本文整理汇总了PHP中Users_Record_Model::getInstanceFromUserObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Users_Record_Model::getInstanceFromUserObject方法的具体用法?PHP Users_Record_Model::getInstanceFromUserObject怎么用?PHP Users_Record_Model::getInstanceFromUserObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users_Record_Model
的用法示例。
在下文中一共展示了Users_Record_Model::getInstanceFromUserObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process(Mobile_API_Request $request)
{
global $current_user;
$response = new Mobile_API_Response();
$current_user = $this->getActiveUser();
$currentUserModel = Users_Record_Model::getInstanceFromUserObject($current_user);
$moduleName = $request->get('module');
$users = $this->getUsers($currentUserModel, $moduleName);
$groups = $this->getGroups($currentUserModel, $moduleName);
$result = array('users' => $users, 'groups' => $groups);
$response->setResult($result);
return $response;
}
示例2: Calendar
/**
* Sync Calendar Records
* @return <array> Count of Calendar Records
*/
public function Calendar($userId = false)
{
if (!$userId) {
$user = Users_Record_Model::getCurrentUserModel();
} else {
$user = new Users();
$user = $user->retrieve_entity_info($userId, 'Users');
$user = Users_Record_Model::getInstanceFromUserObject($user);
}
$controller = new Google_Calendar_Controller($user);
$records = $controller->synchronize();
$syncRecords = $this->getSyncRecordsCount($records);
$syncRecords['vtiger']['more'] = $controller->targetConnector->moreRecordsExits();
$syncRecords['google']['more'] = $controller->sourceConnector->moreRecordsExits();
return $syncRecords;
}
示例3: replaceRelatedModuleFields
//.........这里部分代码省略.........
} elseif ($value == 'E') {
$value = getTranslatedString('External', $modulename);
}
}
if ($field_uitype == 32) {
$name = '%' . $value . '%';
$new_value = $db->query("select name from vtiger_language where prefix like '{$name}'", true);
$value = getTranslatedString($db->query_result($new_value, 0, "name"));
}
/// dla pól z przypisanym użytkownikie,
if ($field_uitype == 53 || $field_uitype == 52) {
$value = getUserName($value);
}
/// dla pól z folderem
/* if( $field_uitype == 26 ) {
$new_value = $db->query( "select foldername from vtiger_attachmentsfolder where folderid = '$value'", true );
$value = $db->query_result( $new_value, 0, "foldername" );
} */
/// Dla pól z roląużytkownika w organizacji
if ($field_uitype == 98) {
$new_value = $db->query("select rolename from vtiger_role where roleid = '{$value}'", true);
$value = $db->query_result($new_value, 0, "rolename");
}
/// Dla pól typu checkbox
if ($field_uitype == 56) {
if ($value == 1) {
$value = getTranslatedString('yes', "OSSPdf");
} elseif ($value == 0) {
$value = getTranslatedString('no', "OSSPdf");
}
}
/// Dla pola ze zdjęciem użytkownika
if ($field_uitype == 105) {
$recordModel = Users_Record_Model::getInstanceFromUserObject($obiekt);
$details = $recordModel->getImageDetails();
if (is_array($details[0])) {
$value = $details[0]['path'] . '_' . $details[0]['orgname'];
} else {
$value = '';
}
}
/// Dla pól typu lista wyboru
if ($field_uitype == 15 || $field_uitype == 16 || $field_uitype == 55 && $key == 'salutationtype') {
$value = getTranslatedString($value, $modulename);
}
if ($field_uitype == 83) {
$pobierz_tax = $db->query("select * from vtiger_producttaxrel where productid = '{$record}'", true);
for ($a = 0; $a < $db->num_rows($pobierz_tax); $a++) {
$taxid = $db->query_result($pobierz_tax, $a, "taxid");
$taxvalue = $db->query_result($pobierz_tax, $a, "taxpercentage");
if ($taxid == 1) {
$value .= getTranslatedString('LBL_VAT') . getTranslatedString('COVERED_PERCENTAGE') . ': ' . $taxvalue . '%';
} elseif ($taxid == 2) {
$value .= getTranslatedString('LBL_SALES') . getTranslatedString('COVERED_PERCENTAGE') . ': ' . $taxvalue . '%';
} elseif ($taxid == 3) {
$value .= getTranslatedString('LBL_SERVICE') . getTranslatedString('COVERED_PERCENTAGE') . ': ' . $taxvalue . '%';
}
$value .= '<br/>';
}
}
########################
if (in_array($field_uitype2, $uitypelist2)) {
if ($field_uitype == 10) {
$pobierz_wartosc = $db->query("select relmodule from vtiger_fieldmodulerel where fieldid = '{$fieldid}'", true);
for ($i = 0; $i < $db->num_rows($pobierz_wartosc); $i++) {
$module .= $db->query_result($pobierz_wartosc, $i, "relmodule") . ';';
示例4: pullEvents
protected function pullEvents($start, $end, &$result, $userid = false, $color = null, $textColor = 'white')
{
$dbStartDateOject = DateTimeField::convertToDBTimeZone($start);
$dbStartDateTime = $dbStartDateOject->format('Y-m-d H:i:s');
$dbStartDateTimeComponents = explode(' ', $dbStartDateTime);
$dbStartDate = $dbStartDateTimeComponents[0];
$dbEndDateObject = DateTimeField::convertToDBTimeZone($end);
$dbEndDateTime = $dbEndDateObject->format('Y-m-d H:i:s');
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
$moduleModel = Vtiger_Module_Model::getInstance('Events');
if ($userid) {
$focus = new Users();
$focus->id = $userid;
$focus->retrieve_entity_info($userid, 'Users');
$user = Users_Record_Model::getInstanceFromUserObject($focus);
$userName = $user->getName();
$queryGenerator = new QueryGenerator($moduleModel->get('name'), $user);
} else {
$queryGenerator = new QueryGenerator($moduleModel->get('name'), $currentUser);
}
$queryGenerator->setFields(array('subject', 'eventstatus', 'visibility', 'date_start', 'time_start', 'due_date', 'time_end', 'assigned_user_id', 'id', 'activitytype'));
$query = $queryGenerator->getQuery();
$query .= " AND vtiger_activity.activitytype NOT IN ('Emails','Task') AND ";
$hideCompleted = $currentUser->get('hidecompletedevents');
if ($hideCompleted) {
$query .= "vtiger_activity.eventstatus != 'HELD' AND ";
}
$query .= " ((concat(date_start, '', time_start) >= '{$dbStartDateTime}' AND concat(due_date, '', time_end) < '{$dbEndDateTime}') OR ( due_date >= '{$dbStartDate}'))";
$params = array();
if (empty($userid)) {
$eventUserId = $currentUser->getId();
} else {
$eventUserId = $userid;
}
$params = array_merge(array($eventUserId), $this->getGroupsIdsForUsers($eventUserId));
$query .= " AND vtiger_crmentity.smownerid IN (" . generateQuestionMarks($params) . ")";
$queryResult = $db->pquery($query, $params);
while ($record = $db->fetchByAssoc($queryResult)) {
$item = array();
$crmid = $record['activityid'];
$visibility = $record['visibility'];
$activitytype = $record['activitytype'];
$status = $record['eventstatus'];
$item['id'] = $crmid;
$item['visibility'] = $visibility;
$item['activitytype'] = $activitytype;
$item['status'] = $status;
if (!$currentUser->isAdminUser() && $visibility == 'Private' && $userid && $userid != $currentUser->getId()) {
$item['title'] = decode_html($userName) . ' - ' . decode_html(vtranslate('Busy', 'Events')) . '*';
$item['url'] = '';
} else {
$item['title'] = decode_html($record['subject']) . ' - (' . decode_html(vtranslate($record['eventstatus'], 'Calendar')) . ')';
$item['url'] = sprintf('index.php?module=Calendar&view=Detail&record=%s', $crmid);
}
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$item['start'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$item['end'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$item['className'] = $cssClass;
$item['allDay'] = false;
$item['color'] = $color;
$item['textColor'] = $textColor;
$item['module'] = $moduleModel->getName();
$result[] = $item;
}
}
示例5: process
public function process($feed, $request, $start, $end, &$result, $userid = false, $color = null, $textColor = 'white')
{
$dbStartDateOject = DateTimeField::convertToDBTimeZone($start);
$dbStartDateTime = $dbStartDateOject->format('Y-m-d H:i:s');
$dbStartDateTimeComponents = explode(' ', $dbStartDateTime);
$dbStartDate = $dbStartDateTimeComponents[0];
$dbEndDateObject = DateTimeField::convertToDBTimeZone($end);
$dbEndDateTime = $dbEndDateObject->format('Y-m-d H:i:s');
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
$moduleModel = Vtiger_Module_Model::getInstance('Events');
if ($userid) {
$focus = new Users();
$focus->id = $userid;
$focus->retrieve_entity_info($userid, 'Users');
$user = Users_Record_Model::getInstanceFromUserObject($focus);
$userName = $user->getName();
}
$params = array();
if (empty($userid)) {
$eventUserId = $currentUser->getId();
} else {
$eventUserId = $userid;
}
$params = array_merge(array($eventUserId), $feed->getGroupsIdsForUsers($eventUserId));
$query = 'SELECT vtiger_activity.subject, vtiger_activity.eventstatus, vtiger_activity.visibility, vtiger_activity.date_start, vtiger_activity.time_start, vtiger_activity.due_date, vtiger_activity.time_end, vtiger_activity.activityid, vtiger_activity.activitytype, vtiger_seactivityrel.crmid as parent_id FROM vtiger_activity LEFT JOIN vtiger_seactivityrel ON vtiger_seactivityrel.activityid = vtiger_activity.activityid WHERE';
$query .= " vtiger_activity.activitytype NOT IN ('Emails','Task') AND ";
$hideCompleted = $currentUser->get('hidecompletedevents');
if ($hideCompleted) {
$query .= "vtiger_activity.eventstatus != 'HELD' AND ";
}
$query .= " ((concat(date_start, '', time_start) >= '{$dbStartDateTime}' AND concat(due_date, '', time_end) < '{$dbEndDateTime}') ) AND vtiger_activity.smownerid IN (" . generateQuestionMarks($params) . ") AND vtiger_activity.deleted=0";
$queryResult = $db->pquery($query, $params);
while ($record = $db->fetchByAssoc($queryResult)) {
$item = array();
$crmid = $record['activityid'];
$visibility = $record['visibility'];
$activitytype = $record['activitytype'];
$status = $record['eventstatus'];
$item['id'] = $crmid;
$item['visibility'] = $visibility;
$item['activitytype'] = $activitytype;
$item['status'] = $status;
//dodanie powiazan albo z kontaktow albo z powiazanych
$title_add = $record['parent_id'] ? Vtiger_Functions::getCRMRecordLabel($record['parent_id']) : implode(', ', getActivityRelatedContacts($crmid));
if (!$currentUser->isAdminUser() && $visibility == 'Private' && $userid && $userid != $currentUser->getId()) {
$item['title'] = decode_html($userName);
$item['url'] = '';
} else {
$item['title'] = decode_html($record['subject']);
$item['url'] = sprintf('index.php?module=Calendar&view=Detail&record=%s', $crmid);
}
if ($title_add != '') {
$item['title'] .= ' [' . decode_html($title_add) . ']';
}
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue($currentUser);
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$item['start'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
$userDateTimeString = $dateTimeFieldInstance->getDisplayDateTimeValue($currentUser);
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$item['end'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$item['className'] = $cssClass;
$item['allDay'] = false;
$item['color'] = $color;
$item['textColor'] = $textColor;
$item['module'] = $moduleModel->getName();
$result[] = $item;
}
return $widget;
}