Example #1
0
        // dropdown lists -> generate lists
        $manufacturer_list = $root_manufacturer->build_html_tree($manufacturer_id, true, false);
        $category_list = $root_category->build_html_tree($category_id, true, false);
        $storelocation_list = $root_storelocation->build_html_tree($storelocation_id, true, false);
        $footprint_list = $root_footprint->build_html_tree($footprint_id, true, false);
        // the category ID is used for creating a new part (in *.tmpl file the latest DIV element)
        $html->set_variable('category_id', $category_id, 'integer');
        // dropdown lists -> set html variables
        $html->set_variable('manufacturer_list', $manufacturer_list, 'string');
        $html->set_variable('category_list', $category_list, 'string');
        $html->set_variable('storelocation_list', $storelocation_list, 'string');
        $html->set_variable('footprint_list', $footprint_list, 'string');
        // global/category stuff
        $category = new Category($database, $current_user, $log, $category_id);
        $html->set_variable('disable_footprints', $config['footprints']['disable'] || $category->get_disable_footprints(true), 'boolean');
        $html->set_variable('disable_manufacturers', $config['manufacturers']['disable'] || $category->get_disable_manufacturers(true), 'boolean');
        $html->set_variable('max_upload_filesize', ini_get('upload_max_filesize'), 'string');
    } catch (Exception $e) {
        $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
        $fatal_error = true;
    }
}
/********************************************************************************
 *
 *   Generate HTML Output
 *
 *********************************************************************************/
// an empty string in "$reload_link" means that the reload-button won't be visible
$reload_link = $fatal_error && $action != 'delete_part_confirmed' ? 'edit_part_info.php?pid=' . $part_id : '';
$html->print_header($messages, $reload_link);
if (!$fatal_error) {
Example #2
0
 /**
  * @brief Get the "disable manufacturers" attribute
  *
  * @param boolean $including_parents        @li If true, this method will return a "true" if at least
  *                                              one parent category has set "disable_manufacturers == true"
  *                                          @li If false, this method will only return that value
  *                                              which is stored in the database
  *
  * @retval boolean          the "disable manufacturers" attribute
  */
 public function get_disable_manufacturers($including_parents = false)
 {
     if ($including_parents) {
         $parent_id = $this->get_id();
         while ($parent_id > 0) {
             $category = new Category($this->database, $this->current_user, $this->log, $parent_id);
             $parent_id = $category->get_parent_id();
             if ($category->get_disable_manufacturers()) {
                 return true;
             }
         }
         return false;
     } else {
         return $this->db_data['disable_manufacturers'];
     }
 }