当前位置: 首页>>代码示例>>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;未经允许,请勿转载。