当前位置: 首页>>代码示例>>PHP>>正文


PHP Combo::find方法代码示例

本文整理汇总了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>";
}
开发者ID:p-mob2015,项目名称:idea19,代码行数:39,代码来源:quinstreet.php


注:本文中的Combo::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。