function dispatch()
 {
     global $ModuleDir, $ClassDir, $template, $DefaultModule, $DefaultPage, $timer;
     $this->path_info = ltrim(getenv("PATH_INFO"), "/");
     $this->setDefualtModule($DefaultModule);
     $this->setDefualtPage($DefaultPage);
     $module_name = $this->getModuleName() ? $this->getModuleName() : $this->getDefualtModule();
     $page_name = $this->getPageName() ? $this->getPageName() : $this->getDefualtPage();
     $action_name = $this->getActionName() ? $this->getActionName() : $this->default_action;
     include_once $ClassDir . "StringHelper.class.php";
     $page_class_name = StringHelper::CamelCaseFromUnderscore($page_name);
     $include_file = $ModuleDir . $module_name . DIRECTORY_SEPARATOR . $page_class_name . ".class.php";
     if (file_exists($include_file)) {
         include_once $include_file;
         $TempObj = new $page_class_name();
         $Action = "execute" . ucfirst($action_name);
         $TempObj->{$Action}();
     }
     //		printf("module %s/ page %s/ action %s/ ",$module_name,$page_name,$action_name);
     //		$template->setFile(array (
     //			"TAB" => "tab.html",
     //		));
     //		$template->setBlock("TAB", "tab");
     $this->parseTemplateLang(true);
     $template->parse("OUT", array("LAOUT"));
     $template->p("OUT");
     if (defined('APF_DEBUG') && APF_DEBUG == true) {
         $timer->stop();
         $timer->display();
     }
 }
 * contact.import.from.csv.php.
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: contact.import.from.csv.php,v 1.1 2006/09/27 16:08:53 arzen Exp $
 */
define('APF_ROOT_DIR', realpath(dirname(__FILE__) . '/..'));
define('APF_DEBUG', true);
require_once APF_ROOT_DIR . DIRECTORY_SEPARATOR . 'tools.init.php';
require_once 'File/CSV.php';
require_once $ClassDir . 'StringHelper.class.php';
$header = array("name", "mobile", "phone");
$conf = array('fields' => count($header), 'sep' => ";", 'quote' => '', 'header' => false, 'crlf' => "\r\n");
$file = "D:/nokia_tool/contact.txt";
$csv = new File_CSV();
$conf = File_CSV::discoverFormat($file);
$i = 0;
while ($fields = File_CSV::read($file, $conf)) {
    $apf_contact = DB_DataObject::factory('ApfContact');
    $j = 0;
    foreach ($fields as $coloum_data) {
        $coloum_function = "set" . StringHelper::CamelCaseFromUnderscore($header[$j]);
        $apf_contact->{$coloum_function}($coloum_data);
        $j++;
    }
    $apf_contact->insert();
    $i++;
}
echo "Import {$i} records;";
 function exportPDF()
 {
     global $i18n, $ClassDir;
     require_once 'fpdf/PDF_Chinese.php';
     require_once $ClassDir . 'StringHelper.class.php';
     $header = array("name" => "20", "gender" => "12", "birthday" => "25", "mobile" => "30", "phone" => "30", "office_phone" => "30", "fax" => "30", "addrees" => "20");
     $pdf = new PDF_Chinese();
     $pdf->AddGBFont('simsun', 'ËÎÌå');
     $pdf->AddGBFont('simhei', 'ºÚÌå');
     $pdf->AddGBFont('simkai', '¿¬Ìå_GB2312');
     $pdf->AddGBFont('sinfang', '·ÂËÎ_GB2312');
     $pdf->Open();
     $pdf->SetMargins(5, 20, 5);
     $pdf->AddPage();
     $pdf->SetAutoPageBreak("on", 20);
     $pdf->SetFont('simsun', '', 16);
     $pdf->Cell(0, 20, $i18n->_('Contact'), 0, 1, 'C');
     foreach ($header as $title => $lenght) {
         $header_title_arr[] = $i18n->_(StringHelper::CamelCaseFromUnderscore($title));
     }
     // Write header
     $pdf->SetFont('simsun', 'B', 7);
     $pdf->SetWidths(array_values($header));
     $pdf->Row(array_values($header_title_arr));
     // Write contact record
     $pdf->SetFont('simsun', '', 7);
     $apf_contact = DB_DataObject::factory('ApfContact');
     $apf_contact->orderBy('id desc');
     $apf_contact->find();
     $i = 0;
     $page_rows = 30;
     while ($apf_contact->fetch()) {
         $i % $page_rows == 0 && $i ? $pdf->AddPage() : "";
         $coloum_data = array();
         foreach ($header as $title => $lenght) {
             $coloum_function = "get" . StringHelper::CamelCaseFromUnderscore($title);
             $coloum_data[] = $apf_contact->{$coloum_function}();
         }
         $pdf->Row(array_values($coloum_data));
         $i++;
     }
     $pdf->SetFont('Arial', '', 9);
     $pdf->AliasNbPages();
     $filename = date("Y_m_d") . "_contact_export.pdf";
     $pdf->Output($filename, true);
     exit;
 }