<!--[if lt IE 9]> <script src="../../assets/js/html5shiv.js"></script> <script src="../../assets/js/respond.min.js"></script> <![endif]--> </head> <body> <?php showNavbar($user); ?> <ol class="breadcrumb"> <li><a href="index.php">Home</a></li> <li class="active">Forms</li> </ol> <div class="container"> <h2>Forms:</h2> <div class="list-group"> <?php // Show the list of forms. $qTools = new FormTools(); $qTools->showFormList("form.php"); ?> </div> <a href="form.php" class="btn btn-lg btn-primary btn-block" value="add" name="add-submit" />New</a> </div> </body> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="//code.jquery.com/jquery-latest.min.js"></script> <script src="js/bootstrap.js"></script> </html>
define("_DEFAULT_MIN_ACTIONS_", 0); define("_COMMENTS_OFFSET_", 50); /* * ************** Extracción de parámetros ************** */ $usersStr = FormTools::getParameter('users'); $limit = FormTools::getParameter('limit') === false ? _DEFAULT_LIMIT_ : FormTools::getParameter('limit'); $since = FormTools::getParameter('since'); $format = FormTools::getParameter('format') === false ? _DEFAULT_FORMAT_ : strtolower(FormTools::getParameter('format')); $zone = FormTools::getParameter('zone'); $keywordsStr = FormTools::getParameter('keywords'); $tagsStr = FormTools::getParameter('tags'); $commentersStr = FormTools::getParameter('commenters'); $minActions = FormTools::getParameter('minactions') === false ? _DEFAULT_MIN_ACTIONS_ : FormTools::getParameter('minactions'); $userName = FormTools::getParameter('getId'); $getCommenters = FormTools::getParameter('getCommenters'); $getComments = FormTools::getParameter('getComments') === false ? false : true; $ThirdPartyPosts = FormTools::getParameter('getThirdPartyPosts') === false ? false : true; /* * ************** Procesamiento de parámetros ************** */ //Formato de respuesta switch ($format) { case "json": header('Content-Type: text/javascript; charset=utf-8'); break; case "xml": header("Content-Type: application/xml; charset=utf-8"); break; default: header("Content-Type: text/plain; charset=utf-8"); } $since = substr($since, 0, strlen($since) - 3); $users = false; $usersLat = false;
?> "> <h2>Form Title:</h2> <input type="text" class="form-control well-lg" placeholder="Form Title" autofocus name="title" required value="<?php echo $form->title; ?> " /> <h2 style="display: inline">Active?</h2> <input type="checkbox" class="form-control" name="active" <?php if ($form->active == 1) { echo 'checked'; } ?> /><br /> <?php $fTool = new FormTools(); // // If we are viewing an existing form, show the form's questions (if any). // if ($form->id != "") { $fTool->showFormQuestions($form->id, "question.php"); } // // If this is a new form (that isn't in the db yet), just show the Add button. // Otherwise, show Modify, Delete and New buttons. // if ($mode == "insert") { echo '<button type="submit" class="btn btn-lg btn-primary btn-block" value="add" name="add-submit" />Add</button>'; } else { echo '<button type="submit" class="btn btn-lg btn-primary btn-block" value="modify" name="modify-submit" />Modify</button>'; echo '<button data-toggle="modal" href="#myModal" class="btn btn-lg btn-primary btn-block" value="delete">Delete</button>';
/** * FormTools::writeOptionsFromCollection() * retourne un tableau d'options à partir de la collection passée en * paramètre et de la méthode à afficher comme label du select. * * @static * @param Object Collection $col une collection d'objet * @param mixed $selID la ou les valeurs selectionnées par défaut * @param string $labelmethod méthode à appelé pour le contenu de l'option * @param boolean $addNullEntry true pour ajouter une option 'Sélectionnez * un élément' * @return void */ static function writeOptionsFromCollection($col, $selID = 0, $labelmethod = 'toString', $addNullEntry = false) { $options = array(); if ($col instanceof Collection) { $dataArray = array(); $count = $col->getCount(); for ($i = 0; $i < $count; $i++) { $item = $col->getItem($i); if (method_exists($item, 'getId') && method_exists($item, $labelmethod)) { $dataArray[$item->getId()] = $item->{$labelmethod}(); } unset($item); } $options = FormTools::writeOptionsFromArray($dataArray, $selID, $addNullEntry); } return $options; }
/** * GridColumnFieldMapper::render() * * @param $object * @return string */ public function render($object) { $return = Tools::getValueFromMacro($object, $this->macro); // Le rendu par defaut if (empty($this->render)) { return $return; } else { $render = $this->render; if ($render['Type'] == 'text') { // On supprime les '%' si Name non fourni $name = !isset($render['Name']) ? strtr($this->macro, array('%' => '')) : $render['Name']; return sprintf('<input type="text" size="12" value="%s" name="%s[]" />', $return, $name); } elseif ($render['Type'] == 'select') { if (!isset($render['Coll'])) { die('Error: specifiez une collection au FieldMapper!!'); } // On supprime les '%' et le '.Id' final si Name non fourni if (!isset($render['Name'])) { $cleanedMacro = strtr($this->macro, array('%' => '')); $render['Name'] = substr($cleanedMacro, 0, strlen($cleanedMacro) - 3); } $name = $render['Name']; $options = FormTools::writeOptionsFromCollection($render['Coll'], $return); return sprintf('<select name="%s[]" >%s</select>', $name, implode("\n\t", $options)); } } }