/**
  * Get the full caption value for the slider with the 'hours' step type
  * @param Array dateArray
  * @param Boolean isLower
  * @return String
  */
 protected function getHoursCaption($dateArray, $isLower)
 {
     global $locale_info;
     $hours = $this->getAdjustedHoursValue($dateArray[3], $dateArray[4], $isLower);
     $dateArray[3] = $dateArray[4] = $dateArray[5] = 0;
     $dateArray = addHours($dateArray, $hours);
     $timeFormatString = str_replace($locale_info["LOCALE_STIME"] . "ss", "", $locale_info["LOCALE_STIMEFORMAT"]);
     return format_datetime_custom($dateArray, $timeFormatString);
 }
Exemplo n.º 2
0
 function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data)
 {
     global $locale_info;
     parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data);
     if ($fieldNum) {
         $this->cfield = "value" . $fieldNum . "_" . GoodFieldName($this->field) . '_' . $this->id;
     }
     echo '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="date' . $this->pageObject->pSetEdit->getDateEditType($this->field) . '">';
     if ($this->pageObject->pageType == PAGE_LIST) {
         $pSet = new ProjectSettings($this->pageObject->tName, PAGE_SEARCH);
     } else {
         $pSet = $this->pageObject->pSetEdit;
     }
     $tvalue = $value;
     $time = db2time($tvalue);
     if (!count($time)) {
         $time = array(0, 0, 0, 0, 0, 0);
     }
     $dp = 0;
     $hasImgCal = true;
     $showTime = $pSet->dateEditShowTime($this->field);
     switch ($pSet->getDateEditType($this->field)) {
         case EDIT_DATE_SIMPLE_INLINE:
             $hasImgCal = false;
         case EDIT_DATE_SIMPLE_DP:
             $ovalue = $value;
             if ($locale_info["LOCALE_IDATE"] == 1) {
                 $fmt = "dd" . $locale_info["LOCALE_SDATE"] . "MM" . $locale_info["LOCALE_SDATE"] . "yyyy";
             } else {
                 if ($locale_info["LOCALE_IDATE"] == 0) {
                     $fmt = "MM" . $locale_info["LOCALE_SDATE"] . "dd" . $locale_info["LOCALE_SDATE"] . "yyyy";
                 } else {
                     $fmt = "yyyy" . $locale_info["LOCALE_SDATE"] . "MM" . $locale_info["LOCALE_SDATE"] . "dd";
                 }
             }
             if ($showTime || $time[3] || $time[4] || $time[5]) {
                 $fmt .= " HH:mm:ss";
             }
             if ($time[0]) {
                 $ovalue = format_datetime_custom($time, $fmt);
             }
             $ovalue1 = $time[2] . "-" . $time[1] . "-" . $time[0];
             if ($showTime || $time[3] || $time[4] || $time[5]) {
                 $ovalue1 .= " " . $time[3] . ":" . $time[4] . ":" . $time[5];
             }
             // need to create date control object to use it with datePicker
             $ret = '<input id="' . $this->cfield . '" ' . $this->inputStyle . ' type="Text" name="' . $this->cfield . '" value="' . $ovalue . '">';
             $ret .= '<input id="ts' . $this->cfield . '" type="Hidden" name="ts' . $this->cfield . '" value="' . $ovalue1 . '">';
             if ($hasImgCal) {
                 $ret .= '&nbsp;<a href="#" id="imgCal_' . $this->cfield . '" data-icon="calendar" title="Click Here to Pick up the date" ></a>';
             }
             echo $ret;
             break;
         case EDIT_DATE_DD_INLINE:
         case EDIT_DATE_DD_DP:
             $dp = 1;
         case EDIT_DATE_DD:
             $controlWidth = $pSet->getControlWidth($this->field);
             if ($controlWidth > 0) {
                 $controlWidth -= 10;
                 $yearWidth = floor($controlWidth * 0.3);
                 $yearStyle = 'style="min-width: ' . $yearWidth . 'px; ';
                 $dayWidth = floor($controlWidth * 0.2);
                 $dayStyle = 'style="min-width: ' . $dayWidth . 'px; margin-right:5px;" ';
                 $mothWidth = $controlWidth - $yearWidth - $dayWidth;
                 $monthStyle = 'style="min-width: ' . $mothWidth . 'px; margin-right:5px;" ';
             } else {
                 $dayStyle = '';
                 $monthStyle = '';
                 $yearStyle = '';
             }
             $alt = ($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 ? 'alt="' . $this->strLabel . '" ' : '';
             $retday = '<select id="day' . $this->cfield . '" ' . $dayStyle . $alt . 'name="day' . $this->cfield . '" ></select>';
             $retmonth = '<select id="month' . $this->cfield . '" ' . $monthStyle . $alt . 'name="month' . $this->cfield . '" ></select>';
             $retyear = '<select id="year' . $this->cfield . '" ' . $yearStyle . $alt . 'name="year' . $this->cfield . '" ></select>';
             $space = $controlWidth > 0 ? '' : "&nbsp;";
             if ($locale_info["LOCALE_ILONGDATE"] == 1) {
                 $ret = $retday . $space . $retmonth . $space . $retyear;
             } else {
                 if ($locale_info["LOCALE_ILONGDATE"] == 0) {
                     $ret = $retmonth . $space . $retday . $space . $retyear;
                 } else {
                     $ret = $retyear . $space . $retmonth . $space . $retday;
                 }
             }
             if ($time[0] && $time[1] && $time[2]) {
                 $ret .= "<input id=\"" . $this->cfield . "\" type=hidden name=\"" . $this->cfield . "\" value=\"" . $time[0] . "-" . $time[1] . "-" . $time[2] . "\">";
             } else {
                 $ret .= "<input id=\"" . $this->cfield . "\" type=hidden name=\"" . $this->cfield . "\" value=\"\">";
             }
             // calendar handling for three DD
             if ($dp) {
                 $ret .= '&nbsp;<a href="#" id="imgCal_' . $this->cfield . '" data-icon="calendar" title="Click Here to Pick up the date"></a>' . '<input id="ts' . $this->cfield . '" type=hidden name="ts' . $this->cfield . '" value="' . $time[2] . '-' . $time[1] . '-' . $time[0] . '">';
             }
             echo $ret;
             break;
         default:
             //	case EDIT_DATE_SIMPLE:
             $ovalue = $value;
             if ($time[0]) {
                 if ($showTime || $time[3] || $time[4] || $time[5]) {
                     $ovalue = str_format_datetime($time);
                 } else {
                     $ovalue = format_shortdate($time);
                 }
             }
             echo '<input id="' . $this->cfield . '" type=text name="' . $this->cfield . '" ' . $this->inputStyle . ' value="' . runner_htmlspecialchars($ovalue) . '">';
     }
     $this->buildControlEnd($validate);
 }
Exemplo n.º 3
0
 function LogAddEvent($message, $description = "", $str_table = "")
 {
     global $globalEvents;
     $retval = true;
     $table = $str_table;
     $arr = array();
     if ($globalEvents->exists("OnAuditLog")) {
         $retval = $globalEvents->OnAuditLog($message, $this->params, $table, $arr, $arr, $arr);
     }
     if ($retval) {
         $fp = $this->CreateLogFile();
         $str = format_datetime_custom(db2time(now()), "MMM dd,yyyy") . chr(9) . format_datetime_custom(db2time(now()), "HH:mm:ss") . chr(9) . $params[0] . chr(9) . $params[1] . chr(9) . $table . chr(9) . $message . chr(9) . $description . "\r\n";
         if ($fp) {
             fputs($fp, $str);
             fclose($fp);
         }
     }
     return $retval;
 }
Exemplo n.º 4
0
 function UnlockAdmin($strtable, $keys, $startEdit)
 {
     $skeys = "";
     foreach ($keys as $ind => $val) {
         if (strlen($skeys)) {
             $skeys .= "&";
         }
         $skeys .= rawurlencode($val);
     }
     $sdate = now();
     if ($startEdit) {
         //	add a record - lock
         $this->TableObj->startdatetime = $sdate;
         $this->TableObj->confirmdatetime = $sdate;
         $this->TableObj->sessionid = session_id();
         $this->TableObj->table = $strtable;
         $this->TableObj->keys = $skeys;
         $this->TableObj->userid = $this->UserID;
         $this->TableObj->action = 1;
         $this->TableObj->Add();
     }
     //	delete all other locking records
     $rstmp = CustomQuery("delete from " . AddTableWrappers($this->lockTableName) . " where " . AddFieldWrappers("table") . "=" . db_prepare_string($strtable) . " and " . AddFieldWrappers("keys") . "=" . db_prepare_string($skeys) . " and " . AddFieldWrappers("action") . "=1 and " . AddFieldWrappers("sessionid") . "<>'" . session_id() . "' ");
     //	inform other users that their locking were removed by locking
     $rstmp = CustomQuery("delete from " . AddTableWrappers($this->lockTableName) . " where " . AddFieldWrappers("startdatetime") . "<'" . format_datetime_custom(adddays(db2time(now()), -2), "yyyy-MM-dd HH:mm:ss") . "' and " . AddFieldWrappers("action") . "=2");
     $this->TableObj->startdatetime = $sdate;
     $this->TableObj->confirmdatetime = $sdate;
     $this->TableObj->sessionid = session_id();
     $this->TableObj->table = $strtable;
     $this->TableObj->keys = $skeys;
     $this->TableObj->userid = $this->UserID;
     $this->TableObj->action = 2;
     $this->TableObj->Add();
 }
Exemplo n.º 5
0
/**
 * @intellisense
 */
function format_longdate($time)
{
    global $locale_info;
    return format_datetime_custom($time, $locale_info["LOCALE_SLONGDATE"]);
}
Exemplo n.º 6
0
/**
 * Get value for field edit as time and get dpTime settings
 * @param integer $convention - 24 or 12 hours format for timePicker
 * @param string $type - type of field
 * @param string $value - value of field
 * @param boolean $useTimePicker -  use timePicker or not
 * @return array
 */
function getValForTimePicker($type, $value, $locale)
{
    $val = "";
    $dbtime = array();
    if (IsDateFieldType($type)) {
        $dbtime = db2time($value);
        if (count($dbtime)) {
            $val = format_datetime_custom($dbtime, $locale);
        }
    } else {
        $arr = parsenumbers($value);
        if (count($arr)) {
            while (count($arr) < 3) {
                $arr[] = 0;
            }
            $dbtime = array(0, 0, 0, $arr[0], $arr[1], $arr[2]);
            $val = format_datetime_custom($dbtime, $locale);
        }
    }
    return array('val' => $val, 'dbTime' => $dbtime);
}
 /**
  * Get date-time formatted string
  * @param Array dateArray
  * @return String
  */
 protected function getDateTimeString($dateArray)
 {
     global $locale_info;
     //to avoid locale-specific formatting
     $formatString = $locale_info["LOCALE_SSHORTDATE"] . " HH:mm:ss";
     return format_datetime_custom($dateArray, $formatString);
 }
Exemplo n.º 8
0
 function UnlockAdmin($strtable, $keys, $startEdit)
 {
     $skeys = "";
     foreach ($keys as $ind => $val) {
         if (strlen($skeys)) {
             $skeys .= "&";
         }
         $skeys .= rawurlencode($val);
     }
     $sdate = now();
     if ($startEdit) {
         //	add a record - lock
         $this->insert($strtable, $sdate, $sdate, $skeys, session_id(), $this->UserID, 1);
     }
     //	delete all other locking records
     $where = $this->connection->addFieldWrappers("table") . "=" . $this->connection->prepareString($strtable) . " AND " . $this->connection->addFieldWrappers("keys") . "=" . $this->connection->prepareString($skeys) . " AND " . $this->connection->addFieldWrappers("action") . "=1 AND " . $this->connection->addFieldWrappers("sessionid") . "<>" . $this->connection->prepareString(session_id());
     $this->delete($where);
     //	inform other users that their locking were removed by locking
     $where = $this->connection->addFieldWrappers("startdatetime") . "<" . $this->connection->addDateQuotes(format_datetime_custom(adddays(db2time(now()), -2), "yyyy-MM-dd HH:mm:ss")) . " AND " . $this->connection->addFieldWrappers("action") . "=2";
     $this->delete($where);
     $this->insert($strtable, $sdate, $sdate, $skeys, session_id(), $this->UserID, 2);
 }