Ejemplo n.º 1
0
/**
 * uiChartVs
 * 
 * Options:
 *   labelLeft, labelRight   Labels on each side
 * 	 valueLeft, valueRight   Values, will be summed up to calculate percentage
 *   labelLeftMax            Label to use when value of the other side is 0 (OPTIONAL)
 *   labelRightMax
 * 
 * @see /doc/slicing/RevTK/charts/uiChartVs.html
 */
function ui_chart_vs(array $options)
{
    $valueTotal = $options['valueLeft'] + $options['valueRight'];
    $pctLeft = ceil($options['valueLeft'] * 100 / $valueTotal);
    $pctRight = 100 - $pctLeft;
    $captionLeft = isset($options['labelLeftMax']) && $options['valueRight'] == 0 ? $options['labelLeftMax'] : $options['labelLeft'];
    $captionRight = isset($options['labelRightMax']) && $options['valueLeft'] == 0 ? $options['labelRightMax'] : $options['labelRight'];
    $options = array_merge($options, array('pctLeft' => $pctLeft, 'pctRight' => $pctRight, 'bZeroLeft' => $pctLeft == 0, 'bZeroRight' => $pctRight == 0, 'captionLeft' => $captionLeft, 'captionRight' => $captionRight));
    $view = new coreView(coreContext::getInstance());
    $view->getParameterHolder()->add($options);
    $view->setTemplate(dirname(__FILE__) . '/templates/ui_chart_vs.php');
    return $view->render();
}
Ejemplo n.º 2
0
/**
 * Returns HTML code for a uiWindow.
 * 
 * @uses   jquery, jquery UI/Draggable
 * @uses   ui_box_rounded() for the window border
 * 
 * @param  string  $content  HTML content for the uiWindow div.window-body
 * @param  array   $options  Tag attributes as for tag() helper (to set id, etc)
 *                           Classes can be set, "uiWindow" class is merged
 * 
 * @return string  HTML code
 */
function ui_window($content = '', $options = array())
{
    // add uiWindow class
    $options['class'] = _merge_class_names(isset($options['class']) ? $options['class'] : array(), array('uiWindow'));
    $view = new coreView(coreContext::getInstance());
    $view->getParameterHolder()->add(array('content' => $content, 'options' => $options));
    $view->setTemplate(dirname(__FILE__) . '/templates/ui_window.php');
    return $view->render();
}
Ejemplo n.º 3
0
/**
 * Evaluates and returns a component.
 * The syntax is similar to the one of include_component.
 *
 * <b>Example:</b>
 * <code>
 *  echo get_component('mymodule', 'mypartial', array('myvar' => 12345));
 * </code>
 *
 * @param  string module name
 * @param  string component name
 * @param  array variables to be made accessible to the component
 * @return string result of the component execution
 * @see    include_component
 */
function get_component($moduleName, $componentName, $vars = array())
{
    $context = coreContext::getInstance();
    $actionName = '_' . $componentName;
    $allVars = _call_component($moduleName, $componentName, $vars);
    if (!is_null($allVars)) {
        // render
        $view = new coreView($context, $moduleName, $actionName, '');
        //      $view->getParameterHolder()->add($vars);
        $view->getParameterHolder()->add($allVars);
        return $view->render();
    }
}