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


PHP ca_sets::setUsers方法代碼示例

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


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

示例1: shareSet

 public function shareSet()
 {
     $pn_set_id = $this->request->getParameter('set_id', pInteger);
     $t_set = new ca_sets();
     if (!$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_EDIT_ACCESS__, $pn_set_id)) {
         $this->notification->addNotification(_t("You cannot share this set"), "message");
     } else {
         $t_set->load($pn_set_id);
         $vs_form_prefix = 'shareSetForm_';
         $va_users_to_set = array();
         foreach ($_REQUEST as $vs_key => $vs_val) {
             if (preg_match("!^{$vs_form_prefix}id(.*)\$!", $vs_key, $va_matches)) {
                 $vn_user_id = (int) $this->request->getParameter($vs_form_prefix . 'id' . $va_matches[1], pInteger);
                 $vn_access = $this->request->getParameter($vs_form_prefix . 'access_' . $va_matches[1], pInteger);
                 if ($vn_access > 0) {
                     $va_users_to_set[$vn_user_id] = $vn_access;
                 }
             }
         }
         $t_set->setUsers($va_users_to_set);
         if ($t_set->numErrors()) {
             $this->notification->addNotification(_t("There were errors while sharing: %1", join("; ", $t_set->getErrors())), "message");
         } else {
             $vn_c = sizeof($va_users_to_set);
             $this->notification->addNotification($vn_c == 1 ? _t("Shared set with %1 user", $vn_c) : _t("Shared set with %1 users", $vn_c), "message");
         }
     }
     $this->index();
 }
開發者ID:guaykuru,項目名稱:pawtucket,代碼行數:29,代碼來源:SetsController.php


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