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


PHP FileModel类代码示例

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


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


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