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


PHP Cabinet::moveToForm方法代码示例

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


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

示例1: edit

 public function edit()
 {
     static $folder;
     if (empty($this->multimedia)) {
         $this->loadMultimedia();
     }
     if (empty($folder)) {
         $folder = new Folder($this->multimedia->folder_id);
     }
     PHPWS_Core::initCoreClass('File.php');
     $form = new PHPWS_FORM();
     $form->setFormId('file-form');
     $form->addHidden('module', 'filecabinet');
     $form->addHidden('mop', 'post_multimedia_upload');
     $form->addHidden('ms', $this->max_size);
     $form->addHidden('folder_id', $this->multimedia->folder_id);
     $form->addFile('file_name');
     $form->setLabel('file_name', dgettext('filecabinet', 'Multimedia location'));
     $form->addText('title', $this->multimedia->title);
     $form->setLabel('title', dgettext('filecabinet', 'Title'));
     $form->setClass('title', 'form-control');
     $form->addTextArea('description', $this->multimedia->description);
     $form->setLabel('description', dgettext('filecabinet', 'Description'));
     $form->setClass('description', 'form-control');
     if ($this->multimedia->id) {
         $this->title = 'Edit multimedia';
         $form->addHidden('multimedia_id', $this->multimedia->id);
         $form->addText('width', $this->multimedia->width);
         $form->setLabel('width', dgettext('filecabinet', 'Width'));
         $form->addText('height', $this->multimedia->height);
         $form->setLabel('height', dgettext('filecabinet', 'Height'));
     } else {
         $this->title = 'Upload multimedia';
     }
     if ($this->multimedia->id && Current_User::allow('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder', true)) {
         Cabinet::moveToForm($form, $folder);
     }
     $template = $form->getTemplate();
     if ($this->multimedia->id) {
         $template['CURRENT_MULTIMEDIA_LABEL'] = dgettext('filecabinet', 'Current multimedia');
         $template['CURRENT_MULTIMEDIA_ICON'] = $this->multimedia->getThumbnail();
         $template['CURRENT_MULTIMEDIA_FILE'] = $this->multimedia->file_name;
         $ow['address'] = PHPWS_Text::linkAddress('filecabinet', array('aop' => 'change_tn', 'type' => 'mm', 'id' => $this->multimedia->id), true);
         $ow['label'] = 'Change thumbnail';
         $ow['width'] = 400;
         $ow['height'] = 250;
         $template['EDIT_THUMBNAIL'] = javascript('open_window', $ow);
     }
     $template['MAX_SIZE_LABEL'] = dgettext('filecabinet', 'Maximum file size');
     $size_max = Cabinet::getMaxSizes();
     $sys_size =& $size_max['system'];
     $form_max =& $size_max['form'];
     if ($form_max < $sys_size && $form_max < $this->max_size) {
         $max_size =& $form_max;
     } elseif ($sys_size < $form_max && $sys_size < $this->max_size) {
         $max_size =& $sys_size;
     } else {
         $max_size =& $this->max_size;
     }
     if ($max_size >= 1000000) {
         $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%dMB (%d bytes)'), floor($max_size / 1000000), $max_size);
     } elseif ($max_size >= 1000) {
         $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%dKB (%d bytes)'), floor($max_size / 1000), $max_size);
     } else {
         $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%d bytes'), $max_size);
     }
     if ($this->message) {
         $template['ERROR'] = $this->message;
     }
     $this->content = PHPWS_Template::process($template, 'filecabinet', 'Forms/multimedia_edit.tpl');
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:71,代码来源:Multimedia_Manager.php

示例2: edit

 /**
  * Upload image form
  */
 public function edit($force_width = 0, $force_height = 0)
 {
     $form = new PHPWS_Form();
     $form->setFormId('file-form');
     $form->addHidden('module', 'filecabinet');
     $form->addHidden('iop', 'post_image_upload');
     $form->addHidden('ms', $this->max_size);
     $form->addHidden('mh', $this->max_height);
     $form->addHidden('mw', $this->max_width);
     $form->addHidden('folder_id', $this->folder->id);
     if ($this->image->id && Current_User::allow('filecabinet', 'edit_folders', $this->folder->id, 'folder', true)) {
         Cabinet::moveToForm($form, $this->folder);
     }
     // if 'im' is set, then we are inside the image manage interface
     // the post needs to be aware of that to respond correctly
     if (isset($_GET['im'])) {
         $form->addHidden('im', 1);
     }
     if ($this->image->id) {
         $form->addHidden('image_id', $this->image->id);
         $this->title = dgettext('filecabinet', 'Update image');
     } else {
         $this->title = dgettext('filecabinet', 'Upload image');
     }
     $form->addFile('file_name');
     $form->setClass('file_name', 'form-control');
     $form->setSize('file_name', 30);
     $form->setMaxFileSize($this->max_size);
     $form->setLabel('file_name', dgettext('filecabinet', 'Image location'));
     $form->addText('title', $this->image->title);
     $form->setLabel('title', dgettext('filecabinet', 'Title'));
     $form->setClass('title', 'form-control');
     $form->addTextArea('description', $this->image->description);
     $form->setRows('description', 8);
     $form->setCols('description', 45);
     $form->setLabel('description', dgettext('filecabinet', 'Description'));
     if ($this->image->folder_id) {
         $folder = new Folder($this->image->folder_id);
         if ($folder->public_folder) {
             $link_choice['folder'] = dgettext('filecabinet', 'Link to image folder');
         }
     }
     if ($this->folder->max_image_dimension && $this->folder->max_image_dimension < $this->max_width) {
         $max_width = $this->folder->max_image_dimension;
     } else {
         $max_width = $this->max_width;
     }
     if ($force_width && $force_height) {
         $form->addHidden('fw', $force_width);
         $form->addHidden('fh', $force_height);
         $form->addTplTag('RESIZE_LABEL', dgettext('filecabinet', 'Images resized to:'));
         $form->addTplTag('RESIZE', sprintf('%s x %spx', $force_width, $force_height));
     } elseif (!$this->image->id) {
         $resizes = Cabinet::getResizes($max_width);
         if (!empty($resizes)) {
             $form->addSelect('resize', $resizes);
             $form->setLabel('resize', dgettext('filecabinet', 'Resize image if over'));
         }
     }
     switch (1) {
         case empty($this->image->url):
             $form->setMatch('link', 'none');
             $form->addTplTag('VISIBLE', 'none');
             $form->setValue('url', 'http://');
             break;
         case $this->image->url == 'parent':
             $form->setMatch('link', 'parent');
             $form->addTplTag('VISIBLE', 'none');
             break;
         case $this->image->url == 'folder':
             $form->setMatch('link', 'folder');
             $form->addTplTag('VISIBLE', 'none');
             break;
         default:
             $form->setMatch('link', 'url');
             $form->setValue('url', $this->image->url);
             $form->addTplTag('VISIBLE', 'table-row');
             break;
     }
     if (!empty($this->image->id)) {
         $form->addSubmit('submit', dgettext('filecabinet', 'Update'));
     } else {
         $form->addSubmit('submit', dgettext('filecabinet', 'Upload'));
     }
     $form->setClass('submit', 'btn btn-primary');
     $template = $form->getTemplate();
     $template['CANCEL'] = sprintf('<input type="button" value="%s" onclick="javascript:window.close()" />', dgettext('filecabinet', 'Cancel'));
     if ($this->image->id) {
         $template['CURRENT_IMAGE_LABEL'] = dgettext('filecabinet', 'Current image');
         $template['CURRENT_IMAGE'] = $this->image->getJSView(TRUE);
         $template['SIZE'] = sprintf('%s x %s', $this->image->width, $this->image->height);
     }
     $template['MAX_SIZE_LABEL'] = dgettext('filecabinet', 'Maximum file size');
     $template['MAX_DIMENSION_LABEL'] = dgettext('filecabinet', 'Maximum image dimension');
     $template['MAX_DIMENSION'] = $this->max_width;
     $sys_size = str_replace('M', '', ini_get('upload_max_filesize'));
     $sys_size = $sys_size * 1000000;
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Image_Manager.php

示例3: edit

 /**
  * @Override FC_Document_Manager::edit()
  *
  * This is a copy and paste of the overridden function
  * except that the module for the form is set to intern.
  * Also, check if the folder has been set. If not create
  * one for the user and load it.
  */
 public function edit()
 {
     if (empty($this->document)) {
         $this->loadDocument();
     }
     // If the folder ID is zero then it was not found
     // when InternFolder::documentUpload() was called.
     // Create one and load it.
     if ($this->folder->id == 0) {
         \PHPWS_Core::requireInc('filecabinet', 'defines.php');
         $folder = new InternFolder();
         $folder->module_created = 'intern';
         $folder->title = 'intern documents';
         $folder->public_folder = FALSE;
         $folder->ftype = DOCUMENT_FOLDER;
         $folder->loadDirectory();
         $folder->save();
         $this->folder = $folder;
     }
     \PHPWS_Core::initCoreClass('File.php');
     $form = new \PHPWS_FORM();
     $form->addHidden('module', 'intern');
     $form->addHidden('internship', $_REQUEST['internship']);
     $form->addHidden('action', 'post_document_upload');
     $form->addHidden('ms', $this->max_size);
     $form->addHidden('folder_id', $this->folder->id);
     $form->addFile('file_name');
     $form->setSize('file_name', 30);
     $form->setLabel('file_name', dgettext('filecabinet', 'Document location'));
     $form->addText('title', $this->document->title);
     $form->setSize('title', 40);
     $form->setLabel('title', dgettext('filecabinet', 'Title'));
     $form->addTextArea('description', $this->document->description);
     $form->setLabel('description', dgettext('filecabinet', 'Description'));
     if ($this->document->id) {
         $form->addTplTag('FORM_TITLE', dgettext('filecabinet', 'Update file'));
         $form->addHidden('document_id', $this->document->id);
         $form->addSubmit('submit', dgettext('filecabinet', 'Update'));
     } else {
         $form->addTplTag('FORM_TITLE', dgettext('filecabinet', 'Upload new file'));
         $form->addSubmit('upload', dgettext('filecabinet', 'Upload'));
     }
     $form->addButton('cancel', dgettext('filecabinet', 'Cancel'));
     $form->setExtra('cancel', 'onclick="window.close()"');
     $form->setExtra('upload', 'onclick="this.style.display=\'none\'"');
     if ($this->document->id && Current_User::allow('filecabinet', 'edit_folders', $this->folder->id, 'folder', true)) {
         Cabinet::moveToForm($form, $this->folder);
     }
     $template = $form->getTemplate();
     if ($this->document->id) {
         $template['CURRENT_DOCUMENT_LABEL'] = dgettext('filecabinet', 'Current document');
         $template['CURRENT_DOCUMENT_ICON'] = $this->document->getIconView();
         $template['CURRENT_DOCUMENT_FILE'] = $this->document->file_name;
     }
     $template['MAX_SIZE_LABEL'] = dgettext('filecabinet', 'Maximum file size');
     $sys_size = str_replace('M', '', ini_get('upload_max_filesize'));
     $sys_size = $sys_size * 1000000;
     if ((int) $sys_size < (int) $this->max_size) {
         $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%d bytes (system wide)'), $sys_size);
     } else {
         $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%d bytes'), $this->max_size);
     }
     if ($this->document->_errors) {
         $template['ERROR'] = $this->document->printErrors();
     }
     return \PHPWS_Template::process($template, 'filecabinet', 'Forms/document_edit.tpl');
     //        Layout::add(PHPWS_Template::process($template, 'filecabinet', 'document_edit.tpl'));
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:76,代码来源:DocumentManager.php

示例4: edit

 public function edit()
 {
     if (empty($this->document)) {
         $this->loadDocument();
     }
     PHPWS_Core::initCoreClass('File.php');
     $form = new PHPWS_FORM();
     $form->setFormId('file-form');
     $form->addHidden('module', 'filecabinet');
     $form->addHidden('dop', 'post_document_upload');
     $form->addHidden('ms', $this->max_size);
     $form->addHidden('folder_id', $this->folder->id);
     $form->addFile('file_name');
     $form->setLabel('file_name', dgettext('filecabinet', 'Document location'));
     $form->addText('title', $this->document->title);
     $form->setLabel('title', dgettext('filecabinet', 'Title'));
     $form->setClass('title', 'form-control');
     $form->addSubmit('upload', 'Upload document');
     $form->setClass('upload', 'btn btn-primary');
     if ($this->document->id) {
         $this->title = dgettext('filecabinet', 'Update file');
         $form->addHidden('document_id', $this->document->id);
     } else {
         $this->title = dgettext('filecabinet', 'Upload new file');
     }
     if ($this->document->id && Current_User::allow('filecabinet', 'edit_folders', $this->folder->id, 'folder', true)) {
         Cabinet::moveToForm($form, $this->folder);
     }
     $template = $form->getTemplate();
     if ($this->document->id) {
         $template['CURRENT_DOCUMENT_LABEL'] = dgettext('filecabinet', 'Current document');
         $template['CURRENT_DOCUMENT_ICON'] = $this->document->getIconView();
         $template['CURRENT_DOCUMENT_FILE'] = $this->document->file_name;
     }
     $template['MAX_SIZE_LABEL'] = dgettext('filecabinet', 'Maximum file size');
     $sys_size = str_replace('M', '', ini_get('upload_max_filesize'));
     $sys_size = $sys_size * 1000000;
     if ((int) $sys_size < (int) $this->max_size) {
         $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%d bytes (system wide)'), $sys_size);
     } else {
         $template['MAX_SIZE'] = sprintf(dgettext('filecabinet', '%d bytes'), $this->max_size);
     }
     $this->content = PHPWS_Template::process($template, 'filecabinet', 'Forms/document_edit.tpl');
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:44,代码来源:Document_Manager.php


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