Beispiel #1
0
            $close = '</a>';
            $tray_def[$tray_id]['__slots__'][$slot_id]['__weight__'] = isset($slot_def['__weight__']) ? $slot_def['__weight__'] : 0;
            if (IPHONE) {
                $row_info = '';
                $row_info .= '<div>' . _V($tray['__title__']) . '</div><div>' . _V($slot_def['__name__']) . ' (' . $slot_def['__count__'] . ')</div>';
                $row = $open . $row_info . $close;
                $tray_def[$tray_id]['__slots__'][$slot_id]['__html__'] = '<li class="arrow">' . $row . '</li>';
            } else {
                $row = array();
                $row = array($open . _V($tray['__title__']) . '<br>' . _V($slot_def['__name__']) . $close, $slot_def['__count__']);
                $tray_def[$tray_id]['__slots__'][$slot_id]['__html__'] = $row;
            }
        }
    }
}
Utils_TrayCommon::sort_trays($tray_def);
if (IPHONE) {
    $html = '';
} else {
    $data_out = array();
}
foreach ($tray_def as $tray_id => $def) {
    foreach ($def['__slots__'] as $slot) {
        if (IPHONE) {
            $html .= $slot['__html__'];
        } else {
            $data_out[] = $slot['__html__'];
        }
    }
}
//display table
Beispiel #2
0
	public function set_filters($rb, $display_tray_select = true, $filter_defaults = array()) {
		if(!Base_AclCommon::check_permission('Dashboard')) return;
		if($this->is_back()) {
			$x = ModuleManager::get_instance('/Base_Box|0');
			if(!$x) trigger_error('There is no base box module instance',E_USER_ERROR);
			return $x->push_main('Utils_Tray');
		}

		if (isset($_REQUEST['tray_slot'])) {
			Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
			$this->set_module_variable('tray_slot', $_REQUEST['tray_slot']);
		}

		$tray_func = $this->parent->get_type().'Common::tray';
		if (!is_callable($tray_func)) return;

		$settings = call_user_func($tray_func);

		if (!isset($settings[$rb->tab])) return;

		$slot_defs = Utils_TrayCommon::get_slots($rb->tab, $settings[$rb->tab]);
		Utils_TrayCommon::sort_trays($slot_defs);

		if ($display_tray_select) {
			$tray_slot_select_options = array('__NULL__'=>'---');
			foreach ($slot_defs as $slot_id=>$slot_def) {
				$tray_slot_select_options[$slot_id] = _V($slot_def['__name__']);
			}

			$form = $this->init_module('Libs/QuickForm');
			$form->addElement('select', 'tray_slot_select', __('Tray'), $tray_slot_select_options, array('style'=>'width: 130px','onchange'=>$form->get_submit_form_js()));
			if ($form->validate()) {
				$tray_slot = $form->exportValue('tray_slot_select');
				$this->set_module_variable('tray_slot',$tray_slot);
				
				$rb->unset_module_variable('def_filter');
			}
		}

		$tray_slot = $this->get_module_variable('tray_slot');
		
		if (isset($slot_defs[$tray_slot]['__filters__'])) {
			$filters_changed = Utils_TrayCommon::are_filters_changed($slot_defs[$tray_slot]['__filters__']);
		}
		else {
			$filters_changed = true;
		}

		if (!isset($_REQUEST['__location']) && ($tray_slot!='__NULL__') && isset($tray_slot) && !$filters_changed){
			$rb->set_additional_caption(_V($slot_defs[$tray_slot]['__name__']));
		}
		else {
			$this->unset_module_variable('tray_slot');
			$tray_slot='__NULL__';
		}

		if ($display_tray_select) {
			$form->setDefaults(array('tray_slot_select'=>$tray_slot));

			ob_start();
			$form->display_as_row();
			$html = ob_get_clean();
			print('<div style="position: absolute;right:120px;">'.$html.'</div>');
		}
		
		if (is_null($tray_slot) || $tray_slot=='__NULL__') {
			$rb->set_filters_defaults($filter_defaults);
			return;
		}
		
		$rb->disable_browse_mode_switch();

		$rb->set_filters_defaults($slot_defs[$tray_slot]['__filters__']);
	}
Beispiel #3
0
 public static function sort_trays(&$trays, $include_slots = true)
 {
     self::$tmp_trays = $trays;
     uksort($trays, array('Utils_TrayCommon', 'sort_tray_cmp'));
     foreach ($trays as &$t) {
         if (is_array($t) && array_key_exists('__slots__', $t) && $include_slots) {
             self::sort_trays($t['__slots__']);
         }
     }
     unset($trays['__weight__']);
 }