/** * Similar to Folder::uploadLink except this one takes a internship id as parameter * and links to intern module instead of filecabinet. */ public function documentUpload($internshipId) { $link_var['folder_id'] = $this->id; $link_var['action'] = 'upload_document_form'; $link_var['internship'] = $internshipId; $link = new PHPWS_Link(null, 'intern', $link_var, true); $link->convertAmp(false); $link->setSalted(); $vars['address'] = $link->getAddress(); $label = dgettext('filecabinet', 'Add document'); javascript('open_window'); return '<button type="button" class="btn btn-default btn-sm" onClick="javascript:open_window(\'' . $link->getAddress() . '\', 600, 600, \'default970975506\', 1); return false;"><i class="fa fa-upload"></i> ' . $label . '</button>'; }
public function editAddress($fid = null) { $add_vars = $this->linkInfo(); $add_vars['fop'] = 'open_file_manager'; if (isset($fid)) { $add_vars['fid'] = $fid; } $link = new PHPWS_Link(null, 'filecabinet', $add_vars, true); $link->convertAmp(false); $link->setSalted(); return $link->getAddress(); }
/** * @deprecated * @param type $icon * @return type */ public function editLink($icon = false) { $vars['mop'] = 'upload_multimedia_form'; $vars['multimedia_id'] = $this->id; $vars['folder_id'] = $this->folder_id; $jsvars['width'] = 550; $jsvars['height'] = 620; $link = new PHPWS_Link(null, 'filecabinet', $vars); $link->setSecure(); $link->setSalted(); $jsvars['address'] = $link->getAddress(); $jsvars['window_name'] = 'edit_link'; if ($icon) { $jsvars['label'] = Icon::show('edit', dgettext('filecabinet', 'Edit multimedia file')); } else { $jsvars['label'] = dgettext('filecabinet', 'Edit'); } return javascript('open_window', $jsvars); }
/** * @deprecated * @param type $icon * @return type */ public function editLink($icon = false) { $vars['iop'] = 'upload_image_form'; $vars['image_id'] = $this->id; $vars['folder_id'] = $this->folder_id; $jsvars['width'] = 550; $jsvars['height'] = 600 + PHPWS_Settings::get('filecabinet', 'max_thumbnail_size'); $link = new PHPWS_Link(null, 'filecabinet', $vars); $link->setSecure(); $link->setSalted(); $jsvars['address'] = $link->getAddress(); $jsvars['window_name'] = 'edit_link'; if ($icon) { $jsvars['label'] = Icon::show('edit'); } else { $jsvars['label'] = dgettext('filecabinet', 'Edit'); } return javascript('open_window', $jsvars); }
/** * @deprecated */ private function addLink($type, $mode = null, $force_width = 0, $force_height = 0, $id = 0) { $vars['width'] = 400; $vars['height'] = 400; $link_var['folder_id'] = $this->id; if ($id) { $link_var['file_id'] = $id; } switch ($type) { case 'image': $link_var['iop'] = 'upload_image_form'; $link_var['fw'] = $force_width; $link_var['fh'] = $force_height; $label = dgettext('filecabinet', 'Add image'); break; case 'document': $link_var['dop'] = 'upload_document_form'; $label = dgettext('filecabinet', 'Add document'); break; case 'media': $link_var['mop'] = 'upload_multimedia_form'; $label = dgettext('filecabinet', 'Add media'); break; } $link = new PHPWS_Link(null, 'filecabinet', $link_var, true); $link->convertAmp(false); $link->setSalted(); $vars['address'] = $link->getAddress(); $vars['title'] =& $label; switch ($mode) { case 'button': $vars['label'] = $label; $vars['type'] = 'button'; $vars['class'] = 'btn btn-success'; break; case 'icon': $vars['label'] = '<i class="fa fa-upload" title="' . dgettext('filecabient', 'Upload') . '"></i>'; break; default: $vars['label'] = $label; } return javascript('open_window', $vars); }
public function getUserTpl() { // Don't let a deity change their deity status // Don't let non-deities change status if (Current_User::isDeity() && !Current_User::isUser($this->id)) { if ($this->isDeity()) { $dvars['QUESTION'] = dgettext('users', 'Are you sure you want to remove deity status?'); $dvars['ADDRESS'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'mortalize_user', 'user_id' => $this->id), 1); $dvars['LINK'] = sprintf('<i class="fa fa-cloud" title="%s"></i>', dgettext('users', 'Deity')); $links[] = javascript('confirm', $dvars); } else { $dvars['QUESTION'] = dgettext('users', 'Are you sure you want to deify this user?'); $dvars['ADDRESS'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'deify_user', 'user_id' => $this->id), 1); $dvars['LINK'] = sprintf('<i class="fa fa-male" title="%s"></i>', dgettext('users', 'Mortal')); $links[] = javascript('confirm', $dvars); } } $linkVar['action'] = 'admin'; $linkVar['user_id'] = $this->id; if ($this->isActive()) { if (!$this->deity) { $linkVar['command'] = 'deactivateUser'; $template['ACTIVE'] = PHPWS_Text::secureLink(dgettext('users', 'Yes'), 'users', $linkVar, null, dgettext('users', 'Deactivate this user')); } else { $template['ACTIVE'] = dgettext('users', 'Yes'); } } else { if (!$this->deity) { $linkVar['command'] = 'activateUser'; $template['ACTIVE'] = PHPWS_Text::secureLink(dgettext('users', 'No'), 'users', $linkVar, null, dgettext('users', 'Activate this user')); } else { $template['ACTIVE'] = dgettext('users', 'No'); } } $logged = $this->getLastLogged('%Y/%m/%d %H:%M'); if (empty($logged)) { $template['LAST_LOGGED'] = dgettext('users', 'Never'); } else { $template['LAST_LOGGED'] = $logged; } $template['EMAIL'] = $this->getEmail(true, true); $jsvar['QUESTION'] = sprintf(dgettext('users', 'Are you certain you want to delete the user "%s" permanently?'), $this->getUsername()); $link = new PHPWS_Link(null, 'users', array('action' => 'admin', 'command' => 'deleteUser', 'user_id' => $this->id), true); $link->setSalted(); $jsvar['ADDRESS'] = $link->getAddress(); $jsvar['LINK'] = '<i class="fa fa-trash-o" title="' . dgettext('users', 'Delete user') . '"></i>'; $linkVar['command'] = 'editUser'; $links[] = PHPWS_Text::secureLink('<i class="fa fa-edit"></i>', 'users', $linkVar); $linkVar['command'] = 'setUserPermissions'; $links[] = PHPWS_Text::secureLink('<i class="fa fa-key" title="' . dgettext('users', 'Permissions') . '"></i>', 'users', $linkVar); if (!$this->isDeity() && $this->id != Current_User::getId()) { $links[] = Layout::getJavascript('confirm', $jsvar); } $template['ACTIONS'] = implode(' ', $links); if ($this->deity && !Current_User::isDeity()) { unset($template['ACTIONS']); } return $template; }
/** * @deprecated * @param type $icon * @return type */ public function editLink($icon = false) { $vars['document_id'] = $this->id; $vars['folder_id'] = $this->folder_id; $vars['dop'] = 'upload_document_form'; $link = new PHPWS_Link(null, 'filecabinet', $vars, true); $link->setSalted(1); $js['address'] = $link->getAddress(); $js['width'] = 550; $js['height'] = 500; if ($icon) { $js['label'] = Icon::show('edit', dgettext('filecabinet', 'Edit document')); } else { $js['label'] = dgettext('filecabinet', 'Edit'); } return javascript('open_window', $js); }