APC Action Applications - Home Page

Frequently Asked Questions v2

 

There are several recent (Mar 2002) changes to make it easier to call apc-aa modules, especially the item manager, from php code.

Sample code to call admin/index.php3 (item manager) from outside.

file: apc-aa/sample/itemmanager.php3
(this need to stay same level of folder with apc-aa/admin/ )

<?PHP
# parameter
# project_id - slice id for project slice.
#
# Usage:
# http://host.name/apc-aa/sample/itemmanager.php3&project_id=<slice id>
# <slice id> : slice id to be open ....
# optional parameter:
# Tab - this is for admin/index.php3 to select Table.
# ="app" - Active bin (default)
# ="appb" - Pending bin
# ="appc" - Expired
# ="hold" - Hold bin
# ="trash" - Trash
#
# AA_CP_Session - session id
#
require "../include/init_page.php3";
// this check AA_CP_Session and open login prompt and call me again.
// also it sets slice_id, is session is already there.


if( isset( $sess ) )
page_close(); // this will store session variables in database.



// === prepair parameters to call admin/index.php3 ===


// use change_id if we open the slice 1st time.
if ($project_id == $slice_id)
$slice_param = "&slice_id=$project_id"; // we may not need this.
else
$slice_param = "&change_id=$project_id";


// table to open (active,trash,hold,expire,pending...)
$tab_param = $Tab ? ("&Tab=".$Tab) : "";


// filter parameter from apc-aa/admin/index.php3
$filter_param = (!$admin_order)? "" :
"&admin_order=$admin_order".
"&admin_order_dir=$admin_order_dir".
"&admin_search=$admin_search".
"&admin_search_field=$admin_search_field";


// parametere for scroller -- set by admin/index.php3 (at callback)
$scroller_param="";
if ($scr_st3_Mv) $scroller_param .= "&scr_st3_Mv=$scr_st3_Mv";
if ($scr_st3_Go) $scroller_param .= "&scr_st3_Go=$scr_st3_Go";


$debug_param = $debug ? ("&debug=$debug") : "";


// parameter to call myself from admin/index.php3 (admin/index.php3 will call me back)
$my_param=
"AA_CP_Session=$AA_CP_Session".
"&project_id=$project_id".
"&projects_item=$projects_item".
$tab_param.
$debug_param;

$MY_URL=urlencode($PHP_SELF."?".$my_param); // &return_url=.... for itemedit.php3, etc.

// So, all parameter to call admin/index.php3 is prepaired we write the page.
?>
<?PHP // -- showing Project Tasks (a slice made from "Project Tasks (template)" )
// -- now , we are using ItemManager of APC-AA as our ItemManger (not slice.php3 with index view) $pts_item_manager = "http://localhost/apc-aa/admin/index.php3". "?AA_CP_Session=$AA_CP_Session". $slice_param. $tab_param. $scroller_param. "&bodyonly=1".
"&action_selected=1".
"&sort_filter=1".
"&return_url=$MY_URL".
$debug_param. ""; include $pts_item_manager; ?>
# action_select=1 turns off "Feed selected" and "View selected"
# sort_filter=1 turns off the sort line
# scr_st3_Mv and scr_st3_Go can be set to work with the scroller

Last Edit: Aug 17 2011

<aafaq id=1719> ~ToDo: 1719 Can I call apc-aa item-manager  from other php3 code </aafaq> 

This FAQ interface was developed by Jason at Commons.ca

APC: Internet and ICTs for social justice and development APC ActionApps is a free software content management system initiated by the Association for Progressive Communications (APC)
APC - Internet and ICTs for social justice and development