/** @test */ public function it_can_render_the_view() { $breadcrumb = new Breadcrumb($this->viewFactory); $breadcrumb->add('Home'); $view = $breadcrumb->render(); $this->assertInstanceOf('Illuminate\\View\\View', $view); }
/** * @param Breadcrumb|null $parent */ public function __construct(Breadcrumb $parent = null) { $this->children = array(); if ($parent) { $this->parent = $parent; $parent->addChild($this); } }
/** * @covers Breadcrumb::getNarrowerConcepts * @covers Breadcrumb::addNarrower */ public function testAddAndGetNarrower() { $bc = new Breadcrumb('http://skosmos.skos/onto/test/t001', 'prefLabel'); $bc2 = new Breadcrumb('http://skosmos.skos/onto/test/t007', 'narrower'); $bc->addNarrower($bc2); $children = $bc->getNarrowerConcepts(); $this->assertEquals($bc2, $children['http://skosmos.skos/onto/test/t007']); }
/** * 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 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)); }
/** * 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() { 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'))); } }
/** * @test * @group breadcrumbs */ public function test_should_clear_all_breadcrumbs() { Breadcrumbs::add(Breadcrumb::factory()->set_title("Crumb 1")->set_url("http://example.com/")); Breadcrumbs::add(Breadcrumb::factory()->set_title("Crumb 2")); Breadcrumbs::clear(); $this->assertSame(array(), Breadcrumbs::get()); }
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_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 show($page_name) { // Display the page specified by $page_name, or a 404 error if it doesn't exist. // Run a database search to look up the page. $existing_page = ORM::factory("px_static_page")->where("name", "=", $page_name)->find_all(); // If it doesn't exist, display a 404 error. if (count($existing_page) == 0) { throw new Kohana_404_Exception(); } // Set up breadcrumbs. $breadcrumbs = array(); $root = item::root(); $breadcrumbs[] = Breadcrumb::instance($root->title, $root->url())->set_first(); $breadcrumbs[] = Breadcrumb::instance(t($existing_page[0]->title), url::site("pages_xtra/show/{$page_name}"))->set_last(); // Display the page. $template = new Theme_View("page.html", "other", "Pages"); $template->set_global(array("breadcrumbs" => $breadcrumbs)); // Call database variables into page header (off-page content). $site_title = module::get_var("pages_xtra", "site_title"); // Next line can be used as alternative to the following line // $template->page_title = t("Gallery :: ") . t($existing_page[0]->title); $template->page_title = t($existing_page[0]->title) . t(" :: {$site_title}"); $template->page_tags = $existing_page[0]->tags; $page_tags = trim(nl2br(html::purify($existing_page[0]->tags))); $template->page_description = $existing_page[0]->description; $page_description = trim(nl2br(html::purify($existing_page[0]->description))); // Set a new View and call database variables into page (on-page content). $template->content = new View("pages_xtra_display.html"); $template->content->title = $existing_page[0]->title; $template->content->body = $existing_page[0]->html_code; print $template; }
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'); }
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())); }
/** * 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() { // 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)); }
public function action_message() { Controller::$full_width = TRUE; if ($this->request->param('id') !== NULL and is_numeric($id_msg_thread = $this->request->param('id'))) { $messages = Model_Message::get_thread($id_msg_thread, $this->user->id_user); if ($messages !== FALSE) { $msg_thread = new Model_Message(); $msg_thread = $msg_thread->where('id_message', '=', $this->request->param('id'))->find(); // send reply message if ($this->request->post() and Form::token('reply_message', TRUE)) { $validation = Validation::factory($this->request->post())->rule('message', 'not_empty'); if ($validation->check()) { $ret = Model_Message::reply(core::post('message'), $this->user->id_user, $id_msg_thread, NULL); if ($ret !== FALSE) { //who is who? if from is the same then send to TO, else to from if ($msg_thread->id_user_from == $this->user->id_user) { $user_to = $msg_thread->to; $user_from = $msg_thread->from; } else { $user_to = $msg_thread->from; $user_from = $msg_thread->to; } //email title if ($msg_thread->id_ad !== NULL) { $email_title = $msg_thread->ad->title; } else { $email_title = sprintf(__('Direct message from %s'), $user_from->name); } $user_to->email('messaging-reply', array('[TITLE]' => $email_title, '[DESCRIPTION]' => core::post('message'), '[URL.QL]' => $user_to->ql('oc-panel', array('controller' => 'messages', 'action' => 'message', 'id' => $this->request->param('id'))))); Alert::set(Alert::SUCCESS, __('Reply created.')); $this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'message', 'id' => Request::current()->param('id')))); } else { Alert::set(Alert::ERROR, __('Message not sent')); } } else { $errors = $validation->errors('message'); } } Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Messaging'))->set_url(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index')))); if ($msg_thread->id_ad !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($msg_thread->ad->title)); } else { Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Direct Message'))); } $this->template->styles = array('css/jquery.sceditor.default.theme.min.css' => 'screen'); $this->template->scripts['footer'] = array('js/jquery.sceditor.bbcode.min.js', 'js/messages.js'); $this->template->content = View::factory('oc-panel/pages/messages/message', array('msg_thread' => $msg_thread, 'messages' => $messages, 'user' => $this->user)); } else { Alert::set(Alert::ERROR, __('Message not found')); $this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index'))); } } else { Alert::set(Alert::ERROR, __('Message not found')); $this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index'))); } }
public function action_edit() { Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Translation'))); $this->template->title = __('Edit Translation'); $this->template->bind('content', $content); $content = View::factory('oc-panel/pages/translations/edit'); $this->template->scripts['footer'][] = 'js/oc-panel/translations.js'; $language = $this->language_fix($this->request->param('id')); //get the translated ad not translated. list($translation_array, $untranslated_array) = $this->get_translation($language); //watch out at any standard php installation there's a limit of 1000 posts....edit php.ini max_input_vars = 10000 to amend it. if ($this->request->post() and is_array(Core::post('translations'))) { $data_translated = Core::post('translations'); if ($this->save_translation($language, $translation_array, $data_translated)) { Alert::set(Alert::SUCCESS, $language . ' ' . __('Language saved')); } else { Alert::set(Alert::ALERT, $language); } $this->redirect(URL::current()); } //add filters to search $translation_array_filtered = $translation_array; //only display not translated if (core::get('translated') == 1) { $translation_array_filtered_aux = array(); foreach ($untranslated_array as $key => $value) { $translation_array_filtered_aux[] = $translation_array_filtered[$value]; } $translation_array_filtered = $translation_array_filtered_aux; } elseif (core::get('search') !== NULL) { $translation_array_filtered_aux = array(); foreach ($translation_array as $key => $value) { if (strpos($value['original'], core::get('search')) !== FALSE or strpos($value['translated'], core::get('search')) !== FALSE) { $translation_array_filtered_aux[] = $value; } } $translation_array_filtered = $translation_array_filtered_aux; } //how many translated items we have? $total_items = count($translation_array_filtered); //get elements for current page $pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $total_items, 'items_per_page' => 20))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'id' => $language)); $trans_array_paginated = array(); $from = $pagination->offset; $to = $from + $pagination->items_per_page; for ($key = $from; $key < $to; $key++) { if (isset($translation_array_filtered[$key])) { $trans_array_paginated[$key] = $translation_array_filtered[$key]; } } $content->edit_language = $language; $content->translation_array = $trans_array_paginated; $content->cont_untranslated = count($untranslated_array); $content->total_items = count($translation_array); $content->pagination = $pagination->render(); }
public function build_breadcrumbs_for_item_test() { $album = test::random_album(); $item = test::random_photo($album); $expected = array(); $expected[] = Breadcrumb::instance(item::root()->title, item::root()->url("show={$album->id}"))->set_first(); $expected[] = Breadcrumb::instance($album->title, $album->url("show={$item->id}")); $expected[] = Breadcrumb::instance($item->title, $item->url())->set_last(); $this->assert_equal($expected, Breadcrumb::array_from_item_parents($item)); }
public function action_index() { // validation active Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Market'))); $this->template->title = __('Market'); $market_url = Kohana::$environment !== Kohana::DEVELOPMENT ? 'market.open-classifieds.com' : 'eshop.lo'; $this->template->scripts['footer'][] = 'http://' . $market_url . '/embed.js'; $market = Core::get_market(); $this->template->content = View::factory('oc-panel/pages/market/index', array('market' => $market)); }
/** * overwrites the default crud index * @param string $view nothing since we don't use it * @return void */ public function action_index($view = NULL) { //template header $this->template->title = __('Locations'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Locations'))); $this->template->styles = array('css/sortable.css' => 'screen'); $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js'; $this->template->scripts['footer'][] = 'js/oc-panel/locations.js'; list($locs, $order) = Model_Location::get_all(); $this->template->content = View::factory('oc-panel/pages/locations', array('locs' => $locs, 'order' => $order)); }
public function action_index() { $this->before('oc-panel/pages/widgets/main'); //template header $this->template->title = __('Widgets'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Widgets'))); $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js'; $this->template->scripts['footer'][] = 'js/oc-panel/widgets.js'; $this->template->widgets = Widgets::get_widgets(); $this->template->placeholders = Widgets::get_placeholders(); }
public function action_index() { Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Newsletter'))); $this->template->title = __('Newsletter'); //count all users $user = new Model_User(); $user->where('status', '=', Model_User::STATUS_ACTIVE); $count_all_users = $user->count_all(); //count support expired $query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where('status', '=', Model_Order::STATUS_PAID)->where('support_date', '<', Date::unix2mysql())->execute(); $count_support_expired = $query->as_array(); $count_support_expired = $count_support_expired[0]['count']; //count license expired $query = DB::select(DB::expr('COUNT(id_license) count'))->from('licenses')->where('valid_date', 'IS NOT', NULL)->where('valid_date', '<', Date::unix2mysql())->execute(); $count_license_expired = $query->as_array(); $count_license_expired = $count_license_expired[0]['count']; //orders per product, not accuarate since 1 user could buy more than 1 product but will do $query = DB::select(DB::expr('COUNT(id_order) count'))->select('p.title')->select('p.id_product')->from(array('products', 'p'))->join(array('orders', 'o'))->using('id_product')->where('o.status', '=', Model_Order::STATUS_PAID)->group_by('p.id_product')->execute(); $products = $query->as_array(); //post done sending newsletter if ($this->request->post() and Core::post('subject') != NULL) { $users = array(); if (core::post('send_all') == 'on') { $query = DB::select('email')->select('name')->from('users')->where('status', '=', Model_User::STATUS_ACTIVE)->execute(); $users = array_merge($users, $query->as_array()); } if (Theme::get('premium') == 1) { if (core::post('send_expired_support') == 'on') { $query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.status', '=', Model_Order::STATUS_PAID)->where('o.support_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute(); $users = array_merge($users, $query->as_array()); } if (core::post('send_expired_license') == 'on') { $query = DB::select('email')->select('name')->from(array('licenses', 'l'))->join(array('users', 'u'))->using('id_user')->where('l.valid_date', 'IS NOT', NULL)->where('l.valid_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute(); $users = array_merge($users, $query->as_array()); } if (is_numeric(core::post('send_product'))) { $query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.id_product', '=', core::post('send_product'))->where('o.status', '=', Model_Order::STATUS_PAID)->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute(); $users = array_merge($users, $query->as_array()); } } //NOTE $users may have duplicated emails, but phpmailer takes care of not sending the email 2 times to same recipient //sending! if (count($users) > 0) { if (!Email::send($users, '', Core::post('subject'), Kohana::$_POST_ORIG['description'], Core::post('from'), Core::post('from_email'))) { Alert::set(Alert::ERROR, __('Error on mail delivery, not sent')); } else { Alert::set(Alert::SUCCESS, __('Email sent')); } } else { Alert::set(Alert::ERROR, __('Mail not sent')); } } $this->template->content = View::factory('oc-panel/pages/newsletter', array('count_all_users' => $count_all_users, 'count_support_expired' => $count_support_expired, 'count_license_expired' => $count_license_expired, 'products' => $products)); }
public function action_index() { //template header $this->template->title = __('Black list'); $this->template->meta_description = __('Black list'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List'))); //find all tables $user = new Model_User(); $black_list = $user->where('status', '=', Model_User::STATUS_SPAM)->order_by('id_user')->find_all(); $this->template->content = View::factory('oc-panel/pages/black_list', array('black_list' => $black_list)); }
/** * overwrites the default crud index * @param string $view nothing since we don't use it * @return void */ public function action_index($view = NULL) { //Request::current()->redirect(Route::url('oc-panel',array('controller' => 'category','action'=>'dashboard'))); //template header $this->template->title = __('Categories'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Categories'))); $this->template->styles = array('css/sortable.css' => 'screen'); $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js'; $this->template->scripts['footer'][] = 'js/oc-panel/categories.js'; list($cats, $order) = Model_Category::get_all(); $this->template->content = View::factory('oc-panel/pages/categories', array('cats' => $cats, 'order' => $order)); }
static function get_display_context($item) { $where = array(array("type", "!=", "album")); $position = item::get_position($item, $where); if ($position > 1) { list($previous_item, $ignore, $next_item) = $item->parent()->viewable()->children(3, $position - 2, $where); } else { $previous_item = null; list($next_item) = $item->parent()->viewable()->children(1, $position, $where); } return array("position" => $position, "previous_item" => $previous_item, "next_item" => $next_item, "sibling_count" => $item->parent()->viewable()->children_count($where), "siblings_callback" => array("Albums_Controller::get_siblings", array($item)), "parents" => $item->parents()->as_array(), "breadcrumbs" => Breadcrumb::array_from_item_parents($item)); }
public function action_index() { //if not god redirect him to the normal profile page if (Auth::instance()->get_user()->id_role != Model_Role::ROLE_ADMIN) { HTTP::redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'index'))); } Core::ocacu(); $this->template->title = __('Welcome'); Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title)); $rss_url = 'http://feeds.feedburner.com/RssBlogOpenEshop'; $rss = Feed::parse($rss_url, 10); $this->template->content = View::factory('oc-panel/home', array('rss' => $rss)); }
static function get_display_context($item, $album_defn, $path) { $where = array(array("type", "!=", "album")); $position = dynamic::get_position($album_defn, $item, $where); if ($position > 1) { list($previous_item, $ignore, $next_item) = dynamic::items($album_defn->key_field, 3, $position - 2); } else { $previous_item = null; list($next_item) = dynamic::items($album_defn->key_field, 1, $position); } $root = item::root(); return array("position" => $position, "previous_item" => $previous_item, "next_item" => $next_item, "sibling_count" => dynamic::get_display_count($album_defn), "siblings_callback" => array("dynamic::items", array($album_defn->key_field)), "breadcrumbs" => array(Breadcrumb::instance($root->title, $root->url())->set_first(), Breadcrumb::instance($album_defn->title, url::site("dynamic/{$path}?show={$item->id}")), Breadcrumb::instance($item->title, $item->url())->set_last())); }
/** * overwrites the default crud index * @param string $view nothing since we don't use it * @return void */ public function action_index($view = NULL) { //template header $this->template->title = __('Menu'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Menu'))); $this->template->styles = array('css/sortable.css' => 'screen'); $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js'; $this->template->scripts['footer'][] = 'js/oc-panel/menu.js'; //find all, for populating form select fields list($categories, $order_categories) = Model_Category::get_all(); // d($categories); $this->template->content = View::factory('oc-panel/pages/menu', array('menu' => Menu::get(), 'categories' => $categories, 'order_categories' => $order_categories)); }
/** * overwrites the default crud index * @param string $view nothing since we don't use it * @return void */ public function action_index($view = NULL) { //HTTP::redirect(Route::url('oc-panel',array('controller' => 'category','action'=>'dashboard'))); //template header $this->template->title = __('Categories'); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Categories'))); $this->template->styles = array('css/sortable.css' => 'screen', '//cdn.jsdelivr.net/bootstrap.tagsinput/0.3.9/bootstrap-tagsinput.css' => 'screen'); $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js'; $this->template->scripts['footer'][] = 'js/oc-panel/categories.js'; $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/bootstrap.tagsinput/0.3.9/bootstrap-tagsinput.min.js'; $cats = Model_Category::get_as_array(); $order = Model_Category::get_multidimensional(); $this->template->content = View::factory('oc-panel/pages/categories/index', array('cats' => $cats, 'order' => $order)); }