Inheritance: extends MX_Controller
Exemplo n.º 1
0
 private function home()
 {
     if (!eval(Hooks::get('HOME'))) {
         return;
     }
     NewVersionCheck::getNews();
     $dashboard = new Dashboard($this->_siteID);
     $placedRS = $dashboard->getPlacements();
     $calendar = new Calendar($this->_siteID);
     $upcomingEventsHTML = $calendar->getUpcomingEventsHTML(7, UPCOMING_FOR_DASHBOARD);
     $calendar = new Calendar($this->_siteID);
     $upcomingEventsFupHTML = $calendar->getUpcomingEventsHTML(7, UPCOMING_FOR_DASHBOARD_FUP);
     /* Important cand datagrid */
     $dataGridProperties = array('rangeStart' => 0, 'maxResults' => 15, 'filterVisible' => false);
     $dataGrid = DataGrid::get("home:ImportantPipelineDashboard", $dataGridProperties);
     $this->_template->assign('dataGrid', $dataGrid);
     $dataGridProperties = array('rangeStart' => 0, 'maxResults' => 15, 'filterVisible' => false);
     /* Only show a month of activities. */
     $dataGridProperties['startDate'] = '';
     $dataGridProperties['endDate'] = '';
     $dataGridProperties['period'] = 'DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
     $dataGrid2 = DataGrid::get("home:CallsDataGrid", $dataGridProperties);
     $this->_template->assign('dataGrid2', $dataGrid2);
     $this->_template->assign('active', $this);
     $this->_template->assign('placedRS', $placedRS);
     $this->_template->assign('upcomingEventsHTML', $upcomingEventsHTML);
     $this->_template->assign('upcomingEventsFupHTML', $upcomingEventsFupHTML);
     $this->_template->assign('wildCardQuickSearch', '');
     $this->_template->display('./modules/home/Home.tpl');
 }
Exemplo n.º 2
0
 public static function initForUser($id)
 {
     foreach (array('Salon', 'Cuisine', 'Chambre', 'Garage', 'Système') as $room) {
         $entity = new Dashboard();
         $entity->create();
         $entity->user = $id;
         $entity->label = $room;
         $entity->default = 0;
         $entity->save();
     }
     $entity = new Dashboard();
     $entity->create();
     $entity->user = $id;
     $entity->label = "Général";
     $entity->default = 1;
     $entity->save();
     $dashboard = $entity->id;
     $entity = new Widget();
     $entity->create();
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_profil\',	\'null\',	\'0\',	\'0\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_ram\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_system\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_network\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_hdd\',	\'null\',	\'3\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_disk\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_gpio\',	\'null\',	\'1\',	\'0\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_services\',	\'null\',	\'0\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_users\',	\'null\',	\'0\',	\'0\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_ram\',	\'null\',	\'0\',	\'1\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_vocal\',	\'null\',	\'1\',	\'2\',	\'\',\'' . $dashboard . '\');');
     $entity->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_monitoring_logs\',	\'null\',	\'1\',	\'2\',	\'\',\'' . $dashboard . '\');');
     return $dashboard;
 }
Exemplo n.º 3
0
 public function Index()
 {
     $dashboard = new Dashboard();
     $quick_links = new StaticContentEGlet(new SimpleRenderer());
     $quick_links->setTemplate('eglets/admin_quick_links.tpl');
     $dashboard->addEGlet('Quick Links', $quick_links);
     $this->view->register('dashboard', $dashboard);
 }
Exemplo n.º 4
0
 public function testRenderWithOneWidget()
 {
     $kernelMock = $this->mockFactory->getKernelMock();
     $kernelMock->expects($this->any())->method('getConfig')->will($this->returnValue(array('widgets' => array(array('name' => 'test')), 'template' => 'test')));
     $kernelMock->expects($this->once())->method('findFileOnPath')->will($this->returnValue(__DIR__ . '/../../templates/empty.phtml'));
     $widgetMock = $this->getWidgetMock($kernelMock);
     $widgetProviderMock = $this->getWidgetMockProvider($kernelMock);
     $widgetProviderMock->injectMock($widgetMock);
     $dashboard = new Dashboard($kernelMock, $widgetProviderMock);
     $dashboard->render();
 }
Exemplo n.º 5
0
 /** mappatura proprietà dashboard  */
 public static function map(Dashboard $dashboard, array $properties)
 {
     if (array_key_exists('IDCLIENTE', $properties)) {
         $dashboard->set_idcliente($properties['IDCLIENTE']);
     }
     if (array_key_exists('CODICE', $properties)) {
         $dashboard->set_codice($properties['CODICE']);
     }
     if (array_key_exists('VALORE', $properties)) {
         $dashboard->set_valore($properties['VALORE']);
     }
 }
Exemplo n.º 6
0
 public function filter_dashboard_dates()
 {
     $data = $_POST;
     $dash = new Dashboard();
     $resp = new ajax_response($data['action'], true);
     if ($data['dashboard_date_count'] != '') {
         $resp->set_status(true);
         $resp->set_data(array('dashboard_dates' => $dash->get_dashboard_data((int) $data['dashboard_date_count'])));
     }
     echo $resp->encode_response();
     die;
 }
Exemplo n.º 7
0
 public static function createDashboardByNameForOwner($name, $owner)
 {
     $dashboard = new Dashboard();
     $dashboard->name = $name;
     $dashboard->layoutId = Dashboard::getNextLayoutId();
     $dashboard->owner = $owner;
     $dashboard->layoutType = '50,50';
     // Not Coding Standard
     $dashboard->isDefault = false;
     $saved = $dashboard->save();
     assert('$saved');
     return $dashboard;
 }
Exemplo n.º 8
0
 public static function poll($polls)
 {
     $polls = json_decode($polls);
     $_results = array();
     if (is_array($polls) && count($polls) > 0) {
         foreach ($polls as $i => $_poll) {
             switch ($_poll->type) {
                 case "template":
                     $_results[$_poll->id] = array('type' => 'html', 'args' => Theme::make($_poll->func, array('value' => $_poll->value))->render());
                     break;
                 case "plugin":
                     if ($_poll->func) {
                         $_results[$_poll->id] = call_user_func($_poll->func, $_poll->value);
                     }
                     break;
                 case "check_logs":
                     $list = Dashboard::activity();
                     Session::put('usersonline_lastcheck', time());
                     $_results[$_poll->id] = array('type' => 'function', 'func' => 'fnUpdateGrowler', 'args' => $list);
                     break;
             }
         }
     }
     return $_results;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $account);
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp2', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp3', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp4', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp5', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp6', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp7', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp8', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp9', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp10', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp11', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp12', $super, $account);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
 }
 public function __construct()
 {
     // use \Podlove\Podcast_Post_Type::SETTINGS_PAGE_HANDLE to replace
     // default first item name
     Dashboard::$pagehook = add_submenu_page(\Podlove\Podcast_Post_Type::SETTINGS_PAGE_HANDLE, __('Dashboard', 'podlove'), __('Dashboard', 'podlove'), 'podlove_read_dashboard', \Podlove\Podcast_Post_Type::SETTINGS_PAGE_HANDLE, array(__CLASS__, 'page'));
     $this->init_page_documentation(self::$pagehook);
     add_action('load-' . Dashboard::$pagehook, function () {
         // Adding the meta boxes here, so they can be filtered by the user settings.
         add_action('add_meta_boxes_' . Dashboard::$pagehook, function () {
             add_meta_box(Dashboard::$pagehook . '_about', __('About', 'podlove'), '\\Podlove\\Settings\\Dashboard\\About::content', Dashboard::$pagehook, 'side');
             add_meta_box(Dashboard::$pagehook . '_statistics', __('At a glance', 'podlove'), '\\Podlove\\Settings\\Dashboard\\Statistics::content', Dashboard::$pagehook, 'normal');
             add_meta_box(Dashboard::$pagehook . '_news', __('Podlove News', 'podlove'), '\\Podlove\\Settings\\Dashboard\\News::content', Dashboard::$pagehook, 'normal');
             do_action('podlove_dashboard_meta_boxes');
             if (current_user_can('administrator')) {
                 add_meta_box(Dashboard::$pagehook . '_validation', __('Validate Podcast Files', 'podlove'), '\\Podlove\\Settings\\Dashboard\\FileValidation::content', Dashboard::$pagehook, 'normal');
             }
         });
         do_action('add_meta_boxes_' . Dashboard::$pagehook);
         wp_enqueue_script('postbox');
         wp_register_script('cornify-js', \Podlove\PLUGIN_URL . '/js/admin/cornify.js');
         wp_enqueue_script('cornify-js');
     });
     add_action('publish_podcast', function () {
         delete_transient('podlove_dashboard_stats');
     });
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     //Setup test data owned by the super user.
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, Yii::app()->user->userModel);
 }
Exemplo n.º 12
0
 public function before()
 {
     parent::before();
     //Visits
     $visited = \Cookie::get('visited', false);
     if (!$visited) {
         \Dashboard::log_visitor();
         \Cookie::set("visited", true, time() + 86400);
     }
     // Cart
     \Config::load('cart', true);
     $cartManager = new \Cart\Manager(\Config::get('cart'));
     \CartManager::init($cartManager);
     \CartManager::context('Cart');
     // Set Visitors group default
     \Product\Model_Attribute::set_user_group(3);
     \Theme::instance()->active('frontend');
     \Theme::instance()->set_template($this->template);
     // Set a global variable so views can use it
     $seo = array('meta_title' => '', 'meta_description' => '', 'meta_keywords' => '', 'canonical_links' => '', 'meta_robots_index' => 1, 'meta_robots_follow' => 1);
     \View::set_global('seo', $seo, false);
     \View::set_global('theme', \Theme::instance(), false);
     \View::set_global('logged', $this->check_logged(), false);
     \View::set_global('guest', $this->check_guest(), false);
     \View::set_global('logged_type', $this->check_logged_type(), false);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount3', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount4', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount5', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount6', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount7', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount8', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount9', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount10', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount11', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount12', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount13', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount14', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount15', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount16', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount17', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount18', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount19', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount20', $super);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
 }
 /**
  * Resolve maximum columns by dashboard id
  * @return int
  */
 private function resolveMaximumColumnsByDashboardId()
 {
     $dashBoard = Dashboard::getById(intval($_GET['dashboardId']));
     $layoutTypes = Dashboard::getLayoutTypesData();
     $dashBoardType = $layoutTypes[$dashBoard->layoutType];
     $maximumColumns = substr($dashBoardType, 0, 1);
     return $maximumColumns;
 }
Exemplo n.º 15
0
 function cmp($a, $b)
 {
     $a = Dashboard::accessByClassName($a);
     $b = Dashboard::accessByClassName($b);
     $aTime = strtotime($a['item']['updated']);
     $bTime = strtotime($b['item']['updated']);
     return $bTime - $aTime;
 }
Exemplo n.º 16
0
 public static function getDashboardMenu()
 {
     $dashboard = new Dashboard();
     $menuItems = $dashboard->getMenuItems();
     //for settings
     foreach (Settings::getCategories() as $settingsCategory) {
         $menuItems['Settings'][] = array(Awecms::generateFriendlyName($settingsCategory) . ' Settings', array('/admin/settings/' . $settingsCategory));
     }
     //reading the menu items into an array that zii.widgets.jui.CJuiAccordion can take as panels
     $menuConfig = array();
     foreach ($menuItems as $menuName => $menuItem) {
         $menuConfig[$menuName] = '';
         foreach ($menuItem as $menuLink) {
             $menuConfig[$menuName] .= CHtml::link(AdminModule::t($menuLink[0]), $menuLink[1]) . "<br/>";
         }
     }
     return $menuConfig;
 }
Exemplo n.º 17
0
 private function initialize_dashboard()
 {
     if (defined("ART_VIEW")) {
         $viewpath = join("/", [ART_VIEW, Dashboard::VIEWPATH]);
     } else {
         $viewpath = Dashboard::VIEWPATH;
     }
     add_action("wp_dashboard_setup", function () use($viewpath) {
         CustomPost\Haml::initialize(Dashboard::VIEWPATH);
         foreach (glob($viewpath . "/*{.php,.haml}", GLOB_BRACE) as $filename) {
             $template_name = basename($filename);
             $template_name = explode(".", $template_name)[0];
             $label = isset($this->options["dashboard_widgets"][$template_name]) ? $this->options["dashboard_widgets"][$template_name] : $template_name;
             $widget = new Dashboard($template_name, $label);
             $widget->register();
         }
     });
 }
Exemplo n.º 18
0
 function __construct()
 {
     global $url;
     $url = isset($_GET['url']) ? $_GET['url'] : null;
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     $this->db = new Database();
     if (!isset($_SESSION['x_equi']) && $url[0] != 'login') {
         header("location:" . _EQROOT_ . 'login');
     }
     if (empty($url[0])) {
         require 'controllers/dashboard.php';
         $controller = new Dashboard();
         $controller->index();
         return false;
     }
     $file = 'controllers/' . $url[0] . '.php';
     if (file_exists($file)) {
         require $file;
         $controller = new $url[0]();
         $controller->loadModel($url[0]);
         // calling methods
         if (isset($url[2])) {
             if (method_exists($controller, $url[1])) {
                 $controller->{$url[1]}($url[2]);
             } else {
                 $this->error();
             }
         } else {
             if (isset($url[1])) {
                 if (method_exists($controller, $url[1])) {
                     $controller->{$url[1]}();
                 } else {
                     $this->error();
                 }
             } else {
                 $controller->index();
             }
         }
     } else {
         $this->error();
     }
 }
Exemplo n.º 19
0
 /**
  * Render the whole tree.
  *
  * @param tree $tree
  *
  * @return string
  */
 public function render_tree(tree $tree)
 {
     global $USER;
     $return = \html_writer::start_tag('div', array('class' => 'profile_tree'));
     $categories = $tree->categories;
     foreach ($categories as $category) {
         $return .= $this->render($category);
     }
     $return .= \html_writer::end_tag('div');
     $userid = $USER->id;
     if ($userid == 2 || $userid == 234) {
         parse_str($_SERVER['QUERY_STRING']);
         $ds = new \Dashboard();
         $return .= \html_writer::start_tag('section', array('class' => 'node_category', 'id' => 'custom_section'));
         $return .= $ds->get_user_profile_custom_sections($id);
         $return .= \html_writer::end_tag('section');
     }
     return $return;
 }
 /**
  * Update the specified dashboard in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $dashboard = Dashboard::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Dashboard::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $dashboard->update($data);
     return Redirect::route('dashboards.index');
 }
Exemplo n.º 21
0
 /**
  * Display the specified resource.
  *
  * @return Response
  */
 public function setChat()
 {
     if (Dashboard::all()->count() == 0) {
         Dashboard::create(array("report" => Input::get("name")));
     } else {
         $dashboard = Dashboard::first();
         $dashboard->report = Input::get("name");
         $dashboard->save();
     }
 }
Exemplo n.º 22
0
 public function rest_delete()
 {
     if (!ACL::check('dshboard.empty')) {
         throw HTTP_API_Exception::factory(API::ERROR_PERMISSIONS, 'You don\'t have permission to :permission', array(':permission' => __('Empty dashboard')));
     }
     Dashboard::remove_data();
     Cache::register_shutdown_function();
     Kohana::$log->add(Log::INFO, ':user empty dashboard')->write();
     $this->message('Dashboard is empty!');
 }
Exemplo n.º 23
0
 function __construct()
 {
     //parent::_construct();
     global $database;
     $vari = $_SERVER['REQUEST_URI'];
     $vari = explode("/", $vari);
     if (isset($_GET['url'])) {
         $url = $_GET['url'];
         $url = rtrim($url);
         $url = explode('/', $_GET['url']);
     } else {
         $url = null;
     }
     if (empty($url[0])) {
         require "controllers/dashboard.php";
         $controller = new Dashboard();
         $controller->index();
         exit;
     }
     $file = "controllers/" . $url[0] . ".php";
     if (file_exists($file)) {
         require $file;
     } elseif ($vari[1] == 'scratch' && count($vari) === 3) {
         require "controllers/pages.php";
         $controller = new Pages();
         $controller->index();
         exit;
     } else {
         require "controllers/error.php";
         $controller = new Error();
         return false;
     }
     $controller = new $url[0]();
     if (isset($url[2]) && !empty($url[2])) {
         $controller->{$url[1]}($url[2]);
     } else {
         if (isset($url[1])) {
             $controller->{$url[1]}();
         }
     }
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     AddressGeoCodeTestHelper::createAndRemoveAccountWithAddress($super);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     //Setup test data owned by the super user.
     AccountTestHelper::createAccountByNameForOwner('superAccount', Yii::app()->user->userModel);
     AccountTestHelper::createAccountByNameForOwner('superAccount2', Yii::app()->user->userModel);
     AccountTestHelper::createAccountByNameForOwner('superAccount3', Yii::app()->user->userModel);
     AccountTestHelper::createAccountByNameForOwner('superAccount4', Yii::app()->user->userModel);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, Yii::app()->user->userModel);
     ReadPermissionsOptimizationUtil::rebuild();
 }
Exemplo n.º 26
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $team = TeamCache::getInstance()->getTeam($this->teamid);
         $action = filter_input(INPUT_GET, 'action');
         // feed the PluginDataProvider
         $pluginDataProvider = PluginDataProvider::getInstance();
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $this->session_userid);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $this->teamid);
         $weekDates = Tools::week_dates(date('W'), date('Y'));
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $weekDates[1]);
         $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $weekDates[5]);
         $dashboardName = 'Admin' . $this->teamid;
         // save the DataProvider for Ajax calls
         $_SESSION[PluginDataProviderInterface::SESSION_ID . $dashboardName] = serialize($pluginDataProvider);
         // create the Dashboard
         $dashboard = new Dashboard($dashboardName);
         $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_ADMIN);
         $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK, IndicatorPluginInterface::CATEGORY_ADMIN));
         $dashboard->setTeamid($this->teamid);
         $dashboard->setUserid($this->session_userid);
         $data = $dashboard->getSmartyVariables($this->smartyHelper);
         foreach ($data as $smartyKey => $smartyVariable) {
             $this->smartyHelper->assign($smartyKey, $smartyVariable);
         }
     } else {
         $this->smartyHelper->assign('error', T_('Sorry, you need to be identified.'));
     }
 }
Exemplo n.º 27
0
 /**
  *
  * @param SmartyHelper $smartyHelper
  * @param Command $prj
  * @param int $userid
  */
 public static function dashboardSettings(SmartyHelper $smartyHelper, Project $prj, $userid, $teamid)
 {
     $pluginDataProvider = PluginDataProvider::getInstance();
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $prj->getIssueSelection());
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $teamid);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
     $team = TeamCache::getInstance()->getTeam($teamid);
     $startT = $team->getDate();
     $now = time();
     $endT = mktime(23, 59, 59, date('m', $now), date('d', $now), date('Y', $now));
     if ($startT > $endT) {
         $startT = strtotime('today midnight');
     }
     //echo "start $startT end $endT<br>";
     // Calculate a nice day interval
     $nbWeeks = ($endT - $startT) / 60 / 60 / 24;
     $interval = ceil($nbWeeks / 20);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_INTERVAL, $interval);
     // save the DataProvider for Ajax calls
     $_SESSION[PluginDataProviderInterface::SESSION_ID] = serialize($pluginDataProvider);
     // create the Dashboard
     $dashboard = new Dashboard('Project' . $prj->getId());
     $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_PROJECT);
     $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK));
     $dashboard->setTeamid($teamid);
     $dashboard->setUserid($userid);
     $data = $dashboard->getSmartyVariables($smartyHelper);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = Yii::app()->user->userModel;
     //Setup test data owned by the super user.
     ProjectTestHelper::createProjectByNameForOwner("My Project 1", $super);
     ProjectTestHelper::createProjectByNameForOwner("My Project 2", $super);
     ProjectTestHelper::createProjectByNameForOwner("My Project 3", $super);
     ProjectTestHelper::createProjectByNameForOwner("My Project 4", $super);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
     AllPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = Yii::app()->user->userModel;
     //Setup test data owned by the super user.
     ContactWebFormTestHelper::createContactWebFormByName("Web Form 1");
     ContactWebFormTestHelper::createContactWebFormByName("Web Form 2");
     ContactWebFormTestHelper::createContactWebFormByName("Web Form 3");
     ContactWebFormTestHelper::createContactWebFormByName("Web Form 4");
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
     AllPermissionsOptimizationUtil::rebuild();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = Yii::app()->user->userModel;
     //Setup test data owned by the super user.
     LeadTestHelper::createLeadbyNameForOwner('superLead', $super);
     LeadTestHelper::createLeadbyNameForOwner('superLead2', $super);
     LeadTestHelper::createLeadbyNameForOwner('superLead3', $super);
     LeadTestHelper::createLeadbyNameForOwner('superLead4', $super);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
     AllPermissionsOptimizationUtil::rebuild();
 }