function render() { $active_worker = PortSensorApplication::getActiveWorker(); $translate = DevblocksPlatform::getTranslationService(); $visit = PortSensorApplication::getVisit(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $response = DevblocksPlatform::getHttpResponse(); $tpl->assign('request_path', implode('/', $response->path)); // View $sensorsView = Ps_AbstractViewLoader::getView(self::VIEW_ALL_SENSORS); if (null == $sensorsView) { $sensorsView = new Ps_SensorView(); $sensorsView->id = self::VIEW_ALL_SENSORS; $sensorsView->name = $translate->_('core.menu.sensors'); $sensorsView->renderLimit = 25; $sensorsView->renderPage = 0; $sensorsView->renderSortBy = SearchFields_Sensor::NAME; $sensorsView->renderSortAsc = 1; $sensorsView->params = array(SearchFields_Sensor::IS_DISABLED => new DevblocksSearchCriteria(SearchFields_Sensor::IS_DISABLED, '=', 0)); Ps_AbstractViewLoader::setView($sensorsView->id, $sensorsView); } /* * [TODO] This doesn't need to save every display, but it was possible to * lose the params in the saved version of the view in the DB w/o recovery. * This should be moved back into the if(null==...) check in a later build. */ $tpl->assign('response_uri', 'sensors'); // $quick_search_type = $visit->get('crm.opps.quick_search_type'); // $tpl->assign('quick_search_type', $quick_search_type); $tpl->assign('view', $sensorsView); $tpl->assign('view_fields', Ps_SensorView::getFields()); $tpl->assign('view_searchable_fields', Ps_SensorView::getSearchFields()); $tpl->display('file:' . $this->_TPL_PATH . 'sensors/index.tpl'); }
function isVisible() { // check login $visit = PortSensorApplication::getVisit(); if (empty($visit)) { return false; } else { return true; } }
function showTabSensorsAction() { $visit = PortSensorApplication::getVisit(); $translate = DevblocksPlatform::getTranslationService(); $active_worker = PortSensorApplication::getActiveWorker(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); // Select tab // $visit->set(PortSensorVisit::KEY_HOME_SELECTED_TAB, 'sensors'); // My Notifications $sensorsView = Ps_AbstractViewLoader::getView(self::VIEW_ACTIVE_SENSORS); // $title = vsprintf($translate->_('home.my_notifications.view.title'), $active_worker->getName()); if (null == $sensorsView) { $sensorsView = new Ps_SensorView(); $sensorsView->id = self::VIEW_ACTIVE_SENSORS; // $sensorsView->name = $title; $sensorsView->renderLimit = 25; $sensorsView->renderPage = 0; $sensorsView->renderSortBy = SearchFields_Sensor::NAME; $sensorsView->renderSortAsc = 1; } // Overload criteria $sensorsView->name = 'Active Sensors'; $sensorsView->params = array(SearchFields_Sensor::IS_DISABLED => new DevblocksSearchCriteria(SearchFields_Sensor::IS_DISABLED, '=', 0)); /* * [TODO] This doesn't need to save every display, but it was possible to * lose the params in the saved version of the view in the DB w/o recovery. * This should be moved back into the if(null==...) check in a later build. */ Ps_AbstractViewLoader::setView($sensorsView->id, $sensorsView); $tpl->assign('view', $sensorsView); $tpl->display('file:' . $this->_TPL_PATH . 'home/tabs/sensors/index.tpl'); }
function viewDoCopyAction() { $translate = DevblocksPlatform::getTranslationService(); $active_worker = PortSensorApplication::getActiveWorker(); $visit = PortSensorApplication::getVisit(); @($view_id = DevblocksPlatform::importGPC($_POST['view_id'], 'string')); $view = Ps_AbstractViewLoader::getView($view_id); @($list_title = DevblocksPlatform::importGPC($_POST['list_title'], 'string', '')); @($workspace = DevblocksPlatform::importGPC($_POST['workspace'], 'string', '')); @($new_workspace = DevblocksPlatform::importGPC($_POST['new_workspace'], 'string', '')); if (empty($workspace) && empty($new_workspace)) { $new_workspace = $translate->_('New Workspace'); } if (empty($list_title)) { $list_title = $translate->_('New Worklist'); } $workspace_name = !empty($new_workspace) ? $new_workspace : $workspace; // Find the proper workspace source based on the class of the view $source_manifests = DevblocksPlatform::getExtensions(Extension_WorklistSource::EXTENSION_POINT, false); $source_manifest = null; if (is_array($source_manifests)) { foreach ($source_manifests as $mft) { if (is_a($view, $mft->params['view_class'])) { $source_manifest = $mft; break; } } } if (!is_null($source_manifest)) { // View params inside the list for quick render overload $list_view = new Model_WorklistView(); $list_view->title = $list_title; $list_view->num_rows = $view->renderLimit; $list_view->columns = $view->view_columns; $list_view->params = $view->params; $list_view->sort_by = $view->renderSortBy; $list_view->sort_asc = $view->renderSortAsc; // Save the new worklist $fields = array(DAO_Worklist::WORKER_ID => $active_worker->id, DAO_Worklist::WORKSPACE => $workspace_name, DAO_Worklist::SOURCE_EXTENSION => $source_manifest->id, DAO_Worklist::VIEW_SERIALIZED => serialize($list_view), DAO_Worklist::VIEW_POS => 99); $list_id = DAO_Worklist::create($fields); } // Select the workspace tab $visit->set(PortSensorVisit::KEY_HOME_SELECTED_TAB, 'w_' . $workspace_name); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home'))); }
private static function _save() { // persist $visit = PortSensorApplication::getVisit(); $visit->set(self::VISIT_ABSTRACTVIEWS, self::$views); }