本文整理汇总了PHP中Users::getActiveAdminUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::getActiveAdminUser方法的具体用法?PHP Users::getActiveAdminUser怎么用?PHP Users::getActiveAdminUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::getActiveAdminUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changePassword
public function changePassword($request)
{
$request = new Vtiger_Request($request);
$viewer = Vtiger_Viewer::getInstance();
$userName = $request->get('username');
$newPassword = $request->get('password');
$confirmPassword = $request->get('confirmPassword');
$shortURLID = $request->get('shorturl_id');
$secretHash = $request->get('secret_hash');
$shortURLModel = Vtiger_ShortURL_Helper::getInstance($shortURLID);
$secretToken = $shortURLModel->handler_data['secret_token'];
$validateData = array('username' => $userName, 'secret_token' => $secretToken, 'secret_hash' => $secretHash);
$valid = $shortURLModel->compareEquals($validateData);
if ($valid) {
$userId = getUserId_Ol($userName);
$user = Users::getActiveAdminUser();
$wsUserId = vtws_getWebserviceEntityId('Users', $userId);
vtws_changePassword($wsUserId, '', $newPassword, $confirmPassword, $user);
} else {
$viewer->assign('ERROR', true);
}
$shortURLModel->delete();
$viewer->assign('USERNAME', $userName);
$viewer->assign('PASSWORD', $newPassword);
$viewer->view('FPLogin.tpl', 'Users');
}
示例2: _getFile
protected function _getFile($id, $moduleName, $crmid)
{
$current_user = \Users_Record_Model::getCurrentUserModel();
$useUser = \Users::getActiveAdminUser();
$oldUser = vglobal('current_user');
vglobal('current_user', $useUser);
$tmpFilename = $this->_getTmpFilename();
$mpdf = "";
$language = $current_user->language;
if (empty($language)) {
$language = \Vtiger_Language_Handler::getLanguage();
}
$Records = array($crmid);
// $request = $_REQUEST;
// $_REQUEST['search'] = true;
//$_REQUEST['submode'] = true;
\Vtiger_Loader::autoLoad('PDFMaker_PDFMaker_Model');
$PDFMaker = new \PDFMaker_PDFMaker_Model();
$name = $PDFMaker->GetPreparedMPDF($mpdf, $Records, array($id), $moduleName, $language);
$name = $PDFMaker->generate_cool_uri($name);
if ($name != "") {
$name = $name . ".pdf";
}
$mpdf->Output($tmpFilename);
vglobal('current_user', $oldUser);
$filetype = "application/pdf";
//$_REQUEST = $request;
return array('path' => $tmpFilename, 'name' => $name, 'type' => $filetype);
}
示例3: step1
public function step1(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$recordId = $request->get('record');
if ($recordId) {
$workflowModel = Settings_Workflows_Record_Model::getInstance($recordId);
$viewer->assign('RECORDID', $recordId);
$viewer->assign('MODULE_MODEL', $workflowModel->getModule());
$viewer->assign('MODE', 'edit');
} else {
$workflowModel = Settings_Workflows_Record_Model::getCleanInstance($moduleName);
$selectedModule = $request->get('source_module');
if (!empty($selectedModule)) {
$viewer->assign('SELECTED_MODULE', $selectedModule);
}
}
$db = PearDatabase::getInstance();
$workflowManager = new VTWorkflowManager($db);
$viewer->assign('MAX_ALLOWED_SCHEDULED_WORKFLOWS', $workflowManager->getMaxAllowedScheduledWorkflows());
$viewer->assign('SCHEDULED_WORKFLOW_COUNT', $workflowManager->getScheduledWorkflowsCount());
$viewer->assign('WORKFLOW_MODEL', $workflowModel);
$viewer->assign('ALL_MODULES', Settings_Workflows_Module_Model::getSupportedModules());
$viewer->assign('TRIGGER_TYPES', Settings_Workflows_Module_Model::getTriggerTypes());
$viewer->assign('MODULE', $moduleName);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('CURRENT_USER', $currentUser);
$admin = Users::getActiveAdminUser();
$viewer->assign('ACTIVE_ADMIN', $admin);
$viewer->view('Step1.tpl', $qualifiedModuleName);
}
示例4: processMap
function processMap($arguments)
{
global $adb, $current_user;
$xml = $this->getXMLContent();
$entityId = $arguments[0];
$holduser = $current_user;
$current_user = Users::getActiveAdminUser();
// evaluate condition as admin user
$entity = new VTWorkflowEntity($current_user, $entityId);
$current_user = $holduser;
if (isset($xml->expression)) {
$testexpression = (string) $xml->expression;
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($testexpression)));
$expression = $parser->expression();
$exprEvaluater = new VTFieldExpressionEvaluater($expression);
$exprEvaluation = $exprEvaluater->evaluate($entity);
} elseif (isset($xml->function)) {
list($void, $entity->data['record_id']) = explode('x', $entity->data['id']);
$entity->data['record_module'] = $entity->getModuleName();
$function = (string) $xml->function->name;
$testexpression = '$exprEvaluation = ' . $function . '(';
foreach ($xml->function->parameters->parameter as $k => $v) {
if (isset($entity->data[(string) $v])) {
$testexpression .= "'" . $entity->data[(string) $v] . "',";
} else {
$testexpression .= "'" . (string) $v . "',";
}
}
$testexpression = trim($testexpression, ',') . ');';
eval($testexpression);
}
return $exprEvaluation;
}
示例5: adminUser
/**
* Push the admin user on to the user stack
* and make it the $current_user
*
*/
function adminUser()
{
$user = Users::getActiveAdminUser();
global $current_user;
if (empty(self::$userStack) || count(self::$userStack) == 0) {
self::$loggedInUser = $current_user;
}
array_push(self::$userStack, $current_user);
$current_user = $user;
return $user;
}
示例6: changePassword
public function changePassword($request)
{
$request = new Vtiger_Request($request);
$viewer = Vtiger_Viewer::getInstance();
$username = $request->get('username');
$newPassword = $request->get('password');
$confirmPassword = $request->get('confirmPassword');
$userId = getUserId_Ol($username);
$user = Users::getActiveAdminUser();
$wsUserId = vtws_getWebserviceEntityId('Users', $userId);
vtws_changePassword($wsUserId, '', $newPassword, $confirmPassword, $user);
$viewer->assign('USERNAME', $username);
$viewer->assign('PASSWORD', $newPassword);
$viewer->view('FPLogin.tpl', 'Users');
}
示例7: getAllChildAttachmentIds
/**
* @param $context \Workflow\VTEntity
*/
public function getAllChildAttachmentIds($context)
{
$adb = \PearDatabase::getInstance();
$oldUser = vglobal('current_user');
vglobal('current_user', \Users::getActiveAdminUser());
$model = \Vtiger_Module_Model::getInstance($context->getModuleName());
$query = $model->getRelationQuery($context->getId(), 'get_attachments', \Vtiger_Module_Model::getInstance('Documents'));
$parts = explode('FROM', $query, 2);
$query = 'SELECT vtiger_attachments.attachmentsid as id FROM ' . $parts[1];
$result = $adb->query($query);
$ids = array();
while ($row = $adb->fetchByAssoc($result)) {
$this->addAttachmentRecord('ID', $row['id']);
}
vglobal('current_user', $oldUser);
}
示例8: createInvoice
function createInvoice($salesorder_id)
{
require_once 'include/utils/utils.php';
require_once 'modules/SalesOrder/SalesOrder.php';
require_once 'modules/Invoice/Invoice.php';
require_once 'modules/Users/Users.php';
global $log, $adb;
global $current_user;
// Payment duration in days
$payment_duration_values = array('net 01 day' => '1', 'net 05 days' => '5', 'net 07 days' => '7', 'net 10 days' => '10', 'net 15 days' => '15', 'net 30 days' => '30', 'net 45 days' => '45', 'net 60 days' => '60');
if (!$current_user) {
$current_user = Users::getActiveAdminUser();
}
$so_focus = new SalesOrder();
$so_focus->id = $salesorder_id;
$so_focus->retrieve_entity_info($salesorder_id, "SalesOrder");
foreach ($so_focus->column_fields as $fieldname => $value) {
$so_focus->column_fields[$fieldname] = decode_html($value);
}
$focus = new Invoice();
// This will only fill in the basic columns from SO to Invoice and also Update the SO id in new Invoice
$focus = getConvertSoToInvoice($focus, $so_focus, $salesorder_id);
// Pick up the Payment due date based on the Configuration in SO
$payment_duration = $so_focus->column_fields['payment_duration'];
$due_duration = $payment_duration_values[trim(strtolower($payment_duration))];
$durationinsec = mktime(0, 0, 0, date('m'), date('d') + $due_duration, date('Y'));
// Cleanup focus object, to duplicate the Invoice.
$focus->id = '';
$focus->mode = '';
$focus->column_fields['invoicestatus'] = $so_focus->column_fields['invoicestatus'];
$focus->column_fields['invoicedate'] = date('Y-m-d');
$focus->column_fields['duedate'] = date('Y-m-d', $durationinsec);
// Additional SO fields to copy -> Invoice field name mapped to equivalent SO field name
$invoice_so_fields = array('txtAdjustment' => 'txtAdjustment', 'hdnSubTotal' => 'hdnSubTotal', 'hdnGrandTotal' => 'hdnGrandTotal', 'hdnTaxType' => 'hdnTaxType', 'hdnDiscountPercent' => 'hdnDiscountPercent', 'hdnDiscountAmount' => 'hdnDiscountAmount', 'hdnS_H_Amount' => 'hdnS_H_Amount', 'assigned_user_id' => 'assigned_user_id', 'currency_id' => 'currency_id', 'conversion_rate' => 'conversion_rate');
foreach ($invoice_so_fields as $invoice_field => $so_field) {
$focus->column_fields[$invoice_field] = $so_focus->column_fields[$so_field];
}
$focus->_salesorderid = $salesorder_id;
$focus->_recurring_mode = 'recurringinvoice_from_so';
$focus->save("Invoice");
}
示例9: __CreateNewEmail
/**
* Create new Email record (and link to given record) including attachments
* @global Users $current_user
* @global PearDataBase $adb
* @param MailManager_Message_Model $mailrecord
* @param String $module
* @param CRMEntity $linkfocus
* @return Integer
*/
function __CreateNewEmail($mailrecord, $module, $linkfocus)
{
global $current_user, $adb;
if (!$current_user) {
$current_user = Users::getActiveAdminUser();
}
$handler = vtws_getModuleHandlerFromName('Emails', $current_user);
$meta = $handler->getMeta();
if ($meta->hasWriteAccess() != true) {
return false;
}
$focus = new Emails();
$focus->column_fields['activitytype'] = 'Emails';
$focus->column_fields['subject'] = $mailrecord->_subject;
if (!empty($module)) {
$focus->column_fields['parent_type'] = $module;
}
if (!empty($linkfocus->id)) {
$focus->column_fields['parent_id'] = "{$linkfocus->id}@-1|";
}
$focus->column_fields['description'] = $mailrecord->getBodyHTML();
$focus->column_fields['assigned_user_id'] = $current_user->id;
$focus->column_fields["date_start"] = date('Y-m-d', $mailrecord->_date);
$focus->column_fields["email_flag"] = 'MailManager';
$from = $mailrecord->_from[0];
$to = $mailrecord->_to[0];
$cc = !empty($mailrecord->_cc) ? implode(',', $mailrecord->_cc) : '';
$bcc = !empty($mailrecord->_bcc) ? implode(',', $mailrecord->_bcc) : '';
//emails field were restructured and to,bcc and cc field are JSON arrays
$focus->column_fields['from_email'] = $from;
$focus->column_fields['saved_toid'] = $to;
$focus->column_fields['ccmail'] = $cc;
$focus->column_fields['bccmail'] = $bcc;
$focus->save('Emails');
$emailid = $focus->id;
// TODO: Handle attachments of the mail (inline/file)
$this->__SaveAttachements($mailrecord, 'Emails', $focus);
return $emailid;
}
示例10: __construct
/**
* Initilizate commerce operation controller.
* @param String $assignedUserName
* @param String $userKey
*/
public function __construct($assignedUserName)
{
$this->restUser = Users::getActiveAdminUser();
$this->assignedUserReference = $this->getUserReference($assignedUserName);
}
示例11: handleTask
public function handleTask(&$context)
{
$adb = \PearDatabase::getInstance();
if (!getTabid('PDFMaker') || !vtlib_isModuleActive('PDFMaker')) {
throw new \Exception('PDFMaker Extension not found!');
}
/* Insert here source code to execute the task */
$recordChooser = $this->get('recordChooser');
if (empty($recordChooser) || $recordChooser == -1) {
throw new \Exception('You need to configure the PDFMaker Integraion.');
}
$recordIds = array();
if ($recordChooser === 'current') {
$recordIds = array($context->getId());
$moduleName = $this->getModuleName();
} else {
$currentTime = microtime(true);
$benchmark = array();
$parts = explode("#~#", $this->get("search_module"));
$related_module = VtUtils::getModuleName($parts[1]);
$moduleName = $related_module;
$logger = new \Workflow\ConditionLogger();
$objMySQL = new \Workflow\ConditionMysql($related_module, $context);
$objMySQL->setLogger($logger);
$main_module = \CRMEntity::getInstance($related_module);
$sqlCondition = $objMySQL->parse($this->get("condition"));
$newTime = microtime(true);
$benchmark[] = round($newTime - $currentTime, 3);
$currentTime = $newTime;
$sqlTables = $objMySQL->generateTables();
if (strlen($sqlCondition) > 3) {
$sqlCondition .= " AND vtiger_crmentity.deleted = 0";
} else {
$sqlCondition .= " vtiger_crmentity.deleted = 0";
}
$logs = $logger->getLogs();
$this->setStat($logs);
$sqlCondition .= " GROUP BY vtiger_crmentity.crmid ";
$idColumn = $main_module->table_name . "." . $main_module->table_index;
$sqlQuery = "SELECT {$idColumn} as `idCol` " . $sqlTables . " WHERE " . (strlen($sqlCondition) > 3 ? $sqlCondition : "");
$sortField = $this->get("sort_field");
if (!empty($sortField) && $sortField != -1) {
$sortField = VtUtils::getColumnName($sortField);
$sortDirection = $this->get("sortDirection");
$sqlQuery .= " ORDER BY " . $sortField . " " . $sortDirection;
}
$this->addStat("MySQL Query: " . $sqlQuery);
$result = $adb->query($sqlQuery, true);
$newTime = microtime(true);
$benchmark[] = round($newTime - $currentTime, 3);
$this->addStat("num Rows: " . $adb->num_rows($result));
# If no records are found, fo other way
if ($adb->num_rows($result) == 0) {
return "yes";
}
$this->addStat("Benchmark: " . implode("/", $benchmark));
while ($row = $adb->fetchByAssoc($result)) {
$recordIds[] = $row['idcol'];
}
}
$context->save();
$useUser = Users::getActiveAdminUser();
$oldUser = vglobal('current_user');
vglobal('current_user', $useUser);
$PDFMaker = new PDFMaker_PDFMaker_Model();
$dl = Vtiger_Language_Handler::getLanguage();
$mpdf = "";
$copies = $this->get('copies');
if ($copies == -1 || empty($copies)) {
$copies = 1;
}
$templateids = array();
for ($i = 0; $i < $copies; $i++) {
$templateids = array_merge($templateids, $this->get("template"));
}
$filename = $PDFMaker->GetPreparedMPDF($mpdf, $recordIds, $templateids, $moduleName, $dl, '');
if (strpos($filename, '.pdf') === false) {
$filename .= '.pdf';
}
// $filename = $PDFMaker->generate_cool_uri($filename);
$tmpfile = tempnam(sys_get_temp_dir(), 'WfTmp');
@unlink($tmpfile);
$mpdf->Output($tmpfile);
$overwriteFilename = $this->get("filename", $context);
if ($overwriteFilename != -1 && !empty($overwriteFilename)) {
$filename = $overwriteFilename;
}
\Workflow\FileAction::doActions($this->get('resultaction'), $tmpfile, $filename, $context, $recordIds, $this->getWorkflow());
vglobal('current_user', $oldUser);
return "yes";
}
示例12: error_handler
//.........这里部分代码省略.........
${$thmqjfmfpw} = "E_EXPRESSION_ERROR";
break;
case E_NONBREAK_ERROR:
${${"GLOBALS"}["lywuyikoio"]} = "E_NONBREAK_ERROR";
break;
default:
return true;
}
${${"GLOBALS"}["mfgxjg"]} = "<html>";
${${"GLOBALS"}["glxgfbgigzku"]} .= "<body style='font-family:Arial;'>";
${$zxslshktqz} .= "<h2>Workflow2 Error occurred [" . Workflow2::VERSION . "]</h2>";
${${"GLOBALS"}["bcgwqrfkwi"]} .= "<table style='font-size:14px;font-family:Courier;'>";
${$boxfsxrhhy} .= "<tr><td width=100>ERROR:</td><td><strong>" . ${${"GLOBALS"}["lywuyikoio"]} . "</strong></td></tr>";
${${"GLOBALS"}["epitxtaom"]} .= "<tr><td>LOCATION:</td><td><em>" . ${${"GLOBALS"}["nkwnskowfm"]} . " [" . ${${"GLOBALS"}["wwhducoegfhj"]} . "]</td></tr>";
${${"GLOBALS"}["nlobacmlu"]} .= "<tr><td>Last Block:</td><td><em>" . Workflow2::${${"GLOBALS"}["gzmpicl"]} . "</td></tr>";
if (is_object(Workflow2::${${"GLOBALS"}["mxrwfqjv"]})) {
$xoibeexo = "wfId";
$iupfnkgskt = "currentBlock";
$heerhomdboi = "currentBlock";
${"GLOBALS"}["dspzbdt"] = "wfId";
${${"GLOBALS"}["dspzbdt"]} = Workflow2::$currentBlockObj->getWorkflowId();
${${"GLOBALS"}["bcgwqrfkwi"]} .= "<tr><td>Current Block:</td><td><a href='" . vglobal("site_URL") . "/index.php?module=Workflow2&view=Config&parent=Settings&workflow=" . ${$xoibeexo} . "'>WF " . Workflow2::$currentBlockObj->getWorkflowId() . "</a> - <a href='" . vglobal("site_URL") . "/index.php?module=Workflow2&parent=Settings&view=TaskConfig&taskid=" . Workflow2::${$heerhomdboi} . "'><em>Block " . Workflow2::${$iupfnkgskt} . "</a></td></tr>";
} else {
$yxnhgamlo = "currentBlock";
${${"GLOBALS"}["bcgwqrfkwi"]} .= "<tr><td>Current Block:</td><td><a href='" . vglobal("site_URL") . "/index.php?module=Workflow2&parent=Settings&view=TaskConfig&taskid=" . Workflow2::${$yxnhgamlo} . "'><em>Block " . Workflow2::${${"GLOBALS"}["hjepztr"]} . "</a></td></tr>";
}
${${"GLOBALS"}["bcgwqrfkwi"]} .= "</table>";
${${"GLOBALS"}["bcgwqrfkwi"]} .= "<br>";
${${"GLOBALS"}["kqrcfjwiiaaf"]} .= ${${"GLOBALS"}["tpuuspn"]};
if ($current_user->is_admin == "on") {
${${"GLOBALS"}["bcgwqrfkwi"]} .= "<br><br><pre>" . substr(print_r(isset(${${"GLOBALS"}["gqqzlivz"]}) ? ${${"GLOBALS"}["gqqzlivz"]} : debug_backtrace(), true), 0, 10000) . "</pre>";
}
${${"GLOBALS"}["bcgwqrfkwi"]} .= "</body>";
${${"GLOBALS"}["bcgwqrfkwi"]} .= "</html>";
if (${${"GLOBALS"}["xboekqcqm"]} != E_NONBREAK_ERROR) {
echo "<br><br><strong>The Systemadministrator has been notified!</strong>";
if (php_sapi_name() == "cli" && empty($_SERVER["REMOTE_ADDR"])) {
$wztouxewoxg = "html";
echo strip_tags(str_replace("</tr>", "\n", ${$wztouxewoxg}));
} else {
echo ${${"GLOBALS"}["bcgwqrfkwi"]};
}
}
if (is_object(self::${${"GLOBALS"}["tbqjwgajpr"]})) {
${"GLOBALS"}["hgcpks"] = "sql";
$ltrvirquaxf = "typestr";
${"GLOBALS"}["rullypv"] = "errstr";
${${"GLOBALS"}["hgcpks"]} = "INSERT INTO vtiger_wf_errorlog SET block_id = " . intval(Workflow2::${${"GLOBALS"}["hjepztr"]}) . ", text = ?, workflow_id = ?";
global $adb;
$adb->pquery(${${"GLOBALS"}["wpvlkaycsb"]}, array(${$ltrvirquaxf} . " # " . ${${"GLOBALS"}["rullypv"]}, self::$currentBlockObj->getWorkflowId()));
}
set_include_path(dirname(__FILE__) . "/../../" . PATH_SEPARATOR . get_include_path());
if (defined("ERROR_HANDLER")) {
if (constant("ERROR_HANDLER") == "email") {
$uctwsbxmn = "errorMail";
${$uctwsbxmn} = constant("ERROR_HANDLER_VALUE");
${"GLOBALS"}["zvrlosxm"] = "errorMail";
if (empty(${${"GLOBALS"}["zvrlosxm"]})) {
${${"GLOBALS"}["vlxqookbyem"]} = \Users::getActiveAdminUser();
${${"GLOBALS"}["dhlyfml"]} = $adminUser->column_fields["email1"];
}
} elseif (constant("ERROR_HANDLER") == "file") {
${"GLOBALS"}["knmrkjltmi"] = "currentBlock";
error_log(${${"GLOBALS"}["pmliottx"]} . " # - # Block: " . Workflow2::${${"GLOBALS"}["knmrkjltmi"]} . " # -\n", 3, constant("ERROR_HANDLER_VALUE"));
}
}
if (!defined("WF_DEMO_MODE") || constant("WF_DEMO_MODE") != true) {
${"GLOBALS"}["wxiehnwe"] = "errorMail";
require_once "modules/Emails/mail.php";
$xfidny = "to_email";
if (!class_exists("Workflow_PHPMailer")) {
require_once "modules/Workflow2/phpmailer/class.phpmailer.php";
}
${"GLOBALS"}["rwxevbhvzdl"] = "errorMail";
${$xfidny} = trim(${${"GLOBALS"}["wxiehnwe"]}, ",");
$jhhssnhww = "html";
${${"GLOBALS"}["buscjzx"]} = array();
if (strpos(${${"GLOBALS"}["chwolsutzxsr"]}, ";") !== false) {
$wikeps = "mails";
${$wikeps} = explode(";", ${${"GLOBALS"}["chwolsutzxsr"]});
$oiuuxhhtyoh = "address";
$npqvob = "mails";
foreach (${$npqvob} as ${$oiuuxhhtyoh}) {
$lixdtmhjtqhr = "to";
${$lixdtmhjtqhr}[] = ${${"GLOBALS"}["tqpkvmfwbj"]};
}
} else {
$xywinhspgvrz = "to_email";
${${"GLOBALS"}["buscjzx"]}[] = ${$xywinhspgvrz};
}
send_mail("Workflow2", ${${"GLOBALS"}["chwolsutzxsr"]}, "Workflow Designer", ${${"GLOBALS"}["rwxevbhvzdl"]}, "Workflow2 Error occurred", ${$jhhssnhww});
}
if (wfIsCli()) {
return true;
}
if (${${"GLOBALS"}["lqwwegyxqvq"]} != E_NONBREAK_ERROR) {
exit;
}
return true;
}
示例13: _parseValueForDate
/**
* Function parse the value based on the condition
* @param <Array> $condition
* @return <String>
*/
function _parseValueForDate($condition)
{
$value = $condition['value'];
$operation = $condition['operation'];
// based on the admin users time zone, since query generator expects datetime at user timezone
global $default_timezone;
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
@date_default_timezone_set($adminTimeZone);
switch ($operation) {
case 'less than days ago':
//between current date and (currentdate - givenValue)
$days = $condition['value'];
$value = date('Y-m-d', strtotime('-' . $days . ' days')) . ',' . date('Y-m-d', strtotime('+1 day'));
break;
case 'more than days ago':
// less than (current date - givenValue)
$days = $condition['value'] - 1;
$value = date('Y-m-d', strtotime('-' . $days . ' days'));
break;
case 'in less than':
// between current date and future date(current date + givenValue)
$days = $condition['value'] + 1;
$value = date('Y-m-d', strtotime('-1 day')) . ',' . date('Y-m-d', strtotime('+' . $days . ' days'));
break;
case 'in more than':
// greater than future date(current date + givenValue)
$days = $condition['value'] - 1;
$value = date('Y-m-d', strtotime('+' . $days . ' days'));
break;
case 'days ago':
$days = $condition['value'];
$value = date('Y-m-d', strtotime('-' . $days . ' days'));
break;
case 'days later':
$days = $condition['value'];
$value = date('Y-m-d', strtotime('+' . $days . ' days'));
break;
case 'is today':
$value = date('Y-m-d');
break;
case 'less than hours before':
$hours = $condition['value'];
$value = date('Y-m-d H:i:s', strtotime('-' . $hours . ' hours')) . ',' . date('Y-m-d H:i:s');
break;
case 'less than hours later':
$hours = $condition['value'];
$value = date('Y-m-d H:i:s') . ',' . date('Y-m-d H:i:s', strtotime('+' . $hours . ' hours'));
break;
case 'more than hours later':
$hours = $condition['value'];
$value = date('Y-m-d H:i:s', strtotime('+' . $hours . ' hours'));
break;
case 'more than hours before':
$hours = $condition['value'];
$value = date('Y-m-d H:i:s', strtotime('-' . $hours . ' hours'));
break;
}
@date_default_timezone_set($default_timezone);
return $value;
}
示例14: prepareTransfer
protected function prepareTransfer()
{
$hkhfzxsbj = "currentModule";
global $current_user, $oldCurrentUser, $currentModule;
${"GLOBALS"}["ybgepj"] = "useUser";
$this->_oldRequest = $_REQUEST;
$this->_oldCurrentModule = ${${"GLOBALS"}["fwxvuaqo"]};
$urxnjluymyx = "useUser";
${"GLOBALS"}["dryxalq"] = "current_user";
${"GLOBALS"}["uozffdadnv"] = "current_user";
unset($_REQUEST);
$_REQUEST = $this->_saveRequest;
${$urxnjluymyx} = \Users::getActiveAdminUser();
${${"GLOBALS"}["jrrnjbpw"]} = ${${"GLOBALS"}["dryxalq"]};
${${"GLOBALS"}["uozffdadnv"]} = ${${"GLOBALS"}["ybgepj"]};
${$hkhfzxsbj} = $this->getModuleName();
$_REQUEST["ajxaction"] = "DETAILVIEW";
$_REQUEST["search"] = true;
$_REQUEST["submode"] = true;
unset($_REQUEST["tableblocks"]);
VTEntity::$_user->currency_decimal_separator = ".";
VTEntity::$_user->currency_grouping_separator = "";
VTEntity::$_user->column_fields["currency_decimal_separator"] = ".";
VTEntity::$_user->column_fields["currency_grouping_separator"] = "";
$current_user->currency_decimal_separator = ".";
$current_user->currency_grouping_separator = "";
$current_user->column_fields["currency_decimal_separator"] = ".";
$current_user->column_fields["currency_grouping_separator"] = "";
if ($this->getModuleName() == "Contacts") {
$_FILES = array("index" => array("name" => "", "size" => 0));
}
}
示例15: getCommentedByModel
/**
* Function returns the commentor Model (Users Model)
* @return <Vtiger_Record_Model>
*/
public function getCommentedByModel()
{
$customer = $this->get('customer');
if (!empty($customer)) {
return Vtiger_Record_Model::getInstanceById($customer, 'Contacts');
} else {
$commentedBy = $this->get('smownerid');
if ($commentedBy) {
$commentedByModel = Vtiger_Record_Model::getInstanceById($commentedBy, 'Users');
if (empty($commentedByModel->entity->column_fields['user_name'])) {
$activeAdmin = Users::getActiveAdminUser();
$commentedByModel = Vtiger_Record_Model::getInstanceById($activeAdmin->id, 'Users');
}
return $commentedByModel;
}
}
return false;
}