Example #1
0
 /**
  * 判断分组名是否存在
  * @param int $user_id 用户ID
  * @param string $name 分组名
  * @param int $id 分组ID
  * @return bool
  */
 public function check_name($user_id, $name, $id = 0)
 {
     //检查是否系统分组
     $system_groups = Kohana::config('contact.sys_groups');
     $groups = array();
     foreach ($system_groups as $system_group) {
         $groups[] = $system_group['name'];
     }
     if (in_array($name, $groups)) {
         return TRUE;
     }
     //检查是否已存在的分组
     return $this->contact_mapper->check_category_name($user_id, $name, $id);
 }