Example #1
0
 public function index($params)
 {
     $this->setPageTitle(OW::getLanguage()->text('spdownload', 'category_index_page_title'));
     $this->setPageHeading(OW::getLanguage()->text('spdownload', 'category_index_page_heading'));
     $category = array();
     if (!empty($params) && isset($params['categoryId'])) {
         $category = SPDOWNLOAD_BOL_CategoryDao::getInstance()->findById($params['categoryId']);
     }
     $downloads = SPDOWNLOAD_BOL_CategoryService::getInstance()->getCategoryList();
     $downloadCategories = array();
     foreach ($downloads as $key => $value) {
         $downloadCategories[$value->id] = $value->name;
     }
     $form = new Form('add_category');
     $this->addForm($form);
     // Create selectbox
     $fieldTo = new SelectBox('parent_category');
     foreach ($downloadCategories as $key => $label) {
         $fieldTo->addOption($key, $label);
     }
     if (!empty($params) && isset($params['categoryId'])) {
         $fieldTo->setValue($category->parentId);
     }
     $fieldTo->setLabel(OW::getLanguage()->text('spdownload', 'ad_parent_category'));
     $form->addElement($fieldTo);
     $fieldCate = new TextField('category');
     $fieldCate->setLabel(OW::getLanguage()->text('spdownload', 'ad_label_category'));
     if (!empty($params) && isset($params['categoryId'])) {
         $fieldCate->setValue($category->name);
     }
     $fieldCate->setRequired();
     $fieldCate->setHasInvitation(true);
     $form->addElement($fieldCate);
     $submit = new Submit('add');
     $submit->setValue(OW::getLanguage()->text('spdownload', 'form_add_category_submit'));
     $form->addElement($submit);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             if ($data['parent_category'] == null) {
                 $data['parent_category'] = 0;
             }
             if (!empty($params) && isset($params['categoryId'])) {
                 SPDOWNLOAD_BOL_CategoryService::getInstance()->addCategory($data['category'], $data['parent_category'], $params['categoryId']);
             } else {
                 SPDOWNLOAD_BOL_CategoryService::getInstance()->addCategory($data['category'], $data['parent_category']);
             }
             $this->redirect(OW::getRouter()->urlForRoute('spdownload.category_list'));
         }
     }
 }
 /**
  * Generates control's HTML element.
  * @return Html
  */
 public function getControl()
 {
     $control = parent::getControl();
     $control->name .= '[]';
     $control->multiple = TRUE;
     return $control;
 }
Example #3
0
 /**
  * Adds a validation rule.
  * Adds default error messages
  * 
  * @param  mixed      rule type
  * @param  string     message to display for invalid data
  * @param  mixed      optional rule arguments
  * @return FormControl  provides a fluent interface
  */
 public function addRule($operation, $message = NULL, $arg = NULL)
 {
     if ($operation === ':filled' and is_null($message)) {
         $message = 'Choose %label';
     }
     return parent::addRule($operation, $message, $arg);
 }
Example #4
0
 public static function Factory($name, $valueList, $label = '', $required = false, $selected = array(), $attrList = array())
 {
     $element = new SelectBox($name);
     $element->setValue($valueList);
     $element->setLabel($label);
     $element->setRequired($required);
     $element->setOptionList($attrList);
     $element->setSelectedValueList($selected);
     return $element;
 }
Example #5
0
function &create_node_box(&$root, &$pipeline)
{
    // Determine CSS proerty value for current child
    $css_state =& $pipeline->get_current_css_state();
    $css_state->pushDefaultState();
    $default_css = $pipeline->get_default_css();
    $default_css->apply($root, $css_state, $pipeline);
    // Store the default 'display' value; we'll need it later when checking for impossible tag/display combination
    $handler =& CSS::get_handler(CSS_DISPLAY);
    $default_display = $handler->get($css_state->getState());
    // Initially generated boxes do not require block wrappers
    // Block wrappers are required in following cases:
    // - float property is specified for non-block box which cannot be directly converted to block box
    //   (a button, for example)
    // - display set to block for such box
    $need_block_wrapper = false;
    // TODO: some inheritance magic
    // Order is important. Items with most priority should be applied last
    // Tag attributes
    execute_attrs_before($root, $pipeline);
    // CSS stylesheet
    $css =& $pipeline->get_current_css();
    $css->apply($root, $css_state, $pipeline);
    // values from 'style' attribute
    if ($root->has_attribute("style")) {
        parse_style_attr($root, $css_state, $pipeline);
    }
    _fix_tag_display($default_display, $css_state, $pipeline);
    execute_attrs_after_styles($root, $pipeline);
    // CSS 2.1:
    // 9.7 Relationships between 'display', 'position', and 'float'
    // The three properties that affect box generation and layout —
    // 'display', 'position', and 'float' — interact as follows:
    // 1. If 'display' has the value 'none', then 'position' and 'float' do not apply.
    //    In this case, the element generates no box.
    $position_handler =& CSS::get_handler(CSS_POSITION);
    $float_handler =& CSS::get_handler(CSS_FLOAT);
    // 2. Otherwise, if 'position' has the value 'absolute' or 'fixed', the box is absolutely positioned,
    //    the computed value of 'float' is 'none', and display is set according to the table below.
    //    The position of the box will be determined by the 'top', 'right', 'bottom' and 'left' properties and
    //    the box's containing block.
    $position = $css_state->get_property(CSS_POSITION);
    if ($position === CSS_PROPERTY_INHERIT) {
        $position = $css_state->getInheritedProperty(CSS_POSITION);
    }
    if ($position === POSITION_ABSOLUTE || $position === POSITION_FIXED) {
        $float_handler->replace(FLOAT_NONE, $css_state);
        $need_block_wrapper |= _fix_display_position_float($css_state);
    }
    // 3. Otherwise, if 'float' has a value other than 'none', the box is floated and 'display' is set
    //    according to the table below.
    $float = $css_state->get_property(CSS_FLOAT);
    if ($float != FLOAT_NONE) {
        $need_block_wrapper |= _fix_display_position_float($css_state);
    }
    // Process some special nodes, which should not get their 'display' values overwritten (unless
    // current display value is 'none'
    $current_display = $css_state->get_property(CSS_DISPLAY);
    if ($current_display != 'none') {
        switch ($root->tagname()) {
            case 'body':
                $handler =& CSS::get_handler(CSS_DISPLAY);
                $handler->css('-body', $pipeline);
                break;
            case 'br':
                $handler =& CSS::get_handler(CSS_DISPLAY);
                $handler->css('-break', $pipeline);
                break;
            case 'img':
                $handler =& CSS::get_handler(CSS_DISPLAY);
                $need_block_wrapper |= $handler->get($css_state->getState()) == 'block';
                $handler->css('-image', $pipeline);
                break;
        }
    }
    // 4. Otherwise, if the element is the root element, 'display' is set according to the table below.
    // 5. Otherwise, the remaining 'display' property values apply as specified. (see _fix_display_position_float)
    switch ($css_state->get_property(CSS_DISPLAY)) {
        case 'block':
            $box =& BlockBox::create($root, $pipeline);
            break;
        case '-break':
            $box =& BRBox::create($pipeline);
            break;
        case '-body':
            $box =& BodyBox::create($root, $pipeline);
            break;
        case '-button':
            $box =& ButtonBox::create($root, $pipeline);
            break;
        case '-button-reset':
            $box =& ButtonResetBox::create($root, $pipeline);
            break;
        case '-button-submit':
            $box =& ButtonSubmitBox::create($root, $pipeline);
            break;
        case '-button-image':
            $box =& ButtonImageBox::create($root, $pipeline);
            break;
        case '-checkbox':
            $box =& CheckBox::create($root, $pipeline);
            break;
        case '-form':
            $box =& FormBox::create($root, $pipeline);
            break;
        case '-frame':
            inc_frame_level();
            $box =& FrameBox::create($root, $pipeline);
            dec_frame_level();
            break;
        case '-frameset':
            inc_frame_level();
            $box =& FramesetBox::create($root, $pipeline);
            dec_frame_level();
            break;
        case '-iframe':
            inc_frame_level();
            $box =& IFrameBox::create($root, $pipeline);
            dec_frame_level();
            break;
        case '-textarea':
            $box =& TextAreaInputBox::create($root, $pipeline);
            break;
        case '-image':
            $box =& IMGBox::create($root, $pipeline);
            break;
        case 'inline':
            $box =& InlineBox::create($root, $pipeline);
            break;
        case 'inline-block':
            $box =& InlineBlockBox::create($root, $pipeline);
            break;
        case '-legend':
            $box =& LegendBox::create($root, $pipeline);
            break;
        case 'list-item':
            $box =& ListItemBox::create($root, $pipeline);
            break;
        case 'none':
            $box =& NullBox::create();
            break;
        case '-radio':
            $box =& RadioBox::create($root, $pipeline);
            break;
        case '-select':
            $box =& SelectBox::create($root, $pipeline);
            break;
        case 'table':
            $box =& TableBox::create($root, $pipeline);
            break;
        case 'table-cell':
            $box =& TableCellBox::create($root, $pipeline);
            break;
        case 'table-row':
            $box =& TableRowBox::create($root, $pipeline);
            break;
        case 'table-row-group':
        case 'table-header-group':
        case 'table-footer-group':
            $box =& TableSectionBox::create($root, $pipeline);
            break;
        case '-text':
            $box =& TextInputBox::create($root, $pipeline);
            break;
        case '-password':
            $box =& PasswordInputBox::create($root, $pipeline);
            break;
        default:
            /**
             * If 'display' value is invalid or unsupported, fall back to 'block' mode
             */
            error_log("Unsupported 'display' value: " . $css_state->get_property(CSS_DISPLAY));
            $box =& BlockBox::create($root, $pipeline);
            break;
    }
    // Now check if pseudoelement should be created; in this case we'll use the "inline wrapper" box
    // containing both generated box and pseudoelements
    //
    $pseudoelements = $box->get_css_property(CSS_HTML2PS_PSEUDOELEMENTS);
    if ($pseudoelements & CSS_HTML2PS_PSEUDOELEMENTS_BEFORE) {
        // Check if :before preudoelement exists
        $before =& create_pdf_pseudoelement($root, SELECTOR_PSEUDOELEMENT_BEFORE, $pipeline);
        if (!is_null($before)) {
            $box->insert_child(0, $before);
        }
    }
    if ($pseudoelements & CSS_HTML2PS_PSEUDOELEMENTS_AFTER) {
        // Check if :after pseudoelement exists
        $after =& create_pdf_pseudoelement($root, SELECTOR_PSEUDOELEMENT_AFTER, $pipeline);
        if (!is_null($after)) {
            $box->add_child($after);
        }
    }
    // Check if this box needs a block wrapper (for example, floating button)
    // Note that to keep float/position information, we clear the CSS stack only
    // AFTER the wrapper box have been created; BUT we should clear the following CSS properties
    // to avoid the fake wrapper box actually affect the layout:
    // - margin
    // - border
    // - padding
    // - background
    //
    if ($need_block_wrapper) {
        /**
         * Clear POSITION/FLOAT properties on wrapped boxes
         */
        $box->setCSSProperty(CSS_POSITION, POSITION_STATIC);
        $box->setCSSProperty(CSS_POSITION, FLOAT_NONE);
        $wc = $box->get_css_property(CSS_WIDTH);
        // Note that if element width have been set as a percentage constraint and we're adding a block wrapper,
        // then we need to:
        // 1. set the same percentage width constraint to the wrapper element (will be done implicilty if we will not
        // modify the 'width' CSS handler stack
        // 2. set the wrapped element's width constraint to 100%, otherwise it will be narrower than expected
        if ($wc->isFraction()) {
            $box->setCSSProperty(CSS_WIDTH, new WCFraction(1));
        }
        $handler =& CSS::get_handler(CSS_MARGIN);
        $box->setCSSProperty(CSS_MARGIN, $handler->default_value());
        /** 
         * Note:  default border does  not contain  any fontsize-dependent
         * values, so we may safely use zero as a base font size
         */
        $border_handler =& CSS::get_handler(CSS_BORDER);
        $value = $border_handler->default_value();
        $value->units2pt(0);
        $box->setCSSProperty(CSS_BORDER, $value);
        $handler =& CSS::get_handler(CSS_PADDING);
        $box->setCSSProperty(CSS_PADDING, $handler->default_value());
        $handler =& CSS::get_handler(CSS_BACKGROUND);
        $box->setCSSProperty(CSS_BACKGROUND, $handler->default_value());
        // Create "clean" block box
        $wrapper =& new BlockBox();
        $wrapper->readCSS($pipeline->get_current_css_state());
        $wrapper->add_child($box);
        // Remove CSS propery values from stack
        execute_attrs_after($root, $pipeline);
        $css_state->popState();
        return $wrapper;
    } else {
        // Remove CSS propery values from stack
        execute_attrs_after($root, $pipeline);
        $css_state->popState();
        $box->set_tagname($root->tagname());
        return $box;
    }
}
Example #6
0
 function output()
 {
       global $gTables;
       $query = "SELECT ".$gTables['agenti'].".id_agente,".$gTables['agenti'].".id_fornitore,".$gTables['anagra'].".ragso1,".$gTables['clfoco'].".codice
                 FROM ".$gTables['agenti']." LEFT JOIN ".$gTables['clfoco']." ON ".$gTables['agenti'].".id_fornitore = ".$gTables['clfoco'].".codice
                 LEFT JOIN ".$gTables['anagra']." ON ".$gTables['clfoco'].".id_anagra = ".$gTables['anagra'].".id";
       SelectBox::_output($query, 'ragso1', True,'','',"id_agente",'AGENTE');
 }
Example #7
0
 function output()
 {
     global $gTables;
     $query = 'SELECT * FROM `' . $gTables['imball'] . '` ORDER BY `codice`';
     SelectBox::_output($query, 'codice', True, '-', 'descri');
 }
Example #8
0
function &create_pdf_box(&$root, &$pipeline)
{
    switch ($root->node_type()) {
        case XML_DOCUMENT_NODE:
            // TODO: some magic from traverse_dom_tree
            $box =& BlockBox::create($root, $pipeline);
            break;
        case XML_ELEMENT_NODE:
            // Determine CSS proerty value for current child
            push_css_defaults();
            global $g_css_defaults_obj;
            $g_css_defaults_obj->apply($root, $pipeline);
            // Store the default 'display' value; we'll need it later when checking for impossible tag/display combination
            $handler =& get_css_handler('display');
            $default_display = $handler->get();
            // Initially generated boxes do not require block wrappers
            // Block wrappers are required in following cases:
            // - float property is specified for non-block box which cannot be directly converted to block box
            //   (a button, for example)
            // - display set to block for such box
            $need_block_wrapper = false;
            // TODO: some inheritance magic
            // Order is important. Items with most priority should be applied last
            // Tag attributes
            execute_attrs_before($root, $pipeline);
            // CSS stylesheet
            global $g_css_obj;
            $g_css_obj->apply($root, $pipeline);
            // values from 'style' attribute
            if ($root->has_attribute("style")) {
                parse_style_attr(null, $root, $pipeline);
            }
            _fix_tag_display($default_display, $pipeline);
            // TODO: do_tag_specials
            // TODO: execute_attrs_after_styles
            // CSS 2.1:
            // 9.7 Relationships between 'display', 'position', and 'float'
            // The three properties that affect box generation and layout —
            // 'display', 'position', and 'float' — interact as follows:
            // 1. If 'display' has the value 'none', then 'position' and 'float' do not apply.
            //    In this case, the element generates no box.
            $position_handler =& get_css_handler('position');
            $float_handler =& get_css_handler('float');
            // 2. Otherwise, if 'position' has the value 'absolute' or 'fixed', the box is absolutely positioned,
            //    the computed value of 'float' is 'none', and display is set according to the table below.
            //    The position of the box will be determined by the 'top', 'right', 'bottom' and 'left' properties and
            //    the box's containing block.
            $position = $position_handler->get();
            if ($position === POSITION_ABSOLUTE || $position === POSITION_FIXED) {
                $float_handler->replace(FLOAT_NONE);
                $need_block_wrapper |= _fix_display_position_float();
            }
            // 3. Otherwise, if 'float' has a value other than 'none', the box is floated and 'display' is set
            //    according to the table below.
            $float = $float_handler->get();
            if ($float != FLOAT_NONE) {
                $need_block_wrapper |= _fix_display_position_float();
            }
            // Process some special nodes
            // BR
            if ($root->tagname() == "br") {
                $handler =& get_css_handler('display');
                $handler->css('-break', $pipeline);
            }
            if ($root->tagname() == "img") {
                $handler =& get_css_handler('display');
                $need_block_wrapper |= $handler->get() == "block";
                $handler->css('-image', $pipeline);
            }
            // 4. Otherwise, if the element is the root element, 'display' is set according to the table below.
            // 5. Otherwise, the remaining 'display' property values apply as specified. (see _fix_display_position_float)
            $display_handler =& get_css_handler('display');
            switch (trim($display_handler->get())) {
                case "block":
                    $box =& BlockBox::create($root, $pipeline);
                    break;
                case "-break":
                    $box =& BRBox::create($pipeline);
                    break;
                case "-button":
                    $box =& ButtonBox::create($root, $pipeline);
                    break;
                case "-button-reset":
                    $box =& ButtonResetBox::create($root, $pipeline);
                    break;
                case "-button-submit":
                    $box =& ButtonSubmitBox::create($root, $pipeline);
                    break;
                case "-button-image":
                    $box =& ButtonImageBox::create($root, $pipeline);
                    break;
                case "-checkbox":
                    $box =& CheckBox::create($root, $pipeline);
                    break;
                case "-form":
                    $box =& FormBox::create($root, $pipeline);
                    break;
                case "-frame":
                    inc_frame_level();
                    $box =& FrameBox::create($root, $pipeline);
                    dec_frame_level();
                    break;
                case "-frameset":
                    inc_frame_level();
                    $box =& FramesetBox::create($root, $pipeline);
                    dec_frame_level();
                    break;
                case "-iframe":
                    inc_frame_level();
                    $box =& IFrameBox::create($root, $pipeline);
                    dec_frame_level();
                    break;
                case "-textarea":
                    $box =& TextAreaInputBox::create($root, $pipeline);
                    break;
                case "-image":
                    $box =& IMGBox::create($root, $pipeline);
                    break;
                case "inline":
                    $box =& InlineBox::create($root, $pipeline);
                    break;
                case "inline-block":
                    $box =& InlineBlockBox::create($root, $pipeline);
                    break;
                case "-legend":
                    $box =& LegendBox::create($root, $pipeline);
                    break;
                case "list-item":
                    $box =& ListItemBox::create($root, $pipeline);
                    break;
                case "none":
                    $box =& NullBox::create($root, $pipeline);
                    break;
                case "-radio":
                    $box =& RadioBox::create($root, $pipeline);
                    break;
                case "-select":
                    $box =& SelectBox::create($root, $pipeline);
                    break;
                case "table":
                    $box =& TableBox::create($root, $pipeline);
                    break;
                case "table-cell":
                    $box =& TableCellBox::create($root, $pipeline);
                    break;
                case "table-row":
                    $box =& TableRowBox::create($root, $pipeline);
                    break;
                case "-table-section":
                    $box =& TableSectionBox::create($root, $pipeline);
                    break;
                case "-text":
                    $box =& TextInputBox::create($root, $pipeline);
                    break;
                case "-password":
                    $box =& PasswordInputBox::create($root, $pipeline);
                    break;
                default:
                    die("Unsupported 'display' value: " . $display_handler->get());
            }
            // Now check if pseudoelement should be created; in this case we'll use the "inline wrapper" box
            // containing both generated box and pseudoelements
            //
            if ($box->content_pseudoelement !== "") {
                $content_handler =& get_css_handler('content');
                // Check if :before preudoelement exists
                $before = create_pdf_pseudoelement($root, SELECTOR_PSEUDOELEMENT_BEFORE, $pipeline);
                if ($before) {
                    $box->insert_child(0, $before);
                }
                // Check if :after pseudoelement exists
                $after = create_pdf_pseudoelement($root, SELECTOR_PSEUDOELEMENT_AFTER, $pipeline);
                if ($after) {
                    $box->add_child($after);
                }
            }
            // Check if this box needs a block wrapper (for example, floating button)
            // Note that to keep float/position information, we clear the CSS stack only
            // AFTER the wrapper box have been created; BUT we should clear the following CSS properties
            // to avoid the fake wrapper box actually affect the layout:
            // - margin
            // - border
            // - padding
            // - background
            //
            if ($need_block_wrapper) {
                // Note that if element width have been set as a percentage constraint and we're adding a block wrapper,
                // then we need to:
                // 1. set the same percentage width constraint to the wrapper element (will be done implicilty if we will not
                // modify the 'width' CSS handler stack
                // 2. set the wrapped element's width constraint to 100%, otherwise it will be narrower than expected
                if (is_a($box->_width_constraint, "WCFraction")) {
                    $box->_width_constraint = new WCFraction(1);
                }
                $handler =& get_css_handler('margin');
                $box->margin = $handler->default_value();
                $box->border = new BorderPDF(default_border());
                $handler =& get_css_handler('padding');
                $box->padding = $handler->default_value();
                $handler =& get_css_handler('background');
                $box->background = $handler->default_value();
                //       $handler =& get_css_handler('margin');
                //       $box->margin = $handler->parse("0");
                //       // Clear CSS properties
                //       pop_border();
                //       push_border(default_border());
                //       $handler =& get_css_handler('padding');
                //       $handler->css('0');
                //       $handler =& get_css_handler('background');
                //       $handler->css('transparent');
                // Create "clean" block box
                $wrapper =& new BlockBox();
                $wrapper->add_child($box);
                // Remove CSS propery values from stack
                execute_attrs_after($root, $pipeline);
                pop_css_defaults();
                // Clear CSS properties handled by wrapper
                $box->float = FLOAT_NONE;
                $box->position = POSITION_STATIC;
                return $wrapper;
            } else {
                // Remove CSS propery values from stack
                execute_attrs_after($root, $pipeline);
                pop_css_defaults();
                return $box;
            }
            break;
        case XML_TEXT_NODE:
            // Determine CSS property value for current child
            push_css_text_defaults();
            // No text boxes generated by empty text nodes
            //    if (trim($root->content) !== "") {
            if ($root->content !== "") {
                $box =& InlineBox::create($root, $pipeline);
            } else {
                $box = null;
            }
            // Remove CSS property values from stack
            pop_css_defaults();
            return $box;
            break;
        default:
            die("Unsupported node type:" . $root->node_type());
    }
}
Example #9
0
 function getControl()
 {
     $control = parent::getControl();
     $control->multiple = TRUE;
     return $control;
 }
Example #10
0
 /**
  * Generates control's HTML element.
  * @return Html
  */
 public function getControl()
 {
     return parent::getControl()->multiple(TRUE);
 }
Example #11
0
$PRIORITY = new SelectBox('Чему уделяется приоритет?', 'Выберите ответ');
$PRIORITY->addItem('Борьбе', 'Дзюдо')->addItem('Ударам', 'Бокс');
$DANCE = new SelectBox('Любит танцевать?', 'Выберите ответ');
$DANCE->addItem('Да', 'Хореография')->addItem('Нет', 'Театр');
$SING = new SelectBox('Любит петь?', 'Выберите ответ');
$SING->addItem('Да', 'Вокал')->addItem('Нет', 'Театр');
$VIDEO = new SelectBox('Любит смотреть видео?', 'Выберите ответ');
$VIDEO->addItem('Нет', 'Композитор')->addItem('Да', 'Звукорежиссер');
$HELP = new SelectBox('С помощью чего?', 'Выберите ответ');
$HELP->addItem('Иглы', 'Вышивка')->addItem('Спиц', 'Вязание')->addItem('Руками', 'Плетение');
$MAKE = new SelectBox('Что он с ней делает?', 'Выберите ответ');
$MAKE->addItem('Клеит', 'Аппликация')->addItem('Складывает', 'Оригами')->addItem('Скручивает', 'Квиллинг');
$COUPLE = new SelectBox('Игра в паре?', 'Выберите ответ');
$COUPLE->addItem('Да', 'Теннис')->addItem('Нет', 'ACTION');
$ACTION = new SelectBox('Какие действия производят с мячом?', 'Выберите действие');
$ACTION->addItem('Бросают в корзину', 'Баскетбол')->addItem('Перебрасывают через сетку', 'Волейбол')->addItem('Забивают в ворота', 'Футбол');
$selects = array('PURPOSE' => $PURPOSE, 'SPORT' => $SPORT, 'SCENE' => $SCENE, 'COUNT' => $COUNT, 'ITEMS' => $ITEMS, 'INTELLECT' => $INTELLECT, 'SELF' => $SELF, 'ART' => $ART, 'TOOL' => $TOOL, 'TECHNOLOGY' => $TECHNOLOGY, 'LANGUAGE' => $LANGUAGE, 'MUSIC' => $MUSIC, 'BALL' => $BALL, 'AUTOR' => $AUTOR, 'PRIORITY' => $PRIORITY, 'DANCE' => $DANCE, 'SING' => $SING, 'VIDEO' => $VIDEO, 'HELP' => $HELP, 'MAKE' => $MAKE, 'COUPLE' => $COUPLE, 'ACTION' => $ACTION);
// Будем просматривать данный массив и возвращать выбранный объект в зависимости
// от парметра $_GET['key'] передаваемого jQuery
// Вы можете модифицировать код для выбора результата из таблицы
if (array_key_exists($_GET['key'], $selects)) {
    header('Content-type: application/json');
    echo $selects[$_GET['key']]->toJSON();
} elseif (isset($_GET['key'])) {
    $answer = new SelectBox($_GET['key'], 'answer');
    header('Content-type: application/json');
    echo $answer->toJSON();
} else {
    header("HTTP/1.0 404 Not Found");
    header('Status: 404 Not Found');
}
Example #12
0
 /**
  * @param  string  label
  * @param  int  width of the control
  * @param  int  maximum number of characters the user may enter
  */
 public function __construct($label, $from = null, $to = null, $sequence = null, $default = null)
 {
     parent::__construct($label);
     $this->setRange($from, $to, $sequence, $default);
 }
Example #13
0
 public function getHTML()
 {
     return $this->dayBox->getHTML() . $this->monthBox->getHTML() . $this->yearBox->getHTML();
 }
Example #14
0
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('eventx', 'add_form_title_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     if (OW::getConfig()->getValue('eventx', 'enableCategoryList') == '1') {
         if (OW::getConfig()->getValue('eventx', 'enableMultiCategories') == 1) {
             $element = new CheckboxGroup('event_category');
             $element->setColumnCount(3);
         } else {
             $element = new SelectBox('event_category');
         }
         $element->setRequired(true);
         $element->setLabel($language->text('eventx', 'event_category_label'));
         foreach (EVENTX_BOL_EventService::getInstance()->getCategoriesList() as $category) {
             $element->addOption($category->id, $category->name);
         }
         $this->addElement($element);
     }
     $maxInvites = new TextField('max_invites');
     $maxInvites->setRequired();
     $validator = new IntValidator(0);
     $validator->setErrorMessage($language->text('eventx', 'invalid_integer_value'));
     $maxInvites->addValidator($validator);
     $maxInvites->setLabel($language->text('eventx', 'add_form_maxinvites_label'));
     $this->addElement($maxInvites);
     $location = new TextField('location');
     $location->setRequired();
     $location->setId('location');
     $location->setLabel($language->text('eventx', 'add_form_location_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('eventx', 'add_form_who_can_view_option_anybody'), '2' => $language->text('eventx', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('eventx', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENTX_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('eventx', 'add_form_who_can_invite_option_participants'), EVENTX_BOL_EventService::CAN_INVITE_CREATOR => $language->text('eventx', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('eventx', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('eventx', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('eventx', 'add_form_image_label'));
     $this->addElement($imageField);
     if (OW::getConfig()->getValue('eventx', 'enableTagsList') == '1') {
         $tags = new TagsInputField('tags');
         $tags->setId('tags');
         $tags->setLabel($language->text('base', 'tags_cloud_cap_label'));
         $this->addElement($tags);
     }
     $submit = new Submit('submit');
     $submit->setValue($language->text('eventx', 'add_form_submit_label'));
     $this->addElement($submit);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }