コード例 #1
0
    public static function markTagAsSold($tag)
    {
        $db =& JFactory::getDBO();
        $query = "UPDATE #__cbodb_items SET isSold = TRUE WHERE tag = '" . $tag . "'";
        $db->setQuery($query);
        $result = $db->loadResult();
        if ($db->getErrorNum()) {
            echo $db->stderr();
            return false;
        } else {
            return true;
        }
    }
}
/* END class CbodbItem */
CbodbItem::$commissionMechanics = CbodbItem::getCommissionedMechanics();
class CbodbTask
{
    private $id;
    public $data;
    public function __construct($id = null)
    {
        $row =& JTable::getInstance('task', 'Table');
        if ($id) {
            $row->id = $id;
            $row->load($this->id);
        }
        $this->data = $row;
    }
    public function __get($member)
    {
コード例 #2
0
ファイル: cbodb.html.php プロジェクト: reeleis/ohiocitycycles
    function addBicycle($option, $memberID)
    {
        //$commissionMechanics = CbodbMember::getGroupMemberList($option, "Commission mechanic");
        $commissionMechanics = CbodbItem::getCommissionedMechanics();
        $commissionMechanics[0] = "No one";
        ksort($commissionMechanics);
        ?>
  <h2>Enter a Bicycle</h2>
  <p>Use this form to enter the bicycle you've been working on into our database system. When you're done, press "Save and Finish", and the system will give a tag number to write on the bicycle's paper tag.</p>
  <?php 
        JHTML::_('behavior.formvalidation');
        ?>
	<script language="javascript">
	function myValidate(f) {
   	if (document.formvalidator.isValid(f)) {
      	f.check.value='<?php 
        echo JUtility::getToken();
        ?>
'; //send token
      	return true; 
   	}
   	else {
      var msg = 'You have not entered all necessary values for this bicycle:';
 
      //Example on how to test specific fields
      if($('bikeBrand').hasClass('invalid')){msg += '\n\n\tMissing Brand';}
      if($('bikeModel').hasClass('invalid')){msg += '\n\tMissing Model';}
      if($('bikeColor').hasClass('invalid')){msg += '\n\tMissing Color';}
      if($('bikeSerial').hasClass('invalid')){msg += '\n\tMissing Serial';}
      if($('priceSale').hasClass('invalid')){msg += '\n\tMissing Price';}
      if($('bikeSize1').hasClass('invalid')){msg += '\n\tMissing Height';}
      if($('bikeSize2').hasClass('invalid')){msg += '\n\tMissing Length';}
      if($('bikeSize3').hasClass('invalid')){msg += '\n\tMissing Tire Size';}
 
      alert(msg);
   	}
   return false;
}
</script>
  
  <form id="test-form" method="post" class="form-validate" onSubmit="return myValidate(this);">
  <input type="hidden" name="check" value="post"/>
  <table>
    <tr>
    	<td width="200" align="right" class="key">Bike Brand:</td>
    	<td><input type="text" class="required" name="bikeBrand" id="bikeBrand" size="20" maxlength="50" value="" /></td>
    </tr>
    <tr>
    	<td width="200" align="right" class="key">Bike Model:</td>
    	<td><input type="text" class="required" name="bikeModel" id="bikeModel" size="20" maxlength="50" /></td>
    </tr>
    <tr>
    	<td width="200" align="right" class="key">Color:</td>
    	<td><input class="required" type="text" name="bikeColor" id="bikeColor" size="20" maxlength="50" /></td>
    </tr>
    <tr>
    	<td width="200" align="right" class="key">Bike Serial Number:</td>
    	<td><input class="required" type="text" name="bikeSerial" id="bikeSerial" size="20" maxlength="50" /></td>
    </tr>
	  <tr>
	  	<td width="100" align="right" class="key">Sale Price:</td>
	  	<td><input class="required" type="text" name="priceSale" id="priceSale" size="50" maxlength="250" /></td>	
	  </tr>
	  <tr>
	  	<td width="100" align="right" class="key">Is it for sale?</td>
	  	<td><input type="checkbox" name="isForSale" id="isForSale" /></td>
	  </tr>		
	  <tr>
	  	<td width="100" align="right" class="key">Is it ready?</td>
	  	<td><input type="checkbox" name="isReady" id="isReady" /></td>
	  </tr>
	  <tr>
	  	<td width="100" align="right" class="key">Size:</td>
	  	<td>
	  	  <input class="required" type="text" name="bikeSize1" id="bikeSize1" size="5" maxlength="250" /> x
	  		<input class="required" type="text" name="bikeSize2" id="bikeSize2" size="5" maxlength="250" /> x
	  		<input class="required" type="text" name="bikeSize3" id="bikeSize3" size="5" maxlength="250" /> &nbsp;
	  	</td>
	  </tr>
	  <tr>
	  	<td width="100" align="right" class="key">Location:</td>
	  	<td><?php 
        HTML_cbodb::dropdownFromArray("location", CbodbItem::$itemLocationArray, 0);
        ?>
</td>
	  </tr>		
	  <tr>
	  	<td width="100" align="right" class="key">Style:</td>
	  	<td><?php 
        HTML_cbodb::dropdownFromArray("bikeStyle", CbodbItem::$itemBikeStyleArray, 0);
        ?>
</td>
	  </tr>		
	  <tr>
	  	<td width="100" align="right" class="key">Drivetrain:</td>
	  	<td><?php 
        HTML_cbodb::dropdownFromArray("bikeDrivetrain", CbodbItem::$itemBikeDrivetrainArray, 0);
        ?>
</td>
	  </tr>		
	  <tr>
	  	<td width="100" align="right" class="key">Frame style:</td>
	  	<td><?php 
        HTML_cbodb::dropdownFromArray("bikeFrameStyle", CbodbItem::$itemBikeFrameStyleArray, 0);
        ?>
</td>
	  </tr>		
	  <tr>
	  	<td width="100" align="right" class="key">Tire Style:</td>
	  	<td><?php 
        HTML_cbodb::dropdownFromArray("bikeTireStyle", CbodbItem::$itemBikeTireStyleArray, 0);
        ?>
</td>
	  </tr>
	  <tr>
	  	<td width="100" align="right" class="key">Commission:</td>
	  	<td><?php 
        HTML_cbodb::dropdownFromArray("commissionUserID", $commissionMechanics, 0);
        ?>
</td>
	  </tr>
  </table>
  <br />	
  <input type="submit" name="membersubmit" value="Save and Finish">
  <input type="hidden" name="memberID" value="<?php 
        echo $memberID;
        ?>
">
  <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
  <input type="hidden" name="task" value="savenewbicycle" />
  <input type="hidden" name="isBike" value="on" />
  </form>
<?php 
    }