/**
	 * Function to get the Display Value, for the current field type with given DB Insert Value
	 * @param <Object> $value
	 * @return <Object>
	 */
	public function getDisplayValue($values)
	{
		if ($values == '')
			return;

		foreach (Vtiger_Functions::getArrayFromValue($values) as $value) {
			if (Vtiger_Owner_UIType::getOwnerType($value) === 'User') {
				$userModel = Users_Record_Model::getCleanInstance('Users');
				$userModel->set('id', $value);
				$detailViewUrl = $userModel->getDetailViewUrl();
				$currentUser = Users_Record_Model::getCurrentUserModel();
				if ($currentUser->isAdminUser()) {
					$displayvalue[] = '<a href=' . $detailViewUrl . '>' . rtrim(getOwnerName($value)) . '</a>';
				} else {
					$displayvalue[] = rtrim(getOwnerName($value));
				}
			} else {
				$currentUser = Users_Record_Model::getCurrentUserModel();
				if ($currentUser->isAdminUser()) {
					$recordModel = new Settings_Groups_Record_Model();
					$recordModel->set('groupid', $value);
					$detailViewUrl = $recordModel->getDetailViewUrl();
					$displayvalue[] = '<a href=' . $detailViewUrl . '>' . rtrim(getOwnerName($value)) . '</a>';
				} else {
					$displayvalue[] = rtrim(getOwnerName($value));
				}
			}
		}
		$displayvalue = implode(', ', $displayvalue);
		return $displayvalue;
	}
	/**
	 * Function to get the Display Value, for the current field type with given DB Insert Value
	 * @param <Object> $value
	 * @return <Object>
	 */
	public function getDisplayValue($values)
	{
		if ($values == NULL && !is_array($values))
			return;
		foreach ($values as $value) {
			if (self::getOwnerType($value) === 'User') {
				$userModel = Users_Record_Model::getCleanInstance('Users');
				$userModel->set('id', $value);
				$detailViewUrl = $userModel->getDetailViewUrl();
				$currentUser = Users_Record_Model::getCurrentUserModel();
				if (!$currentUser->isAdminUser()) {
					return getOwnerName($value);
				}
			} else {
				$currentUser = Users_Record_Model::getCurrentUserModel();
				if (!$currentUser->isAdminUser()) {
					return getOwnerName($value);
				}
				$recordModel = new Settings_Groups_Record_Model();
				$recordModel->set('groupid', $value);
				$detailViewUrl = $recordModel->getDetailViewUrl();
			}
			$displayvalue[] = "<a href=" . $detailViewUrl . ">" . getOwnerName($value) . "</a>&nbsp";
		}
		$displayvalue = implode(',', $displayvalue);
		return $displayvalue;
	}
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $recordModel = Users_Record_Model::getCleanInstance($moduleName);
     $moduleModel = $recordModel->getModule();
     $fieldList = $moduleModel->getFields();
     $requestFieldList = array_intersect_key($request->getAll(), $fieldList);
     foreach ($requestFieldList as $fieldName => $fieldValue) {
         $fieldModel = $fieldList[$fieldName];
         if ($fieldModel->isEditable()) {
             $recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
         }
     }
     $recordStructureInstance = Users_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Users_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
     $viewer = $this->getViewer($request);
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
     $viewer->assign('MODULE_MODEL', $moduleModel);
     $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
     $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('SCRIPTS', $this->getFooterScripts($request));
     echo $viewer->view('QuickCreate.tpl', $moduleName, true);
 }
	/**
	 * Function to get display value
	 * @param <String> $value
	 * @param <Number> $recordId
	 * @return <String> display value
	 */
	public function getDisplayValue($value, $recordId)
	{
		$displayValue = $this->getEditViewDisplayValue($value);
		$currentUserModel = Users_Record_Model::getCurrentUserModel();
		if ($currentUserModel->isAdminUser()) {
			$recordModel = Users_Record_Model::getCleanInstance('Users');
			$recordModel->set('id', $value);
			return '<a href="' . $recordModel->getDetailViewUrl() . '">' . textlength_check($displayValue) . '</a>';
		}
		return $displayValue;
	}
Exemple #5
0
 /**
  * Function to get display value
  * @param <String> $value
  * @param <Number> $recordId
  * @return <String> display value
  */
 public function getDisplayValue($value, $recordId)
 {
     global $log;
     $log->debug("Entering ./uitypes/UserReference.php::getDisplayValue");
     $displayValue = $this->getEditViewDisplayValue($value);
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     if ($currentUserModel->isAdminUser()) {
         $recordModel = Users_Record_Model::getCleanInstance('Users');
         $recordModel->set('id', $value);
         return '<a href="' . $recordModel->getDetailViewUrl() . '">' . textlength_check($displayValue) . '</a>';
     }
     return $displayValue;
 }
Exemple #6
0
 /**
  * Function to get the Display Value, for the current field type with given DB Insert Value
  * @param <Object> $value
  * @return <Object>
  */
 public function getDisplayValue($value)
 {
     if (self::getOwnerType($value) === 'User') {
         $userModel = Users_Record_Model::getCleanInstance('Users');
         $userModel->set('id', $value);
         $detailViewUrl = $userModel->getDetailViewUrl();
     } else {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         if (!$currentUser->isAdminUser()) {
             return getOwnerName($value);
         }
         $recordModel = new Settings_Groups_Record_Model();
         $recordModel->set('groupid', $value);
         $detailViewUrl = $recordModel->getDetailViewUrl();
     }
     return "<a href=" . $detailViewUrl . ">" . getOwnerName($value) . "</a>";
 }
 /**
  * Function to get the Display Value, for the current field type with given DB Insert Value
  * @param <Object> $value
  * @return <Object>
  */
 public function getDisplayValue($values)
 {
     if ($values == NULL) {
         return;
     }
     foreach (Vtiger_Functions::getArrayFromValue($values) as $value) {
         $userModel = Users_Record_Model::getCleanInstance('Users');
         $userModel->set('id', $value);
         $detailViewUrl = $userModel->getDetailViewUrl();
         $currentUser = Users_Record_Model::getCurrentUserModel();
         if (!$currentUser->isAdminUser()) {
             return getOwnerName($value);
         }
         $displayvalue[] = "<a href=" . $detailViewUrl . ">" . getOwnerName($value) . "</a>&nbsp";
     }
     $displayvalue = implode(',', $displayvalue);
     return $displayvalue;
 }
 public function process($moduleName, $ID, $record_form, $config)
 {
     $save_record = true;
     if ($record_form['view'] == 'quick_edit' && $moduleName != 'Calendar' && $moduleName != 'Events') {
         $records = Vtiger_Record_Model::getInstanceById($ID, $moduleName);
         $recordModel = Users_Record_Model::getCleanInstance($moduleName);
         $fieldList = $recordModel->getModule()->getFields();
         foreach ($fieldList as $fieldName => $field) {
             if ($field->isMandatory() && !$records->get($fieldName) && !$record_form[$fieldName]) {
                 $invalidField = $field->get('label');
                 $fieldName2 = $fieldName;
                 $save_record = false;
                 break;
             }
         }
     }
     if (!$save_record) {
         return array('save_record' => $save_record, 's' => $moduleName, 'fne' => $fieldName2, 'type' => 0, 'info' => array('title' => vtranslate('LBL_FAILED_TO_APPROVE_CHANGES', 'Settings:DataAccess'), 'text' => vtranslate('LBL_MANDATORY_FIELD', 'Settings:DataAccess') . ': ' . vtranslate($invalidField, $moduleName), 'type' => 'info'));
     } else {
         return array('save_record' => $save_record);
     }
 }
Exemple #9
0
 /**
  * Function to get Detail View Url of this member
  * return <String> url
  */
 public function getDetailViewUrl()
 {
     list($type, $recordId) = self::getIdComponentsFromQualifiedId($this->getId());
     switch ($type) {
         case 'Users':
             $recordModel = Users_Record_Model::getCleanInstance($type);
             $recordModel->setId($recordId);
             return $recordModel->getDetailViewUrl();
         case 'RoleAndSubordinates':
         case 'Roles':
             $recordModel = new Settings_Roles_Record_Model();
             $recordModel->set('roleid', $recordId);
             return $recordModel->getEditViewUrl();
         case 'Groups':
             $recordModel = new Settings_Groups_Record_Model();
             $recordModel->setId($recordId);
             return $recordModel->getDetailViewUrl();
     }
 }