/** * Get a list of applications that the user might invoke. * * @param array $lst List of tools * @return array List of tools */ private function _getToollist($lst = NULL) { require_once Component::path('com_tools') . DS . 'models' . DS . 'tool.php'; $toollist = array(); // Create a Tool object $database = \App::get('db'); if (is_array($lst)) { $tools = array(); // Check if the list is empty or not if (empty($lst)) { return $tools; } ksort($lst); $items = array(); // Get info for tools in the list foreach ($lst as $item) { if (strstr($item, '_r')) { $bits = explode('_r', $item); $rev = is_array($bits) && count($bits > 1) ? array_pop($bits) : ''; $item = trim(implode('_r', $bits)); } $items[] = $item; } $tools = \Components\Tools\Models\Version::getVersionInfo('', 'current', $items, ''); } else { // Get all available tools $tools = \Components\Tools\Models\Tool::getMyTools(); } $toolnames = array(); // Turn it into an App array. foreach ($tools as $tool) { if (!in_array(strtolower($tool->toolname), $toolnames)) { // include only one version $toollist[strtolower($tool->instance)] = new App($tool->instance, $tool->title, $tool->description, $tool->mw, 0, '', 0, 1, $tool->revision, $tool->toolname); } $toolnames[] = strtolower($tool->toolname); } return $toollist; }
/** * Method to get list of tools * * @apiMethod GET * @apiUri /tools/list * @apiParameter { * "name": "user_id", * "description": "Member identifier", * "type": "integer", * "required": true, * "default": 0 * } * @return void */ public function listTask() { //get the userid and attempt to load user profile $userid = Request::getInt('user_id', 0); $result = User::getInstance($userid); //make sure we have a user //if ($result === false) return $this->not_found(); //instantiate database object $database = \App::get('db'); //get list of tools $tools = \Components\Tools\Models\Tool::getMyTools(); //get the supported tag $rconfig = Component::params('com_resources'); $supportedtag = $rconfig->get('supportedtag', ''); //get supportedtag usage include_once Component::path('com_resources') . DS . 'helpers' . DS . 'tags.php'; $resource_tags = new \Components\Resources\Helpers\Tags(0); $supportedtagusage = $resource_tags->getTagUsage($supportedtag, 'alias'); //create list of tools $t = array(); foreach ($tools as $k => $tool) { if (isset($t[$tool->alias])) { $t[$tool->alias]['versions'][] = $tool->revision; continue; } $t[$tool->alias]['alias'] = $tool->alias; $t[$tool->alias]['title'] = $tool->title; $t[$tool->alias]['description'] = $tool->description; $t[$tool->alias]['versions'] = array($tool->revision); $t[$tool->alias]['supported'] = in_array($tool->alias, $supportedtagusage) ? 1 : 0; } //encode and return result $object = new stdClass(); $object->tools = array_values($t); $this->send($object); }
$assets = array(); foreach ($this->course->offering()->units() as $unit) { foreach ($unit->assetgroups() as $agt) { foreach ($agt->children() as $ag) { $assetgroups[] = array('id' => $ag->get('id'), 'title' => $ag->get('title')); foreach ($ag->assets() as $a) { if ($a->isPublished()) { $a->set('longTitle', $unit->get('title') . ' - ' . $ag->get('title') . ' - ' . $a->get('title')); $assets[] = $a; } } } } } require_once PATH_CORE . DS . 'components' . DS . 'com_tools' . DS . 'models' . DS . 'tool.php'; $tools = \Components\Tools\Models\Tool::getMyTools(); $config = Component::params('com_courses'); $tool_path = $config->get('tool_path'); ?> <div class="edit-asset"> <h3>Edit Asset</h3> <form action="<?php echo Request::base(true); ?> /api/courses/asset/save" method="POST" class="edit-form"> <p> <label for="title">Title:</label> <input type="text" name="title" value="<?php