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


PHP Document::create方法代码示例

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


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

示例1: fileConvertAndUpdate

 public function fileConvertAndUpdate()
 {
     $dir = "../files/";
     $num = 0;
     $documents_group = scandir($dir);
     foreach ($documents_group as $key => $value) {
         if ($value != "." && $value != "..") {
             $handler = new handler($dir, $value);
             if ($handler->getFileType() != NULL) {
                 try {
                     $document = Document::create(array('path' => $handler->getPath(), 'fileName' => $handler->getFileName(), 'fileType' => $handler->getFileType(), 'systemName' => $handler->getSystemName(), 'airlineName' => $handler->getAirlineName(), 'ticketNumber' => $handler->getTicketNumber(), 'dateString' => $handler->getDateString(), 'orderOfDay' => $handler->getOrderOfDay(), 'fileContent' => $handler->getFileContent(), 'dateOfFile' => $handler->getDateOfFile(), 'paxName' => $handler->getPaxName(), 'rloc' => $handler->getRloc(), 'ticketsType' => $handler->getTicketsType()));
                     $document->save();
                     $num++;
                     rename($dir . $value, "../done/" . $value);
                 } catch (Exception $e) {
                     $response['info'] = "fail";
                     $boolean = false;
                     echo $e;
                 }
             }
         }
     }
     //echo $num." files have been converted."; die;
     return $num;
 }
开发者ID:pj10182014,项目名称:tickets,代码行数:25,代码来源:TicketsController.php

示例2: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Document::create([]);
     }
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:7,代码来源:DocumentsTableSeeder.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     $array = array(['path' => 'uploads/documents/dummy.pdf', 'documentable_id' => '1', 'documentable_type' => 'page'], ['path' => 'uploads/documents/dummy.pdf', 'documentable_id' => '1', 'documentable_type' => 'page']);
     foreach ($array as $item) {
         Document::create($item);
     }
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:8,代码来源:DocumentsTableSeeder.php

示例4: postAdd

 public function postAdd()
 {
     $document = Document::create(Input::all());
     $document->user_id = Auth::user()->id;
     $user = User::find($document->user_id);
     $organization = User::find($document->user_id)->organization();
     $user->organization->last_document_number++;
     $user->organization->save();
     $document->document_number = $user->organization->last_document_number;
     $document->save();
     return Redirect::action('DocumentsController@getView', [$document->id]);
 }
开发者ID:alexsynarchin,项目名称:Itnk,代码行数:12,代码来源:DocumentsController.php

示例5: store

 /**
  * Store a newly created document in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Document::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Input::hasFile('file')) {
         $uploaded_file = Input::file('file');
         $extension = $uploaded_file->getClientOriginalExtension();
         $filename = Input::get('name') . '.' . $extension;
         $destinationPath = public_path() . DIRECTORY_SEPARATOR . 'uploads/documents';
         $uploaded_file->move($destinationPath, $filename);
         $data['file'] = $filename;
         Document::create($data);
         return Redirect::route('admin.documents.index')->with("successMessage", "Dokumen berhasil ditambahkan");
     }
 }
开发者ID:inseo201,项目名称:atletik4,代码行数:22,代码来源:DocumentsController.php

示例6: run

 public function run()
 {
     DB::table('documents')->delete();
     Document::create(array('title' => 'AGM 2015 Agenda', 'type' => 'meeting', 'filename' => 'agm-2015-agenda', 'filetype' => 'pdf', 'owner' => 'Laurie Everest'));
     Document::create(array('title' => 'AGM 2014 Minutes', 'type' => 'meeting', 'filename' => 'agm-2014-minutes', 'filetype' => 'pdf', 'owner' => 'Laurie Everest'));
 }
开发者ID:GarethClarridge,项目名称:crockenhill,代码行数:6,代码来源:DocumentSeeder.php

示例7: __construct

    public function __construct()
    {
        $this->group = static::getGroup();
        // обращается к статичному методу дочернего класса
    }
    public static function create()
    {
        return new static();
        // создаёт обьект доченего класса
    }
    static function getGroup()
    {
        return "default";
    }
}
class User extends DomainObject
{
}
class Document extends DomainObject
{
    static function getGroup()
    {
        return "document";
    }
}
class SpreadSheet extends Document
{
}
var_dump(User::create());
var_dump(Document::create());
var_dump(SpreadSheet::create());
开发者ID:Overfinch,项目名称:oop,代码行数:31,代码来源:index2.php

示例8: array

     } else {
         $assignees = array();
     }
     if (!in_array($_POST['assign'], $assignees)) {
         $assignees[] = $_POST['assign'];
     }
     for ($i = 0; $i < count($assignees); $i++) {
         echo (new User($assignees[$i]))->getName();
         if ($i != count($assignees) - 1) {
             echo ', ';
         }
     }
 } else {
     if ($do == 'create') {
         extract($_POST);
         $document = Document::create($subject, $body, $clearance, $prefix, $_SESSION['user']->getID(), $assignees);
         /* Mail the new assignees */
         $ids = explode(',', $assignees);
         $users = array();
         for ($i = 0; $i < count($ids); $i++) {
             $users[] = new User($ids[$i]);
         }
         $message = 'You have been assigned to document <b>' . $document->getPrefix()->getPrefixAbbrev() . $document->getID() . '</b> by <b><i>' . $_SESSION['user']->getName() . '</i></b><br />';
         $message .= 'Login to <a href="http://irin.eotir.com">IRIN</a> to look at the document.';
         $subject = 'Document Assignment';
         $headers = "MIME-Version: 1.0" . "\r\n";
         $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
         $headers .= "From: IR Information Network <irin@eotir.com>" . "\r\n";
         foreach ($users as $user) {
             if (!in_array($user, $document->getAssignees())) {
                 $to = $user->getEmail();
开发者ID:Keshaun1222,项目名称:IRIN,代码行数:31,代码来源:documents.php

示例9: function

<?php

Route::get('documents/create', function () {
    if (!($user = Auth::user())) {
        return array('error' => 'You must be logged in to create a document.');
    }
    $input = Input::all();
    $rules = array('snippet_id' => 'required|exists:snippets,id', 'title' => 'required|max:255', 'syntax' => 'alpha', 'data' => 'required');
    $validated = Validator::make($input, $rules);
    if ($validated->fails()) {
        return array('error' => $validated->errors);
    }
    $snippet = Snippet::get($input['snippet_id']);
    if (isset($snippet->documents[$input['title']])) {
        return array('error' => array('title' => 'This snippet already has a document of that name'));
    }
    if (!isset($input['syntax'])) {
        $input['syntax'] = substr($input['title'], strpos($input['title'], '.') + 1);
    }
    if ($id = Document::create($input['snippet_id'], $input)) {
        return Redirect::to('documents/' . $id);
    }
});
开发者ID:richthegeek,项目名称:Sasshare,代码行数:23,代码来源:create.php

示例10: create

<?php

abstract class DomainObject
{
    public static function create()
    {
        return new static();
    }
}
class User extends DomainObject
{
}
class Document extends DomainObject
{
}
print_r(Document::create());
开发者ID:jabouzi,项目名称:projet,代码行数:16,代码来源:listing04.12.php

示例11: json_decode

     $document = Document::fromDatabase($_POST['documentID']);
     Snapshot::create($document, json_decode(stripslashes($_POST['documentData']), true), $_POST['timestamp']);
     break;
 case 'loadSnapshot':
     $document = Document::fromDatabase($_POST['documentID']);
     echo json_encode(Snapshot::getData($document, $_POST['snapshotID']));
     break;
 case 'deleteDocument':
     $document = Document::fromDatabase($_POST['id']);
     $document->delete();
     break;
 case 'loadDocuments':
     echo json_encode(Document::getList(Document::FORMAT_JSON));
     break;
 case 'createDocument':
     $document = Document::create($_POST['name']);
     echo $document->getId();
     break;
 case 'renameDocument':
     $document = Document::fromDatabase($_POST['id']);
     $document->rename($_POST['newname']);
     break;
 case 'copyDocument':
     $document = Document::fromDatabase($_POST['id']);
     $newdoc = $document->copy($_POST['copyname']);
     echo json_encode($newdoc->toJSON());
     break;
 case 'exportDocument':
     $document = Document::fromDatabase($_POST['id']);
     header("Content-Type: text/plain");
     header("Content-Disposition: attachment; filename=\"" . $document->getName() . ".vonline\"");
开发者ID:roadlabs,项目名称:diagraph,代码行数:31,代码来源:index.php

示例12: create

<?php

abstract class DomainObject
{
}
class User extends DomainObject
{
    public static function create()
    {
        return new User();
    }
}
class Document extends DomainObject
{
    public static function create()
    {
        return new Document();
    }
}
$document = Document::create();
print_r($document);
开发者ID:jabouzi,项目名称:projet,代码行数:21,代码来源:listing04.10.php

示例13: User

 function ajax_add($project_id = null)
 {
     $this->Email->from = "contact@javan.web.id";
     $this->set("current", "assign");
     $this->set('closeModalbox', false);
     if (!empty($this->data)) {
         $this->Task->create();
         $this->data['Task']['creator_id'] = $this->currentUser['id'];
         if ($this->Task->save($this->data)) {
             $user = new User();
             $user->recursive = 0;
             $assigned = $user->findById($this->data['Task']['user_id']);
             $this->Email->from = "contact@javan.web.id";
             $this->Email->to = $assigned['User']['email'];
             $this->Email->subject = "JAVAN : You are Assigned a Task";
             $this->Email->send("You are assigned task {$this->data['Task']['name']} : {$this->data['Task']['description']}. Please login to for more information http://internal.javan.web.id/");
             $this->Session->setFlash(__('The Task has been saved', true));
             if (!$this->RequestHandler->isAjax()) {
                 // redirect back to index page
                 $this->redirect($this->referer());
             }
             if (isset($this->data['files'])) {
                 mkdir(WWW_ROOT . 'files/tasks/' . $this->Task->id);
                 $doc = new Document();
                 foreach ($this->data['files'] as $file) {
                     $doc->create();
                     $path = WWW_ROOT . 'files/tasks/' . $this->Task->id . '/' . $file;
                     rename(WWW_ROOT . 'files/tmp/' . $file, $path);
                     $d['Document']['task_id'] = $this->Task->id;
                     $d['Document']['filename'] = $file;
                     $d['Document']['fullpath'] = $path;
                     $doc->save($d);
                 }
             }
             // else
             $this->set('closeModalbox', true);
         } else {
             $this->Session->setFlash(__('The Task could not be saved. Please, try again.', true));
         }
     }
     if ($project_id) {
         $this->Task->Project->recursive = 0;
         $project = $this->Task->Project->read(null, $project_id);
         $this->set("project", $project);
         $this->set("project_id", $project_id);
     }
     $users = $this->Task->User->find('list', array('conditions' => array('User.id !=' => $this->currentUser['id'])));
     $projects = $this->Task->Project->find('list');
     $this->set(compact('users', 'projects'));
 }
开发者ID:javan-it-services,项目名称:internal,代码行数:50,代码来源:tasks_controller.php

示例14: create

<?php

abstract class DomainObject
{
    public static function create()
    {
        return new self();
    }
}
class User extends DomainObject
{
}
class Document extends DomainObject
{
}
Document::create();
开发者ID:jabouzi,项目名称:projet,代码行数:16,代码来源:listing04.11.php

示例15: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['from'])) {
         $this->from = User::create($attributes['from']);
     }
     if (isset($attributes['chat'])) {
         $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']);
     }
     if (isset($attributes['forward_from'])) {
         $this->forward_from = User::create($attributes['forward_from']);
     }
     if (isset($attributes['forward_from_chat'])) {
         $this->forward_from_chat = Chat::create($attributes['forward_from_chat']);
     }
     if (isset($attributes['reply_to_message'])) {
         $this->reply_to_message = Message::create($attributes['reply_to_message']);
     }
     if (isset($attributes['entities'])) {
         $this->entities = array_map(function ($entity) {
             return MessageEntity::create($entity);
         }, $attributes['entities']);
     }
     if (isset($attributes['audio'])) {
         $this->audio = Audio::create($attributes['audio']);
     }
     if (isset($attributes['document'])) {
         $this->document = Document::create($attributes['document']);
     }
     if (isset($attributes['photo'])) {
         $this->photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['photo']);
     }
     if (isset($attributes['sticker'])) {
         $this->sticker = Sticker::create($attributes['sticker']);
     }
     if (isset($attributes['video'])) {
         $this->video = Video::create($attributes['video']);
     }
     if (isset($attributes['voice'])) {
         $this->voice = Voice::create($attributes['voice']);
     }
     if (isset($attributes['contact'])) {
         $this->contact = Contact::create($attributes['contact']);
     }
     if (isset($attributes['location'])) {
         $this->location = Location::create($attributes['location']);
     }
     if (isset($attributes['venue'])) {
         $this->venue = Venue::create($attributes['venue']);
     }
     if (isset($attributes['new_chat_member'])) {
         $this->new_chat_member = User::create($attributes['new_chat_member']);
     }
     if (isset($attributes['left_chat_member'])) {
         $this->left_chat_member = new User($attributes['left_chat_member']);
     }
     if (isset($attributes['new_chat_photo'])) {
         $this->new_chat_photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['new_chat_photo']);
     }
 }
开发者ID:zelenin,项目名称:telegram-bot-api,代码行数:67,代码来源:Message.php


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