本文整理汇总了PHP中DateTimeField::convertToDBFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeField::convertToDBFormat方法的具体用法?PHP DateTimeField::convertToDBFormat怎么用?PHP DateTimeField::convertToDBFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeField
的用法示例。
在下文中一共展示了DateTimeField::convertToDBFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFields
function setFields(array $fieldNames, $required, $value)
{
require_once 'include/fields/DateTimeField.php';
foreach ($fieldNames as $ind => $fieldname) {
$fieldInfo = Webforms::getFieldInfo($this->getTargetModule(), $fieldname);
$fieldModel = new Webforms_Field_Model();
$fieldModel->setFieldName($fieldname);
$fieldModel->setNeutralizedField($fieldname, $fieldInfo['label']);
$field = Webforms::getFieldInfo('Leads', $fieldname);
if ($field['type']['name'] == 'date') {
$defaultvalue = DateTimeField::convertToDBFormat($value[$fieldname]);
} else {
if ($field['type']['name'] == 'boolean') {
if (in_array($fieldname, $required)) {
if (empty($value[$fieldname])) {
$defaultvalue = 'off';
} else {
$defaultvalue = 'on';
}
} else {
$defaultvalue = $value[$fieldname];
}
} else {
$defaultvalue = vtlib_purify($value[$fieldname]);
}
}
$fieldModel->setDefaultValue($defaultvalue);
if (!empty($required) && in_array($fieldname, $required)) {
$fieldModel->setRequired(1);
} else {
$fieldModel->setRequired(0);
}
$this->addField($fieldModel);
}
}
示例2: save
/**
* Save date
* @param <Object> $request
* @return true if saved, false otherwise
*/
public function save(Vtiger_Request $request)
{
$response = new Vtiger_Response();
$moduleName = 'Settings:' . $request->getModule();
try {
$id = $request->get('holidayId');
$date = DateTimeField::convertToDBFormat($request->get('holidayDate'));
$name = $request->get('holidayName');
$type = $request->get('holidayType');
if (empty($name) || empty($date)) {
$response->setResult(array('success' => false, 'message' => vtranslate('LBL_FILL_FORM_ERROR', $moduleName)));
} else {
if (!empty($id)) {
if (Settings_PublicHoliday_Module_Model::edit($id, $date, $name, $type)) {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_EDIT_DATE_OK', $moduleName)));
} else {
$response->setResult(array('success' => false, 'message' => vtranslate('LBL_EDIT_DATE_ERROR', $moduleName)));
}
} else {
if (Settings_PublicHoliday_Module_Model::save($date, $name, $type)) {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_NEW_DATE_OK', $moduleName)));
} else {
$response->setResult(array('success' => false, 'message' => vtranslate('LBL_NEW_DATE_ERROR', $moduleName)));
}
}
}
} catch (Exception $e) {
$response->setError($e->getCode(), $e->getMessage());
}
$response->emit();
}
示例3: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$modules = $request->get('modules');
$assignId = $request->get('assigned_user_id');
$currentUser = Users_Record_Model::getCurrentUserModel();
$entityValues = array();
$entityValues['transferRelatedRecordsTo'] = $request->get('transferModule');
//■権限なぜか、エラーになるので権限を固定するinouchi
//$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType($assignId), $assignId);
$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType(1), 1);
$entityValues['leadId'] = vtws_getWebserviceEntityId($request->getModule(), $recordId);
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $request->getModule());
$convertLeadFields = $recordModel->getConvertLeadFields();
$availableModules = array('Accounts', 'Contacts', 'Potentials');
foreach ($availableModules as $module) {
if (vtlib_isModuleActive($module) && in_array($module, $modules)) {
$entityValues['entities'][$module]['create'] = true;
$entityValues['entities'][$module]['name'] = $module;
foreach ($convertLeadFields[$module] as $fieldModel) {
$fieldName = $fieldModel->getName();
$fieldValue = $request->get($fieldName);
//Potential Amount Field value converting into DB format
if ($fieldModel->getFieldDataType() === 'currency') {
$fieldValue = Vtiger_Currency_UIType::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'date') {
$fieldValue = DateTimeField::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
$ids = vtws_getIdComponents($fieldValue);
if (count($ids) === 1) {
$fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
}
}
$entityValues['entities'][$module][$fieldName] = $fieldValue;
}
}
}
try {
$result = vtws_convertlead($entityValues, $currentUser);
} catch (Exception $e) {
$this->showError($request, $e);
exit;
}
if (!empty($result['Accounts'])) {
$accountIdComponents = vtws_getIdComponents($result['Accounts']);
$accountId = $accountIdComponents[1];
}
if (!empty($result['Contacts'])) {
$contactIdComponents = vtws_getIdComponents($result['Contacts']);
$contactId = $contactIdComponents[1];
}
if (!empty($accountId)) {
header("Location: index.php?view=Detail&module=Accounts&record={$accountId}");
} elseif (!empty($contactId)) {
header("Location: index.php?view=Detail&module=Contacts&record={$contactId}");
} else {
$this->showError($request);
exit;
}
}
示例4: vtSaveTask
function vtSaveTask($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("savetask");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$tm = new VTTaskManager($adb);
if (isset($request["task_id"])) {
$task = $tm->retrieveTask($request["task_id"]);
} else {
$taskType = vtlib_purifyForSql($request["task_type"]);
$workflowId = $request["workflow_id"];
$task = $tm->createTask($taskType, $workflowId);
}
$task->summary = $request["summary"];
if ($request["active"] == "true") {
$task->active = true;
} else {
if ($request["active"] == "false") {
$task->active = false;
}
}
if (isset($request['check_select_date'])) {
$trigger = array('days' => ($request['select_date_direction'] == 'after' ? 1 : -1) * (int) $request['select_date_days'], 'field' => $request['select_date_field']);
$task->trigger = $trigger;
} else {
$task->trigger = null;
}
$fieldNames = $task->getFieldNames();
foreach ($fieldNames as $fieldName) {
$task->{$fieldName} = $request[$fieldName];
if ($fieldName == 'calendar_repeat_limit_date') {
$task->{$fieldName} = DateTimeField::convertToDBFormat($request[$fieldName]);
}
}
$tm->saveTask($task);
if (isset(vtlib_purify($request["return_url"]))) {
$returnUrl = vtlib_purify($request["return_url"]);
} else {
$returnUrl = $module->editTaskUrl($task->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
示例5: saveScheduleReport
/**
* Function to save the Scheduled Reports data
*/
public function saveScheduleReport() {
$adb = PearDatabase::getInstance();
$reportid = $this->get('reportid');
$scheduleid = $this->get('scheduleid');
$schtime = $this->get('schtime');
if(!preg_match('/^[0-2]\d(:[0-5]\d){1,2}$/', $schtime) or substr($schtime,0,2)>23) { // invalid time format
$schtime='00:00';
}
$schtime .=':00';
$schdate = null; $schdayoftheweek = null; $schdayofthemonth = null; $schannualdates = null;
if ($scheduleid == self::$SCHEDULED_ON_SPECIFIC_DATE) {
$date = $this->get('schdate');
$dateDBFormat = DateTimeField::convertToDBFormat($date);
$nextTriggerTime = $dateDBFormat.' '.$schtime;
$currentTime = Vtiger_Util_Helper::getActiveAdminCurrentDateTime();
if($nextTriggerTime > $currentTime) {
$this->set('next_trigger_time', $nextTriggerTime);
} else {
$this->set('next_trigger_time', date('Y-m-d H:i:s', strtotime('+10 year')));
}
$schdate = Zend_Json::encode(array($dateDBFormat));
} else if ($scheduleid == self::$SCHEDULED_WEEKLY) {
$schdayoftheweek = Zend_Json::encode($this->get('schdayoftheweek'));
$this->set('schdayoftheweek', $schdayoftheweek);
} else if ($scheduleid == self::$SCHEDULED_MONTHLY_BY_DATE) {
$schdayofthemonth = Zend_Json::encode($this->get('schdayofthemonth'));
$this->set('schdayofthemonth', $schdayofthemonth);
} else if ($scheduleid == self::$SCHEDULED_ANNUALLY) {
$schannualdates = Zend_Json::encode($this->get('schannualdates'));
$this->set('schannualdates', $schannualdates);
}
$recipients = Zend_Json::encode($this->get('recipients'));
$specificemails = Zend_Json::encode($this->get('specificemails'));
$isReportScheduled = $this->get('isReportScheduled');
if($scheduleid != self::$SCHEDULED_ON_SPECIFIC_DATE) {
$nextTriggerTime = $this->getNextTriggerTime();
}
if ($isReportScheduled == '0' || $isReportScheduled == '' || $isReportScheduled == false) {
$deleteScheduledReportSql = "DELETE FROM vtiger_schedulereports WHERE reportid=?";
$adb->pquery($deleteScheduledReportSql, array($reportid));
} else {
$checkScheduledResult = $adb->pquery('SELECT 1 FROM vtiger_schedulereports WHERE reportid=?', array($reportid));
if ($adb->num_rows($checkScheduledResult) > 0) {
$scheduledReportSql = 'UPDATE vtiger_schedulereports SET scheduleid=?, recipients=?, schdate=?, schtime=?, schdayoftheweek=?, schdayofthemonth=?, schannualdates=?, specificemails=?, next_trigger_time=? WHERE reportid=?';
$adb->pquery($scheduledReportSql, array($scheduleid, $recipients, $schdate, $schtime, $schdayoftheweek, $schdayofthemonth, $schannualdates, $specificemails, $nextTriggerTime, $reportid));
} else {
$scheduleReportSql = 'INSERT INTO vtiger_schedulereports (reportid,scheduleid,recipients,schdate,schtime,schdayoftheweek,schdayofthemonth,schannualdates,next_trigger_time,specificemails) VALUES (?,?,?,?,?,?,?,?,?,?)';
$adb->pquery($scheduleReportSql, array($reportid, $scheduleid, $recipients, $schdate, $schtime, $schdayoftheweek, $schdayofthemonth, $schannualdates, $nextTriggerTime, $specificemails));
}
}
}
示例6: getValue
/**
* @param $value
* @param $name
* @param $type
* @param \Workflow\VTEntity $context
* @return \type
*/
public function getValue($value, $name, $type, $context)
{
if ($type == 'date') {
$value = \DateTimeField::convertToDBFormat($value);
}
if ($type == 'file') {
// var_dump($value, $name, $type, $_FILES, $this);
$context->addTempFile($_FILES['fileUpload']['tmp_name'][$name], $value, $_FILES['fileUpload']['name'][$name]);
return '1';
}
return $value;
}
示例7: track_email
function track_email($user_name, $password, $contact_ids, $date_sent, $email_subject, $email_body)
{
if (authentication($user_name, $password)) {
global $current_user;
global $adb;
global $log;
require_once 'modules/Users/Users.php';
require_once 'modules/Emails/Emails.php';
$current_user = new Users();
$user_id = $current_user->retrieve_user_id($user_name);
$query = "select email1 from vtiger_users where id =?";
$result = $adb->pquery($query, array($user_id));
$user_emailid = $adb->query_result($result, 0, "email1");
$current_user = $current_user->retrieveCurrentUserInfoFromFile($user_id);
$email = new Emails();
//$log->debug($msgdtls['contactid']);
$emailbody = str_replace("'", "''", $email_body);
$emailsubject = str_replace("'", "''", $email_subject);
$datesent = substr($date_sent, 1, 10);
$mydate = date('Y-m-d', $datesent);
$mydate = DateTimeField::convertToDBFormat($mydate);
$email->column_fields[subject] = $emailsubject;
$email->column_fields[assigned_user_id] = $user_id;
$email->column_fields[date_start] = $mydate;
$email->column_fields[description] = $emailbody;
$email->column_fields[activitytype] = 'Emails';
$email->plugin_save = true;
$email->save("Emails");
$query = "select fieldid from vtiger_field where fieldname = 'email' and tabid = 4 and vtiger_field.presence in (0,2)";
$result = $adb->pquery($query, array());
$field_id = $adb->query_result($result, 0, "fieldid");
$email->set_emails_contact_invitee_relationship($email->id, $contact_ids);
$email->set_emails_se_invitee_relationship($email->id, $contact_ids);
$email->set_emails_user_invitee_relationship($email->id, $user_id);
$sql = "select email from vtiger_contactdetails inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid where vtiger_crmentity.deleted =0 and vtiger_contactdetails.contactid=?";
$result = $adb->pquery($sql, array($contact_ids));
$camodulerow = $adb->fetch_array($result);
if (isset($camodulerow)) {
$emailid = $camodulerow["email"];
//added to save < as $lt; and > as > in the database so as to retrive the emailID
$user_emailid = str_replace('<', '<', $user_emailid);
$user_emailid = str_replace('>', '>', $user_emailid);
$query = 'insert into vtiger_emaildetails values (?,?,?,?,?,?,?,?)';
$params = array($email->id, $emailid, $user_emailid, "", "", "", $user_id . '@-1|' . $contact_ids . '@' . $field_id . '|', "THUNDERBIRD");
$adb->pquery($query, $params);
}
return $email->id;
}
}
示例8: process
public function process($ModuleName, $ID, $record_form, $config)
{
$projectmilestoneid = $record_form['projectmilestoneid'];
if (!isset($projectmilestoneid) || $projectmilestoneid == 0 || $projectmilestoneid == '') {
return array('save_record' => true);
}
$moduleModel = Vtiger_Record_Model::getInstanceById($projectmilestoneid, 'ProjectMilestone');
$projectMilestoneDate = $moduleModel->get('projectmilestonedate');
if (!isset($projectMilestoneDate) || $projectMilestoneDate == 0 || $projectMilestoneDate == '') {
return array('save_record' => true);
}
$dateField = new DateTimeField($projectMilestoneDate);
$projectMilestoneDateUserFormat = $dateField->convertToUserFormat($projectMilestoneDate);
$dateField = new DateTimeField($record_form['targetenddate']);
$targetEndDateUserFormat = $dateField->convertToDBFormat($record_form['targetenddate']);
if (strtotime($targetEndDateUserFormat) > strtotime($projectMilestoneDate)) {
return array('save_record' => false, 'type' => 0, 'info' => array('text' => vtranslate('Date can not be greater', 'DataAccess') . ' ( ' . $record_form['targetenddate'] . ' < ' . $projectMilestoneDateUserFormat . ')', 'type' => 'error'));
} else {
return array('save_record' => true);
}
}
示例9: foreach
$focus->retrieve_entity_info($record, 'Invoice');
$focus->name = $focus->column_fields['subject'];
}
} else {
if (isset($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'update_so_val') {
//Updating the Selected SO Value in Create Mode
foreach ($focus->column_fields as $fieldname => $val) {
if (isset($_REQUEST[$fieldname])) {
$value = $_REQUEST[$fieldname];
$focus->column_fields[$fieldname] = $value;
}
}
//Handling for dateformat in invoicedate vtiger_field
if ($focus->column_fields['invoicedate'] != '') {
$curr_due_date = $focus->column_fields['invoicedate'];
$focus->column_fields['invoicedate'] = DateTimeField::convertToDBFormat($curr_due_date);
}
$soid = $focus->column_fields['salesorder_id'];
$so_focus = new SalesOrder();
$so_focus->id = $soid;
$so_focus->retrieve_entity_info($soid, "SalesOrder");
$focus = getConvertSoToInvoice($focus, $so_focus, $soid);
// Reset the value w.r.t SalesOrder Selected
$currencyid = $so_focus->column_fields['currency_id'];
$rate = $so_focus->column_fields['conversion_rate'];
//Added to display the SO's associated products -- when we select SO in New Invoice page
if (isset($_REQUEST['salesorder_id']) && $_REQUEST['salesorder_id'] != '') {
$associated_prod = getAssociatedProducts("SalesOrder", $so_focus, $focus->column_fields['salesorder_id']);
}
$smarty->assign("SALESORDER_ID", $focus->column_fields['salesorder_id']);
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
示例10: unset
if ($_REQUEST[$allKeys[$i]] != "") {
$columnslist[] = $_REQUEST[$allKeys[$i]];
}
}
}
//<<<<<<<columns>>>>>>>>>
//<<<<<<<standardfilters>>>>>>>>>
$stdfiltercolumn = $_REQUEST["stdDateFilterField"];
$std_filter_list["columnname"] = $stdfiltercolumn;
$stdcriteria = $_REQUEST["stdDateFilter"];
$std_filter_list["stdfilter"] = $stdcriteria;
$startdate = $_REQUEST["startdate"];
$enddate = $_REQUEST["enddate"];
if ($stdcriteria == "custom") {
$startdate = DateTimeField::convertToDBFormat($startdate);
$enddate = DateTimeField::convertToDBFormat($enddate);
}
$std_filter_list["startdate"] = $startdate;
$std_filter_list["enddate"] = $enddate;
if (empty($startdate) && empty($enddate)) {
unset($std_filter_list);
}
//<<<<<<<standardfilters>>>>>>>>>
//<<<<<<<advancedfilter>>>>>>>>>
$json = new Zend_Json();
$advft_criteria = $_REQUEST['advft_criteria'];
$advft_criteria = $json->decode($advft_criteria);
$advft_criteria_groups = $_REQUEST['advft_criteria_groups'];
$advft_criteria_groups = $json->decode($advft_criteria_groups);
//<<<<<<<advancedfilter>>>>>>>>
$moduleHandler = vtws_getModuleHandlerFromName($cvmodule, $current_user);
示例11: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$summary = $request->get('summary');
$moduleName = $request->get('module_name');
$conditions = $request->get('conditions');
$filterSavedInNew = $request->get('filtersavedinnew');
$executionCondition = $request->get('execution_condition');
if ($recordId) {
$workflowModel = Settings_Workflows_Record_Model::getInstance($recordId);
} else {
$workflowModel = Settings_Workflows_Record_Model::getCleanInstance($moduleName);
}
$response = new Vtiger_Response();
$workflowModel->set('summary', $summary);
$workflowModel->set('module_name', $moduleName);
$workflowModel->set('conditions', $conditions);
$workflowModel->set('execution_condition', $executionCondition);
if ($executionCondition == '6') {
$schtime = $request->get("schtime");
if (!preg_match('/^[0-2]\\d(:[0-5]\\d){1,2}$/', $schtime) or substr($schtime, 0, 2) > 23) {
// invalid time format
$schtime = '00:00';
}
$schtime .= ':00';
$workflowModel->set('schtime', $schtime);
$workflowScheduleType = $request->get('schtypeid');
$workflowModel->set('schtypeid', $workflowScheduleType);
$dayOfMonth = null;
$dayOfWeek = null;
$month = null;
$annualDates = null;
if ($workflowScheduleType == Workflow::$SCHEDULED_WEEKLY) {
$dayOfWeek = Zend_Json::encode($request->get('schdayofweek'));
} else {
if ($workflowScheduleType == Workflow::$SCHEDULED_MONTHLY_BY_DATE) {
$dayOfMonth = Zend_Json::encode($request->get('schdayofmonth'));
} else {
if ($workflowScheduleType == Workflow::$SCHEDULED_ON_SPECIFIC_DATE) {
$date = $request->get('schdate');
$dateDBFormat = DateTimeField::convertToDBFormat($date);
$nextTriggerTime = $dateDBFormat . ' ' . $schtime;
$currentTime = Vtiger_Util_Helper::getActiveAdminCurrentDateTime();
if ($nextTriggerTime > $currentTime) {
$workflowModel->set('nexttrigger_time', $nextTriggerTime);
} else {
$workflowModel->set('nexttrigger_time', date('Y-m-d H:i:s', strtotime('+10 year')));
}
$annualDates = Zend_Json::encode(array($dateDBFormat));
} else {
if ($workflowScheduleType == Workflow::$SCHEDULED_ANNUALLY) {
$annualDates = Zend_Json::encode($request->get('schannualdates'));
}
}
}
}
$workflowModel->set('schdayofmonth', $dayOfMonth);
$workflowModel->set('schdayofweek', $dayOfWeek);
$workflowModel->set('schannualdates', $annualDates);
}
// Added to save the condition only when its changed from vtiger6
if ($filterSavedInNew == '6') {
//Added to change advanced filter condition to workflow
$workflowModel->transformAdvanceFilterToWorkFlowFilter();
}
$workflowModel->set('filtersavedinnew', $filterSavedInNew);
$workflowModel->save();
//Update only for scheduled workflows other than specific date
if ($workflowScheduleType != Workflow::$SCHEDULED_ON_SPECIFIC_DATE && $executionCondition == '6') {
$workflowModel->updateNextTriggerTime();
}
$response->setResult(array('id' => $workflowModel->get('workflow_id')));
$response->emit();
}
示例12: updateInfo
/**
* This function is used to get the days in between the current time and the modified time of an entity .
* Takes the input parameter as $id - crmid it will calculate the number of days in between the
* the current time and the modified time from the vtiger_crmentity vtiger_table and return the result as a string.
* The return format is updated <No of Days> day ago <(date when updated)>
*/
function updateInfo($id)
{
global $log;
$log->debug("Entering updateInfo(" . $id . ") method ...");
global $adb;
global $app_strings;
$query = 'SELECT modifiedtime, modifiedby FROM vtiger_crmentity WHERE crmid = ?';
$result = $adb->pquery($query, array($id));
$modifiedtime = $adb->query_result($result, 0, 'modifiedtime');
$modifiedby_id = $adb->query_result($result, 0, 'modifiedby');
$modifiedby = $app_strings['LBL_BY'] . getOwnerName($modifiedby_id);
$date = new DateTimeField($modifiedtime);
$modifiedtime = DateTimeField::convertToDBFormat($date->getDisplayDate());
$current_time = date('Y-m-d H:i:s');
$values = explode(' ', $modifiedtime);
$date_info = explode('-', $values[0]);
$time_info = explode(':', $values[1]);
$date = $date_info[2] . ' ' . $app_strings[date("M", mktime(0, 0, 0, $date_info[1], $date_info[2], $date_info[0]))] . ' ' . $date_info[0];
$time_modified = strtotime($modifiedtime);
$time_now = strtotime($current_time);
$days_diff = (int) (($time_now - $time_modified) / (60 * 60 * 24));
if ($days_diff == 0) {
$update_info = $app_strings['LBL_UPDATED_TODAY'] . " (" . $date . ")" . ' ' . $modifiedby;
} elseif ($days_diff == 1) {
$update_info = $app_strings['LBL_UPDATED'] . " " . $days_diff . " " . $app_strings['LBL_DAY_AGO'] . " (" . $date . ")" . ' ' . $modifiedby;
} else {
$update_info = $app_strings['LBL_UPDATED'] . " " . $days_diff . " " . $app_strings['LBL_DAYS_AGO'] . " (" . $date . ")" . ' ' . $modifiedby;
}
$log->debug("Exiting updateInfo method ...");
return $update_info;
}
示例13: vtlib_purify
if (isset($_REQUEST['month']) && is_numeric(vtlib_purify($_REQUEST['month']))) {
$date_data['month'] = vtlib_purify($_REQUEST['month']);
}
if (isset($_REQUEST['week']) && is_numeric(vtlib_purify($_REQUEST['week']))) {
$date_data['week'] = vtlib_purify($_REQUEST['week']);
}
if (isset($_REQUEST['year']) && is_numeric(vtlib_purify($_REQUEST['year']))) {
if ($_REQUEST['year'] > 2037 || $_REQUEST['year'] < 1970) {
print "<font color='red'>" . $app_strings['LBL_CAL_LIMIT_MSG'] . "</font>";
exit;
}
$date_data['year'] = vtlib_purify($_REQUEST['year']);
}
if (empty($date_data)) {
$dateTimeField = new DateTimeField('');
$dateValue = $dateTimeField->getDisplayDate();
$timeValue = $dateTimeField->getDisplayTime();
$dbDateValue = DateTimeField::convertToDBFormat($dateValue);
$dateValueArray = explode('-', $dbDateValue);
$timeValueArray = explode(':', $timeValue);
$date_data = array('day' => $dateValueArray[2], 'month' => $dateValueArray[1], 'year' => $dateValueArray[0], 'hour' => $timeValueArray[0], 'min' => $timeValueArray[1]);
}
$calendar_arr['calendar'] = new Calendar($mysel, $date_data);
if ($current_user->hour_format != '') {
$calendar_arr['calendar']->hour_format = $current_user->hour_format;
}
if ($viewBox == 'hourview' && ($mysel == 'day' || $mysel == 'week' || $mysel == 'month' || $mysel == 'year')) {
$calendar_arr['calendar']->add_Activities($current_user);
}
$calendar_arr['view'] = $mysel;
calendar_layout($calendar_arr, $viewBox, $subtab);
示例14: generateAdvFilterSql
//.........这里部分代码省略.........
if (!empty($columncondition)) {
$advfiltergroupsql .= ' ' . $columncondition . ' ';
}
$this->queryPlanner->addTable($selectedFields[0]);
}
continue;
}
$selectedfields = explode(":", $fieldcolname);
$moduleFieldLabel = $selectedfields[2];
list($moduleName, $fieldLabel) = explode('__', $moduleFieldLabel, 2);
$fieldInfo = getFieldByReportLabel($moduleName, $fieldLabel);
$concatSql = getSqlForNameInDisplayFormat(array('first_name' => $selectedfields[0] . ".first_name", 'last_name' => $selectedfields[0] . ".last_name"), 'Users');
// Added to handle the crmentity table name for Primary module
if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) {
$selectedfields[0] = "vtiger_crmentity";
}
//Added to handle yes or no for checkbox field in reports advance filters. -shahul
if ($selectedfields[4] == 'C') {
if (strcasecmp(trim($value), "yes") == 0) {
$value = "1";
}
if (strcasecmp(trim($value), "no") == 0) {
$value = "0";
}
}
if (in_array($comparator, $dateSpecificConditions)) {
$customView = new CustomView($moduleName);
$columninfo['stdfilter'] = $columninfo['comparator'];
$valueComponents = explode(',', $columninfo['value']);
if ($comparator == 'custom') {
if ($selectedfields[4] == 'DT') {
$startDateTimeComponents = explode(' ', $valueComponents[0]);
$endDateTimeComponents = explode(' ', $valueComponents[1]);
$columninfo['startdate'] = DateTimeField::convertToDBFormat($startDateTimeComponents[0]);
$columninfo['enddate'] = DateTimeField::convertToDBFormat($endDateTimeComponents[0]);
} else {
$columninfo['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$columninfo['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($columninfo);
$startDate = DateTimeField::convertToDBFormat($dateFilterResolvedList['startdate']);
$endDate = DateTimeField::convertToDBFormat($dateFilterResolvedList['enddate']);
$columninfo['value'] = $value = implode(',', array($startDate, $endDate));
$comparator = 'bw';
}
$valuearray = explode(",", trim($value));
$datatype = isset($selectedfields[4]) ? $selectedfields[4] : "";
if (isset($valuearray) && count($valuearray) > 1 && $comparator != 'bw') {
$advcolumnsql = "";
for ($n = 0; $n < count($valuearray); $n++) {
if (($selectedfields[0] == "vtiger_users" . $this->primarymodule || $selectedfields[0] == "vtiger_users" . $this->secondarymodule) && $selectedfields[1] == 'user_name') {
$module_from_tablename = str_replace("vtiger_users", "", $selectedfields[0]);
$advcolsql[] = " (trim({$concatSql})" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype) . " or vtiger_groups" . $module_from_tablename . ".groupname " . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype) . ")";
$this->queryPlanner->addTable("vtiger_groups" . $module_from_tablename);
} elseif ($selectedfields[1] == 'status') {
//when you use comma seperated values.
if ($selectedfields[2] == 'Calendar_Status') {
$advcolsql[] = "(case when (vtiger_activity.status not like '') then vtiger_activity.status else vtiger_activity.eventstatus end)" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype);
} else {
if ($selectedfields[2] == 'HelpDesk_Status') {
$advcolsql[] = "vtiger_troubletickets.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype);
} else {
if ($selectedfields[2] == 'Faq_Status') {
$advcolsql[] = "vtiger_faq.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype);
} else {
示例15: parseAdvFilterList
public function parseAdvFilterList($advFilterList, $glue = '')
{
if (!empty($glue)) {
$this->addConditionGlue($glue);
}
$customView = new CustomView($this->module);
$dateSpecificConditions = $customView->getStdFilterConditions();
foreach ($advFilterList as $groupindex => $groupcolumns) {
$filtercolumns = $groupcolumns['columns'];
if (count($filtercolumns) > 0) {
$this->startGroup('');
foreach ($filtercolumns as $index => $filter) {
$nameComponents = explode(':', $filter['columnname']);
// For Events "End Date & Time" field datatype should be DT. But, db will give D for due_date field
if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') {
$nameComponents[4] = 'DT';
}
if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
$name = $this->getSQLColumn('id');
} else {
$name = $nameComponents[2];
}
if (($nameComponents[4] == 'D' || $nameComponents[4] == 'DT') && in_array($filter['comparator'], $dateSpecificConditions)) {
$filter['stdfilter'] = $filter['comparator'];
$valueComponents = explode(',', $filter['value']);
if ($filter['comparator'] == 'custom') {
if ($nameComponents[4] == 'DT') {
$startDateTimeComponents = explode(' ', $valueComponents[0]);
$endDateTimeComponents = explode(' ', $valueComponents[1]);
$filter['startdate'] = DateTimeField::convertToDBFormat($startDateTimeComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($endDateTimeComponents[0]);
} else {
$filter['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($filter);
// If datatype is DT then we should append time also
if ($nameComponents[4] == 'DT') {
$startdate = explode(' ', $dateFilterResolvedList['startdate']);
if ($startdate[1] == '') {
$startdate[1] = '00:00:00';
}
$dateFilterResolvedList['startdate'] = $startdate[0] . ' ' . $startdate[1];
$enddate = explode(' ', $dateFilterResolvedList['enddate']);
if ($enddate[1] == '') {
$enddate[1] = '23:59:59';
}
$dateFilterResolvedList['enddate'] = $enddate[0] . ' ' . $enddate[1];
}
$value = array();
$value[] = $this->fixDateTimeValue($name, $dateFilterResolvedList['startdate']);
$value[] = $this->fixDateTimeValue($name, $dateFilterResolvedList['enddate'], false);
$this->addCondition($name, $value, 'BETWEEN');
} else {
if ($nameComponents[4] == 'DT' && ($filter['comparator'] == 'e' || $filter['comparator'] == 'n')) {
$filter['stdfilter'] = $filter['comparator'];
$dateTimeComponents = explode(' ', $filter['value']);
$filter['startdate'] = DateTimeField::convertToDBFormat($dateTimeComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($dateTimeComponents[0]);
$startDate = $this->fixDateTimeValue($name, $filter['startdate']);
$endDate = $this->fixDateTimeValue($name, $filter['enddate'], false);
$value = array();
$start = explode(' ', $startDate);
if ($start[1] == "") {
$startDate = $start[0] . ' ' . '00:00:00';
}
$end = explode(' ', $endDate);
if ($end[1] == "") {
$endDate = $end[0] . ' ' . '23:59:59';
}
$value[] = $startDate;
$value[] = $endDate;
if ($filter['comparator'] == 'n') {
$this->addCondition($name, $value, 'NOTEQUAL');
} else {
$this->addCondition($name, $value, 'BETWEEN');
}
} else {
if ($nameComponents[4] == 'DT' && ($filter['comparator'] == 'a' || $filter['comparator'] == 'b')) {
$dateTime = explode(' ', $filter['value']);
$date = DateTimeField::convertToDBFormat($dateTime[0]);
$value = array();
$value[] = $this->fixDateTimeValue($name, $date, false);
// Still fixDateTimeValue returns only date value, we need to append time because it is DT type
for ($i = 0; $i < count($value); $i++) {
$values = explode(' ', $value[$i]);
if ($values[1] == '') {
$values[1] = '00:00:00';
}
$value[$i] = $values[0] . ' ' . $values[1];
}
$this->addCondition($name, $value, $filter['comparator']);
} else {
$this->addCondition($name, $filter['value'], $filter['comparator']);
}
}
}
$columncondition = $filter['column_condition'];
if (!empty($columncondition)) {
//.........这里部分代码省略.........