public function changeTN() { $form = new PHPWS_Form('thumbnail'); $form->addHidden('module', 'filecabinet'); $form->addHidden('aop', 'post_thumbnail'); $form->addHidden('type', $_REQUEST['type']); $form->addHidden('id', $_REQUEST['id']); $form->addFile('thumbnail'); $form->setLabel('thumbnail', dgettext('filecabinet', 'Upload thumbnail')); $form->addSubmit(dgettext('filecabinet', 'Upload')); if ($_REQUEST['type'] == 'mm') { PHPWS_Core::initModClass('filecabinet', 'Multimedia.php'); $mm = new PHPWS_Multimedia($_REQUEST['id']); if (!$mm->id) { return false; } } $tpl = $form->getTemplate(); $tpl['CLOSE'] = javascript('close_window'); $thumb = PHPWS_Settings::get('filecabinet', 'max_thumbnail_size'); $warnings[] = sprintf(dgettext('filecabinet', 'Max thumbnail size : %sx%s.'), $thumb, $thumb); if ($mm->isVideo()) { $warnings[] = dgettext('filecabinet', 'Image must be a jpeg file.'); } $tpl['WARNINGS'] = implode('<br />', $warnings); $this->title = dgettext('filecabinet', 'Upload new thumbnail'); $this->content = PHPWS_Template::process($tpl, 'filecabinet', 'thumbnail.tpl'); }
/** * Add image form * * @author Greg Meiste <*****@*****.**> */ function add() { $form = new PHPWS_Form(); $form->addHidden('module', 'wiki'); $form->addHidden('op', 'doimageupload'); $form->addFile('filename'); $form->setSize('filename', 50); $form->setLabel('filename', dgettext('wiki', 'Filename')); $form->addText('summary'); $form->setSize('summary', 50, 200); $form->setLabel('summary', dgettext('wiki', 'Summary')); $form->addSubmit('save', dgettext('wiki', 'Upload')); return $form->getTemplate(); }
private function uploadEvent() { $form = new PHPWS_Form('upload-event'); $form->addHidden('module', 'calendar'); $form->addHidden('aop', 'post_upload'); $form->addHidden('js', 1); $form->addHidden('sch_id', $this->calendar->schedule->id); $form->addFile('upload_file'); $form->setLabel('upload_file', dgettext('calendar', 'File location')); $form->addSubmit('go', dgettext('calendar', 'Send file')); $tpl = $form->getTemplate(); $tpl['CLOSE'] = javascript('close_window'); $this->content = PHPWS_Template::process($tpl, 'calendar', 'upload.tpl'); $this->title = dgettext('calendar', 'Import iCal/vCal file'); }
public function form() { $form = new \PHPWS_Form('photo-form'); $form->addHidden('module', 'properties'); if (isset($_SESSION['Contact_User'])) { $form->addHidden('cop', 'post_photo'); $form->addHidden('k', $_SESSION['Contact_User']->getKey()); } else { $form->addHidden('aop', 'post_photo'); } if (isset($_GET['v'])) { $form->addHidden('v', 1); } $form->addHidden('pid', $_GET['pid']); $form->addText('title'); $form->setLabel('title', 'Title'); $form->addFile('photo'); $form->addSubmit('submit', 'Upload photo'); $tpl = $form->getTemplate(); $tpl['WIDTH'] = PROP_THUMBNAIL_WIDTH; $tpl['HEIGHT'] = PROP_THUMBNAIL_HEIGHT; $tpl['AUTH'] = \Current_User::getAuthKey(); $tpl['THUMBNAILS'] = Photo::getThumbs($_GET['pid']); if (isset($_SESSION['Contact_User'])) { $tpl['CMD'] = 'k=' . $_SESSION['Contact_User']->getKey() . '&cop'; } else { $tpl['CMD'] = 'aop'; } return \PHPWS_Template::process($tpl, 'properties', 'photo_form.tpl'); }