예제 #1
0
 /**
  * Called after 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 postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install') {
         $element = $adapter->get('element');
         // Restore assets from backup
         PFInstallerHelper::restoreAssets($element);
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
         // Create a menu item in the projectfork site menu
         $com = JComponentHelper::getComponent($element);
         $eid = is_object($com) && isset($com->id) ? $com->id : 0;
         if ($eid) {
             $item = array();
             $item['title'] = 'Time Tracking';
             $item['alias'] = 'timetracking';
             $item['link'] = 'index.php?option=' . $element . '&view=timesheet';
             $item['component_id'] = $eid;
             PFInstallerHelper::addMenuItem($item);
         }
     }
     if (strtolower($route) == 'update') {
         $element = $adapter->get('element');
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
     }
     return true;
 }
예제 #2
0
파일: script.php 프로젝트: MrJookie/pm
 /**
  * Called after 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 postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install') {
         $element = $adapter->get('element');
         // Restore assets from backup
         PFInstallerHelper::restoreAssets($element);
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
         // Create a menu item in the projectfork site menu
         $com = JComponentHelper::getComponent($element);
         $eid = is_object($com) && isset($com->id) ? $com->id : 0;
         if ($eid) {
             $item = array();
             $item['title'] = 'Designs';
             $item['alias'] = 'designs';
             $item['link'] = 'index.php?option=' . $element . '&view=designs';
             $item['component_id'] = $eid;
             PFInstallerHelper::addMenuItem($item);
         }
     }
     if (strtolower($route) == 'update') {
         $element = $adapter->get('element');
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
         // Delete duplicate top-level admin menu entry if it exists
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('id')->from('#__menu')->where('level = 1')->where('menutype = ' . $db->quote('main'))->where('link = "index.php?option=' . $element . '&view=designs"');
         $db->setQuery($query);
         $item_id = (int) $db->loadResult();
         if ($item_id) {
             $menu = JTable::getInstance('menu');
             $menu->delete($item_id);
         }
     }
     if (in_array(strtolower($route), array('install', 'update'))) {
         $this->installPlugins($adapter);
     }
     return true;
 }
 *
 * @author       Tobias Kuhn (eaxs)
 * @copyright    Copyright (C) 2006-2012 Tobias Kuhn. All rights reserved.
 * @license      http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
 */
defined('_JEXEC') or die;
// Get new component id.
$com = JComponentHelper::getComponent('com_projectfork');
$com_id = is_object($com) && isset($com->id) ? $com->id : 0;
if ($com_id) {
    $item = array();
    $item['title'] = 'Dashboard';
    $item['alias'] = 'dashboard';
    $item['link'] = 'index.php?option=com_projectfork&view=dashboard';
    $item['component_id'] = $com_id;
    PFInstallerHelper::addMenuItem($item);
}
// Restore admin component menu item if not exists (Joomla 3.4)
if (version_compare(JVERSION, '3.4', 'ge')) {
    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    // Check if the menu item exists
    $query->select('id')->from('#__menu')->where('title = ' . $db->quote('com_projectfork'))->where('menutype = ' . $db->quote('main'))->where('client_id = 1');
    $db->setQuery($query);
    $menu_id = (int) $db->loadResult();
    if ($menu_id) {
        return true;
    }
    $data = array();
    $data['menutype'] = 'main';
    $data['title'] = 'com_projectfork';