コード例 #1
0
ファイル: TimeDateTest.php プロジェクト: nickpro/sugarcrm_dev
 public function testGetCalFormats()
 {
     $cal_tests = array(array("df" => "Y-m-d", "caldf" => "%Y-%m-%d", "tf" => "H:i:s", "caltf" => "%H:%M:%S"), array("df" => "d/m/Y", "caldf" => "%d/%m/%Y", "tf" => "h:i:sa", "caltf" => "%I:%M:%S%P"), array("df" => "m/d/Y", "caldf" => "%m/%d/%Y", "tf" => "H:i", "caltf" => "%H:%M"), array("df" => "Y-m-d", "caldf" => "%Y-%m-%d", "tf" => "h:iA", "caltf" => "%I:%M%p"));
     foreach ($cal_tests as $datetest) {
         $this->_setPrefs($datetest["df"], $datetest["tf"], "America/Los_Angeles");
         $this->assertEquals($datetest["caldf"], $this->time_date->get_cal_date_format(), "Bad cal date format for '{$datetest["df"]}'");
         $this->assertEquals($datetest["caltf"], $this->time_date->get_cal_time_format(), "Bad cal time format for '{$datetest["tf"]}'");
         $this->assertEquals($this->time_date->merge_date_time($datetest["caldf"], $datetest["caltf"]), $this->time_date->get_cal_date_time_format(), "Bad cal datetime format for '{$datetest["df"]} {$datetest["tf"]}'");
     }
 }
コード例 #2
0
global $current_user;
$xtpl->assign("PAYMENT_TERM", get_select_options_with_id($app_list_strings['payment_terms'], $focus->payment_term));
$productrows = $focus->getProductRows();
if (count($productrows) == 0) {
    $xtpl->assign("PRODUCTROWS", $focus->getProductRow(new PurchaseOrderLine(), 0, true));
    $xtpl->parse("main.row1");
}
for ($i = 0; $i < count($productrows); $i++) {
    $fieldcount = count($productrows[$i]);
    $xtpl->assign("PRODUCTROWS", $focus->getProductRow($productrows[$i], $i, true));
    $xtpl->parse("main.row1");
}
$xtpl->assign('PRODUCTCOUNT', count($productrows));
$xtpl->assign('PurchaseOrder', $xtpl_data);
$timedate = new TimeDate();
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
$xtpl->assign("USER_DATE_FORMAT", $timedate->get_user_date_format());
if (empty($focus->id)) {
    $focus->assigned_user_id = $current_user->id;
}
if (empty($focus->id)) {
    $focus->assigned_user_name = $current_user->user_name;
}
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->parse("main");
$xtpl->out("main");
require_once 'include/javascript/javascript.php';
$javascript = new javascript();
$javascript->setFormName('EditView');
コード例 #3
0
 function get_parameter_html($rp, $rpl)
 {
     global $app_strings;
     global $current_language, $current_user, $theme;
     $mod_strings = return_module_language($current_language, "ZuckerReportParameter");
     $mod_list_strings = return_mod_list_strings_language($current_language, "ZuckerReportParameter");
     $xtpl = new XTemplate('modules/ZuckerReportParameter/ParameterFill.html');
     $xtpl->assign("MOD", $mod_strings);
     $xtpl->assign("APP", $app_strings);
     $xtpl->assign("THEME", $theme);
     $selected_val = $rpl->default_value;
     if (!empty($_REQUEST[$rpl->name])) {
         $selected_val = $_REQUEST[$rpl->name];
     }
     if ($rp->range_name == 'SQL') {
         $param_table = $rp->get_sql_table();
         //asort($param_table);
         if (is_array($param_table)) {
             $xtpl->assign("PARAM_FRIENDLY_NAME", $rpl->friendly_name);
             $xtpl->assign("PARAM_NAME", $rpl->name);
             $xtpl->assign("PARAM_SELECTION", get_select_options_with_id($param_table, $selected_val));
             $xtpl->parse("SQL");
             $parameter_html = $xtpl->text("SQL");
         } else {
             $parameter_html = $param_table . "<br/>";
         }
     } else {
         if ($rp->range_name == 'LIST') {
             $list = $rp->get_list_table();
             asort($list);
             $xtpl->assign("PARAM_FRIENDLY_NAME", $rpl->friendly_name);
             $xtpl->assign("PARAM_NAME", $rpl->name);
             $xtpl->assign("PARAM_SELECTION", get_select_options_with_id($list, $selected_val));
             $xtpl->parse("LIST");
             $parameter_html = $xtpl->text("LIST");
         } else {
             if ($rp->range_name == 'DROPDOWN') {
                 $app_list_strings = return_app_list_strings_language($current_language);
                 $list = $rp->get_list_table();
                 $xtpl->assign("PARAM_FRIENDLY_NAME", $rpl->friendly_name);
                 $xtpl->assign("PARAM_NAME", $rpl->name);
                 asort($app_list_strings[$rp->range_options]);
                 $xtpl->assign("PARAM_SELECTION", get_select_options_with_id($app_list_strings[$rp->range_options], $selected_val));
                 $xtpl->parse("LIST");
                 $parameter_html = $xtpl->text("LIST");
             } else {
                 if ($rp->range_name == 'SIMPLE') {
                     $xtpl->assign("PARAM_FRIENDLY_NAME", $rpl->friendly_name);
                     $xtpl->assign("PARAM_NAME", $rpl->name);
                     $xtpl->assign("PARAM_VALUE", $selected_val);
                     $xtpl->parse("SIMPLE");
                     $parameter_html = $xtpl->text("SIMPLE");
                 } else {
                     if ($rp->range_name == 'DATE') {
                         $timedate = new TimeDate();
                         $xtpl->assign("PARAM_FRIENDLY_NAME", $rpl->friendly_name);
                         $xtpl->assign("PARAM_NAME", $rpl->name);
                         $xtpl->assign("PARAM_VALUE", $selected_val);
                         $xtpl->assign("CALENDAR_LANG", "en");
                         $xtpl->assign("USER_DATEFORMAT", '(' . $timedate->get_user_date_format() . ')');
                         $xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
                         $xtpl->parse("DATE");
                         $parameter_html = $xtpl->text("DATE");
                     } else {
                         if ($rp->range_name == 'DATE_ADD' || $rp->range_name == 'DATE_SUB') {
                             $xtpl->assign("PARAM_FRIENDLY_NAME", $rpl->friendly_name);
                             $xtpl->assign("PARAM_NAME", $rpl->name);
                             $xtpl->assign("PARAM_VALUE", $selected_val);
                             $arr = split("::", $selected_val);
                             if (count($arr) == 2) {
                                 $count = $arr[0];
                                 $type = $arr[1];
                             } else {
                                 $count = 0;
                                 $type = NULL;
                             }
                             $xtpl->assign("PARAM_VALUE_COUNT", $count);
                             asort($mod_list_strings['PARAM_DATE_TYPES']);
                             $xtpl->assign("PARAM_SELECTION", get_select_options_with_id($mod_list_strings['PARAM_DATE_TYPES'], $type));
                             $xtpl->parse("DATE_CALC");
                             $parameter_html = $xtpl->text("DATE_CALC");
                         }
                     }
                 }
             }
         }
     }
     return $parameter_html;
 }