public function index() { // Breadcrumbs $breadcrumbs = new Breadcrumbs(); $breadcrumbs->add('Home', '/home'); $this->registry->template->breadcrumbs = $breadcrumbs; // Load index model $this->registry->template->model = $this->getModel('selectModule', 'index'); // Show the view $this->registry->template->show('selectModule/smSelect'); }
public function create() { // Breadcrumbs $breadcrumbs = new Breadcrumbs(); $breadcrumbs->add('Home', '/home'); $this->registry->template->breadcrumbs = $breadcrumbs; // Load index model $this->registry->template->model = $this->getModel('journalAdmin', 'create'); // Show the view $this->registry->template->show('journalAdmin/jaCreate'); }
public function error404() { // Breadcrumbs $breadcrumbs = new Breadcrumbs(); $breadcrumbs->add('Home', '/home'); $breadcrumbs->add('Error', ''); $this->registry->template->breadcrumbs = $breadcrumbs; // Load index model $this->registry->template->model = $this->getModel('error', 'error404'); // Show the view $this->registry->template->show('common/sidebarPage'); }
public function taAdmin() { // Breadcrumbs $breadcrumbs = new Breadcrumbs(); $breadcrumbs->add('Home', '/home'); $this->registry->template->breadcrumbs = $breadcrumbs; // Show the view if (isset($_SESSION['username']) && isset($_SESSION['admin']) && $_SESSION['admin'] == true) { // Load index model $this->registry->template->show('userAdmin/taAdmin'); } else { header('Location: ' . __SITE_DIR . '/home'); } }
public static function instance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * action: EDIT */ public function action_edit() { $id = $this->request->param('id'); $content = new Model_Content($id); $type = $content->type; $site = $type == 'page' ? __('Page') : __('Email'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit') . ' ' . $site)); $locale = $content->locale; if ($content->loaded()) { $languages = i18n::get_languages(); $this->template->content = View::factory('oc-panel/pages/content/edit', array('cont' => $content, 'locale' => $languages)); if ($p = $this->request->post()) { foreach ($p as $name => $value) { if ($name != 'submit') { $content->{$name} = $value; } } // if status is not checked, it is not set as POST response $content->status = isset($p['status']) ? 1 : 0; //$content->seotitle = $content->gen_seotitle($this->request->post('title')); try { $content->save(); Cache::instance()->delete_all(); Alert::set(Alert::SUCCESS, $content->type . ' ' . __('is edited')); Request::current()->redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'edit', 'id' => $content->id_content))); } catch (Exception $e) { Alert::set(Alert::ERROR, $e->getMessage()); } } } else { Alert::set(Alert::INFO, __('Faild to load content')); Request::current()->redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'edit')) . '?type=' . $type . '&locale_select=' . $locale); } }
public function actionShow() { $id = $_GET['id']; $auth = Auth::checkAuth(); if ($auth) { $user = Users::findOneByPK($auth); $user->getProfile(); } $courses = Courses::findAllByColumn('parent_id', $id); $view = new View(); $view->user = $user; $view->courses = $courses; // $view->user_login = $user->user_login; // $view->user_group = $user->user_group; $parent_course = Courses::findOneByPK($id); $crumbs = Breadcrumbs::getCrumbs($parent_course); $view->crumbs = $crumbs; $view->page_title = $parent_course->name; $view->display('header.php'); if (isset($id)) { $view->display('courses/child-list.php'); } else { $view->display('courses/list.php'); } $view->display('footer.php'); }
public function action_update() { $name = $this->request->param('id'); $field = new Model_Field(); $field_data = $field->get($name); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit') . ' ' . $name)); $this->template->title = __('Edit Custom Field for Advertisement'); //find all, for populating form select fields list($categories) = Model_Category::get_all(); if ($_POST) { try { $options = array('label' => Core::post('label'), 'tooltip' => Core::post('tooltip'), 'required' => Core::post('required') == 'on' ? TRUE : FALSE, 'searchable' => Core::post('searchable') == 'on' ? TRUE : FALSE); if ($field->update($name, Core::post('values'), Core::post('categories'), $options)) { Cache::instance()->delete_all(); Theme::delete_minified(); Alert::set(Alert::SUCCESS, __('Field edited ' . $name)); Request::current()->redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index'))); } else { Alert::set(Alert::ERROR, __('Field cant be edited' . $name)); } } catch (Exception $e) { throw new HTTP_Exception_500(); } } $this->template->content = View::factory('oc-panel/pages/fields/update', array('field_data' => $field_data, 'name' => $name, 'categories' => $categories)); }
public static function instance() { if (self::$_instance === FALSE) { self::$_instance = new Breadcrumbs(); } return self::$_instance; }
public function action_edit($id) { $term = ORM::factory('category', $id); if (!$term->loaded()) { Message::instance()->set('Invalid category.'); $this->request->redirect('admin/taxonomy'); } if (strtolower(Request::$method) == 'post') { $post = Validate::factory($_POST); $post->rule('title', 'not_empty')->rule('name', 'not_empty'); if ($post->check()) { $term->title = $post["title"]; $term->name = $post["name"]; $term->save(); Message::instance()->set('Category updated.', Message::INFO); $this->request->redirect('admin/taxonomy'); } else { Message::instance()->set('Try again.'); $this->request->redirect('admin/taxonomy/' . $id . '/edit'); } } else { $this->template = View::factory('admin/taxonomy/edit'); $term = ORM::factory('category', (int) $id); $this->template->term = $term; } Breadcrumbs::instance()->add('Management', 'admin/')->add('Categories', 'admin/taxonomy')->add($term->title, 'admin/taxonomy/' . $term->id . '/edit'); }
public function viewEntry() { if (isset($_GET['entryId'])) { $queryStr = array("entryId" => intval(addslashes($_GET['entryId']))); } else { $queryStr = array(); } // Breadcrumbs $breadcrumbs = new Breadcrumbs(); $breadcrumbs->add('Home', '/home'); $this->registry->template->breadcrumbs = $breadcrumbs; // Load index model $this->registry->template->model = $this->getModel('tutorViewJournal', 'viewEntry', $queryStr); // Show the view $this->registry->template->show('tutorViewJournal/viewEntry'); }
public function action_index() { //template header $this->template->title = __('Contact Us'); $this->template->meta_description = __('Contact') . ' ' . core::config('general.site_name'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default'))); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Contact Us'))); if ($this->request->post()) { //captcha check if (captcha::check('contact')) { //check if user is loged in if (Auth::instance()->logged_in()) { $email_from = Auth::instance()->get_user()->email; $name_from = Auth::instance()->get_user()->name; } else { $email_from = core::post('email'); $name_from = core::post('name'); } //akismet spam filter if (!core::akismet($name_from, $email_from, core::post('message'))) { $replace = array('[EMAIL.BODY]' => core::post('message'), '[EMAIL.SENDER]' => $name_from, '[EMAIL.FROM]' => $email_from); if (Email::content(core::config('email.notify_email'), core::config('general.site_name'), $email_from, $name_from, 'contact-admin', $replace)) { Alert::set(Alert::SUCCESS, __('Your message has been sent')); } else { Alert::set(Alert::ERROR, __('Message not sent')); } } else { Alert::set(Alert::WARNING, __('This email has been considered as spam! We are sorry but we can not send this email.')); } } else { Alert::set(Alert::ERROR, __('Wrong captcha')); } } $this->template->content = View::factory('pages/contact'); }
public function action_index() { $supplychain_alias = ORM::factory('supplychain_alias'); $page = max($this->request->param('page'), 1); $items = 20; $offset = $items * ($page - 1); $count = $supplychain_alias->count_all(); $pagination = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'page'), 'total_items' => $supplychain_alias->count_all(), 'items_per_page' => $items)); $this->template->supplychain_alias = $supplychain_alias->limit($pagination->items_per_page)->offset($pagination->offset)->find_all()->as_array(null, array('id', 'site', 'alias', 'supplychain_id')); $this->template->page_links = $pagination->render(); $this->template->offset = $pagination->offset; $supplychain_alias_count = $supplychain_alias->count_all(); $post = Validate::factory($_POST); $post->rule('site', 'not_empty')->rule('alias', 'not_empty')->filter('site', 'strip_tags')->filter('alias', 'strip_tags')->rule('supplychain_id', 'not_empty')->filter(true, 'trim'); if (strtolower(Request::$method) === 'post' && $post->check()) { $check = false; $post = (object) $post->as_array(); $site_added = $post->site; $alias_added = $post->alias; $id = $post->supplychain_id; // check if the alias already exists, if not add new alias $supplychain_alias = ORM::factory('supplychain_alias'); $supplychain_alias->supplychain_id = $id; $supplychain_alias->site = $site_added; $supplychain_alias->alias = $alias_added; try { $supplychain_alias->save(); } catch (Exception $e) { Message::instance()->set('Could not create alias. Violates the unique (site, alias)'); } $this->request->redirect('admin/aliases'); } Breadcrumbs::instance()->add('Management', 'admin/')->add('Aliases', 'admin/aliases'); }
/** * STEP 0 * Confirm you want to update! */ public function action_confirm() { //force update check reload so we are sure he has latest version Core::get_updates(TRUE); $versions = core::config('versions'); $this->template->title = __('Updates'); Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title)); $this->template->scripts['footer'][] = 'js/oc-panel/update.js'; //version numbers in a key value $version_nums = array(); foreach ($versions as $version => $values) { $version_nums[] = $version; } //latest version available $latest_version = current($version_nums); //info from the latest version available $version = $versions[$latest_version]; //this is the version we allow to update from. Only the one before latest $latest_version_update = (int) str_replace('.', '', next($version_nums)); //current installation version $current_version = (int) str_replace('.', '', core::VERSION); $can_update = FALSE; if ($current_version == $latest_version_update) { $can_update = TRUE; } //pass to view from local versions.php $this->template->content = View::factory('oc-panel/pages/update/confirm', array('latest_version' => $latest_version, 'version' => $version, 'can_update' => $can_update)); }
public function action_index() { $this->template->title = __('Import tool for ads'); Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title)); $this->template->scripts['footer'][] = 'js/oc-panel/import.js'; $this->template->content = View::factory('oc-panel/pages/tools/import_ads', array('ads_import' => $this->amount_ads_import())); }
public function action_update() { $name = $this->request->param('id'); $field = new Model_Field(); $field_data = $field->get($name); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit') . ' ' . $name)); $this->template->title = __('Edit Custom Field for Advertisement'); //find all, for populating form select fields $categories = Model_Category::get_as_array(); if ($_POST) { try { $options = array('label' => Core::post('label'), 'tooltip' => Core::post('tooltip'), 'required' => Core::post('required') == 'on' ? TRUE : FALSE, 'searchable' => Core::post('searchable') == 'on' ? TRUE : FALSE, 'admin_privilege' => Core::post('admin_privilege') == 'on' ? TRUE : FALSE, 'show_listing' => Core::post('show_listing') == 'on' ? TRUE : FALSE); if ($field->update($name, Core::post('values'), Core::post('categories'), $options)) { Core::delete_cache(); Alert::set(Alert::SUCCESS, sprintf(__('Field %s edited'), $name)); } else { Alert::set(Alert::ERROR, sprintf(__('Field %s cannot be edited'), $name)); } } catch (Exception $e) { throw HTTP_Exception::factory(500, $e->getMessage()); } HTTP::redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index'))); } $this->template->content = View::factory('oc-panel/pages/fields/update', array('field_data' => $field_data, 'name' => $name, 'categories' => $categories)); }
public function action_index() { Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default'))); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('User Profile'))); $seoname = $this->request->param('seoname', NULL); if ($seoname !== NULL) { $user = new Model_User(); $user->where('seoname', '=', $seoname)->limit(1)->cached()->find(); if ($user->loaded()) { $this->template->title = __('User Profile') . ' - ' . $user->name; //$this->template->meta_description = $user->name;//@todo phpseo $this->template->bind('content', $content); $ads = new Model_Ad(); $ads = $ads->where('id_user', '=', $user->id_user)->where('status', '=', Model_Ad::STATUS_PUBLISHED)->order_by('created', 'desc')->cached()->find_all(); // case when user dont have any ads if ($ads->count() == 0) { $profile_ads = NULL; } $this->template->content = View::factory('pages/userprofile', array('user' => $user, 'profile_ads' => $ads)); } else { //throw 404 throw HTTP_Exception::factory(404, __('Page not found')); } } else { //throw 404 throw HTTP_Exception::factory(404, __('Page not found')); } }
/** * Update new forum */ public function action_update() { Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Topic'))); $topic = new Model_Topic($this->request->param('id')); $get_all = Model_Forum::get_all(); //get all forums to build forum parents in select $forum_parents = array(); foreach ($get_all[0] as $parent) { $forum_parents[$parent['id']] = $parent['name']; } $this->template->content = View::factory('oc-panel/pages/forum/topic', array('topic' => $topic, 'forum_parents' => $forum_parents)); if ($_POST) { $topic->title = core::post('title'); $topic->id_forum = core::post('id_forum'); $topic->description = core::post('description'); if (core::post('seotitle') != $topic->seotitle) { $topic->seotitle = $topic->gen_seotitle(core::post('seotitle')); } if (core::post('status') == 'on') { $topic->status = 1; } else { $topic->status = 0; } try { $topic->save(); Alert::set(Alert::SUCCESS, __('Topic is updated.')); } catch (Exception $e) { Alert::set(Alert::ERROR, $e->getMessage()); } HTTP::redirect(Route::url('oc-panel', array('controller' => 'topic', 'action' => 'index'))); } }
public function getIndex() { $this->heads = array(array('Role', array('search' => true, 'sort' => false, 'select' => Prefs::getRole()->RoleToSelection('_id', 'rolename'))), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true))); //print $this->model->where('docFormat','picture')->get()->toJSON(); Breadcrumbs::addCrumb('System', URL::to(strtolower($this->controller_name))); return parent::getIndex(); }
/** * List all Advertisements (PUBLISHED) */ public function action_index() { //template header $this->template->title = __('Advertisements'); $this->template->meta_description = __('Advertisements'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List'))); $this->template->scripts['footer'][] = 'js/jquery.toolbar.js'; $this->template->scripts['footer'][] = 'js/oc-panel/moderation.js'; $ads = new Model_Ad(); $fields = array('title', 'id_ad', 'published', 'created', 'id_category', 'id_location', 'status'); //filter ads by status $status = is_numeric(Core::get('status')) ? Core::get('status') : Model_Ad::STATUS_PUBLISHED; $ads = $ads->where('status', '=', $status); // sort ads by search value if ($q = $this->request->query('search')) { $ads = $ads->where('title', 'like', '%' . $q . '%'); if (core::config('general.search_by_description') == TRUE) { $ads = $ads->or_where('description', 'like', '%' . $q . '%'); } } $ads_count = clone $ads; $res_count = $ads_count->count_all(); if ($res_count > 0) { $pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $res_count, 'items_per_page' => 50))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action())); $ads = $ads->order_by(core::get('order', 'published'), core::get('sort', 'desc'))->limit($pagination->items_per_page)->offset($pagination->offset)->find_all(); $this->template->content = View::factory('oc-panel/pages/ad', array('res' => $ads, 'pagination' => $pagination, 'fields' => $fields)); } else { $this->template->content = View::factory('oc-panel/pages/ad', array('res' => NULL, 'fields' => $fields)); } }
public function action_index() { //template header $this->template->title = __('Contact Us'); $this->template->meta_description = __('Contact Us'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default'))); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Contact Us'))); if ($this->request->post()) { //captcha check if (captcha::check('contact')) { //akismet spam filter if (!core::akismet(core::post('name'), core::post('email'), core::post('message'))) { $replace = array('[EMAIL.BODY]' => core::post('message'), '[EMAIL.SENDER]' => core::post('name'), '[EMAIL.FROM]' => core::post('email')); if (Email::content(core::config('email.notify_email'), core::config('general.site_name'), core::post('email'), core::post('name'), 'contact.admin', $replace)) { Alert::set(Alert::SUCCESS, __('Your message has been sent')); } else { Alert::set(Alert::ERROR, __('Message not sent')); } } else { Alert::set(Alert::SUCCESS, __('This email has been considered as spam! We are sorry but we can not send this email.')); } } else { Alert::set(Alert::ERROR, __('Check the form for errors')); } } $this->template->content = View::factory('pages/contact'); }
/** * Build the request to determine what wiki page is being requested. */ protected function buildRequest() { $this->file = dirname(dirname(__FILE__)) . '/wiki/' . \App\getLanguage() . '/'; $this->file .= !empty($this->category) ? $this->category . '/' . $this->page : $this->page; $crumbs = $this->breadcrumbs->setCategory($this->category)->setPage($this->page)->build(); $this->view->addChange('breadcrumbs', $crumbs); }
public function get_list($id = 0) { $breadcrumbs = Breadcrumbs::get($id); $categories = $id ? Category::find($id)->children : Category::where('parent', '=', 0)->get(); $products = $id ? Category::find($id)->products : array(); $this->layout->page_title = "Admin - Categories - List"; $this->layout->page_content = View::make('admin.categories.list')->with('id', $id)->with('breadcrumbs', $breadcrumbs)->with('categories', $categories)->with('products', $products); }
public function action_index() { // validation active Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Market'))); $this->template->title = __('Market'); $market = Core::get_market(); $this->template->content = View::factory('oc-panel/pages/market/index', array('market' => $market)); }
function __construct() { if (isset(self::$_this)) { wp_die(sprintf(__('%s is a singleton class and you cannot create a second instance.', 'breadcrumbs'), get_class($this))); } self::$_this = $this; add_action('loop_start', array($this, 'breadcrumbs')); }
public function getIndex() { $this->heads = array(array('Type', array('search' => true, 'sort' => true)), array('Created', array('search' => true, 'sort' => true, 'daterange' => true)), array('Last Update', array('search' => true, 'sort' => true, 'daterange' => true))); //print $this->model->where('docFormat','picture')->get()->toJSON(); $this->title = 'Device Type'; Breadcrumbs::addCrumb('Assets', URL::to(strtolower($this->controller_name))); return parent::getIndex(); }
/** * * @param string $title * @param boolean $set_breadcrumbs * @return Controller */ public function set_title($title, $set_breadcrumbs = TRUE) { $this->template->title = $title; if ($set_breadcrumbs === TRUE) { $this->breadcrumbs->add($title, FALSE, FALSE, 999); } return $this; }
public function getIndex() { $this->heads = array(array('Full Name', array('search' => true, 'sort' => true)), array('Role', array('search' => true, 'sort' => false, 'select' => Prefs::getRole()->RoleToSelection('_id', 'rolename'))), array('Email', array('search' => true, 'sort' => true)), array('Mobile', array('search' => true, 'sort' => true)), array('Address', array('search' => true, 'sort' => true)), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true))); $this->title = 'Employees'; $this->place_action = 'first'; Breadcrumbs::addCrumb('HRMS', URL::to(strtolower($this->controller_name))); return parent::getIndex(); }
public function __construct(Authentication $auth, Store $session, Request $request, Redirector $redirect, Application $application) { $this->auth = $auth; $this->session = $session; $this->request = $request; $this->redirect = $redirect; $this->application = $application; \Breadcrumbs::addCrumb(trans('core::core.breadcrumb.home'), \URL::route('dashboard.index')); }
public function action_view() { $user_id = $this->request->param('id'); $user = ORM::factory('user', $user_id); DynamicMenu::extend(array('profilemenu' => array(array('profile/view/id/' . $user_id, 'Info', 1, array()), array('profile/view/id/' . $user_id, 'Wall', 2, array())))); $view = View::factory('profile/view')->bind('user', $user); Breadcrumbs::add(array('Profile', Url::site('profile/view/id/' . $user_id))); $this->content = $view; }