Example #1
0
 public function __construct($id = false, $table = null, $ds = null)
 {
     if (CakePlugin::loaded('Comments')) {
         $this->actsAs[] = 'Comments.Commentable';
         $this->hasMany['Comment'] = array('className' => 'Comments.Comment', 'foreignKey' => 'foreign_key', 'conditions' => array('Comment.model' => 'UserGroupWallPost'));
     }
     parent::__construct($id, $table, $ds);
 }
Example #2
0
 /**
  * Constructor
  *
  * @param string $id ID
  * @param string $table Table
  * @param string $ds Datasource
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array('email' => array('isValid' => array('rule' => 'email', 'required' => true, 'message' => __d('users', 'Please enter a valid email address.', true)), 'isUnique' => array('rule' => array('isUnique', 'email'), 'message' => __d('users', 'This email is already in use.', true))), 'passwd' => array('to_short' => array('rule' => array('minLength', '4'), 'message' => __d('users', 'The password must have at least 8 characters.', true)), 'required' => array('rule' => 'notEmpty', 'message' => __d('users', 'Please enter a password.', true))), 'temppassword' => array('rule' => 'confirmPassword', 'message' => __d('users', 'The passwords are not equal, please try again.', true)), 'tos' => array('rule' => array('custom', '[1]'), 'message' => __d('users', 'You must agree to the terms of use.', true)));
     $this->validatePasswordChange = array('new_password' => $this->validate['passwd'], 'confirm_password' => array('required' => array('rule' => array('compareFields', 'new_password', 'confirm_password'), 'required' => true, 'message' => __d('users', 'The passwords are not equal.', true))), 'old_password' => array('to_short' => array('rule' => 'validateOldPassword', 'required' => true, 'message' => __d('users', 'Invalid password.', true))));
     $this->Detail->sectionSchema[$this->alias] = array('birthday' => array('type' => 'date', 'null' => null, 'default' => null, 'length' => null));
     $this->Detail->sectionValidation[$this->alias] = array('birthday' => array('validDate' => array('rule' => array('date'), 'allowEmpty' => true, 'message' => __d('users', 'Invalid date', true))));
 }
Example #3
0
 /**
  * Constructor
  *
  * @param string $id ID
  * @param string $table Table
  * @param string $ds Datasource
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     $userClass = Configure::read('App.UserClass');
     if (empty($userClass)) {
         $userClass = 'Users.User';
     }
     $this->belongsTo['User'] = array('className' => $userClass, 'foreignKey' => 'user_id');
     parent::__construct($id, $table, $ds);
 }
Example #4
0
File: User.php Project: ayaou/Zuha
 public function __construct($id = false, $table = null, $ds = null)
 {
     $this->order = array($this->alias . '.last_name', $this->alias . '.full_name', $this->alias . '.first_name');
     if (CakePlugin::loaded('Media')) {
         $this->actsAs[] = 'Media.MediaAttachable';
     }
     if (CakePlugin::loaded('Subscribers')) {
         $this->actsAs[] = 'Subscribers.Subscribable';
     }
     if (CakePlugin::loaded('Transactions')) {
         $this->hasMany['TransactionAddress'] = array('className' => 'Transactions.TransactionAddress', 'foreign_key' => 'user_id');
     }
     if (CakePlugin::loaded('Connections')) {
         $this->hasMany['Connection'] = array('className' => 'Connections.Connection', 'foreignKey' => 'user_id', 'dependent' => true);
     }
     if (CakePlugin::loaded('Categories')) {
         $this->actsAs[] = 'Categories.Categorizable';
     }
     parent::__construct($id, $table, $ds);
     // default ordering
     $this->order = array($this->alias . '.last_name', $this->alias . '.full_name', $this->alias . '.first_name');
 }
Example #5
0
 /**
  * Constructor. Configures the order property.
  *
  * @param bool|int|string|array $id Set this ID for this model on startup,
  * can also be an array of options, see above.
  * @param string $table Name of database table to use.
  * @param string $ds DataSource connection name.
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->order = $this->alias . '.name ASC';
 }
Example #6
0
 /**
  * Constructor
  *
  * @param string $id ID
  * @param string $table Table
  * @param string $ds Datasource
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     $this->_setupBehaviors();
     $this->_setupValidation();
     parent::__construct($id, $table, $ds);
 }
Example #7
0
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array('name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter a name for this group')), 'isUnique' => array('rule' => 'isUnique', 'message' => __('There is alread a group with this name'))));
 }
Example #8
0
 /**
  * Constructor. Binds the model's database table to the object.
  *
  * @param bool|int|string|array $id Set this ID for this model on startup,
  * can also be an array of options, see above.
  * @param string $table Name of database table to use.
  * @param string $ds DataSource connection name.
  * @see Model::__construct()
  * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     self::$publicTypes = array(self::PUBLIC_TYPE_CONFIDENTIAL => __d('users', 'Confidential'), self::PUBLIC_TYPE_DISCLOSE_TO_ALL => __d('users', 'Disclose to all'));
     //アバターの設定
     if (!Configure::read('NetCommons.installed')) {
         //インストール時は、アップロードビヘイビアを削除する
         $this->Behaviors->unload('Files.Attachment');
         $this->Behaviors->unload('Users.Avatar');
     }
     //RoleテーブルのbelongsToの定義は、こっちでやる
     $this->bindModel(array('belongsTo' => array('Role' => array('className' => 'Roles.Role', 'foreignKey' => false, 'conditions' => array('User.role_key = Role.key', 'Role.type = 1', 'Role.language_id' => Current::read('Language.id', '2')), 'fields' => '', 'order' => ''), 'UserRoleSetting' => array('className' => 'UserRoles.UserRoleSetting', 'foreignKey' => false, 'conditions' => array('User.role_key = UserRoleSetting.role_key'), 'fields' => '', 'order' => ''))), false);
 }
Example #9
0
File: Used.php Project: ayaou/Zuha
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array();
 }
Example #10
0
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $message = Configure::read('Website.password_validation');
     $this->validate = array('username' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('users', 'Please enter your username')), 'isUnique' => array('rule' => 'isUnique', 'message' => __d('users', 'That username is taken, sorry'))), 'email' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('users', 'Please enter your email address')), 'email' => array('rule' => array('email', true), 'message' => __d('users', 'That email address does not seem to be valid')), 'isUnique' => array('rule' => 'isUnique', 'message' => __d('users', 'It seems you are already registered, please use the forgot password option'))), 'confirm_email' => array('validateCompareFields' => array('rule' => array('validateCompareFields', array('email', 'confirm_email')), 'message' => __d('users', 'Your email address does not match'))), 'password' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('users', 'Please enter a password'))), 'confirm_password' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('users', 'Please re-enter your password')), 'validPassword' => array('rule' => 'validPassword', 'message' => !empty($message) ? $message : __d('users', 'Please enter a stronger password')), 'validateCompareFields' => array('rule' => array('validateCompareFields', array('password', 'confirm_password')), 'message' => __d('users', 'The passwords entered do not match'))), 'time_zone' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('users', 'Please select a time zone'))));
 }
Example #11
0
 /**
  * Constructor
  *
  * @param string $id ID
  * @param string $table Table
  * @param string $ds Datasource
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array('username' => array('required' => array('rule' => array('notEmpty'), 'required' => true, 'allowEmpty' => false, 'message' => __d('users', 'Please enter a username', true)), 'alpha' => array('rule' => array('alphaNumeric'), 'message' => __d('users', 'The username must be alphanumeric', true)), 'unique_username' => array('rule' => array('isUnique', 'username'), 'message' => __d('users', 'This username is already in use.', true)), 'username_min' => array('rule' => array('minLength', '3'), 'message' => __d('users', 'The username must have at least 3 characters.', true))), 'email' => array('isValid' => array('rule' => 'email', 'required' => true, 'message' => __d('users', 'Please enter a valid email address.', true)), 'isUnique' => array('rule' => array('isUnique', 'email'), 'message' => __d('users', 'This email is already in use.', true))), 'passwd' => array('to_short' => array('rule' => array('minLength', '6'), 'message' => __d('users', 'The password must have at least 6 characters.', true)), 'required' => array('rule' => 'notEmpty', 'message' => __d('users', 'Please enter a password.', true))), 'temppassword' => array('rule' => 'confirmPassword', 'message' => __d('users', 'The passwords are not equal, please try again.', true)), 'tos' => array('rule' => array('custom', '[1]'), 'message' => __d('users', 'You must agree to the terms of use.', true)));
     $this->validatePasswordChange = array('new_password' => $this->validate['passwd'], 'confirm_password' => array('required' => array('rule' => array('compareFields', 'new_password', 'confirm_password'), 'required' => true, 'message' => __d('users', 'The passwords are not equal.', true))), 'old_password' => array('to_short' => array('rule' => 'validateOldPassword', 'required' => true, 'message' => __d('users', 'Invalid password.', true))));
 }