예제 #1
0
 private function column()
 {
     $db = M("column");
     $data = $db->where(array("status" => 1))->order("pid,level")->select();
     $data = getColumn($data);
     //dump($data);
     return $data;
 }
function inputFilterString($columns, $columnName, $charset)
{
    $column = getColumn($columns, $columnName);
    $isRequired = getisRequiredString($column);
    $strMaxLength = 0;
    if (preg_match('/\\((\\d+)\\)/', $column['type'], $matches) == 1) {
        $strMaxLength = $matches[1];
    }
    echo "            \$inputFilter->add(\$factory->createInput(array(\r\n\t\t\t'name'     => '{$columnName}',\r\n\t\t\t'required' => {$isRequired},\r\n\t\t\t'filters'  => array(\r\n\t\t\tarray('name' => 'StripTags'),\r\n\t\t\tarray('name' => 'StringTrim'),\r\n\t\t\t),";
    if ($strMaxLength > 0) {
        // TODO: charset here is set to utf8 instead of UTF-8. test if it's ok
        echo "\r\n\t\t\t'validators' => array(\r\n\t\t\tarray(\r\n\t\t\t'name'    => 'StringLength',\r\n\t\t\t'options' => array(\r\n\t\t\t'encoding' => '{$charset}',\r\n\t\t\t'min'      => 1,\r\n\t\t\t'max'      => {$strMaxLength},\r\n\t\t\t\t),\r\n\t\t\t\t),\r\n\t\t\t\t),";
    }
    echo "\r\n\t\t\t\t)));\r\n\t\t\t\t";
}
require_once __DIR__ . "/../vendor/autoload.php";
$configFile = "../project/config.xml";
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize($configFile);
$DB = Database::singleton();
// define which configuration file we're using for this installation
//Get the entries we already have in the DB
getColumns("Select Name, ParameterTypeID from parameter_type", $DB, $parameter_types);
//Delete in the parameter_type table relating to
//parameter_type_category.Type = 'Instrument', without affecting other entries.
//get parameter_type_category.Type ='Instrument' ParamenterTypeCategoryIDs
getColumn("SELECT ParameterTypeCategoryID\n        FROM parameter_type_category\n        WHERE Type = 'Instrument'", $DB, $instrumentParameterTypeCategoryIDs);
$instrumentParameterTypeCategoryIDString = implode(', ', $instrumentParameterTypeCategoryIDs);
//get all 'Instrument' ParameterTypeIDs
getColumn("SELECT ParameterTypeID\n        FROM parameter_type_category_rel\n        WHERE ParameterTypeCategoryID\n        IN ({$instrumentParameterTypeCategoryIDString})", $DB, $instrumentParameterTypeIDs);
$instrumentParameterTypeIDString = implode(', ', $instrumentParameterTypeIDs);
//delete all 'Instrument' entries from parameter_type_category_rel
$DB->run("DELETE FROM parameter_type_category_rel\n    WHERE ParameterTypeID in ({$instrumentParameterTypeIDString})");
//delete all 'Instrument' entries from parameter_type_category
$DB->run("DELETE FROM parameter_type_category\n    WHERE ParameterTypeCategoryID IN ({$instrumentParameterTypeCategoryIDString})");
//delete all 'Instrument' entries from parameter_type
$DB->run("DELETE FROM parameter_type\n    WHERE ParameterTypeID IN ({$instrumentParameterTypeIDString})");
print "Cleared data from BVL instruments\n";
//Instruments with excessively wordy names.  Entries are OPTIONAL
//It would be really nice to have a table_names.Abbreviation
//field, but messy to change the names *everywhere*.
$abbreviations = array('childs_health_questions_12' => 'chq12', 'childs_health_questions_18_36' => 'chq18_36', 'childs_health_questions_6' => 'chq6', 'child_bearing_attitudes' => 'cba', 'ecbq_temperament' => 'ecbq', 'edinburgh_postnatal_depression_scale' => 'epds', 'health_well_being' => 'hwb', 'home_environment_evaluation' => 'hee', 'ibq_temperament' => 'ibq', 'montreal_prenatal' => 'montreal_prenatal', 'parental_bonding_inventory' => 'pbi', 'state_trait_anxiety_inventory' => 'stai', 'med_records_24' => 'med_rec_24', 'med_records_recruit' => 'med_rec_recr');
print "Reading instruments\n";
//Read the ip_output.txt staging file.
$fp = fopen("ip_output.txt", "r");
예제 #4
0
if (!isset($_SESSION['State'])) {
    $_SESSION['State'] =& State::singleton();
}
$_SESSION['State']->setUsername(get_current_user());
// define which configuration file we're using for this installation
//Get the entries we already have in the DB
getColumns("Select Name, ParameterTypeID from parameter_type", $DB, $parameter_types, array());
//Delete in the parameter_type table relating to
//parameter_type_category.Type = 'Instrument', without affecting other entries.
//get parameter_type_category.Type ='Instrument' ParamenterTypeCategoryIDs
getColumn("SELECT ParameterTypeCategoryID\n        FROM parameter_type_category\n        WHERE Type = :in", $DB, $instrumentParameterTypeCategoryIDs, array('in' => 'Instrument'));
if (!empty($instrumentParameterTypeCategoryIDs)) {
    // Prepare for the IN () SQL quandary
    $prepIn = prepareIn($instrumentParameterTypeCategoryIDs);
    //get all 'Instrument' ParameterTypeIDs
    getColumn("SELECT ParameterTypeID\n            FROM parameter_type_category_rel\n            WHERE ParameterTypeCategoryID\n            IN (" . $prepIn['query'] . ")", $DB, $instrumentParameterTypeIDs, $prepIn['array']);
    $instrumentParameterTypeIDString = implode(', ', $instrumentParameterTypeIDs);
}
if (!empty($instrumentParameterTypeIDString)) {
    //delete all 'Instrument' entries from parameter_type_category_rel
    $DB->run("DELETE FROM parameter_type_category_rel\n        WHERE ParameterTypeID in ({$instrumentParameterTypeIDString})");
}
if (!empty($instrumentParameterTypeCategoryIDString)) {
    //delete all 'Instrument' entries from parameter_type_category
    $DB->run("DELETE FROM parameter_type_category\n        WHERE ParameterTypeCategoryID IN ({$instrumentParameterTypeCategoryIDString})");
}
if (!empty($instrumentParameterTypeIDString)) {
    //delete all 'Instrument' entries from parameter_type
    $DB->run("DELETE FROM parameter_type\n        WHERE ParameterTypeID IN ({$instrumentParameterTypeIDString})");
}
print "Cleared data from BVL instruments\n";
예제 #5
0
    echo "<?php ";
    ?>
echo GridView::widget([
            'dataProvider' => $dataProvider,
            'filterModel' => $searchModel,
            'columns' => [
            <?php 
    $count = 0;
    echo "\n";
    // code-formatting
    foreach ($generator->getTableSchema()->columns as $column) {
        if ($column->name == "olusturan") {
            $format = getColumn("Create");
        } else {
            if ($column->name == "guncelleyen") {
                $format = getColumn("Update");
            } else {
                $format = trim($generator->columnFormat($column, $model));
            }
        }
        if ($column->name != "silindi") {
            if ($format == false) {
                continue;
            }
            if (++$count < 8) {
                echo "\t\t\t{$format},\n";
            } else {
                echo "\t\t\t{$format},\n";
            }
        }
    }
예제 #6
0
<?php

require "path.php";
require PATH . "include/include.php";
//*************************************************************************************************
include "public_session.php";
//*************************************************************************************************
$wuserId = $_GET['wuserId'];
$pageId = $_GET['pageId'];
if ($pageId == '') {
    $pageId = getColumn("USER_WEBSITE", $wuserId, "ID", "USERID");
}
if ($pageId == '') {
    header("Location:index.php?info=" . urlencode('Please select a website to see ads.'));
    die;
}
//*************************************************************************************************
if (!($recWebsite = getRecord("USER_WEBSITE", $pageId))) {
    header("Location:index.php?info=" . urlencode('Website not found. Error Code - 02 -'));
    die;
}
$wuserId = $recWebsite['USERID'];
//*************************************************************************************************
if (!($recUser = getRecord("USER", $wuserId, "USERID"))) {
    header("Location:index.php?info=" . urlencode('Website not found. Error Code - 01 -'));
    die;
}
//*************************************************************************************************
include "header.php";
//*************************************************************************************************
?>
예제 #7
0
파일: wizard.php 프로젝트: jackpf/ossim-arc
 case "6":
     if ($next && $_SESSION[$wr_key]['step'] == 5) {
         $widget_id = $_SESSION[$wr_key]['widget_id'];
         $widget_type = $_SESSION[$wr_key]['widget_type'];
         $widget_asset = $_SESSION[$wr_key]['widget_asset'];
         $widget_title = $_SESSION[$wr_key]['widget_title'];
         $widget_help = $_SESSION[$wr_key]['widget_help'];
         $widget_refresh = $_SESSION[$wr_key]['widget_refresh'];
         $widget_height = $_SESSION[$wr_key]['widget_height'];
         $widget_url = $_SESSION[$wr_key]['widget_url'];
         $owner = $_SESSION[$wr_key]['owner'];
         $id_content = $_SESSION[$wr_key]['id_content'];
         $widget_media = $_SESSION[$wr_key]['widget_media'];
         $widget_params = $_SESSION[$wr_key]['widget_params'];
         if ($id_content != "") {
             $column = getColumn($dbconn, $id_content);
             $order = getOrder($dbconn, $id_content);
         } else {
             $id_content = getNewId($dbconn, $tab);
             $column = 0;
             $order = 0;
             $error = reorder_widgets($dbconn, $tab);
         }
         ossim_valid($column, OSS_DIGIT, 'illegal:' . _("Widget Column"));
         ossim_valid($order, OSS_DIGIT, 'illegal:' . _("Widget Row"));
         if (ossim_error()) {
             $info_error[] = ossim_get_error();
             ossim_clean_error();
             $error = true;
         }
         if ($widget_type == 'report' && !$pro) {
예제 #8
0
function add($pdo)
{
    global $page_display_title;
    $page_display_title = 'ثبت کاربران';
    if (!isset($_FILES['exfile'])) {
        if (isset($_GET['type']) && !empty($_GET['type'])) {
            if ($_GET['type'] == 'student') {
                $hidden = '<input type="hidden" name="type" value="student"/>';
            } else {
                if ($_GET['type'] == 'teacher') {
                    $hidden = '<input type="hidden" name="type" value="teacher"/>';
                }
            }
            #set input style
            echo '
<center>
<img src="' . BASE_PATH . '/assets/img/UserGroups.png" />
<form method="post" enctype="multipart/form-data" style="width: 650px; height: 500px; background: url(' . BASE_PATH . '/assets/img/adduserbg.jpg) center;">
' . $hidden . '
<div align="right" style="font-size: 34px; font-weight: bold;">
اضافه نمودن کاربران جدید
</div>
<br/>
<div style="font-size: 18px; font-weight: bold;">
<b>روشی آسان برای اضافه نمودن کاربران به برنامه، در این روش شما در ابتدا نوع کاربر مورد نظر خود را مشخص نموده تا وارد بخش ثبت کاربران شده و از طریق فرم زیر اقدام به ارسال فایل اکسل که شامل اسامی کاربران می باشد نمایید</b>
<br/>
<b>همچنین پس از ثبت کاربران، از بخش مدیریت کاربران همه اطلاعات کاربران قابل مدیریت و ویرایش می باشد</b>
</div>
<br/>
<input type="file" name="exfile" id="exfile" accept=".xlsx"/>
<br/><br/>
<input type="submit" class="perfect_btn" value="ثبت کاربران جدید"/>
</form>
<br/><br/>
</center>
';
        }
    } else {
        if (isset($_POST['type']) && in_array($_POST['type'], array('student', 'teacher'))) {
            $permission = trim(filter_var($_POST['type'], FILTER_SANITIZE_STRING));
            $type = $permission == 'student' ? 3 : 2;
            $file = $_FILES["exfile"]["tmp_name"];
            $fileType = pathinfo(basename($_FILES["exfile"]["name"]), PATHINFO_EXTENSION);
            if ($fileType == 'xlsx') {
                $data = openExcel($file);
                if (is_array($data)) {
                    $sql = "select * from field";
                    $stmt = $pdo->query($sql);
                    if ($stmt->rowCount()) {
                        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
                        $fields = array();
                        foreach ($rows as $row) {
                            $fields[trim(ToUnicode2($row['title']))] = $row['id'];
                        }
                        $userList = array();
                        $columns = getColumn($data);
                        $len = count($data);
                        for ($i = 2; $i <= $len; $i++) {
                            $fullname = fullname($data[$i][$columns['نام و نام خانوادگی']]);
                            $username = $data[$i][$columns['شماره دانشجویی']];
                            $password = hashSSHA($data[$i][$columns['شماره شناسنامه']]);
                            $field = trim(ToUnicode2($data[$i][$columns['رشته']]));
                            $sex = $data[$i][$columns['جنسیت']];
                            if (array_key_exists($field, $fields) || $type == 2) {
                                $userList[] = array('username' => $username, 'password' => $password['encrypted'], 'salt' => $password['salt'], 'fname' => trim($fullname['fname']), 'lname' => trim($fullname['lname']), 'sex' => $sex == 'مرد' ? 1 : 0, 'permission' => $permission, 'f_id' => $type == 3 ? $fields[$field] : $field, 'type' => $type);
                            }
                        }
                        if (!empty($userList)) {
                            $i = 0;
                            $values = array();
                            for ($x = 1; $x <= count($userList); $x++) {
                                #-Make Directory
                                mkdir("assets/d/" . $userList[$x - 1]['username']);
                                $values[] = "(:p_" . ($i + 1) . ",:p_" . ($i + 2) . ",:p_" . ($i + 3) . ",:p_" . ($i + 4) . ",:p_" . ($i + 5) . ",:p_" . ($i + 6) . ",:p_" . ($i + 7) . ",:p_" . ($i + 8) . ",:p_" . ($i + 9) . ")";
                                $i = $i + 9;
                            }
                            $sql = "insert into `user`(`username`,`password`,`salt`,`fname`,`lname`,`sex`,`permission`,`f_id`,`type`) values" . implode(',', $values);
                            //echo $sql;
                            $stmt = $pdo->prepare($sql);
                            $i = 1;
                            foreach ($userList as $user) {
                                foreach ($user as $k => $v) {
                                    $stmt->bindValue(":p_{$i}", $v, PDO::PARAM_STR);
                                    $i++;
                                }
                            }
                            $stmt->execute();
                        }
                    }
                }
                //Excel Data
            }
            //Excel File Extension
        }
        #Return To Manage
        redirect(BASE_PATH . '/user/?do=manage&token=' . $_SESSION['token'], 1);
    }
}
예제 #9
0
echo $ROOT;
?>
seller_adsapproval.php" class="style32">Approve / Reject New Advertisers</a> <br>
														<a href="<?php 
echo $ROOT;
?>
seller_liveadstats.php" class="style32">View Live Ad Stats</a> <br>
														<a href="<?php 
echo $ROOT;
?>
seller_paymenthistory.php" class="style32">Payment History</a> <br>
														<a href="<?php 
echo $ROOT;
?>
seller_websitedetails.php?websiteId=<?php 
echo getColumn("USER_WEBSITE", $userId, "ID", "USERID");
?>
" class="style32">Update Website Details</a> <br>
														<a href="<?php 
echo $ROOT;
?>
seller_accountdetails.php" class="style32">Update Account Details</a> <br>
														<a href="<?php 
echo $ROOT;
?>
seller_htmlcode.php" class="style32">Get Ad HTML Code For Your Website</a><br>
														 <a href="<?php 
echo $ROOT;
?>
seller_featured.php" class="style32">Further Promotion</a> <br>
														 <a href="<?php 
예제 #10
0
// var_dump($sheetData);
// Define Column Alias
$keyColumns = array(array("yearColumn", "YEAR"), array("districtColumn", "DISTRICT"), array("highwayColumn", "HWY", "Highway Number"), array("fromColumn", "TRM From"), array("fromDispColumn", "TRM From Displ"), array("toColumn", "TRM To"), array("toDispColumn", "TRM To Displ"), array("rdbdColumn", "Roadbed"), array("dirColumn", "Direction"));
// LOOP THROUGH DATA
$sheetCount = $objPHPExcel->getSheetCount();
// PREPARE EXCEL FILE
// CREATE NEW PHPEXCEL OBJECT
$objPHPOutputExcel = new PHPExcel();
for ($sheetNum = 0; $sheetNum < $sheetCount; $sheetNum++) {
    unset($sheetData);
    $sheetData = $objPHPExcel->getSheet($sheetNum)->toArray(null, true, true, true);
    $header = $sheetData[1];
    // var_dump($sheetData);
    foreach ($keyColumns as $key => $val) {
        // echo $val[0];
        ${$val}[0] = getColumn($header, array_splice($val, 1));
        // var_dump($$val[0]);
    }
    if ($sheetNum != 0) {
        $objPHPOutputExcel->createSheet();
    }
    $objPHPOutputExcel->setActiveSheetIndex($sheetNum);
    $outputSheet = $objPHPOutputExcel->getActiveSheet();
    // echo "Total found worksheets in Excel: $sheetCount <br>";
    $count = count($sheetData);
    $excelRow = 1;
    // echo "<table border=0>";
    for ($i = 2; $i <= $count; $i++) {
        $highway = assembleHighway($sheetData[$i][$highwayColumn]);
        $rdbd = $sheetData[$i][$rdbdColumn];
        $dirc = $sheetData[$i][$dirColumn];
예제 #11
0
파일: index.php 프로젝트: jspautsch/Soku
function getMiddleTile($pieceTile, $connectingTile)
{
    global $GRID_COLUMNS;
    $connectingRow = getRow($connectingTile);
    $connectingColumn = getColumn($connectingTile);
    $pieceRow = getRow($pieceTile);
    $pieceColumn = getColumn($pieceTile);
    // Vertical
    if ($pieceColumn === $connectingColumn) {
        if ($pieceTile > $connectingTile) {
            $lockedTile = $pieceTile - $GRID_COLUMNS;
        } else {
            $lockedTile = $pieceTile + $GRID_COLUMNS;
        }
        return $lockedTile;
    }
    // Horizontal
    if ($pieceRow === $connectingRow) {
        if ($pieceTile > $connectingTile) {
            $lockedTile = $pieceTile - 1;
        } else {
            $lockedTile = $pieceTile + 1;
        }
        return $lockedTile;
    }
    // Diagonal
    if ($pieceRow > $connectingRow) {
        if ($pieceColumn > $connectingColumn) {
            $lockedTile = $pieceTile - $GRID_COLUMNS - 1;
        } else {
            $lockedTile = $pieceTile - $GRID_COLUMNS + 1;
        }
    } else {
        if ($pieceColumn > $connectingColumn) {
            $lockedTile = $pieceTile + $GRID_COLUMNS - 1;
        } else {
            $lockedTile = $pieceTile + $GRID_COLUMNS + 1;
        }
    }
    return $lockedTile;
}
 public static function getUnits($chapter_id)
 {
     $units = getColumn("units", "*", "WHERE chapter_id={$chapter_id} ORDER BY name");
     if (!empty($units)) {
         return $units;
     } else {
         return 0;
     }
 }