Return HTML Table of Services with their available Formats.
@access		public
@return		string			HTML of Service Table
493430
public function buildContent()
	{
		$rows		= array();
		$services	= $this->servicePoint->getServices();
		natcasesort( $services );
		$heads		= array();
		
		$heads	= array( "<th>Service</th><th>Parameter</th>" );
		$cols	= array( "<col width='35%'/><col width='30%'/>" ); 
		foreach( $this->availableFormats as $format )
		{
			$cols[]		= "<col width='".round( ( 100 - 65 ) / count( $this->availableFormats ), 0 )."%'/>";
			$heads[]	= "<th><a href='#' onClick='$(\"#format\").val(\"".$format."\").trigger(\"change\")'>".strtoupper( $format )."</a></th>";
		}
		$cols	= "<colgroup>".implode( "", $cols )."</colgroup>";
		$heads	= "<tr>".implode( "", $heads )."</tr>";
		$counter	= 0;
		foreach( $services as $service )
		{
			$counter ++;
			//  --  FORMATS  --   //
			$cells		= array();
			$formats	= $this->servicePoint->getServiceFormats( $service );
			$default	= $this->servicePoint->getDefaultServiceFormat( $service );
			foreach( $this->availableFormats as $format )
			{
				if( $format == $default )
					$cells[]	= "<td class='preferred'><span class='".$format."'>+</span></td>";
				else if( in_array( $format, $formats ) )
					$cells[]	= "<td class='yes'><span class='".$format."'>+</span></td>";
				else
					$cells[]	= "<td class='no'>-</td>";
			}
						
			//  --  PARAMETERS  --   //
			$parameterList	= array();
			$parameters	= $this->servicePoint->getServiceParameters( $service );
			foreach( $parameters as $parameter => $rules )
			{
				$ruleList	= array();
				$mandatory	= FALSE;
				$type		= "";
				if( $rules )
				{
					foreach( $rules as $ruleKey => $ruleValue )
					{
						if( $ruleKey == "title" )
							continue;
						if( $ruleKey == "mandatory" )
						{
							$mandatory	= $ruleValue;
							$ruleValue	= $ruleValue ? "yes" : "no";
						}
						if( $ruleKey == "type" )
						{
							$type	= "<small><em>".$ruleValue."</em></small>&nbsp;";
						}
						$spanKey	= UI_HTML_Tag::create( "span", $ruleKey.":", array( 'class' => "key" ) );
						$spanValue	= UI_HTML_Tag::create( "span", htmlspecialchars( $ruleValue ), array( 'class' => "value" ) );
						$ruleList[]	= $spanKey." ".$spanValue;
					}
				}
				if( isset( $rules['title'] ) )
					$parameter	= UI_HTML_Elements::Acronym( $parameter, $rules['title'] );
				$parameter	= $type.$parameter;
				if( !$mandatory )
					$parameter	= "[".$parameter."]";
				$rules	= $ruleList ? '<div class="rules">'.implode( ", ", $ruleList ).'</div>' : "";
				$parameterList[]	= $rules.$parameter;
			}
			$parameters	= implode( "<br/>", $parameterList );

			$linkService	= UI_HTML_Tag::create( "a", $service, array( 'href' => "?service=".$service, 'title' => "Run this service" ) );
			$imageTest		= UI_HTML_Tag::create( "span", NULL, array( 'class' => 'linkTest', 'title' => 'Test this service' ) );
			$linkTest		= UI_HTML_Elements::Link( "?test=".$service, $imageTest );

			$serviceLink	= '<div class="serviceName">'.$linkTest.$linkService.'</div>';
			$serviceClass	= '<div class="className">'.$this->servicePoint->getServiceClass( $service ).'</div>';
			$description	= '<div class="description">'.$this->servicePoint->getServiceDescription( $service ).'</div>';
			$cellService	= '<td class="service">'.$serviceClass.$serviceLink.$description.'</td>';
			$cellParameters	= '<td class="parameter">'.$parameters.'</td>';
			$cellsFormats	= implode( "", $cells );
			$formats		= implode( " ", $formats );
			$row	= '<tr class="service '.$formats.'">'.$cellService.$cellParameters.$cellsFormats.'</tr>';
			$rows[]	= $row;
			if( $counter % 10 == 0 )
				$rows[]	= $heads;
		}
		return "<table class='".$this->tableClass."'>".$cols."<thead>".$heads."</thead><tbody>".implode( "", $rows )."</tbody></table>";
	}
284669
public function getServiceDescription()
	{
		return array(
			'Locale_Site.deleteItems' => array(
				"parameters" => array(
					array( "type" => "array","name" => "items","optional" => false ),
				),
				"returns" => "array",
			),
			'Locale_Site.saveItems' => array(
				"parameters" => array(
					array( "type" => "array","name" => "items","optional" => false ),
				),
				"returns" => "array",
			),
			'Locale_Site.searchItems' => array(
				"parameters" => array(
					array( "type" => "array","name" => "condition","optional" => true ),
					array( "type" => "integer","name" => "start","optional" => true ),
					array( "type" => "integer","name" => "limit","optional" => true ),
					array( "type" => "string","name" => "sort","optional" => true ),
					array( "type" => "string","name" => "dir","optional" => true ),
				),
				"returns" => "array",
			),
			'Locale_Site.getTree' => array(
				"parameters" => array(
					array( "type" => "array","name" => "items","optional" => false ),
				),
				"returns" => "array",
			),
			'Locale_Site.insertItems' => array(
				"parameters" => array(
					array( "type" => "array","name" => "items","optional" => false ),
					array( "type" => "string","name" => "parentid","optional" => true ),
					array( "type" => "string","name" => "refid","optional" => true ),
				),
				"returns" => "array",
			),
			'Locale_Site.moveItems' => array(
				"parameters" => array(
					array( "type" => "array","name" => "items","optional" => false ),
					array( "type" => "string","name" => "oldparentid","optional" => false ),
					array( "type" => "string","name" => "newparentid","optional" => false ),
					array( "type" => "string","name" => "refid","optional" => true ),
				),
				"returns" => "array",
			),
		);
	}
633216
protected function getTables()
    {
        if (empty($this->config['tables'])) {
            return '';
        }
        $tables = [];
        // Tables specified in both tables and structureTables should only
        // export their structure. @see getStructureTables().
        $allTables = array_diff($this->config['tables'], $this->config['structureTables']);
        foreach ($allTables as $table) {
            $tables[] = escapeshellarg($table);
        }
        return implode($tables);
    }
1326048
public function getHtmlColumnHeader(): string
  {
    $attributes = [];
    $classes    = [];

    // Add class indicating this column can be used for sorting.
    if ($this->sortable)
    {
      $classes[] = 'sort-1';

      // Add attributes indicating the sort order of this column and direction.
      if ($this->sortOrder!==null)
      {
        $attributes['data-sort-order-1'] = $this->sortOrder;

        $classes[] = ($this->sortDirection=='desc') ? 'sorted-1-desc' : 'sorted-1-asc';
      }
    }

    // Add class indicating this column can be used for sorting.
    if ($this->sortable2)
    {
      $classes[] = 'sort-2';

      // Add attributes indicating the sort order of this column and direction.
      if ($this->sortOrder2!==null)
      {
        $attributes['data-sort-order-2'] = $this->sortOrder2;

        $classes[] = ($this->sortDirection2=='desc') ? 'sorted-2-desc' : 'sorted-2-asc';
      }
    }

    $attributes['class']   = implode(' ', $classes);
    $attributes['colspan'] = 2;

    return Html::generateElement('th', $attributes, '<span>&nbsp;</span>'.Html::txt2Html($this->headerText), true);
  }
311566
public function getFormattedAttributes()
    {
        $rtn = "";
        foreach($this->listAttributes() as $name => $value)
        {
            $rtn .= sprintf(" %s=\"%s\"",htmlentities($name),htmlentities($value));
        }
        return $rtn;
    }
1341389
public function get_content_html() {
		return wc_get_template_html( $this->template_html, [
			'order'         => $this->object,
			'email_heading' => $this->get_heading(),
			'sent_to_admin' => false,
			'plain_text'    => false,
			'email'			=> $this,
		] );
	}
168953
private function getServiceMap()
    {
        $result = [
            'transport' => 'POST',
            'envelope' => 'JSON-RPC-2.0',
            'SMDVersion' => '2.0',
            'contentType' => 'application/json',
            'target' => !empty($_SERVER['REQUEST_URI']) ?
                substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) : '',
            'services' => [],
            'description' => '',
        ];

        foreach ($this->instances as $namespace => $instance) {
            $rc = new \ReflectionClass($instance);

            // Get Class Description
            if ($rcDocComment = $this->getDocDescription($rc->getDocComment())) {
                $result['description'] .= $rcDocComment . PHP_EOL;
            }

            foreach ($rc->getMethods() as $method) {
                /** @var \ReflectionMethod $method */
                if (!$method->isPublic() || in_array(strtolower($method->getName()), $this->hiddenMethods)) {
                    continue;
                }

                $methodName = ($namespace ? $namespace . '.' : '') . $method->getName();
                $docComment = $method->getDocComment();

                $result['services'][$methodName] = ['parameters' => []];

                // set description
                if ($rmDocComment = $this->getDocDescription($docComment)) {
                    $result['services'][$methodName]['description'] = $rmDocComment;
                }

                // @param\s+([^\s]*)\s+([^\s]*)\s*([^\s\*]*)
                $parsedParams = [];
                if (preg_match_all('/@param\s+([^\s]*)\s+([^\s]*)\s*([^\n\*]*)/', $docComment, $matches)) {
                    foreach ($matches[2] as $number => $name) {
                        $type = $matches[1][$number];
                        $desc = $matches[3][$number];
                        $name = trim($name, '$');

                        $param = ['type' => $type, 'description' => $desc];
                        $parsedParams[$name] = array_filter($param);
                    }
                };

                // process params
                foreach ($method->getParameters() as $parameter) {
                    $name = $parameter->getName();
                    $param = ['name' => $name, 'optional' => $parameter->isDefaultValueAvailable()];
                    if (array_key_exists($name, $parsedParams)) {
                        $param += $parsedParams[$name];
                    }

                    if ($param['optional']) {
                        $param['default'] = $parameter->getDefaultValue();
                    }

                    $result['services'][$methodName]['parameters'][] = $param;
                }

                // set return type
                if (preg_match('/@return\s+([^\s]+)\s*([^\n\*]+)/', $docComment, $matches)) {
                    $returns = ['type' => $matches[1], 'description' => trim($matches[2])];
                    $result['services'][$methodName]['returns'] = array_filter($returns);
                }
            }
        }

        return $result;
    }
1275196
public function display()
    {
        if (!$this->visible) {
            return;
        }

        if ($this->model === null) {
            return;
        }

        parent::display();

        $show_no_records = true;
        $row_count = count($this->model);
        foreach ($this->extra_rows as $row) {
            if ($row->getVisibleByCount($row_count)) {
                $show_no_records = false;
                break;
            }
        }

        if ($row_count === 0 && $show_no_records) {
            if ($this->no_records_message != '') {
                $div = new SwatHtmlTag('div');
                $div->class = 'swat-none';
                $div->setContent(
                    $this->no_records_message,
                    $this->no_records_message_type
                );

                $div->display();
            }

            return;
        }

        $table_tag = new SwatHtmlTag('table');
        $table_tag->id = $this->id;
        $table_tag->class = $this->getCSSClassString();
        $table_tag->cellspacing = '0';

        $table_tag->open();

        if ($this->hasHeader()) {
            $this->displayHeader();
        }

        if ($this->use_invalid_tfoot_ordering) {
            $this->displayBody();
            $this->displayFooter();
        } else {
            $this->displayFooter();
            $this->displayBody();
        }

        $table_tag->close();

        Swat::displayInlineJavaScript($this->getInlineJavaScript());
    }
531522
public function getHtmlHeadEntrySet()
    {
        $set = parent::getHtmlHeadEntrySet();

        foreach ($this->columns as $column) {
            $set->addEntrySet($column->getHtmlHeadEntrySet());
        }

        foreach ($this->spanning_columns as $column) {
            $set->addEntrySet($column->getHtmlHeadEntrySet());
        }

        foreach ($this->extra_rows as $row) {
            $set->addEntrySet($row->getHtmlHeadEntrySet());
        }

        foreach ($this->groups as $group) {
            $set->addEntrySet($group->getHtmlHeadEntrySet());
        }

        return $set;
    }
1232850
public function html() {
        global $OUTPUT;

        if (!empty($this->initerrors)) {
            $warnings = '';
            foreach ($this->initerrors as $mesg) {
                $warnings .= $OUTPUT->notification($mesg);
            }
            return $warnings;
        }
        $table = new html_table();

        $table->head = $this->headers();

        $summary = $this->summary();
        if (!empty($summary)) {
            $table->summary = $summary;
        }

        // To be used for extra formatting.
        $this->index = 0;
        $this->total = count($this->items);

        foreach ($this->items as $item) {
            if ($this->index >= ($this->perpage * $this->page) &&
                $this->index < ($this->perpage * ($this->page + 1))) {
                $table->data[] = $this->format_line($item);
            }
            $this->index++;
        }

        $underlying = get_class($this);

        $data = new stdClass();
        $data->table = $table;
        $data->instance = $this;

        $buttonattr = array('class' => 'singleview_buttons submit');
        $buttonhtml = implode(' ', $this->buttons());

        $buttons = html_writer::tag('div', $buttonhtml, $buttonattr);
        $selectview = new select($this->courseid, $this->itemid, $this->groupid);

        $sessionvalidation = html_writer::empty_tag('input',
            array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));

        $html = $selectview->html();
        $html .= html_writer::tag('form',
            $buttons . html_writer::table($table) . $this->bulk_insert() . $buttons . $sessionvalidation,
            array('method' => 'POST')
        );
        $html .= $selectview->html();
        return $html;
    }
1173013
public function format()
    {
        if ($this->format === null) {
            if (null !== ($format = $this->parameters->getParam('format'))) {
                $this->format = $format;
            } else {
                $headers = getallheaders();
                if (isset($headers['Accept'])) {
                    $acceptHeader = $headers['Accept'];
                    
                    $negotiator = new FormatNegotiator();
                    $priorities = ['html', 'json', 'xml', 'js', '*.*'];
                    $this->format = $negotiator->getBestFormat($acceptHeader, $priorities) ?: 'html';
                } else {
                    $this->format = 'html';
                }
            }
        }
        return $this->format;
    }
763882
protected function renderContentSets()
    {
        $ret = '';
        $ret .= $this->start('table');
        $ret .= $this->element('caption', 'Content Sets');
        foreach ($this->def->info_content_sets as $name => $lookup) {
            $ret .= $this->heavyHeader($name);
            $ret .= $this->start('tr');
            $ret .= $this->element('td', $this->listifyTagLookup($lookup));
            $ret .= $this->end('tr');
        }
        $ret .= $this->end('table');
        return $ret;
    }
1288085
public function table()
    {
        $first = true;
        $result = "<table>\n";

        foreach ($this as $record) {
            if ($first) {
                $result .= "<tr>";
                foreach ($record as $k => $v) {
                    $result .= "<th>" . Convert::raw2xml($k) . "</th> ";
                }
                $result .= "</tr> \n";
            }

            $result .= "<tr>";
            foreach ($record as $k => $v) {
                $result .= "<td>" . Convert::raw2xml($v) . "</td> ";
            }
            $result .= "</tr> \n";

            $first = false;
        }
        $result .= "</table>\n";

        if ($first) {
            return "No records found";
        }
        return $result;
    }
517645
public function listCommand($services = [], $table_pattern = '')
    {
        foreach ($services ?: $this->_getDbServices() as $service) {
            /** @var \ManaPHP\DbInterface $db */
            $db = $this->_di->getShared($service);

            $this->console->writeLn(['service: `:service`', 'service' => $service], Console::FC_CYAN);
            foreach ($this->_getTables($service, $table_pattern) as $row => $table) {
                $columns = (array)$db->getMetadata($table)[Db::METADATA_ATTRIBUTES];
                $primaryKey = $db->getMetadata($table)[Db::METADATA_PRIMARY_KEY];
                foreach ($columns as $i => $column) {
                    if (in_array($column, $primaryKey, true)) {
                        $columns[$i] = $this->console->colorize($column, Console::FC_RED);
                    }
                }

                $this->console->writeLn([' :row :table(:columns)',
                    'row' => sprintf('%2d ', $row + 1),
                    'table' => $this->console->colorize($table, Console::FC_GREEN),
                    'columns' => implode(', ', $columns)]);
            }
        }
    }
890847
protected function _table()
    {
        return $this->_controller()
            ->loadModel(
                null,
                $this->getConfig('modelFactory') ?: $this->_controller()->getModelType()
            );
    }
1270215
public function getAvailableFormats()
    {
        try {
            $ret    = array();
            $result = $this->getSoapClient()->GetDocumentFormats();
            if ( isset($result->GetDocumentFormatsResult->string) ) {
                $ret = $result->GetDocumentFormatsResult->string;
                $ret = array_map('strtolower' , $ret);
            }

            return $ret;
        } catch ( SoapException $ex ) {
            throw new StatusException('Error while getting the list of available document formats' , $ex);
        }
    }
884577
public function getJSData()
    {
        return [
            'name'          => $this->name,
            'title'         => $this->title,
            'description'   => $this->description,
            'column'        => $this->column,
            'extraColumn'   => $this->extraColumn,
            'columnFormat'  => $this->columnFormat,
            'addForm'       => $this->addForm,
            'editForm'      => $this->editForm,
            'inputType'     => $this->inputType,
            'actions'       => $this->actions,

            'deleteOption'      => $this->deleteOption,
            'editOption'        => $this->editOption,
            'addOption'         => $this->addOption,
            'orderOption'       => $this->orderOption,
            'exportOption'      => $this->exportOption,
            'microEditOption'   => $this->microEditOption,

            'modelDefaults' => $this->modelDefaults,
            'selectOptions' => $this->selectOptions,
            'filters'       => $this->filters,
            'richFilters'   => $this->richFilters,
            'showFilters'   => $this->showFilters,
            'trans'         => $this->trans,
            'moduleInPopup' => $this->moduleInPopup,
            'customActions' => $this->customActions,
            'panelView'     => $this->panelView,
            'orderParameters' => $this->orderParameters,
            'checkboxColumn' => $this->checkboxColumn,
            'defaultSortAttr' => $this->defaultSortAttr,
            'defaultSortOrder' => $this->defaultSortOrder,
            'interfaceTrans' => $this->getInterfaceTrans(),
            'thumbnailColumns' => $this->getThumbnailColumns(),
            'dateTimePickerOptions' => $this->getDateTimePickerOptions(),

            'config' => [
                'routePrefix'    => config('crude.routePrefix'),
                'numRowsOptions' => config('crude.numRowsOptions'),
                'iconClassName'  => config('crude.iconClassName'),
                'refreshAll'     => config('crude.refreshAll'),
                'mapCenter'      => config('crude.mapCenter'),
                'sortAttr'       => $this->getOrderAttribute(),
            ],
        ];
    }