Esempio n. 1
0
	public function edit_attribute() {
		$uo = UserInfo::getByID($_POST['uID']);
		$u = new User();
		if ($uo->getUserID() == USER_SUPER_ID && (!$u->isSuperUser())) {
			throw new Exception(t('Only the super user may edit this account.'));
		}
		
		$assignment = PermissionKey::getByHandle('edit_user_properties')->getMyAssignment();
		$akID = $_REQUEST['uakID'];
		if (!in_array($akID, $assignment->getAttributesAllowedArray())) {
			throw new Exception(t('You do not have permission to modify this attribute.'));
		}
		
		$ak = UserAttributeKey::get($akID);

		if ($_POST['task'] == 'update_extended_attribute') { 
			$ak->saveAttributeForm($uo);
			$val = $uo->getAttributeValueObject($ak);
			print $val->getValue('displaySanitized','display');
			exit;
		}
		
		if ($_POST['task'] == 'clear_extended_attribute') {
			$uo->clearAttribute($ak);			
			$val = $uo->getAttributeValueObject($ak);
			print '<div class="ccm-attribute-field-none">' . t('None') . '</div>';
			exit;
		}
	}
    $fakID = $_REQUEST['fakID'];
    $value = '';
    $ak = UserAttributeKey::get($fakID);
    foreach ($users as $ui) {
        if ($ek->validate($ak)) {
            $ak->saveAttributeForm($ui);
        }
    }
    $val = $ui->getAttributeValueObject($ak);
    print $val->getValue('display');
    exit;
}
if ($_POST['task'] == 'clear_extended_attribute') {
    $fakID = $_REQUEST['fakID'];
    $value = '';
    $ak = UserAttributeKey::get($fakID);
    foreach ($users as $ui) {
        if ($ek->validate($ak)) {
            $ui->clearAttribute($ak);
        }
    }
    print '<div class="ccm-attribute-field-none">' . t('None') . '</div>';
    exit;
}
function printAttributeRow($ak, $ek)
{
    global $users, $form;
    $value = '';
    for ($i = 0; $i < count($users); $i++) {
        $lastValue = $value;
        $ui = $users[$i];
Esempio n. 3
0
 public function edit_attribute()
 {
     $uo = UserInfo::getByID($_POST['uID']);
     $u = new User();
     if ($uo->getUserID() == USER_SUPER_ID && !$u->isSuperUser()) {
         throw new Exception(t('Only the super user may edit this account.'));
     }
     $akID = $_REQUEST['uakID'];
     $ak = UserAttributeKey::get($akID);
     if ($_POST['task'] == 'update_extended_attribute') {
         $ak->saveAttributeForm($uo);
         $val = $uo->getAttributeValueObject($ak);
         print $val->getValue('displaySanitized', 'display');
         exit;
     }
     if ($_POST['task'] == 'clear_extended_attribute') {
         $uo->clearAttribute($ak);
         $val = $uo->getAttributeValueObject($ak);
         print '<div class="ccm-attribute-field-none">' . t('None') . '</div>';
         exit;
     }
 }