/** * Constructor * * @since 0.9 */ function __construct() { parent::__construct(); // Register Extra task $this->registerTask('eventimgup', 'uploadimage'); $this->registerTask('venueimgup', 'uploadimage'); }
/** * logic to create the edit venue view * * @access public * @return void * @since 0.9 */ function edit() { JRequest::setVar('view', 'settings'); parent::display(); $model = $this->getModel('settings'); $model->checkout(); }
/** * Constructor * * @since 0.9 */ function __construct() { parent::__construct(); // Register Extra task $this->registerTask('cleaneventimg', 'delete'); $this->registerTask('cleanvenueimg', 'delete'); }
/** * logic to create the edit event screen * * @access public * @return void * @since 0.9 */ function edit() { JRequest::setVar('view', 'group'); JRequest::setVar('hidemainmenu', 1); $model = $this->getModel('group'); $user =& JFactory::getUser(); // Error if checkedout by another administrator if ($model->isCheckedOut($user->get('id'))) { $this->setRedirect('index.php?option=com_eventlist&view=groups', JText::_('EDITED BY ANOTHER ADMIN')); } $model->checkout(); parent::display(); }
/** * Constructor * *@since 0.9 */ function __construct() { parent::__construct(); }
function csvcategoriesimport() { $replace = JRequest::getVar('replace_cats', 0, 'post', 'int'); $object =& JTable::getInstance('eventlist_categories', ''); $object_fields = get_object_vars($object); $msg = ''; if ($file = JRequest::getVar('Filecats', null, 'files', 'array')) { $handle = fopen($file['tmp_name'], 'r'); if (!$handle) { $msg = JText::_('Cannot open uploaded file.'); $this->setRedirect('index.php?option=com_eventlist&view=import', $msg, 'error'); return; } // get fields, on first row of the file $fields = array(); if (($data = fgetcsv($handle, 1000, ',', '"')) !== FALSE) { $numfields = count($data); for ($c = 0; $c < $numfields; $c++) { // here, we make sure that the field match one of the fields of eventlist_venues table or special fields, // otherwise, we don't add it if (array_key_exists($data[$c], $object_fields)) { $fields[$c] = $data[$c]; } } } // If there is no validated fields, there is a problem... if (!count($fields)) { $msg .= "<p>Error parsing column names. Are you sure this is a proper csv export ?<br />try to export first to get an example of formatting</p>\n"; $this->setRedirect('index.php?option=com_eventlist&view=import', $msg, 'error'); return; } else { $msg .= "<p>" . $numfields . " fields found in first row</p>\n"; $msg .= "<p>" . count($fields) . " fields were kept</p>\n"; } // Now get the records, meaning the rest of the rows. $records = array(); $row = 1; while (($data = fgetcsv($handle, 10000, ',', '"')) !== FALSE) { $num = count($data); if ($numfields != $num) { $msg .= "<p>Wrong number of fields ({$num}) line {$row}<br /></p>\n"; } else { $r = array(); // only extract columns with validated header, from previous step. foreach ($fields as $k => $v) { $r[] = $this->_formatcsvfield($v, $data[$k]); } $records[] = $r; } $row++; } fclose($handle); $msg .= "<p>total records found: " . count($records) . "<br /></p>\n"; // database update if (count($records)) { $model = $this->getModel('import'); $result = $model->categoriesimport($fields, $records, $replace); $msg .= "<p>total added records: " . $result['added'] . "<br /></p>\n"; $msg .= "<p>total updated records: " . $result['updated'] . "<br /></p>\n"; } $this->setRedirect('index.php?option=com_eventlist&view=import', $msg); } else { parent::display(); } }
$user = $session->getUser(); $eventDAO = EventDAO::getInstance(); $page = isset($_GET["page"]) && is_numeric($_GET["page"]) ? intval($_GET["page"]) : 1; $platform_id = isset($_GET["platform"]) && is_numeric($_GET["platform"]) ? intval($_GET["platform"]) : 0; if ($page < 1) { $page = 1; } $count = $paginator = $paginator_page = $queryVars = $current_platform = null; if ($platform_id <= 0) { $count = $eventDAO->countStatus(Event::APPROVED_STATUS); $paginator = new Paginator($count, $PAGINATION_LIMIT); $paginator_page = $paginator->getPage($page); $event_array = $eventDAO->allByStatus(Event::APPROVED_STATUS, array("order" => "{$eventDAO->getTableName()}.date DESC, {$eventDAO->getTableName()}.id DESC", "joins" => true, "limit" => $paginator_page)); } else { $count = $eventDAO->countPlatformStatus($platform_id, Event::APPROVED_STATUS); $paginator = new Paginator($count, $PAGINATION_LIMIT); $paginator_page = $paginator->getPage($page); $event_array = $eventDAO->allByPlatformStatus($platform_id, Event::APPROVED_STATUS, array("order" => "{$eventDAO->getTableName()}.date DESC, {$eventDAO->getTableName()}.id DESC", "joins" => true, "limit" => $paginator_page)); $queryVars = array("platform" => $platform_id); } $platformDAO = PlatformDAO::getInstance(); $platform_array = $platformDAO->all(); //print_r ($event_array); if ($platform_id > 0) { $current_platform = $platformDAO->load($platform_id); } $this->template->render(array("title" => "Event List", "main_page" => "event_list_tpl.php", "event_array" => $event_array, "session" => $session, "paginator_page" => $paginator_page, "sidebar_extra" => joinPath("fragments", "event_sidebar_tpl.php"), "platform_array" => $platform_array, "queryVars" => $queryVars, "current_platform" => $current_platform)); } } $controller = new EventListController(); $controller->run();