[Logicampus-cvs] logicampus/src/logicreate/services/lobrepo import.lcp, 1.9, 1.10 lob_table_rendere
Brought to you by:
trilexcom
From: Mark K <har...@us...> - 2007-10-08 19:41:33
|
Update of /cvsroot/logicampus/logicampus/src/logicreate/services/lobrepo In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4300/services/lobrepo Modified Files: import.lcp lob_table_renderer.php myobj.lcp Log Message: Make my LOB table paginate. Index: lob_table_renderer.php =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/services/lobrepo/lob_table_renderer.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** lob_table_renderer.php 28 Sep 2007 15:21:27 -0000 1.12 --- lob_table_renderer.php 8 Oct 2007 19:41:24 -0000 1.13 *************** *** 4,10 **** * Custom renderer for Learning Objects */ ! class Lob_Table_Renderer extends LC_TableRenderer { /** * Shows the table as HTML --- 4,13 ---- * Custom renderer for Learning Objects */ ! class Lob_Table_Renderer extends LC_TableRendererPaged { + var $style="clear:right; border:0px; background-color:white;"; + // var $cssClass = 'datatable'; + /** * Shows the table as HTML *************** *** 31,35 **** function startTable() { ! $this->html .='<table border="0" width="100%" class="datatable" style="background-color:white;border:0px">'; } --- 34,39 ---- function startTable() { ! parent::startTable(); ! // $this->html .='<table border="0" width="100%" class="datatable" style="background-color:white;border:0px">'; } Index: myobj.lcp =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/services/lobrepo/myobj.lcp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** myobj.lcp 4 Oct 2007 14:55:56 -0000 1.17 --- myobj.lcp 8 Oct 2007 19:41:24 -0000 1.18 *************** *** 33,39 **** --- 33,57 ---- //$lobs = LobContentPeer::doSelect(); + //get total count for paged tables. + $db->query('SELECT count(*) as totalcount + FROM lob_repo_entry as A + LEFT JOIN lob_metadata as B on A.lob_repo_entry_id = B.lob_repo_entry_id + LEFT JOIN lob_user_link as C on A.lob_repo_entry_id = C.lob_repo_entry_id + WHERE C.user_id = '.$u->userId.' + '); + + $db->nextRecord(); + $db->freeResult(); + $totalCount = $db->record['totalcount']; + + + $pageIdx = intval($lc->getvars['p']); + if ($pageIdx ==0 ) {$pageIdx =1;} + $lobItems = array(); $idx=0; + $limitCount = 30; + $limitStart = $limitCount * ($pageIdx-1); $db->query('SELECT A.*,B.author, B.license, B.copyright,B.subject, B.subdisc FROM lob_repo_entry as A *************** *** 41,47 **** LEFT JOIN lob_user_link as C on A.lob_repo_entry_id = C.lob_repo_entry_id WHERE C.user_id = '.$u->userId.' '); - while($db->nextRecord()) { //foreach ($lobs as $lobObj) { --- 59,65 ---- LEFT JOIN lob_user_link as C on A.lob_repo_entry_id = C.lob_repo_entry_id WHERE C.user_id = '.$u->userId.' + LIMIT '.$limitStart.','.$limitCount.' '); while($db->nextRecord()) { //foreach ($lobs as $lobObj) { *************** *** 63,67 **** $dm->ignoreColumn('subdisc'); $dm->ignoreColumn('lobRepoEntryId'); ! $table = new LC_Table($dm); $columnModel = &$table->getColumnModel(); $col = &$columnModel->getColumnAt(0); --- 81,90 ---- $dm->ignoreColumn('subdisc'); $dm->ignoreColumn('lobRepoEntryId'); ! ! $table = new LC_TablePaged($dm); ! $table->url = appurl('lobrepo').'/myobj/p=%d'; ! $table->maxRows = $totalCount; ! $table->rowsPerPage = $limitCount = 30; ! $table->currentPage = $pageIdx; $columnModel = &$table->getColumnModel(); $col = &$columnModel->getColumnAt(0); *************** *** 93,97 **** $linkIds[$linkObj->lobClassRepoId][] = $linkObj->classId; } ! $t['lobTable']->classLinkIds = $linkIds; // print_r($t['lobTable']); } --- 116,120 ---- $linkIds[$linkObj->lobClassRepoId][] = $linkObj->classId; } ! // $t['lobTable']->classLinkIds = $linkIds; // print_r($t['lobTable']); } Index: import.lcp =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/services/lobrepo/import.lcp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** import.lcp 8 Oct 2007 00:13:35 -0000 1.9 --- import.lcp 8 Oct 2007 19:41:24 -0000 1.10 *************** *** 82,85 **** --- 82,89 ---- $lobSub = $this->makeContentNode($node); } + if ($lobObj->lobType == 'interaction') { + $lobSub = $this->makeActivityNode($node); + } + echo "saving ".$xidx." lob ... <br/>\n"; *************** *** 128,131 **** --- 132,168 ---- } + /** + * return a lob activity sub-object + */ + function makeActivityNode($n) { + $result = $n->getElementsByTagname('response'); + $responseNode = $result->item(0); + $lobSub = new LobActivity(); + switch($resposneNode->nodeValue) { + case 'upload': + $lobSub->responseTypeId = 1; + break; + case 'text': + $lobSub->responseTypeId = 2; + break; + case 'uploadandtext': + $lobSub->responseTypeId = 3; + break; + case 'forum': + $lobSub->responseTypeId = 4; + break; + case 'none': + $lobSub->responseTypeId = 5; + break; + case 'audio': + $lobSub->responseTypeId = 6; + break; + + default: + $lobSub->responseTypeId = 5; + } + return $lobSub; + } + /** *************** *** 168,171 **** --- 205,211 ---- $lob->set('lobType','interaction'); break; + case 'activity': + $lob->set('lobType','activity'); + break; } if ($lob->lobType == '') { return null; die ('unknown type '. $content); } *************** *** 291,295 **** return $lob; - // debug($children); } --- 331,334 ---- |