コード例 #1
0
ファイル: AppHelper.php プロジェクト: nani8124/infinitas
 /**
  * @brief Admin page heading
  *
  * Generates a heading based on the controller and adds a bread crumb
  *
  * @access public
  *
  * @return string the markup for the page header
  */
 public function adminPageHead()
 {
     return '<h1>' . sprintf(__('%s Manager'), prettyName($this->request->params['controller'])) . '<small>' . $this->breadcrumbs() . '</small></h1>';
 }
コード例 #2
0
ファイル: app_helper.php プロジェクト: rchavik/infinitas
 /**
  * Generate nice title text.
  *
  * This method is used to generate nice looking information title text
  * depending on what is displayed to the user.
  *
  * @param $switch this is the title that is passed in
  * @param $notHuman if this is true the prettyName function will be called making the text human readable.
  *
  * @return string the text for the title.
  */
 function niceTitleText($switch = null)
 {
     $switch = prettyName($switch);
     $controller = __(Inflector::singularize($this->params['controller']), true);
     switch (strtolower($switch)) {
         case 'add':
             $heading = sprintf('%s %s', __('Create a New', true), $controller);
             $text = sprintf(__('Click here to create a new %s. You do not need to tick any checkboxes to create a new %s.', true), $controller, $controller);
             break;
         case 'edit':
             $heading = sprintf('%s %s', __('Edit the', true), $controller);
             $text = sprintf(__('Tick the checkbox next to the %s you want to edit then click here.<br/><br/>Currently you may only edit one %s at a time.', true), $controller, $controller);
             break;
         case 'copy':
             $controller = __($this->params['controller'], true);
             $heading = sprintf('%s %s', __('Copy some', true), $controller);
             $text = sprintf(__('Tick the checkboxes next to the %s you want to copy then click here.<br/><br/>You may copy as many %s as you like.', true), $controller, $controller);
             break;
         case 'toggle':
             $controller = __($this->params['controller'], true);
             $heading = sprintf('%s %s', __('Toggle some', true), $controller);
             $text = sprintf(__('Tick the checkboxes next to the %s you want to toggle then click here.<br/><br/>Inactive %s will become active, and active %s will become inactive', true), $controller, $controller, $controller);
             break;
         case 'delete':
             $heading = sprintf('%s %s', __('Delete some', true), $this->params['controller']);
             $text = sprintf(__('Tick the checkboxes next to the %s you want to delete then click here.<br/><br/>If possible the %s will be moved to the trash can. If not they will be deleted permanently.', true), $controller, $controller);
             break;
         case 'disabled':
             $heading = sprintf('%s %s', __('Delete some', true), $this->params['controller']);
             $text = sprintf(__('This %s currently disabled, to enable it tick the check to the left and click toggle.', true), $controller);
             break;
         case 'active':
             $heading = sprintf('%s %s', __('Delete some', true), $this->params['controller']);
             $text = sprintf(__('This %s currently active, to disable it tick the check to the left and click toggle.', true), $controller);
             break;
         case 'save':
             $heading = sprintf('%s %s', __('Save the', true), $this->params['controller']);
             $text = sprintf(__('Click here to save your %s. This will save your current changes and take you back to the index list.', true), $controller);
             break;
         case 'cancel':
             $heading = sprintf('%s', __('Discard your changes', true));
             $text = sprintf(__('Click here to return to the index page without saving the changes you have made to the %s.', true), $controller);
             break;
         case 'move':
             $heading = sprintf('%s %s', __('Move the ', true), $this->params['controller']);
             $text = sprintf(__('Tick the checkboxes next to the %s you want to move then click here. You will be prompted with a page, asking how you would like to move the %s', true), $controller, $controller);
             break;
         default:
             $heading = $switch;
             $text = 'todo: Need to add something';
     }
     return sprintf('%s :: %s', $heading, $text);
 }
コード例 #3
0
ファイル: MenuHelper.php プロジェクト: nani8124/infinitas
 /**
  * Build the icon list for admin dashboard.
  *
  * Generates an array of links for plugins to be used as a dashboard
  * list of icons. If nothing is passed it will build the list for the entire
  * app (used on admin dashboard).
  *
  * @var array $plugins this is the array of icons (could do with a better name)
  * @var string $type this is a name that is used for cache if not used funy things can happen
  *
  * @deprecated cache is causing loads of issues, and not enough speed.
  *
  * @return array the menu that was built
  */
 public function builDashboardLinks($plugins = array(), $type = null, $cache = true)
 {
     if (!$type) {
         $type = $this->plugin;
     }
     if (empty($plugins)) {
         $plugins = $this->Event->trigger('pluginRollCall');
         $plugins = array_filter($plugins['pluginRollCall']);
         $type = 'all';
     }
     ksort($plugins);
     $return = array();
     foreach ($plugins as $name => $info) {
         $name = Inflector::camelize($name);
         $info = array_merge($this->__adminDashboardIcon, $info);
         if (empty($info['name'])) {
             $info['name'] = __(prettyName($name));
         }
         if (empty($info['dashboard'])) {
             $info['dashboard'] = array('plugin' => strtolower($name), 'controller' => strtolower($name), 'action' => 'index');
         }
         $var = 'plugin';
         if ($type !== 'all') {
             $var = $type;
         } else {
             if (strstr(App::pluginPath($name), APP . 'Core' . DS)) {
                 $var = 'core';
             }
         }
         $_options = array('title' => sprintf('%s :: %s', __($info['name']), __($info['description'])), 'escape' => false, 'style' => 'background-image: url(' . Router::url(isset($info['icon']) ? $info['icon'] : DS . $name . DS . 'img' . DS . 'icon.png') . ');');
         $return[$var][] = $this->Html->link($info['name'], $info['dashboard'], array_merge($_options, $info['options']));
     }
     unset($plugins);
     return $return;
 }
コード例 #4
0
ファイル: AppController.php プロジェクト: nani8124/infinitas
 /**
  * @brief normal before filter.
  *
  * set up some variables and do a bit of pre processing before handing
  * over to the controller responsible for the request.
  *
  * @link http://api.cakephp.org/class/controller#method-ControllerbeforeFilter
  *
  * @access public
  *
  * @return void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->request->params['admin'] = isset($this->request->params['admin']) ? $this->request->params['admin'] : false;
     if ($this->request->params['admin'] && $this->request->params['action'] != 'admin_login' && $this->Auth->user('group_id') != 1) {
         $this->redirect(array('admin' => 1, 'plugin' => 'users', 'controller' => 'users', 'action' => 'login'));
     }
     if (isset($this->request->data['PaginationOptions']['pagination_limit'])) {
         $this->Infinitas->changePaginationLimit($this->request->data['PaginationOptions'], $this->request->params);
     }
     if (isset($this->request->params['named']['limit'])) {
         $this->request->params['named']['limit'] = $this->Infinitas->paginationHardLimit($this->request->params['named']['limit']);
     }
     if (sizeof($this->uses) && (isset($this->{$this->modelClass}->Behaviors) && $this->{$this->modelClass}->Behaviors->attached('Logable'))) {
         $this->{$this->modelClass}->setUserData($this->Auth->user());
     }
     $this->__callBacks[__FUNCTION__] = true;
     $this->prettyModelName = prettyName($this->modelClass);
     if (!empty($this->Session) && !$this->Session->read('ip_address')) {
         $this->Session->write('ip_address', $this->request->clientIp());
     }
     $modelName = !empty($this->prettyModelName) ? $this->prettyModelName : prettyName($this->name);
     $modelName = Inflector::singularize($modelName);
     foreach ($this->notice as $type => &$config) {
         if (empty($config['message'])) {
             continue;
         }
         if (strstr($config['message'], '%s')) {
             $plugin = Inflector::underscore($this->plugin);
             $config['message'] = __d($plugin, $config['message'], $modelName);
         }
     }
 }