当前位置: 首页>>代码示例>>PHP>>正文


PHP repository::get_types方法代码示例

本文整理汇总了PHP中repository::get_types方法的典型用法代码示例。如果您正苦于以下问题:PHP repository::get_types方法的具体用法?PHP repository::get_types怎么用?PHP repository::get_types使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在repository的用法示例。


在下文中一共展示了repository::get_types方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_string

 $catname = get_string('repositories', 'repository');
 $managerepo = get_string('manage', 'repository');
 $url = $CFG->wwwroot . '/' . $CFG->admin . '/repository.php';
 $ADMIN->add('modules', new admin_category('repositorysettings', $catname));
 $temp = new admin_settingpage('managerepositories', $managerepo);
 $temp->add(new admin_setting_heading('managerepositories', get_string('activerepository', 'repository'), ''));
 $temp->add(new admin_setting_managerepository());
 $temp->add(new admin_setting_heading('managerepositoriescommonheading', get_string('commonsettings', 'admin'), ''));
 $temp->add(new admin_setting_configtext('repositorycacheexpire', get_string('cacheexpire', 'repository'), get_string('configcacheexpire', 'repository'), 120));
 $ADMIN->add('repositorysettings', $temp);
 $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', get_string('addplugin', 'repository'), $url, 'moodle/site:config', true), '', $url);
 $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete', get_string('deleterepository', 'repository'), $url, 'moodle/site:config', true), '', $url);
 $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller', get_string('managerepositories', 'repository'), $url, 'moodle/site:config', true), '', $url);
 $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew', get_string('createrepository', 'repository'), $url, 'moodle/site:config', true), '', $url);
 $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', get_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true), '', $url);
 foreach (repository::get_types() as $repositorytype) {
     //display setup page for plugins with: general options or multiple instances (e.g. has instance config)
     $typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names');
     $instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names');
     if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
         $ADMIN->add('repositorysettings', new admin_externalpage('repositorysettings' . $repositorytype->get_typename(), $repositorytype->get_readablename(), $url . '?edit=' . $repositorytype->get_typename()), 'moodle/site:config');
     }
 }
 // Question type settings.
 $ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin')));
 $ADMIN->add('qtypesettings', new admin_page_manageqtypes());
 require_once $CFG->libdir . '/questionlib.php';
 global $QTYPES;
 foreach ($QTYPES as $qtype) {
     $settingsfile = $qtype->plugin_dir() . '/settings.php';
     if (file_exists($settingsfile)) {
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:plugins.php

示例2: output_html

 /**
  * Builds XHTML to display the control
  *
  * @param string $data Unused
  * @param string $query
  * @return string XHTML
  */
 public function output_html($data, $query = '')
 {
     global $CFG, $USER, $OUTPUT;
     // Get strings that are used
     $strshow = get_string('on', 'repository');
     $strhide = get_string('off', 'repository');
     $strdelete = get_string('disabled', 'repository');
     $actionchoicesforexisting = array('show' => $strshow, 'hide' => $strhide, 'delete' => $strdelete);
     $actionchoicesfornew = array('newon' => $strshow, 'newoff' => $strhide, 'delete' => $strdelete);
     $return = '';
     $return .= $OUTPUT->box_start('generalbox');
     // Set strings that are used multiple times
     $settingsstr = get_string('settings');
     $disablestr = get_string('disable');
     // Table to list plug-ins
     $table = new html_table();
     $table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr);
     $table->align = array('left', 'center', 'center', 'center', 'center');
     $table->data = array();
     // Get list of used plug-ins
     $instances = repository::get_types();
     if (!empty($instances)) {
         // Array to store plugins being used
         $alreadyplugins = array();
         $totalinstances = count($instances);
         $updowncount = 1;
         foreach ($instances as $i) {
             $settings = '';
             $typename = $i->get_typename();
             // Display edit link only if you can config the type or if it has multiple instances (e.g. has instance config)
             $typeoptionnames = repository::static_function($typename, 'get_type_option_names');
             $instanceoptionnames = repository::static_function($typename, 'get_instance_option_names');
             if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
                 // Calculate number of instances in order to display them for the Moodle administrator
                 if (!empty($instanceoptionnames)) {
                     $params = array();
                     $params['context'] = array(get_system_context());
                     $params['onlyvisible'] = false;
                     $params['type'] = $typename;
                     $admininstancenumber = count(repository::static_function($typename, 'get_instances', $params));
                     // site instances
                     $admininstancenumbertext = get_string('instancesforsite', 'repository', $admininstancenumber);
                     $params['context'] = array();
                     $instances = repository::static_function($typename, 'get_instances', $params);
                     $courseinstances = array();
                     $userinstances = array();
                     foreach ($instances as $instance) {
                         if ($instance->context->contextlevel == CONTEXT_COURSE) {
                             $courseinstances[] = $instance;
                         } else {
                             if ($instance->context->contextlevel == CONTEXT_USER) {
                                 $userinstances[] = $instance;
                             }
                         }
                     }
                     // course instances
                     $instancenumber = count($courseinstances);
                     $courseinstancenumbertext = get_string('instancesforcourses', 'repository', $instancenumber);
                     // user private instances
                     $instancenumber = count($userinstances);
                     $userinstancenumbertext = get_string('instancesforusers', 'repository', $instancenumber);
                 } else {
                     $admininstancenumbertext = "";
                     $courseinstancenumbertext = "";
                     $userinstancenumbertext = "";
                 }
                 $settings .= '<a href="' . $this->baseurl . '&amp;action=edit&amp;repos=' . $typename . '">' . $settingsstr . '</a>';
                 $settings .= $OUTPUT->container_start('mdl-left');
                 $settings .= '<br/>';
                 $settings .= $admininstancenumbertext;
                 $settings .= '<br/>';
                 $settings .= $courseinstancenumbertext;
                 $settings .= '<br/>';
                 $settings .= $userinstancenumbertext;
                 $settings .= $OUTPUT->container_end();
             }
             // Get the current visibility
             if ($i->get_visible()) {
                 $currentaction = 'show';
             } else {
                 $currentaction = 'hide';
             }
             $select = new single_select($this->repository_action_url($typename, 'repos'), 'action', $actionchoicesforexisting, $currentaction, null, 'applyto' . basename($typename));
             // Display up/down link
             $updown = '';
             $spacer = $OUTPUT->spacer(array('height' => 15, 'width' => 15));
             // should be done with CSS instead
             if ($updowncount > 1) {
                 $updown .= "<a href=\"{$this->baseurl}&amp;action=moveup&amp;repos=" . $typename . "\">";
                 $updown .= "<img src=\"" . $OUTPUT->pix_url('t/up') . "\" alt=\"up\" /></a>&nbsp;";
             } else {
                 $updown .= $spacer;
             }
//.........这里部分代码省略.........
开发者ID:raymondAntonio,项目名称:moodle,代码行数:101,代码来源:adminlib.php

示例3: get_editable_types

 /**
  * Return all types that you a user can create/edit and which are also visible
  * Note: Mostly used in order to know if at least one editable type can be set
  *
  * @static
  * @param stdClass $context the context for which we want the editable types
  * @return array types
  */
 public static function get_editable_types($context = null)
 {
     if (empty($context)) {
         $context = context_system::instance();
     }
     $types = repository::get_types(true);
     $editabletypes = array();
     foreach ($types as $type) {
         $instanceoptionnames = repository::static_function($type->get_typename(), 'get_instance_option_names');
         if (!empty($instanceoptionnames)) {
             if ($type->get_contextvisibility($context)) {
                 $editabletypes[] = $type;
             }
         }
     }
     return $editabletypes;
 }
开发者ID:isuruAb,项目名称:moodle,代码行数:25,代码来源:lib.php

示例4: get_string

 $strhide = get_string('off', 'repository');
 $strdelete = get_string('disabled', 'repository');
 $actionchoicesforexisting = array('show' => $strshow, 'hide' => $strhide, 'delete' => $strdelete);
 $actionchoicesfornew = array('newon' => $strshow, 'newoff' => $strhide, 'delete' => $strdelete);
 $output = '';
 $output .= $OUTPUT->box_start('generalbox');
 // Set strings that are used multiple times
 $settingsstr = get_string('settings');
 $disablestr = get_string('disable');
 // Table to list plug-ins
 $table = new html_table();
 $table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr);
 $table->align = array('left', 'center', 'center', 'center', 'center');
 $table->data = array();
 // Get list of used plug-ins
 $instances = repository::get_types();
 if (!empty($instances)) {
     // Array to store plugins being used
     $alreadyplugins = array();
     $totalinstances = count($instances);
     $updowncount = 1;
     foreach ($instances as $i) {
         $settings = '';
         $typename = $i->get_typename();
         // Display edit link only if you can config the type or if it has multiple instances (e.g. has instance config)
         $typeoptionnames = repository::static_function($typename, 'get_type_option_names');
         $instanceoptionnames = repository::static_function($typename, 'get_instance_option_names');
         if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
             // Calculate number of instances in order to display them for the Moodle administrator
             if (!empty($instanceoptionnames)) {
                 $params = array();
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:repository.php

示例5: output_html

 /**
  * Builds XHTML to display the control
  *
  * @param string $data Unused
  * @param string $query
  * @return string XHTML
  */
 public function output_html($data, $query = '')
 {
     global $CFG, $USER, $OUTPUT;
     $output = $OUTPUT->box_start('generalbox');
     $namestr = get_string('name');
     $settingsstr = get_string('settings');
     $updownstr = get_string('updown', 'repository');
     $hiddenstr = get_string('hiddenshow', 'repository');
     $deletestr = get_string('delete');
     $plugins = get_plugin_list('repository');
     $instances = repository::get_types();
     $instancesnumber = count($instances);
     $alreadyplugins = array();
     $table = new html_table();
     $table->head = array($namestr, $updownstr, $hiddenstr, $deletestr, $settingsstr);
     $table->align = array('left', 'center', 'center', 'center', 'center');
     $table->data = array();
     $updowncount = 1;
     foreach ($instances as $i) {
         $settings = '';
         //display edit link only if you can config the type or if it has multiple instances (e.g. has instance config)
         $typeoptionnames = repository::static_function($i->get_typename(), 'get_type_option_names');
         $instanceoptionnames = repository::static_function($i->get_typename(), 'get_instance_option_names');
         if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
             //calculate number of instances in order to display them for the Moodle administrator
             if (!empty($instanceoptionnames)) {
                 $admininstancenumber = count(repository::static_function($i->get_typename(), 'get_instances', array(get_context_instance(CONTEXT_SYSTEM)), null, false, $i->get_typename()));
                 $admininstancenumbertext = " <br/> " . $admininstancenumber . " " . get_string('instancesforadmin', 'repository');
                 $instancenumber = count(repository::static_function($i->get_typename(), 'get_instances', array(), null, false, $i->get_typename())) - $admininstancenumber;
                 $instancenumbertext = "<br/>" . $instancenumber . " " . get_string('instancesforothers', 'repository');
             } else {
                 $admininstancenumbertext = "";
                 $instancenumbertext = "";
             }
             $settings .= '<a href="' . $this->baseurl . '&amp;edit=' . $i->get_typename() . '">' . $settingsstr . '</a>' . $admininstancenumbertext . $instancenumbertext . "\n";
         }
         $delete = '<a href="' . $this->baseurl . '&amp;delete=' . $i->get_typename() . '">' . $deletestr . '</a>' . "\n";
         $hidetitle = $i->get_visible() ? get_string('clicktohide', 'repository') : get_string('clicktoshow', 'repository');
         $hiddenshow = ' <a href="' . $this->baseurl . '&amp;hide=' . $i->get_typename() . '">' . '<img src="' . $OUTPUT->old_icon_url('i/' . ($i->get_visible() ? 'hide' : 'show')) . '"' . ' alt="' . $hidetitle . '" ' . ' title="' . $hidetitle . '" />' . '</a>' . "\n";
         // display up/down link
         $updown = '';
         if ($updowncount > 1) {
             $updown .= "<a href=\"{$this->baseurl}&amp;move=up&amp;type=" . $i->get_typename() . "\">";
             $updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/up') . "\" alt=\"up\" /></a>&nbsp;";
         } else {
             $updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />&nbsp;";
         }
         if ($updowncount < count($instances)) {
             $updown .= "<a href=\"{$this->baseurl}&amp;move=down&amp;type=" . $i->get_typename() . "\">";
             $updown .= "<img src=\"" . $OUTPUT->old_icon_url('t/down') . "\" alt=\"down\" /></a>";
         } else {
             $updown .= "<img src=\"" . $OUTPUT->old_icon_url('spacer.gif') . "\" class=\"icon\" alt=\"\" />";
         }
         $updowncount++;
         $table->data[] = array($i->get_readablename(), $updown, $hiddenshow, $delete, $settings);
         //display a grey row if the type is defined as not visible
         if (!$i->get_visible()) {
             $table->rowclasses[] = 'dimmed_text';
         } else {
             $table->rowclasses[] = '';
         }
         if (!in_array($i->get_typename(), $alreadyplugins)) {
             $alreadyplugins[] = $i->get_typename();
         }
     }
     $output .= $OUTPUT->table($table);
     $instancehtml = '<div><h3>';
     $instancehtml .= get_string('addplugin', 'repository');
     $instancehtml .= '</h3><ul>';
     $addable = 0;
     foreach ($plugins as $p => $dir) {
         if (!in_array($p, $alreadyplugins)) {
             $instancehtml .= '<li><a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/repository.php?sesskey=' . sesskey() . '&amp;new=' . $p . '">' . get_string('add', 'repository') . ' "' . get_string('repositoryname', 'repository_' . $p) . '" ' . '</a></li>';
             $addable++;
         }
     }
     $instancehtml .= '</ul>';
     $instancehtml .= '</div>';
     if ($addable) {
         $output .= $instancehtml;
     }
     $output .= $OUTPUT->box_end();
     return highlight($query, $output);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:91,代码来源:adminlib.php

示例6: array

 $actionchoicesforexisting = array('show' => $strshow, 'hide' => $strhide, 'delete' => $strdelete);
 $actionchoicesfornew = array('newon' => $strshow, 'newoff' => $strhide, 'delete' => $strdelete);
 $output = '';
 $output .= $OUTPUT->box_start('generalbox');
 // Set strings that are used multiple times
 $settingsstr = get_string('settings');
 $disablestr = get_string('disable');
 // Table to list plug-ins
 $table = new html_table();
 $table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr);
 $table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign');
 $table->id = 'repositoriessetting';
 $table->data = array();
 $table->attributes['class'] = 'admintable generaltable';
 // Get list of used plug-ins
 $repositorytypes = repository::get_types();
 // Array to store plugins being used
 $alreadyplugins = array();
 if (!empty($repositorytypes)) {
     $totalrepositorytypes = count($repositorytypes);
     $updowncount = 1;
     foreach ($repositorytypes as $i) {
         $settings = '';
         $typename = $i->get_typename();
         // Display edit link only if you can config the type or if it has multiple instances (e.g. has instance config)
         $typeoptionnames = repository::static_function($typename, 'get_type_option_names');
         $instanceoptionnames = repository::static_function($typename, 'get_instance_option_names');
         if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
             // Calculate number of instances in order to display them for the Moodle administrator
             if (!empty($instanceoptionnames)) {
                 $params = array();
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:repository.php


注:本文中的repository::get_types方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。