1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Fix for Page-Chapter Batch Link creation.

This commit is contained in:
Cameron 2013-06-14 17:00:41 -07:00
parent c6cec3cf61
commit 7d57148ed0
2 changed files with 47 additions and 8 deletions

View File

@ -120,6 +120,8 @@ class page_chapters_ui extends e_admin_ui
protected $batchCopy = true;
protected $batchLink = true;
protected $listOrder = ' COALESCE(NULLIF(chapter_parent,0), chapter_id), chapter_parent > 0, chapter_order '; //FIXME works with parent/child but doesn't respect parent order.
protected $url = array('route'=>'page/chapter/index', 'vars' => array('id' => 'chapter_id', 'name' => 'chapter_sef'), 'name' => 'chapter_name', 'description' => ''); // 'link' only needed if profile not provided.
// protected $sortField = 'chapter_order';
// protected $orderStep = 10;

View File

@ -37,18 +37,55 @@ class core_page_url extends eUrlConfig
{
if(!$params) return 'page.php';
if(is_string($route)) $route = explode('/', $route, 2);
if(is_string($route))
{
$route = explode('/', $route, 2);
}
if(!varset($route[1])) $route[1] = 'index';
## aliases as retrieved from the DB, map vars to proper values
if(isset($params['page_title']) && !empty($params['page_title'])) $params['name'] = $params['page_title'];
if(isset($params['page_id']) && !empty($params['page_id'])) $params['id'] = $params['page_id'];
$url = 'page.php?';
if('--FROM--' != vartrue($params['page'])) $page = varset($params['page']) ? intval($params['page']) : '0';
else $page = '--FROM--';
switch ($route[0])
{
case 'book':
$url .= "bk=".intval($params['id']);
break;
case 'chapter':
$url .= "ch=".intval($params['id']);
break;
case 'view':
default:
## aliases as retrieved from the DB, map vars to proper values
if(isset($params['page_title']) && !empty($params['page_title']))
{
$params['name'] = $params['page_title'];
}
if(isset($params['page_id']) && !empty($params['page_id']))
{
$params['id'] = $params['page_id'];
}
if('--FROM--' != vartrue($params['page']))
{
$page = varset($params['page']) ? intval($params['page']) : '0';
}
else
{
$page = '--FROM--';
}
$url .= "id=".intval($params['id']).($page ? '.'.$page : '');
break;
}
return $url;
}