当前位置: 首页>>代码示例>>PHP>>正文


PHP Generic::isSuperAdmin方法代码示例

本文整理汇总了PHP中Generic::isSuperAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::isSuperAdmin方法的具体用法?PHP Generic::isSuperAdmin怎么用?PHP Generic::isSuperAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Generic的用法示例。


在下文中一共展示了Generic::isSuperAdmin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CanAccess

 /**
  * Determines whether access to specific action is allowed or not.
  * @param string $action the action to which the access is validated
  * @return boolean true if access to specific action is allowed; false otherwise
  */
 private function CanAccess($action = "")
 {
     $superuser = Generic::isSuperAdmin();
     if ($superuser) {
         return true;
     }
     if ($action == 'index') {
         return true;
     } else {
         if ($action == 'admin') {
             return true;
         } else {
             if ($action == 'create') {
                 return false;
             } else {
                 if ($action == 'update') {
                     return true;
                 } else {
                     if ($action == 'delete') {
                         return false;
                     } else {
                         if ($action == 'view') {
                             return true;
                         } else {
                             if ($action == 'activate') {
                                 return false;
                             } else {
                                 if ($action == 'deactivate') {
                                     return false;
                                 } else {
                                     if ($action == 'checkdata') {
                                         return false;
                                     } else {
                                         if ($action == 'exportdata') {
                                             return false;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:52,代码来源:CompetitionUserAwardsController.php

示例2: canShowAwardField

 public static function canShowAwardField($competition_id)
 {
     $superuser = Generic::isSuperAdmin();
     if (!$superuser) {
         // check if visible by competition settings
         $cache_key = 'CCompetition-mentor-awards-timestamp-' . $competition_id;
         $cache = Yii::app()->cache->get($cache_key);
         if ($cache == null) {
             $competition = Competition::model()->findByPk($competition_id);
             if ($competition != null) {
                 $cache = $competition->timestamp_mentor_awards == null ? '-' : $competition->timestamp_mentor_awards;
             } else {
                 $cache = '-';
             }
             Yii::app()->cache->set($cache_key, $cache, 600);
         }
         if ($cache == '-') {
             return false;
         } else {
             $timestamp = strtotime($cache);
             if ($timestamp > time()) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:27,代码来源:CompetitionUser.php

示例3: CanAccess

 /**
  * Determines whether access to specific action is allowed or not.
  * @param string $action the action to which the access is validated
  * @return boolean true if access to specific action is allowed; false otherwise
  */
 private function CanAccess($action = "")
 {
     $superuser = Generic::isSuperAdmin();
     $allowed = $superuser;
     if ($action == 'index') {
     } else {
         if ($action == 'admin') {
         } else {
             if ($action == 'create') {
             } else {
                 if ($action == 'update') {
                 } else {
                     if ($action == 'delete') {
                     } else {
                         if ($action == 'view') {
                         } else {
                             if ($action == 'activate') {
                             } else {
                                 if ($action == 'deactivate') {
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $allowed;
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:34,代码来源:LanguageController.php

示例4: array

<?php

/* @var $this CompetitionUserController */
/* @var $model CompetitionUser */
$this->breadcrumbs = array(Yii::t('app', 'Competition Users') => array('admin'), Yii::t('app', 'manage'));
$superuser = Generic::isSuperAdmin();
$create_competition_user = false;
$export_active_mentors = false;
$export_user_data = true;
$check_data = false;
$import_data = false;
$calculate_awards = false;
if ($superuser) {
    $create_competition_user = true;
    $export_active_mentors = true;
    $export_user_data = true;
    $check_data = true;
    $import_data = true;
    $calculate_awards = true;
}
$this->menu = array(array('label' => Yii::t('app', 'Manage Competition Users'), 'url' => array('admin')), array('label' => Yii::t('app', 'Create Competition User'), 'url' => array('create'), 'visible' => $create_competition_user), array('label' => Yii::t('app', 'Export Active Mentors'), 'url' => array('exportactivementor'), 'visible' => $export_active_mentors), array('label' => Yii::t('app', 'Export Competition User data'), 'url' => array('exportdata'), 'visible' => $export_user_data), array('label' => Yii::t('app', 'Check Competition User data'), 'url' => array('checkdata'), 'visible' => $check_data), array('label' => Yii::t('app', 'Import Competition User data'), 'url' => array('import'), 'visible' => $import_data), array('label' => Yii::t('app', 'Calculate awards for competitors'), 'url' => array('calculateawards'), 'visible' => $calculate_awards), array('label' => Yii::t('app', 'Calculate which competitors will advance to next level'), 'url' => array('calculateadvancingtonextlevel'), 'visible' => $calculate_awards));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('admin-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Manage Competition Users');
?>
</h1>
<?php 
/*
 <?php echo CHtml::link(Yii::t('app', 'advanced_search'), '#', array('class' => 'search-button')); ?>
开发者ID:lidijakralj,项目名称:bober,代码行数:31,代码来源:admin.php

示例5: CanAccess

 /**
  * Determines whether access to specific action is allowed or not.
  * @param string $action the action to which the access is validated
  * @return boolean true if access to specific action is allowed; false otherwise
  */
 private function CanAccess($action = "")
 {
     $superuser = Generic::isSuperAdmin();
     $user_role = Generic::getUserRole();
     $allowed = false;
     if ($user_role >= 5) {
         $allowed = true;
     }
     if ($action == 'index') {
     } else {
         if ($action == 'admin') {
         } else {
             if ($action == 'create') {
             } else {
                 if ($action == 'update') {
                 } else {
                     if ($action == 'delete') {
                     } else {
                         if ($action == 'view') {
                         } else {
                             if ($action == 'activate') {
                             } else {
                                 if ($action == 'deactivate') {
                                 } else {
                                     if ($action == 'import') {
                                         if (!$superuser) {
                                             $allowed = false;
                                         }
                                     } else {
                                         if ($action == 'export') {
                                             if (!$superuser) {
                                                 $allowed = false;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $allowed;
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:50,代码来源:CompetitionCategorySchoolController.php

示例6: CanView

 public function CanView()
 {
     $superuser = Generic::isSuperAdmin();
     $user_role = Generic::getUserRole();
     if ($superuser || $user_role >= 10) {
         return true;
     }
     return false;
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:9,代码来源:Competition.php

示例7: GetCompetitionNameIdList

 public function GetCompetitionNameIdList($get_only_competition_on_which_schools_you_are_mentor = false)
 {
     if ($get_only_competition_on_which_schools_you_are_mentor) {
         if (Generic::isSuperAdmin()) {
             $get_only_competition_on_which_schools_you_are_mentor = false;
         }
     }
     $list = array();
     if ($get_only_competition_on_which_schools_you_are_mentor) {
         $competitions = Competition::model()->with('competitionCategorySchools')->with('competitionCategorySchools.school')->with('competitionCategorySchools.school.schoolMentors')->findAll('schoolMentors.user_id=:user_id', array(':user_id' => Yii::app()->user->id));
         foreach ($competitions as $competition) {
             $competition['name'] = $competition->name;
             $list[] = $competition;
         }
     } else {
         $modelData = Competition::model()->search(true);
         foreach ($modelData->getData() as $competition) {
             $competition['name'] = $competition->name;
             $list[] = $competition;
         }
     }
     return $list;
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:23,代码来源:CompetitionCategorySchool.php

示例8: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search($show_all = false)
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     if ($this->level_of_education == 0) {
         $this->level_of_education = NULL;
     }
     $criteria->compare('id', $this->id);
     $criteria->compare('active', $this->active);
     $criteria->compare('country_id', $this->country_id);
     $criteria->compare('name', $this->name, true);
     $criteria->compare('level_of_education', $this->level_of_education);
     $criteria->compare('class_from', $this->class_from);
     $criteria->compare('class_to', $this->class_to);
     $criteria->together = true;
     $criteria->with = array('country');
     $criteria->compare('`country`.`country`', $this->country_search, true);
     $superuser = Generic::isSuperAdmin();
     $user_role = Generic::getUserRole();
     if ($superuser) {
         // ok
     } else {
         if ($user_role == 10) {
             // $countryAministrator = CountryAdministrator::model()->findAll('user_id=:user_id', array(':user_id' => Yii::app()->user->id));
             $criteria->with[] = 'country.countryAdministrators';
             $criteria->compare('`countryAdministrators`.`user_id`', Yii::app()->user->id);
             $criteria->together = true;
         }
     }
     $pagination = true;
     if ($show_all) {
         $pagination = false;
     }
     $options = array('criteria' => $criteria, 'sort' => array('attributes' => array('country_search' => array('asc' => 'country.name', 'desc' => 'country.name DESC'), '*')));
     if ($pagination == false) {
         $options['pagination'] = false;
     }
     return new CActiveDataProvider($this, $options);
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:44,代码来源:CompetitionCategory.php

示例9: actionGet

 public function actionGet()
 {
     $starttime = microtime(true);
     if ($this->CanAccess('get')) {
         $keys = array_keys($_GET);
         if (count($keys) == 0) {
             die;
         }
         $question_id = $keys[0];
         $superuser = Generic::isSuperAdmin();
         $user_role = Generic::getUserRole();
         $allow = false;
         if ($superuser || $user_role >= 10) {
             $allow = true;
         }
         $competition_user_id = isset(Yii::app()->session['competition_user_id']) ? Yii::app()->session['competition_user_id'] : 0;
         Yii::app()->session->close();
         $criteria = new CDbCriteria();
         $criteria->limit = 1;
         $criteria->join = 'INNER JOIN competition_question on t.competition_question_id = competition_question.id';
         $criteria->condition = 't.competition_user_id = :competition_user_id AND competition_question.question_id = :question_id';
         $criteria->params = array(':question_id' => $question_id, ':competition_user_id' => $competition_user_id);
         $competition_user_question = CompetitionUserQuestion::model()->find($criteria);
         //$competition_user_question = CompetitionUserQuestion::model()->with('competitionQuestion')->find('competitionQuestion.question_id=:question_id and t.competition_user_id=:competition_user_id', array(':question_id' => $question_id, ':competition_user_id' => $competition_user_id));
         if ($competition_user_question != null) {
             $allow = true;
         }
         if ($allow) {
             $path = '';
             foreach ($_GET as $key => $value) {
                 $path .= $key . '/';
                 if ($value != '') {
                     $path .= $value . '/';
                 }
             }
             $path = trim(mb_substr($path, mb_strpos($path, '/', 0, 'UTF-8') + 1, mb_strlen($path, 'UTF-8'), 'UTF-8'), '/');
             $filename = trim(mb_substr($path, mb_strrpos($path, '/', 0, 'UTF-8'), mb_strlen($path, 'UTF-8'), 'UTF-8'), '/');
             $language_code = mb_substr($path, 0, mb_strpos($path, '/', 0, 'UTF-8'), 'UTF-8');
             $path = ltrim(mb_substr($path, mb_strpos($path, '/', 0, 'UTF-8'), mb_strrpos($path, '/', 0, 'UTF-8') - mb_strpos($path, '/', 0, 'UTF-8'), 'UTF-8'), '/');
             if ($path != '') {
                 $path .= '/';
             }
             /*
                               echo "<pre>";
                               echo "Question ID: ";
                               print_r($question_id);
                               echo "\n";
                               echo "Language code: ";
                               print_r($language_code);
                               echo "\n";
                               var_dump($path);
                               echo "\n";
                               print_r($filename);
                               echo "</pre>";
                               die(); */
             $cache_id = 'bober-' . $question_id . '-' . $language_code . '-' . $path . '-' . $filename;
             $questionResourceArray = Yii::app()->cache->get($cache_id);
             if ($questionResourceArray === false) {
                 $questionResource = QuestionResource::model()->with('language')->find('question_id=:question_id and language.short=:language_code and path=:path and filename=:filename', array(':question_id' => $question_id, ':filename' => $filename, ':path' => $path, ':language_code' => $language_code));
                 if ($questionResource == null) {
                     $questionResource = new QuestionResource();
                     die;
                 }
                 $questionResourceArray = array('data' => $questionResource->data, 'file_type' => $questionResource->file_type, 'length' => strlen($questionResource->data));
                 if ($questionResourceArray['length'] > 1000000) {
                     // cannot go to memcache
                 } else {
                     Yii::app()->cache->set($cache_id, $questionResourceArray, 1800);
                 }
             }
             if (isset($questionResourceArray['length'])) {
                 header('Pragma: public');
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                 header('Content-Transfer-Encoding: binary');
                 header('Content-length: ' . $questionResourceArray['length']);
                 header('Content-Type: ' . $questionResourceArray['file_type']);
                 header('X-Content-Type-Options: nosniff');
                 header('X-Frame-Options: SAMEORIGIN');
                 header('Connection: close');
                 echo $questionResourceArray['data'];
             }
             die;
         } else {
             die;
         }
     } else {
         die;
     }
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:90,代码来源:QuestionResourceController.php


注:本文中的Generic::isSuperAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。