예제 #1
0
 public function render($name)
 {
     $this->addAttribute('class', 'btn');
     if ($this->theme != 'default') {
         $this->addAttribute('class', 'btn-' . $this->theme);
     }
     if ($this->size != 'default') {
         $this->addAttribute('class', 'btn-' . $this->size);
     }
     parent::render($name);
     if ($this->clear) {
         $this->html .= '<div>&nbsp;</div>';
     }
     switch ($this->tag_type) {
         default:
         case 'a':
             //WBN this is broken sort of, fix that ish
             $this->html .= '<a href="/" ' . $this->element_attributes . '>' . $this->text . '</a>';
             break;
         case 'input':
             $this->html .= '<input ' . $this->element_attributes . 'type ="' . $this->type . '" value="' . $this->text . '" />';
             break;
         case 'button':
             $this->html .= '<button ' . $this->element_attributes . ' type ="' . $this->type . '" >' . $this->text . '' . $this->icon . '</button>';
             break;
         case 'icon_submit':
             $this->html .= '<button ' . $this->element_attributes . ' type ="' . $this->type . '" >' . $this->text . '' . $this->icon . '</button>';
             break;
     }
     return $this->html;
 }
예제 #2
0
 public function render($name)
 {
     parent::render($name);
     if ($this->label) {
         $this->html = $this->label();
     }
     if ($this->prepended || $this->appended) {
         $div_class = '';
         if ($this->prepended) {
             $div_class .= ' input-prepend';
         }
         if ($this->appended) {
             $div_class .= ' input-append';
         }
         $this->html .= '<div class="' . $div_class . '">';
     }
     if ($this->prepended) {
         $this->html .= '<span class="add-on">' . $this->prepended . '</span>';
     }
     $this->html .= $this->rendered_input($name);
     if ($this->appended) {
         $this->html .= '<span class="add-on">' . $this->appended . '</span>';
     }
     if ($this->prepended || $this->appended) {
         $this->html .= '</div>';
     }
     return $this->html;
 }
예제 #3
0
파일: form.php 프로젝트: mirkoargentino/bbn
 public function script($with_ele = 1)
 {
     $st = parent::script($with_ele);
     if (isset($this->attr['id'])) {
         $st .= 'kendo.bind("#' . $this->attr['id'] . ' *", kappui.tabstrip.obs[kappui.tabstrip.selected].info);';
     }
     return $st;
 }
예제 #4
0
 public function displayElement(element $element)
 {
     switch ($element->type()) {
         case 'headlineElement':
             $this->displayHeadline($element);
             break;
         case 'textElement':
             $this->displayText($element);
             break;
         case 'imageElement':
             $this->displayImage($element);
             break;
         default:
             $errormsg = 'Unknown element type: ' . htmlentities($element->type());
             trigger_error($errormsg, E_USER_WARNING);
     }
 }
예제 #5
0
 /**
  * This will build a new HTML form element according to the given configuration.
  * Only name and tag are mandatory, then other values depending on the tag
  * 
  * @param array $cfg The configuration
  * @return self
  */
 public function __construct($cfg)
 {
     if (is_string($cfg)) {
         $cfg = ['type' => 'submit', 'text' => $cfg];
     }
     $cfg['tag'] = 'button';
     parent::__construct($cfg);
     return $this;
 }
예제 #6
0
 public function render()
 {
     /*
      * En el caso que $div YA SEA UN element significa que nos está llamando él para renderearse
      * Tambien nos rendereamos en el caso que no tengamos un label (tal vez no habra label y seamos nosotros solitos)
      */
     if (is_null($this->label) || is_a($this->div, 'element')) {
         return parent::render();
     }
     // Si $div NO ES un element lo rendereamos metiendonos en medio con nuestra label
     if (!is_a($this->div, 'element')) {
         $this->div = new element(array('tag' => 'div', 'class' => 'form-group', 'id' => false, $this->label, $this));
         return $this->div->render();
     }
 }
예제 #7
0
파일: bootstrap.php 프로젝트: stgnet/pui
 public function __construct($theme = False)
 {
     parent::__construct();
     /* placeholder object, don't output an actual tag */
     if ($theme) {
         $this->theme = $theme;
     } else {
         $this->theme = 'default';
     }
     $this->head[] = new Element('meta', array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge'));
     $this->head[] = new Element('meta', array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'));
     $this->head[] = new Element('link', array('rel' => 'stylesheet', 'href' => $this->url('css'), 'type' => 'text/css'));
     $this->tail[] = new Element('script', array('src' => $this->url('jquery')));
     $this->tail[] = new Element('script', array('src' => $this->url('js')));
 }
예제 #8
0
파일: form.php 프로젝트: querquobad/html5
 public function __construct($att = array())
 {
     if (isset($att['tag']) && $att['tag'] !== 'form') {
         throw new RuntimeException('No se puede crear un elemento ' . $att['tag'] . ' con la clase form');
     }
     $att['tag'] = 'form';
     if (isset($att['tipo']) && ($att['tipo'] === 'horizontal' || $att['tipo'] === 'inline')) {
         $this->tipo = $att['tipo'];
         $this->addAtributo('class', 'form-' . $att['tipo']);
     }
     if (isset($att['tipo'])) {
         unset($att['tipo']);
     }
     $this->addAtributo('role', 'form');
     parent::__construct($att);
 }
예제 #9
0
}
$id_label = 'ID';
$element_id = '<input type="text" id="elements_id" value="' . $element->id . '" readonly="readonly" />';
$element_code = '<input type="text" value="' . $element->detail['code'] . '" readonly="readonly" />';
if ($element->detail['code'] != '') {
    $id_label .= ' / Code';
    $element_id .= ' / ' . $element_code;
}
$element_name = '<input type="text" class="input2 editable" id="elements_name" name="elements_name" value="' . $element->detail['name'] . '" />';
$element_description = '<input type="text" class="input2 editable" id="elements_description" name="elements_description" value="' . $element->detail['description'] . '" />';
$element_weight = '<input type="text" class="editable" id="elements_weight" name="elements_weight" value="' . $element->detail['weight'] . '" readonly="readonly" />';
$gold_carats = array('9' => '&nbsp;375&nbsp;<small class="notice">(9k)</small>', '14' => '&nbsp;585&nbsp;<small class="notice">(14k)</small>', '0' => '&nbsp;non-gold');
foreach ($gold_carats as $gck => $gcv) {
    $carat = $element->detail['weight_goldpure'] == '' || $element->detail['weight_goldpure'] == '0' ? '0' : element::getCaratFromWeight($element->detail['weight'], $element->detail['weight_goldpure']);
    if ($carat == 0) {
        $carat = element::getMaterialFromToCarat('', $element->attributes['material']['id']);
    }
    $selected = $carat == $gck ? 'checked="checked"' : '';
    $goldpure_carat .= '<div style="float:left;margin-right:10px;"><input type="radio" id="el_car_' . $gck . '" class="editable" name="elements_weight_goldpure" value="' . $gck . '" ' . $selected . ' disabled="disabled" />' . $gcv . '</div>';
}
$element_weight_goldpure .= '<input type="text" class="editable" id="weight_goldpure" name="weight_goldpure" value="' . $element->detail['weight_goldpure'] . '" readonly="readonly" />';
$element_suppliers = '<input type="text" id="elements_supplier" value="' . $element->detail['supplier'] . '" readonly="readonly" />';
$el_price = displayCurrency('EUR', $element->detail['price'], true, $element->detail['price'] < ELEMENTS_LOWER_PRICE ? 5 : 2);
$element_price = '<input type="text" id="elements_price" value="' . $el_price . '" readonly="readonly" />';
$element_wax_complexity = '<select id="wax_complexity" name="wax_complexity" disabled="disabled"><option value="">Please select complexity</option>' . loadComboListFromArray(getComplexity(), null, $element->wax_complexity, false) . '</select>';
if (is_null($element->id)) {
    $content .= '<h3 id="newinfo" class="red ui-corner-all" style="background:#ffeeee;padding:5px;margin-bottom:10px;">Specify a name to create New ID</h3>';
}
$content .= '<div id="element-detail">';
use_class('elements_stock');
$el_stock = new elements_stock();
예제 #10
0
 public function render($buffer = false)
 {
     // Build Element Structure
     $this->build_element_structure($this->table_elements['header'], $this->table_data['elements']['header']);
     $this->build_element_structure($this->table_elements['body'], $this->table_data['elements']['body']);
     $this->build_element_structure($this->table_elements['footer'], $this->table_data['elements']['footer']);
     // Convert Table Data to XML
     $this->inset_val = array2xml('table_data', $this->table_data);
     // Render Table Element
     parent::render($buffer);
 }
 $q .= ", IF(IFNULL(ed1.name, '')='', ed2.name, ed1.name) AS name";
 $q .= ", CONCAT('elements/', ei.image_path, ei.image_filename) AS elements_image";
 $q .= " FROM elements e";
 $q .= " LEFT JOIN elements_description ed1 ON ed1.elements_id=e.elements_id AND ed1.languages_id=1";
 $q .= " LEFT JOIN elements_description ed2 ON ed2.elements_id=e.elements_id AND ed2.languages_id=2";
 $q .= " LEFT JOIN elements_images ei ON ei.elements_id=e.elements_id AND ei.elements_sample_name='EC1'";
 $q .= " WHERE e.elements_id IN (" . implode(',', $elements_keep_id) . ")";
 $r = tep_db_query($q);
 $elements = array();
 while ($row = tep_db_fetch_array($r)) {
     $elements[] = $row;
 }
 $count = 0;
 $copy_time = date('Y-m-d H:i:s');
 foreach ($elements as $e) {
     $element = new element($e['elements_id']);
     if (is_null($element->id)) {
         $element->forceID($e['elements_id']);
         $element->create($e['elements_code'], $e['name'], $e['elements_weight'], '', 0, $copy_time, 'auto');
         if ($e['elements_image'] != '') {
             $image_uploaded = DIR_WS_IMAGES . $e['elements_image'];
             $image_filename = basename($image_uploaded);
             $element->uploadImage($image_uploaded, $image_filename);
         }
         $suppliers = $element->getSuppliers();
         $sup_name = '';
         $sup_name = 0;
         foreach ($suppliers as $sup) {
             if ($sup['is_default'] == '1') {
                 $sup_name = $sup['suppliers_name'];
                 $sup_price = calculateCurrency($sup['elements_price'] / $sup['pieces_per_qty_type'], $sup['price_currency']);
예제 #12
0
 public function __construct(&$theArray)
 {
     ENTER("document::document", __LINE__);
     foreach ($theArray as $aKey => $aValue) {
         if (array_search($aKey, $this->myOwnFields) !== false) {
             $this->{$aKey} = $aValue;
         }
     }
     parent::__construct($theArray);
 }
예제 #13
0
파일: ElementTest.php 프로젝트: stgnet/pui
 public function testptext()
 {
     $p = new element('p', array('text' => 'should be <p> tag'));
     $this->assertEquals($p->asHtml(), '<p>should be &lt;p&gt; tag</p>');
 }
예제 #14
0
 public function render($buffer = false)
 {
     //============================================================
     // Form Label
     //============================================================
     if (isset($this->form_label)) {
         $this->add_child(xhe('form_label', $this->form_label));
     }
     //============================================================
     // Hidden Form Elements
     //============================================================
     $hid_elements = new gen_element('hidden_elements');
     $hid_elements->display_tree();
     foreach ($this->hidden_elements as $hid_element) {
         ob_start();
         $this->process_element($hid_element);
         $tmp_element = !empty($this->xsl_template) ? $this->xml_escape(ob_get_clean()) : ob_get_clean();
         $tmp_element = trim($tmp_element);
         $tmp_he = new gen_element('hid_element', $tmp_element);
         $tmp_he->display_tree();
         $hid_elements->add_child($tmp_he);
     }
     $this->add_child($hid_elements);
     //============================================================
     // Process Visible Form Elements
     //============================================================
     $elements = new gen_element('form_elements');
     $elements->display_tree();
     foreach ($this->form_elements as $element) {
         //-----------------------------------------------------
         // Validate Each Element
         //-----------------------------------------------------
         if (!is_array($element) || is_array($element) && count($element) < 2) {
             continue;
         }
         //-----------------------------------------------------
         // Process the element
         //-----------------------------------------------------
         ob_start();
         $this->process_element($element[0]);
         $tmp_element = ob_get_clean();
         //-----------------------------------------------------
         // Build Form Element into XML and add it to Tree
         //-----------------------------------------------------
         $fe_attrs = array();
         $fe_content = trim($tmp_element);
         $content_empty = $fe_content == '' ? true : false;
         if ($fe_content != '' && !empty($this->xsl_template)) {
             $fe_content = xml_escape($fe_content);
         }
         $fe_attrs = isset($element[2]) && is_array($element[2]) ? $element[2] : array();
         $tmp_fe = new gen_element($element[1], $fe_content, $fe_attrs);
         if (substr($element[1], 0, 4) != 'end_' && !$content_empty) {
             $tmp_fe->display_tree();
         }
         $elements->add_child($tmp_fe);
     }
     $this->add_child($elements);
     //============================================================
     // Call Parent Render Function
     //============================================================
     return parent::render($buffer);
 }
예제 #15
0
            }
            $fq .= " WHERE {$field}='{$filter_attr_id}'";
        }
        if ($keywords != '') {
            $fq .= $fq == '' ? " WHERE " : " AND ";
            if (is_numeric($keywords)) {
                $fq .= "elements_id={$keywords}";
            } elseif (strlen($keywords) < 10 && strpos($keywords, '-') !== false) {
                $fq .= "elements_code='{$keywords}'";
            } else {
                $fq .= "elements_name LIKE '%{$keywords}%'";
            }
        }
    } elseif ($_POST['me_action'] == 'ELEMENTDELETE') {
        $id = tep_db_prepare_input($_POST['elements_id']);
        $element = new element($id);
        $is_deleted = $element->delete($session_userinfo['username']);
        $result = array();
        $result['target_id'] = $id;
        $result['is_deleted'] = $is_deleted;
        ajaxReturn($result);
        exit;
    }
}
$listofids = array();
$q = "SELECT elements_id FROM element" . $fq;
$q .= " ORDER BY is_finalized ASC, add_date DESC, elements_id DESC";
$r = tep_db_query($q);
if (tep_db_num_rows($r) == 1) {
    $row = tep_db_fetch_array($r);
    header("Location: ?open=element&id={$row['elements_id']}");
예제 #16
0
     $result .= '<td class="w100 tar">' . displayCurrency('EUR', $row['outgoing_value'], false) . '</td>';
     $result .= '</tr>';
 }
 $result .= '<tr class="t">';
 $result .= '<td class="d">TOTAL</td>';
 $result .= '<td class="w080 tac">' . strval(intval($total_incoming)) . '</td>';
 $result .= '<td class="w100 tar">' . displayCurrency('EUR', $total_incoming_value, false) . '</td>';
 $result .= '<td class="w080 tac">' . strval(intval($total_outgoing)) . '</td>';
 $result .= '<td class="w100 tar">' . displayCurrency('EUR', $total_outgoing_value, false) . '</td>';
 $result .= '</tr>';
 $result .= '</table></div>';
 $result .= '</div>';
 //Today Sourcing List
 $result2 = '';
 $total_elements_to_list = 35;
 $nslist = element::retrieveNeedSourcingSpecificDate('yesterday', $total_elements_to_list);
 $total_elements = count($nslist);
 if ($total_elements == 0) {
     $result2 .= '<h3 class="green">No NS Elements Today</h3>';
 } else {
     $columns_no = 5;
     $rows_no = ceil($total_elements / $columns_no);
     $rowcount = 0;
     $eid_collection = array();
     foreach ($nslist as $nse) {
         $e = new element($nse['elements_id']);
         $rowcount++;
         if ($rowcount == 1) {
             $result2 .= '<div class="draw-table" style="float:left;margin-right:20px;">';
             $result2 .= '<table class="proman sticky-tablehead" border="0" cellpadding="0" cellspacing="0">';
             $result2 .= '<thead><tr>';
$show_amount = 10;
$fq = '';
$header = array();
$header['img'] = 'Image';
$header['id'] = 'ID';
$header['name'] = 'Name';
$header['info'] = 'Supplier';
$header['pri'] = 'Price';
$header['sold'] = 'Products Sold';
$header['sold2'] = 'Elements Sold';
//AJAX ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'LOADROW') {
        $id = tep_db_prepare_input($_POST['grabid']);
        $row_class = tep_db_prepare_input($_POST['row_class']);
        $detail = new element($id);
        if (is_null($detail->id)) {
            $row = 'FAILED';
        } else {
            $id = $detail->id;
            $img = webImage($detail->image, '80', '80', $id);
            $name = $detail->detail['name'];
            $info = $detail->detail['supplier'];
            $pri = displayCurrency('EUR', $detail->detail['price']);
            $sold = $detail->log['weekly_sold_products'];
            $sold2 = $detail->log['weekly_sold'];
            $row = '<tr id="id-' . $id . '" class="' . $row_class . '">';
            foreach ($header as $td => $h) {
                if ($td == 'id') {
                    $content = '<a href="?open=element&amp;id=' . $id . '&amp;hidemenu=true" class="view_webpage bold">' . $id . '</a>';
                } elseif ($td == 'img') {
예제 #18
0
 /**
  * This will build a new HTML form element according to the given configuration.
  * Only name and tag are mandatory, then other values depending on the tag
  * 
  * @param array $cfg The configuration
  * @return self
  */
 public function __construct($cfg)
 {
     if (is_string($cfg)) {
         $cfg = ['field' => 'text', 'attr' => ['name' => $cfg]];
     }
     parent::__construct($cfg);
     if ($this->tag) {
         $mandatory_attr = array();
         if (!isset($this->attr['id'])) {
             $this->attr['id'] = \bbn\str\text::genpwd(20, 15);
         }
         $this->script = isset($cfg['script']) ? $cfg['script'] : '';
         $this->value = isset($cfg['value']) ? $cfg['value'] : '';
         switch ($this->tag) {
             case "input":
                 array_push($mandatory_attr, "type");
                 break;
             case "textarea":
                 array_push($mandatory_attr, "cols", "rows");
                 break;
             case "select":
                 array_push($mandatory_attr, "attr");
                 break;
         }
         foreach ($mandatory_attr as $m) {
             if (!isset($this->attr[$m])) {
                 die("Argument {$m} is missing in your config... Sorry!");
             }
         }
     }
     return $this;
 }
예제 #19
0
 function deleteElement($elements_id, $username)
 {
     use_class('element');
     $element = new element($elements_id);
     $elements_name = $element->detail['name'];
     $element->delete($username);
     if ($this->id > 0) {
         tep_db_query("DELETE FROM designs_elements WHERE elements_id = '{$elements_id}'");
     }
     $comment = 'I delete Element ID ' . $elements_id . ' (' . $elements_name . ')';
     $this->comments->addComment($username, $comment);
 }
예제 #20
0
 public function render($buffer = false)
 {
     // Inset Value Buffer
     ob_start();
     // Data Output Buffer
     ob_start();
     // Form Label
     if (isset($this->form_label)) {
         print new gen_element('form_label', $this->form_label);
     }
     // Headers
     $headers_arr = array();
     for ($x = 0; $x < $this->cols; $x++) {
         if (isset($this->headers[$x])) {
             $headers_arr[] = $this->headers[$x];
         }
     }
     print array2xml('headers', $headers_arr);
     // Button Cell Attributes
     print array2xml('button_cell_attrs', $this->button_cell_attrs);
     // Button(s)
     if (gettype($this->button) == 'array') {
         $buttons = array();
         foreach ($this->button as $key => $value) {
             if (gettype($key) == 'integer') {
                 $key = 'button_' . $key;
             }
             $buttons[$key] = array('name' => $key, 'value' => $this->xml_escape($value));
         }
         print array2xml('buttons', $buttons);
     } else {
         if ($this->button !== NULL) {
             print new gen_element('button', $this->xml_escape($this->button));
         }
     }
     print new gen_element('columns', $this->cols);
     // Form content
     $curr_cols = 0;
     $colspan = 0;
     $row_begin = false;
     $row_end = false;
     // Hidden Form Elements
     $hid_elems = array();
     foreach ($this->hidden_elements as $he_key => $hid_element) {
         ob_start();
         $this->process_element($hid_element);
         $hid_elems[] = !empty($this->xsl_template) ? $this->xml_escape(ob_get_clean()) : ob_get_clean();
     }
     print array2xml('hidden_elements', $hid_elems);
     // Visible Form Elements
     ob_start();
     $rows = 0;
     foreach ($this->form_elements as $element) {
         // Process the element (object -> render, text -> print, array -> process elements)
         ob_start();
         $this->process_element($element[0]);
         $tmp_element = ob_get_clean();
         if ($element[2] == 'cell') {
             // Start ROW
             if ($curr_cols == 0) {
                 ob_start();
                 if ($rows % 2 == 1 && $this->alt_rows) {
                     $this->set_row_attr($rows, 'class', 'alt');
                 }
                 $row_attrs = isset($this->row_attrs[$rows]) ? $this->row_attrs[$rows] : array();
                 $row_begin = true;
                 $row_end = false;
                 $rows++;
             }
             // Build Form Element
             $colspan = $element[1] + 0;
             $fe_attrs = array('colspan' => $element[1]);
             foreach ($element[3] as $fe_attr_key => $fe_attr_val) {
                 $fe_attrs[$fe_attr_key] = $fe_attr_val;
             }
             $fe_content = !empty($this->xsl_template) ? $this->xml_escape($tmp_element) : $tmp_element;
             print new gen_element('form_element', $fe_content, $fe_attrs);
             // End ROW
             if ($curr_cols + $colspan >= $this->cols) {
                 print new gen_element('row', ob_get_clean(), $row_attrs);
                 $row_begin = false;
                 $row_end = true;
                 $curr_cols = 0;
             } else {
                 $curr_cols += $colspan;
             }
         } else {
             print !empty($this->xsl_template) && $element[2] != 'fieldset' ? $this->xml_escape($tmp_element) : $tmp_element;
         }
     }
     // End ROW if not already terminated
     if (!$row_end && $row_begin && count($this->form_elements) > 0) {
         print new gen_element('row', ob_get_clean(), $row_attrs);
     }
     print new gen_element('elements', ob_get_clean());
     print new gen_element('data', ob_get_clean());
     $this->inset_val .= ob_get_clean();
     return parent::render($buffer);
 }
예제 #21
0
<?php

require_once 'autoload.php';
require_once 'sesiones.php';
$html = new element(array('tag' => 'html', 'lang' => 'es', 'id' => false, include 'view/head.php', new element(array('tag' => 'body', 'id' => false, include 'view/navbar.php'))));
$html->getElementByTag('body')->addElement(include 'view/modal.php');
//Finalmente esto lo usaremos bastante sin importar si ya se hizo login.
$html->getElementByTag('body')->addElement(new element(array('tag' => 'div', 'id' => 'bt-container', 'class' => 'container-fluid')));
if (!(isset($_SESSION['usuario']) && is_a($_SESSION['usuario'], 'usuario'))) {
    // Si no tenemos sesión nos vamos a identificar
    $html->getElementById('bt-container')->addElement(include 'view/login.php');
    $html->getElementByTag('head')->addElement(new element(array('tag' => 'script', 'src' => 'js/login.js', 'type' => 'text/javascript', 'id' => false)));
} else {
    /*
     * Supuestamente si tenemos una sesión activa (o por lo menos un email)
     * Por lo que ya hay menú
     */
    $html->getElementById('bt-container')->addElement(new element(array('id' => 'menu_usuario', 'tag' => 'div', new element(array('tag' => 'ul', 'class' => 'nav nav-tabs')))));
    $html->getElementById('bt-container')->addElement(new element(array('tag' => 'div', 'class' => 'tab-content', 'id' => 'tab-content')));
    //Aqui va el contenido de los tabs
    foreach ($_SESSION['usuario']->getMenu() as $value) {
        $active = true;
        /*
         * Agregamos el contenido y el menu
         */
        try {
            $html->getElementById('tab-content')->addElement(new element(array('tag' => 'div', 'id' => $value['leyenda'], 'class' => 'tab-pane fade', include_once 'view/' . stripAccents($value['leyenda']) . '.php')));
            $html->getElementByTag('head')->addElement(new element(array('tag' => 'script', 'id' => false, 'src' => 'js/' . stripAccents($value['leyenda']) . '.js')));
            if ($active) {
                $html->getElementById($value['leyenda'])->addAtributo('class', 'in active');
                $active = false;
예제 #22
0
 function postProcess($post_vars)
 {
     global $session_userinfo;
     $result = array();
     if ($post_vars['me_action'] == 'SEARCH') {
         $type = $post_vars['type'];
         $jng_sp_id = $post_vars['jng_sp_id'];
         //another strange case, in live datepicker filter is always given as \'datevalue\' instead of 'datevalue'
         //still cant find the root cause (and it's ok in local dev), so for quickwin workaround we simple replace
         //the \' value into ' with below update (sahat 11.02.2014)
         //$post_filters = explode("|", $post_vars['post_filters']);
         $post_filters = explode("|", str_replace('\\\'', "'", $post_vars['post_filters']));
         $filters = array();
         foreach ($post_filters as $f) {
             $f_temp = explode('-', $f);
             $field = $f_temp[0];
             unset($f_temp[0]);
             $value = implode('-', $f_temp);
             //explode to array for input on field $multivalue_fields which allowed multivalue separated by $multivalue_separator
             if (in_array($field, $this->multivalue_fields)) {
                 $mv_temp = explode(current($this->multivalue_separator), $value);
                 if (is_array($mv_temp) && $mv_temp > 0) {
                     foreach ($mv_temp as $mv) {
                         $mv = trim($mv);
                         if (!isset($filters[$field]) || !in_array($mv, $filters[$field])) {
                             $filters[$field][] = $mv;
                         }
                     }
                 } else {
                     $filters[$field][] = $value;
                 }
             } else {
                 $filters[$field][] = $value;
             }
         }
         $query = $this->constructQuery($jng_sp_id, $filters);
         $dbq = tep_db_query($query);
         $result = '';
         $total = 0;
         $elements_ids = '';
         //$display_spot = '';
         while ($r = tep_db_fetch_array($dbq)) {
             $total++;
             if ($total > 1) {
                 $elements_ids .= ',';
             }
             $elements_ids .= $r['elements_id'];
             //                $display_spot .= '<div id="'.$r['elements_id'].'" class="lists-elements"></div>';
         }
         $result['type'] = $type;
         $result['total'] = $total;
         $result['elements_ids'] = $elements_ids;
         //            $result['display_spot'] = $display_spot;
         ajaxReturn($result);
     } elseif ($post_vars['me_action'] == 'DISPLAY') {
         $type = $post_vars['type'];
         $elements_id = $post_vars['elements_id'];
         $query = "SELECT e.elements_id, e.elements_code, e.elements_name, e.elements_image, e.elements_price, e.add_date, IFNULL(e.elements_weight,'-') elements_weight, e.stars, e.elements_description";
         $query .= ", IFNULL(esup.suppliers_name,'-') suppliers_name";
         $query .= ", el.used_in_products, IFNULL(el.weekly_sold, '-') weekly_sold, IFNULL(el.weekly_sold_products, '-') weekly_sold_products, IFNULL(el.sold_monthly_1, '-') last_month_sold";
         $query .= ", (IFNULL(els.sold_{$this->last_year}_sp, 0) + IFNULL(els.sold_{$this->last_year}_jg, 0)) sold_{$this->last_year}";
         $query .= ", (IFNULL(els.sold_products_{$this->last_year}_sp, 0) + IFNULL(els.sold_products_{$this->last_year}_jg, 0)) sold_products_{$this->last_year}";
         $query .= ", ec.name AS cat_name, pm.material_name AS mat_name, cpd.name AS color_name, ei.name AS size_name, eh.name AS holesize_name";
         $query .= ", es.name AS shape_name, es.shape_image, eu.name AS surface_name, eu.surface_image, et.name AS cut_name, et.cuts_image AS cut_image";
         $query .= ", ehe.name AS height_name, ew.name AS width_name, eth.name AS thickness_name, est.stock";
         $query .= ", DATEDIFF(NOW(), e.add_date) AS elements_age";
         $query .= " FROM element e";
         $query .= " LEFT JOIN elements_log el ON el.elements_id=e.elements_id";
         $query .= " LEFT JOIN elements_log_static els ON els.elements_id=e.elements_id";
         $query .= " LEFT JOIN elements_to_elements_suppliers etes ON etes.elements_id = e.elements_id AND is_default = 1";
         $query .= " LEFT JOIN elements_suppliers esup ON esup.elements_suppliers_id = etes.elements_suppliers_id";
         $query .= " LEFT JOIN elements_stock est ON est.elements_id = e.elements_id AND est.jng_warehouses_id = " . WAREHOUSE_ID_ELEMENTS;
         $query .= " LEFT JOIN element_category ec ON ec.element_category_id=e.attribute_category_id";
         $query .= " LEFT JOIN products_materials pm ON pm.products_materials_id=e.attribute_material_id";
         $query .= " LEFT JOIN color_pattern cp ON cp.color_pattern_id=e.attribute_color_id";
         $query .= " LEFT JOIN color_pattern_description cpd ON cpd.color_pattern_id=e.attribute_color_id AND languages_id=1";
         $query .= " LEFT JOIN element_size ei ON ei.element_size_id=e.attribute_size_id";
         $query .= " LEFT JOIN element_holesize eh ON eh.element_holesize_id=e.attribute_holesize_id";
         $query .= " LEFT JOIN element_shape es ON es.element_shape_id=e.attribute_shape_id";
         $query .= " LEFT JOIN element_surface eu ON eu.element_surface_id=e.attribute_surface_id";
         $query .= " LEFT JOIN element_cut et ON et.element_cut_id=e.attribute_cut_id";
         $query .= " LEFT JOIN element_height ehe ON ehe.element_height_id=e.attribute_height_id";
         $query .= " LEFT JOIN element_width ew ON ew.element_width_id=e.attribute_width_id";
         $query .= " LEFT JOIN element_thickness eth ON eth.element_thickness_id=e.attribute_thickness_id";
         $query .= " WHERE e.elements_id = '{$elements_id}'";
         $dbq = tep_db_query($query);
         $res = tep_db_fetch_array($dbq);
         $elements_image = webImageWithDetailLink($res['elements_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1, 'Element ' . $res['elements_id'], 'img-border');
         $elements_created = date('d-M-Y', strtotime($res['add_date']));
         $elements_price = $res['elements_price'] < ELEMENTS_LOWER_PRICE ? displayCurrency('EUR', $res['elements_price'], true, 5) : displayCurrency('EUR', $res['elements_price']);
         $resultsdt = array();
         //0-4
         $resultsdt[] = $elements_id;
         $resultsdt[] = $elements_image;
         //$resultsdt[] = $res['elements_name'];
         $resultsdt[] = $res['elements_description'];
         $resultsdt[] = $elements_created;
         $resultsdt[] = $elements_price;
         //5-9
         $resultsdt[] = $res['suppliers_name'];
         $resultsdt[] = $res['weekly_sold'];
         $resultsdt[] = $res['weekly_sold_products'];
         $resultsdt[] = $res['sold_' . $this->last_year];
         $resultsdt[] = $res['sold_products_' . $this->last_year];
         //10-14'd
         $resultsdt[] = $res['elements_weight'];
         $resultsdt[] = $res['last_month_sold'];
         $resultsdt[] = $res['stock'];
         $resultsdt[] = drawStars($res['stars']);
         $resultsdt[] = $res['elements_age'];
         $result['type'] = $type;
         $result['result'] = implode($this->result_separator, $resultsdt);
         ajaxReturn($result);
     } elseif ($post_vars['me_action'] == 'KILLELEMENT') {
         use_class('element');
         $elid = tep_db_prepare_input($_POST['elid']);
         $element = new element($elid);
         $is_deleted = $element->delete($session_userinfo['username']);
         $result = array();
         $result['target_id'] = $elid;
         $result['is_deleted'] = $is_deleted;
         ajaxReturn($result);
     }
 }
예제 #23
0
     $result = array();
     $result['oid'] = $oid;
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'CLOSEPO') {
     $oid = tep_db_prepare_input($_POST['oid']);
     $eo = new elements_order($oid);
     $eo->updateStatus('2', $session_userinfo['username']);
     $result = array();
     $result['oid'] = $oid;
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'ADDMANLOADEID') {
     $eid = tep_db_prepare_input($_POST['eid']);
     $qtytoadd = '';
     $element = new element($eid);
     if (is_null($element->id)) {
         $found = '0';
         $preview = '<h3 class="red">Element Not Found</h3>';
     } else {
         //$img = webImage($element->image, '80', '80', $eid);
         $img = webImageWithDetailLinkStars($element->image, '80', '80', $eid, '', '', '500', '500', $element->stars);
         $stock = $class_es->retrieveOne($whid, $eid);
         $preview = '<div style="float:left;">' . $img . '</div>';
         $preview .= '<div style="margin-left:100px;">';
         $preview .= '<div style="margin-bottom:5px;">';
         $preview .= $element->detail['supplier'];
         $preview .= ' / 1 ' . $stock['qty_type'] . ' = ' . displayCurrency('EUR', $element->detail['price']);
         //$preview .= ' <span class="smallText notice">('.$stock['pieces_per_qty_type'].' qty = 1 '.$stock['qty_type'].')</span>';
         $preview .= '</div>';
         $found = '1';
use_class('elements_order');
use_class('elements_suppliers');
use_class('element');
$oid = tep_db_prepare_input($_GET['id']);
$eo = new elements_order($oid);
$po_number = $eo->detail['po_number'] == '' ? $oid : $eo->detail['po_number'];
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'CONFIRMPRICE') {
        $is_saved_to_elsup = tep_db_prepare_input($_POST['is_saved_to_elsup']) == 'true';
        $eoi_id = tep_db_prepare_input($_POST['eoi_id']);
        $price = tep_db_prepare_input($_POST['price']);
        $currency = tep_db_prepare_input($_POST['currency']);
        $eo->confirmPrice($eoi_id, $price, $currency);
        $eoi = $eo->items[$eoi_id];
        if ($is_saved_to_elsup) {
            $e = new element($eoi['elements_id']);
            $e->getSuppliers();
            foreach ($e->suppliers as $etesid => $etes) {
                $el_cur_info = elements_suppliers::formatPreviousInfo($etes['elements_price'], $etes['price_currency'], $etes['price_quantity_type'], $etes['pieces_per_qty_type'], $etes['resourcing_day'], $session_userinfo['username']);
                if ($el_cur_info != '') {
                    $prev_infos = explode('||', $el_cur_info);
                    $prev_price = $prev_infos[1];
                    $new_el_price = $currency == 'IDR' ? number_format($price, 0, '.', '') : number_format($price, 2, '.', '');
                    $price_changed = "{$currency}|{$new_el_price}" != $prev_price;
                }
                if (!$price_changed) {
                    $el_cur_info = null;
                }
                if ($etes['elements_suppliers_id'] == $eo->suppliers_id && $etes['item_number'] == $eoi['item_number']) {
                    $e->updateSupplier($etesid, $etes['elements_suppliers_id'], $price, $etes['price_quantity_type'], $etes['item_number'], $currency, $etes['discount'], $etes['pieces_per_qty_type'], $etes['is_default'], $etes['resourcing_day'], $el_cur_info);
                }
 *
 * @author IT TEAM BONOFACTUM
 * @created Oct 4, 2013 4:40:39 PM
 */
use_class('element');
use_class('elements_preorder');
use_class('elements_order');
use_class('forecasting');
element::loadDIOHsettings();
$forecasting_conf = load_config('forecasting');
$elements_id = tep_db_prepare_input($_GET['id']);
$year = date('Y');
$kw_now = date('W');
$log_base_data = element::DIOH_BASENUMBER_COLUMN_NAME;
$log_base_info = element::DIOH_BASENUMBER_DESCRIPTION;
$e = new element($elements_id);
$monthly_usage = intval($e->log[$log_base_data]);
$daily_usage = round($monthly_usage / 30, 1);
$last_week_usage = $daily_usage * 7;
$last_week_usage = $last_week_usage > 0 && $last_week_usage < 1 ? 1 : round($last_week_usage, 0);
$fc = new forecasting($year, $forecasting_conf['elements-sourcing-projection']);
$weekly_usage = $e->retrieveWeeklyUsage($year);
$box_style = 'height:100px;padding:5px;';
$content .= '<div class="float-box w450 ui-corner-all" style="' . $box_style . 'margin-right:20px;">';
$content .= '<h3>Chart Legend</h3>';
$content .= '<div><table border="0" cellspacing="0" cellpadding="0">';
$content .= '<tr style="background:#efccef;"><td class="w080">Purple Block</td><td>=</td><td>Current Calendar Week</td></tr>';
$content .= '<tr><td class="blue">Blue Line</td><td class="blue">=</td><td class="blue">Forecasting based on weekly average of ' . $log_base_info . '</td></tr>';
$content .= '<tr><td class="red">Red Line</td><td class="red">=</td><td class="red">Real weekly elements usage</td></tr>';
$content .= '</table></div>';
$content .= '</div>';
예제 #26
0
파일: fitimages.php 프로젝트: stgnet/pui
 public function __construct()
 {
     parent::__construct();
     $this->head[] = new Element('style', array('html' => 'img { height: 100%; width: 100%; object-fit: contain; }'));
 }
$header['id'] = 'ID';
$header['name'] = 'Name';
$header['info'] = 'Supplier';
$header['pri'] = 'Price per Piece';
$header['info2'] = 'Stock Available';
if ($sort_option == 'msws') {
    $header['ws'] = 'Weekly Sold';
}
$header['pri3'] = 'DIOH';
$header['pri2'] = 'Total';
//AJAX ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'LOADROW') {
        $id = tep_db_prepare_input($_POST['grabid']);
        $row_class = tep_db_prepare_input($_POST['row_class']);
        $detail = new element($id);
        if (is_null($detail->id)) {
            $row = 'FAILED';
        } else {
            $id = $detail->id;
            $stock_data = $class_es->retrieveOne($whid, $id);
            if ($stock_data['pieces_per_qty_type'] == 0) {
                $stock_text = '<a href="?open=elements-suppliers&amp;id=' . $id . '&amp;hidemenu=true" class="view_webpage red" title="Manage Supplier Data">UNSET Qty/Piece</a>';
            } else {
                $stock = $stock_data['stock'] / $stock_data['pieces_per_qty_type'];
                $stock_text = $stock - floor($stock) == 0 ? $stock : number_format($stock, 1, ',', '');
                $stock_text .= ' ' . $stock_data['qty_type'];
                $stock_text = '<a href="?open=elements-stock-update&amp;id=' . $id . '&amp;hidemenu=true" class="view_webpage" title="Update Stock">' . $stock_text . '</a>';
                if ($stock_data['pieces_per_qty_type'] > 1 && $stock_data['stock'] > 0) {
                    $piece_qty_type = $stock_data['qty_type'] == 'meter' ? ' cm' : ' pieces';
                    $stock_text .= '<br /><span class="notice">(' . $stock_data['stock'] . $piece_qty_type . ')</span>';
 if (!$need_php_filtered) {
     $q .= " LIMIT {$maxelements}";
 }
 //            echo $q;
 $dbq = tep_db_query($q);
 $elements = array();
 $elements_counter = 0;
 $total_value = 0;
 $total_missing = 0;
 while ($r = tep_db_fetch_array($dbq)) {
     $include = false;
     $elid = $r['elements_id'];
     $current_stock = $r['stock_actual'];
     $qty_ordered = elements_order::openOrdersQuantity($elid);
     $qty_requested = elements_preorder::openOrdersQuantity($elid);
     $e = new element($elid);
     $dioh = $e->getDIOH($current_stock);
     $dioh2 = $e->getDIOH($current_stock + $qty_ordered);
     $dioh_text = $e->displayDIOH($current_stock);
     $dioh2_text = $e->displayDIOH($current_stock + $qty_ordered);
     $target_stock = $e->getDIOHstockTarget();
     $orders_in_sourcing = elements_preorder::totalNeededForSourcingTab($elid);
     $missing = $target_stock + $orders_in_sourcing - ($current_stock + $qty_ordered);
     if ($missing < 0) {
         $missing = 0;
     }
     $refill = $e->calcRefillQuantity($current_stock, $qty_ordered, 1);
     if (!$need_php_filtered) {
         $include = true;
     } else {
         switch ($filter_refill) {
<?php

global $db;
require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
tep_db_connect();
use_class('element');
//LIST 1
//$elements_todelete = array(1704,1705,1706,1707,1708,1066,1070,1744,1276,1735,1736,1737,1738,1741,1742,1743,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1771,1772,1773,1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1808,1809,1810,1811,1812,1813,1814,1815,1823,1825,1826,1827,1829,1830,1831,1833,1836,1839,1841,1842,1843,1844,1845,1849,2012,2015,2023,2041,2042,2043,2046,2048,2050,2058,2059,2060,2061,2062,2063,2064,2075,2076,2077,2078,2091,2092,2093,2099,2100,2344,2345,2346,2347,2348,2363,2364,2365,2366,2367,2368,2397,2461,2454,2456,2462,2463,2464,2465,2466,2467,2468,2469,2470,2471,2472,2475,2476,2477,2478,2479,2480,2481,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2492,2493,2494,2495,2496,2497,2498,2499,2500,2501,2502,2503,2504,2505,2506,2507,2508,2510,2511,2512,2513,2514,2515,2516,2517,2518,2519,2520,2521,2523,2524,2525,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538,2539,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,2555,2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2570,2571,2572,2573,2574,2575,2576,2577,2578,2579,2580,2581,2582,2583,2584,2609,2610,2611,2612,2614,2616,2618,2619,2620,2621,2622,2623,2624,2625,2629,2631,2633,2634,2635,2637,2639,2641,2668,2756,2759,2773,2775,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2867,2869,2870,2872,2873,2874,2875,2877,2880,2883,2884,2885,2886,2887,2888,2892,2894,2896,2897,2898,2899,2900,2906,2907,2913,2927,2947,2948,2951,2956,2957,2970,2971,2972,2973,2974,2975,2976,2977,2987,2988,2990,2992,3002,3004,3005,3007,3009,3014,3015,3017,3023,3026,3028,3036,3037,3038,3039,3040,3041,3042,3043,3045,3048,3050,3051,3053,3054,3075,3076,3077,3078,3079,3080,3081,3083,3085,3086,3088,3096,3099,3100,3102,3103,3105,3107,3123,3124,3126,3128,3137,3143,3145,3148,3149,3151,3153,3154,3155,3172,3178,3179,3180,3182,3184,3185,3187,3204,3205,3206,3208,3255,3257,3258,3259,3279,3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3292,3293,3294,3295,3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3314,3317,3319,3321,3323,3325,3346,3375);
//LIST 2
//$elements_todelete = array(3898,3901,3902,3939,3954,3994,3995,4010,4011,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040,4041,4042,4043,4044,4045,4046,4047,4048);
//LIST 3
//$elements_todelete = array(1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,2678,2687,2688,2689);
//LIST 4
$elements_todelete = array();
$count = 0;
foreach ($elements_todelete as $eid) {
    $element = new element($eid);
    if (!is_null($element->id)) {
        $element->delete();
        $count++;
    }
}
echo "{$count} Elements are deleted";
tep_db_close();
예제 #30
0
 $po_list = array();
 $el_list = array();
 foreach ($_POST['suppliers'] as $suppliers) {
     list($supid, $elements_raw) = explode('|||', $suppliers);
     $elements = array();
     $eltemp = explode('|', $elements_raw);
     foreach ($eltemp as $et) {
         list($eid, $eqty) = explode('-', $et);
         if ($eid > 0 && $eqty > 0) {
             $elements[$eid] = $eqty;
         }
     }
     if (count($elements) > 0) {
         $po = new elements_order('0');
         foreach ($elements as $eid => $eqty) {
             $e = new element($eid);
             $e->getSuppliers();
             $etes = null;
             foreach ($e->suppliers as $etes_id => $etes_temp) {
                 if ($etes_temp['elements_suppliers_id'] == $supid) {
                     $etes = $etes_temp;
                     break;
                 }
             }
             if (!is_null($etes)) {
                 if ($po->orders_id == '0') {
                     $po->suppliers_id = $supid;
                     $po->createNew($etes['price_currency'], $session_userinfo['username']);
                     $po_list[] = $po->orders_id;
                 }
                 $el_list[] = $eid;