Inheritance: extends Controller
Beispiel #1
0
<?php

include_once "../Controllers/PostsController.php";
$controller = new PostsController();
$posts = $controller->read();
?>

<div class="row">
    <div class="small-12 column">
        <div class="callout panel">

<?php 
foreach ($posts as $post) {
    ?>

    <div class="row">
        <div class="small-12 column">
            <span class="primary label"><?php 
    echo $post['timestamp'];
    ?>
</span>
            <blockquote><?php 
    echo $post['content'];
    ?>
            <cite><?php 
    echo $post['username'];
    ?>
</cite>
            </blockquote>
        </div>
    </div>
<?php

require 'models/' . changesingular($resource) . '.php';
//$post = new Post();
$posts = new PostsController();
switch ($action) {
    case 'index':
        $posts->index();
        break;
    case 'show':
        $posts->show($id);
        break;
    case 'create':
        $posts->create();
        break;
    case 'edit':
        $posts->edit(1);
        break;
    case 'destroy':
        $posts->destroy($id);
        break;
    case 'view':
        $post->view(1);
        break;
    case 'update':
        $post->update(1);
        break;
    case 'delete':
        $post->delete(1);
    default:
        # code...
 /**
  * get_context
  *
  * @return mixed
  */
 protected function get_context()
 {
     parent::get_context();
     $this->context['taxonomy'] = $this->get_taxonomy();
     return $this->context;
 }
Beispiel #4
0
<?php

include_once "../Controllers/PostsController.php";
$controller = new PostsController();
if ($controller->delete($_POST['postId'])) {
    print "<div class='success callout small-6'>Postare stearsa !</div>";
}
<?php

require 'models/' . changesingular($resource) . '.php';
$posts = new PostsController();
$post = new Post();
switch ($action) {
    case 'index':
        $posts->index();
        break;
    case 'show':
        $posts->show(1);
        break;
    case 'edit':
        $posts->edit(1);
        break;
    case 'destroy':
        $posts->destroy(1);
        break;
    case 'view':
        $post->view(1);
        break;
    case 'update':
        $post->update(1);
        break;
    case 'delete':
        $post->delete(1);
    default:
        # code...
        break;
}
function changesingular($value)
Beispiel #6
0
<?php

include "../Controllers/PostsController.php";
$controller = new PostsController();
$controller->create();
Beispiel #7
0
<?php

require_once realpath(dirname(__FILE__)) . "/../Controller/PostsController.php";
$con = new PostsController();
echo realpath(dirname(__FILE__)) . "/../Controller/PostsController.php";
$con->controller_ins_posts();
Beispiel #8
0
<?php

include "../Controllers/PostsController.php";
$controller = new PostsController();
$myPosts = $controller->readMyPosts($_SESSION['user']->uniqueID);
?>



<div class="row">
    <div class="small-12 column">
        <div class="callout panel">

<?php 
foreach ($myPosts as $post) {
    ?>

    <div class="row post-container">
        <div class="small-12 column">
            <span class="primary label"><?php 
    echo $post['timestamp'];
    ?>
</span><span class="label alert trigger-delete" post-data="<?php 
    echo $post['postId'];
    ?>
">Delete ?</span>
            <blockquote><?php 
    echo $post['content'];
    ?>
                <cite><?php 
    echo $post['username'];
Beispiel #9
0
<?php

define("PER_PAGE", 30);
require_once realpath(dirname(__FILE__)) . "/../Controller/PostsController.php";
$con = new PostsController();
//$con->controller_ins_posts();
if (preg_match('/^[1-9][0-9]*$/', $_GET['page'])) {
    $page = (int) $_GET['page'];
} else {
    $page = 1;
}
$count = PER_PAGE;
$offset = PER_PAGE * ($page - 1);
$data = $con->controller_get_posts($offset, $count);
$total = $con->controller_get_total_posts();
$totalPages = ceil($total / PER_PAGE);
foreach ($data as $post) {
    print <<<EOF
<small>
<div class="row">

\t<div class = col-xs-1>
\t<!--
\t\t<label class="checkbox" for="checkbox2">
\t\t\t<input type="checkbox" value="" id="checkbox2" data-toggle="checkbox">
\t\t</label>
\t-->
\t</div>
\t<div class="col-xs-10">
\t\t<div class="row">
\t\t\t<div class="panel panel-default">