function _get_select()
 {
     $exclude = array();
     $wlk = $this->_tree_walk_preorder($this->node);
     while (!$wlk['recset']->EOF) {
         $row = $wlk['recset']->fields;
         $exclude[$row['id']] = 'yes';
         $wlk['recset']->MoveNext();
     }
     $mySelect = new CHAW_select($this->key);
     $node = $this->_tree_get_group_root_node($this->usergroup);
     $attributes = array('name');
     $wlk = $this->_tree_walk_preorder($node);
     while ($curr = $this->_tree_walk_next($wlk)) {
         $level = $this->_tree_walk_level($wlk);
         $spaces = str_repeat('--', $level - 1);
         $att = reset($attributes);
         while ($att) {
             if ($level == 0) {
                 $mySelect->add_option('(seleziona cartella)', $wlk['row']['id']);
             } elseif ($wlk['row']['file'] == '' && !isset($exclude[$wlk['row']['id']])) {
                 $mySelect->add_option($spaces . $wlk['row'][$att], $wlk['row']['id']);
             }
             $att = next($attributes);
         }
     }
     return $mySelect;
 }
Exemplo n.º 2
0
 function draw(&$form)
 {
     parent::draw($form);
     $text = new CHAW_text($this->title . $this->labelseparator);
     $text->set_br(0);
     if (!empty($this->title)) {
         $form->add_text($text);
     }
     $mySelect = new CHAW_select($this->key);
     global $_CAMILA;
     $_CAMILA['db']->SetFetchMode(ADODB_FETCH_ASSOC);
     $result = $_CAMILA['db']->Execute($this->query);
     if ($result === false) {
         camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
     }
     $val = '';
     while (!$result->EOF) {
         if ($result->fields[$this->lbkey] == $this->value) {
             $mySelect->add_option($result->fields[$this->lbvalue], $result->fields[$this->lbkey], HAW_SELECTED);
             $val = $result->fields[$this->lbvalue];
         } else {
             $mySelect->add_option($result->fields[$this->lbvalue], $result->fields[$this->lbkey]);
         }
         $result->MoveNext();
     }
     if ($this->updatable) {
         $form->add_select($mySelect);
         $text = new CHAW_text('');
         $form->add_text($text);
     } else {
         $text = new CHAW_text($val);
         $form->add_text($text);
     }
 }
 function _get_select()
 {
     global $_CAMILA;
     $mySelect = new CHAW_select($this->key);
     if (is_dir($this->basedir)) {
         if ($dh = opendir($this->basedir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..' && !is_dir($this->basedir . '/' . $file)) {
                     $ext = $this->_find_extension($file);
                     if (strlen($ext) > 0) {
                         $filename = substr($file, 0, -strlen($ext) - 1);
                     } else {
                         $filename = $file;
                     }
                     //if ($file == $this->value)
                     //    $mySelect->add_option($filename, $file, HAW_SELECTED);
                     //else
                     if (substr(strtolower($file), 0, strlen($_CAMILA['page_short_title'])) == strtolower($_CAMILA['page_short_title'])) {
                         $mySelect->add_option(substr($filename, strlen($_CAMILA['page_short_title']) + 1), $file);
                     }
                 }
             }
             closedir($dh);
         }
     }
     return $mySelect;
 }
Exemplo n.º 4
0
 function draw(&$form)
 {
     parent::draw($form);
     reset($this->options);
     if ($this->updatable) {
         $myText = new CHAW_text($this->title . $this->labelseparator);
         $myText->set_br(0);
     } else {
         while ($tok = each($this->options)) {
             //$mySelect->add_option($tok[1][1], $tok[1][0], $selected);
             if ($tok[1][0] == $this->value) {
                 $value = $tok[1][1];
             }
         }
         $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $value);
     }
     $form->add_text($myText);
     if ($this->updatable) {
         $mySelect = new CHAW_select($this->key);
         while ($tok = each($this->options)) {
             $selected = $tok[1][0] == $this->value ? HAW_SELECTED : HAW_NOTSELECTED;
             $mySelect->add_option($tok[1][1], $tok[1][0], $selected);
         }
         $form->add_select($mySelect);
         $text = new CHAW_text('');
         $form->add_text($text);
     }
 }
Exemplo n.º 5
0
 function _get_select()
 {
     $mySelect = new CHAW_select($this->key);
     $node = $this->fs->_tree_get_group_root_node($this->usergroup);
     $attributes = array('name');
     $wlk = $this->fs->_tree_walk_preorder($node);
     while ($curr = $this->fs->_tree_walk_next($wlk)) {
         $level = $this->fs->_tree_walk_level($wlk);
         $spaces = str_repeat('--', $level - 1);
         $att = reset($attributes);
         while ($att) {
             if ($level == 0) {
                 $mySelect->add_option('(' . camila_get_translation('camila.fm.selectfolder') . ')', $wlk['row']['id']);
             } elseif ($wlk['row']['file'] == '') {
                 if ($wlk['row']['id'] == $_REQUEST['camila_dir']) {
                     $mySelect->add_option($spaces . $wlk['row'][$att], $wlk['row']['id'], HAW_SELECTED);
                 } else {
                     $mySelect->add_option($spaces . $wlk['row'][$att], $wlk['row']['id']);
                 }
             }
             $att = next($attributes);
         }
     }
     return $mySelect;
 }
Exemplo n.º 6
0
function camila_export_action_select()
{
    global $_CAMILA;
    $mySelect = new CHAW_select('camila_export_action');
    require_once 'fs.class.php';
    $fs = new fs($_CAMILA['adm_user_group']);
    $mySelect->add_option(camila_get_translation('camila.export.download'), 'download');
    if (!CAMILA_FM_EXTFS_ENABLED) {
        if (!CAMILA_FM_EXPORT_SAVETO_DISABLED) {
            $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), '/', $_REQUEST['camila_export_last_action'] == '/' ? HAW_SELECTED : HAW_NOTSELECTED);
            $arr = $fs->scandir(CAMILA_FM_ROOTDIR, true, false);
            sort($arr);
            foreach ($arr as $value) {
                $item = substr($value, strlen(CAMILA_FM_ROOTDIR) + 1);
                if ($item != camila_get_translation('camila.documents.recyclebin')) {
                    if ('/' . $item == $_REQUEST['camila_export_last_action']) {
                        $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item, HAW_SELECTED);
                    } else {
                        $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $item, '/' . $item);
                    }
                }
            }
        }
    } else {
        $node = $fs->_tree_get_group_root_node($_CAMILA['adm_user_group']);
        $attributes = array('name');
        $wlk = $fs->_tree_walk_preorder($node);
        while ($curr = $fs->_tree_walk_next($wlk)) {
            $level = $fs->_tree_walk_level($wlk);
            $spaces = str_repeat('--', $level - 1);
            $att = reset($attributes);
            while ($att) {
                if ($level == 0) {
                    $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents'), $wlk['row']['id']);
                } elseif ($wlk['row']['file'] == '') {
                    $mySelect->add_option(camila_get_translation('camila.export.saveto') . ' ' . camila_get_translation('camila.documents') . '/' . $spaces . $wlk['row'][$att], $wlk['row']['id']);
                }
                $att = next($attributes);
            }
        }
    }
    return $mySelect;
}
Exemplo n.º 7
0
 $thePW1->set_size(20);
 $thePW1->set_maxlength(CAMILA_PASSWORD_LENGTH);
 $thePW1->set_type(HAW_INPUT_PASSWORD);
 $myForm->add_input($thePW1);
 $myParClose = new HAW_raw(HAW_HTML, '</p>');
 $myForm->add_raw($myParClose);
 if (CAMILA_USERNAME_LOGIN) {
     $myParOpen = new HAW_raw(HAW_HTML, '<p>');
     $myForm->add_raw($myParOpen);
     $myCheckbox = new CHAW_checkbox('remembersession', 'yes', camila_get_translation('camila.login.remembersession'));
     //$myCheckbox->set_br(0);
     $myForm->add_checkbox($myCheckbox);
     $myForm->add_raw($myParClose);
     if ($dh2 = opendir('./lang/')) {
         $myForm->add_raw($myParOpen);
         $mySelect = new CHAW_select('lang');
         while (($file2 = readdir($dh2)) !== false) {
             if (substr($file2, -9) == '.lang.php') {
                 $lang = substr($file2, 0, 2);
                 if ($lang == CAMILA_LANG) {
                     $mySelect->add_option(camila_get_translation('camila.lang.' . substr($file2, 0, 2)), $lang, HAW_SELECTED);
                 } else {
                     $mySelect->add_option(camila_get_translation('camila.lang.' . substr($file2, 0, 2)), $lang);
                 }
             }
         }
         $myForm->add_select($mySelect);
         $myForm->add_raw($myParClose);
         //$myText = new CHAW_text('');
         //$myForm->add_text($myText);
         closedir($dh2);
Exemplo n.º 8
0
 function _get_select_extfs()
 {
     $mySelect = new CHAW_select($this->key);
     $node = $this->fs->_tree_get_group_root_node($this->usergroup);
     $attributes = array('name');
     $mySelect = new CHAW_select($name);
     $wlk = $this->fs->_tree_walk_preorder($node);
     $mySelect->add_option('(seleziona allegato)', '.');
     $currentDir = '';
     while ($curr = $this->fs->_tree_walk_next($wlk)) {
         $level = $this->fs->_tree_walk_level($wlk);
         $spaces = str_repeat('--', $level - 1);
         $att = reset($attributes);
         while ($att) {
             if ($level != 0) {
                 if ($wlk['row']['file'] != '') {
                     if (isset($_REQUEST[$name]) && $_REQUEST[$name] != '' && $wlk['row']['file'] == $_REQUEST[$name]) {
                         $mySelect->add_option($spaces . $wlk['row']['name'], $wlk['row']['file'], HAW_SELECTED);
                     } else {
                         $mySelect->add_option($spaces . $wlk['row']['name'], $wlk['row']['file'], HAW_NOTSELECTED);
                     }
                 } else {
                     $mySelect->add_option($spaces . '--' . '[' . $wlk['row']['name'] . ']', '..', HAW_NOTSELECTED);
                 }
             }
             $att = next($attributes);
         }
     }
     return $mySelect;
 }
Exemplo n.º 9
0
}
$myForm->add_select($mySelect);
$text = new CHAW_text('');
$text->set_br(2);
$myForm->add_text($text);
if ($_CAMILA['user_preferences']['c_fs'] == '') {
    $_CAMILA['user_preferences']['c_fs'] = CAMILA_SIZE;
}
if ($_CAMILA['user_preferences']['c_ts'] == '') {
    $_CAMILA['user_preferences']['c_ts'] = CAMILA_TABLE_SIZE;
}
$text = new CHAW_text(camila_get_translation('camila.prefs.fontsize'));
$text->set_br(0);
$myForm->add_text($text);
$mySelect = new CHAW_select('camila_font_size');
$mySelect2 = new CHAW_select('camila_table_font_size');
$_fields = explode(',', '7pt,8pt,9pt,10pt,11pt,12pt,13pt,15pt,16pt,17pt,18pt,19pt,20pt,21pt,22pt,23pt,24pt');
while (list($key, $value) = each($_fields)) {
    if ($_CAMILA['user_preferences']['c_fs'] == $value) {
        $mySelect->add_option($value, $value, HAW_SELECTED);
    } else {
        $mySelect->add_option($value, $value);
    }
    if ($_CAMILA['user_preferences']['c_ts'] == $value) {
        $mySelect2->add_option($value, $value, HAW_SELECTED);
    } else {
        $mySelect2->add_option($value, $value);
    }
}
$myForm->add_select($mySelect);
$text = new CHAW_text('');
Exemplo n.º 10
0
 function draw(&$form)
 {
     parent::draw($form);
     global $_CAMILA;
     $this->tDate = '';
     $this->tFormat = '';
     $fmt = '';
     $fmt2 = '';
     $f = array();
     $m = camila_get_translation('camila.dateformat.monthpos');
     $d = camila_get_translation('camila.dateformat.daypos');
     $y = camila_get_translation('camila.dateformat.yearpos');
     $f[$m] = 'm';
     $f[$d] = 'd';
     $f[$y] = 'Y';
     ksort($f);
     reset($f);
     $count = 0;
     while (list($k, $v) = each($f)) {
         $fmt .= $v;
         $fmt2 .= '%' . $v;
         $this->tFormat .= camila_get_translation('camila.dateformat.placeholder.' . $v);
         if ($count < 2) {
             $fmt .= camila_get_translation('camila.dateformat.separator');
             $fmt2 .= camila_get_translation('camila.dateformat.separator');
             $this->tFormat .= camila_get_translation('camila.date.separator');
         }
         $count++;
     }
     if ($this->value != '') {
         $this->tDate = $_CAMILA['db']->UserTimeStamp($this->value, $fmt);
         $this->value_hour = $_CAMILA['db']->UserTimeStamp($this->value, 'H');
         $this->value_minute = $_CAMILA['db']->UserTimeStamp($this->value, 'i');
     }
     if ($this->updatable && !isset($_REQUEST['camila_inline_field'])) {
         $myInput = new CHAW_input($this->key, $this->tDate, $this->title . ' - Data (' . $this->tFormat . ')' . $this->labelseparator);
         if ($this->maxlength > 0) {
             $myInput->set_maxlength($this->maxlength);
         }
         if ($this->size > 0) {
             $myInput->set_size($this->size);
         }
         $myInput->set_br(1);
         $form->add_input($myInput);
         $code = '<link rel="stylesheet" type="text/css" media="all" href="' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_theme_file . '" />';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/calendar.js\' type=\'text/javascript\'></script>';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_lang_file . '\'  type=\'text/javascript\'></script>';
         $code .= '<script src=\'' . CAMILA_LIB_DIR . 'jscalendar/' . $this->calendar_setup_file . '\' type=\'text/javascript\'></script>';
         $_CAMILA['page']->camila_add_js($code, 'jscalendar');
         $code = '<script type=\'text/javascript\'>xParent(\'' . $this->key . '\',true).removeChild(xNextSib(\'' . $this->key . '\',\'br\'))</script>';
         $js = new CHAW_js($code);
         $form->add_userdefined($js);
         $popup = new CHAW_js("<a href=\"#\" id=\"f-calendar-trigger-" . $this->key . "\"><img src=\"" . CAMILA_LIB_DIR . "jscalendar/img.gif\" alt=\"\" align=\"middle\" border=\"0\"></a><script type=\"text/javascript\">Calendar.setup({\"ifFormat\":\"" . $fmt2 . "\",\"daFormat\":\"" . $fmt2 . "\",\"firstDay\":1,\"showsTime\":false,\"showOthers\":false,\"timeFormat\":12,\"inputField\":\"" . $this->key . "\",\"button\":\"f-calendar-trigger-" . $this->key . "\"});</script>");
         $form->add_userdefined($popup);
         $myText = new CHAW_text(' Ora' . $this->labelseparator);
         $myText->set_br(0);
         $form->add_text($myText);
         $tok = strtok('00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23', ',');
         while ($tok) {
             $pos = strpos($tok, ';');
             if ($pos === false) {
                 $this->hour_options[] = array($tok, $tok);
             } else {
                 $this->hour_options[] = array(substr($tok, 0, $pos), substr($tok, $pos + 1));
             }
             $tok = strtok(',');
         }
         $mySelect = new CHAW_select($this->key . '_hour');
         while ($tok = each($this->hour_options)) {
             $selected = $tok[1][0] == $this->value_hour ? HAW_SELECTED : HAW_NOTSELECTED;
             $mySelect->add_option($tok[1][1], $tok[1][0], $selected);
         }
         $form->add_select($mySelect);
         $text = new CHAW_text(':');
         $text->set_br(0);
         $form->add_text($text);
         $this->minute_options = array();
         for ($i = 0; $i < 60; $i += 60 / $this->hslots) {
             $this->minute_options[] = array(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
         }
         $mySelect = new CHAW_select($this->key . '_minute');
         while ($tok = each($this->minute_options)) {
             $selected = $tok[1][0] == $this->value_minute ? HAW_SELECTED : HAW_NOTSELECTED;
             $mySelect->add_option($tok[1][1], $tok[1][0], $selected);
         }
         $form->add_select($mySelect);
         $text = new CHAW_text('');
         $form->add_text($text);
     } elseif (isset($_REQUEST['camila_inline_field'])) {
         $fVal = $this->tDate . ' ' . $this->value_hour . camila_get_translation('camila.time.separator') . $this->value_minute . camila_get_translation('camila.time.separator') . '00';
         $mySelect = new CHAW_select($this->key);
         if ($this->value == '-' || $this->value == '') {
             $mySelect->add_option('-', '-', HAW_SELECTED);
         } else {
             $mySelect->add_option($fVal, $fVal, HAW_SELECTED);
             $mySelect->add_option('-', '-', HAW_NOTSELECTED);
         }
         $now = $_CAMILA['db']->UserTimeStamp(date('Y-m-d H:i:s'), $fmt) . ' ' . date('H') . camila_get_translation('camila.time.separator') . date('i') . camila_get_translation('camila.time.separator') . '00';
         $fVal = $this->tDate . ' ' . $this->value_hour . camila_get_translation('camila.time.separator') . $this->value_minute . camila_get_translation('camila.time.separator') . '00';
         if ($fVal == $now) {
             $mySelect->add_option($now, $now, HAW_SELECTED);
         } else {
             $mySelect->add_option($now, $now, HAW_NOTSELECTED);
         }
         $form->add_select($mySelect);
     } else {
         if ($this->value_hour != '00' || $this->value_minute != '00') {
             $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $this->tDate . ' - Ore ' . $this->value_hour . camila_get_translation('camila.time.separator') . $this->value_minute);
         } else {
             $myText = new CHAW_text($this->title . $this->labelseparator . ' ' . $this->tDate);
         }
         $form->add_text($myText);
     }
 }