/**
  * @param string $type Type of google visualization
  * @param array $options Options. Depends on $type
  * @param string $query A valid google query string. See [queryobjects](https://developers.google.com/chart/interactive/docs/reference#queryobjects)
  * @param DataSource $ds DataSource to use, will fall back to GoogleVisualization::$DefaultDatasource or (if that is not set) to <model_datasource>('internal')
  */
 function __initialize($type = false, $options = array(), $query = false, $ds = false)
 {
     parent::__initialize();
     $this->addClass('google_vis');
     $this->_ds = $ds ? $ds : (self::$DefaultDatasource ? self::$DefaultDatasource : model_datasource('internal'));
     $this->gvType = $type ? $type : substr(get_class_simple($this), 2);
     $this->gvOptions = $options ? $options : array();
     $this->gvQuery = $query;
     $this->content("<div class='loading'>&nbsp;</div>");
     store_object($this);
 }
Exemplo n.º 2
0
 /**
  * @override
  */
 function PreRender($args = array())
 {
     if (!$this->CultureInfo) {
         $this->SetCulture(Localization::detectCulture());
     }
     if (isset($this->value)) {
         $this->value = get_class_simple($this) == "uiDatePicker" ? $this->CultureInfo->FormatDate($this->value, DateTimeFormat::DF_SHORTDATE) : $this->CultureInfo->FormatDateTime($this->value);
     }
     if (isset($this->Options['defaultDate'])) {
         $this->Options['defaultDate'] = get_class_simple($this) == "uiDatePicker" ? $this->CultureInfo->FormatDate($this->Options['defaultDate'], DateTimeFormat::DF_SHORTDATE) : $this->CultureInfo->FormatDateTime($this->Options['defaultDate']);
     }
     parent::PreRender($args);
 }
Exemplo n.º 3
0
 /**
  * @override
  */
 function PreRender($args = array())
 {
     if (!$this->CultureInfo) {
         $this->SetCulture(Localization::detectCulture());
     }
     if (isset($this->value)) {
         $this->value = get_class_simple($this) == "uiDatePicker" ? $this->CultureInfo->FormatDate($this->value, DateTimeFormat::DF_SHORTDATE) : $this->CultureInfo->FormatDateTime($this->value);
     }
     if (isset($this->Options['defaultDate'])) {
         $this->Options['defaultDate'] = get_class_simple($this) == "uiDatePicker" ? $this->CultureInfo->FormatDate($this->Options['defaultDate'], DateTimeFormat::DF_SHORTDATE) : $this->CultureInfo->FormatDateTime($this->Options['defaultDate']);
     }
     $this->script("\$('#{$this->id}').{$this->init_code}(" . system_to_json($this->Options) . ");");
     parent::PreRender($args);
 }
Exemplo n.º 4
0
 function __initialize($tag = "")
 {
     parent::__initialize($tag);
     $this->InitFunctionName = strtolower(preg_replace('/^ui/', '', get_class_simple($this)));
 }
 function __initialize($title = "", $body_class = false)
 {
     parent::__initialize($title, $body_class);
     $this->subnav('New strings', get_class_simple($this), 'NewStrings');
     $this->subnav('Fetch strings', get_class_simple($this), 'Fetch');
 }
Exemplo n.º 6
0
 /**
  * Override this method instead of writing a constructor.
  * 
  * @param string $tag The HTML Tag of this control. Default ""
  */
 function __initialize($tag = "")
 {
     $this->Tag = strtolower($tag);
     $class = strtolower(get_class_simple($this));
     if ($class != $this->Tag && $class != "control") {
         $this->class = $class;
     }
 }
Exemplo n.º 7
0
 /**
  * @override 
  */
 function WdfRender()
 {
     if ($this->DataCallback) {
         $this->Clear();
         $args = array($this);
         system_call_user_func_array_byref($this->DataCallback[0], $this->DataCallback[1], $args);
     }
     if ($this->ItemsPerPage && !$this->HidePager) {
         $pager = $this->RenderPager();
         $this->content($pager);
     }
     if ($this->footer) {
         $this->prepend($this->footer);
     }
     //array_merge(array($this->footer),$this->_content);
     if ($this->header) {
         $this->prepend($this->header);
     }
     //array_merge(array($this->header),$this->_content);
     if ($this->colgroup) {
         $this->prepend($this->colgroup);
     }
     //array_merge(array($this->colgroup),$this->_content);
     if ($this->Caption) {
         $this->_ensureCaptionObject();
         $this->prepend($this->Caption);
         //array_merge(array($this->Caption),$this->_content);
     }
     foreach ($this->_content as &$c) {
         if (!is_object($c) || get_class_simple($c) != "TBody") {
             continue;
         }
         foreach ($c->_content as $r) {
             if (!$r instanceof Tr) {
                 continue;
             }
             $rcnt = count($r->_content);
             for ($i = 0; $i < $rcnt; $i++) {
                 if ($r->_content[$i]->CellFormat) {
                     $r->_content[$i]->CellFormat->Format($r->_content[$i], $this->Culture);
                 } elseif (isset($this->ColFormats[$i])) {
                     $this->ColFormats[$i]->Format($r->_content[$i], $this->Culture);
                 }
             }
         }
     }
     return parent::WdfRender();
 }
Exemplo n.º 8
0
 /**
  * Creates a object id
  * 
  * ScavixWDF will create IDs for <Renderable> objects automatically and ensures uniqueness for
  * the whole session. This method creates such an id based on the given objects classname.
  * It will store it to `$obj->_storage_id` and return it.
  * @param object $obj Object which needs an id
  * @return string The generated object id
  */
 function CreateId(&$obj)
 {
     global $CONFIG;
     if (unserializer_active()) {
         log_trace("create_storage_id while unserializing object of type " . get_class_simple($obj));
         $obj->_storage_id = "to_be_overwritten_by_unserializer";
         return $obj->_storage_id;
     }
     $cn = strtolower(get_class_simple($obj));
     if (!isset($GLOBALS['object_ids'][$cn])) {
         $i = 1;
         while (isset($_SESSION[$CONFIG['session']['prefix'] . "session"][$cn . $i])) {
             $i++;
         }
         $GLOBALS['object_ids'][$cn] = $i;
     } else {
         $GLOBALS['object_ids'][$cn]++;
     }
     $obj->_storage_id = $cn . $GLOBALS['object_ids'][$cn];
     if (session_id()) {
         $_SESSION['object_id_storage'] = $GLOBALS['object_ids'];
     }
     return $obj->_storage_id;
 }
Exemplo n.º 9
0
/**
 * Returns the current chosen controller
 * 
 * Note that if you request a controller object (`$as_string==false`) that may still be a string, if it has not been
 * instaciated yet!
 * @param bool $as_string If true will return the classname (or id if it is from object store)
 * @return mixed Depending on $as_string: Classname/Id or controller object
 */
function current_controller($as_string = true)
{
    if (!isset($GLOBALS['current_controller'])) {
        return $as_string ? '' : null;
    }
    if ($as_string) {
        return strtolower(is_object($GLOBALS['current_controller']) ? get_class_simple($GLOBALS['current_controller']) : $GLOBALS['current_controller']);
    }
    return $GLOBALS['current_controller'];
}
Exemplo n.º 10
0
 private function __collectResourcesInternal($template)
 {
     $res = array();
     if (is_object($template)) {
         $classname = get_class($template);
         // first collect statics from the class definitions
         $static = ResourceAttribute::ResolveAll(ResourceAttribute::Collect($classname));
         $res = array_merge($res, $static);
         if ($template instanceof Renderable) {
             // then check all contents and collect theis includes
             foreach ($template->__getContentVars() as $varname) {
                 $sub = array();
                 foreach ($template->{$varname} as $var) {
                     if (is_object($var) || is_array($var)) {
                         $sub = array_merge($sub, $this->__collectResourcesInternal($var));
                     }
                 }
                 $res = array_merge($res, $sub);
             }
             // for Template class check the template file too
             if ($template instanceof Template) {
                 $fnl = strtolower(array_shift(explode(".", basename($template->file))));
                 if (get_class_simple($template, true) != $fnl) {
                     if (resourceExists("{$fnl}.css")) {
                         $res[] = resFile("{$fnl}.css");
                     } elseif (resourceExists("{$fnl}.less")) {
                         $res[] = resFile("{$fnl}.less");
                     }
                     if (resourceExists("{$fnl}.js")) {
                         $res[] = resFile("{$fnl}.js");
                     }
                 }
             }
             // finally include the 'self' stuff (<classname>.js,...)
             // Note: these can be forced to be loaded in static if they require to be loaded before the contents resources
             $classname = get_class_simple($template);
             $parents = array();
             $cnl = strtolower($classname);
             do {
                 if (resourceExists("{$cnl}.css")) {
                     $parents[] = resFile("{$cnl}.css");
                 } elseif (resourceExists("{$cnl}.less")) {
                     $parents[] = resFile("{$cnl}.less");
                 }
                 if (resourceExists("{$cnl}.js")) {
                     $parents[] = resFile("{$cnl}.js");
                 }
                 $classname = array_pop(explode('\\', get_parent_class(fq_class_name($classname))));
                 $cnl = strtolower($classname);
             } while ($classname != "");
             $res = array_merge($res, array_reverse($parents));
         }
     } elseif (is_array($template)) {
         foreach ($template as $var) {
             if (is_object($var) || is_array($var)) {
                 $res = array_merge($res, $this->__collectResourcesInternal($var));
             }
         }
     }
     return array_unique($res);
 }
Exemplo n.º 11
0
 /**
  * @internal SysAdmin logout event.
  */
 function Logout()
 {
     unset($_SESSION['admin_handler_username']);
     unset($_SESSION['admin_handler_password']);
     redirect(get_class_simple($this), 'login');
 }
Exemplo n.º 12
0
 function __construct()
 {
     $this->title = "TXT_PAYMENTPROVIDER_" . strtoupper(get_class_simple($this));
 }