Changeset 596
- Timestamp:
- 09/28/07 16:26:51 (1 year ago)
- Files:
-
- branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (3 diffs)
- branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (3 diffs)
- branches/1.0beta3.x/lib/jelix/core-modules/jelix/templates/crud_list.tpl (modified) (2 diffs)
- branches/1.0beta3.x/lib/jelix/core-modules/jelix/templates/crud_list.tpl (modified) (2 diffs)
- branches/1.0beta3.x/lib/jelix/dao/jDaoBase.class.php (modified) (1 diff)
- branches/1.0beta3.x/lib/jelix/dao/jDaoBase.class.php (modified) (1 diff)
- branches/1.0beta3.x/testapp/modules/testapp/controllers/samplecrud.classic.php (modified) (1 diff)
- branches/1.0beta3.x/testapp/modules/testapp/controllers/samplecrud.classic.php (modified) (1 diff)
- trunk/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (3 diffs)
- trunk/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (3 diffs)
- trunk/lib/jelix/core-modules/jelix/templates/crud_list.tpl (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/templates/crud_list.tpl (modified) (2 diffs)
- trunk/lib/jelix/dao/jDaoBase.class.php (modified) (1 diff)
- trunk/lib/jelix/dao/jDaoBase.class.php (modified) (1 diff)
- trunk/testapp/modules/testapp/controllers/samplecrud.classic.php (modified) (1 diff)
- trunk/testapp/modules/testapp/controllers/samplecrud.classic.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php
r595 r596 41 41 protected $propertiesForList = array(); 42 42 43 44 /** 45 * list of properties which serve to order the record list 46 * if empty list (default), the list is in a natural order 47 * keys are properties name, and values are "asc" or "desc" 48 * @var array 49 */ 50 protected $propertiesForRecordsOrder = array(); 51 43 52 /** 44 53 * template to display the list of records … … 133 142 134 143 $dao = jDao::get($this->dao, $this->dbProfil); 135 $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 144 145 $cond = jDao::createConditions(); 146 foreach ($this->propertiesForRecordsOrder as $p=>$order) { 147 $cond->addItemOrder($p, $order); 148 } 149 150 $results = $dao->findBy($cond,$offset,$this->listPageSize); 136 151 $pk = $dao->getPrimaryKeyNames(); 137 152 138 jForms::destroy($this->form, $this->pseudoFormId); 139 153 // we're using a form to have the portunity to have 154 // labels for each columns. 155 $form = jForms::create($this->form, $this->pseudoFormId); 140 156 $tpl = new jTpl(); 141 157 $tpl->assign('list',$results); 142 158 $tpl->assign('primarykey', $pk[0]); 143 if(count($this->propertiesForList)) 144 $tpl->assign('properties', $this->propertiesForList); 145 else{ 146 $tpl->assign('properties', array_keys($dao->getProperties())); 147 } 159 160 if(count($this->propertiesForList)) { 161 $prop = $this->propertiesForList; 162 }else{ 163 $prop = array_keys($dao->getProperties()); 164 } 165 166 $tpl->assign('properties', $prop); 167 $tpl->assign('controls',$form->getControls()); 148 168 $tpl->assign('editAction' , $this->_getAction('preupdate')); 149 169 $tpl->assign('createAction' , $this->_getAction('create')); … … 157 177 158 178 $this->_index($rep, $tpl); 159 160 179 $rep->body->assign($this->templateAssign, $tpl->fetch($this->listTemplate)); 161 180 jForms::destroy($this->form, $this->pseudoFormId); 162 181 return $rep; 163 182 } branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php
r595 r596 41 41 protected $propertiesForList = array(); 42 42 43 44 /** 45 * list of properties which serve to order the record list 46 * if empty list (default), the list is in a natural order 47 * keys are properties name, and values are "asc" or "desc" 48 * @var array 49 */ 50 protected $propertiesForRecordsOrder = array(); 51 43 52 /** 44 53 * template to display the list of records … … 133 142 134 143 $dao = jDao::get($this->dao, $this->dbProfil); 135 $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 144 145 $cond = jDao::createConditions(); 146 foreach ($this->propertiesForRecordsOrder as $p=>$order) { 147 $cond->addItemOrder($p, $order); 148 } 149 150 $results = $dao->findBy($cond,$offset,$this->listPageSize); 136 151 $pk = $dao->getPrimaryKeyNames(); 137 152 138 jForms::destroy($this->form, $this->pseudoFormId); 139 153 // we're using a form to have the portunity to have 154 // labels for each columns. 155 $form = jForms::create($this->form, $this->pseudoFormId); 140 156 $tpl = new jTpl(); 141 157 $tpl->assign('list',$results); 142 158 $tpl->assign('primarykey', $pk[0]); 143 if(count($this->propertiesForList)) 144 $tpl->assign('properties', $this->propertiesForList); 145 else{ 146 $tpl->assign('properties', array_keys($dao->getProperties())); 147 } 159 160 if(count($this->propertiesForList)) { 161 $prop = $this->propertiesForList; 162 }else{ 163 $prop = array_keys($dao->getProperties()); 164 } 165 166 $tpl->assign('properties', $prop); 167 $tpl->assign('controls',$form->getControls()); 148 168 $tpl->assign('editAction' , $this->_getAction('preupdate')); 149 169 $tpl->assign('createAction' , $this->_getAction('create')); … … 157 177 158 178 $this->_index($rep, $tpl); 159 160 179 $rep->body->assign($this->templateAssign, $tpl->fetch($this->listTemplate)); 161 180 jForms::destroy($this->form, $this->pseudoFormId); 162 181 return $rep; 163 182 } branches/1.0beta3.x/lib/jelix/core-modules/jelix/templates/crud_list.tpl
r571 r596 1 1 <h1>{@jelix~crud.title.list@}</h1> 2 2 3 <table class="crud-record-list"> 3 <table class="crud-record-list" border="1"> 4 <thead> 5 <tr> 6 {foreach $properties as $propname} 7 {if isset($controls[$propname])} 8 <th>{$controls[$propname]->label|eschtml}</th> 9 {else} 10 <th>{$propname|eschtml}</th> 11 {/if} 12 {/foreach} 13 <th> </th> 14 </tr> 15 </thead> 16 <tbody> 4 17 {foreach $list as $record} 5 18 <tr> … … 12 25 </tr> 13 26 {/foreach} 27 </tbody> 14 28 </table> 15 29 <p class="crud-pages">Pages : {pagelinks $listAction, array(), $recordCount, $page, $listPageSize, $offsetParameterName }</p> branches/1.0beta3.x/lib/jelix/core-modules/jelix/templates/crud_list.tpl
r571 r596 1 1 <h1>{@jelix~crud.title.list@}</h1> 2 2 3 <table class="crud-record-list"> 3 <table class="crud-record-list" border="1"> 4 <thead> 5 <tr> 6 {foreach $properties as $propname} 7 {if isset($controls[$propname])} 8 <th>{$controls[$propname]->label|eschtml}</th> 9 {else} 10 <th>{$propname|eschtml}</th> 11 {/if} 12 {/foreach} 13 <th> </th> 14 </tr> 15 </thead> 16 <tbody> 4 17 {foreach $list as $record} 5 18 <tr> … … 12 25 </tr> 13 26 {/foreach} 27 </tbody> 14 28 </table> 15 29 <p class="crud-pages">Pages : {pagelinks $listAction, array(), $recordCount, $page, $listPageSize, $offsetParameterName }</p> branches/1.0beta3.x/lib/jelix/dao/jDaoBase.class.php
r576 r596 394 394 $order = array (); 395 395 foreach ($daocond->order as $name => $way){ 396 if (isset($ fields[$name])){396 if (isset($props[$name])){ 397 397 $order[] = $name.' '.$way; 398 398 } branches/1.0beta3.x/lib/jelix/dao/jDaoBase.class.php
r576 r596 394 394 $order = array (); 395 395 foreach ($daocond->order as $name => $way){ 396 if (isset($ fields[$name])){396 if (isset($props[$name])){ 397 397 $order[] = $name.' '.$way; 398 398 } branches/1.0beta3.x/testapp/modules/testapp/controllers/samplecrud.classic.php
r572 r596 21 21 protected $form = 'testapp~products'; 22 22 23 24 protected $propertiesForRecordsOrder = array('price'=>'desc'); 23 25 } 24 26 branches/1.0beta3.x/testapp/modules/testapp/controllers/samplecrud.classic.php
r572 r596 21 21 protected $form = 'testapp~products'; 22 22 23 24 protected $propertiesForRecordsOrder = array('price'=>'desc'); 23 25 } 24 26 trunk/lib/jelix/controllers/jControllerDaoCrud.class.php
r595 r596 41 41 protected $propertiesForList = array(); 42 42 43 44 /** 45 * list of properties which serve to order the record list 46 * if empty list (default), the list is in a natural order 47 * keys are properties name, and values are "asc" or "desc" 48 * @var array 49 */ 50 protected $propertiesForRecordsOrder = array(); 51 43 52 /** 44 53 * template to display the list of records … … 133 142 134 143 $dao = jDao::get($this->dao, $this->dbProfil); 135 $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 144 145 $cond = jDao::createConditions(); 146 foreach ($this->propertiesForRecordsOrder as $p=>$order) { 147 $cond->addItemOrder($p, $order); 148 } 149 150 $results = $dao->findBy($cond,$offset,$this->listPageSize); 136 151 $pk = $dao->getPrimaryKeyNames(); 137 152 138 jForms::destroy($this->form, $this->pseudoFormId); 139 153 // we're using a form to have the portunity to have 154 // labels for each columns. 155 $form = jForms::create($this->form, $this->pseudoFormId); 140 156 $tpl = new jTpl(); 141 157 $tpl->assign('list',$results); 142 158 $tpl->assign('primarykey', $pk[0]); 143 if(count($this->propertiesForList)) 144 $tpl->assign('properties', $this->propertiesForList); 145 else{ 146 $tpl->assign('properties', array_keys($dao->getProperties())); 147 } 159 160 if(count($this->propertiesForList)) { 161 $prop = $this->propertiesForList; 162 }else{ 163 $prop = array_keys($dao->getProperties()); 164 } 165 166 $tpl->assign('properties', $prop); 167 $tpl->assign('controls',$form->getControls()); 148 168 $tpl->assign('editAction' , $this->_getAction('preupdate')); 149 169 $tpl->assign('createAction' , $this->_getAction('create')); … … 157 177 158 178 $this->_index($rep, $tpl); 159 160 179 $rep->body->assign($this->templateAssign, $tpl->fetch($this->listTemplate)); 161 180 jForms::destroy($this->form, $this->pseudoFormId); 162 181 return $rep; 163 182 } trunk/lib/jelix/controllers/jControllerDaoCrud.class.php
r595 r596 41 41 protected $propertiesForList = array(); 42 42 43 44 /** 45 * list of properties which serve to order the record list 46 * if empty list (default), the list is in a natural order 47 * keys are properties name, and values are "asc" or "desc" 48 * @var array 49 */ 50 protected $propertiesForRecordsOrder = array(); 51 43 52 /** 44 53 * template to display the list of records … … 133 142 134 143 $dao = jDao::get($this->dao, $this->dbProfil); 135 $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 144 145 $cond = jDao::createConditions(); 146 foreach ($this->propertiesForRecordsOrder as $p=>$order) { 147 $cond->addItemOrder($p, $order); 148 } 149 150 $results = $dao->findBy($cond,$offset,$this->listPageSize); 136 151 $pk = $dao->getPrimaryKeyNames(); 137 152 138 jForms::destroy($this->form, $this->pseudoFormId); 139 153 // we're using a form to have the portunity to have 154 // labels for each columns. 155 $form = jForms::create($this->form, $this->pseudoFormId); 140 156 $tpl = new jTpl(); 141 157 $tpl->assign('list',$results); 142 158 $tpl->assign('primarykey', $pk[0]); 143 if(count($this->propertiesForList)) 144 $tpl->assign('properties', $this->propertiesForList); 145 else{ 146 $tpl->assign('properties', array_keys($dao->getProperties())); 147 } 159 160 if(count($this->propertiesForList)) { 161 $prop = $this->propertiesForList; 162 }else{ 163 $prop = array_keys($dao->getProperties()); 164 } 165 166 $tpl->assign('properties', $prop); 167 $tpl->assign('controls',$form->getControls()); 148 168 $tpl->assign('editAction' , $this->_getAction('preupdate')); 149 169 $tpl->assign('createAction' , $this->_getAction('create')); … … 157 177 158 178 $this->_index($rep, $tpl); 159 160 179 $rep->body->assign($this->templateAssign, $tpl->fetch($this->listTemplate)); 161 180 jForms::destroy($this->form, $this->pseudoFormId); 162 181 return $rep; 163 182 } trunk/lib/jelix/core-modules/jelix/templates/crud_list.tpl
r571 r596 1 1 <h1>{@jelix~crud.title.list@}</h1> 2 2 3 <table class="crud-record-list"> 3 <table class="crud-record-list" border="1"> 4 <thead> 5 <tr> 6 {foreach $properties as $propname} 7 {if isset($controls[$propname])} 8 <th>{$controls[$propname]->label|eschtml}</th> 9 {else} 10 <th>{$propname|eschtml}</th> 11 {/if} 12 {/foreach} 13 <th> </th> 14 </tr> 15 </thead> 16 <tbody> 4 17 {foreach $list as $record} 5 18 <tr> … … 12 25 </tr> 13 26 {/foreach} 27 </tbody> 14 28 </table> 15 29 <p class="crud-pages">Pages : {pagelinks $listAction, array(), $recordCount, $page, $listPageSize, $offsetParameterName }</p> trunk/lib/jelix/core-modules/jelix/templates/crud_list.tpl
r571 r596 1 1 <h1>{@jelix~crud.title.list@}</h1> 2 2 3 <table class="crud-record-list"> 3 <table class="crud-record-list" border="1"> 4 <thead> 5 <tr> 6 {foreach $properties as $propname} 7 {if isset($controls[$propname])} 8 <th>{$controls[$propname]->label|eschtml}</th> 9 {else} 10 <th>{$propname|eschtml}</th> 11 {/if} 12 {/foreach} 13 <th> </th> 14 </tr> 15 </thead> 16 <tbody> 4 17 {foreach $list as $record} 5 18 <tr> … … 12 25 </tr> 13 26 {/foreach} 27 </tbody> 14 28 </table> 15 29 <p class="crud-pages">Pages : {pagelinks $listAction, array(), $recordCount, $page, $listPageSize, $offsetParameterName }</p> trunk/lib/jelix/dao/jDaoBase.class.php
r576 r596 394 394 $order = array (); 395 395 foreach ($daocond->order as $name => $way){ 396 if (isset($ fields[$name])){396 if (isset($props[$name])){ 397 397 $order[] = $name.' '.$way; 398 398 } trunk/lib/jelix/dao/jDaoBase.class.php
r576 r596 394 394 $order = array (); 395 395 foreach ($daocond->order as $name => $way){ 396 if (isset($ fields[$name])){396 if (isset($props[$name])){ 397 397 $order[] = $name.' '.$way; 398 398 } trunk/testapp/modules/testapp/controllers/samplecrud.classic.php
r572 r596 21 21 protected $form = 'testapp~products'; 22 22 23 24 protected $propertiesForRecordsOrder = array('price'=>'desc'); 23 25 } 24 26 trunk/testapp/modules/testapp/controllers/samplecrud.classic.php
r572 r596 21 21 protected $form = 'testapp~products'; 22 22 23 24 protected $propertiesForRecordsOrder = array('price'=>'desc'); 23 25 } 24 26
