本文整理汇总了PHP中select::add方法的典型用法代码示例。如果您正苦于以下问题:PHP select::add方法的具体用法?PHP select::add怎么用?PHP select::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类select
的用法示例。
在下文中一共展示了select::add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$newfield->value = ${$newfield->field};
$newfield->add();
$listAnnees = array();
$listAnnees["0000"] = "0000";
$resultx = $PDO->free_requete("SELECT aa FROM " . $myTable . " GROUP BY aa");
foreach ($resultx as $rowx) {
$listAnnees[$rowx->aa] = $rowx->aa;
}
$newfield = new select();
$newfield->field = "F__annee";
$newfield->label = " " . $datas_lang["annee"];
$newfield->widthLabel = 0;
$newfield->widthField = 0;
$newfield->items = $listAnnees;
$newfield->value = ${$newfield->field};
$newfield->add();
// FIN FILTRES //////////////////////////////////////////
//for($i=0;$i<=101;$i++) {
// $lg = array_rand($myAdmin->LIST_LANG_DATAS, 1);
// $e = array_rand($listEmplacements, 1);
// $c = array_rand($listCampagnes, 1);
// $b = rand(1, 5);
// $aa = rand(2014, 2015);
// $mm = rand(1, 12);
// $jj = rand(1, 30);
//
// $nb_aff = rand(0, 500);
// $nb_click = rand(0, 50);
//
// $resultx = $PDO->free_requete("INSERT INTO " . $myTable . " (lg, id_emplacement, id_campagne, id_bandeau, aa, mm, jj, nb_aff, nb_click) VALUES ('$lg', $e, $c, $b, $aa, $mm, $jj, $nb_aff, $nb_click)");
//}
示例2: foreach
// FILTRES /////////////////////////////////////// ????
if (count($datasArticle["filtre"]) > 0) {
include DOS_INCPAGES_ADMIN . "list-prepareFiltres.php";
foreach ($datasArticle["filtre"] as $f => $filtre) {
if ($filtre["type"] == "select") {
reset($filtre["items"]);
$newfield = new select();
$newfield->field = "F__filtre_" . $filtre["field"];
$newfield->label = $filtre["label"];
$newfield->widthLabel = 1;
$newfield->multiLang = false;
$newfield->javascript = "onChange='submitFiltres()'";
$newfield->allItems = true;
$newfield->items = $filtre["items"];
$newfield->value = ${$newfield->field};
$datasArticle["filtre"][$f]["HTML_Filtre"] = $newfield->add();
}
if ($filtre["type"] == "date") {
$newfield = new date();
$newfield->field = "F__filtre_" . $filtre["field"];
$newfield->label = $filtre["label"];
$newfield->widthLabel = 1;
$newfield->changeYear = true;
$newfield->numberOfMonths = 1;
$newfield->dateFormat = "dd.mm.yy";
$newfield->javascript = "onChange='submitFiltres()'";
$newfield->value = ${$newfield->field};
$datasArticle["filtre"][$f]["HTML_Filtre"] = $newfield->add();
}
}
}
示例3: array
$socket_maps1 = array();
$socket_maps2 = array();
// 实例化select类
$select = new select($check_socks);
while (true) {
/*
print_r( $socket_maps );
print "<br />";
*/
// select轮询,超时2秒
foreach ($select->can_read(1) as $socket) {
// listen_sock可读,说明有人连接上来了
if ($socket == $listen_sock) {
// 接受新连接,并加入到轮训数组
$new_client = socket_accept($listen_sock);
$select->add($new_client);
socket_getpeername($new_client, $ip, $port);
echo "New client connected: {$ip}, {$port}<br />";
// 建立到真实服务器的socket
$server_sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($server_sock, "127.0.0.1", $listen_port);
// 建立真实服务器socket和真实客户端socket之间的映射关系
$socket_maps1[$new_client] = $server_sock;
$socket_maps2[$server_sock] = $new_client;
// 添加到select轮询中
$select->add($server_sock);
// $listen_sock的可读数据是因为有新连接,已经处理了。暂时去掉,因为下面开始处理数据转发
//select->remove( $listen_sock );
} else {
// 读取数据,失败则从轮询socket中删除,并关闭socket
$client_data = @socket_read($socket, 1024, PHP_NORMAL_READ);
示例4: add
public function add($param = "")
{
global $myAdmin;
global $formMaj;
global $datas_lang;
global $smarty;
global $thisSite;
parent::add();
if ($this->insideForm == false) {
$this->fileRequired = true;
$this->legendeEnabled = true;
}
if ($this->insideForm == true) {
$prefixe_field = $this->field . "__";
$mySelect = new mySelect(__FILE__);
$mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "medias";
$mySelect->fields = "*";
$mySelect->orderby = "id DESC";
// pour prendre le premier élément
$mySelect->where = "field_media=:field_media AND id_parent=:id_parent";
$mySelect->whereValue["field_media"] = array($this->field, PDO::PARAM_STR);
//$formMaj->tables . "." .
$id_parent = $formMaj->datasForm[$myAdmin->LANG_DATAS]["id"];
if ($id_parent == "") {
$id_parent = $formMaj->datasForm[""]["id"];
}
$mySelect->whereValue["id_parent"] = array($id_parent, PDO::PARAM_INT);
$resultmySelect = $mySelect->query();
foreach ($resultmySelect as $rowS) {
$lg = $rowS["lg"];
$value_fichier_media[$lg] = $rowS["fichier_media"];
$value_titre_media[$lg] = $rowS["titre_media"];
if ($lg == $myAdmin->LANG_DEF) {
// pour les données monolangue
$value_idMedia = $rowS["id"];
$value_fichier_media[""] = $rowS["fichier_media"];
$value_titre_media[""] = $rowS["titre_media"];
}
}
} else {
$prefixe_field = "";
}
$newfield = new select();
$newfield->field = "typeVideo";
$newfield->widthLabel = 2;
$newfield->widthField = 2;
$newfield->addStyleLabel = "margin-right:10px;";
$newfield->label = "";
$newfield->multiLang = false;
$newfield->defaultValue = $thisSite->TYPE_VIDEO_DEFAUT;
$newfield->items = $thisSite->LIST_TYPE_VIDEO;
$result = $newfield->add();
$field_fichier_media = $result;
$newfield = new input();
$newfield->field = $prefixe_field . "fichier_media";
$newfield->multiLang = $this->multiLangType;
/*if($this->insideForm==true) {
$newfield->label=$this->label;
} else {
$newfield->label=$datas_lang["lienVideo"];
}*/
$newfield->value = $value_fichier_media;
$newfield->widthLabel = 0;
$newfield->widthField = 3;
$newfield->addClass = $this->addClass;
if ($this->placeholder == "") {
$newfield->placeholder = $datas_lang["placeholderVideo"];
} else {
$newfield->placeholder = $this->placeholder;
}
$newfield->tooltip = $this->tooltip;
$result = $newfield->add();
$field_fichier_media .= $result;
if ($this->fileRequired == true) {
$newfield->rule("required", true);
}
// champ Titre: légende de l'image, du fichier ou du lien
if ($this->legendeEnabled == true) {
$newfield = new input();
$newfield->field = $prefixe_field . "titre_media";
$newfield->multiLang = true;
$newfield->value = $value_titre_media;
$newfield->label = $datas_lang["legende"];
$newfield->tooltip = $datas_lang["tooltipsLegende"];
$newfield->widthLabel = 2;
$newfield->widthField = 9;
$result = $newfield->add();
$field_titre_media = $result;
}
$smarty->assign('field_fichier_media', $field_fichier_media);
$smarty->assign('field_titre_media', $field_titre_media);
if ($this->insideForm == true) {
$newfield = new hidden();
$newfield->field = "fieldMedia__" . $this->field;
$newfield->multiLang = false;
$newfield->value = serialize(array("type" => $this->type, "field_media" => $this->field, "idMedia" => $value_idMedia));
$result = $newfield->add();
$smarty->assign('fieldMediaField', $result);
}
$smarty->assign('this', $this);
//.........这里部分代码省略.........
示例5: getScript
if ($extok == 1 && $posunder === false) {
$xx = explode(".", $file);
$file = array_shift($xx);
$lFiles[$repertoire . $dir . $file] = $file;
}
}
}
$newfield = new select();
$newfield->field = "script";
$newfield->multiLang = false;
$newfield->defaultValue = "";
$newfield->noneItem = true;
$newfield->label = "Script";
$newfield->items = $lFiles;
$newfield->valuesDisabled = $Dirs;
$newfield->javascript = "onChange='getScript()'";
echo $newfield->add();
?>
</div></section>
</fieldset>
<script type="text/javascript">
function getScript(){
if($("#titre_fr").val()=="") {
$("#titre_fr").val(ucfirst($("#script option:selected").text()));
}
$("#lien").val($("#script").val());
$("#param_lien").val("");
}
</script>