當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Style::getAll方法代碼示例

本文整理匯總了PHP中Style::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Style::getAll方法的具體用法?PHP Style::getAll怎麽用?PHP Style::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Style的用法示例。


在下文中一共展示了Style::getAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: profileEdit

 function profileEdit()
 {
     // Authorize user
     $id = $_GET['id'];
     if ($this->_user['is_authorized']) {
         if (!($this->_user['id'] == $id)) {
             $this->set('authorized', false);
             die('You are not allowed to edit this profile!');
         } else {
             $this->set('authorized', true);
         }
     } else {
         $this->set('authorized', false);
         die('You are not allowed to edit this profile!');
     }
     // get all necessary user data
     $user = new User();
     $user->createFromID($id);
     $email = $user->getEmail();
     $language = $user->getDefaultLanguage();
     $this->set('default_language', $language);
     // notification_interval is rewritten if any POST data is present
     $notification_interval = $user->getNotificationInterval();
     $default_theme = $user->getDefaultTheme();
     //if any POST data in - update profile
     $style = new Style();
     $styles_list = $style->getAll();
     $this->set('styles', $styles_list);
     $this->set('notification_interval', $notification_interval);
     $this->set('default_theme', $default_theme);
     $this->set('profile', $user);
     $this->set('email', $email);
     $this->set('page_title', "Edit User - " . $user->username);
 }
開發者ID:TBoonX,項目名稱:SlideWiki,代碼行數:34,代碼來源:UserController.php

示例2:

			<div class="col-md-8">
				<table class="table table-striped">
					<tr>
						<th>Name:</th>
						<td><input type='text', name='name', class='form-control'></td>
					</tr>
					<tr>
						<th>Description:</th>
						<td><textarea name='description' form='new-style-form' class='form-control'></textarea></td>
					</tr>
					<tr>
						<th>Style:</th>
						<td>
							<select name ='style_id' class='form-control'>
								<?php 
$styles = Style::getAll();
foreach ($styles as $style) {
    echo "<option value={$style->id}>{$style->name}</option>";
}
?>
							</select>
						</td>
					</tr>
					<tr>
						<th>Brewery:</th>
						<td>
							<select name='brewery_id' class='form-control'>
								<?php 
$breweries = Brewery::getAll();
foreach ($breweries as $brewery) {
    echo "<option value={$brewery->id}>{$brewery->name}</option>";
開發者ID:k4hun,項目名稱:beers-blog-php,代碼行數:31,代碼來源:add.php

示例3: count

<div class='container'>
	<p>Donec congue, tellus in malesuada fermentum, sem dui tristique diam, sit amet posuere eros metus vitae augue. Vivamus metus sem, imperdiet nec lacinia vitae, ornare non erat. Aliquam pharetra, turpis ut ornare pellentesque, lectus odio semper nibh, non tristique massa arcu id ante. Vestibulum nisi libero, tempor nec dolor nec, tempus iaculis lorem. Phasellus mauris sapien, bibendum ut convallis quis, feugiat ac nibh. Donec lacinia eget mauris eu congue. Nulla at enim eget risus molestie efficitur nec et erat. Fusce at iaculis purus. Morbi eget finibus odio. Donec ac sodales lectus, id finibus felis. Proin tempor gravida arcu ut ultrices. Aliquam quis cursus risus. Vivamus nisi augue, congue nec faucibus eu, congue eu orci. Nulla pulvinar, nisi at pellentesque tincidunt, ligula ex pellentesque tortor, a iaculis ante quam at lectus.</p>
	<div class='text-center ingredients'>
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/water.jpg" width="180" /></div>
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/malts.jpg" width="180" /></div>
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/hops.jpg" width="180" /></div>
		<div class='col-md-3'><img height="150" src="assets/images/ingredients/yeasts.jpg" width="180" /></div>
	</div>
</div>
<hr>
<h2 class='h2-header' id='tasted'>Already tasted</h2>
<div class='container'>
	<ul id='tasted_list'>
		<div class='row'>
			<?php 
$tasted = Style::getAll();
$row = 1;
foreach ($tasted as $style) {
    $beers = count(Style::getBeers($style->id));
    echo "<div class='col-md-4'>\n\t\t\t\t\t\t\t<li><a href='" . $_SERVER['PHP_SELF'] . "?style=" . $style->id . "#tasted'>" . $style->name . "</a> <span class='badge'>" . $beers . "</span></li>\n\t\t\t\t\t\t</div>";
    if ($row % 3 == 0) {
        echo "</div><div class='row'>";
    }
    $row++;
}
?>
		</div>
	</ul>

	<div class='row'>
		<?php 
開發者ID:k4hun,項目名稱:beers-blog-php,代碼行數:31,代碼來源:beers.php

示例4: newDeck

 function newDeck()
 {
     // need a better access control here
     if (!$this->_user['is_authorized']) {
         $this->set('authorized', false);
         //die ( 'Please login in to create a new deck!' );
     } else {
         $this->set('authorized', true);
     }
     if (isset($_POST['submit'])) {
         $data = $_POST['deck'];
         $deck = new Deck();
         $deck->title = $data['title'];
         $deck->slug_title = $deck->sluggify($deck->title);
         $user = new User();
         $user->createFromID($this->getCurrentUserID());
         $deck->user = $user;
         $deck->abstract = $data['abstract'];
         $deck->default_theme = $data['theme'];
         $deck->visibility = $data['visibility'];
         $deck->language['id'] = $data['language_id'];
         $deck->language['name'] = $data['language_name'];
         $deck->create();
         $slide_no = $data['slideNo'];
         //add slides
         $content = array();
         for ($i = 1; $i < $slide_no; $i++) {
             $slide = new Slide();
             $slide->user = $user;
             $slide->content = "<h2>new slide</h2>";
             $slide->language['id'] = $data['language_id'];
             $slide->language['name'] = $data['language_name'];
             $slide->translation_status = 'original';
             $slide->create();
             $content[] = $slide;
         }
         $deck->addContent($content);
         $tag = new Tag();
         $tag->item_type = "deck";
         $tag->item_id = $deck->id;
         foreach (explode(',', $data['tags']) as $item) {
             $tag->tag = $item;
             $tag->save();
         }
         header('Location:deck/' . $deck->id . '_' . $deck->slug_title);
     } else {
         $style = new Style();
         $styles_list = $style->getAll();
         $this->set('styles', $styles_list);
         $user_id = $this->getCurrentUserID();
         $user = new User();
         $user->id = $user_id;
         $default_language = $user->getDefaultLanguage();
         if (!$default_language['id']) {
             $default_language['id'] = 'en';
             $default_language['name'] = 'English';
         }
         $this->set('default_language', $default_language);
     }
     $this->set('page_title', 'SlideWiki - Create a new deck');
 }
開發者ID:TBoonX,項目名稱:SlideWiki,代碼行數:61,代碼來源:MainController.php


注:本文中的Style::getAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。