public function indexAction() { // params $limit = 3; // model $destinationDb = new Model_DbTable_Destination(); $newsDb = new Model_DbTable_News(); $eventDb = new Model_DbTable_Event(); // data $latestculture = $destinationDb->getLatestPost($limit); $latestdraft = $destinationDb->getLatestDraft($limit); $latestnews = $newsDb->getLatestPost($limit); $latestnewsdraft = $newsDb->getLatestPost($limit); $latestevent = $eventDb->getLatestPost($limit); $latesteventdraft = $eventDb->getLatestDraft($limit); $messages = $this->_helper->flashMessenger->getMessages(); // view $this->view->latestdraft = $latestdraft; $this->view->latestculture = $latestculture; $this->view->latestnews = $latestnews; $this->view->latestnewsdraft = $latestnewsdraft; $this->view->latestevent = $latestevent; $this->view->latesteventdraft = $latesteventdraft; $this->view->messages = $messages; }
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: event * Desc: Fungsi untuk menampilkan detail international event */ public function viewAction() { // Param $id = $this->_getParam('id'); // Model $eventDb = new Model_DbTable_Event(); // Data $event = $eventDb->getAllWithDescById($id, 1); // View $this->view->event = $event[0]; }
public function eventWidget($limit, $show_thumbnails = false, $side_space = true) { $languageId = Zend_Registry::get('languageId'); $cache = Zend_Registry::get('cache'); if (($widget = $cache->load('widget_event')) === false) { $title = $this->view->translate('recent_events'); $tbl_event = new Model_DbTable_Event(); $events = $tbl_event->getEventLatestByIdLang($languageId, null, $limit); $list = "<ul>"; $thumbnails = ''; foreach ($events as $event) { $urlFormat = $this->view->makeUrlFormat($event['name']); $link = $this->view->baseUrl("event/detail/{$event['event_id']}/{$urlFormat}"); if ($show_thumbnails) { $source = 'default.jpg'; $image_dir = UPLOAD_FOLDER . 'event/'; $width = 50; $height = 50; $quality = 100; if (file_exists($image_dir . $event['main_pics']) && !empty($event['main_pics'])) { $source = "upload/event/{$event['main_pics']}"; } $thumb = $this->view->imageUrl("timthumb.php?src={$source}&w={$width}&h={$height}&q={$quality}"); $thumbnails = "<img class='thumbnail' src='{$thumb}' alt='{$event['name']}' />"; } $list .= "<li>{$thumbnails}<a href='{$link}'><span class='desc'>{$event['name']}</span></a></li>"; } $list .= "</ul>"; $list .= "<div class='clear'></div>"; if ($side_space) { $side_space_class = 'side-space'; } $widget = <<<HTML <div class="widget-half-list {$side_space_class}"> <h2>{$title}</h2> {$list} </div> HTML; $cache->save($widget); } return $widget; }
/** * IS: - * FS: Mengirimkan ke viewer: destination, news, event, destSearchForm, * activitySearchForm, highlight, video * Desc: Fungsi untuk menampilkan halaman depan */ public function indexAction() { $this->_helper->layout->setLayout('kebudayaan'); // Form $destSearchForm = new Form_DestSearchHomeForm(); $activitySearchForm = new Form_ActivitySearchHomeForm(); $destSearchForm->setNameLabel($this->view->translate('name')); // Model $destinationDb = new Model_DbTable_Destination(); $eventDb = new Model_DbTable_Event(); $highlightDb = new Model_DbTable_Highlight(); // $videoModel = new Model_Video; $galleryModel = new Model_DbTable_Image(); // Data $galleryHeader = $highlightDb->getGalleryHeader(); $featured_culture = $destinationDb->getFeaturedCulture($this->_languageId, 4); //generate news $news = $this->news->getLastNews($this->_languageId, 4); $event = $eventDb->getFourClosestEvent($this->_languageId); $highlightMed = $highlightDb->getMainType(2, $this->_languageId); // $videos = $videoModel->getMostViewedVideos($startIndexVideo, $maxResultVideo); $latestImage = $galleryModel->getTenLastImage(1, false, true); $this->view->activeHeaders = $highlightDb->getActiveHeaders(); // Passing ke view $this->view->galleryHeader = $galleryHeader; $this->view->latestImage = $latestImage; $this->view->featured_culture = $featured_culture; $this->view->news = $news->toArray(); $this->view->event = $event; $this->view->destSearchForm = $destSearchForm; $this->view->useFeaturedSlideshow = true; $this->view->featuredCulture = $featured_culture; $this->view->activitySearchForm = $activitySearchForm; $this->view->highlight = $highlightMed; // $this->view->videos = $videos; $this->view->languageID = $this->_languageId; $this->view->useGoogleExperiment = true; $this->view->langId = $this->_languageId; $this->view->homepage = true; $this->view->figures = $this->figure->findAll($this->_languageId, 2)->toArray(); }
/** * IS: - * FS: Mengirimkan ke viewer: destination, news, event, destSearchForm, * activitySearchForm, highlight, video * Desc: Fungsi untuk menampilkan halaman depan */ public function indexAction() { $this->_helper->layout->setLayout('kebudayaan'); // Model $destinationDb = new Model_DbTable_Destination(); $eventDb = new Model_DbTable_Event(); $highlightDb = new Model_DbTable_Highlight(); // $videoModel = new Model_Video; $galleryModel = new Model_DbTable_Image(); // Data $galleryHeader = $highlightDb->getGalleryHeader(); $featured_culture = $destinationDb->getFeaturedCulture($this->_languageId, 4); //generate news $news = $this->news->getLastNews($this->_languageId, 4); $event = $eventDb->getFourClosestEvent($this->_languageId); $highlightMed = $highlightDb->getMainType(2, $this->_languageId); // $videos = $videoModel->getMostViewedVideos($startIndexVideo, $maxResultVideo); $latestImage = $galleryModel->getTenLastImage(1, false, true); $activeHeaders = $highlightDb->getActiveHeaders($this->_languageId); if (count($activeHeaders) == 0) { $activeHeaders = $highlightDb->getActiveHeaders(); } $this->view->activeHeaders = $activeHeaders; // Passing ke view $this->view->galleryHeader = $galleryHeader; $this->view->latestImage = $latestImage; $this->view->featured_culture = $featured_culture; $this->view->news = $news->toArray(); $this->view->event = $event; $this->view->useFeaturedSlideshow = true; $this->view->featuredCulture = $featured_culture; $this->view->highlight = $highlightMed; // $this->view->videos = $videos; $this->view->languageID = $this->_languageId; $this->view->useGoogleExperiment = true; $this->view->langId = $this->_languageId; $this->view->homepage = true; $this->view->figures = $this->figure->findAll($this->_languageId, 2)->toArray(); $this->view->headMeta()->appendName('keywords', join(', ', $this->_meta)); $this->view->headMeta()->appendName('description', "kebudayaanindonesia.net adalah laman referensi kebudayaan Indonesia untuk mewujudkan bangsa Indonesia yang cerdas dan berbudaya"); }
public function deleteAction() { $this->_helper->viewRenderer->setNoRender(); $id = $this->_getParam('id'); if (null != $id) { $event = $this->event->find($id)->current(); if (null != $event) { if ($event->status != self::STATUS_ARCHIVED) { $event->setFromArray(array('status' => self::STATUS_ARCHIVED))->save(); $this->loggingaction('Event', 'Archive', $id, self::LANGUAGE_ID); $this->_helper->flashMessenger->addMessage('Kegiatan dipindahkan ke arsip.'); } else { $event->delete(); $this->loggingaction('Event', 'Delete', $id, self::LANGUAGE_ID); $this->_helper->flashMessenger->addMessage('Kegiatan berhasil dihapus.'); } } } $this->_helper->redirector('index'); }
public function eventpagingAction() { $this->_helper->layout->disableLayout(); /* disable layout */ $this->_helper->viewRenderer->setNoRender(true); /* supaya tidak render view */ $limit = $this->_getParam(urldecode('paramLimit')); $offset = $this->_getParam(urldecode('paramOffset')); $param = $this->_getParam(urldecode('paramKey')); $generateEvent = new Model_DbTable_Event(); $getResultEvent = $generateEvent->searchEventBaru($param, $limit, $offset, $this->_languageId); //$getResultEvent = $generateEvent->searchEvent($param,$limit,$offset,$this->_languageId); $data['result'] = ''; foreach ($getResultEvent as $rowEvent) { $title = $this->view->boldStyle(strtolower($rowEvent['name']), $param); $data['result'] .= '<li>'; $data['result'] .= '<a href="' . $this->_request->getBaseUrl() . '/' . $this->lang . '/event/detail/' . $rowEvent['event_id'] . '/' . $this->view->makeUrlFormat($rowEvent['name']) . '" title="' . $rowEvent['name'] . '">' . ltrim($title) . '</a>'; $data['result'] .= '<br /><br />' . substr(strip_tags($this->view->htmlDecode($rowEvent['description'])), 0, 225) . ' ...'; $data['result'] .= '</li>'; } /* - - - - - - - - - - - link pages - - - - - - - - - - - - - - - - -*/ $action_query = $this->_getParam(urldecode('actionQuery')); switch ($action_query) { case 'next': $curpageEvent = $this->_getParam(urldecode('paramPage')) + 1; break; case 'prev': $curpageEvent = $this->_getParam(urldecode('paramPage')) - 1; break; default: $curpageEvent = $this->_getParam(urldecode('paramPage')) + 1; break; } $num_linkEvent = NUM_LINKS; $per_pageEvent = $limit; $getTotalEvent = $generateEvent->numbRowsEvent($param, $this->_languageId); $num_pageEvent = ceil($getTotalEvent / $limit); $startEvent = $curpageEvent - $num_linkEvent > 0 ? $curpageEvent - ($num_linkEvent - 1) : 1; $endEvent = $curpageEvent + $num_linkEvent < $num_pageEvent ? $curpageEvent + $num_linkEvent : $num_pageEvent; $data['start'] = $startEvent; $data['end'] = $endEvent; $data['per_pages'] = $per_pageEvent; $data['cur_pages'] = $curpageEvent; $data['all_page'] = $getTotalEvent; /* - - - - - - - - - - - end link pages - - - - - - - - - - - - - - -*/ $data['offset'] = $offset + $limit; $data['curpages'] = $curpageEvent; echo json_encode($data); }
public function contentfactoryAction() { if ($this->getRequest()->getActionName() != 'deny') { $pass = false; $session = new Zend_Session_Namespace('login'); if ($session->user) { if ($session->user->isCommunityAdmin()) { $pass = true; } } if (!$pass) { $this->forward('deny', 'misc', 'common'); } } $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']), 'https') === FALSE ? 'http' : 'https'; $this->view->domain = $protocol . '://' . $_SERVER['HTTP_HOST']; $classified = new Model_DbTable_Classified_Classified(); $this->view->classifieds = $classified->search($this->_request, 5); $criteria = new Model_Contracts_EventCriteria(); $criteria->start = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $criteria->end = mktime(0, 0, 0, date("m") + 11, date("d"), date("Y")); $criteria->limit = 5; $event = new Model_DbTable_Event(); $this->view->events = $event->getPlatformEvents($criteria); $libraryArray = array(); $proclib = new Model_Proclib(); $q = "SELECT ID,Name from nccs_links.LINKS WHERE platform = '" . $_SESSION['dbstate'] . "' AND isDeleted = '0' AND Publish = 'Y' AND (GroupID < 1 || GroupID IS NULL) AND (ProjectID < 1 || ProjectID IS NULL) AND (GroupEdit LIKE '' or GroupEdit IS NULL) ORDER BY IFNULL(`ChangedDate`, `AddedDate`) DESC limit 5"; $results = $proclib->runSql($q); $numRecs = mysql_num_rows($results); $numRecs = $numRecs > 5 ? 5 : $numRecs; for ($i = 0; $i < $numRecs; $i++) { array_push($libraryArray, mysql_fetch_array($results)); } $this->view->libraryitems = $libraryArray; $suggestedArray = array(); $proclib = new Model_Proclib(); $q = "SELECT l.ID,l.Name from nccs_links.LINKS as l LEFT JOIN communityneeds.taggeditem as t ON t.KnowledgebaseId = l.ID WHERE t.tagId = 2189 AND l.isDeleted = '0' AND l.Publish = 'Y' AND (l.GroupID < 1 || l.GroupID IS NULL) AND (l.ProjectID < 1 || l.ProjectID IS NULL) AND (l.GroupEdit LIKE '' or l.GroupEdit IS NULL)ORDER BY IFNULL(`ChangedDate`, `AddedDate`) DESC limit 5"; $results = $proclib->runSql($q); $numRecs = mysql_num_rows($results); $numRecs = $numRecs > 5 ? 5 : $numRecs; for ($i = 0; $i < $numRecs; $i++) { array_push($suggestedArray, mysql_fetch_array($results)); } $this->view->suggesteditems = $suggestedArray; $this->view->organizations1 = array(); if ($this->communityConfig->directoryVersion < 1) { $organizationsNoEin = new Model_DbTable_OrganizationNoEin(); $organizationsNoEinArray = $organizationsNoEin->getRecentlyUpdatedOrganizations(3); $organizationsAllEin = new Model_DbTable_Organization(); $organizationsAllEinArray = $organizationsAllEin->getRecentlyUpdatedOrganizations(3); $organizations = array_merge($organizationsNoEinArray, $organizationsAllEinArray); foreach ($organizations as $key => $row) { $date[$key] = $row['date']; } array_multisort($date, SORT_DESC, $organizations); $this->view->organizations1 = $organizations; } else { $organizations = new Model_DbTable_OrganizationNoEinExtended(); $this->view->organizations2 = $organizations->getRecentlyUpdatedOrganizations(5); } }
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: form, date_view, show_clock, event_time, * event_id * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { //set parameter $language_id = $this->_getParam('lang'); $event_id = $this->_getParam('id'); //creating instance $form = new Admin_Form_EventForm(); $form->setCategorySelectData(); $table_event = new Model_DbTable_Event(); $table_event_description = new Model_DbTable_EventDesc(); $table_poitoevent = new Model_DbTable_PoiToEvent(); //if this is a post request if ($this->getRequest()->isPost()) { //preparing data and update for event description $event_name = htmlspecialchars($_POST['eventName'], ENT_QUOTES); $event_description = htmlspecialchars($_POST['eventDescription'], ENT_QUOTES); if ($language_id == 1) { $indo = $table_event_description->checkForIndo($event_id, 1); if ($indo) { $data = array('event_id' => $event_id, 'language_id' => $language_id, 'name' => $event_name, 'description' => $event_description); $table_event_description->updateEvent($data, $event_id, $language_id); } else { $data2 = array('event_id' => $event_id, 'language_id' => $language_id, 'name' => $event_name, 'description' => $event_description); $table_event_description->insertEvent($data2); } } else { if ($_POST['dateStart'] == $_POST['dateEnd']) { $startdate = $_POST['dateStart'] . ' ' . $_POST['timeStart'] . ':00'; $enddate = $_POST['dateStart'] . ' ' . $_POST['timeEnd'] . ':00'; } else { $startdate = $_POST['dateStart'] . ' ' . $_POST['timeStart'] . ':00'; $enddate = $_POST['dateEnd'] . ' ' . $_POST['timeEnd'] . ':00'; } //preparing data and update for event table $data = array('main_pics' => $_POST['eventImage'], 'date_start' => $startdate, 'date_end' => $enddate, 'category' => $_POST['mainCategory']); $table_event->updateEvent($data, $event_id); $data = array('event_id' => $event_id, 'language_id' => $language_id, 'name' => $event_name, 'description' => $event_description); $table_event_description->updateEvent($data, $event_id, $language_id); $poi_count = $_POST['poiMax']; $poiarr = array(); for ($i = 0; $i <= $poi_count; $i++) { if ($_POST['poiValue' . $i] != '') { array_push($poiarr, $_POST['poiValue' . $i]); } } //create poi related to event list $saved_poitoevent = array(); $saved_list = $table_poitoevent->getAllPoiNameByEventId($event_id); //convert to a non ASSOC array foreach ($saved_list as $list) { array_push($saved_poitoevent, $list['poi_id']); } //compare the new list with the new one, if the new one doesnt exist then insert then new one foreach ($poiarr as $poi_new) { if (!in_array($poi_new, $saved_poitoevent)) { $data = array('event_id' => $event_id, 'poi_id' => $poi_new); $table_poitoevent->insertEvent($data); } } //do the complementary process, if the old one doesnot exist in the new list then delete the old ones foreach ($saved_poitoevent as $poi_old) { if (!in_array($poi_old, $poiarr)) { if ($poi_old != '') { $table_poitoevent->deleteEvent($event_id, $poi_old); } } } } //preparing data for updating the poi to event data $this->loggingaction('event', 'edit', $event_id, $language_id); $this->_flash->addMessage("1\\Event Update Success!"); $this->_redirect($this->view->rootUrl('/admin/eventindo/')); } if ($language_id == 1) { $indo = $table_event_description->checkForIndo($event_id, $language_id); if ($indo) { $saved_list = $table_poitoevent->getAllPoiNameByEventId($event_id, $language_id); } } else { $saved_list = $table_poitoevent->getAllPoiNameByEventId($event_id, $language_id); } //data processing $event_data = $table_event->getAllWithDescById($event_id, $language_id); $event_name = $this->view->HtmlDecode($event_data[0]['name']); $event_description = $this->view->HtmlDecode($event_data[0]['description']); $poiCount = $table_poitoevent->countRelatedPoiByEventId($event_id); $datetime_start = explode(' ', $event_data[0]['date_start']); $datetime_end = explode(' ', $event_data[0]['date_end']); //set form element value $form->eventName->setValue($event_name); $form->eventDescription->setValue($event_description); $form->eventImage->setValue($event_data[0]['main_pics']); $form->dateEnd->setValue($datetime_end[0]); $form->dateStart->setValue($datetime_start[0]); $form->timeStart->setValue(substr($datetime_start[1], 0, 5)); $form->timeEnd->setValue(substr($datetime_end[1], 0, 5)); $form->mainCategory->setValue($event_data[0]['category']); $form->poiMax->setValue($poiCount); if ($datetime_start[0] == $datetime_end[0]) { $this->view->date_view = $datetime_start[0] . ' one day event'; $this->view->show_clock = TRUE; } else { $this->view->date_view = $datetime_start[0] . ' until ' . $datetime_end[0]; $this->view->show_clock = FALSE; } $this->view->event_time = array($datetime_start[1], $datetime_end[1]); $this->view->event_id = $event_id; $this->view->form = $form; $this->view->langId = $language_id; }
public function rssAction() { // Tidak pake layout $this->_helper->layout->disableLayout(); // Model $eventDb = new Model_DbTable_Event(); $lang_id = $this->_languageId; // Data $eventQuery = $eventDb->getAllWithDescForRss($lang_id, 10); $event = $eventDb->fetchAll($eventQuery); for ($i = 0; $i < count($event); $i++) { $string = $event[$i]['name']; $string = str_replace('“', ' ', $string); $string = str_replace('”', ' ', $string); $string = str_replace('�', ' ', $string); $string = str_replace('�', ' ', $string); $news[$i]['name'] = $this->xmlEntities(htmlentities($string, ENT_QUOTES)); $string = $event[$i]['description']; $string = str_replace('“', ' ', $string); $string = str_replace('”', ' ', $string); $string = str_replace('�', ' ', $string); $string = str_replace('�', ' ', $string); $news[$i]['description'] = $this->xmlEntities(htmlentities($news[$i]['content'], ENT_QUOTES)); } $this->view->data = $event; }
$this->_helper->viewRenderer->setNoRender(true); // Param $poiId = $this->_getParam('poiId'); // Model $destinationDb = new Model_DbTable_Destination(); // Data $destination = $destinationDb->getWithDescForMapByPoiId($poiId, $this->_languageId); $destinationData = $this->_createArrayDestination($destination); echo json_encode($destinationData); } /** * IS: * FS: * Desc: Fungsi AJAX untuk mendapatkan koordinate dari area * * @return bentuk JSON dari koordinate */
if ($type == 'destination') { $type = 'culture'; } $folder = $type . '/'; // Handle image upload or display list of image based on type if ($this->getRequest()->isPost()) { $this->_helper->viewRenderer->setNoRender(); $ftp = new Zend_File_Transfer_Adapter_Http(); $file = pathinfo($ftp->getFileName()); $ftp->setDestination(UPLOAD_FOLDER . $folder); $ftp->addFilter('Rename', UPLOAD_FOLDER . $folder . '/' . $file['filename'] . '_' . rand(1, 100) . '_' . time() . '.' . $file['extension']); $ftp->addValidator(new Zend_Validate_File_Extension('jpg,png')); $ftp->receive(); } else {
{ if ($path != '') { $fp = fopen($path, 'w'); fwrite($fp, $data); fclose($fp); } } /* * Fungsi untuk membaca isi file gz * @param : (string)full path file * return string / array * */ protected function readGZ($path = '') { if ($path != '') { ob_start(); $data = file_get_contents($path); $uncompressed = gzuncompress(trim($data)); ob_end_flush(); return $uncompressed; } } /** * get event humanDate json data used by eventCalendar * * @return json */ public function eventdataAction() { // only accept ajax request if ($this->getRequest()->isXmlHttpRequest() || true) { // disable layout and render $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); // set response content-type to json $this->_response->setHeader("content-type", "application/json"); // for view helpers $view = $this->view;
{ if ($path != '') { $fp = fopen($path, 'w'); fwrite($fp, $data); fclose($fp); } } /* * Fungsi untuk membaca isi file gz * @param : (string)full path file * return string / array * */ protected function readGZ($path = '') { if ($path != '') { ob_start(); $data = file_get_contents($path); $uncompressed = gzuncompress(trim($data)); ob_end_flush(); return $uncompressed; } } /** * get event humanDate json data used by eventCalendar * * @return json */ public function eventdataAction() { // only accept ajax request if ($this->getRequest()->isXmlHttpRequest()) { // disable layout and render $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); // set response content-type to json