/** * Gets a list of the actions that can be performed. * * @return JObject * * @since 1.6 * @todo Refactor to work with notes */ public static function getActions() { if (empty(self::$actions)) { $user = JFactory::getUser(); self::$actions = new JObject(); $actions = JAccess::getActions('com_openhrm'); foreach ($actions as $action) { self::$actions->set($action->name, $user->authorise($action->name, 'com_openhrm')); } } return self::$actions; }
public function files() { $json = array(); $input = JFactory::getApplication()->input; $directory = $input->post('directory', '', 'STRING'); if (isset($directory)) { $directory = DIR_IMAGE . str_replace('../', '', $directory); } else { $directory = DIR_IMAGE; } $allowed = array('.jpg', '.jpeg', '.png', '.gif'); $files = glob(rtrim($directory, '/') . '/*'); if ($files) { foreach ($files as $file) { if (is_file($file)) { $ext = strrchr($file, '.'); } else { $ext = ''; } if (in_array(strtolower($ext), $allowed)) { $size = filesize($file); $i = 0; $suffix = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); while ($size / 1024 > 1) { $size = $size / 1024; $i++; } $fileData = utf8_substr($file, strlen(DIR_IMAGE) + 1); $filename = basename($file); $size = round(utf8_substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i]; $thumb = OpenHrmHelpersOpenhrm::resize($file, 100, 100); $json[] = array('file' => $fileData, 'filename' => $filename, 'size' => $size, 'thumb' => $thumb); } } } return json_encode($json); }
JHtml::_('script', 'openhrm/assets/jquery/ajaxupload.js', false, true, false, false); $button_folder = JText::_('Thư mục mới'); $button_delete = JText::_('Xóa'); $button_move = JText::_('Chuyển'); $button_copy = JText::_('Sao'); $button_rename = JText::_('Sửa tên'); $button_upload = JText::_('Tải lên'); $button_refresh = JText::_('Làm tươi'); $entry_folder = JText::_('entry_folder'); $entry_move = JText::_('entry_move'); $entry_copy = JText::_('entry_copy'); $entry_rename = JText::_('entry_rename'); $button_submit = JText::_('button_submit'); $error_directory = JText::_('error_directory'); $error_select = JText::_('error_select'); $no_image = OpenHrmHelpersOpenhrm::resize(JPATH_ROOT . '/media/openhrm/images/default-photo.png', 100, 100); ?> <style type="text/css"> body { padding: 0; margin: 0; background: #F7F7F7; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; } img { border: 0; } #container { padding: 0px 10px 7px 10px;