当前位置: 首页>>代码示例>>PHP>>正文


PHP Book::load方法代码示例

本文整理汇总了PHP中Book::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::load方法的具体用法?PHP Book::load怎么用?PHP Book::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Book的用法示例。


在下文中一共展示了Book::load方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 /**
  * @return bool
  * @throws Exception
  */
 public function process()
 {
     $bookModel = new Book();
     if (!$bookModel->load($this->data) || !$bookModel->validate()) {
         throw new Exception('Invalid data!');
     }
     return $bookModel->delete();
 }
开发者ID:alfytu,项目名称:booklibrary,代码行数:12,代码来源:Delete.php

示例2: process

 /**
  * @return bool
  * @throws Exception
  */
 public function process()
 {
     $bookModel = new Book();
     if ($bookModel->load($this->data) && $bookModel->validate()) {
         $bookModel->save();
         return (array) $bookModel;
     }
     throw new Exception('Invalid data!');
 }
开发者ID:alfytu,项目名称:booklibrary,代码行数:13,代码来源:Set.php

示例3: find

		public function find ($id= null){
			if ($id!= null){
				$book= new Book();
				$book->load($id);
				return $book;
			}
			else{
				$error = new GsError(303,"Error loading book.");
				throw $error;
			}
		}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:11,代码来源:BookController.class.php

示例4: process

 /**
  * @return array
  * @throws Exception
  */
 public function process()
 {
     $bookModel = new Book();
     if (!$bookModel->load($this->data)) {
         return $bookModel->getAllRecords();
     }
     if ($bookModel->validate()) {
         return $bookModel->getRecords();
     }
     throw new Exception('Invalid data!');
 }
开发者ID:alfytu,项目名称:booklibrary,代码行数:15,代码来源:View.php

示例5: toHTML

 /**
  * Export a sheet to Html table
  *
  * @param Sheet $sheet
  * @return String
  */
 public static function toHTML($sheet)
 {
     $maxCol = FormatController::maxWrittenColumn($sheet);
     $maxRow = FormatController::maxWrittenRow($sheet);
     $book = new Book();
     $book->load($sheet->getBookId());
     $cells = $sheet->cells;
     unset($output);
     $output .= '<table border=1 border-collapse="collapse">';
     for ($i = 0; $i <= $maxRow; $i++) {
         $output .= '<tr>';
         for ($j = 0; $j <= $maxCol; $j++) {
             $cell = $sheet->getCell($i, $j);
             $fsId = 0;
             if ($cell != null) {
                 $fsId = $cell->getFontStyleId();
             }
             $output .= '<td class="c' . $fsId . '">';
             if ($cell != null) {
                 //$output.= $sheet->getData($i,$j);
                 $output .= $cell->getFormula();
             }
             $output .= '</td>';
         }
         $output .= '</tr>';
     }
     $output .= '</table>';
     $style = '<style type="text/css" media="screen">';
     $style .= "table{border-collapse:collapse;}";
     $style .= "td{border:1px solid #CCC;height:18px;width:80px;position:relative;}";
     foreach ($book->getFontStyles() as $fstyle) {
         $style .= FormatController::fontStyleToCss($fstyle) . "\n";
     }
     $style .= '</style>';
     $output = '<html><head>' . $style . '</head><body>' . $output . '</body></html>';
     return $output;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:43,代码来源:FormatController.class.php

示例6: wpimage_pageflip_filter

/**
 * find all images on page from pageflip and replace it by <a><img></a>
 * @param string $content - content of post
 * @return string - changed content
 */
function wpimage_pageflip_filter($content)
{
    //FlippingBook
    global $pageFlip;
    // error_reporting(-1);
    if (is_object($pageFlip) && is_a($pageFlip, 'pageFlip_plugin_base')) {
        $matches = array();
        preg_match_all("/\\[\\s*book\\s*id='([0-9]*)'[\\s\\/]*\\]/", $content, $matches);
        if (empty($matches[1])) {
            return $content;
        }
        foreach ($matches[1] as $match_key => $code) {
            $book = new Book($code);
            $book->load();
            $out = '';
            foreach ($book->pages as $key => $page) {
                //                $out .= '<a href="'.$book->pages[$i]->image.'">
                //                <img src="'.$book->album->images[$i]->thumb.'" '.($i == 0?'data-wiziapp-pageflipbook-id="'.$code.'"':'').'>
                //                </a>';
                /** We dont resize images anymore!!! Only thumbnails, on demand.
                                $image = new WiziappImageHandler($page->image);
                
                                $size = wiziapp_getImageSize('full_image');
                                $url_to_full_sized_image = $image->getResizedImageUrl($page->image, $size['width'], $size['height'], 'resize');
                
                                $size = wiziapp_getImageSize('multi_image');
                                $urlToMultiSizedImage = $image->getResizedImageUrl($page->image, $size['width'], $size['height'], 'resize');
                                
                                $width = $image->getNewWidth();
                                $height = $image->getNewHeight();
                
                                $sizeHtml = " width=\"{$width}\" height=\"{$height}\" "; */
                $out .= '<a href="' . $page->image . '" class="wiziapp_gallery wiziapp_pageflip_plugin"><img src="' . $page->image . '" data-wiziapp-pageflipbook-id="' . $code . '"></a>';
            }
            $content = str_replace($matches[0][$match_key], $out, $content);
        }
    }
    return $content;
}
开发者ID:sajidsan,项目名称:sajidsan.github.io,代码行数:44,代码来源:pageflip_pugin.php

示例7: save

		/**
		 * Saves the book into de database.
		 * If the id isn't setted, automatically assigns one
		 *
		 **/
		public function save(){
			
			
			$update = false ; 
			$hasErrors = false;

			if(!isset($this->userId))
				$this->userId = 1;    //TODO: Remove only for debugging user must be always setted (logged user)
			
			$sql = "INSERT INTO ".table('books'). " (BookId, BookName, UserId) VALUES ($this->bookId,'$this->bookName',$this->userId)";


			if (isset($this->bookId)) { // Edit book..
				//Check if the the id is correct..
				$res = mysql_query("SELECT BookId FROM ".table('books'). " where BookId=$this->bookId");
				if(!$res){
					$error = new GsError(302,"Error loading book.");
					if($error->isDebugging()){
						$error->addContentElement("BookId",$BookId);
						$err = str_replace("'", '"', mysql_error());
						$error->addContentElement("MySql Error",$err);
					}
					throw $error;					
					$hasErrors = true;
				}

				$row = mysql_fetch_object($res);
				if (!$row) {
					//ERROR: trying to save a book that does exist. Must have null value the bookid
					if(!mysql_query($sql)){
						$error = new GsError(302,"Error saving book. Book don't exists");
						if($error->isDebugging()){
							$error->addContentElement("BookId",$BookId);
							$err = str_replace("'", '"', mysql_error());
							$error->addContentElement("MySql Error",$err);
						}
						throw $error;					
					}

				}else {
				// OK: Delete.. and save it again
					$update = true;
					mysql_query("START TRANSACTION");
					$book_tmp = new Book();
					$book_tmp->load($this->bookId);
					$book_tmp->delete(true);


					if(!mysql_query($sql)){
						$error = new GsError(302,"Error saving book. Book don't exists");
						if($error->isDebugging()){
							$error->addContentElement("BookId",$BookId);
							$err = str_replace("'", '"', mysql_error());
							$error->addContentElement("MySql Error",$err);
						}
						throw $error;					
						$hasErrors = true;
					}

				}

			}else { 
				//SAVE AS...
				
				$sql = "INSERT INTO ".table('books'). " (BookName, UserId) VALUES ('$this->bookName',$this->userId)";
				$query = mysql_query($sql);
				if($query)
					$this->bookId= mysql_insert_id();
				else{
					
					$error = new GsError(302,"Error saving book.");
					if($error->isDebugging()){
						$error->addContentElement("BookId",$BookId);
						$err = str_replace("'", '"', mysql_error());
						$error->addContentElement("MySql Error",$err);
					}
					throw $error;					
					
					$hasErrors = true;
				}
			}
			
			//COMMON CODE..
			if(!$hasErrors){
				foreach ($this->sheets as $sheet) {
					$sheet->bookId = $this->bookId;
					$hasErrors = $sheet->save();
				}
			}

			if(!$hasErrors){
				foreach ($this->fontStyles as $fontStyle) {
					$fontStyle->bookId = $this->bookId;
					$hasErrors = $fontStyle->save();
				}
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:Book.class.php

示例8: restoreMagazineNumber

 private static function restoreMagazineNumber($id_book, $number)
 {
     if (!$number) {
         list($number, $id_magazine) = Database::sql2row("SELECT `n`,`id_magazine` FROM `book_magazines` WHERE `id_book`=" . $id_book);
     } else {
         $id_magazine = Database::sql2single("SELECT `id_magazine` FROM `book_magazines` WHERE `id_book`=" . $id_book);
     }
     if (!$number) {
         return;
     }
     global $current_user;
     $magazineData = Database::sql2row('SELECT * FROM `magazines` WHERE `id`=' . $id_magazine);
     $query = 'UPDATE `book_magazines` SET `n`=' . $number . '  WHERE `id_book`=' . $id_book;
     Database::query($query);
     $book = new Book($id_book);
     $book->load();
     $year = $book->data['year'];
     $title = $magazineData['title'];
     $subtitle = '№ ' . $number . ' за ' . $book->data['year'] . ' год';
     $query = 'UPDATE `book` SET `title`=' . Database::escape($title) . ' , `subtitle`=' . Database::escape($subtitle) . ' WHERE `id`=' . $id_book;
     Database::query($query);
 }
开发者ID:rasstroen,项目名称:metro,代码行数:22,代码来源:BiberLog.php


注:本文中的Book::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。