示例#1
0
$table->setRowsStyle("100%");
$table->setWidth("100%");
$table->setHeight("100%");
$table->setClass("table.white");
$table_form = new Table();
$table_form->setRowsStyle("76dip;76dip;76dip;76dip");
$table_form->setClass("table.forms");
$input_value = new InputNumeric(15);
$input_value->setClass("input.form");
$input_date = new InputDate();
$input_date->setClass("input.form");
$input_desc = new InputText();
$input_desc->setLabelCaption("Description");
$input_desc->setClass("input.form");
$dc_cat = new DynamicComboBox();
$dc_cat->setValues(load_cat());
$dc_cat->setAddEmptyItem(false);
$dc_cat->setClass("input.form");
$button = new Button();
$button->setCaption("Confirm");
$button->onTap(confirm());
$button->setClass("button.blue");
$table_form->addControl($input_value, 1, 1, 1, 1, "Center", "Middle");
$table_form->addControl($input_date, 2, 1, 1, 1, "Center", "Middle");
$table_form->addControl($input_desc, 3, 1, 1, 1, "Center", "Middle");
$table_form->addControl($dc_cat, 4, 1, 1, 1, "Center", "Middle");
$table_button = new Table();
$table_button->addControl($button, 1, 1, 1, 1, "Center", "Middle");
$table->addControl($table_form, 1, 1);
$table->addControl($table_button, 2, 1);
$win->addControl($table);
示例#2
0
 /**
  * import categories
  * @param array $categories
  * @param type $parent
  */
 public function importCategories($categories, $parent = null)
 {
     $categories_ext_id = array();
     foreach ($this->cat as $category) {
         $categories_ext_id[$category['external_id']] = $category['id'];
     }
     foreach ($categories as $category) {
         //            $searchedCat = is_cat($category->ID, $this->cat);
         if ($category->IDWeb || $categories_ext_id[(string) $category->ID]) {
             $this->updateCategory($data, $parent, $category, $categories_ext_id[(string) $category->ID]);
         } else {
             $this->insertCategory($data, $parent, $category, $searchedCat);
         }
     }
     $insert = $this->insert;
     $update = $this->update;
     $this->insertData($this->categories_table);
     $inserted_categories = load_cat();
     foreach ($inserted_categories as $value) {
         foreach ($this->insert_categories_i18n as $key => $category_i18n) {
             if ($category_i18n['external_id'] == $value['external_id']) {
                 $this->insert_categories_i18n[$key]['id'] = $value['id'];
                 unset($this->insert_categories_i18n[$key]['external_id']);
             }
         }
         foreach ($this->cat as $category) {
             if ($category['external_id'] == $value['external_id']) {
                 $this->cat[$key]['id'] = $value['id'];
             }
         }
     }
     $this->insert = $this->insert_categories_i18n;
     $this->insertData('shop_category_i18n');
     $this->updateData($this->categories_table, 'id');
     $this->update = $this->update_categories_i18n;
     $this->updateData($this->categories_table . '_i18n', 'id');
     $this->updateCategoryFilds($insert);
     $this->updateCategoryFilds($update);
 }
示例#3
0
if (!user_admin()) {
    include PATH_GLOBAL_VIEW . 'error_not_admin.php';
} else {
    include PATH_LIB . 'form.php';
    include PATH_MODEL . 'admin.php';
    //Add a category of product
    $form_add_cat = new Form('form_add_cat');
    $form_add_cat->method('POST');
    $form_add_cat->add('Text', 'cat_name')->label('Nom de la catégorie');
    $form_add_cat->add('Text', 'cat_description')->label('Description de la catégorie');
    $form_add_cat->add('Text', 'cat_image')->label('URL de l\'image de la catégorie');
    $form_add_cat->add('Submit', 'submit')->value('Valider');
    //Add a product
    $form_add_product = new Form('form_add_product');
    $form_add_product->method('POST');
    $choice_cat = load_cat();
    $form_add_product->add('Text', 'product_name')->label('Nom du produit');
    $form_add_product->add('Select', 'product_cat')->label('Catégorie du produit')->choices($choice_cat);
    $form_add_product->add('Text', 'product_description')->label('Description du produit');
    $form_add_product->add('Text', 'product_qty')->label('Quantité du produit');
    $form_add_product->add('Text', 'product_portion')->label('Nombre de portions par produit');
    $form_add_product->add('Text', 'product_price')->label('Prix du produit');
    $form_add_product->add('Text', 'product_img')->label('Image du produit');
    $form_add_product->add('Text', 'product_health_pt')->label('Point de santé du produit');
    $form_add_product->add('Text', 'product_angry_pt')->label('Point de faim du produit');
    $form_add_product->add('Text', 'product_thirst_pt')->label('Point de soif du produit');
    $form_add_product->add('Submit', 'submit')->value('Valider');
    //Errors array
    $errors_form_cat = array();
    $errors_form_product = array();
    $msg_confirm = array();
示例#4
0
 /**
  * import categories
  * @param array $categories
  * @param type $parent
  */
 public function importCategories($categories, $parent = null)
 {
     foreach ($categories as $category) {
         if ($category->ЭтоГруппа == 'true') {
             $searchedCat = is_cat($category->ID, $this->cat);
             if (!$searchedCat) {
                 $this->insertCategory($data, $parent, $category, $searchedCat);
             } else {
                 $this->updateCategory($data, $parent, $category, $searchedCat);
             }
             //                if (isset($category->IDРодитель)) {
             //
             //                    //$parent_cat брати з масиву
             //                    $parentCat = is_cat($category->ID, $this->cat);
             //                    //$this->ci->db->select("id, url, full_path, full_path_ids")->where('external_id', $category->Ид . "")->get($this->categories_table)->row_array();
             //                    $this->importCategories($category->IDРодитель, $parentCat);
             //                }
         }
     }
     $this->insertData($this->categories_table);
     $inserted_categories = load_cat();
     foreach ($inserted_categories as $value) {
         foreach ($this->insert_categories_i18n as $key => $category_i18n) {
             if ($category_i18n['external_id'] == $value['external_id']) {
                 $this->insert_categories_i18n[$key]['id'] = $value['id'];
                 unset($this->insert_categories_i18n[$key]['external_id']);
             }
         }
         foreach ($this->cat as $category) {
             if ($category['external_id'] == $value['external_id']) {
                 $this->cat[$key]['id'] = $value['id'];
             }
         }
     }
     $this->insert = $this->insert_categories_i18n;
     $this->insertData('shop_category_i18n');
     $this->updateData($this->categories_table, 'external_id');
     $this->update = $this->update_categories_i18n;
     $this->updateData($this->categories_table . '_i18n', 'id');
 }