[ PHPXref.com ] [ Generated: Sun Jul 20 21:04:18 2008 ] [ WikyBlog 0.9.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/include/ -> specCoordAcctsLocal2.php (source)

   1  <?
   2  //$lang under development
   3  
   4  if ( !defined('WikyBlog') ){
   5      die("Not an entry point...");
   6  }
   7  
   8  
   9  includeFile('search.php');
  10  includeFile('toolBatchObject.php');
  11  
  12  class coordAccts{
  13      var $t;
  14      var $searchObj;
  15      
  16  	function coordAccts(){
  17          global $page,$pageOwner,$dbInfo;
  18          
  19  
  20          switch($page->userCmd){
  21              
  22              case 'continue':
  23                  $this->searchObj = new coordAcctsSearch();
  24                  // foreach($this->searchObj->data as $i => $row){
  25                  //     echo $row;
  26                  // }
  27                  
  28              break;
  29      
  30              default:
  31                  $this->selectDataType();
  32              break;
  33          }
  34          
  35          //$this->setTimestamp();
  36      }
  37      
  38  	function selectDataType(){
  39          global $page,$pageOwner,$dbInfo;
  40          ob_start();
  41          echo '<table id="update" border="0" style="margin-left:auto;margin-right:auto"><tr><td>';
  42          echo '<h3 class="underline">Select a File Type:</h3> ';
  43          foreach($dbInfo as $key => $space){
  44              if( !isset($space['dbTable']) ){
  45                  continue;
  46              }
  47              echo ' <input type="hidden" name="xmlForms" value="'.wbStrtolower($key).'" />';
  48              echo ' <input type="hidden" name="cmd" value="continue" />';
  49              echo ' <input type="submit" name="space" value="'.wbUcwords($key).'" /> ';
  50          }
  51          echo '</td></tr></table>';
  52          $page->contentA['Coord Accts'] = ob_get_clean();
  53  
  54      }
  55      
  56  	function setTimestamp(){
  57          global $pageOwner;
  58          $pageOwner['coordtimestamp'] = date('Y-m-d H:i:s');
  59          //unset($pageOwner['coordtimestamp']);
  60      }
  61      
  62  }
  63  
  64  class coordAcctsSearch extends query{
  65      var $data;
  66      var $keys;
  67      
  68      
  69  	function coordAcctsSearch(){
  70          global $dbInfo,$pageOwner,$batchObject;
  71          
  72          $this->rowLimit = 5;
  73          
  74          if( !batchSetObject($_POST['space']) ){
  75              return;
  76          }
  77          
  78          $this->data['space'] = $_POST['space'];
  79          
  80          $select = array();
  81          foreach($batchObject->dbInfo['keys'] as $key => $trash){
  82              $select[] = $key;
  83              $this->keys[] = $key;
  84          }
  85          foreach($batchObject->userValues as $key => $trash){
  86              $select[] = $key;
  87              $this->keys[] = $key;
  88          }
  89          $this->keys[] = 'flags';
  90          
  91          if( isset($_POST['offset']) ){
  92              $_GET['offset'] = $_POST['offset'];
  93          }
  94          
  95          
  96          $this->query = 'SELECT SQL_CALC_FOUND_ROWS ';
  97          $this->query .= implode(', ',$select);
  98          $this->query .= ' FROM '.$batchObject->dbInfo['queryFrom'].' WHERE ';
  99          $this->query .= ' owner="'.$pageOwner['username'].'" ';
 100          
 101          //this needs to be in the data file!
 102  //         if(isset($pageOwner['coordtimestamp']) ){
 103  //             $this->query .= ' AND modified >= "'.$pageOwner['coordtimestamp'].'"';
 104  //         }
 105          
 106          $this->limit();
 107          message($this->query);
 108          browseSearch3($this,'Coord Accts');
 109          
 110      }
 111      
 112  	function sendData(){
 113          
 114          if( !loadExtension('curl') ){
 115              message('Could not load the Curl extension.');
 116              return;
 117          }
 118                  
 119          //$ch = curl_init("http://wikyblog2/main/home?xmlHttp=10");
 120          //$ch = curl_init("http://wikyblog2/special/main/coordaccts");
 121          $ch = curl_init("http://wikyblog2/special/main/coordremote?xmlHttp=1");
 122          curl_setopt($ch, CURLOPT_HEADER, FALSE);             //don't include the header in the output
 123          curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);         //return as string instead of outputing to browser
 124          curl_setopt($ch, CURLOPT_POST,TRUE);                //Send as POST
 125          curl_setopt($ch, CURLOPT_POSTFIELDS,$this->data);    //CAREFUL! looks like data gets modified
 126          
 127          echo '<br/><div class="underline"><h3 class="heading">Response:</h3></div>';
 128          echo curl_exec($ch);
 129          curl_close($ch);
 130          
 131      }    
 132      
 133      ////////////////////////////////////////////////////////////////////////////////
 134      //
 135      //    Functions that are called from browseSearch3()
 136      //        - here they set $this->data which will be set to the remote server
 137      //
 138  
 139      //setLinks()    
 140      //    must set $this->currLabel at least
 141  	function setLinks(&$currentPageNum,&$rowsFound,&$tabLabel){
 142          $this->currLabel = $tabLabel;
 143      }
 144      
 145  	function displayNumbers(&$from,&$to,&$rowsFound,&$prev,&$next,&$current){
 146          
 147          $offset = min($_GET['offset'] + $this->rowLimit,$rowsFound);
 148          
 149          echo '<input type="hidden" name="xmlForms" value="continue" />';
 150          echo '<input type="hidden" name="offset" value="'.$offset.'" />';
 151          echo '<input type="hidden" name="space" value="'.$_POST['space'].'" />';
 152          echo '<input type="submit" name="cmd" value="Continue" />';
 153          //parent::displayNumbers(&$from,&$to,&$rowsFound,&$prev,&$next,&$current);
 154      }
 155  	function displayEmpty(){
 156          message('next');
 157          return false;
 158      }
 159  	function displayPre(){ }
 160  	function display($row,$i){
 161          global $batchObject;
 162          
 163          foreach($this->keys as $key){
 164              $index = $i.'['.urlencode($key).']';
 165              $this->data[$index] = $row->$key;
 166          }
 167      }
 168  	function displayPost(&$prev,&$pages,&$next,$more=null){
 169          $this->sendData();
 170      }
 171  }
 172  
 173  
 174  
 175  global $page,$pageOwner,$dbObject;
 176  
 177  $newObj = new coordAccts();
 178  
 179  $page->formAction = '/Special/'.$pageOwner['username'].'/coordAccts';
 180  $page->displayTitle = 'Coordinate Accounts';
 181  $dbObject->links['Coord Accts'] = $page->formAction;


[ Powered by PHPXref - Served by Debian GNU/Linux ]