コード例 #1
0
ファイル: Application.php プロジェクト: IASA-GR/appdb-core
 public function save()
 {
     parent::save();
     if ($this->moderated) {
         if ($this->_modInfo !== null) {
             $this->_modInfo->save();
         }
     } else {
         $mis = new Default_Model_AppModInfos();
         $mis->filter->id->equals($this->id);
         if (count($mis->items) > 0) {
             $tmp = $mis->items[0];
             $mis->remove($tmp);
         }
     }
     if ($this->deleted) {
         if ($this->_delInfo !== null) {
             $this->_delInfo->save();
         }
     } else {
         $dis = new Default_Model_AppDelInfos();
         $dis->filter->id->equals($this->id);
         if (count($dis->items) > 0) {
             $tmp = $dis->items[0];
             $dis->remove($tmp);
         }
     }
 }
コード例 #2
0
ファイル: AppsController.php プロジェクト: IASA-GR/appdb-core
 public function deleteAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     if ($this->session->userid !== null) {
         $users = new Default_Model_Researchers();
         $users->filter->id->equals($this->session->userid);
         $user = $users->items[0];
         $apps = new Default_Model_Applications();
         $apps->filter->id->equals($_POST['id']);
         $apps->refresh();
         if ($user->privs->canDeleteApplication($apps->items[0])) {
             $app = $apps->items[0];
             $app->deleted = true;
             $app->name = $app->name . '-DELETED-' . $app->guid;
             $app->save();
             $delinfos = new Default_Model_AppDelInfos();
             $delinfo = new Default_Model_AppDelInfo();
             $delinfo->appID = $_POST['id'];
             $delinfo->deletedBy = $this->session->userid;
             $delinfos->add($delinfo);
         }
     }
 }