當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。