コード例 #1
0
ファイル: ScreensController.php プロジェクト: mrtos/OpenNVR
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Screens the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     //$id = (int)$id;
     $model = Screens::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
         //		} elseif ((Yii::app()->user->getId() != $model->owner_id) && (Yii::app()->user->permissions != 3)) {
         //			$model=null;
     }
     return $model;
 }
コード例 #2
0
ファイル: main-hipster.php プロジェクト: mrtos/OpenNVR
    ?>
					<li class="dropdown">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php 
    echo Yii::t('menu', 'Screens');
    ?>
 <b class="caret"></b></a>
						<ul class="dropdown-menu">
							<li><?php 
    echo CHtml::link(Yii::t('menu', 'Manage'), $this->createUrl('screens/manage'));
    ?>
</li>
							<?php 
    if (Yii::app()->user->permissions == 3) {
        $myscreens = Screens::model()->findAll();
    } else {
        $myscreens = Screens::model()->findAllByAttributes(array('owner_id' => Yii::app()->user->getId()));
    }
    foreach ($myscreens as $key => $value) {
        echo "<li>" . CHtml::link("{$value->name}", $this->createUrl("screens/view/id/{$value->id}")) . "</li>";
    }
    ?>
						</ul>
					</li>

					<li><?php 
    echo CHtml::link(Yii::t('menu', 'Account settings'), $this->createUrl('users/profile', array('id' => 'any')));
    ?>
</li>
					<li><?php 
    echo CHtml::link(Yii::t('menu', 'Logout [{nick}]', array('{nick}' => Yii::app()->user->nick)), $this->createUrl('site/logout'));
    ?>