コード例 #1
0
ファイル: Calendar.php プロジェクト: hukumonline/admin
 function save($aData)
 {
     if (empty($aData['guid'])) {
         throw new Zend_Exception('Guid can not be EMPTY!');
     }
     $guid = $aData['guid'];
     $cid = isset($aData['cid']) ? $aData['cid'] : '';
     $doe = $aData['dateOfEvent'];
     $title = $aData['title'];
     $text = $aData['text'];
     $starttime = $aData['starttime'];
     $endtime = $aData['endtime'];
     $tblcalendar = new App_Model_Db_Table_Calendar();
     $rowcalendar = $tblcalendar->find($cid)->current();
     if ($rowcalendar) {
         $rowcalendar->uid = $guid;
         $rowcalendar->m = substr($doe, 3, 2);
         $rowcalendar->d = substr($doe, 0, 2);
         $rowcalendar->y = substr($doe, 6, 4);
         $rowcalendar->start_time = $starttime;
         $rowcalendar->end_time = $endtime;
         $rowcalendar->title = $title;
         $rowcalendar->text = $text;
     } else {
         $rowcalendar = $tblcalendar->fetchNew();
         $rowcalendar->uid = $guid;
         $rowcalendar->m = substr($doe, 3, 2);
         $rowcalendar->d = substr($doe, 0, 2);
         $rowcalendar->y = substr($doe, 6, 4);
         $rowcalendar->start_time = $starttime;
         $rowcalendar->end_time = $endtime;
         $rowcalendar->title = $title;
         $rowcalendar->text = $text;
     }
     $result = $rowcalendar->save();
 }
コード例 #2
0
ファイル: EventController.php プロジェクト: hukumonline/admin
 function editpostingAction()
 {
     $zl = Zend_Registry::get("Zend_Locale");
     if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('eventcalendar', 'all')) {
         $this->_redirect(ROOT_URL . '/' . $zl->getLanguage() . '/error/restricted');
     }
     $r = $this->getRequest();
     $pid = $r->getParam('pid');
     $tblcalendar = new App_Model_Db_Table_Calendar();
     $rowedit = $tblcalendar->find($pid)->current();
     $day = $rowedit->d;
     if ($day < 10) {
         $day = 0 . $day;
     }
     $month = $rowedit->m;
     if ($month < 10) {
         $month = 0 . $month;
     }
     $year = $rowedit->y;
     $this->view->dateOfEvent = $day . '-' . $month . '-' . $year;
     $this->view->title = $rowedit->title;
     $this->view->text = $rowedit->text;
     $this->view->starttime = $rowedit->start_time;
     $this->view->endtime = $rowedit->end_time;
     $this->view->pid = $pid;
     if ($r->isPost()) {
         $aData = $r->getParams();
         $aData['guid'] = $this->_user->kopel;
         try {
             $hol = new Pandamp_Core_Hol_Calendar();
             $hol->save($aData);
             $this->_redirect(ROOT_URL . "/" . $zl->getLanguage() . "/calendar/event/openposting/pid/" . $pid);
         } catch (Exception $e) {
             throw new Zend_Exception($e->getMessage());
         }
     }
     $this->_helper->layout()->headerTitle = "Event Calendar";
 }