当前位置: 首页>>代码示例>>PHP>>正文


PHP PFApplicationHelper类代码示例

本文整理汇总了PHP中PFApplicationHelper的典型用法代码示例。如果您正苦于以下问题:PHP PFApplicationHelper类的具体用法?PHP PFApplicationHelper怎么用?PHP PFApplicationHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PFApplicationHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: allowAdd

 /**
  * Method to check if you can add a new record.
  *
  * @param     array      $data    An array of input data.
  *
  * @return    boolean
  */
 protected function allowAdd($data = array())
 {
     // Get form input
     $project = isset($data['project_id']) ? (int) $data['project_id'] : PFApplicationHelper::getActiveProjectId();
     $ms = isset($data['milestone_id']) ? (int) $data['milestone_id'] : 0;
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     $is_sa = $user->authorise('core.admin');
     $levels = $user->getAuthorisedViewLevels();
     $query = $db->getQuery(true);
     $asset = 'com_pftasks';
     $access = true;
     // Check if the user has access to the project
     if ($project) {
         // Check if in allowed projects when not a super admin
         if (!$is_sa) {
             $access = in_array($project, PFUserHelper::getAuthorisedProjects());
         }
         // Change the asset name
         $asset .= '.project.' . $project;
     }
     // Check if the user can access the selected milestone when not a super admin
     if (!$is_sa && $ms && $access) {
         $query->select('access')->from('#__pf_milestones')->where('id = ' . $db->quote((int) $ms));
         $db->setQuery($query);
         $lvl = $db->loadResult();
         $access = in_array($lvl, $levels);
     }
     return $user->authorise('core.create', $asset) && $access;
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:37,代码来源:tasklistform.json.php

示例2: getUserRoute

 /**
  * Creates a link to a user item view
  *
  * @param     string    $id      The user slug
  *
  * @return    string    $link    The link
  */
 public static function getUserRoute($id)
 {
     static $dest = null;
     if (is_null($dest)) {
         $params = JComponentHelper::getParams('com_projectfork');
         $dest = $params->get('user_profile_link');
     }
     $link = null;
     switch ($dest) {
         case 'cb':
             $link = self::getCBRoute($id);
             break;
         case 'js':
             $link = self::getJSRoute($id);
             break;
         case 'kunena':
             $link = self::getKRoute($id);
             break;
     }
     if (!empty($link)) {
         return $link;
     }
     // Default - Projectfork Profile
     $link = 'index.php?option=com_pfusers&view=user';
     $link .= '&id=' . $id;
     $needles = array('id' => array((int) $id));
     if ($item = PFApplicationHelper::itemRoute($needles, 'com_pfusers.user')) {
         $link .= '&Itemid=' . $item;
     } elseif ($item = PFApplicationHelper::itemRoute(null, 'com_pfusers.users')) {
         $link .= '&Itemid=' . $item;
     }
     return $link;
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:40,代码来源:route.php

示例3: getItems

 /**
  * Method to get a list of tasks
  *
  * @return    array    $items    The tasks
  */
 public static function getItems($params)
 {
     JLoader::register('PFtasksModelTasks', JPATH_SITE . '/components/com_pftasks/models/tasks.php');
     $model = JModelLegacy::getInstance('Tasks', 'PFtasksModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 10));
     $model->setState('filter.published', 1);
     // Set project filter
     if (!(int) $params->get('tasks_of')) {
         $model->setState('filter.project', PFApplicationHelper::getActiveProjectId());
     } else {
         $project = (int) $params->get('project');
         if ($project) {
             $model->setState('filter.project', $project);
         } else {
             $model->setState('filter.project', PFApplicationHelper::getActiveProjectId());
         }
     }
     // Set completition filter
     $model->setState('filter.complete', $params->get('filter_complete'));
     // Sort and order
     $model->setState('list.ordering', $params->get('sort'));
     $model->setState('list.direction', $params->get('order'));
     $items = $model->getItems();
     return $items;
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:36,代码来源:helper.php

示例4: display

 /**
  * Displays the view.
  *
  */
 public function display($tpl = null)
 {
     // Get data from model
     $this->items = $this->get('Items');
     $this->state = $this->get('State');
     $this->albums = $this->get('Albums');
     $this->designs = $this->get('Designs');
     if (PFApplicationHelper::getActiveProjectId() <= 0) {
         $text = JText::_('COM_PROJECTFORK_DESIGNS_WARNING_IMPORT_SELECT_PROJECT');
         JFactory::getApplication()->enqueueMessage($text);
     }
     // Check for errors
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     if ($this->getLayout() !== 'modal') {
         $this->addToolbar();
         if (version_compare(JVERSION, '3', 'ge')) {
             PFdesignsHelper::addSubmenu('import');
             $this->sidebar = JHtmlSidebar::render();
         }
     }
     parent::display($tpl);
 }
开发者ID:MrJookie,项目名称:pm,代码行数:29,代码来源:view.html.php

示例5: preflight

 /**
  * Called before any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function preflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install' || strtolower($route) == 'update') {
         if (!defined('PF_LIBRARY')) {
             jimport('projectfork.library');
         }
         $name = htmlspecialchars($adapter->get('manifest')->name, ENT_QUOTES, 'UTF-8');
         // Check if the library is installed
         if (!defined('PF_LIBRARY')) {
             JError::raiseWarning(1, JText::_('This extension (' . $name . ') requires the Projectfork Library to be installed!'));
             return false;
         }
         // Check if the projectfork component is installed
         if (!PFApplicationHelper::exists('com_projectfork')) {
             JError::raiseWarning(1, JText::_('This extension (' . $name . ') requires the Projectfork Component to be installed!'));
             return false;
         }
     }
     if (strtolower($route) == 'uninstall') {
         $dest = JPATH_SITE . "/plugins/system/pftaskexpirynotifier/cron_pf_notifier.php";
         $src = JPATH_SITE . "/cli/cron_pf_notifier.php";
         //move the file back into its plugin folder otherwise the installer will complain when uninstalling.
         JFile::move($src, $dest);
     }
     return true;
 }
开发者ID:hlgrl13,项目名称:Projectfork-3rd-Party-Extensions,代码行数:34,代码来源:script.php

示例6: getButtons

 protected function getButtons()
 {
     $components = PFapplicationHelper::getComponents();
     $buttons = array();
     foreach ($components as $component) {
         if (!PFApplicationHelper::enabled($component->element)) {
             continue;
         }
         $helper = JPATH_ADMINISTRATOR . '/components/' . $component->element . '/helpers/dashboard.php';
         $class = str_replace('com_pf', 'PF', $component->element) . 'HelperDashboard';
         if (!JFile::exists($helper)) {
             continue;
         }
         JLoader::register($class, $helper);
         if (class_exists($class)) {
             if (in_array('getAdminButtons', get_class_methods($class))) {
                 $com_buttons = (array) call_user_func(array($class, 'getAdminButtons'));
                 $buttons[$component->element] = array();
                 foreach ($com_buttons as $button) {
                     $buttons[$component->element][] = $button;
                 }
             }
         }
     }
     return $buttons;
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:26,代码来源:view.html.php

示例7: addSubmenu

 /**
  * Configure the Linkbar.
  *
  * @param     string    $view    The name of the active view.
  *
  * @return    void               
  */
 public static function addSubmenu($view)
 {
     $is_j3 = version_compare(JVERSION, '3.0.0', 'ge');
     $forms = array('project', 'category');
     if (in_array($view, $forms) && $is_j3) {
         return;
     }
     $components = PFApplicationHelper::getComponents();
     $option = JFactory::getApplication()->input->get('option');
     $class = $is_j3 ? 'JHtmlSidebar' : 'JSubMenuHelper';
     foreach ($components as $component) {
         if ($component->enabled == '0') {
             continue;
         }
         $title = JText::_($component->element);
         $parts = explode('-', $title, 2);
         if (count($parts) == 2) {
             $title = trim($parts[1]);
         }
         call_user_func(array($class, 'addEntry'), $title, 'index.php?option=' . $component->element, $option == $component->element);
         if ($component->element == self::$extension && ($view == 'projects' || $view == 'categories')) {
             call_user_func(array($class, 'addEntry'), JText::_('COM_PROJECTFORK_SUBMENU_CATEGORIES'), 'index.php?option=com_categories&extension=' . $component->element, $view == 'categories');
         }
     }
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:32,代码来源:pfprojects.php

示例8: allowAdd

 /**
  * Method to check if you can add a new record.
  *
  * @param     array      $data    An array of input data.
  *
  * @return    boolean
  */
 protected function allowAdd($data = array())
 {
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $access = true;
     $project = isset($data['project_id']) ? (int) $data['project_id'] : PFApplicationHelper::getActiveProjectId();
     $album = isset($data['album_id']) ? (int) $data['album_id'] : 0;
     $asset = 'com_pfdesigns';
     // Check if the user has access to the album
     if (!$user->authorise('core.admin')) {
         if ($album && $access) {
             $query->clear();
             $query->select('access')->from('#__pf_design_albums')->where('id = ' . (int) $album);
             $db->setQuery($query);
             $access = in_array((int) $db->loadResult(), $levels);
         }
     }
     // Check if the user has access to the project
     if (!$user->authorise('core.admin')) {
         if ($project && $access) {
             $query->select('access')->from('#__pf_projects')->where('id = ' . (int) $project);
             $db->setQuery($query);
             $access = in_array((int) $db->loadResult(), $user->getAuthorisedViewLevels());
             // Change the asset name
             if (version_compare(PFVERSION, '4.2', 'ge')) {
                 $asset .= '.project.' . $project;
             }
         }
     }
     return $user->authorise('core.create', $asset) && $access;
 }
开发者ID:MrJookie,项目名称:pm,代码行数:39,代码来源:designform.json.php

示例9: populateState

 /**
  * Method to auto-populate the model state.
  * Note: Calling getState in this method will result in recursion.
  *
  * @param     string    $ordering     Default field to sort the items by
  * @param     string    $direction    Default list sorting direction
  *
  * @return    void
  */
 protected function populateState($ordering = 'a.created', $direction = 'desc')
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     // Adjust the context to support modal layouts.
     if ($layout = JRequest::getVar('layout')) {
         $this->context .= '.' . $layout;
     }
     // Filter - Search
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     // Filter - Author
     $author_id = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
     $this->setState('filter.author_id', $author_id);
     // Filter - State
     $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
     $this->setState('filter.published', $published);
     // Filter - Access
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '');
     $this->setState('filter.access', $access);
     // Filter - Project
     $project = PFApplicationHelper::getActiveProjectId('filter_project');
     $this->setState('filter.project', $project);
     // Disable author filter if no project is selected
     if (!$project) {
         $this->setState('filter.author_id', '');
     }
     // List state information.
     parent::populateState($ordering, $direction);
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:39,代码来源:topics.php

示例10: getButtons

 /**
  * Method to get a list of available buttons
  *
  * @return    array    $buttons    The available buttons
  */
 public static function getButtons()
 {
     $components = PFApplicationHelper::getComponents();
     $buttons = array();
     foreach ($components as $component) {
         if (!PFApplicationHelper::enabled($component->element)) {
             continue;
         }
         // Register component route helper if exists
         $router = JPATH_SITE . '/components/' . $component->element . '/helpers/route.php';
         $class = str_replace('com_pf', 'PF', $component->element) . 'HelperRoute';
         if (JFile::exists($router)) {
             JLoader::register($class, $router);
         }
         // Register component dashboard helper if exists
         $helper = JPATH_ADMINISTRATOR . '/components/' . $component->element . '/helpers/dashboard.php';
         $class = str_replace('com_pf', 'PF', $component->element) . 'HelperDashboard';
         if (!JFile::exists($helper)) {
             continue;
         }
         JLoader::register($class, $helper);
         // Get the dashboard button
         if (class_exists($class)) {
             if (in_array('getSiteButtons', get_class_methods($class))) {
                 $com_buttons = (array) call_user_func(array($class, 'getSiteButtons'));
                 $buttons[$component->element] = array();
                 foreach ($com_buttons as $button) {
                     $buttons[$component->element][] = $button;
                 }
             }
         }
     }
     return $buttons;
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:39,代码来源:helper.php

示例11: getMilestoneRoute

 /**
  * Creates a link to a milestone item view
  *
  * @param     string    $milestone_slug    The milestone slug
  * @param     string    $project_slug      The project slug. Optional
  *
  * @return    string    $link              The link
  */
 public static function getMilestoneRoute($milestone_slug, $project_slug = '')
 {
     if (!$project_slug) {
         $project_slug = PFApplicationHelper::getActiveProjectId();
     }
     $link = 'index.php?option=com_pfmilestones&view=milestone&filter_project=' . $project_slug . '&id=' . $milestone_slug;
     // Get the id from the slug
     if (strrpos($milestone_slug, ':') !== false) {
         $slug_parts = explode(':', $milestone_slug);
         $milestone_id = (int) $slug_parts[0];
     } else {
         $milestone_id = (int) $milestone_slug;
     }
     $needles = array('id' => array($milestone_slug));
     $item = PFApplicationHelper::itemRoute($needles, 'com_pfmilestones.milestone');
     if (!$item) {
         $app = JFactory::getApplication();
         // Stay on current menu item if we are viewing a milestone list
         if ($app->input->get('option') == 'com_pfmilestones' && $app->input->get('view') == 'milestones') {
             $item = PFApplicationHelper::getActiveMenuItemId();
         } else {
             // Find overview menu item
             $item = PFApplicationHelper::itemRoute(null, 'com_pfmilestones.milestones');
         }
     }
     if ($item) {
         $link .= '&Itemid=' . $item;
     }
     return $link;
 }
开发者ID:eno93,项目名称:Projectfork,代码行数:38,代码来源:route.php

示例12: getInput

 /**
  * Method to get the user field input markup.
  *
  * @return    string    The field input markup.
  */
 protected function getInput()
 {
     static $js_loaded = false;
     if ($js_loaded === false) {
         // Make sure the JS is loaded only once
         $js_loaded = true;
         $script = $this->getJavascript();
         JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     }
     $task_id = (int) $this->form->getValue('task_id');
     $id = (int) $this->form->getValue('id');
     if ($task_id && (!$this->value || $this->value == '0.00')) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('rate')->from('#__pf_tasks')->where('id = ' . $task_id);
         $db->setQuery($query);
         $task_rate = $db->loadResult();
         if ($task_rate) {
             $this->value = $task_rate;
         }
     }
     // Setup field values
     if ($this->value) {
         $v1 = substr($this->value, 0, -3);
         $v2 = substr($this->value, -2);
     } else {
         $this->value = '0.00';
         $v1 = '0';
         $v2 = '00';
         // Pre-fill from previously entered value
         if (empty($id) || $id === '0') {
             $cached = JFactory::getApplication()->getUserState('com_projectfork.' . $this->id);
             if ($cached && $cached != '0.00') {
                 $this->value = $cached;
                 $v1 = substr($this->value, 0, -3);
                 $v2 = substr($this->value, -2);
             }
         }
     }
     // Get params
     $params = PFApplicationHelper::getProjectParams();
     // Initialize some field attributes.
     $attribs = array();
     $attribs['readonly'] = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
     $attribs['disabled'] = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attribs['maxlength'] = (int) $this->element['maxlength'] != '' ? $this->element['maxlength'] : 4;
     $attribs['currency'] = $params->get('currency_sign');
     $attribs['decimal'] = $params->get('decimal_delimiter');
     $attribs['position'] = $params->get('currency_position');
     if ($attribs['readonly'] == '' && $attribs['disabled'] == '') {
         $attribs['onchange'] = ' onchange="setMoneyFieldValue(\'' . $this->id . '\');"';
     } else {
         $attribs['onchange'] = '';
     }
     // Get HTML
     $html = $this->getHTML($v1, $v2, $attribs);
     // Return HTML
     return implode("\n", $html);
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:64,代码来源:money.php

示例13: getProjectsRoute

 /**
  * Creates a link to the projects overview
  *
  * @return    string    $link    The link
  */
 public static function getProjectsRoute()
 {
     $link = 'index.php?option=com_pfprojects&view=projects';
     if ($item = PFApplicationHelper::itemRoute(null, 'com_pfprojects.projects')) {
         $link .= '&Itemid=' . $item;
     }
     return $link;
 }
开发者ID:sgershen,项目名称:Projectfork,代码行数:13,代码来源:route.php

示例14: __construct

 public function __construct()
 {
     $pcfg = PFApplicationHelper::getProjectParams();
     $this->curr_code = $pcfg->get('currency_code');
     $this->curr_sign = $pcfg->get('currency_sign');
     $this->curr_pos = $pcfg->get('currency_position');
     $cid = (int) JRequest::getVar('cid', null);
     $this->pid = $cid;
 }
开发者ID:hlgrl13,项目名称:Projectfork-3rd-Party-Extensions,代码行数:9,代码来源:helper.php

示例15: getProjectEditRoute

 public static function getProjectEditRoute($project)
 {
     $link = 'index.php?option=com_pfprojects&task=form.edit&id=' . $project;
     if ($item = PFApplicationHelper::itemRoute(null, 'com_pfprojects.form')) {
         $link .= '&Itemid=' . $item;
     } elseif ($item = PFApplicationHelper::itemRoute(null, 'com_pfprojects.projects')) {
         $link .= '&Itemid=' . $item;
     }
     return $link;
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:10,代码来源:route.php


注:本文中的PFApplicationHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。