示例#1
0
 function draw(&$row, &$fields)
 {
     global $_CAMILA;
     if ($_CAMILA['page']->camila_exporting()) {
     } elseif (isset($this->onprint)) {
         $func = $this->onprint;
         $func($this, $row, $fields);
     } else {
         if ($this->imagepath != '') {
             $icon = $this->imagepath;
         } else {
             $icon = '../camila/images/png/' . $this->field . '_' . $this->value . '.png';
         }
         $wbmp = str_replace('png/', 'wbmp/', $icon);
         $wbmp = str_replace('.png', '.wbmp', $wbmp);
         $image = new CHAW_image($wbmp, $icon, '');
         if (!in_array($this->field, $this->report->keys) && $this->report->inline_editing) {
             $image->set_css_class('cf_editText');
         }
         if ($this->inline && $this->report->inline_editing) {
             $id = $this->field;
             foreach ($this->report->keys as $k => $v) {
                 $v = str_replace('.', '__', $v);
                 $id .= '__cf__' . $fields['camilakey_' . $v]->value;
             }
             $image->set_id($id);
         }
         $row->add_column($image);
     }
 }
示例#2
0
function camila_formupdatelink(&$field, &$row, $fields)
{
    global $_CAMILA;
    $arr = array();
    $inline_id = '';
    foreach ($fields as $key) {
        if (substr($key->field, 0, strlen('camilakey_')) == 'camilakey_' && substr($key->field, 0, strlen('camilakey_del_')) != 'camilakey_del_') {
            if (strpos($key->field, '__') !== false) {
                $kf .= 'camilakey_' . substr($key->field, strpos($key->field, '__') + 2);
            } else {
                $kf .= $key->field;
            }
            $inline_id = '__cf__' . $key->value;
            $arr[$kf] = $key->value;
        }
    }
    $reqs = 'camila_update=' . urlencode(serialize($arr)) . '&camila_token=' . camila_token(serialize($arr));
    if (isset($_REQUEST['camila_custom'])) {
        $reqs .= '&camila_custom=' . urlencode($_REQUEST['camila_custom']);
    }
    if (isset($_REQUEST['camila_share_key'])) {
        $reqs .= '&camila_share_key=' . urlencode($_REQUEST['camila_share_key']);
    }
    $pos = strpos($_CAMILA['page_url'], '?');
    if ($pos === false) {
        $link = basename($_SERVER['PHP_SELF']) . '?';
    } else {
        $link = $_CAMILA['page_url'] . '&';
    }
    if (isset($_REQUEST['camila_share_key'])) {
        $link .= 'camila_share_key=' . urlencode($_REQUEST['camila_share_key']) . '&';
    }
    $myLink = new CHAW_link($field->report->formupdatelinktext, $link . $reqs . '&camila_returl=' . urlencode($_CAMILA['returl']));
    $myLink->set_br(0);
    $image = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/bullet_go.wbmp', CAMILA_IMG_DIR . 'png/bullet_go.png', '>');
    $image->set_br(0);
    $image->set_id($inline_id);
    //$myLink->add_image($image);
    $ar = array();
    $ar[0] = $image;
    $ar[1] = $myLink;
    $row->add_column($ar);
    if ($field->report->inline_editing) {
        $_CAMILA['page']->camila_add_js("<script type='text/javascript'>var camila_inline=new Array();</script>\n", 'camila_inline_array');
        $_CAMILA['page']->camila_add_js("<script type='text/javascript'>var camila_inline_script='{$link}';</script>\n", 'camila_inline_script');
        $_CAMILA['page']->camila_add_js("<script type='text/javascript'>camila_inline['{$inline_id}']='{$reqs}';</script>\n", $inline_id);
    }
}
示例#3
0
 function draw(&$form)
 {
     parent::draw($form);
     $text = new CHAW_text($this->title . $this->labelseparator);
     $text->set_br(1);
     if (!empty($this->title)) {
         $form->add_text($text);
     }
     $select_all = new CHAW_js('<div class="camilacheckall" id="camilacheckall"><a id="CheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.checkall') . '</a> ' . camila_get_translation('camila.form.checkallseparator') . ' <a id="UncheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.uncheckall') . '</a></div>');
     $form->add_userdefined($select_all);
     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());
     }
     $count = 0;
     //          while (!$result->EOF) {
     for ($i = 0; $i < count($this->values); $i++) {
         //              $myHidden = new CHAW_hidden($this->key . '_labels_'.$count, $result->fields[$this->label_field]);
         //              $form->add_input($myHidden);
         if ($this->values[$i] == '') {
             $myImage = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/nocheck.wbmp', CAMILA_IMG_DIR . 'png/nocheck.png', '-');
             $myImage->set_br(0);
             $form->add_image($myImage);
             $text = new CHAW_text($this->labels[$i]);
             $form->add_text($text);
         } else {
             if (in_array($this->values[$i], $this->value)) {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $i, $this->values[$i], $this->labels[$i], HAW_SELECTED);
             } else {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $i, $this->values[$i], $this->labels[$i]);
             }
             $form->add_checkbox($myCheckbox);
             $this->checked++;
         }
         $count++;
         //              $result->MoveNext();
     }
     //          $myHidden = new CHAW_hidden($this->key . '_count', $count);
     //          $form->add_input($myHidden);
 }
示例#4
0
 function draw_header(&$row, $link)
 {
     global $_CAMILA;
     $_CAMILA['page']->header_cols_count++;
     if ($_CAMILA['page']->camila_exporting() || isset($this->onprint) || !$this->orderable) {
         if ($this->title == 'camilakey_id') {
             $text = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/wrench_orange.wbmp', CAMILA_IMG_DIR . 'png/spacer.png', 'v');
             //$text = new CHAW_text('X');
             $text->set_id('camilatablemenu');
         } elseif (substr($this->title, 0, strlen('camilakey_')) == 'camilakey_' || substr($this->title, 0, strlen('camila_')) == 'camila_') {
             $text = new CHAW_text('');
         } else {
             $text = new CHAW_text($this->title);
         }
         $text->metatype = $this->metatype;
         $text->field = $this->field;
         $row->add_column($text);
     } else {
         $myLink = new CHAW_link($this->title, $link);
         $myLink->set_br(0);
         $orderby = $this->report->orderby;
         //if (strpos($this->report->orderby, '.') !== false)
         //    $orderby = substr($this->report->orderby, 0, strpos($this->report->orderby, '.')) . '__' . substr($this->report->orderby, strpos($this->report->orderby, '.') + 1);
         $ar = array();
         $ar[0] = $myLink;
         if ($orderby == $this->field) {
             if ($_REQUEST['d'] == '1' || $this->report->direction == 'desc') {
                 $image = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/icon_sort_up.wbmp', CAMILA_IMG_DIR . 'png/icon_sort_up.png', '^');
             } else {
                 $image = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/icon_sort_down.wbmp', CAMILA_IMG_DIR . 'png/icon_sort_down.png', 'v');
             }
             $image->set_br(0);
             $ar[0] = $myLink;
             $ar[1] = $image;
         } else {
             $ar[0] = $myLink;
         }
         $row->add_column($ar);
     }
 }
示例#5
0
 function draw(&$form)
 {
     parent::draw($form);
     $text = new CHAW_text($this->title . $this->labelseparator);
     $text->set_br(1);
     if (!empty($this->title)) {
         $form->add_text($text);
     }
     if (count($this->labels) > 1) {
         $select_all = new CHAW_js('<div class="camilacheckall" id="camilacheckall"><a id="CheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.checkall') . '</a> ' . camila_get_translation('camila.form.checkallseparator') . ' <a id="UncheckAll_' . $this->key . '" href="">' . camila_get_translation('camila.form.uncheckall') . '</a></div>');
         $form->add_userdefined($select_all);
     }
     global $_CAMILA;
     $count = 0;
     foreach ($this->values as $key => $value) {
         $myHidden = new CHAW_hidden($this->key . '_labels_' . $count, $this->labels[$count]);
         $form->add_input($myHidden);
         if ($this->values[$count] == '') {
             $myImage = new CHAW_image(CAMILA_IMG_DIR . 'wbmp/nocheck.wbmp', CAMILA_IMG_DIR . 'png/nocheck.png', '-');
             $myImage->set_br(0);
             $form->add_image($myImage);
             $text = new CHAW_text($this->labels[$count]);
             $form->add_text($text);
         } else {
             if (in_array($fields[$count], $this->value)) {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $count, $this->values[$count], $this->labels[$count], HAW_SELECTED);
             } else {
                 $myCheckbox = new CHAW_checkbox($this->key . '_' . $count, $this->values[$count], $this->labels[$count]);
             }
             if (($count + 1) % $this->cols != 0 && count($this->labels) > 1) {
                 $myCheckbox->set_br(0);
             }
             $form->add_checkbox($myCheckbox);
             $this->checked++;
         }
         $count++;
     }
     //          $myHidden = new CHAW_hidden($this->key . '_count', $count);
     //          $form->add_input($myHidden);
 }