本文整理汇总了PHP中Yum::module方法的典型用法代码示例。如果您正苦于以下问题:PHP Yum::module方法的具体用法?PHP Yum::module怎么用?PHP Yum::module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yum
的用法示例。
在下文中一共展示了Yum::module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction($action)
{
if (Yum::module()->enableOnlineStatus && !Yii::app()->user->isGuest) {
Yii::app()->user->data()->setLastAction();
}
return parent::beforeAction($action);
}
示例2: tableName
public function tableName()
{
if (isset(Yum::module('profile')->profileCommentTable)) {
return Yum::module('profile')->profileCommentTable;
}
return '{{profile_comment}}';
}
示例3: checkAccess
public function checkAccess($operation, $params=array(), $allowCaching=true)
{
if(!Yum::hasModule('role') || Yum::module('role')->useYiiCheckAccess )
return parent::checkAccess($operation, $params, $allowCaching);
return $this->can($operation);
}
示例4: tableName
public function tableName()
{
if (isset(Yum::module('profile')->privacySettingTable)) {
return Yum::module('profile')->privacySettingTable;
}
return '{{privacysetting}}';
}
示例5: rules
public function rules()
{
$rules = parent::rules();
/* FIXME: As soon as i grasp how i can dynamically add variables to a
class in PHP, i will enable this code snippet for flexibility:
$profile = new YumProfile;
$profile_rules = $profile->rules();
foreach($profile_rules as $rule)
if(isset($rule[0]) && is_string($rule[0]))
$this->${$rule[0]} = '';
$rules = array_merge($rules, $profile->rules()); */
$rules[] = array('username', 'required');
$rules[] = array('password, verifyPassword', 'required');
$rules[] = array('password', 'compare',
'compareAttribute'=>'verifyPassword',
'message' => Yum::t("Retype password is incorrect."));
if(Yum::module('registration')->enableCaptcha)
$rules[] = array('verifyCode', 'captcha',
'allowEmpty'=>CCaptcha::checkRequirements());
return $rules;
}
示例6: actionCreate
public function actionCreate()
{
$this->layout = Yum::module()->adminLayout;
$model = new YumPermission();
$this->performAjaxValidation($model, 'permission-create-form');
if (isset($_POST['YumPermission'])) {
$model->attributes = $_POST['YumPermission'];
if ($model->validate()) {
if ($_POST['YumPermission']['type'] == 'user') {
$model->subordinate = $_POST['YumPermission']['subordinate_id'];
$model->principal = $_POST['YumPermission']['principal_id'];
} else {
if ($_POST['YumPermission']['type'] == 'role') {
$model->subordinate_role = $_POST['YumPermission']['subordinate_id'];
$model->principal_role = $_POST['YumPermission']['principal_id'];
}
}
if ($model->save()) {
$this->redirect(array('admin'));
}
return;
}
}
$model->type = 'user';
// preselect 'user'
$this->render('create', array('model' => $model));
}
示例7: actionEditAvatar
public function actionEditAvatar()
{
$model = YumUser::model()->findByPk(Yii::app()->user->id);
if (isset($_POST['YumUser'])) {
$model->attributes = $_POST['YumUser'];
$model->setScenario('avatarUpload');
if (Yum::module('avatar')->avatarMaxWidth != 0) {
$model->setScenario('avatarSizeCheck');
}
$model->avatar = CUploadedFile::getInstanceByName('YumUser[avatar]');
if ($model->validate()) {
if ($model->avatar instanceof CUploadedFile) {
// Prepend the id of the user to avoid filename conflicts
$filename = Yum::module('avatar')->avatarPath . '/' . $model->id . '_' . $_FILES['YumUser']['name']['avatar'];
$model->avatar->saveAs($filename);
$model->avatar = $filename;
if ($model->save()) {
Yum::setFlash(Yum::t('The image was uploaded successfully'));
Yum::log(Yum::t('User {username} uploaded avatar image {filename}', array('{username}' => $model->username, '{filename}' => $model->avatar)));
$this->redirect(array('//profile/profile/view'));
}
}
}
}
$this->render('edit_avatar', array('model' => $model));
}
示例8: tableName
public function tableName()
{
if (isset(Yum::module('profile')->profileVisitTable)) {
return Yum::module('profile')->profileVisitTable;
}
return '{{profile_visit}}';
}
示例9: tableName
public function tableName()
{
if (isset(Yum::module()->translationTable)) {
return Yum::module()->translationTable;
} else {
return '{{translation}}';
}
}
示例10: behaviors
/**
* Adds the CAdvancedArBehavior and, if enabled, the LoggableBehavior to
* every YUM Active Record model
* @return array
*/
public function behaviors()
{
$behaviors = array('CAdvancedArBehavior');
if (Yum::module()->enableAuditTrail) {
$behaviors = array_merge($behaviors, array('LoggableBehavior' => 'application.modules.auditTrail.behaviors.LoggableBehavior'));
}
return $behaviors;
}
示例11: rules
public function rules()
{
$rules = array(array('login_or_email', 'required'), array('login_or_email', 'checkexists'));
if (Yum::module('registration')->validEmailPattern) {
$rules[] = array('login_or_email', 'match', 'pattern' => Yum::module('registration')->validEmailPattern, 'message' => Yum::t('Incorrect symbols. (A-z0-9)'));
}
return $rules;
}
示例12: createRandomPassword
public function createRandomPassword() {
$lowercase = Yum::module()->passwordRequirements['minLowerCase'];
$uppercase = Yum::module()->passwordRequirements['minUpperCase'];
$minnumbers = Yum::module()->passwordRequirements['minDigits'];
$max = Yum::module()->passwordRequirements['maxLen'];
$chars = "abcdefghijkmnopqrstuvwxyz";
$numbers = "1023456789";
srand((double) microtime() * 1000000);
$i = 0;
$current_lc = 0;
$current_uc = 0;
$current_dd = 0;
$password = '';
while ($i <= $max) {
if ($current_lc < $lowercase) {
$charnum = rand() % 22;
$tmpchar = substr($chars, $charnum, 1);
$password = $password . $tmpchar;
$i++;
}
if ($current_uc < $uppercase) {
$charnum = rand() % 22;
$tmpchar = substr($chars, $charnum, 1);
$password = $password . strtoupper($tmpchar);
$i++;
}
if ($current_dd < $minnumbers) {
$charnum = rand() % 9;
$tmpchar = substr($numbers, $charnum, 1);
$password = $password . $tmpchar;
$i++;
}
if ($current_lc == $lowercase && $current_uc == $uppercase && $current_dd == $numbers && $i < $max) {
$charnum = rand() % 22;
$tmpchar = substr($chars, $charnum, 1);
$password = $password . $tmpchar;
$i++;
if ($i < $max) {
$charnum = rand() % 9;
$tmpchar = substr($numbers, $charnum, 1);
$password = $password . $tmpchar;
$i++;
}
if ($i < $max) {
$charnum = rand() % 22;
$tmpchar = substr($chars, $charnum, 1);
$password = $password . strtoupper($tmpchar);
$i++;
}
}
}
return $password;
}
示例13: beforeAction
public function beforeAction($event)
{
if (Yii::app()->user->isAdmin()) {
$this->layout = Yum::module('usergroup')->adminLayout;
} else {
$this->layout = Yum::module('usergroup')->layout;
}
return parent::beforeAction($event);
}
示例14: tableName
public function tableName() {
if (isset(Yum::module()->textSettingsTable))
$this->_tableName = Yum::module()->textSettingsTable;
elseif (isset(Yii::app()->modules['user']['textSettingsTable']))
$this->_tableName = Yii::app()->modules['user']['textSettingsTable'];
else
$this->_tableName = '{{yumtextsettings}}'; // fallback if nothing is set
return Yum::resolveTableName($this->_tableName, $this->getDbConnection());
}
示例15: actionAdmin
public function actionAdmin()
{
$this->layout = Yum::module()->adminLayout;
$model = new YumAction('search');
$model->unsetAttributes();
if (isset($_GET['YumAction'])) {
$model->attributes = $_GET['YumAction'];
}
$this->render('admin', array('model' => $model));
}