Пример #1
0
/**
 * Frontendausgabe CMS:tag date
 *
 * @Args: int type_container -> id von cms:tag <cms:lay type="container" id="XX" />
 *        int type_number  -> Entspricht der Verdopplungsid eines Containers
 *        int type_typenumber -> Eindeutige Id des Contents
 *        array $type_config -> Attribute und deren Werte des cms:tags
 * @Return String Content
 * @Access public
 */
function type_output_date($type_container, $type_number, $type_typenumber, $type_config)
{
    global $sess, $cfg_cms, $cfg_client, $idcatside, $mod_lang, $content, $cms_side;
    global $cms_edittype, $cms_mod, $con_side, $cms_path, $core_bbcode;
    //catch vars and arrays from the tag attributes
    eval(_type_get_dynamic_val_string($type_config));
    // Content aus Array holen
    $mod_content = is_array($content[$type_container][$type_number]) ? $content[$type_container][$type_number]['18'][$type_typenumber]['1'] : '';
    // Wenn Default Format angefordert wird
    if (empty($mod_content) || $mod_content == "") {
        $mod_content = "";
    } else {
        if (empty($type_config['mode']) || $type_config['mode'] == 'default-cms-format') {
            $mod_content = date($cfg_cms['FormatDate'] . ' ' . $cfg_cms['FormatTime'], $mod_content);
        } elseif (empty($type_config['mode']) || $type_config['mode'] == 'default-cms-date-format') {
            $mod_content = date($cfg_cms['FormatDate'], $mod_content);
        } elseif (empty($type_config['mode']) || $type_config['mode'] == 'default-cms-time-format') {
            $mod_content = date($cfg_cms['FormatTime'], $mod_content);
        } elseif ($type_config['mode'] == 'timestamp') {
            $mod_content = $mod_content;
        } else {
            $mod_content = date($type_config['mode'], $mod_content);
        }
    }
    // make global edit_all url
    if (_type_check_editall($cms_side, $type_config)) {
        $cms_edittype[$type_container][$type_number][] = '18-' . $type_typenumber;
    }
    // Editiermodus
    if (_type_check_editable($cms_side['edit'], $type_config['editable'], $cms_side['view'], isset($cms_side['edit_all'])) && $type_config['menuoptions'] != 'false') {
        $title = empty($type_config['title']) ? $mod_lang['type_date'] : $type_config['title'];
        // advanced Modus
        if ($type_config['menuoptions'] == 'advanced') {
            $new = false;
            $delete = false;
            $up = false;
            $down = false;
            // neu anlegen & loeschen
            if ($type_number != '1' || $mod_content != '') {
                $new = true;
                $delete = true;
            }
            // nach oben verschieben
            if ($type_number != '1') {
                $up = true;
            }
            // nach unten verschieben
            if ($mod_content != '' && $cms_mod['modul']['lastentry'] != 'true') {
                $down = true;
            }
        }
        $ids[] = 18;
        $infos = array('container_number' => $type_container, 'cmstag_id' => $type_typenumber, 'mod_repeat_id' => $type_number, 'title' => $title, 'base_url' => $con_side[$idcatside]['link'], 'mode' => $type_config['menuoptions']);
        //menu erstellen
        $mod = _type_get_layer_menu($ids, $infos, $delete, $new, $up, $down);
        //Wenn nur editbutton gefordert - Ausgabe BACKEND
        if ($type_config['mode'] == 'editbutton') {
            return $mod;
        }
        //Content mit Editbutton erzeugen
        $mod = $mod_content . $mod;
    } else {
        $mod = $mod_content;
    }
    //Frontend: wenn Editbutton
    if ($type_config['mode'] == 'editbutton') {
        return;
    }
    // Style
    $css = _type_get_style($type_config['styleclass'], $type_config['styleid'], $type_config['styledb']);
    $css['type'] = trim($css['type']);
    if (!empty($css['type'])) {
        $mod = '<span ' . $css['fullstyle'] . '>' . $mod . '</span>';
    }
    return $mod;
}
Пример #2
0
 function flex2_edit_menu($title, $full_edit_link, $first, $last, $group)
 {
     global $modv;
     $modinfo = sf_api('LIB', 'Modinfo');
     $cfg = sf_api('LIB', 'Config');
     $idcatside = $cfg->env('idcatside');
     $returnediticon = false;
     $flex2_title = $title;
     $flex2_type_config = "advanced";
     if (_type_check_editable($group) || !_type_check_editable($group) && $modv['MOD_VALUE_1001'] == 'true') {
         $flex2_full_edit_link = $full_edit_link;
         $returnediticon = true;
     } else {
         $flex2_full_edit_link = '';
     }
     $flex2_new = false;
     if (_type_check_editable($group) || !_type_check_editable($group) && $modv['MOD_VALUE_1002'] == 'true') {
         $flex2_delete = true;
         $returnediticon = true;
     }
     if (_type_check_editable($group) || !_type_check_editable($group) && $modv['MOD_VALUE_1003'] == 'true') {
         $flex2_up = !$first;
         $flex2_down = !$last;
         $returnediticon = true;
     }
     // preserve include file backward compatibility (ContentFlex module output code versions < 1.3.5)
     if (empty($modv['MOD_VALUE_1001']) && empty($modv['MOD_VALUE_1002']) && empty($modv['MOD_VALUE_1003'])) {
         $flex2_new = false;
         $flex2_delete = true;
         $flex2_up = !$first;
         $flex2_down = !$last;
         $flex2_ids = array(NULL);
         $returnediticon = true;
     }
     if ($returnediticon === TRUE) {
         $flex2_ids = array(NULL);
         $flex2_infos = array('container_number' => $modinfo->getIdContainer(), 'pre_compiled' => $flex2_full_edit_link, 'mod_repeat_id' => $modinfo->getEntryNr(), 'title' => $flex2_title, 'base_url' => 'cms://idcatside=' . $idcatside, 'mode' => $flex2_type_config);
         //menu erstellen
         $layer_menu = _type_get_layer_menu($flex2_ids, $flex2_infos, $flex2_delete, $flex2_new, $flex2_up, $flex2_down);
         return $layer_menu;
     }
     return '';
 }
Пример #3
0
/**
* Returns complete formatted date
* 
* @Args : formname -> name of the inputfield
*         content -> value of textfield
*         type_config -> array with values from the CMS:tag
*         cms_side['view'] -> the current view of the user, 'edit' or 'preview'
*                  ['edit'] -> 'true' if user set the mod in templateconfig as active
*                              if user set inactiv var is not set
* @Return String HTML fields
* @Access public 
*/
function type_form_date($formname, $content, $type_config, $cms_side)
{
    global $cfg_cms, $sess;
    include_once 'HTML/QuickForm.php';
    if (!_type_check_editable($cms_side['edit'], $type_config['editable'], $cms_side['view'])) {
        return _type_get_element_hidden($formname, $content);
    }
    if (empty($content)) {
        $content = time();
    }
    $optionfields = "";
    // Datumsangaben für Ausgabe formatieren
    if (!(empty($type_config['formdateformat']) || $type_config['formdateformat'] == '')) {
        if ($type_config['formdateformat'] == "default-cms-date-format") {
            $type_config['formdateformat'] = $cfg_cms['FormatDate'];
        }
        if ($type_config['formdateformat'] == "default-cms-time-format") {
            $type_config['formdateformat'] = $cfg_cms['FormatTime'];
        }
        if ($type_config['formdateformat'] == "default-cms-format") {
            $type_config['formdateformat'] = $cfg_cms['FormatDate'] . " " . $cfg_cms['FormatTime'];
        }
        $form = new HTML_QuickForm('');
        $form->setDefaults(array($formname => $content));
        $dateOptions = array('format' => $type_config['formdateformat'], 'language' => 'de', 'optionIncrement' => array('i' => 5));
        $contentYear = date("Y", $content);
        if (!empty($type_config['minyear'])) {
            $dateOptions['minYear'] = $type_config['minyear'];
        } else {
            $dateOptions['minYear'] = date("Y") - 5;
        }
        if ($dateOptions['minYear'] > $contentYear) {
            $dateOptions['minYear'] = $contentYear;
        }
        if (!empty($type_config['maxyear'])) {
            $dateOptions['maxYear'] = $type_config['maxyear'];
        } else {
            $dateOptions['maxYear'] = date("Y") + 5;
        }
        if ($dateOptions['maxYear'] < $contentYear) {
            $dateOptions['maxYear'] = $contentYear;
        }
        $form->addElement('date', $formname, 'Date2:', $dateOptions);
        $temp_fileds = $form->toArray();
        $optionfields .= $temp_fileds[elements][0][html];
        $optionfields .= '&nbsp;&nbsp;' . date($type_config['formdateformat'], $content);
    } else {
        $type_config['formdateformat'] = 'd.m.Y';
        $startdate = date($type_config['formdateformat'], $content);
        $content = getdate($content);
        // Datumsangaben für Ausgabe formatieren
        $optionfields .= _type_get_element_hidden($formname . '[0]', 'd.m.Y');
        $optionfields .= '<input type="text" id="' . $formname . '" name="' . $formname . '[1]" value="' . $startdate . '" size="10" maxlength="10" style="width: 85px;">';
        $optionfields .= '&nbsp;
    	<script language="JavaScript1.2">
        function callback_' . $formname . '(date, month, year)
        {
            if (String(month).length == 1) {
                month = "0" + month;
            }
        
            if (String(date).length == 1) {
                date = "0" + date;
            }    
            document.getElementById("' . $formname . '").value = date + "." + month + "." + year;
        }
    	  calendar' . $formname . ' = new dynCalendar("calendar' . $formname . '", "callback_' . $formname . '", "' . $cfg_cms['cms_html_path'] . '/tpl/standard/img/");
    	  calendar' . $formname . '.setMonthCombo(true);
    	  calendar' . $formname . '.setYearCombo(true);
    	</script>';
        $optionfields .= '&nbsp;&nbsp;dd.mm.yyyy';
        $optionfields .= '&nbsp;&nbsp;' . date($type_config['formdateformat']);
    }
    return '<td>
          ' . $optionfields . '
        </td>' . "\n";
}
 function flex2_edit_menu($title, $full_edit_link, $first, $last, $group)
 {
     global $cms_mod, $con_side, $idcatside, $perm, $modv;
     $returnediticon = false;
     $flex2_title = $title;
     $flex2_type_config = "advanced";
     if (_type_check_editable(true, $group, 'edit') || !_type_check_editable(true, $group, 'edit') && $modv['MOD_VALUE_1001'] == 'true') {
         $flex2_full_edit_link = $full_edit_link;
         $returnediticon = true;
     } else {
         $flex2_full_edit_link = '';
     }
     $flex2_new = false;
     if (_type_check_editable(true, $group, 'edit') || !_type_check_editable(true, $group, 'edit') && $modv['MOD_VALUE_1002'] == 'true') {
         $flex2_delete = true;
         $returnediticon = true;
     }
     if (_type_check_editable(true, $group, 'edit') || !_type_check_editable(true, $group, 'edit') && $modv['MOD_VALUE_1003'] == 'true') {
         $flex2_up = !$first;
         $flex2_down = !$last;
         $returnediticon = true;
     }
     // preserve include file backward compatibility (ContentFlex module output code versions < 1.3.5)
     if (empty($modv['MOD_VALUE_1001']) && empty($modv['MOD_VALUE_1002']) && empty($modv['MOD_VALUE_1003'])) {
         $flex2_new = false;
         $flex2_delete = true;
         $flex2_up = !$first;
         $flex2_down = !$last;
         $flex2_ids = array(NULL);
         $returnediticon = true;
     }
     if ($returnediticon === true) {
         $flex2_ids = array(NULL);
         $flex2_infos = array('container_number' => $cms_mod['container']['id'], 'pre_compiled' => $flex2_full_edit_link, 'mod_repeat_id' => $cms_mod['modul']['id'], 'title' => $flex2_title, 'base_url' => $con_side[$idcatside]['link'], 'mode' => $flex2_type_config);
         //menu erstellen
         $layer_menu = _type_get_layer_menu($flex2_ids, $flex2_infos, $flex2_delete, $flex2_new, $flex2_up, $flex2_down);
         return $layer_menu;
     } else {
         return '';
     }
 }
Пример #5
0
/**
* Returns complete formatted date
* 
* @Args : formname -> name of the inputfield
*         content -> value of textfield
*         type_config -> array with values from the CMS:tag
*         cms_side['view'] -> the current view of the user, 'edit' or 'preview'
*                  ['edit'] -> 'true' if user set the mod in templateconfig as active
*                              if user set inactiv var is not set
* @Return String HTML fields
* @Access public 
*/
function type_form_date($formname, $content, $type_config)
{
    global $cfg_cms, $sess;
    if (!_type_check_editable($type_config['editable'])) {
        return _type_get_element_hidden($formname, $content);
    }
    if (empty($content)) {
        $content = time();
    }
    $startdate = date($cfg_cms['format_date'], $content);
    $starttime = date($cfg_cms['format_time'], $content);
    $content = getdate($content);
    $optionfields = "";
    $optionfields .= _type_get_element_hidden($formname . '[0]', $cfg_cms['format_date']);
    $optionfields .= '<input type="text" id="' . $formname . '_1" name="' . $formname . '[1]" value="' . $startdate . '" size="10" maxlength="10" style="width: 85px;" class="sfDatepicker">';
    $optionfields .= '&nbsp;';
    $optionfields .= _type_get_element_hidden($formname . '[2]', $cfg_cms['format_time']);
    $optionfields .= '<input type="text" id="' . $formname . '_3" name="' . $formname . '[3]" value="' . $starttime . '" size="8" maxlength="8" style="width: 55px;">';
    return '<td>
          ' . $optionfields . '
        </td>' . "\n";
}