| 63 | | //seperate JSON-lists for every list, edit and edit.page -pages |
|---|
| 64 | | <?php |
|---|
| 65 | | $for = array('list'); |
|---|
| 66 | | if ($this->getParameterValue('edit.display', null) || !$this->getParameterValue('edit.pages', null)) { |
|---|
| 67 | | $for[] = 'edit'; |
|---|
| 68 | | } |
|---|
| 69 | | |
|---|
| 70 | | $edit_pages = $this->getParameterValue('edit.pages', array()); |
|---|
| 71 | | |
|---|
| 72 | | foreach ($edit_pages as $pageName => $page) |
|---|
| 73 | | { |
|---|
| 74 | | $for[] = 'edit.pages.'.$pageName; |
|---|
| 75 | | } |
|---|
| 76 | | |
|---|
| 77 | | foreach($for as $page): |
|---|
| 78 | | $page_name = ucFirst(sfInflector::camelize(str_replace('.','_', $page))); |
|---|
| 79 | | ?> |
|---|
| 80 | | public function executeJson<?php echo $page_name ?>() |
|---|
| | 60 | |
|---|
| | 61 | public function executeJsonList() |
|---|
| 98 | | <?php if ($sortColumn = $this->getGroupField()) : |
|---|
| 99 | | |
|---|
| 100 | | //strange construction!? AND Note there is also something like: $this->getPeerClassName() |
|---|
| 101 | | $className = '<?php echo $this->getClassName() ?>'; |
|---|
| 102 | | |
|---|
| 103 | | if (false !== strpos($sortColumn, $tableDelimiter)) |
|---|
| 104 | | { |
|---|
| 105 | | $elements = explode($tableDelimiter, $sortColumn); |
|---|
| 106 | | |
|---|
| 107 | | $className = sfInflector::camelize($elements[count($elements)-2]); |
|---|
| 108 | | $sortColumn = $elements[count($elements)-1]; |
|---|
| 109 | | } |
|---|
| 110 | | |
|---|
| 111 | | try |
|---|
| 112 | | { |
|---|
| 113 | | $fieldName = call_user_func(array($className.'Peer', 'translateFieldName'), $sortColumn, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME); |
|---|
| 114 | | } |
|---|
| 115 | | catch (Exception $e) |
|---|
| 116 | | { |
|---|
| 117 | | // sort column does not exist, throw error |
|---|
| 118 | | throw new sfException(sprintf('Cannot sort on column "%s", the column does not exist. Clearing your cookies will (temporarily) fix this error.', $sortColumn)); |
|---|
| 119 | | } |
|---|
| 120 | | ?> |
|---|
| 121 | | // first sort on group-by column |
|---|
| 122 | | // TODO: this can be enhanced with options for the generator.yml file. |
|---|
| 123 | | $c->addAscendingOrderByColumn('<?php echo $fieldName ?>'); |
|---|
| 124 | | <?php endif; ?> |
|---|
| | 77 | <?php //if ($fields = $this->getParameterValue('list.fields')): ?> |
|---|
| | 78 | <?php //foreach ($fields as $key => $field): ?> |
|---|
| | 79 | <?php //if ($join_fields = $this->getParameterValue('list.fields.'.$key.'.join_fields')): ?> |
|---|
| | 80 | //$c->addJoin(<?//=$join_fields[0]?>,<?//=$join_fields[1]?>); |
|---|
| | 81 | <?php //endif; ?> |
|---|
| | 82 | <?php //endforeach; ?> |
|---|
| | 83 | <?php //endif; ?> |
|---|
| 140 | | $this->setLayout(false); |
|---|
| 141 | | sfConfig::set('sf_web_debug', false); |
|---|
| 142 | | $this->setTemplate('json'); |
|---|
| 143 | | } |
|---|
| 144 | | <?php endforeach; ?> |
|---|
| 145 | | |
|---|
| 146 | | public function executeListPrint() |
|---|
| 147 | | { |
|---|
| 148 | | $this->executeList(); |
|---|
| 149 | | |
|---|
| 150 | | $this->print = true; |
|---|
| 151 | | |
|---|
| 152 | | $this->setLayout(false); // TODO: set to a print layout... |
|---|
| 153 | | sfConfig::set('sf_web_debug', false); |
|---|
| 154 | | $this->setTemplate('list'); |
|---|
| 155 | | } |
|---|
| | 99 | // $this->setLayout(false); |
|---|
| | 100 | // sfConfig::set('sf_web_debug', false); |
|---|
| | 101 | } |
|---|
| | 102 | |
|---|
| | 103 | <?php |
|---|
| | 104 | $columns = $this->getColumnsGroup(); |
|---|
| | 105 | if (isset($columns['related'])): |
|---|
| | 106 | foreach ($columns['related'] as $class => $relatedColumns): |
|---|
| | 107 | $className = sfInflector::camelize($class); |
|---|
| | 108 | ?> |
|---|
| | 109 | public function executeJsonList<?php echo $class ?>() |
|---|
| | 110 | { |
|---|
| | 111 | //connect extjs to symfony |
|---|
| | 112 | $limit = $this->getRequestParameter('limit', 10); |
|---|
| | 113 | |
|---|
| | 114 | // pager |
|---|
| | 115 | $this->pager = new sfPropelPager('<?php echo $className ?>', $limit); |
|---|
| | 116 | $c = new Criteria(); |
|---|
| | 117 | $this->pager->setCriteria($c); |
|---|
| | 118 | $this->pager->setPage(1); |
|---|
| | 119 | $this->pager->init(); |
|---|
| | 120 | |
|---|
| | 121 | $this->setLayout(false); |
|---|
| | 122 | sfConfig::set('sf_web_debug', false); |
|---|
| | 123 | |
|---|
| | 124 | $render = ' |
|---|
| | 125 | {totalCount:"'.$this->pager->getNbResults().'", data:[ |
|---|
| | 126 | '; |
|---|
| | 127 | $i = 0; |
|---|
| | 128 | foreach ($this->pager->getResults() as $result) |
|---|
| | 129 | { |
|---|
| | 130 | if ($i > 0) $render .= ', '; |
|---|
| | 131 | <?php |
|---|
| | 132 | $pkName = $relatedColumns['pk']->getName(); |
|---|
| | 133 | $pkMethod = 'get'.sfInflector::camelize($pkName); |
|---|
| | 134 | ?> |
|---|
| | 135 | $render .= '{ "<?php echo $pkName ?>": "'.$result-><?php echo $pkMethod ?>().'", '; |
|---|
| | 136 | <?php $j = 0; foreach ($relatedColumns['columns'] as $col): |
|---|
| | 137 | $colName = $col->getName(); |
|---|
| | 138 | $colMethod = 'get'.sfInflector::camelize($colName); |
|---|
| | 139 | ?> |
|---|
| | 140 | <?php if ($j > 0): ?>$render .= ', ';<?php endif; ?> |
|---|
| | 141 | $render .= ' "<?php echo $colName ?>": "'.$result-><?php echo $colMethod ?>().'"'; |
|---|
| | 142 | <?php $j++; endforeach; ?> |
|---|
| | 143 | $render .= ' }'; |
|---|
| | 144 | $i++; |
|---|
| | 145 | } |
|---|
| | 146 | $render .= ' |
|---|
| | 147 | ]}'; |
|---|
| | 148 | |
|---|
| | 149 | return $this->renderText($render); |
|---|
| | 150 | } |
|---|
| | 151 | <?php endforeach; ?> |
|---|
| | 152 | <?php endif; ?> |
|---|
| | 153 | |
|---|
| 188 | | |
|---|
| 189 | | |
|---|
| | 186 | } |
|---|
| | 187 | |
|---|
| | 188 | public function executeCreate() |
|---|
| | 189 | { |
|---|
| | 190 | return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); |
|---|
| | 191 | } |
|---|
| | 192 | |
|---|
| | 193 | public function executeSave() |
|---|
| | 194 | { |
|---|
| | 195 | return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); |
|---|
| | 196 | } |
|---|
| | 197 | |
|---|
| | 198 | public function executeAjaxSave() |
|---|
| | 199 | { |
|---|
| | 200 | $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); |
|---|
| | 201 | |
|---|
| | 202 | $request = array(); |
|---|
| | 203 | $fieldName = ''; |
|---|
| | 204 | if ($field = $this->getRequestParameter('field')) |
|---|
| | 205 | { |
|---|
| | 206 | $fieldsName = $this->getFields(); |
|---|
| | 207 | $fieldName = array_search($field, $fieldsName); |
|---|
| | 208 | $value = $this->getRequestParameter('value'); |
|---|
| | 209 | |
|---|
| | 210 | $this->update<?php echo $this->getClassName() ?>ListFromRequest($fieldName, $value); |
|---|
| | 211 | } |
|---|
| | 212 | else |
|---|
| | 213 | { |
|---|
| | 214 | $this->update<?php echo $this->getClassName() ?>FromRequest($request); |
|---|
| | 215 | } |
|---|
| | 216 | |
|---|
| | 217 | $this->save<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>); |
|---|
| | 218 | |
|---|
| | 219 | return $this->renderText('{ success: true, message: "Your modifications have been saved" }'); |
|---|
| | 220 | } |
|---|
| | 221 | |
|---|
| | 222 | public function executeEdit() |
|---|
| | 223 | { |
|---|
| | 224 | $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); |
|---|
| | 225 | |
|---|
| | 226 | if ($this->getRequest()->getMethod() == sfRequest::POST) |
|---|
| | 227 | { |
|---|
| | 228 | $this->update<?php echo $this->getClassName() ?>FromRequest(); |
|---|
| | 229 | |
|---|
| | 230 | $this->save<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>); |
|---|
| | 231 | |
|---|
| | 232 | $this->setFlash('notice', 'Your modifications have been saved'); |
|---|
| | 233 | |
|---|
| | 234 | if ($this->getRequestParameter('save_and_add')) |
|---|
| | 235 | { |
|---|
| | 236 | return $this->redirect('<?php echo $this->getModuleName() ?>/create'); |
|---|
| | 237 | } |
|---|
| | 238 | else if ($this->getRequestParameter('save_and_list')) |
|---|
| | 239 | { |
|---|
| | 240 | return $this->redirect('<?php echo $this->getModuleName() ?>/list'); |
|---|
| | 241 | } |
|---|
| | 242 | else |
|---|
| | 243 | { |
|---|
| | 244 | return $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams('this->') ?>); |
|---|
| | 245 | } |
|---|
| | 246 | } |
|---|
| | 247 | else |
|---|
| | 248 | { |
|---|
| | 249 | $this->labels = $this->getLabels(); |
|---|
| | 250 | } |
|---|
| | 251 | |
|---|
| 191 | | $this->setTemplate('listAjax'); |
|---|
| 192 | | <?php endif; ?> |
|---|
| 193 | | |
|---|
| 194 | | } |
|---|
| 195 | | |
|---|
| 196 | | public function executeCreate() |
|---|
| 197 | | { |
|---|
| 198 | | return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); |
|---|
| 199 | | } |
|---|
| 200 | | |
|---|
| 201 | | public function executeSave() |
|---|
| 202 | | { |
|---|
| 203 | | return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); |
|---|
| 204 | | } |
|---|
| 205 | | |
|---|
| 206 | | public function executeAjaxEdit() |
|---|
| 207 | | { |
|---|
| 208 | | // Check if retreiving instead of saving... |
|---|
| 209 | | if ($this->getRequest()->hasParameter('filter')) |
|---|
| 210 | | { |
|---|
| 211 | | return $this->forward('<?php echo $this->getModuleName() ?>', 'jsonList'); |
|---|
| 212 | | } |
|---|
| 213 | | |
|---|
| 214 | | $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); |
|---|
| 215 | | |
|---|
| 216 | | if ($fieldName = $this->getRequestParameter('field')) |
|---|
| 217 | | { |
|---|
| 218 | | $value = $this->getRequestParameter('value'); |
|---|
| 219 | | |
|---|
| 220 | | $this->update<?php echo $this->getClassName() ?>ListFromRequest($fieldName, $value); |
|---|
| 221 | | } |
|---|
| 222 | | else |
|---|
| 223 | | { |
|---|
| 224 | | $this->update<?php echo $this->getClassName() ?>FromRequest(); |
|---|
| 225 | | } |
|---|
| 226 | | |
|---|
| 227 | | $this->save<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>); |
|---|
| 228 | | |
|---|
| 229 | | $this->setLayout(false); |
|---|
| | 253 | //if (!$this->getRequest()->isXmlHttpRequest()) |
|---|
| | 254 | //{ |
|---|
| | 255 | $this->setLayout(false); // TODO: maybe set to specific ajax layout |
|---|
| | 256 | //} |
|---|
| 231 | | return $this->renderText('{ success: true, message: "Your modifications have been saved" }'); |
|---|
| 232 | | } |
|---|
| 233 | | |
|---|
| 234 | | public function executeEdit() |
|---|
| 235 | | { |
|---|
| 236 | | $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); |
|---|
| 237 | | |
|---|
| 238 | | if ($this->getRequest()->getMethod() == sfRequest::POST) |
|---|
| 239 | | { |
|---|
| 240 | | $this->update<?php echo $this->getClassName() ?>FromRequest(); |
|---|
| 241 | | |
|---|
| 242 | | $this->save<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>); |
|---|
| 243 | | |
|---|
| 244 | | $this->setFlash('notice', 'Your modifications have been saved'); |
|---|
| 245 | | |
|---|
| 246 | | if ($this->getRequestParameter('save_and_add')) |
|---|
| 247 | | { |
|---|
| 248 | | return $this->redirect('<?php echo $this->getModuleName() ?>/create'); |
|---|
| 249 | | } |
|---|
| 250 | | else if ($this->getRequestParameter('save_and_list')) |
|---|
| 251 | | { |
|---|
| 252 | | return $this->redirect('<?php echo $this->getModuleName() ?>/list'); |
|---|
| 253 | | } |
|---|
| 254 | | else |
|---|
| 255 | | { |
|---|
| 256 | | return $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams('this->') ?>); |
|---|
| 257 | | } |
|---|
| 258 | | } |
|---|
| 259 | | else |
|---|
| 260 | | { |
|---|
| 261 | | $this->labels = $this->getLabels(); |
|---|
| 262 | | } |
|---|
| 263 | | |
|---|
| 264 | | <?php if ($this->getParameterValue('ajax', sfConfig::get('app_sf_extjs_theme_plugin_ajax', true))): ?> |
|---|
| 265 | | if ($this->getRequest()->isXmlHttpRequest()) |
|---|
| 266 | | { |
|---|
| 267 | | $this->setLayout(false); |
|---|
| 268 | | sfConfig::set('sf_web_debug', false); |
|---|
| 269 | | } |
|---|
| 394 | | <?php |
|---|
| 395 | | $groupedColumns = $this->getColumnsGrouped('list.display'); |
|---|
| 396 | | $columns = $this->getListUniqueColumns($groupedColumns, true); |
|---|
| 397 | | |
|---|
| 398 | | $tableName = $this->getTableName(); |
|---|
| 399 | | $first = true; |
|---|
| 400 | | |
|---|
| 401 | | foreach ($columns as $column): |
|---|
| 402 | | |
|---|
| 403 | | $columnName = $column->key; |
|---|
| 404 | | list($class, $checkName) = explode('/',$columnName, 2); |
|---|
| 405 | | |
|---|
| 406 | | if (strtolower($class) != strtolower($tableName)) |
|---|
| 407 | | { |
|---|
| 408 | | $checkName = $columnName; |
|---|
| 409 | | } |
|---|
| 410 | | |
|---|
| 411 | | if ($column->isPrimaryKey()) continue; |
|---|
| 412 | | if (false !== strpos($checkName, '/')) continue; // TODO: at the moment cannot handle foreign fields |
|---|
| 413 | | |
|---|
| 414 | | $type = $column->getCreoleType(); |
|---|
| 415 | | ?> |
|---|
| 416 | | <?php echo !$first ? 'else' : '' ?>if ($columnName == '<?php echo str_replace('/', $tableDelimiter, $column->key) ?>') |
|---|
| 417 | | { |
|---|
| 418 | | <?php $credentials = $this->getParameterValue('list.fields.'.$checkName.'.credentials') ?> |
|---|
| | 382 | <?php $columns = $this->getColumns('list.display'); ?> |
|---|
| | 383 | <?php foreach ($columns as $column): $type = $column->getCreoleType(); ?> |
|---|
| | 384 | <?php $name = $column->getName(); ?> |
|---|
| | 385 | <?php if ($column->isPrimaryKey()) continue ?> |
|---|
| | 386 | <?php if (false !== strpos($name, '/')) continue; // TODO: at the moment cannot handle foreign fields ?> |
|---|
| | 387 | |
|---|
| | 388 | if ($columnName == '<?php echo $column->getName() ?>') |
|---|
| | 389 | { |
|---|
| | 390 | <?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?> |
|---|
| 432 | | $dateFormat = new sfDateFormat($this->getUser()->getCulture()); |
|---|
| 433 | | <?php $inputPattern = $type == CreoleTypes::DATE ? 'd' : 'g'; ?> |
|---|
| 434 | | <?php $outputPattern = $type == CreoleTypes::DATE ? 'i' : 'I'; ?> |
|---|
| 435 | | //TODO : check $columnName below, this was $name, but this was obviously wrong! I don't know if $columnName is correct here.. |
|---|
| 436 | | if (!is_array($<?php echo $this->getSingularName() ?>['<?php echo $columnName ?>'])) |
|---|
| 437 | | { |
|---|
| 438 | | $value = $dateFormat->format($columnValue, '<?php echo $outputPattern ?>', $dateFormat->getInputPattern('<?php echo $inputPattern ?>')); |
|---|
| 439 | | } |
|---|
| 440 | | else |
|---|
| 441 | | { |
|---|
| 442 | | $value_array = $columnValue; |
|---|
| 443 | | $value = $value_array['year'].'-'.$value_array['month'].'-'.$value_array['day'].(isset($value_array['hour']) ? ' '.$value_array['hour'].':'.$value_array['minute'].(isset($value_array['second']) ? ':'.$value_array['second'] : '') : ''); |
|---|
| 444 | | } |
|---|
| 445 | | $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($value); |
|---|
| | 409 | $value = $dateFormat->format($columnValue, '<?php echo $outputPattern ?>', $dateFormat->getInputPattern('<?php echo $inputPattern ?>')); |
|---|
| 478 | | <?php |
|---|
| 479 | | $groupedColumns = $this->getColumnsGrouped('edit.display'); |
|---|
| 480 | | $columns = $this->getListUniqueColumns($groupedColumns, true); |
|---|
| 481 | | $tableName = $this->getTableName(); |
|---|
| 482 | | |
|---|
| 483 | | foreach ($columns as $column): |
|---|
| 484 | | list($class, $checkName) = explode('/', $column->key, 2); |
|---|
| 485 | | |
|---|
| 486 | | if (strtolower($class) != strtolower($tableName)) |
|---|
| 487 | | { |
|---|
| 488 | | $checkName = $columnName; |
|---|
| 489 | | } |
|---|
| 490 | | |
|---|
| 491 | | if ($column->isPrimaryKey()) continue; |
|---|
| 492 | | if (false !== strpos($checkName, '/')) continue; // TODO: at the moment cannot handle foreign fields |
|---|
| 493 | | |
|---|
| 494 | | $type = $column->getCreoleType(); |
|---|
| 495 | | $name = str_replace('/', $tableDelimiter, $checkName); |
|---|
| 496 | | |
|---|
| 497 | | $credentials = $this->getParameterValue('edit.fields.'.$checkName.'.credentials'); |
|---|
| 498 | | $input_type = $this->getParameterValue('edit.fields.'.$checkName.'.type'); |
|---|
| 499 | | |
|---|
| 500 | | ?> |
|---|
| 501 | | <?php |
|---|
| 502 | | if ($credentials): |
|---|
| 503 | | $credentials = str_replace("\n", ' ', var_export($credentials, true)) |
|---|
| 504 | | ?> |
|---|
| | 448 | <?php foreach ($this->getColumnCategories('edit.display') as $category): ?> |
|---|
| | 449 | <?php foreach ($this->getColumns('edit.display', $category) as $name => $column): $type = $column->getCreoleType(); ?> |
|---|
| | 450 | <?php $name = $column->getName() ?> |
|---|
| | 451 | <?php if ($column->isPrimaryKey()) continue ?> |
|---|
| | 452 | <?php if (false !== strpos($name, '/')) continue; // TODO: at the moment cannot handle foreign fields ?> |
|---|
| | 453 | |
|---|
| | 454 | <?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?> |
|---|
| | 455 | <?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?> |
|---|
| | 456 | <?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?> |
|---|
| 699 | | <?php |
|---|
| 700 | | // filtering is also used for drop-down combo-box filtering and retreiving json-data for edit-pages! |
|---|
| 701 | | $for = array('list.filters', 'list.display', 'edit.display'); |
|---|
| 702 | | $groupedColumns = $this->getColumnsGrouped($for, false); |
|---|
| 703 | | |
|---|
| 704 | | $pk = clone($groupedColumns['pk']); //copy by value, you don't want to add $pk->key to groupedColumns['pk'] |
|---|
| 705 | | $pk->key = strtolower($pk->getTableName().'/'.$pk->getName()); |
|---|
| 706 | | |
|---|
| 707 | | $columns = array(); |
|---|
| 708 | | $columns[] = $pk; // add primary key |
|---|
| 709 | | // add primary keys of related classes |
|---|
| 710 | | foreach ($groupedColumns['related'] as $relatedTable => $relatedGroupedColumns) |
|---|
| 711 | | { |
|---|
| 712 | | $pkr = clone($relatedGroupedColumns['pk']); //copy by value, you don't want to add $pk->key to groupedColumns['pk'] |
|---|
| 713 | | $pkr->key = strtolower($pk->getTableName().'/'.$pkr->getTableName().'/'.$pkr->getName()); |
|---|
| 714 | | |
|---|
| 715 | | $columns[] = $pkr; // add related primary key |
|---|
| 716 | | } |
|---|
| 717 | | // add default keys below PKs |
|---|
| 718 | | $columns = array_merge($columns, $this->getListUniqueColumns($groupedColumns, false)); |
|---|
| 719 | | |
|---|
| 720 | | ?> |
|---|
| | 650 | <?php if ($this->getParameterValue('list.filters') || $this->getParameterValue('list.display')): ?> |
|---|
| | 651 | <?php $columns = array_merge($this->getColumns('list.filters'), $this->getColumns('list.display')) ?> |
|---|
| 723 | | <?php |
|---|
| 724 | | $peerClassName = $this->getPeerClassName(); |
|---|
| 725 | | if (false !== strpos($column->key, '/')) |
|---|
| 726 | | { |
|---|
| 727 | | $parts = explode('/', $column->key); |
|---|
| 728 | | $peer = $parts[count($parts)-2]; |
|---|
| 729 | | $peerClassName = sfInflector::camelize($peer).'Peer'; |
|---|
| 730 | | } |
|---|
| 731 | | $columnName = strtoupper($column->getName()); |
|---|
| 732 | | ?> |
|---|
| 733 | | <?php if (($column->isPartial() || $column->isComponent()) && $this->getParameterValue('list.fields.'.$column->getName().'.filter_criteria_disabled')) continue; ?> |
|---|
| 734 | | <?php if (!$column->isPrimaryKey()): ?> |
|---|
| 735 | | if (isset($this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>_is_empty'])) |
|---|
| 736 | | { |
|---|
| 737 | | $criterion = $c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, ''); |
|---|
| 738 | | $criterion->addOr($c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, null, Criteria::ISNULL)); |
|---|
| | 654 | <?php if (($column->isPartial() || $column->isComponent()) && $this->getParameterValue('list.fields.'.$column->getName().'.filter_criteria_disabled')) continue ?> |
|---|
| | 655 | if (isset($this->filters['<?php echo $column->getName() ?>_is_empty'])) |
|---|
| | 656 | { |
|---|
| | 657 | $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, ''); |
|---|
| | 658 | $criterion->addOr($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, null, Criteria::ISNULL)); |
|---|
| 749 | | $criterion = $c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, date('Y-m-d', $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['from']), Criteria::GREATER_EQUAL); |
|---|
| 750 | | <?php else: ?> |
|---|
| 751 | | $criterion = $c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['from'], Criteria::GREATER_EQUAL); |
|---|
| 752 | | <?php endif; ?> |
|---|
| 753 | | } |
|---|
| 754 | | if (isset($this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['to']) && $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['to'] !== '') |
|---|
| | 667 | $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['from']), Criteria::GREATER_EQUAL); |
|---|
| | 668 | <?php else: ?> |
|---|
| | 669 | $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['from'], Criteria::GREATER_EQUAL); |
|---|
| | 670 | <?php endif; ?> |
|---|
| | 671 | } |
|---|
| | 672 | if (isset($this->filters['<?php echo $column->getName() ?>']['to']) && $this->filters['<?php echo $column->getName() ?>']['to'] !== '') |
|---|
| 759 | | $criterion->addAnd($c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, date('Y-m-d', $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['to']), Criteria::LESS_EQUAL)); |
|---|
| 760 | | <?php else: ?> |
|---|
| 761 | | $criterion->addAnd($c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['to'], Criteria::LESS_EQUAL)); |
|---|
| | 677 | $criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL)); |
|---|
| | 678 | <?php else: ?> |
|---|
| | 679 | $criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL)); |
|---|
| 767 | | $criterion = $c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, date('Y-m-d', $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['to']), Criteria::LESS_EQUAL); |
|---|
| 768 | | <?php else: ?> |
|---|
| 769 | | $criterion = $c->getNewCriterion(<?php echo $peerClassName ?>::<?php echo $columnName ?>, $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']['to'], Criteria::LESS_EQUAL); |
|---|
| | 685 | $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL); |
|---|
| | 686 | <?php else: ?> |
|---|
| | 687 | $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL); |
|---|
| 785 | | $c->add(<?php echo $peerClassName ?>::<?php echo $columnName ?>, strtr($this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>'].$q, '*', '%'), Criteria::LIKE); |
|---|
| 786 | | <?php else: ?> |
|---|
| 787 | | <?php if ($type == CreoleTypes::CHAR || $type == CreoleTypes::VARCHAR || $type == CreoleTypes::LONGVARCHAR): ?> |
|---|
| | 703 | $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, strtr($this->filters['<?php echo $column->getName() ?>'].$q, '*', '%'), Criteria::LIKE); |
|---|
| | 704 | <?php else: ?> |
|---|
| | 705 | <?php |
|---|
| | 706 | $columnName = $column->getName(); |
|---|
| | 707 | $peer = $this->getPeerClassName(); |
|---|
| | 708 | if (false !== strpos($columnName, '/')) |
|---|
| | 709 | { |
|---|
| | 710 | list($peer, $columnName) = explode('/', $columnName, 2); |
|---|
| | 711 | } |
|---|
| | 712 | ?> |
|---|
| 790 | | $c->add(<?php echo $peerClassName ?>::<?php echo $columnName ?>, strtr($this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>'].$q, '*', '%'), Criteria::LIKE); |
|---|
| 791 | | <?php else: ?> |
|---|
| 792 | | $c->add(<?php echo $peerClassName ?>::<?php echo $columnName ?>, $this->filters['<?php echo str_replace('/', $tableDelimiter, $column->key) ?>']); |
|---|
| 793 | | <?php endif; ?> |
|---|
| 794 | | <?php endif; ?> |
|---|
| 795 | | } |
|---|
| 796 | | <?php endif; ?> |
|---|
| 797 | | <?php endforeach; ?> |
|---|
| | 715 | $c->add('<?php echo $peer ?>.<?php echo strtoupper($columnName) ?>', strtr($this->filters['<?php echo $column->getName() ?>'].$q, '*', '%'), Criteria::LIKE); |
|---|
| | 716 | <?php endif; ?> |
|---|
| | 717 | } |
|---|
| | 718 | <?php endif; ?> |
|---|
| | 719 | <?php endforeach; ?> |
|---|
| | 720 | <?php endif; ?> |
|---|
| 860 | | <?php |
|---|
| 861 | | $groupedColumns = $this->getColumnsGrouped('edit.display'); |
|---|
| 862 | | $columns = $this->getListUniqueColumns($groupedColumns, true); |
|---|
| 863 | | $tableName = $this->getTableName(); |
|---|
| 864 | | |
|---|
| 865 | | foreach ($columns as $columnName => $column) : |
|---|
| 866 | | $columnName = $column->key; |
|---|
| 867 | | |
|---|
| 868 | | list($class, $checkName) = explode('/', $columnName, 2); |
|---|
| 869 | | |
|---|
| 870 | | if (strtolower($class) != strtolower($tableName)) |
|---|
| 871 | | { |
|---|
| 872 | | $class = strtolower($tableName); |
|---|
| 873 | | $checkName = $columnName; |
|---|
| 874 | | } |
|---|
| 875 | | |
|---|
| 876 | | $fieldName = str_replace('/', $tableDelimiter, $columnName); |
|---|
| 877 | | |
|---|
| 878 | | $labelName = str_replace("'", "\\'", $this->getParameterValue('edit.fields.'.$checkName.'.name')); |
|---|
| 879 | | ?> |
|---|
| 880 | | '<?php echo $fieldName ?>' => '<?php echo $labelName ?>', |
|---|
| | 791 | <?php foreach ($this->getColumnCategories('edit.display') as $category): ?> |
|---|
| | 792 | <?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?> |
|---|
| | 793 | '<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}' => '<?php $label_name = str_replace("'", "\\'", $this->getParameterValue('edit.fields.'.$column->getName().'.name')); echo $label_name ?>', |
|---|
| | 794 | <?php endforeach; ?> |
|---|