• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FileModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mcm_objDelete

 public function mcm_objDelete()
 {
     //删除文件对象ById
     $File = new FileModel();
     $id = '5655749ac9a15ae50d392c8e';
     $File->objDelete($id);
 }
开发者ID:feeee,项目名称:APICloud-PHP-SDK,代码行数:7,代码来源:example-File.php


示例2: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     /* Инициализация модели */
     $model = new FileModel();
     $model->name = "Гость";
     $output = $model->render(USER_DEFAULT_FILE);
     $fc->setBody($output);
 }
开发者ID:HungryJunior,项目名称:MyMVCFramework,代码行数:9,代码来源:IndexController.php


示例3: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     /* Инициализация модели */
     $model = new FileModel();
     $view = 'moderator.php';
     $file = './protected/views/layout/main.php';
     $output = $model->render($file, $view);
     $fc->setBody($output);
 }
开发者ID:sarmaGit,项目名称:orbis,代码行数:10,代码来源:ModeratorController.php


示例4: indexAction

 public function indexAction()
 {
     $pdo = DB::getInstance()->getConnection();
     $fc = FrontController::getInstance();
     /* Инициализация модели */
     $model = new FileModel();
     /* 
      *	$model->name = $params['name'];
      */
     $model->name = "Guest";
     $output = $model->render(TEMPLATE, USER_DEFAULT_FILE);
     $fc->setBody($output);
 }
开发者ID:TimaVox,项目名称:First-MVC,代码行数:13,代码来源:IndexController.php


示例5: addAction

 public function addAction()
 {
     $fc = FrontController::getInstance();
     $params = $fc->getParams();
     $model = new FileModel();
     $model->name = $params['name'];
     $model->role = $params['role'];
     $str = file_get_contents('data/users.txt');
     $arrUsers = unserialize($str);
     $arrUsers[$model->name] = $model->role;
     $str_2 = serialize($arrUsers);
     file_put_contents('data/users.txt', $str_2);
     $result = $model->render('application/views/' . USER_ADD_FILE);
     $fc->setBody($result);
 }
开发者ID:echmaster,项目名称:data,代码行数:15,代码来源:UserController.php


示例6: renderDefault

 public function renderDefault($url)
 {
     $res = dibi::query('
   SELECT
         workId,
         url as file,
         title,
         text,', Model::sqlCategory() . ' as category,
         authorUrl,
         CONCAT_WS(" ", name, surname) as authorName,
         year,', Model::sqlWorkClassName() . 'as workClass,', 'award,
         type, 
         pages,
         words,
         characters,
         [read],
         added,
         edited             
         FROM [works] 
         join [authors] on author = authorId
         WHERE `url`=%s', $url)->fetchAll();
     //$res[0]['award'] = ($res[0]['award'] != 99) ? $res[0]['award'] . ". místo" : "nominaci";
     //2010-08-19 22:43:25
     $res[0]['added'] = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', '$3.$2.$1 $4:$5', $res[0]['added']);
     $res[0]['edited'] = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', '$3.$2.$1 $4:$5', $res[0]['edited']);
     $this->template->data = $res[0];
     $this->template->files = FileModel::getFiles($res[0]['workId']);
     Model::increaseRead($res[0]['workId']);
 }
开发者ID:xixixao,项目名称:chytrapalice,代码行数:29,代码来源:WorkPresenter.php


示例7: renderContent

 protected function renderContent()
 {
     $homeUrl = Yii::app()->createUrl('home/default');
     $content = '<div class="clearfix">';
     $content .= '<a href="#" id="nav-trigger" title="Toggle Navigation">&rsaquo;</a>';
     $content .= '<div id="corp-logo">';
     if ($logoFileModelId = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'logoFileModelId')) {
         $logoFileModel = FileModel::getById($logoFileModelId);
         $logoFileSrc = Yii::app()->getAssetManager()->getPublishedUrl(Yii::getPathOfAlias('application.runtime.uploads') . DIRECTORY_SEPARATOR . $logoFileModel->name);
     } else {
         $logoFileSrc = Yii::app()->themeManager->baseUrl . '/default/images/Zurmo_logo.png';
     }
     $logoHeight = ZurmoConfigurationFormAdapter::resolveLogoHeight();
     $logoWidth = ZurmoConfigurationFormAdapter::resolveLogoWidth();
     if (Yii::app()->userInterface->isMobile()) {
         $content .= '<a href="' . $homeUrl . '"><img src="' . $logoFileSrc . '" alt="Zurmo Logo" /></a>';
         //make sure width and height are NEVER defined
     } else {
         $content .= '<a href="' . $homeUrl . '"><img src="' . $logoFileSrc . '" alt="Zurmo Logo" height="' . $logoHeight . '" width="' . $logoWidth . '" /></a>';
     }
     if ($this->applicationName != null) {
         $content .= ZurmoHtml::tag('span', array(), $this->applicationName);
     }
     $content .= '</div>';
     if (!empty($this->userMenuItems) && !empty($this->settingsMenuItems)) {
         $content .= '<div id="user-toolbar" class="clearfix">';
         $content .= static::renderHeaderMenus($this->userMenuItems, $this->settingsMenuItems);
         $content .= '</div>';
     }
     $content .= '</div>';
     return $content;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:32,代码来源:HeaderLinksView.php


示例8: POST_indexAction

 /**
  * 打印任务
  * POST /task/
  * @method POST_index
  * @param fid 文件id
  * @param pid 打印店id
  * @param
  */
 public function POST_indexAction()
 {
     $userid = $this->auth();
     $response['status'] = 0;
     if (!Input::post('fid', $fid, 'int')) {
         $response['info'] = '未选择文件';
     } elseif (!Input::post('pid', $pid, 'int')) {
         $response['info'] = '未选择打印店';
     } elseif (!($file = FileModel::where('use_id', $userid)->where('status', '>', 0)->field('url,name,status')->find($fid))) {
         $response['info'] = '没有该文件或者此文件已经删除';
     } else {
         $task = TaskModel::create('post');
         $task['name'] = $file['name'];
         $task['use_id'] = $userid;
         $task['pri_id'] = $pid;
         if (!($task['url'] = File::addTask($file['url']))) {
             $response['info'] = '文件转换出错';
         } elseif (!($tid = TaskModel::insert($task))) {
             $response['info'] = '任务添加失败';
         } else {
             $response['status'] = 1;
             $response['info'] = ['msg' => '打印任务添加成功', 'id' => $tid];
         }
     }
     $this->response = $response;
 }
开发者ID:derek-chow,项目名称:YunYinService,代码行数:34,代码来源:Task.php


示例9: createFileModel

 public static function createFileModel($fileName = 'testNote.txt')
 {
     $pathToFiles = Yii::getPathOfAlias('application.modules.zurmo.tests.unit.files');
     $filePath = $pathToFiles . DIRECTORY_SEPARATOR . $fileName;
     $contents = file_get_contents($pathToFiles . DIRECTORY_SEPARATOR . $fileName);
     $fileContent = new FileContent();
     $fileContent->content = $contents;
     $file = new FileModel();
     $file->fileContent = $fileContent;
     $file->name = $fileName;
     $file->type = ZurmoFileHelper::getMimeType($pathToFiles . DIRECTORY_SEPARATOR . $fileName);
     $file->size = filesize($filePath);
     $saved = $file->save();
     assert('$saved');
     // Not Coding Standard
     return $file;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:17,代码来源:ZurmoTestHelper.php


示例10: handleDelete

 public function handleDelete($id)
 {
     Model::delete($id, "authorId", "authors");
     $array = dibi::query('SELECT workId FROM works WHERE author=%i', $id)->fetchAssoc();
     foreach ($array as $val) {
         FileModel::deleteFiles($val['workId']);
     }
     Model::delete($id, "author", "works");
     $this->redirect('this');
 }
开发者ID:xixixao,项目名称:chytrapalice,代码行数:10,代码来源:AuthorList.php


示例11: addAction

 public function addAction()
 {
     $fc = FrontController::getInstance();
     $params = $fc->getParams();
     //Получаем параметры из адресной строки(name/role)
     $model = new FileModel();
     $model->name = $params["name"];
     $model->role = $params["role"];
     $model->user[$model->name] = $model->role;
     //Записываем наши значения в "темповый" массив User
     $model->list = unserialize(file_get_contents(USER_DB));
     //Вытягиваем данные из файла пользователей
     $model->list = array_merge($model->list, $model->user);
     //Объеденяем массив текущих пользователей с массивом темпового.Перезаписываем
     file_put_contents(USER_DB, serialize($model->list));
     //Перезаписываем файл с данными всех пользователей
     $result = $model->render(USER_ADD_FILE);
     $fc->setBody($result);
 }
开发者ID:HungryJunior,项目名称:MyMVCFramework,代码行数:19,代码来源:UserController.php


示例12: testToArray

 public function testToArray()
 {
     $model = new FileModel();
     $result = $model->toArray();
     $attributes = ['Id' => 111, 'Name' => 'Имя'];
     $model->setAttributes($attributes);
     $reflectionClass = new ReflectionClass('FileModel');
     $properties = $reflectionClass->getProperties();
     /**
      * @var $property ReflectionProperty
      */
     foreach ($properties as $property) {
         $name = $property->getName();
         $value = $model->{$name};
         if (array_key_exists($name, $attributes)) {
             $this->assertEquals($attributes[$name], $value);
         } else {
             $this->assertNotContains($name, $result);
         }
     }
 }
开发者ID:tselishev-semen,项目名称:Chocolate,代码行数:21,代码来源:FileModelTest.php


示例13: populateWithFiles

 protected function populateWithFiles($model, $numberOfFilesToAttach, $pathToFiles)
 {
     assert('$model instanceof EmailTemplate  || $model instanceof Autoresponder || $model instanceof Campaign');
     for ($i = 0; $i < $numberOfFilesToAttach; $i++) {
         $fileName = $this->files[array_rand($this->files)];
         $filePath = $pathToFiles . DIRECTORY_SEPARATOR . $fileName;
         $contents = file_get_contents($pathToFiles . DIRECTORY_SEPARATOR . $fileName);
         $fileContent = new FileContent();
         $fileContent->content = $contents;
         $file = new FileModel();
         $file->fileContent = $fileContent;
         $file->name = $fileName;
         $file->type = ZurmoFileHelper::getMimeType($pathToFiles . DIRECTORY_SEPARATOR . $fileName);
         $file->size = filesize($filePath);
         $saved = $file->save();
         if (!$saved) {
             throw new FailedToSaveModelException();
         }
         $model->files->add($file);
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:21,代码来源:MarketingDemoDataMaker.php


示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->user = User::getByUsername('super');
     Yii::app()->user->userModel = $this->user;
     EmailAccount::deleteAll();
     EmailMessage::deleteAll();
     EmailMessageContent::deleteAll();
     EmailMessageSender::deleteAll();
     EmailMessageRecipient::deleteAll();
     EmailMessageSendError::deleteAll();
     FileModel::deleteAll();
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:13,代码来源:ProcessOutboundEmailJobBenchmarkTest.php


示例15: setUp

 public function setUp()
 {
     parent::setUp();
     $this->user = User::getByUsername('super');
     Yii::app()->user->userModel = $this->user;
     EmailAccount::deleteAll();
     EmailMessage::deleteAll();
     EmailMessageContent::deleteAll();
     EmailMessageSender::deleteAll();
     EmailMessageRecipient::deleteAll();
     EmailMessageSendError::deleteAll();
     FileModel::deleteAll();
     if (!EmailMessageTestHelper::isSetEmailAccountsTestConfiguration()) {
         $this->markTestSkipped('Please fix the test email settings');
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:16,代码来源:ProcessOutboundEmailJobBenchmarkTest.php


示例16: actionCreate

 public function actionCreate()
 {
     $model = new Image();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $file = UploadedFile::getInstance($model, 'name');
         if ($fileModel = FileModel::saveAs($file, '@common/upload')) {
         }
         if ($model->load(Yii::$app->request->post()) && $model->validate()) {
             if ($model->saveUploadedFile() !== false) {
                 $model->save();
                 return $this->redirect('image/create', ['model' => $model]);
             }
         } else {
             return $this->render('create', ['model' => $model]);
         }
     }
 }
开发者ID:kotmonstr,项目名称:full-shop,代码行数:17,代码来源:DefaultController.php


示例17: getAdd

 public function getAdd($id = null)
 {
     if ($id == null) {
         $new = new AutomateModel();
         $new->name = "";
         $data['row'] = $new;
         $data['technology'] = TechnologyModel::all();
         $data['plot'] = PlotModel::join('his_technology', 'his_technology.id', '=', 'his_plot.id_tech')->select('his_plot.id', 'his_plot.name', 'his_technology.name as technology')->orderBy('his_plot.id_tech')->get();
         $data['file'] = FileModel::where('filename', 'like', '%xls%')->get();
     } else {
         $id = SiteHelpers::encryptID($id, true);
         $data['technology'] = TechnologyModel::all();
         $data['plot'] = PlotModel::all();
         $data['file'] = FileModel::where('filename', 'like', '%xls%');
         $data['row'] = AutomateModel::where('id', $id)->first();
     }
     return View::make('automate.form', $data);
 }
开发者ID:alphatelradius,项目名称:histogram-tool,代码行数:18,代码来源:AutomateController.php


示例18: POST_indexAction

 /**
  * 分享文件
  * POST /share/
  * @method POST_index
  * @param key 获取token时返回的key
  */
 public function POST_indexAction()
 {
     $userid = $this->auth();
     $response['status'] = 0;
     if (!Input::post('fid', $fid, 'int')) {
         $response['info'] = '未选择文件';
     } elseif (!($File = FileModel::field('name,url,status')->where('use_id', '=', $userid)->where('status', '>', 0)->find($fid))) {
         /*数据库中查询的文件*/
         $response['info'] = '文件无效';
     } elseif ($File['status'] & self::SHARED_FLAG) {
         /*是否已经共享*/
         $response['info'] = '文件已分享';
     } elseif (!($share['url'] = File::share($File->url))) {
         /*发布到共享空间*/
         $response['info'] = '文件转移出错';
     } else {
         /*验证完成,开始插入*/
         $share['fil_id'] = $fid;
         $share['use_id'] = $userid;
         $share['name'] = Input::post('name', $name, 'title') ? $name : $File->name;
         if (Input::post('detail', $detail, 'text')) {
             $share['detail'] = $detail;
         }
         if (Input::post('anonymous', $anonymous)) {
             $share['anonymous'] = boolval($anonymous);
         }
         if ($sid = ShareModel::Insert($share)) {
             //插入成功
             //文件状态,更新为已分享
             $File->save(['status' => $File['status'] | self::SHARED_FLAG]);
             //TODO
             //分享文件预处理
             $response['status'] = 1;
             $response['info'] = ['msg' => '分享成功', 'id' => $sid];
         } else {
             $response['info'] = '分享失败';
         }
     }
     $this->response = $response;
 }
开发者ID:derek-chow,项目名称:YunYinService,代码行数:46,代码来源:Share.php


示例19: beforeDelete

 /**
  * Event handler for beforeDelete
  * @param \yii\base\ModelEvent $event
  */
 public function beforeDelete($event)
 {
     $oldId = $this->owner->{$this->savedAttribute};
     if (($oldModel = FileModel::findOne($oldId)) !== null) {
         $event->isValid = $event->isValid && $oldModel->delete();
     }
 }
开发者ID:elevatesolutions,项目名称:proverbs,代码行数:11,代码来源:ImageUploadBehavior.php


示例20: actionDelete

 public function actionDelete($id)
 {
     $fileModel = FileModel::getById((int) $id);
     $fileModel->delete();
     //todo: add error handling.
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:6,代码来源:FileModelController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FileNameFilter类代码示例发布时间:2022-05-23
下一篇:
PHP FileManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap