本文整理汇总了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);
}
示例2: indexAction
public function indexAction()
{
$fc = FrontController::getInstance();
/* Инициализация модели */
$model = new FileModel();
$model->name = "Гость";
$output = $model->render(USER_DEFAULT_FILE);
$fc->setBody($output);
}
示例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);
}
示例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);
}
示例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);
}
示例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']);
}
示例7: renderContent
protected function renderContent()
{
$homeUrl = Yii::app()->createUrl('home/default');
$content = '<div class="clearfix">';
$content .= '<a href="#" id="nav-trigger" title="Toggle Navigation">›</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;
}
示例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;
}
示例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;
}
示例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');
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例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();
}
示例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');
}
}