本文整理汇总了PHP中Topic::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::getAll方法的具体用法?PHP Topic::getAll怎么用?PHP Topic::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topic
的用法示例。
在下文中一共展示了Topic::getAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
static function find($search_id)
{
$found_topic = null;
$topics = Topic::getAll();
foreach ($topics as $topic) {
$id = $topic->getId();
if ($search_id == $id) {
$found_topic = $topic;
}
}
return $found_topic;
}
示例2: question
<tr><td><input type="text" name="question" value="" id="second_td" style="display:none;"/></td></tr>
<tr>
<td id="first_td">Describe your Question/Problem (Min 60 characters) : </td>
<td><textarea id="teatarea_td" name="question" placeholder="Describe your Question/Problem (Min 60 characters)"></textarea></td>
</tr>
<tr>
<td id="first_td">Heading (Min 20 characters) : </td>
<td><input type="text" id="second_td" name="heading" placeholder="Provide an appropriate heading for your question (minimum 20 characters)"/></td>
</tr>
<tr>
<td id="first_td">Topic : </td>
<td><select id="second_td" name="topic_id">
<option value="">--Select Topic--</option>
<?php
$topicObj = new Topic();
$rows = $topicObj->getAll();
foreach ($rows as $row) {
?>
<option value="<?php
echo $row['topic_id'];
?>
"><?php
echo $row['topic'];
?>
</option>
<?php
}
?>
</select>
示例3: array
return $app['twig']->render('promptr.html.twig', array('promptr' => $promptr, 'questions' => $promptr->getQuestions(), 'topic' => $topic));
});
// PROMPTRS.HTML.TWIG
// ADD PROMPTR -- adds a prompter and displays promptrs within the topic
$app->post("/promptrs", function () use($app) {
$promptr_name = $_POST['promptr_name'];
$topic_id = $_POST['topic_id'];
$new_promptr = new Promptr($promptr_name, $topic_id);
$new_promptr->save();
return $app['twig']->render('promptrs.html.twig', array('promptrs' => Promptr::getAll(), 'topic' => $topic_id, 'topic_picked' => true));
// flag for included template
});
$app->get("/topic/{id}", function ($id) use($app) {
$topic = Topic::find($id);
$promptrs = $topic->getPromptrs();
$allT = Topic::getAll();
return $app['twig']->render("topic.html.twig", array('topic' => $topic, 'promptrs' => $promptrs, 'all_topics' => $allT));
});
// PROMPTR.HTML.TWIG
//delete question from NEW PROMPTR route -- then displays promptr page
$app->get("promptr/{id}", function ($id) use($app) {
$promptr = Promptr::find($id);
$questions = $promptr->getQuestions();
return $app['twig']->render("promptr.html.twig", array('promptr' => $promptr, 'questions' => $questions));
});
//delete question route
$app->delete("/promptr/{id}/delete_question/{qId}", function ($id, $qId) use($app) {
$question_id = $qId;
$promptr = Promptr::find($id);
$topic = Topic::find($promptr->getTopicId());
$question = Question::findById($question_id);
示例4: test_update
function test_update()
{
$name = "Writing";
$test_topic = new Topic($name);
$test_topic->save();
$name2 = "Interview";
$test_topic->update($name2);
$topics = Topic::getAll();
$result = $topics[0]->getName();
$this->assertEquals($name2, $result);
}
示例5: Topic
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php
require 'core/init.php';
$topic = new Topic();
$template = new Template('templates/frontpage.php');
$template->topics = $topic->getAll();
//echo '<pre>';
//var_dump($t);
//echo '</pre>';
echo $template;