Ejemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     JS::add('/js/Chart.min.js', false);
     JS::startup('lightning.stats.init()');
     // Prepare the JS.
     JS::set('chart.' . $this->id . '.renderer', $this->renderer);
     JS::set('chart.' . $this->id . '.url', '/' . Request::getLocation());
     JS::set('chart.' . $this->id . '.params.start', ['source' => 'start']);
     JS::set('chart.' . $this->id . '.params.number_format', $this->numberFormat);
     JS::set('chart.' . $this->id . '.params.diff', !empty($this->diff));
     if (!empty($this->data)) {
         JS::set('chart.' . $this->id . '.data', $this->data);
     }
     JS::set('chart.' . $this->id . '.ajax', $this->ajax);
 }
Ejemplo n.º 2
0
 public function __construct($options = array())
 {
     $this->calendar_year = date('Y');
     $this->calendar_month = date('m');
     // TODO: Action is not set yet. Is any of this necessary?
     if ($this->action == 'new') {
         $backlinkname = '';
         $backlinkvalue = '';
         // check for a backlink to be prepopulated in a new entry
         if (isset($_REQUEST['backlinkname'])) {
             $backlinkname = $_REQUEST['backlinkname'];
         }
         if (isset($_REQUEST['backlinkvalue'])) {
             $backlinkvalue = $_REQUEST['backlinkvalue'];
         }
         // must have both
         if ($backlinkname && $backlinkvalue) {
             $this->preset[$backlinkname] = array('default' => $backlinkvalue);
         }
     }
     if (isset($_POST['function'])) {
         $this->function = $_POST['function'];
     }
     if (isset($_REQUEST['id'])) {
         $this->id = Request::get('id');
     }
     if (isset($_REQUEST['p'])) {
         $this->page_number = max(1, Request::get('p'));
     }
     /*
      * serial_update comes as POST parameter
      */
     $this->serial_update = Request::post('serialupdate', 'boolean');
     $this->refer_return = Request::get('refer_return');
     // load the sort fields
     if ($sort = Request::get('sort')) {
         $field = explode(";", $sort);
         $this->sort_fields = array();
         $sort_strings = array();
         foreach ($field as $f) {
             $f = explode(":", $f);
             if (!empty($f[1]) && $f[1] == "D") {
                 $this->sort_fields[$f[0]] = "D";
                 $sort_strings[] = "`{$f[0]}` DESC";
             } else {
                 $this->sort_fields[$f[0]] = "A";
                 $sort_strings[] = "`{$f[0]}` ASC";
             }
         }
         $this->sort = implode(",", $sort_strings);
     }
     $this->action_file = preg_replace('/\\?.*/', '', $_SERVER['REQUEST_URI']);
     foreach ($options as $name => $value) {
         $this->{$name} = $value;
     }
     $this->initSettings();
     $this->fillDetaultSettings();
     Template::getInstance()->set('full_width', true);
     parent::__construct();
 }