Advertisement
Guest User

Untitled

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