Пример #1
0
function createJS($arg)
{
    $type = 'JS';
    $prefix = '<script type="text/javascript" src="';
    $suffix = '.js"></script>';
    createElement($arg, $type, $prefix, $suffix);
}
 /**
  * Chargement des contrôles via un template de formulaire.
  *
  * @access    private
  * @return    Zend_Form     Objet du formulaire une foix le template parsé et le formulaire initialisé.
  *
  * @author Etienne de Longeaux <*****@*****.**>
  * @since 2012-06-26
  */
 private function setFormByControls()
 {
     //set instance
     $Allgroup = array();
     //         $instance             = $this->_session->_addInstance();
     //         $instanceElement     = $this->_form->createElement('hidden', 'form_instance');
     //         $instanceElement->setValue($instance);
     //         $this->_form->addElement($instanceElement);
     if ($this->_controls) {
         foreach ($this->_controls as $control) {
             $attribs = $control->attributes();
             $id = (string) $attribs['id'];
             $type = (string) $attribs['type'];
             $this->_AllTypesControls[$type] = $type;
             if ($type == "select") {
                 $opts = explode(';', (string) $attribs['opt']);
                 foreach ($opts as $opts => $values) {
                     $v = explode('_', $values);
                     $_o = $v[0];
                     $_v = $v[1];
                     $options[$_o] = $_v;
                 }
             }
             unset($attribs['id']);
             unset($attribs['type']);
             if (isset($attribs['label'])) {
                 $label = (string) $attribs['label'];
                 unset($attribs['label']);
             } else {
                 $label = $id;
                 // $view->getTranslation($id);
                 $label = str_replace('_', '_', $label);
             }
             $elet_attrib = array();
             if (isset($attribs['size'])) {
                 $elet_attrib['size'] = (string) $attribs['size'];
             }
             $control = $this->_form->createElement($type, $id, $elet_attrib);
             $control->setLabel($this->container->get('translator')->trans($label))->addFilter('StripTags')->addFilter('StringTrim');
             if (isset($attribs['desc']) && (string) $attribs['desc'] != '') {
                 $control->setDescription((string) $attribs['desc']);
             }
             if (isset($attribs['required']) && (string) $attribs['required'] == 'true') {
                 $control->setAttrib('required', 'required');
                 $control->setRequired(true);
             }
             if (isset($attribs['pattern'])) {
                 $control->setAttrib('pattern', (string) $attribs['pattern']);
             }
             if (isset($attribs['maxlength'])) {
                 $control->setAttrib('maxlength', (string) $attribs['maxlength']);
             }
             if (isset($attribs['minlength'])) {
                 $control->setAttrib('minlength', (string) $attribs['minlength']);
             }
             if (isset($attribs['data-equals'])) {
                 $control->setAttrib('data-equals', (string) $attribs['data-equals']);
             }
             if (isset($attribs['rows'])) {
                 $control->setAttrib('rows', (string) $attribs['rows']);
             }
             if (isset($attribs['cols'])) {
                 $control->setAttrib('cols', (string) $attribs['cols']);
             }
             if (isset($attribs['width'])) {
                 $control->setAttrib('width', (string) $attribs['width']);
             }
             if (isset($attribs['class']) && (string) $attribs['class'] != '') {
                 $control->setAttrib('class', (string) $attribs['class']);
             }
             if (isset($attribs['step'])) {
                 $control->setAttrib('step', (string) $attribs['step']);
             }
             if ($type == "select") {
                 $control->addMultiOptions($options);
             }
             if (isset($attribs['value'])) {
                 $control->setValue($attribs['value']);
             }
             $control->setAttrib('rel', isset($attribs['group']) ? (string) $attribs['group'] : 'main');
             $this->_form->addElement($control);
             if (isset(self::$_content['DisplayGroup']) && self::$_content['DisplayGroup'] == true) {
                 // set the display group
                 $NameGroup = isset($attribs['group']) ? (string) $attribs['group'] : 'main';
                 //$this->_form->addDisplayGroup(array($id), $NameGroup, array('legend' => 'Role'));
                 if (isset($Allgroup[$NameGroup]) && !empty($Allgroup[$NameGroup])) {
                     $Allgroup[$NameGroup] = array_merge(array($id), $Allgroup[$NameGroup]);
                 } else {
                     $Allgroup[$NameGroup] = array($id);
                 }
             }
         }
     } else {
         throw new \Zend_Exception("Les controls du formulaire n'ont pas pu être chargés !");
     }
     foreach ($Allgroup as $Name => $elements) {
         $elements = array_reverse($elements);
         $this->_form->addDisplayGroup($elements, $Name, array('legend' => 'Role'));
     }
 }
Пример #3
0
        echo '<font color="red">';
        if ($err_assistant) {
            echo '<font color="*">';
        }
        ?>
  <?php 
        echo $LDassitant . ':';
        echo createElement('assistant', $assistant, 14, 14);
        echo '<font color="red">';
        if ($err_op_room) {
            echo '<font color="*">';
        }
        ?>
  &nbsp; <?php 
        echo $LDOpRoom . ':';
        echo createElement('op_room', $op_room);
        ?>
<p>

<?php 
        if ($mode == 'saveok') {
            ?>

 <input  type="image" <?php 
            echo createLDImgSrc($root_path, 'update_data.gif', '0', 'absmiddle');
            ?>
  alt="<?php 
            echo $LDSave;
            ?>
">
<input type="button" value="<?php 
Пример #4
0
function main()
{
    $data = parseRepoXML();
    //$data = $data->fermat;
    $platformList = [];
    $layerList = [];
    $pluginList = [];
    $superLayerList = [];
    $layerIndex = 0;
    $platformIndex = 0;
    $superLayerIndex = 0;
    foreach ($data->platforms->children() as $platform) {
        array_push($platformList, array('code' => strval($platform['code']), 'name' => strval($platform['name']), 'logo' => strval($platform['logo']), 'index' => $platformIndex));
        if ($platform['dependsOn']) {
            $platformList[$platformIndex]['dependsOn'] = strval($platform['dependsOn']);
        }
        $platformIndex++;
        foreach ($platform->children() as $layer) {
            if (searchName(strval($layer['name']), $layerList) === false) {
                array_push($layerList, array('name' => strval($layer['name']), 'index' => $layerIndex, 'super_layer' => false));
                $layerIndex++;
            }
            if (isset($layer['super_layer'])) {
                foreach ($data->super_layers->children() as $super_layer) {
                    if (search('code', strval($super_layer['code']), $superLayerList) === null) {
                        array_push($superLayerList, array('name' => strval($super_layer['name']), 'code' => strval($super_layer['code']), 'index' => $superLayerIndex));
                        if ($super_layer['dependsOn']) {
                            $superLayerList[$superLayerIndex]['dependsOn'] = strval($super_layer['dependsOn']);
                        }
                        $superLayerIndex++;
                    }
                    if (strval($super_layer['code']) === strval($layer['super_layer'])) {
                        foreach ($super_layer->children() as $sub_superLayer) {
                            if (searchName(strval($sub_superLayer['name']), $layerList) === false) {
                                array_push($layerList, array('name' => strval($sub_superLayer['name']), 'index' => $layerIndex, 'super_layer' => strval($super_layer['code'])));
                                $layerIndex++;
                            }
                            if ($sub_superLayer->androids) {
                                foreach ($sub_superLayer->androids->children() as $android) {
                                    $newElement = createElement($android, 'Android', $sub_superLayer);
                                    array_push($pluginList, $newElement);
                                }
                            }
                            if ($sub_superLayer->plugins) {
                                foreach ($sub_superLayer->plugins->children() as $plugin) {
                                    $newElement = createElement($plugin, 'Plugin', $sub_superLayer);
                                    array_push($pluginList, $newElement);
                                }
                            }
                            if ($sub_superLayer->addons) {
                                foreach ($sub_superLayer->addons->children() as $addon) {
                                    $newElement = createElement($addon, 'Addon', $sub_superLayer);
                                    array_push($pluginList, $newElement);
                                }
                            }
                            if ($sub_superLayer->libraries) {
                                foreach ($sub_superLayer->libraries->children() as $library) {
                                    $newElement = createElement($library, 'Library', $sub_superLayer);
                                    array_push($pluginList, $newElement);
                                }
                            }
                        }
                    }
                }
            } else {
                if ($layer->androids) {
                    foreach ($layer->androids->children() as $android) {
                        $newElement = createElement($android, 'Android', $layer, $platform);
                        array_push($pluginList, $newElement);
                    }
                }
                if ($layer->plugins) {
                    foreach ($layer->plugins->children() as $plugin) {
                        $newElement = createElement($plugin, 'Plugin', $layer, $platform);
                        array_push($pluginList, $newElement);
                    }
                }
                if ($layer->addons) {
                    foreach ($layer->addons->children() as $addon) {
                        $newElement = createElement($addon, 'Addon', $layer, $platform);
                        array_push($pluginList, $newElement);
                    }
                }
                if ($layer->libraries) {
                    foreach ($layer->libraries->children() as $library) {
                        $newElement = createElement($library, 'Library', $layer, $platform);
                        array_push($pluginList, $newElement);
                    }
                }
            }
        }
    }
    $result = array('groups' => $platformList, 'layers' => $layerList, 'plugins' => $pluginList, 'superLayers' => $superLayerList);
    $output = gzencode(json_encode($result));
    header('Content-Encoding: gzip');
    header("Access-Control-Allow-Origin: *");
    //header('Content-Length: '.strlen($gzipoutput));
    echo $output;
}