Пример #1
0
 function getSourceInfo($object_id)
 {
     if (null == ($opp = DAO_CrmOpportunity::get($object_id))) {
         return;
     }
     $url = DevblocksPlatform::getUrlService();
     return array('name' => '[Opp] ' . $opp->name, 'url' => $url->write(sprintf('c=crm&a=opps&id=%d', $opp->id)));
 }
Пример #2
0
 function render()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $response = DevblocksPlatform::getHttpResponse();
     $translate = DevblocksPlatform::getTranslationService();
     // are we displaying the main home page?
     $path = $response->path;
     array_shift($path);
     // iphone
     //			array_shift($path); // activity
     array_shift($path);
     // opportunities
     $action = array_shift($path);
     // current action
     $id = array_shift($path);
     // opp id
     switch ($action) {
         case 'display':
             $tab_manifests = DevblocksPlatform::getExtensions('cerberusweb.iphone.opportunity.display.tab', false);
             $tpl->assign('tab_manifests', $tab_manifests);
             $tpl->assign('opp_id', $id);
             $selected_tab = array_shift($path);
             $selected_tab = null != $selected_tab ? $selected_tab : 'notes';
             // tab
             foreach ($tab_manifests as $tab_mft) {
                 if ($selected_tab == $tab_mft->params['uri']) {
                     $tab = DevblocksPlatform::getExtension($tab_mft->id, true);
                 }
             }
             $tpl->assign('tab', $tab);
             $tpl->assign('selected_tab', $selected_tab);
             $opp = DAO_CrmOpportunity::get($id);
             $tpl->assign('opp', $opp);
             $address = DAO_Address::get($opp->primary_email_id);
             $tpl->assign('address', $address);
             $workers = DAO_Worker::getAllActive();
             $tpl->assign('workers', $workers);
             $tpl->display('file:' . $this->_TPL_PATH . 'display.tpl');
             break;
         case null:
             $defaults = new C4_AbstractViewModel();
             $defaults->class_name = 'View_CrmOpportunity_iPhone';
             $defaults->id = self::VIEW_OPPS;
             $defaults->name = $translate->_('crm.tab.title');
             $defaults->renderSortBy = SearchFields_CrmOpportunity::UPDATED_DATE;
             $defaults->renderSortAsc = 0;
             $view = C4_AbstractViewLoader::getView(self::VIEW_OPPS, $defaults);
             $tpl->assign('view', $view);
             $tpl->display('file:' . $this->_TPL_PATH . 'home.tpl');
             break;
         default:
             break;
     }
 }