當前位置: 首頁>>代碼示例>>PHP>>正文


PHP group::lookup_by_name方法代碼示例

本文整理匯總了PHP中group::lookup_by_name方法的典型用法代碼示例。如果您正苦於以下問題:PHP group::lookup_by_name方法的具體用法?PHP group::lookup_by_name怎麽用?PHP group::lookup_by_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在group的用法示例。


在下文中一共展示了group::lookup_by_name方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: import_group

 /**
  * Import a single group.
  */
 static function import_group(&$queue)
 {
     $g2_group_id = array_shift($queue);
     if (self::map($g2_group_id)) {
         return t("Group with id: %id already imported, skipping", array("id" => $g2_group_id));
     }
     try {
         $g2_group = g2(GalleryCoreApi::loadEntitiesById($g2_group_id));
     } catch (Exception $e) {
         return t("Failed to import Gallery 2 group with id: %id\n%exception", array("id" => $g2_group_id, "exception" => $e->__toString()));
     }
     switch ($g2_group->getGroupType()) {
         case GROUP_NORMAL:
             try {
                 $group = group::create($g2_group->getGroupName());
             } catch (Exception $e) {
                 // @todo For now we assume this is a "duplicate group" exception
                 $group = group::lookup_by_name($g2_group->getGroupname());
             }
             $message = t("Group '%name' was imported", array("name" => $g2_group->getGroupname()));
             break;
         case GROUP_ALL_USERS:
             $group = group::registered_users();
             $message = t("Group 'Registered' was converted to '%name'", array("name" => $group->name));
             break;
         case GROUP_SITE_ADMINS:
             $message = t("Group 'Admin' does not exist in Gallery 3, skipping");
             break;
             // This is not a group in G3
         // This is not a group in G3
         case GROUP_EVERYBODY:
             $group = group::everybody();
             $message = t("Group 'Everybody' was converted to '%name'", array("name" => $group->name));
             break;
     }
     if (isset($group)) {
         self::set_map($g2_group->getId(), $group->id);
     }
     return $message;
 }
開發者ID:hiwilson,項目名稱:gallery3,代碼行數:43,代碼來源:g2_import.php

示例2: edit_group

 public function edit_group($id)
 {
     access::verify_csrf();
     $group = group::lookup($id);
     if (empty($group)) {
         kohana::show_404();
     }
     $form = $this->_get_group_edit_form_admin($group);
     $valid = $form->validate();
     if ($valid) {
         $new_name = $form->edit_group->inputs["name"]->value;
         $group = group::lookup_by_name($name);
         if ($group->loaded) {
             $form->edit_group->inputs["name"]->add_error("in_use", 1);
             $valid = false;
         }
     }
     if ($valid) {
         $group->name = $form->edit_group->inputs["name"]->value;
         $group->save();
         message::success(t("Changed group %group_name", array("group_name" => $group->name)));
         print json_encode(array("result" => "success"));
     } else {
         message::error(t("Failed to change group %group_name", array("group_name" => $group->name)));
         print json_encode(array("result" => "error", "form" => $form->__toString()));
     }
 }
開發者ID:ChrisRut,項目名稱:gallery3,代碼行數:27,代碼來源:admin_users.php

示例3: import_group

 /**
  * Import a single group.
  */
 static function import_group(&$queue)
 {
     $g2_group_id = array_shift($queue);
     if (self::map($g2_group_id)) {
         return;
     }
     try {
         $g2_group = g2(GalleryCoreApi::loadEntitiesById($g2_group_id));
     } catch (Exception $e) {
         g2_import::log(t("Failed to import Gallery 2 group with id: %id", array("id" => $g2_group_id)));
         return;
     }
     switch ($g2_group->getGroupType()) {
         case GROUP_NORMAL:
             try {
                 $group = group::create($g2_group->getGroupName());
             } catch (Exception $e) {
                 // @todo For now we assume this is a "duplicate group" exception
                 $group = group::lookup_by_name($g2_group->getGroupname());
             }
             break;
         case GROUP_ALL_USERS:
             $group = group::registered_users();
             break;
         case GROUP_SITE_ADMINS:
             break;
             // This is not a group in G3
         // This is not a group in G3
         case GROUP_EVERYBODY:
             $group = group::everybody();
             break;
     }
     if (isset($group)) {
         self::set_map($g2_group->getId(), $group->id);
     }
 }
開發者ID:HelixiR,項目名稱:gallery3,代碼行數:39,代碼來源:g2_import.php

示例4: lookup_group_by_name

 /**
  * @see IdentityProvider_Driver::lookup_group_by_name.
  */
 public function lookup_group_by_name($name)
 {
     return group::lookup_by_name($name);
 }
開發者ID:kandsten,項目名稱:gallery3,代碼行數:7,代碼來源:Gallery.php


注:本文中的group::lookup_by_name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。