本文整理汇总了PHP中Categorie类的典型用法代码示例。如果您正苦于以下问题:PHP Categorie类的具体用法?PHP Categorie怎么用?PHP Categorie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Categorie类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildDomainObject
/**
* Creates an Category object based on a DB row.
*
* @param array $row The DB row containing Category data.
* @return \MyMovies\Domain\Category
*/
protected function buildDomainObject($row)
{
$cat = new Categorie();
$cat->setCat_id($row['cat_id']);
$cat->setCat_name($row['cat_name']);
return $cat;
}
示例2: update
public function update(Categorie $categorie)
{
$query = $this->_db->prepare('UPDATE categorie SET nom=:nom, detail=:detail WHERE id=:id');
$query->bindValue(':nom', $categorie->nom());
$query->bindValue(':detail', $categorie->detail());
$query->bindValue(':id', $categorie->id());
$query->execute();
$query->closeCursor();
}
示例3: setQuestions
private function setQuestions()
{
$categories = new Categorie();
$questions = new Question();
$questions->readQuestions($categories->getCategories());
$tabUn = $questions->getUn();
$tabAutre = $questions->getAutre();
$this->_questions = array('lun1' => $tabUn[0], 'lautre1' => $tabAutre[0], 'lun2' => $tabUn[1], 'lautre2' => $tabAutre[1]);
}
示例4: getCategorie
function getCategorie($id)
{
$result = $this->connector->query("SELECT * FROM categorie WHERE `cat_id` = '{$id}'");
while ($row = $this->connector->fetchArray($result)) {
$categorie = new Categorie();
$categorie->setCat_id($row['cat_id']);
$categorie->setCat_title($row['cat_title']);
$categorie->setCat_despription($row['cat_despription']);
return $categorie;
}
}
示例5: create
public function create($nom)
{
$category = new Categorie($this->link);
$category->setTitre($nom);
$nom = mysqli_real_escape_string($this->link, $category->getCategory());
$request = "INSERT INTO categories VALUES(NULL, '" . $nom . "')";
$res = mysqli_query($this->link, $request);
if ($res) {
return $this->select(mysqli_insert_id($this->link));
} else {
throw new Exception("Internal server error");
}
}
示例6: procede
public function procede()
{
if (!$this->oRequest->existParam('key')) {
throw new Error('Vous devez renseigner la clé.', 3003);
}
if ($this->oRequest->getParam('key', 'string') != Config::get('ingestkey')) {
throw new Error('La clé est invalide.', 3003);
}
//Ajoute du titre
$this->oView->addData('titre', 'Analyse des releases');
//On récupère les 30 dernières releases
$oMysqli = Database::getInstance();
//Traitement de la requête
$sSqlRequest = "SELECT r.*, \r\n (SELECT GROUP_CONCAT(t.id_regex ORDER BY t.id_regex SEPARATOR ';') FROM tks_tags t WHERE t.id_release = r.id) AS tags,\r\n (SELECT GROUP_CONCAT(f.date ORDER BY f.date SEPARATOR ';') FROM tks_torrents f WHERE f.id_release = r.id) AS dates\t\r\n FROM tks_releases r \r\n WHERE r.id_categorie = '0' \r\n ORDER BY r.id DESC \r\n LIMIT 10";
$oResults = $oMysqli->query($sSqlRequest);
$oTable = new TableGenerator();
$oTable->setId(md5('Scrapper'));
$oTable->addColumn('Release');
$oTable->addColumn('Catégorie');
$oTable->addColumn('ID Fiche');
$aCategories = Categorie::getCategoriesSelect();
while ($aResult = $oResults->fetch_assoc()) {
$oScrapper = new Scrapper($aResult['name'], $aResult['id']);
$oScrapper->procede();
$oTable->addLine(array($aResult['name'], $aCategories[$oScrapper->getCategorie()], $oScrapper->getFiche()));
}
$oTable->setBottom('');
$oTable->create();
$this->oView->addData('content', $oTable->getCode());
$this->oView->Create();
}
示例7: recupereCategorie
function recupereCategorie()
{
$categories = Categorie::fetchAll();
//Change l'ordre selon la fonction de comparaison cmp.
usort($categories, "cmp");
return $categories;
}
示例8: getAllCategories
public static function getAllCategories()
{
$results = Categorie::select('name', 'id')->orderBy('name', 'asc')->get();
$allCategories = array();
foreach ($results as $result) {
$allCategories = array_add($allCategories, $result->id, $result->name);
}
return $allCategories;
}
示例9: beheerMateriaal
public function beheerMateriaal()
{
if (Auth::check()) {
$categories = Categorie::with('materials')->get();
return View::make('users.admin.beheerMateriaal', ['categories' => $categories]);
} else {
return Redirect::to('/');
}
}
示例10: up
/**
* Make changes to the database.
*
* @return void
*/
public function up()
{
//
Schema::create('categories', function ($table) {
$table->increments('id');
$table->string('title');
});
$cat = new Categorie();
$cat->title = "Wood";
$cat->save();
$cat = new Categorie();
$cat->title = "Metal";
$cat->save();
$cat = new Categorie();
$cat->title = "Ceramic";
$cat->save();
$cat = new Categorie();
$cat->title = "Glass";
$cat->save();
$cat = new Categorie();
$cat->title = "Fabric";
$cat->save();
$cat = new Categorie();
$cat->title = "Plastic";
$cat->save();
$cat = new Categorie();
$cat->title = "Concrete";
$cat->save();
$cat = new Categorie();
$cat->title = "Appliances";
$cat->save();
$cat = new Categorie();
$cat->title = "Electical";
$cat->save();
$cat = new Categorie();
$cat->title = "Plumbing";
$cat->save();
$cat = new Categorie();
$cat->title = "Insulation";
$cat->save();
$cat = new Categorie();
$cat->title = "Other";
$cat->save();
}
示例11: __construct
/**
* Initialise les variables en tableaux, et crée l'ensemble des catégories question de la partie
*/
function __construct()
{
$bddConnect = new Connector();
$this->tabCategorie = array();
$this->tabTheme1 = array();
$this->tabTheme2 = array();
$this->tabQuestion = array();
$this->tabReponse = array();
$this->tabExplication = array();
// étape actuelle de la partie (1 étape = 1 question)
$this->position = 0;
// création et récupération des catégories de la partie
$Categorie = new Categorie($bddConnect->getBdd());
$nomCategorie = $Categorie->getNomCategorie();
for ($i = 0; $i < sizeof($nomCategorie); $i++) {
// création et récupération des thèmes de la partie associés aux catégories choisies
$Theme = new Theme($bddConnect->getBdd(), $nomCategorie[$i]);
$idTheme = $Theme->getIdTheme();
$theme1 = $Theme->getTheme1();
$theme2 = $Theme->getTheme2();
for ($j = 0; $j < sizeof($theme1); $j++) {
// cration et récupération des questions de la partie associées aux thémes
$Question = new Question($bddConnect->getBdd(), $idTheme[$j]);
$intituleQuestion = $Question->getIntituleQuestion();
$reponse = $Question->getReponse();
$explication = $Question->getExplication();
for ($h = 0; $h < sizeof($intituleQuestion); $h++) {
// 1 indice de chauqe tableau équivaut au catégorie / theme question / ... de la question actuelle
array_push($this->tabCategorie, $nomCategorie[$i]);
array_push($this->tabTheme1, $theme1[$j]);
array_push($this->tabTheme2, $theme2[$j]);
array_push($this->tabQuestion, $intituleQuestion[$h]);
array_push($this->tabReponse, $reponse[$h]);
// s'il existe ou non une explication de la réponse
if (isset($explication[$h])) {
array_push($this->tabExplication, $explication[$h]);
} else {
array_push($this->tabExplication, null);
}
}
}
}
}
示例12: findAll
/**
*
* @return array A list of all Links.
*/
public function findAll()
{
$sql = "select * from rit_link";
$result = $this->getDb()->fetchAll($sql);
// Convert query result to an array of domain objects
$links = array();
foreach ($result as $row) {
$linkId = $row['lnk_id'];
$links[$linkId] = $this->buildDomainObject($row);
if (null !== $row['cat_id']) {
$sql2 = "select * from rit_categories";
$r2 = $this->getDb()->fetchAll($sql2);
$cat = new Categorie();
$cat->setId($r2[0]['cat_id']);
$cat->setName($r2[0]['cat_name']);
$links[$linkId]->setArticle($cat);
}
}
return $links;
}
示例13: run
public function run()
{
Eloquent::unguard();
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
DB::table('categories')->delete();
Categorie::create(array('user_id' => 2, 'nom' => 'Men Cat 1', 'nomcourt' => 'M1', 'sexe_id' => 1, 'hcpmin' => -5, 'hcpmax' => 18.4, 'agemin' => 30, 'agemax' => 99, 'agelimityear' => 0, 'tee_id' => 3));
Categorie::create(array('user_id' => 2, 'nom' => 'Men Cat 2', 'nomcourt' => 'M2', 'sexe_id' => 1, 'hcpmin' => 18.5, 'hcpmax' => 36, 'agemin' => 30, 'agemax' => 99, 'agelimityear' => 0, 'tee_id' => 4));
Categorie::create(array('user_id' => 2, 'nom' => 'Ladies Cat 1', 'nomcourt' => 'L1', 'sexe_id' => 2, 'hcpmin' => -5, 'hcpmax' => 20.4, 'agemin' => 30, 'agemax' => 99, 'agelimityear' => 0, 'tee_id' => 6));
Categorie::create(array('user_id' => 2, 'nom' => 'Ladies Cat 2', 'nomcourt' => 'L2', 'sexe_id' => 2, 'hcpmin' => 20.5, 'hcpmax' => 36, 'agemin' => 30, 'agemax' => 99, 'agelimityear' => 0, 'tee_id' => 7));
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}
示例14: supprimerCategorie
public static function supprimerCategorie($nom)
{
$nomCat = Categorie::getDefaultCategorie();
require_once "../Modele/Film.class.php";
$films = Film::getListeFilms();
foreach ($films as $film) {
if ($film['categorie'] == $nom) {
Film::setDefaultCategorie($nomCat['nom'], $film['id']);
}
}
SingletonRequete::getBase()->requeteParam("DELETE FROM Category WHERE category_name=?", array($nom));
}
示例15: ajax_categoria
function ajax_categoria()
{
$macro = $_REQUEST["macro"];
$suffisso = $_REQUEST["suffisso"];
//query sulle categorie
$objCat = new Categorie();
$arrCat = $objCat->getAll(" and cat_fkclasse=" . $macro . " order by cat_sorting");
$num = count($arrCat);
if ($num == 0) {
print "- - <input type='hidden' name='categoria" . $suffisso . "' value=''>";
} else {
print "<select name='categoria" . $suffisso . "' id='categoria" . $suffisso . "' class='select' onChange=\"ajaxSottocat('','" . $suffisso . "'); ajaxProdotto('','" . $suffisso . "'); \"><option value=''></option>";
foreach ($arrCat as $arr) {
print "<option value='" . $arr["cat_id"] . "'";
if (isset($_REQUEST["evidenza"]) && $_REQUEST["evidenza"] == $arr["cat_id"]) {
print " selected";
}
print ">" . $arr["cat_categoria"] . "</option>";
}
print "</select>";
}
}