Ejemplo n.º 1
0
 function post_u_view()
 {
     global $FANNIE_OP_DB, $FANNIE_URL;
     $this->add_script($FANNIE_URL . '/src/javascript/jquery.js');
     $this->add_css_file($FANNIE_URL . '/src/style.css');
     $ret = '';
     $ret .= '<form action="SyncFromSearch.php" method="post">';
     $scales = new ServiceScalesModel(FannieDB::get($FANNIE_OP_DB));
     $ret .= '<div class="panel panel-default">
         <div class="panel-heading">Scales</div>
         <div class="panel-body">';
     foreach ($scales->find('description') as $scale) {
         $ret .= sprintf('<input type="checkbox" class="scaleID" name="scaleID[]" 
                             id="scaleID%d" value="%d" />
                          <label for="scaleID%d">%s</label><br />', $scale->serviceScaleID(), $scale->serviceScaleID(), $scale->serviceScaleID(), $scale->description());
     }
     $ret .= '</div></div>';
     $ret .= '<p><button type="submit" name="sendall" value="1"
                 class="btn btn-default">Sync All Items</button></p>';
     $ret .= '<div id="alert-area"></div>';
     $ret .= '<table class="table">';
     $ret .= '<tr>
             <th>UPC</th>
             <th>Description</th>
             <th>Price</th>
             <th>Last Changed</th>
             <th>Send Now</th>
             </tr>';
     $model = new ScaleItemsModel(FannieDB::get($FANNIE_OP_DB));
     foreach ($this->upcs as $upc) {
         $model->plu($upc);
         if (!$model->load()) {
             continue;
         }
         $ret .= sprintf('<tr id="row%s">
                         <td>%s</td>
                         <td>%s</td>
                         <td>%.2f</td>
                         <td>%s</td>
                         <td><button type="button" class="btn btn-default"
                             onclick="sendOne(\'%s\'); return false;">Sync Item</button></td>
                         <input type="hidden" name="upcs[]" value="%s" />
                         </tr>', $model->plu(), $model->plu(), $model->mergeDescription(), $model->price(), $model->modified(), $model->plu(), $model->plu());
     }
     $ret .= '</table>';
     $ret .= '</form>';
     return $ret;
 }