Exemplo n.º 1
0
 /**
  * get list
  */
 public function getList($publish = 1)
 {
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     $list = $Taxonomy->getTree($publish);
     return $list;
 }
Exemplo n.º 2
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/ecommerce/ecommerce_product_taxonomy.php';
     $ProductTaxonomy = new ecommerce_product_taxonomy();
     $node_id = $this->GET['id'];
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     //listing
     if (is_numeric($node_id)) {
         $current = $ProductTaxonomy->getRelationsToNode($node_id);
         if (is_array($current)) {
             foreach ($current as $c_id) {
                 $taxonomy_data = $Taxonomy->taxonomyItemDetail($c_id);
                 $option = $taxonomy_data['label'];
                 $this->tpl->assign("OPTION", $taxonomy_data['label']);
                 //check if it is a Product Options
                 if ($taxonomy_data['parent'] == $ProductTaxonomy->conf['options_id']) {
                     $taxonomy_list = $Taxonomy->getChildren($taxonomy_data['id']);
                     foreach ($taxonomy_list as $item) {
                         if ($item['label']['publish'] == 1) {
                             $this->tpl->assign("ITEM", $item);
                             $this->tpl->parse("content.option.item");
                         }
                     }
                     $this->tpl->parse("content.option");
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     if ($_POST['save']) {
         if ($_POST['taxonomy']['label']['publish'] == 'on' || $_POST['taxonomy']['label']['publish'] == 1) {
             $_POST['taxonomy']['label']['publish'] = 1;
         } else {
             $_POST['taxonomy']['label']['publish'] = 0;
         }
         if ($Taxonomy->labelUpdate($_POST['taxonomy']['label'])) {
             msg("Taxonomy label updated.");
         }
     }
     if (is_numeric($this->GET['id'])) {
         $taxonomy_data['label'] = $Taxonomy->labelDetailByLTT($this->GET['id']);
         //display
         if ($taxonomy_data['label']['publish'] == 1) {
             $taxonomy_data['label']['publish_check'] = 'checked="checked"';
         } else {
             $taxonomy_data['label']['publish_check'] = 0;
         }
         $this->tpl->assign('TAXONOMY', $taxonomy_data);
         $this->tpl->parse('content.editor');
     } else {
     }
     return true;
 }
Exemplo n.º 4
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     if ($_POST['save']) {
         if ($id = $Taxonomy->labelInsert($_POST['taxonomy']['label'])) {
             msg("Taxonomy label inserted.");
         } else {
             $this->tpl->assign('TAXONOMY', $_POST['taxonomy']);
         }
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  * getImageThumbnailSrc
  *
  * @return URL string
  */
 public function getImageThumbnailSrc($label_id)
 {
     if (!is_numeric($label_id)) {
         return false;
     }
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     $images = $Taxonomy->getLabelImages($label_id);
     if (is_array($images) && count($images) > 0) {
         return "//{$_SERVER['HTTP_HOST']}/image/" . $images[0]['src'];
     } else {
         return '';
     }
 }
Exemplo n.º 6
0
 /**
  * post action
  */
 function post()
 {
     parent::post();
     //dropdowns
     $Offer_Group = new ecommerce_offer_group();
     $Taxonomy = new common_taxonomy();
     $conf = ecommerce_offer::initConfiguration();
     $groups_in_progress = $Offer_Group->listing("schedule_start <= NOW() AND (schedule_end IS NULL OR schedule_end >= NOW())", "id DESC");
     $groups_scheduled = $Offer_Group->listing("schedule_start > NOW()", "id DESC");
     $groups_past = $Offer_Group->listing("(schedule_start < NOW() OR schedule_start IS NULL) AND schedule_end IS NOT NULL AND schedule_end < NOW()", "id DESC");
     $campaign_categories = $Taxonomy->getChildren($conf['campaign_category_parent_id']);
     $roundel_categories = $Taxonomy->getChildren($conf['roundel_category_parent_id']);
     $this->parseOffersSelectGroup($groups_in_progress, 'In Progress', $this->node_data['component']['offer_group_id']);
     $this->parseOffersSelectGroup($groups_scheduled, 'Scheduled', $this->node_data['component']['offer_group_id']);
     $this->parseOffersSelectGroup($groups_past, 'Past', $this->node_data['component']['offer_group_id']);
     $this->parseCategorySelect($campaign_categories, $this->node_data['component']['campaign_category_id'], 'campaign_category_item');
     $this->parseCategorySelect($roundel_categories, $this->node_data['component']['roundel_category_id'], 'roundel_category_item');
     $this->parseTemplatesSelect($this->node_data['component']['template']);
 }
Exemplo n.º 7
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * input variables
      */
     if (is_numeric($this->GET['parent'])) {
         $parent = $this->GET['parent'];
     } else {
         $parent = 0;
     }
     if ($this->GET['publish'] == 1) {
         $published_only = true;
     } else {
         $published_only = false;
     }
     /* optional node_id and relation to show only related items (associated categories) */
     if (is_numeric($this->GET['node_id'])) {
         $node_id = $this->GET['node_id'];
     } else {
         $node_id = false;
     }
     if ($this->GET['relation']) {
         $relation = $this->GET['relation'];
     } else {
         $relation = false;
     }
     if (is_numeric($node_id) && $relation) {
         $related_taxonomy_label_list = $this->findOnlyRelated($node_id, $relation);
     } else {
         $related_taxonomy_label_list = false;
     }
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     $list = $Taxonomy->getChildren($parent, 'priority DESC, id ASC', true);
     foreach ($list as $item) {
         // process only if filtering by related isn't required or current item is matching
         if ($related_taxonomy_label_list === false || is_array($related_taxonomy_label_list) && is_array($related_taxonomy_label_list[$item['label_id']])) {
             $this->assignAndParseItem($item);
         }
     }
     return true;
 }
Exemplo n.º 8
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     /**
      * check input variables
      */
     if (is_numeric($this->GET['source_node_id'])) {
         $source_node_id = $this->GET['source_node_id'];
     } else {
         msg("taxonomy_move: source_node_id is not numeric", 'error');
         return false;
     }
     if (is_numeric($this->GET['destination_node_id'])) {
         $destination_node_id = $this->GET['destination_node_id'];
     } else {
         msg("taxonomy_move: destination_node_id is not numeric", 'error');
         return false;
     }
     if (is_numeric($this->GET['position'])) {
         $position = $this->GET['position'];
     } else {
         msg("taxonomy_move: position is not numeric", 'error');
         return false;
     }
     /**
      * move
      */
     //msg($source_node_id, $destination_node_id, $position);
     if ($Taxonomy->moveItem($source_node_id, $destination_node_id, $position)) {
         msg("Moved");
     } else {
         msg("Cannot move taxonomy to ({$source_node_id}, {$destination_node_id}, {$position})", 'error');
     }
     return true;
 }
Exemplo n.º 9
0
 /**
  * main action
  */
 public function mainAction()
 {
     if (is_numeric($this->GET['parent'])) {
         $parent = $this->GET['parent'];
     } else {
         $parent = 0;
     }
     if ($this->GET['publish'] == 1) {
         $published_only = true;
     } else {
         $published_only = false;
     }
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     $list = $Taxonomy->getChildren($parent, 'priority DESC, id ASC', true);
     foreach ($list as $item) {
         $this->tpl->assign('ITEM', $item);
         /**
          * image
          */
         if (is_array($item['label']['image']) && count($item['label']['image']) > 0) {
             $image = $item['label']['image'][0];
             $this->tpl->assign('IMAGE', $image);
             if (is_numeric($image['link_to_node_id'])) {
                 $this->tpl->parse('content.item.image_link');
             } else {
                 $this->tpl->parse('content.item.image');
             }
         }
         /**
          * content
          */
         $this->tpl->parse('content.item');
     }
     return true;
 }
Exemplo n.º 10
0
 /**
  * getRelatedTaxonomy
  */
 public function getRelatedTaxonomy($product_id)
 {
     if (!is_numeric($product_id)) {
         return false;
     }
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     $related_taxonomy = $Taxonomy->getRelatedTaxonomy($product_id, 'ecommerce_product_taxonomy');
     return $related_taxonomy;
 }
Exemplo n.º 11
0
 /**
  * getTaxonomyBranch
  */
 public function getTaxonomyBranch($parent)
 {
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     return $Taxonomy->getChildren($parent);
 }
Exemplo n.º 12
0
 /**
  * getRecipeTaxonomy
  * TODO: this should re-used or merged with /api/v1.3/recipe_category_list
  */
 public function getRecipeTaxonomy()
 {
     // get categories from taxonomy
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     $recipe_categories = $Taxonomy->getChildren($this->conf['taxonomy_tree_id']);
     return $recipe_categories;
 }