AAAAhome/academiac/www/libraries/joomla/html/parameter/element/list.php 0000644 00000004325 15137262466 0021525 0 ustar 00 children() as $option)
{
$val = $option->attributes('value');
$text = $option->data();
$options[] = JHtml::_('select.option', $val, JText::_($text));
}
return $options;
}
/**
* Fetch the HTML code for the parameter element.
*
* @param string $name The field name.
* @param mixed $value The value of the field.
* @param JSimpleXMLElement &$node The current JSimpleXMLElement node.
* @param string $control_name The name of the HTML control.
*
* @return string
*
* @deprecated 12.1
* @since 11.1
*/
public function fetchElement($name, $value, &$node, $control_name)
{
$ctrl = $control_name . '[' . $name . ']';
$attribs = ' ';
if ($v = $node->attributes('size'))
{
$attribs .= 'size="' . $v . '"';
}
if ($v = $node->attributes('class'))
{
$attribs .= 'class="' . $v . '"';
}
else
{
$attribs .= 'class="inputbox"';
}
if ($m = $node->attributes('multiple'))
{
$attribs .= 'multiple="multiple"';
$ctrl .= '[]';
}
return JHtml::_(
'select.genericlist',
$this->_getOptions($node),
$ctrl,
array('id' => $control_name . $name, 'list.attr' => $attribs, 'list.select' => $value)
);
}
}
home/academiac/www/libraries/joomla/html/html/list.php 0000644 00000023227 15137264207 0017055 0 ustar 00 access);
}
/**
* Build the select list to choose an image
*
* @param string $name The name of the field
* @param string $active The selected item
* @param string $javascript Alternative javascript
* @param string $directory Directory the images are stored in
* @param string $extensions Allowed extensions
*
* @return array Image names
*
* @since 11.1
*/
public static function images($name, $active = null, $javascript = null, $directory = null, $extensions = "bmp|gif|jpg|png")
{
if (!$directory)
{
$directory = '/images/';
}
if (!$javascript)
{
$javascript = "onchange=\"if (document.forms.adminForm." . $name
. ".options[selectedIndex].value!='') {document.imagelib.src='..$directory' + document.forms.adminForm." . $name
. ".options[selectedIndex].value} else {document.imagelib.src='media/system/images/blank.png'}\"";
}
jimport('joomla.filesystem.folder');
$imageFiles = JFolder::files(JPATH_SITE . '/' . $directory);
$images = array(JHtml::_('select.option', '', JText::_('JOPTION_SELECT_IMAGE')));
foreach ($imageFiles as $file)
{
if (preg_match('#(' . $extensions . ')$#', $file))
{
$images[] = JHtml::_('select.option', $file);
}
}
$images = JHtml::_(
'select.genericlist',
$images,
$name,
array(
'list.attr' => 'class="inputbox" size="1" ' . $javascript,
'list.select' => $active
)
);
return $images;
}
/**
* Returns an array of options
*
* @param string $sql SQL with 'ordering' AS value and 'name field' AS text
* @param integer $chop The length of the truncated headline
*
* @return array An array of objects formatted for JHtml list processing
*
* @since 11.1
*/
public static function genericordering($sql, $chop = '30')
{
$db = JFactory::getDbo();
$options = array();
$db->setQuery($sql);
$items = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum())
{
JError::raiseNotice(500, $db->getErrorMsg());
return false;
}
if (empty($items))
{
$options[] = JHtml::_('select.option', 1, JText::_('JOPTION_ORDER_FIRST'));
return $options;
}
$options[] = JHtml::_('select.option', 0, '0 ' . JText::_('JOPTION_ORDER_FIRST'));
for ($i = 0, $n = count($items); $i < $n; $i++)
{
$items[$i]->text = JText::_($items[$i]->text);
if (JString::strlen($items[$i]->text) > $chop)
{
$text = JString::substr($items[$i]->text, 0, $chop) . "...";
}
else
{
$text = $items[$i]->text;
}
$options[] = JHtml::_('select.option', $items[$i]->value, $items[$i]->value . '. ' . $text);
}
$options[] = JHtml::_('select.option', $items[$i - 1]->value + 1, ($items[$i - 1]->value + 1) . ' ' . JText::_('JOPTION_ORDER_LAST'));
return $options;
}
/**
* Build a select list with a specific ordering
*
* @param integer $value The scalar value
* @param integer $id The id for an existing item in the list
* @param string $query The query
* @param integer $neworder 1 if new and first, -1 if new and last,
* 0 or null if existing item
*
* @return string Html for the ordered list
*
* @since 11.1
*
* @see JHtmlList::ordering
* @deprecated 12.1 Use JHtml::_('list.ordering') instead
*/
public static function specificordering($value, $id, $query, $neworder = 0)
{
if (is_object($value))
{
$value = $value->ordering;
}
if ($id)
{
$neworder = 0;
}
else
{
if ($neworder)
{
$neworder = 1;
}
else
{
$neworder = -1;
}
}
return JHtmlList::ordering('ordering', $query, '', $value, $neworder);
}
/**
* Build the select list for Ordering derived from a query
*
* @param integer $name The scalar value
* @param string $query The query
* @param string $attribs HTML tag attributes
* @param string $selected The selected item
* @param integer $neworder 1 if new and first, -1 if new and last, 0 or null if existing item
* @param string $chop The length of the truncated headline
*
* @return string Html for the select list
*
* @since 11.1
*/
public static function ordering($name, $query, $attribs = null, $selected = null, $neworder = null, $chop = null)
{
if (empty($attribs))
{
$attribs = 'class="inputbox" size="1"';
}
if (empty($neworder))
{
$orders = JHtml::_('list.genericordering', $query);
$html = JHtml::_('select.genericlist', $orders, $name, array('list.attr' => $attribs, 'list.select' => (int) $selected));
}
else
{
if ($neworder > 0)
{
$text = JText::_('JGLOBAL_NEWITEMSLAST_DESC');
}
elseif ($neworder <= 0)
{
$text = JText::_('JGLOBAL_NEWITEMSFIRST_DESC');
}
$html = '' . '' . $text . '';
}
return $html;
}
/**
* Select list of active users
*
* @param string $name The name of the field
* @param string $active The active user
* @param integer $nouser If set include an option to select no user
* @param string $javascript Custom javascript
* @param string $order Specify a field to order by
* @param string $reg Deprecated Excludes users who are explicitly in group 2.
*
* @return string The HTML for a list of users list of users
*
* @since 11.1
*/
public static function users($name, $active, $nouser = 0, $javascript = null, $order = 'name', $reg = 1)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
if ($reg)
{
// Does not include registered users in the list
// @deprecated
$query->where('m.group_id != 2');
}
$query->select('u.id AS value, u.name AS text');
$query->from('#__users AS u');
$query->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = u.id');
$query->where('u.block = 0');
$query->order($order);
$db->setQuery($query);
if ($nouser)
{
$users[] = JHtml::_('select.option', '0', JText::_('JOPTION_NO_USER'));
$users = array_merge($users, $db->loadObjectList());
}
else
{
$users = $db->loadObjectList();
}
$users = JHtml::_(
'select.genericlist',
$users,
$name,
array(
'list.attr' => 'class="inputbox" size="1" ' . $javascript,
'list.select' => $active
)
);
return $users;
}
/**
* Select list of positions - generally used for location of images
*
* @param string $name Name of the field
* @param string $active The active value
* @param string $javascript Alternative javascript
* @param boolean $none Null if not assigned
* @param boolean $center Null if not assigned
* @param boolean $left Null if not assigned
* @param boolean $right Null if not assigned
* @param boolean $id Null if not assigned
*
* @return array The positions
*
* @since 11.1
*/
public static function positions($name, $active = null, $javascript = null, $none = 1, $center = 1, $left = 1, $right = 1, $id = false)
{
$pos = array();
if ($none)
{
$pos[''] = JText::_('JNONE');
}
if ($center)
{
$pos['center'] = JText::_('JGLOBAL_CENTER');
}
if ($left)
{
$pos['left'] = JText::_('JGLOBAL_LEFT');
}
if ($right)
{
$pos['right'] = JText::_('JGLOBAL_RIGHT');
}
$positions = JHtml::_(
'select.genericlist', $pos, $name,
array(
'id' => $id,
'list.attr' => 'class="inputbox" size="1"' . $javascript,
'list.select' => $active,
'option.key' => null,
)
);
return $positions;
}
/**
* Crates a select list of categories
*
* @param string $name Name of the field
* @param string $extension Extension for which the categories will be listed
* @param string $selected Selected value
* @param string $javascript Custom javascript
* @param integer $order Not used.
* @param integer $size Size of the field
* @param boolean $sel_cat If null do not include a Select Categories row
*
* @return string
*
* @deprecated 12.1 Use JHtmlCategory instead
* @since 11.1
* @see JHtmlCategory
*/
public static function category($name, $extension, $selected = null, $javascript = null, $order = null, $size = 1, $sel_cat = 1)
{
// Deprecation warning.
JLog::add('JList::category is deprecated.', JLog::WARNING, 'deprecated');
$categories = JHtml::_('category.options', $extension);
if ($sel_cat)
{
array_unshift($categories, JHtml::_('select.option', '0', JText::_('JOPTION_SELECT_CATEGORY')));
}
$category = JHtml::_(
'select.genericlist', $categories, $name, 'class="inputbox" size="' . $size . '" ' . $javascript, 'value', 'text',
$selected
);
return $category;
}
}
home/academiac/www/libraries/joomla/form/fields/list.php 0000644 00000006104 15137515115 0017346 0 ustar 00 element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true')
{
$attr .= ' disabled="disabled"';
}
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
// Get the field options.
$options = (array) $this->getOptions();
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true')
{
$html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
$html[] = '';
}
// Create a regular list.
else
{
$html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
return implode($html);
}
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
// Initialize variables.
$options = array();
foreach ($this->element->children() as $option)
{
// Only add elements.
if ($option->getName() != 'option')
{
continue;
}
// Create a new option object based on the element.
$tmp = JHtml::_(
'select.option', (string) $option['value'],
JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text',
((string) $option['disabled'] == 'true')
);
// Set some option attributes.
$tmp->class = (string) $option['class'];
// Set some JavaScript option attributes.
$tmp->onclick = (string) $option['onclick'];
// Add the option object to the result set.
$options[] = $tmp;
}
reset($options);
return $options;
}
}
home/academiac/www/administrator/components/com_media/models/list.php 0000644 00000010466 15140221172 0022142 0 ustar 00 setState('folder', $folder);
$parent = str_replace("\\", "/", dirname($folder));
$parent = ($parent == '.') ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property, $default);
}
function getImages()
{
$list = $this->getList();
return $list['images'];
}
function getFolders()
{
$list = $this->getList();
return $list['folders'];
}
function getDocuments()
{
$list = $this->getList();
return $list['docs'];
}
/**
* Build imagelist
*
* @param string $listFolder The image directory to display
* @since 1.5
*/
function getList()
{
static $list;
// Only process the list once per request
if (is_array($list)) {
return $list;
}
// Get current path from request
$current = $this->getState('folder');
// If undefined, set to empty
if ($current == 'undefined') {
$current = '';
}
// Initialise variables.
if (strlen($current) > 0) {
$basePath = COM_MEDIA_BASE.'/'.$current;
}
else {
$basePath = COM_MEDIA_BASE;
}
$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE.'/');
$images = array ();
$folders = array ();
$docs = array ();
$fileList = false;
$folderList = false;
if (file_exists($basePath))
{
// Get the list of files and folders from the given folder
$fileList = JFolder::files($basePath);
$folderList = JFolder::folders($basePath);
}
// Iterate over the files if they exist
if ($fileList !== false) {
foreach ($fileList as $file)
{
if (is_file($basePath.'/'.$file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
$tmp = new JObject();
$tmp->name = $file;
$tmp->title = $file;
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $file));
$tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
$tmp->size = filesize($tmp->path);
$ext = strtolower(JFile::getExt($file));
switch ($ext)
{
// Image
case 'jpg':
case 'png':
case 'gif':
case 'xcf':
case 'odg':
case 'bmp':
case 'jpeg':
case 'ico':
$info = @getimagesize($tmp->path);
$tmp->width = @$info[0];
$tmp->height = @$info[1];
$tmp->type = @$info[2];
$tmp->mime = @$info['mime'];
if (($info[0] > 60) || ($info[1] > 60)) {
$dimensions = MediaHelper::imageResize($info[0], $info[1], 60);
$tmp->width_60 = $dimensions[0];
$tmp->height_60 = $dimensions[1];
}
else {
$tmp->width_60 = $tmp->width;
$tmp->height_60 = $tmp->height;
}
if (($info[0] > 16) || ($info[1] > 16)) {
$dimensions = MediaHelper::imageResize($info[0], $info[1], 16);
$tmp->width_16 = $dimensions[0];
$tmp->height_16 = $dimensions[1];
}
else {
$tmp->width_16 = $tmp->width;
$tmp->height_16 = $tmp->height;
}
$images[] = $tmp;
break;
// Non-image document
default:
$tmp->icon_32 = "media/mime-icon-32/".$ext.".png";
$tmp->icon_16 = "media/mime-icon-16/".$ext.".png";
$docs[] = $tmp;
break;
}
}
}
}
// Iterate over the folders if they exist
if ($folderList !== false) {
foreach ($folderList as $folder)
{
$tmp = new JObject();
$tmp->name = basename($folder);
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $folder));
$tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
$count = MediaHelper::countFiles($tmp->path);
$tmp->files = $count[0];
$tmp->folders = $count[1];
$folders[] = $tmp;
}
}
$list = array('folders' => $folders, 'docs' => $docs, 'images' => $images);
return $list;
}
}