Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. <?php
  2. #in uis_script.php (controller)
  3. public function dynDeleteUISScript($script_id) {
  4.     $objResponse       = new xajaxResponse();
  5.  
  6.     $script            = new UnattendedScript();
  7.     $script->getScriptbyId($script_id);
  8.  
  9.     $memotable_dbh     = new DbObject('UIS_script_memotable');
  10.     $memotable_dbh->id = $this->memo_id;
  11.     $remove_element    = $script_id . "_row";
  12.  
  13.     if ( $script->dbh->delete && $memotable_dbh->delete ) {
  14.         $objResponse->remove($remove_element);
  15.         return $objResponse->getXML();
  16.     }
  17.     else {
  18.         ipm_error ( 2,
  19.             "Unable to delete : "
  20.             . $this->script_path
  21.             . ", script id: "
  22.             . $this->script_id );
  23.         return FALSE;
  24.     }
  25. }
  26. ?>
  27. #in view_scripts.php (view)
  28. <?php
  29.     $scripts  = Template::getVar ('scripts');
  30.     $os_level = Template::getVar ('os_level');
  31. ?>
  32.     <h1>Scripts available for <?=$os_level?></h1>
  33. <table>
  34.     <tr>
  35.         <th>Script ID</th>
  36.         <th>Script Path</th>
  37.         <th>Created By</th>
  38.         <th>Last Edited By</th>
  39.         <th>Last Edited At</th>
  40.         <th>Script Type</th>
  41.         <th>CVS Version</th>
  42.         <th>Actions</th>
  43.     </tr>
  44.     <? foreach ( $script AS $scripts ) { ?>
  45.     <tr>
  46.         <td><?=$script->script_id?></td>
  47.         <td><?=$script->script_path?></td>
  48.         <td><?=$script->created_by?></td>
  49.         <td><?=$script->last_edited_by?></td>
  50.         <td><?=$script->last_edited_ts?></td>
  51.         <td><?=$script->cvs_ver?></td>
  52.         <td><? if (hasPerm ("aaisunixadmin")) { ?>
  53.             <a href="?op=EditUISScript&script_id=<?=$script->script_id?>">[Edit]</a>
  54.             <a onClick='ajax("dynDeleteUISScript", <?=$script->script_id?>)' href="#">[Delete]</a>
  55.         </td>
  56.  
  57.     </tr>
  58.     <? } ?>
  59. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement