LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file Application.php

Documentation is available at Application.php

  1. <?php
  2. require_once 'index.php';
  3. echo '<h3>Application</h3>';
  4.  
  5. // Add
  6. for ($i = 1; $i < 4; $i++{
  7.     $data = array('application_define_name' => 'APP'.rand());
  8.     $appId $admin->perm->addApplication($data);
  9.  
  10.     if ($appId === false{
  11.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  12.         print_r($admin->getErrors());
  13.     else {
  14.         echo 'Created Application id <strong>' $appId '</strong><br />';
  15.     }
  16. }
  17.  
  18. // Get
  19. $applications $admin->perm->getApplications();
  20.  
  21. if ($applications === false{
  22.     echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  23.     print_r($admin->getErrors());
  24. elseif (empty($applications)) {
  25.     echo 'No applications were found, thus we\'ve halted the rest of the test<br />';
  26. else {
  27.     echo 'These are our current applications:';
  28.     Var_Dump::display($applications);
  29.     echo '<br />';
  30.  
  31.     // Remove
  32.     $id array_rand($applications);
  33.     $filters = array('application_id' => $applications[$id]['application_id']);
  34.     $removeApp $admin->perm->removeApplication($filters);
  35.  
  36.     if ($removeApp === false{
  37.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  38.         print_r($admin->getErrors());
  39.     else {
  40.         echo '<strong>App3</strong> was removed<br />';
  41.         unset($applications[$id]);
  42.     }
  43.  
  44.     // Update
  45.     $id array_rand($applications);
  46.     $data = array('application_define_name' => 'APP2_' $applications[$id]['application_id''updated');
  47.     $filters = array('application_id' => $applications[$id]['application_id']);
  48.     $updateApp $admin->perm->updateApplication($data$filters);
  49.  
  50.     if ($updateApp === false{
  51.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  52.         print_r($admin->getErrors());
  53.     else {
  54.         echo '<strong>App2</strong> was updated<br />';
  55.         $params = array('filters' => array('application_id' => $applications[$id]['application_id']));
  56.         $result $admin->perm->getApplications($params);
  57.  
  58.         if ($result === false{
  59.             echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  60.             print_r($admin->getErrors());
  61.         elseif (empty($result)) {
  62.             echo 'No applications were found<br />';
  63.         else {
  64.             Var_Dump::display($result);
  65.         }
  66.     }
  67.  
  68.     // Get
  69.     $applications $admin->perm->getApplications();
  70.  
  71.     if ($applications === false{
  72.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  73.         print_r($admin->getErrors());
  74.     elseif (empty($applications)) {
  75.         echo 'No applications were found<br />';
  76.     else {
  77.         echo 'These are our current applications:';
  78.         Var_Dump::display($applications);
  79.         echo '<br />';
  80.     }
  81. }
  82.  
  83. echo '<hr />';

Documentation generated on Mon, 11 Mar 2019 15:39:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.