How to use make method of variable class

Best Atoum code snippet using variable.make

Variables.php

Source:Variables.php Github

copy

Full Screen

...28 }29 $this->generateSidebar('variables');30 $this->stdHeader();31 $this->msm = (ee()->config->item('multiple_sites_enabled') == 'y');32 // make sure all variables are synced from the filesystem33 ee('Model')->make('GlobalVariable')->loadAll();34 }35 public function index()36 {37 if (ee()->input->post('bulk_action') == 'remove') {38 $this->remove(ee()->input->post('selection'));39 ee()->functions->redirect(ee('CP/URL')->make('design/variables', ee()->cp->get_url_state()));40 } elseif (ee()->input->post('bulk_action') == 'export') {41 $this->exportVariables(ee()->input->post('selection'));42 }43 $vars = array();44 $table = ee('CP/Table', array('autosort' => false));45 $columns = array(46 'variable',47 'all_sites' => array(48 'encode' => false49 ),50 'manage' => array(51 'type' => Table::COL_TOOLBAR52 ),53 array(54 'type' => Table::COL_CHECKBOX55 )56 );57 if (! $this->msm) {58 unset($columns['all_sites']);59 }60 $variable_id = ee()->session->flashdata('variable_id');61 $table->setColumns($columns);62 $data = array();63 $variables = ee('Model')->get('GlobalVariable')64 ->filter('site_id', 'IN', array(0, ee()->config->item('site_id')));65 $this->base_url = ee('CP/URL')->make('design/variables');66 $total = $variables->count();67 $filters = ee('CP/Filter')68 ->add('Keyword')69 ->add('Perpage', $variables->count(), 'show_all_variables');70 // Before pagination so perpage is set correctly71 $this->renderFilters($filters);72 $sort_col = $table->sort_col;73 $sort_map = array(74 'all_sites' => 'site_id',75 'variable' => 'variable_name'76 );77 if (! array_key_exists($sort_col, $sort_map)) {78 throw new \Exception("Invalid sort column: " . htmlentities($sort_col));79 }80 $variable_data = $variables->order($sort_map[$sort_col], $table->sort_dir)81 ->limit($this->perpage)82 ->offset($this->offset);83 if (isset($this->params['filter_by_keyword'])) {84 $variable_data->search(['variable_name', 'variable_data'], $this->params['filter_by_keyword']);85 }86 $variable_data = $variable_data->all();87 foreach ($variable_data as $variable) {88 if ($variable->site_id == 0) {89 $all_sites = '<b class="yes">' . lang('yes') . '</b>';90 } else {91 $all_sites = '<b class="no">' . lang('no') . '</b>';92 }93 $edit_url = ee('CP/URL')->make('design/variables/edit/' . $variable->variable_id);94 $column = array(95 array(96 'content' => $variable->variable_name,97 'href' => $edit_url98 ),99 $all_sites,100 array('toolbar_items' => array(101 'edit' => array(102 'href' => $edit_url,103 'title' => lang('edit')104 ),105 'find' => array(106 'href' => ee('CP/URL')->make('design/template/search', array('search' => '{' . $variable->variable_name . '}')),107 'title' => lang('find')108 ),109 )),110 array(111 'name' => 'selection[]',112 'value' => $variable->variable_id,113 'data' => array(114 'confirm' => lang('template_variable') . ': <b>' . htmlentities($variable->variable_name, ENT_QUOTES, 'UTF-8') . '</b>'115 )116 )117 );118 $attrs = array();119 if ($variable_id && $variable->variable_id == $variable_id) {120 $attrs = array('class' => 'selected');121 }122 if (! $this->msm) {123 unset($column[1]);124 }125 $data[] = array(126 'attrs' => $attrs,127 'columns' => $column128 );129 }130 $table->setNoResultsText('no_template_variables');131 $table->setData($data);132 $vars['table'] = $table->viewData($this->base_url);133 $vars['form_url'] = $vars['table']['base_url'];134 if (! empty($vars['table']['data'])) {135 // Paginate!136 $vars['pagination'] = ee('CP/Pagination', $total)137 ->perPage($this->perpage)138 ->currentPage($this->page)139 ->render($this->base_url);140 }141 ee()->javascript->set_global('lang.remove_confirm', lang('template_variable') . ': <b>### ' . lang('template_variables') . '</b>');142 ee()->cp->add_js_script(array(143 'file' => array('cp/confirm_remove'),144 ));145 $this->stdHeader();146 ee()->view->cp_page_title = lang('template_manager');147 ee()->view->cp_heading = lang('template_variables_header');148 ee()->view->cp_breadcrumbs = array(149 '' => lang('template_variables')150 );151 ee()->cp->render('design/variables/index', $vars);152 }153 public function create()154 {155 if (! ee('Permission')->can('create_template_variables')) {156 show_error(lang('unauthorized_access'), 403);157 }158 $vars = array(159 'ajax_validate' => true,160 'base_url' => ee('CP/URL')->make('design/variables/create'),161 'save_btn_text' => sprintf(lang('btn_save'), lang('template_variable')),162 'save_btn_text_working' => 'btn_saving',163 'sections' => array(164 array(165 array(166 'title' => 'variable_name',167 'fields' => array(168 'variable_name' => array(169 'type' => 'text',170 'required' => true171 )172 )173 ),174 array(175 'title' => 'variable_data',176 'wide' => true,177 'fields' => array(178 'variable_data' => array(179 'type' => 'textarea',180 'attrs' => 'class="textarea-medium"'181 )182 )183 ),184 )185 )186 );187 if ($this->msm) {188 $vars['sections'][0][] = array(189 'title' => 'enable_template_variable_on_all_sites',190 'desc' => 'enable_template_variable_on_all_sites_desc',191 'fields' => array(192 'site_id' => array(193 'type' => 'inline_radio',194 'choices' => array(195 '0' => 'all_sites',196 ee()->config->item('site_id') => ee()->config->item('site_label') . ' ' . lang('only')197 ),198 'encode' => false,199 'value' => '0',200 )201 )202 );203 } else {204 $vars['form_hidden'] = array(205 'site_id' => ee()->config->item('site_id')206 );207 }208 if (! empty($_POST)) {209 $variable = ee('Model')->make('GlobalVariable');210 $variable->site_id = ee()->input->post('site_id');211 $variable->variable_name = ee()->input->post('variable_name');212 $variable->variable_data = ee()->input->post('variable_data');213 214 $result = $variable->validate();215 if (isset($_POST['ee_fv_field']) && $response = $this->ajaxValidation($result)) {216 return $response;217 }218 if ($result->isValid()) {219 $variable->save();220 ee()->session->set_flashdata('variable_id', $variable->variable_id);221 ee('CP/Alert')->makeInline('shared-form')222 ->asSuccess()223 ->withTitle(lang('create_template_variable_success'))224 ->addToBody(sprintf(lang('create_template_variable_success_desc'), $variable->variable_name))225 ->defer();226 ee()->functions->redirect(ee('CP/URL')->make('design/variables'));227 } else {228 ee('CP/Alert')->makeInline('shared-form')229 ->asIssue()230 ->withTitle(lang('create_template_variable_error'))231 ->addToBody(lang('create_template_variable_error_desc'))232 ->now();233 }234 }235 $this->loadCodeMirrorAssets('variable_data');236 ee()->view->cp_page_title = lang('create_template_variable');237 ee()->view->cp_breadcrumbs = array(238 ee('CP/URL')->make('design/variables')->compile() => lang('template_variables'),239 '' => lang('create_template_variable')240 );241 ee()->cp->render('settings/form', $vars);242 }243 public function edit($variable_id)244 {245 if (! ee('Permission')->can('edit_template_variables')) {246 show_error(lang('unauthorized_access'), 403);247 }248 $variable = ee('Model')->get('GlobalVariable')249 ->filter('variable_id', $variable_id)250 ->filterGroup()251 ->filter('site_id', ee()->config->item('site_id'))252 ->orFilter('site_id', 0)253 ->endFilterGroup()254 ->first();255 if (! $variable) {256 show_404();257 }258 $vars = array(259 'ajax_validate' => true,260 'base_url' => ee('CP/URL')->make('design/variables/edit/' . $variable_id),261 'form_hidden' => array(262 'old_name' => $variable->variable_name263 ),264 'save_btn_text' => sprintf(lang('btn_save'), lang('template_variable')),265 'save_btn_text_working' => 'btn_saving',266 'sections' => array(267 array(268 array(269 'title' => 'variable_name',270 'fields' => array(271 'variable_name' => array(272 'type' => 'text',273 'required' => true,274 'value' => $variable->variable_name275 )276 )277 ),278 array(279 'title' => 'variable_data',280 'wide' => true,281 'fields' => array(282 'variable_data' => array(283 'type' => 'textarea',284 'attrs' => 'class="textarea-medium"',285 'value' => $variable->variable_data286 )287 )288 ),289 )290 )291 );292 if ($this->msm) {293 $vars['sections'][0][] = array(294 'title' => 'enable_template_variable_on_all_sites',295 'desc' => 'enable_template_variable_on_all_sites_desc',296 'fields' => array(297 'site_id' => array(298 'type' => 'inline_radio',299 'choices' => array(300 '0' => 'all_sites',301 ee()->config->item('site_id') => ee()->config->item('site_label') . ' ' . lang('only')302 ),303 'value' => $variable->site_id,304 'encode' => false,305 )306 )307 );308 }309 if (! empty($_POST)) {310 if ($this->msm) {311 $variable->site_id = ee()->input->post('site_id');312 }313 $variable->variable_name = ee()->input->post('variable_name');314 $variable->variable_data = ee()->input->post('variable_data');315 $result = $variable->validate();316 if (isset($_POST['ee_fv_field']) && $response = $this->ajaxValidation($result)) {317 return $response;318 }319 if ($result->isValid()) {320 $variable->save();321 ee()->session->set_flashdata('variable_id', $variable->variable_id);322 ee('CP/Alert')->makeInline('shared-form')323 ->asSuccess()324 ->withTitle(lang('edit_template_variable_success'))325 ->addToBody(sprintf(lang('edit_template_variable_success_desc'), $variable->variable_name))326 ->defer();327 ee()->functions->redirect(ee('CP/URL')->make('design/variables'));328 } else {329 ee('CP/Alert')->makeInline('shared-form')330 ->asIssue()331 ->withTitle(lang('edit_template_variable_error'))332 ->addToBody(lang('edit_template_variable_error_desc'))333 ->now();334 }335 }336 $this->loadCodeMirrorAssets('variable_data');337 ee()->view->cp_page_title = lang('edit_template_variable');338 ee()->view->cp_breadcrumbs = array(339 ee('CP/URL')->make('design/variables')->compile() => lang('template_variables'),340 '' => lang('edit_template_variable')341 );342 ee()->cp->render('settings/form', $vars);343 }344 /**345 * Removes variables346 *347 * @param int|array $variable_ids The ids of variables to remove348 * @return void349 */350 private function remove($variable_ids)351 {352 if (! ee('Permission')->can('delete_template_variables')) {353 show_error(lang('unauthorized_access'), 403);354 }355 if (! is_array($variable_ids)) {356 $variable_ids = array($variable_ids);357 }358 $variables = ee('Model')->get('GlobalVariable', $variable_ids)359 ->filterGroup()360 ->filter('site_id', ee()->config->item('site_id'))361 ->orFilter('site_id', 0)362 ->endFilterGroup()363 ->all();364 $names = $variables->pluck('variable_name');365 $variables->delete();366 ee('CP/Alert')->makeInline('variable-form')367 ->asSuccess()368 ->withTitle(lang('success'))369 ->addToBody(lang('template_variables_deleted_desc'))370 ->addToBody($names)371 ->defer();372 }373 /**374 * Export variables375 *376 * @param int|array $variable_ids The ids of variables to export377 * @return void378 */379 private function exportVariables($variable_ids)380 {381 if (! is_array($variable_ids)) {382 $variable_ids = array($variable_ids);383 }384 // Create the Zip Archive385 $zipfilename = tempnam(sys_get_temp_dir(), '');386 $zip = new ZipArchive();387 if ($zip->open($zipfilename, ZipArchive::CREATE) !== true) {388 ee('CP/Alert')->makeInline('shared-form')389 ->asIssue()390 ->withTitle(lang('error_export'))391 ->addToBody(lang('error_cannot_create_zip'))392 ->now();393 return;394 }395 // Loop through variables and add them to the zip396 $variables = ee('Model')->get('GlobalVariable', $variable_ids)397 ->filter('site_id', ee()->config->item('site_id'))398 ->all()399 ->each(function ($variable) use ($zip) {400 $zip->addFromString($variable->variable_name . '.html', $variable->variable_data);401 });402 $zip->close();...

Full Screen

Full Screen

SingleProperty.php

Source:SingleProperty.php Github

copy

Full Screen

...20 public static function variables(): array21 {22 $conversions = (new KoomehProperty)->conversions()->implode(',');23 return [24 Variable::make('id', __('Property Id')),25 Variable::make('name', __('Property Name')),26 Variable::make('code', __('Property Code')),27 Variable::make('url', __('Property URL')),28 Variable::make('price', __('Property price amount')),29 Variable::make('pricing', __('Name of the applied pricing')),30 Variable::make('accommodation', __('Actual property accommodation space')),31 Variable::make('max_accommodation', __('Extra property accommodation space')),32 33 Variable::make('max_accommodation_payment', __('Additional cost per guest by percent')), 34 Variable::make('images', __(35 "Property gallery image list. available conversions is:[{$conversions}]"36 )),37 Variable::make('hits', __('Property Hits')),38 Variable::make('lat', __('Property Google Latitude')),39 Variable::make('long', __('Property Google Longitude')), 40 Variable::make('address', __('Property full address')), 41 Variable::make('propertyLocality.name', __('Property Locality Name')),42 Variable::make('propertyLocality.icon', __('Property Locality Icon')),43 Variable::make('propertyLocality.help', __('Property Locality Help')),44 Variable::make('propertyType.name', __('Property Type Name')),45 Variable::make('propertyType.icon', __('Property Type Icon')),46 Variable::make('propertyType.help', __('Property Type Help')),47 Variable::make('roomType.name', __('Room Type Name')),48 Variable::make('roomType.help', __('Room Type Help')),49 Variable::make('paymentBasis.name', __('Property Payment Basis')), 50 Variable::make('reservation.name', __('Property Reservation Name')), 51 Variable::make('reservation.help', __('Property Reservation Help')), 52 Variable::make('stateName', __('Property State Name')), 53 Variable::make('cityName', __('Property City Name')), 54 Variable::make('zoneName', __('Property Zone Name')), 55 Variable::make('availableDetails', __(56 'Property available amenities list. each amenity has a name, help, value, group and icon.'57 )), 58 Variable::make('countableDetails', __(59 'Property countable amenities list. each amenity has a name, help, value, group and icon.'60 )), 61 Variable::make('descriptiveDetails', __(62 'Property descriptive amenities list. each amenity has a name, help, value, group and icon.'63 )), 64 Variable::make('conditions', __(65 'Property conditions list. each condition has a name, help and groupName.'66 )), 67 Variable::make('conditions', __('List of property conditions')), 68 Variable::make('condition', __('Property custom stay conditions')), 69 Variable::make('creation_date', __('Property Creation Date')),70 Variable::make('last_update', __('Property Update Date')), 71 Variable::make('summary', __('Property Summary')),72 Variable::make('content', __('Property Content')), 73 ];74 } 75}...

Full Screen

Full Screen

IndexProperty.php

Source:IndexProperty.php Github

copy

Full Screen

...20 public static function variables(): array21 {22 $conversions = (new KoomehProperty)->conversions()->implode(',');23 return [ 24 Variable::make('id', __('Property Id')),25 Variable::make('name', __('Property Name')),26 Variable::make('code', __('Property Code')),27 Variable::make('url', __('Property URL')),28 Variable::make('images', __(29 "Property gallery image list. available conversions is:[{$conversions}]"30 )),31 Variable::make('hits', __('Property Hits')),32 Variable::make('propertyType.name', __('Property Type Name')),33 Variable::make('propertyType.icon', __('Property Type Icon')),34 Variable::make('propertyType.help', __('Property Type Help')),35 Variable::make('stateName', __('Property State Name')), 36 Variable::make('cityName', __('Property City Name')), 37 Variable::make('zoneName', __('Property Zone Name')), 38 Variable::make('details', __(39 'Property available amenities list. each amenity has a name, help, value, group and icon.'40 )), 41 Variable::make('creation_date', __('Property Creation Date')),42 Variable::make('last_update', __('Property Update Date')), 43 Variable::make('summary', __('Property Summary')), 44 ];45 } 46}...

Full Screen

Full Screen

make

Using AI Code Generation

copy

Full Screen

1$var1 = new variable();2$var1->make(1);3echo $var1->get();4echo "<br>";5$var2 = new variable();6$var2->make(2);7echo $var2->get();8echo "<br>";9$var3 = new variable();10$var3->make(3);11echo $var3->get();12echo "<br>";13$var4 = new variable();14$var4->make(4);15echo $var4->get();16echo "<br>";17$var5 = new variable();18$var5->make(5);19echo $var5->get();20echo "<br>";21$var6 = new variable();22$var6->make(6);23echo $var6->get();24echo "<br>";25$var7 = new variable();26$var7->make(7);27echo $var7->get();28echo "<br>";29$var8 = new variable();30$var8->make(8);31echo $var8->get();32echo "<br>";33$var9 = new variable();34$var9->make(9);35echo $var9->get();36echo "<br>";37$var10 = new variable();38$var10->make(10);39echo $var10->get();40echo "<br>";41$var11 = new variable();42$var11->make(11);43echo $var11->get();44echo "<br>";45$var12 = new variable();46$var12->make(12);47echo $var12->get();48echo "<br>";49$var13 = new variable();50$var13->make(13);51echo $var13->get();52echo "<br>";53$var14 = new variable();54$var14->make(14);55echo $var14->get();56echo "<br>";

Full Screen

Full Screen

make

Using AI Code Generation

copy

Full Screen

1$var = new Variable();2$var->make();3echo "<br>";4$var->make(1);5echo "<br>";6$var->make(1,2);7echo "<br>";8$var->make(1,2,3);9echo "<br>";10$var->make(1,2,3,4);11echo "<br>";12$var->make(1,2,3,4,5);13echo "<br>";14$var->make(1,2,3,4,5,6);15echo "<br>";16$var->make(1,2,3,4,5,6,7);17echo "<br>";18$var->make(1,2,3,4,5,6,7,8);19echo "<br>";20$var->make(1,2,3,4,5,6,7,8,9);21echo "<br>";22$var->make(1,2,3,4,5,6,7,8,9,10);23echo "<br>";24$var->make(1,2,3,4,5,6,7,8,9,10,11);25echo "<br>";26$var->make(1,2,3,4,5,6,7,8,9,10,11,12);27echo "<br>";28$var->make(1,2,3,4,5,6,7,8,9,10,11,12,13);29echo "<br>";30$var->make(1,2,3,4,5,6,7,8,9,10,11,12,13,14);31echo "<br>";32$var->make(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);33echo "<br>";34$var->make(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);35echo "<br>";36$var->make(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17);37echo "<br>";38$var->make(1,2,3,4,5,6,7,8,9,10

Full Screen

Full Screen

make

Using AI Code Generation

copy

Full Screen

1$var = new variable();2$var->make("a", "b", "c", "d", "e");3echo $var->a;4echo $var->b;5echo $var->c;6echo $var->d;7echo $var->e;

Full Screen

Full Screen

make

Using AI Code Generation

copy

Full Screen

1include 'variable.php';2$var = new variable(1);3$var->make();4include 'variable.php';5$var = new variable(2);6$var->make();7include 'variable.php';8$var = new variable(3);9$var->make();10include 'variable.php';11$var = new variable(4);12$var->make();13include 'variable.php';14$var = new variable(5);15$var->make();16include 'variable.php';17$var = new variable(6);18$var->make();19include 'variable.php';20$var = new variable(7);21$var->make();22include 'variable.php';23$var = new variable(8);24$var->make();25include 'variable.php';26$var = new variable(9);27$var->make();28include 'variable.php';29$var = new variable(10);30$var->make();31include 'variable.php';32$var = new variable(11);33$var->make();34include 'variable.php';35$var = new variable(12);36$var->make();37include 'variable.php';38$var = new variable(13);39$var->make();

Full Screen

Full Screen

make

Using AI Code Generation

copy

Full Screen

1require_once('variable.php');2$var = new Variable();3$var->make('test', 'test', 'test', 'test', 'test', 'test', 'test', 'test', 'test', 'test');4echo $var->get('test');5echo $var->get('test1');6echo $var->get('test2');7echo $var->get('test3');8echo $var->get('test4');9echo $var->get('test5');10echo $var->get('test6');11echo $var->get('test7');12echo $var->get('test8');13echo $var->get('test9');14echo $var->get('test10');15echo $var->get('test11');16echo $var->get('test12');17echo $var->get('test13');18echo $var->get('test14');19echo $var->get('test15');20echo $var->get('test16');21echo $var->get('test17');22echo $var->get('test18');23echo $var->get('test19');24echo $var->get('test20');25echo $var->get('test21');26echo $var->get('test22');27echo $var->get('test23');28echo $var->get('test24');29echo $var->get('test25');30echo $var->get('test26');31echo $var->get('test27');32echo $var->get('test28');33echo $var->get('test29');34echo $var->get('test30');35echo $var->get('test31');36echo $var->get('test32');37echo $var->get('test33');38echo $var->get('test34');39echo $var->get('test35');40echo $var->get('test36');41echo $var->get('test37');42echo $var->get('test38');43echo $var->get('test39');44echo $var->get('test40');45echo $var->get('test41');46echo $var->get('test42');47echo $var->get('test43');48echo $var->get('test44');49echo $var->get('test45');50echo $var->get('test46');51echo $var->get('test47');52echo $var->get('test48');53echo $var->get('test49');

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful