• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DAO_Worker类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: render

 function render()
 {
     $active_worker = UsermeetApplication::getActiveWorker();
     $visit = UsermeetApplication::getVisit();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $response = DevblocksPlatform::getHttpResponse();
     $tpl->assign('request_path', implode('/', $response->path));
     // Remember the last tab/URL
     if (null == ($selected_tab = @$response->path[1])) {
         $selected_tab = $visit->get(UsermeetVisit::KEY_HOME_SELECTED_TAB, 'notifications');
     }
     $tpl->assign('selected_tab', $selected_tab);
     $tab_manifests = DevblocksPlatform::getExtensions('usermeet.home.tab', false);
     $tpl->assign('tab_manifests', $tab_manifests);
     // Custom workspaces
     //		$workspaces = DAO_WorkerWorkspaceList::getWorkspaces($active_worker->id);
     //		$tpl->assign('workspaces', $workspaces);
     // ====== Who's Online
     $whos_online = DAO_Worker::getAllOnline();
     if (!empty($whos_online)) {
         $tpl->assign('whos_online', $whos_online);
         $tpl->assign('whos_online_count', count($whos_online));
     }
     $tpl->display('file:' . $this->_TPL_PATH . 'home/index.tpl');
 }
开发者ID:rmiddle,项目名称:usermeet,代码行数:26,代码来源:home.php


示例2: handleRequest

 function handleRequest(DevblocksHttpRequest $request)
 {
     $stack = $request->path;
     $db = DevblocksPlatform::getDatabaseService();
     // **** BEGIN AUTH
     @($verb = $_SERVER['REQUEST_METHOD']);
     @($header_date = $_SERVER['HTTP_DATE']);
     @($header_signature = $_SERVER['HTTP_PORTSENSOR_AUTH']);
     @($this->_payload = $this->_getRawPost());
     @(list($auth_worker_email, $auth_signature) = explode(":", $header_signature, 2));
     $url_parts = parse_url(DevblocksPlatform::getWebPath());
     $url_path = $url_parts['path'];
     $url_query = $this->_sortQueryString($_SERVER['QUERY_STRING']);
     $string_to_sign_prefix = "{$verb}\n{$header_date}\n{$url_path}\n{$url_query}\n{$this->_payload}";
     if (!$this->_validateRfcDate($header_date)) {
         $this->_error("Access denied! (Invalid timestamp)");
     }
     //		if(strpos($auth_access_key,'@')) { // WORKER-LEVEL AUTH
     $results = DAO_Worker::getWhere(sprintf("%s = %s", DAO_Worker::EMAIL, $db->qstr($auth_worker_email)));
     if (empty($results)) {
         $this->_error("Access denied! (Invalid authentication)");
     } else {
         $worker = array_shift($results);
         $this->setActiveWorker($worker);
     }
     if (null == $this->getActiveWorker()) {
         $this->_error("Access denied! (Invalid worker)");
     }
     if (!$worker->hasPriv('plugin.usermeet.webapi')) {
         $this->_error("Access denied! (No permission)");
     }
     $pass = $this->getActiveWorker()->pass;
     $string_to_sign = "{$string_to_sign_prefix}\n{$pass}\n";
     $compare_hash = base64_encode(sha1($string_to_sign, true));
     if (0 != strcmp($auth_signature, $compare_hash)) {
         $this->_error("Access denied! (Invalid password)");
     }
     // **** END APP AUTH
     // Figure out our format by looking at the last path argument
     @(list($command, $format) = explode('.', array_pop($stack)));
     array_push($stack, $command);
     $this->_format = $format;
     // Call the verb as an action
     $method = strtolower($verb) . 'Action';
     if (method_exists($this, $method)) {
         call_user_func(array(&$this, $method), $stack);
     } else {
         $this->_error("Invalid action.");
     }
 }
开发者ID:rmiddle,项目名称:usermeet,代码行数:50,代码来源:App.php


示例3: render

 function render()
 {
     $active_worker = FegApplication::getActiveWorker();
     $visit = FegApplication::getVisit();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $response = DevblocksPlatform::getHttpResponse();
     $tpl->assign('request_path', implode('/', $response->path));
     // ====== Who's Online
     $whos_online = DAO_Worker::getAllOnline();
     if (!empty($whos_online)) {
         $tpl->assign('whos_online', $whos_online);
         $tpl->assign('whos_online_count', count($whos_online));
     }
     $tpl->display('file:' . $this->_TPL_PATH . 'stats/index.tpl');
 }
开发者ID:rmiddle,项目名称:feg,代码行数:16,代码来源:stats.php


示例4: authenticate

 function authenticate()
 {
     // Pull from $_POST
     @($email = DevblocksPlatform::importGPC($_POST['email']));
     @($password = DevblocksPlatform::importGPC($_POST['password']));
     $worker = DAO_Worker::login($email, $password);
     if (!is_null($worker)) {
         $session = DevblocksPlatform::getSessionService();
         $visit = new CerberusVisit();
         $visit->setWorker($worker);
         $session->setVisit($visit);
         // [TODO] Only direct to /welcome when tour is enabled
         return true;
     } else {
         return false;
     }
 }
开发者ID:rmiddle,项目名称:cerb4,代码行数:17,代码来源:login.classes.php


示例5: render

 function render()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $active_worker = FegApplication::getActiveWorker();
     $visit = FegApplication::getVisit();
     $response = DevblocksPlatform::getHttpResponse();
     $translate = DevblocksPlatform::getTranslationService();
     $url = DevblocksPlatform::getUrlService();
     $stack = $response->path;
     @array_shift($stack);
     // customer
     @($customer_id = array_shift($stack));
     @($customer = DAO_CustomerAccount::get($customer_id));
     if (empty($customer)) {
         echo "<H1>" . $translate->_('customer.display.invalid_customer') . "</H1>";
         return;
     }
     $tpl->assign('customer_id', $customer_id);
     // Tabs
     $tab_manifests = DevblocksPlatform::getExtensions('feg.customer.tab', false);
     $tpl->assign('tab_manifests', $tab_manifests);
     @($tab_selected = array_shift($stack));
     if (empty($tab_selected)) {
         $tab_selected = 'property';
     }
     $tpl->assign('tab_selected', $tab_selected);
     switch ($tab_selected) {
         case 'property':
             @($tab_parm = array_shift($stack));
             break;
     }
     // ====== Who's Online
     $whos_online = DAO_Worker::getAllOnline();
     if (!empty($whos_online)) {
         $tpl->assign('whos_online', $whos_online);
         $tpl->assign('whos_online_count', count($whos_online));
     }
     $tpl->display('file:' . $this->_TPL_PATH . 'customer/index.tpl');
 }
开发者ID:rmiddle,项目名称:feg,代码行数:40,代码来源:customer.php


示例6: array

     // Sales Group
     $sales_gid = DAO_Group::createTeam(array(DAO_Group::TEAM_NAME => 'Sales'));
     // Sales Spam Bucket
     $sales_spam_bid = DAO_Bucket::create('Spam', $sales_gid);
     DAO_GroupSettings::set($sales_gid, DAO_GroupSettings::SETTING_SPAM_ACTION, '2');
     DAO_GroupSettings::set($sales_gid, DAO_GroupSettings::SETTING_SPAM_ACTION_PARAM, $sales_spam_bid);
     DAO_GroupSettings::set($sales_gid, DAO_GroupSettings::SETTING_SPAM_THRESHOLD, '85');
     // Default catchall
     DAO_Group::updateTeam($dispatch_gid, array(DAO_Group::IS_DEFAULT => 1));
 }
 // If this worker doesn't exist, create them
 if (null === ($lookup = DAO_Worker::lookupAgentEmail($worker_email))) {
     $worker_id = DAO_Worker::create($worker_email, $worker_pass, 'Super', 'User', 'Administrator');
     // Superuser bit
     $fields = array(DAO_Worker::IS_SUPERUSER => 1);
     DAO_Worker::updateAgent($worker_id, $fields);
     // Add the worker e-mail to the addresses table
     if (!empty($worker_email)) {
         DAO_Address::lookupAddress($worker_email, true);
     }
     // Authorize this e-mail address (watchers, etc.)
     DAO_AddressToWorker::assign($worker_email, $worker_id);
     DAO_AddressToWorker::update($worker_email, array(DAO_AddressToWorker::IS_CONFIRMED => 1));
     // Default group memberships
     if (!empty($dispatch_gid)) {
         DAO_Group::setTeamMember($dispatch_gid, $worker_id, true);
     }
     if (!empty($support_gid)) {
         DAO_Group::setTeamMember($support_gid, $worker_id, true);
     }
     if (!empty($sales_gid)) {
开发者ID:rmiddle,项目名称:cerb4,代码行数:31,代码来源:index.php


示例7: doRecoverStep3Action

 function doRecoverStep3Action()
 {
     @($password = DevblocksPlatform::importGPC($_REQUEST['password'], 'string'));
     $email = $_SESSION[self::KEY_FORGOT_EMAIL];
     $sentcode = $_SESSION[self::KEY_FORGOT_SENTCODE];
     $code = $_SESSION[self::KEY_FORGOT_CODE];
     $worker_id = DAO_Worker::lookupAgentEmail($email);
     if (empty($email) || empty($code) || empty($worker_id)) {
         return;
     }
     if (0 == strcmp($sentcode, $code)) {
         // passed
         DAO_Worker::updateAgent($worker_id, array(DAO_Worker::PASSWORD => md5($password)));
         unset($_SESSION[self::KEY_FORGOT_EMAIL]);
         unset($_SESSION[self::KEY_FORGOT_CODE]);
         unset($_SESSION[self::KEY_FORGOT_SENTCODE]);
         DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login')));
     } else {
         DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2')));
     }
 }
开发者ID:rmiddle,项目名称:cerb4,代码行数:21,代码来源:login.php


示例8: getRenderedContent

 public function getRenderedContent($message_id)
 {
     $raw = $this->content;
     $replace = array();
     $with = array();
     $replace[] = '#timestamp#';
     $with[] = date('r');
     if (!empty($message_id)) {
         $message = DAO_Ticket::getMessage($message_id);
         $ticket = DAO_Ticket::getTicket($message->ticket_id);
         $sender = DAO_Address::get($message->address_id);
         $sender_org = DAO_ContactOrg::get($sender->contact_org_id);
         $replace[] = '#sender_first_name#';
         $replace[] = '#sender_last_name#';
         $replace[] = '#sender_org#';
         $with[] = $sender->first_name;
         $with[] = $sender->last_name;
         $with[] = !empty($sender_org) ? $sender_org->name : "";
         $replace[] = '#ticket_id#';
         $replace[] = '#ticket_mask#';
         $replace[] = '#ticket_subject#';
         $with[] = $ticket->id;
         $with[] = $ticket->mask;
         $with[] = $ticket->subject;
     }
     if (null != ($active_worker = CerberusApplication::getActiveWorker())) {
         $worker = DAO_Worker::getAgent($active_worker->id);
         // most recent info (not session)
         $replace[] = '#worker_first_name#';
         $replace[] = '#worker_last_name#';
         $replace[] = '#worker_title#';
         $with[] = $worker->first_name;
         $with[] = $worker->last_name;
         $with[] = $worker->title;
     }
     return str_replace($replace, $with, $raw);
 }
开发者ID:rmiddle,项目名称:cerb4,代码行数:37,代码来源:Model.class.php


示例9: writeResponse

 public function writeResponse(DevblocksHttpResponse $response)
 {
     $path = $response->path;
     // [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
     //	    if(empty($path))
     //			return;
     $tpl = DevblocksPlatform::getTemplateService();
     $session = DevblocksPlatform::getSessionService();
     $settings = DevblocksPlatform::getPluginSettingsService();
     $translate = DevblocksPlatform::getTranslationService();
     $active_worker = FegApplication::getActiveWorker();
     $visit = $session->getVisit();
     $page_manifests = $this->_getAllowedPages();
     $controller = array_shift($path);
     // Default page [TODO] This is supposed to come from framework.config.php
     if (empty($controller)) {
         $controller = 'preferences';
     }
     // [JAS]: Require us to always be logged in for Feg pages
     if (empty($visit) && 0 != strcasecmp($controller, 'login')) {
         $query = array();
         if (!empty($response->path)) {
             $query = array('url' => urlencode(implode('/', $response->path)));
         }
         DevblocksPlatform::redirect(new DevblocksHttpRequest(array('login'), $query));
     }
     $page_id = $this->_getPageIdByUri($controller);
     @($page = DevblocksPlatform::getExtension($page_id, true));
     /* @var $page FegPageExtension */
     if (empty($page)) {
         header("Status: 404");
         return;
         // [TODO] 404
     }
     // [JAS]: Listeners (Step-by-step guided tour, etc.)
     $listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
     foreach ($listenerManifests as $listenerManifest) {
         /* @var $listenerManifest DevblocksExtensionManifest */
         $inst = $listenerManifest->createInstance();
         /* @var $inst DevblocksHttpRequestListenerExtension */
         $inst->run($response, $tpl);
     }
     $tpl->assign('active_worker', $active_worker);
     $tour_enabled = false;
     if (!empty($visit) && !is_null($active_worker)) {
         $tour_enabled = intval(DAO_WorkerPref::get($active_worker->id, 'assist_mode', 1));
         $keyboard_shortcuts = intval(DAO_WorkerPref::get($active_worker->id, 'keyboard_shortcuts', 1));
         $tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
         //	    	$active_worker_memberships = $active_worker->getMemberships();
         //	    	$tpl->assign('active_worker_memberships', $active_worker_memberships);
         $unread_notifications = DAO_WorkerEvent::getUnreadCountByWorker($active_worker->id);
         $tpl->assign('active_worker_notify_count', $unread_notifications);
         DAO_Worker::logActivity($active_worker->id, $page->getActivity());
     }
     $tpl->assign('tour_enabled', $tour_enabled);
     // [JAS]: Variables provided to all page templates
     $tpl->assign('settings', $settings);
     $tpl->assign('session', $_SESSION);
     $tpl->assign('translate', $translate);
     $tpl->assign('visit', $visit);
     $tpl->assign('license', FegLicense::getInstance());
     $tpl->assign('page_manifests', $page_manifests);
     $tpl->assign('page', $page);
     $tpl->assign('response_uri', implode('/', $response->path));
     $core_tpl = APP_PATH . '/features/feg.core/templates/';
     $tpl->assign('core_tpl', $core_tpl);
     // Prebody Renderers
     $preBodyRenderers = DevblocksPlatform::getExtensions('feg.renderer.prebody', true);
     if (!empty($preBodyRenderers)) {
         $tpl->assign('prebody_renderers', $preBodyRenderers);
     }
     // Postbody Renderers
     $postBodyRenderers = DevblocksPlatform::getExtensions('feg.renderer.postbody', true);
     if (!empty($postBodyRenderers)) {
         $tpl->assign('postbody_renderers', $postBodyRenderers);
     }
     // Timings
     $tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
     if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
         $tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
         $tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
     }
     $tpl->display($core_tpl . 'border.tpl');
     //		$cache = DevblocksPlatform::getCacheService();
     //		$cache->printStatistics();
 }
开发者ID:rmiddle,项目名称:feg,代码行数:86,代码来源:plugin.classes.php


示例10: showWorkspaceTabAction

 function showWorkspaceTabAction()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $visit = PortSensorApplication::getVisit();
     $db = DevblocksPlatform::getDatabaseService();
     $active_worker = PortSensorApplication::getActiveWorker();
     $current_workspace = DevblocksPlatform::importGPC($_REQUEST['workspace'], 'string', '');
     $workspaces = DAO_Worklist::getWorkspaces($active_worker->id);
     // Fix a bad/old cache
     if (!empty($current_workspace) && false === array_search($current_workspace, $workspaces)) {
         $current_workspace = '';
     }
     $views = array();
     if (empty($current_workspace) && !empty($workspaces)) {
         // custom dashboards
         $current_workspace = reset($workspaces);
     }
     if (!empty($current_workspace)) {
         // Remember the tab
         $visit->set(PortSensorVisit::KEY_HOME_SELECTED_TAB, 'w_' . $current_workspace);
         $lists = DAO_Worklist::getWhere(sprintf("%s = %d AND %s = %s", DAO_Worklist::WORKER_ID, $active_worker->id, DAO_Worklist::WORKSPACE, $db->qstr($current_workspace)));
         // Load the workspace sources to map to view renderer
         $source_manifests = DevblocksPlatform::getExtensions(Extension_WorklistSource::EXTENSION_POINT, false);
         // Loop through list schemas
         if (is_array($lists) && !empty($lists)) {
             foreach ($lists as $list) {
                 /* @var $list Model_Worklist */
                 $view_id = 'cust_' . $list->id;
                 if (null == ($view = Ps_AbstractViewLoader::getView($view_id))) {
                     $list_view = $list->view;
                     // Make sure we can find the workspace source (plugin not disabled)
                     if (!isset($source_manifests[$list->source_extension]) || null == ($workspace_source = $source_manifests[$list->source_extension]) || !isset($workspace_source->params['view_class'])) {
                         continue;
                     }
                     // Make sure our workspace source has a valid renderer class
                     $view_class = $workspace_source->params['view_class'];
                     if (!class_exists($view_class)) {
                         continue;
                     }
                     $view = new $view_class();
                     $view->id = $view_id;
                     $view->name = $list_view->title;
                     $view->renderLimit = $list_view->num_rows;
                     $view->renderPage = 0;
                     $view->view_columns = $list_view->columns;
                     $view->params = $list_view->params;
                     $view->renderSortBy = $list_view->sort_by;
                     $view->renderSortAsc = $list_view->sort_asc;
                     Ps_AbstractViewLoader::setView($view_id, $view);
                 }
                 if (!empty($view)) {
                     $views[] = $view;
                 }
             }
         }
         $tpl->assign('current_workspace', $current_workspace);
         $tpl->assign('views', $views);
     }
     // Log activity
     DAO_Worker::logActivity($active_worker->id, new Model_Activity('activity.mail.workspaces', array('<i>' . $current_workspace . '</i>')));
     $tpl->display('file:' . $this->_TPL_PATH . 'home/workspaces/index.tpl');
 }
开发者ID:jstanden,项目名称:portsensor,代码行数:63,代码来源:home.php


示例11: getMatches

 /**
  * @return Model_WatcherMailFilter[]|false
  */
 static function getMatches(CerberusTicket $ticket, $event, $only_worker_id = null)
 {
     $matches = array();
     if (!empty($only_worker_id)) {
         $filters = DAO_WatcherMailFilter::getWhere(sprintf("%s = %d AND %s = %d", DAO_WatcherMailFilter::WORKER_ID, $only_worker_id, DAO_WatcherMailFilter::IS_DISABLED, 0));
     } else {
         $filters = DAO_WatcherMailFilter::getWhere(sprintf("%s = %d", DAO_WatcherMailFilter::IS_DISABLED, 0));
     }
     // [JAS]: Don't send obvious spam to watchers.
     if ($ticket->spam_score >= 0.9) {
         return false;
     }
     // Build our objects
     $ticket_from = DAO_Address::get($ticket->last_wrote_address_id);
     $ticket_group_id = $ticket->team_id;
     // [TODO] These expensive checks should only populate when needed
     $messages = DAO_Ticket::getMessagesByTicket($ticket->id);
     $message_headers = array();
     if (empty($messages)) {
         return false;
     }
     if (null != @($message_last = array_pop($messages))) {
         /* @var $message_last CerberusMessage */
         $message_headers = $message_last->getHeaders();
     }
     // Clear the rest of the message manifests
     unset($messages);
     $custom_fields = DAO_CustomField::getAll();
     // Lazy load when needed on criteria basis
     $ticket_field_values = null;
     $address_field_values = null;
     $org_field_values = null;
     // Worker memberships (for checking permissions)
     $workers = DAO_Worker::getAll();
     $group_rosters = DAO_Group::getRosters();
     // Check filters
     if (is_array($filters)) {
         foreach ($filters as $filter) {
             /* @var $filter Model_WatcherMailFilter */
             $passed = 0;
             // check the worker's group memberships
             if (!isset($workers[$filter->worker_id]) || $workers[$filter->worker_id]->is_disabled || !$workers[$filter->worker_id]->is_superuser && !isset($group_rosters[$ticket->team_id][$filter->worker_id])) {
                 // no membership
                 continue;
             }
             // check criteria
             foreach ($filter->criteria as $rule_key => $rule) {
                 @($value = $rule['value']);
                 switch ($rule_key) {
                     case 'dayofweek':
                         $current_day = strftime('%w');
                         //$current_day = 1;
                         // Forced to English abbrevs as indexes
                         $days = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
                         // Is the current day enabled?
                         if (isset($rule[$days[$current_day]])) {
                             $passed++;
                         }
                         break;
                     case 'timeofday':
                         $current_hour = strftime('%H');
                         $current_min = strftime('%M');
                         //$current_hour = 17;
                         //$current_min = 5;
                         if (null != ($from_time = @$rule['from'])) {
                             list($from_hour, $from_min) = explode(':', $from_time);
                         }
                         if (null != ($to_time = @$rule['to'])) {
                             if (list($to_hour, $to_min) = explode(':', $to_time)) {
                             }
                         }
                         // Do we need to wrap around to the next day's hours?
                         if ($from_hour > $to_hour) {
                             // yes
                             $to_hour += 24;
                             // add 24 hrs to the destination (1am = 25th hour)
                         }
                         // Are we in the right 24 hourly range?
                         if ((int) $current_hour >= $from_hour && (int) $current_hour <= $to_hour) {
                             // If we're in the first hour, are we minutes early?
                             if ($current_hour == $from_hour && (int) $current_min < $from_min) {
                                 break;
                             }
                             // If we're in the last hour, are we minutes late?
                             if ($current_hour == $to_hour && (int) $current_min > $to_min) {
                                 break;
                             }
                             $passed++;
                         }
                         break;
                     case 'event':
                         if (!empty($event) && is_array($rule) && isset($rule[$event])) {
                             $passed++;
                         }
                         break;
                     case 'groups':
                         if (null !== @($group_buckets = $rule['groups'][$ticket->team_id]) && (empty($group_buckets) || in_array($ticket->category_id, $group_buckets))) {
//.........这里部分代码省略.........
开发者ID:Hildy,项目名称:cerb5,代码行数:101,代码来源:App.php


示例12: render

 function render()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $active_worker = CerberusApplication::getActiveWorker();
     $memberships = $active_worker->getMemberships();
     $response = DevblocksPlatform::getHttpResponse();
     @($section = $response->path[1]);
     //print_r($_REQUEST);exit();
     //@$page = DevblocksPlatform::importGPC($_GET['password']);
     @($page = DevblocksPlatform::importGPC($_REQUEST['page'], 'integer'));
     if ($page == NULL) {
         $page = 0;
     }
     if (isset($_POST['a2'])) {
         @($section = $_POST['a2']);
     } else {
         @($section = $response->path[2]);
     }
     //print_r($section);
     //echo $section;
     switch ($section) {
         case 'search':
             $title = 'Search';
             $query = $_POST['query'];
             if ($query && false === strpos($query, '*')) {
                 $query = '*' . $query . '*';
             }
             if (!is_null($query)) {
                 $params = array();
                 $type = $_POST['type'];
                 switch ($type) {
                     case "mask":
                         $params[SearchFields_Ticket::TICKET_MASK] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_MASK, DevblocksSearchCriteria::OPER_LIKE, strtoupper($query));
                         break;
                     case "sender":
                         $params[SearchFields_Ticket::TICKET_FIRST_WROTE] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE, DevblocksSearchCriteria::OPER_LIKE, strtolower($query));
                         break;
                     case "subject":
                         $params[SearchFields_Ticket::TICKET_SUBJECT] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_SUBJECT, DevblocksSearchCriteria::OPER_LIKE, $query);
                         break;
                     case "content":
                         $params[SearchFields_Ticket::TICKET_MESSAGE_CONTENT] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_MESSAGE_CONTENT, DevblocksSearchCriteria::OPER_LIKE, $query);
                         break;
                 }
             } else {
                 //show the search form because no search has been submitted
                 $tpl->display('file:' . dirname(__FILE__) . '/templates/tickets/search.tpl');
                 return;
             }
             break;
         case 'sidebar':
             $groups = DAO_Group::getAll();
             $tpl->assign('groups', $groups);
             $group_buckets = DAO_Bucket::getTeams();
             $tpl->assign('group_buckets', $group_buckets);
             $workers = DAO_Worker::getAll();
             $tpl->assign('workers', $workers);
             $group_counts = DAO_Overview::getGroupTotals();
             $tpl->assign('group_counts', $group_counts);
             $waiting_counts = DAO_Overview::getWaitingTotals();
             $tpl->assign('waiting_counts', $waiting_counts);
             $worker_counts = DAO_Overview::getWorkerTotals();
             $tpl->assign('worker_counts', $worker_counts);
             $tpl->display('file:' . dirname(__FILE__) . '/templates/tickets/sidebar.tpl');
             return;
             break;
         case 'overview':
         default:
             $workers = DAO_Worker::getAll();
             $group_buckets = DAO_Bucket::getTeams();
             $groups = DAO_Group::getAll();
             @($filter = $response->path[3]);
             switch ($filter) {
                 case 'group':
                     @($filter_group_id = $response->path[4]);
                     $params = array(SearchFields_Ticket::TICKET_CLOSED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, '=', CerberusTicketStatus::OPEN), SearchFields_Ticket::TICKET_WAITING => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_WAITING, '=', 0), SearchFields_Ticket::TICKET_NEXT_WORKER_ID => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_NEXT_WORKER_ID, '=', 0));
                     if (!is_null($filter_group_id) && isset($groups[$filter_group_id])) {
                         $tpl->assign('filter_group_id', $filter_group_id);
                         $title = $groups[$filter_group_id]->name;
                         $params[SearchFields_Ticket::TICKET_TEAM_ID] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, '=', $filter_group_id);
                         @($filter_bucket_id = $response->path[5]);
                         if (!is_null($filter_bucket_id)) {
                             $tpl->assign('filter_bucket_id', $filter_bucket_id);
                             @($title .= ': ' . ($filter_bucket_id == 0 ? 'Inbox' : $group_buckets[$filter_group_id][$filter_bucket_id]->name));
                             $params[SearchFields_Ticket::TICKET_CATEGORY_ID] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CATEGORY_ID, '=', $filter_bucket_id);
                         } else {
                             @($title .= ' (Spam Filtered)');
                             $params[SearchFields_Ticket::TICKET_SPAM_SCORE] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_SPAM_SCORE, '<=', '0.9000');
                         }
                     }
                     break;
                 case 'waiting':
                     @($filter_waiting_id = $response->path[4]);
                     $params = array(SearchFields_Ticket::TICKET_CLOSED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, '=', CerberusTicketStatus::OPEN), SearchFields_Ticket::TICKET_WAITING => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_WAITING, '=', 1));
                     if (!is_null($filter_waiting_id) && isset($groups[$filter_waiting_id])) {
                         $tpl->assign('filter_waiting_id', $filter_waiting_id);
                         $title = '[Waiting] ' . $groups[$filter_waiting_id]->name;
                         $params[SearchFields_Ticket::TICKET_TEAM_ID] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, '=', $filter_waiting_id);
                         @($filter_bucket_id = $response->path[5]);
                         if (!is_null($filter_bucket_id)) {
//.........这里部分代码省略.........
开发者ID:jsjohnst,项目名称:cerb4,代码行数:101,代码来源:classes.php


示例13: _getTicketLastAction

 private function _getTicketLastAction($ticket)
 {
     static $workers = null;
     $action_code = $ticket[SearchFields_Ticket::TICKET_LAST_ACTION_CODE];
     $output = '';
     if (is_null($workers)) {
         $workers = DAO_Worker::getAll();
     }
     // [TODO] Translate
     switch ($action_code) {
         case CerberusTicketActionCode::TICKET_OPENED:
             $output = sprintf("New from %s", $ticket[SearchFields_Ticket::TICKET_LAST_WROTE]);
             break;
         case CerberusTicketActionCode::TICKET_CUSTOMER_REPLY:
             @($worker_id = $ticket[SearchFields_Ticket::TICKET_NEXT_WORKER_ID]);
             @($worker = $workers[$worker_id]);
             $output = sprintf("Incoming for %s", !empty($worker) ? $worker->getName() : "Helpdesk");
             break;
         case CerberusTicketActionCode::TICKET_WORKER_REPLY:
             @($worker_id = $ticket[SearchFields_Ticket::TICKET_LAST_WORKER_ID]);
             @($worker = $workers[$worker_id]);
             $output = sprintf("Outgoing from %s", !empty($worker) ? $worker->getName() : "Helpdesk");
             break;
     }
     return $output;
 }
开发者ID:rmiddle,项目名称:cerb4,代码行数:26,代码来源:plugin.classes.php


示例14: showTaskBulkPanelAction

 function showTaskBulkPanelAction()
 {
     @($ids = DevblocksPlatform::importGPC($_REQUEST['ids']));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id']));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('view_id', $view_id);
     if (!empty($ids)) {
         $id_list = DevblocksPlatform::parseCsvString($ids);
         $tpl->assign('ids', implode(',', $id_list));
     }
     $workers = DAO_Worker::getAllActive();
     $tpl->assign('workers', $workers);
     // Custom Fields
     $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->cache_lifetime = "0";
     $tpl->display('file:' . $this->_TPL_PATH . 'tasks/rpc/bulk.tpl');
 }
开发者ID:joegeck,项目名称:cerb4,代码行数:18,代码来源:tasks.php


示例15: renderCriteriaParam

 function renderCriteriaParam($param)
 {
     $field = $param->field;
     $values = !is_array($param->value) ? array($param->value) : $param->value;
     switch ($field) {
         case SearchFields_FeedbackEntry::WORKER_ID:
             $workers = DAO_Worker::getAll();
             $strings = array();
             foreach ($values as $val) {
                 if (0 == $val) {
                     $strings[] = "Nobody";
                 } else {
                     if (!isset($workers[$val])) {
                         continue;
                     }
                     $strings[] = $workers[$val]->getName();
                 }
             }
             echo implode(", ", $strings);
             break;
         case SearchFields_FeedbackEntry::QUOTE_MOOD:
             $strings = array();
             // [TODO] Translations
             foreach ($values as $val) {
                 switch ($val) {
                     case 0:
                         $strings[] = "Neutral";
                         break;
                     case 1:
                         $strings[] = "Praise";
                         break;
                     case 2:
                         $strings[] = "Criticism";
                         break;
                 }
             }
             echo implode(", ", $strings);
             break;
         default:
             parent::renderCriteriaParam($param);
             break;
     }
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:43,代码来源:App.php


示例16: renderCriteriaParam

 function renderCriteriaParam($param)
 {
     $field = $param->field;
     $vals = $param->value;
     if (!is_array($vals)) {
         $vals = array($vals);
     }
     // Do we need to do anything special on custom fields?
     if ('cf_' == substr($field, 0, 3)) {
         $field_id = intval(substr($field, 3));
         $custom_fields = DAO_CustomField::getAll();
         switch ($custom_fields[$field_id]->type) {
             case Model_CustomField::TYPE_WORKER:
                 $workers = DAO_Worker::getAll();
                 foreach ($vals as $idx => $worker_id) {
                     if (isset($workers[$worker_id])) {
                         $vals[$idx] = $workers[$worker_id]->getName();
                     }
                 }
                 break;
         }
     }
     echo implode(', ', $vals);
 }
开发者ID:rmiddle,项目名称:feg,代码行数:24,代码来源:Model.class.php


示例17: showTabHistoryAction

 function showTabHistoryAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     @($org = DevblocksPlatform::importGPC($_REQUEST['org']));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $contact = DAO_ContactOrg::get($org);
     $tpl->assign('contact', $contact);
     $visit = CerberusApplication::getVisit();
     /* @var $visit CerberusVisit */
     $tickets_view = C4_AbstractViewLoader::getView('contact_history');
     // All org contacts
     $people = DAO_Address::getWhere(sprintf("%s = %d", DAO_Address::CONTACT_ORG_ID, $contact->id));
     if (null == $tickets_view) {
         $tickets_view = new C4_TicketView();
         $tickets_view->id = 'contact_history';
         $tickets_view->name = $translate->_('addy_book.history.view_title');
         $tickets_view->view_columns = array(SearchFields_Ticket::TICKET_LAST_ACTION_CODE, SearchFields_Ticket::TICKET_CREATED_DATE, SearchFields_Ticket::TICKET_TEAM_ID, SearchFields_Ticket::TICKET_CATEGORY_ID);
         $tickets_view->params = array();
         $tickets_view->renderLimit = 10;
         $tickets_view->renderPage = 0;
         $tickets_view->renderSortBy = SearchFields_Ticket::TICKET_CREATED_DATE;
         $tickets_view->renderSortAsc = false;
     }
     @($tickets_view->name = $translate->_('ticket.requesters') . ": " . htmlspecialchars($contact->name) . ' - ' . intval(count($people)) . ' contact(s)');
     $tickets_view->params = array(SearchFields_Ticket::REQUESTER_ID => new DevblocksSearchCriteria(SearchFields_Ticket::REQUESTER_ID, 'in', array_keys($people)), SearchFields_Ticket::TICKET_DELETED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_DELETED, DevblocksSearchCriteria::OPER_EQ, 0));
     $tpl->assign('contact_history', $tickets_view);
     C4_AbstractViewLoader::setView($tickets_view->id, $tickets_view);
     $workers = DAO_Worker::getAll();
     $tpl->assign('workers', $workers);
     $teams = DAO_Group::getAll();
     $tpl->assign('teams', $teams);
     $buckets = DAO_Bucket::getAll();
     $tpl->assign('buckets', $buckets);
     $team_categories = DAO_Bucket::getTeams();
     $tpl->assign('team_categories', $team_categories);
     $tpl->display('file:' . $this->_TPL_PATH . 'contacts/orgs/tabs/history.tpl');
     exit;
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:39,代码来源:contacts.php


示例18: handleRequest

 function handleRequest(DevblocksHttpRequest $request)
 {
     $stack = $request->path;
     $db = DevblocksPlatform::getDatabaseService();
     // **** BEGIN AUTH
     @($verb = $_SERVER['REQUEST_METHOD']);
     @($header_date = $_SERVER['HTTP_DATE']);
     @($header_signature = $_SERVER['HTTP_CERB4_AUTH']);
     @($this->_payload = $this->_getRawPost());
     @(list($auth_access_key, $auth_signature) = explode(":", $header_signature, 2));
     $url_parts = parse_url(DevblocksPlatform::getWebPath());
     $url_path = $url_parts['path'];
     $url_query = $this->_sortQueryString($_SERVER['QUERY_STRING']);
     $string_to_sign_prefix = "{$verb}\n{$header_date}\n{$url_path}\n{$url_query}\n{$this->_payload}";
     if (!$this->_validateRfcDate($header_date)) {
         $this->_error("Access denied! (Invalid timestamp)");
     }
     if (strpos($auth_access_key, '@')) {
         // WORKER-LEVEL AUTH
         $workers = DAO_Worker::getAll();
         foreach ($workers as $worker) {
             /* @var $worker CerberusWorker */
             if ($worker->email == $auth_access_key) {
                 $this->setActiveWorker($worker);
                 break;
             }
         }
         if (null == $this->getActiveWorker()) {
             $this->_error("Access denied! (Invalid worker)");
         }
         $pass = $this->getActiveWorker()->pass;
         $string_to_sign = "{$string_to_sign_prefix}\n{$pass}\n";
         $compare_hash = base64_encode(sha1($string_to_sign, true));
         if (0 != strcmp($auth_signature, $compare_hash)) {
             $this->_error("Access denied! (Invalid password)");
         }
     } else {
         // APP-LEVEL AUTH
         $stored_keychains = DAO_WebapiKey::getWhere(sprintf("%s = %s", DAO_WebapiKey::ACCESS_KEY, $db->qstr(str_replace(' ', '', $auth_access_key))));
         /* @var $stored_keychain Model_WebApiKey */
         if (!empty($stored_keychains)) {
             @($stored_keychain = array_shift($stored_keychains));
             @($auth_secret_key = $stored_keychain->secret_key);
             @($auth_rights = $stored_keychain->rights);
             $string_to_sign = "{$string_to_sign_prefix}\n{$auth_secret_key}\n";
             $compare_hash = base64_encode(sha1($string_to_sign, true));
             if (0 != strcmp($auth_signature, $compare_hash)) {
                 $this->_error("Access denied! (Invalid signature)");
             }
             // Check that this IP is allowed to perform the VERB
             if (!$stored_keychain->isValidIp($_SERVER['REMOTE_ADDR'])) {
                 $this->_error(sprintf("Access denied! (IP %s not authorized)", $_SERVER['REMOTE_ADDR']));
             }
         } else {
             $this->_error("Access denied! (Unknown access key)");
         }
     }
     // **** END APP AUTH
     // Figure out our format by looking at the last path argument
     @(list($comm 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DB类代码示例发布时间:2022-05-23
下一篇:
PHP DAORegistry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap