Example #1
0
 public function testFormAttributes()
 {
     $this->assertEquals(Form::METHOD_POST, $this->object->getMethod());
     $this->object->setMethod(Form::METHOD_GET);
     $this->assertEquals(Form::METHOD_GET, $this->object->getMethod());
     $this->assertEquals(null, $this->object->getAction());
     $this->object->setAction('/some/url');
     $this->assertEquals('/some/url', $this->object->getAction());
     $this->assertFalse($this->object->isMultipart());
     $this->object->setMultipart(true);
     $this->assertTrue($this->object->isMultipart());
     $this->assertInstanceOf('\\ArrayIterator', $this->object->getIterator());
 }
Example #2
0
        $idUser = $req->fetch();
        $user = new User(0, "", "", "", "", "");
        $_SESSION["user"] = $user->getUserByID($idUser["idUser"]);
        header("Location: /Salon/Canal");
    } else {
        if ($req->rowCount() == 0) {
            $_SESSION["erreur"][] = "Les identifiant données sont invalide.";
            echo "Les identifiant données sont invalide.";
        } else {
            $_SESSION["erreur"][] = "Une erreur est survenu au seins de la base de données.";
            echo "Une erreur est survenu au seins de la base de données.";
        }
    }
    if (isset($_SESSION["erreur"])) {
        header("Location: /Erreur");
    }
}
?>


<?php 
$formConnexion = new Form("Connexion");
$formConnexion->setMethod("POST");
$formConnexion->setAction("/Portail/Connexion");
$pseudo = new Element("login", "Votre pseudo");
$password = new Element("password", "Mot de passe");
$password->setTypeElement("password");
$formConnexion->addElement($pseudo);
$formConnexion->addElement($password);
$formConnexion->submit("Entrez dans le Tchat");
echo $formConnexion->render();
Example #3
0
<?php

include "vue/rsc/part/avatar.php";
authentificationRequire();
if (isset($_SESSION["user"])) {
}
$user = $_SESSION["user"];
$formProfil = new Form("Vos informations");
$formProfil->setMethod("POST");
$formProfil->setAction("/controller/profil/profil.php");
/*
    $mail=new Element("mail",$user->getMail());
$mail->setLabel("Mail");

$birthdate = date('d/m/Y', strtotime(str_replace('-', '/', $user->getBirth())));
$birth=new Element("birth",$birthdate);
    $birth->setLabel("Date de naissance");
*/
$mail = new Element("mail", "mail");
$mail->setElement("Label");
$mail->setLabel("Adresse mail : " . $user->getMail());
$birthdate = date('d/m/Y', strtotime(str_replace('-', '/', $user->getBirth())));
$birth = new Element("birth", "birth");
$birth->setElement("Label");
$birth->setLabel("Date de naissance : {$birthdate}");
$phone = new Element("phone", $user->getPhoneNumber());
$phone->setLabel("Numéro de téléphone");
$country = new Element("country", $user->getCountry());
$country->setLabel("Pays");
$city = new Element("city", $user->getCity());
$city->setLabel("Ville");
Example #4
0
 private function renderFirewallCounterForm()
 {
     $content = '<h2>Firewall Counters</h2>';
     $allDevices = Device::get_devices();
     //$allDevices = array();
     asort($allDevices);
     $getdeviceID = "";
     if (isset($_GET['deviceID'])) {
         $getdeviceID = $_GET['deviceID'];
     }
     $getFrom = "-1d";
     if (isset($_GET['From'])) {
         $getFrom = $_GET['From'];
     }
     $form = new Form("auto", 2);
     $values = array();
     $handler = array();
     $titles = array("Device", "Time Frame", "tab", "pluginID");
     $postKeys = array("deviceID", "From", "tab", "pluginID");
     array_push($values, $getdeviceID, $getFrom, $_GET['tab'], $_GET['pluginID']);
     $heading = array("Select location");
     $fieldType[0] = "drop_down";
     $fieldType[1] = "drop_down";
     $fieldType[2] = "hidden";
     $fieldType[3] = "hidden";
     $form->setType($allDevices);
     $allFrom = array();
     $allFrom["-1h"] = "Past 1 Hour";
     $allFrom["-1d"] = "Past 1 Day";
     $allFrom["-1w"] = "Past 1 Week";
     $allFrom["-1y"] = "Past 1 Year";
     $form->setType($allFrom);
     $form->setFieldType($fieldType);
     $form->setSortable(false);
     $form->setHeadings($heading);
     $form->setTitles($titles);
     $form->setData($values);
     $form->setDatabase($postKeys);
     //set the table size
     $form->setTableWidth("100");
     $form->setTitleWidth("20%");
     $form->setUpdateValue("GetCounters");
     $form->setUpdateText("Get Counters");
     $form->setMethod("GET");
     $content .= $form->EditForm(1);
     $content .= "<div style=\"clear:both;\"></div> </p>";
     return $content;
 }
Example #5
0
 public function index($params = array())
 {
     $this->addContentMenu();
     $accountType = null;
     if (isset($_GET['accountType'])) {
         OW::getSession()->set(self::SESSION_VAR_ACCIUNT_TYPE, trim($_GET['accountType']));
     }
     if (OW::getSession()->get(self::SESSION_VAR_ACCIUNT_TYPE)) {
         $accountType = OW::getSession()->get(self::SESSION_VAR_ACCIUNT_TYPE);
     }
     $serviceLang = BOL_LanguageService::getInstance();
     $language = OW::getLanguage();
     $currentLanguageId = OW::getLanguage()->getCurrentId();
     // get available account types from DB
     $accountTypes = $this->questionService->findAllAccountTypesWithQuestionsCount();
     /* @var $value BOL_QuestionAccount */
     foreach ($accountTypes as $key => $value) {
         $accounts[$value['name']] = $language->text('base', 'questions_account_type_' . $value['name']);
     }
     $accountsKeys = array_keys($accounts);
     $accountType = !isset($accountType) || !in_array($accountType, $accountsKeys) ? $accountsKeys[0] : $accountType;
     // -- Select account type form --
     $accountTypeSelectForm = new Form('qst_account_type_select_form');
     $accountTypeSelectForm->setMethod(Form::METHOD_GET);
     $qstAccountType = new Selectbox('accountType');
     $qstAccountType->addAttribute('id', 'qst_account_type_select');
     $qstAccountType->setLabel($language->text('admin', 'questions_account_type_label'));
     $qstAccountType->setOptions($accounts);
     $qstAccountType->setValue($accountType);
     $qstAccountType->setHasInvitation(false);
     $accountTypeSelectForm->addElement($qstAccountType);
     $this->addForm($accountTypeSelectForm);
     $script = '
                     $("#qst_account_type_select").change( function(){
                             $(this).parents("form:eq(0)").submit();
                     } );
                 ';
     OW::getDocument()->addOnloadScript($script);
     $this->assign('accountTypes', $accountTypes);
     $this->assign('editAccountTypeUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'editAccountType'));
     $addSectionForm = new Form('qst_add_section_form');
     $qstSectionName = new TextField('section_name');
     $qstSectionName->addAttribute('class', 'ow_text');
     $qstSectionName->addAttribute('style', 'width: auto;');
     $qstSectionName->setRequired();
     $qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
     $addSectionForm->addElement($qstSectionName);
     if (OW::getRequest()->isPost() && isset($_POST['section_name'])) {
         if ($addSectionForm->isValid($_POST)) {
             $data = $addSectionForm->getValues();
             $questionSection = new BOL_QuestionSection();
             $questionSection->name = md5(uniqid());
             $questionSection->sortOrder = $this->questionService->findLastSectionOrder() + 1;
             $this->questionService->saveOrUpdateSection($questionSection);
             $this->questionService->updateQuestionsEditStamp();
             $serviceLang->addValue($currentLanguageId, 'base', 'questions_section_' . $questionSection->name . '_label', htmlspecialchars($data['section_name']));
             if (OW::getDbo()->getAffectedRows() > 0) {
                 OW::getFeedback()->info($language->text('admin', 'questions_section_was_added'));
             }
             $this->redirect(OW::getRequest()->getRequestUri());
         }
     }
     $this->addForm($addSectionForm);
     // -- Get all section, questions and question values --
     $questions = $this->questionService->findAllQuestionsWithSectionForAccountType($accountType);
     $section = null;
     $questionArray = array();
     $questionNameList = array();
     $sectionDeleteUrlList = array();
     $parentList = array();
     foreach ($questions as $sort => $question) {
         if ($section !== $question['sectionName']) {
             $section = $question['sectionName'];
             $sectionDeleteUrlList[$section] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'deleteSection', array("sectionName" => $section));
             $questionArray[$section] = array();
         }
         if (isset($questions[$sort]['id'])) {
             $questionArray[$section][$sort] = $questions[$sort];
             $questionArray[$section][$sort]['questionEditUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'edit', array("questionId" => $questions[$sort]['id']));
             $questionArray[$section][$sort]['questionDeleteUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'deleteQuestion', array("questionId" => $questions[$sort]['id']));
             if (!empty($question['parent'])) {
                 $parent = $this->questionService->findQuestionByName($question['parent']);
                 if (!empty($parent)) {
                     $questionArray[$section][$sort]['parentUrl'] = OW::getRouter()->urlFor('ADMIN_CTRL_Questions', 'edit', array("questionId" => $parent->id));
                     $questionArray[$section][$sort]['parentLabel'] = $this->questionService->getQuestionLang($parent->name);
                     $parentList[$question['parent']][] = array('name' => $question['name'], 'editUrl' => $questionArray[$section][$sort]['questionEditUrl']);
                 } else {
                     $questionArray[$section][$sort]['parent'] = '';
                 }
             }
             $questionNameList[] = $questions[$sort]['name'];
         }
     }
     foreach ($questions as $sort => $question) {
         $text = $language->text('admin', 'questions_delete_question_confirmation');
         if (array_key_exists($question['name'], $parentList)) {
             $questionStringList = array();
             foreach ($parentList[$question['name']] as $child) {
                 $questionStringList[] = BOL_QuestionService::getInstance()->getQuestionLang($child['name']);
             }
             $text = $language->text('admin', 'questions_delete_question_parent_confirmation', array('questions' => implode(', ', $questionStringList)));
         }
         $text = json_encode($text);
         OW::getDocument()->addOnloadScript("OW.registerLanguageKey('admin', 'questions_delete_question_confirmation_" . (int) $question['id'] . "', {$text});");
     }
     $questionValues = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     $this->assign('questionsBySections', $questionArray);
     $this->assign('questionValues', $questionValues);
     $this->assign('sectionDeleteUrlList', $sectionDeleteUrlList);
     $language->addKeyForJs('admin', 'questions_delete_section_confirmation');
     $script = ' window.indexQuest = new indexQuestions( ' . json_encode(array('questionAddUrl' => OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "add"), 'ajaxResponderUrl' => $this->ajaxResponderUrl)) . ' )';
     //' . json_encode( array( 'questionEditUrl' => $questionEditUrl ) ) . ' ); ';
     OW::getDocument()->addOnloadScript($script);
     $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl();
     OW::getDocument()->addScript($jsDir . "questions.js");
     $baseJsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
     OW::getDocument()->addScript($baseJsDir . "jquery-ui.min.js");
 }
Example #6
0
 function render_create_report()
 {
     if (isset($_GET['pid']) && is_numeric($_GET['pid'])) {
         $pid = $_GET['pid'];
     } else {
         return "<b>Sorry invalid profile id " . $_GET['pid'] . "</b>";
     }
     $profile_name = $this->get_accounting_profile_name($pid);
     // Menu bar
     $content = "<div style='font-size:10px; font-weight:100px;'>\n\t\t\t<a href='{$this->url}'>Accounting</a> >> <a href='{$this->url}&pid={$pid}&action=show_accounting_profile'>{$profile_name}</a>\n\t\t\t>> <a href='{$this->url}&pid={$pid}&action=show_reports''> Reports</a> </div>";
     $content .= "<h2>Create Report</h2>";
     $headings = array("Please select reporting Period ");
     $postKeys = array("action", "tab", "pluginID", "pid", "date1", "date2");
     $keyTitle = array("action", "tab", "pluginID", "pid", "Start Date", "End Date");
     $keyData = array("render_report", $_GET['tab'], $_GET['pluginID'], $pid, "", "");
     $form = new Form();
     $form->setCols(2);
     $form->setData($keyData);
     $form->setTitles($keyTitle);
     $form->setDatabase($postKeys);
     $form->setTableWidth("400px");
     $fieldType[0] = "hidden";
     $fieldType[1] = "hidden";
     $fieldType[2] = "hidden";
     $fieldType[3] = "hidden";
     $fieldType[4] = "date_picker";
     $fieldType[5] = "date_picker";
     $form->setFieldType($fieldType);
     $form->setHeadings($headings);
     $form->setSortable(false);
     $form->setUpdateValue("gen_report");
     $form->setUpdateText("Generate Report");
     $form->setMethod("GET");
     $content .= $form->editForm();
     return $content;
 }
Example #7
0
		/*
		$init_data = $note->fields;
		$init_data['id'] = $note->id;
		echo "<div id='success'>";
		echo "Item added...";
		echo "</div>";
		*/
	}
}

$all_notes = Note::getSelect( $note_sort, $note_order );

echo "<div>";

$select_form = new Form();
$select_form->setMethod("get");
$select_form->fields = array(
						array('name'=>'id','type'=>'select','onchange'=>'this.form.submit();','width'=>'400px','data'=>$all_notes,'value'=>$note->id),
						array('name'=>'note_sort','type'=>'select','onchange'=>'this.form.submit();','width'=>'400px','data'=>$note_sort_values,'value'=>$note_sort),
						array('name'=>'note_order','type'=>'select','onchange'=>'this.form.submit();','width'=>'400px','data'=>$note_order_values,'value'=>$note_order)
						);
echo $select_form->buildForm(null,!is_null($note->id)?"<span style='margin-right: 10px'><a href='?'>Cancel</a></span>":null);
echo "</div>";

echo "<div id='form'>";
$form->fields = $fields;
$form->setEncType("multipart/form-data");
$form->setFormWrapper("table");
echo $form->buildForm();

$mp3 = "../mp3s/".$note->id.".mp3";
Example #8
0
    $user = new User(User::generateID(), $_POST["pseudo"], $_POST["birth"], $sexe, $_POST["mail"], $_POST["password"]);
    $user->updateAge($_POST["birth"]);
    $req = $bdd->prepare("SELECT * FROM user WHERE UCASE(pseudo)=UCASE(:pseudo) OR UCASE(email)=UCASE(:email)");
    $req->execute(array(":pseudo" => $_POST["pseudo"], ":email" => $_POST["mail"]));
    if ($req->rowCount() >= 1) {
        $_SESSION["erreur"][] = "Le pseudo ou le mail renseigner existe déjà.";
        header("Location: /Erreur");
    } else {
        $user->save();
    }
}
?>

<?php 
$formInscription = new Form("Inscription");
$formInscription->setMethod("POST");
$formInscription->setAction("/Portail/Inscription");
$pseudo = new Element("pseudo", "Votre pseudo");
$pseudo->requireElement(true);
$mail = new Element("mail", "Votre email");
$mail->setTypeElement("email");
$mail->requireElement(true);
$password = new Element("password", "Mot de passe");
$password->setTypeElement("password");
$password->requireElement(true);
$confirmPassword = new Element("confirmPassword", "Confirmez votre mot de passe");
$confirmPassword->setTypeElement("password");
$confirmPassword->requireElement(true);
$birth = new Element("birth", "Votre date de naissances");
$birth->requireElement(true);
$radioHomme = new Element("sexe", "Homme");