build Materialize modal quickly by a table name.

@param string $table
@param string $link

@return string
503004
public function mtGet($table, $link, $title)
    {
        $result = new AutoArray($table);

        $modal = $this->modalDirector->build($title, 'Create', $result->merge(), $link, $this->MtModal);

        return $modal->modalHead.$modal->modalBody.$modal->modalFooter;
    }
1114700
def _table_materialize(table):
    
    if table._is_materialized():
        return table

    op = ops.MaterializedJoin(table)
    return op.to_expr()
911000
public function renderDefinition(TableStructure $table): string
    {
        $this->buildSpecificDefinition($table);
        $this->buildGeneralDefinition($table);

        return implode('->', $this->definition);
    }
1168082
public function FormatTableName($Table) {

      if (strpos($Table, '.') !== FALSE){
         if(preg_match('/^([^\s]+)\s+(?:as\s+)?`?([^`]+)`?$/', $Table, $Matches)){
            $DatabaseTable = '`' . str_replace('.', '`.`', $Matches[1]) . '`';
            $Table = str_replace($Matches[1], $DatabaseTable, $Table);
         }else
            $Table = '`' . str_replace('.', '`.`', $Table) . '`';
      }
      return $Table;
   }
836965
public function getString($row, Table $table) {
        if (!$this->isVisible($row)) {
            return "";
        }
        $options = $this->htmlOptions;
        if ($this->title != "") {
            eval("\$options['title'] = {$this->title};");
        } elseif (!isset($options['title'])) {
            $options['title'] = '';
        }
        if ($this->confirmation && (!$this->post)) {
            if ($this->jsAction) {
                $options['onclick'] = "if (confirm('{$this->confirmation}')) {$this->jsAction}({$row->{$this->dataProvider->getPkKey()}}, '{$this->name}', this);";
            } else {
                $options['onclick'] = "return confirm('{$this->confirmation}');";
            }
        } elseif ($this->jsAction) {
            $options['onclick'] = "return {$this->jsAction}({$row->id}, '{$this->name}', this);";
        }

        if ('#' != $this->url) {
            eval("\$url = {$this->url};");
        } else {
            $url = '#';
        }
        if (false !== $this->post && is_array($this->post)) {
            $options['class'] = isset($options['class']) ? $options['class'] . ' mdata-table-post-link' : 'mdata-table-post-link';
            $parsed = array();
            foreach ($this->post as $name=>$value){
                eval('$value = '. $value.';');
                if ('{{modelKey}}' == $name){
                    $name = $table->dataProvider->filtersKey;
                }
                $parsed[$name] = $value;
            }
            $options['post-data'] = json_encode($parsed);
            if ($this->confirmation){
                $options['post-confirmation'] = $this->confirmation;
            }
        }
        $icon = $this->getIcon($options['title'], $table);
        return Html::get()->link($url, $icon . $this->label, $options);
    }
820296
public function transform($link, array $params = array())
    {
        $facade = $this->newFacade();

        $facade->name = $link['name'];
        $facade->link = $link['link'];

        return $facade;
    }
1105303
public function loadResourceLink($resourcelink) {
        global $DB;

        $resourceid = $resourcelink->getRecordId();
        if (!empty($resourceid)) {
            $params = ['id' => $resourceid];
            $row = $DB->get_record($this->resourcelinktable, $params);
        } else if (!empty($resourcelink->getContext())) {
            $params = [
                'contextid' => $resourcelink->getContext()->getRecordId(),
                'ltiresourcelinkkey' => $resourcelink->getId()
            ];
            $row = $DB->get_record($this->resourcelinktable, $params);
        } else {
            $sql = "SELECT r.*
                      FROM {{$this->resourcelinktable}} r
           LEFT OUTER JOIN {{$this->contexttable}} c
                        ON r.contextid = c.id
                     WHERE (r.consumerid = ? OR c.consumerid = ?)
                           AND ltiresourcelinkkey = ?";
            $params = [
                $resourcelink->getConsumer()->getRecordId(),
                $resourcelink->getConsumer()->getRecordId(),
                $resourcelink->getId()
            ];
            $row = $DB->get_record_sql($sql, $params);
        }
        if ($row) {
            $resourcelink->setRecordId($row->id);
            if (!is_null($row->contextid)) {
                $resourcelink->setContextId($row->contextid);
            } else {
                $resourcelink->setContextId(null);
            }
            if (!is_null($row->consumerid)) {
                $resourcelink->setConsumerId($row->consumerid);
            } else {
                $resourcelink->setConsumerId(null);
            }
            $resourcelink->ltiResourceLinkId = $row->ltiresourcelinkkey;
            $settings = unserialize($row->settings);
            if (!is_array($settings)) {
                $settings = array();
            }
            $resourcelink->setSettings($settings);
            if (!is_null($row->primaryresourcelinkid)) {
                $resourcelink->primaryResourceLinkId = $row->primaryresourcelinkid;
            } else {
                $resourcelink->primaryResourceLinkId = null;
            }
            $resourcelink->shareApproved = (is_null($row->shareapproved)) ? null : ($row->shareapproved == 1);
            $resourcelink->created = $row->created;
            $resourcelink->updated = $row->updated;
            return true;
        }

        return false;
    }
930834
public function setTitle($title, $link = null)
    {
        $this->data['title'] = $title;
        if ($link) {
            $this->data['title_link'] = $link;
        }

        return $this;
    }
1232104
public static function label($link) {
        if(isset($link['label']) && !empty(trim($link['label']))) {
            return trim($link['label']);
        }
        elseif(isset($link['title']) && !empty(trim($link['title']))) {
            return trim($link['title']);
        }
        return false;
    }
241468
public function linkCell(string $link) : LinkCell
    {
        $this->addCell($cell = new LinkCell($link));

        return $cell;
    }
1011446
public function buildSimpleLink($output, Link $link)
    {
        $name = $link->getName();

        $output->$name = $link->getHref();

        return $output;
    }
333681
public function table($table, /*# string */ $alias = '')
    {
        $tbl = $this->fixTable($table, $alias);
        $clone = [] === $this->tables ? $this : clone $this;
        $clone->tables = $tbl;
        return $clone;
    }
157913
public static function getAnchorName($link) {
    preg_match_all("/#(.+)$/", $link, $matches);
    if (sizeof($matches) > 0 && sizeof($matches[1]) > 0) {
      $name = $matches[1][0];
      return $name;
    }
    return null;
  }
780484
public function table_prefix($table = null)
	{
		if ($table !== null)
		{
			return $this->_config['table_prefix'] .$table;
		}

		return $this->_config['table_prefix'];
	}
862178
public function addTablePrefix(string $table): string
    {
        return ($this->tablePrefixer ?? $this->database->getTablePrefixer())->addTablePrefix($table);
    }
1327118
public function render(TableStructure $table, int $indent = 8): string
    {
        return str_repeat(' ', $indent)
            . "\$this->addPrimaryKey('"
            . ($this->name ?: self::GENERIC_PRIMARY_KEY)
            . "', '"
            . $table->renderName()
            . "', ['"
            . implode("', '", $this->columns)
            . "']);";
    }
770133
public function fill_table($activitylink = false, $studentcoursesonly = false) {
        global $CFG, $DB, $OUTPUT, $USER;

        if ($studentcoursesonly && count($this->studentcourseids) == 0) {
            return false;
        }

        // Only show user's courses instead of all courses.
        if ($this->courses) {
            $coursesdata = $this->setup_courses_data($studentcoursesonly);

            foreach ($coursesdata as $coursedata) {

                $course = $coursedata['course'];
                $coursecontext = $coursedata['context'];
                $finalgrade = $coursedata['finalgrade'];
                $courseitem = $coursedata['courseitem'];

                $coursename = format_string(get_course_display_name_for_list($course), true, array('context' => $coursecontext));
                // Link to the activity report version of the user grade report.
                if ($activitylink) {
                    $courselink = html_writer::link(new moodle_url('/course/user.php', array('mode' => 'grade', 'id' => $course->id,
                        'user' => $this->user->id)), $coursename);
                } else {
                    $courselink = html_writer::link(new moodle_url('/grade/report/user/index.php', array('id' => $course->id,
                        'userid' => $this->user->id, 'group' => $this->gpr->groupid)), $coursename);
                }

                $data = array($courselink, grade_format_gradevalue($finalgrade, $courseitem, true));

                if ($this->showrank['any']) {
                    if ($this->showrank[$course->id] && !is_null($finalgrade)) {
                        $rank = $coursedata['rank'];
                        $numusers = $coursedata['numusers'];
                        $data[] = "$rank/$numusers";
                    } else {
                        // No grade, no rank.
                        // Or this course wants rank hidden.
                        $data[] = '-';
                    }
                }

                $this->table->add_data($data);
            }

            return true;
        } else {
            echo $OUTPUT->notification(get_string('notenrolled', 'grades'), 'notifymessage');
            return false;
        }
    }