本文整理汇总了PHP中Yum::t方法的典型用法代码示例。如果您正苦于以下问题:PHP Yum::t方法的具体用法?PHP Yum::t怎么用?PHP Yum::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yum
的用法示例。
在下文中一共展示了Yum::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: actionLeave
public function actionLeave($id = null)
{
if ($id !== null) {
$p = YumUsergroup::model()->findByPk($id);
$participants = $p->participants;
if (!in_array(Yii::app()->user->id, $participants)) {
Yum::setFlash(Yum::t('You are not participating in this group'));
} else {
$participants = $p->participants;
foreach ($participants as $key => $participant) {
if ($participant == Yii::app()->user->id) {
unset($participants[$key]);
}
}
$p->participants = $participants;
if ($p->save(array('participants'))) {
Yum::setFlash(Yum::t('You have left this group'));
Yum::log(Yum::t('User {username} left group id {id}', array('{username}' => Yii::app()->user->data()->username, '{id}' => $id)));
}
}
$this->redirect(array('//usergroup/groups/index'));
} else {
throw new CHttpException(404);
}
}
示例3: itemAlias
public static function itemAlias($type,$code=NULL) {
$_items = array(
'field_type' => array(
'INTEGER' => Yum::t('INTEGER'),
'VARCHAR' => Yum::t( 'VARCHAR'),
'TEXT'=> Yum::t( 'TEXT'),
'DATE'=> Yum::t( 'DATE'),
'DROPDOWNLIST' => Yum::t('DROPDOWNLIST'),
'FLOAT'=> Yum::t('FLOAT'),
'BOOL'=> Yum::t('BOOL'),
'BLOB'=> Yum::t('BLOB'),
'BINARY'=> Yum::t('BINARY'),
'FILE'=> 'FILE',
),
'required' => array(
'0' => Yum::t('No'),
'1' => Yum::t('Yes'),
),
'visible' => array(
self::VISIBLE_USER_DECISION => Yum::t('Let the user choose in privacy settings'),
self::VISIBLE_PUBLIC => Yum::t('For all'),
self::VISIBLE_REGISTER_USER => Yum::t('Registered users'),
self::VISIBLE_ONLY_OWNER => Yum::t('Only owner'),
self::VISIBLE_HIDDEN => Yum::t('Hidden'),
),
);
if (isset($code))
return isset($_items[$type][$code]) ? $_items[$type][$code] : false;
else
return isset($_items[$type]) ? $_items[$type] : false;
}
示例4: 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));
}
示例5: attributeLabels
/**
* Declares attribute labels.
*/
public function attributeLabels() {
return array(
'password'=>Yum::t('New password'),
'verifyPassword'=>Yum::t('Retype your new password'),
'currentPassword'=>Yum::t('Your current password'),
);
}
示例6: init
public function init()
{
if ($this->title === NULL) {
$this->title = Yum::t('Login');
}
parent::init();
}
示例7: init
public function init()
{
if (Yum::module('message')->messageSystem === false) {
return false;
}
$this->title = Yum::t('New messages');
parent::init();
}
示例8: init
public function init()
{
$this->title = Yum::t('Profile Comments');
if (Yii::app()->user->isGuest) {
return false;
}
parent::init();
}
示例9: actionDelete
public function actionDelete()
{
$permission = YumPermission::model()->findByPk($_GET['id']);
if ($permission->delete()) {
Yum::setFlash(Yum::t('The permission has been removed'));
} else {
Yum::setFlash(Yum::t('Error while removing the permission'));
}
$this->redirect(array('//role/permission/admin'));
}
示例10: attributeLabels
public function attributeLabels()
{
return array(
'id' => Yum::t('ID'),
'user_id' => Yum::t('Written from'),
'profile_id' => Yum::t('Profile'),
'comment' => Yum::t('Comment'),
'createtime' => Yum::t('Written at'),
);
}
示例11: actionDelete
public function actionDelete($id)
{
$comment = YumProfileComment::model()->findByPk($id);
if ($comment->user_id == Yii::app()->user->id || $comment->profile_id == Yii::app()->user->id) {
$comment->delete();
$this->redirect(array(Yum::module('profile')->profileView, 'id' => $comment->profile->user_id));
} else {
throw new CHttpException(403, Yum::t('You are not the owner of this Comment or this Profile!'));
}
}
示例12: attributeLabels
public function attributeLabels()
{
return array(
'id' => Yum::t('id'),
'timestamp' => Yum::t('timestamp'),
'user_id' => Yum::t('User'),
'action' => Yum::t('Action'),
'remote_addr' => Yum::t('Connected from IP'),
'http_user_agent' => Yum::t('Used browser(HTTP_USER_AGENT)'),
);
}
示例13: init
public function init()
{
if (!Yum::module('profile')->enableProfileVisitLogging) {
return false;
}
$this->title = Yum::t('Profile visits');
if (Yii::app()->user->isGuest) {
return false;
}
parent::init();
}
示例14: attributeLabels
public function attributeLabels()
{
return array(
'id'=>Yum::t("#"),
'title'=>Yum::t("Title"),
'description'=>Yum::t("Description"),
'selectable'=>Yum::t("Selectable on registration"),
'searchable'=>Yum::t("Searchable"),
'price'=>Yum::t("Price"),
'duration'=>Yum::t("Duration in days"),
);
}
示例15: sendRegistrationEmail
public function sendRegistrationEmail($user, $password)
{
if (!isset($user->profile->email)) {
throw new CException(Yum::t('Email is not set when trying to send Registration Email'));
}
$activation_url = $user->getActivationUrl();
if (is_object($content)) {
$body = strtr('Hi, {email}, your new password is {password}. Please activate your account by clicking this link: {activation_url}', array('{email}' => $user->profile->email, '{password}' => $password, '{activation_url}' => $activation_url));
$mail = array('from' => Yum::module('registration')->registrationEmail, 'to' => $user->profile->email, 'subject' => 'Your registration on my example Website', 'body' => $body);
$sent = YumMailer::send($mail);
}
return $sent;
}