public function getForm($item, $description = '')
 {
     if ($item instanceof TaskPermission) {
         $tp = new TaskPermissionList();
         $tp->add($item);
     } else {
         $tp = $item;
     }
     $gl = new GroupList($tp);
     $ul = new UserInfoList($tp);
     $uArray = $ul->getUserInfoList();
     $gArray = $gl->getGroupList();
     $tps = $tp->getTaskPermissions();
     $html = '';
     foreach ($tps as $_tp) {
         $html .= '<input type="hidden" name="tpID[]" value="' . $_tp->getTaskPermissionID() . '" />';
     }
     $html .= '<a href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/user_group_selector" id="ug-selector" dialog-modal="false" dialog-width="90%" dialog-title="' . t('Choose User/Group') . '"  dialog-height="70%" class="ccm-button-right dialog-launch"><span><em>' . t('Add Group or User') . '</em></span></a>';
     $html .= '<p>' . $description . '</p>';
     $html .= '<div class="ccm-spacer">&nbsp;</div><br/>';
     $html .= '<div id="ccm-permissions-entities-wrapper" class="ccm-permissions-entities-wrapper"><div id="ccm-permissions-entity-base" class="ccm-permissions-entity-base">' . $this->getAccessRow($tp) . '</div>';
     foreach ($gArray as $g) {
         $html .= $this->getAccessRow($tp, $g);
     }
     foreach ($uArray as $ui) {
         $html .= $this->getAccessRow($tp, $ui);
     }
     $html .= '</div>';
     return $html;
 }
Example #2
0
	public function getForm($item, $description = '') {
		
		if ($item instanceof TaskPermission) {
			$tp = new TaskPermissionList();
			$tp->add($item);
		} else {
			$tp = $item;
		}

		$gl = new GroupList($tp);
		$ul = new UserInfoList($tp);
		$uArray = $ul->getUserInfoList();
		$gArray = $gl->getGroupList();
		
		$tps = $tp->getTaskPermissions();
		$html = '';
		foreach($tps as $_tp) {
			$html .= '<input type="hidden" name="tpID[]" value="' . $_tp->getTaskPermissionID() . '" />';
		}
		
		$html .= '<div class="ccm-pane-body">';
		$html .= '<a class="btn ug-selector ccm-button-right dialog-launch" href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/users/search_dialog?mode=choose_multiple" dialog-modal="false" dialog-width="90%" dialog-title="' . t('Add User') . '"  dialog-height="70%">' . t('Add User') . '</a>';
		$html .= '<a class="btn ug-selector ccm-button-right dialog-launch" style="margin-right: 5px" href="' . REL_DIR_FILES_TOOLS_REQUIRED . '/select_group" dialog-modal="false" dialog-title="' . t('Add Group') . '">' . t('Add Group') . '</a>';

		$html .= '<p>' . $description . '</p>'; 

		$html .= '<div id="ccm-permissions-entities-wrapper" class="ccm-permissions-entities-wrapper"><div id="ccm-permissions-entity-base" class="ccm-permissions-entity-base">' . $this->getAccessRow($tp) . '</div>';
		
		foreach($gArray as $g) { 
			$html .= $this->getAccessRow($tp, $g);
		}
		
		foreach($uArray as $ui) {
			$html .= $this->getAccessRow($tp, $ui);
		}
		
		
		$html .= '</div></div>';
		
		return $html;
	}
					// smartly inherit the correct items.
					$gl = new GroupList($a);
					$ul = new UserInfoList($a);
					$permsSet = true;				
				}
			}		
			
			if (!$permsSet) {
				// otherwise we grab the collection permissions for this page
				$gl = new GroupList($c);
				$ul = new UserInfoList($c);
			}	
		}
		
		$gArray = $gl->getGroupList();
		$ulArray = $ul->getUserInfoList();
		
		?>
		<script type="text/javascript">
			function ccm_triggerSelectUser(uID, uName) {
				rowValue = "uID:" + uID;
				rowText = uName;
				if ($("#_row_uID_" + uID).length > 0) {
					return false;
				}			
	
				tbl = document.getElementById("ccmPermissionsTableArea");	   
				row1 = tbl.insertRow(-1); // insert at bottom of table. safari, wtf ?                            
				row1.id = "_row_uID_" + uID;
				row2 = tbl.insertRow(-1); // insert at bottom of table. safari, wtf ?                            
				row3 = tbl.insertRow(-1); // insert at bottom of table. safari, wtf ?