private function render($data, $users) { View::renderTemplate("header", $data, 'MetroTemplate'); echo "<h1>"; echo "Hello " . $users->fname; echo "</h1>"; Session::set('user_name', $users->user_name); $o = ""; $o .= Form::open(array('action' => 'logout', 'method' => 'post')); $o .= Form::hidden(array('id' => 'username', 'name' => 'username', 'value' => Session::get('user_name'))); $o .= Form::submit(array()); $o .= Form::close(); echo $o; View::renderTemplate("footer", $data, 'MetroTemplate'); }
<div class='input-group' style='margin-bottom: 25px'> <span class='input-group-addon'><i class='glyphicon glyphicon-pencil'></i> </span> <?php echo Form::textBox(array('type' => 'text', 'name' => 'content', 'class' => 'form-control', 'value' => $data['content'], 'placeholder' => 'Message Content', 'rows' => '6')); ?> </div> <!-- CSRF Token --> <input type="hidden" name="csrf_token" value="<?php echo $data['csrf_token']; ?> " /> <button class="btn btn-md btn-success" name="submit" type="submit"> <?php // echo Language::show('update_profile', 'Auth'); ?> Send Message </button> <?php echo Form::close(); ?> <?php // END Check to see if message form is disabled } ?> </div> </div> </div>
public function testClose() { $this->assertEquals('</form>', \Helpers\Form::close()); }
/** * displaySweetsButton * * display sweets button * update/add sweets type * * @param int $sweet_id (ID of post where sweet is) * @param string $sweet_location (Section of site where sweet is) * @param int $sweet_owner_userid (ID of user sweeting) * @param int $sweet_type (sweet/unsweet) * @param int $sweet_sec_id (ID of secondary post) * @param string $sweet_url (redirect url) * * @return string returns sweet button data */ public static function displaySweetsButton($sweet_id = null, $sweet_location = null, $sweet_owner_userid = null, $sweet_sec_id = null, $sweet_url = null) { // Make sure that there is a user logged in if ($sweet_owner_userid != null) { // Check to see if current user has already sweeted page self::$db = Database::get(); // Check to see if this is main post if ($sweet_sec_id == null) { // Sweet is for main post $sweet_data = self::$db->select("\n SELECT\n *\n FROM\n " . PREFIX . "sweets\n WHERE\n sweet_id = :sweet_id\n AND sweet_location = :sweet_location\n AND sweet_owner_userid = :sweet_owner_userid\n ", array(':sweet_id' => $sweet_id, ':sweet_location' => $sweet_location, ':sweet_owner_userid' => $sweet_owner_userid)); // Get count to see if user has already submitted a sweet $sweet_count = count($sweet_data); } else { // Sweet is for secondary post $sweet_data = self::$db->select("\n SELECT\n *\n FROM\n " . PREFIX . "sweets\n WHERE\n sweet_id = :sweet_id\n AND sweet_location = :sweet_location\n AND sweet_owner_userid = :sweet_owner_userid\n AND sweet_sec_id = :sweet_sec_id\n ", array(':sweet_id' => $sweet_id, ':sweet_location' => $sweet_location, ':sweet_owner_userid' => $sweet_owner_userid, ':sweet_sec_id' => $sweet_sec_id)); // Get count to see if user has already submitted a sweet $sweet_count = count($sweet_data); } //echo " ($sweet_count) "; // Setup Sweet Button Form $sweet_button_display = Form::open(array('method' => 'post', 'style' => 'display:inline')); // Check to see if user has alreadyed sweeted if ($sweet_count > 0) { // Display UnSweet button if user has already sweeted $sweet_button_display .= " <input type='hidden' name='delete_sweet' value='true' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_id' value='{$sweet_id}' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_sec_id' value='{$sweet_sec_id}' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_location' value='{$sweet_location}' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_owner_userid' value='{$sweet_owner_userid}' /> "; $sweet_button_display .= " <button type='submit' class='btn btn-warning btn-xs' value='Sweet' name='sweet'> Un" . SWEET_BUTTON_DISPLAY . " </button> "; } else { // Display Sweet Button if user has not yet sweeted $sweet_button_display .= " <input type='hidden' name='submit_sweet' value='true' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_id' value='{$sweet_id}' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_sec_id' value='{$sweet_sec_id}' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_location' value='{$sweet_location}' /> "; $sweet_button_display .= " <input type='hidden' name='sweet_owner_userid' value='{$sweet_owner_userid}' /> "; $sweet_button_display .= " <button type='submit' class='btn btn-success btn-xs' value='Sweet' name='sweet'> " . SWEET_BUTTON_DISPLAY . " </button> "; } // Close the Sweet Button Form $sweet_button_display .= Form::close(); // Check to see if user is submitting a new sweet $submit_sweet = Request::post('submit_sweet'); $delete_sweet = Request::post('delete_sweet'); $post_sweet_id = Request::post('sweet_id'); $post_sweet_location = Request::post('sweet_location'); $post_sweet_owner_userid = Request::post('sweet_owner_userid'); $post_sweet_sec_id = Request::post('sweet_sec_id'); if ($submit_sweet == "true" && $post_sweet_sec_id == $sweet_sec_id) { self::addSweet($post_sweet_id, $post_sweet_location, $post_sweet_owner_userid, $post_sweet_sec_id, $sweet_url); } else { if ($delete_sweet == "true" && $post_sweet_sec_id == $sweet_sec_id) { self::removeSweet($post_sweet_id, $post_sweet_location, $post_sweet_owner_userid, $post_sweet_sec_id, $sweet_url); } } // Ouput the sweet/unsweet button return $sweet_button_display; } }