public function beforeSave()
 {
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     // check for single role
     foreach ($roles as $role) {
         if ($role->name == 'Editor' or $role->name == 'Administrator' or $role->name == 'Superadmin') {
             $this->post_editor = Yii::app()->user->id;
         } else {
             $this->post_author = Yii::app()->user->id;
         }
     }
     if ($this->isNewRecord) {
         // jika record baru jalankan
         $this->post_created = date('Y-m-d H:i:s');
     }
     if ($this->post_name == '') {
         $this->post_name = 'No Title';
     }
     if ($this->post_link == '') {
         $this->post_link = $this->post_name;
     }
     if ($this->post_title == '') {
         $this->post_title = $this->post_name;
     }
     $this->post_type = $this->_type;
     $this->post_image = str_replace(Helper::rootImg('content'), '', $this->post_image);
     return parent::beforeSave();
 }
 public function beforeControllerAction($controller, $action)
 {
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     // check for single role
     foreach ($roles as $role) {
         if (sizeof($roles) == 1 and $role->name == 'parent') {
             $controller->layout = 'none';
         }
         if (sizeof($roles) == 1 and $role->name == 'student') {
             $controller->layout = 'studentmain';
         }
     }
     if (Yii::app()->user->isGuest) {
         if (Yii::app()->user->loginUrl) {
             $controller->redirect($controller->createUrl(reset(Yii::app()->user->loginUrl)));
         } else {
             $controller->redirect($controller->createUrl('/'));
         }
     } else {
         if (parent::beforeControllerAction($controller, $action)) {
             // this method is called before any module controller action is performed
             // you may place customized code here
             return true;
         } else {
             return false;
         }
     }
 }
 public function isRole($roleParam)
 {
     $allroles = Rights::getAssignedRoles($this->id);
     foreach ($allroles as $ii) {
         if ($ii->name == $roleParam) {
             return true;
         }
     }
     return false;
 }
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = '`file`<>:null';
     $criteria->params = array(':null' => '');
     $roles = Rights::getAssignedRoles(Yii::app()->user->id);
     // check for single role
     $user_roles = array();
     foreach ($roles as $role) {
         $user_roles[] = '"' . $role->name . '"';
     }
     $teacher = Employees::model()->findByAttributes(array('uid' => Yii::app()->user->id));
     $batches = Batches::model()->findAllByAttributes(array('employee_id' => $teacher->id));
     foreach ($batches as $classteacher) {
         $batch[] = $classteacher->id;
     }
     $timetable = TimetableEntries::model()->findAllByAttributes(array('employee_id' => $teacher->id));
     foreach ($timetable as $period) {
         $batch[] = $period->batch_id;
     }
     $unique_batch = array_unique($batch);
     if (count($unique_batch) > 0) {
         $criteria->condition .= ' AND (`placeholder`=:null OR `created_by`=:user_id OR (`placeholder` IN (' . implode(',', $user_roles) . ')) AND (`batch` IS NULL OR `batch` IN (' . implode(',', $unique_batch) . '))) ';
     } else {
         $criteria->condition .= ' AND (`placeholder`=:null OR `created_by`=:user_id) OR (`placeholder` IN (' . implode(',', $user_roles) . '))';
     }
     $criteria->params[':user_id'] = Yii::app()->user->id;
     $criteria->order = '`created_at` DESC';
     $files = FileUploads::model()->findAll($criteria);
     if (isset($_POST['Downfiles'])) {
         $selected_files = $_POST['Downfiles'];
         $slfiles = array();
         foreach ($selected_files as $s_file) {
             $model = FileUploads::model()->findByPk($s_file);
             if ($model != NULL) {
                 $slfiles[] = 'uploads/shared/' . $model->id . '/' . $model->file;
             }
         }
         $zip = Yii::app()->zip;
         $fName = $this->generateRandomString(rand(10, 20)) . '.zip';
         $zipFile = 'compressed/' . $fName;
         if ($zip->makeZip($slfiles, $zipFile)) {
             $fcon = file_get_contents($zipFile);
             header('Content-type:text/plain');
             header('Content-disposition:attachment; filename=' . $fName);
             header('Pragma:no-cache');
             echo $fcon;
             unlink($zipFile);
         } else {
             Yii::app()->user->setFlash('success', 'Can\'t download');
         }
     }
     $this->render('/fileUploads/index', array('files' => $files));
 }
 public function actions()
 {
     $disabled = array();
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     // check for single role
     foreach ($roles as $role) {
         if ($role->name != 'Editor' and $role->name != 'Administrator' and $role->name != 'Superadmin') {
             $disabled = array('copy', 'paste', 'archive', 'extract', 'mkdir', 'mkfile', 'rm', 'duplicate', 'resize', 'rename', 'edit');
         }
     }
     return array('connector' => array('class' => 'ElFinderConnectorAction', 'settings' => array('root' => ROOT_DIR . '/uploads/content/', 'URL' => rootUrl . 'uploads/content/', 'rootAlias' => 'Home', 'mimeDetect' => 'internal', 'tmbDir' => '.tmb', 'debug' => '', 'uploadAllow' => array('image'), 'uploadDeny' => array('all'), 'uploadOrder' => 'deny,allow', 'perms' => array('/\\.(txt|html|php|py|pl|sh|xml)$/i' => array('read' => true, 'write' => false, 'rm' => true)), 'disabled' => $disabled)));
 }
 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     if (Yii::app()->user->isGuest) {
         $model = new UserLogin();
         // collect user input data
         if (isset($_POST['UserLogin'])) {
             $model->attributes = $_POST['UserLogin'];
             // validate user input and redirect to previous page if valid
             if ($model->validate()) {
                 $this->lastViset();
                 //Yii::import('application.controllers.ActivityFeedController');
                 //SmsSettings::model()->sendSms($to,$from,$message); To call an action written on a controller
                 //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
                 ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '1', NULL, NULL, NULL, NULL, NULL);
                 $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
                 // check for single role
                 foreach ($roles as $role) {
                     if (sizeof($roles) == 1 and $role->name == 'Company') {
                         $this->redirect(array('/students'));
                     }
                 }
                 if (sizeof($roles) == 1 and $role->name == 'Trainee') {
                     $this->redirect(array('/students'));
                 }
                 if (sizeof($roles) == 1 and $role->name == 'Employee') {
                     $this->redirect(array('/students'));
                 }
                 if (Yii::app()->user->checkAccess('admin')) {
                     if (Yii::app()->user->returnUrl == '/index.php') {
                         $this->redirect(Yii::app()->controller->module->returnUrl);
                     } else {
                         $this->redirect(Yii::app()->user->returnUrl);
                     }
                 } else {
                     $this->redirect(array('/students'));
                 }
             }
         }
         // display the login form
         $this->render('/user/login', array('model' => $model));
     } else {
         $this->redirect(Yii::app()->controller->module->returnUrl);
     }
 }
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = '';
     $roles = Rights::getAssignedRoles(Yii::app()->user->id);
     // check for single role
     $user_roles = array();
     foreach ($roles as $role) {
         $user_roles[] = '"' . $role->name . '"';
     }
     $student = Students::model()->findByAttributes(array('uid' => Yii::app()->user->id));
     $batch = Batches::model()->findByAttributes(array('id' => $student->batch_id));
     $criteria->condition .= '`file`<>:null AND (`placeholder`=:null OR `placeholder` IN (' . implode(',', $user_roles) . ')) AND ((`course` IS NULL) OR (`course`=:course) OR (`course`=0)) AND ((`batch` IS NULL) OR (`batch`=:batch) OR (`batch`=0))';
     $criteria->params = array(':null' => '', ':course' => $batch->course_id, ':batch' => $batch->id);
     $criteria->order = '`created_at` DESC';
     //print_r($criteria); exit;
     $files = FileUploads::model()->findAll($criteria);
     if (isset($_POST['Downfiles'])) {
         $selected_files = $_POST['Downfiles'];
         $slfiles = array();
         foreach ($selected_files as $s_file) {
             $model = FileUploads::model()->findByPk($s_file);
             if ($model != NULL) {
                 $slfiles[] = 'uploads/shared/' . $model->id . '/' . $model->file;
             }
         }
         $zip = Yii::app()->zip;
         $fName = $this->generateRandomString(rand(10, 20)) . '.zip';
         $zipFile = 'compressed/' . $fName;
         if ($zip->makeZip($slfiles, $zipFile)) {
             $fcon = file_get_contents($zipFile);
             header('Content-type:text/plain');
             header('Content-disposition:attachment; filename=' . $fName);
             header('Pragma:no-cache');
             echo $fcon;
             unlink($zipFile);
         } else {
             Yii::app()->user->setFlash('success', 'Can\'t download');
         }
     }
     $this->render('/fileUploads/index', array('files' => $files));
 }
 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     if (Yii::app()->user->isGuest) {
         $model = new UserLogin();
         // collect user input data
         if (isset($_POST['UserLogin'])) {
             $model->attributes = $_POST['UserLogin'];
             // validate user input and redirect to previous page if valid
             if ($model->validate()) {
                 $this->lastViset();
                 $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
                 // check for single role
                 foreach ($roles as $role) {
                     if (sizeof($roles) == 1 and $role->name == 'parent') {
                         $this->redirect(array('/portal'));
                     }
                 }
                 if (sizeof($roles) == 1 and $role->name == 'student') {
                     $this->redirect(array('/portal'));
                 }
                 if (sizeof($roles) == 1 and $role->name == 'teacher') {
                     $this->redirect(array('/portal'));
                 }
                 if (Yii::app()->user->checkAccess('admin')) {
                     if (Yii::app()->user->returnUrl == '/index.php') {
                         $this->redirect(Yii::app()->controller->module->returnUrl);
                     } else {
                         $this->redirect(Yii::app()->user->returnUrl);
                     }
                 } else {
                     $this->redirect(array('/mailbox'));
                 }
             }
         }
         // display the login form
         $this->render('/user/login', array('model' => $model));
     } else {
         $this->redirect(Yii::app()->controller->module->returnUrl);
     }
 }
Beispiel #9
0
 /**
  * Authenticates a user.
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $username = strtolower($this->username);
     $user = User::model()->find('LOWER(email)=?', array($username));
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if (!$user->validatePassword($this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             $this->_id = $user->id;
             $this->username = $user->email;
             $this->setState('name', $user->name);
             $this->setState('dashboardurl', '/dashboard');
             $this->errorCode = self::ERROR_NONE;
             $this->setSessionParams($user->publisher);
             $roles = Rights::getAssignedRoles($user->id, true);
             $this->setState('isAdmin', array_key_exists("Admin", $roles) ? 1 : 0);
         }
     }
     return $this->errorCode == self::ERROR_NONE;
 }
Beispiel #10
0
 public function role()
 {
     foreach (Rights::getAssignedRoles($this->id) as $role) {
         echo $role->description . ', ';
     }
 }
 public static function checkTransferTo($params = null, $data = null, $perm)
 {
     $roles = Rights::getAssignedRoles(user()->id, true);
     $arr_result = array();
     $to_user_roles = Rights::getAssignedRoles($params['to_user_id'], true);
     foreach ($roles as $role) {
         if (array_key_exists(trim($role->name), $perm)) {
             foreach ($to_user_roles as $to_role) {
                 if (array_key_exists($to_role->name, $perm[trim($role->name)]['allowedTransferto'])) {
                     $arr_result[] = GxcContentPermission::execBizRules($perm[trim($role->name)]['allowedTransferto'][$to_role->name]['condition'], $params, $data);
                 } else {
                     $arr_result[] = false;
                 }
             }
         }
     }
     if (in_array(true, $arr_result)) {
         return true;
     } else {
         return false;
     }
 }
Beispiel #12
0
 public function checkUserRole($user_id)
 {
     foreach (Rights::getAssignedRoles($user_id) as $role) {
         echo $role->name . '<br/>';
     }
 }
Beispiel #13
0
    /**
     * Do Search Object based on its status
     * @param type $type
     * @return CActiveDataProvider 
     */
    public function doSearch($type = 0)
    {
        $criteria = new CDbCriteria();
        $sort = new CSort();
        $sort->attributes = array('object_id');
        $sort->defaultOrder = 'object_id DESC';
        switch ($type) {
            //If looking for DRAFT Content
            case ConstantDefine::OBJECT_STATUS_DRAFT:
                $criteria->condition = 'object_status = :status and object_author = :uid';
                $criteria->params = array(':status' => ConstantDefine::OBJECT_STATUS_DRAFT, ':uid' => user()->id);
                break;
                //If looking for Pending Content
            //If looking for Pending Content
            case ConstantDefine::OBJECT_STATUS_PENDING:
                $criteria->select = " t.*";
                $criteria->distinct = true;
                $current_user_roles = Rights::getAssignedRoles(user()->id, true);
                foreach ($current_user_roles as $r) {
                    $user_roles_allow[] = $r->name;
                }
                $criteria->join = "JOIN gxc_transfer as tr ON t.object_id = tr.object_id\n\t\t\tLEFT OUTER JOIN gxc_transfer tr2 ON (t.object_id = tr2.object_id AND \n\t\t\t(tr.time < tr2.time OR tr.time = tr2.time AND tr.transfer_id < tr2.transfer_id))";
                $criteria->condition = 'object_status = :status and tr2.transfer_id IS NULL and
			(( tr.type= :type_person and tr.to_user_id = :toperson ) or (
			   tr.type= :type_role and tr.note in ( "' . implode(",", $user_roles_allow) . '" )
			) )
			';
                $criteria->params = array(':status' => ConstantDefine::OBJECT_STATUS_PENDING, ':toperson' => user()->id, ':type_person' => ConstantDefine::TRANS_PERSON, ':type_role' => ConstantDefine::TRANS_ROLE);
                break;
                //If looking for Published Content
            //If looking for Published Content
            case ConstantDefine::OBJECT_STATUS_PUBLISHED:
                //Do nothing;
                $criteria->condition = 'object_status = :status';
                $criteria->params = array(':status' => ConstantDefine::OBJECT_STATUS_PUBLISHED);
                break;
        }
        $criteria->compare('object_id', $this->object_id, true);
        $criteria->compare('object_author', $this->object_author, true);
        $criteria->compare('object_date', $this->object_date);
        $criteria->compare('object_content', $this->object_content, true);
        $criteria->compare('object_title', $this->object_title, true);
        $criteria->compare('object_name', $this->object_name, true);
        return new CActiveDataProvider(get_class($this), array('criteria' => $criteria, 'sort' => $sort));
    }
Beispiel #14
0
<?php

if (Yii::app()->user->isSuperuser && $data->id != Yii::app()->user->id) {
    $roles = Rights::getAssignedRoles($data->id);
    $su = 0;
    foreach ($roles as $role) {
        if ($role->name == 'Admin') {
            $su = 1;
            break;
        }
    }
    if ($su) {
        $group = Yii::t('site', 'Admin');
    } else {
        $group = Yii::t('site', 'User');
    }
    ?>
<a  data-title="<?php 
    echo Yii::t('site', 'Change status');
    ?>
"  data-value="<?php 
    echo $su;
    ?>
" data-pk="<?php 
    echo $data->id;
    ?>
"   id="group<?php 
    echo $data->id;
    ?>
" href="#" class="status editable editable-click" data-original-title="" title="" style=""><?php 
    echo $group;
Beispiel #15
0
 public function getType($alias = false)
 {
     $roles = Rights::getAssignedRoles($this->id);
     foreach ($roles as $role) {
         if ($alias == true) {
             return $role->name;
         }
         return $role->getNameText();
     }
 }
 public function listStatus()
 {
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     // check for single role
     foreach ($roles as $role) {
         if ($role->name == 'Editor' or $role->name == 'Administrator' or $role->name == 'Superadmin') {
             return array('publish' => 'Publish', 'draft' => 'Draft');
         } else {
             return array('draft' => 'Draft');
         }
     }
 }
Beispiel #17
0
 /**
  * Static Function retrun Array Roles of the User
  * @param bigint $uid
  * @return string
  */
 public static function getArrayRoles($uid = 0)
 {
     $res = array();
     if ($uid) {
         $roles = Rights::getAssignedRoles($uid, true);
         $res = array();
         foreach ($roles as $r) {
             $res[] = $r->name;
         }
     }
     return $res;
 }
 /**
  * Return admin status.
  * @return boolean
  */
 public static function isAdmin()
 {
     if (Yii::app()->user->isGuest) {
         return false;
     } else {
         if (!isset(self::$_admin)) {
             $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
             // check for single role
             foreach ($roles as $role) {
                 if ($role->name == 'Administrator' or $role->name == 'Superadmin') {
                     self::$_admin = true;
                 } else {
                     self::$_admin = false;
                 }
             }
         }
         return self::$_admin;
     }
 }
Beispiel #19
0
 public function getRoles()
 {
     return array_keys(Rights::getAssignedRoles($this->id));
 }
Beispiel #20
0
 public function role($data, $row)
 {
     $roles = Rights::getAssignedRoles($data->id);
     // check for single role
     if (count($roles) < 1) {
         return 'No roles';
     } else {
         foreach ($roles as $role) {
             return $role->name;
         }
     }
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Registration();
     $model_1 = new Room();
     //$err_msg = '';
     $err_flag = 0;
     $err_msg = Yii::t('hostel', 'Please fix the following errors.') . '<br/>';
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Registration'])) {
         $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
         // check for single role
         foreach ($roles as $role) {
             if (sizeof($roles) == 1 and $role->name == 'student') {
                 $request = new Roomrequest();
                 $model->student_id = $_POST['Registration']['student_id'];
                 $model->food_preference = $_POST['Registration']['food_preference'];
                 $model->status = 'C';
                 $request->student_id = $_POST['Registration']['student_id'];
                 $request->status = 'C';
                 $request->save();
                 $model->save();
                 $this->redirect(array('/hostel/registration/create'));
             } else {
                 if ($_POST['hostel'] == NULL) {
                     $err_flag = 1;
                     $err_msg = $err_msg . '- ' . Yii::t('hostel', 'Hostel cannot be blank') . '<br/>';
                 }
                 if ($_POST['floor'] == NULL) {
                     $err_flag = 1;
                     $err_msg = $err_msg . '- ' . Yii::t('hostel', 'Floor cannot be blank') . '<br/>';
                 }
                 if ($_POST['student_id'] == NULL) {
                     $err_flag = 1;
                     $err_msg = $err_msg . '- ' . Yii::t('hostel', 'Student cannot be blank') . '<br/>';
                 }
                 if ($_POST['Registration']['food_preference'] == NULL) {
                     $err_flag = 1;
                     $err_msg = $err_msg . '- ' . Yii::t('hostel', 'Food Preference cannot be blank') . '<br/>';
                 }
                 if ($err_flag == 0) {
                     $allot_erre = Allotment::model()->findByAttributes(array('student_id' => $_POST['student_id'], 'status' => 'S'));
                     $hostel_reg = Registration::model()->findByAttributes(array('student_id' => $_POST['student_id'], 'status' => 'S'));
                     $model->attributes = $_POST['Registration'];
                     $model->student_id = $_POST['student_id'];
                     if ($allot_erre != NULL and $hostel_reg != NULL) {
                         $this->redirect(array('error', 'student_id' => $_POST['student_id']));
                     }
                     $trans = Transportation::model()->findByAttributes(array('student_id' => $_POST['student_id']));
                     if ($trans->student_id != NULL) {
                         if ($trans->student_id == $_POST['student_id']) {
                             $this->redirect(array('warning', 'registration' => $_POST['Registration'], 'student_id' => $_POST['student_id'], 'floor_id' => $_POST['floor'], 'hostel' => $_POST['hostel']));
                         }
                     }
                     $register = Registration::model()->findByAttributes(array('student_id' => $_POST['student_id']));
                     //var_dump($register->attributes);exit;
                     if ($register != NULL) {
                         $request = Roomrequest::model()->findByAttributes(array('student_id' => $register->student_id, 'status' => 'C'));
                         if ($request != NULL) {
                             $request->status = 'S';
                             $request->save();
                         }
                         $register->status = 'S';
                         $register->save();
                     } else {
                         $model->food_preference = $_POST['Registration']['food_preference'];
                         $model->student_id = $_POST['student_id'];
                         $model->status = 'S';
                     }
                     if ($model->save()) {
                         //$bed_info=Allotment::model()->findAll('status=:x AND student_id=:y',array(':x'=>'C',':y'=>NULL));
                         $bed_info = Allotment::model()->findByAttributes(array('student_id' => NULL, 'status' => 'C'));
                         //var_dump($bed_info->attributes);exit;
                         if ($bed_info == NULL) {
                             $this->redirect(array('/hostel/allotment/roominfo/'));
                         } else {
                             $this->redirect(array('/hostel/room/roomlist', 'id' => $model->student_id, 'floor_id' => $_POST['floor']));
                         }
                     }
                 } else {
                     Yii::app()->user->setFlash('errorMessage', $err_msg);
                 }
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function actionMySlip()
 {
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     foreach ($roles as $role) {
         $cekrole = $role->name;
     }
     $model = new Listgaji();
     $slip = false;
     $id = Yii::app()->user->Id;
     $command = Yii::app()->db->createCommand();
     $dataKaryawan = $command->select('*')->from('profiles')->where('user_id=:id', array(':id' => $id))->queryRow();
     if (isset($_GET['month']) and isset($_GET['year'])) {
         $listgaji = Listgaji::model()->findByAttributes(array('month' => $_GET['month'], 'year' => $_GET['year'], 'nip' => $dataKaryawan['nip']));
         if ($listgaji == null) {
             $this->render('mySlip', array('model' => $listgaji, 'model2' => $dataKaryawan, 'slip' => true));
         } else {
             $dataKaryawan = $this->loadModel2($listgaji->nip);
             $this->render('mySlip', array('model' => $listgaji, 'model2' => $dataKaryawan, 'slip' => true));
         }
     } else {
         $this->render('mySlip', array('model' => $model, 'slip' => $slip, 'model2' => $dataKaryawan));
     }
 }
Beispiel #23
0
?>

	
	<title><?php 
echo CHtml::encode($this->pageTitle);
?>
</title>
</head>

<body style="background-color:#f5f5f5;">
<div class="container" id="page">
	<?php 
$cekrole = '';
?>
	<?php 
$roles = Rights::getAssignedRoles(Yii::app()->user->Id);
foreach ($roles as $role) {
    $cekrole = $role->name;
}
?>

		
		<?php 
$this->widget('bootstrap.widgets.TbNavbar', array('brandLabel' => 'Morena Payroll Web', 'collapse' => true, 'items' => array(array('class' => 'bootstrap.widgets.TbNav', 'items' => array(array('label' => Yii::t('app', 'Login'), 'url' => array('/user/login/login'), 'visible' => Yii::app()->user->isGuest), array('label' => Yii::t('app', 'Payroll Management'), 'url' => array('/listgaji/admin'), 'visible' => $cekrole == 'Admin' or $cekrole == 'adminMorena' or $cekrole == 'supervisorMorena'), array('label' => Yii::t('app', 'Users Management'), 'url' => array('/user/admin/admin'), 'visible' => $cekrole == 'Admin' or $cekrole == 'adminMorena' or $cekrole == 'supervisorMorena'), array('label' => Yii::t('app', 'My Salary Slip'), 'url' => array('/listgaji/mySlip'), 'visible' => $cekrole == 'employee'), array('label' => Yii::t('app', 'About'), 'url' => array('/site/page', 'view' => 'about'), 'visible' => Yii::app()->user->isGuest), array('label' => Yii::t('app', 'Contact'), 'url' => array('/site/contact'), 'visible' => Yii::app()->user->isGuest), array('label' => Yii::t('app', 'Logout') . ' (' . Yii::app()->user->name . ')', 'url' => array('/user/logout'), 'visible' => !Yii::app()->user->isGuest))))));
?>
	
<!-- mainmenu -->
</div>	

<div class="container" style="background-color: red;">
Beispiel #24
0
                <div class="a_feed_cntnr" >
               <!-- <div class="a_feed_seprtr"><h1>9 Sep 2013</h1></div>-->
                	<div class="a_feed_bx" id="feed_content_box">
                    	
                    
						<?php 
//$feeds = ActivityFeed::model()->findAll($criteria); // Get all feeds
$count = 0;
if ($feeds != NULL) {
    foreach ($feeds as $feed) {
        ?>
                                	<div class="individual_feed">
                                <?php 
        $initiator = Profile::model()->findByAttributes(array('user_id' => $feed->initiator_id));
        // Generate appropriate url and id
        $roles = Rights::getAssignedRoles($initiator->user_id);
        // check for single role
        foreach ($roles as $role) {
            if (sizeof($roles) == 1 and $role->name == 'Admin') {
                $url = "user/admin/view";
                $id = $feed->initiator_id;
            }
        }
        if (sizeof($roles) == 1 and $role->name == 'parent') {
            $url = "students/guardians/view";
            $guardian = Guardians::model()->findByAttributes(array('uid' => $feed->initiator_id));
            $id = $guardian->id;
        }
        if (sizeof($roles) == 1 and $role->name == 'student') {
            $url = "/students/students/view";
            $student = Students::model()->findByAttributes(array('uid' => $feed->initiator_id));
Beispiel #25
0
 /**
  * Static Function retrun String Roles of the User
  * @param bigint $uid
  * @return string
  */
 public static function getStringRoles($uid = 0)
 {
     $roles = Rights::getAssignedRoles($uid, true);
     $res = array();
     foreach ($roles as $r) {
         $res[] = $r->name;
     }
     if (count($res) > 0) {
         return implode(",", $res);
     } else {
         return '';
     }
 }
Beispiel #26
0
 public function getUserRoles()
 {
     return Rights::getAssignedRoles($this->id);
 }