Exemplo n.º 1
0
 function render()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $translate = DevblocksPlatform::getTranslationService();
     $tpl_path = dirname(dirname(__FILE__)) . '/templates/';
     $tpl->assign('path', $tpl_path);
     $tpl->assign('core_tplpath', $core_tplpath);
     $tpl->assign('view_id', $view_id);
     $title = $translate->_('account.tab.account.title');
     $defaults = new Feg_AbstractViewModel();
     $defaults->id = "customer_view_account";
     $defaults->class_name = 'View_CustomerAccount';
     $defaults->renderSortBy = SearchFields_CustomerAccount::ID;
     $defaults->renderSortAsc = 1;
     $defaults->name = $title;
     $view = Feg_AbstractViewLoader::getView($defaults->id, $defaults);
     $tpl->assign('view', $view);
     $tpl->assign('view_fields', View_CustomerAccount::getFields());
     $tpl->assign('view_searchable_fields', View_CustomerAccount::getSearchFields());
     $tpl->display('file:' . $this->_TPL_PATH . 'account/accounts.tpl');
 }
Exemplo n.º 2
0
 function doAccountBulkUpdateAction()
 {
     // Checked rows
     @($ids_str = DevblocksPlatform::importGPC($_REQUEST['ids'], 'string'));
     $ids = DevblocksPlatform::parseCsvString($ids_str);
     // Filter: whole list or check
     @($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
     // View
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     $view = Feg_AbstractViewLoader::getView($view_id);
     // Customer Recpiept Fields.
     @($is_disabled = trim(DevblocksPlatform::importGPC($_POST['account_is_disabled'], 'string', '')));
     $do = array();
     // Do: Disabled
     if (0 != strlen($is_disabled)) {
         $do['is_disabled'] = $is_disabled;
     }
     // Do: Custom fields
     $do = DAO_CustomFieldValue::handleBulkPost($do);
     $view->doBulkUpdate($filter, $do, $ids);
     $view->render();
     return;
 }
Exemplo n.º 3
0
 function saveMessageRecipientFailurePeekAction()
 {
     @($id = DevblocksPlatform::importGPC($_POST['id'], 'integer'));
     @($view_id = DevblocksPlatform::importGPC($_POST['view_id'], 'string'));
     @($retry = DevblocksPlatform::importGPC($_POST['retry'], 'integer', 0));
     $fields = array(DAO_MessageRecipient::SEND_STATUS => $retry);
     $status = DAO_MessageRecipient::update($id, $fields);
     if (!empty($view_id)) {
         $view = Feg_AbstractViewLoader::getView($view_id);
         $view->render();
     }
     //DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup','workers')));
 }
Exemplo n.º 4
0
 function viewSaveCustomizeAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     @($id = DevblocksPlatform::importGPC($_REQUEST['id']));
     @($columns = DevblocksPlatform::importGPC($_REQUEST['columns'], 'array', array()));
     @($num_rows = DevblocksPlatform::importGPC($_REQUEST['num_rows'], 'integer', 10));
     $num_rows = max($num_rows, 1);
     // make 1 the minimum
     $view = Feg_AbstractViewLoader::getView($id);
     $view->doCustomize($columns, $num_rows);
     $active_worker = FegApplication::getActiveWorker();
     // Conditional Persist
     //		if(substr($id,0,5)=="cust_") { // custom workspace
     //			$list_view_id = intval(substr($id,5));
     //
     //			// Special custom view fields
     //			@$title = DevblocksPlatform::importGPC($_REQUEST['title'],'string', $translate->_('views.new_list'));
     //
     //			$view->name = $title;
     //
     //			// Persist Object
     //			$list_view = new Model_WorkerWorkspaceListView();
     //			$list_view->title = $title;
     //			$list_view->columns = $view->view_columns;
     //			$list_view->num_rows = $view->renderLimit;
     //			$list_view->params = $view->params;
     //			$list_view->sort_by = $view->renderSortBy;
     //			$list_view->sort_asc = $view->renderSortAsc;
     //
     //			DAO_WorkerWorkspaceList::update($list_view_id, array(
     //				DAO_WorkerWorkspaceList::LIST_VIEW => serialize($list_view)
     //			));
     //
     //		} else {
     $prefs = new Feg_AbstractViewModel();
     $prefs->class_name = get_class($view);
     $prefs->view_columns = $view->view_columns;
     $prefs->renderLimit = $view->renderLimit;
     $prefs->renderSortBy = $view->renderSortBy;
     $prefs->renderSortAsc = $view->renderSortAsc;
     DAO_WorkerPref::set($active_worker->id, 'view' . $view->id, serialize($prefs));
     //		}
     Feg_AbstractViewLoader::setView($id, $view);
     $view->render();
 }
Exemplo n.º 5
0
Arquivo: App.php Projeto: rmiddle/feg
 function exportTmxAction()
 {
     $defaults = new Feg_AbstractViewModel();
     $defaults->class_name = 'Feg_TranslationView';
     $defaults->id = Feg_TranslationView::DEFAULT_ID;
     $view = Feg_AbstractViewLoader::getView(Feg_TranslationView::DEFAULT_ID, $defaults);
     // Extract every result from the view
     list($results, $null) = DAO_Translation::search($view->params, -1, 0, SearchFields_Translation::STRING_ID, true, false);
     // Build TMX outline
     $xml = simplexml_load_string('<?xml version="1.0" encoding="' . LANG_CHARSET_CODE . '"?>' . '<!DOCTYPE tmx SYSTEM "tmx14.dtd">' . '<tmx version="1.4">' . '<body></body>' . '</tmx>');
     /* @var $xml SimpleXMLElement */
     $namespaces = $xml->getNamespaces(true);
     $codes = array();
     // Loop translated strings
     if (is_array($results)) {
         foreach ($results as $result) {
             $string_id = $result[SearchFields_Translation::STRING_ID];
             $lang_code = $result[SearchFields_Translation::LANG_CODE];
             $string_default = $result[SearchFields_Translation::STRING_DEFAULT];
             $string_override = $result[SearchFields_Translation::STRING_OVERRIDE];
             $codes[$lang_code] = 1;
             $string = !empty($string_override) ? $string_override : $string_default;
             // [TODO] Nest multiple <tuv> in a single <tu> parent
             $eTu =& $xml->body->addChild('tu');
             /* @var $eTu SimpleXMLElement */
             $eTu->addAttribute('tuid', $string_id);
             $eTuv =& $eTu->addChild('tuv');
             /* @var $eTuv SimpleXMLElement */
             $eTuv->addAttribute('xml:lang', $lang_code, 'http://www.w3.org/XML/1998/namespace');
             $eSeg =& $eTuv->addChild('seg', htmlspecialchars($string));
             /* @var $eSeg SimpleXMLElement */
         }
     }
     $imp = new DOMImplementation();
     //		$dtd = $imp->createDocumentType('tmx', '', 'tmx14.dtd');
     //		$doc = $imp->createDocument("", "", $dtd);
     $doc = $imp->createDocument("", "");
     $doc->encoding = LANG_CHARSET_CODE;
     $doc->formatOutput = true;
     $simplexml = dom_import_simplexml($xml);
     /* @var $dom DOMElement */
     $simplexml = $doc->importNode($simplexml, true);
     $simplexml = $doc->appendChild($simplexml);
     $filename = "feg_lang_" . implode('_', array_keys($codes)) . ".xml";
     header("Content-type: text/xml");
     header("Content-Disposition: attachment; filename=\"{$filename}\"");
     echo $doc->saveXML();
 }
Exemplo n.º 6
0
 function showTab()
 {
     @($customer_id = DevblocksPlatform::importGPC($_REQUEST['customer_id'], 'integer', 0));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->cache_lifetime = "0";
     //  FIXME setup ACL check.
     //		$worker = FegApplication::getActiveWorker();
     //		if(!$worker || !$worker->is_superuser) {
     //			echo $translate->_('common.access_denied');
     //			return;
     //		}
     $tpl->assign('customer_id', $customer_id);
     $defaults = new Feg_AbstractViewModel();
     $defaults->name = 'Message List';
     $defaults->id = '_view_customer_messages';
     $defaults->class_name = 'View_Message';
     $defaults->renderLimit = 15;
     $defaults->renderSortBy = SearchFields_Message::ID;
     $defaults->renderSortAsc = 0;
     $view = Feg_AbstractViewLoader::getView($defaults->id, $defaults);
     $view->name = 'Message List';
     $view->params = array(SearchFields_Message::ACCOUNT_ID => new DevblocksSearchCriteria(SearchFields_Message::ACCOUNT_ID, '=', $customer_id));
     $view->renderPage = 0;
     $view->view_columns = array(SearchFields_Message::ID, SearchFields_Message::IMPORT_STATUS, SearchFields_Message::CREATED_DATE, SearchFields_Message::UPDATED_DATE);
     Feg_AbstractViewLoader::setView($view->id, $view);
     $tpl->assign('view', $view);
     $tpl->display('file:' . $this->_TPL_PATH . 'customer/tabs/messages/messages.tpl');
 }
Exemplo n.º 7
0
Arquivo: App.php Projeto: rmiddle/feg
 function showTab()
 {
     $visit = FegApplication::getVisit();
     /* @var $visit CerberusVisit */
     $translate = DevblocksPlatform::getTranslationService();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->tpl_path);
     @($customer_id = DevblocksPlatform::importGPC($_REQUEST['customer_id'], 'integer', 0));
     $tpl->assign('customer_id', $customer_id);
     $defaults = new Feg_AbstractViewModel();
     $defaults->class_name = 'View_MessageAuditLog';
     $defaults->id = 'customer_audit_log';
     $defaults->renderLimit = 15;
     $defaults->view_columns = array(SearchFields_MessageAuditLog::CHANGE_DATE, SearchFields_MessageAuditLog::RECIPIENT_ID, SearchFields_MessageAuditLog::MESSAGE_ID, SearchFields_MessageAuditLog::MESSAGE_RECIPIENT_ID, SearchFields_MessageAuditLog::WORKER_ID, SearchFields_MessageAuditLog::CHANGE_FIELD, SearchFields_MessageAuditLog::CHANGE_VALUE);
     $defaults->renderSortBy = SearchFields_MessageAuditLog::CHANGE_DATE;
     $defaults->renderSortAsc = false;
     $defaults->params = array();
     $defaults->renderPage = 0;
     $view = Feg_AbstractViewLoader::getView($defaults->id, $defaults);
     $view->name = 'Customer Audit Log';
     $view->renderTemplate = 'default';
     $view->params = array(SearchFields_MessageAuditLog::ACCOUNT_ID => new DevblocksSearchCriteria(SearchFields_MessageAuditLog::ACCOUNT_ID, DevblocksSearchCriteria::OPER_EQ, $customer_id));
     $view->renderPage = 0;
     Feg_AbstractViewLoader::setView($view->id, $view);
     $tpl->assign('view', $view);
     $tpl->display('file:' . $this->tpl_path . '/display/log/index.tpl');
 }
Exemplo n.º 8
0
 function doNotificationsMarkReadAction()
 {
     $worker = FegApplication::getActiveWorker();
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
     @($row_ids = DevblocksPlatform::importGPC($_REQUEST['row_id'], 'array', array()));
     if (is_array($row_ids) && !empty($row_ids)) {
         DAO_WorkerEvent::updateWhere(array(DAO_WorkerEvent::IS_READ => 1), sprintf("%s = %d AND %s IN (%s)", DAO_WorkerEvent::WORKER_ID, $worker->id, DAO_WorkerEvent::ID, implode(',', $row_ids)));
         DAO_WorkerEvent::clearCountCache($worker->id);
     }
     $myEventsView = Feg_AbstractViewLoader::getView($view_id);
     $myEventsView->render();
 }