How to use getPointer method of controller class

Best Atoum code snippet using controller.getPointer

ApiGenerator.php

Source:ApiGenerator.php Github

copy

Full Screen

...418 if ($content->schema instanceof Reference) {419 $referencedSchema = $content->schema->resolve();420 // Model data is directly returned421 if ($referencedSchema->type === null || $referencedSchema->type === 'object') {422 $ref = $content->schema->getJsonReference()->getJsonPointer()->getPointer();423 if (strpos($ref, '/components/schemas/') === 0) {424 return [substr($ref, 20), '', ''];425 }426 }427 // an array of Model data is directly returned428 if ($referencedSchema->type === 'array' && $referencedSchema->items instanceof Reference) {429 $ref = $referencedSchema->items->getJsonReference()->getJsonPointer()->getPointer();430 if (strpos($ref, '/components/schemas/') === 0) {431 return [substr($ref, 20), '', ''];432 }433 }434 } else {435 $referencedSchema = $content->schema;436 }437 if ($referencedSchema === null) {438 return [null, null, null];439 }440 if ($referencedSchema->type === null || $referencedSchema->type === 'object') {441 foreach ($referencedSchema->properties as $propertyName => $property) {442 if ($property instanceof Reference) {443 $referencedModelSchema = $property->resolve();444 if ($referencedModelSchema->type === null || $referencedModelSchema->type === 'object') {445 // Model data is wrapped446 $ref = $property->getJsonReference()->getJsonPointer()->getPointer();447 if (strpos($ref, '/components/schemas/') === 0) {448 return [substr($ref, 20), $propertyName, null];449 }450 } elseif ($referencedModelSchema->type === 'array' && $referencedModelSchema->items instanceof Reference) {451 // an array of Model data is wrapped452 $ref = $referencedModelSchema->items->getJsonReference()->getJsonPointer()->getPointer();453 if (strpos($ref, '/components/schemas/') === 0) {454 return [substr($ref, 20), null, $propertyName];455 }456 }457 } elseif ($property->type === 'array' && $property->items instanceof Reference) {458 // an array of Model data is wrapped459 $ref = $property->items->getJsonReference()->getJsonPointer()->getPointer();460 if (strpos($ref, '/components/schemas/') === 0) {461 return [substr($ref, 20), null, $propertyName];462 }463 }464 }465 }466 if ($referencedSchema->type === 'array' && $referencedSchema->items instanceof Reference) {467 $ref = $referencedSchema->items->getJsonReference()->getJsonPointer()->getPointer();468 if (strpos($ref, '/components/schemas/') === 0) {469 return [substr($ref, 20), '', ''];470 }471 }472 return [null, null, null];473 }474 /**475 * Figure out whether response item is wrapped in response.476 * @param Operation $operation477 * @param $actionName478 * @param $modelClass479 * @return null|array480 */481 private function findResponseWrapper(Operation $operation, $actionName, $modelClass)482 {483 if (!isset($operation->responses)) {484 return null;485 }486 foreach ($operation->responses as $code => $successResponse) {487 if (((string) $code)[0] !== '2') {488 continue;489 }490 if ($successResponse instanceof Reference) {491 $successResponse = $successResponse->resolve();492 }493 foreach ($successResponse->content as $contentType => $content) {494 list($detectedModelClass, $itemWrapper, $itemsWrapper) = $this->guessModelClassFromContent($content);495 if (($itemWrapper !== null || $itemsWrapper !== null) && $detectedModelClass === $modelClass) {496 return [$itemWrapper, $itemsWrapper];497 }498 }499 }500 return null;501 }502 /**503 * @param Reference $reference504 * @return \ramprasadm1986\openapi\SpecObjectInterface505 */506 private function resolveReference(Reference $reference)507 {508 return $reference->resolve(new ReferenceContext($this->getOpenApi(), Yii::getAlias($this->openApiPath)));509 }510 protected function generateControllers()511 {512 $urls = $this->generateUrls();513 $c = [];514 foreach ($urls as $url) {515 $parts = explode('/', $url['route'], 2);516 $c[$parts[0]][] = [517 'id' => $parts[1],518 'params' => array_keys($url['actionParams']),519 'idParam' => $url['idParam'] ?? null,520 'modelClass' => $url['modelClass'],521 'responseWrapper' => $url['responseWrapper'],522 ];523 }524 return $c;525 }526 protected function generateModels()527 {528 $models = [];529 foreach ($this->getOpenApi()->components->schemas as $schemaName => $schema) {530 if ($schema instanceof Reference) {531 $schema = $schema->resolve();532 }533 $attributes = [];534 $relations = [];535 if ((empty($schema->type) || $schema->type === 'object') && empty($schema->properties)) {536 continue;537 }538 if (!empty($schema->type) && $schema->type !== 'object') {539 continue;540 }541 if (in_array($schemaName, $this->excludeModels)) {542 continue;543 }544 foreach ($schema->properties as $name => $property) {545 if ($property instanceof Reference) {546 $ref = $property->getJsonReference()->getJsonPointer()->getPointer();547 $resolvedProperty = $property->resolve();548 $dbName = "{$name}_id";549 $dbType = 'integer'; // for a foreign key550 if (strpos($ref, '/components/schemas/') === 0) {551 // relation552 $type = substr($ref, 20);553 $relations[$name] = [554 'class' => $type,555 'method' => 'hasOne',556 'link' => ['id' => $dbName], // TODO pk may not be 'id'557 ];558 } else {559 $type = $this->getSchemaType($resolvedProperty);560 }561 } else {562 $resolvedProperty = $property;563 $type = $this->getSchemaType($property);564 $dbName = $name;565 $dbType = $this->getDbType($name, $property);566 }567 // relation568 if (is_array($type)) {569 $relations[$name] = [570 'class' => $type[1],571 'method' => 'hasMany',572 'link' => [Inflector::camel2id($schemaName, '_') . '_id' => 'id'], // TODO pk may not be 'id'573 ];574 $type = $type[0];575 }576 $attributes[$name] = [577 'name' => $name,578 'type' => $type,579 'dbType' => $dbType,580 'dbName' => $dbName,581 'required' => false,582 'readOnly' => $resolvedProperty->readOnly ?? false,583 'description' => $resolvedProperty->description,584 'faker' => $this->guessModelFaker($name, $type, $resolvedProperty),585 ];586 }587 if (!empty($schema->required)) {588 foreach ($schema->required as $property) {589 if (!isset($attributes[$property])) {590 continue;591 }592 $attributes[$property]['required'] = true;593 }594 }595 $models[$schemaName] = [596 'name' => $schemaName,597 'tableName' => '{{%' . Inflector::camel2id(StringHelper::basename(Inflector::pluralize($schemaName)), '_') . '}}',598 'description' => $schema->description,599 'attributes' => $attributes,600 'relations' => $relations,601 ];602 }603 // TODO generate hasMany relations and inverse relations604 return $models;605 }606 /**607 * Guess faker for attribute.608 * @param string $name609 * @param string $type610 * @return string|null the faker PHP code or null.611 * @link https://github.com/fzaninotto/Faker#formatters612 */613 private function guessModelFaker($name, $type, Schema $property)614 {615 if (isset($property->{'x-faker'})) {616 return $property->{'x-faker'};617 }618 $min = $max = null;619 if (isset($property->minimum)) {620 $min = $property->minimum;621 } elseif (isset($property->exclusiveMinimum)) {622 $min = $property->exclusiveMinimum + 1;623 }624 if (isset($property->maximum)) {625 $max = $property->maximum;626 } elseif (isset($property->exclusiveMaximum)) {627 $max = $property->exclusiveMaximum - 1;628 }629 switch ($type) {630 case 'string':631 if ($property->format === 'date') {632 return '$faker->iso8601';633 }634 if (!empty($property->enum) && is_array($property->enum)) {635 return '$faker->randomElement('.var_export($property->enum, true).')';636 }637 if ($name === 'title' && isset($property->maxLength) && $property->maxLength < 10) {638 return '$faker->title';639 }640 $patterns = [641 '~_id$~' => '$uniqueFaker->numberBetween(0, 1000000)',642 '~uuid$~' => '$uniqueFaker->uuid',643 '~firstname~i' => '$faker->firstName',644 '~(last|sur)name~i' => '$faker->lastName',645 '~(username|login)~i' => '$faker->userName',646 '~(company|employer)~i' => '$faker->company',647 '~(city|town)~i' => '$faker->city',648 '~(post|zip)code~i' => '$faker->postcode',649 '~streetaddress~i' => '$faker->streetAddress',650 '~address~i' => '$faker->address',651 '~street~i' => '$faker->streetName',652 '~state~i' => '$faker->state',653 '~county~i' => 'sprintf("%s County", $faker->city)',654 '~country~i' => '$faker->countryCode',655 '~lang~i' => '$faker->languageCode',656 '~locale~i' => '$faker->locale',657 '~currency~i' => '$faker->currencyCode',658 '~hash~i' => '$faker->sha256',659 '~e?mail~i' => '$faker->safeEmail',660 '~timestamp~i' => '$faker->unixTime',661 '~.*ed_at$~i' => '$faker->dateTimeThisCentury(\'Y-m-d H:i:s\')', // created_at, updated_at, ...662 '~(phone|fax|mobile|telnumber)~i' => '$faker->e164PhoneNumber',663 '~(^lat|coord)~i' => '$faker->latitude',664 '~^lon~i' => '$faker->longitude',665 '~title~i' => '$faker->sentence',666 '~(body|summary|article|content|descr|comment|detail)~i' => '$faker->paragraphs(6, true)',667 '~(url|site|website)~i' => '$faker->url',668 ];669 foreach ($patterns as $pattern => $faker) {670 if (preg_match($pattern, $name)) {671 if (isset($property->maxLength)) {672 return 'substr(' . $faker . ', 0, ' . $property->maxLength . ')';673 } else {674 return $faker;675 }676 }677 }678 // TODO maybe also consider OpenAPI examples here679 if (isset($property->maxLength)) {680 return 'substr($faker->text(' . $property->maxLength . '), 0, ' . $property->maxLength . ')';681 }682 return '$faker->sentence';683 case 'int':684 $fakerVariable = preg_match('~_?id$~', $name) ? 'uniqueFaker' : 'faker';685 if ($min !== null && $max !== null) {686 return "\${$fakerVariable}->numberBetween($min, $max)";687 } elseif ($min !== null) {688 return "\${$fakerVariable}->numberBetween($min, PHP_INT_MAX)";689 } elseif ($max !== null) {690 return "\${$fakerVariable}->numberBetween(0, $max)";691 }692 $patterns = [693 '~timestamp~i' => '$faker->unixTime',694 '~.*ed_at$~i' => '$faker->unixTime', // created_at, updated_at, ...695 ];696 foreach ($patterns as $pattern => $faker) {697 if (preg_match($pattern, $name)) {698 return $faker;699 }700 }701 return "\${$fakerVariable}->numberBetween(0, PHP_INT_MAX)";702 case 'bool':703 return '$faker->boolean';704 case 'float':705 if ($min !== null && $max !== null) {706 return "\$faker->randomFloat(null, $min, $max)";707 } elseif ($min !== null) {708 return "\$faker->randomFloat(null, $min)";709 } elseif ($max !== null) {710 return "\$faker->randomFloat(null, 0, $max)";711 }712 return '$faker->randomFloat()';713 }714 return null;715 }716 /**717 * @param Schema $schema718 * @return string|array719 */720 protected function getSchemaType($schema)721 {722 switch ($schema->type) {723 case 'integer':724 return 'int';725 case 'boolean':726 return 'bool';727 case 'number': // can be double and float728 return 'float';729 case 'array':730 if (isset($schema->items) && $schema->items instanceof Reference) {731 $ref = $schema->items->getJsonReference()->getJsonPointer()->getPointer();732 if (strpos($ref, '/components/schemas/') === 0) {733 return [substr($ref, 20) . '[]', substr($ref, 20)];734 }735 }736 // no break here737 default:738 return $schema->type;739 }740 }741 /**742 * @param string $name743 * @param Schema $schema744 * @return string745 */746 protected function getDbType($name, $schema)747 {748 if ($name === 'id') {749 return 'pk';750 }751 switch ($schema->type) {752 case 'string':753 if (isset($schema->maxLength)) {754 return 'string(' . ((int) $schema->maxLength) . ')';755 }756 return 'text';757 case 'integer':758 case 'boolean':759 return $schema->type;760 case 'number': // can be double and float761 return $schema->format ?? 'float';762// case 'array':763 // TODO array might refer to has_many relation764// if (isset($schema->items) && $schema->items instanceof Reference) {765// $ref = $schema->items->getJsonReference()->getJsonPointer()->getPointer();766// if (strpos($ref, '/components/schemas/') === 0) {767// return substr($ref, 20) . '[]';768// }769// }770// // no break here771 default:772 return 'text';773 }774 }775 /**776 * Generates the code based on the current user input and the specified code template files.777 * This is the main method that child classes should implement.778 * Please refer to [[\yii\gii\generators\controller\Generator::generate()]] as an example779 * on how to implement this method....

Full Screen

Full Screen

crud.orig.php

Source:crud.orig.php Github

copy

Full Screen

...35 <ul>36 <li class="tabs__item" ng-class="{'tabs__item--active' : crudSwitchType==0}">37 <a class="tabs__anchor" ng-click="switchTo(0, true)"><i class="material-icons tabs__icon">menu</i> <?= Module::t('ngrest_crud_btn_list'); ?></a>38 </li>39 <?php if ($canCreate && $config->getPointer('create')): ?>40 <li class="tabs__item" ng-class="{'tabs__item--active' : crudSwitchType==1}">41 <a class="tabs__anchor" style="" ng-click="switchTo(1)"><i class="material-icons tabs__icon">add_box</i> <?= Module::t('ngrest_crud_btn_add'); ?></a>42 </li>43 <?php endif; ?>44 45 <li ng-show="crudSwitchType==2" class="tabs__item" ng-class="{'tabs__item--active' : crudSwitchType==2}">46 <a class="tabs__anchor" ng-click="switchTo(0, true)"><i class="material-icons tabs__icon">cancel</i> <?= Module::t('ngrest_crud_btn_close'); ?></a>47 </li>48 </ul>49 </div>50 <div class="langswitch crud__langswitch" ng-if="crudSwitchType!==0">51 <a ng-repeat="lang in AdminLangService.data" ng-click="AdminLangService.toggleSelection(lang)" ng-class="{'langswitch__item--active' : AdminLangService.isInSelection(lang.short_code)}" class="langswitch__item [ waves-effect waves-blue ][ btn-flat btn--small btn--bold ] ng-binding ng-scope">52 <span class="flag flag--{{lang.short_code}}">53 <span class="flag__fallback">{{lang.name}}</span>54 </span>55 </a>56 </div>57 58 <!-- LIST -->59 <div class="card-panel" ng-show="crudSwitchType==0">60 <div class="button-right" style="margin-bottom:30px;">61 <div class="button-right__left">62 <div class="row">63 <div class="col <?php if (!empty($config->filters)): ?>m12 l6<?php else: ?>m6 l8<?php endif; ?>">64 <div class="input input--text">65 <div class="input__field-wrapper">66 <input class="input__field" id="searchString" ng-model="searchString" ng-change="evalSearchString()" type="text" placeholder="<?= Module::t('ngrest_crud_search_text'); ?>" />67 </div>68 </div>69 </div>70 <div class="col <?php if (!empty($config->filters)): ?>m6 l3<?php else: ?>m12 l4<?php endif; ?>">71 <div class="input input--select input--vertical input--full-width">72 <div class="input__field-wrapper">73 <i class="input__select-arrow material-icons">keyboard_arrow_down</i>74 <select class="input__field" ng-change="changeGroupByField()" ng-model="groupByField">75 <option value="0">Nach Feld gruppieren</option>76 <?php foreach ($config->getPointer('list') as $item): ?>77 <option value="<?= $item['name']; ?>"><?= $item['alias']; ?></option>78 <?php endforeach; ?>79 </select>80 </div>81 </div>82 </div>83 <?php if (!empty($config->filters)): ?>84 <div class="col m6 l3">85 <div class="input input--select input--vertical input--full-width">86 <div class="input__field-wrapper">87 <i class="input__select-arrow material-icons">keyboard_arrow_down</i>88 <select class="input__field" ng-change="realoadCrudList()" ng-model="currentFilter">89 <option value="0">Filter auswählen</option>90 <?php foreach (array_keys($config->filters) as $name): ?>91 <option value="<?= $name; ?>"><?= $name; ?></option>92 <?php endforeach; ?>93 </select>94 </div>95 </div>96 </div>97 <?php endif; ?>98 </div>99 </div>100 <div class="button-right__right">101 <div>102 <button type="button" ng-show="!exportDownloadButton && !exportLoading" ng-click="exportData()" class="btn cyan btn--small" style="width: 100%;">103 <i class="material-icons left">unarchive</i> <?= Module::t('ngrest_crud_csv_export_btn'); ?>104 </button>105 <div ng-show="exportLoading" class="btn disabled btn--small center" style="width: 100%;"><i class="material-icons spin">cached</i></div>106 <div ng-show="exportDownloadButton">107 <button ng-click="exportDownload()" class="btn light-green btn--small" type="button" style="width: 100%;"><i class="material-icons left">file_download</i> <?= Module::t('ngrest_crud_csv_export_btn_dl'); ?></button>108 </div>109 </div>110 </div>111 </div>112 113 <div ng-if="pager" style="text-align: center;">114 <ul class="pagination">115 <li class="waves-effect" ng-class="{'disabled' : pager.currentPage == 1}" ng-click="pagerPrevClick()"><a><i class="material-icons">chevron_left</i></a></li>116 <li class="waves-effect" ng-repeat="pageId in pager.pages" ng-class="{'active': pageId == pager.currentPage}" ng-click="realoadCrudList(pageId)">117 <a>{{pageId}}</a>118 </li> 119 <li class="waves-effect" ng-class="{'disabled' : pager.currentPage == pager.pageCount}" ng-click="pagerNextClick()"><a><i class="material-icons">chevron_right</i></a></li>120 </ul>121 </div>122 123 <table class="striped responsive-table hoverable">124 <thead>125 <tr>126 <?php foreach ($config->getPointer('list') as $item): ?>127 <th ng-hide="groupBy && groupByField == '<?= $item['name']; ?>'"><?php echo $item['alias']; ?> <i ng-click="changeOrder('<?php echo $item['name']; ?>', '+')" ng-class="{'active-orderby' : isOrderBy('+<?php echo $item['name']; ?>') }" class="material-icons grid-sort-btn">keyboard_arrow_up</i> <i ng-click="changeOrder('<?php echo $item['name']; ?>', '-')" ng-class="{'active-orderby' : isOrderBy('-<?php echo $item['name']; ?>') }" class="material-icons grid-sort-btn">keyboard_arrow_down</i></th>128 <?php endforeach; ?>129 <?php if (count($this->context->getButtons()) > 0): ?>130 <th style="text-align:right;"><span class="grid-data-length">{{data.list.length}} <?= Module::t('ngrest_crud_rows_count'); ?></span></th>131 <?php endif; ?>132 </tr>133 </thead>134 <tbody ng-repeat="(key, items) in data.list | srcbox:searchString | groupBy: groupByField" ng-init="viewToggler[key]=true">135 <tr ng-if="groupBy" class="table__group">136 <td colspan="100"> <!--ng-click="IS IT THIS?"-->137 <strong>{{key}}</strong>138 <i class="material-icons right" ng-click="viewToggler[key]=true" ng-show="!viewToggler[key]">keyboard_arrow_up</i>139 <i class="material-icons right" ng-click="viewToggler[key]=false" ng-show="viewToggler[key]">keyboard_arrow_down</i>140 </td>141 </tr>142 <tr ng-repeat="(k, item) in items | srcbox:searchString" ng-show="viewToggler[key]" ng-class="{'crud__item-highlight': isHighlighted(item)}">143 <?php foreach ($config->getPointer('list') as $item): ?>144 <?php foreach ($this->context->createElements($item, RenderCrud::TYPE_LIST) as $element): ?>145 <td ng-hide="groupBy && groupByField == '<?= $item['name']; ?>'"><?php echo $element['html']; ?></td>146 <?php endforeach; ?>147 <?php endforeach; ?>148 <?php if (count($this->context->getButtons()) > 0): ?>149 <td style="text-align:right;">150 <?php foreach ($this->context->getButtons() as $item): ?>151 <a class="crud__button waves-effect waves-light btn-flat btn--bordered" ng-click="<?php echo $item['ngClick']; ?>"><i class="material-icons<?php if (!empty($item['label'])): ?> left<?php endif; ?>"><?php echo $item['icon']; ?></i><?php echo $item['label']; ?></a>152 <?php endforeach; ?>153 </td>154 <?php endif; ?>155 </tr>156 </tbody>157 </table>158 159 <div ng-if="pager" style="text-align: center;">160 <ul class="pagination">161 <li class="waves-effect" ng-class="{'disabled' : pager.currentPage == 1}" ng-click="pagerPrevClick()"><a><i class="material-icons">chevron_left</i></a></li>162 <li class="waves-effect" ng-repeat="pageId in pager.pages" ng-class="{'active': pageId == pager.currentPage}" ng-click="realoadCrudList(pageId)">163 <a>{{pageId}}</a>164 </li> 165 <li class="waves-effect" ng-class="{'disabled' : pager.currentPage == pager.pageCount}" ng-click="pagerNextClick()"><a><i class="material-icons">chevron_right</i></a></li>166 </ul>167 </div>168 169 <div ng-show="data.list.length == 0" class="alert alert--info"><?= Module::t('ngrest_crud_empty_row'); ?></div>170 </div>171 <!-- /LIST -->172 173 <div class="card-panel" ng-show="crudSwitchType==1" <?php if (!$config->inline): ?>zaa-esc="closeCreate()"<?php endif; ?>>174 <?php if ($canCreate && $config->getPointer('create')): ?>175 <form name="formCreate" role="form" ng-submit="submitCreate()">176 <!-- MODAL CONTENT -->177 <div class="modal__content">178 <?php foreach ($this->context->forEachGroups(RenderCrud::TYPE_CREATE) as $key => $group): ?>179 <?php if (!$group['is_default']): ?>180 <div class="form-group" ng-init="groupToggler[<?= $key; ?>] = <?= (int) !$group['collapsed']; ?>">181 <p class="form-group__title" ng-click="groupToggler[<?= $key; ?>] = !groupToggler[<?= $key; ?>]">182 <?= $group['name']; ?>183 <span class="material-icons right" ng-show="groupToggler[<?= $key; ?>]">keyboard_arrow_up</span>184 <span class="material-icons right" ng-show="!groupToggler[<?= $key; ?>]">keyboard_arrow_down</span>185 </p>186 <div class="form-group__fields" ng-show="groupToggler[<?= $key; ?>]">187 <?php endif; ?>188 <?php foreach ($group['fields'] as $field => $fieldItem): ?>189 <div class="row">190 <?php foreach ($this->context->createElements($fieldItem, RenderCrud::TYPE_CREATE) as $element): ?>191 <?php echo $element['html']; ?>192 <?php endforeach; ?>193 </div>194 <?php endforeach; ?>195 <?php if (!$group['is_default']): ?>196 </div> <!-- /.form-group__fields -->197 </div> <!-- /.form-group -->198 <?php endif; ?>199 <?php endforeach; ?>200 </div>201 <div class="modal__footer">202 <div class="row">203 <div class="col s12">204 <div class="right">205 <button class="btn waves-effect waves-light" type="submit" ng-disabled="createForm.$invalid">206 <?= Module::t('ngrest_crud_btn_create'); ?> <i class="material-icons right">check</i>207 </button>208 <button class="btn waves-effect waves-light red" type="button" ng-click="closeCreate()">209 <i class="material-icons left">cancel</i> <?= Module::t('button_abort'); ?>210 </button>211 </div>212 </div>213 </div>214 </div>215 </form>216 <?php endif; ?>217 </div>218 219 <div class="card-panel" ng-show="crudSwitchType==2" <?php if (!$config->inline): ?>zaa-esc="closeUpdate()"<?php endif; ?>>220 <?php if ($canUpdate && $config->getPointer('update')): ?>221 <form name="formUpdate" role="form" ng-submit="submitUpdate()">222 <!-- MODAL CONTENT -->223 <div class="modal__content">224 <?php foreach ($this->context->forEachGroups(RenderCrud::TYPE_UPDATE) as $key => $group): ?>225 <?php if (!$group['is_default']): ?>226 <div ng-init="groupToggler[<?= $key; ?>] = <?= (int) !$group['collapsed']; ?>">227 <h5 ng-click="groupToggler[<?= $key; ?>] = !groupToggler[<?= $key; ?>]"><?= $group['name']; ?> +/- Toggler</h5>228 <div style="border:1px solid #F0F0F0; margin-bottom:20px;" ng-show="groupToggler[<?= $key; ?>]">229 <?php endif; ?>230 <?php foreach ($group['fields'] as $field => $fieldItem): ?>231 <div class="row">232 <?php foreach ($this->context->createElements($fieldItem, RenderCrud::TYPE_UPDATE) as $element): ?>233 <?php echo $element['html']; ?>234 <?php endforeach; ?>...

Full Screen

Full Screen

crud.php

Source:crud.php Github

copy

Full Screen

...46 <i class="material-icons">list</i>47 <span><?= Module::t('ngrest_crud_btn_list'); ?></span>48 </a>49 </li>50 <?php if ($canCreate && $config->getPointer('create')): ?>51 <li class="nav-item">52 <a class="nav-link" ng-class="{'active':crudSwitchType==1}" ng-click="switchTo(1)">53 <i class="material-icons">add_box</i>54 <span><?= Module::t('ngrest_crud_btn_add'); ?></span>55 </a>56 </li>57 <?php endif; ?>58 <li class="nav-item" ng-show="crudSwitchType==2">59 <a class="nav-link" ng-class="{'active' : crudSwitchType==2}" ng-click="switchTo(0, true)">60 <i class="material-icons">cancel</i>61 <span><?= Module::t('ngrest_crud_btn_close'); ?></span>62 </a>63 </li>64 <?php if (!$isInline): ?>65 <li class="nav-item" ng-repeat="(index,btn) in tabService.tabs">66 <a class="nav-link" ng-class="{'active' : btn.active}">67 <i class="material-icons" ng-click="closeTab(btn, index)">cancel</i>68 <span ng-click="switchToTab(btn)">{{btn.name}} <small class="badge badge-secondary">#{{btn.id}}</small></span>69 </a>70 </li>71 <?php endif; ?>72 <li class="nav-item nav-item-alternative" ng-repeat="lang in AdminLangService.data" ng-class="{'ml-auto' : $first}" ng-show="AdminLangService.data.length > 1">73 <a class="nav-link" ng-click="AdminLangService.toggleSelection(lang)" ng-class="{'active' : AdminLangService.isInSelection(lang.short_code)}" role="tab">74 <span class="flag flag-{{lang.short_code}}">75 <span class="flag-fallback">{{lang.name}}</span>76 </span>77 </a>78 </li>79 </ul>80 <?php endif; ?>81 <div class="tab-content">82 <?php if (!$relationCall && !$isInline): ?>83 <div class="tab-pane" ng-repeat="btn in tabService.tabs" ng-class="{'active' : btn.active}" ng-if="btn.active">84 <crud-relation-loader api="{{btn.api}}" array-index="{{btn.arrayIndex}}" model-class="{{btn.modelClass}}" id="{{btn.id}}"></crud-relation-loader>85 </div>86 <?php endif; ?>87 <div class="tab-pane" ng-if="crudSwitchType==0" ng-class="{'active' : crudSwitchType==0}">88 <div class="tab-padded">89 <div class="row mt-2">90 <div class="col-md-4 col-lg-6 col-xl-6 col-xxxl-8">91 <div class="input-group mb-2 mr-sm-2 mb-sm-0">92 <div class="input-group-addon">93 <i class="material-icons">search</i>94 </div>95 <input class="form-control" ng-model="config.searchQuery" type="text" placeholder="<?= Module::t('ngrest_crud_search_text'); ?>">96 </div>97 </div>98 <div class="col-md-4 col-lg-3 col-xl-3 col-xxxl-2">99 <select class="form-control" ng-change="changeGroupByField()" ng-model="config.groupByField">100 <option value="0"><?= Module::t('ngrest_crud_group_prompt'); ?></option>101 <?php foreach ($config->getPointer('list') as $item): ?>102 <option value="<?= $item['name']; ?>"><?= $item['alias']; ?></option>103 <?php endforeach; ?>104 </select>105 </div>106 <?php if (!empty($config->getFilters())): ?>107 <div class="col-md-4 col-lg-3 col-xl-3 col-xxxl-2">108 <select class="form-control" ng-model="config.filter" ng-change="changeNgRestFilter()">109 <option value="0"><?= Module::t('ngrest_crud_filter_prompt'); ?></option>110 <?php foreach (array_keys($config->getFilters()) as $name): ?>111 <option value="<?= $name; ?>"><?= $name; ?></option>112 <?php endforeach; ?>113 </select>114 </div>115 <?php endif; ?>116 </div>117 </div>118 <?php if ($relationCall && $canCreate && $config->getPointer('create')): ?>119 <button type="button" class="btn btn-add ml-3 mt-3" ng-click="switchTo(1)">120 <i class="material-icons">add_box</i>121 <span><?= Module::t('ngrest_crud_btn_add'); ?></span>122 </button>123 <?php endif; ?>124 <small class="crud-counter">{{data.listArray.length}} of {{totalRows}}</small>125 <div class="table-responsive-wrapper">126 <table class="table table-hover table-align-middle table-striped mt-0">127 <thead class="thead-default">128 <tr>129 <?php foreach ($config->getPointer('list') as $item): ?>130 <th class="tab-padding-left">131 <div class="table-sorter-wrapper" ng-class="{'is-active' : isOrderBy('+<?= $item['name']; ?>') || isOrderBy('-<?= $item['name']; ?>') }">132 <?php if ($config->getDefaultOrderField()): ?>133 <div class="table-sorter table-sorter-up" ng-click="changeOrder('<?= $item['name']; ?>', '-')" ng-class="{'is-sorting': !isOrderBy('-<?= $item['name']; ?>')}">134 <span><?= $item['alias']; ?></span>135 <i class="material-icons">keyboard_arrow_up</i>136 </div>137 <div class="table-sorter table-sorter-down" ng-click="changeOrder('<?= $item['name']; ?>', '+')" ng-class="{'is-sorting': !isOrderBy('+<?= $item['name']; ?>')}">138 <span><?= $item['alias']; ?></span>139 <i class="material-icons">keyboard_arrow_down</i>140 </div>141 <?php else: ?>142 <span><?= $item['alias']; ?></span>143 <?php endif; ?>144 </div>145 </th>146 <?php endforeach; ?>147 <th class="crud-buttons-column"></th>148 </tr>149 </thead>150 <tbody ng-repeat="(key, items) in data.listArray | groupBy: config.groupByField" ng-init="viewToggler[key]=true">151 <tr ng-if="config.groupBy" class="table-group" ng-click="viewToggler[key]=!viewToggler[key]">152 <td colspan="<?= count($config->getPointer('list')) + 1 ?>">153 <strong>{{key}}</strong>154 <i class="material-icons right" ng-show="!viewToggler[key]">keyboard_arrow_right</i>155 <i class="material-icons right" ng-show="viewToggler[key]">keyboard_arrow_down</i>156 </td>157 </tr>158 <tr ng-repeat="(k, item) in items track by k | srcbox:config.searchString" ng-show="viewToggler[key]" <?php if ($isInline && !$relationCall): ?>ng-click="parentSelectInline(item)" <?php if ($modelSelection): ?>ng-class="{'crud-selected-row': getRowPrimaryValue(item) == <?= $modelSelection?>}"<?php endif; ?> class="crud-selectable-row"<?php endif; ?>>159 <?php $i = 0; foreach ($config->getPointer('list') as $item): $i++; ?>160 <?php foreach ($this->context->createElements($item, RenderCrud::TYPE_LIST) as $element): ?>161 <td class="<?= $i != 1 ?: 'tab-padding-left'; ?>"><?= $element['html']; ?></td>162 <?php endforeach; ?>163 <?php endforeach; ?>164 <td class="crud-buttons-column" ng-hide="isLocked(config.tableName, item[config.pk])">165 <?php if (count($this->context->getButtons()) > 0): ?>166 <div class="crud-buttons">167 <i class="crud-buttons-toggler material-icons">more_vert</i>168 <div class="crud-buttons-pan">169 <?php foreach ($this->context->getButtons() as $item): ?>170 <button type="button" class="crud-buttons-button" ng-click="<?= $item['ngClick']; ?>"><i class="material-icons"><?= $item['icon']; ?></i><?php if (!empty($item["label"])): echo "<span class=\"btn-crud-label\">". $item["label"] . "</span>"; endif; ?></span></button>171 <?php endforeach; ?>172 </div>173 </div>174 <?php endif; ?>175 </td>176 <td class="text-right" ng-show="isLocked(config.tableName, item[config.pk])">177 <small><i class="material-icons btn-symbol">lock_outline</i><?= Module::t('locked_info'); ?></small>178 </td>179 </tr>180 </tbody>181 </table>182 </div>183 <div ng-show="data.list.length == 0" class="alert"><?= Module::t('ngrest_crud_empty_row'); ?></div>184 <div class="pagination-wrapper" ng-if="pager && !config.pagerHiddenByAjaxSearch">185 <div class="pagination">186 <ul class="pagination-list" has-enough-space loading-condition="pager && !config.pagerHiddenByAjaxSearch">187 <li class="page-item page-item-icon" ng-class="{'disabled' : pager.currentPage == 1}" >188 <a class="page-link" ng-click="pagerPrevClick()"><i class="material-icons">keyboard_arrow_left</i></a>189 </li>190 <li class="page-item" ng-repeat="pageId in pager.pages" ng-class="{'active': pageId == pager.currentPage}">191 <a class="page-link" ng-click="reloadCrudList(pageId)">{{pageId}}</a>192 </li>193 <li class="page-item page-item-icon" ng-class="{'disabled' : pager.currentPage == pager.pageCount}">194 <a class="page-link" ng-click="pagerNextClick();"><i class="material-icons">keyboard_arrow_right</i></a>195 </li>196 </ul>197 <ul class="pagination-list pagination-list-small">198 <li class="page-item page-item-icon" ng-class="{'disabled' : pager.currentPage == 1}" >199 <a class="page-link" ng-click="pagerPrevClick()"><i class="material-icons">keyboard_arrow_left</i></a>200 </li>201 <li class="page-item">202 <div class="btn-group" role="group" ng-init="openDropdown = false" ng-class="{'show': openDropdown}">203 <button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" ng-click="openDropdown = !openDropdown">204 {{pager.currentPage}}205 </button>206 <div class="dropdown-menu" aria-labelledby="btnGroupDrop1" ng-class="{'show': openDropdown}">207 <button class="dropdown-item" ng-repeat="pageId in pager.pages" ng-show="pager.currentPage != pageId" ng-click="reloadCrudList(pageId); openDropdown = false;">{{pageId}}</button>208 </div>209 </div>210 </li>211 <li class="page-item page-item-icon" ng-class="{'disabled' : pager.currentPage == pager.pageCount}">212 <a class="page-link" ng-click="pagerNextClick();"><i class="material-icons">keyboard_arrow_right</i></a>213 </li>214 </ul>215 </div>216 </div>217 </div>218 <?php if ($canCreate && $config->getPointer('create')): ?>219 <?= $this->render('_crudform', ['type' => '1', 'renderer' => RenderCrud::TYPE_CREATE, 'isInline' => $isInline, 'relationCall' => $relationCall]); ?>220 <?php endif; ?>221 <?php if ($canUpdate && $config->getPointer('update')): ?>222 <?= $this->render('_crudform', ['type' => '2', 'renderer' => RenderCrud::TYPE_UPDATE, 'isInline' => $isInline, 'relationCall' => $relationCall]); ?>223 <?php endif; ?>224 <?= $this->render('_awform'); ?>225 </div>226</div>227<?php $this->endBody(); ?>228<?php $this->endPage(); ?>...

Full Screen

Full Screen

getPointer

Using AI Code Generation

copy

Full Screen

1$obj->getPointer('1.php');2$obj->getPointer('2.php');3$obj->getPointer('3.php');4$obj->getPointer('4.php');5$obj->getPointer('5.php');6$obj->getPointer('6.php');7$obj->getPointer('7.php');8$obj->getPointer('8.php');9$obj->getPointer('9.php');10$obj->getPointer('10.php');11$obj->getPointer('11.php');12$obj->getPointer('12.php');13$obj->getPointer('13.php');14$obj->getPointer('14.php');15$obj->getPointer('15.php');16$obj->getPointer('16.php');17$obj->getPointer('17.php');18$obj->getPointer('18.php');19$obj->getPointer('19.php');

Full Screen

Full Screen

getPointer

Using AI Code Generation

copy

Full Screen

1$getPointer = $this->getPointer();2$getPointer = $this->getPointer();3$getPointer = $this->getPointer();4$getPointer = $this->getPointer();5$getPointer = $this->getPointer();6$getPointer = $this->getPointer();7$getPointer = $this->getPointer();8$getPointer = $this->getPointer();9$getPointer = $this->getPointer();10$getPointer = $this->getPointer();11$getPointer = $this->getPointer();12$getPointer = $this->getPointer();13$getPointer = $this->getPointer();

Full Screen

Full Screen

getPointer

Using AI Code Generation

copy

Full Screen

1$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");2$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");3$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");4$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");5$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");6$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");7$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");8$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");9$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");10$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");11$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");12$this->getPointer('controller')->getPointer('model')->getPointer('db')->query("SELECT * FROM table");

Full Screen

Full Screen

getPointer

Using AI Code Generation

copy

Full Screen

1$fp = $this->getPointer('1.php');2$content = fread($fp, filesize('1.php'));3fclose($fp);4fwrite($fp, $content);5fclose($fp);6$this->setPointer('1.php', $fp);7$fp = $this->getPointer('2.php');8$content = fread($fp, filesize('2.php'));9fclose($fp);10fwrite($fp, $content);11fclose($fp);12$this->setPointer('2.php', $fp);13$fp = $this->getPointer('3.php');14$content = fread($fp, filesize('3.php'));15fclose($fp);16fwrite($fp, $content);17fclose($fp);18$this->setPointer('3.php', $fp);19$fp = $this->getPointer('4.php');20$content = fread($fp, filesize('4.php'));21fclose($fp);22fwrite($fp, $content);23fclose($fp);24$this->setPointer('4.php', $

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in controller

Trigger getPointer code on LambdaTest Cloud Grid

Execute automation tests with getPointer on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful