Пример #1
0
function createInput($name, $type = "text", $size = 7, $default_value = null, $list_name = null, $comment = null)
{
    $prefix = "convprofile_";
    global $element_id;
    $element_id++;
    $id = $name . "_" . $element_id;
    if (!$type) {
        $type = "text";
    }
    if (!$size) {
        $size = 20;
    }
    if (!$default_value) {
        $default_vlaue = "";
    }
    $str = "<td>";
    if ($type == "select") {
        $str .= createSelect($id, $name, $default_value, $list_name);
    } elseif ($type == "textarea") {
        @(list($rows, $cols) = explode(",", $size));
        $str .= "<textarea id='{$prefix}{$id}' name='{$prefix}{$name}' rows='{$rows}' cols='{$cols}' >{$default_value}</textarea>";
    } else {
        $str .= "<input id='{$prefix}{$id}' name='{$prefix}{$name}'  type='{$type}'' size='{$size}' value='{$default_value}'>";
    }
    $str .= "</td><td style='color:gray; font-size:11px; font-family:arial;'>" . ($comment ? "* " . $comment : "&nbsp;") . "</td>";
    return $str;
}
Пример #2
0
 public static function obtieneProducto($con, $codProd)
 {
     if ($codProd != null || $codProd != "") {
         $values = ["*" => ""];
         $conditions = ["cod" => "{$codProd}"];
         $sql = createSelect("producto", $values, $conditions);
         $resultado = execSelect($con, $sql, $conditions);
         $productos = array();
         $producto = null;
         if (isset($resultado)) {
             $row = $resultado->fetch();
             $producto = new Producto($row);
         }
         return $producto;
     }
 }
function smarty_function_absDateSelect($params, &$smarty)
{
    /* return text input, calendar select, and date unit select html codes
        WARNING: util/calendar.tpl should be included in smarty before this method called
        parameter name (required,string): name of text input. _unit will be appended to this name, for select name of date unit
    */
    $select = createSelect($params, $smarty);
    $text_default = getSelectedAttrFromSmartyParams($smarty, $params);
    return <<<END
<input type=text name="{$params["name"]}" value="{$text_default}" id="{$params["name"]}_input" class="text">
<input type=image id="{$params["name"]}_calendar" onclick="setup_calendar('{$params["name"]}_input', '{$params["name"]}_calendar', this.date_type); return false;" src="/IBSng/images/icon/calendar.gif">
{$select}
<script>
    absDateSelectChanged(document.getElementById('{$params["name"]}_select'),'{$params["name"]}_calendar');
</script>
END;
}
Пример #4
0
function editDisplay()
{
    global $config;
    if ($_SESSION["Privilege"] == "admin") {
        #use session data if logged in as admin only
        $myID = (int) $_SESSION['AdminID'];
    } else {
        if (isset($_POST['AdminID']) && (int) $_POST['AdminID'] > 0) {
            $myID = (int) $_POST['AdminID'];
            #Convert to integer, will equate to zero if fails
        } else {
            feedback("AdminID not numeric", "error");
            myRedirect($config->adminReset);
        }
    }
    $privileges = getENUM(PREFIX . 'Admin', 'Privilege');
    #grab all possible 'Privileges' from ENUM
    $myConn = conn('', FALSE);
    $sql = sprintf("select FirstName,LastName,Email,Privilege from " . PREFIX . "Admin WHERE AdminID=%d", $myID);
    $result = @mysql_query($sql, $myConn) or die(trigger_error(mysql_error(), E_USER_ERROR));
    if (mysql_num_rows($result) > 0) {
        //show results
        while ($row = mysql_fetch_array($result)) {
            //dbOut() function is a 'wrapper' designed to strip slashes, etc. of data leaving db
            $FirstName = dbOut($row['FirstName']);
            $LastName = dbOut($row['LastName']);
            $Email = dbOut($row['Email']);
            $Privilege = dbOut($row['Privilege']);
        }
    } else {
        //no records
        //put links on page to reset form, exit
        echo '
      <div align="center"><h3>No such administrator.</h3></div>
      <div align="center"><a href="' . $config->adminDashboard . '">Exit To Admin</a></div>
      ';
    }
    $config->loadhead = '
	<script type="text/javascript" src="<?php echo VIRTUAL_PATH; ?>include/util.js"></script>
	<script type="text/javascript">
			function checkForm(thisForm)
			{//check form data for valid info
				if(empty(thisForm.FirstName,"Please enter first name.")){return false;}
				if(empty(thisForm.LastName,"Please enter last name.")){return false;}
				if(!isEmail(thisForm.Email,"Please enter a valid Email Address")){return false;}
				return true;//if all is passed, submit!
			}
	</script>
	';
    get_header();
    echo '
	<h3 align="center">Edit Administrator</h3>
	<form action="' . $config->adminEdit . '" method="post" onsubmit="return checkForm(this);">
	<table align="center">
		<tr>
			<td align="right">First Name</td>
			<td>
				<input type="text" name="FirstName" value="' . $FirstName . '" />
				<font color="red"><b>*</b></font>
			</td>
		</tr>
		<tr>
			<td align="right">Last Name</td>
			<td>
				<input type="text" name="LastName" value="' . $LastName . '" />
				<font color="red"><b>*</b></font>
			</td>
		</tr>
		<tr>
			<td align="right">Email</td>
			<td>
				<input type="text" name="Email" value="' . $Email . '" />
				<font color="red"><b>*</b></font>
			</td>
		</tr>
	';
    if ($_SESSION["Privilege"] == "developer" || $_SESSION["Privilege"] == "superadmin") {
        # uses createSelect() function to preload the select option
        echo '
			<tr>
				<td align="right">Privilege</td>
				<td>
				';
        # createSelect(element-type,element-name,values-array,db-array,labels-array,concatentator) - creates preloaded radio, select, checkbox set
        createSelect("select", "Privilege", $privileges, $Privilege, $privileges, ",");
        #privileges is from ENUM
        echo '
				</td>
			</tr>';
    } else {
        echo '<input type="hidden" name="Privilege" value="' . $_SESSION["Privilege"] . '" />';
    }
    echo '
	   <input type="hidden" name="AdminID" value="', $myID . '" />
	   <input type="hidden" name="act" value="update" />
	   <tr>
			<td align="center" colspan="2">
				<input type="submit" value="Update Admin" />
				<em>(<font color="red"><b>*</b> required field</font>)</em>
			</td>
		</tr>
	</table>    
	</form>
	<div align="center"><a href="' . $config->adminDashboard . '">Exit To Admin</a></div>
	';
    @mysql_free_result($result);
    //free resources
    get_footer();
}
Пример #5
0
}
if (isset($_GET['status']) && $_GET['status'] != '') {
    $tpl->AssignValue("select_status", createSelect("status", $statusoptions, $_GET['status'], 'class="listmenus" style="width:155px;"'));
} else {
    $tpl->AssignValue("select_status", createSelect("status", $statusoptions, '', 'class="listmenus" style="width:155px;"'));
}
//Get BA
$q_user = Query("SELECT u.*, t.* FROM user u, user_roles t WHERE t.roleID REGEXP '^2\$' AND u.status REGEXP '1' AND u.id=t.userID");
$ba[''] = 'Select BA';
while ($r_user = FetchAssoc($q_user)) {
    $ba[$r_user["id"]] = $r_user["first_name"] . ' ' . $r_user["last_name"];
}
if (isset($_GET['ba'])) {
    $tpl->AssignValue("select_ba", createSelect("ba", $ba, $_GET['ba'], 'class="listmenus" style="width:155px;"'));
} else {
    $tpl->AssignValue("select_ba", createSelect("ba", $ba, '', 'class="listmenus" style="width:155px;"'));
}
if ($_SESSION['utype'] != 'BA') {
    $tpl->Zone("balist", "enabled");
}
//conditions based on login
$extra = '';
$condition = array();
if ($_SESSION['utype'] == 'BA') {
    $condition['o.created_by'] = $_SESSION['id'];
    $extra = " AND o.created_by = {$_SESSION['id']}";
} else {
    if ($_SESSION['utype'] == 'AM') {
        $condition['u.area_id'] = $_SESSION['areaid'];
        $extra = " AND u.area_id = {$_SESSION['areaid']}";
    } else {
function createInput($name, $type = "text", $size = 7, $default_value = null, $list_name = null, $comment = null, $content_id = null, $checked = true)
{
    global $element_id, $pid_arr;
    $element_id++;
    $id = $name . "_" . $element_id;
    // a good enough unique algo for the path of the element (including the context_id)
    $pid = substr(md5($content_id . $name), 0, 3);
    //	if ( isset ( $pid_arr[$pid] ) ) echo "DUPLICATE PID $pid";
    $pid_arr[$pid] = $pid;
    $pid_str = " pid='{$pid}' ";
    if (!$type) {
        $type = "text";
    }
    if (!$size) {
        $size = 20;
    }
    if (!$default_value) {
        $default_vlaue = "";
    }
    $copyToClipboard = "";
    if ($name == "ks" || $name == "ks2") {
        $copyToClipboard = "<a href='#' onclick='copyToClipboard(\"{$id}\"); return false;'>(copy)</a>";
    }
    // set the default "checked" for the radio to be according to $checked
    $str = "<tr>" . "<td ><input type='checkbox' " . ($checked ? "checked=checked" : "") . " class='shouldsend' sibling_id='{$id}' onclick='enableDisable ( this , \"{$id}\")'>" . "{$name}:{$copyToClipboard}</td><td>";
    if ($type == "select") {
        $str .= createSelect($id, $name, $default_value, $list_name, $pid_str);
    } elseif ($type == "textarea") {
        @(list($rows, $cols) = explode(",", $size));
        $str .= "<textarea id='{$id}' name='{$name}' rows='{$rows}' cols='{$cols}' {$pid_str}>{$default_value}</textarea>";
    } else {
        $str .= "<input id='{$id}' name='{$name}' id='{$name}' type='{$type}'' size='{$size}' value='{$default_value}' {$pid_str}>";
    }
    $str .= "</td><td style='color:gray; font-size:11px; font-family:arial;'>" . ($comment ? "* " . $comment : "&nbsp;") . "</td></tr>";
    return $str;
}
Пример #7
0
function validateUser($connection, $table, $user, $password)
{
    $conditions = ["usuario" => $user, "password" => md5($password)];
    $vals = array("*");
    $sql = createSelect($table, $vals, $conditions);
    echo $sql;
    $validate = execSelect($connection, $sql, $conditions);
    if ($validate->fetch()) {
        return true;
    } else {
        return false;
    }
}
Пример #8
0
</div>

<div id="newFixture" class="reveal-modal small" data-reveal>
    <h2>Add new match.</h2>  
    <div class="row">
        <div class="large-8 small-8 medium-8">
            <form id="addMatch" action="<?php 
echo plugin_dir_url(__FILE__);
?>
../db/insertFixture.php" method="POST">
                <input type="hidden" name="addFixture" value="Form"/>
                <span class="label">Tournaments: </span><?php 
echo createSelect("Tournament", "tournamentId");
?>
    
                <span class="label">Groups/Pool</span><input name="_group" type="text" value="" placeholder="Group or Pool Name">
                <span class="label">Match date & Time: </span><input id="newFixtureDTP" type="text" name="matchdate" placeholder="Select date & time" >
                <span class="label">Team A: </span><?php 
echo createSelect("Team", 'TeamA');
?>
                <span class="label">Team B:</span> <?php 
echo createSelect("Team", 'TeamB');
?>
                <span class="label">Venue:</span> <input name="venue" type="text" value="" placeholder="Venue Name">
                <button id="saveFixture" class="saveNew" role="button" tabindex="0" aria-label="Save"><i class="fi-save"></i> Save</button>
            </form>
        </div>
    </div>
    <a class="close-reveal-modal">&#215;</a>
</div>
				<?php 
}
?>
	</div>
	<div class="product-right">
		<div style="background-color:#FFDEAD; margin-left:20px; margin-top:20px; border-radius:5px; padding-left:200px; height:40px; "> Please, enter your changes</div>
		<form action="action_add_product" method='post' enctype="multipart/form-data">
			<div class="left_part">
				<strong>Name:</strong><br>
				<input type="text" name="name" value="<?php 
echo $product['name'];
?>
"><br>
				<strong>Type:</strong><br>
				<?php 
echo createSelect($product['type'], $product_type_list, "type_id");
?>
<br>	
				<strong>Price:</strong><br>
				<input type="text" name="price" value="<?php 
echo $product['price'];
?>
"><br>
			</div>
			<div class="right_part">
				<strong style="margin-left:60px;">Logo:</strong><br>
				<input type='file' name='logo'  style="background-color:lightgray; width: 230px; border-radius:5px; padding 15px; margin-left:60px;"><br>
				<strong style="margin-left:60px;">Gallery:</strong><br>
				<input type='file' name='photos[]' multiple style="background-color:lightgray; width: 230px; border-radius:5px; padding 15px; margin-left:60px;"><br>
			</div>
			<div style="clear:both">
Пример #10
0
                </div>                      
            </form>      
        </div>
    </div>
    <?php 
//Added in - Version 1.1.1
?>
    
    <div class="panel">
        <div class="row">
            <form id="selectTournament" method="post" role="form" action="">                
                <div class="large-6 columns">
                    <label for="tournament">Select tournament</label>
                    <?php 
$selected = isset($_POST['tId']) ? $_POST['tId'] : null;
$t = createSelect('Tournament', 'tId', $selected);
echo $t;
?>
                </div>  
                <div class="large-6 columns">
                    <button id="uploadPTFile" class="saveNew" role="button" tabindex="0" aria-label="Save"><i class="fi-upload"></i> Submit</button>
                </div>                      
            </form>      
        </div>
    </div>
    <div class="row">        
        <?php 
//echo "<h4>" . __('Add results', 'oscimp_trdom') . "</h4>";
?>
        <table id="wp_pointtable" class="large-12 small-12 medium-12" >
            <thead>    
Пример #11
0
			</td>
		</tr>
		<tr>
			<td align="right">Email</td>
			<td>
				<input type="text" name="Email" />
				<font color="red"><b>*</b></font>
			</td>
		</tr>
	   <tr>
	   		<td align="right">Privilege:</td>
	   		<td>
	   	';
    $privileges = getENUM(PREFIX . 'Admin', 'Privilege');
    #grab all possible 'Privileges' from ENUM
    createSelect("select", "Privilege", $privileges, "", $privileges, ",");
    echo '
	   		</td>
	   </tr>
	   <tr>
	   		<td align="right">Password</td>
	   		<td>
	   			<input type="password" name="PWord1" />
	   				<font color="red"><b>*</b></font> 
	   				<em>(6-20 alphanumeric chars)</em>
	   		</td>
	   	</tr>
	   <tr>
	   		<td align="right">Re-enter Password</td>
	   		<td>
	   			<input type="password" name="PWord2" />
Пример #12
0
function reportTrunks($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $credentials)
{
    global $arrPermission;
    $pTrunk = new paloSantoTrunk($pDB);
    $pORGZ = new paloSantoOrganization($pDB);
    $error = "";
    $domain = getParameter("organization");
    $technology = getParameter("technology");
    $status = getParameter("status");
    $url['menu'] = $module_name;
    $url['organization'] = $domain;
    $url['technology'] = $technology;
    $url['status'] = $status;
    $total = $pTrunk->getNumTrunks($domain, $technology, $status);
    if ($total === false) {
        $error = $pTrunk->errMsg;
        $total = 0;
    }
    $limit = 20;
    $oGrid = new paloSantoGrid($smarty);
    $oGrid->setLimit($limit);
    $oGrid->setTotal($total);
    $offset = $oGrid->calculateOffset();
    $end = $offset + $limit <= $total ? $offset + $limit : $total;
    $oGrid->setTitle(_tr('Trunks List'));
    $oGrid->setWidth("99%");
    $oGrid->setStart($total == 0 ? 0 : $offset + 1);
    $oGrid->setEnd($end);
    $oGrid->setTotal($total);
    $oGrid->setURL($url);
    $arrColum[] = _tr("Name");
    $arrColum[] = _tr("Technology");
    $arrColum[] = _tr("Channel / Peer|[User]");
    $arrColum[] = _tr("Max. Channels");
    $arrColum[] = _tr("Current # of calls by period");
    $arrColum[] = _tr("Status");
    $oGrid->setColumns($arrColum);
    $edit = in_array('edit', $arrPermission);
    $arrData = array();
    if ($total != 0) {
        $arrTrunks = $pTrunk->getTrunks($domain, $technology, $status, $limit, $offset);
        if ($arrTrunks === false) {
            $error = _tr("Error to obtain trunks") . $pTrunk->errMsg;
            $arrTrunks = array();
        }
        foreach ($arrTrunks as $trunk) {
            $arrTmp[0] = "&nbsp;<a href='?menu=trunks&action=view&id_trunk=" . $trunk['trunkid'] . "&tech_trunk=" . $trunk["tech"] . "'>" . $trunk['name'] . "</a>";
            $arrTmp[1] = strtoupper($trunk['tech']);
            $arrTmp[2] = $trunk['channelid'];
            $arrTmp[3] = $trunk['maxchans'];
            $state = "";
            if ($trunk['sec_call_time'] == "yes") {
                $arrTmp[4] = createDivToolTip($trunk['trunkid'], $pTrunk, $state);
            } else {
                $arrTmp[4] = _tr("Feature don't Set");
            }
            if ($trunk['disabled'] == "on" || $state == "YES") {
                $disabled = "on";
            } else {
                $disabled = "off";
            }
            if ($edit) {
                $arrTmp[5] = createSelect($trunk['trunkid'], $disabled);
            } else {
                $arrTmp[5] = $disabled == 'on' ? _tr('Disabled') : _tr('Enabled');
            }
            $arrData[] = $arrTmp;
        }
    }
    if (in_array('create', $arrPermission)) {
        $arrTech = array("sip" => _tr("SIP"), "dahdi" => _tr("DAHDI"), "iax2" => _tr("IAX2"), "custom" => _tr("CUSTOM"));
        $oGrid->addComboAction($name_select = "tech_trunk", _tr("Create New Trunk"), $arrTech, $selected = null, $task = "create_trunk", $onchange_select = null);
    }
    $arrOrgz = array("" => _tr("all"));
    foreach ($pORGZ->getOrganization(array()) as $value) {
        $arrOrgz[$value["domain"]] = $value["name"];
    }
    $_POST["organization"] = $domain;
    $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Organization Allow") . " = " . $arrOrgz[$domain], $_POST, array("organization" => ""), true);
    //organization allow
    $techFilter = array('' => _tr('All'), "sip" => _tr("SIP"), "dahdi" => _tr("DAHDI"), "iax2" => _tr("IAX2"), "custom" => _tr("CUSTOM"));
    $_POST["technology"] = $technology;
    $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Type") . " = " . $techFilter[$technology], $_POST, array("technology" => ""), true);
    //technology
    $arrStatus = array('' => '', 'off' => _tr('Enabled'), 'on' => _tr('Disabled'));
    $_POST["status"] = $status;
    $oGrid->addFilterControl(_tr("Filter applied ") . _tr("Status") . " = " . $arrStatus[$status], $_POST, array("status" => ""), true);
    //status
    $smarty->assign("SEARCH", "<input type='submit' class='button' value='" . _tr('Search') . "' name='search'>");
    $arrFormElements = createFieldFilter($arrOrgz, $techFilter, $arrStatus);
    $oFilterForm = new paloForm($smarty, $arrFormElements);
    $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $_POST);
    $oGrid->showFilter(trim($htmlFilter));
    if ($error != "") {
        $smarty->assign("mb_title", _tr("MESSAGE"));
        $smarty->assign("mb_message", $error);
    }
    $contenidoModulo = $oGrid->fetchGrid(array(), $arrData);
    $contenidoModulo .= "<input type='hidden' name='grid_limit' id='grid_limit' value='{$limit}'>";
    $contenidoModulo .= "<input type='hidden' name='grid_offset' id='grid_offset' value='{$offset}'>";
    return $contenidoModulo;
}
Пример #13
0
$lname = $_POST['lname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$question = $_POST['question'];
$newsletter = $_POST['newsletter'];
$notify = $_POST['notify'];
$contact = $_POST['contact'];
//radio button choice
//$submit = $_POST['submit'];
$c_newsletter = $newsletter == "on" ? 'checked="checked"' : "";
$c_notify = $notify == "on" ? 'checked="checked"' : "";
$c_email = $contact == "c_email" ? 'checked="checked"' : "";
$c_phone = $contact == "c_phone" ? 'checked="checked"' : "";
$inquiry = array("General Inquiry", "Volunteer", "Other");
$selected_inquiry = $_POST['inquiry'];
$select = createSelect('inquiry', $inquiry, $selected_inquiry);
$submit = $_POST['submit'];
if ($submit) {
    $errors = array();
    if (!isset($fname) || $fname === "") {
        $errors['fname'] = "First name can't be blank";
    }
    if (!isset($lname) || $lname === "") {
        $errors['lname'] = "Last name can't be blank";
    }
    if (!isset($email) || $email === "") {
        $errors['email'] = "Email can't be blank";
    }
    if (count($errors) > 0) {
        echo "<h4> Please fix the following errors </h4>";
        echo "<ul>";
Пример #14
0
function get_ctc_date_control($form, $name, $date, $bRequireAll = true)
{
    ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $date_arr);
    $yr = $date_arr[1];
    if ($yr == "") {
        $yr = 0;
    }
    $mo = $date_arr[2];
    if ($mo == "") {
        $mo = 0;
    }
    $dy = $date_arr[3];
    if ($dy == "") {
        $dy = 0;
    }
    if ($date != "") {
        $date_val = "{$yr}-{$mo}-{$dy}";
    }
    // create month
    $strDateControl = "";
    $strDateControl .= "<input type=hidden name={$name} value='{$date_val}'>";
    for ($i = 1; $i <= 12; $i++) {
        $months[$i] = date("M", mktime(0, 0, 0, $i, 1, 2004));
    }
    $strDateControl .= createSelect($name . "_month", $months, $mo, "javascript:updateDateControlDays();");
    $strDateControl .= "&nbsp;&nbsp;";
    for ($i = 1; $i <= 31; $i++) {
        $days[$i] = $i;
    }
    $strDateControl .= createSelect($name . "_days", $days, $dy, "javascript:updateDateControlDays();");
    $strDateControl .= "&nbsp;&nbsp;";
    for ($i = date("Y"); $i >= 1920; $i--) {
        $years[$i] = $i;
    }
    $strDateControl .= createSelect($name . "_year", $years, $yr, "javascript:updateDateControlDays();");
    $strDateControl .= "<script language='Javascript'><!--\n";
    $strDateControl .= "function updateDateControlDays(){";
    $strScript = "var j; var frm = {$form};\n";
    $strScript .= "var days = 0;\n";
    $strScript .= "var mo = frm.{$name}" . "_month.value;\n";
    $strScript .= "var form_dy_select = frm.{$name}" . "_days;\n";
    $strScript .= "var form_yr_select = frm.{$name}" . "_year;\n";
    $strScript .= "var form_mo_select = frm.{$name}" . "_month;\n";
    $strScript .= "var form_bdate = frm.{$name};\n";
    $strScript .= "var yr = frm.{$name}" . "_year.value;\n";
    $strScript .= "if ( mo == 1 || mo == 3 || mo == 5 || mo == 7 || mo == 8 || mo == 10 || mo == 12 ) { \n";
    $strScript .= "\t\tdays = 31;\n";
    $strScript .= "} else if ( mo == 2 ) { // check if leap year\n";
    $strScript .= "\t\tdays = ((yr%4)==0)?29:28;\n";
    $strScript .= "} else { \n";
    $strScript .= "\t\tdays = 30;\n";
    $strScript .= "}\n";
    $strScript .= "var selectedIndex = form_dy_select.selectedIndex\n";
    $strScript .= "while ( form_dy_select.options.length > 0 ){\n";
    $strScript .= "\t\tform_dy_select.remove(0);\n";
    $strScript .= "}\n";
    $strScript .= " var elem = document.createElement(\"OPTION\");\n";
    $strScript .= " elem.value = 0;";
    $strScript .= " elem.text = '----';";
    $strScript .= "form_dy_select.options.add(elem,i);\n";
    $strScript .= "for (var i = 1; i <= days; i++ ){\n";
    $strScript .= " var elem = document.createElement(\"OPTION\");\n";
    $strScript .= " elem.value = i;";
    $strScript .= " elem.text = i;";
    $strScript .= "form_dy_select.options.add(elem,i);\n";
    $strScript .= "}\n";
    $strScript .= " if ( form_dy_select.options.length > selectedIndex ) { form_dy_select.selectedIndex = selectedIndex; }\n";
    $strScript .= " else { form_dy_select.selectedIndex = 0; }\n";
    $strScript .= "if ( form_mo_select.item(form_mo_select.selectedIndex).value.length < 2 ) form_mo_select.item(form_mo_select.selectedIndex).value = '0' + form_mo_select.item(form_mo_select.selectedIndex).value;";
    $strScript .= "if ( form_dy_select.item(form_dy_select.selectedIndex).value.length < 2 ) form_dy_select.item(form_dy_select.selectedIndex).value = '0' + form_dy_select.item(form_dy_select.selectedIndex).value;";
    if ($bRequireAll) {
        $strScript .= "if ( form_mo_select.selectedIndex == 0 || form_dy_select.selectedIndex == 0 || form_yr_select.selectedIndex == 0 ) form_bdate.value = '';";
        $strScript .= "else form_bdate.value = ( form_yr_select.item(form_yr_select.selectedIndex).value + '-' + form_mo_select.item(form_mo_select.selectedIndex).value + '-' + form_dy_select.item(form_dy_select.selectedIndex).value );\n";
    } else {
        $strScript .= "form_bdate.value = '';\n";
        // year
        $strScript .= "if ( form_yr_select.selectedIndex != 0 ) form_bdate.value = form_yr_select.item(form_yr_select.selectedIndex).value + '-';\n";
        $strScript .= "else form_bdate.value = '^[0-9]{4}-';\n";
        // month only
        $strScript .= "if ( form_mo_select.selectedIndex != 0 ) form_bdate.value = form_bdate.value + form_mo_select.item(form_mo_select.selectedIndex).value + '-';\n";
        $strScript .= "else form_bdate.value = form_bdate.value + '[0-9]{2}-';\n";
        // day
        $strScript .= "if ( ( form_mo_select.selectedIndex != 0 || form_yr_select.selectedIndex != 0 ) && form_dy_select.selectedIndex != 0  ) form_bdate.value = form_bdate.value + form_dy_select.item(form_dy_select.selectedIndex).value;\n";
        $strScript .= "else if ( form_dy_select.selectedIndex != 0  ) form_bdate.value = form_bdate.value + form_dy_select.item(form_dy_select.selectedIndex).value;\n";
        $strScript .= "else form_bdate.value = form_bdate.value + '[0-9]{2}';\n";
    }
    //$strScript .= "alert(form_bdate.value);";
    $strDateControl .= $strScript;
    $strDateControl .= "}\n--></script>";
    return $strDateControl;
}
Пример #15
0
<?php

if (!isset($_REQUEST['rondin'])) {
    echo '<span class="error">Seleccione un Rondin y vuelvalo a intentar.</span>';
} else {
    include '../conf/dbconfig.php';
    include '../conf/localeconf.php';
    $query = 'SELECT DISTINCT Edificio,Edificio FROM EdificioSalon ORDER BY 1';
    $edificios = $dbconn->GetAssoc($query);
    function createSelect($array, $id, $label, $action)
    {
        echo '<label for="' . $id . '">' . $label . '</label>';
        echo '<select name="' . $id . '" id="' . $id . '" ' . $action . '>';
        echo '<option value="0" selected="selected" >Elija</option>';
        foreach ($array as $index => $value) {
            echo '<option value="' . $index . '">' . $value . '</option>';
        }
        echo '</select>';
    }
    echo '<form name="captura" id="captura">';
    //echo '<input type="hidden" value="'.$_REQUEST['rondin'].'" id="rondin" />';
    createSelect($edificios, 'edificio', 'Edificio :', 'onchange="imprimeCaptEdificio($F(\'edificio\'))"');
    echo '<br />';
    echo '<div id="edificiofrm">';
    echo '</div></form>';
}
Пример #16
0
function createFormElements($report_elements)
{
    global $bDebug;
    if (!is_array($report_elements)) {
        return;
    }
    unset($form_elements);
    foreach ($report_elements as $key => $value) {
        $elemName = $key;
        $elemLabel = $value["label"];
        $elemType = $value["type"];
        //$arr_params = Array("dbLink"=>get_db_connection(), "bDebug"=>$bDebug );
        $arr_params = get_db_connection();
        $elemValuesFunction = $value["values_func"];
        if ($elemValuesFunction != NULL) {
            $elemValues = @call_user_func_array($elemValuesFunction, $arr_params);
            //log_err("elemValuesFunction : $elemValuesFunction");
        } else {
            $elemValues = $value["values"];
        }
        $elemDefault = $value["default"];
        $elemRequired = $value["required"];
        switch ($elemType) {
            case "date":
                $strControl = createDateControl("document._FRM", $elemName, $elemDefault, $elemRequired);
                break;
            case "select":
                $strControl = createSelect($elemName, $elemValues, $elemDefault, $script, $class_style);
                break;
            case "multiselect":
                $strControl = createMultipleSelect($elemName, $elemValues, $elemDefault, $script, $class_style);
                break;
            case "input":
                $strControl = createTextField($elemName, $elemValues, $elemLabel, $class);
                break;
            case "checkbox":
                $strControl = createCheckBox($elemName, $elemValues, $elemLabel, $elemDefault);
                break;
            default:
                $strControl = "cant create control, elem type {$elemType} undefined.";
                break;
        }
        $form_elements[] = array("label" => $elemLabel, "required" => $elemRequired, "control" => $strControl);
    }
    return $form_elements;
}
Пример #17
0
 /**
  * Display user form
  *
  * @access private
  */
 function formUser()
 {
     if (isset($_REQUEST["user"])) {
         $dataUser = $this->getUserInfo($_REQUEST["user"]);
     }
     $groupeList = $GLOBALS["db"]->array_query("SELECT groupe_id, groupe_name FROM groupes");
     foreach ($groupeList as $groupe) {
         $dataGroupe[$groupe["groupe_id"]] = $groupe["groupe_name"];
     }
     echo "<form name='user' method='POST' action='main.php' target='main'>\r\n\t\t\t\t<table style='font-size: 10px'>\r\n\t\t\t\t\t<tr><td>" . $GLOBALS["traduct"]->get(163) . "</td><td><input type='text' class='text' name='name' value='" . (!empty($dataUser) ? $dataUser["user_name"] : "") . "'></td></tr>\r\n\t\t\t\t\t<tr><td>" . $GLOBALS["traduct"]->get(164) . "</td><td><input type='text' class='text' name='login' value='" . (!empty($dataUser) ? $dataUser["user_login"] : "") . "'></td></tr>\r\n\t\t\t\t\t<tr><td>" . $GLOBALS["traduct"]->get(165) . "</td><td>" . createSelect($dataGroupe, "groupe_id", !empty($dataUser) ? $dataUser["user_groupe_id"] : "") . "</td></tr>\r\n\t\t\t\t\t<tr><td colspan=2 align='center'><input class='button' type='submit' value='" . $GLOBALS["traduct"]->get(51) . "'></td>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t<input type='hidden' name='action' value='" . $GLOBALS["action"] . "'>\r\n\t\t\t\t<input type='hidden' name='user' value='" . (isset($GLOBALS["user"]) ? $GLOBALS["user"] : "") . "'>\r\n\t\t\t\t<input type='hidden' name='auth_action' value='saveUser'>\r\n\t\t\t\t</form>";
 }
Пример #18
0
            unset($files[$e[DB_COL_PROJECTNAME]][$key]);
        }
    }
    if (!empty($error[2]) && !in_array($error[2], $functions[$e[DB_COL_PROJECTNAME]])) {
        $functions[$e[DB_COL_PROJECTNAME]][$e[DB_COL_ERRORID]] = $error[2];
    } else {
        if (!empty($error[2])) {
            $key = array_search($error[2], $functions[$e[DB_COL_PROJECTNAME]]);
            $functions[$e[DB_COL_PROJECTNAME]][$key . "," . $e[DB_COL_ERRORID]] = $error[2];
            unset($functions[$e[DB_COL_PROJECTNAME]][$key]);
        }
    }
}
$exceptionSelect = createSelect($exceptions);
$fileSelect = createSelect($files);
$functionSelect = createSelect($functions);
if (defined("MULTIPROJECT") && MULTIPROJECT) {
    $projectSelect = '<option value="">All projects</option>';
    $projects = db::getProjects();
    foreach ($projects as $project) {
        $projectSelect .= '<option value="' . htmlspecialchars($project[DB_COL_PROJECTID]) . '">' . htmlspecialchars($project[DB_COL_PROJECTNAME]) . '</option>';
    }
    $projectSelect = '<div id="currProj">Current Project: <select id="projSelect">' . $projectSelect . '</select></div>';
} else {
    $projectSelect = '<input type="hidden" id="projSelect" value=""/>';
}
if (defined("METADATA") && METADATA) {
    $metadata = explode(",", METADATA);
    foreach ($metadata as $m) {
        $metaColumns .= '<th title="User-defined metadata">' . $m . '</th>';
    }