コード例 #1
0
 function saveAction()
 {
     $request = $this->getRequest();
     $aData = $request->getParams();
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         echo "{success:false, error:'You are not login or your session is expired. Please login.'}";
         die;
     } else {
         $aData['guid'] = $auth->getIdentity()->guid;
     }
     try {
         $hol = new Pandamp_Core_Hol_Calendar();
         $hol->save($aData);
         $response['success'] = true;
         $response['message'] = "EventCalendar is successfully saved";
     } catch (Exception $e) {
         $response['success'] = true;
         $response['message'] = $e->getMessage();
     }
     echo Zend_Json::encode($response);
 }
コード例 #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";
 }