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


PHP addColumn函数代码示例

本文整理汇总了PHP中addColumn函数的典型用法代码示例。如果您正苦于以下问题:PHP addColumn函数的具体用法?PHP addColumn怎么用?PHP addColumn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了addColumn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgradeSurveyTables164

/**
*  Make sure all active tables have the right sized token field
*
*  During a small period in the 2.0 cycle some survey tables got no
*  token field or a token field that was too small. This patch makes
*  sure all surveys that are not anonymous have a token field with the
*  right size
*
* @return void
*/
function upgradeSurveyTables164()
{
    $sQuery = "SELECT sid FROM {{surveys}} WHERE active='Y' and anonymized='N'";
    $aResult = Yii::app()->getDb()->createCommand($sQuery)->queryAll();
    if (!$aResult) {
        return "Database Error";
    } else {
        foreach ($aResult as $sv) {
            $token = SurveyDynamic::model($sv['sid'])->getTableSchema()->getColumn('token');
            if (is_null($token)) {
                addColumn('{{survey_' . $sv['sid'] . '}}', 'token', 'string(36)');
            } elseif ($token->size < 36) {
                alterColumn('{{survey_' . $sv['sid'] . '}}', 'token', 'string(36)');
            }
        }
    }
}
开发者ID:CSCI-462-01-2016,项目名称:LimeSurvey,代码行数:27,代码来源:updatedb_helper.php

示例2: synchronizeComments

    echo "</table>\r\n";
}
function synchronizeComments()
{
    global $xoopsDB, $xoopsModule, $mydirname;
    $sql = sprintf('SELECT bl.blog_id, COUNT(cm.com_id) FROM %s AS bl LEFT JOIN %s AS cm ON bl.blog_id=cm.com_itemid AND cm.com_modid=%d GROUP BY bl.blog_id', $xoopsDB->prefix($mydirname), $xoopsDB->prefix('xoopscomments'), $xoopsModule->getVar('mid'));
    $result = $xoopsDB->query($sql) or exit($xoopsDB->error());
    $handler =& xoops_getmodulehandler('entry');
    while (list($blog_id, $comments) = $xoopsDB->fetchRow($result)) {
        $handler->updateComments($blog_id, intval($comments));
    }
    redirect_header('dbmanager.php', 2, _AM_WEBLOG_DBUPDATED);
    exit;
}
switch ($action) {
    case "comments":
        synchronizeComments();
        break;
    case "checktable":
        checkTables();
        break;
    case "addcolumn":
        addColumn($_POST);
        break;
    case "addtable":
        addtable($_POST);
        break;
    default:
        dbManager();
        break;
}
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:31,代码来源:dbmanager.php

示例3: copyCPBDAttributesToTokens

 function copyCPBDAttributesToTokens($surveyid, $mapped, $newcreate, $participantid, $overwriteauto = false, $overwriteman = false, $overwritest = false, $createautomap = true)
 {
     Yii::app()->loadHelper('common');
     $duplicate = 0;
     $sucessfull = 0;
     $iBlacklistSkipped = 0;
     $participantid = explode(",", $participantid);
     //List of participant ids to add to tokens table
     if ($participantid[0] == "") {
         $participantid = array_slice($participantid, 1);
     }
     $number2add = sanitize_int(count($newcreate));
     //Number of tokens being created
     $tokenattributefieldnames = array();
     //Will contain descriptions of existing token attribute fields
     $tokenfieldnames = array();
     //Will contain the actual field names of existing token attribute fields
     $attributesadded = array();
     //Will contain the actual field name of any new token attribute fields
     $attributeidadded = array();
     //Will contain the description of any new token attribute fields
     $fieldcontents = array();
     //Will contain serialised info for the surveys.attributedescriptions field
     $surveyinfo = getSurveyInfo($surveyid);
     $defaultsurveylang = $surveyinfo['surveyls_language'];
     $arr = Yii::app()->db->createCommand()->select('*')->from("{{tokens_{$surveyid}}}")->queryRow();
     if (is_array($arr)) {
         $tokenfieldnames = array_keys($arr);
         $tokenattributefieldnames = array_filter($tokenfieldnames, 'filterForAttributes');
     }
     // If automapping is enabled then update the token field properties with the mapped CPDB field ID
     if ($createautomap == "true") {
         foreach ($mapped as $key => $iIDAttributeCPDB) {
             if (is_numeric($iIDAttributeCPDB)) {
                 /* Update the attributedescriptions info */
                 $aTokenAttributes = Survey::model()->findByPk($surveyid)->tokenattributes;
                 $aTokenAttributes[$key]['cpdbmap'] = $iIDAttributeCPDB;
                 Yii::app()->db->createCommand()->update('{{surveys}}', array("attributedescriptions" => json_encode($aAttributes)), 'sid = ' . $surveyid);
             }
         }
     }
     foreach ($tokenattributefieldnames as $key => $value) {
         $mapped[$key] = $value;
         // $value can be 'attribute_1', which will clash with postgres
     }
     if (!empty($newcreate)) {
         foreach ($newcreate as $key => $value) {
             $newfieldname = 'attribute_' . $value;
             $fields[$newfieldname] = array('type' => 'string');
             $attname = Yii::app()->db->createCommand()->select('{{participant_attribute_names_lang}}.attribute_name, {{participant_attribute_names_lang}}.lang')->from('{{participant_attribute_names}}')->join('{{participant_attribute_names_lang}}', '{{participant_attribute_names}}.attribute_id = {{participant_attribute_names_lang}}.attribute_id')->where('{{participant_attribute_names}}.attribute_id = :attrid ')->bindParam(":attrid", $value, PDO::PARAM_INT);
             $attributename = $attname->queryAll();
             foreach ($attributename as $att) {
                 $languages[$att['lang']] = $att['attribute_name'];
             }
             //Check first for the default survey language
             if (isset($languages[$defaultsurveylang])) {
                 $newname = $languages[$defaultsurveylang];
             } elseif (isset($language[Yii::app()->session['adminlang']])) {
                 $newname = $languages[Yii::app()->session['adminlang']];
             } else {
                 $newname = $attributename[0]['attribute_name'];
                 //Choose the first item in the list
             }
             $tokenattributefieldnames[] = $newfieldname;
             $fieldcontents[$newfieldname] = array("description" => $newname, "mandatory" => "N", "show_register" => "N");
             array_push($attributeidadded, 'attribute_' . $value);
             array_push($attributesadded, $value);
         }
         //Update the attributedescriptions in the survey table to include the newly created attributes
         $previousatt = Yii::app()->db->createCommand()->select('attributedescriptions')->where("sid = :sid")->from('{{surveys}}')->bindParam(":sid", $surveyid, PDO::PARAM_INT);
         $aTokenAttributes = $previousatt->queryRow();
         $aTokenAttributes = decodeTokenAttributes($aTokenAttributes['attributedescriptions']);
         foreach ($fieldcontents as $key => $iIDAttributeCPDB) {
             $aTokenAttributes[$key] = $iIDAttributeCPDB;
         }
         $aTokenAttributes = serialize($aTokenAttributes);
         Yii::app()->db->createCommand()->update('{{surveys}}', array("attributedescriptions" => $aTokenAttributes), 'sid = ' . intval($surveyid));
         // load description in the surveys table
         //Actually create the fields in the tokens table
         Yii::app()->loadHelper('update/updatedb');
         foreach ($fields as $key => $value) {
             addColumn("{{tokens_{$surveyid}}}", $key, $value['type']);
         }
         Yii::app()->db->schema->getTable("{{tokens_{$surveyid}}}", true);
         // Refresh schema cache just
     }
     //Write each participant to the survey token table
     foreach ($participantid as $key => $sParticipantUID) {
         $writearray = array();
         $participantdata = Yii::app()->db->createCommand()->select('firstname,lastname,email,language,blacklisted')->where('participant_id = :pid')->from('{{participants}}')->bindParam(":pid", $sParticipantUID, PDO::PARAM_INT);
         $tobeinserted = $participantdata->queryRow();
         if (Yii::app()->getConfig('blockaddingtosurveys') == 'Y' && $tobeinserted == 'Y') {
             $iBlacklistSkipped++;
             continue;
         }
         /* Search for matching participant name/email in the survey token table */
         $sQuery = Yii::app()->db->createCommand()->select('*')->from('{{tokens_' . $surveyid . '}}')->where('firstname = :firstname AND lastname = :lastname AND email = :email AND participant_id = :participant_id')->bindParam(":firstname", $tobeinserted['firstname'], PDO::PARAM_STR)->bindParam(":lastname", $tobeinserted['lastname'], PDO::PARAM_STR)->bindParam(":email", $tobeinserted['email'], PDO::PARAM_STR)->bindParam(":participant_id", $sParticipantUID, PDO::PARAM_STR)->queryAll();
         if (count($sQuery) > 0) {
             //Participant already exists in token table - don't copy
             $duplicate++;
//.........这里部分代码省略.........
开发者ID:kochichi,项目名称:LimeSurvey,代码行数:101,代码来源:Participant.php

示例4: createColumnsInTokenTable

 /**
  * Create new "fields"? in which table?
  *
  * @param int $surveyId
  * @param array $newAttributes
  * @return array [addedAttributes, addedAttributeIds]
  */
 private function createColumnsInTokenTable($surveyId, array $newAttributes)
 {
     // Get default language
     $surveyInfo = getSurveyInfo($surveyId);
     $defaultsurveylang = $surveyInfo['surveyls_language'];
     //Will contain serialised info for the surveys.attributedescriptions field
     $fieldcontents = array();
     // ??
     $fields = array();
     //Will contain the actual field name of any new token attribute fields
     $addedAttributes = array();
     //Will contain the description of any new token attribute fields
     $addedAttributeIds = array();
     foreach ($newAttributes as $value) {
         $newfieldname = 'attribute_' . $value;
         $fields[$newfieldname] = array('type' => 'string');
         // TODO: Always string??
         $attname = Yii::app()->db->createCommand()->select('{{participant_attribute_names_lang}}.attribute_name, {{participant_attribute_names_lang}}.lang')->from('{{participant_attribute_names}}')->join('{{participant_attribute_names_lang}}', '{{participant_attribute_names}}.attribute_id = {{participant_attribute_names_lang}}.attribute_id')->where('{{participant_attribute_names}}.attribute_id = :attrid ')->bindParam(":attrid", $value, PDO::PARAM_INT);
         $attributename = $attname->queryAll();
         foreach ($attributename as $att) {
             $languages[$att['lang']] = $att['attribute_name'];
         }
         //Check first for the default survey language
         if (isset($languages[$defaultsurveylang])) {
             $newname = $languages[$defaultsurveylang];
         } elseif (isset($language[Yii::app()->session['adminlang']])) {
             $newname = $languages[Yii::app()->session['adminlang']];
         } else {
             $newname = $attributename[0]['attribute_name'];
             //Choose the first item in the list
         }
         $tokenAttributeFieldNames[] = $newfieldname;
         $fieldcontents[$newfieldname] = array("description" => $newname, "mandatory" => "N", "show_register" => "N");
         array_push($addedAttributeIds, 'attribute_' . $value);
         array_push($addedAttributes, $value);
     }
     //Update the attributedescriptions in the survey table to include the newly created attributes
     $previousatt = Yii::app()->db->createCommand()->select('attributedescriptions')->where("sid = :sid")->from('{{surveys}}')->bindParam(":sid", $surveyId, PDO::PARAM_INT);
     $aTokenAttributes = $previousatt->queryRow();
     $aTokenAttributes = decodeTokenAttributes($aTokenAttributes['attributedescriptions']);
     foreach ($fieldcontents as $key => $iIDAttributeCPDB) {
         $aTokenAttributes[$key] = $iIDAttributeCPDB;
     }
     $aTokenAttributes = serialize($aTokenAttributes);
     Yii::app()->db->createCommand()->update('{{surveys}}', array("attributedescriptions" => $aTokenAttributes), 'sid = ' . intval($surveyId));
     // load description in the surveys table
     //Actually create the fields in the tokens table
     Yii::app()->loadHelper('update/updatedb');
     foreach ($fields as $key => $value) {
         addColumn("{{tokens_{$surveyId}}}", $key, $value['type']);
     }
     Yii::app()->db->schema->getTable("{{tokens_{$surveyId}}}", true);
     // Refresh schema cache just
     return array($addedAttributes, $addedAttributeIds);
 }
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:62,代码来源:Participant.php

示例5: checkColumns

 /**
  * Checks to make sure that all required columns exist in this tokens table
  * (some older tokens tables dont' get udated properly)
  *
  */
 public function checkColumns()
 {
     $sid = self::$sid;
     $surveytable = '{{tokens_' . $sid . '}}';
     $columncheck = array("tid", "participant_id", "firstname", "lastname", "email", "emailstatus", "token", "language", "blacklisted", "sent", "remindersent", "completed", "usesleft", "validfrom", "validuntil");
     $columns = Yii::app()->db->schema->getTable($surveytable)->getColumnNames();
     $missingcolumns = array_diff($columncheck, $columns);
     if (count($missingcolumns) > 0) {
         Yii::app()->loadHelper('update/updatedb');
         //Load the admin helper to allow column creation
         setVarchar();
         //Set the appropriate varchar settings according to the database
         $sVarchar = Yii::app()->getConfig('varchar');
         //Retrieve the db specific varchar setting
         $columninfo = array('validfrom' => 'datetime', 'validuntil' => 'datetime', 'blacklisted' => $sVarchar . '(17) NOT NULL', 'participant_id' => $sVarchar . '(50) NOT NULL', 'remindercount' => "integer DEFAULT '0'", 'usesleft' => 'integer NOT NULL default 1');
         //Not sure if any other fields would ever turn up here - please add if you can think of any others
         foreach ($missingcolumns as $columnname) {
             addColumn($surveytable, $columnname, $columninfo[$columnname]);
         }
     }
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:26,代码来源:Tokens_dynamic.php

示例6: addColumn

 addColumn("users", 'level', "ENUM('free', 'user', 'admin' )", "default 'free'");
 addColumn("users", 'email', "varchar(65)", "default NULL");
 // Add the options table columns
 addColumn("options", '`type`', "ENUM('input', 'date', 'checkbox', 'hidden', 'textarea')", "default 'input'");
 addColumn("options", '`group`', "varchar(65)", "default 'Miscellaneous'");
 // This table will be where the settings are kept
 createTable("options_groups", "`group` varchar(65) NOT NULL", True, False);
 addColumn("options_groups", '`desc`', "varchar(65)", "default NULL");
 // This table will be where the settings are kept
 createTable("settings", "setting varchar(65) NOT NULL", True, False);
 addColumn("settings", '`desc`', "varchar(65)", "default NULL");
 addColumn("settings", 'type', "ENUM('input', 'date', 'checkbox', 'hidden', 'textarea')", "default 'input'");
 // This is where we will add the clien'ts ability to add values to the settings.
 createTable("repositry", "user_id int(11) NOT NULL", false, false);
 addColumn("repositry", '`key`', "varchar(65)", "default NULL");
 addColumn("repositry", 'value', "varchar(65)", "default NULL");
 // Create the default system user
 // Username: demo
 // Password: demo
 Auth::createNewUser('admin', 'password', 'admin@demo.co.za');
 // Add a user, when the username does not exist
 Auth::changeGroup('admin', 'admin');
 // Promote the user to administrator by running the following snippet*/
 $getId = Auth::userId('admin');
 Activation::generate($getId, 20);
 Activation::activate($getId);
 // Set the timestamp and filesize
 Options::add('installModified', $lastEdit, 'input');
 // Do not modify these, they need to be static
 Options::add('installFilesize', $fileSize, 'input');
 // Do not modify these, they need to be static*/
开发者ID:ninjahza,项目名称:baseline,代码行数:31,代码来源:install.inc.php

示例7: addColumn

		if(!$result){
			$addcolRes['dbset']=$db->lastErrorMsg();
		}
		else{
			$addcolRes['dbset']=$db->changes().' Record updated successfully.';
		}
		
		$db->close();
		return $addcolRes;
	}
}
$addcolRes = addColumn($settingRes,'tasubgroupopt','for_all_group');
$addcolRes = addColumn($settingRes,'tasubgroup','1');
$addcolRes = addColumn($settingRes,'critsPlugin','0');
$addcolRes = addColumn($settingRes,'critsPage','https://192.168.1.131/api/v1/');
$addcolRes = addColumn($settingRes,'critsLogin','username=<username>&api_key=<apikey>');


if(isset($_GET['update'])){
	$command[]="cd /var/www/";
	$command[]="mkdir /var/www/tmpupdatebackup";
	$command[]="cd /var/www/tmpupdatebackup/";
	#Backup DB's
	$command[]="cp /var/www/admin/admin.db /var/www/tmpupdatebackup";
	$command[]="cp /var/www/urls/urls.db /var/www/tmpupdatebackup";
	$command[]="cp /var/www/autopb/autopb.db /var/www/tmpupdatebackup";
	$command[]="cp /var/www/malwr/malwr.db /var/www/tmpupdatebackup";
	$command[]="cp /var/www/mastiff/mastiff.db /var/www/tmpupdatebackup";
	$command[]="cp /var/www/twitter/twitter.db /var/www/tmpupdatebackup";
	$command[]="cp /var/www/ticketgen.php /var/www/tmpupdatebackup";
	#Get new WIPSTER files
开发者ID:bhargavz,项目名称:WIPSTER,代码行数:31,代码来源:admin.php

示例8: checkColumns

 /**
  * Checks to make sure that all required columns exist in this tokens table
  * (some older tokens tables dont' get udated properly)
  *
  * This method should be moved to db update for 2.05 version so it runs only 
  * once per token table / backup token table
  */
 public function checkColumns()
 {
     $sid = self::$sid;
     $sTableName = '{{tokens_' . $sid . '}}';
     $columncheck = array("tid", "participant_id", "firstname", "lastname", "email", "emailstatus", "token", "language", "blacklisted", "sent", "remindersent", "completed", "usesleft", "validfrom", "validuntil");
     $tableSchema = Yii::app()->db->schema->getTable($sTableName);
     $columns = $tableSchema->getColumnNames();
     $missingcolumns = array_diff($columncheck, $columns);
     if (count($missingcolumns) > 0) {
         Yii::app()->loadHelper('update/updatedb');
         //Load the admin helper to allow column creation
         setVarchar();
         //Set the appropriate varchar settings according to the database
         $sVarchar = Yii::app()->getConfig('varchar');
         //Retrieve the db specific varchar setting
         $columninfo = array('validfrom' => 'datetime', 'validuntil' => 'datetime', 'blacklisted' => $sVarchar . '(17)', 'participant_id' => $sVarchar . '(50)', 'remindercount' => "integer DEFAULT '0'", 'usesleft' => 'integer NOT NULL default 1');
         //Not sure if any other fields would ever turn up here - please add if you can think of any others
         foreach ($missingcolumns as $columnname) {
             addColumn($sTableName, $columnname, $columninfo[$columnname]);
         }
         Yii::app()->db->schema->getTable($sTableName, true);
         // Refresh schema cache just in case the table existed in the past
     } else {
         // On some installs we have created not null for participant_id and blacklisted fix this
         $columns = array('blacklisted', 'participant_id');
         foreach ($columns as $columnname) {
             $definition = $tableSchema->getColumn($columnname);
             if ($definition->allowNull != true) {
                 Yii::app()->loadHelper('update/updatedb');
                 //Load the admin helper to allow column creation
                 setVarchar();
                 //Set the appropriate varchar settings according to the database
                 $sVarchar = Yii::app()->getConfig('varchar');
                 //Retrieve the db specific varchar setting
                 Yii::app()->db->createCommand()->alterColumn($sTableName, $columnname, sprintf('%s(%s)', Yii::app()->getConfig('varchar'), $definition->size));
                 Yii::app()->db->schema->getTable($sTableName, true);
                 // Refresh schema cache just in case the table existed in the past
             }
         }
     }
 }
开发者ID:rouben,项目名称:LimeSurvey,代码行数:48,代码来源:TokenDynamic.php

示例9: foreach

$countDisplayedColumns = 0;
foreach ($prefs as $property => $propertyValue) {
    if ($property != 'id_user' && $property != '_id') {
        if ($propertyValue) {
            $visibility = "table_cell";
            $countDisplayedColumns++;
        } else {
            $visibility = 'display:none';
        }
        if ($property == 'notes') {
            $columns[] = addColumn($property, $model->getAttributeLabel($property), '$data->getShortNotes()', $visibility);
        } elseif ($property == 'biobank_id') {
            $columns[] = addColumn('biobank_id', $model->getAttributeLabel('biobank_id'), '$data->getBiobankName()', $visibility);
        } elseif ($property == 'collection_name') {
            $columns[] = addColumn('collection_name', Biobank::model()->getAttributeLabel('collection_name'), '$data->biobank->collection_name', $visibility);
        } elseif ($property == 'collection_id') {
            $columns[] = addColumn('collection_id', Biobank::model()->getAttributeLabel('collection_id'), '$data->biobank->collection_id', $visibility);
        } elseif ($property == 'collect_date') {
            $columns[] = addColumn('collect_date', $model->getAttributeLabel('collect_date'), '$data->collect_date', $visibility);
            //TODO normaliser les dates de collecte avant d activer cette feature
            // $columns [] = getArrayColumn('collect_date', $model->getAttributeLabel('collect_date'), 'CommonTools::toShortDateFR($data->collect_date)', $visibility);
        } elseif ($property == 'storage_conditions') {
            $columns[] = addColumn('storage_conditions', $model->getAttributeLabel('storage_conditions'), '$data->getLiteralStorageCondition()', $visibility);
        } else {
            $columns[] = addColumn($property, $model->getAttributeLabel($property), '$data->' . $property, $visibility);
        }
    }
}
//popup de choix des colonnes à afficher
$columns[] = array('class' => 'CButtonColumn', 'header' => CHtml::link($imageSelect, '#', array('onclick' => '$("#selectPopup").dialog("open");return false;')), 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("site/view",array("id"=>"$data->_id", "asDialog"=>1))', 'click' => 'function(){window.open(this.href,"_blank","left=100,top=100,width=760,height=650,toolbar=0,resizable=1, location=no");return false;}')));
$this->widget('zii.widgets.grid.CGridView', array('id' => 'sample-grid', 'dataProvider' => $model->searchWithNotes(), 'columns' => $columns));
开发者ID:nmalservet,项目名称:biocap,代码行数:31,代码来源:search_samples.php

示例10: upgradeTokenTables126

function upgradeTokenTables126()
{
    global $modifyoutput;
    $sVarchar = Yii::app()->getConfig('varchar');
    $surveyidresult = dbGetTablesLike("tokens%");
    if (!$surveyidresult) {
        return "Database Error";
    } else {
        foreach ($surveyidresult as $sv) {
            Yii::app()->db->createCommand()->alterColumn(reset($sv), 'token', "{$sVarchar}(15)");
            addColumn(reset($sv), 'emailstatus', "{$sVarchar}(300) NOT NULL DEFAULT 'OK'");
        }
    }
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:14,代码来源:updatedb_helper.php

示例11: update_db

function update_db($newinstall)
{
    $database =& JFactory::getDBO();
    $error = false;
    // we create the new columns for 2.7
    $error = addColumn($database, 'preview_textfile_extensions', '', $error);
    $error = addColumn($database, 'edit_textfile_extensions', '', $error);
    $error = addColumn($database, 'js_create_folder', '', $error);
    $error = addColumn($database, 'js_rename_folder', '', $error);
    $error = addColumn($database, 'js_delete_folder', '', $error);
    $error = addColumn($database, 'js_copymove', '', $error);
    // new 2.8
    $error = addColumn($database, 'language_dropdown', 'de,en,es,br,cn,ct,da,fr,it,jp,nl,no,pl,pt,se,sk,tw', $error);
    $error = addColumn($database, 'use_image_magic', 'false', $error);
    $error = addColumn($database, 'image_magic_path', 'convert', $error);
    $error = addColumn($database, 'exclude_directories', 'data.pxp,_vti_cnf,.svn,CVS,thumbs', $error);
    $error = addColumn($database, 'normalise_file_names', 'false', $error);
    $error = addColumn($database, 'download_multiple_files_as_zip', 'false', $error);
    $error = addColumn($database, 'allowed_view_file_extensions', 'all', $error);
    $error = addColumn($database, 'forbidden_view_file_extensions', '', $error);
    $error = addColumn($database, 'description_mode', 'false', $error);
    $error = addColumn($database, 'description_mode_show_default', 'true', $error);
    $error = addColumn($database, 'description_mode_store', 'email', $error);
    $error = addColumn($database, 'master_profile', 'false', $error);
    $error = addColumn($database, 'master_profile_mode', 'login', $error);
    $error = addColumn($database, 'master_profile_lowercase', 'true', $error);
    // new 2.8.3
    $error = addColumn($database, 'normalise_directory_names', 'false', $error);
    $error = addColumn($database, 'direct_download', 'false', $error);
    $error = addColumn($database, 'fix_utf8', '', $error);
    // new 2.9
    if (!testEntry('use_js_include')) {
        $database->setQuery("INSERT INTO #__joomla_flash_uploader_conf (key_id, value) values ('use_js_include','true')");
        if (!$database->query()) {
            $error = true;
            echo $database->getErrorMsg() . '<br />';
        }
    }
    if (!testEntry('backend_access_upload')) {
        $database->setQuery("INSERT INTO #__joomla_flash_uploader_conf (key_id, value) values ('backend_access_upload','Manager')");
        if (!$database->query()) {
            $error = true;
            echo $database->getErrorMsg() . '<br />';
        }
    }
    if (!testEntry('backend_access_config')) {
        $database->setQuery("INSERT INTO #__joomla_flash_uploader_conf (key_id, value) values ('backend_access_config','Manager')");
        if (!$database->query()) {
            $error = true;
            echo $database->getErrorMsg() . '<br />';
        }
    }
    if (!testEntry('file_chmod')) {
        $database->setQuery("INSERT INTO #__joomla_flash_uploader_conf (key_id, value) values ('file_chmod','')");
        if (!$database->query()) {
            $error = true;
            echo $database->getErrorMsg() . '<br />';
        }
    }
    $error = addColumn($database, 'overwrite_files', 'true', $error);
    $error = addColumn($database, 'description_mode_mandatory', 'false', $error);
    $error = addColumn($database, 'show_full_url_for_selected_file', 'false', $error);
    $error = addColumn($database, 'normalize_spaces', 'false', $error);
    if (!testEntry('dir_chmod')) {
        $database->setQuery("INSERT INTO #__joomla_flash_uploader_conf (key_id, value) values ('dir_chmod','')");
        if (!$database->query()) {
            $error = true;
            echo $database->getErrorMsg() . '<br />';
        }
    }
    if ($error) {
        echo "<p class='error'>";
        echo JText::_('I_UPDATE_ERROR');
        return true;
        echo "</p>";
    } else {
        if (!$newinstall) {
            echo JText::_('I_UPDATE_OK');
        }
        return false;
    }
}
开发者ID:jnvilo,项目名称:tomasinasanctuary.org,代码行数:82,代码来源:install.joomla_flash_uploader.php

示例12: createTable

 createTable("users", "id int(11) NOT NULL", True, True);
 addColumn("users", 'nid', "varchar(32)", "default NULL");
 addColumn("users", 'username', "varchar(65)", "default NULL");
 addColumn("users", 'password', "varchar(65)", "default NULL");
 addColumn("users", 'level', "ENUM('free', 'user', 'admin', 'moderator')", "default 'user'");
 addColumn("users", 'email', "varchar(65)", "default NULL");
 // Add the options table columns
 addColumn("options", '`type`', "ENUM('input', 'date', 'bool', 'hidden', 'textarea')", "default 'input'");
 addColumn("options", '`group`', "varchar(65)", "default 'Miscellaneous'");
 // This table will be where the settings are kept
 createTable("options_groups", "`group` varchar(65) NOT NULL", True, False);
 addColumn("options_groups", '`desc`', "varchar(65)", "default NULL");
 // This is where we will add the clien'ts ability to add values to the settings.
 createTable("options_users", "user_id int(11) NOT NULL", false, false);
 addColumn("options_users", '`key`', "varchar(65)", "default NULL");
 addColumn("options_users", 'value', "varchar(65)", "default NULL");
 $defaultUser = 'root';
 $defaultPass = 'root';
 $adminEmail = 'iam@thatguy.co.za';
 // Create the default system user
 Auth::createNewUser($defaultUser, $defaultPass, $adminEmail);
 // Add a user, when the username does not exist
 Auth::changeGroup($defaultUser, 'admin');
 // Promote the user to administrator by running the following snippet*/
 $getId = Auth::userId($defaultUser);
 Activation::generate($getId, 20);
 Activation::activate($getId);
 // Set the timestamp and filesize
 Options::add('installModified', $lastEdit, 'hidden', 'Miscellaneous');
 // Do not modify these, they need to be static
 Options::add('installFilesize', $fileSize, 'hidden', 'Miscellaneous');
开发者ID:repsycle,项目名称:baseline,代码行数:31,代码来源:install.inc.php

示例13: addColumn

 function addColumn($table, $column_name, $column_info = '', $after = '')
 {
     if (addColumn($table, $column_name, $column_info, $after)) {
         $this->updated = true;
     }
 }
开发者ID:rsemedo,项目名称:Apply-Within,代码行数:6,代码来源:upgrade.php

示例14: array

            $visibility = "table_cell";
        } else {
            $visibility = 'display:none';
        }
        if ($property == 'notes') {
            $columns[] = array('class' => 'DataColumn', 'name' => $property, 'id' => 'col_' . $property, 'header' => Sample::model()->getAttributeLabel($property), 'value' => '$data->getShortNotes()', 'htmlOptions' => array('class' => "col_{$property}", 'style' => $visibility), 'headerHtmlOptions' => array('class' => "col_{$property}", 'style' => $visibility));
        } elseif ($property == 'biobank_id') {
            $columns[] = array('class' => 'DataColumn', 'name' => Yii::t('sample', 'biobank_id'), 'id' => 'col_' . $property, 'header' => Sample::model()->getAttributeLabel($property), 'value' => 'Biobank::model()->findByPk(new MongoId($data->biobank_id))->name', 'htmlOptions' => array('class' => "col_{$property}", 'style' => $visibility), 'headerHtmlOptions' => array('class' => "col_{$property}", 'style' => $visibility));
        } elseif ($property == 'collect_date') {
            $columns[] = array('class' => 'DataColumn', 'name' => $property, 'id' => 'col_' . $property, 'header' => Sample::model()->getAttributeLabel($property), 'value' => 'CommonTools::toShortDateFR($data->collect_date)', 'htmlOptions' => array('class' => "col_{$property}", 'style' => $visibility), 'headerHtmlOptions' => array('class' => "col_{$property}", 'style' => $visibility));
        } elseif ($property == 'storage_conditions') {
            $columns[] = array('class' => 'DataColumn', 'name' => $property, 'id' => 'col_' . $property, 'header' => Sample::model()->getAttributeLabel($property), 'value' => '$data->getLiteralStorageCondition()', 'htmlOptions' => array('class' => "col_{$property}", 'style' => $visibility), 'headerHtmlOptions' => array('class' => "col_{$property}", 'style' => $visibility));
        } elseif ($property == 'collection_name') {
            $columns[] = addColumn('collection_name', Biobank::model()->getAttributeLabel('collection_name'), '$data->biobank->collection_name', $visibility);
        } elseif ($property == 'collection_id') {
            $columns[] = addColumn('collection_id', Biobank::model()->getAttributeLabel('collection_id'), '$data->biobank->collection_id', $visibility);
        } else {
            $columns[] = array('class' => 'DataColumn', 'name' => $property, 'id' => 'col_' . $property, 'value' => '$data->' . $property, 'header' => Sample::model()->getAttributeLabel($property), 'htmlOptions' => array('class' => "col_{$property}", 'style' => $visibility), 'headerHtmlOptions' => array('class' => "col_{$property}", 'style' => $visibility));
        }
    }
}
//
$columns[] = array('header' => Yii::t('demande', 'sampleDetail'), 'class' => 'CLinkColumn', 'labelExpression' => '$data->_id', 'urlExpression' => 'Yii::app()->createUrl("site/view",array("id"=>"$data->_id"))', 'linkHtmlOptions' => array('onclick' => 'window.open(this.href,"SampleDetail","left=100,top=100,width=760,height=650,toolbar=0,resizable=0, location=no");return false;'), 'htmlOptions' => array('style' => 'text-align:center'), 'imageUrl' => $imageSampleDetail);
?>

<h1><?php 
echo Yii::t('common', 'demande') . ' ' . $model->titre;
?>
</h1>

<?php 
开发者ID:nmalservet,项目名称:biocap,代码行数:31,代码来源:update.php

示例15: XMLImportTokens

function XMLImportTokens($sFullFilePath, $iSurveyID, $sCreateMissingAttributeFields = true)
{
    Yii::app()->loadHelper('database');
    $clang = Yii::app()->lang;
    $sXMLdata = file_get_contents($sFullFilePath);
    $xml = simplexml_load_string($sXMLdata, 'SimpleXMLElement', LIBXML_NONET);
    $results['warnings'] = array();
    if ($xml->LimeSurveyDocType != 'Tokens') {
        $results['error'] = $clang->gT("This is not a valid token data XML file.");
        return $results;
    }
    if (!isset($xml->tokens->fields)) {
        $results['tokens'] = 0;
        return $results;
    }
    $results['tokens'] = 0;
    $results['tokenfieldscreated'] = 0;
    if ($sCreateMissingAttributeFields) {
        // Get a list with all fieldnames in the XML
        $aXLMFieldNames = array();
        foreach ($xml->tokens->fields->fieldname as $sFieldName) {
            $aXLMFieldNames[] = (string) $sFieldName;
        }
        // Get a list of all fieldnames in the token table
        $aTokenFieldNames = Yii::app()->db->getSchema()->getTable("{{tokens_{$iSurveyID}}}", true);
        $aTokenFieldNames = array_keys($aTokenFieldNames->columns);
        $aFieldsToCreate = array_diff($aXLMFieldNames, $aTokenFieldNames);
        Yii::app()->loadHelper('update/updatedb');
        foreach ($aFieldsToCreate as $sField) {
            if (strpos($sField, 'attribute') !== false) {
                addColumn('{{tokens_' . $iSurveyID . '}}', $sField, 'string');
            }
        }
    }
    switchMSSQLIdentityInsert('tokens_' . $iSurveyID, true);
    foreach ($xml->tokens->rows->row as $row) {
        $insertdata = array();
        foreach ($row as $key => $value) {
            $insertdata[(string) $key] = (string) $value;
        }
        $token = Token::create($iSurveyID);
        $token->setAttributes($insertdata, false);
        if (!$token->save()) {
            $results['warnings'][] = $clang->gT("Skipped tokens entry:") . ' ' . implode('. ', $token->errors['token']);
        }
        $results['tokens']++;
    }
    switchMSSQLIdentityInsert('tokens_' . $iSurveyID, false);
    if (Yii::app()->db->getDriverName() == 'pgsql') {
        try {
            Yii::app()->db->createCommand("SELECT pg_catalog.setval(pg_get_serial_sequence('{{tokens_" . $iSurveyID . "}}', 'tid'), (SELECT MAX(tid) FROM {{tokens_" . $iSurveyID . "}}))")->execute();
        } catch (Exception $oException) {
        }
    }
    return $results;
}
开发者ID:rouben,项目名称:LimeSurvey,代码行数:56,代码来源:import_helper.php


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