public function view() { // Get URI vars $listID = uri::segment(6); // Get list if (!$listID || !($list = $this->lists_model->getList($listID))) { router::redirect('cp/system/config/system'); } // Did we submit the form? if (input::post('action') == 'reorder' && input::post('ids')) { $this->_reorderItems(); } // Get items if (!($items = $this->lists_model->getItems($listID))) { router::redirect('cp/system/config/system'); } // Create table grid $grid = array('uri' => 'cp/system/templates/navigation', 'keyword' => 'templates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'active' => array('html' => __('active', 'system'), 'class' => 'status')), 'content' => array()); // Create grid content foreach ($items as $item) { $grid['content'][] = array('name' => array('html' => $item['name']), 'status' => array('html' => html_helper::anchor('cp/system/templates/navigation/togglestatus/' . $item['item_id'], $item['active'] ? __('yes', 'system') : __('no', 'system'), array('class' => $item['active'] ? 'label success small' : 'label important small')))); } // Filter hooks hook::filter('cp/system/templates/navigation/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid, 'items' => $items, 'listID' => $listID)); // Set title view::setTitle(__('system_templates_navigation_manage', 'system_navigation')); // Set trail view::setTrail('cp/system/templates/navigation/view/' . $listID, $list['name']); // Set actions view::setAction('#', __('done', 'system'), array('class' => 'icon-text icon-system-done', 'onclick' => 'saveSortable();return false;', 'id' => 'actions_link_save')); view::setAction('#', __('cancel', 'system'), array('class' => 'icon-text icon-system-cancel', 'onclick' => 'cancelSortable();return false;', 'id' => 'actions_link_cancel')); view::setAction('#', __('reorder', 'system'), array('class' => 'icon-text icon-system-sort', 'onclick' => 'switchSortable();return false;', 'id' => 'actions_link_reorder')); // Include sortable vendor files view::includeJavascript('externals/html5sortable/html5sortable.js'); view::includeStylesheet('externals/html5sortable/style.css'); // Load view if (input::isAjaxRequest()) { view::load('cp/system/templates/navigation/items/browse_' . (input::post('view') == 'list' ? 'list' : 'grid')); } else { view::load('cp/system/templates/navigation/items/browse'); } }
public function browse() { // Did we submit the form? if (input::post('action') == 'reorder' && input::post('ids')) { $this->_reorderPlans(); } // Get plans if (!($plans = $this->plans_model->getPlans(false))) { view::setInfo(__('no_plans', 'billing_plans')); } // Set cycles $cycles = array_map('strtolower', array(1 => __('day', 'date'), 2 => __('week', 'date'), 3 => __('month', 'date'), 4 => __('year', 'date'))); $cyclesMulti = array_map('strtolower', array(1 => __('days', 'date'), 2 => __('weeks', 'date'), 3 => __('months', 'date'), 4 => __('years', 'date'))); // Create table grid $grid = array('uri' => 'cp/billing/plans/browse', 'keyword' => 'billing_plans', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'group' => array('html' => __('plan_group', 'billing_plans'), 'class' => 'group'), 'cycle' => array('html' => __('plan_cycle', 'billing_plans'), 'class' => 'cycle'), 'price' => array('html' => __('price', 'billing'), 'class' => 'price'), 'signup' => array('html' => __('plan_signup', 'billing_plans'), 'class' => 'signup'), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array()); // Create grid content foreach ($plans as $plan) { $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/billing/plans/edit/' . $plan['plan_id'], $plan['name'])), 'group' => array('html' => config::item('usergroups', 'core', $plan['group_id'])), 'cycle' => array('html' => $plan['duration'] . ' ' . ($plan['duration'] == 1 ? $cycles[$plan['cycle']] : $cyclesMulti[$plan['cycle']])), 'price' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $plan['price']), 'signup' => array('html' => $plan['signup'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'status' => array('html' => $plan['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/plans/edit/' . $plan['plan_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/billing/plans/delete/' . $plan['plan_id'], __('delete', 'system'), array('data-html' => __('plan_delete?', 'billing_plans'), 'data-role' => 'confirm', 'class' => 'delete'))))); } // Filter hooks hook::filter('cp/billing/plans/browse/grid', $grid); // Assign vars view::assign(array('grid' => $grid, 'plans' => $plans)); // Set title view::setTitle(__('billing_plans_manage', 'system_navigation')); // Assign actions view::setAction('cp/billing/plans/edit', __('plan_new', 'billing_plans'), array('class' => 'icon-text icon-billing-plans-new')); view::setAction('#', __('done', 'system'), array('class' => 'icon-text icon-system-done', 'onclick' => 'saveSortable();return false;', 'id' => 'actions_link_save')); view::setAction('#', __('cancel', 'system'), array('class' => 'icon-text icon-system-cancel', 'onclick' => 'cancelSortable();return false;', 'id' => 'actions_link_cancel')); view::setAction('#', __('reorder', 'system'), array('class' => 'icon-text icon-system-sort', 'onclick' => 'switchSortable();return false;', 'id' => 'actions_link_reorder')); // Include sortable vendor files view::includeJavascript('externals/html5sortable/html5sortable.js'); view::includeStylesheet('externals/html5sortable/style.css'); // Load view if (input::isAjaxRequest()) { view::load('cp/billing/plans/browse_' . (input::post('view') == 'list' ? 'list' : 'grid')); } else { view::load('cp/billing/plans/browse'); } }
protected function editField($plugin, $table, $categoryID, $fieldID, $config = array(), $hidden = array()) { // Get field $field = array(); if ($fieldID && !($field = $this->fields_model->getField($fieldID))) { view::setError(__('no_field', 'system_fields')); router::redirect('cp/system/fields/' . $plugin . '/browse' . ($categoryID ? '/' . $categoryID : '')); } // Field types $types = $this->fieldsdb_model->getTypes(false, isset($hidden['system_types']) && is_array($hidden['system_types']) && $hidden['system_types'] ? $hidden['system_types'] : array()); // Field properties $properties = $this->fieldsdb_model->getFieldProperties(); $properties['custom'] = $config; // Get total and max items if (input::post('do_save_field')) { //$totalItems = input::post('items') ? count(current(input::post('items'))) : 0; $lastItemID = input::post('items') ? max(array_keys(current(input::post('items')))) : 0; } else { //$totalItems = isset($field['items']) && $field['items'] ? count($field['items']) : 0; $lastItemID = isset($field['items']) && $field['items'] ? max(array_keys($field['items'])) : 0; } // Assign vars view::assign(array('fieldID' => $fieldID, 'categoryID' => $categoryID, 'field' => $field, 'hidden' => $hidden, 'types' => $types, 'properties' => $properties, 'lastItemID' => $lastItemID)); // Process form values if (input::post('do_save_field')) { $this->_saveField($plugin, $table, $categoryID, $fieldID, $field, $properties, $hidden); } // Set trail view::setTrail('cp/system/fields/' . $plugin . '/edit/' . $categoryID . '/' . ($fieldID ? $fieldID : ''), $fieldID ? __('edit_field', 'system_fields') . ' - ' . text_helper::entities($field['name_' . session::item('language')]) : __('new_field', 'system_fields')); // Set actions if (count(config::item('languages', 'core', 'keywords')) > 1) { view::setAction('translate', ''); } // Include sortable vendor files view::includeJavascript('externals/html5sortable/html5sortable.js'); view::includeStylesheet('externals/html5sortable/style.css'); // Load view view::load('cp/system/fields/edit'); }
public function thumbnail() { // Is user loggedin ? if (!users_helper::isLoggedin()) { router::redirect('users/login'); } // Resize picture? if (input::post('do_save_thumbnail')) { $this->_saveThumbnail(); } // Set title view::setTitle(__('picture_thumbnail_edit', 'system_files')); // Set trail view::setTrail(session::item('slug'), __('my_profile', 'system_navigation')); // Include jcron files view::includeJavascript('externals/jcrop/jcrop.min.js'); view::includeStylesheet('externals/jcrop/style.css'); // Load view view::load('users/profile/thumbnail'); }
public function thumbnail() { // Is user logged in? if (!users_helper::isLoggedin()) { router::redirect('users/login'); } // Get URI vars $adID = (int) uri::segment(4); $pictureID = (int) uri::segment(5); // Get album if (!$adID || !($ad = $this->classifieds_model->getAd($adID, 'in_view')) || $ad['user_id'] != session::item('user_id')) { view::setError(__('no_ad', 'classifieds')); router::redirect('classifieds'); } // Get picture if (!$pictureID || !($picture = $this->classifieds_pictures_model->getPicture($pictureID, 'in_view')) || $picture['user_id'] != session::item('user_id')) { view::setError(__('no_picture', 'classifieds')); router::redirect('classifieds/pictures/index/' . $adID . '/' . text_helper::slug($ad['data_title'], 100)); } // Assign vars view::assign(array('adID' => $adID, 'pictureID' => $pictureID, 'picture' => $picture, 'ad' => $ad)); // Resize picture? if (input::post('do_save_thumbnail')) { $this->_saveThumbnail($pictureID, $picture, $ad); } // Set title view::setTitle(__('picture_thumbnail_edit', 'system_files')); // Set trail view::setTrail(session::item('slug'), __('my_profile', 'system_navigation')); view::setTrail('classifieds/manage', __('classifieds', 'system_navigation')); view::setTrail('classifieds/view/' . $ad['ad_id'] . '/' . text_helper::slug($ad['data_title'], 100), __('ad_view', 'classifieds'), array('side' => true)); // Include jcron files view::includeJavascript('externals/jcrop/jcrop.min.js'); view::includeStylesheet('externals/jcrop/style.css'); // Load view view::load('classifieds/pictures/thumbnail'); }
public function thumbnail() { // Is user logged in? if (users_helper::isLoggedin()) { router::redirect(session::item('slug')); } elseif (!config::item('signup_enable', 'users')) { // Success view::setError(__('signup_disabled', 'users_signup')); router::redirect('users/login'); } elseif (!session::item('account', 'signup') || config::item('signup_steps', 'users', 'profile') !== false && !session::item('profile', 'signup')) { router::redirect('users/signup'); } elseif (!session::item('picture', 'signup', 'file_id')) { router::redirect('users/signup/picture'); } // Reset steps $this->_resetSteps('picture'); // Process form values if (input::post('do_save_thumbnail')) { $this->_saveThumbnail(); } // Add storage includes $this->storage_model->includeExternals(); // Set title view::setTitle(__('picture_thumbnail_edit', 'system_files')); // Include jcron files view::includeJavascript('externals/jcrop/jcrop.min.js'); view::includeStylesheet('externals/jcrop/style.css'); // Load view view::load('users/signup/thumbnail'); }