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


PHP Place::getByAll方法代码示例

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


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

示例1: create


//.........这里部分代码省略.........
                     if ($im && $im2) {
                         $imageMade = File::imageToFile($im, IMAGEPATH . $temp_thumblink);
                         if ($imageMade) {
                             $viewMade = File::imageToFile($im2, IMAGEPATH . $view_link);
                             if (!$viewMade) {
                                 unlink($link);
                                 return -6;
                             }
                         } else {
                             unlink($temp_thumblink);
                             unlink($link);
                             return -6;
                         }
                     } else {
                         unlink($link);
                         return -6;
                     }
                     $type = $this->docType;
                 } else {
                     $view_link = null;
                     $temp_thumblink = "changeMeToDocThumb";
                     $type = "other";
                 }
                 $result[] = "Stored in: " . "upload/" . $savename;
                 $init = new File();
                 $init->id = null;
                 $init->link = $link;
                 $init->thumblink = $temp_thumblink;
                 $init->viewlink = $view_link;
                 $init->title = $title ? $title : "Untitled";
                 $init->author = $author;
                 $init->comments = $comments;
                 $init->date = null;
                 $init->type = $this->docType;
                 $init_id = $init->save();
                 if ($init_id) {
                     if (isset($this->tags) && !empty($this->tags)) {
                         foreach ($this->tags as $key => $value) {
                             if ($key === 'person') {
                                 foreach ($value as $person) {
                                     $tag = new Tag();
                                     $tag->enum = 'person';
                                     $tag->fileid = $init_id;
                                     $tag->foreignid = $person->id;
                                     $tag->save();
                                 }
                             } else {
                                 if ($key === 'place') {
                                     foreach ($value as $place) {
                                         $tag = new Tag();
                                         $tag->enum = 'place';
                                         $tag->foreignid = false;
                                         $tempPlace = Place::getByAll($place);
                                         if ($tempPlace) {
                                             $tag->foreignid = $tempPlace->id;
                                         } else {
                                             $tempPlace = recast('Place', $place);
                                             $tpId = $tempPlace->save();
                                             if ($tpId) {
                                                 $tag->foreignid = $tpId;
                                             }
                                         }
                                         if ($tag->foreignid) {
                                             $tag->fileid = $init_id;
                                             $tag->save();
                                         }
                                     }
                                 } else {
                                     if ($key === 'other') {
                                         foreach ($value as $tag) {
                                             $tag = recast('Tag', $tag);
                                             if ($tag) {
                                                 $tag->fileid = $init_id;
                                                 $tag->enum = 'other';
                                                 $tag->id = NULL;
                                                 $tag->save();
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     return 1;
                 } else {
                     unlink($temp_thumblink);
                     unlink($link);
                     //database connection wasn't saved
                     return -4;
                 }
             } else {
                 //file wasn't moved
                 return -3;
             }
         }
     }
     //the database entry already exists
     return -5;
     // save file
 }
开发者ID:Jonathan-Law,项目名称:fhd,代码行数:101,代码来源:dropzone.php

示例2: getByTagType

 public static function getByTagType($val, $type = NULL, $limit)
 {
     $database = cbSQLConnect::connect('object');
     $limitNum = isset($limit) && $limit === true ? 10 : false;
     if (isset($database)) {
         if ($type !== NULL && $type === 'person') {
             $query = "SELECT * FROM `file` WHERE `id` IN (SELECT `fileid` FROM `tag` WHERE `foreignid` IN (SELECT `id` FROM `person` WHERE MATCH(`firstName`, `middleName`, `lastName`) AGAINST('" . $val . "' IN BOOLEAN MODE)))";
             if ($limitNum) {
                 $query .= "LIMIT 0, {$limitNum}";
             }
         } else {
             if ($type !== NULL && $type === 'place') {
                 $place = Place::getByAll($val);
                 if ($place) {
                     $query = "SELECT * FROM `file` WHERE `id` IN (SELECT `fileid` FROM `tag` WHERE `foreignid` IN (SELECT `id` FROM `place` WHERE `id`=" . $place->id . "))";
                     if ($limitNum) {
                         $query .= "LIMIT 0, {$limitNum}";
                     }
                 } else {
                     $query = "SELECT *, MATCH(title, author, comments) AGAINST('" . $val . "' IN BOOLEAN MODE) AS score FROM `file` WHERE MATCH(title, author, comments) AGAINST('" . $val . "' IN BOOLEAN MODE) ORDER BY score DESC";
                     if ($limitNum) {
                         $query .= "LIMIT 0, {$limitNum}";
                     }
                 }
             } else {
                 if ($type !== NULL && $type === 'collection') {
                     $query = "SELECT * FROM `file` WHERE `id` IN (SELECT `fileid` FROM `tag` WHERE MATCH(`text`) AGAINST('" . $val . "' IN BOOLEAN MODE))";
                     if ($limitNum) {
                         $query .= "LIMIT 0, {$limitNum}";
                     }
                 } else {
                     $query = "SELECT *, MATCH(title, author, comments) AGAINST('" . $val . "' IN BOOLEAN MODE) AS score FROM `file` WHERE MATCH(title, author, comments) AGAINST('" . $val . "' IN BOOLEAN MODE) OR `link` LIKE '%" . $val . "%' ORDER BY score DESC";
                     if ($limitNum) {
                         $query .= "LIMIT 0, {$limitNum}";
                     }
                     $database = cbSQLConnect::connect('array');
                     return $database->QuerySingle($query);
                 }
             }
         }
         return $database->QuerySingle($query);
     }
     return false;
 }
开发者ID:Jonathan-Law,项目名称:fhd,代码行数:44,代码来源:file.php


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