public function fetchEventCalendarAction() { $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $lang['days'] = array("Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"); $lang['months'] = array("Januari", "Februari", "Maret", "April", "May", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"); $modelCalendar = new Pandamp_Modules_Misc_Agenda_Model_Calendar(); $rowset = $modelCalendar->fetchCalendar($start, $end); $num_rows = $modelCalendar->getCountCalendar(); $a = array(); $a['totalCount'] = $num_rows; $i = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $a['calendar'][$i]['guid'] = $row->id; $a['calendar'][$i]['title'] = stripslashes($row->title); $a['calendar'][$i]['body'] = stripslashes(str_replace("\n", "<br />", $row->text)); $a['calendar'][$i]['author'] = "Posted by : " . $row->username; if (!($row->start_time == "55:55:55" && $row->end_time == "55:55:55")) { if ($row->start_time == "55:55:55") { $starttime = "- -"; } else { $starttime = $row->stime; } if ($row->end_time == "55:55:55") { $endtime = "- -"; } else { $endtime = $row->etime; } $timestr = "{$starttime} - {$endtime}"; } else { $timestr = ""; } $a['calendar'][$i]['timestr'] = $timestr; $d = $row->d; $m = $row->m; $y = $row->y; $dateline = $d . " " . $lang['months'][$m - 1] . " " . $y; $wday = date("w", mktime(0, 0, 0, $m, $d, $y)); $a['calendar'][$i]['dateline'] = $dateline; $a['calendar'][$i]['wday'] = $lang['days'][$wday - 1]; $a['calendar'][$i]['month'] = $m; $a['calendar'][$i]['year'] = $y; $i++; } } if ($a['totalCount'] == 0) { $a['calendar'][0]['guid'] = 'XXX'; $a['calendar'][0]['title'] = "No Data"; $a['calendar'][0]['body'] = "-"; $a['calendar'][0]['author'] = ''; $a['calendar'][0]['timestr'] = ''; $a['calendar'][0]['dateline'] = ''; $a['calendar'][0]['wday'] = ''; $a['calendar'][0]['month'] = ''; $a['calendar'][0]['year'] = ''; } echo Zend_Json::encode($a); }
function delete($guid) { $tblCalendar = new Pandamp_Modules_Misc_Agenda_Model_Calendar(); $rowset = $tblCalendar->find($guid); if (count($rowset)) { $row = $rowset->current(); try { $row->delete(); } catch (Exception $e) { throw new Zend_Exception($e->getMessage()); } } }
function openPostingAction() { $this->_helper->layout()->disableLayout(); $lang['days'] = array("Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"); $lang['months'] = array("Januari", "Februari", "Maret", "April", "May", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"); $pid = $this->_getParam('pid'); $tblCalendar = new Pandamp_Modules_Misc_Agenda_Model_Calendar(); $row = $tblCalendar->openPosting($pid); $d = $row[0]['d']; $m = $row[0]['m']; $y = $row[0]['y']; $dateline = $d . " " . $lang['months'][$m - 1] . " " . $y; $wday = date("w", mktime(0, 0, 0, $m, $d, $y)); $this->view->dateline = $dateline; $this->view->wday = $lang['days'][$wday - 1]; // write posting $rowposting = $tblCalendar->writePosting($pid); $title = stripslashes($rowposting[0]['title']); $body = stripslashes(str_replace("\n", "<br />", $rowposting[0]['text'])); $postedby = "Posted by : " . $rowposting[0]['username']; if (!($rowposting[0]["start_time"] == "55:55:55" && $rowposting[0]["end_time"] == "55:55:55")) { if ($rowposting[0]["start_time"] == "55:55:55") { $starttime = "- -"; } else { $starttime = $rowposting[0]["stime"]; } if ($rowposting[0]["end_time"] == "55:55:55") { $endtime = "- -"; } else { $endtime = $rowposting[0]["etime"]; } $timestr = "{$starttime} - {$endtime}"; } else { $timestr = ""; } $this->view->title = $title; $this->view->body = $body; $this->view->postedby = $postedby; $this->view->timestr = $timestr; $this->view->pid = $pid; $this->view->month = $m; $this->view->year = $y; }
function editpostAction() { $pid = $this->_getParam('pid'); $tblcalendar = new Pandamp_Modules_Misc_Agenda_Model_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; }
/** * getEventDataArray * @param $month, $year */ function getEventDataArray($month, $year) { $eventdata = array(); $tblCalendarMsgs = new Pandamp_Modules_Misc_Agenda_Model_Calendar(); $sql = $tblCalendarMsgs->EventDateCalendar($month, $year); foreach ($sql as $sqlDB) { $eventdata[$sqlDB->d]["id"][] = $sqlDB->id; if (strlen($sqlDB->title) > TITLE_CHAR_LIMIT) { $eventdata[$sqlDB->d]["title"][] = substr(stripslashes($sqlDB->title), 0, TITLE_CHAR_LIMIT) . "..."; } else { $eventdata[$sqlDB->d]["title"][] = stripslashes($sqlDB->title); } if (!($sqlDB->start_time == "55:55:55" && $sqlDB->end_time == "55:55:55")) { if ($sqlDB->start_time == "55:55:55") { $starttime = "- -"; } else { $starttime = $sqlDB->stime; } if ($sqlDB->end_time == "55:55:55") { $endtime = "- -"; } else { $endtime = $sqlDB->etime; } $timestr = "<div align=\"right\" class=\"time_str\">({$starttime} - {$endtime}) </div>"; } else { $timestr = "<br>"; } $eventdata[$sqlDB->d]["timestr"][] = $timestr; } return $eventdata; }