示例#1
0
 function run()
 {
     global $_out;
     if (ap::isCurrentModule($this)) {
         /* локализация */
         ap::translate($this->getSection()->getXML(), array('//@title', '//field[@label]/@label', '//button[@value]/@value', '//rowlist/col[@header]/@header'), PATH_MODULE . __CLASS__ . '/translate.php');
         ap::addMessage($this->getMessage());
         $row = $this->getRow();
         switch ($action = param('action')) {
             case 'delete':
                 if ($row && ($tl = $this->getPackages())) {
                     if (!is_array($row)) {
                         $row = array($row);
                     }
                     foreach ($row as $v) {
                         if ($e = $tl->getById($v)) {
                             $tl->remove($e);
                         }
                     }
                     $tl->getXML()->save();
                     $this->redirect('delete_ok');
                 } else {
                     $this->redirect('delete_fail');
                 }
                 break;
             default:
                 if ($rl = $this->getRowList()) {
                     $_out->elementIncludeTo($rl->getRootElement(), '/page/section');
                 }
         }
     }
 }
示例#2
0
 static function getForm()
 {
     $xml = new xml(PATH_MODULE . __CLASS__ . '/form/add.xml');
     $xml = ap::translate($xml, array('//@title', '//field[@label]/@label', '//button[@value]/@value', '//rowlist/col[@header]/@header'), PATH_MODULE . __CLASS__ . '/translate.php');
     return new form($xml->de());
 }