public function blockReport($report_id) { \PHPWS_Core::initModClass('properties', 'Message.php'); \PHPWS_Core::initModClass('properties', 'Report.php'); $report = new Report($report_id); $message = new Message($report->message_id); $user = new \PHPWS_User($message->from_user_id); $this->title = 'Block user:'******'module', 'properties'); $form->addHidden('aop', 'block_post'); $form->addHidden('report_id', $report->id); $form->addHidden('message_id', $message->id); $form->addTextarea('block_reason'); $form->addSubmit('Block user'); $tpl = $form->getTemplate(); $this->content = \PHPWS_Template::process($tpl, 'properties', 'block.tpl'); }
public function getForm($name = null) { javascript('datepicker'); \Layout::addStyle('properties', 'forms.css'); $form = new \PHPWS_Form($name); $form->addHidden('module', 'properties'); $form->addCheck('appalcart', 1); $form->setLabel('appalcart', 'On Appalcart route'); $form->setMatch('appalcart', $this->appalcart); $form->addSelect('campus_distance', array(0 => '0 to 5', 5 => '5 to 10', 10 => '10 to 25', 25 => 'More than 25')); $form->setLabel('campus_distance', 'Miles from campus'); $form->setMatch('campus_distance', $this->campus_distance); $form->addCheck('clubhouse', 1); $form->setLabel('clubhouse', 'Clubhouse'); $form->setMatch('clubhouse', $this->clubhouse); \PHPWS_Core::initModClass('properties', 'User.php'); $contracts = User::getContracts(); $form->addSelect('contract_length', $contracts); $form->setLabel('contract_length', 'Contract length'); $form->setMatch('contract_length', $this->contract_length); $form->addTextarea('description', $this->description); $form->setLabel('description', 'Other property information'); $form->addCheck('airconditioning', 1); $form->setLabel('airconditioning', 'Air Conditioning'); $form->setMatch('airconditioning', $this->airconditioning); $form->addCheck('dishwasher', 1); $form->setLabel('dishwasher', 'Dishwasher'); $form->setMatch('dishwasher', $this->dishwasher); $itypes[NET_DIALUP] = 'Dial Up'; $itypes[NET_CABLE] = 'Cable'; $itypes[NET_DSL] = 'DSL'; $itypes[NET_WIRELESS] = 'Wireless'; $itypes[NET_SATELLITE] = 'Satellite'; $itypes[NET_FIBER] = 'Fiber'; $itypes[NET_BOTH] = 'DSL/Cable'; $form->addSelect('internet_type', $itypes); $form->setLabel('internet_type', 'Internet'); $form->setMatch('internet_type', $this->internet_type); $form->addSelect('laundry_type', array(LAUNDRY_NONE => 'No laundry', LAUNDRY_ON_PREMISES => 'Laundry room on premises', LAUNDRY_HOOKUP => 'Washer/Dryer hook ups in unit', LAUNDRY_IN_UNIT => 'Washer/Dryer in unit')); $form->setLabel('laundry_type', 'Laundry'); $form->setMatch('laundry_type', $this->laundry_type); $form->addText('monthly_rent', $this->getMonthlyRent()); $form->setLabel('monthly_rent', 'Monthly rent'); $form->setSize('monthly_rent', 8, 8); $form->setRequired('monthly_rent'); $form->addText('move_in_date', $this->getMoveInDate()); $form->setLabel('move_in_date', 'Move-in date'); $form->setExtra('move_in_date', 'class="datepicker"'); $form->addText('name', $this->name); $form->setLabel('name', 'Name of property'); $form->setRequired('name'); $form->setSize('name', 50); $form->addCheck('pets_allowed', 1); $form->setLabel('pets_allowed', 'Pets allowed'); $form->setMatch('pets_allowed', $this->pets_allowed); $form->addCheck('sublease', 1); $form->setMatch('sublease', $this->sublease); $form->setLabel('sublease', 'Sublease'); $toptions[TV_NONE] = 'Antenna'; $toptions[TV_CABLE] = 'Cable'; $toptions[TV_SATELLITE] = 'Satellite'; $toptions[TV_FIBER] = 'Fiber'; $form->addSelect('tv_type', $toptions); $form->setLabel('tv_type', 'Television'); $form->setMatch('tv_type', $this->tv_type); $form->addSelect('trash_type', array(TRASH_ON_YOUR_OWN => 'Trash and recycling receptacles not provided', TRASH_ON_PREMISES_NO_RECYCLE => 'Trash receptacles on site. Recycling not provided', TRASH_ON_PREMISES_WITH_RECYCLE => 'Trash and recycling receptacles provided on site', TRASH_PICKUP => 'Curbside pickup for trash and recycling')); $form->setMatch('trash_type', $this->trash_type); $form->setLabel('trash_type', 'Trash removal'); $form->addCheck('workout_room', 1); $form->setMatch('workout_room', $this->workout_room); $form->setLabel('workout_room', 'Workout room'); return $form; }
public function classifyFile($files) { $tpl = null; $this->cabinet->title = dgettext('filecabinet', 'Classify Files'); $classify_dir = $this->cabinet->getClassifyDir(); if (empty($classify_dir) || !is_dir($classify_dir)) { $this->cabinet->content = dgettext('filecabinet', 'Unable to locate the classify directory. Please check your File Cabinet settings, configuration file and directory permissions.'); return; } if (!is_array($files)) { $files = array($files); } // image folders $image_folders = Cabinet::listFolders(IMAGE_FOLDER, true); // document folders $document_folders = Cabinet::listFolders(DOCUMENT_FOLDER, true); // multimedia folders $multimedia_folders = Cabinet::listFolders(MULTIMEDIA_FOLDER, true); $count = 0; $image_types = $this->cabinet->getAllowedTypes('image'); $document_types = $this->cabinet->getAllowedTypes('document'); $media_types = $this->cabinet->getAllowedTypes('media'); foreach ($files as $file) { if (!is_file($classify_dir . $file) || !PHPWS_File::checkMimeType($classify_dir . $file) || !$this->cabinet->fileTypeAllowed($file)) { continue; } $form = new PHPWS_Form('file_form_' . $count); $ext = PHPWS_File::getFileExtension($file); if (in_array($ext, $image_types)) { $folders =& $image_folders; } elseif (in_array($ext, $media_types)) { $folders =& $multimedia_folders; } elseif (in_array($ext, $document_types)) { $folders =& $document_folders; } else { continue; } $form->addSelect("folder[{$count}]", $folders); $form->setTag("folder[{$count}]", 'folder'); $form->setLabel("folder[{$count}]", dgettext('filecabinet', 'Folder')); $form->addText("file_title[{$count}]", $file); $form->setLabel("file_title[{$count}]", dgettext('filecabinet', 'Title')); $form->setTag("file_title[{$count}]", 'file_title'); $form->setSize("file_title[{$count}]", 40); $form->addTextarea("file_description[{$count}]"); $form->setLabel("file_description[{$count}]", dgettext('filecabinet', 'Description')); $form->setTag("file_description[{$count}]", 'file_description'); $form->addSubmit('submit', dgettext('filecabinet', 'Classify files')); $subtpl = $form->getTemplate(); $subtpl['HIDDEN'] = sprintf('<input type="hidden" name="file_count[%s]" value="%s" />', $count, $file); $subtpl['FILE_NAME'] = $file; $subtpl['FILE_NAME_LABEL'] = dgettext('filecabinet', 'File name'); unset($subtpl['START_FORM']); unset($subtpl['END_FORM']); $tpl['files'][] = $subtpl; $count++; } $form = new PHPWS_Form('classify_files'); $form->addHidden('module', 'filecabinet'); $form->addHidden('aop', 'post_classifications'); if (!empty($tpl)) { $form_template = $form->getTemplate(true, true, $tpl); $this->cabinet->content = PHPWS_Template::process($form_template, 'filecabinet', 'Forms/classify_file.tpl'); } else { $this->cabinet->content = dgettext('filecabinet', 'Unable to classify files.'); } }
public function show_edit_email($error = null, $subject = null, $body = null) { $tpl = array(); if (!is_null($error)) { $tpl['ERROR'] = $error; } $tpl['HEADER'] = 'Email'; $form = new PHPWS_Form('email_content'); if (Current_User::allow('hms', 'anonymous_notifications')) { $form->addCheck('anonymous'); $form->setMatch('anonymous', isset($_REQUEST['anonymous']) ? true : false); $form->setLabel('anonymous', 'Send Anonymously: '); } $form->addText('subject', !is_null($subject) ? $subject : ''); $form->setLabel('subject', 'Subject:'); $form->setSize('subject', 35); $form->addTextarea('body', !is_null($body) ? $body : ''); $form->setLabel('body', 'Message:'); $form->addHidden('type', 'notification'); $form->addHidden('op', 'review'); if (isset($_REQUEST['hall'])) { $form->addHidden('hall', $_REQUEST['hall']); } $form->addSubmit('Submit'); $tpl['EMAIL'] = preg_replace('/<br \\/>/', '', implode('<br />', $form->getTemplate()), 2); return PHPWS_Template::process($tpl, 'hms', 'admin/hall_notification_email_page.tpl'); }