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


PHP File::find方法代码示例

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


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

示例1: index

 public function index()
 {
     $login = Auth::check('member');
     $softwares = Software::find('all', array('order' => array('created' => 'DESC')));
     $files = File::find('all');
     return compact('login', 'softwares', 'files');
 }
开发者ID:beeckmpi,项目名称:permanentielijsten,代码行数:7,代码来源:SoftwareController.php

示例2: actionIndex

 /**
  * Lists all File models.
  * @return mixed
  */
 public function actionIndex()
 {
     if (!Yii::$app->user->can("admin")) {
         throw new HttpException(403, 'You are not allowed to perform this action.');
     }
     $dataProvider = new ActiveDataProvider(['query' => File::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
开发者ID:rsvancara,项目名称:filedownloader,代码行数:12,代码来源:FileController.php

示例3: document

 public function document()
 {
     $user = Session::read('member');
     $id = md5($user['email']);
     $document = Details::find('first', array('conditions' => array('user_id' => (string) $user['_id'])));
     //		if(count($document)==0){return $this->redirect('/');}
     $uploadOk = 1;
     if ($this->request->data) {
         $extension = pathinfo($this->request->data['file']['name'], PATHINFO_EXTENSION);
         $allowed = array('pdf');
         if (!in_array(strtolower($extension), $allowed)) {
             $msg = "Sorry, only PDF files are allowed.";
             $uploadOk = 0;
         }
         if ($uploadOk = 1) {
             $option = 'doc';
             $data = array('details_' . $option . '_id' => (string) $document['_id'], 'docname' => $this->request->data['docname'], 'date' => $this->request->data['date'], 'DateTime' => new \MongoDate(), 'keywords' => $this->request->data['keywords'], 'description' => $this->request->data['description'], $option => $this->request->data['file'], $option . '.verified' => 'No', $option . '.IP' => $_SERVER['REMOTE_ADDR']);
             $field = 'details_' . $option . '_id';
             $Documents = Documents::create($data);
             $saved = $Documents->save();
             $fileData = array('file' => $this->request->data['file'], 'documents_' . $option . '_id' => (string) $Documents->_id);
             $file = File::create();
             if ($file->save($fileData)) {
                 $msg = "Upload OK";
             }
             $image_address = File::find('first', array('conditions' => array('documents_doc_id' => (string) $Documents->_id)));
             if ($image_address['filename'] != "") {
                 $imagename_address = $image_address['_id'] . '_' . $image_address['filename'];
                 $path = LITHIUM_APP_PATH . '/webroot/download/' . $imagename_address;
                 file_put_contents($path, $image_address->file->getBytes());
             }
             //		print_r($path);
             $pages = $this->getPDFPages($path);
             // Output: 13
             //				print_r($pages);exit;
             unlink($path);
             $docdata = array();
             foreach ($pages as $page) {
                 $params = explode(":", $page);
                 $left = $params[0];
                 $right = $params[1];
                 $docdata = array_merge($docdata, array($left => trim($right)));
             }
             $data = array("document" => $docdata);
             $conditions = array("_id" => (string) $Documents->_id);
             Documents::update($data, $conditions);
             // Use the function
         }
     }
     return $this->redirect('ex::save');
 }
开发者ID:nilamdoc,项目名称:OxOPDF,代码行数:51,代码来源:UploadController.php

示例4: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = File::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'size' => $this->size, 'date_entered' => $this->date_entered, 'date_updated' => $this->date_updated]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
开发者ID:jamezlee,项目名称:v3,代码行数:21,代码来源:FileSearch.php

示例5: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = File::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['file_id' => $this->file_id, 'file_time' => $this->file_time, 'file_msg_id' => $this->file_msg_id, 'file_user_id' => $this->file_user_id, 'file_size' => $this->file_size]);
     $query->andFilterWhere(['like', 'file_orig_name', $this->file_orig_name])->andFilterWhere(['like', 'file_type', $this->file_type])->andFilterWhere(['like', 'file_name', $this->file_name]);
     return $dataProvider;
 }
开发者ID:mosedu,项目名称:confprof,代码行数:21,代码来源:FileSearch.php

示例6: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = File::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'rec_id' => $this->rec_id, 'type_id' => $this->type_id, 'rec_status_id' => $this->rec_status_id, 'user_id' => $this->user_id, 'dc' => $this->dc]);
     $query->andFilterWhere(['like', 'table_name', $this->table_name])->andFilterWhere(['like', 'class_name', $this->class_name])->andFilterWhere(['like', 'file_name', $this->file_name])->andFilterWhere(['like', 'file_path', $this->file_path])->andFilterWhere(['like', 'note', $this->note]);
     return $dataProvider;
 }
开发者ID:slavam,项目名称:placement,代码行数:21,代码来源:FileSearch.php

示例7: view

 public function view($id = null)
 {
     $user = Session::read('member');
     if ($user == "") {
         return $this->redirect('/');
     }
     $image_address = File::find('first', array('conditions' => array('documents_doc_id' => (string) $id)));
     if ($image_address['filename'] != "") {
         $imagename_address = $image_address['_id'] . '_' . $image_address['filename'];
         $path = LITHIUM_APP_PATH . '/webroot/download/' . $imagename_address;
         file_put_contents($path, $image_address->file->getBytes());
     }
     return compact('imagename_address');
 }
开发者ID:nilamdoc,项目名称:OxOPDF,代码行数:14,代码来源:ExController.php

示例8: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = File::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'filename', $this->filename])->andFilterWhere(['like', 'avatar', $this->avatar])->andFilterWhere(['like', 'type', $this->type]);
     return $dataProvider;
 }
开发者ID:eibenm,项目名称:raptorapp,代码行数:21,代码来源:FileSearch.php

示例9: search

 /**
 * Creates data provider instance with search query applied
 *
 * @param array $params
 *
 * @return ActiveDataProvider
 */
 public function search($params)
 {
     $query = File::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'startdate' => $this->startdate, 'enddate' => $this->enddate, 'sensorid' => $this->sensorid]);
     $query->andFilterWhere(['like', 'filelink', $this->filelink])->andFilterWhere(['like', 'filename', $this->filename])->andFilterWhere(['like', 'extension', $this->extension])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
开发者ID:ICHydro,项目名称:anaconda,代码行数:21,代码来源:FileSearch.php

示例10: saveHeaders

 private function saveHeaders($file, $fileID)
 {
     //create the path
     $fileName = base_path() . "/public/files/" . $file->getClientOriginalName();
     //create the empty arrays
     $columnTitles = [];
     $taxonomyArray = [];
     $fieldArray = [];
     //load the file
     $rows = Excel::load($fileName, function ($reader) {
     })->get();
     //set the values of the columns as the header
     foreach ($rows as $title => $value) {
         //set the row data
         foreach ($value as $key => $column) {
             $columnTitles[$key][] = $column;
         }
     }
     $files = File::find($fileID);
     foreach ($columnTitles as $key => $value) {
         $field_tax = Field_Taxonomy::where('title', '=', $key);
         $fieldTaxID = 0;
         $count = 1;
         //if the title doesn't exist as a record in the field_tax table
         if ($field_tax->count() === 0) {
             //grab the id of the newly inserted taxonomy record
             $fieldTaxID = Field_Taxonomy::insertGetId(['title' => $key]);
             foreach ($value as $data) {
                 Field::insert(['value' => $data, 'field_taxonomy_id' => $fieldTaxID, 'row_in_file' => $count]);
                 $count++;
             }
             File_Field_Taxonomy::insert(['file_id' => $fileID, 'field_taxonomy_id' => $fieldTaxID]);
         } else {
             $fileArr = explode(".", $file->getClientOriginalName());
             $fileTitleArr = explode("_", $fileArr[0]);
             $fieldTax = Field_Taxonomy::take(1)->select('field_taxonomy_table.id')->join('file_field_taxonomy_table', 'file_field_taxonomy_table.field_taxonomy_id', '=', 'field_taxonomy_table.id')->join('files', 'files.id', '=', 'file_field_taxonomy_table.file_id')->where('title', '=', $key)->where('parsed_title', '=', $fileTitleArr[0])->get();
             if (count($fieldTax) > 0) {
                 $fieldTaxID = $fieldTax[0]->id;
             } else {
                 $fieldTaxID = Field_Taxonomy::insertGetId(['title' => $key]);
             }
             foreach ($value as $data) {
                 Field::insert(['value' => $data, 'field_taxonomy_id' => $fieldTaxID, 'row_in_file' => $count]);
                 $count++;
             }
             File_Field_Taxonomy::insert(['file_id' => $fileID, 'field_taxonomy_id' => $fieldTaxID]);
         }
     }
 }
开发者ID:progyny-joe,项目名称:claimsbybatch,代码行数:49,代码来源:File.php

示例11: getImageAsResponse

 static function getImageAsResponse($id, $imageId, $size = 0)
 {
     $file = File::find($imageId);
     if ($file) {
         try {
             $path = self::getImageFromStorage($id, $file->new_filename);
             $img = Image::make($path);
             if ($size > 0) {
                 $img->resize($size, null, function ($constraint) {
                     $constraint->aspectRatio();
                 });
             }
             return response($img->encode($img->extension), 200)->header('Content-Type', $img->mime);
         } catch (\Exception $e) {
             return new \RuntimeException($e);
         }
     }
 }
开发者ID:arjayads,项目名称:all-star,代码行数:18,代码来源:MyHelper.php

示例12: create

 /**
  * Create a file sharing request
  */
 public function create($input)
 {
     $user = \Auth::user();
     $input['user_id'] = $user->id;
     $now = \Carbon\Carbon::now();
     $input['expires_at'] = $now->addDays($input['expires_at'])->toDateTimeString();
     $request = \App\Models\SharedFileRequest::create($input);
     if ($request) {
         foreach ($input['files'] as $file) {
             $fileShare = \App\Models\SharedFile::create(['request_id' => $request->id, 'file_id' => $file['id'], 'user_id' => $user->id]);
             $file = FSFile::find($file['id']);
             $file->resolvable_type = 'FileShare';
             $file->resolvable_id = $fileShare->id;
             $file->save();
         }
         foreach ($input['recipients'] as $recipient) {
             $d = \App\Models\SharedFileRecipient::create(['request_id' => $request->id, 'email' => $recipient]);
         }
         \Event::fire(new \App\Events\FileShared($request));
     }
     return $request;
 }
开发者ID:GoohegWeb,项目名称:file-sharing,代码行数:25,代码来源:SharedFiles.php

示例13: actionVerify

 /**
  * Verify request
  * @param $id
  */
 public function actionVerify($id)
 {
     if (!Yii::$app->user->can("admin")) {
         throw new HttpException(403, 'You are not allowed to perform this action.');
     }
     $user = \Yii::$app->user->identity;
     $request = Request::find()->where(['id' => $id])->one();
     $user = User::find()->where(['id' => $request->user_id])->one();
     $profile = Profile::find()->where(['user_id' => $user->id])->one();
     $request_files = RequestFile::find()->where(['request_id' => $request->id])->all();
     $files = [];
     if ($request_files !== NULL) {
         foreach ($request_files as $rf) {
             $file = File::find()->where(['id' => $rf->file_id])->one();
             array_push($files, $file);
         }
     }
     if ($request === NULL) {
         $this->redirect(['site/error']);
     }
     return $this->render('verify', ['request' => $request, 'user' => $user, 'profile' => $profile, 'files' => $files]);
 }
开发者ID:rsvancara,项目名称:filedownloader,代码行数:26,代码来源:RequestController.php

示例14: Approve

 public function Approve($media = null, $id = null, $response = null)
 {
     if ($this->__init() == false) {
         $this->redirect('ex::dashboard');
     }
     if ($response != "") {
         if ($response == "Approve") {
             $data = array($media . ".verified" => "Yes");
         } elseif ($response == "Reject") {
             $data = array($media . ".verified" => "No");
         }
         $details = Details::find('first', array('conditions' => array('_id' => $id)))->save($data);
     }
     $details = Details::find('first', array('conditions' => array('_id' => $id)));
     $image_utility = File::find('first', array('conditions' => array('details_' . $media . '_id' => (string) $details['_id'])));
     if ($image_utility['filename'] != "") {
         $imagename_utility = $image_utility['_id'] . '_' . $image_utility['filename'];
         $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_utility;
         file_put_contents($path, $image_utility->file->getBytes());
     }
     $this->_render['layout'] = 'image';
     $title = "Approve";
     $keywords = "Approve, documents";
     $description = "Admin Approve documents ";
     return compact('imagename_utility', 'media', 'id', 'title', 'keywords', 'description', 'settings');
 }
开发者ID:nilamdoc,项目名称:msx,代码行数:26,代码来源:AdminController.php

示例15: settings

 public function settings($option = null)
 {
     $title = "User settings";
     $ga = new GoogleAuthenticator();
     $user = Session::read('default');
     if ($user == "") {
         return $this->redirect('/login');
     }
     $id = $user['_id'];
     $details = Details::find('first', array('conditions' => array('user_id' => (string) $id)));
     $uploadOk = 1;
     $qrCodeUrl = $ga->getQRCodeGoogleUrl(COMPANY_URL . "-" . $details['username'], $details['secret']);
     if ($this->request->data) {
         $imageFileType = pathinfo($this->request->data['file']['name'], PATHINFO_EXTENSION);
         if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
             $msg = "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
             $uploadOk = 0;
             return $this->redirect('Users::settings', compact('msg'));
         }
         if ($uploadOk = 1) {
             $option = $this->request->data['option'];
             $data = array($option => $this->request->data['file'], $option . '.verified' => 'No');
             $field = 'details_' . $option . '_id';
             $remove = File::remove('all', array('conditions' => array($field => (string) $details->_id)));
             $fileData = array('file' => $this->request->data['file'], 'details_' . $option . '_id' => (string) $details->_id);
             $details = Details::find('first', array('conditions' => array('user_id' => (string) $id)))->save($data);
             $file = File::create();
             if ($file->save($fileData)) {
                 $this->redirect('ex::dashboard');
             }
         }
         $TOTP = $details['TOTP.Validate'];
         $secret = $details['secret'];
     }
     $details = Details::find('first', array('conditions' => array('user_id' => (string) $id)));
     $image_address = File::find('first', array('conditions' => array('details_address_id' => (string) $details['_id'])));
     if ($image_address['filename'] != "") {
         $imagename_address = $image_address['_id'] . '_' . $image_address['filename'];
         $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_address;
         file_put_contents($path, $image_address->file->getBytes());
     }
     $image_government = File::find('first', array('conditions' => array('details_government_id' => (string) $details['_id'])));
     if ($image_government['filename'] != "") {
         $imagename_government = $image_government['_id'] . '_' . $image_government['filename'];
         $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_government;
         file_put_contents($path, $image_government->file->getBytes());
     }
     $image_bank = File::find('first', array('conditions' => array('details_bank_id' => (string) $details['_id'])));
     if ($image_bank['filename'] != "") {
         $imagename_bank = $image_bank['_id'] . '_' . $image_bank['filename'];
         $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_bank;
         file_put_contents($path, $image_bank->file->getBytes());
     }
     $settings = Settings::find('first');
     return compact('details', 'user', 'title', 'qrCodeUrl', 'secret', 'option', 'imagename_address', 'imagename_government', 'imagename_bank', 'settings', 'msg');
 }
开发者ID:nilamdoc,项目名称:msx,代码行数:56,代码来源:UsersController.php


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