PHP Method User::addRecentItem, codiad Code Examples

This page contains top rated real world PHP examples of method User::addRecentItem from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: WorkflowController.php Project: shuvro35/X2CRM
0
 /**
  * Displays workflow table/funnel diagram or the pipeline
  * @param int $id id of the workflow record
  */
 public function actionView($id)
 {
     // check for optional GET param, if it's not set, use the profile settings
     if (!isset($_GET['perStageWorkflowView'])) {
         $perStageWorkflowView = Yii::app()->params->profile->miscLayoutSettings['perStageWorkflowView'];
     } else {
         $perStageWorkflowView = $_GET['perStageWorkflowView'];
         if ($perStageWorkflowView !== Yii::app()->params->profile->miscLayoutSettings['perStageWorkflowView']) {
             $perStageWorkflowView = $perStageWorkflowView === 'true' ? true : false;
             Profile::setMiscLayoutSetting('perStageWorkflowView', $perStageWorkflowView, true);
         }
     }
     $users = isset($_GET['users']) ? $_GET['users'] : '';
     if (isset($_GET['stage']) && is_numeric($_GET['stage'])) {
         $viewStage = $_GET['stage'];
     } else {
         $viewStage = null;
     }
     // add workflow to user's recent item list
     User::addRecentItem('w', $id, Yii::app()->user->getId());
     //AuxLib::debugLogR ('actionView');
     //$params = ($this->getPerStageViewParams ($id, $viewStage, $users));
     //AuxLib::debugLogR ($params['expectedCloseDateDateRange']);
     $workflows = Workflow::getList(false);
     // no "none" options
     $this->render('view', array_merge(array('perStageWorkflowView' => $perStageWorkflowView, 'workflows' => $workflows), $perStageWorkflowView ? $this->getPerStageViewParams($id, $viewStage, $users) : $this->getDragAndDropViewParams($id, $users)));
 }
Example #2
Show file File: ServicesController.php Project: shayanyi/CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     if (!$this->checkPermissions($model, 'view')) {
         $this->denied();
     }
     // add service case to user's recent item list
     User::addRecentItem('s', $id, Yii::app()->user->getId());
     parent::view($model, 'services');
 }
Example #3
Show file File: MediaController.php Project: shayanyi/CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     if (!$this->checkPermissions($model, 'view')) {
         $this->denied();
     }
     // add media object to user's recent item list
     User::addRecentItem('m', $id, Yii::app()->user->getId());
     $this->render('view', array('model' => $model));
 }
Example #4
Show file File: DocsController.php Project: tymiles003/X2CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     if (!$this->checkPermissions($model, 'view')) {
         $this->denied();
     }
     // add doc to user's recent item list
     User::addRecentItem('d', $id, Yii::app()->user->getId());
     X2Flow::trigger('RecordViewTrigger', array('model' => $model));
     $this->render('view', array('model' => $model));
 }
Example #5
Show file File: BugReportsController.php Project: tymiles003/X2CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     User::addRecentItem('BugReports', $id);
     $type = 'BugReports';
     $model = $this->loadModel($id);
     if ($this->checkPermissions($model, 'view')) {
         parent::view($model, $type);
     } else {
         $this->redirect('index');
     }
 }
Example #6
Show file File: X2LeadsController.php Project: tymiles003/X2CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  * @param null|Opportunity Set by actionConvertLead in the case that conversion fails
  */
 public function actionView($id, $opportunity = null)
 {
     $type = 'x2Leads';
     $model = $this->loadModel($id);
     if ($this->checkPermissions($model, 'view')) {
         // add opportunity to user's recent item list
         User::addRecentItem('l', $id, Yii::app()->user->getId());
         parent::view($model, $type);
     } else {
         $this->redirect('index');
     }
 }
Example #7
Show file File: OpportunitiesController.php Project: shuvro35/X2CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $type = 'opportunities';
     $model = $this->loadModel($id);
     $model->associatedContacts = Contacts::getContactLinks($model->associatedContacts);
     if ($this->checkPermissions($model, 'view')) {
         // add opportunity to user's recent item list
         User::addRecentItem('o', $id, Yii::app()->user->getId());
         parent::view($model, $type);
     } else {
         $this->redirect('index');
     }
 }
Example #8
Show file File: QuotesController.php Project: xl602/X2CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $type = 'quotes';
     $model = $this->getModel($id);
     if (!$this->checkPermissions($model, 'view')) {
         $this->denied();
     }
     $quoteProducts = $model->lineItems;
     // add quote to user's recent item list
     User::addRecentItem('q', $id, Yii::app()->user->getId());
     $contactNameId = Fields::nameAndId($model->associatedContacts);
     $contactId = $contactNameId[1];
     parent::view($model, $type, array('orders' => $quoteProducts, 'contactId' => $contactId));
 }
Example #9
Show file File: AccountsController.php Project: dsyman2/X2CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     if (!parent::checkPermissions($model, 'view')) {
         $this->denied();
     }
     // add account to user's recent item list
     User::addRecentItem('a', $id, Yii::app()->user->getId());
     if ($model->checkForDuplicates()) {
         $this->redirect($this->createUrl('/site/duplicateCheck', array('moduleName' => 'accounts', 'modelName' => 'Accounts', 'id' => $id, 'ref' => 'view')));
     } else {
         $model->duplicateChecked();
         parent::view($model, 'accounts');
     }
 }
Example #10
Show file File: MobileViewAction.php Project: tymiles003/X2CRM
0
 public function run($id)
 {
     parent::beforeRun();
     $model = $this->getModel($id);
     $this->controller->pageClass = $this->pageClass;
     $this->controller->dataUrl = $model->getUrl();
     $this->controller->pageId .= '-' . $model->id;
     if ($this->controller->checkPermissions($model, 'view')) {
         User::addRecentItem(get_class($model), $id);
         //if (!($model instanceof X2Model))
         $model->setFormatter($this->pathAliasBase . 'components.formatters.MobileFieldFormatter');
         $this->controller->render($this->pathAliasBase . 'views.mobile.recordView', array('model' => $model));
     } else {
         $this->controller->denied();
     }
 }
Example #11
Show file File: GroupsController.php Project: keyeMyria/CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $userLinks = GroupToUser::model()->findAllByAttributes(array('groupId' => $id));
     $str = "";
     foreach ($userLinks as $userLink) {
         $user = X2Model::model('User')->findByPk($userLink->userId);
         if (isset($user)) {
             $str .= $user->username . ", ";
         }
     }
     $str = substr($str, 0, -2);
     $users = User::getUserLinks($str);
     // add group to user's recent item list
     User::addRecentItem('g', $id, Yii::app()->user->getId());
     $this->render('view', array('model' => $this->loadModel($id), 'users' => $users));
 }
Example #12
Show file File: ActionsController.php Project: dsyman2/X2CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $action = CActiveRecord::model('Actions')->findByPk($id);
     if ($action === null) {
         $this->redirect('index');
     }
     $users = User::getNames();
     $association = $this->getAssociation($action->associationType, $action->associationId);
     if ($this->checkPermissions($action, 'view')) {
         X2Flow::trigger('RecordViewTrigger', array('model' => $action));
         User::addRecentItem('t', $id, Yii::app()->user->getId());
         //add action to user's recent item list
         $this->render('view', array('model' => $this->loadModel($id), 'associationModel' => $association, 'users' => $users));
     } else {
         $this->redirect('index');
     }
 }
Example #13
Show file File: MobileTopicsViewAction.php Project: tymiles003/X2CRM
0
 public function run($id)
 {
     parent::beforeRun();
     $model = $this->getModel($id);
     $reply = new TopicReplies();
     if (isset($_POST['TopicReplies'])) {
         if (!$this->controller->checkPermissions($model, 'view')) {
             $this->controller->denied();
         }
         $reply->text = $_POST['TopicReplies']['text'];
         $reply->topicId = $model->id;
         $this->controller->setFileFields($reply, true);
         if ($reply->save()) {
             if (isset($_FILES['TopicReplies'])) {
                 Yii::app()->end();
             }
             $reply = new TopicReplies();
         } else {
             if (isset($_FILES['TopicReplies'])) {
                 throw new CHttpException(400, Yii::t('app', 'Upload failed'));
             }
         }
     }
     $this->controller->pageClass = $this->pageClass;
     $this->controller->dataUrl = $model->getUrl();
     //       AuxLib::debugLogR ('$_GET = ');
     //        AuxLib::debugLogR ($_GET);
     //
     //        if (isset ($_GET['topic-replies_page'])) {
     //            AuxLib::debugLogR ('merging');
     //            $this->controller->dataUrl .= '/topic-replies_page/' . $_GET['topic-replies_page'];
     //           AuxLib::debugLogR ('$this->controller->dataUrl = ');
     //            AuxLib::debugLogR ($this->controller->dataUrl);
     //
     //
     //        }
     $this->controller->pageId .= '-' . $model->id;
     $this->controller->headerTitle = $model->name;
     User::addRecentItem(get_class($model), $id);
     $dataProvider = new CArrayDataProvider($model->replies, array('id' => 'topic-replies', 'pagination' => array('pageSize' => Topics::PAGE_SIZE)));
     $dataProvider->getPagination()->setItemCount($dataProvider->getTotalItemCount());
     $this->controller->render($this->pathAliasBase . 'views.mobile.topicsView', array('model' => $model, 'reply' => $reply, 'dataProvider' => $dataProvider));
 }
Example #14
Show file File: DefaultController.php Project: netconstructor/X2Engine
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $action = Actions::model()->findByPk($id);
     if ($action != null) {
         $users = User::getNames();
         $association = $this->getAssociation($action->associationType, $action->associationId);
         // if($association != null)
         // $associationName = $association->name;
         //else
         //$associationName = Yii::t('app','None');
         if ($action->assignedTo == Yii::app()->user->getName() || $action->visibility == 1 || $action->assignedTo == 'Anyone') {
             User::addRecentItem('t', $id, Yii::app()->user->getId());
             //add action to user's recent item list
             $this->render('view', array('model' => $this->loadModel($id), 'associationModel' => $association, 'users' => $users));
         } else {
             $this->redirect('index');
         }
     } else {
         $this->redirect('index');
     }
 }
Example #15
Show file File: DefaultController.php Project: netconstructor/X2Engine
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     // $this->layout = '//layouts/column3';
     $contact = $this->loadModel($id);
     $viewPermissions = $contact->assignedTo == Yii::app()->user->getName() || $contact->visibility == 1 || Yii::app()->user->getName() == 'admin';
     /* x2temp */
     $groups = GroupToUser::model()->findAllByAttributes(array('userId' => Yii::app()->user->getId()));
     $temp = array();
     foreach ($groups as $group) {
         $temp[] = $group->groupId;
     }
     if (array_search($contact->assignedTo, $temp) !== false) {
         $viewPermissions = true;
     }
     if ($contact->visibility == '2') {
         $user = User::model()->findByAttributes(array('username' => $contact->assignedTo));
         $groups = GroupToUser::model()->findAllByAttributes(array('userId' => $user->id));
         $tempOne = array();
         foreach ($groups as $group) {
             $tempOne[] = $group->groupId;
         }
         $userGroups = GroupToUser::model()->findAllByAttributes(array('userId' => Yii::app()->user->getId()));
         $tempTwo = array();
         foreach ($userGroups as $userGroup) {
             $tempTwo[] = $userGroup->groupId;
         }
         if (count(array_intersect($tempOne, $tempTwo)) > 0) {
             $viewPermissions = true;
         }
     }
     if (is_numeric($contact->assignedTo)) {
         $contact->assignedTo = Groups::model()->findByPk($contact->assignedTo)->name;
     }
     /* end x2temp */
     if ($viewPermissions) {
         User::addRecentItem('c', $id, Yii::app()->user->getId());
         ////add contact to user's recent item list
         parent::view($contact, 'contacts');
     } else {
         $this->redirect('index');
     }
 }
Example #16
Show file File: ContactsController.php Project: shuvro35/X2CRM
0
 /**
  * This is a prototype function designed to re-build a record from the changelog.
  *
  * This method is largely a work in progress though it is functional right
  * now as is, it could just use some refactoring and improvements. On the
  * "View Changelog" page in the Admin tab there's a link on each Contact
  * changelog entry to view the record at that point in the history. Clicking
  * that link brings you here.
  * @param int $id The ID of the Contact to be viewed
  * @param int $timestamp The timestamp to view the Contact at... this should probably be refactored to changelog ID
  */
 public function actionRevisions($id, $timestamp)
 {
     $contact = $this->loadModel($id);
     // Find all the changelog entries associated with this Contact after the given
     // timestamp. Realistically, this would be more accurate if Changelog ID
     // was used instead of the timestamp.
     $changes = X2Model::model('Changelog')->findAll('type="Contacts" AND itemId="' . $contact->id . '" AND timestamp > ' . $timestamp . ' ORDER BY timestamp DESC');
     // Loop through the changes and apply each one retroactively to the Contact record.
     foreach ($changes as $change) {
         $fieldName = $change->fieldName;
         if ($contact->hasAttribute($fieldName) && $fieldName != 'id') {
             $contact->{$fieldName} = $change->oldValue;
         }
     }
     // Set our widget info
     if (isset($this->portlets['TimeZone'])) {
         $this->portlets['TimeZone']['params']['model'] =& $contact;
     }
     if ($this->checkPermissions($contact, 'view')) {
         if (isset($_COOKIE['vcr-list'])) {
             Yii::app()->user->setState('vcr-list', $_COOKIE['vcr-list']);
         }
         User::addRecentItem('c', $id, Yii::app()->user->getId());
         ////add contact to user's recent item list
         // View the Contact with the data modified to this point
         parent::view($contact, 'contacts');
     } else {
         $this->redirect('index');
     }
 }
Example #17
Show file File: DocsController.php Project: shayanyi/CRM
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = CActiveRecord::model('Docs')->findByPk($id);
     if (!$this->checkPermissions($model, 'view')) {
         $this->denied();
     }
     if (isset($model)) {
         $permissions = explode(", ", $model->editPermissions);
         if (in_array(Yii::app()->user->getName(), $permissions)) {
             $editFlag = true;
         } else {
             $editFlag = false;
         }
     }
     if (!isset($model) || $model->visibility == 0 && $model->createdBy != Yii::app()->user->getName() && !Yii::app()->params->isAdmin && !$editFlag) {
         $this->redirect(array('/docs/docs/index'));
     }
     // add doc to user's recent item list
     User::addRecentItem('d', $id, Yii::app()->user->getId());
     X2Flow::trigger('RecordViewTrigger', array('model' => $model));
     $this->render('view', array('model' => $model));
 }
Example #18
Show file File: MarketingController.php Project: shayanyi/CRM
0
 /**
  * Displays a particular model.
  *
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     if (!$this->checkPermissions($model, 'view')) {
         $this->denied();
     }
     if (!isset($model)) {
         Yii::app()->user->setFlash('error', Yii::t('app', 'The requested page does not exist.'));
         $this->redirect(array('index'));
     }
     if (isset($model->list)) {
         //set this as the list we are viewing, for use by vcr controls
         Yii::app()->user->setState('contacts-list', $model->list->id);
     }
     // add campaign to user's recent item list
     User::addRecentItem('p', $id, Yii::app()->user->getId());
     $this->view($model, 'marketing', array('contactList' => $model->list));
 }