Esempio n. 1
0
	/**
	 * Displays a particular model.
	 * @param integer $id the ID of the model to be displayed
	 */
	public function actionView($id) {
	
		$action = ActionChild::model()->findByPk($id);

		if($action != null) {
		
			$users = UserChild::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') {
				UserChild::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');
	}
Esempio n. 2
0
	/**
	 * Displays a particular model.
	 * @param integer $id the ID of the model to be displayed
	 */
	public function actionView($id) {

		$contact = $this->loadModel($id);

		if ($contact->assignedTo == Yii::app()->user->getName()
				|| $contact->visibility == 1
				|| Yii::app()->user->getName() == 'admin') {
			UserChild::addRecentItem('c',$id,Yii::app()->user->getId());	////add contact to user's recent item list
			parent::actionView($contact, 'contacts');
		} else
			$this->redirect('index');
	}