/**
  * Fetch all password tokens
  * 
  * @return Apine\Core\Collection
  */
 public static function create_all()
 {
     $database = new Apine\Core\Database();
     $request = $database->select('SELECT `id` from `apine_password_tokens` ORDER BY `user_id` ASC');
     $liste = new Apine\Core\Collection();
     if ($request != null && count($request) > 0) {
         foreach ($request as $item) {
             $liste->add_item(new Apine\User\PasswordToken((int) $item['id']));
         }
     }
     return $liste;
 }
 /**
  * Fetch apine_user_groups by user
  * 
  * @param integer $user
  *        User id
  * @return Collection
  */
 public static function create_by_user($user)
 {
     $database = new Database();
     $request = $database->select("SELECT `group_id` FROM `apine_users_user_groups` WHERE `user_id`={$user}");
     $liste = new Collection();
     if ($request != null && count($request) > 0) {
         foreach ($request as $item) {
             $liste->add_item(new Apine\User\UserGroup((int) $item['group_id']));
         }
     }
     return $liste;
 }
Esempio n. 3
0
 /**
  * Set a variable to be accessible by the view
  * 
  * @param string $a_name
  * @param mixed $a_data
  */
 public final function set_param($a_name, $a_data)
 {
     $this->_params->add_item($a_data, $a_name);
 }
Esempio n. 4
0
 /**
  * Fetch users by group id
  * 
  * @param integer $group
  *        User Group id
  * @return Apine\Core\Collection
  */
 public static function create_by_group($group)
 {
     $database = new Apine\Core\Database();
     $request = $database->select("SELECT `user_id` FROM `apine_users_user_groups` WHERE `group_id`={$group}");
     $liste = new Apine\Core\Collection();
     if ($request != null && count($request) > 0) {
         foreach ($request as $item) {
             $class = self::get_user_class();
             $liste->add_item(new $class((int) $item['user_id']));
         }
     }
     return $liste;
 }