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.     // Set/Get current Application
  32.     $id array_rand($applications);
  33.     $admin->perm->setCurrentApplication($applications[$id]['application_id']);
  34.     $currentApp $admin->perm->getCurrentApplication();
  35.     echo '<strong>'.$currentApp.'</strong> is our current application now.<br />';
  36.  
  37.     // Remove
  38.     $id array_rand($applications);
  39.     $filters = array('application_id' => $applications[$id]['application_id']);
  40.     $removeApp $admin->perm->removeApplication($filters);
  41.  
  42.     if ($removeApp === false{
  43.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  44.         print_r($admin->getErrors());
  45.     else {
  46.         echo '<strong>App3</strong> was removed<br />';
  47.         unset($applications[$id]);
  48.     }
  49.  
  50.     // Update
  51.     $id array_rand($applications);
  52.     $data = array('application_define_name' => 'APP2_' $applications[$id]['application_id''updated');
  53.     $filters = array('application_id' => $applications[$id]['application_id']);
  54.     $updateApp $admin->perm->updateApplication($data$filters);
  55.  
  56.     if ($updateApp === false{
  57.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  58.         print_r($admin->getErrors());
  59.     else {
  60.         echo '<strong>App2</strong> was updated<br />';
  61.         $params = array('filters' => array('application_id' => $applications[$id]['application_id']));
  62.         $result $admin->perm->getApplications($params);
  63.  
  64.         if ($result === false{
  65.             echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  66.             print_r($admin->getErrors());
  67.         elseif (empty($result)) {
  68.             echo 'No applications were found<br />';
  69.         else {
  70.             Var_Dump::display($result);
  71.         }
  72.     }
  73.  
  74.     // Get
  75.     $applications $admin->perm->getApplications();
  76.  
  77.     if ($applications === false{
  78.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  79.         print_r($admin->getErrors());
  80.     elseif (empty($applications)) {
  81.         echo 'No applications were found<br />';
  82.     else {
  83.         echo 'These are our current applications:';
  84.         Var_Dump::display($applications);
  85.         echo '<br />';
  86.     }
  87. }
  88.  
  89. echo '<hr />';

Documentation generated on Mon, 11 Mar 2019 14:16:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.