• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/ZendX/JQuery/Controller/Action/Helper/AutoComplete.php

00001 <?php
00023 require_once "Zend/Controller/Action/Helper/AutoComplete/Abstract.php";
00024 
00025 class ZendX_JQuery_Controller_Action_Helper_AutoComplete
00026 extends Zend_Controller_Action_Helper_AutoComplete_Abstract
00027 {
00034     public function validateData($data)
00035     {
00036         if (!is_array($data)) {
00037             return false;
00038         }
00039 
00040         return true;
00041     }
00042 
00050     public function prepareAutoCompletion($data, $keepLayouts = false)
00051     {
00052         if (!$this->validateData($data)) {
00056             require_once 'Zend/Controller/Action/Exception.php';
00057             throw new Zend_Controller_Action_Exception('Invalid data passed for autocompletion');
00058         }
00059 
00060         $data = (array) $data;
00061         $output = "";
00062         foreach($data AS $k => $v) {
00063             if(is_numeric($k)) {
00064                 $output .= $v."\n";
00065             } else {
00066                 $output .= $k."|".$v."\n";
00067             }
00068         }
00069 
00070         if (!$keepLayouts) {
00071             $this->disableLayouts();
00072         }
00073 
00074         return $output;
00075     }
00076 }

Generated on Thu Apr 19 2012 17:01:18 for openbiz by  doxygen 1.7.2