本文整理汇总了PHP中Combo::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Combo::find方法的具体用法?PHP Combo::find怎么用?PHP Combo::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combo
的用法示例。
在下文中一共展示了Combo::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extractAndSave
function extractAndSave($comboName, $type = 1)
{
/*
Extract and Save choices of the combo/option
PARAM:
# comboName - name of the combo/option within the web page
# type - 1 for combo, 2 for option
RESULT:
# none
*/
$arrCombo = Combo::find('all', array('conditions' => array('nameCombo=? and levelCombo=1', $comboName)));
if (count($arrCombo) == 0) {
echo "! No such combobox named '{$comboName}' <br>";
return;
}
$combo = $arrCombo[0];
$combo_id = $combo->idcombo;
// --1-- Found corresponding id of the combo named "$comboName"
$arrChoices = array();
if ($type == 1) {
$arrChoices = extractComboChoices($comboName);
} else {
$arrChoices = extractOptionChoices($comboName);
}
// --2-- extracted choice array from remote site
Combochoice::table()->delete(array('comboidcombochoice' => $combo_id));
// --3-- cleaned up old choices data to avoid redundancy
foreach ($arrChoices as $key => $text) {
$objChoice = new Combochoice();
$objChoice->comboidcombochoice = $combo_id;
$objChoice->textcombochoice = $text;
$objChoice->valuecombochoice = $key;
$objChoice->save();
}
// --4-- saved extracted choice data into the database
echo "### Successfully extracted choice information for ";
echo $type == 1 ? "Combo" : "Option Group";
echo " named \"{$comboName}\" <br>";
}