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


PHP Group::get_name方法代碼示例

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


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

示例1: list_groups

 /**
  * @param string $json_column_array
  * @param string $json_argument_array
  * @param string $get_array
  * @param string $css_page_id
  * @param string $css_row_sort_id
  * @param string $entries_per_page
  * @param string $page
  * @param string $sortvalue
  * @param string $sortmethod
  * @return string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_groups($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     if ($user->is_admin()) {
         if ($get_array) {
             $_GET = unserialize($get_array);
         }
         $list_request = new ListRequest_IO();
         $list_request->set_column_array($json_column_array);
         if (!is_numeric($entries_per_page) or $entries_per_page < 1) {
             $entries_per_page = 20;
         }
         $list_array = User_Wrapper::list_groups($sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             foreach ($list_array as $key => $value) {
                 $group = new Group($list_array[$key]['id']);
                 $paramquery = $_GET;
                 $paramquery['action'] = "detail";
                 $paramquery['id'] = $list_array[$key]['id'];
                 $params = http_build_query($paramquery, '', '&#38;');
                 unset($list_array[$key]['name']);
                 $list_array[$key]['symbol']['link'] = $params;
                 $list_array[$key]['symbol']['content'] = "<img src='images/icons/groups.png' alt='' style='border: 0;' />";
                 $list_array[$key]['name']['link'] = $params;
                 $list_array[$key]['name']['content'] = $group->get_name();
                 $list_array[$key]['users'] = $group->get_number_of_user_members();
                 $paramquery = $_GET;
                 $paramquery['action'] = "delete";
                 $paramquery['id'] = $list_array[$key]['id'];
                 $params = http_build_query($paramquery, '', '&#38;');
                 if ($list_array[$key]['id'] < 100) {
                     $list_array[$key]['delete'] = "<img src='images/icons/delete_group_na.png' alt='' style='border: 0;' />";
                 } else {
                     $list_array[$key]['delete']['link'] = $params;
                     $list_array[$key]['delete']['content'] = "<img src='images/icons/delete_group.png' alt='' style='border: 0;' />";
                 }
             }
         } else {
             $list_request->empty_message("<span class='italic'>No groups found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:59,代碼來源:admin_group.ajax.php

示例2: permission_window

 /**
  * @todo remove code; merge with IO permission function (GET <-> POST)
  * @return string
  * @throws FolderIDMissingException
  */
 public static function permission_window()
 {
     global $user;
     if ($_POST['file_id'] or $_POST['value_id'] or $_POST['parameter_id'] or $_POST['folder_id']) {
         if ($_POST['file_id']) {
             $id = $_POST['file_id'];
             $object = File::get_instance($id);
             $type = "file";
             $title = $object->get_name();
         }
         if ($_POST['value_id']) {
             $id = $_POST['value_id'];
             $object = Value::get_instance($id);
             $type = "value";
             $title = $object->get_type_name();
         }
         if ($_POST['parameter_id']) {
             $id = $_POST['parameter_id'];
             $object = Parameter::get_instance($id);
             $type = "parameter";
             $title = $object->get_name();
         }
         if ($_POST['folder_id']) {
             $id = $_POST['folder_id'];
             $object = Folder::get_instance($id);
             $type = "folder";
             $title = $object->get_name();
         }
     } else {
         throw new FolderIDMissingException();
     }
     $data_permission = new DataPermission($type, $id);
     $template = new HTMLTemplate("data/data_permission_window.html");
     $template->set_var("title", $title);
     $user = new User($data_permission->get_owner_id());
     $group = new Group($data_permission->get_owner_group_id());
     $template->set_var("owner", $user->get_full_name(false));
     $template->set_var("owner_group", $group->get_name());
     if ($object->can_set_automatic()) {
         $disable_automatic = false;
     } else {
         $disable_automatic = true;
     }
     if ($object->can_set_data_entity()) {
         $disable_project = false;
     } else {
         $disable_project = true;
     }
     if ($object->can_set_control()) {
         $disable_control = false;
     } else {
         $disable_control = true;
     }
     if ($object->can_set_remain()) {
         $disable_remain = false;
     } else {
         $disable_remain = true;
     }
     if ($disable_automatic == true) {
         $template->set_var("disabled_automatic", "disabled='disabled'");
     } else {
         $template->set_var("disabled_automatic", "");
     }
     if ($data_permission->get_automatic() == true) {
         $template->set_var("checked_automatic", "checked='checked'");
         if ($disable_automatic == true) {
             $template->set_var("hidden_automatic", "<input type='hidden' name='automatic' value='1' />");
         } else {
             $template->set_var("hidden_automatic", "");
         }
     } else {
         $template->set_var("checked_automatic", "");
         $template->set_var("hidden_automatic", "");
     }
     $permission_array = $data_permission->get_permission_array();
     for ($i = 1; $i <= 4; $i++) {
         for ($j = 1; $j <= 4; $j++) {
             $checked_name = "checked_" . $i . "_" . $j;
             $disabled_name = "disabled_" . $i . "_" . $j;
             $hidden_name = "hidden_" . $i . "_" . $j;
             if ($i == 3 and $disable_project == true) {
                 $template->set_var($disabled_name, "disabled='disabled'");
                 $disabled = true;
             } else {
                 if (($j == 3 or $j == 4) and $disable_control == true) {
                     $template->set_var($disabled_name, "disabled='disabled'");
                     $disabled = true;
                 } else {
                     if ($disable_remain == true) {
                         $template->set_var($disabled_name, "disabled='disabled'");
                         $disabled = true;
                     } else {
                         $template->set_var($disabled_name, "");
                         $disabled = false;
                     }
//.........這裏部分代碼省略.........
開發者ID:suxinde2009,項目名稱:www,代碼行數:101,代碼來源:data.ajax.php

示例3: list_groups

 /**
  * @param string $json_column_array
  * @param string $json_argument_array
  * @param string $get_array
  * @param string $css_page_id
  * @param string $css_row_sort_id
  * @param string $entries_per_page
  * @param string $page
  * @param string $sortvalue
  * @param string $sortmethod
  * @return string
  * @throws OrganisationUnitIDMissingException
  */
 public static function list_groups($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     $argument_array = json_decode($json_argument_array);
     $organisation_unit_id = $argument_array[1];
     if (is_numeric($organisation_unit_id)) {
         $list_request = new ListRequest_IO();
         $list_request->set_column_array($json_column_array);
         if (!is_numeric($entries_per_page) or $entries_per_page < 1) {
             $entries_per_page = 20;
         }
         $list_array = OrganisationUnit_Wrapper::list_organisation_unit_groups($organisation_unit_id, $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             $module_link_array = ModuleLink::list_links_by_type("ou_navigation");
             foreach ($list_array as $key => $value) {
                 $group = new Group($value['id']);
                 $list_array[$key]['symbol'] = "<img src='images/icons/groups.png' alt='' />";
                 $list_array[$key]['groupname'] = $group->get_name();
             }
         } else {
             $list_request->empty_message("<span class='italic'>No results found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new OrganisationUnitIDMissingException();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:43,代碼來源:organisation_unit.ajax.php

示例4: url

        echo BASE;
        ?>
group/<?php 
        echo $suggested_group->get_id();
        ?>
/">
												<div class="group" id="group-<?php 
        echo $suggested_group->get_id();
        ?>
" style="background-image: url(<?php 
        echo $suggested_group->get_url_for_header_image_to_show();
        ?>
);">
													<div class="group-header">
														<h3><?php 
        echo $suggested_group->get_name();
        ?>
</h3>
														<div class="publicity">
															<?php 
        if ($suggested_group->get_public() == 1) {
            ?>
																<span class="fa fa-unlock fa-2x"></span>
																<?php 
        } else {
            ?>
																<span class="fa fa-lock fa-2x"></span>
																<?php 
        }
        ?>
														</div>
開發者ID:DonBananos,項目名稱:studyteam,代碼行數:31,代碼來源:index.php

示例5: displayGroupManagement

function displayGroupManagement()
{
    global $tool, $propertyForm;
    $groups = Group::get_groups();
    echo "<style>";
    foreach ($groups as $id => $value) {
        echo "#modalBox #allUserDialog" . $id;
        echo "{\n\t\t\twidth:auto;\n\t\t\tmax-width: 80%;\n\t\t\tmin-width:40%;\n\t\t\theight:auto;\n\t\t\tpadding:10px;\n\t\t\tpadding-top:10px;\n\t\t\toverflow:auto;\n\t\t}";
    }
    echo "</style>";
    $toolNames = array("Add Group");
    $toolIcons = array("add");
    $formType = array("newDialog");
    echo $tool->createNewModal($toolNames, $toolIcons, $formType);
    foreach ($groups as $id => $value) {
        $curGroup = new Group($id);
        $groupID = $id;
        $access = $curGroup->get_access_level();
        switch ($access) {
            case 0:
                $access = "No Access";
                break;
            case 25:
                $access = "Read Only";
                break;
            case 50:
                $access = "Read Write Only";
                break;
            case 100:
                $access = "Admin";
                break;
        }
        echo "<form method='post' action='' style='width:1024px;'><input type='hidden' name='groupID' value='" . $curGroup->get_group_id() . "' />\n\t\t<table id=\"sortDataTable\" class='sortable' cellspacing=\"0\" cellpadding=\"0\" border=\"1\" style='width:100%; clear:left;'>\n\t\t<thead>\n\t\t<tr>\n\t\t<th style='text-align:left;'>" . $curGroup->get_name() . "</th>\n\t\t<th colspan='10'><a name='modal' href='#dialog" . $id . "' style='float:right; margin-bottom:5px; margin-right: 5px;'>Edit</a></th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tbody>";
        if ($curGroup->get_group_pass() == true) {
            $myModalID = "modalPass" . $curGroup->get_group_id();
            // Check if it already has a password or not.
            if ($curGroup->has_password() == 1) {
                // Already has a password
                // this is to update existing pass
                // Create custom input field for password
                // as type password is not defined in class...
                $group_pass = "Enabled<br> <a name='modal' href='#" . $myModalID . "'>Update Group Password</a>";
                $heading = array("Update Group Password");
                $title = array("Old Password", "New Password", "New Password", "group_id", "action");
                $keys = array("old_pass", "new_pass1", "new_pass2", "group_id", "update_group_key");
                $data = array("", "", "", $curGroup->get_group_id(), "update_group_key");
                $fieldType = array(0 => "password", 1 => "password", 2 => "password", 3 => "hidden", 4 => "hidden");
            } elseif ($curGroup->has_password() == 0) {
                // Group does not yet have a pass
                // Inital password will be set below
                $group_pass = "Enabled (no password set)<br> <a name='modal' href='#" . $myModalID . "'>Set Group Password</a>";
                $heading = array("Configure Group Password");
                $title = array("Old Password", "New Password", "New Password", "group_id", "action");
                $keys = array("old_pass", "new_pass1", "new_pass2", "group_id", "update_group_key");
                $data = array("dummy", "", "", $curGroup->get_group_id(), "update_group_key");
                $fieldType = array(0 => 'hidden', 1 => 'password', 2 => 'password', 3 => "hidden", 4 => "hidden");
            }
            // Modal for password update
            $form = new Form("auto", 2);
            $form->setHeadings($heading);
            $form->setTitles($title);
            $form->setData($data);
            $form->setDatabase($keys);
            $form->setFieldType($fieldType);
            $form->setModalID($myModalID);
            //set the table size
            $form->setTableWidth("1024px");
            $form->setTitleWidth("20%");
            $modal_group_pass .= $form->modalForm();
            // End Modal for group pass
        } else {
            $group_pass = "Disabled";
        }
        echo "\n\t\t<tr class='form'><td style='text-align:left; width:200px;'><h3>Description</h3>" . $curGroup->get_description() . "</td>\n\t\t<td style='text-align:left; width:200px;'><h3>LDAP Group Name</h3>" . $curGroup->get_ldap_group_name() . "</td>\n\t\t<td style='text-align:left; width:100px;'><h3>Access Level</h3>" . $access . "</td>\n\t\t<td style='text-align:left; width:100px;'><h3>Access To Private Data</h3>" . $group_pass . "</td></tr>";
        echo "<tr class='form'><td colspan='4'>";
        $groupUsers = $curGroup->get_users();
        foreach ($groupUsers as $id => $value) {
            echo "<input type='checkbox' name='userList[]' value='" . $id . "'>" . $value . " | ";
        }
        echo "<a name=modal href='#allUserDialog" . $groupID . "'>Add User...</a>\n\t\t</td></tr>";
        echo "</tbody>\n\t\t</table>";
        echo "<input type='submit' name='delUserFromGroup' value='Delete Users From Group' style='float:right; margin-bottom:5px; margin-right: 5px;' />";
        echo "<input type='submit' name='delGroup' value='Delete Group' style='float:left; clear:left; margin-bottom:20px;' />\n\t\t</form>";
        echo "<div id='modalBox'>";
        $users = User::get_users();
        echo "<div id='allUserDialog" . $groupID . "' class='window'>\n\t\t\t <a href='#'class='close' /><img src='icons/close.png'></a>\n\t\t\t <form method='post' action=''>\n\t\t\t <input type='hidden' name='groups2' value='" . $curGroup->get_group_id() . "' />";
        foreach ($users as $id => $value) {
            $isIn = false;
            foreach ($groupUsers as $gid => $gvalue) {
                if ($value == $gvalue) {
                    $isIn = true;
                }
            }
            if (!$isIn) {
                echo "<input type='checkbox' name='list[]' value='" . $id . "'>" . $value . " | ";
            }
        }
        echo "<input type='submit' name='userToGroup' value='Add Users to Group' />";
        echo "</form>\n\t\t\t </div>";
        echo "<div id='mask'></div>\n\t\t\t </div>";
//.........這裏部分代碼省略.........
開發者ID:precurse,項目名稱:netharbour,代碼行數:101,代碼來源:configurations.php

示例6: catch

      * If they are still admins it's because they were the only one left.
      *   They will then proceed to destroy the group.
      */
     try {
         $group->remove_admin($user);
     } catch (Exception $e) {
         // Do nothing
     }
     try {
         $group->remove_reader($user);
     } catch (Exception $e) {
         // Do nothing
     }
     // If user was removed, then say so and quit.
     if (!$group->is_admin($user) && !$group->is_reader($user)) {
         Helpers::respond_json(new Attempt('success', "{$user->get_name()} removed from {$group->get_name()}."));
         die;
     }
     try {
         // If user is still admin, destroy group
         $group->destroy($user);
         $attempt = new Attempt('success', 'Group ' . $group->get_name() . ' removed permanently by ' . $user->get_name() . ".");
     } catch (Exception $e) {
         Helpers::respond_json(new Attempt('error', $e->getMessage()));
         die;
     }
     // END of remove_group
 } else {
     if ($action == "am_admin") {
         try {
             $group_name = Helpers::require_variable('group', 'a group name');
開發者ID:also-engineering,項目名稱:robbert,代碼行數:31,代碼來源:index.php

示例7: elseif

        }
        ?>
		<script>alert("<?php 
        echo $answer;
        ?>
");</script>
		<?php 
    } elseif (isset($_POST['edit'])) {
        $student_level_in_group = $student->get_student_level_in_group($group->get_id());
        if ($student_level_in_group === 2 || $student_level_in_group === 3) {
            $safe_name = sanitize_text($_POST['editGroupName']);
            $safe_max_size = sanitize_int($_POST['editGroupSize']);
            $safe_category = sanitize_int($_POST['editGroupCategory']);
            $safe_description = sanitize_text($_POST['editGroupDescription']);
            if ($student_level_in_group === 2) {
                $safe_name = $group->get_name();
                $safe_max_size = $group->get_max_members();
                $safe_category = $group->get_category_id();
                $edit_message = $group->update_group($safe_name, $safe_max_size, $safe_category, $safe_description);
                $edited = TRUE;
            } elseif ($student_level_in_group === 3) {
                if ($gc->validate_if_category($safe_category) === FALSE) {
                    $safe_category = $group->get_category_id();
                }
                $edit_message = $group->update_group($safe_name, $safe_max_size, $safe_category, $safe_description);
                $edited = TRUE;
            }
        }
    }
    if (isset($_POST['madmin'])) {
        //Make the given user admin in group!
開發者ID:DonBananos,項目名稱:studyteam,代碼行數:31,代碼來源:details.php

示例8: permission_edit

 /**
  * @throws ProjectIDMissingException
  * @throws ProjectSecurityAccessDeniedException
  * @throws ProjectPermissionIDMissingException
  */
 public static function permission_edit()
 {
     global $project_security, $user;
     if ($_GET['project_id']) {
         if ($_GET['id']) {
             $project_id = $_GET['project_id'];
             $project = new Project($project_id);
             $project_permission = ProjectPermission::get_instance($_GET['id']);
             if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(2, false) == true or $project_security->is_access(4, false) == true or $project_security->is_access(7, false) == true) {
                 if ($_GET['nextpage'] == 1) {
                     $page_1_passed = true;
                 } else {
                     $page_1_passed = false;
                     $error = "";
                 }
                 if ($page_1_passed == false) {
                     $template = new HTMLTemplate("project/admin/permission_add_edit.html");
                     $template->set_var("add_edit", "Edit");
                     $paramquery = $_GET;
                     $paramquery['nextpage'] = "1";
                     $params = http_build_query($paramquery, '', '&#38;');
                     $template->set_var("params", $params);
                     $template->set_var("error", $error);
                     $user_id = $project_permission->get_user_id();
                     $group_id = $project_permission->get_group_id();
                     $organ_unit_id = $project_permission->get_organisation_unit_id();
                     if ($user_id) {
                         $permission_user = new User($user_id);
                         $template->set_var("name", $permission_user->get_username());
                         $template->set_var("type", "user");
                     } elseif ($group_id) {
                         $group = new Group($group_id);
                         $template->set_var("name", $group->get_name());
                         $template->set_var("type", "group");
                     } else {
                         $organisation_unit = new OrganisationUnit($organ_unit_id);
                         $template->set_var("name", $organisation_unit->get_name());
                         $template->set_var("type", "organisation unit");
                     }
                     $permission_array = $project_permission->get_permission_array();
                     if ($permission_array['read'] == true) {
                         $template->set_var("checked_re", "checked='checked'");
                     } else {
                         $template->set_var("checked_re", "");
                     }
                     if ($permission_array['set_readable'] == true) {
                         $template->set_var("checked_sr", "checked='checked'");
                     } else {
                         $template->set_var("checked_sr", "");
                     }
                     if ($permission_array['write'] == true) {
                         $template->set_var("checked_wr", "checked='checked'");
                     } else {
                         $template->set_var("checked_wr", "");
                     }
                     if ($permission_array['set_writeable'] == true) {
                         $template->set_var("checked_sw", "checked='checked'");
                     } else {
                         $template->set_var("checked_sw", "");
                     }
                     if ($permission_array['reactivate'] == true) {
                         $template->set_var("checked_ra", "checked='checked'");
                     } else {
                         $template->set_var("checked_ra", "");
                     }
                     if ($permission_array['delete'] == true) {
                         $template->set_var("checked_de", "checked='checked'");
                     } else {
                         $template->set_var("checked_de", "");
                     }
                     if ($permission_array['set_permissions'] == true) {
                         $template->set_var("checked_sp", "checked='checked'");
                     } else {
                         $template->set_var("checked_sp", "");
                     }
                     if ($project_security->is_access(2, false) or $project->get_owner_id() == $user->get_user_id()) {
                         $template->set_var("disabled_re", "");
                     } else {
                         $template->set_var("disabled_re", "disabled='disabled'");
                     }
                     if ($project_security->is_access(7, false) or $project->get_owner_id() == $user->get_user_id()) {
                         $template->set_var("disabled_sr", "");
                         $template->set_var("disabled_sw", "");
                     } else {
                         $template->set_var("disabled_sr", "disabled='disabled'");
                         $template->set_var("disabled_sw", "disabled='disabled'");
                     }
                     if ($project_security->is_access(4, false) or $project->get_owner_id() == $user->get_user_id()) {
                         $template->set_var("disabled_wr", false);
                     } else {
                         $template->set_var("disabled_wr", "disabled='disabled'");
                     }
                     if ($project_security->is_access(7, false)) {
                         $template->set_var("disabled_ra", "");
                         $template->set_var("disabled_de", "");
//.........這裏部分代碼省略.........
開發者ID:suxinde2009,項目名稱:www,代碼行數:101,代碼來源:project_admin.io.php

示例9: listen_events

 /**
  * @see EventListenerInterface::listen_events()
  * @param object $event_object
  * @return bool
  */
 public static function listen_events($event_object)
 {
     if ($event_object instanceof GroupCreateEvent) {
         $group_folder = new GroupFolder(null);
         if ($group_folder->create($event_object->get_group_id()) == false) {
             return false;
         }
     }
     if ($event_object instanceof GroupPostDeleteEvent) {
         $folder_id = GroupFolder::get_folder_by_group_id($event_object->get_group_id());
         $group_folder = new GroupFolder($folder_id);
         if ($group_folder->delete(true, true) == false) {
             return false;
         }
     }
     if ($event_object instanceof GroupRenameEvent) {
         $group = new Group($event_object->get_group_id());
         $group_folder = new GroupFolder(self::get_folder_by_group_id($event_object->get_group_id()));
         if ($group_folder->set_name($group->get_name()) == false) {
             return false;
         }
     }
     return true;
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:29,代碼來源:group_folder.class.php

示例10: index

 function index()
 {
     create_context(TRUE);
     $del_user = array();
     //建立$group1
     $group1 = $this->group->create_group($this->url, $this->group_name1);
     //[R]$group1->get_name()
     $this->unit->run($group1->get_name(), $this->group_name1, '建立$group1 [R]$group1->get_name()');
     //$group1find = find by name
     $group1finds = $this->group->find_groups($this->url, $this->group_name1);
     $group1find = $group1finds[0];
     //$group1find->get_domain()
     $domain1 = $group1find->get_domain();
     //[R]取得domain的host
     $this->unit->run($domain1->get_host(), $this->host, '$group1find = find by name get_domain() [R]取得domain的host');
     //建立$user1
     //把$user1加入$group1中
     $user1 = $this->user->create_user($this->url, $this->user_name1);
     $group1->add_actor($user1);
     //$group1->get_users()
     $users = $group1->get_users();
     //[R]測試get_users()數量是否為1
     $this->unit->run(count($users), 1, '把$user1加入$group1中 $group1->get_users() [R]測試get_users()數量是否為1');
     //記得$group1_id
     //$group1find = find by id
     $group1_id = $group1->get_id();
     //$group1find = $this->group->find('id', $group1_id);
     $group1find = new Group($group1_id);
     //$group1find->get_users()
     //[R]測試users[0]的名字是否符合
     $users = $group1find->get_users();
     $this->unit->run($users[0]->get_email(), $this->user_name1, '$group1find = find by id | $group1find->get_users() | [R]測試users[0]的名字是否符合' . $users[0]->get_id());
     //從$group1中移除$user1
     //[R]$group1看看是否數量為0
     $group1->remove_actor($users[0]);
     $users = $group1->get_users();
     $this->unit->run(count($users), 0, '從$group1中移除$user1 | [R]$group1看看是否數量為0');
     //$group1find = find by id
     //[R] 看看get_users數量是否為0
     //$group1find = $this->group->find(array('group_id'=> $group1_id));
     $group1find = new Group($group1_id);
     $users = $group1find->get_users();
     $this->unit->run(count($users), 0, '$group1find = find by id | [R] 看看get_users數量是否為0');
     //建立$group2
     //把$group2加入$group1中
     $group2 = $this->group->create_group($this->url, $this->group_name2);
     $group1->add_actor($group2);
     //從$group1中get_group
     //[R]檢查groups[0]是否跟$group2->equals()
     $groups = $group1->get_groups();
     $this->unit->run($group2->equals($groups[0]), TRUE, '從$group1中get_group | [R]檢查groups[0]是否跟$group2->equals()');
     //建立$user2
     //把$user2加入$group2中
     //取得$user2->get_parent_groups()
     //[R] 檢查數量是否有2個
     $user2 = $this->user->create_user($this->url, $this->user_name2);
     $group2->add_actor($user2);
     $groups = $user2->get_parent_groups();
     $this->unit->run(count($groups), 2, '建立$user2 | 把$user2加入$group2中 | 取得$user2->get_parent_groups() | [R] 檢查數量是否有2個');
     //[R] 檢查第一個是否equals $group1
     $this->unit->run($groups[0]->equals($group2), TRUE, '[R] 檢查第一個是否equals $group2');
     //[R] 檢查第二個是否跟$group2的名稱一樣
     $this->unit->run($group1->equals($groups[1]), TRUE, '[R] 檢查第二個是否跟$group1的名稱一樣');
     //刪除$group1
     $group1->delete();
     //取得$user2的get_parent_groups
     //[R] 數量是否為1
     $groups = $user2->get_parent_groups();
     $this->unit->run(count($groups), 1, '取得$user2的get_parent_groups | [R] 數量是否為1');
     //[R] 是否equals $group2
     $this->unit->run($groups[0]->equals($group2), TRUE, '[R] 是否equals $group2');
     //刪除$group2
     $group2->delete();
     //[R] 確認$group2的名稱消失
     $this->unit->run($group2->get_name(), NULL, '刪除$group2 | [R] 確認$group2的名稱消失');
     //用id去找尋$group1
     //[R] 確認找不到
     //$group1find = $this->group->find('group_id', $group1_id);
     $group1find = new Group($group1_id);
     $this->unit->run($group1find->get_name(), NULL, '用id去找尋$group1 | [R] 確認get_name取不到名字');
     //刪除$user1 $user2
     //用資料庫刪除
     //        $user1_id = $user1->get_id();
     //        $user2_id = $user2->get_id();
     //        $user1->delete();
     //        $user2->delete();
     //        $this->db->delete('domain2user', array('user_id'=>$user1_id));
     //        $this->db->delete('domain2user', array('user_id'=>$user2_id));
     //        $this->db->delete('user', array('user_id'=>$user1_id));
     //        $this->db->delete('user', array('user_id'=>$user2_id));
     //        $this->unit->run($test_result,
     //                $expected_result,
     //                $test_name);
     unit_test_report($this);
 }
開發者ID:119155012,項目名稱:kals,代碼行數:95,代碼來源:ut_group.php

示例11: change_group

 /**
  * @throws FolderIDMissingException
  */
 public static function change_group()
 {
     if ($_GET['file_id'] or $_GET['value_id'] or $_GET['parameter_id'] or $_GET['folder_id']) {
         if ($_GET['file_id']) {
             $id = $_GET['file_id'];
             $object = File::get_instance($id);
             $type = "file";
             $title = $object->get_name();
         }
         if ($_GET['value_id']) {
             $id = $_GET['value_id'];
             $object = Value::get_instance($id);
             $type = "value";
             $title = $object->get_type_name();
         }
         if ($_GET['parameter_id']) {
             $id = $_GET['parameter_id'];
             $object = Parameter::get_instance($id);
             $type = "parameter";
             $title = $object->get_name();
         }
         if ($_GET['folder_id']) {
             $id = $_GET['folder_id'];
             $object = Folder::get_instance($id);
             $type = "folder";
             $title = $object->get_name();
         }
     } else {
         throw new FolderIDMissingException();
     }
     if ($object->is_control_access() == true) {
         $data_permission = new DataPermission($type, $id);
         if (!$_GET['nextpage']) {
             $template = new HTMLTemplate("data/data_change_group.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             $template->set_var("title", $title);
             $template->set_var("error", "");
             $group_array = Group::list_groups();
             $result = array();
             $counter = 0;
             foreach ($group_array as $key => $value) {
                 $group = new Group($value);
                 $result[$counter]['value'] = $value;
                 $result[$counter]['content'] = $group->get_name();
                 $counter++;
             }
             $template->set_var("option", $result);
             $paramquery = $_GET;
             $paramquery['action'] = "permission";
             unset($paramquery['nextpage']);
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("back_link", $params);
             $template->output();
         } else {
             $paramquery = $_GET;
             $paramquery['action'] = "permission";
             unset($paramquery['nextpage']);
             $params = http_build_query($paramquery, '', '&#38;');
             if ($data_permission->set_owner_group_id($_POST['group']) == true) {
                 Common_IO::step_proceed($params, "Permission: " . $title . "", "Changes saved succesful", null);
             } else {
                 Common_IO::step_proceed($params, "Permission: " . $title . "", "Operation failed", null);
             }
         }
     } else {
         throw new DataSecuriyAccessDeniedException();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:74,代碼來源:data.io.php

示例12: add_group

 /**
  * @throws UserIDMissingException
  */
 public static function add_group()
 {
     if ($_GET['id']) {
         if ($_GET['nextpage'] == 1) {
             if (is_numeric($_POST['group'])) {
                 $group = new Group($_POST['group']);
                 if ($group->is_user_in_group($_GET['id']) == true) {
                     $page_1_passed = false;
                     $error = "The user is already member of this group.";
                 } else {
                     $page_1_passed = true;
                 }
             } else {
                 $page_1_passed = false;
                 $error = "You must select a group.";
             }
         } elseif ($_GET['nextpage'] > 1) {
             $page_1_passed = true;
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("base/user/admin/user/add_group.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             $template->set_var("error", $error);
             $group_array = Group::list_groups();
             $result = array();
             $counter = 0;
             foreach ($group_array as $key => $value) {
                 $group = new Group($value);
                 $result[$counter]['value'] = $value;
                 $result[$counter]['content'] = $group->get_name();
                 $counter++;
             }
             $template->set_var("option", $result);
             $template->output();
         } else {
             $group = new Group($_POST['group']);
             $paramquery = $_GET;
             $paramquery['action'] = "detail";
             unset($paramquery['nextpage']);
             $params = http_build_query($paramquery, '', '&#38;');
             if ($group->create_user_in_group($_GET['id'])) {
                 Common_IO::step_proceed($params, "Add Group", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Add Group", "Operation Failed", null);
             }
         }
     } else {
         throw new UserIDMissingException();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:59,代碼來源:admin_user.io.php

示例13: group_details

 /**
  * @throws GroupIDMissingException
  */
 public static function group_details()
 {
     if ($_GET['id']) {
         $group = new Group($_GET['id']);
         $template = new HTMLTemplate("base/user/group_details.html");
         $template->set_var("name", $group->get_name());
         $user_array = Group::list_group_releated_users($_GET['id']);
         $user_content_array = array();
         $counter = 0;
         if (is_array($user_array) and count($user_array) >= 1) {
             foreach ($user_array as $key => $value) {
                 $user = new User($value);
                 $paramquery = $_GET;
                 $paramquery['dialog'] = "user_detail";
                 $paramquery['id'] = $value;
                 $params = http_build_query($paramquery, '', '&#38;');
                 $user_content_array[$counter]['username'] = $user->get_username();
                 $user_content_array[$counter]['fullname'] = $user->get_full_name(false);
                 $user_content_array[$counter]['params'] = $params;
                 $counter++;
             }
             $template->set_var("no_user", false);
         } else {
             $template->set_var("no_user", true);
         }
         $template->set_var("user", $user_content_array);
         $organisation_unit_array = OrganisationUnit::list_entries_by_group_id($_GET['id']);
         $organisation_unit_content_array = array();
         $counter = 0;
         if (is_array($organisation_unit_array) and count($organisation_unit_array) >= 1) {
             foreach ($organisation_unit_array as $key => $value) {
                 $organisation_unit = new OrganisationUnit($value);
                 $organisation_unit_content_array[$counter]['name'] = $organisation_unit->get_name();
                 $counter++;
             }
             $template->set_var("no_ou", false);
         } else {
             $template->set_var("no_ou", true);
         }
         $template->set_var("ou", $organisation_unit_content_array);
         $template->output();
     } else {
         throw new GroupIDMissingException();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:48,代碼來源:user.io.php

示例14: rename

 /**
  * @throws GroupIDMissingException
  */
 public static function rename()
 {
     if ($_GET['id']) {
         $group = new Group($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             if ($_POST['name']) {
                 if (Group::exist_name($_POST['name']) == true) {
                     $page_1_passed = false;
                     $error = "This name is already allocated.";
                 } else {
                     $page_1_passed = true;
                 }
             } else {
                 $page_1_passed = false;
                 $error = "You must enter a name.";
             }
         } elseif ($_GET['nextpage'] > 1) {
             $page_1_passed = true;
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("base/user/admin/group/rename.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             $template->set_var("error", $error);
             if ($_POST['username']) {
                 $template->set_var("name", $_POST['name']);
             } else {
                 $template->set_var("name", $group->get_name());
             }
             $template->output();
         } else {
             $paramquery = $_GET;
             $paramquery['action'] = "detail";
             unset($paramquery['nextpage']);
             $params = http_build_query($paramquery, '', '&#38;');
             if ($group->set_name($_POST['name'])) {
                 Common_IO::step_proceed($params, "Rename User", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Rename User", "Operation Failed", null);
             }
         }
     } else {
         throw new GroupIDMissingException();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:53,代碼來源:admin_group.io.php

示例15: remove_group

 /**
  * Adds the group's name to the user's doc. If the user's doc has not been fetched, will attempt to read first.
  */
 public function remove_group(Group $group = null)
 {
     if ($group == null) {
         throw new UnexpectedValueException("Please supply a group.");
     }
     $group_name = $group->get_name();
     // If the doc is not there, add group.
     if (!isset($this->doc)) {
         try {
             $this->read();
         } catch (Exception $e) {
             throw new Exception("Attempted to read user doc: " . $e);
         }
     }
     if (!isset($this->doc)) {
         throw new Exception("Could not read user doc.");
     }
     $this->groups = Helpers::array_without($group_name, $this->groups);
     $this->save();
     return $this->doc['groups'];
 }
開發者ID:also-engineering,項目名稱:robbert,代碼行數:24,代碼來源:User.php


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