query
stringlengths
10
8.11k
document
stringlengths
17
398k
negatives
sequencelengths
19
20
metadata
dict
Get the value of salesTaxID
public function getSalesTaxID() { return $this->salesTaxID; }
[ "public function getTaxID();", "public function getShippingSalesTaxNumber();", "public function getCustomerTaxId();", "public function getTaxID()\n {\n return $this->taxID;\n }", "public function getIdTax()\n {\n return $this->id_tax;\n }", "public function getTaxId()\n {\n return isset($this->TaxId) ? $this->TaxId : null;\n }", "public function getTaxId()\n {\n return $this->taxId;\n }", "public function getSalesTax()\n {\n if (isset($this->data->totalTax)) {\n return $this->data->totalTax;\n }\n return null;\n }", "public function getTaxes_id()\n {\n return $this->taxes_id;\n }", "public function getTaxVal() {\n\t\treturn $this->taxVal;\n\t}", "public function getTaxClassId();", "public function getItemSalesTaxName()\n\t{\n\t\treturn $this->get('ItemSalesTaxRef FullName');\n\t}", "public function getItemSalesTaxListID()\n\t{\n\t\treturn $this->get('ItemSalesTaxRef ListID');\n\t}", "public function getCustomerTaxNumber(){\n $attributeCustomer = JSON::decode($this->attribute1);\n return isset($attributeCustomer['tax_no']) ? $attributeCustomer['tax_no'] : '';\n }", "public function getCidTax()\n {\n return $this->cid_tax;\n }", "function getTaxRateId() {\n return $this->getFieldValue('tax_rate_id');\n }", "public function getLineTax()\n\t{\n\t\treturn $this->getKeyValue('line_tax'); \n\n\t}", "public function getTaxAmount();", "public function action_gettaxval()\n {\n $common_model = Model::factory( 'commonmodel' );\n echo $company_tax = ( FARE_SETTINGS == 2 && !empty( $_REQUEST['company'] ) ) ? $common_model->company_tax( $_REQUEST['company'] ) : TAX;\n exit;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions getValidFieldsFromDb() Static valid fields are set in the Variables section. Valid fields derived from the database must be set here. Set dynamic valid fields just like static ones.
function getValidFieldsFromDb($dbs, $validTextFields, $validCheckFields, $validRadioFields, $validSelectFields, $validSelectMultiFields) { $errorCount = 0; // Database lookups inserted here // Process the data if($errorCount == 0) { return TRUE; } else { return FALSE; } }
[ "public function validateAllItemFields()\n {\n global $db;\n foreach (static::$db_table_fields as $key => $value) {\n //pass to validate function\n $rules = $this->findRules($value, static::$item_rules);\n $this->validate($value, $this->$value, $rules);\n } \n }", "public function validate_fields() {\n \n\t\t//...\n \n }", "public function validate_fields() {\n \n\t\t\n \n\t\t}", "protected function attachDynamicFields() {\n # Get Dynamic Entity Fields from Database\n $oMyFieldsDB = CoreEntityModel::$aEntityTables['core-form-fields']->select(['form'=>$this->sSingleForm]);\n if(count($oMyFieldsDB) > 0) {\n foreach($oMyFieldsDB as $oField) {\n $sFieldName = $oField->fieldkey;\n if(!property_exists($this,$sFieldName)) {\n # Assign Value from Object to Data based on type\n switch($oField->type) {\n case 'text':\n case 'textarea':\n case 'code':\n case 'email':\n case 'url':\n case 'featuredimage':\n case 'tel':\n case 'upload':\n $this->$sFieldName = '';\n break;\n case 'select':\n case 'currency':\n case 'hidden':\n case 'number':\n case 'boolselect':\n $this->$sFieldName = 0;\n break;\n case 'date':\n case 'datetime':\n $this->$sFieldName = '0000-00-00 00:00:00';\n break;\n default:\n break;\n }\n }\n }\n }\n }", "protected final static function valid_fields() {\n return array(\"id\", \"typeid\", \"userid\", \"courseid\", \"roomid\", \"starts\", \"ends\", \"day\", \"weeks\");\n }", "public function validateAllAttributeFields()\n {\n global $db;\n foreach (static::$db_attributes_table_fields as $key => $value) {\n $rules = $this->findRules($value, static::$attribute_rules);\n $this->validate($value, $this->$value, $rules);\n } \n }", "private function createFields(){\n //Human::log(\"------------- Create fields model \".$this->modelName);\n self::$yetInit[get_class($this)]=true;\n //let's init database.\n $modelName=get_class($this);\n $modelNameManager=$modelName.\"Manager\";\n if(!class_exists($modelNameManager)){\n $modelNameManager=\"DbManager\";\n }\n $rc=new ReflectionClass($modelName);\n $rc->setStaticPropertyValue(\"manager\", new $modelNameManager( $modelName ));\n \n //browse the class properties to find db fields and then store it in a good order (keys first, associations later)\n\t $fields=array();\n foreach ($rc->getProperties() as $field){\n if($field->isPublic()){\n\n\n //get the type from the @var type $field name comment...yes, I'm sure.\n $comments=$field->getDocComment();\n $details=CodeComments::getVariable($comments);\n\n $type=$details[\"type\"];\n $isVector=$details[\"isVector\"];\n $description=$details[\"description\"];\n $fieldName=$field->name;\n\n $fieldObject=$this->getDbField($fieldName,$type,$isVector);\n\n if($fieldObject){\n $fieldObject[\"comments\"]=$description;\n switch($fieldObject[\"type\"]){\n\n case \"OneToOneAssoc\":\n case \"NToNAssoc\":\n //associations at the end\n array_push($fields, $fieldObject);\n break;\n\n default :\n //classic fields at the beginning\n array_unshift($fields, $fieldObject);\n\n }\n\n }\n }\n }\n\t //create the fields\n\t foreach ($fields as $f){\n\t\t$f[\"options\"][Field::COMMENTS]=$f[\"comments\"];\n Field::create($modelName.\".\".$f[\"name\"],$f[\"type\"],$f[\"options\"]);\n //Human::log($this->modelName.\" Create field \".$f[\"name\"]);\n \n\t }\n \n\t //whooho!\n $this->db()->init(); \n }", "private function _parseFields()\n {\n // make a new array from the field_types array where all values are ZERO\n $num_types = array_fill_keys(array_keys($this->field_types), 0);\n\n // create a new fillable array\n $fillable = [];\n\n // loop fields\n foreach($this->fields as &$field_config){\n\n // DB FIELD NAME ---------------------------------------------------\n // get the schema type (eg: string, text etc.)\n $type = $this->field_types[$field_config['type']]['schema_type'];\n // create the field name based on the type and count\n $field_config['name'] = $type . (++$num_types[$type]);\n\n // FILLABLE ENTRIES ---------------------------------------------------\n // add a 'fillable' value like \"string1\", \"decimal3\" etc.\n $fillable[] = $field_config['name'];\n \n // VALIDATION RULES --------------------------------------------------\n // get the related rules from either the class fields or the field_types arrays\n $field_rules = isset($field_config['rules']) ? $field_config['rules'] : $this->field_types[$type]['rules']; \n // store\n $this->validation_rules[$field_config['name']] = $field_rules;\n\n // VALIDATION MESSAGES\n // copy all the validation messages from the lang file into a \n // FIELD specific array so we can swap all the attribute names out\n foreach(explode('|', $field_rules) as $field_rule){\n $rule_name = preg_replace('@:.*@','',$field_rule);\n $this->validation_messages[$field_config['name'].'.'.$rule_name] = $this->_swapValidationAttrs($rule_name, $field_config['label'], $field_rules);\n }\n\n }\n\n // merge the dynamic fillable fields with the defaults\n $merged_fillable = array_merge($this->fillable, $fillable);\n\n // set the fillable array using the appropriate parent method\n $this->fillable($merged_fillable);\n\n }", "private static function validateFieldsAreSet()\n\t{\n\t\tif(empty(static::$fields))\n\t\t{\n\t\t\tthrow new ActiveRecordException('No fields are set for ' . get_called_class() . '.');\n\t\t}\n\t}", "public function validate_fields(){\n\t \n\t\t\treturn true;\n\t\t \n\t\t}", "protected function _CheckFields ( )\n\t{\n\t\tparent::_CheckFields();\n\n\t\t// check for int/decimal changes\n\t\t$rules = Config::GetInstance()->GetConfig( 'rules' );\n\n\t\tforeach( $rules as $name => $format )\n\t\t{\n\t\t\t// table_description is filled before creating missing fields, but in that case\n\t\t\t// the field has been created with the right format\n\t\t\tif( $format->fieldtype == 'number' && isset( $this->table_description[$name] ) )\n\t\t\t{\n\t\t\t\tif( $format->decimals == 0 &&\n\t\t\t\t\tstrpos( $this->table_description[$name]['Type'], 'int' ) === false )\n\t\t\t\t{\n\t\t\t\t\t$sql = 'ALTER TABLE ' . $this->_EscapeName( $this->table )\n\t\t\t \t\t\t . ' CHANGE ' . $this->_EscapeName( $name) . ' ' . $this->_EscapeName( $name)\n\t\t\t \t\t\t . ' int(11)';\n\t\t\t\t}\n\t\t\t\telseif( $this->table_description[$name]['Type'] != 'decimal(' . 11 + $format->decimals . ',' . $format->decimals . ')' )\n\t\t\t\t{\n\t\t\t\t\t$sql = 'ALTER TABLE ' . $this->_EscapeName( $this->table )\n\t\t\t \t\t\t . ' CHANGE ' . $this->_EscapeName( $name) . ' ' . $this->_EscapeName( $name)\n\t\t\t \t\t\t . ' decimal(' . (11 + $format->decimals) . ',' . $format->decimals . ');';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$this->_Exec( $sql );\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "protected static function _initFields()\n {\n $className = get_called_class();\n $optionsMask = [\n 'type' => null,\n 'length' => null,\n 'primary' => null,\n 'unique' => null,\n 'autoincrement' => null,\n 'notnull' => null,\n 'unsigned' => null,\n 'default' => null,\n 'values' => null,\n ];\n\n // apply default values to field definitions\n if (!empty(static::$_classFields[$className])) {\n $fields = [];\n\n foreach (static::$_classFields[$className] as $field => $options) {\n if (is_string($field)) {\n if (is_array($options)) {\n $fields[$field] = array_merge($optionsMask, static::$fieldDefaults, ['columnName' => $field], $options);\n } elseif (is_string($options)) {\n $fields[$field] = array_merge($optionsMask, static::$fieldDefaults, ['columnName' => $field, 'type' => $options]);\n } elseif ($options == null) {\n continue;\n }\n } elseif (is_string($options)) {\n $field = $options;\n $fields[$field] = array_merge($optionsMask, static::$fieldDefaults, ['columnName' => $field]);\n }\n\n if ($field == 'Class') {\n // apply Class enum values\n $fields[$field]['values'] = static::$subClasses;\n }\n\n if (!isset($fields[$field]['blankisnull']) && empty($fields[$field]['notnull'])) {\n $fields[$field]['blankisnull'] = true;\n }\n\n if ($fields[$field]['autoincrement']) {\n $fields[$field]['primary'] = true;\n }\n }\n\n static::$_classFields[$className] = $fields;\n }\n }", "abstract protected function loadFields();", "public function loadFields()\n\t{\n\t\t// Get only the fields from the class instance, not its descendants\n\t\t$getFields = create_function('$obj', 'return get_object_vars($obj);');\n\t\t$fields = $getFields($this);\n\n\t\t// Field defaults\n\t\t$defaults = array(\n\t\t\t'primary' => false,\n\t\t\t'relation' => false\n\t\t);\n\n\t\t// Go through and set up each field\n\t\tforeach ($fields as $name => $options)\n\t\t{\n\t\t\t// Merge the defaults\n\t\t\t$options = array_merge($defaults, $options);\n\n\t\t\t// Is this the primary field?\n\t\t\tif ($options['primary'] === true)\n\t\t\t{\n\t\t\t\t$this->primaryKeyField = $name;\n\t\t\t}\n\n\t\t\t// Is this a relation?\n\t\t\tif ($options['relation'] !== false)\n\t\t\t{\n\t\t\t\t$this->relations[$name] = $options;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$this->fields[$name] = array();\n\t\t}\n\t}", "static function initFields()\r\n {\r\n global $effort_fields;\r\n $effort_fields=array();\r\n addProjectItemFields(&$effort_fields);\r\n \r\n foreach(array(\r\n new FieldInternal(array( 'name'=>'id',\r\n 'default'=>0,\r\n 'in_db_object'=>1,\r\n 'in_db_item'=>1,\r\n )),\r\n new FieldInternal(array( 'name'=>'project',\r\n 'default'=>0,\r\n 'in_db_object'=>1,\r\n 'in_db_item'=>1,\r\n )),\r\n new FieldString(array( 'name'=>'name',\r\n 'title'=>__('Summary'),\r\n 'tooltip'=>__('optional if tasks linked to this effort'),\r\n )),\r\n \r\n new FieldInternal(array( 'name'=>'task',\r\n )),\r\n \r\n new FieldDatetime(array( 'name'=>'time_start',\r\n 'title'=> __('Time Start'),\r\n 'default'=>FINIT_NOW\r\n )),\r\n new FieldDatetime(array( 'name'=>'time_end',\r\n 'title'=> __('Time End'),\r\n 'default'=>FINIT_NOW\r\n )),\r\n new FieldInternal(array( 'name'=>'person',\r\n )),\r\n new FieldText(array( 'name'=>'description',\r\n 'title'=>__('Description'),\r\n )),\r\n new FieldInternal(array( 'name'=>'as_duration',\r\n 'default'=>0,\r\n )),\r\n \t\t\t\tnew FieldOption (array( 'name'=>'status',\r\n 'title'=>__('Status'),\r\n 'view_in_forms'=>true,\r\n 'default'=>1,\r\n )),\r\n \r\n ) as $f) {\r\n $effort_fields[$f->name]=$f;\r\n }\r\n }", "abstract protected function initializeFields();", "public function test_coursecorequisite_hascorrectdbfields() {\n $testobj = new coursecorequisite(false, null, array(), false, array());\n $this->assertTrue($testobj->_test_dbfields(), 'Error(s) with class $_dbfield_ properties.');\n }", "protected final static function valid_fields() {\n return array('id', 'userid', 'courseid', 'roleid', 'status');\n }", "abstract protected function getFieldValidators();" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creation de l'objet Creer l'objet et prepare la valeur du sort_en_erreur.
public function __construct($sort_en_erreur = false, $entete = __CLASS__) { parent::__construct ( $sort_en_erreur, $entete ); }
[ "public function __construct($sort_en_erreur = \"oui\", $entete = __CLASS__) {\n\t\tparent::__construct ( $sort_en_erreur, $entete );\n\t}", "public function __construct(\n\t\t\t$sort_en_erreur = \"oui\",\n\t\t\t$entete = __CLASS__) {\n\t\t// Gestion de abstract_log\n\t\tparent::__construct ( $sort_en_erreur, $entete );\n\t\t$this->charge_table ();\n\t\t$this->charge_champs ();\n\t}", "public function sortir_new(){\r\n\t\tglobal $conn;\r\n\t\t$query =$conn->prepare(\"INSERT INTO sortir(id_films,type_sortie_films, date_sortie) VALUES (:id_films,:type_sortie_films,:date_sortie)\");\r\n\t\t$query->execute(array(\"id_films\" =>$this->id_films, \"type_sortie_films\" =>$this->type_sortie_films, \"date_sortie\" =>$this->date_sortie));\r\n\t}", "static function &creer_zabbix_item(&$liste_option, &$zabbix_ws, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\tabstract_log::onDebug_standard ( __METHOD__, 1 );\n\t\t$objet = new zabbix_item ( $sort_en_erreur, $entete );\n\t\treturn $objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option,\n\t\t\t\t\"zabbix_wsclient\" => $zabbix_ws \n\t\t) );\n\t}", "static function &creer_zabbix_action_operation_message(&$liste_option, &$zabbix_ws, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\tabstract_log::onDebug_standard ( __METHOD__, 1 );\n\t\t$objet = new zabbix_action_operation_message ( $sort_en_erreur, $entete );\n\t\treturn $objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option,\n\t\t\t\t\"zabbix_wsclient\" => $zabbix_ws \n\t\t) );\n\t}", "static function &creer_comparaison_resultat_sql(&$liste_option, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\t$objet = new comparaison_resultat_sql ( $sort_en_erreur, $entete );\n\t\t$objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option \n\t\t) );\n\t\t\n\t\treturn $objet;\n\t}", "public function crear()\r\n {\r\n if ($this->nombreCorto && $this->nombreLargo) {\r\n $consulta = \"INSERT INTO asignatura (id, nombreCorto, nombreLargo, fechaCreacion) VALUES (NULL, '{$this->nombreCorto}', '{$this->nombreLargo}', NOW())\";\r\n $resultado = Conexion::getInstancia()->insertar($consulta);\r\n if ($resultado[0] == 2) {\r\n $this->id = $resultado[2];\r\n return $resultado;\r\n }\r\n return ($resultado[0] == 1) ? $this->obtenerPorNombre() : $resultado;\r\n }\r\n Log::guardar(\"INF\", \"ASIGNATURA --> CREAR NOMBRE CORTO O LARGO INVALIDO\");\r\n return array(1, \"Los campos necesarios para crear la asignatura no cumplen con el formato requerido\");\r\n }", "static function &creer_definition_fichier(&$liste_option, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\t$objet = new definition_fichier ( $sort_en_erreur, $entete );\n\t\t$objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option \n\t\t) );\n\t\t\n\t\treturn $objet;\n\t}", "static function &creer_zabbix_action(&$liste_option, &$zabbix_ws, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\tabstract_log::onDebug_standard ( __METHOD__, 1 );\n\t\t$objet = new zabbix_action ( $sort_en_erreur,$entete );\n\t\treturn $objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option,\n\t\t\t\t\"zabbix_wsclient\" => $zabbix_ws \n\t\t) );\n\t}", "static function &creer_requete_complexe_itop(\n\t\t\t&$liste_option,\n\t\t\t$sort_en_erreur = true,\n\t\t\t$entete = __CLASS__) {\n\t\t$objet = new requete_complexe_itop ( $sort_en_erreur, $entete );\n\t\t$objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option\n\t\t) );\n\t\treturn $objet;\n\t}", "protected function insereErradas() {\n date_default_timezone_set('America/Sao_Paulo');\n $datahora = date(\"Y-m-d H:i:s\");\n $create = new Create;\n $Dados = array(\"datahora\" => $datahora, \"flag\" => $this->resposta, \"usuario_id\" => $this->userid,);\n $create->IniCreate(\"erradas\", $Dados);\n if ($create->getResult()):\n return 0; // Cadastrado errada e retorna flag Incorreta\n endif;\n }", "static function &creer_sitescope_compare_tables(&$liste_option, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\t$objet = new sitescope_compare_tables ( $entete, $sort_en_erreur );\n\t\t$objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option\n\t\t) );\n\t\n\t\treturn $objet;\n\t}", "function prepare_donnees(&$liste_option,$donnees_resultat)\n{\n\t$tableau_valeur=array();\n\t$donnee_preparees=array();\n\t$entete=creer_entete_csv($liste_option);\n\n\tif($liste_option->getOption(\"fichier[@ajouter_serial='oui']\",true)!==false)\n\t{\n\t\t$entete=\"Serial\".$liste_option->getOption(array(\"ordre_de_sortie\",\"separateur\")).$entete;\n\t}\n\n\tforeach($donnees_resultat as $serial => $donnees_par_date)\n\t{\n\t\t//On prepare le nom du fichier\n\t\tif($liste_option->getOption(\"fichier[@ajouter_serial='oui']\",true)!==false) {\n\t\t\t$nom_fichier=\"unique\";\n\t\t} else {\n\t\t\t$nom_fichier=$serial;\n\t\t}\n\n\t\t//On prepare le tableau\n\t\t//Si on ajoute dans la fichier, on ne met pas d'entete\n\t\t$donnee_preparees[$nom_fichier][0]=$entete;\n\n\t\tforeach($donnees_par_date as $date => $donnees_algo)\n\t\t{\n\t\t\t$liste_nom_algo=$liste_option->getOption(array(\"ordre_de_sortie\",\"champ\",\"nom_algo\"));\n\t\t\t$separateur=$liste_option->getOption(array(\"ordre_de_sortie\",\"separateur\"));\n\t\t\t$nb_max_champ=nombre_max_champ($donnees_algo,$liste_nom_algo);\n\t\t\tfor($i=0;$i<$nb_max_champ;$i++)\n\t\t\t{\n\t\t\t\tif($liste_option->getOption(\"fichier[@ajouter_serial='oui']\",true)!==false) {\n\t\t\t\t\t$ligne=$serial;\n\t\t\t\t} else {\n\t\t\t\t\t$ligne=\"\";\n\t\t\t\t}\n\t\t\t\t//Ajout de la date dans la ligne\n\t\t\t\tif(check_report_date($liste_option)) {\n\t\t\t\t\tif($ligne!=\"\") {\n\t\t\t\t\t\t$ligne.=$separateur;\n\t\t\t\t\t}\n\t\t\t\t\t$ligne.=$date;\n\t\t\t\t}\n\t\t\t\t//on creer une table de hash avec les valeurs a la case $i\n\t\t\t\tforeach($donnees_algo as $libelle => $valeur)\n\t\t\t\t{\n\t\t\t\t\tif(is_array($valeur)) \n\t\t\t\t\t{\n\t\t\t\t\t\tif(isset($valeur[$i]))\t$tableau_valeur[$libelle]=$valeur[$i];\n\t\t\t\t\t\telse $tableau_valeur[$libelle]=\" \";\n\t\t\t\t\t} elseif($i==0) $tableau_valeur[$libelle]=$valeur;\n\t\t\t\t\telse $tableau_valeur[$libelle]=\" \";\n\t\t\t\t}\n\n\t\t\t\t//Pour chaque champ de ordre_de_sortie\n\t\t\t\t//on recupere le nom_algo et on le cherche dans les donnees algo pour l'afficher\n\t\t\t\tif(is_array($liste_nom_algo))\n\t\t\t\t{\n\t\t\t\t\tforeach($liste_nom_algo as $nom_algo)\n\t\t\t\t\t{\n\t\t\t\t\t\tif($ligne!=\"\") $ligne.=$separateur;\n\t\t\t\t\t\tif($liste_option->verifie_option_existe(\"convertir_serial_en_nom\")!==false && $nom_algo==\"serial\") {\n\t\t\t\t\t\t\t$tableau_valeur[$nom_algo]=convert_serial_to_nom($liste_option,$tableau_valeur[$nom_algo]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($nom_algo!=\"\" && isset($tableau_valeur[$nom_algo])) {\n\t\t\t\t\t\t\t$ligne.=hash_ligne($tableau_valeur[$nom_algo]);\n\t\t\t\t\t\t} elseif($liste_option->verifie_option_existe(array(\"ordre_de_sortie\",\"champ\",$nom_algo))!==false)\n\t\t\t\t\t\t\t$ligne.=$liste_option->getOption(array(\"ordre_de_sortie\",\"champ\",$nom_algo));\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tif($ligne!=\"\") $ligne.=$separateur;\n\t\t\t\t\t$ligne.=hash_ligne($tableau_valeur[$liste_nom_algo]);\n\t\t\t\t}\n\t\t\t\t$donnee_preparees[$nom_fichier][].=$ligne;\n\t\t\t}\n\t\t}\n\t}\n\treturn $donnee_preparees;\n}", "function insert_stat_sortie($id_domicilie, $nom_fichier, $id_utilisateur, $id_signataire){\r\n\t$SQL = \"insert into sorties (id_domicilie,type,date,id_utilisateur,id_signataire) values(\".$id_domicilie.\",'\".$nom_fichier.\"','\".date('Ymd').\"',\".$id_utilisateur.\",\".$id_signataire.\")\";\r\n\t$resultat = mysql_query($SQL);\r\n}", "static function &creer_zabbix_action_operation(&$liste_option, &$zabbix_ws, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\tabstract_log::onDebug_standard ( __METHOD__, 1 );\n\t\t$objet = new zabbix_action_operation ( $sort_en_erreur, $entete );\n\t\treturn $objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option,\n\t\t\t\t\"zabbix_wsclient\" => $zabbix_ws \n\t\t) );\n\t}", "Public function convobjet($requete,$nom_objet)\n {\n /*si la requete est vide alors on return une erreur */\n if(empty($requete))\n {\n return 'erreur Le parametre requete est vide';\n\n }\n\n if(empty($nom_objet))\n {\n return 'erreur le parametre nom objet est vide';\n }\n\n /*on continu on extrait toute la requete dans un objet avec la boucle while*/\n\n /* @var $donnee object */\n $i = 1;\n while( $donnee = mysql_fetch_object($requete))\n {\n $db_objet->total = $i;\n $test = $nom_objet.'_'.$i;\n $db_objet->$test =$donnee;\n\n $i ++;\n }\n\n /* je retoune l'objet crée par la requete sql */\n return $db_objet;\n }", "function ajouterHeberge(){\n\t\tglobal $tabRes;\t\n\t\t$type = $_POST['type'];\n\t\t$nom = $_POST['nom'];\n\t\t$adresse = $_POST['adresse'];\n\t\t$siteweb = $_POST['siteweb'];\n\t\t$description = $_POST['description'];\n\t\t\n\t\ttry{\n\t\t\t$unModele=new royaltoursModele();\n\t\t\t$requete=\"INSERT INTO hebergement VALUES(0,?,?,?,?,?)\";\n\t\t\t$unModele=new royaltoursModele($requete,\n\t\t\t\tarray($type,$nom,$adresse,$siteweb,$description));\n\t\t\t$stmt=$unModele->executer();\n\t\t\t$tabRes['action']=\"enregistrer\";\n\t\t\t$tabRes['msg']=\" hebergement bien enregistre\";\n\t\t}catch(Exception $e){\n\t\t}finally{\n\t\t\tunset($unModele);\n\t\t}\n\t}", "public function addfichierAction()\n {\n\n\t\t$sessionutilisateur = new Zend_Session_Namespace('utilisateur');\n\t\t//$this->_helper->layout->disableLayout();\n \t\t$this->_helper->layout()->setLayout('layoutpublicesmcadmin');\n\t\t\n\tif (!isset($sessionutilisateur->login)) {$this->_redirect('/administration/login');}\nif($sessionutilisateur->confirmation != \"\"){$this->_redirect('/administration/confirmation');}\n\n\tif (isset($_POST['ok']) && $_POST['ok']==\"ok\") {\n\tif (isset($_POST['fichier_type']) && $_POST['fichier_type']!=\"\" && isset($_POST['fichier_categorie']) && $_POST['fichier_categorie']!=\"\" && isset($_POST['fichier_libelle']) && $_POST['fichier_libelle']!=\"\" && isset($_FILES['fichier_url']['name']) && $_FILES['fichier_url']['name']!=\"\") {\n\t\t\n\t\tinclude(\"Transfert.php\");\n\t\tif(isset($_FILES['fichier_url']['name']) && $_FILES['fichier_url']['name']!=\"\"){\n\t\t$chemin\t= \"fichiers\";\n\t\t$file = $_FILES['fichier_url']['name'];\n\t\t$file1='fichier_url';\n\t\t$fichier = $chemin.\"/\".transfert($chemin,$file1);\n\t\t} else {$fichier = \"\";}\n\t\t\t\n $date_id = new Zend_Date(Zend_Date::ISO_8601);\n $a = new Application_Model_EuFichier();\n $ma = new Application_Model_EuFichierMapper();\n\t\t\t\n $compteur = $ma->findConuter() + 1;\n $a->setFichier_id($compteur);\n $a->setFichier_type($_POST['fichier_type']);\n $a->setFichier_categorie($_POST['fichier_categorie']);\n $a->setFichier_libelle($_POST['fichier_libelle']);\n $a->setFichier_url($fichier);\n $a->setPublier($_POST['publier']);\n $ma->save($a);\n\t\t\t\n\t\t$this->_redirect('/administration/listfichier');\n\t\t} else { $this->view->error = \"Champs * obligatoire ...\"; } \n\t\t}\n\t\t\n }", "static function &creer_zabbix_templates(&$liste_option, &$zabbix_ws, $sort_en_erreur = false, $entete = __CLASS__) {\n\t\tabstract_log::onDebug_standard ( __METHOD__, 1 );\n\t\t$objet = new zabbix_templates ( $sort_en_erreur, $entete );\n\t\treturn $objet->_initialise ( array (\n\t\t\t\t\"options\" => $liste_option,\n\t\t\t\t\"zabbix_wsclient\" => $zabbix_ws \n\t\t) );\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get fake instance of TblSanciones
public function fakeTblSanciones($tblSancionesFields = []) { return new TblSanciones($this->fakeTblSancionesData($tblSancionesFields)); }
[ "public function fakeTblStatusproyecto($tblStatusproyectoFields = [])\n {\n return new TblStatusproyecto($this->fakeTblStatusproyectoData($tblStatusproyectoFields));\n }", "public static function getInstance()\n {\n return Doctrine_Core::getTable('talleSetZona');\n }", "public function fakeTblTitulos($tblTitulosFields = [])\n {\n return new TblTitulos($this->fakeTblTitulosData($tblTitulosFields));\n }", "public function getBasedeDatos()\n {\n return new MySqlBD();\n }", "public function fakeTblDuracion($tblDuracionFields = [])\n {\n return new TblDuracion($this->fakeTblDuracionData($tblDuracionFields));\n }", "protected function create_table_object() {\n\t\treturn new DBTable('test');\t\t\n\t}", "public static function Table() { $strClass = self::TableClass(); return new $strClass; }", "public function getTable()\n {\n $data= DB::table('dispositivo')->select('*')->where('dispositivo.estado','ACTIVO')->orderBy('dispositivo.id', 'desc')->get();\n return Datatables::of($data)->make(true);\n }", "private function getCargoTable()\n {\n // adicionar service ModelCargo a variavel de classe\n if (!$this->cargoTable) {\n $this->cargoTable = $this->getServiceLocator()->get('ModelCargo');\n }\n\n // return vairavel de classe com service ModelCargo\n return $this->cargoTable;\n }", "public static function getInstance()\n {\n return Doctrine_Core::getTable('pedidoProductoItemCampana');\n }", "function getDBTable() {\n // start with a general db_obj \n $db_obj = new db_class();\n \n $this->primary_key = $db_obj->getPrimaryKey($this->table_name);\n \n if(! $this->filtered_query){\n $sql = $this->get_sql();\n $db_table = $db_obj->getTableNoParams($sql);\n } else {\n $variables = gen_filtered_search();\n $db_table = $db_obj->safeSelect($variables['sql'], $variables['typestr'], $variables['params'] );\n }\n $db_obj->closeDB();\n \n return $db_table;\n }", "protected function setUpOldTable()\n {\n return new Table('foo');\n }", "private function createDummyTable() {}", "private function getTable()\n {\n return DB::table(self::$table);\n }", "public function get()\n {\n return new TableFacade();\n }", "private function createTableMock()\n {\n return $this->getMockBuilder(Table::class)->disableOriginalConstructor()->getMock();\n }", "protected function init_table() \t\r\n\t\t{ \r\n\t\t\treturn self::TABLE; \r\n\t\t}", "public function getTabla()\r\n {\r\n return $this->tabla;\r\n }", "public function select(){\r\n\t\techo \"SELECT * FROM \".static::$table; //value will be panding and its value assign when its object created and its value assign inside class of object\r\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find out columns used in a query by comparing every models field against a given string
public function getColumns($string) { if (empty($string)) { return false; } foreach (SalamaData::$c as $model => $fields) { foreach ($fields as $field => $v) { if (strpos($string, $field) !== false) { if (!in_array($field, $this->_usedColumns)) { $this->_usedColumns[] = $field; } } } } }
[ "protected function queryFields() {\n $key = $this->tableName();\n\n // only look up fields if they haven't already been looked up\n if (!isset(self::$_fields[$key])) {\n\n // check the app cache for the data\n self::$_fields[$key] = Yii::app()->cache->get('fields_' . $key);\n if (self::$_fields[$key] === false) { // if the cache is empty, look up the fields\n $fieldList = CActiveRecord::model('Fields')->findAllByAttributes(\n array('modelName' => get_class($this), 'isVirtual' => 0));\n if (!empty($fieldList)) {\n self::$_fields[$key] = $fieldList;\n\n // cache the data\n Yii::app()->cache->set('fields_' . $key, self::$_fields[$key], 0);\n } else {\n self::$_fields[$key] = $this->attributeLabels();\n }\n }\n }\n }", "public function _getBestSearchFields(){\n\n\t\t$result = self::getSearchFields();\n\n\t\tif($result){\n\t\t\treturn($result);\n\t\t}else{\n\t\t\tdie(\"DURC Model for $this_class_name could not get any reasonable fields for searching.. check your $db_table table..\");\n\t\t}\n\t}", "private function _find_fields() {\n\t\t$result = $this->db->fields($this->_table);\n\t\t$this->_fields = array_diff($result, array('id'));\n\t}", "public function getBoostQueryFields();", "private function handle_show_columns_query() {\n\t\t$this->_query = str_ireplace(' FULL', '', $this->_query);\n\t\t$pattern_like = '/^\\\\s*SHOW\\\\s*(COLUMNS|FIELDS)\\\\s*FROM\\\\s*(.*)?\\\\s*LIKE\\\\s*(.*)?/i';\n\t\t$pattern = '/^\\\\s*SHOW\\\\s*(COLUMNS|FIELDS)\\\\s*FROM\\\\s*(.*)?/i';\n\t\tif (preg_match($pattern_like, $this->_query, $matches)) {\n\t\t\t$table_name = str_replace(\"'\", \"\", trim($matches[2]));\n\t\t\t$column_name = str_replace(\"'\", \"\", trim($matches[3]));\n\t\t\t$query_string = \"SELECT sql FROM sqlite_master WHERE tbl_name='$table_name' AND sql LIKE '%$column_name%'\";\n\t\t\t$this->_query = $query_string;\n\t\t} elseif (preg_match($pattern, $this->_query, $matches)) {\n\t\t\t$table_name = $matches[2];\n\t\t\t$query_string = preg_replace($pattern, \"PRAGMA table_info($table_name)\", $this->_query);\n\t\t\t$this->_query = $query_string;\n\t\t}\n\t}", "abstract public function getFieldsQuery($table);", "function hint_cols() {\n //Filter from this table's columns those that are descriptive\n $descriptives = array_filter($this->fields, function($col) {\n //Get the column name\n $name = $col->column_name;\n //\n //Descriptive columns ar names descriptions or have a name\n //suffix\n $filter = ((substr($name, -4) == \"name\") || ($name == \"description\")) ? true : false;\n //\n return $filter;\n });\n //\n //Let $c be the combination of indexing and descriptive columns\n $c = array_merge($this->default_index_cols(), $descriptives);\n //\n //Remove duplicates. Get the __toString to work correctory\n $d = array_unique($c);\n //\n //return the combination\n return $d;\n }", "function get_hint_cols() {\n //\n //Filter from this table's columns those that are descriptive\n $descriptives = array_filter($this->fields, function($col) {\n //Get the column name\n $name = $col->name;\n //\n //Descriptive columns are named are name, description or have a \n //name //suffix\n $filter = ((substr($name, -4) == \"name\") || ($name == \"description\")) ? true : false;\n //\n return $filter;\n });\n //\n //Let $c be the combination of indexing and descriptive columns\n $c = array_merge($this->first_index_cols(), $descriptives);\n //\n //Remove duplicates. Get the __toString to work correctly, i.e, the \n //array unique function requires us to convert the columns to strings\n $d = array_unique($c);\n //\n //return the combination\n return $d;\n }", "private function handle_show_columns_query()\n {\n $this->_query = str_ireplace(' FULL', '', $this->_query);\n $pattern_like = '/^\\\\s*SHOW\\\\s*(COLUMNS|FIELDS)\\\\s*FROM\\\\s*(.*)?\\\\s*LIKE\\\\s*(.*)?/i';\n $pattern = '/^\\\\s*SHOW\\\\s*(COLUMNS|FIELDS)\\\\s*FROM\\\\s*(.*)?/i';\n if (preg_match($pattern_like, $this->_query, $matches)) {\n $table_name = str_replace(\"'\", '', trim($matches[2]));\n $column_name = str_replace(\"'\", '', trim($matches[3]));\n $query_string = \"SELECT sql FROM sqlite_master WHERE tbl_name='$table_name' AND sql LIKE '%$column_name%'\";\n $this->_query = $query_string;\n } elseif (preg_match($pattern, $this->_query, $matches)) {\n $table_name = $matches[2];\n $query_string = preg_replace($pattern, \"PRAGMA table_info($table_name)\", $this->_query);\n $this->_query = $query_string;\n }\n }", "public function columns_by_name()\n {\n $cols_by_name = array();\n foreach ($this->columns() as $column)\n $cols_by_name[$column->Field] = $column;\n\n return $cols_by_name;\n }", "private function searchableColumns()\n {\n return empty($this->searchables) ? array_diff($this->fillable, $this->hidden) : $this->searchables;\n }", "public function getQueryFields();", "public function columns($fields=NULL)\n\t{\n\t\textract($this->read());\n\n\t\tif (is_null($fields) || is_string($fields))\n\t\t{\n\t\t\treturn $columns[$fields ? $fields : 'all'];\n\t\t}\n\n\t\t$search = array_combine($fields, $fields);\n\n\t\t// Translate each short fieldname to its fully qualified name\n\t\t// If there is a conflict, fields from the main table will have priority\n\t\tforeach (($columns['own'] + $columns['src']) as $fqn => $c)\n\t\t{\n\t\t\t$col = $c['column'];\n\t\t\t$tbl = \"`{$c['table']}`.`{$c['column']}`\";\n\n\t\t\t// Find matches with decreasing specificity\n\t\t\tif (($inc = array_search($fqn, $search, true)) !== false\n\t\t\t || ($inc = array_search($tbl, $search, true)) !== false\n\t\t\t || ($inc = array_search($col, $search, true)) !== false)\n\t\t\t{\n\t\t\t\t$search[$inc] = $c;\n\t\t\t}\n\t\t}\n\n\t\t// Fields without a match retain the field name instead of an empty list\n\t\tforeach ($search as &$v)\n\t\t{\n\t\t\tis_array($v) || ($v = []);\n\t\t}\n\n\t\treturn $search;\n\t}", "function filter_search_columns($columns, $search, $WP_User_Query)\n {\n }", "private function columnList()\n\t{\n\t\t$table = $this->query->table();\n\t\t$joins = $this->query->joins();\n\t\t$fields = [];\n\t\t\n\t\tforeach ($this->query->columns() as $name => $alias) {\n\t\t\t$fields[] = $this->_columnName($table, $name, $alias);\n\t\t}\n\t\tforeach ($joins as $join) {\n\t\t\t$foreignTable = $join->foreignTable();\n\t\t\tforeach ($join->columns() as $name => $alias) {\n\t\t\t\t$fields[] = $this->_columnName($foreignTable, $name, $alias);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count($fields) ? implode(\", \", $fields) : \"*\";\n\t}", "function checkByField() {\n //Get the name of the table\n $db =& ConnectionManager::getDataSource($this->useDbConfig);\n $tableName = $db->fullTableName($this, false);\n\n // cek if field created_by and modified_by is exists in current table\n $result = $this->query(\"SELECT column_name FROM information_schema.columns WHERE table_name ='{$tableName}' and column_name LIKE '%ed_by';\");\n if( isset( $result[0]['COLUMNS']['column_name']) || isset($result[0][0]['column_name'])) {\n return true;\n } else {\n return false;\n }\n }", "function user_search_columns($columns, $search, $WP_User_Query)\n {\n }", "public function querableFields() {\n return array(\n 'given' => 'Name.given',\n 'family' => 'Name.family',\n 'mail' => 'EmailAddress.mail'\n );\n }", "public function getExistColumns() {\n\t\t$result = array();\n\t\tforeach($this->notorm_source as $row) {\n\t\t\t$result = array_keys(iterator_to_array($row)); \n\t\t\tbreak;\n\t\t}\n\t\t\n\t\t$this->exist_columns = $result;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply a transformer using a member transformer(s) on a value.
public static function applyTransformer(object $instance, string $member, $value, ?string $transform = 'transform') { $class = \get_class($instance); $metas = OrmUtils::getModelMetadata($class); if (isset ($metas ['#transformers'] [$transform] [$member])) { $transformer = $metas ['#transformers'] [$transform] [$member]; return $transformer::$transform ($value); } return $value; }
[ "abstract public function transform($value);", "public function transform($value);", "public function transformValue( $value ) {\n $valueTransformer = $this->_valueTransformer;\n return $valueTransformer ? $valueTransformer($value) : $value ;\n }", "public function transform($internalValue);", "public function transform() {\n // Prepare the texts to be transformed, and create a TextTranslator.\n // Any separator would be OK except \".\" because we do not want TextTranslator to remap the texts into their\n // positions using the dot notation. We will handle remapping using ValueSetter.\n $separator = '|';\n $extractor = new ValueExtractor();\n\n // Get which fields should be transformed\n $transformableFields = $this->useCustomFields ? $this->customTransformableFields : $this->transformable->getTransformableFields();\n\n $texts = $extractor->fillAndFlatten($this->transformable, $transformableFields, $separator);\n\n // If there are no texts to transform, no need to proceed.\n if(!$texts) return $this->transformable;\n\n // Translate the prepared texts\n $transformedTexts = $this->getTransformationService()->transform($this->settings, $texts, $this->dryRun);\n if (!$transformedTexts) return null;\n\n // Assign transformed texts to the Transformable instance.\n $setter = new ValueSetter();\n $setter->set($this->transformable, $transformedTexts, $separator);\n\n return $this->transformable;\n }", "public function transform(callable $transformer)\n {\n return self::from(Iterables::transform($this, $transformer));\n }", "public function apply($value);", "abstract protected function applyTransformations();", "public function resolveTransformedValue($value)\n {\n return transform($value, $this->transformCallback ?? function ($value) {\n return $value;\n });\n }", "public abstract function transform($item);", "public function setTransformations($field, $transformations = []);", "abstract public function transform($data);", "private static function apply_default_transform( $field_obj ) {\n\t\t$class = self::get_transform_class_name( $field_obj['type'] );\n\n\t\tif ( method_exists( $class, 'apply' ) ) {\n\t\t\treturn call_user_func( [ $class, 'apply' ], $field_obj );\n\t\t}\n\n\t\treturn $field_obj['value'];\n\t}", "public function getTransformer();", "public function setValueTransformer( Closure $transformer ) {\n $this->_axisValueTransformer = $transformer;\n return $this;\n }", "public function addTransform($context, callable $transform, $offset = PHP_INT_MAX)\n {\n if (!isset($this->transforms[$context])) {\n $this->transforms[$context] = [];\n }\n\n array_splice($this->transforms[$context], $offset, 0, [$transform]);\n $this->resolved = [];\n\n return $this;\n }", "public function mutate($value, $mutators);", "public function displayTransform($value)\n {\n if (is_callable($value)) {\n $this->fieldProperties->offsetSet('displayTransform', $value);\n return $this;\n }\n throw new \\InvalidArgumentException(\"displayTransform() requires a callable\");\n }", "protected function applyFieldValue($fieldName, $value) {\n\t\treturn $value;\n\t\t$method = 'apply' . ucfirst($fieldName);\n\t\tif (method_exists($this, $method)) {\n\t\t\treturn $this->$method($value);\n\t\t} else {\n\t\t\treturn $value;\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the whole URI of user's picture, or 'nopicture' image if he doesn't have one
public function getPictureURI() { if ($this->getPicture()) { return '/uploads/trombinoscope/' . $this->getPicture(); } else { return 'no_picture'; } }
[ "public function getProfilePicture()\n {\n $baseUrl = 'img/clients/' . $this->id;\n return file_exists($baseUrl . self::JPG) ? '/' . $baseUrl . self::JPG : (\n file_exists($baseUrl . self::PNG) ? '/' . $baseUrl . self::PNG : '/img/default_avatar.jpg'\n );\n }", "public function user_photo($nophoto_image = \"\") {\n\t global $url;\n\t $user_photo = $url->url_userTRdir($this->user_info[user_id]).$this->user_info[user_photo];\n\t //if(!file_exists($user_photo) | $this->user_info[user_photo] == \"\") { $user_photo = $nophoto_image; }\n\t if($this->user_info[user_photo] == \"\") { $user_photo = $nophoto_image; }\n\t return $user_photo;\n\t \n\t}", "function ProfilePicUrl($user=false){\r\n\r\n$user=$this->GetUserById($user);\r\n\r\nif(!filter_var($user->profile_pic, FILTER_VALIDATE_URL))\r\n{\r\n\treturn $user && !empty($user->profile_pic)?AppURLs::ProfilePictureURL($user->profile_pic):Helpers::get_image(\"nopic.png\");\r\n}\r\nelse\r\n{\r\n\treturn $user && !empty($user->profile_pic)?$user->profile_pic:Helpers::get_image(\"nopic.png\");\r\n}\r\n\r\n\r\n\r\n}", "function getUserPhoto($user)\n {\n $imagePath = 'images/';\n if ($user->pic) {\n return $imagePath.$user->pic;\n } else {\n return $imagePath.'default-user.png';\n }\n }", "public function getPictureUrl()\n {\n $user = $this->getOauthUser();\n return $user['pic_url'];\n }", "public function profilePicture()\n {\n if ($this->picture) {\n return \"/storage/{$this->picture}\";\n }\n\n return 'http://i.pravatar.cc/200';\n }", "public function getProfilePictureURL() {\n //if img src is from google+\n if (substr($this->_imageSrc, 0, 4) == 'http') {\n return $this->_imageSrc;\n }\n //if img is from local folder\n else {\n return \"../static/img/profile/users/\" . $this->_imageSrc;\n }\n }", "function checkMyUserPhoto()\n {\n $imagePath = 'images/';\n if (Auth::user()->pic) {\n return $imagePath.Auth::user()->pic;\n } else {\n return $imagePath.'default-user.png';\n }\n }", "public function getUserPicture()\n {\n $userProfile = $this->getUserProfile();\n if (!empty($userProfile) && array_key_exists('picture', $userProfile)) {\n return $userProfile['picture'];\n }\n return null;\n }", "function myProfilePhotoUrl() {\n\t$url = login( 'photo_url' );\n\tif ( $url ) {\n\t\treturn $url;\n\t} else {\n\t\treturn ANONYMOUS_PROFILE_PHOTO;\n\t}\n}", "public function get_picture() \n\t{\n\t\t// ACTUALIZO EL DATO DE LA INSTANCIA\n\t\t$this->select('foto');\n\t\t// PATH DONDE SE GUARDA LA MINNIATURA\n\t\t$thumb = \"/img/perfil/thumb/{$this->foto}\";\n\t\t// SI EL ARCHIVO NO EXISTE RETORNA LA IMAGEN POR DEFAULT\n\t\treturn file_exists(getcwd() . $thumb) ? URL_ROOT . $thumb : USER_IMG;\n\t}", "public function getProfileImageUrl()\n {\n if ($this->hasProfileImage()){\n return URL::to($this->user_pic);\n }\n return URL::to('/img/profiles/default.png');\n }", "public function get_user_image() {\n\t\tloggedOnly();\n\n\t\t// Pega o usuario logado\n\t\t$user = auth();\n\n\t\t// Busca a imagem\n\t\tif( $user->midia_id ) {\n\t\t\tif( $image = $user->belongsTo( 'midia' ) ) {\n\t\t\t\treturn resolve( $image->path() );\n\t\t\t} return resolve( base_url( 'public/images/empty.jpg' ) );\n\t\t} return resolve( base_url( 'public/images/empty.jpg' ) );\n\t}", "public function getProfilePicture();", "public function getProfileImageURL()\n {\n return 'http://i.imgur.com/dv78K3h.jpg';\n }", "public function getPicture() {\n $path = FILES_LOCATION . DS .'users'. DS . $this->getId() . DS . $this->getId() .'.'. IMAGE_TYPE;\n if(file_exists($path)) {\n $result = $path;\n } else {\n $result = FALSE;\n }\n\n return $result;\n }", "public function profileImage()\n {\n return ($this->image) ? '/storage/' . $this->image : \"/images/profile_pic.png\";\n }", "function getProfilePicture()\r\n\t\t{\r\n\t\t\treturn APP_IMG_URL.$this->profilePictureImg;\r\n\t\t\t\r\n\t\t}", "public function getFbProfilePicUrl() {\n // Determine preferred resolution for the profile picture.\n $resolution = $this->getPreferredResolution();\n\n // Generate FB API query.\n $query = '/me/picture?redirect=false';\n if (is_array($resolution)) {\n $query .= '&width=' . $resolution['width'] . '&height=' . $resolution['height'];\n }\n\n // Call Graph API to request profile picture.\n try {\n $graph_node = $this->facebook->get($query)->getGraphNode();\n\n // We don't download the FB default silhouettes, only real pictures.\n $is_silhouette = (bool) $graph_node->getField('is_silhouette');\n if ($is_silhouette) {\n return FALSE;\n }\n\n // We have a real picture, return URL for it.\n return $graph_node->getField('url');\n }\n catch (FacebookResponseException $ex) {\n $this->loggerFactory\n ->get('social_auth_facebook')\n ->error('Could not load Facebook profile picture URL. FacebookResponseException: @message', array('@message' => json_encode($ex->getMessage())));\n }\n catch (FacebookSDKException $ex) {\n $this->loggerFactory\n ->get('social_auth_facebook')\n ->error('Could not load Facebook profile picture URL. FacebookSDKException: @message', array('@message' => ($ex->getMessage())));\n }\n\n // Something went wrong and the picture could not be loaded.\n return FALSE;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all mc questions
protected function deleteMCQuestions() { $areas = array_keys(adnCatalogNumbering::getMCAreas()); foreach($areas as $area) { $all = adnExaminationQuestion::getAllQuestions(array("catalog_area"=>$area), false, false, null, null, null, null, false); foreach($all as $item) { $quest = new adnMCQuestion($item["id"]); $quest->delete(true); } } }
[ "function clear_questions($exam_id){\n\t$data = array();\n\t$result = mysql_query(\"SELECT * FROM `mock_exam_questions` WHERE `quiz_id` = '$exam_id'\");\n\twhile ($row = mysql_fetch_assoc($result)) {\n\t $data [] = $row;\n\t}\n\tforeach($data as $d){\n\t\tclear_answers($d['question_id']);\n\t}\n\t$id = (int)$exam_id;\n\t// Delete the question to update\n\tmysql_query(\"DELETE FROM `mock_exam_questions` WHERE `quiz_id` = '$id'\");\n}", "public function cleanQuestions(){\n $questions = Question::with('exercise')->get();\n\n foreach($questions as $question){\n if(empty($question['exercise'])){\n $question->delete();\n }\n }\n return redirect()->route('admin.db-clean')->with('success_message', 'Questions table was successfully cleaned!');\n }", "function ipal_clear_question(){\n\tglobal $ipal;\n\tglobal $DB;\n\n\tif($DB->record_exists('ipal_active_questions', array('ipal_id'=>$ipal->id))){\n\t\t$mybool=$DB->delete_records('ipal_active_questions', array('ipal_id'=>$ipal->id));\n\t}\n}", "public function DeleteAllFormQuestions() {\n\t\t\tif ((is_null($this->intId)))\n\t\t\t\tthrow new QUndefinedPrimaryKeyException('Unable to call UnassociateFormQuestion on this unsaved SignupForm.');\n\n\t\t\t// Get the Database Object for this Class\n\t\t\t$objDatabase = SignupForm::GetDatabase();\n\n\t\t\t// Journaling\n\t\t\tif ($objDatabase->JournalingDatabase) {\n\t\t\t\tforeach (FormQuestion::LoadArrayBySignupFormId($this->intId) as $objFormQuestion) {\n\t\t\t\t\t$objFormQuestion->Journal('DELETE');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Perform the SQL Query\n\t\t\t$objDatabase->NonQuery('\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`form_question`\n\t\t\t\tWHERE\n\t\t\t\t\t`signup_form_id` = ' . $objDatabase->SqlVariable($this->intId) . '\n\t\t\t');\n\t\t}", "public function deletequery(){\n\t\t$id = Input::get('queryId');\n\t\t$deleteQuestionwillingtohelp = Questionwillingtohelp::where('question_id', '=',$id)->delete();\n\t\t$deleteGroupQuestion = Groupquestion::where('question_id', '=',$id)->delete();\n\t\t$deleteQuestion = Question::where('id', '=',$id)->delete();\n\t\t$deleteKarmafeed = Karmafeed::where('id_type', '=',$id)->whereIn('message_type',array('KarmaQuery','OfferHelpTo'))->delete(); \n\t\t$deleteMykarma = Mykarma::where('entry_id', '=',$id)->whereIn('users_role',array('PostedQuery','OfferedHelp'))->delete();\n echo \"Question \".$id.\" deleted\";\n\t}", "public function confirmRemoveQuestionsObject()\n\t{\n\t\t$checked_questions = $_POST[\"q_id\"];\n\n\t\t$questions = $this->object->getQuestionTitlesAndIndexes();\n\t\t$deleted = array();\n\t\tforeach((array)$checked_questions as $value)\n\t\t{\n\t\t\t$this->object->removeQuestion($value);\n\t\t\t$deleted[] = $value;\n\t\t}\n\n\t\t$this->object->saveCompleteStatus( $this->testQuestionSetConfigFactory->getQuestionSetConfig() );\n\t\t\n\t\tilUtil::sendSuccess($this->lng->txt(\"tst_questions_removed\"));\n\n\t\tif($_REQUEST['test_express_mode'])\n\t\t{\n\t\t\t$prev = null;\n\t\t\t$return_to = null;\n\t\t\t$deleted_tmp = $deleted;\n\t\t\t$first = array_shift($deleted_tmp);\n\t\t\tforeach((array)$questions as $key => $value)\n\t\t\t{\n\t\t\t\tif(!in_array($key, $deleted))\n\t\t\t\t{\n\t\t\t\t\t$prev = $key;\n\t\t\t\t\tif(!$first)\n\t\t\t\t\t{\n\t\t\t\t\t\t$return_to = $prev;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse continue;\n\t\t\t\t}\n\t\t\t\telse if($key == $first)\n\t\t\t\t{\n\t\t\t\t\tif($prev)\n\t\t\t\t\t{\n\t\t\t\t\t\t$return_to = $prev;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$first = array_shift($deleted_tmp);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(\n\t\t\t\tcount($questions) == count($checked_questions) ||\n\t\t\t\t!$return_to\n\t\t\t)\n\t\t\t{\n\t\t\t\t$this->ctrl->setParameter($this, 'q_id', '');\n\t\t\t\t$this->ctrl->redirect($this, 'showPage');\n\t\t\t}\n\n\t\t\t$this->ctrl->setParameter($this, 'q_id', $return_to);\n\t\t\t$this->ctrl->redirect($this, \"showPage\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->ctrl->setParameter($this, 'q_id', '');\n\t\t\t$this->ctrl->redirect($this, 'questions');\n\t\t}\n\t}", "function questionnaire_cleanup() {\n global $CFG;\n\n /// Find surveys that don't have questionnaires associated with them.\n $sql = 'SELECT qs.* FROM '.$CFG->prefix.'questionnaire_survey qs '.\n 'LEFT JOIN '.$CFG->prefix.'questionnaire q ON q.sid = qs.id '.\n 'WHERE q.sid IS NULL';\n\n if ($surveys = get_records_sql($sql)) {\n foreach ($surveys as $survey) {\n questionnaire_delete_survey($survey->id, 0);\n }\n }\n /// Find deleted questions and remove them from database (with their associated choices, etc. // TODO\n return true;\n}", "function questionnaire_cleanup() {\n global $DB;\n\n /// Find surveys that don't have questionnaires associated with them.\n $sql = 'SELECT qs.* FROM {questionnaire_survey} qs '.\n 'LEFT JOIN {questionnaire} q ON q.sid = qs.id '.\n 'WHERE q.sid IS NULL';\n\n if ($surveys = $DB->get_records_sql($sql)) {\n foreach ($surveys as $survey) {\n questionnaire_delete_survey($survey->id, 0);\n }\n }\n /// Find deleted questions and remove them from database (with their associated choices, etc. // TODO\n return true;\n}", "function deleteAnswer(){\r\n\t\tforeach ($_POST[\"answer\"] as $answerId){\r\n\t\t\t$query = \"DELETE FROM {$this->main->databaseTablePrefix}poll_answers WHERE poll_answers_id ={$answerId}\";\r\n\t\r\n\t\t\t$recordSet = $this->main->databaseConnection->Execute($query);\r\n\t\t\t\t\t\t\r\n\t\t\t//Check for error, if an error occured then report that error\r\n\t\t\tif (!$recordSet) {\r\n\t\t\t\ttrigger_error(\"Unable to delete answer '{$answerId}'\\nreason is : \".$this->main->databaseConnection->ErrorMsg());\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function confirmRemoveQuestionsObject()\n\t{\n\t\t$checked_questions = array();\n\t\t$checked_questionblocks = array();\n\t\t$checked_headings = array();\n\t\tforeach ($_POST as $key => $value) \n\t\t{\n\t\t\tif (preg_match(\"/id_(\\d+)/\", $key, $matches)) \n\t\t\t{\n\t\t\t\tarray_push($checked_questions, $matches[1]);\n\t\t\t}\n\t\t\tif (preg_match(\"/id_qb_(\\d+)/\", $key, $matches)) \n\t\t\t{\n\t\t\t\tarray_push($checked_questionblocks, $matches[1]);\n\t\t\t}\n\t\t\tif (preg_match(\"/id_tb_(\\d+)/\", $key, $matches))\n\t\t\t{\n\t\t\t\tarray_push($checked_headings, $matches[1]);\n\t\t\t}\n\t\t}\n\n\t\tif(sizeof($checked_questions) || sizeof($checked_questionblocks))\n\t\t{\n\t\t\t$this->object->removeQuestions($checked_questions, $checked_questionblocks);\n\t\t}\n\t\tif($checked_headings)\n\t\t{\n\t\t\tforeach($checked_headings as $q_id)\n\t\t\t{\n\t\t\t\t$this->object->saveHeading(\"\", $q_id);\n\t\t\t}\n\t\t}\n\t\t$this->object->saveCompletionStatus();\n\t\tilUtil::sendSuccess($this->lng->txt(\"questions_removed\"), true);\n\t\t$this->ctrl->redirect($this, \"questions\");\n\t}", "public function resetQuestions(): void\n {\n\n $questions = Question::where('user_answer','!=',null)->get();\n\n foreach($questions as $question){\n $question->update(['user_answer'=>null]);\n\n }\n\n $this->info(\"Question has been reset successfully!\");\n\n $this->mainMenu();\n }", "function check_deleting_questions() {\n global $DB;\n\n if ( ! empty( $this->questions )) {\n foreach ( $this->questions as $question ) {\n // get \"names\" of form data that matches the question\n $qid = $question->id;\n $title = \"title_\".$qid;\n $min = \"min_\".$qid;\n $max = \"max_\".$qid;\n $body = \"body_\".$qid;\n $delete = \"delete_\".$qid;\n\n // is the current question being deleted?\n if ( isset( $this->form_data->$delete ) ) {\n\n if ( ! $DB->delete_records(\"bimtwo_questions\", \n array(\"id\"=>$qid ))) {\n // print_string( \"error_delete\", \"bimtwo\", $title );\n } else {\n $this->deleted_questions[$qid] = $question;\n }\n }\n }\n }\n }", "function removeQuestionsObject()\n\t{\n\t\t$items = $this->gatherSelectedTableItems(true, true, true, true);\n\t\tif (count($items[\"blocks\"]) + count($items[\"questions\"]) + count($items[\"headings\"]) > 0)\n\t\t{\n\t\t\tilUtil::sendQuestion($this->lng->txt(\"remove_questions\"));\n\t\t\t$this->removeQuestionsForm($items[\"blocks\"], $items[\"questions\"], $items[\"headings\"]);\n\t\t\treturn;\n\t\t} \n\t\telse \n\t\t{\n\t\t\tilUtil::sendInfo($this->lng->txt(\"no_question_selected_for_removal\"), true);\n\t\t\t$this->ctrl->redirect($this, \"questions\");\n\t\t}\n\t}", "static function deleteAll() {\n $GLOBALS['DB']->exec(\"DELETE FROM courses;\");\n }", "static function deleteAll()\n {\n $GLOBALS['DB']->exec(\"DELETE FROM courses;\");\n }", "public function deleteGroupQuestionsConnectionWithAnswer(){\n //Yii::app()->db->createCommand('DELETE FROM `tbl_link_group_questions_answers` WHERE `group_questions_id`=:group')->bindParam(\":group\",$this->id)->execute();\n Yii::app()->db->createCommand()->delete('tbl_link_group_questions_answers', 'group_questions_id=:id', array(':id'=>$this->id));\n }", "public function test_delete_topic_with_questions()\n {\n $topic_id = self::_dummy_topic_create();\n $this->resetInstance();\n $this->CI->load->model(['topic_model', 'question_model']);\n\n $this->CI->question_model->insert([\n 'FK_Topic' => $topic_id,\n 'FK_Question_Type' => 1,\n 'Question' => 'dummy_question'\n ]);\n\n $this->_db_errors_save();\n\n $topic = $this->CI->topic_model->get($topic_id);\n $this->assertNotNull($topic);\n\n $this->request('GET', \"topic/delete_topic/{$topic_id}\");\n\n $topic = $this->CI->topic_model->get($topic_id);\n $this->assertNotNull($topic);\n\n $this->assertFalse(\n $this->_db_errors_diff(),\n 'One or more error occured in an SQL statement'\n );\n\n // Clean up question\n $questions = $this->CI->question_model->get_many_by(['Question' => 'dummy_question']);\n foreach($questions as $question) {\n $this->CI->question_model->delete($question->ID, TRUE);\n }\n }", "protected function deleteTestMails(): void {\n\t\t$query = $this->dbConnection->getQueryBuilder();\n\t\t$query->delete('activity_mq')\n\t\t\t->where($query->expr()->eq('amq_appid', $query->createNamedParameter('test')));\n\t\t$query->executeStatement();\n\t}", "public function actionDeleteExamItems()\n {\n \t$criteria = new CDbCriteria();\n \t$criteria->compare('status', QuizExam::STATUS_COMPLETED);\n \t$quizExams = QuizExam::model()->findAll($criteria);\n \tif(count($quizExams)>0){\n \t\tforeach($quizExams as $exam){\n \t\t\t$examItems = $exam->getAssignedQuizItems();\n \t\t\tif(count($examItems)>0){\n \t\t\t\tforeach($examItems as $item){\n \t\t\t\t\t$item->deleteAllConnectedQuiz();//Delete all connected of item\n \t\t\t\t\techo \"Xoa cau hoi \".$item->id.\" trong de thi $exam->id \\n\";\n \t\t\t$item->delete();//Delete this session \t\t\t\n \t\t\t\t}\n \t\t\t}\n \t\t\t$exam->deleteAllConnectedQuiz();//Delete all connected of exam\n \t\t\techo \"Xoa thanh cong de thi ma so \".$exam->id.\"\\n\";\n \t$exam->delete();//Delete this exam\n \t\t}\n \t}\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine a files' type based on its extension.
function getFileType($filename) { global $fileTypes; static $extensions = null; if ($extensions == null) { $extensions = array(); foreach ($fileTypes as $keyType => $value) { foreach ($value as $ext) $extensions[$ext] = $keyType; } } $pi = pathinfo($filename); // directories cause warnings, prevent it if (!array_key_exists('extension', $pi)) return "unknown"; $extension = $pi['extension']; $type = @$extensions[strtolower($extension)]; if ($type == "") { return "unknown"; } else { return $type; } }
[ "public function getExtensionType()\n {\n $extension = pathinfo($this->original_filename, PATHINFO_EXTENSION);\n $extensionType = 'file';\n switch ($extension) {\n case 'xls':\n case 'xlsx':\n $extensionType = 'file-excel';\n break;\n\n case 'doc':\n case 'docx':\n case 'odt':\n $extensionType = 'file-word';\n break;\n\n case 'jpg':\n case 'jpeg':\n case 'png':\n case 'bmp':\n case 'gif':\n $extensionType = 'file-image';\n break;\n\n case 'pdf':\n $extensionType = 'file-pdf';\n break;\n\n case 'mp4':\n case 'avi':\n case 'ogg':\n case 'webm':\n case 'flv':\n case 'wmb':\n case 'wmv':\n $extensionType = 'file-video';\n break;\n\n case 'mp3':\n case 'wav':\n $extensionType = 'file-audio';\n break;\n\n }\n\n return $extensionType;\n }", "public static function getFileTypeBasedOnExtension($filename)\n {\n $fileInfo = explode('.', $filename);\n $fileExtension = strtolower(array_pop($fileInfo));\n $type = 'file';\n switch ($fileExtension) {\n case 'jpg':\n case 'png':\n case 'gif':\n case 'jpeg':\n case 'svg':\n case 'svgx':\n $type = 'image';\n break;\n case 'mp4':\n case 'webm':\n $type = 'video';\n break;\n case 'wav':\n case 'mp3':\n $type = 'audio';\n break;\n case 'pdf':\n $type = 'pdf';\n break;\n default:\n break;\n }\n return $type;\n }", "public function getFileType()\n {\n if (!$this->mime || $this->mime === 'directory' || $this->mime === 'dir') {\n return 'dir';\n }\n\n foreach ($this->mimes as $mime => $mime_values) {\n $key = collect($mime_values)->search(function ($mime_value) {\n return preg_match($mime_value, $this->mime);\n });\n\n if ($key !== false) {\n return $mime;\n }\n }\n\n return 'file';\n }", "static public function getTypeFile($extension): string {\n\t\tif (!empty(config(\"filemanager.extensions.$extension\"))) {\n\t\t\treturn config(\"filemanager.extensions.$extension\");\n\t\t} else {\n\t\t\treturn config('filemanager.extensions.*', \"file\");\n\t\t}\n\t}", "public function getMimeTypeByExtension() {\n if ($this->getIsFile()) {\n $this->addLog('Trying to get MIME type for \"' . $this->_realpath . '\" from extension \"' . $this->_extension . '\"', 'trace');\n static $exts;\n\n if ($exts===null) {\n $exts = require($this->getPathOfAlias('system.utils.mimeTypes') . '.php');\n }\n\n $ext = strtolower($this->_extension);\n if (!empty($ext) && isset($exts[$ext])) {\n return $exts[$ext];\n }\n return False;\n } else {\n $this->addLog('getMimeTypeByExtension() is available only for files', 'warning');\n return False;\n }\n }", "function system_extension_mime_type($file)\n{\n #\n # $file - the filename to examine\n static $types;\n if (!isset($types))\n $types = system_extension_mime_types();\n $ext = pathinfo($file, PATHINFO_EXTENSION);\n if (!$ext)\n $ext = $file;\n $ext = strtolower($ext);\n return isset($types[$ext]) ? $types[$ext] : null;\n}", "function get_type($ext)\r\n {\r\n $ext = strtolower($ext);\r\n // get position of last dot\r\n $dot_pos = strrpos($ext, '.');\r\n if ($dot_pos !== false) $ext = substr($ext, $dot_pos+1);\r\n if (($ext != '') && isset($this->mime_types[$ext])) return $this->mime_types[$ext];\r\n return false;\r\n }", "function filetype ($filename) {}", "function _getFileType( $filename )\n\t{\n\t\t//\tno filetype given, extract from filename\n\t\treturn\tsubstr( strrchr( $filename, '.' ), 1 );\n\t}", "function getFileType($file_name)\n{\n $file = explode('/', $file_name->getMimeType());\n $fileType = isset($file[0]) ? $file[0] : '';\n if ($fileType == \"application\") {\n $fileType = \"file\";\n }\n return $fileType;\n}", "function getExtType($ext = \"\"){\n\t\tif($ext == \"\")\n\t\t\t$ext = $this->getExt();\n\n\t\treturn fileutil::getExtType($ext);\n\t}", "function system_extension_mime_type($file) {\n #\n # $file - the filename to examine\n static $types;\n if(!isset($types))\n $types = $this->system_extension_mime_types();\n $ext = pathinfo($file, PATHINFO_EXTENSION);\n if(!$ext)\n $ext = $file;\n $ext = strtolower($ext);\n return isset($types[$ext]) ? $types[$ext] : null;\n }", "function get_imagetype_from_filename($filename)\n{\n\t$ext = get_fileext_from_path($filename);\n\t$imagetypes = get_imagetype_translation_array();\n\tif(array_key_exists($ext,$imagetypes)) {\n\t\treturn $imagetypes[$ext];\n\t} else {\n\t\treturn $imagetypes['unsupported'];\n\t}\n}", "function get_mime_type ($filename) {\n $path = pathinfo($filename);\n\n switch ($path['extension']) {\n case 'css':\n return 'text/css';\n case 'js':\n return 'text/javascript';\n default:\n return 'text/plain';\n }\n}", "function mimetype_from_filename(string $filename)\n{\n return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION));\n}", "public function getFileExtension(): string\n {\n return match ($this->getMimetype($this->upload['tmp_name'])) {\n MimeHelper::TYPE_JPG => 'jpg',\n MimeHelper::TYPE_JPEG => 'jpeg',\n MimeHelper::TYPE_GIF => 'gif',\n MimeHelper::TYPE_PNG => 'png',\n MimeHelper::TYPE_FIF => 'fif',\n MimeHelper::TYPE_IEF => 'ief',\n MimeHelper::TYPE_TIFF => 'tiff',\n MimeHelper::TYPE_VASA => 'vasa',\n MimeHelper::TYPE_X_ICON => 'ico',\n MimeHelper::TYPE_PDF => 'pdf',\n default => 'file',\n };\n }", "function filetype_to_ext($filetype) {\n\tswitch ($filetype) {\n\t\tcase \"PNG\":\n\t\t\treturn \"png\";\n\t\tcase \"TGA\":\n\t\t\treturn \"tga\";\n\t\tcase \"JPEG\":\n\t\t\treturn \"jpg\";\n\t\tcase \"EXR\":\n\t\t\treturn \"exr\";\n\t\tcase \"MULTILAYER\":\n\t\t\treturn \"exr\";\n\t}\n\t\n}", "public function initFileType($file) {\n\t\t$bad_extensions = array('gov', 'com', 'edu', 'info', 'org');\n\t\t$file_info = pathinfo($file, PATHINFO_EXTENSION);\n\t\t\n\t\tif($file_info && !in_array($file_info, $bad_extensions) && strlen($file_info) > 2) {\n\t\t\t$file_type = 1;\n\t\t} else {\n\t\t\t$file_type = '.pdf';\n\t\t}\n\t\t\n\t\treturn $file_type;\n\t}", "public function getFileExtension();" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[listAjax List Shop Type]
public function listAjax(Request $request) { $records = array(); //processing custom actions if ($request->customActionType == 'groupAction') { $action = $request->customActionName; $idArray = $request->id; if($action == 'delete') { } if($action == 'status') { foreach ($idArray as $_idArray) { ShopType::updateShopTypeStatus($_idArray); } $records["customMessage"] = trans('adminmsg.SHOP_TYPE_STATUS_UPDATED_SUCCESS'); } } $columns = array( 0 => 'shop_type_name', 1 => 'shop_type_detail', 2 => 'shop_type_icon', 3 => 'status' ); $order = $request->order; $search = $request->search; $records["data"] = array(); //getting records from the shop_type table $iTotalRecords = ShopType::getShopTypeCount(); $iTotalFiltered = $iTotalRecords; $iDisplayLength = intval($request->length) <= 0 ? $iTotalRecords : intval($request->length); $iDisplayStart = intval($request->start); $sEcho = intval($request->draw); $records["data"] = ShopType::where('status', '<>', Config::get('constant.DELETED_FLAG')); if (!empty($search['value'])) { $val = $search['value']; $records["data"]->where(function($query) use ($val) { $query->SearchShopTypeName($val) ->SearchShopTypeDetail($val) ->scopeSearchShopTypeStatus($val); }); // No of record after filtering $iTotalFiltered = $records["data"]->where(function($query) use ($val) { $query->SearchShopTypeName($val) ->SearchShopTypeDetail($val) ->scopeSearchShopTypeStatus($val); })->count(); } //order by foreach ($order as $o) { $records["data"] = $records["data"]->orderBy($columns[$o['column']], $o['dir']); } //limit $records["data"] = $records["data"]->take($iDisplayLength)->offset($iDisplayStart)->get(); if(!empty($records["data"])) { foreach ($records["data"] as $key => $_records) { $edit = route('shop-type.edit', $_records->id); if ($_records->status == "active") { $records["data"][$key]->status = '<a href="javascript:;" title="Make Inactive" class="btn-status-shop-type" data-id="' . $_records->id . '"> ' . $_records->status . '</a>'; } else { $records["data"][$key]->status = '<a href="javascript:;" title="Make Active" class="btn-status-shop-type" data-id="' . $_records->id . '"> ' . $_records->status . '</a>'; } $records["data"][$key]['shop_type_icon'] = ($_records->shop_type_icon != '' && File::exists(public_path($this->shopTypeThumbImageUploadPath . $_records->shop_type_icon)) ? '<img src="'.url($this->shopTypeThumbImageUploadPath.$_records->shop_type_icon).'" alt="{{$_records->shop_type_icon}}" height="50" width="50">' : '<img src="'.asset('/images/default.png').'" alt="Default Image" height="50" width="50">'); $records["data"][$key]['action'] = "&emsp;<a href='{$edit}' title='Edit Shop Type' ><span class='glyphicon glyphicon-edit'></span></a> &emsp;<a href='javascript:;' data-id='". $_records->id ."' class='btn-delete-shop-type' title='Delete Shop Type' ><span class='glyphicon glyphicon-trash'></span></a>"; } } $records["draw"] = $sEcho; $records["recordsTotal"] = $iTotalRecords; $records["recordsFiltered"] = $iTotalFiltered; return Response::json($records); }
[ "public function trainingTypeList()\n {\n //$search = null;\n \n // get available records\n $data['training_type_list'] = $this->mdl->getTrainingTypeList();\n \n $this->renderAjax($data);\n }", "public function listeTypeWebservice__()\n {\n $this->views->getTemplate(\"administration/listeTypeWebService\");\n }", "function getType() {\n\t\treturn \"List\";\n\t}", "function shippingtype(){\n ##check admin session live or not\n $this->session_check_admin();\n\n if(isset($_SERVER['QUERY_STRING']))\n {\n $this->Session->delete(\"newsortingby\");\n $strloc=strpos($_SERVER['QUERY_STRING'],'=');\n $strdata=substr($_SERVER['QUERY_STRING'],$strloc+1); \n $this->Session->write(\"newsortingby\",$strdata); \n\n }\n\n ##import contact type model for processing\n App::import(\"Model\", \"ShippingType\");\n $this->ShippingType = & new ShippingType(); \n ##fetch data from contact type table for listing\n $field='';\n $condition = \"delete_status = '0'\";\n if(isset($this->data['Admins']['searchkey']) && $this->data['Admins']['searchkey']){\n $searchkeyword = $this->data['Admins']['searchkey'];\n $condition .= \" and (shipping_type_name LIKE '%\".$searchkeyword.\"%' )\";\n }\n $this->Pagination->sortByClass = 'ShippingType'; ##initaite pagination \n\n $this->Pagination->total= count($this->ShippingType->find('all',array(\"conditions\"=>$condition)));\n\n list($order,$limit,$page) = $this->Pagination->init($condition,$field);\n\n $shippingtypedata = $this->ShippingType->find('all',array(\"conditions\"=>$condition, 'order' =>$order, 'limit' => $limit, 'page' => $page));\n ##set project type data in variable\n\n $this->set(\"shippingtypedata\",$shippingtypedata);\n\n }", "function vegies_type_list(){\n\t\t\n\t\t$rs= $this->Veg_Model->gettypes();\n\t\t//print_r($rs);\n\t\t$data['inner_view']='type_list';\n\t\t$data['result']=$rs;\n\t\t$this->load->view('includes/main_layout',$data);\n\t}", "function saveo_woocommerce_list_post_types($list=array()) {\n\t\t$list['product'] = esc_html__('Products', 'saveo');\n\t\treturn $list;\n\t}", "function _wpsc_fetch_ajax_reponse_for_products_callback()\r\n{\r\n $wp_list_table = new Products_List();\r\n $wp_list_table->ajax_response();\r\n}", "public function nasTypes(){\n //public function nas_types(){\n $items = [];\n $ct = Configure::read('nas_types');\n foreach($ct as $i){\n if($i['active']){\n array_push($items, $i);\n }\n }\n\n $this->set(array(\n 'items' => $items,\n 'success' => true,\n '_serialize' => array('items','success')\n ));\n }", "public function showTypes() {\n if ($results = $this->model->getAllWear())\n {\n $this->page->registerEarlyLoadJS('wearlist.js');\n $this->page->wear_types = $results;\n }\n else\n {\n $this->page->setTemplate('noResults');\n }\n }", "public function shipto_ajax_list()\n {\n $AllPostData = $this->input->post();\n $list = $this->customer_model->get_shipto_datatables();\n $data = array();\n $output = array(\n \"meta\" => array('page' => $AllPostData['datatable']['pagination']['page'], 'pages' => $AllPostData['datatable']['pagination']['pages'], 'perpage' => $AllPostData['datatable']['pagination']['perpage'], 'total' => $this->customer_model->shipto_count_filtered(), 'sort' => 'asc', 'field' => 'company_id'),\n \"data\" => $list,\n );\n //output to json format\n echo json_encode($output);\n }", "function productoption()\n\t{\n\t\t$res = $this->product_model->productOptionList();\n\t\techo \"<pre />\";\n\t\tprint_r($res);\n\t\texit;\n\t\t\n\t\t//check if product type list is pulled. if not, list is set to empty array\n\t\t// $productTypeList = ( $res->rc == 0 ) ? $res->data->producttypelist : array();\n\t\t\n\t\t// $data['mainContent'] = 'producttype_list_view.tpl';\n\t\t\n\t\t// $data['data'] = array(\n\t\t\t// 'baseUrl'\t\t\t=> base_url(),\n\t\t\t// 'title'\t\t\t\t=> 'Product Type',\n\t\t\t// 'msgClass'\t\t\t=> $this->msgClass,\n\t\t\t// 'msgInfo'\t\t\t=> $this->msgInfo,\n\t\t\t// 'productTypeList'\t=> $productTypeList\n\t\t// );\n\t\t\n\t\t// $this->load->view($this->globalTpl, $data);\t\n\t}", "function getProductTypes(){\n }", "public function shoppinglistAction(){\n $shoppingList = $this->getEntityManager()->getRepository('Warehouse\\Entity\\ShoppingList')->findAllOrderBySectionDescription();\n\n $resultArray = array();\n\n for ($i=0;$i<count($shoppingList);$i++){\n $tempArray = [\n \"section\" => $shoppingList[$i]->getSection()->getDescription(),\n \"description\" => $shoppingList[$i]->getDescription(),\n \"supplier\" => $shoppingList[$i]->getSupplier()->getDescription(),\n \"priority\" => $shoppingList[$i]->getPriority(),\n \"quantity\" => $shoppingList[$i]->getQuantity(),\n \"unit\" => $shoppingList[$i]->getMeasureUnit()->getDescription(),\n \"barcodeid\" => $shoppingList[$i]->getStock()->getDescription(),\n \"area\" => $shoppingList[$i]->getArea()->getDescription(),\n ];\n array_push($resultArray, $tempArray);\n }\n\n return new JsonModel($resultArray);\n }", "public function nas_types(){\n $items = array();\n $ct = Configure::read('nas_types');\n foreach($ct as $i){\n if($i['active']){\n array_push($items, $i);\n }\n }\n\n $this->set(array(\n 'items' => $items,\n 'success' => true,\n '_serialize' => array('items','success')\n ));\n }", "function shippingtypedropdown()\r\r\r\r\t{\r\r\r\r App::import(\"Model\", \"ShippingType\");\r\r\r\r $this->ShippingType = &new ShippingType();\r\r\r\r \r\r\r\r \t $shippingdata = $this->ShippingType->find(\"all\", array('conditions' => \"ShippingType.active_status='1' AND ShippingType.delete_status='0'\",'order'=>'ShippingType.created ASC'),array('fields'=>array(\"DISTINCT ShippingType.shipping_type_name\",\"ShippingType.id\"))); \r\r\r\r $shippingdropdown = Set::combine($shippingdata, '{n}.ShippingType.id', '{n}.ShippingType.shipping_type_name');\r\r\r\r asort($shippingdropdown);\r\r\r\r\t $this->set(\"shippingdropdown\", $shippingdropdown);\r\r\r\r\t \r\r\r\r }", "function happyrider_woocommerce_list_post_types($list) {\n\t\t$list['product'] = __('Products', 'happyrider');\n\t\treturn $list;\n\t}", "function type() {\n $build = [\n '#type' => 'custom_list',\n '#title' => $this->t('List Title by #type'),\n '#list_items' => $this->listItemsExample(),\n ];\n\n return $build;\n }", "function listeo_core_get_listing_types(){\n\t $options = array(\n \t'apartments' => __( 'Apartments', 'listeo_core' ),\n\t\t\t'houses' \t => __( 'Houses', 'listeo_core' ),\n\t\t\t'commercial' => __( 'Commercial', 'listeo_core' ),\n\t\t\t'garages' \t => __( 'Garages', 'listeo_core' ),\n\t\t\t'lots' \t\t => __( 'Lots', 'listeo_core' ),\n );\n\treturn apply_filters('listeo_core_get_listing_types',$options);\n}", "public function getAvailableListingTypes() {\r\n $select = $this->select()->where('`show` = ?', 1)->order('order ASC');\r\n return $this->fetchAll($select); \r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test Filter with Multiple
public function testFilterWithMultiple(): void { $this->assertSame(68, $this->filter->filter('LXVIII')); $this->assertSame(1537, $this->filter->filter('MDXXXVII')); }
[ "function testMultipleFilters() {\n\t\t$this->setUrl('/search/advanced?r=org&q[gen_name][op]=CONTAINS&q[gen_name][value]=crm&q[gen_created][op]=AFTER&q[gen_created][value]=1%2F2%2F2011');\n\t\t$this->app->go();\n\t\t$this->assertFalse(Flash::Instance()->hasErrors());\n\t\t$this->assertPattern('/id=\"qb_gen_created\"/', $this->view->output);\n\t\t$this->assertPattern('/<th>Creation Time<\\/th>/', $this->view->output);\n\t\t$collection = $this->view->get('collection');\n\t\t$names = $collection->pluck('name');\n\t\t$this->assertEqual($names, array('Zanzibar CRM'));\n\t}", "public function testMultipleFilter()\n {\n $list = new ArrayList(\n [\n ['Name' => 'Steve', 'ID' => 1],\n (object) ['Name' => 'Steve', 'ID' => 2],\n ['Name' => 'John', 'ID' => 2]\n ]\n );\n $list = $list->filter(['Name'=>'Steve', 'ID'=>2]);\n $this->assertEquals(\n [(object)['Name'=>'Steve', 'ID'=>2]],\n $list->toArray(),\n 'List should only contain object Steve'\n );\n }", "public function testFilterWithMultipleTokensResult()\n {\n $this->assertSame('III', $this->filter->filter(3));\n $this->assertSame('DLV', $this->filter->filter(555));\n }", "public function testFilterDataProvider()\n {\n return [\n [\n 'red',\n 'ReD',\n true\n ],\n [\n 'red',\n 'rEd',\n false\n ],\n [\n 'r3d',\n 'r3D',\n false\n ],\n [\n 'r3d',\n 'R3d',\n true\n ]\n ];\n }", "public function testFilterFollowManyParams()\n {\n // test exit\n $response = $this->get('/api/books?category=1&language=Vietnamese&number_of_page=10000,30000')\n ->assertJsonStructure($this->jsonStructureListBooksExists());\n // test not exit\n $response = $this->get('/api/books?category=2&language=abc&number_of_page=30000,40000')\n ->assertJsonStructure($this->jsonStructureListBooksNotExists());\n }", "public function testGetFilterToAll()\n {\n\n $filter = array('filter' => 'to all', 'ignore' => 1);\n\n $result = $this->_userManager->getFilter($filter);\n\n //$this->assertType('array', $result);\n $this->assertInternalType('array', $result);\n\n //$this->markTestIncomplete('todo try to find dependency');\n// $this->assertEquals(4, sizeof($result));\n }", "public function testMultiWhere()\n {\n $this->todo('stub');\n }", "public function testListFilters()\n\t{\n\t\t$bloomd = new Client();\n\n\t\t$filter = $bloomd->listFilters(self::$filter);\n\n\t\t// Verify all fields contained in first filter\n\t\t$fields = array(\"name\", \"probability\", \"size\", \"capacity\", \"items\");\n\t\tforeach ($fields as $f)\n\t\t{\n\t\t\t$this->assertArrayHasKey($f, $filter[0]);\n\t\t}\n\t}", "public function testFiltersComplex()\n {\n $db = \\db::getSingleton();\n $filters = [\n 'field1' => 'value1',\n 'fx' => null,\n 'f1' => [1, 2, 3]\n ];\n \n // the test\n list($sql, $aParams) = $db->filters($filters);\n \n // asserts\n $this->assertEquals(\" 1=1 AND field1 = $1 AND fx IS NULL AND f1 IN ($2,$3,$4) \", $sql);\n $this->assertCount(4, $aParams);\n $this->assertEquals('value1', $aParams[0]);\n $this->assertEquals(1, $aParams[1]);\n $this->assertEquals(2, $aParams[2]);\n $this->assertEquals(3, $aParams[3]);\n }", "public function testGetFilters()\n {\n $validFilters = array('phone', 'price', 'boolean', 'md5', 'timeAgo');\n\n $filters = self::$class->getFilters();\n\n foreach ($filters as $filter)\n {\n $this->assertContains($filter->getName(), $validFilters);\n $this->assertInstanceOf('Twig_SimpleFilter', $filter);\n }\n }", "public function shouldFilter($data);", "public function applyFilter();", "public function testFilters() {\n\n\t\t$validator = new Validator;\n\n\t\t$validator->add_filter('field1', 'trim');\n\t\t$validator->add_filter('field2', 'strrev');\n\t\t$validator->add_filter('field2', 'strtoupper');\n\n\t\t$result = $validator->is_valid(array(\n\t\t\t'field1' => ' hello world ',\n\t\t\t'field2' => 'abcd',\n\t\t));\n\n\t\t$this->assertTrue($result);\n\n\t\t$expected = array(\n\t\t\t'field1' => 'hello world',\n\t\t\t'field2' => 'DCBA',\n\t\t);\n\n\t\t$this->assertEquals($expected, $validator->get_data());\n\t\t$this->assertCount(0, $validator->get_errors());\n\n\t}", "public function testGetFilterToAllDisabled()\n {\n $filter = array('filter' => 'to all disabled', 'ignore' => 1);\n\n $result = $this->_userManager->getFilter($filter);\n\n //$this->assertType('array', $result);\n $this->assertInternalType('array', $result);\n\n //$this->markTestIncomplete('todo try to find dependency');\n// $this->assertEquals(1, sizeof($result));\n }", "public function testFilters() {\n // Test the title filter page, which filters for title contains 'Comida'.\n // Should show just the Spanish translation, once.\n $this->assertPageCounts('test-title-filter', ['es' => 1, 'fr' => 0, 'en' => 0], 'Comida title filter');\n\n // Test the body filter page, which filters for body contains 'Comida'.\n // Should show just the Spanish translation, once.\n $this->assertPageCounts('test-body-filter', ['es' => 1, 'fr' => 0, 'en' => 0], 'Comida body filter');\n\n // Test the title Paris filter page, which filters for title contains\n // 'Paris'. Should show each translation once.\n $this->assertPageCounts('test-title-paris', ['es' => 1, 'fr' => 1, 'en' => 1], 'Paris title filter');\n\n // Test the body Paris filter page, which filters for body contains\n // 'Paris'. Should show each translation once.\n $this->assertPageCounts('test-body-paris', ['es' => 1, 'fr' => 1, 'en' => 1], 'Paris body filter');\n }", "function hasFilter();", "public function testArrayFilterWithMultipleValues() {\n $original = ['foo', 0, '', 'bar', FALSE, 'baz', [], 'zip'];\n $expected = ['foo', 'bar', 'baz', 'zip'];\n $this->assertArrayEquals($expected, $this->plugin->tamper($original));\n }", "public function dataForFilterTest(): array\n {\n return [\n 'filter will succeed if all filters match' => [\n 'match' => true,\n 'expected' => true,\n ],\n 'filter will fail if not all filters match' => [\n 'match' => false,\n 'expected' => false,\n ],\n ];\n }", "public function testGetApiFilterCustom()\n {\n $test = $this->setUpClass();\n\n // maximum pagination amount\n $this->assertEquals(['exposed', 'exposed_json'], $test->getApiFilter());\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retourne l'ID de cette instance d'Utilisateur.
public function getIdUtilisateur() { return $this->idUtilisateur; }
[ "public function getIdUtilisateur()\n {\n return $this->id_utilisateur;\n }", "public function getUtilisateur_id()\n {\n return $this->utilisateur_id;\n }", "public function getIdUtilisateur()\n {\n return $this->Id_utilisateur;\n }", "public function getId_utilisateur()\n {\n return $this->id_utilisateur;\n }", "public function get_user_id()\r\n {\r\n \t$consulta=$this->db->query(\"SELECT id FROM usuarios WHERE nombre = '{$this->nombre}';\");\r\n \twhile($filas=$consulta->fetch_assoc()){$this->id=$filas;}\r\n \treturn $this->id;\r\n }", "public function getId_utilisateur()\n {\n return $this->id_utilisateur;\n }", "public function getId(){\n return $this->id_utilisateur;\n }", "public function getID () {\n\t\treturn $this->usu_id;\n\t}", "public function getID()\n {\n return $this->idUsuario;\n }", "public function getUserID() {\n if (!$this->isLoggedin()) {\n return -1;\n }\n return $this->user->getId();\n }", "public function getIduser()\n {\n return $this->iduser;\n }", "public function getId_user()\n {\n return $this->id_user;\n }", "public function get_user_id();", "function getIdUsuario () { \n \treturn $this -> usrId; \n }", "public function getid(){\r\n\t\tif($this::isLoggedIn()){\r\n\t\t\t$id2=$this->id;\r\n\t\t\treturn $id2;}\r\n\t\telse {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\t\t//throw new Exception('Nessun utente loggato!');}\r\n\t}", "public function get_id_user()\n\t{\n\t\treturn $this->id_user;\n\t}", "function getId_usuario()\n {\n if (!isset($this->iid_usuario) && !$this->bLoaded) {\n $this->DBCarregar();\n }\n return $this->iid_usuario;\n }", "public function getUserID () {\n\t\treturn $this->ra_usu_id;\n\t}", "public function Usuario_GetID(){\n if(!isset($this->logado_usuario) || !is_numeric($this->logado_usuario->id) || $this->logado===false){\n return 0;\n }\n $id = (int) $this->logado_usuario->id;\n return $id;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to invoke the invocation Will use reflection to validate and invoke the callable Will validate method signature with params If params is passed, it will be used, else will attempt to use from getParameters()
public function __invoke(...$params) { $reflection = $this->getReflection(); $params = $params ?: $this->getParameters(); $this->verify($reflection, $params); return call_user_func_array($this->callable, $params); }
[ "abstract public function invoke($method,$params);", "function execute($callableOrMethodArr, array $invocationArgs = array(), $makeAccessible = FALSE);", "public function call($callable, array $parameters = []);", "public function invokeMethod(&$obj, string $method, array $params = []);", "public function invoke()\n {\n $method = new ReflectionMethod(\n $this->instance,\n $this->method\n );\n $argumentResolver = new ArgumentsResolver(\n $this->container,\n $method->getParameters(),\n $this->arguments\n );\n return $method->invokeArgs(\n $this->instance,\n $argumentResolver->getArguments()\n );\n }", "function invoke_method() {\n\t\t$this->debug('entering invoke_method');\n\t\t// does method exist?\n\t\tif(!function_exists($this->methodname)){\n\t\t\t// \"method not found\" fault here\n\t\t\t$this->debug(\"method '$this->methodname' not found!\");\n\t\t\t$this->result = 'fault: method not found';\n\t\t\t$this->fault('Server',\"method '$this->methodname' not defined in service\");\n\t\t\treturn;\n\t\t}\n\t\tif($this->wsdl){\n\t\t\tif(!$this->opData = $this->wsdl->getOperationData($this->methodname)){\n\t\t\t//if(\n\t\t \t$this->fault('Server',\"Operation '$this->methodname' is not defined in the WSDL for this service\");\n\t\t\t\treturn;\n\t\t }\n\t\t $this->debug('opData is ' . $this->varDump($this->opData));\n\t\t}\n\t\t$this->debug(\"method '$this->methodname' exists\");\n\t\t// evaluate message, getting back parameters\n\t\t// verify that request parameters match the method's signature\n\t\tif(! $this->verify_method($this->methodname,$this->methodparams)){\n\t\t\t// debug\n\t\t\t$this->debug('ERROR: request not verified against method signature');\n\t\t\t$this->result = 'fault: request failed validation against method signature';\n\t\t\t// return fault\n\t\t\t$this->fault('Server',\"Operation '$this->methodname' not defined in service.\");\n\t\t\treturn;\n\t\t}\n\n\t\t// if there are parameters to pass\n $this->debug('params var dump '.$this->varDump($this->methodparams));\n\t\tif($this->methodparams){\n\t\t\t$this->debug(\"calling '$this->methodname' with params\");\n\t\t\tif (! function_exists('call_user_func_array')) {\n\t\t\t\t$this->debug('calling method using eval()');\n\t\t\t\t$funcCall = $this->methodname.'(';\n\t\t\t\tforeach($this->methodparams as $param) {\n\t\t\t\t\t$funcCall .= \"\\\"$param\\\",\";\n\t\t\t\t}\n\t\t\t\t$funcCall = substr($funcCall, 0, -1).')';\n\t\t\t\t$this->debug('function call:<br>'.$funcCall);\n\t\t\t\t@eval(\"\\$this->methodreturn = $funcCall;\");\n\t\t\t} else {\n\t\t\t\t$this->debug('calling method using call_user_func_array()');\n\t\t\t\t$this->methodreturn = call_user_func_array(\"$this->methodname\",$this->methodparams);\n\t\t\t}\n\t\t} else {\n\t\t\t// call method w/ no parameters\n\t\t\t$this->debug(\"calling $this->methodname w/ no params\");\n\t\t\t$m = $this->methodname;\n\t\t\t$this->methodreturn = @$m();\n\t\t}\n $this->debug('methodreturn var dump'.$this->varDump($this->methodreturn));\n\t\t$this->debug(\"leaving invoke_method: called method $this->methodname, received $this->methodreturn of type \".gettype($this->methodreturn));\n\t}", "public abstract function Invoke($obj, array $parameters);", "public function testInvokeReferencingWithParameters()\n {\n // unit test. Until there is no good way to test that feature, I skip the\n // test\n $this->markTestSkipped();\n\n $toBeInvoked = $this->getMock('toBeInvoked', array('invokeWithParams'));\n $toBeInvoked->expects($this->once())\n ->method('invokeWithParams')\n ->with($this->equalTo('foo'),\n $this->equalTo('hello'),\n $this->equalTo('world'))\n ->will($this->returnValue(null));\n\n $property = new Property('foo', sprintf('@invoke(%s, invokeWithParams, hello, world)', get_class($toBeInvoked)));\n $injector = $this->getMock('\\Sweetie\\Injector', array('inject'), array(), '', false);\n\n $reflection = new \\ReflectionObject($injector);\n\n /* @var $method ReflectionMethod */\n $method = $reflection->getMethod('_getDependency');\n\n $method->setAccessible(true);\n $object = $method->invokeArgs($injector, array($property));\n }", "private final function call_user_func_args($method, array $arguments, $validate_input = false) {\n // Make sure the $method actually exists\n if (!method_exists($this, $method)) {\n throw new ParameterException($method . ' is not defined.');\n }\n\n // validate arguments\n foreach ($arguments as $argument_name => $argument_value) {\n if (empty($argument_name) or is_numeric($argument_name)) {\n throw new ParameterException('$Arguments cannot have numeric offsets.');\n }\n if (!preg_match('~^[a-z\\_][a-zA-Z0-9\\_]*$~', $argument_name)) {\n throw new ParameterException('$Arguments contains illegal character offsets. Was given \"' . $argument_name . '\"');\n }\n }\n\n $reflector = new \\ReflectionMethod(get_class($this), $method);\n\n // No arguments, and no required arguments\n $required_parameter_count = $reflector->getNumberOfRequiredParameters();\n if (empty($arguments) && $required_parameter_count == 0) {\n return $this->$method();\n }\n\n // Arguments, but no method arguments\n $parameter_count = $reflector->getNumberOfParameters();\n if (!$parameter_count) {\n return $this->$method();\n }\n\n // Prepare the $Parameters\n $parameters = array();\n foreach ($reflector->getParameters() as $param) {\n $lower_name = strtolower($name = $param->getName());\n $argument = ($available = array_key_exists($name, $arguments)) ? $arguments[$name] : null;\n $default = ($is_default = $param->isDefaultValueAvailable()) ? $param->getDefaultValue() : null;\n $parameters[$lower_name] = array('Name' => $name, 'Offset' => $param->getPosition(), 'Optional' => $param->isOptional(), 'Nullable' => $param->allowsNull(), 'Reference' => $param->isPassedByReference(), 'Array' => $param->isArray(), 'Defaultable' => $is_default, 'Default' => $default, 'Available' => $available, 'Provided' => $available ? $argument : $default,);\n }\n\n // Pop pointless nulls (from the last to the first)\n end($parameters);\n while ($param = current($parameters)) {\n if (!$param['Nullable'] or !$param['Optional'] or !is_null($param['Provided'])) {\n break;\n }\n array_pop($parameters); // Pop trailing null optional nullable arguments\n prev($parameters); // Move one back\n }\n\n // Prepare the final $Arguments\n $arguments = array();\n foreach ($parameters as $name => $param) {\n if ($validate_input) {\n if (is_null($param['Provided']) and !$param['Nullable']) {\n throw new ParameterException(\"Argument '{$name}' does not accept NULL.\");\n }\n if ($param['Array'] and !is_array($param['Provided'])) {\n if (!$param['Nullable'] and is_null($param['Provided'])) {\n throw new ParameterException(\"Argument '{$name}' should be an array.\");\n }\n }\n if (!$param['Available'] and !$param['Optional'] and !$param['Defaultable']) {\n throw new ParameterException(\"Argument '{$name}' is required.\");\n }\n }\n // Store this in the final $Arguments array\n $arguments[] = $param['Provided'];\n }\n // Invoke the actual function\n return $reflector->invokeArgs($this, $arguments);\n }", "public function __invoke(){\n \n echo \"trying to call object as method __invoke method \"; \n\n }", "public function call(string $method, array $parameters = []);", "public function testInvokeCallableFunction()\n {\n $function = 'strlen';\n $arg = uniqid('string');\n $length = strlen($arg);\n $args = [$arg];\n $reflection = $this->createReflectionFunction($function, ['invokeArgs']);\n $params = $reflection->getParameters();\n $subject = $this->createInstance(['_normalizeArray', '_createReflectionForCallable', '_validateParams']);\n $_subject = $this->reflect($subject);\n\n $subject->expects($this->exactly(1))\n ->method('_normalizeArray')\n ->with($args)\n ->will($this->returnArgument(0));\n $subject->expects($this->exactly(1))\n ->method('_createReflectionForCallable')\n ->with($function)\n ->will($this->returnValue($reflection));\n $subject->expects($this->exactly(1))\n ->method('_validateParams')\n ->with($args, $params);\n\n $result = $_subject->_invokeCallable($function, $args);\n $this->assertEquals($length, $result, 'Invocation produced a wrong result');\n }", "function call_user_func_named($function, $params) {\n // make sure we do not throw exception if function not found: raise error instead...\n // (oh boy, we do like php 4 better than 5, don't we...)\n if(!function_exists($function)) {\n if(!is_array($function)) {\n MakeError(ERROR_PHP, 'Call to unexisting function '.$function);\n return NULL;\n }\n else if(!is_object($function[0]) || !method_exists($function[0], $function[1])) {\n MakeError(ERROR_PHP, 'Call to unexisting function '.get_class($function[0]).'::'.$function[1]);\n return NULL;\n }\n }\n \n if(is_array($function) && is_object($function[0]))\n $reflect = new ReflectionMethod(get_class($function[0]), $function[1]);\n else\n $reflect = new ReflectionFunction($function);\n \n $func_params = $reflect->getParameters();\n $ordered_params = array();\n foreach($func_params as $i => $param) {\n $pname = $param->getName();\n \n if ($param->isPassedByReference()) {\n /// @todo shall we raise some warning?\n }\n \n if (array_key_exists($pname, $params)) {\n $ordered_params[] = $params[$pname];\n }\n else if ($param->isDefaultValueAvailable()) {\n $ordered_params[] = $param->getDefaultValue();\n }\n else {\n // missing required parameter: mark an error and exit\n //return new Exception('call to '.$function.' missing parameter nr. '.$i+1);\n MakeError(sprintf('Call to %s missing parameter nr. %d: \"%s\"', $function, $i+1, $pname),\n compact($function, $params));\n return NULL;\n }\n }\n \n return call_user_func_array($function, $ordered_params);\n}", "public function __invoke();", "public function __invoke()\n {\n return call_user_func_array($this->callable, func_get_args());\n }", "public function __invoke() {}", "public function call(callable $callable, array $args = []);", "final public function runCallMethod()\n {\n // Use a default call if the DefaultService class is being used (allow for extension)\n $callMethod = (get_class($this) === 'Drest\\Service\\DefaultService') ? $this->getDefaultMethod() : $this->matched_route->getServiceCallMethod();\n if (!method_exists($this, $callMethod))\n {\n throw DrestException::unknownServiceMethod(get_class($this), $callMethod);\n }\n $this->$callMethod();\n }", "function call_if_callable($callable, ...$params) {\n if (is_callable($callable)) {\n return call_user_func_array($callable, $params);\n }\n\n return null;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create request for operation 'createOfferAttachmentUsingPOST'
protected function createOfferAttachmentUsingPOSTRequest($offer_attachment) { // verify the required parameter 'offer_attachment' is set if ($offer_attachment === null || (is_array($offer_attachment) && count($offer_attachment) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $offer_attachment when calling createOfferAttachmentUsingPOST' ); } $resourcePath = '/sale/offer-attachments'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; // body params $_tempBody = null; if (isset($offer_attachment)) { $_tempBody = $offer_attachment; } if ($multipart) { $headers = $this->headerSelector->selectHeadersForMultipart( ['application/vnd.allegro.public.v1+json'] ); } else { $headers = $this->headerSelector->selectHeaders( ['application/vnd.allegro.public.v1+json'], ['application/vnd.allegro.public.v1+json'] ); } // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present if ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); } else { $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { $multipartContents[] = [ 'name' => $formParamName, 'contents' => $formParamValue ]; } // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { // for HTTP post (form) $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } // this endpoint requires OAuth (access token) if ($this->config->getAccessToken() !== null) { $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); } $headers = array_merge( $defaultHeaders, $headerParams, $headers ); $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); }
[ "public function createOfferAttachmentUsingPOSTWithHttpInfo($offer_attachment)\n {\n $request = $this->createOfferAttachmentUsingPOSTRequest($offer_attachment);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n switch($statusCode) {\n case 201:\n if ('\\AllegroApi\\Model\\OfferAttachment' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\AllegroApi\\Model\\OfferAttachment', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\AllegroApi\\Model\\OfferAttachment';\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 201:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\AllegroApi\\Model\\OfferAttachment',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function create(AttachmentFormModel $attachmentModel): Attachment;", "protected function addAttachmentRequest($virtual_operator, $id, $attachment)\n {\n // verify the required parameter 'virtual_operator' is set\n if ($virtual_operator === null || (is_array($virtual_operator) && count($virtual_operator) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $virtual_operator when calling addAttachment'\n );\n }\n if (strlen($virtual_operator) > 60) {\n throw new \\InvalidArgumentException('invalid length for \"$virtual_operator\" when calling DocumentsApi.addAttachment, must be smaller than or equal to 60.');\n }\n\n // verify the required parameter 'id' is set\n if ($id === null || (is_array($id) && count($id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $id when calling addAttachment'\n );\n }\n // verify the required parameter 'attachment' is set\n if ($attachment === null || (is_array($attachment) && count($attachment) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $attachment when calling addAttachment'\n );\n }\n\n $resourcePath = '/v2/{virtualOperator}/outbounddocuments/{id}/attachments';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($virtual_operator !== null) {\n $resourcePath = str_replace(\n '{' . 'virtualOperator' . '}',\n ObjectSerializer::toPathValue($virtual_operator),\n $resourcePath\n );\n }\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n '{' . 'id' . '}',\n ObjectSerializer::toPathValue($id),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($attachment)) {\n $_tempBody = $attachment;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n\n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('Authorization');\n if ($apiKey !== null) {\n $headers['Authorization'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function addAttachmentRequest($id, $attachment_name = null, $attachment_description = null, $attachment_type = null, $url = null, $content = null)\n {\n // verify the required parameter 'id' is set\n if ($id === null || (is_array($id) && count($id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $id when calling addAttachment'\n );\n }\n\n $resourcePath = '/task/{id}/attachment/create';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n '{' . 'id' . '}',\n ObjectSerializer::toPathValue($id),\n $resourcePath\n );\n }\n\n // form params\n if ($attachment_name !== null) {\n $formParams['attachment-name'] = ObjectSerializer::toFormValue($attachment_name);\n }\n // form params\n if ($attachment_description !== null) {\n $formParams['attachment-description'] = ObjectSerializer::toFormValue($attachment_description);\n }\n // form params\n if ($attachment_type !== null) {\n $formParams['attachment-type'] = ObjectSerializer::toFormValue($attachment_type);\n }\n // form params\n if ($url !== null) {\n $formParams['url'] = ObjectSerializer::toFormValue($url);\n }\n // form params\n if ($content !== null) {\n $multipart = true;\n $formParams['content'] = [];\n $paramFiles = is_array($content) ? $content : [$content];\n foreach ($paramFiles as $paramFile) {\n $formParams['content'][] = \\GuzzleHttp\\Psr7\\try_fopen(\n ObjectSerializer::toFormValue($paramFile),\n 'rb'\n );\n }\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['multipart/form-data']\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function publishOfferRequest($offer_id)\n {\n // verify the required parameter 'offer_id' is set\n if ($offer_id === null || (is_array($offer_id) && count($offer_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $offer_id when calling publishOffer'\n );\n }\n\n $resourcePath = '/offer/{offerId}/publish/';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($offer_id !== null) {\n $resourcePath = str_replace(\n '{' . 'offerId' . '}',\n ObjectSerializer::toPathValue($offer_id),\n $resourcePath\n );\n }\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function testCreateOfferUsingPOST()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "public function uploadF24AttachmentRequest($company_id, $filename = null, $attachment = null, string $contentType = self::contentTypes['uploadF24Attachment'][0])\n {\n\n // verify the required parameter 'company_id' is set\n if ($company_id === null || (is_array($company_id) && count($company_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $company_id when calling uploadF24Attachment'\n );\n }\n\n\n\n\n $resourcePath = '/c/{company_id}/taxes/attachment';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($company_id !== null) {\n $resourcePath = str_replace(\n '{' . 'company_id' . '}',\n ObjectSerializer::toPathValue($company_id),\n $resourcePath\n );\n }\n\n // form params\n if ($filename !== null) {\n $formParams['filename'] = ObjectSerializer::toFormValue($filename);\n }\n // form params\n if ($attachment !== null) {\n $multipart = true;\n $formParams['attachment'] = [];\n $paramFiles = is_array($attachment) ? $attachment : [$attachment];\n foreach ($paramFiles as $paramFile) {\n $formParams['attachment'][] = \\GuzzleHttp\\Psr7\\Utils::tryFopen(\n ObjectSerializer::toFormValue($paramFile),\n 'rb'\n );\n }\n }\n\n $headers = $this->headerSelector->selectHeaders(\n ['application/json', ],\n $contentType,\n $multipart\n );\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {\n # if Content-Type contains \"application/json\", json_encode the form parameters\n $httpBody = \\GuzzleHttp\\Utils::jsonEncode($formParams);\n } else {\n // for HTTP post (form)\n $httpBody = ObjectSerializer::buildQuery($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if (!empty($this->config->getAccessToken())) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $operationHost = $this->config->getHost();\n $query = ObjectSerializer::buildQuery($queryParams);\n return new Request(\n 'POST',\n $operationHost . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function createOfferAttachmentUsingPOST($offer_attachment)\n {\n list($response) = $this->createOfferAttachmentUsingPOSTWithHttpInfo($offer_attachment);\n return $response;\n }", "protected function createAttachment()\n {\n return factory(Attachment::class)->create();\n }", "public function createOfferUsingPOSTWithHttpInfo($offer)\n {\n $request = $this->createOfferUsingPOSTRequest($offer);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n switch($statusCode) {\n case 200:\n if ('\\AllegroApi\\Model\\Offer' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\AllegroApi\\Model\\Offer', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\AllegroApi\\Model\\Offer';\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\AllegroApi\\Model\\Offer',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function getOfferRequest($offer_id)\n {\n // verify the required parameter 'offer_id' is set\n if ($offer_id === null || (is_array($offer_id) && count($offer_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $offer_id when calling getOffer'\n );\n }\n\n $resourcePath = '/offer/{offerId}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($offer_id !== null) {\n $resourcePath = str_replace(\n '{' . 'offerId' . '}',\n ObjectSerializer::toPathValue($offer_id),\n $resourcePath\n );\n }\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function create(AttachmentNestedAttachmentEntity $resource): Response\n {\n $parentID = $resource->parentID;\n return $this->client->post(\"Attachments/$parentID/NestedAttachments\", $resource->toArray());\n }", "public function createMediaFileRequest($wt_employee_create_media_file)\n {\n // verify the required parameter 'wt_employee_create_media_file' is set\n if ($wt_employee_create_media_file === null || (is_array($wt_employee_create_media_file) && count($wt_employee_create_media_file) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $wt_employee_create_media_file when calling createMediaFile'\n );\n }\n\n $resourcePath = '/v2/employee/mediaFile';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($wt_employee_create_media_file)) {\n if ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($wt_employee_create_media_file));\n } else {\n $httpBody = $wt_employee_create_media_file;\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\Query::build($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\Query::build($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "protected function supportUploadAttachmentRequest($file = null)\n {\n\n $resourcePath = '/support/messages/attachment';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // form params\n if ($file !== null) {\n $multipart = true;\n $formParams['file'] = \\GuzzleHttp\\Psr7\\try_fopen(ObjectSerializer::toFormValue($file), 'rb');\n }\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['multipart/form-data']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('x-api-key');\n if ($apiKey !== null) {\n $headers['x-api-key'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function createViaRequest()\n {\n $photo = photos()->createPhotoViaRequest();\n $related = finder()->findInstance(\n input('alert_type'), input('alert_id')\n );\n $alert = Alert::create($this->buildCreateParameters($photo, $related, input('alert_type')));\n $photo->alerts()->attach($alert->uuid);\n $alert->load('photo', 'user');\n return $alert;\n }", "public function actionCreate()\n {\n $model = new Part();\n $attachment = new PartAttachment();\n\n if ($model->load(Yii::$app->request->post()) ) {\n\n $model->created_by = Yii::$app->user->identity->id;\n $currentDateTime = date(\"Y-m-d H:i:s\");\n $model->created = $currentDateTime;\n $a_attach = UploadedFile::getInstances($attachment, 'attachment');\n\n if ($model->save()) {\n $part_id = $model->id;\n if (!empty($a_attach)) {\n $this->upload($a_attach,$part_id);\n }\n return $this->redirect(['view', 'id' => $model->id]);\n }\n }\n return $this->render('create', [\n 'attachment'=>$attachment,\n 'model' => $model,\n ]);\n }", "protected function createServiceOfferingUsingPOSTRequest($service_offering)\n {\n // verify the required parameter 'service_offering' is set\n if ($service_offering === null) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $service_offering when calling createServiceOfferingUsingPOST'\n );\n }\n\n $resourcePath = '/api/service-offerings';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n if (isset($service_offering)) {\n $_tempBody = $service_offering;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['*/*']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['*/*'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('Authorization');\n if ($apiKey !== null) {\n $headers['Authorization'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function testCreateOffer()\n {\n $request = $this->call('POST', '/offer', ['name' => 'Offer Name', 'description' => 'Offer Description', 'fixed_discount' => 30, 'expiry_date' => '2020-10-10']);\n $this->assertEquals(201, $request->status());\n }", "public function create(array $input): Attachment;" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates wallet with specified currency.
private function createWallet(Currency $currency) { $wallet = new Wallet([ 'shown' => true, 'order' => $this->owner->wallets()->count() + 1 ]); $wallet->currency_code = $currency->getCode(); $wallet->balance = '0'; $this->owner->wallets()->save($wallet); return $wallet; }
[ "public function createWallet($curr){\n if($curr === 'XRP' || $curr === 'BTC' || $curr === 'ETH'){\n $arr = [\n \"wallet_type\" => $curr\n ];\n return $this->runWithBody(\"/api/v1/wallet/create\", $arr, 'POST');\n }else{\n return 'Currency Not available';\n }\n }", "public function createWallet($account);", "public function create_wallet()\n {\n $headers = array();\n $data = null;\n return $this->get_json(Requests::post(\n $this->get_wallet_url(),\n $headers,\n $data,\n $this->get_authorisation_header($this->access_id, $this->secret_key, 'POST')));\n }", "function wallet_add_new_wallet(){\n\t}", "public function createMoney($amount/*, $currency = null*/);", "public function generate_wallets()\n {\n foreach (User::$wallets as $type => $currencies) {\n foreach($currencies as $currency => $name){\n $this->{$type}()->create(['name' => $name, 'currency' => $currency]);\n }\n }\n }", "public function createNewWallet($options) {\n if (!is_array($options)) {\n $args = func_get_args();\n $options = [\n \"identifier\" => $args[0],\n \"password\" => $args[1],\n \"key_index\" => isset($args[2]) ? $args[2] : null,\n ];\n }\n\n $identifier = $options['identifier'];\n $password = isset($options['passphrase']) ? $options['passphrase'] : (isset($options['password']) ? $options['password'] : null);\n $keyIndex = isset($options['key_index']) ? $options['key_index'] : 0;\n\n $walletPath = WalletPath::create($keyIndex);\n\n $storePrimaryMnemonic = isset($options['store_primary_mnemonic']) ? $options['store_primary_mnemonic'] : null;\n\n if (isset($options['primary_mnemonic']) && $options['primary_private_key']) {\n throw new \\InvalidArgumentException(\"Can't specify Primary Mnemonic and Primary PrivateKey\");\n }\n\n $primaryMnemonic = null;\n $primaryPrivateKey = null;\n if (!isset($options['primary_mnemonic']) && !isset($options['primary_private_key'])) {\n if (!$password) {\n throw new \\InvalidArgumentException(\"Can't generate Primary Mnemonic without a passphrase\");\n } else {\n // create new primary seed\n list($primaryMnemonic, $primarySeed, $primaryPrivateKey) = $this->newPrimarySeed($password);\n if ($storePrimaryMnemonic !== false) {\n $storePrimaryMnemonic = true;\n }\n }\n } else if (isset($options['primary_mnemonic'])) {\n $primaryMnemonic = $options['primary_mnemonic'];\n } else if (isset($options['primary_private_key'])) {\n $primaryPrivateKey = $options['primary_private_key'];\n }\n\n if ($storePrimaryMnemonic && $primaryMnemonic && !$password) {\n throw new \\InvalidArgumentException(\"Can't store Primary Mnemonic on server without a passphrase\");\n }\n\n if ($primaryPrivateKey) {\n if (is_string($primaryPrivateKey)) {\n $primaryPrivateKey = [$primaryPrivateKey, \"m\"];\n }\n } else {\n $primaryPrivateKey = BIP32::master_key(BIP39::mnemonicToSeedHex($primaryMnemonic, $password), 'bitcoin', $this->testnet);\n }\n\n if (!$storePrimaryMnemonic) {\n $primaryMnemonic = false;\n }\n\n // create primary public key from the created private key\n $primaryPublicKey = BIP32::build_key($primaryPrivateKey, (string)$walletPath->keyIndexPath()->publicPath());\n\n if (isset($options['backup_mnemonic']) && $options['backup_public_key']) {\n throw new \\InvalidArgumentException(\"Can't specify Backup Mnemonic and Backup PublicKey\");\n }\n\n $backupMnemonic = null;\n $backupPublicKey = null;\n if (!isset($options['backup_mnemonic']) && !isset($options['backup_public_key'])) {\n list($backupMnemonic, $backupSeed, $backupPrivateKey) = $this->newBackupSeed();\n } else if (isset($options['backup_mnemonic'])) {\n $backupMnemonic = $options['backup_mnemonic'];\n } else if (isset($options['backup_public_key'])) {\n $backupPublicKey = $options['backup_public_key'];\n }\n\n if ($backupPublicKey) {\n if (is_string($backupPublicKey)) {\n $backupPublicKey = [$backupPublicKey, \"m\"];\n }\n } else {\n $backupPublicKey = BIP32::extended_private_to_public(BIP32::master_key(BIP39::mnemonicToSeedHex($backupMnemonic, \"\"), 'bitcoin', $this->testnet));\n }\n\n // create a checksum of our private key which we'll later use to verify we used the right password\n $checksum = BIP32::key_to_address($primaryPrivateKey[0]);\n\n // send the public keys to the server to store them\n // and the mnemonic, which is safe because it's useless without the password\n $data = $this->_createNewWallet($identifier, $primaryPublicKey, $backupPublicKey, $primaryMnemonic, $checksum, $keyIndex);\n // received the blocktrail public keys\n $blocktrailPublicKeys = $data['blocktrail_public_keys'];\n\n $wallet = new Wallet($this, $identifier, $primaryMnemonic, [$keyIndex => $primaryPublicKey], $backupPublicKey, $blocktrailPublicKeys, $keyIndex, $this->network, $this->testnet, $checksum);\n\n $wallet->unlock($options);\n\n // return wallet and backup mnemonic\n return [\n $wallet,\n $primaryMnemonic,\n $backupMnemonic,\n $blocktrailPublicKeys\n ];\n }", "public function actionCreate()\n {\n $model = new UsersWallets();\n $user = (new Users)->findOne(\\Yii::$app->user->identity->id);//::findOne($id);\n $currency = new Currency;//::find()->all(); \n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n 'user' => $user,\n 'currency' => $currency, \n ]);\n }", "public function created(Currency $currency)\n {\n $job = new CreateWalletsForCurrencyJob($currency);\n\n dispatch_now($job);\n }", "public function wallet();", "public function created(Currency $currency);", "protected function _testNewBlankWallet(Wallet $wallet) {\n $client = $this->setupBlocktrailSDK();\n\n $this->assertFalse($wallet->isLocked());\n $wallet->lock();\n $this->assertTrue($wallet->isLocked());\n\n $address = $wallet->getNewAddress();\n $this->assertTrue(!!$address, \"should generate an address, was `\".$address.\"`\");\n\n $this->assertEquals(0, $wallet->getBalance()[0]);\n\n $e = null;\n try {\n $wallet->pay([\n \"2N6Fg6T74Fcv1JQ8FkPJMs8mYmbm9kitTxy\" => BlocktrailSDK::toSatoshi(0.001)\n ]);\n } catch (\\Exception $e) {\n }\n $this->assertTrue(!!$e && strpos($e->getMessage(), \"lock\") !== false, \"Locked wallet is able to pay...\");\n\n $e = null;\n try {\n $wallet->upgradeKeyIndex(10000);\n } catch (\\Exception $e) {\n }\n $this->assertTrue(!!$e && strpos($e->getMessage(), \"lock\") !== false, \"Locked wallet is able to upgrade key index...\");\n\n // repeat above but starting with readonly = true\n $wallet = $client->initWallet([\n \"identifier\" => $wallet->getIdentifier(),\n \"readonly\" => true\n ]);\n\n $this->assertTrue($wallet->isLocked());\n\n $this->assertTrue(!!$wallet->getNewAddress());\n\n $this->assertEquals(0, $wallet->getBalance()[0]);\n\n $e = null;\n try {\n $wallet->pay([\n \"2N6Fg6T74Fcv1JQ8FkPJMs8mYmbm9kitTxy\" => BlocktrailSDK::toSatoshi(0.001)\n ]);\n } catch (\\Exception $e) {\n }\n $this->assertTrue(!!$e && strpos($e->getMessage(), \"lock\") !== false, \"Locked wallet is able to pay...\");\n\n $e = null;\n try {\n $wallet->upgradeKeyIndex(10000);\n } catch (\\Exception $e) {\n }\n $this->assertTrue(!!$e && strpos($e->getMessage(), \"lock\") !== false, \"Locked wallet is able to upgrade key index...\");\n\n $wallet->unlock(['passphrase' => \"password\"]);\n $this->assertFalse($wallet->isLocked());\n\n $e = null;\n try {\n $wallet->pay([\n \"2N6Fg6T74Fcv1JQ8FkPJMs8mYmbm9kitTxy\" => BlocktrailSDK::toSatoshi(0.001)\n ]);\n } catch (\\Exception $e) {\n }\n $this->assertTrue(!!$e, \"Wallet without balance is able to pay...\");\n\n $wallet->upgradeKeyIndex(10000);\n\n /*\n * init same wallet by with bad password\n */\n $e = null;\n try {\n $wallet = $client->initWallet([\n \"identifier\" => $wallet->getIdentifier(),\n \"passphrase\" => \"password2\",\n ]);\n } catch (\\Exception $e) {\n }\n $this->assertTrue(!!$e, \"Wallet with bad pass initialized\");\n }", "public function initWallet($options) {\n if (!is_array($options)) {\n $args = func_get_args();\n $options = [\n \"identifier\" => $args[0],\n \"password\" => $args[1],\n ];\n }\n\n $identifier = $options['identifier'];\n $readonly = isset($options['readonly']) ? $options['readonly'] :\n (isset($options['readOnly']) ? $options['readOnly'] :\n (isset($options['read-only']) ? $options['read-only'] :\n false));\n\n // get the wallet data from the server\n $data = $this->getWallet($identifier);\n if (!$data) {\n throw new \\Exception(\"Failed to get wallet\");\n }\n\n if (array_key_exists('check_backup_key', $options)) {\n if (!is_string($options['check_backup_key'])) {\n throw new \\InvalidArgumentException(\"check_backup_key should be a string (the xpub)\");\n }\n if ($options['check_backup_key'] !== $data['backup_public_key'][0]) {\n throw new \\InvalidArgumentException(\"Backup key returned from server didn't match our own\");\n }\n }\n\n $addressReader = $this->makeAddressReader($options);\n\n switch ($data['wallet_version']) {\n case Wallet::WALLET_VERSION_V1:\n $wallet = new WalletV1(\n $this,\n $identifier,\n isset($options['primary_mnemonic']) ? $options['primary_mnemonic'] : $data['primary_mnemonic'],\n $data['primary_public_keys'],\n $data['backup_public_key'],\n $data['blocktrail_public_keys'],\n isset($options['key_index']) ? $options['key_index'] : $data['key_index'],\n $this->network,\n $this->testnet,\n array_key_exists('segwit', $data) ? $data['segwit'] : false,\n $addressReader,\n $data['checksum']\n );\n break;\n case Wallet::WALLET_VERSION_V2:\n $wallet = new WalletV2(\n $this,\n $identifier,\n isset($options['encrypted_primary_seed']) ? $options['encrypted_primary_seed'] : $data['encrypted_primary_seed'],\n isset($options['encrypted_secret']) ? $options['encrypted_secret'] : $data['encrypted_secret'],\n $data['primary_public_keys'],\n $data['backup_public_key'],\n $data['blocktrail_public_keys'],\n isset($options['key_index']) ? $options['key_index'] : $data['key_index'],\n $this->network,\n $this->testnet,\n array_key_exists('segwit', $data) ? $data['segwit'] : false,\n $addressReader,\n $data['checksum']\n );\n break;\n case Wallet::WALLET_VERSION_V3:\n if (isset($options['encrypted_primary_seed'])) {\n if (!$options['encrypted_primary_seed'] instanceof Buffer) {\n throw new \\InvalidArgumentException('Encrypted PrimarySeed must be provided as a Buffer');\n }\n $encryptedPrimarySeed = $data['encrypted_primary_seed'];\n } else {\n $encryptedPrimarySeed = new Buffer(base64_decode($data['encrypted_primary_seed']));\n }\n\n if (isset($options['encrypted_secret'])) {\n if (!$options['encrypted_secret'] instanceof Buffer) {\n throw new \\InvalidArgumentException('Encrypted secret must be provided as a Buffer');\n }\n\n $encryptedSecret = $data['encrypted_secret'];\n } else {\n $encryptedSecret = new Buffer(base64_decode($data['encrypted_secret']));\n }\n\n $wallet = new WalletV3(\n $this,\n $identifier,\n $encryptedPrimarySeed,\n $encryptedSecret,\n $data['primary_public_keys'],\n $data['backup_public_key'],\n $data['blocktrail_public_keys'],\n isset($options['key_index']) ? $options['key_index'] : $data['key_index'],\n $this->network,\n $this->testnet,\n array_key_exists('segwit', $data) ? $data['segwit'] : false,\n $addressReader,\n $data['checksum']\n );\n break;\n default:\n throw new \\InvalidArgumentException(\"Invalid wallet version\");\n }\n\n if (!$readonly) {\n $wallet->unlock($options);\n }\n\n return $wallet;\n }", "function createCompanyWallet()\n {\n $token = refreshAuthToken();\n \n global $I_A_N;\n global $A_A_N;\n global $endpoint;\n global $wallet_name;\n global $wallet_currency;\n global $wallet_type;\n\n $company_wallet_name = $wallet_name;\n $company_wallet_currency = $wallet_currency;\n $company_wallet_type = $wallet_type;\n \n $curl = curl_init();\n\n $request_fields = [\n \"CreateCompanyWallet\"=>[\n \"request\"=>[\n \"IssuerAccountNumber\"=>$I_A_N,\n \"WalletName\"=>$company_wallet_name,\n \"WalletCurrency\"=>$company_wallet_currency,\n \"WalletType\"=>$company_wallet_type,\n \"AllowAccessAccountNumber\"=>$A_A_N\n ]\n ]\n ];\n\n $json_typed = json_encode($request_fields);\n \n curl_setopt_array($curl, array(\n CURLOPT_URL => $endpoint.'/API/V4/Wallet/CreateCompanyWallet',\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => '',\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 0,\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => 'POST',\n CURLOPT_POSTFIELDS => $json_typed,\n CURLOPT_HTTPHEADER => array(\n \"Content-Type: application/json\",\n \"Authorization: Bearer \".$token\n )\n ));\n \n $response = curl_exec($curl);\n $err = curl_error($curl);\n\n curl_close($curl);\n\n $resp = json_decode($response, true);\n \n //global $go_home;\n\n if ($err) {\n echo \"cURL Error #:\" . $err;\n } else {\n echo \"<h1>Created company wallet</h1>\";\n //echo \"<p><a href='\".$go_home.\"'>Return to API calls test page</a></p>\";\n foreach($resp as $resps){\n foreach($resps as $wallet){\n echo $wallet.\" = \".$part.\"<br>\";\n }\n }\n }\n }", "public function actionCreate()\n {\n $model = new Wallet();\n\n if ($model->loadAll(Yii::$app->request->post()) && $model->saveAll()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Wallet();\n\n if ($model->load(Yii::$app->request->post())) {\n\n if (($user = UserProfile::find()->where(['username' => $model->username])->one()) !== null) {\n\n $model->user_id = $user->id;\n // $model->description = TransactionType::findOne($model->transaction_type)->name; \n $model->save();\n\n return $this->redirect(['view', 'id' => $model->id]);\n }\n Yii::$app->session->setFlash('error', 'The username does not exist.'); \n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public static function newWallet($pass){\n\t\t\t$api_code=\"802b764f-aacd-4fed-aa84-af7fb7700432\";\n\t\t\t$request = new Request('https://blockchain.info');\n\t\t\t$wallet = $request -> makeRequest('GET', '/api/v2/create_wallet', array(\n\t\t\t\t'api_code'=>$api_code,\n\t\t\t\t'password'=>$pass\n\t\t\t\t));\n\t\t\treturn $wallet['guid'];\n\t\t}", "public function createUserDefaultWallet($userId, $defaultCurrency)\n {\n $wallet = new Wallet();\n $wallet->user_id = $userId;\n $wallet->currency_id = $defaultCurrency;\n $wallet->is_default = 'Yes';\n $wallet->save();\n }", "function addWallet($username, $password_hash, $balance)\n{\n global $db;\n $query = \"INSERT INTO wallets VALUES \n (:username, :password_hash, :balance, \n 0, 0, 0, 0, 0, 0, 0, 0)\";\n\n $statement = $db->prepare($query);\n $statement->bindValue('username', $username);\n $statement->bindValue('password_hash', $password_hash);\n $statement->bindValue('balance', $balance);\n $statement->execute();\n $statement->closeCursor();\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays a form to create a new module entity.
public function newAction() { $entity = new Module(); $form = $this->createCreateForm($entity); return array( 'entity' => $entity, 'form' => $form->createView(), ); }
[ "public function newAction()\n {\n $entity = new Module();\n $form = $this->createCreateForm($entity);\n\n return $this->render('EmiageReviewManagerBundle:Module:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new SkIdentificationModule();\n $form = $this->createCreateForm($entity);\n\n return $this->render('SkaphandrusAppBundle:SkIdentificationModule:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Pensum();\n $form = $this->createForm(new PensumType(), $entity);\n\n return $this->render('QQiRecordappBundle:Pensum:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function actionCreate()\n {\n $model = new Module();\n\n \n if ($model->load(Yii::$app->request->post())) {\n\n $createdBy = Yii::$app->user->getId();\n $model->owner_id = $createdBy;\n $model->status = 'in-making';\n $model->review_status = 'yet-to-review';\n\n if(!$model->validate()) { \n $errors = $model->getErrors();\n var_dump($errors); //or print_r($errors)\n exit;\n }\n $model->save();\n\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function newAction()\n {\n $entity = new Form();\n $form = $this->createCreateForm($entity);\n\n return $this->render('FormBundle:Form:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n// if(!$this->isAdmin()){\n// return $this->redirect($this->generateUrl('accueil'));\n// }\n $entity = new Labs();\n $form = $this->createCreateForm($entity);\n\n return $this->render('YnovLabsBundle:Labs:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Fragmento();\n $form = $this->createForm(new FragmentoType(), $entity);\n\n return $this->render('proyectobackendBundle:Fragmento:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Project();\n $form = $this->createForm(new ProjectType(), $entity);\n\n return $this->render('SitronnierSmBoxBundle:Project:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView()\n ));\n }", "public function newAction()\n {\n $entity = new Component();\n $form = $this->createForm(new ComponentType(), $entity);\n\n return $this->render('BatnaSiebelBundle:Component:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView()\n ));\n }", "public function newAction()\n {\n $entity = new Especialidad();\n $form = $this->createForm(new EspecialidadType(), $entity);\n\n return $this->render('GEPedagEntidadesBundle:Especialidad:new_edit.html.twig', array(\n 'titulo' => 'crear',\n 'action' => $this->generateUrl('especialidad_create'),\n 'entity' => $entity,\n 'form' => $form->createView()\n ));\n }", "private function createCreateForm(SkIdentificationModule $entity)\n {\n $form = $this->createForm(new SkIdentificationModuleType(), $entity, array(\n 'action' => $this->generateUrl('identification_module_admin_create'),\n 'method' => 'POST',\n ));\n\n // $form->add('submit', 'submit', array('label' => 'Create'));\n\n return $form;\n }", "public function newAction()\n {\n //camino de miga\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem(\"Inicio\", $this->get(\"router\")->generate(\"hello_page\"));\n $breadcrumbs->addItem(\"Evaluación\", $this->get(\"router\")->generate(\"pantalla_modulo\",array('id'=>4)));\n $breadcrumbs->addItem(\"Periodos de Evaluación\", $this->get(\"router\")->generate(\"periodoeval\"));\n $breadcrumbs->addItem(\"Nuevo Periodo\", $this->get(\"router\")->generate(\"periodoeval_new\"));\n //fin camino de miga\n\n $entity = new Periodoeval();\n $form = $this->createForm(new PeriodoevalType(), $entity);\n\n return $this->render('EvaluacionBundle:Periodoeval:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function actionCreate()\n {\n $model = new TbModule();\n if($model->load(Yii::$app->request->post())){\n $model->createtime = date(\"Y-m-d H:i:s\");\n $model->userid = Yii::$app->user->id;\n if ($model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n }\n else {\n $model->imgurl = '';\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function newAction()\n {\n $entity = new Admin();\n $form = $this->createForm(new AdminType(), $entity);\n\n return $this->render('GestionUserBundle:Admin:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Empleado();\n $form = $this->createForm(new EmpleadoType(), $entity);\n\n return $this->render('PanelBundle:Empleado:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n \n }", "public function newAction()\n {\n $entity = new Lien();\n $form = $this->createCreateForm($entity);\n\n return $this->render('ProjetL3LienBundle:Lien:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Formations();\n $form = $this->createCreateForm($entity);\n\n\n return $this->render('FormBundle:Formations:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new TypeLogement();\n $typeLogementType = new TypeLogementType();\n\t\t$typeLogementType->setUser($this->get('security.context')->getToken()->getUser());\n $form = $this->createForm($typeLogementType, $entity);\n\n return $this->render('chevPensionBundle:TypeLogement:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Project();\n\n $dir = $this->get('request')->getBasePath();\n $dir = substr($dir, 1);\n \n\n $form = $this->createFullProjectCreateForm($entity,$dir);\n\n\n return $this->render('CrmBrookerInventoryBundle:Project:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets all labels associated with an article.
public function getArticleLabels($id) { return $this->call('GET', '/kb/' . intval($id) . '/labels'); return $this->_getResponse($results); }
[ "public function getLabels();", "public function getAllLabels(){\n $query = \"SELECT * FROM labels ORDER BY name\";\n $result = $this->connection->query($query);\n $result = $result->fetchAll(PDO::FETCH_ASSOC);\n $labels = [];\n foreach($result as $data){\n $labels[] = new Label($data);\n }\n return $labels;\n }", "public function getLabels( EntityId $entityId );", "public function getLabels() {\n\t\treturn get_post_type_object( $this->getPostTypeSlug() )->labels;\n\t}", "function get_topics_labels()\n\t{\n\t\tglobal $db, $cache, $config;\n\t\t$sql = \"SELECT * FROM \" . TOPICS_LABELS_TABLE . \" ORDER BY label_name ASC\";\n\t\t$result = $db->sql_query($sql, 0, 'topics_labels_', TOPICS_CACHE_FOLDER);\n\t\t$topic_labels = array();\n\t\twhile ($row = $db->sql_fetchrow($result))\n\t\t{\n\t\t\t$topic_labels[$row['id']] = $row;\n\t\t}\n\t\t$db->sql_freeresult($result);\n\t\treturn $topic_labels;\n\t}", "public function get_labels() {\n\t\treturn [];\n\t}", "public function getLabels() {\n $with_labels = array();\n foreach ($this->contexts as $context) {\n $with_labels[$context] = $this->getService($context)->getLabel();\n }\n return $with_labels;\n }", "public function getLabels()\r\n {\r\n // Fields\r\n $fields = $this->getFields();\r\n // All Labels\r\n $allLabels = ArrayHelper::column($fields, 'label', 'name');\r\n // Checkboxes & Radio Buttons Labels\r\n $checboxAndRadioLabels = ArrayHelper::column($fields, 'groupLabel', 'name');\r\n // Replace with Checkboxes & Radio Buttons labels\r\n $labels = array_merge($allLabels, $checboxAndRadioLabels);\r\n return $labels;\r\n }", "public function getLabels($repo) {\n echo \"GET /repos/$repo/labels\\n\";\n $r = $this->api()->get(\"/repos/$repo/labels\", [], [], ['throw' => true]);\n\n $labels = $r->getBody();\n $labels = array_column($labels, null, 'name');\n $labels = array_change_key_case($labels);\n return $labels;\n }", "public function getLabels()\n {\n if (is_null($this->labels)) {\n $this->labels = collect();\n $testlabel_models = TestLabel::where([\n ['buildid', '=', $this->buildid],\n ['outputid', '=', $this->outputid],\n ])->get();\n foreach ($testlabel_models as $testlabel_model) {\n $label = new Label();\n $label->Id = $testlabel_model->labelid;\n $text = $label->GetText();\n $this->labels->put($text, $label);\n }\n }\n return $this->labels;\n }", "public static function listLabels(){\n\t\t$labels = Record::select('label')->distinct()->orderBy('label', 'asc')->get()->pluck('label', 'label');\n\t\t\n\t\treturn $labels;\n\t}", "protected function getLabels() {\n\t\tif ($this->labelList === null) {\n\t\t\t$this->labelList = ConversationLabel::getLabelsByUser();\n\t\t}\n\t\t\n\t\treturn $this->labelList->getObjects();\n\t}", "public function getLabels() {\n if ($response = $this->podio->get('/task/label/')) {\n return json_decode($response->getBody(), TRUE);\n }\n }", "public function get_labels() {\n global $DB, $USER;\n\n $params = array('userid' => $USER->id, 'course' => $this->course->id);\n return $DB->get_records_select('block_jmail_label', 'userid = :userid AND (courseid = 0 OR courseid = :course)', $params);\n\n }", "function iheart_get_category_labels() {\n\n\t$labels = array();\n\n\t// Get all labels.\n\t$label_ids = iheart_get_all_category_label_ids();\n\tif ( ! $label_ids ) {\n\t\treturn $labels;\n\t}\n\n\t// Categories.\n\t$categories = get_the_terms( get_the_ID(), 'category' );\n\tif ( ! $categories ) {\n\t\treturn $labels;\n\t}\n\n\tforeach ( $categories as $category ) {\n\n\t\t// Skip if not a label.\n\t\tif ( ! in_array( $category->term_id, $label_ids ) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Add to list.\n\t\t$labels[ $category->term_id ] = $category;\n\t}\n\n\n\treturn $labels;\n}", "public function getStoreLabels();", "public function get_issue_labels()\n\t{\n\t\treturn $this->_api_fetch_collection(\n\t\t\t\t\"labels\", \n\t\t\t\t'Github_Repo_Issue_Label');\t\n\t}", "function workflow_load_all_labels() {\n static $labels;\n\n if (is_null($labels)) {\n $labels = array();\n\n foreach (workflow_load_all() as $key => $workflow) {\n $labels[$key] = $workflow->label;\n }\n }\n\n return $labels;\n}", "protected function labels() {\n // The admin has specified the exact labels that should be used.\n if ($this->getSetting('override_labels')) {\n return [\n 'singular' => $this->getSetting('label_singular'),\n 'plural' => $this->getSetting('label_plural'),\n ];\n }\n else {\n $this->initializeIefController();\n return $this->iefHandler->labels();\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$t1='Select root from `all` WHERE `all`.`id_city` IS NULL AND `all`.`id_r` IS NULL and `lv`=7 group by root';
function fun1(){ //$t1='SELECT `id_street` FROM `all` WHERE `all`.`id_city` IS not NULL AND `lv` =7 group by `id_street` having (count(`id_street`)>1)'; //$t1='SELECT id, kod, name FROM `street_zab` where id>=10000 and id<10500 '; $y=8; //echo '<p>'.$x.'</p>'; $t1='SELECT id, kod, name FROM `city_zab` where not( `name` like "%.%")';//type_sity<>"99" and type_sity ='.$x.' '; $q1=mysql_query ($t1); while ($r = mysql_fetch_row($q1)) {$y++; // $t='Select id, name, add_p, lv, root, id_city, id_r from `all` WHERE `id` ="'.$r[0].'" '; //while ($r = mysql_fetch_row($q1)) // { $t='UPDATE `city_zab` SET `name`="?.'.$r[2].'" WHERE `id` ="'.$r[0].'" '; echo $t; $q=mysql_query ($t); //}//} /*$ii=$ii.' '.$r[0]; $t='SELECT * FROM `all` WHERE `id_street` ="'.$r[0].'"'; $q=mysql_query ($t); while ($r1 = mysql_fetch_row($q)) { echo '<p>'.$r1[0].'|'.iconv("utf-8","windows-1251",$r1[2]).'|'.iconv("utf-8","windows-1251",$r1[3]).'|'.$r1[4].'|'.$r1[5].'|'.$r1[6].'</p>'; }*/ }echo $ii; }
[ "function city(){\n\t//\t$t1='select id_city, id, add_p, root, name FROM `all` WHERE id in (SELECT root FROM `all` WHERE `all`.`id_city` IS NULL AND `all`.`id_r` IS NULL and `lv`=7) and `all`.`id_city` IS not NULL order by id ';\n\t\n\t $q1=mysql_query ('SELECT id_city, id FROM `city` where id_city<500 ');\n\n\t\t\t\twhile ($r = mysql_fetch_row($q1)) \n\t\t\t\t\t{\n\t\t\t\t\t//$t=\"s\"\n\t\t\t\t//\t$id=$id.'<p>'.$r[1].'</p>';\n\t\t\t\t\t//$t='UPDATE `all` SET name =\"'.$r[1].\". \".$r[3].', \"+name , root=\"'.$r[2].'\" WHERE `root` =\"'.$r[0].'\" ';\n\t\t\t\t$t='UPDATE `all` SET `id_city`=\"'.$r[0].'\" WHERE `root` =\"'.$r[1].'\" ';\n\t\t\t\t\techo $t;$q=mysql_query ($t);}\n\t\t\t\techo \"good|good\";\n\t\t\t\t}", "function ambil_daftar_bagian(){\n $query1 = $this->db->query(\"select kd, nama_bagian from tbl_bagian where hapus is null order by nama_bagian;\");\n \n return $query1;\n }", "function get_tup_subunit_usul($tahun){\n // . \"FROM rba_2018.subunit LEFT JOIN rsa_2018.trx_tup ON rba_2018.subunit.kode_subunit = rsa_2018.trx_tup.kode_unit_subunit \"\n // . \"WHERE ( rsa_2018.trx_tup.aktif = '1' OR rsa_2018.trx_tup.aktif IS NULL ) \"\n // . \"AND ( rsa_2018.trx_tup.tahun = '{$tahun}' OR rsa_2018.trx_tup.tahun IS NULL ) \"\n // . \"GROUP BY rba_2018.subunit.kode_subunit \"\n // . \"ORDER BY rba_2018.subunit.kode_subunit ASC\";\n\n $query = \"SELECT t1.nama_subunit,t1.kode_subunit,IFNULL(t3.jml,0) AS jml\nFROM rba_2018.subunit t1\nLEFT JOIN (\n SELECT tr1.kode_unit_subunit AS kode_unit,COUNT(tr1.posisi) AS jml \n FROM rsa_2018.trx_tup AS tr1 \n WHERE tr1.tahun = '{$tahun}' AND tr1.posisi = 'SPM-FINAL-VERIFIKATOR' AND tr1.aktif = '1'\n GROUP BY tr1.kode_unit_subunit\n) AS t3\nON t1.kode_subunit = t3.kode_unit\nGROUP BY t1.kode_subunit \nORDER BY t1.kode_subunit ASC\";\n \n// echo $query; die;\n\n $q = $this->db->query($query);\n\n $result = $q->result();\n \n// var_dump($result);die;\n\n return $result ;\n \n }", "function chado_contact_chado_node_sync_select_query($query) {\n $query['where_clauses']['title'][] = 'contact.name <> :contact_name_null1';\n $query['where_clauses']['title'][] = 'contact.name <> :contact_name_null2';\n $query['where_args']['title'][':contact_name_null1'] = 'null';\n $query['where_args']['title'][':contact_name_null2'] = 'NULL';\n\n return $query;\n}", "function chado_pub_chado_node_sync_select_query($query) {\n $query['where_clauses']['title'][] = 'pub.title <> :pub_title_null';\n $query['where_args']['title'][':pub_title_null'] = 'NULL';\n\n return $query;\n}", "function prikazi_jedno($nesto,$odakle) {\n\n\tglobal $db;\n\n\t$komanda = \"SELECT DISTINCT $nesto FROM $odakle\";\n\techo prikazi($komanda);\n\n}", "function get_gup_nihil_unit_usul($tahun){\n // . \"FROM rba_2018.unit LEFT JOIN rsa_2018.trx_gup ON rba_2018.unit.kode_unit = rsa_2018.trx_gup.kode_unit_subunit \"\n // . \"WHERE ( rsa_2018.trx_gup.aktif = '1' OR rsa_2018.trx_gup.aktif IS NULL ) \"\n // . \"AND ( rsa_2018.trx_gup.tahun = '{$tahun}' OR rsa_2018.trx_gup.tahun IS NULL ) \"\n // . \"GROUP BY rba_2018.unit.kode_unit \"\n // . \"ORDER BY rba_2018.unit.kode_unit ASC\";\n\n $query = \"SELECT t1.nama_unit,t1.kode_unit,IFNULL(t3.jml,0) AS jml\nFROM rba_2018.unit t1\nLEFT JOIN (\n SELECT tr1.kode_unit_subunit AS kode_unit,COUNT(tr1.posisi) AS jml \n FROM rsa_2018.trx_gup_nihil AS tr1 \n WHERE tr1.tahun = '{$tahun}' AND tr1.posisi = 'SPM-FINAL-VERIFIKATOR' AND tr1.aktif = '1'\n GROUP BY tr1.kode_unit_subunit\n) AS t3\nON t1.kode_unit = t3.kode_unit\nGROUP BY t1.kode_unit \nORDER BY t1.kode_unit ASC\";\n \n// echo $query; die;\n\n $q = $this->db->query($query);\n\n\t\t$result = $q->result();\n \n// var_dump($result);die;\n\n\t\treturn $result ;\n \n }", "function get_tkd_a_anular($ua=null) {\r\n $where=\"\";\r\n if(isset($ua)){\r\n $where=\" where uni_acad='$ua' and nro_540 is not null \"\r\n . \"and not exists (select * from designacion b\"\r\n . \" where a.uni_acad=b.uni_acad\"\r\n . \" and a.nro_540=b.nro_540\"\r\n . \" and b.check_presup=1 )\";\r\n }\r\n $sql = \"SELECT distinct nro_540 FROM designacion a $where order by nro_540\";\r\n print_r($sql);\r\n return toba::db('designa')->consultar($sql);\r\n }", "public function filterRoomByBranch($id){\n $sql = 'SELECT ROMnature, COUNT(ROMnature) AS countROMnature, USCcode, USCdescTH, USCdescEN FROM ROM LEFT JOIN USC ON ROM.ROMnature = USC.USCcode WHERE (ROMid NOT IN (SELECT BOKromid FROM BOK)) AND ROMdelete = 0 AND ROMbrhid = ' . $id .' AND USCuse = 14 GROUP BY ROMnature ';\n\n $query = $this->db->query($sql);\n $num = $query->num_rows();\n\n if ($num > 0) {\n $row = $query->result_array();\n\n return $row;\n } else {\n return $row = null;\n }\n }", "function newsItem_BacaDataListing_ByKategoriSub_Hotspot_All( $tbl_news , $idkategori, $idkategorisub ){\n\t$sql = mysql_query(\"SELECT * FROM $tbl_news WHERE idkategori = '$idkategori' AND idkategorisub = '$idkategorisub' AND hotspot != '0' ORDER BY id DESC\");\n\treturn $sql;\n}", "function otherpageItem_BacaDataListing_ByKategoriSub_Hotspot_All( $tbl_otherpage , $idkategori, $idkategorisub ){\n\t$sql = mysql_query(\"SELECT * FROM $tbl_otherpage WHERE idkategori = '$idkategori' AND idkategorisub = '$idkategorisub' AND hotspot != '0' ORDER BY judul ASC\");\n\treturn $sql;\n}", "function otherpageItem_BacaDataListing_ByKategoriSub_Pilihan_All( $tbl_otherpage , $idkategori, $idkategorisub ){\n\t$sql = mysql_query(\"SELECT * FROM $tbl_otherpage WHERE idkategori = '$idkategori' AND idkategorisub = '$idkategorisub' AND pilihan != '0' ORDER BY judul ASC\");\n\treturn $sql;\n}", "function otherpageItem_BacaDataListing_ByKategori_Tampil_All( $tbl_otherpage , $idkategori ){\n\t$sql = mysql_query(\"SELECT * FROM $tbl_otherpage WHERE idkategori = '$idkategori' AND statustampil != '0' ORDER BY judul ASC\");\n\treturn $sql;\n}", "function otherpageItem_BacaDataListing_ByKategori_Pilihan_All( $tbl_otherpage , $idkategori ){\n\t$sql = mysql_query(\"SELECT * FROM $tbl_otherpage WHERE idkategori = '$idkategori' AND pilihan != '0' ORDER BY judul ASC\");\n\treturn $sql;\n}", "function otherpageItem_BacaDataListing_ByKategoriSub_DiLampirkan_All( $tbl_otherpage , $idkategori, $idkategorisub ){\n\t$sql = mysql_query(\"SELECT * FROM $tbl_otherpage WHERE idkategori = '$idkategori' AND idkategorisub = '$idkategorisub' AND dilampirkan != '0' ORDER BY judul ASC\");\n\treturn $sql;\n}", "public function getAddressNoltlng(){\n $sql = \"SELECT * FROM $this->tableName WHERE lat IS NULL AND lng IS NULL \";\n $stmt = $this->conn->prepare($sql);\n $stmt->execute();\n return $stmt->fetchAll(PDO::FETCH_ASSOC);\n\n }", "function consultaGrupos($idTutor)\n{\n $sql=\"SELECT DISTINCT gp.id_grupo as id ,\n gp.nombre_grupo as nombre ,\n gp.clave as clave,\n gp.id_escuela as \\\"idEscuela\\\",\n gp.id_empresa as \\\"idEmpresa\\\",\n gp.tipo_grupo as \\\"tipoGrupo\\\" \n FROM rel_curso_tutor r_c_t\n JOIN rel_curso_grupo r_c_g\n ON r_c_t.id_rel_curso_grupo = r_c_g.id_rel_curso_grupo\n JOIN grupo gp\n ON gp.id_grupo = r_c_g.id_grupo \n WHERE \tgp.status = 1\n AND r_c_t.id_tutor = \".$idTutor;\n \n $consultaGrupo= new Query(\"SG\");\n $consultaGrupo->sql=$sql;\n $resultado = $consultaGrupo->select(\"obj\");\n \n return $resultado;\n}", "function selcourt1(){\n\t\t$sql=\"SELECT * FROM gestion WHERE suingdate IS NOT NULL AND judicialdate IS NULL\";\n\t\t$data = $this->selcot($sql);\n\t\treturn $data; \n\t}", "function newsItem_BacaDataListing_ByKategori_Hotspot_All( $tbl_news , $idkategori ){\n\t$sql = mysql_query(\"SELECT * FROM $tbl_news WHERE idkategori = '$idkategori' AND hotspot != '0' ORDER BY id DESC\");\n\treturn $sql;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method: getNumberOfPosts Functionality: Counts the number of posts in a given category passed in as a parameter.
public function getNumberOfPosts( $category_id ) { $numOfPosts = 0; $result = queryDatabase( 'post', 'category_id', "WHERE category_id = '$category_id'", 1 ); while( $row = mysqli_fetch_array($result) ) { $numOfPosts++; } return $numOfPosts; }
[ "function getPostCountInCategory($category) {\n\t\t\tif (is_array($category)) {\n\t\t\t\t$category = $category[\"id\"];\n\t\t\t}\n\t\t\t\n\t\t\treturn sqlrows(sqlquery(\"SELECT btx_dogwood_posts.id FROM btx_dogwood_posts JOIN btx_dogwood_post_categories WHERE btx_dogwood_posts.id = btx_dogwood_post_categories.post AND btx_dogwood_post_categories.category = '\".sqlescape($category).\"' AND (publish_date IS NULL OR publish_date <= '\".date(\"Y-m-d\").\"') AND \".$this->AuthorFilter));\n\t\t}", "private function getNumPages() {\n if($this->category != \"All\") {\n $where = \" WHERE Kitchen_Category.name = '\" . $this->category . \"' \";\n } else {\n $where = \" \";\n }\n\n $query_str = \"\n SELECT Count(Kitchen_Post.id) AS NumPosts\n FROM Kitchen_Post INNER JOIN Kitchen_Category ON Kitchen_Post.category_id = Kitchen_Category.id\n $where;\n \";\n\n $db_query = $this->connection->query($query_str);\n if((!$db_query) || ($db_query->num_rows < 1))\n return Null;\n else {\n $tmp = $db_query->fetch_assoc();\n return $tmp['NumPosts'];\n }\n }", "function count_cat_post($category) {\nif(is_string($category)) {\n\t$catID = get_cat_ID($category);\n} \nelseif(is_numeric($category)) {\n\t$catID = $category;\n} else {\n\treturn 0;\n}\n$cat = get_category($catID);\nreturn $cat->count;\n}", "public function countPosts()\n {\n $db = $this->dbConnect();\n $req = $db->query('SELECT COUNT(*) FROM posts');\n $req->execute();\n $countingPost = $req->fetchColumn();\n \n return $countingPost;\n }", "protected function count_posts() {\n\t\tglobal $wpdb;\n\n\t\t$query = $this->get_count_query();\n\n\t\t$this->total_posts = $wpdb->get_var( $query );\n\t}", "public function countTotalPosts() {\r\n $sql = 'SELECT COUNT(*) AS contenu'\r\n . ' FROM T_POST';\r\n $req = $this->executeRequest($sql);\r\n $numberOfPosts = $req->fetchColumn();\r\n return $numberOfPosts;\r\n }", "public function count_posts() {\n\t\t\n\t\t$data = $this->fetch(\"SELECT id FROM `\" . $this->prefix . \"news`\");\n\t\t$count = count( $data );\n\t\treturn $count;\n\t\t\n\t}", "public function blogPostsNumber() {\r\n global $is_editor;\r\n\r\n $sql = 'SELECT COUNT(`id`) as c FROM `blog_post` WHERE ';\r\n $params = array();\r\n if ($this->course_id != 0) {//course blog\r\n if ($is_editor) {\r\n $sql .= '`course_id` = ?d';\r\n } else {\r\n $sql .= '`course_id` = ?d AND visible = 1';\r\n }\r\n $params[] = $this->course_id;\r\n } else {//user blog\r\n if ($this->user_id == $_SESSION['uid']) {\r\n $sql .= '`course_id` = ?d AND `user_id` = ?d';\r\n } else {\r\n $sql .= '`course_id` = ?d AND visible = 1 AND `user_id` = ?d';\r\n }\r\n $params[] = 0;\r\n $params[] = $this->user_id;\r\n }\r\n $numPosts = Database::get()->querySingle($sql, $params)->c;\r\n return $numPosts;\r\n }", "function count_posts($category, $year = null, $month = null) {\n \tglobal $wpdb;\n \t\n \t// ****** Cache\n \t$cachekey = $category . intval($year) . intval($month);\n $count = wp_cache_get($cachekey, self::$id);\n \tif ($count !== false) return $count;\n \n // ****** Init\n $year = intval($year);\n $month = intval($month);\n $AND_year = '';\n $AND_month = '';\n if ($month > 0 && $month < 13) $AND_month = 'AND MONTH(post_date) = ' . $month;\n if (sizeof($year) == 4) $AND_year = 'AND YEAR(post_date) = ' . $year;\n \n // ****** Query\n $query = \"SELECT COUNT(*) AS num_posts\n FROM {$wpdb->posts} AS p\n INNER JOIN {$wpdb->term_relationships} AS tr ON tr.object_id = p.ID\n INNER JOIN {$wpdb->term_taxonomy} AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id\n INNER JOIN {$wpdb->terms} AS tm ON tm.term_id = tt.term_id\n WHERE\n post_type = 'post'\n AND post_status = 'publish'\n AND tm.name = '%s'\n {$AND_year}\n {$AND_month}\n \";\n $count = $wpdb->get_var($wpdb->prepare($query, $category));\n \n // ****** Cache\n \twp_cache_set($cachekey, $count, self::$id);\n \n // ****** Filter\n return $count;\n }", "private function countCategoryPosts(){\r\n $ressource_properties = array();\r\n $child_arg = array( 'hide_empty' => false, 'parent' => 5 );\r\n $child_cat = get_terms( 'category', $child_arg );\r\n \r\n \r\n foreach( $child_cat as $child_term ) {\r\n\t\t\t$url = get_category_link($child_term->term_id);\r\n\t\t\t\r\n $prop['num_posts'] = $child_term->count;\r\n\t\t\t$prop['url'] = $url;\r\n\t\t\tarray_push($ressource_properties,$prop); \r\n\t\t}\r\n return $ressource_properties;\r\n }", "public function getPostsCountByCategoryId($categoryId){\n\n $sql = \"SELECT * FROM posts WHERE CategoryId = :categoryId\";\n \n $this->db->query($sql);\n $this->db->bind(':categoryId',$categoryId);\n $stmt = $this->db->getStmt();\n $this->db->execute();\n $count = $this->db->rowCount();\n return $count;\n }", "public function getCountPostByCat()\n {\n \n $db = $this->dbConnect();\n $req = $db->query(\"SELECT COUNT(post_id) AS post_id, name FROM cat_post cp JOIN categories c ON cp.cat_id = c.id JOIN posts p ON cp.post_id = p.id WHERE published = TRUE GROUP BY name\");\n\n $categories = array();\n\n while ($data = $req->fetch()) {\n $category = new Category();\n $category->hydrate($data);\n $categories[] = $category;\n\n }\n\n $req->closeCursor();\n\n return $categories;\n }", "public function getPostsCount()\n {\n return $this->posts_count;\n }", "public function getTotalNoOfPosts() {\n $sqlQuery = \"select count(*) from laf873.posts\";\n\n $statement = $this->_dbHandle->prepare($sqlQuery);\n $statement->execute();\n\n $total = $statement->fetchColumn();\n\n return $total;\n }", "public function getNumPosts() {\r\n return $this->num_posts;\r\n }", "public function getNumberPosts()\n {\n return $this->numberPosts;\n }", "public function postCount()\n\t{\n\t\treturn $this->posts()->count();\n\t}", "private function getNumberOfPosts() {\n \treturn $this->properties->getWidgetProperty(self::PROPERTY_POSTS, self::DEFAULT_POSTS);\n }", "public function count( $args, $assoc_args ) {\n\n $language = $this->pll->model->get_language( $args[0] );\n\n $this->cli->success( sprintf( 'Post count: %d', $this->api->count_posts( $language, $assoc_args ) ) );\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new Bo model. If creation is successful, the browser will be redirected to the 'view' page.
public function actionCreate() { $model = new Bo(); if ($model->load(Yii::$app->request->post()) && $model->save()) { //return $this->redirect(['view', 'id' => $model->idbo]); return $this->render('view', [ 'model' => $model, 'provider1' => $this->provider1($model->idbo), 'provider2' => $this->provider2($model->idbo), 'provider3' => $this->provider3($model->idbo), ]); } else { return $this->render('create', [ 'model' => $model, ]); } }
[ "public function actionCreate()\n {\n $model = new BaiduorderZhb();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Bilancio();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Bank();\n\t\t\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->b_id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Bienes();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n $this->layout=\"main\";\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Bienes();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->cod]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Bill();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate() {\n $model = new Bet();\n\n /* if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->bet_id]);\n } else { */\n return $this->render('index', [\n 'model' => $model,\n ]);\n// }\n }", "public function actionCreate(){\n $model = new BrandForm([\n 'brand' => new BrandModel(),\n 'seo' => new SeoModel()\n ]);\n\n if(Yii::$app->request->isPost && $model->save()){\n return $this->redirect([\n 'view',\n 'id' => $model->brand->id\n ]);\n }else{\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n if(Yii::$app->user->can('admin')){\n \n $model = new Birlik();\n \n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n else{\n throw new NotFoundHttpException(\"Sahifa topilmadi\");\n \n }\n }", "public function actionCreate()\n {\n $model = new Objects();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new BotModel();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->b_id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new TaKibBR();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'IDPemda' => $model->IDPemda, 'Kd_Id' => $model->Kd_Id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n if(Yii::$app->user->isGuest){\n return Yii::$app->user->loginRequired();\n }\n\n $model = new Biz();\n $model->level = 1;\n $model->status = 1;\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Bien();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->codebien]);\n } else {\n return $this->renderAjax('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Model();\n $model->setScenario('insert');\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['/admin/model']);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Branches();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new BranchOfCompany();\n $company = ParentCompany::getList();\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n// print_r($model);die;\n $this->redirect(Yii::$app->request->referrer);\n // return $this->redirect(['index']);\n// return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n 'company' => $company,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Brand();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new RoiB();\n\n if ($model->load(Yii::$app->request->post())) {\n //return $this->redirect(['view', 'id' => $model->id]);\n try { \n $this->saveModel(array('model'=>$model));\n } catch (Exception $ex) {\n $transaction->rollBack();\n throw $ex;\n } \n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lists all AnimalesColores models.
public function actionIndex() { $searchModel = new AnimalesColoresSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); }
[ "public function actionIndex()\n {\n $searchModel = new AnimalesSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n\n return $this->render('index', [\n 'especies' => Especies::todas(),\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function all() {\n return $this->app->entityManager->getRepository($this->model_name)->findAll();\n }", "public function listModels()\n\t{\n\t\t$classes = \\SeanMorris\\Ids\\Linker::classes('SeanMorris\\Ids\\Model');\n\n\t\t$classes = array_map(\n\t\t\tfunction($class)\n\t\t\t{\n\t\t\t\treturn str_replace('\\\\', '/', $class);\n\t\t\t}\n\t\t\t, $classes\n\t\t);\n\n\t\tprint implode(PHP_EOL, $classes) . PHP_EOL;\n\t}", "public function all()\n {\n return AnestheticsResource::collection(\n Anesthesia::all()\n );\n }", "public function cochesList(){\n $coches = Coche::orderBy('modelo')->simplePaginate(6);\n\n return view('admin.coches.coches', compact('coches'));\n }", "public function all()\n {\n $discographies = $this->discography->get();\n return response()->json([\n 'items' => $discographies->toArray(),\n 'total' => $discographies->count(),\n ]);\n }", "public function getAllModelos() {\n $sSql = \"\n SELECT *\n FROM tbmodelo\n \";\n $aModelos = [];\n $oSql = $this->Query->query($sSql);\n foreach($oSql->fetchAll(PDO::FETCH_OBJ) as $oObject) {\n $oModelo = new Modelo();\n $oModelo->getMarca()->setCodigo($oObject->marcodigo);\n $oModelo->setCodigo($oObject->modcodigo);\n $oModelo->setAno($oObject->modano);\n $oModelo->setNome($oObject->modnome);\n $aModelos[] = $oModelo;\n }\n return $aModelos;\n }", "public function getAllMccs();", "public function actionAll()\n {\n $model = new Masters();\n\n $comments = $model->getCommentsAll();\n $services = $model->getServices();\n $foto = $model->getFoto();\n $pagination = $model->getPagination(Yii::$app->params['mastersOnPage']);\n $masters = $model->getMastersPagination();\n\n return $this->render('index', [\n 'model' => $model,\n 'masters' => $masters,\n 'comments' => $comments,\n 'services' => $services,\n 'foto' => $foto,\n 'pagination' => $pagination,\n 'mastersOnPage' => Yii::$app->params['mastersOnPage'],\n 'pathToRoot' => Yii::$app->params->pathToRoot\n ]);\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('MDWRosantBundle:Modelo')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('UmgVotacionBundle:AlumnoCurso')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('FantasiaBundle:Modelo')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }", "public function getAllObjects()\n {\n return $this->getObjects();\n }", "public function activeCimas()\n {\n return $this->hasMany('App\\Cima')->where('estado',1);\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('ItesACBackendBundle:Modelo')->findAll();\n\n return array(\n 'entities' => $entities,\n );\n }", "public function getModelsList(){\r\n\t\t$this->db->select(\"id, nome\");\r\n\t\t$this->db->from(\"modelos\");\r\n\t\treturn $this->db->get()->result();\r\n\t}", "public function index()\n\t{\n\t\treturn Media::all();\n\t}", "public function getAllModels(){\n if($this->getRequestType() !== \"GET\") {\n $this->requestError(405);\n }\n $autoModel = AutoModels::model()->findAll();\n\n $this->sendResponse([\"success\" => 1, \"data\" => $autoModel]);\n exit();\n }", "public function clases()\n {\n return $this->belongsToMany('cursos\\Clase', 'rel_alumno_clases', 'alumnos_id', 'clases_id');\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add custom handling fee to an order
function pt_add_handling_fee() { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ($woocommerce->cart->subtotal>=2000){ $fee = 0.00; } else { $fee = 50.00; } $title = 'Delivery Charge'; $woocommerce->cart->add_fee( $title, $fee, TRUE, 'standard' ); }
[ "function pt_add_handling_fee() {\n global $woocommerce;\n if ( is_admin() && ! defined( 'DOING_AJAX' ) )\n return;\n if ($woocommerce->cart->subtotal>=300){\n $fee = 0.00;\n } else {\n $fee = 30.00;\n }\n $title = 'Delivery Charge';\n $woocommerce->cart->add_fee( $title, $fee, TRUE, 'standard' );\n}", "function wc_gateway_ppec_set_transaction_fee( $order, $fee ) {\n\tif ( empty( $fee ) ) {\n\t\treturn;\n\t}\n\t$fee = wc_clean( $fee );\n\tif ( version_compare( WC_VERSION, '3.0', '<' ) ) {\n\t\tupdate_post_meta( $order->id, PPEC_FEE_META_NAME_NEW, $fee );\n\t} else {\n\t\t$order->update_meta_data( PPEC_FEE_META_NAME_NEW, $fee );\n\t\t$order->save_meta_data();\n\t}\n}", "function jr_woocommerce_custom_fee() {\n\n\tif ( ( is_admin() && ! defined( 'DOING_AJAX' ) ) || ! is_checkout() ) {\n\t\treturn;\n\t}\n\n\t$chosen_gateway = WC()->session->chosen_payment_method;\n\n\t$fee = 1.99;\n\n\tif ( $chosen_gateway == 'cod' ) {\n\t\tWC()->cart->add_fee( __( 'Shipping option fee', 'storefront' ), $fee, false, '' );\n\t}\n}", "public function calculate_gateway_fees_order($order_id, wc_order_addfee &$order, $ignore_recalc_option = false)\n\t{\n\t\tglobal $wpdb;\n\t\t\n\t\t$pm = self::get_post_meta_order_default($order_id);\n\t\t\n\t\tif(!$ignore_recalc_option)\n\t\t{\n\t\t\tif (! $pm[woocommerce_additional_fees::OPT_ENABLE_RECALC] == 'yes') return false;\n\t\t}\n\t\t\n\t\t$fees = $pm[self::OPT_KEY_FEE_ITEMS];\n\t\t\n\t\t//\tget totals to subtract deleted fees and add new fees to be able to calculate total order fee (or not if more than limit)\n\t\t$order_taxes = $order->get_tax_totals();\n\t\t$order_tax = (float) 0;\n\t\tforeach ($order_taxes as $tax) \n\t\t{\n\t\t\t$order_tax += $tax->amount;\n\t\t}\n\t\t\n\t\t$order_total = $order->get_total();\n\t\t$order_no_tax = $order_total - $order_tax;\n\t\t\n\t\t//\tremove fee entries from order and from post meta and save\n\t\tforeach ($fees as $item_key => $fee) \n\t\t{\n\t\t\tif($fee->source == self::OPTIONNAME)\n\t\t\t{\n\t\t\t\t//\tcheck, if item exists in DB to correctly adjust total values\n\t\t\t\t$count = $wpdb->get_var( $wpdb->prepare( \"SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id = %d\", $item_key ) );\n\t\t\t\tif($count > 0)\n\t\t\t\t{\t\t\t\n\t\t\t\t\t$order_no_tax -= $fee->amount_no_tax;\n\t\t\t\t\t$order_tax -= $fee->tax_amount;\n\t\t\t\t\t$order_total -= $fee->amount_incl_tax;\n\t\t\t\t}\n\t\t\t\t\t//\ttry to delete in any case to clean DB if anything went wrong\n\t\t\t\twc_delete_order_item( absint( $item_key ) );\n\t\t\t\tunset($pm[self::OPT_KEY_FEE_ITEMS][$item_key]);\n\t\t\t}\n\t\t}\n\t\t\n\t\tupdate_post_meta($order_id, self::KEY_POSTMETA_ORDER, $pm);\n\t\t\n\t\t$items = $order->get_items();\n\t\t$tax = new WC_Tax();\n\t\t$new_fees = array();\t\t//\tsave new fees temporarily to insert all fees later at once\n\t\t\n\t\tif ( sizeof( $items ) > 0 && $this->options[self::OPT_ENABLE_PROD_FEES])\n\t\t{\n\t\t\tforeach ( $items as $item_key => $item ) \n\t\t\t{\n\t\t\t\t$_product = $order->get_product_from_item($item);\n\t\t\t\tif(! $_product)\tcontinue;\n\t\t\t\t\n\t\t\t\t$total_excl = $item['line_total'];\n\t\t\t\t$total_incl = $item['line_total'] + $item['line_tax'];\n\t\t\t\t\n\t\t\t\t$fees_calc = $this->calculate_gateway_fee_product($_product, $tax, $order->prices_include_tax, $total_excl, $total_incl, $item['qty']);\n\t\t\t\t\n\t\t\t\tif(! empty($fees_calc))\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\t$fees_calc->order_item_id[] = $item_key;\n\t\t\t\t\t$new_fees[] = $fees_calc;\n\t\t\t\t\t$order_no_tax += $fees_calc->amount_no_tax;\n\t\t\t\t\t$order_tax += $fees_calc->tax_amount;\n\t\t\t\t\t$order_total += $fees_calc->amount_incl_tax;\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t$fees_calc = $this->calculate_gateway_fee_total($tax, $order->prices_include_tax, $order_no_tax, $order_total);\n\t\tif(! empty($fees_calc))\n\t\t{\t\t\t\t\n\t\t\t$new_fees[] = $fees_calc;\n\t\t}\n\t\t\n\t\t$cart = new WC_Cart();\n\t\t\n\t\tif(count($new_fees) > 0)\n\t\t{\n\t\t\tforeach ($new_fees as &$fee) \n\t\t\t{\n\t\t\t\t$this->add_fee_to_cart($fee, $cart);\n\t\t\t}\n\t\t\n\t\t\t$wc_fees = $cart->get_fees();\n\t\t\t$order->add_new_fees($wc_fees);\n\t\t}\n\t\t\n\t\t$order->update_payment_method($this->payment_gateway_key, $this->gateways[$this->payment_gateway_key]->title);\n\t\t$order->recalc_totals();\n\t\t\n\t\treturn true;\n\t}", "public function setForwarderFee(float $amount): SupplierOrderInterface;", "function calculate_order_fee($order_total, $fee) {\n list($fixed_fee, $percent_fee) = explode(':', $fee);\n return ((float) $fixed_fee + (float) $order_total * ($percent_fee / 100));\n }", "public function handlePaymentFee(Varien_Event_Observer $observer)\n {\n try {\n $paymentMethod = $observer->getEvent()->getData('input')->getData('method');\n $quote = Mage::getSingleton('checkout/session')->getQuote();\n $sku = Mage::getStoreConfig('payment/' . $paymentMethod . '/payment_fee', $quote->getStoreId());\n if(!empty($sku)) {\n if(Mage::helper('ratepay/payment')->isRatepayPayment($paymentMethod)) {\n $flag = true;\n foreach ($quote->getAllItems() as $item) {\n if ($item->getSku() == $sku) {\n $item->calcRowTotal();\n $flag = false;\n }\n }\n\n if ($flag) {\n $product = Mage::getModel('catalog/product');\n $id = $product->getIdBySku($sku);\n if(!empty($id)) {\n $product->load($id);\n $item = $quote->addProduct($product);\n $item->calcRowTotal();\n }\n }\n } else {\n foreach ($quote->getAllItems() as $item) {\n if ($item->getSku() == $sku) {\n $quote->removeItem($item->getId());\n }\n }\n }\n $quote->collectTotals();\n }\n } catch(Exception $e){\n Mage::logException($e);\n }\n }", "private function addTransactionFeeToOrder( $raw_fee, $order_id ) {\n\t\t// Fetch language\n\t\t$this->load->language( 'extension/payment/' . $this->getInstanceName() );\n\n\t\t// Order Totals\n\t\t$data['totals'] = array();\n\t\t$order_total_query = $this->db->query( \"SELECT * FROM `\" . DB_PREFIX . \"order_total` WHERE order_id = '\" . (int) $order_id . \"' ORDER BY sort_order ASC\" );\n\t\tforeach ( $order_total_query->rows as $total ) {\n\t\t\t$data['totals'][] = array(\n\t\t\t\t'order_id' => $total['order_id'],\n\t\t\t\t'code' => $total['code'],\n\t\t\t\t'title' => $total['title'],\n\t\t\t\t'value' => $total['value'],\n\t\t\t\t'sort_order' => $total['sort_order'],\n\t\t\t);\n\t\t}\n\n\t\t// Add fee to data object\n\t\t$fee = $raw_fee / 100;\n\t\t$data['totals'][] = array(\n\t\t\t'code' => 'coolpay_fee',\n\t\t\t'title' => $this->language->get( 'payment_fee' ),\n\t\t\t'value' => floatval( $fee ),\n\t\t\t'sort_order' => 8,\n\t\t);\n\n\t\t// Delete totals and re-add\n\t\t$this->db->query( \"DELETE FROM \" . DB_PREFIX . \"order_total WHERE order_id = '\" . (int) $order_id . \"'\" );\n\n\t\tif ( isset( $data['totals'] ) ) {\n\t\t\tforeach ( $data['totals'] as $total ) {\n\t\t\t\t// Add fee to the total price\n\t\t\t\tif ( $total['code'] === 'total' ) {\n\t\t\t\t\t$total['value'] += $fee;\n\n\t\t\t\t\t// Update the order entry\n\t\t\t\t\t$this->db->query( \"UPDATE \" . DB_PREFIX . \"order SET total = '{$total['value']}' WHERE order_id = '{$order_id}'\" );\n\n\t\t\t\t}\n\t\t\t\t// Add totals to the DB\n\t\t\t\t$this->db->query( \"INSERT INTO \" . DB_PREFIX . \"order_total SET order_id = '\" . (int) $order_id . \"', code = '\" . $this->db->escape( $total['code'] ) . \"', title = '\" . $this->db->escape( $total['title'] ) . \"', `value` = '\" . (float) $total['value'] . \"', sort_order = '\" . (int) $total['sort_order'] . \"'\" );\n\t\t\t}\n\t\t}\n\n\t\t// Add notice in the log\n\t\t$this->log->write( 'Add fee: ' . $fee . ' to order: ' . $order_id );\n\t}", "function commerce_collector_fee_line_item($payment_method, $order, $delete = FALSE) {\n\n if (!_commerce_collector_line_item_exists($order) && !$delete) {\n\n if ($payment_method['settings']['commerce_collector_login']['commerce_collector_fee']) {\n\n // Create the new line item.\n $line_item = commerce_line_item_new('collector_fee', $order->order_id);\n\n // Wrap the line item to simplify manipulating their field data.\n $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);\n\n // Populate the $line_item_wrapper...\n $line_item_wrapper->line_item_label = t('Invoice fee');\n $line_item_wrapper->quantity = 1;\n $line_item_wrapper->commerce_unit_price->amount = $payment_method['settings']['commerce_collector_login']['commerce_collector_fee_amount'];\n $line_item_wrapper->commerce_unit_price->currency_code = commerce_default_currency();\n\n // Set the price component of the unit price.\n $line_item_wrapper->commerce_unit_price->data = commerce_price_component_add(\n $line_item_wrapper->commerce_unit_price->value(),\n 'collector_fee',\n $line_item_wrapper->commerce_unit_price->value(),\n TRUE,\n FALSE\n );\n commerce_line_item_save($line_item);\n\n $order_wrapper = entity_metadata_wrapper('commerce_order', $order);\n $order_wrapper->commerce_line_items[] = $line_item;\n return commerce_order_save($order);\n }\n }\n return FALSE;\n}", "protected function processPaymentFee()\n {\n $local = $this->getConstant('XML_CONFIG_FEE_LOCAL');\n $foreign = $this->getConstant('XML_CONFIG_FEE_FOREIGN');\n $sgOrder = $this->getShopgateOrder();\n\n if (Mage::getStoreConfig($local) || Mage::getStoreConfig($foreign)) {\n $sgOrder->setAmountShopPayment(0);\n }\n }", "public function getOrderFee(string $orderNumber): OrderFee;", "public function custom_shipping_fee($fee) {\n $this->shipping_fees[] = $fee;\n }", "public function handler_wc_add_order_fee_meta( $order_id, $item_id, $fee, $fee_key )\n\t{\n\t\t//\tonly handle our fees\n\t\tif( empty( $fee->data_source) ) \n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif( ! $fee->data_source instanceof WC_Fee_Add_Fees ) \n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif( $fee->data_source->source != self::OPTIONNAME ) \n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t\t\t\n\t\t$pm = self::get_post_meta_order_default( $order_id );\n\t\t\n\t\t$pm[self::OPT_KEY_FEE_ITEMS][ $item_id ] = $fee->data_source;\n\t\tupdate_post_meta( $order_id, self::KEY_POSTMETA_ORDER, $pm );\n\t}", "public function handle_custom_fee($_cart = null) {\n if ($_cart) {\n $cart = WC()->cart->get_cart();\n $cart_total = WC()->cart->cart_contents_total;\n foreach ($cart as $key => $citem) {\n foreach ($citem as $ckey => $cval) {\n if (strpos($ckey, \"wccpf_\") !== false && isset($citem[$ckey][\"fee_rules\"]) && $citem[$ckey][\"user_val\"]) {\n $ftype = $citem[$ckey][\"ftype\"];\n $dformat = $citem[$ckey][\"format\"];\n $uvalue = $citem[$ckey][\"user_val\"];\n $f_rules = $citem[$ckey][\"fee_rules\"];\n /* Iterate through the rules and update the price */\n foreach ($f_rules as $frule) {\n if ($this->check_rules($frule, $uvalue, $ftype, $dformat)) {\n $is_tax = isset( $frule[\"is_tx\"] ) && $frule[\"is_tx\"] == \"non_tax\" ? false : true;\n $fee_amount = isset( $frule[\"tprice\"] ) && $frule[\"tprice\"] == \"cost\" ? $frule[\"amount\"] : ( floatval ( $frule[\"amount\"] ) / 100 ) * $cart_total;\n WC()->cart->add_fee($frule[\"title\"], $fee_amount, $is_tax, \"\");\n }\n }\n }\n }\n }\n }\n }", "public function getHandlingFee()\n {\n return $this->handling_fee;\n }", "public function add_invoice_fee() {\n\t\t$current_gateway = WC_Gateway_Svea_Helper::get_current_gateway();\n\n\t\tif( ! $current_gateway ||\n\t\t\tget_class( $current_gateway ) != \"WC_Gateway_Svea_Invoice\" ) {\n\t\t\treturn;\n\t\t}\n\n\t\tWC_Gateway_Svea_Invoice::init()->add_invoice_fee();\n\t}", "function gdcwc_maybe_add_fee( $new_order, $subscription, $type ) {\n\n\tif ( 'renewal_order' !== $type ) {\n\t\treturn $new_order;\n\t}\n\n\t// Check line items for post trial fee (WC_Order_Item)\n\t$items = $subscription->get_items();\n\n\tforeach ( $items as $item ) {\n\t\t// Check subscription for meta\n\t\t$post_trial_fee = get_post_meta( $subscription->get_id(), '_subscription_post_trial_fee', true );\n\n\t\tif ( '' !== $post_trial_fee ) {\n\n\t\t\t// add fee to order and recalculate\n\t\t\ttry {\n\t\t\t\t$fee = new WC_Order_Item_Fee();\n\t\t\t\t$fee->set_amount( $post_trial_fee );\n\t\t\t\t$fee->set_total( $post_trial_fee );\n\t\t\t\t$fee->set_name( __( 'Post Trial Fee', 'wc-subs-post-trial-fee' ) );\n\t\t\t\t$fee->save();\n\n\t\t\t\t$new_order->add_item( $fee );\n\t\t\t\t$new_order->save();\n\t\t\t\t$new_order->calculate_totals();\n\t\t\t} catch ( Exception $e ) {\n\t\t\t\t// TODO do something\n\t\t\t\t$new_order->add_order_note( 'Failed to add Post Trial Fee' );\n\t\t\t}\n\t\t\t// remove meta from subscription\n\t\t\tdelete_post_meta( $subscription->get_id(), '_subscription_post_trial_fee' );\n\t\t}\n\t}\n\treturn $new_order;\n}", "private function calculateFOBPriceAction()\n {\n // than 99, then modify shippingPrice to 0.00 \n \t$price = $this->info['productPrice'];\n if($price <= 99){\n $shippingPrice = $this->info['shippingPrice'];\n }\n else{\n $this->info['shippingPrice'] = 0.0;\n }\n $this->info['fobPrice'] = ($price + $shippingPrice) * 1.07; // It also adds US TAXes\n }", "public function onFeesSet() {\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generated from protobuf field repeated string channels = 6;
public function setChannels($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->channels = $arr; return $this; }
[ "public function setChannels($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::STRING);\n $this->Channels = $arr;\n\n return $this;\n }", "public function setChannels(array $channels): self;", "public function setChannels(array $channels);", "public function channelsFromString()\n {\n if (func_num_args() == 0) {\n return $this->getChannelsFromString();\n }\n\n $this->setChannelsFromString(func_get_arg(0));\n\n return $this;\n }", "public function setChannels($channels = []);", "public function addChannels(array $channels);", "public function setChannels($var)\n {\n GPBUtil::checkInt32($var);\n $this->Channels = $var;\n\n return $this;\n }", "public function set_channels($channels)\n\t{\n\t\t$this->channels = $channels;\n\t}", "public function getChannels();", "public function setChannels($v)\n\t{\n\r\n\t\t// Since the native PHP type for this column is integer,\r\n\t\t// we will cast the input value to an int (if it is not).\r\n\t\tif ($v !== null && !is_int($v) && is_numeric($v)) {\r\n\t\t\t$v = (int) $v;\r\n\t\t}\r\n\n\t\tif ($this->channels !== $v || $v === 1) {\n\t\t\t$this->channels = $v;\n\t\t\t$this->modifiedColumns[] = PerfilPeer::CHANNELS;\n\t\t}\n\n\t}", "public function setChannels($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\Google\\Cloud\\Container\\V1\\ServerConfig\\ReleaseChannelConfig::class);\n $this->channels = $arr;\n\n return $this;\n }", "public function setChannels($v)\n\t{\n\r\n\t\t// Since the native PHP type for this column is integer,\r\n\t\t// we will cast the input value to an int (if it is not).\r\n\t\tif ($v !== null && !is_int($v) && is_numeric($v)) {\r\n\t\t\t$v = (int) $v;\r\n\t\t}\r\n\n\t\tif ($this->channels !== $v || $v === 1) {\n\t\t\t$this->channels = $v;\n\t\t\t$this->modifiedColumns[] = FilePeer::CHANNELS;\n\t\t}\n\n\t}", "public function setPendingChannels($input);", "public function getChannels(): array\n {\n return $this->channels;\n }", "abstract public function listChannels (): array;", "function getarray_channelsname($run, $detector) {\n \t $channels = array();\n foreach ($this->runlist[$run]['detectors'][$detector]['channels'] as $i => $channel) {\n $channels[ $channel['channelname'] ] = $i;\n } \n return $channels;\n \t}", "function showChannels()\n {\n $parameters = array('Command'=>'core show channels concise');\n $data = $this->AsteriskManagerAPI('Command',$parameters,true);\n $arrChannels = explode(\"\\n\",$data['data']);\n $arrData = null;\n\n if(is_array($arrChannels) & count($arrChannels)>0){\n foreach($arrChannels as $key => $line){\n $tmp = explode(\"!\",$line);\n if(count($tmp) > 10){\n //$tmp[0] channel que orginina la llamada TECHNOLOGY/USER-uniquecode\n $dev=explode(\"/\",$tmp[0]);\n if(is_array($dev) && count($dev)==2){\n if($dev[0]!=\"Local\"){\n $pos=strpos($dev[1],\"-\");\n if($pos!==false){\n $user=substr($dev[1],0,$pos);\n $arrData[$user] = array(\n 'context' => $tmp[1],//para ver si es macro-dialout-trunk\n 'state' => $tmp[4],\n 'data' => $tmp[6],//para ver la troncal que es casi igual a tmp[11]\n //'callerid' => $tmp[8],\n 'time' => $this->Sec2HHMMSS($tmp[11]),\n 'dstn' => $tmp[12],\n 'ext' => $tmp[2]\n //'brigedto' => $tmp[12],\n );\n }\n }\n }\n }\n }\n }\n return $arrData;\n }", "public function setChannels($channels)\n\t{\n\t\t# Clean it up...\n\t\t$channels=trim($channels);\n\t\t# $channels should equal 3 for RGB pictures and 4 for CMYK pictures.\n\t\tif(($channels==3) || ($channels==4))\n\t\t{\n\t\t\t$this->channels=$channels;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public function setNumChannels($var)\n {\n GPBUtil::checkUint32($var);\n $this->num_channels = $var;\n\n return $this;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step to wait one second. [Grrr. This is messy.]
public function i_wait_one_second() { sleep(1); }
[ "public function waitOneSecond(): void;", "public function step(){\t\t\r\n\t\treturn $this->time++;\t\t\r\n\t}", "final private function __sleep() {}", "function Wait( $time ) {\n for( $i=0; $i<$time; $i++){\n $nn=$i*2;\n }\n }", "function wait($n=1)\n {if(!is_int($n)){$n=1;}; if($n<1){$n=1;}; $t=($n*1000); usleep($t);}", "function sleep($seconds) {}", "public function wait($time, $number);", "public function wait($seconds = 0);", "public function sleep($time);", "function wait($timeout=0.0) {}", "public function wait()\n {\n // 2^attempts\n $upper = (1 << ++$this->attempts) - 1;\n\n // random(0, $upper) * slot wait\n $waitTime = mt_rand(0, $upper) * $this->waitPerSlot;\n\n if ($waitTime > $this->maxWait) {\n $waitTime = $this->maxWait;\n }\n\n usleep($waitTime * WaitStrategy::MICROSECONDS_PER_SECOND);\n }", "function wait( $timeInMilliSeconds ) {\n\n\t$timeInSeconds = floor( $timeInMilliSeconds / 1000 );\n\t$timeInNanoSeconds = ( $timeInMilliSeconds % 1000 ) * 1000;\n\t$nanoSeconds = time_nanosleep( $timeInSeconds, $timeInNanoSeconds );\n\tif( $nanoSeconds === true ) {\n\t\t//echo \"Hello\\n Hello\\n Hello\\n Hello\\n Hello\";\n\t}\n\n}", "protected function sleep(): void\n\t{\n\t\tusleep(static::SLEEP_TIME);\n\t}", "public function sleep()\n {\n usleep($this->speed);\n }", "public function delay ($t) {\n\t\t#/usr/share/haxe/std/haxe/MainLoop.hx:29: characters 3-72\n\t\t$this->nextRun = ($t === null ? \\Math::$NEGATIVE_INFINITY : microtime(true) + $t);\n\t}", "protected function pause()\n {\n sleep(1);\n }", "public function wait(): void {}", "function ncurses_halfdelay($tenth) {}", "function swf_actionwaitforframe($frame, $skipcount) {}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle the Ajax request to get the PHP session ID
function iphorm_get_session_id_ajax() { header('Content-Type: application/json'); echo iphorm_json_encode(array( 'type' => 'success', 'id' => session_id() )); exit; }
[ "public function getSessionID()\n {\n $headers = get_headers(self::BASE_URL);\n return $this->extractSessionID($headers);\n }", "public function getAjaxID() {}", "function api_get_session_id()\n{\n return Session::read('id_session', 0);\n}", "protected function getClientSessionID()\r\n {\r\n if (!function_exists('getallheaders')) {\r\n $headers = array();\r\n foreach ($_SERVER as $name => $value) {\r\n if (substr($name, 0, 5) == 'HTTP_') {\r\n $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;\r\n }\r\n }\r\n } else {\r\n $headers = getallheaders();\r\n }\r\n\r\n if (isset($headers['Authorization']) && strpos($headers['Authorization'], 'Bearer') === 0) {\r\n $headers['Authorization'] = substr($headers['Authorization'], 7);\r\n return $headers['Authorization'];\r\n }\r\n if (isset($_GET['access_token'])) {\r\n return $_GET['access_token'];\r\n }\r\n if (isset($_POST['access_token'])) {\r\n return $_POST['access_token'];\r\n }\r\n if (isset($_GET['sso_session'])) {\r\n return $_GET['sso_session'];\r\n }\r\n\r\n return false;\r\n }", "private static function getSessionId()\n {\n $token = Cookie::Get(static::$tokenKey);\n if( false!==$token )\n {\n static::$token = $token;\n return ;\n }\n\n $token = Request::Get(static::$tokenKey);\n if( false!==$token )\n {\n static::$token = $token;\n return ;\n }\n\n $token = Request::Post(static::$tokenKey);\n if( false!==$token )\n {\n static::$token = $token;\n return ;\n }\n\n static::generateSession();\n }", "public function getIdFromRequest() {\r\n\t\t$request = $this->request();\r\n\t\t\r\n\t\t// Check for the session id cookie\r\n\t\tif (($cookieid = $request->getCookie($this->cookiename['id'])) !== null) {\r\n\t\t\t$sessionid = $cookieid;\r\n\t\t\t$this->type = self::TYPECOOKIE;\r\n\t\t\t$this->appendSessionId = '';\r\n\t\t} else {\r\n\t\t\t// No cookie, so check the URI\r\n\t\t\t$sessionid = $request->getParam($this->settings->sessionidname, '');\r\n\t\t\t$this->type = self::TYPEURI;\r\n\t\t}\r\n\t\t\r\n\t\treturn $sessionid;\r\n\t}", "public function GetSessionID()\n {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $this->url);\n curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($ch, CURLOPT_USERPWD, $this->username.':'.$this->password);\n curl_setopt($ch, CURLOPT_HEADER, false);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);\n curl_setopt($ch, CURLOPT_TIMEOUT, 30);\n $content = curl_exec($ch);\n $error_code = curl_errno($ch);\n $error_message = curl_error($ch);\n $http_status_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));\n\n if ($this->debug) {\n var_dump($http_status_code);\n var_dump($error_message);\n var_dump($error_code);\n var_dump($content);\n }\n\n // 401 Invalid username/password\n // 409 成功\n // 其他 Unexpected response from Transmission RPC\n curl_close($ch);\n if($content && preg_match(\"/<code>X-Transmission-Session-Id: (.*?)<\\/code>/\", $content, $match)) {\n $this->session_id = isset($match[1]) ? $match[1] : null;\n }\n\n return $this->session_id;\n }", "public function sessionid ()\r\n {\r\n return session_id();\r\n }", "public function getSessionID()\r\n {\r\n return $this->plugin->getSessionID();\r\n }", "private function json_session_id_details()\r\n {\r\n if ($_REQUEST['sessionId']) {\r\n $sessionId = $_REQUEST['sessionId'];\r\n \r\n $query = \"SELECT title, abstract, award, content.contentId FROM content\r\n JOIN sessions_content ON sessions_content.contentId=content.contentId\r\n WHERE sessionId='$sessionId'\";\r\n\r\n return json_encode(['status' => 200, 'payload' => $this->recordset->getJSONRecordSet($query, [])]);\r\n } else {\r\n return json_encode(['status' => 503, 'payload' => 'Missing parameter: sessionId.']);\r\n }\r\n }", "public function getSessionid()\n {\n return $this->sessionid;\n }", "public function userSessionId(){\n\t\tif(isset($_SESSION['user_id'])){\n\t\t\treturn $_SESSION['user_id'];\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n\t}", "public function getSessionID()\n {\n return session_id();\n }", "public static function getSessionID()\n {\n return session_id();\n }", "function getSessionId() {\r\n return getAllHeaders()['X-Session-Id'];\r\n}", "function getSid(){\r\n\t$objResponse = new xajaxResponse();\t\r\n\t$sid = md5(uniqid(rand()).date(\"YmdHis\"));\r\n\t$objResponse->script(\"sid='\".$sid.\"';\");\r\n\treturn $objResponse;\r\n}", "private function retrieveMetaLibSessionId() {\n\t\ttry {\n\t\t\t//Retrieve ML session id\n\t\t\t$ml_auth = simplexml_load_string(getXML($this->metalib_url.\"/X?op=login_request&user_name=\".$this->metalib_user.\"&user_password=\".$this->metalib_pass));\n\t\t\t$ml_auth_path = $ml_auth->xpath(\"//session_id\");\n\n\t\t\tif ($ml_auth_path[0] instanceof SimpleXMLElement) {\n\t\t\t \treturn $ml_auth_path[0][0];\n\t\t\t} else {\n\t\t\t\tthrow new Exception(\"retrieveMetaLibSessionId: could not retrieve metalib session\");\n\t\t\t}\n\t\t} catch (Exception $e) {\n\t\t\tprint \"Error: \" . $e->getMessage();\n\t\t\texit ;\n\t\t}\n\t}", "public function getUserSessionId() {\n if (isset($_SESSION['user_id'])) {\n return $_SESSION['user_id'];\n }\n }", "public function get_session_id() {\n if ($this->config->get('omega.scope') == 'session') {\n return $this->response->get_cookie_prefix() . $this->session_id;\n } else {\n return null;\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds and displays a Bulto entity.
public function showAction() { $em = $this->getDoctrine()->getManager(); $id = $_GET['id']; $entity = $em->getRepository('BackendBundle:Bulto')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Bulto entity.'); } return $this->render('BackendBundle:Bulto:show.html.twig', array( 'entity' => $entity )); }
[ "public function showAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $tournois = $em->getRepository('EntityBundle:Tournoi')->findAll();\n return $this->render('tournoi/show.html.twig', array(\n 'tournois' => $tournois,\n\n ));\n }", "function action_show_entity_detail() {\n $rc = rcmail::get_instance();\n\n /** @var rcmail_output_html $output */\n $output = $rc->output;\n\n $type = $this->getInput(self::INPUT_ENTITY_TYPE, rcube_utils::INPUT_GET);\n\n switch ($type) {\n case self::ENTITY_FILTER:\n $title = $this->gettext('rubik_filter.title_filter_form');\n break;\n case self::ENTITY_VACATION:\n $title = $this->gettext('rubik_filter.title_vacation_form');\n break;\n case self::ENTITY_REPLY:\n $title = $this->gettext('rubik_filter.title_reply_form');\n break;\n default:\n $title = '';\n break;\n }\n\n $output->set_env('rubik_details_title', $title);\n\n $output->send('rubik_filter.rubik_entity_details');\n }", "public function showAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BackendBundle:Recibo')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Recibo entity.');\n }\n\n return $this->render('BackendBundle:Recibo:show.html.twig', array(\n 'entity' => $entity,\n ));\n }", "public function showAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('EmpruntBundle:Besoin')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Besoin entity.');\n }\n\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('EmpruntBundle:Besoin:show.html.twig', array(\n 'entity' => $entity,\n 'delete_form' => $deleteForm->createView(), ));\n }", "public function showAction(Bu $bu)\n {\n $deleteForm = $this->createDeleteForm($bu);\n\n return $this->render('bu/show.html.twig', array(\n 'bu' => $bu,\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function show()\n {\n // get data\n $data = $this->model->get();\n\n // print_r($data); die();\n\n // render data\n $this->twig->render($this->template, $data);\n }", "public function showAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('AcmeReservasBundle:Obra')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Obra entity.');\n }\n\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('AcmeReservasBundle:Obra:show.html.twig', array(\n 'entity' => $entity,\n 'delete_form' => $deleteForm->createView(), ));\n }", "public function showAction($id) {\n $emRole = $this->getDoctrine()->getManager();\n $roles = ($this->getUser()) ? $this->getUser()->getRoles() : array(null);\n $role = $emRole->getRepository('FdrAdminBundle:Role')->findOneByNomRole(substr(strtoupper($roles[0]), 5));\n $methodes = array('getAffBonCarburantHuile', 'getCrBonCarburantHuile', 'getUpBonCarburantHuile', 'getDelBonCarburantHuile');\n $this->get('entitie_manager')->ayantRoles($this, $role, $emRole, $methodes);\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('FdrAdminBundle:BonCarburantHuile')->find($id);\n\n if (!$entity) {\n $this->get('session')->getFlashBag()->add('notFoundException', 'Impossible de trouver boncarburanthuile ayant code=' . $id);\n return $this->redirect($this->generateUrl('boncarburanthuile'));\n }\n\n //---\n $form = $this->createForm(new BonCarburantHuileType(), $entity);\n //---\n\n return $this->render('FdrAdminBundle:BonCarburantHuile:show.html.twig', array(\n 'entity' => $entity,\n //--\n 'form' => $form->createView(),\n 'role' => $role\n //--\n ));\n }", "public function showAction()\n {\n $em = $this->getDoctrine()->getEntityManager();\n\n //get post\n $getSelectPage = @$_GET['numPage'];\n $getRecord = @$_GET['record'];\n $getTextSearch = @$_GET['textSearch'];\n $getOrderBy = @$_GET['orderBy'];\n $getOrderByType = @$_GET['orderByType'];\n\n //set paging\n $page = 1;\n if (!empty($getSelectPage)) {\n $page = $getSelectPage;\n }\n $limit = 10;\n $midRange = 5;\n if (!empty($getRecord)) {\n $limit = $getRecord;\n } else {\n $getRecord = $limit;\n }\n $offset = $limit * $page - $limit;\n if (empty($getOrderBy) && empty($getOrderByType)) {\n $getOrderBy = 'id';\n $getOrderByType = 'asc';\n }\n $getEntitiesAll = $em->getRepository('FTRWebBundle:User_owner')->findBy(array('deleted' => 0));\n $countListEntities = count($getEntitiesAll);\n\n $entities = $em->getRepository('FTRWebBundle:User_owner')->getDataOwner($limit, $offset, $getTextSearch, $countListEntities, \"$getOrderBy\");\n $paginator = new Paginator($countListEntities, $offset, $limit, $midRange);\n\n return $this->render('FTRAdminBundle:User_owner:show.html.twig', array(\n 'entities' => $entities,\n 'paginator'\t => $paginator,\n 'countListEntities'\t\t=> $countListEntities,\n 'limit' \t => $limit,\n 'noPage'\t => $page,\n 'record'\t => $getRecord,\n 'textSearch' => $getTextSearch,\n 'orderBy' => $getOrderBy\n ));\n }", "public function showAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('CroisiereBundle:Bateau')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Bateau entity.');\n }\n\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('CroisiereBundle:Bateau:show.html.twig', array(\n 'entity' => $entity,\n 'delete_form' => $deleteForm->createView(), ));\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('InventarioBundle:Bien')->findAll();\n\n return $this->render('InventarioBundle:Bien:index.html.twig', array(\n 'entities' => $entities,\n ));\n }", "function simple_entity_view($simple_entity) {\n drupal_set_title(entity_label('simple_entity', $simple_entity));\n return entity_view('simple_entity', array(entity_id('simple_entity', $simple_entity) => $simple_entity), 'full');\n}", "public function showAction($id)\r\n {\r\n $em = $this->getDoctrine()->getManager();\r\n $entity = $em->getRepository('CentrohipicoBundle:DataOperadora')->find($id);\r\n \r\n return $this->render('CentrohipicoBundle:DataOperadora:show.html.twig', array(\r\n 'entity' => $entity\r\n ));\r\n }", "public function show(Conjunto $conjunto)\n {\n //\n }", "public function showAction() {\n $id = $this->getRequest()->get(\"id\");\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BackendBundle:Feast')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Feast entity.');\n }\n\n $deleteForm = $this->createDeleteForm($id);\n\n return array(\n 'entity' => $entity,\n 'delete_form' => $deleteForm->createView(),\n );\n }", "public function showAction($id) {\r\n\t\t$em = $this->getDoctrine ()->getManager ();\r\n\t\t\r\n\t\t$entity = $em->getRepository ( 'AppBundle:Gramfoodklembowdok' )->find ( $id );\r\n\t\t\r\n\t\tif (! $entity) {\r\n\t\t\tthrow $this->createNotFoundException ( 'Unable to find Gramfoodklembowdok entity.' );\r\n\t\t}\r\n\t\t\r\n\t\treturn $this->render ( 'GramfoodMagazynBundle:Default:show.html.twig', array (\r\n\t\t\t\t'entity' => $entity\r\n\t\t) );\r\n\t}", "public function displayEntityBrowser();", "public function showAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BackendBundle:Founder')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Founder entity.');\n }\n\n return $this->render('BackendBundle:Founder:show.html.twig', array(\n 'entity' => $entity,\n ));\n }", "public function showAction($id) {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('TechTBundle:Tbreltecnicoproyecto')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Tbreltecnicoproyecto entity.');\n }\n\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('TechTBundle:Tbreltecnicoproyecto:show.html.twig', array(\n 'entity' => $entity,\n 'delete_form' => $deleteForm->createView(),));\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Upgrade states for an attempt to Moodle 1.5 model Any state that does not yet have its timestamp set to nonzero has not yet been upgraded from Moodle 1.4 The reason these are still around is that for large sites it would have taken too long to upgrade all states at once. This function sets the timestamp field and creates an entry in the question_sessions table.
function quiz_upgrade_states($attempt) { global $CFG; // The old quiz model only allowed a single response per quiz attempt so that there will be // only one state record per question for this attempt. // We set the timestamp of all states to the timemodified field of the attempt. execute_sql("UPDATE {$CFG->prefix}question_states SET timestamp = '$attempt->timemodified' WHERE attempt = '$attempt->uniqueid'", false); // For each state we create an entry in the question_sessions table, with both newest and // newgraded pointing to this state. // Actually we only do this for states whose question is actually listed in $attempt->layout. // We do not do it for states associated to wrapped questions like for example the questions // used by a RANDOM question $newest->attemptid = $attempt->uniqueid; $questionlist = quiz_questions_in_quiz($attempt->layout); if ($questionlist and $states = get_records_select('question_states', "attempt = '$attempt->uniqueid' AND question IN ($questionlist)")) { foreach ($states as $state) { $session->newgraded = $state->id; $session->newest = $state->id; $session->questionid = $state->question; insert_record('question_sessions', $session, false); } } }
[ "function xmldb_tquiz_upgrade($oldversion) {\n global $DB;\n\n $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes\n\n\n // \n if ($oldversion < 2014111901) {\n\n // Define field timecreated to be added to tquiz\n $table = new xmldb_table('tquiz_questions');\n $field = new xmldb_field('questionaudiofname', XMLDB_TYPE_TEXT, null, null, null, null, null);\n\n // Add field timecreated\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Another save point reached\n upgrade_mod_savepoint(true, 2014111901, 'tquiz');\n }\n\t\n\tif ($oldversion < 2014112201) {\n $table = new xmldb_table('tquiz_attempt');\n $table->add_field('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n\t\t$table->add_field('type', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n $table->add_field('tquizid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n $table->add_field('userid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n $table->add_field('status', XMLDB_TYPE_CHAR, 255, null, XMLDB_NOTNULL, null, null);\n\t\t$table->add_field('score', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n $table->add_field('timecreated', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));\n if (!$dbman->table_exists($table)) {\n $dbman->create_table($table);\n }\n\t\t\n\t\t$table = new xmldb_table('tquiz_attempt_log');\n $table->add_field('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n $table->add_field('attemptid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n $table->add_field('eventkey', XMLDB_TYPE_CHAR, 255, null, XMLDB_NOTNULL, null, null);\n $table->add_field('eventvalue', XMLDB_TYPE_CHAR, 255, null, XMLDB_NOTNULL, null, null);\n $table->add_field('timecreated', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));\n if (!$dbman->table_exists($table)) {\n $dbman->create_table($table);\n }\n }\n\t\n\tif ($oldversion < 2014111902) {\n\n // Define field timecreated to be added to tquiz\n $table = new xmldb_table('tquiz_attempt_log');\n $field = new xmldb_field('questionid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);\n\n // Add field timecreated\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Another save point reached\n upgrade_mod_savepoint(true, 2014111902, 'tquiz');\n }\n if($oldversion < 2015013001){\n \t // Define field answercount to be added to tquiz\n $table = new xmldb_table('tquiz_questions');\n $field = new xmldb_field('answercount', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, null, null, null);\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n \n // Add field answersinrow\n $field = new xmldb_field('answersinrow', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, null, null, null);\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n \n // Add field answerwidth\n $field = new xmldb_field('answerwidth', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, null, null, null);\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n \n // Another save point reached\n upgrade_mod_savepoint(true, 2015013001, 'tquiz');\n \n }\n\n return true;\n}", "function quiz_mark_session_change(&$state) {\n if (!$state->changed) {\n $state->changed = true;\n $state->seq_number++;\n $state->timestamp = time();\n }\n}", "private function _update_session_table()\n\t{\n\t\tee()->smartforge->add_column(\n\t\t\t'sessions',\n\t\t\tarray(\n\t\t\t\t'fingerprint' => array(\n\t\t\t\t\t'type'\t\t\t=> 'varchar',\n\t\t\t\t\t'constraint'\t=> 40\n\t\t\t\t),\n\t\t\t\t'sess_start' => array(\n\t\t\t\t\t'type'\t\t\t=> 'int',\n\t\t\t\t\t'constraint'\t=> 10,\n\t\t\t\t\t'unsigned'\t\t=> TRUE,\n\t\t\t\t\t'default'\t\t=> 0,\n\t\t\t\t\t'null'\t\t\t=> FALSE\n\t\t\t\t)\n\t\t\t),\n\t\t\t'user_agent'\n\t\t);\n\t}", "function xmldb_attendance_upgrade($oldversion=0) {\n\n global $DB, $CFG;\n $dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.\n\n if ($oldversion < 2014112000) {\n $table = new xmldb_table('attendance_sessions');\n\n $field = new xmldb_field('studentscanmark');\n $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n upgrade_mod_savepoint(true, 2014112000, 'attendance');\n }\n\n if ($oldversion < 2014112001) {\n // Replace values that reference old module \"attforblock\" to \"attendance\".\n $sql = \"UPDATE {grade_items}\n SET itemmodule = 'attendance'\n WHERE itemmodule = 'attforblock'\";\n\n $DB->execute($sql);\n\n $sql = \"UPDATE {grade_items_history}\n SET itemmodule = 'attendance'\n WHERE itemmodule = 'attforblock'\";\n\n $DB->execute($sql);\n\n /*\n * The user's custom capabilities need to be preserved due to the module renaming.\n * Capabilities with a modifierid = 0 value are installed by default.\n * Only update the user's custom capabilities where modifierid is not zero.\n */\n $sql = $DB->sql_like('capability', '?').' AND modifierid <> 0';\n $rs = $DB->get_recordset_select('role_capabilities', $sql, array('%mod/attforblock%'));\n foreach ($rs as $cap) {\n $renamedcapability = str_replace('mod/attforblock', 'mod/attendance', $cap->capability);\n $exists = $DB->record_exists('role_capabilities', array('roleid' => $cap->roleid, 'capability' => $renamedcapability));\n if (!$exists) {\n $DB->update_record('role_capabilities', array('id' => $cap->id, 'capability' => $renamedcapability));\n }\n }\n\n // Delete old role capabilities.\n $sql = $DB->sql_like('capability', '?');\n $DB->delete_records_select('role_capabilities', $sql, array('%mod/attforblock%'));\n\n // Delete old capabilities.\n $DB->delete_records_select('capabilities', 'component = ?', array('mod_attforblock'));\n\n upgrade_mod_savepoint(true, 2014112001, 'attendance');\n }\n\n if ($oldversion < 2015040501) {\n // Define table attendance_tempusers to be created.\n $table = new xmldb_table('attendance_tempusers');\n\n // Adding fields to table attendance_tempusers.\n $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n $table->add_field('studentid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);\n $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);\n $table->add_field('fullname', XMLDB_TYPE_CHAR, '100', null, null, null, null);\n $table->add_field('email', XMLDB_TYPE_CHAR, '100', null, null, null, null);\n $table->add_field('created', XMLDB_TYPE_INTEGER, '10', null, null, null, null);\n\n // Adding keys to table attendance_tempusers.\n $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));\n\n // Conditionally launch create table for attendance_tempusers.\n if (!$dbman->table_exists($table)) {\n $dbman->create_table($table);\n }\n\n // Conditionally launch add index courseid.\n $index = new xmldb_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));\n if (!$dbman->index_exists($table, $index)) {\n $dbman->add_index($table, $index);\n }\n\n // Conditionally launch add index studentid.\n $index = new xmldb_index('studentid', XMLDB_INDEX_UNIQUE, array('studentid'));\n if (!$dbman->index_exists($table, $index)) {\n $dbman->add_index($table, $index);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2015040501, 'attendance');\n }\n\n if ($oldversion < 2015040502) {\n\n // Define field setnumber to be added to attendance_statuses.\n $table = new xmldb_table('attendance_statuses');\n $field = new xmldb_field('setnumber', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, null, '0', 'deleted');\n\n // Conditionally launch add field setnumber.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Define field statusset to be added to attendance_sessions.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('statusset', XMLDB_TYPE_INTEGER, '5', null, XMLDB_NOTNULL, null, '0', 'descriptionformat');\n\n // Conditionally launch add field statusset.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2015040502, 'attendance');\n }\n\n if ($oldversion < 2015040503) {\n\n // Changing type of field grade on table attendance_statuses to number.\n $table = new xmldb_table('attendance_statuses');\n $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '5, 2', null, XMLDB_NOTNULL, null, '0', 'description');\n\n // Launch change of type for field grade.\n $dbman->change_field_type($table, $field);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2015040503, 'attendance');\n }\n\n if ($oldversion < 2016052202) {\n // Adding field to store calendar event ids.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('caleventid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', null);\n\n // Conditionally launch add field statusset.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Creating events for all existing sessions.\n attendance_upgrade_create_calendar_events();\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2016052202, 'attendance');\n }\n\n if ($oldversion < 2016082900) {\n\n // Define field timemodified to be added to attendance.\n $table = new xmldb_table('attendance');\n $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'grade');\n\n // Conditionally launch add field timemodified.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2016082900, 'attendance');\n }\n if ($oldversion < 2016112100) {\n $table = new xmldb_table('attendance');\n $newfield = $table->add_field('subnet', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'timemodified');\n if (!$dbman->field_exists($table, $newfield)) {\n $dbman->add_field($table, $newfield);\n }\n upgrade_mod_savepoint(true, 2016112100, 'attendance');\n }\n\n if ($oldversion < 2016121300) {\n $table = new xmldb_table('attendance');\n $field = new xmldb_field('sessiondetailspos', XMLDB_TYPE_CHAR, '5', null, null, null, 'left', 'subnet');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n $field = new xmldb_field('showsessiondetails', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'subnet');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n upgrade_mod_savepoint(true, 2016121300, 'attendance');\n }\n\n if ($oldversion < 2017020700) {\n // Define field timemodified to be added to attendance.\n $table = new xmldb_table('attendance');\n\n $fields = [];\n $fields[] = new xmldb_field('intro', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timemodified');\n $fields[] = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, 0, 'intro');\n\n // Conditionally launch add field.\n foreach ($fields as $field) {\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017020700, 'attendance');\n }\n\n if ($oldversion < 2017042800) {\n $table = new xmldb_table('attendance_sessions');\n\n $field = new xmldb_field('studentpassword');\n $field->set_attributes(XMLDB_TYPE_CHAR, '50', null, false, null, '', 'studentscanmark');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n upgrade_mod_savepoint(true, 2017042800, 'attendance');\n }\n\n if ($oldversion < 2017051101) {\n\n // Define field studentavailability to be added to attendance_statuses.\n $table = new xmldb_table('attendance_statuses');\n $field = new xmldb_field('studentavailability', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'grade');\n\n // Conditionally launch add field studentavailability.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017051101, 'attendance');\n }\n\n if ($oldversion < 2017051103) {\n $table = new xmldb_table('attendance_sessions');\n $newfield = $table->add_field('subnet', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'studentpassword');\n if (!$dbman->field_exists($table, $newfield)) {\n $dbman->add_field($table, $newfield);\n }\n upgrade_mod_savepoint(true, 2017051103, 'attendance');\n }\n\n if ($oldversion < 2017051104) {\n // The meaning of the subnet in the attendance table has changed - it is now the \"default\" value - find all existing\n // Attendance with subnet set and set the session subnet for these.\n $attendances = $DB->get_recordset_select('attendance', 'subnet IS NOT NULL');\n foreach ($attendances as $attendance) {\n if (!empty($attendance->subnet)) {\n // Get all sessions for this attendance.\n $sessions = $DB->get_recordset('attendance_sessions', array('attendanceid' => $attendance->id));\n foreach ($sessions as $session) {\n $session->subnet = $attendance->subnet;\n $DB->update_record('attendance_sessions', $session);\n }\n $sessions->close();\n }\n }\n $attendances->close();\n\n upgrade_mod_savepoint(true, 2017051104, 'attendance');\n }\n\n if ($oldversion < 2017051900) {\n // Define field setunmarked to be added to attendance_statuses.\n $table = new xmldb_table('attendance_statuses');\n $field = new xmldb_field('setunmarked', XMLDB_TYPE_INTEGER, '2', null, null, null, null, 'studentavailability');\n\n // Conditionally launch add field studentavailability.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017051900, 'attendance');\n }\n\n if ($oldversion < 2017052201) {\n // Define field setunmarked to be added to attendance_statuses.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('automark', XMLDB_TYPE_INTEGER, '1', null, true, null, '0', 'subnet');\n\n // Conditionally launch add field automark.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n $field = new xmldb_field('automarkcompleted', XMLDB_TYPE_INTEGER, '1', null, true, null, '0', 'automark');\n\n // Conditionally launch add field automarkcompleted.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017052201, 'attendance');\n }\n\n if ($oldversion < 2017060900) {\n // Automark values changed.\n $default = get_config('attendance', 'automark_default');\n if (!empty($default)) { // Change default if set.\n set_config('automark_default', 2, 'attendance');\n }\n // Update any sessions set to use automark = 1.\n $sql = \"UPDATE {attendance_sessions} SET automark = 2 WHERE automark = 1\";\n $DB->execute($sql);\n\n // Update automarkcompleted to 2 if already complete.\n $sql = \"UPDATE {attendance_sessions} SET automarkcompleted = 2 WHERE automarkcompleted = 1\";\n $DB->execute($sql);\n\n upgrade_mod_savepoint(true, 2017060900, 'attendance');\n }\n\n if ($oldversion < 2017062000) {\n\n // Define table attendance_warning_done to be created.\n $table = new xmldb_table('attendance_warning_done');\n\n // Adding fields to table attendance_warning_done.\n $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n $table->add_field('notifyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n $table->add_field('timesent', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n\n // Adding keys to table attendance_warning_done.\n $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));\n\n // Adding indexes to table attendance_warning_done.\n $table->add_index('notifyid_userid', XMLDB_INDEX_UNIQUE, array('notifyid', 'userid'));\n\n // Conditionally launch create table for attendance_warning_done.\n if (!$dbman->table_exists($table)) {\n $dbman->create_table($table);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017062000, 'attendance');\n }\n\n if ($oldversion < 2017071305) {\n\n // Define table attendance_warning to be created.\n $table = new xmldb_table('attendance_warning');\n\n if (!$dbman->table_exists($table)) {\n // Adding fields to table attendance_warning.\n $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n $table->add_field('idnumber', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n $table->add_field('warningpercent', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n $table->add_field('warnafter', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n $table->add_field('emailuser', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null);\n $table->add_field('emailsubject', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);\n $table->add_field('emailcontent', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);\n $table->add_field('emailcontentformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null);\n $table->add_field('thirdpartyemails', XMLDB_TYPE_TEXT, null, null, null, null, null);\n\n // Adding keys to table attendance_warning.\n $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));\n $table->add_key('level_id', XMLDB_KEY_UNIQUE, array('idnumber', 'warningpercent', 'warnafter'));\n\n // Conditionally launch create table for attendance_warning.\n $dbman->create_table($table);\n\n } else {\n // Key definition is probably incorrect so fix it - drop_key dml function doesn't seem to work.\n $indexes = $DB->get_indexes('attendance_warning');\n foreach ($indexes as $name => $index) {\n if ($DB->get_dbfamily() === 'mysql') {\n $DB->execute(\"ALTER TABLE {attendance_warning} DROP INDEX \". $name);\n } else {\n $DB->execute(\"DROP INDEX \". $name);\n }\n }\n $index = new xmldb_key('level_id', XMLDB_KEY_UNIQUE, array('idnumber', 'warningpercent', 'warnafter'));\n $dbman->add_key($table, $index);\n }\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017071305, 'attendance');\n }\n\n if ($oldversion < 2017071800) {\n // Define field setunmarked to be added to attendance_statuses.\n $table = new xmldb_table('attendance_warning');\n $field = new xmldb_field('maxwarn', XMLDB_TYPE_INTEGER, '10', null, true, null, '1', 'warnafter');\n\n // Conditionally launch add field automark.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017071800, 'attendance');\n }\n\n if ($oldversion < 2017071802) {\n // Define field setunmarked to be added to attendance_statuses.\n $table = new xmldb_table('attendance_warning_done');\n\n $index = new xmldb_index('notifyid_userid', XMLDB_INDEX_UNIQUE, array('notifyid', 'userid'));\n if ($dbman->index_exists($table, $index)) {\n $dbman->drop_index($table, $index);\n }\n\n $index = new xmldb_index('notifyid', XMLDB_INDEX_NOTUNIQUE, array('notifyid', 'userid'));\n $dbman->add_index($table, $index);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017071802, 'attendance');\n }\n\n if ($oldversion < 2017082200) {\n // Warnings idnumber field should use attendanceid instead of cmid.\n $sql = \"SELECT cm.id, cm.instance\n FROM {course_modules} cm\n JOIN {modules} md ON md.id = cm.module AND md.name = 'attendance'\";\n $idnumbers = $DB->get_records_sql_menu($sql);\n $warnings = $DB->get_recordset('attendance_warning');\n foreach ($warnings as $warning) {\n if (!empty($warning->idnumber) && !empty($idnumbers[$warning->idnumber])) {\n $warning->idnumber = $idnumbers[$warning->idnumber];\n $DB->update_record(\"attendance_warning\", $warning);\n }\n }\n $warnings->close();\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2017082200, 'attendance');\n }\n\n if ($oldversion < 2017120700) {\n $table = new xmldb_table('attendance_sessions');\n\n $field = new xmldb_field('absenteereport');\n $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'statusset');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n upgrade_mod_savepoint(true, 2017120700, 'attendance');\n }\n\n if ($oldversion < 2017120801) {\n $table = new xmldb_table('attendance_sessions');\n\n $field = new xmldb_field('autoassignstatus');\n $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'studentscanmark');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n upgrade_mod_savepoint(true, 2017120801, 'attendance');\n }\n\n if ($oldversion < 2018022204) {\n $table = new xmldb_table('attendance');\n $field = new xmldb_field('showextrauserdetails', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,\n XMLDB_NOTNULL, null, '1', 'showsessiondetails');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n upgrade_mod_savepoint(true, 2018022204, 'attendance');\n }\n\n if ($oldversion < 2018050100) {\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('preventsharedip', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,\n XMLDB_NOTNULL, null, '0', 'absenteereport');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n $field = new xmldb_field('preventsharediptime', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED,\n null, null, null, 'preventsharedip');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n $table = new xmldb_table('attendance_log');\n $field = new xmldb_field('ipaddress', XMLDB_TYPE_CHAR, '45', null,\n null, null, '', 'remarks');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n upgrade_mod_savepoint(true, 2018050100, 'attendance');\n }\n\n if ($oldversion < 2018072700) {\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('calendarevent', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,\n XMLDB_NOTNULL, null, '1', 'caleventid');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n if (empty(get_config('attendance', 'enablecalendar'))) {\n // Calendar disabled on this site, set calendarevent for existing records to 0.\n $DB->execute(\"UPDATE {attendance_sessions} set calendarevent = 0\");\n }\n }\n upgrade_mod_savepoint(true, 2018072700, 'attendance');\n }\n\n if ($oldversion < 2018082605) {\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('includeqrcode', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,\n XMLDB_NOTNULL, null, '0', 'calendarevent');\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n upgrade_mod_savepoint(true, 2018082605, 'attendance');\n }\n\n if ($oldversion < 2019012500) {\n\n // Changing precision of field statusset on table attendance_log to (1333).\n $table = new xmldb_table('attendance_log');\n $field = new xmldb_field('statusset', XMLDB_TYPE_CHAR, '1333', null, null, null, null, 'statusid');\n\n // Launch change of precision for field statusset.\n $dbman->change_field_precision($table, $field);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2019012500, 'attendance');\n }\n\n if ($oldversion < 2019061800) {\n\n // Make sure default value to '0'.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('preventsharedip', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED,\n XMLDB_NOTNULL, null, '0', 'absenteereport');\n\n if ($dbman->field_exists($table, $field)) {\n $dbman->change_field_default($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2019061800, 'attendance');\n }\n\n if ($oldversion < 2019062000) {\n // Make sure sessiondetailspos is not null.\n $table = new xmldb_table('attendance');\n $field = new xmldb_field('sessiondetailspos', XMLDB_TYPE_CHAR, '5', null, XMLDB_NOTNULL, null, 'left', 'subnet');\n\n if ($dbman->field_exists($table, $field)) {\n $dbman->change_field_notnull($table, $field);\n }\n\n // Make sure maxwarn has default value of '1'.\n $table = new xmldb_table('attendance_warning');\n $field = new xmldb_field('maxwarn', XMLDB_TYPE_INTEGER, '10', null, true, null, '1', 'warnafter');\n\n if ($dbman->field_exists($table, $field)) {\n $dbman->change_field_default($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2019062000, 'attendance');\n }\n\n if ($oldversion < 2019062200) {\n\n // Define table attendance_rotate_passwords to be created.\n $table = new xmldb_table('attendance_rotate_passwords');\n\n // Adding fields to table attendance_rotate_passwords.\n $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n $table->add_field('attendanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n $table->add_field('password', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null);\n $table->add_field('expirytime', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n\n // Adding keys to table attendance_rotate_passwords.\n $table->add_key('id', XMLDB_KEY_PRIMARY, ['id']);\n\n // Conditionally launch create table for attendance_rotate_passwords.\n if (!$dbman->table_exists($table)) {\n $dbman->create_table($table);\n }\n\n // Define field rotateqrcode to be added to attendance_sessions.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('rotateqrcode', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'includeqrcode');\n\n // Conditionally launch add field rotateqrcode.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Define field rotateqrcodesecret to be added to attendance_sessions.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('rotateqrcodesecret', XMLDB_TYPE_CHAR, '10', null, null, null, null, 'rotateqrcode');\n\n // Conditionally launch add field rotateqrcodesecret.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2019062200, 'attendance');\n\n }\n\n if ($oldversion < 2020072900) {\n $table = new xmldb_table('attendance_sessions');\n\n // Conditionally launch add index caleventid.\n $index = new xmldb_index('caleventid', XMLDB_INDEX_NOTUNIQUE, array('caleventid'));\n if (!$dbman->index_exists($table, $index)) {\n $dbman->add_index($table, $index);\n }\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2020072900, 'attendance');\n }\n\n if ($oldversion < 2021050700) {\n // Restore process sometimes creates orphan attendance calendar events - clean them up.\n $sql = \"modulename = 'attendance' AND id NOT IN (SELECT caleventid\n FROM {attendance_sessions})\";\n $DB->delete_records_select('event', $sql);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2021050700, 'attendance');\n }\n\n if ($oldversion < 2021082400) {\n\n // Changing precision of field statusset on table attendance_log to (1333).\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('automarkcmid', XMLDB_TYPE_CHAR, '10', null, false, null, null, 'rotateqrcodesecret');\n\n // Launch change of precision for field statusset.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2021082400, 'attendance');\n }\n\n if ($oldversion < 2021082401) {\n\n // Changing the default of field automarkcmid on table attendance_sessions to 0.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('automarkcmid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'rotateqrcodesecret');\n\n // Launch change of default for field automarkcmid.\n $dbman->change_field_default($table, $field);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2021082401, 'attendance');\n }\n\n if ($oldversion < 2021082402) {\n\n // Changing the default of field ipaddress on table attendance_log to .\n $table = new xmldb_table('attendance_log');\n $field = new xmldb_field('ipaddress', XMLDB_TYPE_CHAR, '45', null, null, null, '', 'remarks');\n\n // Launch change of default for field ipaddress.\n $dbman->change_field_default($table, $field);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2021082402, 'attendance');\n }\n\n if ($oldversion < 2021082600) {\n // Check if auto-marking in use, and if so, set automark_useempty = 0 to prevent changes in existing behaviour.\n if ($DB->record_exists_select('attendance_sessions', 'automark > 0')) {\n set_config('automark_useempty', '0', 'attendance');\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2021082600, 'attendance');\n }\n\n if ($oldversion < 2022082900) {\n\n // Changing precision of field remarks on table attendance_log to (1333).\n $table = new xmldb_table('attendance_log');\n $field = new xmldb_field('remarks', XMLDB_TYPE_CHAR, '1333', null, null, null, null, 'takenby');\n\n // Launch change of precision for field remarks.\n $dbman->change_field_precision($table, $field);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2022082900, 'attendance');\n }\n\n if ($oldversion < 2022083100) {\n\n // Define field studentsearlyopentime to be added to attendance_sessions.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('studentsearlyopentime', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL,\n null, '0', 'studentscanmark');\n\n // Conditionally launch add field studentsearlyopentime.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2022083100, 'attendance');\n }\n if ($oldversion < 2022090900) {\n if (!empty($CFG->dbfamily) && $CFG->dbfamily == 'postgres') {\n $sql = 'DELETE FROM {attendance_log}\n WHERE id NOT IN (SELECT max(id)\n FROM {attendance_log}\n GROUP BY sessionid, studentid, statusid)';\n $DB->execute($sql);\n } else if (!empty($CFG->dbfamily) && $CFG->dbfamily == 'mysql') {\n // There is probably a faster way to do this for mysql, but it works.\n $sql = \"SELECT id\n FROM {attendance_log}\n WHERE id NOT IN (SELECT max(id)\n FROM {attendance_log}\n GROUP BY sessionid, studentid, statusid)\";\n $records = $DB->get_records_sql($sql);\n foreach ($records as $record) {\n $DB->delete_records('attendance_log', ['id' => $record->id]);\n }\n } else if (!empty($CFG->dbfamily) && $CFG->dbfamily == 'mssql') {\n $sql = \"DELETE {attendance_log}\n WHERE id NOT IN (\n SELECT max(id)\n FROM {attendance_log}\n GROUP BY sessionid, studentid, statusid\n )\";\n $DB->execute($sql);\n }\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2022090900, 'attendance');\n }\n\n if ($oldversion < 2023020100) {\n\n // Define field studentavailability to be added to attendance_statuses.\n $table = new xmldb_table('attendance_statuses');\n $field = new xmldb_field('availablebeforesession', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'studentavailability');\n\n // Conditionally launch add field studentavailability.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2023020100, 'attendance');\n }\n\n if ($oldversion < 2023021700) {\n\n // Define field studentavailability to be added to attendance_statuses.\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('allowupdatestatus', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'automarkcmid');\n\n // Conditionally launch add field studentavailability.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2023021700, 'attendance');\n }\n\n if ($oldversion < 2023032800) {\n // Update any records with null values and set to 0;\n $sql = 'UPDATE {attendance_sessions} set allowupdatestatus = 0 WHERE allowupdatestatus is null';\n $DB->execute($sql);\n\n // Changing precision of field allowupdatestatus on table attendance_sessions to (1).\n $table = new xmldb_table('attendance_sessions');\n $field = new xmldb_field('allowupdatestatus', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'studentscanmark');\n\n // Launch change of precision for field allowupdatestatus.\n $dbman->change_field_precision($table, $field);\n $dbman->change_field_default($table, $field);\n $dbman->change_field_notnull($table, $field);\n\n // Attendance savepoint reached.\n upgrade_mod_savepoint(true, 2023032800, 'attendance');\n }\n\n return true;\n}", "private function _update_session_table()\n\t{\n\t\t// Add an index on last_activity\n\t\tee()->smartforge->add_key('sessions', 'last_activity', 'last_activity_idx');\n\n\t\t$field = array(\n\t\t\t'user_agent'\t=> array(\n\t\t\t\t'name'\t\t\t=> 'user_agent',\n\t\t\t\t'type'\t\t\t=> 'VARCHAR',\n\t\t\t\t'constraint'\t=> 120\n\t\t\t)\n\t\t);\n\n\t\tee()->smartforge->modify_column('sessions', $field);\n\t}", "private function _update_session_table()\n\t{\n\t\t// Add an index on last_activity\n\t\t$this->EE->db->query(\"CREATE INDEX last_activity_idx on exp_sessions(last_activity)\");\n\n\t\t$field = array(\n\t\t\t'user_agent'\t=> array(\n\t\t\t\t'name'\t\t\t=> 'user_agent',\n\t\t\t\t'type'\t\t\t=> 'VARCHAR',\n\t\t\t\t'constraint'\t=> 120\n\t\t\t)\n\t\t);\n\n\t\t$this->EE->dbforge->modify_column('sessions', $field);\n\t}", "function xmldb_quiz_upgrade($oldversion=0) {\n\n global $CFG, $THEME, $db;\n\n $result = true;\n\n/// And upgrade begins here. For each one, you'll need one\n/// block of code similar to the next one. Please, delete\n/// this comment lines once this file start handling proper\n/// upgrade code.\n\n if ($result && $oldversion < 2007022800) {\n /// Ensure that there are not existing duplicate entries in the database.\n $duplicateunits = get_records_select('question_numerical_units', \"id > (SELECT MIN(iqnu.id)\n FROM {$CFG->prefix}question_numerical_units iqnu\n WHERE iqnu.question = {$CFG->prefix}question_numerical_units.question AND\n iqnu.unit = {$CFG->prefix}question_numerical_units.unit)\", '', 'id');\n if ($duplicateunits) {\n delete_records_select('question_numerical_units', 'id IN (' . implode(',', array_keys($duplicateunits)) . ')');\n }\n\n /// Define index question-unit (unique) to be added to question_numerical_units\n $table = new XMLDBTable('question_numerical_units');\n $index = new XMLDBIndex('question-unit');\n $index->setAttributes(XMLDB_INDEX_UNIQUE, array('question', 'unit'));\n\n /// Launch add index question-unit\n $result = $result && add_index($table, $index);\n }\n\n if ($result && $oldversion < 2007070200) {\n\n /// Changing precision of field timelimit on table quiz to (10)\n $table = new XMLDBTable('quiz');\n $field = new XMLDBField('timelimit');\n $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timemodified');\n\n /// Launch change of precision for field timelimit\n $result = $result && change_field_precision($table, $field);\n }\n\n if ($result && $oldversion < 2007072200) {\n require_once $CFG->dirroot.'/mod/quiz/lib.php';\n // too much debug output\n $db->debug = false;\n quiz_update_grades();\n $db->debug = true;\n }\n\n // Separate control for when overall feedback is displayed, independant of the question feedback settings.\n if ($result && $oldversion < 2007072600) {\n\n // Adjust the quiz review options so that overall feedback is displayed whenever feedback is.\n $result = $result && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' .\n sql_bitor(sql_bitand('review', sql_bitnot(QUIZ_REVIEW_OVERALLFEEDBACK)),\n sql_bitor(sql_bitand('review', QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY) . ' * 65536',\n sql_bitor(sql_bitand('review', QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN) . ' * 16384',\n sql_bitand('review', QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED) . ' * 4096'))));\n\n // Same adjustment to the defaults for new quizzes.\n $result = $result && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_OVERALLFEEDBACK) |\n (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY) << 16) |\n (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN) << 14) |\n (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED) << 12));\n }\n\n return $result;\n}", "function main_upgrade($oldversion=0) {\n\n global $CFG, $THEME, $db;\n\n $result = true;\n\n if ($oldversion == 0) {\n execute_sql(\"\n CREATE TABLE `config` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `name` (`name`)\n ) COMMENT='Moodle configuration variables';\");\n notify(\"Created a new table 'config' to hold configuration data\");\n }\n if ($oldversion < 2002073100) {\n execute_sql(\" DELETE FROM `modules` WHERE `name` = 'chat' \");\n }\n if ($oldversion < 2002080200) {\n execute_sql(\" ALTER TABLE `modules` DROP `fullname` \");\n execute_sql(\" ALTER TABLE `modules` DROP `search` \");\n }\n if ($oldversion < 2002080300) {\n execute_sql(\" ALTER TABLE `log_display` CHANGE `table` `mtable` VARCHAR( 20 ) NOT NULL \");\n execute_sql(\" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 3 ) DEFAULT '3' NOT NULL \");\n }\n if ($oldversion < 2002082100) {\n execute_sql(\" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL \");\n }\n if ($oldversion < 2002082101) {\n execute_sql(\" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` \");\n }\n if ($oldversion < 2002090100) {\n execute_sql(\" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL \");\n }\n if ($oldversion < 2002090701) {\n execute_sql(\" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 10 ) DEFAULT '3' NOT NULL \");\n execute_sql(\" ALTER TABLE `user_teachers` ADD `role` VARCHAR(40) NOT NULL AFTER `authority` \");\n }\n if ($oldversion < 2002090800) {\n execute_sql(\" ALTER TABLE `course` ADD `teachers` VARCHAR( 100 ) DEFAULT 'Teachers' NOT NULL AFTER `teacher` \");\n execute_sql(\" ALTER TABLE `course` ADD `students` VARCHAR( 100 ) DEFAULT 'Students' NOT NULL AFTER `student` \");\n }\n if ($oldversion < 2002091000) {\n execute_sql(\" ALTER TABLE `user` CHANGE `personality` `secret` VARCHAR( 15 ) NOT NULL DEFAULT '' \");\n }\n if ($oldversion < 2002091400) {\n execute_sql(\" ALTER TABLE `user` ADD `lang` VARCHAR( 3 ) DEFAULT 'en' NOT NULL AFTER `country` \");\n }\n if ($oldversion < 2002091900) {\n notify(\"Most Moodle configuration variables have been moved to the database and can now be edited via the admin page.\");\n notify(\"Although it is not vital that you do so, you might want to edit <U>config.php</U> and remove all the unused settings (except the database, URL and directory definitions). See <U>config-dist.php</U> for an example of how your new slim config.php should look.\");\n }\n if ($oldversion < 2002092000) {\n execute_sql(\" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL \");\n }\n if ($oldversion < 2002092100) {\n execute_sql(\" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` \");\n }\n if ($oldversion < 2002101001) {\n execute_sql(\" ALTER TABLE `user` ADD `htmleditor` TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL AFTER `maildisplay` \");\n }\n if ($oldversion < 2002101701) {\n execute_sql(\" ALTER TABLE `reading` RENAME `resource` \"); // Small line with big consequences!\n execute_sql(\" DELETE FROM `log_display` WHERE module = 'reading'\");\n execute_sql(\" INSERT INTO log_display (module, action, mtable, field) VALUES ('resource', 'view', 'resource', 'name') \");\n execute_sql(\" UPDATE log SET module = 'resource' WHERE module = 'reading' \");\n execute_sql(\" UPDATE modules SET name = 'resource' WHERE name = 'reading' \");\n }\n\n if ($oldversion < 2002102503) {\n execute_sql(\" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` \");\n require_once(\"$CFG->dirroot/mod/forum/lib.php\");\n require_once(\"$CFG->dirroot/course/lib.php\");\n\n if (! $module = get_record(\"modules\", \"name\", \"forum\")) {\n notify(\"Could not find forum module!!\");\n return false;\n }\n\n // First upgrade the site forums\n if ($site = get_site()) {\n print_heading(\"Making News forums editable for main site (moving to section 1)...\");\n if ($news = forum_get_course_forum($site->id, \"news\")) {\n $mod->course = $site->id;\n $mod->module = $module->id;\n $mod->instance = $news->id;\n $mod->section = 1;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the site\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n }\n\n\n // Now upgrade the courses.\n if ($courses = get_records_sql(\"SELECT * FROM course WHERE category > 0\")) {\n print_heading(\"Making News and Social forums editable for each course (moving to section 0)...\");\n foreach ($courses as $course) {\n if ($course->format == \"social\") { // we won't touch them\n continue;\n }\n if ($news = forum_get_course_forum($course->id, \"news\")) {\n $mod->course = $course->id;\n $mod->module = $module->id;\n $mod->instance = $news->id;\n $mod->section = 0;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the course '\" . format_string($course->fullname) . \"'\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n if ($social = forum_get_course_forum($course->id, \"social\")) {\n $mod->course = $course->id;\n $mod->module = $module->id;\n $mod->instance = $social->id;\n $mod->section = 0;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the course '\" . format_string($course->fullname) . \"'\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n }\n }\n }\n\n if ($oldversion < 2002111003) {\n execute_sql(\" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` \");\n if ($courses = get_records_sql(\"SELECT * FROM course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '\" . format_string($course->fullname) . \"'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2002111100) {\n print_simple_box_start(\"CENTER\", \"\", \"#FFCCCC\");\n echo \"<FONT SIZE=+1>\";\n echo \"<P>Changes have been made to all built-in themes, to add the new popup navigation menu.\";\n echo \"<P>If you have customised themes, you will need to edit theme/xxxx/header.html as follows:\";\n echo \"<UL><LI>Change anywhere it says <B>$\".\"button</B> to say <B>$\".\"menu</B>\";\n echo \"<LI>Add <B>$\".\"button</B> elsewhere (eg at the end of the navigation bar)</UL>\";\n echo \"<P>See the standard themes for examples, eg: theme/standard/header.html\";\n print_simple_box_end();\n }\n\n if ($oldversion < 2002111200) {\n execute_sql(\" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` \");\n }\n\n if ($oldversion < 2002111400) {\n // Rebuild all course caches, because some may not be done in new installs (eg site page)\n if ($courses = get_records_sql(\"SELECT * FROM course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '\" . format_string($course->fullname) . \"'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2002112000) {\n set_config(\"guestloginbutton\", 1);\n }\n\n if ($oldversion < 2002122300) {\n execute_sql(\"ALTER TABLE `log` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_admins` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_teachers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `start` `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `end` `timeend` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n }\n\n if ($oldversion < 2002122700) {\n if (! record_exists(\"log_display\", \"module\", \"user\", \"action\", \"view\")) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname,' ',lastname)') \");\n }\n }\n if ($oldversion < 2003010101) {\n delete_records(\"log_display\", \"module\", \"user\");\n $new->module = \"user\";\n $new->action = \"view\";\n $new->mtable = \"user\";\n $new->field = \"CONCAT(firstname,\\\" \\\",lastname)\";\n insert_record(\"log_display\", $new);\n\n delete_records(\"log_display\", \"module\", \"course\");\n $new->module = \"course\";\n $new->action = \"view\";\n $new->mtable = \"course\";\n $new->field = \"fullname\";\n insert_record(\"log_display\", $new);\n $new->action = \"update\";\n insert_record(\"log_display\", $new);\n $new->action = \"enrol\";\n insert_record(\"log_display\", $new);\n }\n\n if ($oldversion < 2003012200) {\n // execute_sql(\" ALTER TABLE `log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL \");\n // Commented out - see below where it's done properly\n }\n\n if ($oldversion < 2003032500) {\n modify_database(\"\", \"CREATE TABLE `prefix_user_coursecreators` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`)\n ) TYPE=MyISAM COMMENT='One record per course creator';\");\n }\n if ($oldversion < 2003032602) {\n // Redoing it because of no prefix last time\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL \");\n // Add some indexes for speed\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(course) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(userid) \");\n }\n\n if ($oldversion < 2003041400) {\n table_column(\"course_modules\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"not null\", \"score\");\n }\n\n if ($oldversion < 2003042104) { // Try to update permissions of all files\n if ($files = get_directory_list($CFG->dataroot)) {\n echo \"Attempting to update permissions for all files... ignore any errors.\";\n foreach ($files as $file) {\n echo \"$CFG->dataroot/$file<br />\";\n @chmod(\"$CFG->dataroot/$file\", $CFG->directorypermissions);\n }\n }\n }\n\n if ($oldversion < 2003042400) {\n // Rebuild all course caches, because of changes to do with visible variable\n if ($courses = get_records_sql(\"SELECT * FROM {$CFG->prefix}course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '\" . format_string($course->fullname) . \"'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2003042500) {\n // Convert all usernames to lowercase.\n $users = get_records_sql(\"SELECT id, username FROM {$CFG->prefix}user\");\n $cerrors = \"\";\n $rarray = array();\n\n foreach ($users as $user) { // Check for possible conflicts\n $lcname = trim(moodle_strtolower($user->username));\n if (in_array($lcname, $rarray)) {\n $cerrors .= $user->id.\"->\".$lcname.'<br/>' ;\n } else {\n array_push($rarray,$lcname);\n }\n }\n\n if ($cerrors != '') {\n notify(\"Error: Cannot convert usernames to lowercase.\n Following usernames would overlap (id->username):<br/> $cerrors .\n Please resolve overlapping errors.\");\n $result = false;\n }\n\n $cerrors = \"\";\n echo \"Checking userdatabase:<br />\";\n foreach ($users as $user) {\n $lcname = trim(moodle_strtolower($user->username));\n if ($lcname != $user->username) {\n $convert = set_field(\"user\" , \"username\" , $lcname, \"id\", $user->id);\n if (!$convert) {\n if ($cerrors){\n $cerrors .= \", \";\n }\n $cerrors .= $item;\n } else {\n echo \".\";\n }\n }\n }\n if ($cerrors != '') {\n notify(\"There were errors when converting following usernames to lowercase.\n '$cerrors' . Sorry, but you will need to fix your database by hand.\");\n $result = false;\n }\n }\n\n if ($oldversion < 2003042600) {\n /// Some more indexes - we need all the help we can get on the logs\n //execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(module) \");\n //execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(action) \");\n }\n\n if ($oldversion < 2003042700) {\n /// Changing to multiple indexes\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX module \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX action \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX course \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX userid \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX coursemoduleaction (course,module,action) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX courseuserid (course,userid) \");\n }\n\n if ($oldversion < 2003042801) {\n execute_sql(\"CREATE TABLE `{$CFG->prefix}course_display` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `course` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `display` int(10) NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `courseuserid` (course,userid)\n ) TYPE=MyISAM COMMENT='Stores info about how to display the course'\");\n }\n\n if ($oldversion < 2003050400) {\n table_column(\"course_sections\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"\");\n }\n\n if ($oldversion < 2003050900) {\n table_column(\"modules\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"\");\n }\n\n if ($oldversion < 2003050902) {\n if (get_records(\"modules\", \"name\", \"pgassignment\")) {\n print_simple_box(\"Note: the pgassignment module has been removed (it will be replaced later by the workshop module). Go to the new 'Manage Modules' page and DELETE IT from your system\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n }\n }\n\n if ($oldversion < 2003051600) {\n print_simple_box(\"Thanks for upgrading!<p>There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n }\n\n if ($oldversion < 2003052300) {\n table_column(\"user\", \"\", \"autosubscribe\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"htmleditor\");\n }\n\n if ($oldversion < 2003072100) {\n table_column(\"course\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"marker\");\n }\n\n if ($oldversion < 2003072101) {\n table_column(\"course_sections\", \"sequence\", \"sequence\", \"text\", \"\", \"\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2003072800) {\n print_simple_box(\"The following database index improves performance, but can be quite large - if you are upgrading and you have problems with a limited quota you may want to delete this index later from the '{$CFG->prefix}log' table in your database\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n flush();\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX timecoursemoduleaction (time,course,module,action) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX courseuserid (course,userid) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX courseuserid (course,userid) \");\n }\n\n if ($oldversion < 2003072803) {\n table_column(\"course_categories\", \"\", \"description\", \"text\", \"\", \"\", \"\");\n table_column(\"course_categories\", \"\", \"parent\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course_categories\", \"\", \"sortorder\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course_categories\", \"\", \"courseorder\", \"text\", \"\", \"\", \"\");\n table_column(\"course_categories\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\");\n table_column(\"course_categories\", \"\", \"timemodified\", \"integer\", \"10\", \"unsigned\");\n }\n\n if ($oldversion < 2003080400) {\n table_column(\"course_categories\", \"courseorder\", \"courseorder\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course\", \"\", \"sortorder\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"category\");\n }\n\n if ($oldversion < 2003080700) {\n notify(\"Cleaning up categories and course ordering...\");\n fix_course_sortorder();\n }\n\n if ($oldversion < 2003081001) {\n table_column(\"course\", \"format\", \"format\", \"varchar\", \"10\", \"\", \"topics\");\n }\n\n if ($oldversion < 2003081500) {\n// print_simple_box(\"Some important changes have been made to how course creators work. Formerly, they could create new courses and assign teachers, and teachers could edit courses. Now, ordinary teachers can no longer edit courses - they <b>need to be a teacher of a course AND a course creator</b>. A new site-wide configuration variable allows you to choose whether to allow course creators to create new courses as well (by default this is off). <p>The following update will automatically convert all your existing teachers into course creators, to maintain backward compatibility. Make sure you look at your upgraded site carefully and understand these new changes.\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n\n// $count = 0;\n// $errorcount = 0;\n// if ($teachers = get_records(\"user_teachers\")) {\n// foreach ($teachers as $teacher) {\n// if (! record_exists(\"user_coursecreators\", \"userid\", $teacher->userid)) {\n// $creator = NULL;\n// $creator->userid = $teacher->userid;\n// if (!insert_record(\"user_coursecreators\", $creator)) {\n// $errorcount++;\n// } else {\n// $count++;\n// }\n// }\n// }\n// }\n// print_simple_box(\"$count teachers were upgraded to course creators (with $errorcount errors)\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n\n }\n\n if ($oldversion < 2003081501) {\n execute_sql(\" CREATE TABLE `{$CFG->prefix}scale` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `name` varchar(255) NOT NULL default '',\n `scale` text NOT NULL,\n `description` text NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (id)\n ) TYPE=MyISAM COMMENT='Defines grading scales'\");\n\n }\n\n if ($oldversion < 2003081503) {\n table_column(\"forum\", \"\", \"scale\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"assessed\");\n get_scales_menu(0); // Just to force the default scale to be created\n }\n\n if ($oldversion < 2003081600) {\n table_column(\"user_teachers\", \"\", \"editall\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"role\");\n table_column(\"user_teachers\", \"\", \"timemodified\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"editall\");\n }\n\n if ($oldversion < 2003081900) {\n table_column(\"course_categories\", \"courseorder\", \"coursecount\", \"integer\", \"10\", \"unsigned\", \"0\");\n }\n\n if ($oldversion < 2003082001) {\n table_column(\"course\", \"\", \"showgrades\", \"integer\", \"2\", \"unsigned\", \"1\", \"\", \"format\");\n }\n\n if ($oldversion < 2003082101) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX category (category) \");\n }\n if ($oldversion < 2003082702) {\n execute_sql(\" INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname,\\\" \\\",lastname)') \");\n }\n\n if ($oldversion < 2003091400) {\n table_column(\"course_modules\", \"\", \"indent\", \"integer\", \"5\", \"unsigned\", \"0\", \"\", \"score\");\n }\n\n if ($oldversion < 2003092900) {\n table_column(\"course\", \"\", \"maxbytes\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"marker\");\n }\n\n if ($oldversion < 2003102700) {\n table_column(\"user_students\", \"\", \"timeaccess\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"time\");\n table_column(\"user_teachers\", \"\", \"timeaccess\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"timemodified\");\n\n $db->debug = false;\n $CFG->debug = 0;\n notify(\"Calculating access times. Please wait - this may take a long time on big sites...\", \"green\");\n flush();\n\n if ($courses = get_records_select(\"course\", \"category > 0\")) {\n foreach ($courses as $course) {\n notify(\"Processing \" . format_string($course->fullname) . \" ...\", \"green\");\n flush();\n if ($users = get_records_select(\"user_teachers\", \"course = '$course->id'\",\n \"id\", \"id, userid, timeaccess\")) {\n foreach ($users as $user) {\n $loginfo = get_record_sql(\"SELECT id, time FROM {$CFG->prefix}log WHERE course = '$course->id' and userid = '$user->userid' ORDER by time DESC\");\n if (empty($loginfo->time)) {\n $loginfo->time = 0;\n }\n execute_sql(\"UPDATE {$CFG->prefix}user_teachers SET timeaccess = '$loginfo->time'\n WHERE userid = '$user->userid' AND course = '$course->id'\", false);\n\n }\n }\n\n if ($users = get_records_select(\"user_students\", \"course = '$course->id'\",\n \"id\", \"id, userid, timeaccess\")) {\n foreach ($users as $user) {\n $loginfo = get_record_sql(\"SELECT id, time FROM {$CFG->prefix}log\n WHERE course = '$course->id' and userid = '$user->userid'\n ORDER by time DESC\");\n if (empty($loginfo->time)) {\n $loginfo->time = 0;\n }\n execute_sql(\"UPDATE {$CFG->prefix}user_students\n SET timeaccess = '$loginfo->time'\n WHERE userid = '$user->userid' AND course = '$course->id'\", false);\n\n }\n }\n }\n }\n notify(\"All courses complete.\", \"green\");\n $db->debug = true;\n }\n\n if ($oldversion < 2003103100) {\n table_column(\"course\", \"\", \"showreports\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"maxbytes\");\n }\n\n if ($oldversion < 2003121600) {\n modify_database(\"\", \"CREATE TABLE `prefix_groups` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `name` varchar(254) NOT NULL default '',\n `description` text NOT NULL,\n `lang` varchar(10) NOT NULL default 'en',\n `picture` int(10) unsigned NOT NULL default '0',\n `timecreated` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM COMMENT='Each record is a group in a course.'; \");\n\n modify_database(\"\", \"CREATE TABLE `prefix_groups_members` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `groupid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `timeadded` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `groupid` (`groupid`)\n ) TYPE=MyISAM COMMENT='Lists memberships of users in groups'; \");\n }\n\n if ($oldversion < 2003121800) {\n table_column(\"course\", \"modinfo\", \"modinfo\", \"longtext\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2003122600) {\n table_column(\"course\", \"\", \"groupmode\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"showreports\");\n table_column(\"course\", \"\", \"groupmodeforce\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"groupmode\");\n }\n\n if ($oldversion < 2004010900) {\n table_column(\"course_modules\", \"\", \"groupmode\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"visible\");\n }\n\n if ($oldversion < 2004011700) {\n modify_database(\"\", \"CREATE TABLE `prefix_event` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `description` text NOT NULL,\n `courseid` int(10) unsigned NOT NULL default '0',\n `groupid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `modulename` varchar(20) NOT NULL default '',\n `instance` int(10) unsigned NOT NULL default '0',\n `eventtype` varchar(20) NOT NULL default '',\n `timestart` int(10) unsigned NOT NULL default '0',\n `timeduration` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`)\n ) TYPE=MyISAM COMMENT='For everything with a time associated to it'; \");\n }\n\n if ($oldversion < 2004012800) {\n modify_database(\"\", \"CREATE TABLE `prefix_user_preferences` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `name` varchar(50) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `useridname` (userid,name)\n ) TYPE=MyISAM COMMENT='Allows modules to store arbitrary user preferences'; \");\n }\n\n if ($oldversion < 2004012900) {\n table_column(\"config\", \"value\", \"value\", \"text\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2004013101) {\n table_column(\"log\", \"\", \"cmid\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"module\");\n set_config(\"upgrade\", \"logs\");\n }\n\n if ($oldversion < 2004020900) {\n table_column(\"course\", \"\", \"lang\", \"varchar\", \"5\", \"\", \"\", \"\", \"groupmodeforce\");\n }\n\n if ($oldversion < 2004020903) {\n modify_database(\"\", \"CREATE TABLE `prefix_cache_text` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `md5key` varchar(32) NOT NULL default '',\n `formattedtext` longtext NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `md5key` (`md5key`)\n ) TYPE=MyISAM COMMENT='For storing temporary copies of processed texts';\");\n }\n\n if ($oldversion < 2004021000) {\n $textfilters = array();\n for ($i=1; $i<=10; $i++) {\n $variable = \"textfilter$i\";\n if (!empty($CFG->$variable)) { /// No more filters\n if (is_readable(\"$CFG->dirroot/\".$CFG->$variable)) {\n $textfilters[] = $CFG->$variable;\n }\n }\n }\n $textfilters = implode(',', $textfilters);\n if (empty($textfilters)) {\n $textfilters = 'mod/glossary/dynalink.php';\n }\n set_config('textfilters', $textfilters);\n }\n\n if ($oldversion < 2004021201) {\n modify_database(\"\", \"CREATE TABLE `prefix_cache_filters` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `filter` varchar(32) NOT NULL default '',\n `version` int(10) unsigned NOT NULL default '0',\n `md5key` varchar(32) NOT NULL default '',\n `rawtext` text NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `filtermd5key` (filter,md5key)\n ) TYPE=MyISAM COMMENT='For keeping information about cached data';\");\n }\n\n if ($oldversion < 2004021500) {\n table_column(\"groups\", \"\", \"hidepicture\", \"integer\", \"2\", \"unsigned\", \"0\", \"\", \"picture\");\n }\n\n if ($oldversion < 2004021700) {\n if (!empty($CFG->textfilters)) {\n $CFG->textfilters = str_replace(\"tex_filter.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"multilang.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"censor.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"mediaplugin.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"algebra_filter.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"dynalink.php\", \"filter.php\", $CFG->textfilters);\n set_config(\"textfilters\", $CFG->textfilters);\n }\n }\n\n if ($oldversion < 2004022000) {\n table_column(\"user\", \"\", \"emailstop\", \"integer\", \"1\", \"unsigned\", \"0\", \"not null\", \"email\");\n }\n\n if ($oldversion < 2004022200) { /// Final renaming I hope. :-)\n if (!empty($CFG->textfilters)) {\n $CFG->textfilters = str_replace(\"/filter.php\", \"\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"mod/glossary/dynalink.php\", \"mod/glossary\", $CFG->textfilters);\n $textfilters = explode(',', $CFG->textfilters);\n foreach ($textfilters as $key => $textfilter) {\n $textfilters[$key] = trim($textfilter);\n }\n set_config(\"textfilters\", implode(',',$textfilters));\n }\n }\n\n if ($oldversion < 2004030702) { /// Because of the renaming of Czech language pack\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang = 'cs' WHERE lang = 'cz'\");\n execute_sql(\"UPDATE {$CFG->prefix}course SET lang = 'cs' WHERE lang = 'cz'\");\n }\n\n if ($oldversion < 2004041800) { /// Integrate Block System from contrib\n table_column(\"course\", \"\", \"blockinfo\", \"varchar\", \"255\", \"\", \"\", \"not null\", \"modinfo\");\n }\n\n if ($oldversion < 2004042600) { /// Rebuild course caches for resource icons\n include_once(\"$CFG->dirroot/course/lib.php\");\n rebuild_course_cache();\n }\n\n if ($oldversion < 2004042700) { /// Increase size of lang fields\n table_column(\"user\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"en\");\n table_column(\"groups\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"\");\n table_column(\"course\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"\");\n }\n\n if ($oldversion < 2004042701) { /// Add hiddentopics field to control hidden topics behaviour\n table_column(\"course\", \"\", \"hiddentopics\", \"integer\", \"1\", \"unsigned\", \"0\", \"not null\", \"visible\");\n }\n\n if ($oldversion < 2004042702) { /// add a format field for the description\n table_column(\"event\", \"\", \"format\", \"integer\", \"4\", \"unsigned\", \"0\", \"not null\", \"description\");\n }\n\n if ($oldversion < 2004042900) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP `showrecent` \");\n }\n\n if ($oldversion < 2004043001) { /// Change hiddentopics to hiddensections\n table_column(\"course\", \"hiddentopics\", \"hiddensections\", \"integer\", \"2\", \"unsigned\", \"0\", \"not null\");\n }\n\n if ($oldversion < 2004050400) { /// add a visible field for events\n table_column(\"event\", \"\", \"visible\", \"tinyint\", \"1\", \"\", \"1\", \"not null\", \"timeduration\");\n if ($events = get_records('event')) {\n foreach($events as $event) {\n if ($moduleid = get_field('modules', 'id', 'name', $event->modulename)) {\n if (get_field('course_modules', 'visible', 'module', $moduleid, 'instance', $event->instance) == 0) {\n set_field('event', 'visible', 0, 'id', $event->id);\n }\n }\n }\n }\n }\n\n if ($oldversion < 2004052800) { /// First version tagged \"1.4 development\", version.php 1.227\n set_config('siteblocksadded', true); /// This will be used later by the block upgrade\n }\n\n if ($oldversion < 2004053000) { /// set defaults for site course\n $site = get_site();\n set_field('course', 'numsections', 0, 'id', $site->id);\n set_field('course', 'groupmodeforce', 1, 'id', $site->id);\n set_field('course', 'teacher', get_string('administrator'), 'id', $site->id);\n set_field('course', 'teachers', get_string('administrators'), 'id', $site->id);\n set_field('course', 'student', get_string('user'), 'id', $site->id);\n set_field('course', 'students', get_string('users'), 'id', $site->id);\n }\n\n if ($oldversion < 2004060100) {\n set_config('digestmailtime', 0);\n table_column('user', \"\", 'maildigest', 'tinyint', '1', '', '0', 'not null', 'mailformat');\n }\n\n if ($oldversion < 2004062400) {\n table_column('user_teachers', \"\", 'timeend', 'int', '10', 'unsigned', '0', 'not null', 'editall');\n table_column('user_teachers', \"\", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall');\n }\n\n if ($oldversion < 2004062401) {\n table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname');\n execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default\n }\n\n if ($oldversion < 2004062600) {\n table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang');\n }\n\n if ($oldversion < 2004072900) {\n table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate');\n }\n\n if ($oldversion < 2004072901) { // Fixing error in schema\n if ($record = get_record('log_display', 'module', 'course', 'action', 'update')) {\n delete_records('log_display', 'module', 'course', 'action', 'update');\n insert_record('log_display', $record, false);\n }\n }\n\n if ($oldversion < 2004081200) { // Fixing version errors in some blocks\n set_field('blocks', 'version', 2004081200, 'name', 'admin');\n set_field('blocks', 'version', 2004081200, 'name', 'calendar_month');\n set_field('blocks', 'version', 2004081200, 'name', 'course_list');\n }\n\n if ($oldversion < 2004081500) { // Adding new \"auth\" field to user table to allow more flexibility\n table_column('user', '', 'auth', 'varchar', '20', '', 'manual', 'not null', 'id');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = 'manual'\"); // Set everyone to 'manual' to be sure\n\n if ($admins = get_admins()) { // Set all the NON-admins to whatever the current auth module is\n $adminlist = array();\n foreach ($admins as $user) {\n $adminlist[] = $user->id; \n }\n $adminlist = implode(',', $adminlist);\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)\");\n }\n }\n \n if ($oldversion < 2004082200) { // Making admins teachers on site course\n $site = get_site();\n $admins = get_admins();\n foreach ($admins as $admin) {\n add_teacher($admin->id, $site->id);\n }\n }\n\n if ($oldversion < 2004082600) {\n //update auth-fields for external users\n // following code would not work in 1.8\n/* include_once ($CFG->dirroot.\"/auth/\".$CFG->auth.\"/lib.php\");\n if (function_exists('auth_get_userlist')) {\n $externalusers = auth_get_userlist();\n if (!empty($externalusers)){\n $externalusers = '\\''. implode('\\',\\'',$externalusers).'\\'';\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE username IN ($externalusers)\");\n }\n }*/\n }\n\n if ($oldversion < 2004082900) { // Make sure guest is \"manual\" too.\n set_field('user', 'auth', 'manual', 'username', 'guest');\n }\n \n /* Commented out unused guid-field code\n if ($oldversion < 2004090300) { // Add guid-field used in user syncronization\n table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth');\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX authguid (auth, guid)\");\n }\n */\n\n if ($oldversion < 2004091900) { // modify idnumber to hold longer values\n table_column('user', 'idnumber', 'idnumber', 'varchar', '64', '', '', '', '');\n execute_sql(\"ALTER TABLE {$CFG->prefix}user DROP INDEX user_idnumber\",false); // added in case of conflicts with upgrade from 14stable\n execute_sql(\"ALTER TABLE {$CFG->prefix}user DROP INDEX user_auth\",false); // added in case of conflicts with upgrade from 14stable\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX idnumber (idnumber)\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX auth (auth)\");\n }\n\n if ($oldversion < 2004093001) { // add new table for sessions storage\n execute_sql(\" CREATE TABLE `{$CFG->prefix}sessions` (\n `sesskey` char(32) NOT null,\n `expiry` int(11) unsigned NOT null,\n `expireref` varchar(64),\n `data` text NOT null,\n PRIMARY KEY (`sesskey`), \n KEY (`expiry`) \n ) TYPE=MyISAM COMMENT='Optional database session storage, not used by default';\");\n }\n\n if ($oldversion < 2004111500) { // Update any users/courses using wrongly-named lang pack\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang = 'mi_nt' WHERE lang = 'ma_nt'\");\n execute_sql(\"UPDATE {$CFG->prefix}course SET lang = 'mi_nt' WHERE lang = 'ma_nt'\");\n }\n\n if ($oldversion < 2004111700) { // add indexes. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP INDEX idnumber;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP INDEX shortname;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` DROP INDEX userid;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` DROP INDEX userid;\",false);\n\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX idnumber (idnumber);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX shortname (shortname);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX userid (userid);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX userid (userid);\");\n }\n\n if ($oldversion < 2004111700) {// add an index to event for timestart and timeduration. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}event DROP INDEX timestart;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}event DROP INDEX timeduration;\",false); \n\n modify_database('','ALTER TABLE prefix_event ADD INDEX timestart (timestart);');\n modify_database('','ALTER TABLE prefix_event ADD INDEX timeduration (timeduration);');\n }\n\n if ($oldversion < 2004111700) { //add indexes on modules and course_modules. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key visible;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key course;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key module;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key instance;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key deleted;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}modules drop key name;\",false);\n\n modify_database('','ALTER TABLE prefix_course_modules add key visible(visible);');\n modify_database('','ALTER TABLE prefix_course_modules add key course(course);');\n modify_database('','ALTER TABLE prefix_course_modules add key module(module);');\n modify_database('','ALTER TABLE prefix_course_modules add key instance (instance);');\n modify_database('','ALTER TABLE prefix_course_modules add key deleted (deleted);');\n modify_database('','ALTER TABLE prefix_modules add key name(name);');\n }\n\n if ($oldversion < 2004111700) { // add an index on the groups_members table. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}groups_members DROP INDEX userid;\",false);\n\n modify_database('','ALTER TABLE prefix_groups_members ADD INDEX userid (userid);');\n }\n\n if ($oldversion < 2004111700) { // add an index on user students timeaccess (used for sorting)- drop them first silently to avoid conflicts when upgrading\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_students DROP INDEX timeaccess;\",false);\n\n modify_database('','ALTER TABLE prefix_user_students ADD INDEX timeaccess (timeaccess);');\n }\n\n if ($oldversion < 2004111700) { // add indexes on faux-foreign keys. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}scale DROP INDEX courseid;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_admins DROP INDEX userid;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_coursecreators DROP INDEX userid;\",false);\n\n modify_database('','ALTER TABLE prefix_scale ADD INDEX courseid (courseid);');\n modify_database('','ALTER TABLE prefix_user_admins ADD INDEX userid (userid);');\n modify_database('','ALTER TABLE prefix_user_coursecreators ADD INDEX userid (userid);');\n }\n\n if ($oldversion < 2004111700) { // replace index on course\n fix_course_sortorder(0,0,1);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}course` DROP KEY category\",false);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}course` DROP KEY category_sortorder;\",false);\n modify_database('', \"ALTER TABLE `prefix_course` ADD UNIQUE KEY category_sortorder(category,sortorder)\"); \n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;\",false); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;\",false); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;\",false);\n\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_deleted_idx (deleted)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_confirmed_idx (confirmed)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_firstname_idx (firstname)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastname_idx (lastname)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_city_idx (city)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_country_idx (country)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastaccess_idx (lastaccess)\");\n }\n \n if ($oldversion < 2004111700) { // one more index for email (for sorting)\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_email_idx;\",false);\n modify_database('','ALTER TABLE `prefix_user` ADD INDEX prefix_user_email_idx (email);');\n }\n\n if ($oldversion < 2004112200) { // new 'enrol' field for enrolment tables\n table_column('user_students', '', 'enrol', 'varchar', '20', '', '', 'not null');\n table_column('user_teachers', '', 'enrol', 'varchar', '20', '', '', 'not null');\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX enrol (enrol);\");\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX enrol (enrol);\");\n }\n \n if ($oldversion < 2004112400) {\n /// Delete duplicate enrolments \n /// and then tell the database course,userid is a unique combination\n if ($users = get_records_select(\"user_students\", \"userid > 0 GROUP BY course, userid \".\n \"HAVING count(*) > 1\", \"\", \"max(id) as id, userid, course ,count(*)\")) {\n foreach ($users as $user) {\n delete_records_select(\"user_students\", \"userid = '$user->userid' \".\n \"AND course = '$user->course' AND id <> '$user->id'\");\n }\n }\n flush();\n \n modify_database('','ALTER TABLE prefix_user_students DROP INDEX courseuserid;');\n modify_database('','ALTER TABLE prefix_user_students ADD UNIQUE INDEX courseuserid(course,userid);'); \n\n /// Delete duplicate teacher enrolments \n /// and then tell the database course,userid is a unique combination\n if ($users = get_records_select(\"user_teachers\", \"userid > 0 GROUP BY course, userid \".\n \"HAVING count(*) > 1\", \"\", \"max(id) as id, userid, course ,count(*)\")) {\n foreach ($users as $user) {\n delete_records_select(\"user_teachers\", \"userid = '$user->userid' \".\n \"AND course = '$user->course' AND id <> '$user->id'\");\n }\n }\n flush();\n modify_database('','ALTER TABLE prefix_user_teachers DROP INDEX courseuserid;');\n modify_database('','ALTER TABLE prefix_user_teachers ADD UNIQUE INDEX courseuserid(course,userid);'); \n } \n\n if ($oldversion < 2004112900) {\n table_column('user', '', 'policyagreed', 'integer', '1', 'unsigned', '0', 'not null', 'confirmed');\n }\n\n if ($oldversion < 2004121400) {\n table_column('groups', '', 'password', 'varchar', '50', '', '', 'not null', 'description');\n }\n\n if ($oldversion < 2004121500) {\n modify_database('',\"CREATE TABLE prefix_dst_preset (\n id int(10) NOT NULL auto_increment,\n name char(48) default '' NOT NULL,\n \n apply_offset tinyint(3) default '0' NOT NULL,\n \n activate_index tinyint(1) default '1' NOT NULL,\n activate_day tinyint(1) default '1' NOT NULL,\n activate_month tinyint(2) default '1' NOT NULL,\n activate_time char(5) default '03:00' NOT NULL,\n \n deactivate_index tinyint(1) default '1' NOT NULL,\n deactivate_day tinyint(1) default '1' NOT NULL,\n deactivate_month tinyint(2) default '2' NOT NULL,\n deactivate_time char(5) default '03:00' NOT NULL,\n \n last_change int(10) default '0' NOT NULL,\n next_change int(10) default '0' NOT NULL,\n current_offset tinyint(3) default '0' NOT NULL,\n \n PRIMARY KEY (id))\");\n } \n\n if ($oldversion < 2004122800) {\n execute_sql(\"DROP TABLE {$CFG->prefix}message\", false);\n execute_sql(\"DROP TABLE {$CFG->prefix}message_read\", false);\n execute_sql(\"DROP TABLE {$CFG->prefix}message_contacts\", false);\n\n modify_database('',\"CREATE TABLE `prefix_message` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `useridfrom` int(10) NOT NULL default '0',\n `useridto` int(10) NOT NULL default '0',\n `message` text NOT NULL,\n `timecreated` int(10) NOT NULL default '0',\n `messagetype` varchar(50) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `useridfrom` (`useridfrom`),\n KEY `useridto` (`useridto`)\n ) TYPE=MyISAM COMMENT='Stores all unread messages';\");\n\n modify_database('',\"CREATE TABLE `prefix_message_read` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `useridfrom` int(10) NOT NULL default '0',\n `useridto` int(10) NOT NULL default '0',\n `message` text NOT NULL,\n `timecreated` int(10) NOT NULL default '0',\n `timeread` int(10) NOT NULL default '0',\n `messagetype` varchar(50) NOT NULL default '',\n `mailed` tinyint(1) NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `useridfrom` (`useridfrom`),\n KEY `useridto` (`useridto`)\n ) TYPE=MyISAM COMMENT='Stores all messages that have been read';\");\n\n modify_database('',\"CREATE TABLE `prefix_message_contacts` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `contactid` int(10) unsigned NOT NULL default '0',\n `blocked` tinyint(1) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `usercontact` (`userid`,`contactid`)\n ) TYPE=MyISAM COMMENT='Maintains lists of relationships between users';\");\n\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'write', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'read', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n }\n\n if ($oldversion < 2004122801) {\n table_column('message', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message');\n table_column('message_read', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message');\n }\n\n if ($oldversion < 2005010100) {\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'add contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'remove contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'block contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'unblock contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n }\n\n if ($oldversion < 2005011000) { // Create a .htaccess file in dataroot, just in case\n if (!file_exists($CFG->dataroot.'/.htaccess')) {\n if ($handle = fopen($CFG->dataroot.'/.htaccess', 'w')) { // For safety\n @fwrite($handle, \"deny from all\\r\\nAllowOverride None\\r\\n\");\n @fclose($handle); \n notify(\"Created a default .htaccess file in $CFG->dataroot\");\n }\n }\n }\n \n\n if ($oldversion < 2005012500) { \n /*\n // add new table for meta courses.\n modify_database(\"\",\"CREATE TABLE `prefix_meta_course` (\n `id` int(1) unsigned NOT NULL auto_increment,\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course)\n );\");\n // add flag to course field\n table_column('course','','meta_course','integer','1','','0','not null');\n */ // taking this OUT for upgrade from 1.4 to 1.5 (those tracking head will have already seen it)\n }\n\n if ($oldversion < 2005012501) { \n execute_sql(\"DROP TABLE {$CFG->prefix}meta_course\",false); // drop silently\n execute_sql(\"ALTER TABLE {$CFG->prefix}course DROP COLUMN meta_course\",false); // drop silently\n \n // add new table for meta courses.\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course)\n );\");\n // add flag to course field\n table_column('course','','metacourse','integer','1','','0','not null');\n }\n\n if ($oldversion < 2005012800) {\n // fix a typo (int 1 becomes int 10) \n table_column('course_meta','id','id','integer','10','','0','not null');\n }\n\n if ($oldversion < 2005020100) {\n fix_course_sortorder(0, 1, 1);\n } \n\n\n if ($oldversion < 2005020101) {\n // hopefully this is the LAST TIME we need to do this ;)\n if ($rows = count_records(\"course_meta\")) {\n // we need to upgrade\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta_tmp` (\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0);\");\n \n execute_sql(\"INSERT INTO {$CFG->prefix}course_meta_tmp (parent_course,child_course) \n SELECT {$CFG->prefix}course_meta.parent_course, {$CFG->prefix}course_meta.child_course\n FROM {$CFG->prefix}course_meta\");\n $insertafter = true;\n }\n\n execute_sql(\"DROP TABLE {$CFG->prefix}course_meta\");\n\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `parent_course` int(10) unsigned NOT NULL default 0,\n `child_course` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course));\");\n\n if (!empty($insertafter)) {\n execute_sql(\"INSERT INTO {$CFG->prefix}course_meta (parent_course,child_course) \n SELECT {$CFG->prefix}course_meta_tmp.parent_course, {$CFG->prefix}course_meta_tmp.child_course\n FROM {$CFG->prefix}course_meta_tmp\");\n\n execute_sql(\"DROP TABLE {$CFG->prefix}course_meta_tmp\");\n }\n }\n\n if ($oldversion < 2005020800) { // Expand module column to max 20 chars\n table_column('log','module','module','varchar','20','','','not null');\n }\n\n if ($oldversion < 2005021000) { // New fields for theme choices\n table_column('course', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n table_column('groups', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n table_column('user', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n\n set_config('theme', 'standardwhite'); // Reset to a known good theme \n }\n \n if ($oldversion < 2005021600) { // course.idnumber should be varchar(100)\n table_column('course', 'idnumber', 'idnumber', 'varchar', '100', '', '', '', '');\n }\n\n if ($oldversion < 2005021700) {\n table_column('user', '', 'dstpreset', 'int', '10', '', '0', 'not null', 'timezone');\n }\n\n if ($oldversion < 2005021800) { // For database debugging, not for normal use\n modify_database(\"\",\" CREATE TABLE `adodb_logsql` (\n `created` datetime NOT NULL,\n `sql0` varchar(250) NOT NULL,\n `sql1` text NOT NULL,\n `params` text NOT NULL,\n `tracer` text NOT NULL,\n `timer` decimal(16,6) NOT NULL\n );\");\n }\n\n if ($oldversion < 2005022400) {\n // Add more visible digits to the fields\n table_column('dst_preset', 'activate_index', 'activate_index', 'tinyint', '2', '', '0', 'not null');\n table_column('dst_preset', 'activate_day', 'activate_day', 'tinyint', '2', '', '0', 'not null');\n // Add family and year fields\n table_column('dst_preset', '', 'family', 'varchar', '100', '', '', 'not null', 'name');\n table_column('dst_preset', '', 'year', 'int', '10', '', '0', 'not null', 'family');\n }\n\n if ($oldversion < 2005030501) {\n table_column('user', '', 'msn', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'aim', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'yahoo', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'skype', 'varchar', '50', '', '', '', 'icq');\n }\n\n if ($oldversion < 2005032300) {\n table_column('user', 'dstpreset', 'timezonename', 'varchar', '100');\n execute_sql('UPDATE `'.$CFG->prefix.'user` SET timezonename = \\'\\'');\n }\n\n if ($oldversion < 2005032600) {\n execute_sql('DROP TABLE '.$CFG->prefix.'dst_preset', false);\n modify_database('',\"CREATE TABLE `prefix_timezone` (\n `id` int(10) NOT NULL auto_increment,\n `name` varchar(100) NOT NULL default '',\n `year` int(11) NOT NULL default '0',\n `rule` varchar(20) NOT NULL default '',\n `gmtoff` int(11) NOT NULL default '0',\n `dstoff` int(11) NOT NULL default '0',\n `dst_month` tinyint(2) NOT NULL default '0',\n `dst_startday` tinyint(3) NOT NULL default '0',\n `dst_weekday` tinyint(3) NOT NULL default '0',\n `dst_skipweeks` tinyint(3) NOT NULL default '0',\n `dst_time` varchar(5) NOT NULL default '00:00',\n `std_month` tinyint(2) NOT NULL default '0',\n `std_startday` tinyint(3) NOT NULL default '0',\n `std_weekday` tinyint(3) NOT NULL default '0',\n `std_skipweeks` tinyint(3) NOT NULL default '0',\n `std_time` varchar(5) NOT NULL default '00:00',\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM COMMENT='Rules for calculating local wall clock time for users';\");\n }\n\n if ($oldversion < 2005032800) {\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_category` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(64) NOT NULL default '',\n `courseid` int(10) unsigned NOT NULL default '0',\n `drop_x_lowest` int(10) unsigned NOT NULL default '0',\n `bonus_points` int(10) unsigned NOT NULL default '0',\n `hidden` int(10) unsigned NOT NULL default '0',\n `weight` decimal(4,2) NOT NULL default '0.00',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_exceptions` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `grade_itemid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_item` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `category` int(10) unsigned NOT NULL default '0',\n `modid` int(10) unsigned NOT NULL default '0',\n `cminstance` int(10) unsigned NOT NULL default '0',\n `scale_grade` float(11,10) default '1.0000000000',\n `extra_credit` int(10) unsigned NOT NULL default '0',\n `sort_order` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_letter` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `letter` varchar(8) NOT NULL default 'NA',\n `grade_high` decimal(4,2) NOT NULL default '100.00',\n `grade_low` decimal(4,2) NOT NULL default '0.00',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n \n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_preferences` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `preference` int(10) NOT NULL default '0',\n `value` int(10) NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `courseidpreference` (`courseid`,`preference`)\n ) TYPE=MyISAM ;\");\n \n }\n\n if ($oldversion < 2005033100) { // Get rid of defunct field from course modules table\n delete_records('course_modules', 'deleted', 1); // Delete old records we don't need any more\n execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP INDEX `deleted`'); // Old index\n execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP `deleted`'); // Old field\n }\n\n if ($oldversion < 2005040800) {\n table_column('user', 'timezone', 'timezone', 'varchar', '100', '', '99');\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user` DROP `timezonename` \");\n }\n \n if ($oldversion < 2005041101) {\n require_once($CFG->libdir.'/filelib.php');\n if (is_readable($CFG->dirroot.'/lib/timezones.txt')) { // Distribution file\n if ($timezones = get_records_csv($CFG->dirroot.'/lib/timezones.txt', 'timezone')) {\n $db->debug = false;\n update_timezone_records($timezones);\n notify(count($timezones).' timezones installed');\n $db->debug = true;\n }\n }\n }\n\n if ($oldversion < 2005041900) { // Copy all Dialogue entries into Messages, and hide Dialogue module\n\n if ($entries = get_records_sql('SELECT e.id, e.userid, c.recipientid, e.text, e.timecreated\n FROM '.$CFG->prefix.'dialogue_conversations c,\n '.$CFG->prefix.'dialogue_entries e\n WHERE e.conversationid = c.id')) {\n foreach ($entries as $entry) {\n $message = new object;\n $message->useridfrom = $entry->userid;\n $message->useridto = $entry->recipientid;\n $message->message = addslashes($entry->text);\n $message->format = FORMAT_HTML;\n $message->timecreated = $entry->timecreated;\n $message->messagetype = 'direct';\n \n insert_record('message_read', $message);\n }\n }\n\n set_field('modules', 'visible', 0, 'name', 'dialogue');\n\n notify('The Dialogue module has been disabled, and all the old Messages from it copied into the new standard Message feature. If you really want Dialogue back, you can enable it using the \"eye\" icon here: Admin >> Modules >> Dialogue');\n\n }\n\n if ($oldversion < 2005042100) {\n $result = table_column('event', '', 'repeatid', 'int', '10', 'unsigned', '0', 'not null', 'userid') && $result;\n }\n\n if ($oldversion < 2005042400) { // Add user tracking prefs field.\n table_column('user', '', 'trackforums', 'int', '4', 'unsigned', '0', 'not null', 'autosubscribe');\n }\n\n if ($oldversion < 2005053000 ) { // Add config_plugins table\n \n // this table was created on the MOODLE_15_STABLE branch\n // so it may already exist.\n $result = execute_sql(\"CREATE TABLE IF NOT EXISTS `{$CFG->prefix}config_plugins` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `plugin` varchar(100) NOT NULL default 'core',\n `name` varchar(100) NOT NULL default '',\n `value` text NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `plugin_name` (`plugin`, `name`)\n ) TYPE=MyISAM \n COMMENT='Moodle modules and plugins configuration variables';\");\n }\n\n if ($oldversion < 2005060200) { // migrate some config items to config_plugins table\n\n // NOTE: this block is in both postgres AND mysql upgrade\n // files. If you edit either, update the otherone. \n $user_fields = array(\"firstname\", \"lastname\", \"email\", \n \"phone1\", \"phone2\", \"department\", \n \"address\", \"city\", \"country\", \n \"description\", \"idnumber\", \"lang\");\n if (!empty($CFG->auth)) { // if we have no auth, just pass\n foreach ($user_fields as $field) {\n $suffixes = array('', '_editlock', '_updateremote', '_updatelocal');\n foreach ($suffixes as $suffix) {\n $key = 'auth_user_' . $field . $suffix;\n if (isset($CFG->$key)) {\n \n // translate keys & values\n // to the new convention\n // this should support upgrading \n // even 1.5dev installs\n $newkey = $key;\n $newval = $CFG->$key;\n if ($suffix === '') {\n $newkey = 'field_map_' . $field;\n } elseif ($suffix === '_editlock') {\n $newkey = 'field_lock_' . $field;\n $newval = ($newval==1) ? 'locked' : 'unlocked'; // translate 0/1 to locked/unlocked\n } elseif ($suffix === '_updateremote') {\n $newkey = 'field_updateremote_' . $field; \n } elseif ($suffix === '_updatelocal') {\n $newkey = 'field_updatelocal_' . $field;\n $newval = ($newval==1) ? 'onlogin' : 'oncreate'; // translate 0/1 to locked/unlocked\n }\n\n if (!(set_config($newkey, addslashes($newval), 'auth/'.$CFG->auth)\n && delete_records('config', 'name', $key))) {\n notify(\"Error updating Auth configuration $key to {$CFG->auth} $newkey .\");\n $result = false;\n }\n } // end if isset key\n } // end foreach suffix\n } // end foreach field\n }\n }\n\n if ($oldversion < 2005060201) { // Close down the Attendance module, we are removing it from CVS.\n if (!file_exists($CFG->dirroot.'/mod/attendance/lib.php')) {\n if (count_records('attendance')) { // We have some data, so should keep it\n\n set_field('modules', 'visible', 0, 'name', 'attendance');\n notify('The Attendance module has been discontinued. If you really want to \n continue using it, you should download it individually from \n http://download.moodle.org/modules and install it, then \n reactivate it from Admin >> Configuration >> Modules. \n None of your existing data has been deleted, so all existing \n Attendance activities should re-appear.');\n\n } else { // No data, so do a complete delete\n\n execute_sql('DROP TABLE '.$CFG->prefix.'attendance', false);\n delete_records('modules', 'name', 'attendance');\n notify(\"The Attendance module has been discontinued and removed from your site. \n You weren't using it anyway. ;-)\");\n }\n }\n }\n\n if ($oldversion < 2005071700) { // Close down the Dialogue module, we are removing it from CVS.\n if (!file_exists($CFG->dirroot.'/mod/dialogue/lib.php')) {\n if (count_records('dialogue')) { // We have some data, so should keep it\n\n set_field('modules', 'visible', 0, 'name', 'dialogue');\n notify('The Dialogue module has been discontinued. If you really want to \n continue using it, you should download it individually from \n http://download.moodle.org/modules and install it, then \n reactivate it from Admin >> Configuration >> Modules. \n None of your existing data has been deleted, so all existing \n Dialogue activities should re-appear.');\n\n } else { // No data, so do a complete delete\n\n execute_sql('DROP TABLE '.$CFG->prefix.'dialogue', false);\n delete_records('modules', 'name', 'dialogue');\n notify(\"The Dialogue module has been discontinued and removed from your site. \n You weren't using it anyway. ;-)\");\n }\n }\n }\n\n if ($oldversion < 2005072000) { // Add a couple fields to mdl_event to work towards iCal import/export\n table_column('event', '', 'uuid', 'char', '36', '', '', 'not null', 'visible');\n table_column('event', '', 'sequence', 'integer', '10', 'unsigned', '1', 'not null', 'uuid');\n }\n\n if ($oldversion < 2005072100) { // run the online assignment cleanup code\n include($CFG->dirroot.'/'.$CFG->admin.'/oacleanup.php');\n if (function_exists('online_assignment_cleanup')) {\n online_assignment_cleanup();\n }\n }\n\n if ($oldversion < 2005072200) { // fix the mistakenly-added currency stuff from enrol/authorize\n execute_sql(\"DROP TABLE {$CFG->prefix}currencies\", false); // drop silently\n execute_sql(\"ALTER TABLE {$CFG->prefix}course DROP currency\", false);\n $defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency;\n table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost');\n }\n\n if ($oldversion < 2005081600) { //set up the course requests table\n modify_database('',\"CREATE TABLE `prefix_course_request` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `fullname` varchar(254) NOT NULL default '',\n `shortname` varchar(15) NOT NULL default '',\n `summary` text NOT NULL,\n `reason` text NOT NULL,\n `requester` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `shortname` (`shortname`)\n ) TYPE=MyISAM;\");\n \n table_column('course','','requested');\n }\n\n if ($oldversion < 2005081601) {\n modify_database('',\"CREATE TABLE `prefix_course_allowed_modules` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `course` int(10) unsigned NOT NULL default 0,\n `module` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `course` (`course`),\n KEY `module` (`module`)\n ) TYPE=MyISAM;\");\n \n table_column('course','','restrictmodules','int','1','','0','not null');\n }\n\n if ($oldversion < 2005081700) {\n table_column('course_categories','','depth','integer');\n table_column('course_categories','','path','varchar','255');\n }\n\n if ($oldversion < 2005090100) {\n modify_database(\"\",\"CREATE TABLE `prefix_stats_daily` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `students` int(10) unsigned NOT NULL default 0,\n `teachers` int(10) unsigned NOT NULL default 0,\n `activestudents` int(10) unsigned NOT NULL default 0,\n `activeteachers` int(10) unsigned NOT NULL default 0,\n `studentreads` int(10) unsigned NOT NULL default 0,\n `studentwrites` int(10) unsigned NOT NULL default 0,\n `teacherreads` int(10) unsigned NOT NULL default 0,\n `teacherwrites` int(10) unsigned NOT NULL default 0,\n `logins` int(10) unsigned NOT NULL default 0,\n `uniquelogins` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_weekly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `students` int(10) unsigned NOT NULL default 0,\n `teachers` int(10) unsigned NOT NULL default 0,\n `activestudents` int(10) unsigned NOT NULL default 0,\n `activeteachers` int(10) unsigned NOT NULL default 0,\n `studentreads` int(10) unsigned NOT NULL default 0,\n `studentwrites` int(10) unsigned NOT NULL default 0,\n `teacherreads` int(10) unsigned NOT NULL default 0,\n `teacherwrites` int(10) unsigned NOT NULL default 0,\n `logins` int(10) unsigned NOT NULL default 0,\n `uniquelogins` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_monthly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `students` int(10) unsigned NOT NULL default 0,\n `teachers` int(10) unsigned NOT NULL default 0,\n `activestudents` int(10) unsigned NOT NULL default 0,\n `activeteachers` int(10) unsigned NOT NULL default 0,\n `studentreads` int(10) unsigned NOT NULL default 0,\n `studentwrites` int(10) unsigned NOT NULL default 0,\n `teacherreads` int(10) unsigned NOT NULL default 0,\n `teacherwrites` int(10) unsigned NOT NULL default 0,\n `logins` int(10) unsigned NOT NULL default 0,\n `uniquelogins` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_user_daily (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `userid` int(10) unsigned NOT NULL default 0,\n `roleid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `statsreads` int(10) unsigned NOT NULL default 0,\n `statswrites` int(10) unsigned NOT NULL default 0,\n `stattype` varchar(30) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`),\n KEY `roleid` (`roleid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_user_weekly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `userid` int(10) unsigned NOT NULL default 0,\n `roleid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `statsreads` int(10) unsigned NOT NULL default 0,\n `statswrites` int(10) unsigned NOT NULL default 0,\n `stattype` varchar(30) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`),\n KEY `roleid` (`roleid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_user_monthly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `userid` int(10) unsigned NOT NULL default 0,\n `roleid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `statsreads` int(10) unsigned NOT NULL default 0,\n `statswrites` int(10) unsigned NOT NULL default 0,\n `stattype` varchar(30) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`),\n KEY `roleid` (`roleid`),\n KEY `timeend` (`timeend`)\n );\");\n \n }\n\n if ($oldversion < 2005100300) {\n table_column('course','','expirynotify','tinyint','1');\n table_column('course','','expirythreshold','int','10');\n table_column('course','','notifystudents','tinyint','1');\n $new = new stdClass();\n $new->name = 'lastexpirynotify';\n $new->value = 0;\n insert_record('config', $new);\n }\n\n if ($oldversion < 2005100400) {\n table_column('course','','enrollable','tinyint','1','unsigned','1');\n table_column('course','','enrolstartdate','int');\n table_column('course','','enrolenddate','int');\n }\n\n if ($oldversion < 2005101200) { // add enrolment key to course_request.\n table_column('course_request','','password','varchar',50);\n }\n\n if ($oldversion < 2006030800) { # add extra indexes to log (see bug #4112)\n modify_database('',\"ALTER TABLE prefix_log ADD INDEX userid (userid);\");\n modify_database('',\"ALTER TABLE prefix_log ADD INDEX info (info);\");\n }\n\n if ($oldversion < 2006030900) {\n table_column('course','','enrol','varchar','20','','');\n\n if ($CFG->enrol == 'internal' || $CFG->enrol == 'manual') {\n set_config('enrol_plugins_enabled', 'manual');\n set_config('enrol', 'manual');\n } else {\n set_config('enrol_plugins_enabled', 'manual,'.$CFG->enrol);\n }\n\n require_once(\"$CFG->dirroot/enrol/enrol.class.php\");\n $defaultenrol = enrolment_factory::factory($CFG->enrol);\n if (!method_exists($defaultenrol, 'print_entry')) { // switch enrollable to off for all courses in this case\n modify_database('', 'UPDATE prefix_course SET enrollable = 0');\n }\n\n execute_sql(\"UPDATE {$CFG->prefix}user_students SET enrol='manual' WHERE enrol='' OR enrol='internal'\");\n execute_sql(\"UPDATE {$CFG->prefix}user_teachers SET enrol='manual' WHERE enrol=''\");\n\n }\n \n if ($oldversion < 2006031000) {\n\n modify_database(\"\",\"CREATE TABLE prefix_post (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `courseid` int(10) unsigned NOT NULL default'0',\n `groupid` int(10) unsigned NOT NULL default'0',\n `moduleid` int(10) unsigned NOT NULL default'0',\n `coursemoduleid` int(10) unsigned NOT NULL default'0',\n `subject` varchar(128) NOT NULL default '',\n `summary` longtext,\n `content` longtext,\n `uniquehash` varchar(128) NOT NULL default '',\n `rating` int(10) unsigned NOT NULL default'0',\n `format` int(10) unsigned NOT NULL default'0',\n `publishstate` enum('draft','site','public') NOT NULL default 'draft',\n `lastmodified` int(10) unsigned NOT NULL default '0',\n `created` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id_user_idx` (`id`, `userid`),\n KEY `post_lastmodified_idx` (`lastmodified`),\n KEY `post_subject_idx` (`subject`)\n ) TYPE=MyISAM COMMENT='New moodle post table. Holds data posts such as forum entries or blog entries.';\");\n\n modify_database(\"\",\"CREATE TABLE prefix_tags (\n `id` int(10) unsigned NOT NULL auto_increment,\n `type` varchar(255) NOT NULL default 'official',\n `userid` int(10) unsigned NOT NULL default'0',\n `text` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM COMMENT ='tags structure for moodle.';\");\n\n modify_database(\"\",\"CREATE TABLE prefix_blog_tag_instance (\n `id` int(10) unsigned NOT NULL auto_increment,\n `entryid` int(10) unsigned NOT NULL default'0',\n `tagid` int(10) unsigned NOT NULL default'0',\n `groupid` int(10) unsigned NOT NULL default'0',\n `courseid` int(10) unsigned NOT NULL default'0',\n `userid` int(10) unsigned NOT NULL default'0',\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM COMMENT ='tag instance for blogs.';\");\n }\n\n if ($oldversion < 2006031400) {\n require_once(\"$CFG->dirroot/enrol/enrol.class.php\");\n $defaultenrol = enrolment_factory::factory($CFG->enrol);\n if (!method_exists($defaultenrol, 'print_entry')) {\n set_config('enrol', 'manual');\n }\n }\n \n if ($oldversion < 2006031600) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}grade_category` CHANGE `weight` `weight` decimal(5,2) default '0.00';\");\n }\n\n if ($oldversion < 2006032000) {\n table_column('post','','module','varchar','20','','','not null', 'id');\n modify_database('',\"ALTER TABLE prefix_post ADD INDEX post_module_idx (module);\");\n modify_database('',\"UPDATE prefix_post SET module = 'blog';\");\n }\n\n if ($oldversion < 2006032001) {\n table_column('blog_tag_instance','','timemodified','integer','10','unsigned','0','not null', 'userid');\n modify_database('',\"ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_entryid_idx (entryid);\");\n modify_database('',\"ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_tagid_idx (tagid);\");\n modify_database('',\"UPDATE prefix_blog_tag_instance SET timemodified = '\".time().\"';\");\n }\n\n if ($oldversion < 2006040500) { // Add an index to course_sections that was never upgraded (bug 5100)\n execute_sql(\" CREATE INDEX coursesection ON {$CFG->prefix}course_sections (course,section) \", false);\n }\n\n /// change all the int(11) to int(10) for blogs and tags\n\n if ($oldversion < 2006041000) {\n table_column('post','id','id','integer','10','unsigned','0','not null');\n table_column('post','userid','userid','integer','10','unsigned','0','not null');\n table_column('post','courseid','courseid','integer','10','unsigned','0','not null');\n table_column('post','groupid','groupid','integer','10','unsigned','0','not null');\n table_column('post','moduleid','moduleid','integer','10','unsigned','0','not null');\n table_column('post','coursemoduleid','coursemoduleid','integer','10','unsigned','0','not null');\n table_column('post','rating','rating','integer','10','unsigned','0','not null');\n table_column('post','format','format','integer','10','unsigned','0','not null');\n table_column('tags','id','id','integer','10','unsigned','0','not null');\n table_column('tags','userid','userid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','id','id','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','entryid','entryid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','tagid','tagid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','groupid','groupid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','courseid','courseid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','userid','userid','integer','10','unsigned','0','not null');\n }\n\n if ($oldversion < 2006041001) {\n table_column('cache_text','formattedtext','formattedtext','longblob','','','','not null');\n }\n \n if ($oldversion < 2006041100) {\n table_column('course_modules','','visibleold','integer','1','unsigned','1','not null', 'visible');\n }\n \n if ($oldversion < 2006041801) { // forgot auto_increments for ids\n modify_database('',\"ALTER TABLE prefix_post CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT\");\n modify_database('',\"ALTER TABLE prefix_tags CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT\");\n modify_database('',\"ALTER TABLE prefix_blog_tag_instance CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT\");\n }\n \n // changed user->firstname, user->lastname, course->shortname to varchar(100)\n \n if ($oldversion < 2006041900) {\n table_column('course','shortname','shortname','varchar','100','','','not null');\n table_column('user','firstname','firstname','varchar','100','','','not null');\n table_column('user','lastname','lastname','varchar','100','','','not null');\n }\n \n if ($oldversion < 2006042400) {\n // Look through table log_display and get rid of duplicates.\n $rs = get_recordset_sql('SELECT DISTINCT * FROM '.$CFG->prefix.'log_display');\n \n // Drop the log_display table and create it back with an id field.\n execute_sql(\"DROP TABLE {$CFG->prefix}log_display\", false);\n \n modify_database('', \"CREATE TABLE prefix_log_display (\n `id` int(10) unsigned NOT NULL auto_increment,\n `module` varchar(30),\n `action` varchar(40),\n `mtable` varchar(30),\n `field` varchar(50),\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM\");\n \n // Add index to ensure that module and action combination is unique.\n modify_database('', \"ALTER TABLE prefix_log_display ADD UNIQUE `moduleaction`(`module` , `action`)\");\n \n // Insert the records back in, sans duplicates.\n if ($rs && $rs->RecordCount() > 0) {\n while (!$rs->EOF) {\n $sql = \"INSERT INTO {$CFG->prefix}log_display \".\n \"VALUES('', '\".$rs->fields['module'].\"', \".\n \"'\".$rs->fields['action'].\"', \".\n \"'\".$rs->fields['mtable'].\"', \".\n \"'\".$rs->fields['field'].\"')\";\n \n execute_sql($sql, false);\n $rs->MoveNext();\n }\n }\n }\n \n // change tags->type to varchar(20), adding 2 indexes for tags table.\n if ($oldversion < 2006042401) {\n table_column('tags','type','type','varchar','20','','','not null');\n modify_database('',\"ALTER TABLE prefix_tags ADD INDEX tags_typeuserid_idx (type(20), userid)\");\n modify_database('',\"ALTER TABLE prefix_tags ADD INDEX tags_text_idx(text(255))\");\n }\n \n /***************************************************\n * The following is an effort to change all the *\n * default NULLs to NOT NULL defaut '' in all *\n * mysql tables, to prevent 5303 and be consistent *\n ***************************************************/\n\n if ($oldversion < 2006042800) {\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_category SET name='' WHERE name IS NULL\");\n table_column('grade_category','name','name','varchar','64','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_category SET weight='0' WHERE weight IS NULL\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}grade_category change weight weight decimal(5,2) NOT NULL default 0.00\");\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET courseid='0' WHERE courseid IS NULL\");\n table_column('grade_item','courseid','courseid','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET category='0' WHERE category IS NULL\");\n table_column('grade_item','category','category','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET modid='0' WHERE modid IS NULL\");\n table_column('grade_item','modid','modid','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET cminstance='0' WHERE cminstance IS NULL\");\n table_column('grade_item','cminstance','cminstance','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET scale_grade='0' WHERE scale_grade IS NULL\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}grade_item change scale_grade scale_grade float(11,10) NOT NULL default 1.0000000000\");\n \n execute_sql(\"UPDATE {$CFG->prefix}grade_preferences SET courseid='0' WHERE courseid IS NULL\");\n table_column('grade_preferences','courseid','courseid','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET idnumber='' WHERE idnumber IS NULL\");\n table_column('user','idnumber','idnumber','varchar','64','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET icq='' WHERE icq IS NULL\");\n table_column('user','icq','icq','varchar','15','','','not null');\n \n execute_sql(\"UPDATE {$CFG->prefix}user SET skype='' WHERE skype IS NULL\");\n table_column('user','skype','skype','varchar','50','','','not null');\n \n execute_sql(\"UPDATE {$CFG->prefix}user SET yahoo='' WHERE yahoo IS NULL\");\n table_column('user','yahoo','yahoo','varchar','50','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET aim='' WHERE aim IS NULL\");\n table_column('user','aim','aim','varchar','50','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET msn='' WHERE msn IS NULL\");\n table_column('user','msn','msn','varchar','50','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET phone1='' WHERE phone1 IS NULL\");\n table_column('user','phone1','phone1','varchar','20','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET phone2='' WHERE phone2 IS NULL\");\n table_column('user','phone2','phone2','varchar','20','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET institution='' WHERE institution IS NULL\");\n table_column('user','institution','institution','varchar','40','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET department='' WHERE department IS NULL\");\n table_column('user','department','department','varchar','30','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET address='' WHERE address IS NULL\");\n table_column('user','address','address','varchar','70','','','not null');\n \n execute_sql(\"UPDATE {$CFG->prefix}user SET city='' WHERE city IS NULL\");\n table_column('user','city','city','varchar','20','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET country='' WHERE country IS NULL\");\n table_column('user','country','country','char','2','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang='' WHERE lang IS NULL\");\n table_column('user','lang','lang','varchar','10','','en','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET lastIP='' WHERE lastIP IS NULL\");\n table_column('user','lastIP','lastIP','varchar','15','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET secret='' WHERE secret IS NULL\");\n table_column('user','secret','secret','varchar','15','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET picture='0' WHERE picture IS NULL\");\n table_column('user','picture','picture','tinyint','1','','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET url='' WHERE url IS NULL\");\n table_column('user','url','url','varchar','255','','','not null');\n }\n \n if ($oldversion < 2006050400) {\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_email_idx;\",false);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_deleted (deleted)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_confirmed (confirmed)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_firstname (firstname)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_lastname (lastname)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_city (city)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_country (country)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_lastaccess (lastaccess)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_email (email)\",false);\n }\n \n if ($oldversion < 2006050500) {\n table_column('log', 'action', 'action', 'varchar', '40', '', '', 'not null');\n }\n\n if ($oldversion < 2006050501) {\n table_column('sessions', 'data', 'data', 'mediumtext', '', '', '', 'not null');\n }\n \n // renaming of reads and writes for stats_user_xyz\n if ($oldversion < 2006052400) { // change this later\n\n // we are using this because we want silent updates\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_daily` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_daily` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_weekly` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_weekly` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_monthly` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_monthly` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0\", false);\n \n }\n\n // Adding some missing log actions\n if ($oldversion < 2006060400) {\n // But only if they doesn't exist (because this was introduced after branch and we could be duplicating!)\n if (!record_exists('log_display', 'module', 'course', 'action', 'report log')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report log', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report live')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report live', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report outline')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report outline', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report participation')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report participation', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report stats')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report stats', 'course', 'fullname')\");\n }\n }\n\n //Renaming lastIP to lastip (all fields lowercase)\n if ($oldversion < 2006060900) {\n //Only if it exists\n $fields = $db->MetaColumnNames($CFG->prefix.'user');\n if (in_array('lastIP',$fields)) {\n table_column(\"user\", \"lastIP\", \"lastip\", \"varchar\", \"15\", \"\", \"\", \"not null\", \"currentlogin\");\n }\n }\n\n // Change in MySQL 5.0.3 concerning how decimals are stored. Mimic from 16_STABLE\n // this isn't dangerous because it's a simple type change, but be careful with\n // versions and duplicate work in order to provide smooth upgrade paths.\n if ($oldversion < 2006071800) {\n table_column('grade_letter', 'grade_high', 'grade_high', 'decimal(5,2)', '', '', '100.00', 'not null', '');\n table_column('grade_letter', 'grade_low', 'grade_low', 'decimal(5,2)', '', '', '0.00', 'not null', '');\n }\n \n if ($oldversion < 2006080400) {\n execute_sql(\"CREATE TABLE {$CFG->prefix}role (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `shortname` varchar(100) NOT NULL default '',\n `description` text NOT NULL default '',\n `sortorder` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}context (\n `id` int(10) unsigned NOT NULL auto_increment,\n `level` int(10) unsigned NOT NULL default '0',\n `instanceid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}role_assignments (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `contextid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `hidden` int(1) unsigned NOT NULL default '0',\n `timestart` int(10) unsigned NOT NULL default '0',\n `timeend` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n `modifierid` int(10) unsigned NOT NULL default '0',\n `enrol` varchar(20) NOT NULL default '',\n `sortorder` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}role_capabilities (\n `id` int(10) unsigned NOT NULL auto_increment,\n `contextid` int(10) unsigned NOT NULL default '0',\n `roleid` int(10) unsigned NOT NULL default '0',\n `capability` varchar(255) NOT NULL default '',\n `permission` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n `modifierid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_deny_grant (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `unviewableroleid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n \n execute_sql(\"CREATE TABLE {$CFG->prefix}capabilities ( \n `id` int(10) unsigned NOT NULL auto_increment, \n `name` varchar(255) NOT NULL default '', \n `captype` varchar(50) NOT NULL default '', \n `contextlevel` int(10) unsigned NOT NULL default '0', \n `component` varchar(100) NOT NULL default '', \n PRIMARY KEY (`id`) \n )\", true); \n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_names ( \n `id` int(10) unsigned NOT NULL auto_increment, \n `roleid` int(10) unsigned NOT NULL default '0',\n `contextid` int(10) unsigned NOT NULL default '0', \n `text` text NOT NULL default '',\n PRIMARY KEY (`id`) \n )\", true); \n \n }\n \n if ($oldversion < 2006081000) {\n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role` ADD INDEX `sortorder` (`sortorder`)\",true);\n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD INDEX `instanceid` (`instanceid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `level-instanceid` (`level`, `instanceid`)\",true);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `roleid` (`roleid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `contextid` (`contextid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `userid` (`userid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD UNIQUE INDEX `contextid-roleid-userid` (`contextid`, `roleid`, `userid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `sortorder` (`sortorder`)\",true);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `roleid` (`roleid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `contextid` (`contextid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `modifierid` (`modifierid`)\",true); \n // MDL-10640 adding missing index from upgrade\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `capability` (`capability`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD UNIQUE INDEX `roleid-contextid-capability` (`roleid`, `contextid`, `capability`)\",true); \n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD INDEX `roleid` (`roleid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD INDEX `unviewableroleid` (`unviewableroleid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD UNIQUE INDEX `roleid-unviewableroleid` (`roleid`, `unviewableroleid`)\",true); \n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}capabilities` ADD UNIQUE INDEX `name` (`name`)\",true); \n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_names` ADD INDEX `roleid` (`roleid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_names` ADD INDEX `contextid` (`contextid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_names` ADD UNIQUE INDEX `roleid-contextid` (`roleid`, `contextid`)\",true); \n }\n \n if ($oldversion < 2006081600) {\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` CHANGE permission permission int(10) NOT NULL default '0'\",true); \n }\n \n // drop role_deny_grant table, and create 2 new ones\n if ($oldversion < 2006081700) {\n execute_sql(\"DROP TABLE `{$CFG->prefix}role_deny_grant`\", true);\n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_allow_assign (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `allowassign` int(10) unsigned NOT NULL default '0',\n KEY `roleid` (`roleid`),\n KEY `allowassign` (`allowassign`),\n UNIQUE KEY `roleid-allowassign` (`roleid`, `allowassign`),\n PRIMARY KEY (`id`)\n )\", true); \n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_allow_override (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `allowoverride` int(10) unsigned NOT NULL default '0',\n KEY `roleid` (`roleid`),\n KEY `allowoverride` (`allowoverride`),\n UNIQUE KEY `roleid-allowoverride` (`roleid`, `allowoverride`),\n PRIMARY KEY (`id`)\n )\", true); \n \n }\n \n if ($oldversion < 2006082100) {\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` DROP INDEX `level-instanceid`;\",false);\n table_column('context', 'level', 'aggregatelevel', 'int', '10', 'unsigned', '0', 'not null', '');\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `aggregatelevel-instanceid` (`aggregatelevel`, `instanceid`)\",false);\n }\n \n if ($oldversion < 2006082200) {\n table_column('timezone', 'rule', 'tzrule', 'varchar', '20', '', '', 'not null', '');\n }\n\n if ($oldversion < 2006082800) {\n table_column('user', '', 'ajax', 'integer', '1', 'unsigned', '1', 'not null', 'htmleditor');\n }\n\n if ($oldversion < 2006082900) {\n execute_sql(\"DROP TABLE {$CFG->prefix}sessions\", true);\n execute_sql(\"\n CREATE TABLE {$CFG->prefix}sessions2 (\n sesskey VARCHAR(64) NOT NULL default '',\n expiry DATETIME NOT NULL,\n expireref VARCHAR(250),\n created DATETIME NOT NULL,\n modified DATETIME NOT NULL,\n sessdata TEXT,\n CONSTRAINT PRIMARY KEY (sesskey)\n ) COMMENT='Optional database session storage in new format, not used by default';\", true);\n\n execute_sql(\"\n CREATE INDEX {$CFG->prefix}sess_exp_ix ON {$CFG->prefix}sessions2 (expiry);\", true);\n execute_sql(\"\n CREATE INDEX {$CFG->prefix}sess_exp2_ix ON {$CFG->prefix}sessions2 (expireref);\", true);\n }\n\n if ($oldversion < 2006083001) {\n table_column('sessions2', 'sessdata', 'sessdata', 'LONGTEXT', '', '', '', '', '');\n }\n \n if ($oldversion < 2006083002) {\n table_column('capabilities', '', 'riskbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', '');\n }\n\n if ($oldversion < 2006083100) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}course CHANGE modinfo modinfo longtext NULL AFTER showgrades\");\n }\n\n if ($oldversion < 2006083101) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_categories CHANGE description description text NULL AFTER name\");\n }\n\n if ($oldversion < 2006083102) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}user CHANGE description description text NULL AFTER url\");\n }\n\n if ($oldversion < 2006090200) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_sections CHANGE summary summary text NULL AFTER section\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_sections CHANGE sequence sequence text NULL AFTER section\");\n }\n\n\n // table to keep track of course page access times, used in online participants block, and participants list\n if ($oldversion < 2006091200) {\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_lastaccess ( \n `id` int(10) unsigned NOT NULL auto_increment, \n `userid` int(10) unsigned NOT NULL default '0',\n `courseid` int(10) unsigned NOT NULL default '0', \n `timeaccess` int(10) unsigned NOT NULL default '0', \n KEY `userid` (`userid`),\n KEY `courseid` (`courseid`),\n UNIQUE KEY `userid-courseid` (`userid`, `courseid`),\n PRIMARY KEY (`id`) \n )TYPE=MYISAM COMMENT ='time user last accessed any page in a course';\", true);\n }\n\n if ($oldversion < 2006091212) { // Reload the guest roles completely with new defaults\n if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {\n delete_records('capabilities');\n $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);\n foreach ($guestroles as $guestrole) {\n delete_records('role_capabilities', 'roleid', $guestrole->id);\n assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id);\n }\n }\n }\n\n if ($oldversion < 2006091700) {\n table_column('course','','defaultrole','integer','10', 'unsigned', '0', 'not null');\n }\n\n if ($oldversion < 2006091800) {\n delete_records('config', 'name', 'showsiteparticipantslist');\n delete_records('config', 'name', 'requestedteachername');\n delete_records('config', 'name', 'requestedteachersname');\n delete_records('config', 'name', 'requestedstudentname');\n delete_records('config', 'name', 'requestedstudentsname');\n }\n\n if ($oldversion < 2006091901) {\n if ($roles = get_records('role')) {\n $first = array_shift($roles);\n if (!empty($first->shortname)) {\n // shortnames already exist\n } else {\n table_column('role', '', 'shortname', 'varchar', '100', '', '', 'not null', 'name');\n $legacy_names = array('admin', 'coursecreator', 'editingteacher', 'teacher', 'student', 'guest');\n foreach ($legacy_names as $name) {\n if ($roles = get_roles_with_capability('moodle/legacy:'.$name, CAP_ALLOW)) {\n $i = '';\n foreach ($roles as $role) {\n if (empty($role->shortname)) {\n $updated = new object();\n $updated->id = $role->id;\n $updated->shortname = $name.$i;\n update_record('role', $updated);\n $i++;\n }\n }\n }\n }\n }\n }\n }\n\n /// Tables for customisable user profile fields\n if ($oldversion < 2006092000) {\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_info_field (\n id BIGINT(10) NOT NULL auto_increment,\n name VARCHAR(255) NOT NULL default '',\n datatype VARCHAR(255) NOT NULL default '',\n categoryid BIGINT(10) unsigned NOT NULL default 0,\n sortorder BIGINT(10) unsigned NOT NULL default 0,\n required TINYINT(2) unsigned NOT NULL default 0,\n locked TINYINT(2) unsigned NOT NULL default 0,\n visible SMALLINT(4) unsigned NOT NULL default 0,\n defaultdata LONGTEXT,\n CONSTRAINT PRIMARY KEY (id));\", true);\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_info_field COMMENT='Customisable user profile fields';\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_info_category (\n id BIGINT(10) NOT NULL auto_increment,\n name VARCHAR(255) NOT NULL default '',\n sortorder BIGINT(10) unsigned NOT NULL default 0,\n CONSTRAINT PRIMARY KEY (id));\", true);\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_info_category COMMENT='Customisable fields categories';\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_info_data (\n id BIGINT(10) NOT NULL auto_increment,\n userid BIGINT(10) unsigned NOT NULL default 0,\n fieldid BIGINT(10) unsigned NOT NULL default 0,\n data LONGTEXT NOT NULL,\n CONSTRAINT PRIMARY KEY (id));\", true);\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_info_data COMMENT='Data for the customisable user fields';\", true);\n\n\n }\n\n if ($oldversion < 2006092200) {\n table_column('context', 'aggregatelevel', 'contextlevel', 'int', '10', 'unsigned', '0', 'not null', '');\n/* execute_sql(\"ALTER TABLE `{$CFG->prefix}context` DROP INDEX `aggregatelevel-instanceid`;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `contextlevel-instanceid` (`contextlevel`, `instanceid`)\",false); // see 2006092409 below */\n }\n\n if ($oldversion < 2006092201) {\n execute_sql('TRUNCATE TABLE '.$CFG->prefix.'cache_text', true);\n table_column('cache_text','formattedtext','formattedtext','longtext','','','','not null');\n }\n\n if ($oldversion < 2006092302) {\n // fix sortorder first if needed\n if ($roles = get_all_roles()) {\n $i = 0;\n foreach ($roles as $rolex) {\n if ($rolex->sortorder != $i) {\n $r = new object();\n $r->id = $rolex->id;\n $r->sortorder = $i;\n update_record('role', $r);\n }\n $i++;\n }\n }\n/* execute_sql(\"ALTER TABLE {$CFG->prefix}role DROP INDEX {$CFG->prefix}role_sor_ix;\", false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}role ADD UNIQUE INDEX {$CFG->prefix}role_sor_uix (sortorder)\", false);*/\n }\n\n if ($oldversion < 2006092400) {\n table_column('user', '', 'trustbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', '');\n }\n\n if ($oldversion < 2006092409) {\n // ok, once more and now correctly!\n execute_sql(\"DROP INDEX `aggregatelevel-instanceid` ON {$CFG->prefix}context ;\", false);\n execute_sql(\"DROP INDEX `contextlevel-instanceid` ON {$CFG->prefix}context ;\", false);\n execute_sql(\"CREATE UNIQUE INDEX {$CFG->prefix}cont_conins_uix ON {$CFG->prefix}context (contextlevel, instanceid);\", false);\n\n execute_sql(\"DROP INDEX {$CFG->prefix}role_sor_ix ON {$CFG->prefix}role ;\", false);\n execute_sql(\"DROP INDEX {$CFG->prefix}role_sor_uix ON {$CFG->prefix}role ;\", false);\n execute_sql(\"CREATE UNIQUE INDEX {$CFG->prefix}role_sor_uix ON {$CFG->prefix}role (sortorder);\", false);\n }\n\n if ($oldversion < 2006092601) {\n table_column('log_display', 'field', 'field', 'varchar', '200', '', '', 'not null', '');\n }\n\n ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.\n\n return $result;\n}", "function xmldb_quizaccess_safeexambrowser_upgrade($oldversion) {\n global $CFG, $DB;\n\n $dbman = $DB->get_manager();\n\n // Valid for version 2014081701 or less (new DB is valid from 2014082501)\n if ($oldversion < 2014082501) {\n\n // Define field answer to be added to quizaccess_studentident_ids.\n $table = new xmldb_table('quizaccess_studentident_ids');\n $field = new xmldb_field('answer', XMLDB_TYPE_TEXT, null, null, null, null, null, 'ident');\n\n // Conditionally launch add field answer.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Studentident savepoint reached.\n upgrade_plugin_savepoint(true, 2014082501, 'quizaccess', 'studentident');\n }\n\n return true;\n}", "function xmldb_qtype_multirowswitch_upgrade($oldversion) {\n global $CFG, $DB;\n\n $dbman = $DB->get_manager();\n\n if ($oldversion < 2020072200) {\n\n // Define table to be created.\n $table = new xmldb_table('qtype_leary_grades');\n\n // Adding fields to table\n $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n $table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');\n $table->add_field('scale', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, 'questionid');\n $table->add_field('amount', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, null, 'scale');\n $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'amount');\n\n // Adding keys to table\n $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));\n\n // Conditionally launch create table.\n if (!$dbman->table_exists($table)) {\n $dbman->create_table($table);\n }\n upgrade_plugin_savepoint(true, 2020072200, 'qtype', 'multirowswitch');\n }\n\n return true;\n}", "public function setupTimestampMigrations()\n {\n $db = $this->_db;\n $tableSql = \"CREATE TABLE IF NOT EXISTS `$db->prefix\" . self::MIGRATION_TABLE_NAME\n . \"` (`version` varchar(16) NOT NULL, UNIQUE KEY `unique_schema_migrations` (`version`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci\";\n $optionSql = \"DELETE FROM $db->Option WHERE name = '\" . self::ORIG_MIGRATION_OPTION_NAME . \"' LIMIT 1\";\n $db->query($optionSql);\n $db->query($tableSql);\n // Setting an empty value ensures that the database is flagged as\n // needing an upgrade.\n $db->insert('Option', array('name' => self::VERSION_OPTION_NAME, 'value' => ''));\n }", "function xmldb_atto_teamsmeeting_upgrade($oldversion) {\n global $DB, $USER, $SITE;\n\n $dbman = $DB->get_manager();\n $result = true;\n\n if ($oldversion < 2020032700) {\n // Define table atto_teamsmeeting to be created.\n $table = new xmldb_table('atto_teamsmeeting');\n\n // Adding fields to table atto_teamsmeeting.\n $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);\n $table->add_field('title', XMLDB_TYPE_CHAR, '255', null, false, null, null);\n $table->add_field('link', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);\n $table->add_field('options', XMLDB_TYPE_TEXT, null, null, false, null, null);\n $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);\n\n // Adding keys to table atto_teamsmeeting.\n $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);\n\n // Conditionally launch create table for atto_teamsmeeting.\n if (!$dbman->table_exists($table)) {\n $dbman->create_table($table);\n }\n\n // Teamsmeeting savepoint reached.\n upgrade_plugin_savepoint(true, 2020032700, 'atto', 'teamsmeeting');\n }\n\n if ($oldversion < 2020032705) {\n // Update legacy meetings app URL.\n $meetingsapplink = get_config('atto_teamsmeeting', 'meetingapplink');\n\n if ($meetingsapplink && is_string($meetingsapplink) && strtolower($meetingsapplink) == 'https://enovation.ie/msteams') {\n set_config('meetingapplink', 'https://enomsteams.z16.web.core.windows.net', 'atto_teamsmeeting');\n }\n\n // Teamsmeeting savepoint reached.\n upgrade_plugin_savepoint(true, 2020032705, 'atto', 'teamsmeeting');\n }\n\n return $result;\n}", "function xmldb_qtype_ordering_upgrade($oldversion) {\n global $CFG, $DB;\n\n $dbman = $DB->get_manager();\n\n $newversion = 2013062800;\n if ($oldversion < $newversion) {\n $select = 'qn.*, qo.id AS questionorderingid';\n $from = '{question} qn LEFT JOIN {question_ordering} qo ON qn.id = qo.question';\n $where = 'qn.qtype = ? AND qo.id IS NULL';\n $params = array('ordering');\n if ($questions = $DB->get_records_sql(\"SELECT $select FROM $from WHERE $where\", $params)) {\n foreach ($questions as $question) {\n if ($answers = $DB->get_records('question_answers', array('question' => $question->id))) {\n // Add \"options\" for this ordering question.\n $questionordering = (object) array(\n 'question' => $question->id,\n 'logical' => 1,\n 'studentsee' => min(6, count($answers)),\n 'correctfeedback' => '',\n 'partiallycorrectfeedback' => '',\n 'incorrectfeedback' => ''\n );\n $questionordering->id = $DB->insert_record('question_ordering', $questionordering);\n } else {\n // This is a faulty ordering question - remove it.\n $DB->delete_records('question', array('id' => $question->id));\n if ($dbman->table_exists('quiz_question_instances')) {\n $DB->delete_records('quiz_question_instances', array('question' => $question->id));\n }\n if ($dbman->table_exists('reader_question_instances')) {\n $DB->delete_records('reader_question_instances', array('question' => $question->id));\n }\n }\n }\n }\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n $newversion = 2015011915;\n if ($oldversion < $newversion) {\n\n // Rename \"ordering\" table for Moodle >= 2.5.\n $oldname = 'question_ordering';\n $newname = 'qtype_ordering_options';\n\n if ($dbman->table_exists($oldname)) {\n $oldtable = new xmldb_table($oldname);\n if ($dbman->table_exists($newname)) {\n $dbman->drop_table($oldtable);\n } else {\n $dbman->rename_table($oldtable, $newname);\n }\n }\n\n // Remove index on question(id) field (because we want to modify the field).\n $table = new xmldb_table('qtype_ordering_options');\n $fields = array('question', 'questionid');\n foreach ($fields as $field) {\n if ($dbman->field_exists($table, $field)) {\n $index = new xmldb_index('qtypordeopti_que_uix', XMLDB_INDEX_UNIQUE, array($field));\n if ($dbman->index_exists($table, $index)) {\n $dbman->drop_index($table, $index);\n }\n }\n }\n\n // Rename \"question\" -> \"questionid\".\n // Rename \"logical\" -> \"selecttype\".\n // Rename \"studentsee\" -> \"selectcount\".\n // Add \"(xxx)feedbackformat\" fields.\n $table = new xmldb_table('qtype_ordering_options');\n $fields = array(\n 'questionid' => new xmldb_field('question', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '0', 'id'),\n 'selecttype' => new xmldb_field('logical', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'questionid'),\n 'selectcount' => new xmldb_field('studentsee', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'selecttype'),\n 'correctfeedbackformat' => new xmldb_field('correctfeedbackformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null,\n '0', 'correctfeedback'),\n 'incorrectfeedbackformat' => new xmldb_field('incorrectfeedbackformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL,\n null, '0', 'incorrectfeedback'),\n 'partiallycorrectfeedbackformat' => new xmldb_field('partiallycorrectfeedbackformat', XMLDB_TYPE_INTEGER, '2', null,\n XMLDB_NOTNULL, null, '0', 'partiallycorrectfeedback')\n );\n foreach ($fields as $newname => $field) {\n $oldexists = $dbman->field_exists($table, $field);\n $newexists = $dbman->field_exists($table, $newname);\n if ($field->getName() != $newname && $oldexists) {\n if ($newexists) {\n $dbman->drop_field($table, $field);\n } else {\n $dbman->rename_field($table, $field, $newname);\n $newexists = true;\n }\n $oldexists = false;\n }\n $field->setName($newname);\n if ($newexists) {\n $dbman->change_field_type($table, $field);\n } else {\n $dbman->add_field($table, $field);\n }\n }\n\n // Make sure there are no duplicate \"questionid\" fields in \"qtype_ordering_options\" table.\n $select = 'questionid, COUNT(*) AS countduplicates, MAX(id) AS maxid';\n $from = '{qtype_ordering_options}';\n $group = 'questionid';\n $having = 'countduplicates > ?';\n $params = array(1);\n if ($records = $DB->get_records_sql(\"SELECT $select FROM $from GROUP BY $group HAVING $having\", $params)) {\n foreach ($records as $record) {\n $select = 'id <> ? AND questionid = ?';\n $params = array($record->maxid, $record->questionid);\n $DB->delete_records_select('qtype_ordering_options', $select, $params);\n }\n }\n\n // Restore index on questionid field.\n $table = new xmldb_table('qtype_ordering_options');\n $index = new xmldb_index('qtypordeopti_que_uix', XMLDB_INDEX_UNIQUE, array('questionid'));\n if (! $dbman->index_exists($table, $index)) {\n $dbman->add_index($table, $index);\n }\n\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n $newversion = 2015110725;\n if ($oldversion < $newversion) {\n $table = new xmldb_table('qtype_ordering_options');\n $fields = array(\n new xmldb_field('layouttype', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, 0, 'questionid'),\n new xmldb_field('selecttype', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, 0, 'layouttype')\n );\n foreach ($fields as $field) {\n if ($dbman->field_exists($table, $field)) {\n $dbman->change_field_type($table, $field);\n } else {\n $dbman->add_field($table, $field);\n }\n }\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n $newversion = 2015121734;\n if ($oldversion < $newversion) {\n $table = new xmldb_table('qtype_ordering_options');\n $fields = array(\n new xmldb_field('gradingtype', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, 0, 'selectcount')\n );\n foreach ($fields as $field) {\n if ($dbman->field_exists($table, $field)) {\n $dbman->change_field_type($table, $field);\n } else {\n $dbman->add_field($table, $field);\n // When adding this field to existing records,\n // the gradingtype is set to whatever the selecttype is.\n $DB->execute('UPDATE {qtype_ordering_options} SET gradingtype = selecttype', array());\n }\n }\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n $newversion = 2016032949;\n if ($oldversion < $newversion) {\n if ($dbman->table_exists('reader_question_instances')) {\n $select = 'rqi.question, COUNT(*) AS countquestion';\n $from = '{reader_question_instances} rqi '.\n 'LEFT JOIN {question} q ON rqi.question = q.id';\n $where = 'q.qtype = ?';\n $group = 'rqi.question';\n $params = array('ordering');\n if ($questions = $DB->get_records_sql(\"SELECT $select FROM $from WHERE $where GROUP BY $group\", $params)) {\n $questions = array_keys($questions);\n list($select, $params) = $DB->get_in_or_equal($questions);\n $select = \"questionid $select\";\n $table = 'qtype_ordering_options';\n $DB->set_field_select($table, 'layouttype', 0, $select, $params); // VERTICAL.\n $DB->set_field_select($table, 'selecttype', 1, $select, $params); // RANDOM.\n $DB->set_field_select($table, 'gradingtype', 1, $select, $params); // RELATIVE.\n\n // For selectcount, we only fix the value, if it is zero (=ALL)\n // because Ordering questions for some low level books use 4.\n $select .= ' AND selectcount = ?';\n $params[] = 0;\n $DB->set_field_select($table, 'selectcount', 6, $select, $params); // Six.\n }\n }\n }\n\n $newversion = 2016081655;\n if ($oldversion < $newversion) {\n $table = new xmldb_table('qtype_ordering_options');\n $field = new xmldb_field('showgrading', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, 1, 'gradingtype');\n if ($dbman->field_exists($table, $field)) {\n $dbman->change_field_type($table, $field);\n } else {\n $dbman->add_field($table, $field);\n }\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n $newversion = 2019071191;\n if ($oldversion < $newversion) {\n\n // Add field \"numberingstyle\" to table \"qtype_ordering_options\".\n // This field was briefly called \"answernumbering\".\n $table = new xmldb_table('qtype_ordering_options');\n $field = new xmldb_field('answernumbering', XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, 'none', 'showgrading');\n $newname = 'numberingstyle';\n\n $oldexists = $dbman->field_exists($table, $field);\n $newexists = $dbman->field_exists($table, $newname);\n if ($oldexists) {\n if ($newexists) {\n $dbman->drop_field($table, $field);\n } else {\n $dbman->rename_field($table, $field, $newname);\n $newexists = true;\n }\n $oldexists = false;\n }\n $field->setName($newname);\n if ($newexists) {\n $dbman->change_field_type($table, $field);\n } else {\n $dbman->add_field($table, $field);\n }\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n $newversion = '2019073193';\n if ($oldversion < $newversion) {\n $table = 'qtype_ordering_options';\n $field = 'numberingstyle';\n $select = \"$field = ? OR $field = ?\";\n $params = array('III', 'ABC');\n if ($options = $DB->get_records_select($table, $select, $params, $field, \"id,$field\")) {\n foreach ($options as $option) {\n switch ($option->numberingstyle) {\n case 'ABC':\n $DB->set_field($table, $field, 'ABCD', array('id' => $option->id));\n break;\n case 'III':\n $DB->set_field($table, $field, 'IIII', array('id' => $option->id));\n break;\n // phpcs:ignore Squiz.PHP.CommentedOutCode.Found\n // Ignore \"abc\", \"iii\", and anything else.\n }\n }\n }\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n $newversion = '2022092000';\n if ($oldversion < $newversion) {\n $table = new xmldb_table('qtype_ordering_options');\n $field = new xmldb_field('shownumcorrect', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, 0);\n if ($dbman->field_exists($table, $field)) {\n $dbman->change_field_type($table, $field);\n } else {\n $dbman->add_field($table, $field);\n }\n upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');\n }\n\n return true;\n}", "function quiz_get_newgraded_states($attemptids, $idxattemptq = true){\n global $CFG;\n if ($attemptids){\n $attemptidlist = join($attemptids, ',');\n $gradedstatesql = \"SELECT qs.* FROM \" .\n \"{$CFG->prefix}question_sessions qns, \" .\n \"{$CFG->prefix}question_states qs \" .\n \"WHERE qns.attemptid IN ($attemptidlist) AND \" .\n \"qns.newgraded = qs.id\";\n $gradedstates = get_records_sql($gradedstatesql);\n if ($idxattemptq){\n $gradedstatesbyattempt = array();\n foreach ($gradedstates as $gradedstate){\n if (!isset($gradedstatesbyattempt[$gradedstate->attempt])){\n $gradedstatesbyattempt[$gradedstate->attempt] = array();\n }\n $gradedstatesbyattempt[$gradedstate->attempt][$gradedstate->question] = $gradedstate;\n }\n return $gradedstatesbyattempt;\n } else {\n return $gradedstates;\n }\n } else {\n return array();\n }\n}", "function xmldb_quizaccess_seb_upgrade($oldversion) {\n global $DB;\n $dbman = $DB->get_manager();\n\n if ($oldversion < 2019122000) {\n\n // Define key quizid (foreign-unique) to be added to quizaccess_seb_quizsettings.\n $table = new xmldb_table('quizaccess_seb_quizsettings');\n\n // Launch drop unique key quizid.\n $key = new xmldb_key('quizid', XMLDB_KEY_UNIQUE, ['quizid']);\n $dbman->drop_key($table, $key);\n\n // Launch add foreign key quizid.\n $key = new xmldb_key('quizid', XMLDB_KEY_FOREIGN_UNIQUE, ['quizid'], 'quiz', ['id']);\n $dbman->add_key($table, $key);\n\n // Launch drop unique key templateid.\n $key = new xmldb_key('templateid', XMLDB_KEY_UNIQUE, ['templateid']);\n $dbman->drop_key($table, $key);\n\n // Launch add foreign key templateid.\n $key = new xmldb_key('templateid', XMLDB_KEY_FOREIGN, ['templateid'], 'quizacces_seb_template', ['id']);\n $dbman->add_key($table, $key);\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2019122000, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020010700) {\n\n // Define field allowedbrowserexamkeys to be added to quizaccess_seb_quizsettings.\n $table = new xmldb_table('quizaccess_seb_quizsettings');\n $field = new xmldb_field('allowedbrowserexamkeys', XMLDB_TYPE_TEXT, null, null, null, null, null, 'regexblocked');\n\n // Conditionally launch add field allowedbrowserexamkeys.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020010700, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020020600) {\n\n // Define field cmid to be added to quizaccess_seb_quizsettings.\n $table = new xmldb_table('quizaccess_seb_quizsettings');\n $field = new xmldb_field('cmid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'quizid');\n\n // Conditionally launch add field cmid.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020020600, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020020700) {\n\n $table = new xmldb_table('quizaccess_seb_template');\n\n $field = new xmldb_field('description', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'name');\n // Conditionally launch add field description.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n $field = new xmldb_field('enabled', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, 'content');\n // Conditionally launch add field enabled.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n $field = new xmldb_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'enabled');\n // Conditionally launch add field sortorder.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n $field = new xmldb_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'sortorder');\n // Conditionally launch add field usermodified.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'usermodified');\n // Conditionally launch add field timecreated.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'timecreated');\n // Conditionally launch add field timemodified.\n if (!$dbman->field_exists($table, $field)) {\n $dbman->add_field($table, $field);\n }\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020020700, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020030402) {\n\n // Define key cmid (foreign-unique) to be added to quizaccess_seb_quizsettings.\n $table = new xmldb_table('quizaccess_seb_quizsettings');\n $key = new xmldb_key('cmid', XMLDB_KEY_FOREIGN_UNIQUE, ['cmid'], 'course_modules', ['id']);\n // Launch add key cmid.\n $dbman->add_key($table, $key);\n\n $field = new xmldb_field('sebconfigfile', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'requiresafeexambrowser');\n // Launch change of type for field sebconfigfile.\n $dbman->change_field_type($table, $field);\n\n $field = new xmldb_field('showsebtaskbar', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'sebconfigfile');\n // Launch change of nullability for field showsebtaskbar.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('showwificontrol', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'showsebtaskbar');\n // Launch change of nullability for field showwificontrol.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('showreloadbutton', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'showwificontrol');\n // Launch change of nullability for field showreloadbutton.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('showtime', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'showreloadbutton');\n // Launch change of nullability for field showtime.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('showkeyboardlayout', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'showtime');\n // Launch change of nullability for field showkeyboardlayout.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('allowuserquitseb', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'showkeyboardlayout');\n // Launch change of nullability for field allowuserquitseb.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('linkquitseb', XMLDB_TYPE_TEXT, null, null, null, null, null, 'quitpassword');\n // Launch change of nullability for field linkquitseb.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('userconfirmquit', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'linkquitseb');\n // Launch change of nullability for field userconfirmquit.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('enableaudiocontrol', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'userconfirmquit');\n // Launch change of nullability for field enableaudiocontrol.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('muteonstartup', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'enableaudiocontrol');\n // Launch change of nullability for field muteonstartup.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('allowspellchecking', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'muteonstartup');\n // Launch change of nullability for field allowspellchecking.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('allowreloadinexam', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'allowspellchecking');\n // Launch change of nullability for field allowreloadinexam.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('activateurlfiltering', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'allowreloadinexam');\n // Launch change of nullability for field activateurlfiltering.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('filterembeddedcontent', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'activateurlfiltering');\n // Launch change of nullability for field filterembeddedcontent.\n $dbman->change_field_notnull($table, $field);\n\n $field = new xmldb_field('suppresssebdownloadlink',\n XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'allowedbrowserexamkeys');\n // Launch change of nullability for field suppresssebdownloadlink.\n $dbman->change_field_notnull($table, $field);\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020030402, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020030403) {\n\n // Define field sebconfigfile to be dropped from quizaccess_seb_quizsettings.\n $table = new xmldb_table('quizaccess_seb_quizsettings');\n $field = new xmldb_field('sebconfigfile');\n\n // Conditionally launch drop field sebconfigfile.\n if ($dbman->field_exists($table, $field)) {\n $dbman->drop_field($table, $field);\n }\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020030403, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020040101) {\n // Drop config and configkey fields.\n $table = new xmldb_table('quizaccess_seb_quizsettings');\n $config = new xmldb_field('config');\n $configkey = new xmldb_field('configkey');\n\n if ($dbman->field_exists($table, $config)) {\n $dbman->drop_field($table, $config);\n }\n\n if ($dbman->field_exists($table, $configkey)) {\n $dbman->drop_field($table, $configkey);\n }\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020040101, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020040703) {\n\n // Rename the field.\n $table = new xmldb_table('quizaccess_seb_quizsettings');\n $field = new xmldb_field('suppresssebdownloadlink');\n\n if ($dbman->field_exists($table, $field)) {\n $field->set_attributes(XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'allowedbrowserexamkeys');\n $dbman->rename_field($table, $field, 'showsebdownloadlink');\n }\n\n // Reverse the field values as the logic has been changed from suppress to show.\n $records = $DB->get_records('quizaccess_seb_quizsettings');\n foreach ($records as $record) {\n if (!is_null($record->showsebdownloadlink)) {\n $record->showsebdownloadlink = !$record->showsebdownloadlink;\n $DB->update_record('quizaccess_seb_quizsettings', $record);\n }\n }\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020040703, 'quizaccess', 'seb');\n }\n\n if ($oldversion < 2020042600) {\n\n $table = new xmldb_table('quizaccess_seb_template');\n\n $field = new xmldb_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);\n $dbman->change_field_type($table, $field);\n\n // Seb savepoint reached.\n upgrade_plugin_savepoint(true, 2020042600, 'quizaccess', 'seb');\n }\n\n return true;\n}", "function xmldb_qtype_multichoice_upgrade($oldversion=0) {\n\n global $CFG, $THEME, $db;\n\n $result = true;\n\n // This upgrade actually belongs to the description question type,\n // but that does not have a DB upgrade script. Therefore, multichoice\n // is doing it.\n // The need for this is that for a while, descriptions were being created\n // with a defaultgrade of 1, when it shoud be 0. We need to reset them all to 0.\n // See MDL-7925. \n if ($result && $oldversion < 2006121500) {\n $result = set_field('question', 'defaultgrade', 0,\n 'qtype', DESCRIPTION, 'defaultgrade', 1);\n }\n\n // This upgrade actually belongs to the description question type,\n // but that does not have a DB upgrade script. Therefore, multichoice\n // is doing it.\n // The need for this is that for a while, descriptions were being created\n // with a defaultgrade of 1, when it shoud be 0. We need to reset them all to 0.\n // This is re-occurrence of MDL-7925, so we need to do it again. \n if ($result && $oldversion < 2006121501) {\n $result = set_field('question', 'defaultgrade', 0,\n 'qtype', DESCRIPTION, 'defaultgrade', 1);\n }\n\n return $result;\n}", "function xmldb_qtype_rqp_upgrade($oldversion=0) {\n\n global $CFG, $THEME, $db;\n\n $result = true;\n\n if ($result && $oldversion < 2006032201) {\n $table = new XMLDBTable('question_rqp_servers');\n\n $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE);\n $table->addFieldInfo('typeid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);\n $table->addFieldInfo('url', XMLDB_TYPE_CHAR, 255);\n $table->addFieldInfo('can_render', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);\n $table->addFieldInfo('can_author', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);\n\n $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));\n $table->addKeyInfo('typeid', XMLDB_KEY_FOREIGN, array('typeid'), 'rqp_types', array('id'));\n\n $result = $result && create_table($table);\n }\n\n return $result;\n}", "function increase_attemptAndsave_module_version()\n\t{\n\t\tglobal $ilDB, $ilUser;\n\t\t$res = $ilDB->queryF(\n\t\t\t'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',\n\t\t\tarray('integer','integer'),\n\t\t\tarray($this->slm->getId(),$ilUser->getId()));\n\t\t$val_rec = $ilDB->fetchAssoc($res);\n\t\tif ($val_rec[\"cnt\"] == 0) { //offline_mode could be inserted\n\t\t\t$attempts = 1;\n\t\t\t$ilDB->manipulateF(\n\t\t\t\t'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',\n\t\t\t\tarray('integer', 'integer', 'integer', 'integer', 'timestamp'),\n\t\t\t\tarray($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s')));\n\t\t} else {\n\t\t\t$attempts = $val_rec[\"package_attempts\"];\n\t\t\tif ($attempts == null) $attempts = 0;\n\t\t\t$attempts++;\n\t\t\t$ilDB->manipulateF(\n\t\t\t\t'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',\n\t\t\t\tarray('integer', 'integer', 'timestamp', 'integer', 'integer'),\n\t\t\t\tarray($attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId()));\n\t\t}\n\t}", "function xmldb_local_amos_upgrade($oldversion) {\n global $CFG, $DB, $OUTPUT;\n\n $dbman = $DB->get_manager();\n $result = true;\n\n if ($oldversion < 2010090103) {\n $dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_stashes');\n upgrade_plugin_savepoint(true, 2010090103, 'local', 'amos');\n }\n\n if ($oldversion < 2010090107) {\n $dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_hidden_requests');\n upgrade_plugin_savepoint(true, 2010090107, 'local', 'amos');\n }\n\n if ($oldversion < 2010110400) {\n $dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_greylist');\n upgrade_plugin_savepoint(true, 2010110400, 'local', 'amos');\n }\n\n if ($oldversion < 2011010600) {\n $dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_contributions');\n upgrade_plugin_savepoint(true, 2011010600, 'local', 'amos');\n }\n\n if ($oldversion < 2011011000) {\n require_once(dirname(dirname(__FILE__)).'/mlanglib.php');\n\n // convert legacy stashes that were pull-requested\n $stashids = $DB->get_records('amos_stashes', array('pullrequest' => 1), 'timemodified ASC', 'id');\n\n foreach ($stashids as $stashrecord) {\n $stash = mlang_stash::instance_from_id($stashrecord->id);\n\n // split the stashed components into separate packages by their language\n $stage = new mlang_stage();\n $langstages = array(); // (string)langcode => (mlang_stage)\n $stash->apply($stage);\n foreach ($stage->get_iterator() as $component) {\n $lang = $component->lang;\n if (!isset($langstages[$lang])) {\n $langstages[$lang] = new mlang_stage();\n }\n $langstages[$lang]->add($component);\n }\n $stage->clear();\n unset($stage);\n\n // create new contribution record for every language and attach a new stash to it\n foreach ($langstages as $lang => $stage) {\n if (!$stage->has_component()) {\n // this should not happen, but...\n continue;\n }\n $copy = new mlang_stage();\n foreach ($stage->get_iterator() as $component) {\n $copy->add($component);\n }\n $copy->rebase();\n if ($copy->has_component()) {\n $tostatus = 0; // new\n } else {\n $tostatus = 30; // nothing left after rebase - consider it accepted\n }\n\n $langstash = mlang_stash::instance_from_stage($stage, 0, $stash->name);\n $langstash->message = $stash->message;\n $langstash->push();\n\n $contribution = new stdClass();\n $contribution->authorid = $stash->ownerid;\n $contribution->lang = $lang;\n $contribution->assignee = null;\n $contribution->subject = $stash->name;\n $contribution->message = $stash->message;\n $contribution->stashid = $langstash->id;\n $contribution->status = $tostatus;\n $contribution->timecreated = $stash->timemodified;\n $contribution->timemodified = null;\n\n $contribution->id = $DB->insert_record('amos_contributions', $contribution);\n\n // add a comment there\n $comment = new stdClass();\n $comment->contextid = SITEID;\n $comment->commentarea = 'amos_contribution';\n $comment->itemid = $contribution->id;\n $comment->content = 'This contribution was automatically created during the conversion of legacy pull-requested stashes.';\n $comment->format = 0;\n $comment->userid = 2;\n $comment->timecreated = time();\n $DB->insert_record('comments', $comment);\n }\n $stash->drop();\n }\n\n upgrade_plugin_savepoint(true, 2011011000, 'local', 'amos');\n }\n\n if ($oldversion < 2011011001) {\n\n $table = new xmldb_table('amos_stashes');\n\n $field = new xmldb_field('shared');\n if ($dbman->field_exists($table, $field)) {\n $dbman->drop_field($table, $field);\n }\n\n $field = new xmldb_field('pullrequest');\n if ($dbman->field_exists($table, $field)) {\n $dbman->drop_field($table, $field);\n }\n\n $table = new xmldb_table('amos_hidden_requests');\n if ($dbman->table_exists($table)) {\n $dbman->drop_table($table);\n }\n\n upgrade_plugin_savepoint(true, 2011011001, 'local', 'amos');\n }\n\n return $result;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests the `Password::hash()` method with both generated and custom salts.
public function testHash() { $this->skipIf(!CRYPT_BLOWFISH, 'Blowfish is not supported.'); $salt = '$2a$07$l1th1um1saw3some12345678$'; $expected = '$2a$07$l1th1um1saw3some12345uDt5Wuw5uzI5lCIn3HM1QkB7cJLou4Hy'; $result = Password::hash($this->_password, $salt); $this->assertEqual($expected, $result); $result = Password::hash($this->_password); $this->assertNotEqual($expected, $result); }
[ "abstract public function hash($password);", "public function test_password_hash()\n\t{\n\t\t// FALSE is returned if no CSPRNG source is available\n\t\tif ( ! defined('MCRYPT_DEV_URANDOM') && ! function_exists('openssl_random_pseudo_bytes')\n\t\t\t&& (DIRECTORY_SEPARATOR !== '/' OR ! is_readable('/dev/arandom') OR ! is_readable('/dev/urandom'))\n\t\t\t)\n\t\t{\n\t\t\t$this->assertFalse(password_hash('foo', PASSWORD_BCRYPT));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->assertEquals(60, strlen(password_hash('foo', PASSWORD_BCRYPT)));\n\t\t\t$this->assertTrue(($hash = password_hash('foo', PASSWORD_BCRYPT)) === crypt('foo', $hash));\n\t\t}\n\n\t\t$this->assertEquals(\n\t\t\t'$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi',\n\t\t\tpassword_hash('rasmuslerdorf', PASSWORD_BCRYPT, array('cost' => 7, 'salt' => 'usesomesillystringforsalt'))\n\t\t);\n\n\t\t$this->assertEquals(\n\t\t\t'$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y',\n\t\t\tpassword_hash('test', PASSWORD_BCRYPT, array('salt' => '123456789012345678901'.chr(0)))\n\t\t);\n\t}", "public function hash($password, $hash_with = self::HASHED_WITH_PHP);", "public function testHash()\n {\n\n if (!extension_loaded('openssl')) {\n $this->markTestSkipped('Warning: openssl extension is not loaded');\n return;\n }\n\n $security = new PhSecurity();\n\n for ($i = 8; $i < 12; $i++) {\n $hash = $security->hash('a', $i);\n $this->assertTrue($security->checkHash('a', $hash));\n }\n\n for ($i = 8; $i < 12; $i++) {\n $hash = $security->hash('aaaaaaaaaaaaaa', $i);\n $this->assertTrue($security->checkHash('aaaaaaaaaaaaaa', $hash));\n }\n }", "public function testDefaultHash()\n {\n $opts = array(\n 'cost' => 7,\n 'salt' => Password::salt(),\n );\n\n $hash = Password::hash( $this->examplePassword, null, $opts );\n\n $this->assertNotEmpty( $hash );\n $this->assertNotEquals( $this->examplePassword, $hash );\n $this->assertTrue( Password::verify( $this->examplePassword, $hash ) );\n $this->assertFalse( Password::needsRehash( $hash, null, $opts ) );\n\n $info = Password::getInfo( $hash );\n $this->assertEquals( Password::ALGO_BCRYPT, $info['algo'] );\n }", "public static function test_password($password, $hash);", "public function testSaltingCapabilitiesForHashingData()\n {\n $hasher = $this->getHashAlgorithmInstanceForTesting();\n\n $data = 'test';\n $hasher->setSalt('1234')\n ->setOutputLength(self::OUTPUT_LENGTH)\n ->setContextualString(self::CONTEXT_STRING)\n ->setDerivationSalt(self::DERIVATION_SALT);\n\n $this->assertEquals('1234', $hasher->getSalt());\n $this->assertEquals(self::OUTPUT_LENGTH, $hasher->getOutputLength());\n $this->assertEquals(self::CONTEXT_STRING, $hasher->getContextualString());\n $this->assertEquals(self::DERIVATION_SALT, $hasher->getDerivationSalt());\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_NONE); // 'test'\n $this->assertEquals($hasher::SALTING_MODE_NONE, $hasher->getSaltingMode());\n\n $this->assertEquals(\n '9FCF983493BA785C13C0D7019729C5B5',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_APPEND); // 'test1234'\n $this->assertEquals($hasher::SALTING_MODE_APPEND, $hasher->getSaltingMode());\n\n $this->assertEquals(\n 'F4D523E7CE28C4834759B5CCABEF9504',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_PREPEND); // '1234test'\n $this->assertEquals($hasher::SALTING_MODE_PREPEND, $hasher->getSaltingMode());\n\n $this->assertEquals(\n 'B53FA7A3DB4DE66B094B9936C90AABFB',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_INFIX_INPUT); // '1234test4321'\n $this->assertEquals($hasher::SALTING_MODE_INFIX_INPUT, $hasher->getSaltingMode());\n\n $this->assertEquals(\n 'D7C7E2CD0246284444D68A5B54FABCBE',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_INFIX_SALT); // 'test1234tset'\n $this->assertEquals($hasher::SALTING_MODE_INFIX_SALT, $hasher->getSaltingMode());\n\n $this->assertEquals(\n 'C2CD764275D8F64B2718197F96C6B99D',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_REVERSE_APPEND); // 'test4321'\n $this->assertEquals($hasher::SALTING_MODE_REVERSE_APPEND, $hasher->getSaltingMode());\n\n $this->assertEquals(\n '0A52D6500083E4748DA6099B1B109446',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_REVERSE_PREPEND); // '4321test'\n $this->assertEquals($hasher::SALTING_MODE_REVERSE_PREPEND, $hasher->getSaltingMode());\n\n $this->assertEquals(\n '6DB11F3A55E6C8BDDA562AD2F2B88ACB',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_DUPLICATE_SUFFIX); // 'test12344321'\n $this->assertEquals($hasher::SALTING_MODE_DUPLICATE_SUFFIX, $hasher->getSaltingMode());\n\n $this->assertEquals(\n 'C30E354922E742368617EEE834594951',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_DUPLICATE_PREFIX); // '12344321test'\n $this->assertEquals($hasher::SALTING_MODE_DUPLICATE_PREFIX, $hasher->getSaltingMode());\n\n $this->assertEquals(\n '967C8C64AED1FF76C72F16AB7F7AA580',\n $hasher->hashData($data)\n );\n\n $hasher->setSaltingMode($hasher::SALTING_MODE_PALINDROME_MIRRORING); // '1234testtset4321'\n $this->assertEquals($hasher::SALTING_MODE_PALINDROME_MIRRORING, $hasher->getSaltingMode());\n\n $this->assertEquals(\n 'DD33C8D29483CA27333E0FF56B71CCCC',\n $hasher->hashData($data)\n );\n }", "public function testHash()\n {\n //Checking that the same hash is returned for the same value.\n $hash1 = $this->encryptor->hash($value = 'some value');\n $hash2 = $this->encryptor->hash($value);\n $this->assertEquals($hash1, $hash2);\n\n //Checking that hash works with hash validation.\n $this->assertTrue($this->encryptor->isValidHash($value, $hash1));\n\n //Checking that key matters.\n $this->keyValidatorMock->method('isValid')->willReturn(true);\n $this->encryptor->setNewKey(self::CRYPT_KEY_2);\n $hash3 = $this->encryptor->hash($value);\n $this->assertNotEquals($hash3, $hash1);\n //Validation still works\n $this->assertTrue($this->encryptor->validateHash($value, $hash3));\n }", "public function testHashingSaltGeneration()\n {\n $generator = $this->getTokenGeneratorForTesting();\n\n $resultOne = $generator->getHashingSalt(64);\n $resultTwo = $generator->getHashingSalt(64);\n\n $this->assertEquals($resultOne, $resultTwo);\n\n $resultOne = $generator->getHashingSalt(64, false);\n $resultTwo = $generator->getHashingSalt(64, false);\n\n $this->assertEquals($resultOne, $resultTwo);\n }", "public static function hash(string $password): string;", "public function validateHash($password, $hash);", "public function testStrongerSystemSpecificHashSuccess($input) {\n\t\t$t_hasher = new PasswordHash(8, FALSE);\n\t\t$hash = $t_hasher->HashPassword($input);\n\n\t\t$this->assertTrue($t_hasher->CheckPassword($input, $hash));\n\t}", "public function testHashProducesValidBcryptHash()\n\t{\n\t\t$this->assertTrue(strlen(Hash::make('taylor')) == 60);\n\t}", "public function testDefaultHash() {\n $psl = new \\phpSec\\Core();\n\n $hash = $psl['crypt/hash'];\n $str = 'some string';\n $pwHash = $hash->create($str);\n\n $this->assertTrue($hash->check($str, $pwHash));\n $this->assertFalse($hash->check($str.'f00', $pwHash));\n }", "function hashPass() {\n\t$args = func_get_args();\n\t\n\tif(count($args) >= 1) {\n\t\t$password = $args[0];\n\t\techo \"Hashing password...\\n\";\n\t\t$hashedPassword = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);\n\t\techo \"Done.\\n\\nHashed Password: \" . $hashedPassword;\n\t}\n}", "public function testHashFilter()\n {\n $password = 'test password';\n $hashedPassword = password_hash('test', PASSWORD_DEFAULT);\n\n $hashFilter = new HashFilter();\n\n $this->assertNotEquals($password, $hashFilter->modify($password));\n $this->assertNotEquals($hashedPassword, $hashFilter->modify($password));\n $this->assertEquals(\n true,\n password_verify($password, $hashFilter->modify($password))\n );\n }", "public function testHashV2Passwords()\n {\n $hasher = new PasswordHasher(PasswordHasherCompatibilityMode::IDENTITY_V2);\n $hashedPassword = $hasher->hashPassword('very strong password');\n $result = $hasher->verifyHashedPassword($hashedPassword, 'very strong password');\n $this->assertEquals(PasswordVerificationResult::SUCCESS, $result);\n }", "public function testHashThatNeedRehash()\n {\n $hash = password_hash('password', PASSWORD_DEFAULT, ['cost' => 9,]);\n\n $this->assertTrue($this->password->needsRehash($hash));\n }", "public function testHashingSaltGeneration()\n {\n $generator = $this->getTokenGeneratorForTesting(new PseudoRandom());\n\n $resultOne = $generator->getHashingSalt(64);\n $resultTwo = $generator->getHashingSalt(64);\n\n $this->assertNotEquals($resultOne, $resultTwo);\n\n $resultOne = $generator->getHashingSalt(64, false);\n $resultTwo = $generator->getHashingSalt(64, false);\n\n $this->assertNotEquals($resultOne, $resultTwo);\n\n $generator->seedRandomGenerator(42);\n $resultOne = $generator->getHashingSalt(64);\n\n $generator->seedRandomGenerator(42);\n $resultTwo = $generator->getHashingSalt(64);\n\n $this->assertEquals($resultOne, $resultTwo);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operation deleteNetworkSwitchAccessPolicy Delete an access policy for a switch network
public function deleteNetworkSwitchAccessPolicy($network_id, $access_policy_number) { $this->deleteNetworkSwitchAccessPolicyWithHttpInfo($network_id, $access_policy_number); }
[ "public function deleteControlPolicy($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->deleteControlPolicyWithOptions($request, $runtime);\n }", "public function removePolicy($absPath, AccessControlPolicyInterface $policy);", "public function deleteTrafficMarkingPolicy($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->deleteTrafficMarkingPolicyWithOptions($request, $runtime);\n }", "public function testUpdateNetworkSwitchAccessPolicy()\n {\n }", "public function delete_policy($policy_name, $opt = null)\n\t{\n\t\tif (!$opt) $opt = array();\n\t\t$opt['PolicyName'] = $policy_name;\n\t\t\n\t\treturn $this->authenticate('DeletePolicy', $opt);\n\t}", "public function deleteVSwitch($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->deleteVSwitchWithOptions($request, $runtime);\n }", "public function deleteNatGateway($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->deleteNatGatewayWithOptions($request, $runtime);\n }", "public function deleteNetworkAcl($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->deleteNetworkAclWithOptions($request, $runtime);\n }", "public function deleteNatIp($request)\n {\n $runtime = new RuntimeOptions([]);\n\n return $this->deleteNatIpWithOptions($request, $runtime);\n }", "public function removeAccessPolicy($accesspolicycontrol) {\n\t\t$accesspolicycontrol = (int)$accesspolicycontrol;\n\n\t\t$sql = \"DELETE FROM\n\t\t\t\t\t{$this->cTableName}\n\t\t\t WHERE\n\t\t\t \tcontrol = {$accesspolicycontrol}\";\n\n $statement = $this->prepare($sql);\n\t\t$statement->execute();\n\n $result = $this->fetchObject($statement);\n\n return $result;\n\n\t}", "public function removePolicy($repositoryId, $policyId, $objectId, ExtensionDataInterface $extension = null);", "public function deleteNetworkSwitchAccessPolicyAsyncWithHttpInfo($network_id, $access_policy_number)\n {\n $returnType = '';\n $request = $this->deleteNetworkSwitchAccessPolicyRequest($network_id, $access_policy_number);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function updateNetworkSwitchAccessPolicy($network_id, $access_policy_number, $update_network_switch_access_policy = null)\n {\n list($response) = $this->updateNetworkSwitchAccessPolicyWithHttpInfo($network_id, $access_policy_number, $update_network_switch_access_policy);\n return $response;\n }", "public function deleteAssetDeliveryPolicy($assetDeliveryPolicy);", "public function testDeleteDeviceControlPolicies()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "protected function updateNetworkSwitchAccessPolicyRequest($network_id, $access_policy_number, $update_network_switch_access_policy = null)\n {\n // verify the required parameter 'network_id' is set\n if ($network_id === null || (is_array($network_id) && count($network_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $network_id when calling updateNetworkSwitchAccessPolicy'\n );\n }\n // verify the required parameter 'access_policy_number' is set\n if ($access_policy_number === null || (is_array($access_policy_number) && count($access_policy_number) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $access_policy_number when calling updateNetworkSwitchAccessPolicy'\n );\n }\n\n $resourcePath = '/networks/{networkId}/switch/accessPolicies/{accessPolicyNumber}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($network_id !== null) {\n $resourcePath = str_replace(\n '{' . 'networkId' . '}',\n ObjectSerializer::toPathValue($network_id),\n $resourcePath\n );\n }\n // path params\n if ($access_policy_number !== null) {\n $resourcePath = str_replace(\n '{' . 'accessPolicyNumber' . '}',\n ObjectSerializer::toPathValue($access_policy_number),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($update_network_switch_access_policy)) {\n $_tempBody = $update_network_switch_access_policy;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('X-Cisco-Meraki-API-Key');\n if ($apiKey !== null) {\n $headers['X-Cisco-Meraki-API-Key'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'PUT',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function deleteContentKeyAuthorizationPolicy($contentKeyAuthorizationPolicy);", "public function networkDelete($id)\n {\n $this->networkDeleteWithHttpInfo($id);\n }", "protected function createNetworkSwitchAccessPolicyRequest($network_id, $create_network_switch_access_policy)\n {\n // verify the required parameter 'network_id' is set\n if ($network_id === null || (is_array($network_id) && count($network_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $network_id when calling createNetworkSwitchAccessPolicy'\n );\n }\n // verify the required parameter 'create_network_switch_access_policy' is set\n if ($create_network_switch_access_policy === null || (is_array($create_network_switch_access_policy) && count($create_network_switch_access_policy) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $create_network_switch_access_policy when calling createNetworkSwitchAccessPolicy'\n );\n }\n\n $resourcePath = '/networks/{networkId}/switch/accessPolicies';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($network_id !== null) {\n $resourcePath = str_replace(\n '{' . 'networkId' . '}',\n ObjectSerializer::toPathValue($network_id),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n if (isset($create_network_switch_access_policy)) {\n $_tempBody = $create_network_switch_access_policy;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('X-Cisco-Meraki-API-Key');\n if ($apiKey !== null) {\n $headers['X-Cisco-Meraki-API-Key'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a visual notification on the edit screen to tell users they are editing a members page or post.
function ssc_member_edit_screen_message() { // @var WP_Screen $screen $screen = get_current_screen(); if ( ssc_member_is_debug_mode() && ( 'member-page' === $screen->post_type || ssc_member_is_editing_private_post() ) ) { echo sprintf( "<div style='background-color: red; color: white; padding: 0.2em; text-align: center;'>%s</div>", esc_html__( 'Members only' ) ); } }
[ "public function show_on_post_edit_screen();", "public function onAttendeesEdit()\n\t{\n\t\tif ($this->perms->edit)\n\t\t{\n\t\t\tJToolBarHelper::save();\n\t\t}\n\n\t\tJToolBarHelper::cancel();\n\t\t$this->setToolbarTitle('Edit');\n\t}", "function on_Edit() {\n $this->on_Show();\n }", "public function admin_edit_notice()\n\t{\n\t\t$this->load->view('admin/admin_edit_notice');\n\t}", "public function admin_notices() {\n\t\t$socialflow_params = filter_input_array( INPUT_GET );\n\t\tglobal $socialflow;\n\t\tif ( isset( $socialflow_params['page'] ) && $this->slug === $socialflow_params['page'] && isset( $socialflow_params['settings-updated'] ) && $socialflow_params['settings-updated'] ) {\n\t\t\t$socialflow->render_view( 'notice/options-updated' );\n\t\t}\n\t}", "public static function is_edit_screen() {\n\t\t$is_edit_screen = isset( $_GET[ Main::EDIT_FLAG ] ) || Post_Type::is_notification();\n\n\t\treturn apply_filters( 'tcb_is_notifications_edit_screen', $is_edit_screen );\n\t}", "function culturefeed_ui_profile_edit_message(CultureFeed_User $culturefeed_user) {\n\n $user_id = culturefeed_get_uid_for_cf_uid($culturefeed_user->id, $culturefeed_user->nick);\n\n $message = t('Changes saved successfully.') . ' ';\n $message .= t(\n \"<a href=\\\"@profile\\\">View your profile</a> as shown to others.\",\n array('@profile' => url('user/' . $user_id))\n );\n\n return $message;\n\n}", "function custom_tmt_members_page(){\n\tui_admin_members();\n}", "public function ns_task_edit_page() {\n\t\tglobal $task;\n\t\t\n\t\t$task_id = $this->sanitize( $_GET, 'edit' );\n\t\t/**\n\t\t * @var WP_Post $task\n\t\t */\n\t\t$task = get_post( $task_id );\n\t\tif ( $task instanceof WP_Error || $task->post_type !== $this->task_type || ! empty( get_post_meta( $task->ID, '_private', true ) ) ) {\n\t\t\twp_redirect( admin_url( 'index.php?page=ns-dashboard' ) );\n\t\t}\n\t\t\n\t\t$this->get_template( 'client-tasks-edit' );\n\t}", "public static function notification_page() {\n\t\t$form_id = rgget( 'id' );\n\t\t$notification_id = rgget( 'nid' );\n\t\tif ( ! rgblank( $notification_id ) ) {\n\t\t\tself::notification_edit_page( $form_id, $notification_id );\n\t\t} else {\n\t\t\tself::notification_list_page( $form_id );\n\t\t}\n\t}", "static function admin_controls( WP_Post $post)\n {\n if ( is_user_logged_in() && current_user_can('edit_post', $post->ID ) )\n ?>\n <a href=\"<?php echo get_edit_post_link($post->ID) ?>\"><span class=\"dashicons dashicons-edit-large\"></span></a>\n <?php\n }", "public function editPage() {\n\t\t\n\t\tinclude(\"system/core/post_functions/edit_page.php\");\n\t\t\n\t}", "public function onPaymentsEdit()\n\t{\n\t\tif ($this->perms->edit)\n\t\t{\n\t\t\t//JToolBarHelper::save();\n\t\t}\n\n\t\tJToolBarHelper::cancel();\n\t\t$this->setToolbarTitle('Edit');\n\t}", "public function _adminPage()\n\t{\t\t\n\t\t// Render notice\n\t\tif($error = $this->error)\n\t\t{\t\n\t\t\t$this->notice = is_array($error) ? implode('<br />', array_unique($error)) : $error;\n\t\t\t$this->notice = '<div class = \"error\"><p>' . $this->notice . '</p></div>';\n\t\t}\n\t\t\n\t\tif($note = $this->notice)\n\t\t\techo $note[0] != '<' ? '<div class = \"updated\"><p>' . $note . '</p></div>' : $note;\n\t\t\n\t\trequire_once dirname(dirname(__FILE__)) . '/resource/view.admin.phtml';\n\t}", "function edit() {\n $this->addHelper('textile');\n $this->setTemplate('add_message');\n \n $message = ProjectMessages::findById(get_id());\n if (!($message instanceof ProjectMessage)) {\n flash_error(lang('message dnx'));\n $this->redirectTo('message');\n } // if\n \n if (!$message->canEdit(logged_user())) {\n flash_error(lang('no access permissions'));\n $this->redirectTo('message');\n } // if\n \n $message_data = array_var($_POST, 'message');\n $this->setSidebar(get_template_path('textile_help_sidebar'));\n if (!is_array($message_data)) {\n $tag_names = plugin_active('tags') ? $message->getTagNames() : '';\n $message_data = array(\n 'milestone_id' => $message->getMilestoneId(),\n 'title' => $message->getTitle(),\n 'text' => $message->getText(),\n 'additional_text' => $message->getAdditionalText(),\n 'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '',\n 'is_private' => $message->isPrivate(),\n 'is_important' => $message->getIsImportant(),\n 'comments_enabled' => $message->getCommentsEnabled(),\n 'anonymous_comments_enabled' => $message->getAnonymousCommentsEnabled(),\n ); // array\n } // if\n \n $this->setSidebar(get_template_path('textile_help_sidebar'));\n tpl_assign('message', $message);\n tpl_assign('message_data', $message_data);\n \n if (is_array(array_var($_POST, 'message'))) {\n try {\n $old_is_private = $message->isPrivate();\n $old_is_important = $message->getIsImportant();\n $old_comments_enabled = $message->getCommentsEnabled();\n $old_anonymous_comments_enabled = $message->getAnonymousCommentsEnabled();\n \n $message->setFromAttributes($message_data);\n \n // Options are reserved only for members of owner company\n if (!logged_user()->isMemberOfOwnerCompany()) {\n $message->setIsPrivate($old_is_private);\n $message->setIsImportant($old_is_important);\n $message->setCommentsEnabled($old_comments_enabled);\n $message->setAnonymousCommentsEnabled($old_anonymous_comments_enabled);\n } // if\n \n DB::beginWork();\n $message->save();\n if (plugin_active('tags')) {\n $message->setTagsFromCSV(array_var($message_data, 'tags'));\n }\n \n ApplicationLogs::createLog($message, $message->getProject(), ApplicationLogs::ACTION_EDIT);\n DB::commit();\n \n flash_success(lang('success edit message', $message->getTitle()));\n $this->redirectToUrl($message->getViewUrl());\n \n } catch(Exception $e) {\n DB::rollback();\n tpl_assign('error', $e);\n } // try\n } // if\n }", "function hrb_dispute_opened_notify_admin( $dispute_id ) {\n\n\t$dispute = get_post( $dispute_id );\n\n\t$disputer = get_user_by( 'id', $dispute->post_author );\n\n\t$dispute_link = html_link( add_query_arg( array( 'post' => $dispute_id, 'action' => 'edit' ), admin_url( 'post.php' ) ), __( 'dispute.', APP_TD ) );\n\t$disputes_link = html_link( add_query_arg( array( 'post_type' => APP_DISPUTE_PTYPE, 'post_status' => 'publish' ), admin_url( 'edit.php' ) ), __( 'View all open disputes.', APP_TD ) );\n\n\t$subject = sprintf( __( '[%s] A new dispute was opened', APP_TD ), get_bloginfo( 'name' ) );\n\n\t$content = sprintf(\n\t\t__( 'Hello,%1$s\n\t\tA new %2$s was opened by \\'%3$s\\'.%1$s%1$s\n\t\tPlease review it and decide accordingly.%1$s%1$s\n\t\t%4$s', APP_TD ), \"\\r\\n\\r\\n\", $dispute_link, $disputer->display_name, $disputes_link\n\t);\n\n\tappthemes_send_email( get_option( 'admin_email' ), $subject, wpautop( $content ) );\n}", "public static function insert_notification_element() {\n\t\tif ( ! ( Main::is_preview_screen() || Main::is_edit_screen() ) ) {\n\t\t\techo Main::get_notification_content( true, '', false, false );\n\t\t}\n\t}", "public function edit() {\n\n\t\tif ($this->authenticated===false) {\n\t\t\t$this->index();\n\t\t} else {\n\n\t\t\t// Get model type and id\n\t\t\t$this->requestParser();\n\n\t\t\t// Create the helper\n\t\t\t$viewHelper = new View_Admin_Helper($this->model, $this->id);\n\n\t\t\t// Set notice to View if available\n\t\t\t$message = isset($this->message) ? $viewHelper->notice($this->message) : null;\t\t\n\n\t\t\t// Setup the editor View\n\t\t\t$this->data['view'] = $viewHelper->editView();\n\t\t}\n\t}", "public static function notification_edit_page( $form_id, $notification_id ) {\n\n\t\tGFFormSettings::page_header( esc_html__( 'Notifications', 'gravityforms' ) );\n\n\t\tif ( ! self::get_settings_renderer() ) {\n\t\t\tself::initialize_settings_renderer();\n\t\t}\n\n\t\t// Render settings.\n\t\tself::get_settings_renderer()->render();\n\n\t\tGFFormSettings::page_footer();\n\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes an item through the frontend My Galleries part
function deleteItem() { global $rsgAccess, $mainframe; $my = JFactory::getUser(); $database = JFactory::getDBO(); $id = rsgInstance::getInt( 'id' , ''); if ($id) { //Get gallery id $gallery_id = galleryUtils::getCatidFromFileId($id); //Check if file deletion is allowed in this gallery if ($rsgAccess->checkGallery('del_img', $gallery_id )) { $filename = galleryUtils::getFileNameFromId($id); imgUtils::deleteImage($filename); $mainframe->redirect(JRoute::_("index.php?option=com_rsgallery2&rsgOption=myGalleries"), JText::_('Image is deleted') ); } else { $mainframe->redirect(JRoute::_("index.php?option=com_rsgallery2&rsgOption=myGalleries"), JText::_('USERIMAGE_NOTOWNER') ); } } else { //No ID sent, no delete possible, back to my galleries $mainframe->redirect(JRoute::_("index.php?option=com_rsgallery2&rsgOption=myGalleries"), JText::_('No Id provided. Contact component developer') ); } }
[ "public function deleteGallery()\n {\n try\n {\n Gallery::deleteGallery($this->get['param'][0]);\n echo $this->responseJson('success', tr::get('gallery_deleted'));\n }\n catch (Exception $e)\n {\n error_log($e->getMessage());\n echo $this->responseJson('error', tr::get('gallery_not_deleted'));\n }\n }", "public function delete()\n\t{\n\t\t$app = JFactory::getApplication();\n\t\t$pk = $app->input->getInt('id');\n\t\t$model = $this->getModel();\n\t\t$db = $model->getDbo();\n\t\t$q = $db->getQuery(true);\n\n\t\t$q\n\t\t\t->select('a.*')\n\t\t\t->from('#__gazebos_gallery AS a')\n\t\t\t->where('a.id = ' . $pk);\n\n\t\t$obj = $db->setQuery($q)->loadObject();\n\n\t\tif ($model->delete($pk))\n\t\t{\n\t\t\t$path = $this->dir . $obj->product_id . '/' . $obj->path;\n\n\t\t\t$to_delete = array(JPATH_SITE . $path);\n\n\t\t\tforeach (EEImageHelper::getImageSizes() as $method => $sizes)\n\t\t\t{\n\t\t\t\tforeach ($sizes as $size)\n\t\t\t\t{\n\t\t\t\t\t$to_delete[] = JPATH_SITE . EEImageHelper::getThumbPath($path . 'thumbs/' . $obj->path, $size);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tJFile::delete($to_delete);\n\t\t\t$result = 'success';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$result = 'fail';\n\t\t}\n\n\t\t$app->close(json_encode(array('result' => $result)));\n\t}", "function videogallery_grade_item_delete($videogallery) {\n global $CFG;\n require_once($CFG->libdir.'/gradelib.php');\n\n return grade_update('mod/videogallery', $videogallery->course, 'mod', 'videogallery',\n $videogallery->id, 0, null, array('deleted' => 1));\n}", "public function deleteGalleryColumn()\n {\n $item = new \\stdClass();\n $item->id = $this->id;\n $item->gallery = '';\n return $this->db->updateObject('#__k2_items', $item, 'id');\n }", "function delete_bp_gallery() {\n\tglobal $bp;\n\tglobal $wpdb;\n\t\n\t$id =\t$_REQUEST['id']; \n\n\t$delete = $wpdb->query(\n\t\t\t\"DELETE FROM \".$wpdb->prefix.\"gallery_images\n\t\t\t WHERE id = '$id'\n\t\t\t\"\n\t\t);\n\t\n\tif($delete) {\n\t\techo $res = \"<span style='color:red;'>Record deleted successfully.</span>\";\n\t}\n\t\n}", "public function deleteAction()\n\t{\n\n // check if we know what should be deleted\n if ($id = $this->getRequest()->getParam('id')) {\n try {\n // init model and delete\n $model = Mage::getModel('responsiveslider/responsiveslider_item');\n $model->load($id);\n $model->delete();\n\n //delete link to slider\n $this->_resetItemToSlidersLink();\n\n // display success message\n Mage::getSingleton('adminhtml/session')->addSuccess(\n Mage::helper('responsiveslider')->__('The slide has been deleted.')\n );\n // go to grid\n $this->_redirect('*/*/');\n\n return;\n\n } catch (Exception $e) {\n // display error message\n Mage::getSingleton('adminhtml/session')->addError($e->getMessage());\n // go back to edit form\n $this->_redirect('*/*/edit', array('id' => $id));\n\n return;\n }\n }\n // display error message\n Mage::getSingleton('adminhtml/session')->addError(\n Mage::helper('responsiveslider')->__('Unable to find a slide to delete.')\n );\n // go to grid\n $this->_redirect('*/*/');\n\t}", "public function delete()\n {\n // Delete the gallery images\n $this->photos()->delete();\n\n // Delete the gallery\n return parent::delete();\n }", "public function delete()\r\n {\r\n $db = Loader::db();\r\n $db->delete('btShsGalleriaImages', array('bID' => $this->bID));\r\n $db->delete('btShsGalleriaVideos', array('bID' => $this->bID));\r\n parent::delete();\r\n }", "public function removegallery(Request $request)\n {\n $item = Slider::where('id', $request->id)->first();\n\n Storage::disk('public')->delete($item->image);\n\n $item->delete();\n }", "public function deleteAction(Request $request, MainGallery $mainGallery)\n {\n// $form = $this->createDeleteForm($mainGallery);\n// $form->handleRequest($request);\n//\n// if ($form->isSubmitted() && $form->isValid()) {\n $em = $this->getDoctrine()->getManager();\n $em->remove($mainGallery);\n $em->flush();\n// }\n return new Response (null, 204);\n// return $this->redirectToRoute('maingallery_index');\n }", "abstract protected function deleteItem();", "public function actionDelete($gallery_url)\n {\n\n if (Yii::$app->request->isAjax) {\n\n\n $post = Yii::$app->request->post();\n\n if(isset($post['id']) and is_numeric($post['id'])) {\n\n $model = $this->findModel($post['id']);\n\n\t $path_to_frontend = Yii::getAlias('@webroot/uploads/' . Yii::$app->controller->id . '/' . $gallery_url . '/');\n\t //$path_to_frontend = '../..' . \\Yii::$app->urlManagerFrontend->createUrl('/') . 'uploads/gallerys/';\n\n if(isset($model->img) and !empty($model->img)) {\n\n $image = $path_to_frontend . $model->img;\n $image_small = $path_to_frontend . 'small_' . $model->img;\n $image_tiny = $path_to_frontend . 'tiny_' . $model->img;\n\n if(file_exists($image)) unlink($image);\n if(file_exists($image_small)) unlink($image_small);\n if(file_exists($image_tiny)) unlink($image_tiny);\n\n }\n //\n $items = [ 'result' => $model->delete(), 'Фотографія успішно видалена'];\n\n \\Yii::$app->response->format = 'json';\n\n return $items;\n }\n }\n\n return $this->redirect(['index']);\n }", "public function offersGalleryDeleteAction()\n {\n\n $imageId = $this->params()->fromRoute('imageId', '');\n $offer = $this->galleryTable->getOfferIdByImage($imageId)->toArray();\n $image = $this->galleryTable->getImage($imageId)->toArray();\n $offerId = $offer['offer_id'];\n\n try {\n $this->galleryTable->delete($imageId);\n unlink(PUBLIC_PATH . '/media/offers/' . $offerId . '/' . $image['image']);\n unlink(PUBLIC_PATH . '/media/offers/' . $offerId . '/front-' . $image['image']);\n } catch (InvalidQueryException $e) {\n $this->flashMessenger()->addErrorMessage('This image cannot be deleted');\n }\n\n return $this->redirect()->toRoute('languageRoute/adminOffersGallery', array('offerId' => $offerId));\n }", "public function deletePhotoOfDayAction() {\n $this->view->id = $this->_getParam('id');\n if ($this->getRequest()->isPost()) {\n Engine_Api::_()->getDbtable('itemofthedays', 'sitealbum')->delete(array('itemoftheday_id =?' => $this->_getParam('id')));\n\n return $this->_forward('success', 'utility', 'core', array(\n 'smoothboxClose' => 10,\n 'parentRefresh' => 10,\n 'messages' => array(Zend_Registry::get('Zend_Translate')->_(''))\n ));\n }\n $this->renderScript('admin-photo/delete.tpl');\n }", "public function deleteAction() {\n\t\tif ($slideId = $this->getRequest()->getParam('id')) {\n\t\t\t$slide = Mage::getModel('flexslider/slide')->load($slideId);\n\t\t\t\n\t\t\tif ($slide->getId()) {\n\t\t\t\ttry {\n\t\t\t\t\t$slide->delete();\n\t\t\t\t\t$this->_getSession()->addSuccess($this->__('The slide was deleted.'));\n\t\t\t\t}\n\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t$this->_getSession()->addError($e->getMessage());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->_redirect('*/*');\n\t}", "public function Delete()\n\t{\n\t\ttry\n\t\t{\n\t\t\t\t\t\t\n\t\t\t// TODO: if a soft delete is prefered, change this to update the deleted flag instead of hard-deleting\n\n\t\t\t$pk = $this->GetRouter()->GetUrlParam('idSlider');\n\t\t\t$slider = $this->Phreezer->Get('Slider',$pk);\n\n\t\t\t$slider->Delete();\n\n\t\t\t$output = new stdClass();\n\n\t\t\t$this->RenderJSON($output, $this->JSONPCallback());\n\n\t\t}\n\t\tcatch (Exception $ex)\n\t\t{\n\t\t\t$this->RenderExceptionJSON($ex);\n\t\t}\n\t}", "public function delete()\n {\n $this->removeImage();\n parent::delete();\n }", "public function del_sliderImage()\n {\n if ($this->isLoggedIn()) {\n $id = $this->input->post('id');\n $this->Admin_model->delete('slider', $id);\n } else {\n redirect(base_url());\n }\n }", "public function delete() {\r\n\tunset(Item::$rawItems[$this->idItem]);\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test index route for admin.
public function testIndexRouteAdmin(): void { // given $expectedStatusCode = 200; $adminUser = $this->createUser([User::ROLE_USER, User::ROLE_ADMIN]); $this->logIn($adminUser); // when $this->httpClient->request('GET', '/status'); $resultStatusCode = $this->httpClient->getResponse()->getStatusCode(); // then $this->assertEquals($expectedStatusCode, $resultStatusCode); }
[ "public function testAdminIndexRouteAdmin(): void\n {\n // given\n $expectedStatusCode = 200;\n $adminUser = $this->createUser([User::ROLE_USER, User::ROLE_ADMIN]);\n $this->logIn($adminUser);\n\n // when\n $this->httpClient->request('GET', '/user/admin');\n $resultStatusCode = $this->httpClient->getResponse()->getStatusCode();\n\n // then\n $this->assertEquals($expectedStatusCode, $resultStatusCode);\n }", "public function testIndexForAdmin() {\n\t\t$userInfo = [\n\t\t\t'role' => USER_ROLE_USER | USER_ROLE_ADMIN,\n\t\t\t'prefix' => 'admin',\n\t\t];\n\t\t$this->applyUserInfo($userInfo);\n\t\t$this->generateMockedController();\n\t\t$opt = [\n\t\t\t'method' => 'GET',\n\t\t\t'return' => 'contents',\n\t\t];\n\t\t$view = $this->testAction('/admin/logs/index', $opt);\n\t\t$expected = 4;\n\t\t$numTableRows = $this->getNumberItemsByCssSelector($view, 'div#content div.container table > tbody > tr');\n\t\t$this->assertData($expected, $numTableRows);\n\t}", "public function testIndexRouteAdmin(): void\n {\n // given\n $expectedStatusCode = 200;\n $adminUser = $this->createUser([User::ROLE_USER, User::ROLE_ADMIN]);\n $this->logIn($adminUser);\n\n // when\n $this->httpClient->request('GET', '/user');\n $resultStatusCode = $this->httpClient->getResponse()->getStatusCode();\n\n // then\n $this->assertEquals($expectedStatusCode, $resultStatusCode);\n }", "public function testAdminCanViewTheUserIndex()\n {\n $this->setupUsers();\n\n $response = $this\n ->actingAs($this->admin)\n ->get('/admin/users');\n \n $response->assertStatus(200);\n $response->assertSee('User1');\n $response->assertSee('User1');\n }", "public function testHomePageAccessForAdmin()\n {\n $response = $this->get('/');\n $response->assertStatus(Response::HTTP_OK);\n }", "public function testAdminCanViewThePageIndex()\n {\n $this->initPosts();\n\n $response = $this\n ->actingAs($this->admin)\n ->get('/admin/blog/pages');\n \n $response->assertStatus(200);\n $response->assertSee('Title one');\n $response->assertSee('Title two');\n }", "public function testIndexFailNotAdmin()\n {\n $this->setUserSession();\n $this->get($this->indexUrl);\n $this->assertRedirect('/');\n }", "public function test_state_index_route()\n {\n $user = $this->_getAdminUser();\n $response = $this->actingAs($user, 'admin')->get(route('admin.state.index'));\n\n $response->assertStatus(200)\n ->assertSee(__('avored-framework::system.state-list'));\n }", "public function test_show_urls_list_page_admin()\n {\n $admin = User::find(1);\n $this->actingAs($admin)\n ->get('/url/list')\n ->assertStatus(200);\n }", "public function test_teams_index_authenticated_admin_shows_correct_view(){\n $this->signInAdmin();\n $response = $this->get(route('myTeam.index'));\n $response->assertStatus(403);\n }", "public function testAdminCanViewTheRoleIndex()\n {\n $this->setupRoles();\n\n $response = $this\n ->actingAs($this->admin)\n ->get('/admin/roles');\n \n $response->assertStatus(200);\n $response->assertSee('Role1');\n $response->assertSee('Role2');\n }", "public function testAdminHome()\n {\n $this->actingAs($this->admin)\n ->visit('/')\n ->click('Admin')\n ->seePageIs('/admin')\n ->see('Teams')\n ->see('Bracket')\n ->see('Users')\n ->click('Teams')\n ->seePageIs('/admin/teams')\n ->click('Back')\n ->seePageIs('/admin');\n $this->actingAs($this->admin)\n ->visit('/')\n ->click('Admin')\n ->seePageIs('/admin')\n ->see('Teams')\n ->see('Bracket')\n ->see('Users')\n ->click('Users')\n ->seePageIs('/admin/users')\n ->click('Back')\n ->seePageIs('/admin');\n $this->actingAs($this->admin)\n ->visit('/admin/brackets')\n ->click('Back')\n ->seePageIs('/admin');\n }", "public function testIndexActionWithAdminCredentials(): void {\n $crawler = $this->logInAdmin();\n $client = $this->getClient();\n\n // Click on nav-admin button\n $crawler = $client->click($crawler->selectLink(\"Mes CV\")->link());\n $this->assertEquals(200, $client->getResponse()->getStatusCode(), \"2. The status code expected is not ok.\");\n $this->assertEquals(\"/restricted/resume/\", $client->getRequest()->getRequestUri(), \"3. The request uri expected is not ok.\");\n $this->assertContains(\"Il n'y a aucune donnée pour le moment !\",\n $crawler->filter(\"#resume-container\")->text(), \"4. The page has to contain no element.\");\n }", "public function testAdminAdmin()\n {\n $this->actingAs($this->admin)\n ->visit('/admin')\n ->dontSee('Register')\n ->dontSee('Login')\n ->see($this->admin->name)\n ->see('logged in as admin')\n ->see('Brackets') //navigation\n ->see('Home') //navigation\n ->see('Admin');\n }", "public function testAdminRoute() {\n $login_routes = ['user.login', 'user.register', 'user.pass'];\n\n foreach ($login_routes as $route_name) {\n $route = \\Drupal::service('router.route_provider')->getRouteByName($route_name);\n $is_admin = \\Drupal::service('router.admin_context')->isAdminRoute($route);\n $this->assertTrue($is_admin, t('Admin route correctly marked for \"@title\" page.', ['@title' => $route->getDefault('_title')]));\n }\n }", "public function testIndexForTenantAdmin(): void\n {\n $token = $this->loginByEmail(self::TENANT_ADMIN_1[0], self::TENANT_ADMIN_1[1]);\n\n // Request\n $response = $this->get('api/v1/introCards?token=' . $token);\n\n // Check response status\n $response->assertStatus(403);\n\n $responseJSON = json_decode($response->getContent(), true);\n $success = $responseJSON['success']; // array\n $code = $responseJSON['code']; // array\n $message = $responseJSON['message']; // array\n\n $this->assertEquals(false, $success);\n $this->assertEquals(403, $code);\n $this->assertEquals(\"Permission is absent\", $message);\n }", "public function test_user_can_see_courses_index()\n {\n $this->actAsAdmin();\n $this->get(route('courses.index'))->assertOk();\n $this->actionSuperAdmin();\n $this->get(route('courses.index'))->assertOk();\n\n }", "public function testEditorAccessIndex(){\n $this->loginEditor();\n $this->dispatch('/');\n $this->assertController('index');\n $this->assertAction('index');\n $this->assertResponseCode(200);\n }", "public function testIndexActionCanBeAccessed()\n {\n $this->dispatch('/warehouse/storage');\n $this->assertResponseStatusCode(200);\n $this->assertModuleName('warehouse');\n $this->assertControllerName('controller_warehouse_storage');\n $this->assertControllerClass('Storage');\n $this->assertActionName('index');\n $this->assertMatchedRouteName('warehouse/storage');\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end method getStudentsPane Summary of getCoursesPane This public method contains the default order for the courses table. It sends information about the table headers and functionality to the tableHeader function in the view. It calls the model to get the courses table data from the mysql database.
public static function getCoursesPane() { // creates a variable to send to the controller, and will then go to the model static $orderBy; // this is the default order for the mysql query $orderBy = "courses.deptPrefix, courses.courseNumber"; // Generate the table header and get the user's selected order $orderBy = tableHeader(self::$coursesFormNames, $orderBy); return Model::getCoursesPane($orderBy); }
[ "public function index()\n\t{\n\t\t$dataLoad['navAncestor'] = 'Courses';\n\t\t$dataLoad['navChild'] = 'null';\n\t\t$dataLoad['header'] = 'Courses';\n\t\t$dataLoad['courses'] = $this->fetchCoursesDisplayDetails();\n\t\t$dataLoad['allClasses'] = $this->fetchAllClasses();\n\t\t$this->load->view('courses/index',$dataLoad);\n\t}", "public function actionTopCourses()\r\n\t{\r\n\t\r\n\t\t$this->layout='//layouts/column3';\r\n\t\r\n\t\t$menu_items = array();\r\n\t\r\n\t\t$id= 0;\r\n\t\t\r\n\t\t$parent_hierarchies = MentoringHyerarchy::model()->findAllByAttributes(array('LEVEL_NUMBER'=>'10', 'PARENT_ID'=>0));\r\n\t\t\t\t\r\n\t\t\t$Criteria = new CDbCriteria();\r\n\t\t\t$Criteria->condition = \"RANKING > 2 AND STATUS > 0 AND HIERARCHY_ID IS NOT NULL\";\r\n\t\t\t$Criteria->limit = 10;\r\n\t\t\t$mentoringHierarchy = Course::model()->findAll($Criteria);\r\n\t\r\n\t\t$menu_items[] = array('label'=>'Top cursos','active'=>(!$id), 'url'=>array('site/topCourses'));\r\n\t\r\n\t\tforeach ($parent_hierarchies as $parent_hierarchy){\r\n\t\t\t\t\r\n\t\t\t$items = \t$this->getFirstChild($parent_hierarchy->ID,'site/courseIndex');\r\n\t\r\n\t\t\t$tech = MentUrl::getStandarPathString($parent_hierarchy->NAME,'tecnología');\r\n\t\t\t\r\n\t\t\t$url = (!count($items))? array('site/courseIndex','id'=>$parent_hierarchy->ID,'tech'=>$tech) : array('#');\r\n\t\t\t\t\r\n\t\t\t$menu_items[] = array('label'=>$parent_hierarchy->NAME,'active'=>($id != 0 && $mentoringHierarchy != null && ($mentoringHierarchy->PARENT_ID == $parent_hierarchy->ID || $mentoringHierarchy->ID == $parent_hierarchy->ID )) , 'url'=>$url, 'items'=>$items);\r\n\t\t\t\t\r\n\t\t}\r\n\t\r\n\t\r\n\t\t/**\r\n\t\t * Get all promotions\r\n\t\t *\r\n\t\t */\r\n\t\r\n\t\t$this->promotionItems = SalePromotion::model()->findAllByAttributes(\r\n\t\t\t\tarray(),\r\n\t\t\t\t$condition = 'END_DATE >= :today AND START_DATE <= :today',\r\n\t\t\t\t$params = array(\r\n\t\t\t\t\t\t':today' => date('Y-m-d', time()),\r\n\t\t\t\t)\r\n\t\t);\r\n\t\r\n\t\r\n\t\r\n\t\t// renders the view file 'protected/views/site/index.php'\r\n\t\t// using the default layout 'protected/views/layouts/main.php'\r\n\t\t$this->render('courseIndex', array('parentTopic'=>$id,'menu_items'=>$menu_items,'model'=>$mentoringHierarchy));\r\n\t}", "public function index() {\n $metaData = array();\n $metaData['title'] = \"Course\";\n $metaData['description'] = \"Course\";\n $this->view->meta = $metaData;\n //$this->view->left_layout = \"left_view\";\n $this->view->courseList = $this->model->getCourseList();\n $this->view->Loadview('course', 'courses');\n }", "function showCourses ()\r\n {\r\n $courses = new course();\r\n $courses->showAllCourseNameInUlList();\r\n }", "public function getCourses()\n { \n // echo $this->student_id;\n // exit; \n \n $sql = \" \n\t\t\tSELECT\n\t\t\t\n\t\t\ttc_course_id AS course_id ,\n\t\t\ttc_course_name AS course_name ,\n\t\t\ttc_duration AS duration, \n\t\t\ttc_fee AS fee, \n\t\t\ttsc_course_id AS enrolled\n\t\t\t\n\t\t\tFROM tbl_courses\n\t\t\tLEFT JOIN tbl_student_courses ON tc_course_id=tsc_course_id AND tsc_student_id=$this->student_id \n\t\t\t\n\t\t\tWHERE 1\n\t\t \";\n\t\t \n\t\t$resset = mysql_query($sql) or die(mysql_error());\n\n\t\t$courses = array();\n\t\t$i=0;\n\t\twhile($fetch = mysql_fetch_assoc($resset))\n\t\t{\n\t\t\t$courses[$i]['course_id'] = $fetch['course_id'];\n\t\t\t$courses[$i]['course_name'] = $fetch['course_name'];\n\t\t\t$courses[$i]['duration'] = $fetch['duration'];\n\t\t\t$courses[$i]['fee'] = $fetch['fee'];\n\t\t\t$courses[$i++]['enrolled'] = $fetch['enrolled'];\n\t\t\t\n\t\t}\n\t\t\n\t\t$this->courses = $courses;\n \t}", "public static function getSCbyDPane() {\n\n // creates a variable to send to the controller and then to the model\n static $orderBy;\n // this is the default order for the mysql query\n $orderBy = \"classes.deptPrefix, classes.courseNumber\";\n\n // Generate the table header and get the user's selected order\n $orderBy = tableHeader(self::$scbydFormNames, $orderBy);\n\n return Model::getSCbyDPane($orderBy);\n }", "public function fetchCourses()\n {\n $courses = Course::get();\n\n return DataTables::of($courses)\n ->addColumn('name', function ($course) {\n return $course->name;\n })\n ->addColumn('description', function ($course) {\n return $course->description;\n })\n ->addColumn('duration', function ($course) {\n return $course->duration;\n })\n ->addColumn('level', function ($course) {\n return $course->level;\n })\n ->addColumn('language', function ($course) {\n return $course->language;\n })\n ->addColumn('doctor', function ($course) {\n return $course->doctor->name;\n })\n ->addColumn('doc1', function ($course) {\n return '<a href=\"/courses/courseEvaluations/'.$course->id.'/doc1\" class=\"btn btn-sm btn-info\">Evaluation 1</a>';\n })\n ->addColumn('doc2', function ($course) {\n return '<a href=\"/courses/courseEvaluations/'.$course->id.'/doc2\" class=\"btn btn-sm btn-info\">Evaluation 2</a>';\n })\n ->addColumn('doc3', function ($course) {\n return '<a href=\"/courses/courseEvaluations/'.$course->id.'/doc3\" class=\"btn btn-sm btn-info\">Evaluation 3</a>';\n })\n ->addColumn('lectures_count', function ($course) {\n return $course->lectures_count;\n })\n ->addColumn('students_count', function ($course) {\n return $course->students_count;\n })\n ->addColumn('image', function ($course) {\n return '<img src=\"'.$course->image.'\" style=\"width:60px;\">';\n })\n ->addColumn('action', function ($course) {\n if(Auth::user()->role == \"subAdmin\"){\n return '';\n }\n return '<a class=\"btn action-btn\" href=\\'/courses/edit/'.$course->id.'\\'><span class=\"fa fa-pencil\"></span></a>\n <a class=\"btn action-btn\" onclick=\\'deleteCourse('.$course->id.')\\'><span class=\"fa fa-trash-o\"></span></a>';\n })\n ->rawColumns(['action', 'image', 'doc1', 'doc2', 'doc3'])\n ->make(true);\n }", "public function coursesList()\r\n {\r\n if(isset($_SESSION['user_type']) && $_SESSION['user_type'] == 'admin') {\r\n $data=[];\r\n $this->callPage('Courses','admin_courses','success','Courses @ Angel',$data);\r\n return;\r\n }\r\n }", "function getCourses(){\n\t\t$courseModel = new CoursesModel();\n\t\t$this->category = $_GET['subject'];\n\t\t$this->courses = $courseModel->getCourses($this->category);\n\t}", "public function index()\n {\n $rawQuestions = $this->questions->getCourseSpecific();\n\n $data['questions'] = $this->foldQuestions($rawQuestions);\n\n $data['results2'] = $this->Course_model->getDistinct(\n array('course_subject', 'course_num', 'title', 'course_section', 'section_id'),\n true\n );\n\n $this->load->view('admin_course_questions_view', $data);\n }", "public function actionCourses ()\n\t{\n\t\t$model=new Course;\n\t\t$this->render('courses',array('model'=>$model));\n\t}", "private function nb_student_overview_header(){ //$user_query\n\n\t\tself::nb_admin_header('Students Overview', 'add_student'); \n\t\t\n\t\t/* echo '\n\t\t<ul class=\"subsubsub\">\n\t\t\t<li class=\"all\"><a '.self::nb_cur_page('all').' href=\"admin.php?page=students\">All<!-- <span class=\"count\">(83)</span> --></a> |</li>\n\t\t\t<li class=\"current\"><a '.self::nb_cur_page('current').' href=\"admin.php?page=students&amp;student_type=current\">Current<!-- <span class=\"count\">(83)</span> --></a> |</li>\n\t\t\t<li class=\"inactive\"><a '.self::nb_cur_page('inactive').' href=\"admin.php?page=students&amp;student_type=inactive\">Inactive<!-- <span class=\"count\">(83)</span> --></a> |</li>\n\t\t\t<li class=\"alumni\"><a '.self::nb_cur_page('alumni').' href=\"admin.php?page=students&amp;student_type=alumni\">Alumni<!-- <span class=\"count\">(83)</span> --></a></li>\n\t\t</ul>'; */\n\t\t\n\t}", "function listCourses(){\n \n return $this->fetchAll(array(\"hidden = ?\"=>'0'))->toArray();\n }", "public function showStudentYearCourseTableAction() {\n\n\t\tif(!isset($_POST['Course_year_term'])) {\n\t\t\tthrow new Exception('Argument not set');\n\t\t}\t\n\t\t$sc = new studentcourseItem();\n\t\t$req = array();\n\t\t$req[0] = array('key' => 'Stu_ID', 'Stu_ID' => $_POST['Account'], 'table' => 'studentcourseItem');\n\t\t$req[1] = array('key' => 'Course_year_term', 'Course_year_term' => $_POST['Course_year_term'], 'table' => 'courseItem');\n\t\t//$arg = array('Course_ID', 'Course', 'Property', 'Credit', 'Classroom', 'Teach_time', 'Total_time');\n\t\t$arg = array('Course_ID', 'Course', 'Classroom', 'Teach_time');\n\t\t$lk = array('Course_ID');\n\t\t$res = $sc->studentcourseLinkCourse($req, $lk, $arg);\n\n\t\treturn $res;\n\t}", "public function courses( $single_course = '0'){\n\t \tif( $single_course == '' || $single_course == '0'){\n\t \t\t$data['page_title'] = \"Courses\";\n\t\t \t\n\t\t \t$page_class = $this->convert_to_slug('Courses');\n\t\t\t$page_class = 'type-page page-'.$page_class ; \n\n\t $page_content = $this->basicModal->check('settingbypage',array('type'=>'pages', 'valueKey' => 'courses' ));\n\t $courseContent = $this->basicModal->get_pagination_data('settingbypage',array('type'=>'course'), -1 );\n\t $data['pageData'] = $page_content;\n\t $data['courseContent'] = $courseContent;\n\n\t if(count($page_content) > 0){\n\t \t \n\t \t$data['page_title'] = $page_content[0]->title;\n\t }\n\t \t$data['header'] = $this->get_header_footer();\n\t\t\t$data['menu_data'] = $this->frontendModal->check('settingbypage',array('type'=>'menu'));\n\t\t\t$data['footermenuData'] = $this->basicModal->check('settingbypage',array('type'=>'footermenu'));\n\t\t\t$data['footersubmenuData'] = $this->basicModal->check('settingbypage',array('type'=>'footersubmenu'));\n\t\t\t$data['page_class'] = $page_class;\n\t \t$this->load->view('component/header', $data);\n\t\t\t$this->load->view('course-list-layout', $data);\n\t\t\t$this->load->view('component/footer',$data);\n\t \t}else{\n\t \t\t$data['page_title'] = \"Course Detail\";\n\t\t \t$page_class = $this->convert_to_slug('Course Detail');\n\t\t\t$page_class = 'type-single-course-page page-'.$page_class ; \n\t $page_content = $this->basicModal->check('settingbypage',array('type'=>'course', 'valueKey' => trim( $single_course ) ));\n\t \n\t $data['pageData'] = $page_content;\n\t if(count($page_content) > 0){\n\t \t \n\t \t$data['page_title'] = $page_content[0]->title;\n\t }\n\t \t$data['header'] = $this->get_header_footer();\n\t\t\t$data['menu_data'] = $this->frontendModal->check('settingbypage',array('type'=>'menu'));\n\t\t\t$data['footermenuData'] = $this->basicModal->check('settingbypage',array('type'=>'footermenu'));\n\t\t\t$data['footersubmenuData'] = $this->basicModal->check('settingbypage',array('type'=>'footersubmenu'));\n\t\t\t$data['page_class'] = $page_class;\n\t \t$this->load->view('component/header', $data);\n\t\t\t$this->load->view('course-single-layout', $data);\n\t\t\t$this->load->view('component/footer',$data);\n\t \t}\n\n\t\t\n\t}", "function execute_course_detail()\n{\t\n\tinclude_once(\"view/course_detail.php\");\n\t$data = array();\n\t$data[\"courses\"] = course_get_detail($courseid);\n\tview($data);\n}", "public function index()\n\t\t{\n\t\t\t$data['breadcrumb1'] = 'Website managements';\n\t\t\t$data['pageHeader'] = $data['breadcrumb2'] = 'Manage course';\n\t\t\t$data['title'] = 'plus-ed.com | Manage course';\n\t\t\t$this->ltelayout->view('frontweb/course_list' , $data);\n\t\t}", "function get_courses(){\n\t\t$data ['rows'] = $this->course_model->get_all();\n\t\t/*show the arrow from database*/\n\t\t//print_r($data);\n\t\tprint json_encode($data);\n\t}", "public function course_overview($courses, $overviews) {\n $html = '';\n $config = get_config('block_course_overview');\n\n $html .= html_writer::start_tag('div', array('id' => 'course_list'));\n $courseordernumber = 0;\n $maxcourses = count($courses);\n // Intialize string/icon etc if user is editing.\n $url = null;\n $moveicon = null;\n $moveup[] = null;\n $movedown[] = null;\n\t\t\n\t\t/* user can't edit */\n\n foreach ($courses as $key => $course) {\n\t\t\t\t\t\n $html .= html_writer::start_tag('div', array('class' => 'coursebox', 'id'=> \"course-{$course->id}\", 'data-role'=> 'controlgroup'));\n\t\t\t\n\t\t\t\n // $html .= html_writer::start_tag('div', array('class' => 'course_title'));\n\t\t\t\n\t\t/* removed ability to shift courses */\n\n\t\t\n\t\t$attributes = array('title' => s($course->fullname), 'data-role' => 'button', 'data-theme' => 'b', 'data-icon'=>'arrow-r', 'data-iconpos'=>'right');\n if ($course->id > 0) {\n $link = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), format_string($course->shortname, true, $course->id), $attributes); //becomes a button\n $html .= $link;\n } else {\n $html .= $this->output->heading(html_writer::link(\n new moodle_url('/auth/mnet/jump.php', array('hostid' => $course->hostid, 'wantsurl' => '/course/view.php?id='.$course->remoteid)),\n format_string($course->shortname, true), $attributes) . ' (' . format_string($course->hostname) . ')', 2, 'title');\n }\n // $html .= html_writer::end_tag('div');\n\n if (!empty($config->showchildren) && ($course->id > 0)) {\n // List children here.\n if ($children = block_course_overview_get_child_shortnames($course->id)) {\n $html .= html_writer::tag('span', $children, array('class' => 'coursechildren'));\n }\n }\n\n if (isset($overviews[$course->id])) {\n $html .= $this->activity_display($course->id, $overviews[$course->id]);\n }\n\n $html .= html_writer::end_tag('div');\n $courseordernumber++;\n }\n $html .= html_writer::end_tag('div');\n\n return $html;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a slave connection CDbConnection for read operation.
public function getSlave() { if (!isset($this->_slave)) { shuffle($this->slaves); foreach ($this->slaves as $slaveConfig) { if (!isset($slaveConfig['class'])) $slaveConfig['class']='CDbConnection'; try { if ($slave=Yii::createComponent($slaveConfig)) { Yii::app()->setComponent('dbslave',$slave); $this->_slave=$slave; break; } } catch (Exception $e) { Yii::log('Create slave database connection failed!','warn'); continue; } } if (!$this->_slave) { $this->_slave=$this; $this->_slave->enableSlave=false; } } return $this->_slave; }
[ "public function getReadConnection()\n\t{\n\t\tif (count($this->_slaves) === 0) {\n\t\t\t// If no slaves then get a master connection\n\t\t\t$read = $this->getWriteConnection();\n\t\t}\n\t\telse {\n\t\t\t// Select slave\n\t\t\t$read = $this->_slaves->selectNode();\n\t\t\tif ($read) $read->connect();\n\t\t}\n\t\t\n\t\treturn $read;\n\t}", "protected function getMasterConnection()\n {\n $db_config = $this->containers['config']->get('mysql');\n $master_db_config = $db_config['master'];\n $this->_master_db = isset($master_db_config['dbname']) ? $master_db_config['dbname'] : '';\n $this->_master_host = isset($master_db_config['host']) ? $master_db_config['host'] : '';\n $this->_master_username = isset($master_db_config['username']) ? $master_db_config['username'] : '';\n $this->_master_password = isset($master_db_config['password']) ? $master_db_config['password'] : '';\n $this->_master_options = isset($master_db_config['options']) ? $master_db_config['options'] : [];\n $this->getDsn(self::CONN_TYPE_MASTER);\n $this->getConnection(self::CONN_TYPE_MASTER);\n }", "private function connectSlave() {\n if(!$this->db_slave) {\n try {\n $options = array(PDO::ATTR_PERSISTENT, MYSQL_PERSISTENT);\n if(MYSQL_DSN_MASTER == MYSQL_DSN_SLAVE) {\n if(!$this->db_master) {\n $this->db_master = new PDO(MYSQL_DSN_MASTER, MYSQL_USER_MASTER, MYSQL_PASS_MASTER, $options);\n }\n $this->db_slave = $this->db_master;\n } else {\n $this->db_slave = new PDO(MYSQL_DSN_SLAVE, MYSQL_USER_SLAVE, MYSQL_PASS_SLAVE, $options);\n }\n } catch(PDOException $e) {\n TCClick::error($e->getMessage() . \"\\n\" . $e->getTraceAsString());\n echo \"Connect database failed, please contact your administrator for more information.\";\n exit;\n }\n }\n }", "function slave()\n {\n if(!$this->isValidResource($this->resources['slave'])) {\n return $this->connect('slave');\n }\n\n return $this->resources['slave'];\n }", "public function __construct()\n {\n /**\n * Initializing Read and Write connections\n */\n $this->_masterConnectionId = PHP2_Database_ConnectionsPool::getInstance()->getConnection(null, PHP2_Database_ConnectionsPool::CONNECTION_TYPE_WRITE);\n $this->_slaveConnectionId = PHP2_Database_ConnectionsPool::getInstance()->getConnection(null, PHP2_Database_ConnectionsPool::CONNECTION_TYPE_READ, true);\n }", "public function getSlavePdo();", "public static function getReadConnection() {\n return Manager::getConnection(self::getDbConnectName(), self::getReadMode());\n }", "public function connectSlave($options = array())\n {\n\n $defaults = array('mode'=>'random');\n\n $options = array_merge($defaults, $options);\n\n if (!empty($this->db_config[\"slave_database_name\"])) {\n\n // connect slave\n switch ($options['mode']) {\n case 'random':\n $slave_db_choose\n = $this->db_config[\"slave_database_name\"][array_rand($this->db_config[\"slave_database_name\"])];\n break;\n default:\n $slave_db_choose\n = $options['mode'];\n break;\n }\n\n\n $s_db_host = $this->db_config['database_server'][$slave_db_choose]['db_host'];\n $s_db_name = $this->db_config['database_server'][$slave_db_choose]['db_name'];\n $s_db_user = $this->db_config['database_server'][$slave_db_choose]['db_user'];\n $s_db_password = $this->db_config['database_server'][$slave_db_choose]['db_password'];\n\n try {\n\n $this->db_connection_poll[$slave_db_choose]\n = new PDO(\n 'mysql:host=' . $s_db_host . ';dbname=' . $s_db_name,\n $s_db_user,\n $s_db_password\n );\n\n $this->db_name_poll[$slave_db_choose] = $s_db_name;\n $this->db_connection_poll[$slave_db_choose]->query(\"SET time_zone='+8:00'\");\n $this->db_connection_poll[$slave_db_choose]->query(\"SET NAMES UTF8\");\n\n // switch to slave\n $this->current_mode = $slave_db_choose;\n $this->db_name = $this->db_name_poll[$slave_db_choose];\n $this->db_connection = $this->db_connection_poll[$slave_db_choose];\n\n } catch (PDOException $e) {\n\n // @codeCoverageIgnoreStart\n throw new RuntimeException();\n // @codeCoverageIgnoreEnd\n\n }\n\n } else {\n\n $this->connectMaster();\n\n }\n\n }", "public function getReadPdo()\r\n {\r\n if ($this->transactions >= 1) {\r\n return $this->getPdo();\r\n }\r\n if ($this->readPdo instanceof PDO) {\r\n return $this->readPdo;\r\n }\r\n if (!is_array($this->slaves) || count($this->slaves) == 0) {\r\n return $this->getPdo();\r\n }\r\n\r\n $slaveDbConfig = $this->slaves;\r\n shuffle($slaveDbConfig);\r\n do {\r\n $config = array_shift($slaveDbConfig);\r\n $config = array_replace_recursive($this->config, $config);\r\n try {\r\n $this->readPdo = $this->makePdo($config);\r\n return $this->readPdo;\r\n } catch (PDOException $e) {\r\n //pass\r\n //echo $e->getMessage();\r\n }\r\n } while (count($slaveDbConfig) > 0);\r\n\r\n return $this->readPdo = $this->getPdo();\r\n }", "function __construct($host, $user, $password, $dbname, $readreplicas = array()) {\n $replica = array_rand($readreplicas, 1);\n $this->readreplica = new mysqli($readreplicas[$replica], $user, $password, $dbname);\n \n // regular db\n return parent::__construct($host, $user, $password, $dbname);\n }", "protected function multi_connect($master = false) {\n\t\tstatic $_config = array();\n\t\tif(empty($_config)) {\n\t\t\t/* cache distributed database configuration parsing */\n\t\t\tforeach($this->dbCfg as $key => $val) {\n\t\t\t\t$_config[$key] = explode(',', $val);\n\t\t\t}\n\t\t}\n\t\tif(C('DB.RW_SEPARATE')) { // whether master-slave database is separate read and write\n\t\t\tif($master) {\n\t\t\t\t$r = 0; // default master server\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$r = floor(mt_rand(1, count($_config['hostname']) - 1)); // random connection read operations database\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$r = floor(mt_rand(0, count($_config['hostname']) - 1)); // server is not separate read and write\n\t\t}\n\t\t$dbCfg = array(\n\t\t\t'username' => isset($_config['username'][$r]) ? $_config['username'][$r] : $_config['username'][0],\n\t\t\t'password' => isset($_config['password'][$r]) ? $_config['password'][$r] : $_config['password'][0],\n\t\t\t'hostname' => isset($_config['hostname'][$r]) ? $_config['hostname'][$r] : $_config['hostname'][0],\n\t\t\t'hostport' => isset($_config['hostport'][$r]) ? $_config['hostport'][$r] : $_config['hostport'][0],\n\t\t\t'database' => isset($_config['database'][$r]) ? $_config['database'][$r] : $_config['database'][0],\n\t\t\t'params' => isset($_config['params'][$r]) ? $_config['params'][$r] : $_config['params'][0],\n\t\t);\n\t\treturn $this->connect($dbCfg, $r);\n\t}", "public static function getSlaveDb()\n\t{\n\t\treturn self::getDb(ECash_Config::DB_SLAVE_ID);\n\t}", "private function connectMaster() {\n if(!$this->db_master) {\n $options = array(PDO::ATTR_PERSISTENT, MYSQL_PERSISTENT);\n $this->db_master = new PDO(MYSQL_DSN_MASTER, MYSQL_USER_MASTER, MYSQL_PASS_MASTER, $options);\n }\n }", "public static function masterRepo()\n {\n $dataSourceManager = static::$dataSourceManager;\n $write = $dataSourceManager->getWriteConnection(static::WRITE_SOURCE_ID);\n $read = $dataSourceManager->getReadConnection(static::READ_SOURCE_ID);\n return static::createRepo($write, $read);\n }", "public function getRead(string $name = ''): ConnectionInterface;", "public function getReadConnectionService();", "public final function getJobDB() : \\JobRouter\\Common\\Database\\ConnectionInterface {}", "private function makeConnection(){\n\n\t\t$conn = new connection;\n\t\t\n\t\treturn $conn->connection();\n\t\t\n\t}", "protected function _master()\n {\n if (null === $this->_master) {\n $this->_master = $this->_connection($this->_config_master);\n }\n return $this->_master;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an inline element such as img. Inline refers to the element not having a closing tag. It does not refer to the created element being displayed inline.
function inline($type, $attrs=array()) { return start_tag($type,$attrs); }
[ "public function createImgTag() {\n\t\t$this->imgNeko = '<img src=\"';\n\t\t$this->imgNeko .= $this->imgUri;\n\t\t$this->imgNeko .= '\" width=\"';\n\t\t$this->imgNeko .= $this->imgSize[0];\n\t\t$this->imgNeko .= '\" height=\"';\n\t\t$this->imgNeko .= $this->imgSize[1];\n\t\t$this->imgNeko .= '\" alt=\"';\n\t\t$this->imgNeko .= $this->creditInfo;\n\t\t$this->imgNeko .= '\">';\n\t}", "protected function _renderInline()\n {\n $this->_content = '';\n\n /* Create a new parser and set its default properties. */\n $this->_parser = xml_parser_create();\n xml_set_object($this->_parser, $this);\n xml_set_element_handler($this->_parser, '_startElement', '_endElement');\n xml_set_character_data_handler($this->_parser, '_defaultHandler');\n xml_parse($this->_parser, $this->_mimepart->getContents(), true);\n xml_parser_free($this->_parser);\n\n return $this->_renderReturn(\n $this->_content,\n 'text/html; charset=UTF-8'\n );\n }", "protected function get_vc_inline_html() {\n\n\t\t\treturn $this->vc_inline_dummy( array(\n\t\t\t\t'class' => 'dt_vc-products_masonry',\n\t\t\t\t'img' => array( PRESSCORE_SHORTCODES_URI . '/images/vc_product_masonry_editor_ico.gif', 98, 104 ),\n\t\t\t\t'title' => _x( 'Products Masonry & Grid', 'vc inline dummy', 'the7mk2' ),\n\n\t\t\t\t'style' => array( 'height' => 'auto' )\n\t\t\t) );\n\t\t}", "public function isInline()\n {\n $this->display_mode = 'i';\n return $this;\n }", "public function isInline()\n {\n $this->display_mode = 'i';\n\n return $this;\n }", "protected function _renderInline()\n {\n return $this->_IMPrender(true);\n }", "public function html(): string {\n\t\treturn \"<input type=\\\"image\\\"\" . $this->emitAttributes() . \" />\";\n\t}", "function create_img($attributes){\n\n\treturn '<img src=\"'.$attributes['src'].'\" alt=\"'.$attributes['alt'].'\">';\n}", "public function renderInlineStyle();", "function testInlineTrue(){\n\t\t#mdx:inline\n\t\t$button = new HtButton(\"action\");\n\t\t$button->inline(true);\n\t\t#/mdx echo $button\n\t\t$this->expectOutputRegex('/button.*style.*inline-block/');\n\t\techo $button;\n\t}", "function add_inline($code, $js_or_css)\n\t{\n\t\t$this->_process_item($code, 'inline_'.$js_or_css);\n\t}", "public function setInline($inline)\n {\n $this->inline = $inline;\n return $this;\n }", "public function appendInlineBlockBox($childDomElement, $element, $style, $parentBlock);", "public function isInline()\n {\n return $this->type === self::TYPE_INLINE;\n }", "public function getLegacyTag() {\n\t\t$html = '<img class=\"ccm-output-thumbnail\" alt=\"' . $this->getAlt() . '\" src=\"' . $this->getSrc() . '\"';\n\t\tif (!$this->isResponsive() && $width = $this->getWidth()) {\n\t\t\t$html .= ' width=\"' . $width . '\"';\n\t\t}\n\t\tif (!$this->isResponsive() && $height = $this->getHeight()) {\n\t\t\t$html .= ' height=\"' . $height . '\"';\n\t\t}\n\t\t$html .= '/>';\n\t\treturn $html;\n\t}", "protected function split_inline() {\r\n\t\t// it is worth considering whether to split attributes from blocks also.\r\n\t\t// since inline tags are always in a block it may be unnecessary... because we do not need to worry about combining blocks.\r\n\t\t$array_replacesI = array();\r\n\t\t$entity = DTD::getInline();\r\n\t\t$entity = str_replace('img|', '', $entity); // exclude images...\r\n\t\t$entity = str_replace('br|', '', $entity); // exclude line breaks...\r\n\t\t//print('$entity: ');var_dump($entity);\r\n\t\t$arrayNonDTDInline = array('u', 'b', 'i', 'strike', 'blink');\r\n\t\t$entity .= \"|\" . implode(\"|\", $arrayNonDTDInline);\r\n\t\tpreg_match_all('/<(' . $entity . ')[\\s>]/is', $this->code, $inlineMatches, PREG_OFFSET_CAPTURE);\r\n\t\tforeach($inlineMatches[0] as $index => $value) {\r\n\t\t\t$tagName = $inlineMatches[1][$index][0];\r\n\t\t\t$offset = $value[1];\r\n\t\t\t$attributes_string = substr($this->code, $offset+strlen($tagName)+1, strpos($this->code, \">\", $offset)-($offset+strlen($tagName)+1));\r\n\t\t\t$opening_string = '<' . $tagName;\r\n\t\t\t$opening_string_with_attributes = '<' . $tagName . $attributes_string . '>';\r\n\t\t\t$closing_string = '</' . $tagName . '>';\r\n\t\t\t$objectString = OM::getOString($this->code, $opening_string, $closing_string, $offset);\r\n\t\t\tif($objectString === false) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tforeach($array_replacesI as $index => $value) {\r\n\t\t\t\tif($value[0] === $objectString) {\r\n\t\t\t\t\tcontinue 2;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpreg_match_all('/ [\\w:]+=\"[^\"]*\"/is', $attributes_string, $attribute_matches);\r\n\t\t\tif($tagName === \"span\") {\r\n\t\t\t\t$new_opening = '';\r\n\t\t\t\t$new_closing = '';\r\n\t\t\t\tforeach($attribute_matches[0] as $index2 => $value2) {\r\n\t\t\t\t\tif(strpos($value2, ' style=\"') === 0) { // in addition to splitting attributes, split the styles in this attribute\r\n\t\t\t\t\t\t$styles_string = substr($value2, 8, strlen($value2)-9);\r\n\t\t\t\t\t\t$styles_array = OM::explode_non_nested(\";\", $styles_string, \"{\", \"}\");\r\n\t\t\t\t\t\tforeach($styles_array as $style) {\r\n\t\t\t\t\t\t\tif(strlen($style) > 0) { // for the possible last ; in a style attribute.\r\n\t\t\t\t\t\t\t\t$new_opening .= '<span style=\"' . ReTidy::cleanStyle($style) . '\">';\r\n\t\t\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t\t} elseif(strpos($value2, ' class=\"') === 0) { // in addition to splitting attributes, split the classes in this attribute\r\n\t\t\t\t\t\t$classes_string = trim(substr($value2, 8, strlen($value2)-9));\r\n\t\t\t\t\t\t$classes_array = explode(\" \", $classes_string);\r\n\t\t\t\t\t\tforeach($classes_array as $class) {\r\n\t\t\t\t\t\t\t$new_opening .= '<span class=\"' . $class . '\">';\r\n\t\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$new_opening .= '<span' . $value2 . '>';\r\n\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t// exclude <a> tags? except for styling. consider whether this is appropriate for all tags (because this function \r\n\t\t\t// may only be used in preparation for combine_inline.\r\n\t\t\telseif($tagName === \"a\") {\r\n\t\t\t\t$kept_attributes_string = \"\";\r\n\t\t\t\t$found_styling = false;\r\n\t\t\t\t$new_opening = '';\r\n\t\t\t\t$new_closing = '';\r\n\t\t\t\tforeach($attribute_matches[0] as $index2 => $value2) {\r\n\t\t\t\t\tif(strpos($value2, ' style=\"') === 0) { // in addition to splitting attributes, split the styles in this attribute\r\n\t\t\t\t\t\t$found_styling = true;\r\n\t\t\t\t\t\t$styles_string = substr($value2, 8, strlen($value2)-9);\r\n\t\t\t\t\t\t$styles_array = OM::explode_non_nested(\";\", $styles_string, \"{\", \"}\");\r\n\t\t\t\t\t\tforeach($styles_array as $style) {\r\n\t\t\t\t\t\t\tif(strlen($style) > 0) { // for the possible last ; in a style attribute.\r\n\t\t\t\t\t\t\t\t$new_opening .= '<span style=\"' . ReTidy::cleanStyle($style) . '\">';\r\n\t\t\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t\t} elseif(strpos($value2, ' class=\"') === 0) { // in addition to splitting attributes, split the classes in this attribute\r\n\t\t\t\t\t\t$found_styling = true;\r\n\t\t\t\t\t\t$classes_string = trim(substr($value2, 8, strlen($value2)-9));\r\n\t\t\t\t\t\t$classes_array = explode(\" \", $classes_string);\r\n\t\t\t\t\t\tforeach($classes_array as $class) {\r\n\t\t\t\t\t\t\t$new_opening .= '<span class=\"' . $class . '\">';\r\n\t\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$kept_attributes_string .= $value2;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(!$found_styling) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$new_opening = '<' . $tagName . $kept_attributes_string . '>' . $new_opening;\r\n\t\t\t\t\t$new_closing = $new_closing . '</' . $tagName . '>';\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t$new_opening = '<' . $tagName . '>';\r\n\t\t\t\t$new_closing = '</' . $tagName . '>';\r\n\t\t\t\tforeach($attribute_matches[0] as $index2 => $value2) {\r\n\t\t\t\t\tif(strpos($value2, ' style=\"') === 0) { // in addition to splitting attributes, split the styles in this attribute\r\n\t\t\t\t\t\t$styles_string = substr($value2, 8, strlen($value2)-9);\r\n\t\t\t\t\t\t$styles_array = OM::explode_non_nested(\";\", $styles_string, \"{\", \"}\");\r\n\t\t\t\t\t\tforeach($styles_array as $style) {\r\n\t\t\t\t\t\t\tif(strlen($style) > 0) { // for the possible last ; in a style attribute.\r\n\t\t\t\t\t\t\t\t$new_opening .= '<span style=\"' . $style . '\">';\r\n\t\t\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t\t} elseif(strpos($value2, ' class=\"') === 0) { // in addition to splitting attributes, split the classes in this attribute\r\n\t\t\t\t\t\t$classes_string = trim(substr($value2, 8, strlen($value2)-9));\r\n\t\t\t\t\t\t$classes_array = explode(\" \", $classes_string);\r\n\t\t\t\t\t\tforeach($classes_array as $class) {\r\n\t\t\t\t\t\t\t$new_opening .= '<span class=\"' . $class . '\">';\r\n\t\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$new_opening .= '<span' . $value2 . '>';\r\n\t\t\t\t\t\t$new_closing = '</span>' . $new_closing;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t$replace_string = $new_opening . substr($objectString, strlen($opening_string_with_attributes), strlen($objectString)-strlen($opening_string_with_attributes)-strlen($closing_string)) . $new_closing;\r\n\t\t\t$array_replacesI[] = array($objectString, $replace_string);\r\n\t\t}\r\n\t\tusort($array_replacesI, \"sortByLengthOfFirst\");\r\n\t\t//print('$array_replacesI: ');var_dump($array_replacesI);\r\n\t\tforeach($array_replacesI as $index => $value) {\r\n\t\t\t$search = $value[0];\r\n\t\t\t$replace = $value[1];\r\n\t\t\t$this->code = str_replace($search, $replace, $this->code);\r\n\t\t}\r\n\t}", "public function addContent(InlineGeneratorInterface $content);", "function _addHtmlImagePart(&$obj, $value) {\n $params['content_type'] = $value['c_type'];\n $params['encoding'] = 'base64';\n $params['disposition'] = 'inline';\n $params['dfilename'] = $value['name'];\n $params['cid'] = $value['cid'];\n $obj->addSubpart($value['body'], $params);\n }", "function create_html_element($tag, $attr=array(), $content=null, $self_close=True){\n\t$attr_str = create_attribute_string($attr);\n\tif ($content){\n\t\t$element = \"<{$tag}{$attr_str}>{$content}</{$tag}>\";\n\t}else{\n\t\tif ($self_close){\n\t\t\t$element = \"<{$tag}{$attr_str}/>\";\n\t\t}else{\n\t\t\t$element = \"<{$tag}{$attr_str}></{$tag}>\";\n\t\t}\n\t}\n\n\treturn $element;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method takes two arrays with rates as arguments. $firstRates: rates from earliest date. $secondRates: rates from input date Method returns an array with rate variation of two arrays
public function getRateVariaton($firstRates, $secondRates) { $rateVariation = array(); foreach ($firstRates as $key => $val) { $rateVariation[$key] = round((($secondRates->$key / $val) - 1) * 100, 2); } arsort($rateVariation); return $rateVariation; }
[ "public function getRateVariaton($firstRates, $secondRates) {\n $rateVariation = array();\n\n foreach ($firstRates as $key => $val) {\n $rateVariation[$key] = round((($secondRates->$key / $val) - 1) * 100, 2);\n }\n arsort($rateVariation);\n\n return $rateVariation;\n }", "public function getRates();", "private function importParameterFromArray($rates) {\n if (sizeof($rates) < 1) {\n $rate = 0;\n } else if (sizeof($rates) == 1) {\n $rate = current($rates);\n } else {\n $now = new \\DateTime();\n $year = $now->format('Y');\n if (isset($rates[$year])) {\n $rate = $rates[$year];\n } else if ($year < current(array_keys($rates))) {\n $rate = current($rates);\n } else {\n $rate = end($rates);\n }\n }\n return $rate;\n }", "public static function getTickerAverage($first_currency = 'BTC', $second_currency = 'USD');", "public function getRates($baseCurrency, \\DateTime $date);", "public function testRates2()\n {\n $response = $this->postJson('/api/rates', [\n 'date' => '2011-04-15',\n 'codes' => ['USD', 'EUR']\n ]);\n\n $response\n ->assertStatus(200)\n ->assertExactJson([\n 'rates' => [\n 'EUR' => '40,8791',\n 'USD' => '28,1886'\n ]\n ]);\n }", "function rate_sort_func ($a, $b) {\n\n $av = array_values($a);\n $av = $av[0];\n $bv = array_values($b);\n $bv = $bv[0];\n\n // return ($av == $bv) ? 0 : (($av < $bv) ? 1 : -1); // for having the high rates first\n return ($av == $bv) ? 0 : (($av > $bv) ? 1 : -1); // low rates first\n }", "public function getDiscountRates();", "public function getRates($currencies, \\DateTime $date = null);", "function it_finds_a_daily_rate_price_from_date_range_rate()\n {\n $dailyPrice = Price::fromString('10', Currency::fromString('EUR'));\n $equipment = new Equipment('Jack Hammer', new Rate(null, $dailyPrice, 1));\n\n $rentalQuery = new RentalQuery(\n $equipment,\n RentalPeriod::fromDateTime(new \\DateTime('2014-07-01'), new \\DateTime('2014-07-07'), 1)\n );\n\n $quotes = $this->getQuotesFor($rentalQuery);\n $quote = $quotes[0];\n\n /** @var RateQuote $quote */\n $quote->getLineItems()->shouldHaveCount(1);\n $lineItems = $quote->getLineItems();\n /** @var RateQuoteLineItem $lineItem */\n $lineItem = $lineItems[0];\n $lineItem->getRate()->getPrice()->equals($dailyPrice);\n\n //////////\n $tempPrice = Price::fromString('8', Currency::fromString('EUR'));\n $equipment->addRate(\n RentalPeriod::fromDateTime(new \\DateTime('2014-07-04'), new \\DateTime('2014-07-10')),\n $tempPrice,\n 1\n );\n\n $quotes = $this->getQuotesFor($rentalQuery);\n $quote = $quotes[0];\n\n /** @var RateQuote $quote */\n $quote->getLineItems()->shouldHaveCount(1);\n $lineItems = $quote->getLineItems();\n /** @var RateQuoteLineItem $lineItem */\n $lineItem = $lineItems[0];\n $lineItem->getRate()->getPrice()->equals($tempPrice);\n\n }", "public function fetchRates();", "function getNumRates($con, $code, $startDate)\n{\n\t$array[] = array();\n\t$sql = \"SELECT * FROM rates WHERE rate_code='\".$code.\"' AND rate_time >='\" .date(\"Y-m-d H:i:s\", $startDate). \"' ORDER BY rate_time DESC\";\n\t$result = mysqli_query($con, $sql);\n\t$count = 0;\n\t\n\twhile($row = mysqli_fetch_row($result)) {\n\t\t$array[$count]=array($row[0], $row[1], $row[2], $row[3], $row[4], $row[5]);\n\t\t$count++;\n\t}\n\tmysqli_free_result($result);\n\t\n\treturn $array;\n}", "protected function Rates() {\n\tif (empty($this->arRates)) {\n\t $tblR = $this->Engine()->Rates();\n\t $rc = $tblR->GetData();\n\t while ($rc->NextRow()) {\n\t\t$idRate = $rc->Value('ID');\n\t\t$this->arRates[$idRate] = $rc->Values();\n\t }\n\t}\n\treturn $this->arRates;\n }", "public function getRates($params);", "function calculate_rates_estimation($rates, $delivery_window) {\n // Filter rates by delivery window\n $eligible_rates = array_values(array_filter(\n $rates,\n function($rate) use($delivery_window){\n return $rate['days'] <= $delivery_window;\n }\n ));\n\n // Calculate estimations on the eligible_rates\n $min = $eligible_rates[0]['amount'];\n $max = 0.0;\n $sum = 0.0;\n foreach ($eligible_rates as $rate) {\n $amount = $rate['amount'];\n\n $min = min($min, $amount);\n $max = max($max, $amount);\n $sum += $amount;\n }\n\n return array(\n 'delivery_window' => $delivery_window,\n 'min' => $min,\n 'max' => $max,\n 'average' => $sum / count($eligible_rates),\n );\n}", "function calculate_rates_estimation($rates, $delivery_window)\n {\n $eligible_rates = array_values(array_filter(\n $rates,\n function($rate) use($delivery_window){\n return $rate['days'] <= $delivery_window;\n }\n ));\n // Calculate estimations on the eligible_rates\n $min = $eligible_rates[0]['amount'];\n $max = 0.0;\n $sum = 0.0;\n foreach ($eligible_rates as $rate) {\n $amount = $rate['amount'];\n $min = min($min, $amount);\n $max = max($max, $amount);\n $sum += $amount;\n }\n return array(\n 'delivery_window' => $delivery_window,\n 'min' => $min,\n 'max' => $max,\n 'average' => $sum / count($eligible_rates),\n 'currency' => $eligible_rates[0]['currency'],\n 'estimated_days'=>$eligible_rates[0]['estimated_days'],\n 'service_provider'=>$eligible_rates[0]['provider'],\n );\n }", "public function getRatesByDate(Request $request)\n {\n $input = $request->all();\n $date = $input['date'];\n\n $this->soapWrapper->add('Currency', function ($service) {\n $service\n ->wsdl('http://api.cba.am/exchangerates.asmx?WSDL')\n ->trace(true)\n ->cache(WSDL_CACHE_NONE)// Optional: Set the WSDL cache\n ->options([\n 'user_agent' => 'PHPSoapClient', // Add this as options\n ])\n ->classmap([\n ExchangeRatesByDate::class,\n ExchangeRatesByDateResponse::class,\n ]);\n });\n\n\n // With classmap\n $response = $this->soapWrapper->call('Currency.ExchangeRatesByDate', [\n new ExchangeRatesByDate($date)\n ]);\n $exchangeRates = $response->ExchangeRatesByDateResult->Rates->ExchangeRate;\n $ISO_array = [];\n $rate_array = [];\n foreach ($exchangeRates as $exchangeRate) {\n $ISO_array[] .= $exchangeRate->ISO;\n $rate_array[] .= $exchangeRate->Rate;\n }\n dd($exchangeRates);\n return redirect()->back();\n\n\n }", "private static function sort_rates($rates)\n {\n }", "function get_mortality_rates(&$rates)\n\t{\n\t//The mortality rates are in the form of a table of male and female rates sorted by age\n\t//The PA90-1 tables were used\n\n\t\t$place=0;\n\t\t$sql = \"SELECT * FROM mortality_rates\";\n\t\t$result = mysql_query($sql);\n\t\twhile ($row = mysql_fetch_assoc($result)) \n\t\t{\n\t\t\t$rates[$place][1] = $row['age'];\n\t\t\t$rates[$place][2] = $row['mortality_male'];\n\t\t\t$rates[$place][3] = $row['mortality_female'];\n\t\t\t$place++;\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Migrate a user account from the old style of personal file storage to the new, SSObased, approach.
function migrate_user($userorusername, $password = '') { global $CFG; if (ALFRESCO_DEBUG_TRACE) mtrace('migrate_user(' . (is_object($userorusername) ? 'object' : $userorusername) . ')'); if (is_string($userorusername)) { if (!$user = get_record('user', 'username', $userorusername, 'mnethostid', $CFG->mnet_localhost_id)) { return false; } } else if (is_object($userorusername)) { $user = $userorusername; } else { return false; } // Create the user's Alfresco account (if one does not already exist). if (!alfresco_create_user($user, $password)) { return false; } // Fix username $username = $this->fix_username($user->username); // If the user has an old-style user directory, migrate it's contents and delete the directory. if ($this->has_old_user_store($user->id)) { $uuid = $this->get_user_store($user->id, true); if (($touuid = alfresco_get_home_directory($username)) === false) { debugging(get_string('couldnotgetalfrescouserdirectory', 'repository_alfresco', $username)); return false; } $dir = $this->read_dir($uuid, true); if (!empty($dir->folders)) { foreach ($dir->folders as $folder) { if (!alfresco_move_node($folder->uuid, $touuid)) { debugging(get_string('couldnotmovenode', 'repository_alfresco')); return false; } } } if (!empty($dir->files)) { foreach ($dir->files as $file) { if (!alfresco_move_node($file->uuid, $touuid)) { debugging(get_string('couldnotmovenode', 'repository_alfresco')); return false; } } } // Redmove the old-style user storage directory. if (!alfresco_delete($uuid, true)) { debugging(get_string('couldnotdeletefile', 'repository_alfresco', $user->id)); return false; } } return true; }
[ "private function _migrate_accounts()\n {\n $this->_output->writeln(\"\\n<info>Migrating user accounts</info>\");\n if (empty($GLOBALS['midcom_config_local'])) {\n $GLOBALS['midcom_config_local'] = [];\n }\n $GLOBALS['midcom_config_local']['person_class'] = 'openpsa_person';\n $GLOBALS['midcom_config_local']['auth_type'] = $this->_input->getOption('authtype');\n if (!defined('OPENPSA2_PREFIX')) {\n define('OPENPSA2_PREFIX', '/');\n }\n $defaults = [\n 'SERVER_PORT' => '80',\n 'SERVER_NAME' => 'localhost',\n 'HTTP_HOST' => 'localhost',\n 'REQUEST_URI' => '/midgard2-convert'\n ];\n $_SERVER = array_merge($defaults, $_SERVER);\n\n \\midcom::init();\n\n $qb = new \\midgard_query_builder(\\midcom::get()->config->get('person_class'));\n $qb->add_constraint('username', '<>', '');\n $results = $qb->execute();\n\n foreach ($results as $person) {\n if (!$this->_migrate_account($person)) {\n $this->_output->writeln(' <error>Account for <info>' . $person->firstname . ' ' . $person->lastname . \"</info> couldn't be migrated!</error>\");\n }\n }\n $this->_output->writeln(\" Done.\");\n }", "public function switchUser() {\n global $user;\n\n if (!restful_is_user_switched() && !$this->getOriginalUserSession()) {\n // This is the first time a user switched, and there isn't an original\n // user session.\n\n $session = drupal_save_session();\n $this->setOriginalUserSession(array(\n 'user' => $user,\n 'session' => $session,\n ));\n\n // Don't allow a session to be saved. Provider that require a session to\n // be saved, like the cookie provider, need to explicitly set\n // drupal_save_session(TRUE).\n // @see \\RestfulUserLoginCookie::loginUser().\n drupal_save_session(FALSE);\n }\n\n $account = $this->getAccount();\n // Set the global user.\n $user = $account;\n\n }", "private function preferenciassUser() {\r\n }", "public function switchToAccount() {\n\t\t\t$auvo = null;\n\t\t\t$switched = false;\n\t\t\t$actual = Yii::app()->user->authenticatedUser;\n\n\t\t\tCRSAuthenticationService_service::isUserSwitched($switched, $this->errorMessage, $actual);\n\t\t\tif ($switched) {\n\t\t\t\tCRSAuthenticationService_service::unswitch($actual, $this->errorMessage, $actual);\n\t\t\t\tif(count($this->errorMessage) != 0) {\n\t\t\t\t\tYii::log('UN SWITCH ERROR= '.print_r($this->errorMessage,true));\n\t\t\t\t\t// return false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tYii::log('name= ' .print_r($this->getName(), true));\n\t\t\tCRSAuthenticationService_service::switchUser($auvo, $this->errorMessage, $actual, $this->getName());\n\t\t\tif(count($this->errorMessage) != 0) {\n\t\t\t\tYii::log('SWITCH ERROR= '.print_r($this->errorMessage,true));\n\t\t\t\t// return false;\n\t\t\t}\n\n\t\t\t$this->clearUserData();\n\t\t\t$this->setUserData($auvo);\n\t\t\t$this->setState(ACTUAL_INTERNAL_USER,$actual);\n\t\t\tYii::log('SWITCH USER= '.print_r($auvo->username, true));\n\t\t\treturn true;\n\t\t}", "public function migratePreviousVersion()\n\t{\n\t\t$oldSamAccountNameProperty = 'adi_samaccountname';\n\t\t$newSamAccountNameProperty = NEXT_AD_INT_PREFIX . NextADInt_Adi_User_Persistence_Repository::META_KEY_ACTIVE_DIRECTORY_SAMACCOUNTNAME;\n\t\t$wpUsers = $this->userRepository->findByMetaKey($oldSamAccountNameProperty);\n\n\t\t$migrated = 0;\n\n\t\tforeach ($wpUsers as $wpUser) {\n\t\t\t$userMeta = $this->userRepository->findUserMeta($wpUser->ID);\n\n\t\t\t$hasOldSamAccountName = isset($userMeta[$oldSamAccountNameProperty]) && (sizeof($userMeta[$oldSamAccountNameProperty]) > 0);\n\t\t\t$hasNewSamAccountName = isset($userMeta[$newSamAccountNameProperty]) && (sizeof($userMeta[$newSamAccountNameProperty]) > 0);\n\n\t\t\tif ($hasOldSamAccountName && !$hasNewSamAccountName) {\n\t\t\t\t$sAMAccountName = $userMeta[$oldSamAccountNameProperty][0];\n\n\t\t\t\t$this->userRepository->updateSAMAccountName($wpUser->ID, $sAMAccountName);\n\t\t\t\t$migrated++;\n\t\t\t}\n\t\t}\n\n\t\treturn $migrated;\n\t}", "private function migrateUser( User $user ) {\n\t\tif ( !$user->isRegistered() ) {\n\t\t\tthrow new Exception( 'Cannot migrate anonymous user' );\n\t\t}\n\n\t\t$localId = $user->getId();\n\t\t$remoteName = $this->getRemoteName( $user );\n\n\t\t$this->database->startAtomic( __METHOD__, IDatabase::ATOMIC_CANCELABLE );\n\n\t\ttry {\n\t\t\t// Insert the new mapping\n\t\t\t$this->database->insert( 'wsoauth_multiauth_mappings', [\n\t\t\t\t'wsoauth_user' => $localId,\n\t\t\t\t'wsoauth_remote_name' => $remoteName,\n\t\t\t\t'wsoauth_provider_id' => $this->provider\n\t\t\t] );\n\n\t\t\t// Delete the old mapping and user, so we don't migrate twice\n\t\t\tif ( $this->database->tableExists( 'wsoauth_mappings' ) ) {\n\t\t\t\t$this->database->delete( 'wsoauth_mappings', [ 'wsoauth_user' => $localId ] );\n\t\t\t}\n\n\t\t\t$this->database->delete( 'wsoauth_users', [ 'wsoauth_user' => $localId ] );\n\t\t} catch ( Exception $exception ) {\n\t\t\t$this->output( \"\\n\" );\n\t\t\t$this->output( \"\\t... failure, rolling back most recent migration ...\\n\" );\n\t\t\t$this->database->cancelAtomic( __METHOD__ );\n\n\t\t\tthrow $exception;\n\t\t}\n\n\t\t$this->database->endAtomic( __METHOD__ );\n\t}", "protected function exportReplaceAuthToNewPath($oldPath, $newPath)\n {\n $this->makeDir($newPath);\n\n $getPath = app_path($oldPath.'/User.php');\n $setPath = app_path($newPath .'/User.php');\n copy($getPath, $setPath);\n\n chmod($getPath, 0777);\n unlink($getPath);\n\n @chmod($oldPath, 0777);\n\n @rmdir(app_path($oldPath));\n }", "public function revertUser();", "function wpl_process_login_update_wpl_user_data( $is_new_user, $user_id, $provider, $adapter, $hybridauth_user_profile, $wp_user )\n{\n\t// HOOKABLE:\n\tdo_action( \"wpl_process_login_update_wpl_user_data_start\", $is_new_user, $user_id, $provider, $adapter, $hybridauth_user_profile, $wp_user );\n\n\t// store user hybridauth user profile in table wplusersprofiles\n\t// > wpl will only sotre the user profile if it has changed since last login.\n\twpl_store_hybridauth_user_profile( $user_id, $provider, $hybridauth_user_profile );\n\n\t// map hybridauth user profile to buddypress xprofile table, if enabled\n\t// > Profile mapping will only work with new users. Profile mapping for returning users will implemented in future version of WPL.\n\tif( $is_new_user )\n\t{\n\t\twpl_buddypress_xprofile_mapping( $user_id, $provider, $hybridauth_user_profile );\n\t}\n\n\t// import user contacts into wplusersprofiles, if enabled\n\t// > wpl will only import the contacts list once per user per provider.\n\twpl_store_hybridauth_user_contacts( $user_id, $provider, $adapter );\n}", "function auth_impersonate( $p_user_id ) {\n\tauth_ensure_can_impersonate( $p_user_id );\n\n\tauth_set_cookies( $p_user_id, /* perm_login */ false );\n\tauth_set_tokens( $p_user_id );\n}", "function hook_gdpr_export_user_export($account, $format, $context) {\n // Export a certain profile from the profile2 module. An appropriate profile2\n // normalizer would have to be implemented though.\n // @see GDPRExportEntityNormalizer.\n $profile = profile2_load_by_user($account, 'user_profile');\n $meta = entity_metadata_wrapper('profile2', $profile);\n $data = gdpr_export_serialize_entity($meta, $format);\n file_unmanaged_save_data($data, $context['gdpr_export_dir'] . \"/user_profile.$format\");\n}", "public function testUpdateUserAccount()\n {\n }", "function importZebroidUser($user = '')\n{\n global $sourcedir, $smcFunc;\n if (!$user) return false;\n\n require_once($sourcedir . '/Subs-Members.php');\n require_once($sourcedir . '/Profile-Modify.php');\n\n // Hash and cut user login\n $username = md5($user->name);\n $username = mb_substr($username, 0, 24, 'UTF-8');\n\n // Check for correct email\n if (empty($user->email) || profileValidateEmail($user->email) == 'bad_email') {\n // Generate fake email\n $user->email = $username . '@' . 'mail.local';\n }\n\n // Check if the email or username is in use already.\n $request = $smcFunc['db_query']('', '\n\t\tSELECT id_member\n\t\tFROM {db_prefix}members\n\t\tWHERE email_address = {string:email_address}\n\t\t\tOR member_name = {string:username}\n\t\tLIMIT 1',\n array(\n 'email_address' => (string)$user->email,\n 'username' => convertZebroidUTF8((string)$username),\n )\n );\n\n if ($smcFunc['db_num_rows']($request) != 0) {\n list ($memberID) = $smcFunc['db_fetch_row']($request);\n $smcFunc['db_free_result']($request);\n\n updateMemberData($memberID, array('last_login' => (int)$user->lastact,)); // Update last_login date for this user\n\n return (int)$memberID;\n }\n\n $regOptions = array(\n 'interface' => 'admin',\n 'username' => $username,\n 'email' => $user->email,\n 'password' => '',\n 'check_reserved_name' => false,\n 'check_password_strength' => false,\n 'check_email_ban' => false,\n 'send_welcome_email' => false,\n 'memberGroup' => 0,\n 'require' => 'nothing',\n );\n $regOptions['extra_register_vars'] = array(\n 'real_name' => convertZebroidUTF8(mb_eregi_replace('_', ' ', mb_substr($user->name, 0, 199, 'UTF-8'))),\n 'date_registered' => (int)$user->regdate,\n 'is_activated' => 1,\n 'last_login' => (int)$user->lastact,\n 'total_time_logged_in' => rand(0, 86400),\n 'hide_email' => 1,\n );\n\n $memberID = registerMember($regOptions);\n unset($regOptions);\n\n if (is_int($memberID)) return $memberID; else return false;\n}", "public function convert_existing_username_and_password() {\n $options = get_option( 'clockwork_options' );\n if( !is_array( $options ) || !isset( $options['api_key'] ) ) {\n $existing_details = $this->get_existing_username_and_password();\n \n if( is_array( $existing_details ) && isset( $existing_details['username'] ) && isset( $existing_details['password'] ) ) {\n try {\n // We have a username and password, now go and convert them\n $this->clockwork = new WordPressClockwork( $existing_details['username'], $existing_details['password'] );\n $key = $this->clockwork->createAPIKey( 'WordPress - ' . home_url() );\n // Set the Clockwork API key to be the newly created key\n update_option( 'clockwork_options', array( 'api_key' => $key ) ); \n } catch( ClockworkException $e ) {\n return;\n }\n } \n }\n }", "public static function migrate_old_credentials() {\n try {\n $credentials = get_option('watsonconv_credentials');\n\n if (!isset($credentials['workspace_url']) && isset($credentials['url']) && isset($credentials['id'])) {\n $credentials['workspace_url'] =\n rtrim($credentials['url'], '/').'/workspaces/'.$credentials['id'].'/message/';\n\n unset($credentials['url']);\n update_option('watsonconv_credentials', $credentials);\n }\n\n if (!isset($credentials['auth_header']) && isset($credentials['username']) && isset($credentials['password'])) {\n $credentials['auth_header'] = 'Basic ' . base64_encode(\n $credentials['username'].':'.\n $credentials['password']\n );\n\n update_option('watsonconv_credentials', $credentials);\n }\n\n if (isset($credentials['password']) && !isset($credentials['api_key'])) {\n $credentials['api_key'] = $credentials['password'];\n update_option('watsonconv_credentials', $credentials);\n }\n\n\n if (!isset($credentials['auth_header']) && isset($credentials['username']) && isset($credentials['api_key'])) {\n $credentials['auth_header'] = 'Basic ' . base64_encode(\n $credentials['username'].':'.\n $credentials['api_key']\n );\n\n update_option('watsonconv_credentials', $credentials);\n }\n } catch (\\Exception $e) {}\n }", "public function save()\n {\n \tglobal $_conf, $_CMDEVEL;\n \t$state = $this->state;\n \tparent::save();\n\n \tif($state==self::STATE_NEW || $state==self::STATE_DIRTY_NEW) {\n \t\tinclude($_CMDEVEL['path'].\"/cmvfs.inc.php\");\n\n \t\t$path = (String) $_conf->app->paths->pages;\n \t\tif(empty($path)) {\n \t\t\tThrow new AMException(\"Cannot save user because the pages dir is not correctly configured. Please, verify your config.xml\");\n \t\t}\n \t\t$path .= \"/users/user_\".$this->codeUser;\n\n \t\t//if the this doesn't exists, so we can create it, otherwise generate an exception.\n \t\ttry {\n \t\t\t$dir = new CMvfsLocal($path);\n \t\t\t$this->delete();\n \t\t\tThrow new AMException(\"You are trying to create a user directory that alredy exists.\");\n \t\t} catch(CMvfsFileNotFound $e) {\n \t\t\t$dir = new CMvfsLocal($path,0); //create but not verify if the dir exists\n \t\t\t$dir->register();\n \t\t}\n \t}\n\n }", "private function loginDrupalAccountProvisioning() {\n if (LdapConfiguration::provisionsDrupalAccountsFromLdap()\n && in_array(self::EVENT_SYNC_TO_DRUPAL_USER, array_keys(LdapConfiguration::provisionsDrupalEvents()))) {\n $ldap_user = $this->factory->getUserDataFromServerByAccount($this->account, $this->config->get('drupalAcctProvisionServer'), 'ldap_user_prov_to_drupal');\n if ($ldap_user) {\n $this->server = $this->factory->getServerById($this->config->get('drupalAcctProvisionServer'));\n $this->applyAttributesToAccount($ldap_user, self::PROVISION_TO_DRUPAL, [self::EVENT_SYNC_TO_DRUPAL_USER]);\n }\n $this->saveAccount();\n }\n }", "public function migrateAuthDatabase()\n {\n $this->migrationsRepository = $this->app->make('migration.repository');\n $this->migrationsRepository->createRepository();\n\n $migrator = new StructuredMigrator(\n $this->migrationsRepository,\n $this->app->make('db'),\n new AuthMigrationBatch()\n );\n\n $migrator->run();\n }", "function user_change_field($username, $field, $value){\n $username = basename($username);\n if (!($userdata = load_user_info($username))) return 16;\n $userdata[$field] = $value;\n if(!file_write_contents(USERS_PATH . $username, serialize($userdata))) return 10;\n return 0;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the categories of a game
public function getCategoriesOfGame(int $idGame) { try { $this->psGameCategorie->execute(array(':search_id' => $idGame)); $result = $this->psGameCategorie->fetchAll(); } catch (PDOException $e) { print "Erreur !: " . $e->getMessage() . "<br>"; die(); } return $result; }
[ "function category_games()\n{\n\tglobal $smcFunc;\n\n\t$no = 30;\n\t// Load Category information\n \t$result = $smcFunc['db_query']('', '\n\t\tSELECT\n\t\tc.id_category,\n\t\tcount(g.id_category) AS games,\n\t\tc.category_name,\n\t\tc.category_icon\n\t\tFROM {db_prefix}arcade_games g, {db_prefix}arcade_categories c\n\t\tWHERE g.id_category = c.id_category AND g.enabled = 1\n \t\tGROUP BY g.id_category\n \t\tORDER BY c.category_order\n \t\tLIMIT 0, {int:limit}',\n\t\tarray(\n\t\t'limit' => $no,\n\t\t)\n\t);\n\twhile ($cat = $smcFunc['db_fetch_assoc']($result))\n\t{\n\t\t$cats[$cat['id_category']] = $cat;\n\t}\n\treturn $cats;\n}", "private function getCasinoGameCategories()\n {\n $casino_game_sql =<<<SQL\n SELECT\n casinoid,\n game_flatform_list\n FROM casino_list\n ORDER BY id\n ;\nSQL;\n\n $casino_game_category_result = runSQLall($casino_game_sql);\n $casino_game_categories = [];\n\n foreach($casino_game_category_result as $index => $casino_category) {\n if($index == 0) continue;\n\n $casino_game_categories[strtolower($casino_category->casinoid)] = json_decode($casino_category->game_flatform_list, true);\n }\n\n return $casino_game_categories;\n }", "public function getCategories() {\n\t\t$probableCategories = [];\n\t\tforeach ( $this->features as $feature => $value ) {\n\t\t\tif ( $feature == 'countFace' ) {\n\t\t\t\t$probableCategories[] = 'Category:People';\n\t\t\t} else if ( $feature == 'percentFace' ) {\n\t\t\t\tif ( $value > 60 ) {\n\t\t\t\t\t$probableCategories[] = 'Category:Selfies';\n\t\t\t\t}\n\t\t\t} else if ( $value == 'expression' ) {\n\t\t\t\tswitch ( $feature ) {\n\t\t\t\t\tcase 'joyLikelihood':\n\t\t\t\t\t\t$probableCategories[] = 'Category:Happiness';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'sorrowLikelihood':\n\t\t\t\t\t\t$probableCategories[] = 'Category:Sadness';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'angerLikelihood':\n\t\t\t\t\t\t$probableCategories[] = 'Category:Anger';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'surpriseLikelihood':\n\t\t\t\t\t\t$probableCategories[] = 'Category:Surprise';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'blurredLikelihood':\n\t\t\t\t\t\t$probableCategories[] = 'Category:Blurred images';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'headwearLikelihood':\n\t\t\t\t\t\t$probableCategories[] = 'Category:Headgear';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$probableCategories[] = 'Category:' . $feature;\n\t\t\t}\n\t\t}\n\n\t\t// If we don't get any probable categories, return\n\t\tif ( count( $probableCategories ) <= 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Make API call to commons categoryinfo API\n\t\t$client = new GuzzleHttp\\Client();\n\t\t$response = $client->request(\n\t\t\t'GET',\n\t\t\t'https://commons.wikimedia.org/w/api.php?',\n\t\t\t[ 'query' => [\n\t\t\t\t'action' => 'query',\n\t\t\t\t'prop' => 'categoryinfo',\n\t\t\t\t'titles' => implode( '|', $probableCategories ),\n\t\t\t\t'formatversion' => 2,\n\t\t\t\t'format' => 'json'\n\t\t\t\t]\n\t\t\t]\n\t\t);\n\t\t// Decode the response\n\t\t$result = json_decode( $response->getBody(), true );\n\t\t// Categories found\n\t\t$actualCategories = [];\n\t\t// Find the valid categories\n\t\tforeach ( $result['query']['pages'] as $element ) {\n\t\t\tif ( !array_key_exists( 'missing', $element ) && $element['categoryinfo']['hidden'] != true ) {\n\t\t\t\t$actualCategories[] = $element['title'];\n\t\t\t}\n\t\t}\n\t\t// If we found any likely categories, return those else false\n\t\tif ( count( $actualCategories ) > 0 ) {\n\t\t\treturn $actualCategories;\n\t\t}\n\t\treturn null;\n\t}", "function getCategorias(){\r\n $conector = new Conector();\r\n $banco = new BancoCategoria();\r\n return $banco->getCategorias($conector->getConexao());\r\n }", "function getCategorie()\n\t{\n\t\treturn array(\"Antipasti\",\"Primi Piatti\",\"Teppanyako e Tempure\",\"Uramaki\",\"Nigiri ed Onigiri\",\"Gunkan\",\"Temaki\",\"Hosomaki\",\"Sashimi\",\"Dessert\");\n\t}", "public function getCategories()\n {\n $app = Factory::getApplication('com_attlist');\n\n // Obtain a database connection\n $db = JFactory::getDbo();\n //Retrieve the shout\n $query = $db->getQuery(true)\n ->select(array('id', 'title'))\n ->from($db->quoteName('#__categories'))\n ->where($db->quoteName('extension') . ' = ' . $db->quote('com_attlist.meldungen'))\n ->order('id ASC');\n // Prepare the query\n $db->setQuery($query);\n // Load the categories.\n $category = $db->loadAssocList();\n // Return the Categories\n return $category;\n }", "public function getCategories();", "private function all_game_categories_for_select() {\n $all = GameCategory::all();\n return array_combine(\n array_pluck($all, 'id'),\n array_pluck($all, 'name')\n );\n }", "public function getGamesFromCategorie()\n {\n\n $html = '<div class=\"cardGameBox box\">';\n $listGamesBrut = $this->requestedgame;\n\n foreach ($listGamesBrut as $key => $game) {\n\n $html .= $this->createCardHTML($game);\n }\n\n $html .= '</div>';\n return $html;\n }", "static private function get_categories() {\n \n $categories = array (\n 'AudioVideo', \n 'Development', \n 'Education', \n 'Game', \n 'Graphics', \n 'Network', \n 'Office', \n 'Settings', \n 'System', \n 'Utility'\n );\n \n /**\n * Additional categories\n *\n * The list of Additional Categories provides categories that can be used to provide more fine grained information about the application. \n * Additional Categories should always be used in combination with one of the Main Categories.\n */\n \n $subcategories = array(\n 'Building',\n 'Debugger',\n 'IDE',\n 'GUIDesigner',\n 'Profiling',\n 'RevisionControl',\n 'Translation',\n 'Calendar',\n 'ContactManagement',\n 'Database',\n 'Dictionary',\n 'Chart',\n 'Email',\n 'Finance',\n 'FlowChart',\n 'PDA',\n 'ProjectManagement',\n 'Presentation',\n 'Spreadsheet',\n 'WordProcessor',\n '2DGraphics',\n 'VectorGraphics',\n 'RasterGraphics',\n '3DGraphics',\n 'Scanning',\n 'OCR',\n 'Photography',\n 'Publishing',\n 'Viewer',\n 'TextTools',\n 'DesktopSettings',\n 'HardwareSettings',\n 'Printing',\n 'PackageManager',\n 'Dialup',\n 'InstantMessaging',\n 'Chat',\n 'IRCClient',\n 'FileTransfer',\n 'HamRadio',\n 'News',\n 'P2P',\n 'RemoteAccess',\n 'Telephony',\n 'TelephonyTools',\n 'VideoConference',\n 'WebBrowser',\n 'WebDevelopment',\n 'Midi',\n 'Mixer',\n 'Sequencer',\n 'Tuner',\n 'TV',\n 'AudioVideoEditing',\n 'Player',\n 'Recorder',\n 'DiscBurning',\n 'ActionGame',\n 'AdventureGame',\n 'ArcadeGame',\n 'BoardGame',\n 'BlocksGame',\n 'CardGame',\n 'KidsGame',\n 'LogicGame',\n 'RolePlaying',\n 'Simulation',\n 'SportsGame',\n 'StrategyGame',\n 'Art',\n 'Construction',\n 'Music',\n 'Languages',\n 'Science',\n 'ArtificialIntelligence',\n 'Astronomy',\n 'Biology',\n 'Chemistry',\n 'ComputerScience',\n 'DataVisualization',\n 'Economy',\n 'Electricity',\n 'Geography',\n 'Geology',\n 'Geoscience',\n 'History',\n 'ImageProcessing',\n 'Literature',\n 'Math',\n 'NumericalAnalysis',\n 'MedicalSoftware',\n 'Physics',\n 'Robotics',\n 'Sports',\n 'ParallelComputing',\n 'Amusement',\n 'Archiving',\n 'Compression',\n 'Electronics',\n 'Emulator',\n 'Engineering',\n 'FileTools',\n 'FileManager',\n 'TerminalEmulator',\n 'Filesystem',\n 'Monitor',\n 'Security',\n 'Accessibility',\n 'Calculator',\n 'Clock',\n 'TextEditor',\n 'Documentation',\n 'Core'\n );\n \n $tech = array(\n 'GTK',\n 'GNOME',\n 'Qt',\n 'KDE',\n 'Motif',\n 'Java'\n );\n \n return array(\n 'categories' => $categories,\n 'subcategories' => $subcategories,\n 'tech' => $tech\n );\n \n }", "function obtenerCategorias(){\n\n \t\treturn $this->cuestionario['cuestionario']['categorias']['catego'];\n \t}", "static function getCategorias()\n\t{\n\t\t$con = new Conexao();\n\t\t$con->open();\n\t\t$sql = \"SELECT '\\\"'||descricao||'\\\",' as descricao from categorias;\";\n\t\t$result = pg_query($sql);\n\t\twhile ($row = pg_fetch_row($result)) {\n\t\t\t$categorias .= $row[0];\n\t\t}\n\t\tpg_free_result($result);\n\t\t$con->close();\n\n\t\treturn $categorias;\n\t}", "function getCategories() {\n $l= &Logger::getInstance();\n return array($l->getCategory('primary'), $l->getCategory('backup'));\n }", "public function getCategories() {\n\t\t$categories = array(\n\t\t\t'' => 'None/Unknown',\n\t\t\t'Feedb' => array(\n\t\t\t\t'' => 'None/Unknown',\n\t\t\t\t'Rep' => 'Reports',\n\t\t\t\t'Sugg' => 'Suggestions',\n\t\t\t\t'Compl' => 'Complaints',\n\t\t\t\t'Bug' => 'Bug/Error',\n\t\t\t),\n\t\t\t'Help' => array(\n\t\t\t\t'' => 'None/Unknown',\n\t\t\t\t'Acc' => 'Account',\n\t\t\t\t'Paym' => 'Payment',\n\t\t\t\t'Subsc' => 'Subscription/Membership',\n\t\t\t\t'Evnt' => 'Events',\n\t\t\t\t'eSprt' => 'E-Sports',\n\t\t\t\t'Grps' => 'Groups',\n\t\t\t\t'oUsr' => 'Other users',\n\t\t\t\t'Cntn' => 'Content',\n\t\t\t),\n\t\t\t'Cont' => array(\n\t\t\t\t'' => 'None/Unknown',\n\t\t\t\t'sCnt' => 'Staff contact',\n\t\t\t\t'jAppl' => 'Job application',\n\t\t\t),\n\t\t);\n\t\treturn $categories;\n\t}", "public function findCategory()\n {\n $result = [];\n $fnd = $this->getDefaultFinder()->name('category.png');\n\n $this->genericScan($fnd, function($categ, $name) use (&$result) {\n $result[$categ] = $name;\n });\n\n return $result;\n }", "function community_groups_get_categories() {\n\treturn array('support', 'plugins', 'language', 'developers');\n}", "function categories()\n {\n $categories = [];\n\n $options = $this->options();\n foreach ($options as $key => $value) {\n if (preg_match('/^category_exists_(.*)$/', $key, $parts)) {\n $category = $parts[1];\n $categories[$category]['exists'] = true;\n foreach ([\n 'background_color',\n 'text_color',\n 'description',\n 'show_column',\n 'label'] as $param) {\n $pkey = \"category_\" . $param . \"_\" . $category;\n if (array_key_exists($pkey, $options)) {\n $categories[$category][$param] = $options[$pkey];\n }\n }\n }\n }\n return $categories;\n }", "public function get_challengecategories()\n {\n $this->token_checker();\n\n $call = \"challengecategories\";\n $key = ($call.$this->_hash);\n $result = $this->_get_cache($key);\n\n if(!$result)\n {\n $this->_api_headers();\n $url = $this->_apiUrl .$call;\n $this->_call_api($url, 'GET');\n $result = $this->result;\n\n $this->_set_cache($key,$result);\n }\n return $result;\n }", "private function _sitebuilder_categories()\n\t{\n\t\t// initialize variables\n\t\t$cats\t= array(\n\t\t\t''\t=> '-- Select a Category --'\n\t\t);\t// This variable will hold the array of categories that Codeignitor can read\t\n\t\t\n\t\t// grab categories from sitebuilder (eventually grab form Platform)\n\t\t$categories\t= json_decode(file_get_contents('http://sitebuilder.brainhost.com/wp_autobuild/api/get_categories.php?api_key=a9463e0b'), 1);\n\t\t\n\t\t// iterate categories and add to our array\n\t\tforeach($categories AS $key => $value):\n\t\t\t$cats[]\t= array(\n\t\t\t\t$value['id'] => $value['name']\n\t\t\t);\n\t\tendforeach;\n\n\t\t// return\t\t\n\t\treturn $cats;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the value for Pass.
public function setPass($pass) { $this->pass = $pass; }
[ "public function testSetPass()\n\t{\n\t\t$this->object->setPass('secret');\n\n\t\t$this->assertThat(\n\t\t\t$this->object->getPass(),\n\t\t\t$this->equalTo('secret')\n\t\t);\n\t}", "private function _set_pass($pass){\n\t\t$this->_pass = $pass;\n\t}", "public function setPass($pass){\n $this->auth_pass = $pass;\n }", "public function setTemporaryAccessPass(?string $value): void {\n $this->getBackingStore()->set('temporaryAccessPass', $value);\n }", "public function set_password($pass)\n {\n $this->auth_type = 'pass';\n $this->auth = $pass;\n }", "public static function setPassword($value) \r\n {\r\n self::$db_passwd[self::$conn_id] = $value;\r\n }", "public function markPassed() {\n $this->passed = true;\n }", "function setValue($value) {\n $this->value = $value;\n }", "function setValue ($value) {\r\n $this->_value = $value;\r\n }", "public function setFastpass($v)\n\t{\n\n\t\tif ($this->fastpass !== $v) {\n\t\t\t$this->fastpass = $v;\n\t\t\t$this->modifiedColumns[] = RidePeer::FASTPASS;\n\t\t}\n\n\t}", "function setTestvalue($value) {\r\n $this->testvalue = $value;\r\n }", "function pass_var($name, $value) {\n\t\t\t$this->pass_vars[$name] = $value;\n\t\t}", "public function setPassState($v)\n\t{\n\t\tif ($v !== null) {\n\t\t\t$v = (string) $v;\n\t\t}\n\n\t\tif ($this->pass_state !== $v) {\n\t\t\t$this->pass_state = $v;\n\t\t\t$this->modifiedColumns[] = MissionRequestTempPeer::PASS_STATE;\n\t\t}\n\n\t\treturn $this;\n\t}", "public function set($value) {}", "public function setPassTemp($passTemp){\n \t$this->passTemp = trim($passTemp);\n }", "public function setUser($value)\r\n\t{\r\n\t\t$this->_user = $value;\r\n\t}", "public function pass()\n {\n $this->pass=true;\n return parent::get_ap()+1;\n }", "public function setPassMessage($msg);", "public function changePass()\n {\n\n $mdp = $this->request->getParameter( 'pass' );\n $verifPass = $this->request->getParameter( 'verifPass' );\n\n if ($mdp !== false && $verifPass !== false) {\n if ($mdp === $verifPass) {\n if (preg_match( \"#^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\W)(?!.*[<>]).{8,30}$#\", $mdp )) {\n $this->user->updateMdp( $mdp, $this->request->getSession()->getAttribut( 'idUser' ) );\n $this->rediriger( \"admin\", \"index\" );\n $this->request->getSession()->setFlash( 'Le mot de passe a été modifié' );\n } else {\n\n $this->request->getSession()->setFlash( 'mots de passe non autorisé' );\n }\n\n } else {\n $this->request->getSession()->setFlash( 'Les mots de passe ne sont pas identiques' );\n }\n } else {\n $this->request->getSession()->setFlash( 'Action non autorisée' );\n }\n $this->rediriger( \"admin\", \"index\" );\n\n\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets as phone2CountryPrefix This field is deprecated. A secondary phone number is no longer supported.
public function getPhone2CountryPrefix() { return $this->phone2CountryPrefix; }
[ "public function setPhone2CountryPrefix($phone2CountryPrefix)\n {\n $this->phone2CountryPrefix = $phone2CountryPrefix;\n return $this;\n }", "public function getMobilePhoneCountryPrefix();", "private function mobilePhoneCountryPrefix()\n {\n return null;\n }", "private function workPhoneCountryPrefix()\n {\n return null;\n }", "public function getCountryAndPrefix()\n {\n return $this->country . ' (' . $this->prefix . ')';\n }", "private function homePhoneCountryPrefix()\n {\n return null;\n }", "public function shipping_to_prefix() {\n\t\tglobal $carton;\n\t\t$return = '';\n\t\tif (in_array($carton->customer->get_shipping_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __( 'to the', 'carton' );\n\t\telse $return = __( 'to', 'carton' );\n\t\treturn apply_filters('carton_countries_shipping_to_prefix', $return, $carton->customer->get_shipping_country());\n\t}", "public function getRef2Phone(){\n\t\t\treturn $this->ref2phone;\n\t\t}", "public function getPhone2()\n {\n return $this->phone2;\n }", "public function getPhonePrefix()\n {\n return $this->phonePrefix;\n }", "public function getPrefix()\n {\n if ($this->prefix == null) {\n $this->prefix = substr($this->msisdn, 0, 3);\n }\n\n return $this->prefix;\n }", "public function getPhoneNumber2(): ?string\n {\n return $this->phoneNumber2;\n }", "public function getFriendReferralCouponCodePrefix()\n {\n $prefix = $this->_scopeConfig->getValue(\n ConfigInterface::XML_PATH_FRIEND_REFERRAL_DISCOUNT_CODE_PREFIX\n );\n return $prefix ?: 'ANTFR';\n }", "public function getCustomerPrefix();", "public function getPhoneNetworkPrefix() : string\n {\n return substr($this->_phone->getLocalFormat(), 0, 4);\n }", "public function getCountryIso2()\n {\n return $this->getCountry() ? $this->getCountry()->getIso2Code() : '';\n }", "public static function getCountryFromCode($country_2_code)\n\t{\n\t\t$dbo = JFactory::getDbo();\n\n\t\t$q = $dbo->getQuery(true)\n\t\t\t->select('*')\n\t\t\t->from($dbo->qn('#__vikappointments_countries'))\n\t\t\t->where($dbo->qn('published') . ' = 1')\n\t\t\t->where($dbo->qn('country_2_code') . ' = ' . $dbo->q($country_2_code));\n\t\t\n\t\t$dbo->setQuery($q, 0, 1);\n\t\t$dbo->execute();\n\n\t\tif ($dbo->getNumRows())\n\t\t{\n\t\t\treturn $dbo->loadAssoc();\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "public function getTelefon2()\n {\n return $this->telefon2;\n }", "public function phoneLocalTwo()\n {\n\n $the_slug = get_queried_object()->slug;\n\n $the_post = ($the_slug == 'agro-rural') ? get_page_by_path('direccion-ejecutiva' , OBJECT, 'directorios') : get_page_by_path($the_slug , OBJECT, 'directorios');\n\n $the_phone = (get_field('dir_phone_local_2', $the_post->ID) ? get_field('dir_phone_local_2', $the_post->ID) : '');\n\n if( $the_phone !== '' ){\n $pos1 = strpos($the_phone, \"-\");\n \n if ( $pos1 !== 1 && $pos1 !== false ) {\n $cityCode = substr($the_phone, 0, $pos1);\n $localNumber = substr($the_phone, ($pos1 + 1)); \n \n return (object) array(\n 'code' => $cityCode,\n 'number' => $localNumber\n );\n }\n\n if ( $pos1 === false ) {\n return (object) array(\n 'city_code' => '',\n 'number' => '',\n 'message' => 'Ingrese codigo de ciudad'\n );\n }\n\n if ( $pos1 === 1 ) {\n return (object) array(\n 'city_code' => '',\n 'number' => '',\n 'message' => 'Ingrese código de ciudad correcto'\n );\n }\n }\n \n return (object) array(\n 'city_code' => '',\n 'number' => ''\n );\n\n //return $the_phone;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generazione dell'url dove reperire i file delle foto
function generateUrl($nomefile){ return 'http://'.$_SERVER['HTTP_HOST'].'/foto/'.$nomefile; }
[ "public function getFile($url);", "public function getUrl(File $file);", "public function url() {\r\n return $this->pathUrl() . ($this->filename ? '/' . $this->filename : '');\r\n }", "function file_create_url($path) {\n // Strip file_directory_path from $path. We only include relative paths in urls.\n if (strpos($path, file_directory_path() .'/') === 0) {\n $path = trim(substr($path, strlen(file_directory_path())), '\\\\/');\n }\n switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {\n case FILE_DOWNLOADS_PUBLIC:\n return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\\\', '/', $path);\n case FILE_DOWNLOADS_PRIVATE:\n return url('system/files/'. $path, array('absolute' => TRUE));\n }\n}", "public function getUrl()\n {\n return phpb_full_url(phpb_config('general.uploads_url') . '/' . $this->public_id . '/' . $this->original_file);\n }", "public function getFileUrl ($path);", "public function url()\n {\n return $this->file->get_file_url();\n }", "public function toURL() {\n /*\n // URL class not implemented yet\n return new URL(\"file\", \"\", $this->slashify($this->getAbsolutePath(), $this->isDirectory()));\n */\n }", "public function getUrlImagen()\n {\n $s3 = new S3Client([\n 'version' => 'latest',\n 'region' => 'eu-west-3',\n 'credentials' => [\n 'key' => getenv('KEY'),\n 'secret' => getenv('SECRET'),\n 'token' => null,\n 'expires' => null,\n ],\n ]);\n\n $carpeta = '';\n\n if ($this->img_key != 'sin-imagen.jpg') {\n $carpeta = str_replace(' ', '_', $this->titulo) . '/';\n }\n\n if (getenv('MEDIA')) {\n $cmd = $s3->getCommand('GetObject', [\n 'Bucket' => 'gamesandfriends',\n 'Key' => 'Juegos/' . $carpeta . $this->img_key,\n ]);\n\n $request = $s3->createPresignedRequest($cmd, '+20 minutes');\n\n return (string) $request->getUri();\n }\n return '';\n }", "static function url($file_path, $timestamp = true) {\n\t\t$mojl = self::destatic();\n\t\techo $mojl->get_url($file_path, $timestamp);\n\t}", "function zbase_public_image_link($file)\r\n{\r\n\treturn '/zbase_tmp/downloads/' . basename($file);\r\n}", "public function toURI() {\n /*\n $f = $this->getAbsoluteFile();\n $sp = (string) $this->slashify($f->getPath(), $f->isDirectory());\n if (StringHelper::startsWith('//', $sp))\n $sp = '//' + sp;\n return new URL('file', null, $sp, null);\n */\n }", "public function getURLToPhoto(): string {\n return \"photo.php?p=\" . $this->id;\n }", "function elgg_file_viewer_get_media_url($file, $format) {\n\n\tif (!$file instanceof ElggFile) {\n\t\treturn '';\n\t}\n\n\t$info = pathinfo($file->getFilenameOnFilestore());\n\t$filename = $info['filename'];\n\n\t$output = new ElggFile();\n\t$output->owner_guid = $file->owner_guid;\n\t$output->setFilename(\"projekktor/$file->guid/$filename.$format\");\n\n//\tif (!$output->exists() && elgg_get_plugin_setting('enable_ffmpeg', 'elgg_file_viewer')) {\n//\t\t$output = elgg_file_viewer_convert_file($file, $format);\n//\t}\n\n\treturn elgg_get_download_url($output);\n}", "public function getUrl()\n {\n return $this->storage()->url(\n $this->getFilepath().DIRECTORY_SEPARATOR.$this->filename\n );\n }", "abstract public function getFileViewUrl();", "function file_url( $file ) {\n\t\t$url = false;\n\t\tif ( isset( $this->files[$file] ) ) {\n\t\t\t$url = $this->files[$file];\n\t\t}\n\t\treturn $url;\n\t}", "protected function makeUploadedFileByUrl() {\n $content = @file_get_contents($this->resource);\n $temp_name = basename($this->resource);\n $this->storage->put($temp_name, $content);\n return (new UploadedFile($this->storage->path($temp_name), $temp_name));\n }", "function crearRutaImagen($imagen){\n return 'http://127.0.0.1/img/' . $imagen;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return back the parcel being sent to allow for editing
public function getBackSendParcel() { $parcel = $this->parcel->getParcelNew(); return view('parcel.send', compact('parcel')); }
[ "public function saveparcelAction(){\n $parcelData = $this->getRequest()->getPost();\n\n $quote = Mage::getModel('checkout/cart')->getQuote();\n\n $quote\n ->setDpdSelected(1)\n ->setDpdParcelshopId($parcelData['parcelShopId'])\n ->setDpdCompany($parcelData['company'])\n ->setDpdStreet($parcelData['street'])\n ->setDpdHouseNumber($parcelData['houseNo'])\n ->setDpdZipcode($parcelData['zipCode'])\n ->setDpdCity($parcelData['city'])\n ->setDpdCountry($parcelData['isoAlpha2'])\n ->save();\n\n $quote->getShippingAddress()\n ->setShippingMethod('dpdparcelshops_dpdparcelshops')\n ->setCollectShippingRates(true)\n ->requestShippingRates();\n\n $quote->save();\n\n $this->loadLayout();\n\n $block = $this->getLayout()\n ->createBlock('dpd/carrier_parcelshop');\n\n $block->setParcelShop($parcelData);\n $block->setTemplate('dpd/parcelshopselected.phtml');\n\n $html = $block->toHtml();\n\n $this->getResponse()->setBody($html);\n }", "public function getParcel() {\n\t\treturn $this->parcel;\n\t}", "abstract public function getForEdit();", "function editdeliverable() {\n\n\t\t// get user\n\t\t$user =& JFactory::getUser();\n\t\t// users must be logged in, not a quess\n\t\tif ($user->guest) {\n\t\t\treturn $this->_authenticationAjaxResponse();\n\t\t}\n\n\t\t$deliverable =& JTable::getInstance('deliverable');\n\n\t\t$deliverable_id = JRequest::getInt('deliverable_id');\n\n\t\t// load current deliverable\n\t\tif (!$deliverable->load($deliverable_id)) {\n\t\t\treturn $this->_databaseErrorAjaxResponse(\n\t\t\t\t$deliverable->getError() . \"[deliverable: \" . $deliverable->deliverable_id . \"]\");\n\t\t}\n\n\t\t// check if user can edit\n\t\tif(!$this->_canEdit($deliverable, $user->id)) {\n\t\t\t// the user can edit only his own deliverables\n\t\t\treturn $this->_permitionErrorAjaxResponse();\n\t\t}\n\n\t\t// construct the response\n\t\t$response['deliverable_id'] = $deliverable->deliverable_id;\n\t\t$response['user_id'] = $deliverable->user_id;\n\t\t$response['title'] = $deliverable->title;\n\t\t$response['type'] = $deliverable->type;\n\t\t$response['description'] = $deliverable->description;\n\t\t// format the currency\n\t\t$deliverable->cost = str_replace(\".\", \",\", $deliverable->cost);\n\t\t$response['cost'] = $deliverable->cost;\n\n\t\t$response['deadline_date'] = $deliverable->deadline_date;\n\n\t\techo json_encode($response);\n\n\t\treturn true;\n\t}", "public function get_edit_access()\n\t{\n\t\treturn $this->Hex_ParcelEdit;\n\t}", "public function edit()\n {\n\t$this->log(\"edit function\");\n\n \t// Check whether client is logged in\n // $logged_in = false;\n // if ($this->isLoggedIn()) {\n // $logged_in = true;\n // }\n\n // Get custom fields from Client controller => save\n \t$client_custom_fields = $this->Clients->getCustomFieldValues(1);\n return $this->set('client_custom_fields', $client_custom_fields);\n }", "public function executeInv()\n {\n $field = $this->getRequestParameter('field');\n\n if($this->hasRequestParameter('ids')){\n $mms = array_reverse(MmPeer::retrieveByPKs(json_decode($this->getRequestParameter('ids'))));\n\n foreach($mms as $mm){\n $save = false;\n if ($field == \"announce\") {\n $mm->setAnnounce(!$mm->getAnnounce());\n $save = true;\n }else if ($field == \"important\") {\n $mm->setImportant(!$mm->getImportant());\n $save = true;\n }\n if ($save){\n $mm->save();\n }\n }\n \n }\n return $this->renderComponent('virtualserial', 'list');\n }", "public function actionEdit()\n\t{\n\t\t$destination = $this->_getFieldOrError($this->_input->filterSingle('destination_id', XenForo_Input::STRING));\n\t\treturn $this->_getFieldAddEditResponse($destination);\n\t}", "public function _renderSubmission($params = array()) {\r\n return $this->_edit();\r\n\t}", "function getEditablePromoCodeID()\n {\n return $this->editablePromoCodeID;\n }", "public function getParcel()\n {\n return Mage::getModel('hermes/parcel')->load(\n $this->getMageShipment()->getEntityId(), 'shipment_id'\n );\n }", "function Room_Envelope_Participants_Data_Edit()\n {\n return $this->ParticipantsObj()->ItemDataGroups(\"Envelope\",\"EditDatas\");\n }", "public function getPartiPresuspuest()\n {\n return $this->parti_presuspuest;\n }", "function proposeEdit($vid,$name,$address,$crossstreet,$city,$state,$zip,$phone,$geolat,$geolong) {\n\t\t$method = \"/venue/proposeedit\".\".\".$this->format.\"?vid=\".$vid.\"&name=\".$name.\"&address=\".$address.\"&city=\".$city.\"&state=\".$state.\"&geolat=\".$geolat.\"&geolong=\".$geolong;\n\t\t\n\t\tif(isset($crossstreet) && $crossstreet != NULL)\n\t\t\t$method .= \"&crossstreet=\".$crossstreet;\n\t\t\n\t\tif(isset($zip) && $zip != NULL)\n\t\t\t$method .= \"&zip=\".$zip;\n\t\t\t\n\t\tif(isset($phone) && $phone != NULL)\n\t\t\t$method .= \"&phone=\".$phone;\n\t\t\n\t\t$this->response = $this->connect($method);\n\t\treturn $this->response;\n\t}", "public function renderSubmission($params = array()) {\n return $this->edit();\n\t}", "protected function getEditmodeData() {}", "public function excelPreviewAction()\n\t{\n\t\t$id = $this->_getParam('id', 0);\n\t\tif ($id > 0){\n\t\t\t\n\t\t\t$aggregator = new Voices_Model_Data_Aggregator();\n\t\t\t$prodInfo = $aggregator->getAllProductInfoFromCommunique($id);\n\t\t\t\n\t\t\tlist($prods, $uResults) = $prodInfo;\n\t\t\t\n\t\t\tif (count($prods) > 0){\n\t\t\t\tforeach ($prods as $pKey=>$pValue){\n\t\t\t\t\tforeach ($pValue as $vKey => $vValue){\n\t\t\t\t\t\tif (isset($pValue[0]['Voices_Model_Contacts'])){\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['con_com_id'] = $vValue['Voices_Model_Contacts']['con_com_id'];\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['contact_fname'] = $vValue['Voices_Model_Contacts']['first_name'];\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['contact_lname'] = $vValue['Voices_Model_Contacts']['last_name'];\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['contact_tel'] = $vValue['Voices_Model_Contacts']['tel_number'];\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['address'] = $vValue['Voices_Model_Contacts']['address'];\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['village'] = $vValue['Voices_Model_Contacts']['village'];\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['zone'] = $vValue['Voices_Model_Contacts']['zone'];\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['com_number'] = $uResults[0]['com_number'];\n\t\t\t\t\t\t\t// here ts_date_delivered = ts_date_submitted for the\n\t\t\t\t\t\t\t// upload since the communique is not been published\n\t\t\t\t\t\t\t// yet.\n\t\t\t\t\t\t\t$prods[$pKey][$vKey]['ts_date_delivered'] = $uResults[0]['ts_date_submitted'];\n\t\t\t\t\t\t}\n\t\t\t\t\t }\n\t\t\t\t}\n\t\t\t\n\t\t\t\t$data = array();\n\t\t\t\n\t\t\t\tforeach ($prods as $aKey => $aValue) {\n\t\t\t\t\tforeach ($aValue as $bKey => $bValue){\n\t\t\t\t\t\tarray_push($data, $bValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t//\t\t\t$excelGen = new Voices_Model_Data_Aggregator();\n\t//\t\t\t$excelGen->makeExcelSheet($data);\n\t\t\t\t$aggregator->makeExcelSheet($data);\n\t\t\t}\n\t\t}\n\t}", "public function cl_pluginsext_edit($data) {\n // TODO HERE (dont delete return) //\n return $data; \n }", "public function editAction() {\n\t\t$this->_checkLogin(true);\n\t\tsleep(1);\n\t\t$this->_loadTask(false);\n\t\t$this->edit->addHelper('json');\n\t\theader('Content-type: application/json');\n\t\techo $this->edit->export('value');\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
supplier List For Report
public function supplier_list_report() { $this->db->select('*'); $this->db->from('supplier_information'); $this->db->order_by('supplier_id','desc'); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->result_array(); } return false; }
[ "public function getSupplierList(){ \n $table = \"supplier\"; display_db_table($table, TRUE, \"border='1'\");\n }", "function getSupplierItems();", "function GetSuppliers(){\n //return $this->api->Supplier->get(132995760,array(\"company\"));\n\n return $this->api->execute('Supplier.list','[{\"company\": true, \"uid\" : true},true]');\n\n }", "public function supplier_list_report() {\n $this->db->select('*');\n $this->db->from('supplier_information');\n $this->db->order_by('supplier_id', 'desc');\n $query = $this->db->get();\n if ($query->num_rows() > 0) {\n return $query->result_array();\n }\n return false;\n }", "public function supplier_list()\n {\n $suppliers = DB::table('supplier_record')\n ->orderBy('supplier_id','desc')\n ->get();\n\n return view('admin.admin-manage-supplier')->with('suppliers',$suppliers);\n\n }", "public function stock_supplierwise()\n {\n $CI =& get_instance();\n $CI->load->model('Reports');\n $data['title'] = 'stock';\n $company_info = $CI->Reports->retrieve_company();\n $currency_details = $CI->Web_settings->retrieve_setting_editdata();\n $data['currency'] = $currency_details[0]['currency'];\n $data['totalnumber'] = $CI->Reports->totalnumberof_product();\n $data['company_info'] = $company_info;\n $reportList = $CI->parser->parse('report/supplierwise_stock', $data, true);\n return $reportList;\n }", "function getAllSuppliers()\r\n\t {\r\n\t\treturn $this->dataClass->getAllRecords(); \r\n\t }", "public function get_suppliers_list()\n\t {\n\t \t$userId=$this->checklogin();\n\t \t$query=$this->ApiModel->get_suppliers_list($userId);\n\t \techo json_encode($query);\n\t }", "public function supplier()\n {\n $data['title'] = 'Admin | Supplier';\n $data['supplier'] = $this->M_apotik->supplier();\n $this->template->load('MasterAdmin','Apotik/supplier/data-supplier',$data);\n }", "private function readSupplierUrls()\n {\n $suppliers = $this->getSupplierForSitemap();\n foreach ($suppliers as &$supplier) {\n $supplier['urlParams'] = [\n 'sViewport' => 'listing',\n 'sAction' => 'manufacturer',\n 'sSupplier' => $supplier['id'],\n ];\n }\n\n return $suppliers;\n }", "function allProdFromSupplier($supplierName,$isDiscontinued){\n $this->setDiscontinued($isDiscontinued);\n $where = \"\";\n if($supplierName!='All'){\n $where = \"[SupplierName] = '\".$supplierName.\"' AND\"; \n }\n \n \n $sql = \"SELECT [Name of Item], [Selling Price], [InternalRefCode], [CodeSup] FROM [Stock] WHERE \".$where.$this->isDiscontinued.\" ORDER BY [Name of Item] ASC\";\n //echo $sql;\n $query = $this->petcoPDO->prepare($sql);\n $query->execute();\n \n $prodFromSupArray = array(); \n while($row = $query->fetch()){\n $prodFromSupArray[] = array('name' => $row['Name of Item'],'salePrice' => round($row['Selling Price'],2),'supCode' => $row['CodeSup'],'intCode' => $row['InternalRefCode']);\n }\n \n return $prodFromSupArray;\n }", "public function allSuppliers();", "public function allSuppliers()\n {\n return $this->supplier->all();\n }", "function fn_get_all_supplier_products($supplier_id)\n{\n return db_get_fields('SELECT object_id FROM ?:supplier_links WHERE ?:supplier_links.object_type = \\'P\\' AND ?:supplier_links.supplier_id = ?i', $supplier_id);\n}", "public function getSupplierItems() : \\Aimeos\\Map\n\t{\n\t\treturn map( $this->get( '.supplier', [] ) );\n\t}", "public function getSuppliers()\n {\n $dbm = ErpDbManager::getInstance();\n $mapper = $dbm->getRepository(Supplier::class);\n return $mapper->findByItem($this);\n }", "protected function getSupplierData()\n {\n $result['model'] = 'Proveedor';\n $result['icon'] = 'fas fa-users';\n $result['group'] = 'suppliers';\n $result['values'] = [\n ['name' => 'total', 'sql' => 'count(*)', 'type' => 'int'],\n ['name' => 'is-creditor', 'sql' => 'SUM(CASE WHEN acreedor THEN 1 ELSE 0 END)', 'type' => 'int'],\n ['name' => 'suspended', 'sql' => 'SUM(CASE WHEN debaja THEN 1 ELSE 0 END)', 'type' => 'int'],\n ];\n\n return $result;\n }", "function listSuppliers($suppliers) {\n \n echo \"<input list=suppliers name=supplier>\";\n echo \"<datalist id=suppliers>\";\n \n // Loop through the suppliers and insert it as an option\n foreach ($suppliers as $supplier) {\n \n echo '<option value=\"' . $supplier[\"SNAME\"] . ' \">' . '</option>';\n \n }\n \n echo \"</datalist>\";\n \n \n }", "public function getSuppliers($suppliers_id);" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a regular expression search and replace using a callback. Returns the `$haystack` string with all occurrences of `$pattern` replaced using `$callback`.
function replace_with(string $haystack, string $pattern, Closure $callback, ?int $limit = null): string { return (string) Internal\call_preg( 'preg_replace_callback', static fn() => preg_replace_callback($pattern, $callback, $haystack, $limit ?? -1), ); }
[ "abstract public function replace($callback);", "function preg_replace_callback ($pattern, $callback, $subject, $limit = null, &$count = null) {}", "function preg_replace_callback($pattern,$callback,$subject,$limit=NULL)\n{\n\treturn '';\n}", "function preg_replace_callback_offset($pattern, $callback, $subject) {\n $offset = 0;\n\n while(preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, $offset)) {\n list($match, $pos) = $matches[0];\n\n $replace = $callback($match, $pos, $subject);\n $subject = substr_replace($subject, $replace, $pos, strlen($match));\n\n $offset = $pos + strlen($replace);\n }\n return $subject;\n}", "protected function replaceWithCallback($pattern, $content, $replacement) {\n $matched = '';\n $replaced = '';\n\n /*\n * Instead of just passing the $replacement callback, we'll wrap another\n * callback around it to also allow us to catch the match & replacement\n * value.\n */\n $callback = function($match) use ($replacement, &$replaced, &$matched) {\n $matched = $match;\n $replaced = call_user_func($replacement, $match);\n return $replaced;\n };\n $content = preg_replace_callback($pattern, $callback, $content, 1, $count);\n\n return array($content, $replaced, $matched);\n }", "function mb_ereg_replace_callback(string $pattern, callable $callback, string $string, string $options = null): ?string\n{\n error_clear_last();\n if ($options !== null) {\n $safeResult = \\mb_ereg_replace_callback($pattern, $callback, $string, $options);\n } else {\n $safeResult = \\mb_ereg_replace_callback($pattern, $callback, $string);\n }\n if ($safeResult === false) {\n throw MbstringException::createFromPhpError();\n }\n return $safeResult;\n}", "function dbmo_shortcode_replace_callback($content, $callback) {\r\n\t$shortcode_pattern = '/'.get_shortcode_regex().'/s';\r\n\treturn preg_replace_callback($shortcode_pattern, $callback, $content);\r\n}", "function ereg_replace( $pattern , $replacement , $string ){\n\t\t\treturn preg_replace ( $pattern , $replacement , $subject );\n\t\t}", "function eregi_replace ($pattern, $replacement, $string) {}", "public static function preg_match_all_callback($pattern, $subject, callable $callback) {\n $r = preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);\n foreach($matches ?? [] as $match)\n $callback($match);\n return $r;\n }", "public function map(string $pattern, callable $callable);", "public function replace($search, $replace);", "function twig_filter_preg_replace($subject, $pattern, $replacement, $limit = -1) {\n return preg_replace($pattern, $replacement, $subject, $limit);\n }", "public static function replace($pattern, $replace, $text){\n return preg_replace($pattern,$replace, $text);\n }", "public function transformPatternToRegex($pattern);", "function safe_preg_replace(\n string $pattern, string $replacement, string $subject): string {\n $result = preg_replace($pattern, $replacement, $subject);\n if (is_null($result)) {\n return $subject;\n }\n return $result;\n}", "public function findTags($str, callable $callback)\n {\n $searchOffset = 0;\n while (preg_match($this->initialSearchRegex, $str, $matches, PREG_OFFSET_CAPTURE, $searchOffset)) {\n $attr = $matches[0][0];\n $offset = $matches[0][1];\n\n $searchOffset = $offset + strlen($attr);\n\n $startOfTag = $this->findStartOfTag(substr($str, 0, $offset));\n if (!$startOfTag) {\n continue;\n }\n $endOfTag = $this->findEndOfTag(substr($str, $offset + strlen($attr)));\n if (!$endOfTag) {\n continue;\n }\n\n $fullTag = implode('', [$startOfTag[0], $attr, $endOfTag[0]]);\n $attributes = implode('', [$startOfTag[1], $attr, $endOfTag[1]]);\n\n $replacement = $callback($fullTag, $attributes);\n\n $tagOffset = $offset - strlen($startOfTag[0]);\n $str = substr_replace($str, $replacement, $tagOffset, strlen($fullTag));\n\n // continue searching from after the end of the replaced tag\n $searchOffset = $tagOffset + strlen($replacement);\n }\n\n return $str;\n }", "protected function replaceTerm(& $e, $callback)\n {\n if (is_string($e)) $term =& $e;\n else $term =& $e['term'];\n\n /**\n * Case 1: all occurrence of $term will be replace\n */\n if (false === strpos($term, '/')) {\n $this->text = str_replace($term, $callback($e), $this->text);\n return;\n }\n\n /**\n * Case 2: only the $nth occurrence of $term will be replace\n */\n list($term, $nth) = explode('/', $term, 2);\n\n $terms = array_fill(1, $nth, \"/$term/\");\n $rplcs = array_fill(1, $nth, '__TMP_REPLACEMENT__');\n $rplcs[$nth] = $callback($e);\n\n $this->text = preg_replace($terms, $rplcs, $this->text, 1);\n $this->text = str_replace('__TMP_REPLACEMENT__', $term, $this->text);\n }", "function preg_replace_callback_array(\n array $patterns_and_callbacks,\n $subject,\n int $limit = -1,\n int &$count = null\n) {\n $args = func_get_args();\n if (count($args) >= 4) {\n $args[3] = &$count;\n }\n return Preg::callPregFunc('\\preg_replace_callback_array', $args, 1);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the value of fechaVisita
public function getFechaVisita() { return $this->fechaVisita; }
[ "public function getValutaDate() {\n\t\treturn $this->valutaDate;\n\t}", "public function getFechaValoracion()\n {\n return $this->fechaValoracion;\n }", "public function getFecha()\n {\n return $this->v_fecha;\n }", "public function getVsfecha()\n\t{\n\t\treturn $this->vsfecha;\n\t}", "public function getFechaVenta()\n {\n return $this->fechaVenta;\n }", "public function getFechaVigencia() {\n\t\treturn $this->fechaVigencia;\n\t}", "function get_fechaIngreso( ) {\n // returns the value of fechaIngreso\n return $this->fechaIngreso;\n }", "public function getFechaVencimiento( ){\n\t\treturn $this->fechaVencimiento;\n\t}", "public function getDateFourni()\n {\n return $this->dateFourni;\n }", "function getFecha(){\n\t\treturn $this->fecha;\n\t}", "public function getDateDerniereVente() {\n return $this->dateDerniereVente;\n }", "public function getDateFecha()\n {\n return $this->dateFecha;\n }", "public function getFechaCampeonato(){\n return $this->fecha_campeonato;\n }", "public function getFecha_carga()\r\n\t{\r\n\t\treturn($this->fecha_carga);\r\n\t}", "public function getFechaVencimiento()\n {\n return $this->fechaVencimiento;\n }", "public function getFechaConsulta()\n {\n return $this->fechaConsulta;\n }", "function fecha() {\n\n\t\tforeach ($this -> xml ->xpath('//cfdi:Comprobante') as $comprobante) {\n\t\t\t$this -> fecha = $comprobante['fecha'] != \"\" ? $comprobante['fecha'] : $comprobante['Fecha'];\n\t\t}\n\n\t\treturn $this -> fecha;\n\t}", "public function getDateDebut();", "public function getFechaCarga() {\n return $this->fechaCarga;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets appointments for the event
protected function getAppointmentsForEvent($event_id) { global $_LW; $output=[]; foreach($_LW->dbo->query('select', ' livewhale_appointments.id, livewhale_appointments.title, IF(livewhale_appointments2any.registration_id IS NOT NULL, 1, 0) AS is_filled ', 'livewhale_appointments', '') ->innerJoin('livewhale_appointments2any', 'livewhale_appointments2any.id1=livewhale_appointments.id AND livewhale_appointments2any.id2='.(int)$event_id.' AND livewhale_appointments2any.type="events"') ->groupBy('livewhale_appointments.id') ->run() as $res2) { // fetch the appointments $output[]=$res2; }; return $output; }
[ "public function getAppointments()\n {\n return $this->appointments;\n }", "public function listAllAppointments() {\n\t\t$appointment = new Appointment();\n\t\treturn $appointment->getList('', $this->db->formatQuery('WHERE t.politician = %i ORDER BY t.time_end DESC', $this->id));\n\t}", "public function getAppointments()\n {\n if (array_key_exists(\"appointments\", $this->_propDict)) {\n return $this->_propDict[\"appointments\"];\n } else {\n return null;\n }\n }", "public function GetAllAppointments()\n\t{\n\t\t$appointments = Appointment::all();\n\t\t$calendarAppointments = array();\n\t\tforeach($appointments as $a) {\n\n\t\t\t$customer = Customer::find($a['customer_id']);\n\t\t\t$customer = $customer->first_name.' '.$customer->last_name;\n\n\t\t\t$package = Package::find($a['appointment_type']);\n\n\t\t\t$startDate = date_create($a['appointment_datetime']);\n\t\t\t$endDate = date_create($a['appointment_datetime']);\n\t\t\t$time = (string)$package->package_time.' hours';\n\t\t\t$endDate = date_add($endDate, date_interval_create_from_date_string($time));\n\t\t\t$event = array(\n\t\t\t\t'id' => $a['id'],\n\t\t\t\t'title' => 'Appointment with '.$customer,\n\t\t\t\t'start' => $startDate->format('Y-m-d\\TH:i:s'),\n\t\t\t\t'end' => $endDate->format('Y-m-d\\TH:i:s'),\n\t\t\t);\n\t\t\tarray_push($calendarAppointments, $event);\n\t\t}\n\n\t\treturn response()->json($calendarAppointments);\n\t}", "function getAvailableAppointments()\n{\n\t$app = Application::getInstance();\n\t$app->getAvailableAppointments();\n}", "public function getAppointments() {\n if (is_null($this->appointments)) {\n $ownerDAO = new OwnerMySQLiDAO();\n $this->appointments = $ownerDAO->findAppointments($this->id);\n }\n return $this->appointments;\n }", "public function getAppointments()\n {\n return $this->hasMany(Appointment::className(), ['id' => 'id']);\n }", "public function fetchAppointmentList();", "public function get_calendar_appointments() {\n\t\t\n\t\t$data = $this->glbl('practitioner_access');\n\t\t$allAppointments = array();\n\t\t$user_id\t \t = $this->tank_auth->ci->session->userdata['user_id'];\n\t\t//$clinicData = $this->manage_locations->getClinicId($user_id);\n\t\t//$clinicLocations = $this->manage_locations->clinicLocationsArray($clinicData->clinic_id);\n\t\t//$myLocation = $this->manage_locations->getLocationID($user_id);\n\t\t\n\t\t$locationPracs = $this->manage_locations->locationPractitioner($this->encryption->decode($this->session->userdata['clinic_location']));\n\t\t//echo '<pre>'; print_r($locationPracs); die;\n\t\t/*if(isset($this->session->userdata['location_pracs']))\n\t\t\t$locationPracs = $this->session->userdata['location_pracs'];\n\t\telse\n\t\t\t$locationPracs = '';\n echo '<pre>'; print_r($locationPracs); die;\n\t\t\t\t*/\n\t\t$allAppointments = $this->appointments->get_appointments($this->encryption->decode($this->session->userdata['clinic_location']), $locationPracs);\n $this->session->unset_userdata('appointment_entered_date');\n\t\techo json_encode($allAppointments);\n\t\texit();\n\t}", "public function getAppointments()\n {\n return $this->hasMany(Appointment::className(), ['car_id' => 'id']);\n }", "public function getAppointmentsForDate($date) {\n $startDate = $date . 'T00:00:00';\n $endDate = $date . 'T23:59:59';\n // $query = new Zend_Gdata_Calendar_EventQuery();\n $query = $this->gdataCal->newEventQuery();\n $query->setProjection('full');\n $query->setStartMin($startDate);\n $query->setStartMax($endDate);\n $query->setUser('default');\n $query->setVisibility('private');\n $query->setProjection('full');\n $query->setOrderby('starttime');\n\n $appointments = array();\n // appointments come in \"2011-08-22T12:00:00.000+02:00\" format\n try {\n $eventFeed = $this->gdataCal->getCalendarEventFeed($query);\n foreach ($eventFeed as $event) {\n $when = $event->when[0];\n $startTime = substr($when->getStartTime(), 0, 19); // strip off TZ\n $endTime = substr($when->getEndTime(), 0, 19);\n $appointments []= array(strtotime($startTime)+$offset,strtotime($endTime)+$offset);\n }\n } catch (Zend_Gdata_App_InvalidArgumentException $e) {\n // send mail? try again? no availability?\n throw new PracticeSchedulerRequestFailedException($e->getMessage());\n }\n return $appointments;\n }", "public function appointmentsResourceCollection()\n {\n $apps = Appointment::all();\n\n return AppointmentResource::collection($apps);\n }", "public function appointmentsList()\n\t{\n\t\t$where = array(\"instructor_id\" => $this->session->userdata(\"id\"));\n\t\t$result = $this->instructor_model->getAppointments($where);\n\t\t// print_r($result);\n\t\t$events = array();\n\t\tif($result){\n\t\t\tforeach ($result as $value) {\n\t\t\t\t$events[] = array(\n\t\t\t\t\t\"studentid\"\t=> \t$value->user_id,\n\t\t\t\t\t\"title\"\t\t=>\t$value->title,\n\t\t\t\t\t\"url\"\t\t=>\t'javascript:appointment_detail('.$value->user_id.')',\n\t\t\t\t\t\"start\"\t\t=>\t$value->start_datetime,\n\t\t\t\t\t\"end\"\t\t=>\t$value->end_datetime\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t$data = array(\"events\" => json_encode($events));\n\t\t$this->load->view('instructor/appointments.view.php',$data);\n\t}", "public function get_service_vice_appointments()\r\n\t{\r\n\t\t$this->load->model('reports_model');\r\n\r\n\t\t$query_service_vice_appointments = $this->reports_model->get_service_vice_appointments();\r\n\r\n\t\tif(!$query_service_vice_appointments == 0)\r\n\t\t{ \r\n\t\t\treturn $query_service_vice_appointments;\r\n\t\t}\r\n\r\n\t}", "function Sycle_Appointments() {\n\treturn Sycle_Appointments::instance();\n}", "public function appointments()\n {\n return $this->hasMany('App\\Appointment');\n }", "public function testGetMessageListAppointments()\r\n\t{\r\n\t\t// Create an event to make sure we have at least one\r\n\t\t$obj = CAntObject::factory($this->dbh, \"calendar_event\", null, $this->user);\r\n\t\t$obj->setValue(\"name\", \"My Test Event\");\r\n\t\t$obj->setValue(\"ts_start\", date(\"m/d/Y\") . \" 12:00 PM\");\r\n\t\t$obj->setValue(\"ts_end\", date(\"m/d/Y\") . \" 01:00 PM\");\r\n\t\t$eid = $obj->save();\r\n\r\n\t\t// Get events\r\n\t\t$events = $this->backend->GetMessageList(\"calendar_root\", time()); // second param cuts off to today\r\n\t\t$found = false;\r\n\t\tforeach ($events as $evt)\r\n\t\t{\r\n\t\t\tif ($evt[\"id\"] == $eid)\r\n\t\t\t\t$found = true;\r\n\t\t}\r\n\t\t$this->assertTrue($found);\r\n\r\n\t\t// Cleanup\r\n\t\t$obj->removeHard();\r\n\t}", "static public function getAppointmentList($oid)\n {\n // Get business start/end dates\n // Run the query\n $query = \"SELECT business_id, appt_duration FROM business_settings WHERE owner_id = $oid\";\n $row = getDatabase()->one($query);\n\n // Get the data\n $bid = $row[\"business_id\"];\n $duration = $row[\"appt_duration\"];\n\n // Build times that our appt search should start/end at\n // Grab dates from URL, grab times from business start/stop times\n $appt_start_time = 0;\n $appt_end_time = 0;\n if(isset($_REQUEST[\"date\"]) && $_REQUEST[\"date\"] != \"\")\n {\n $appt_start_time = date(\"U\", mktime(0, 0, 0,\n date(\"m\", strtotime($_REQUEST[\"date\"])),\n date(\"d\", strtotime($_REQUEST[\"date\"])),\n date(\"Y\", strtotime($_REQUEST[\"date\"]))));\n $appt_end_time = date(\"U\", mktime(23, 59, 59,\n date(\"m\", strtotime($_REQUEST[\"date\"])),\n date(\"d\", strtotime($_REQUEST[\"date\"])),\n date(\"Y\", strtotime($_REQUEST[\"date\"]))));\n }\n else\n {\n $appt_start_time = date(\"U\", mktime(0, 0, 0,\n date(\"m\", time()),\n date(\"d\", time()),\n date(\"Y\", time())));\n $appt_end_time = date(\"U\", mktime(23, 59, 59,\n date(\"m\", time()),\n date(\"d\", time()),\n date(\"Y\", time())));\n }\n\n // Clean up some variables\n unset($biz_start_time, $biz_end_time);\n\n // Find any appointments during provided date (or today) and\n $query = \"SELECT a.start_time, a.duration, a.duration, a.state AS appt_state, u.user_id, u.first_name, u.last_name, \";\n $query .= \"u.street_address, u.city, u.state, u.zip, u.phone \";\n $query .= \"FROM appointments AS a \";\n $query .= \"INNER JOIN users AS u ON a.user_id = u.user_id \";\n $query .= \"WHERE business_id = $bid \";\n $query .= \"AND start_time >= $appt_start_time \";\n $query .= \"AND start_time < $appt_end_time \";\n $query .= \"ORDER BY start_time\";\n\n // Run query\n $res = getDatabase()->all($query);\n\n // Build list of open appointments\n $num = 0;\n $appointments = new Appointment_List;\n //while($row = $res->fetch_assoc())\n foreach($res as $row)\n {\n $appointments->appointments[$num] = new AppointmentOwner();\n $appointments->appointments[$num]->time = (int) $row[\"start_time\"];\n $appointments->appointments[$num]->duration = (int) $duration;\n $appointments->appointments[$num]->state = $row[\"appt_state\"];\n\n $appointments->appointments[$num]->user = new Userinfo();\n $appointments->appointments[$num]->user->id = (int) $row[\"user_id\"];\n $appointments->appointments[$num]->user->firstname = $row[\"first_name\"];\n $appointments->appointments[$num]->user->lastname = $row[\"last_name\"];\n $appointments->appointments[$num]->user->street = $row[\"street_address\"];\n $appointments->appointments[$num]->user->city = $row[\"city\"];\n $appointments->appointments[$num]->user->state = $row[\"state\"];\n $appointments->appointments[$num]->user->zip = $row[\"zip\"];\n\n $num++;\n }\n\n // Print JSON version fo appointment list\n $str = json_encode($appointments);\n print($str);\n }", "public function listAppointments($region = null) {\n\t\t$rgid = is_object($region)? $region->id: ($region != null? intval($region): null);\n\t\t$appointment = new Appointment();\n\t\treturn $appointment->getList('', $this->db->formatQuery('WHERE t.politician = %i '.($rgid? 'AND t.region = %i ': '').' ORDER BY t.time_end DESC', $this->id, $rgid));\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns path to rnd picture
public function getRandomImage():string { $dir = $_SERVER['DOCUMENT_ROOT'] . Steps::MODULE_IMG_PATH; $files = array_values(array_diff(scandir($dir), ['..', '.'])); $randKey = array_rand($files); $randFile = $files[$randKey]; $randImg = $dir . $randFile; return $randImg; }
[ "function randomImg(){\n $imagesDir = 'images/';\n $images = glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);\n $randomImage = '/'.$images[array_rand($images)];\n echo $randomImage;\n}", "public function mainPicture()\n\t{\n\t\treturn '/images/dogs/' . $this->id . '.jpg';\n\t}", "public function getPathOfTemporaryOriginalImage();", "public static function img() {\n\n\treturn \\URL::to('captcha?' . mt_rand(1, 100000), NULL, false, false);\n\n }", "function jumpoff_random_img() {\n // Get dir\n $template_dir = get_bloginfo('template_directory');\n\n // Array of fallback images to deliver randomly\n // @since v1.2\n $random_no_images =\n array('placeholder-1.jpg',\n 'placeholder-2.jpg',\n 'placeholder-3.jpg',\n 'placeholder-4.jpg',\n 'placeholder-5.jpg',\n 'placeholder-6.jpg');\n\n // Randomize array of fallbacks\n $randomNumber = array_rand($random_no_images);\n $randomImage = $random_no_images[$randomNumber];\n\n // Set placeholder path for out random fallbacks\n $related_img = $template_dir.\"/assets/images/placeholders/$randomImage\";\n\n return $related_img;\n}", "public function img()\n\t{\n\t\treturn URL::base() . 'm/pets/'.$this->specie->dir.'/'.$this->color->image;\n\t}", "public function mainPicture()\n\t{\n\t\treturn '/images/puppies/' . $this->id . '.jpg';\n\t}", "abstract public function getRandomPhoto();", "function random_pic($imagesDir){\r\n\r\n$images = glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);\r\n\r\nreturn $images[array_rand($images)];\r\n\r\n}", "public function getPhoto() : string {\n $hash = crc32($this->name);\n $filename = self::PHOTO_DIRECTORY . $hash . '.png';\n\n if (file_exists($filename))\n return '/images/photos/' . $hash . '.png';\n\n return '/images/no-photo.png';\n }", "protected function getTestImageFilePath()\n {\n return base_path('tests/test-data/test-image.png');\n }", "protected static function get_image() {\n\t\tif ( ! self::$images ) {\n\t\t\tself::seed_images();\n\t\t}\n\t\treturn self::$images[ array_rand( self::$images ) ];\n\t}", "public function GenerateImage()\n\t{\n if( !$this->_forGeneration )\n throw new Exception(\"This PlanetData cannot be used for generation!\");\n \n\t\t$selectedImage = $this->_class.\"/\";\n\t\t$this->_selectedgroundtype = $this->_groundtype[ mt_rand( 0, count( $this->_groundtype ) -1 ) ];\n\t\t$selectedImage .= $this->_selectedgroundtype.\"/\";\n\t\t$selectedImage .= $this->_images[ mt_rand( 0, count( $this->_images ) -1 ) ].\".jpg\";\n\t\t$this->_generatedimage = $selectedImage;\n\t\treturn $selectedImage;\n\t}", "function getImagePath() \n\t{\n\t\treturn CLIENT_WEB_DIR . \"/survey/$this->obj_id/$this->id/images/\";\n\t}", "function getPhotoPath()\n\t{\n\t\treturn file_exists(\"img/portrait/user$this->id.jpg\") ? \"/img/portrait/user$this->id.jpg\" : \"/img/unavailable.jpg\";\n\t}", "function getPath() {\n\t\tglobal $view_data;\n\t\t\n\t\t$num_paths = count(glob('img/paths/*.png'));\n\n\t\t// Pick the path requested by the GET 'path' param if it's valid\n\t\tif (isset($_GET['path']) AND $_GET['path'] < $num_paths) {\n\t\t\t$path_id = $_GET['path'];\n\t\t}\n\t\t// Otherwise pick random path, hashing based on order customer's name\n\t\telse {\n\t\t\t$path_id = base_convert($view_data['order']['name'], 32, 10) % $num_paths;\n\t\t}\n\n\t\treturn \"img/paths/path{$path_id}.png\";\n\t}", "function select_random_image($dir_path)\n{\n $dir = opendir($dir_path); \n $images_name = array();\n while($file = readdir($dir))\n {\n\t if($file != '.' && $file != '..' && !is_dir($dir_path.$file))\n\t {\n\t \t$images_name[] = $file;\n\t }\n }\n closedir($dir);\n shuffle($images_name);\n return $dir_path.$images_name[0]; \n}", "function randomImage($imagedir) {\n // determine contents of imagedir and store imagefilenames in imagearray\n $dirhandle = opendir ($imagedir);\n if (!$dirhandle)\n return false;\n $j = 0;\n while ($file = readdir ($dirhandle)) {\n if (strstr ($file, \".png\") || strstr($file, \".jpg\") || \n strstr($file,\".gif\") ) {\n $imagearray[$j]=$file;\n $j++;\n }\n }\n $filecount=sizeof ($imagearray);\n // no files\n if (!$filecount)\n return false;\n // 'select' a random file\n srand((double)microtime()*1000000);\n if ($filecount>1)\n $filenr=rand (0,$filecount-1);\n else\n $filenr=0;\n // construct link to randomly selected file\n $filename=$imagearray[$filenr];\n return \"<img src='$imagedir/$filename' alt='Pretty BioPicture here'>\\n\"; \n}", "public function biography_image_path(){\n\t\treturn $this->new_biography_image_file . \"/\" . $this->image_name; \n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create password reset link
public static function createPasswordResetLink($id) { $token = new UPersonToken(); $token->deleteAll(array( 'condition' => 'u_person_id = :u_person_id AND action = :action', 'params' => array( ':u_person_id' => $id, ':action' => Unitkit::v('backend', 'u_person_token_action:resetPassword') ) )); // generate password and normalize $code = UTools::sha512(uniqid(mt_rand(), true) . ':' . UTools::password(500)); // generate uuid $uuid = UTools::sha256(uniqid(mt_rand(), true) . ':' . UTools::password(500)); // expired at $expiredAt = date('Y-m-d H:i:s', time() + (Unitkit::v('backend', 'u_person_token_expired_at:resetPassword') * 3600)); $token->uuid = $uuid; $token->u_person_id = (int) $id; $token->password = CPasswordHelper::hashPassword($code); // hash password $token->action = Unitkit::v('backend', 'u_person_token_action:resetPassword'); $token->expired_at = $expiredAt; $token->save(); $url = Yii::app()->createAbsoluteUrl('/backend/passwordReset/default/validate', array( 'uuid' => $uuid, 'code' => $code )); return UHtml::link($url, $url); }
[ "function ResetPasswordLink($user){\r\n\r\nreturn $this->createAbsoluteURL(USERS.\"/ResetPassword?uh_=\".$this->UserHash($user));\r\n\r\n}", "private function registerPasswordResetUrl(): void\n {\n if (Features::enabled(Features::resetPasswords())) {\n ResetPassword::createUrlUsing(function (CanResetPassword $notifiable, string $token) {\n return url(\n sprintf(\n '%s?token=%s&email=%s',\n rtrim(Config::get('shieldify.password_reset.url'), '/'),\n $token,\n $notifiable->getEmailForPasswordReset()\n )\n );\n });\n }\n }", "public function testCreatePasswordResetLink()\n {\n $user = factory(User::class)->create();\n\n $this->asAdminUser()->post('v2/resets', ['id' => $user->id]);\n $this->assertResponseStatus(200);\n $this->seeJsonStructure(['url']);\n\n $this->seeInDatabase('password_resets', ['email' => $user->email]);\n }", "public function makeLink() \n {\n return \"https://auth.zrobleno.com.ua/newpassword/{$this->token}\";\n }", "function getResetPasswordUrl() {\n \treturn assemble_url('reset_password', array(\n \t 'user_id' => $this->getId(),\n \t 'code' => $this->getPasswordResetKey(),\n \t));\n }", "public function sendForgotPasswordLink(){\n return $this->repository->sendForgotPasswordLink();\n }", "public function changePasswordLinkAction()\n {\n $userId = $this->getRequest()->getParam('id');\n $user = $this->getEntityManager()->getRepository(\\Application\\Model\\User::class)->findOneById($userId);\n if (!$user) {\n return;\n }\n\n $user->generateToken();\n $this->getEntityManager()->flush();\n\n $subject = 'Reset password';\n $mailParams = [\n 'token' => $user->getToken(),\n ];\n\n $this->sendMail($user, $subject, new ViewModel($mailParams));\n }", "public function get_pass_reset_url()\n {\n $timestamp = date('U');\n $hash = $this->get_pass_reset_hash($timestamp);\n\n return URL::to_action('user::user@reset', array($this->id, $timestamp, $hash));\n }", "public static function getResetPasswordLink() {\n if (!static::isLoggedIn()) {\n $link_text = apply_filters('core_standards/user_login_form/link_text_reset_password', __('Reset Password'));\n return '<a href=\"/wp-login.php?action=lostpassword\" class=\"user-login-form-reset-password-link\">' . $link_text . '</a>';\n }\n }", "public function sendResetLink()\n {\n try {\n\n $post = Input::all();\n\n // Check if the user exists\n $email = $post['email-reset'];\n\n $user = User::where('email', $email)->firstOrFail();\n\n $resetCode = $user->getResetPasswordCode();\n\n $url = URL::route('user.resetPassword', [$resetCode]);\n\n // TODO: Make message multilanguage\n\n $message = '<html><body><p>Klik op de volgende link om uw wachtwoord opnieuw in te stellen: <a href=\"'. $url . '\">' . $url . '</a></p></body></html>';\n\n \t $headers = \"MIME-Version: 1.0\\n\";\n $headers .= \"Content-Type: text/html; charset=ISO-8859-1\\n\";\n\n $result = mail($email, 'Educal: Reset wachtwoord', $message, $headers);\n\n \\Log::info(\"Sent an email to $email, with the reset link: \" . $url);\n\n return Redirect::route('landing')\n ->withInput(['email-success' => 'Er werd een mail gestuurd met verdere instructies.']);\n\n } catch (ModelNotFoundException $ex) {\n\n return Redirect::route('landing')\n ->withInput(['email-reset' => $email])\n ->withErrors([\"message\" => \"Het email adres werd niet gevonden.\"]);\n }\n\n }", "public function generatePasswordResetToken();", "protected function sendPasswordResetEmail() {\r\n $url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . \\App\\Config::SITE_NAME . '/password/reset/' . $this->password_reset_token;\r\n \r\n $text = \"Please click on the following URL to reset your password: $url\";\r\n $html = \"Please click <a href=\\\"$url\\\">here</a> to reset your password.\";\r\n \r\n Mail::send($this->email, 'Password reset', $text, $html);\r\n }", "private function getLinkToReset(){\n\t\treturn \"<a href='?\" . self::$resetURL .\"'>Give me a new word!</a>\";\n\t}", "protected function sendPasswordResetEmail()\n {\n $url = 'http://' . $_SERVER['HTTP_HOST'] . '/password/reset/' . $this->password_reset_token;\n\n $text = View::getTemplate('Password/reset_email.txt', ['url' => $url]);\n $html = View::getTemplate('Password/reset_email.html', ['url' => $url]);\n //var_dump($url);\n Mail::send($this->email, 'Changement de mot de passe', $text, $html);\n }", "function BUSINESS_USER_FORGOT_PASSWORD_LINK($token){\n\n\t\treturn url('/').'/'.GETSEGMENT(2).'/'.VERIFY_BUSINESS_USER_FORGOT_PASS_URL().''.Crypt::encrypt($token);\n\t}", "public function generateResetPasswordLinkToken()\n {\n return Mage::helper('core')->uniqHash();\n }", "public function getForgotPasswordUrl() {\n /**\n * Get forgot password url\n */\n return $this->urlBuilder->getUrl ( 'customer/account/forgotpassword' );\n }", "public function generatePasswordResetToken()\n {\n }", "function linkPassword () {\n $email = $this->input->post('email');\n\n $usuario = $this->user_m->get(['email'=>$email], True);\n if ($usuario) {\n $fecha = date('YmdHi');\n $parametros = $fecha . ';' . $email;\n $link = site_url('cart/recuperarPassword') . '/' . 'R' . '/' . str_replace('/', '[]' , $this->encrypt->encode($parametros));\n $to = $email;\n $from = $this->data['home']->mailEnvio;\n $headers = \"From: \" . $from . \"\\r\\n\";\n $headers .= \"Content-Type: text/html; charset=ISO-8859-1\\r\\n\";\n $subject = \"Recuperar Contraseña\";\n $body = \"<html><body>\";\n $body .= \"<h1>Recuperación de Contraseña</h1>\n <p>Para cambiar su contraseña haga click sobre el siguiente link:</p>\n <p><a href='\" . $link . \"'>Recuperar Contraseña</a></p>\n <h4>Atte. El equipo de VQV</h4>\";\n $body .= \"</body></html>\";\n echo $body;\n try {\n // mail($to, $subject, $body, $headers, \"-f \" . $from) ;\n } finally {\n\n }\n } else {\n echo \"Email no registrado!\";\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Information whether current user can see all posts on community's wall
public function getCanSeeAllPosts() { return $this->can_see_all_posts; }
[ "function bbp_current_user_can_publish_forums()\n{\n}", "function userCanWriteInForum() {\r\n\t\treturn $this->isVisible();\r\n\t}", "public function hasPostingStoryPermissions()\n {\n $stats = $this->UserStats;\n if($stats->storys_total >= 1)\n {\n return true;\n }\n\n return true;\n //return $stats->yiggs_total >= sfConfig::get(\"app_user_minYiggs\", 100)\n //&& $stats->friends_total >= sfConfig::get(\"app_user_minFriends\", 3);\n }", "private function _check_socials_access() {\n return Access_token::inst()->check_socials_access($this->c_user->id);\n }", "private function _check_socials_access() {\n\n return Access_token::inst()->check_socials_access($this->c_user->id);\n\n }", "public function getCanPostToPages()\n\t{\n\t\ttry {\n\t\t\tif (!$this->fb) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$permissions = (new FacebookRequest(\n\t\t\t\t$this->fb, 'GET', '/me/permissions'\n\t\t\t))->execute()->getGraphObject();\n\t\t\tforeach($permissions->asArray() as $permission) {\n\t\t\t\tif (($permission->permission == 'publish_actions' || $permission->permission == 'manage_pages') && $permission->status == 'granted') {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// else\n\t\t\treturn false;\n\t\t} catch (Exception $e) {\n\t\t\t// may not be logged in\n\t\t}\n\t}", "function is_post_publicly_viewable($post = \\null)\n {\n }", "public function userWantsToViewPost() : bool {\n return $this->hasQueryString($this->forumLayout->getPostLink()) && $this->getRequestPostId() !== \"\";\n }", "public static function canManage() {\n\t\treturn in_array(Session::getRole(),self::$_publishers);\n\t}", "function oublog_can_view_post($post, $user, $context, $personalblog) {\n\n // Public visibility means everyone\n if($post->visibility==OUBLOG_VISIBILITY_PUBLIC) {\n return true;\n }\n // Logged-in user visibility means everyone logged in, but no guests\n if($post->visibility==OUBLOG_VISIBILITY_LOGGEDINUSER &&\n (isloggedin() && !isguestuser())) {\n return true;\n } elseif ($post->visibility==OUBLOG_VISIBILITY_LOGGEDINUSER) {\n return false;\n }\n \n if($post->visibility!=OUBLOG_VISIBILITY_COURSEUSER) {\n error('Invalid visibility level '. $post->visibility);\n }\n\n // Otherwise this is set to course visibility\n if($personalblog) {\n return $post->userid==$user->id;\n } else {\n // Check oublog:view capability at module level\n // This might not have been checked yet because if the blog is\n // set to public, you're allowed to view it, but maybe not this\n // post.\n return has_capability('mod/oublog:view',$context, $user->id);\n }\n}", "function hasPostCommentsPermission() {\n\t\treturn( $this->hasUserPermission( 'p_liberty_post_comments' ));\n\t}", "function yz_is_user_can_pin_posts() {\r\n\r\n\tif ( ! is_user_logged_in() || ! yz_is_sticky_posts_active() ) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif ( bp_is_active( 'activity' ) && bp_is_active( 'groups' ) && bp_is_groups_component() && bp_group_is_admin() && bp_is_group_activity() ) {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t// Get Current User Data.\r\n\t$user = wp_get_current_user();\r\n\r\n\t// Allowed Roles\r\n\t$allowed_roles = array( 'administrator' );\r\n\t\r\n\t// Filter Roles.\r\n\t$allowed_roles = apply_filters( 'yz_allowed_roles_to_pin_posts', $allowed_roles );\r\n\r\n\tforeach ( $allowed_roles as $role ) {\r\n\t\tif ( in_array( $role, (array) $user->roles ) ) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}", "public function viewAny(User $user)\n {\n return $user->hasPerm('posts');\n }", "public function viewAny()\n {\n return auth()->user()->can('permission_access');\n }", "private function _getPostingPermissions()\n\t{\n\t\tif ($this->group->published != 1)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tswitch ($this->params->get('posting'))\n\t\t{\n\t\t\tcase 1:\n\t\t\t\tif ($this->authorized == 'manager' || $this->authorized == 'admin')\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase 0:\n\t\t\tdefault:\n\t\t\t\tif ($this->authorized == 'member' || $this->authorized == 'manager' || $this->authorized == 'admin')\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\treturn false;\n\t}", "public function getUsageCanBlog();", "public function canBeViewed()\n\t{\n\t\treturn $this->isPublished()\n\t\t\t|| ($this->getPostStatus() === 'private' && Mage::getSingleton('customer/session')->isLoggedIn());\n\t}", "public function access($user)\n {\n return User::findOrFail($user->id)->hasPermission('laralum::blog.posts.access');\n }", "public function isSocialUser();" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Data provider for [[testAdjustCssUrl()]].
public function adjustCssUrlDataProvider() { return [ [ '.published-same-dir-class {background-image: url(published_same_dir.png);}', '/test/base/path/assets/input', '/test/base/path/assets/output', '.published-same-dir-class {background-image: url(../input/published_same_dir.png);}', ], [ '.published-relative-dir-class {background-image: url(../img/published_relative_dir.png);}', '/test/base/path/assets/input', '/test/base/path/assets/output', '.published-relative-dir-class {background-image: url(../img/published_relative_dir.png);}', ], [ '.static-same-dir-class {background-image: url(\'static_same_dir.png\');}', '/test/base/path/css', '/test/base/path/assets/output', '.static-same-dir-class {background-image: url(\'../../css/static_same_dir.png\');}', ], [ '.static-relative-dir-class {background-image: url("../img/static_relative_dir.png");}', '/test/base/path/css', '/test/base/path/assets/output', '.static-relative-dir-class {background-image: url("../../img/static_relative_dir.png");}', ], [ '.absolute-url-class {background-image: url(http://domain.com/img/image.gif);}', '/test/base/path/assets/input', '/test/base/path/assets/output', '.absolute-url-class {background-image: url(http://domain.com/img/image.gif);}', ], [ '.absolute-url-secure-class {background-image: url(https://secure.domain.com/img/image.gif);}', '/test/base/path/assets/input', '/test/base/path/assets/output', '.absolute-url-secure-class {background-image: url(https://secure.domain.com/img/image.gif);}', ], [ "@font-face { src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'); }", '/test/base/path/assets/input/css', '/test/base/path/assets/output', "@font-face { src: url('../input/fonts/glyphicons-halflings-regular.eot'); src: url('../input/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'); }", ], [ "@font-face { src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'); }", '/test/base/path/assets/input/css', '/test/base/path/assets', "@font-face { src: url('input/fonts/glyphicons-halflings-regular.eot'); src: url('input/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'); }", ], [ "@font-face { src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT==) format('truetype'); }", '/test/base/path/assets/input/css', '/test/base/path/assets/output', "@font-face { src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT==) format('truetype'); }", ], [ '.published-same-dir-class {background-image: url(published_same_dir.png);}', 'C:\test\base\path\assets\input', 'C:\test\base\path\assets\output', '.published-same-dir-class {background-image: url(../input/published_same_dir.png);}', ], [ '.static-root-relative-class {background-image: url(\'/images/static_root_relative.png\');}', '/test/base/path/css', '/test/base/path/assets/output', '.static-root-relative-class {background-image: url(\'/images/static_root_relative.png\');}', ], [ '.published-relative-dir-class {background-image: url(../img/same_relative_dir.png);}', '/test/base/path/assets/css', '/test/base/path/assets/css', '.published-relative-dir-class {background-image: url(../img/same_relative_dir.png);}', ], [ 'img {clip-path: url(#xxx)}', '/test/base/path/css', '/test/base/path/assets/output', 'img {clip-path: url(#xxx)}', ], ]; }
[ "public function testCSSFunction()\n {\n // Test a single value\n $this->assertEquals(\n '<link href=\"foo\" rel=\"stylesheet\">',\n $this->transpiler->callViewFunction('css', 'foo')\n );\n\n // Test multiple values\n $this->assertEquals(\n '<link href=\"foo\" rel=\"stylesheet\">' .\n \"\\n\" .\n '<link href=\"bar\" rel=\"stylesheet\">',\n $this->transpiler->callViewFunction('css', ['foo', 'bar'])\n );\n }", "public function testCss() {\r\n $this->__test('css');\r\n }", "public function testStyleTagWithExternalBaseUrl()\n {\n Configure::write('App.cssBaseUrl', 'https://example.com/css/');\n\n $this->_copyWithoutVersion();\n\n $result = $this->AssetMix->css('main');\n\n $this->assertStringContainsString('https://example.com/css/main.css', $result);\n }", "public function getCssSources(){ }", "protected function applyUrl()\n\t{\n\t\t// CSS\n\t\t$nodes = $this->dom->getElementsByTagName('link');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('href');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('href', $url);\n\t\t\t}\n\t\t}\n\t\t// JS\n\t\t$nodes = $this->dom->getElementsByTagName('script');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('src');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('src', $url);\n\t\t\t}\n\t\t}\n\t\t// Image\n\t\t$nodes = $this->dom->getElementsByTagName('img');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('src');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('src', $url);\n\t\t\t}\n\t\t}\n\t\t// Anchor\n\t\t$nodes = $this->dom->getElementsByTagName('a');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('href');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->base_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('href', $url);\n\t\t\t}\n\t\t}\n\t}", "public function getAdditionalCssLinkReturnsLinkTest() {\n\t\t$pid = 115;\n\t\t$this->testingFramework->createRecord('tx_sfbanners_domain_model_banner', array('pid' => $pid,\n\t\t\t'margin_left' => 10, 'margin_right' => 10, 'sorting' => 1));\n\n\t\t/* Get banner from Repository */\n\t\t$this->demand->setStartingPoint($pid);\n\t\t$banners = $this->bannerRepository->findDemanded($this->demand);\n\n\t\t$result = $this->bannerService->getAdditionalCssLink($banners);\n\t\t$this->assertContains('<link rel=\"stylesheet\" type=\"text/css\" href=', $result);\n\t\t$this->assertContains('typo3temp/stylesheet_', $result);\n\t\t$this->assertContains('.css', $result);\n\t\t$this->assertContains('media=\"all\" />', $result);\n\t}", "function testDataAttributeIsUsed() {\n $this->html2css->paths = array();\n $this->html2css->parse_html('<a href=\"#\" data-test=\"test\"></a>');\n $this->assertEquals('a[data-test=\"test\"] { }', $this->html2css->generateCSS());\n }", "public function DataForTestReplaceUrlsProvider() {\n $tests = array();\n\n $tests[] = array(\n 'to re and then so that we.',\n 'to re http://www.phpliveregex.com/ and then https://oscarotero.com/embed3/demo/index.php?url=https%3A%2F%2Ftwitter.com%2Fgoproject%2Fstatus%2F941051874282754048 so that we.',\n );\n\n $tests[] = array(\n '“Educational initiatives that include time in nature are shown to serve children\\'s physical and mental health as well as boost academic performance:',\n '“Educational initiatives that include time in nature are shown to serve children\\'s physical and mental health as well as boost academic performance: HTTP://t.co/RPwUa7fpks”',\n );\n $tests[] = array(\n '“Educational initiatives that include time in nature are shown to serve children\\'s physical and mental health as well as boost academic performance:',\n '“Educational initiatives that include time in nature are shown to serve children\\'s physical and mental health as well as boost academic performance: http://t.co/RPwUa7fpks”',\n );\n $tests[] = array(\n '“Educational initiatives that include time in nature are shown to serve children\\'s physical and mental health as well as boost academic performance:',\n '“Educational initiatives that include time in nature are shown to serve children\\'s physical and mental health as well as boost academic performance: https://t.co/RPwUa7fpks”',\n );\n\n return $tests;\n }", "function getCssUrl($request) {\n\t\treturn $request->getBaseUrl() . '/' . $this->getPluginPath() . '/css';\n\t}", "public function testGetLayoutDataSetting()\n {\n }", "public function testInfoStylesheets() {\n return [\n '#attached' => [\n 'library' => [\n 'theme_test/theme_stylesheets_override_and_remove_test',\n ],\n ],\n ];\n }", "public function testCustomCoverStyle()\n {\n self::customCoverStyle();\n }", "function get_the_css_urls() {\n\n md_get_the_css_urls();\n \n }", "private function _setCSSValue() {\n $this->css_value = array(\n 'bootstrap' => COMP_URL . 'bootstrap/dist/css/bootstrap.min.css',\n 'animate' => COMP_URL . 'animate.css/animate.min.css',\n //'common' => CSS_URL . 'common.min.css',\n 'font-awesome' => COMP_URL . 'font-awesome/css/font-awesome.min.css',\n 'line-icon' => COMP_URL . 'simple-line-icons/css/simple-line-icons.min.css',\n 'default' => CSS_URL . 'font.min.css',\n //'ui-tree' => COMP_URL . 'angular-ui-tree/dist/angular-ui-tree.min.css',\n 'app' => CSS_URL . 'app.min.css',\n 'sweetalert' => COMP_URL . 'sweet-alert/css/sweet-alert.min.css',\n 'sweetalert-ie9' => COMP_URL . 'sweet-alert/css/ie9.min.css'\n );\n }", "public function testCssAndScriptWithSameName(): void\n {\n $result = $this->Html->css('foo');\n $expected = [\n 'link' => ['rel' => 'stylesheet', 'href' => 'preg:/.*css\\/foo\\.css/'],\n ];\n $this->assertHtml($expected, $result);\n\n $result = $this->Html->script('foo');\n $expected = [\n 'script' => ['src' => 'js/foo.js'],\n ];\n $this->assertHtml($expected, $result);\n }", "public final function getCssUrl()\n {\n return $this->_getUrl('css');\n }", "public function differentSizesDataProvider() {}", "public function testCssFiles() {\n $this->manager = $this->container->get('plugin.manager.ckeditor.plugin');\n $editor = Editor::load('filtered_html');\n\n // Case 1: no CKEditor iframe instance CSS file.\n $this->assertSame([], $this->manager->getCssFiles($editor), 'No iframe instance CSS file found.');\n\n // Enable the CKEditor Test module, which has the LlamaCss plugin and\n // clear the editor manager's cache so it is picked up.\n $this->enableModules(['ckeditor_test']);\n $this->manager = $this->container->get('plugin.manager.ckeditor.plugin');\n $settings = $editor->getSettings();\n // LlamaCss: automatically enabled by adding its 'LlamaCSS' button.\n $settings['toolbar']['rows'][0][0]['items'][] = 'LlamaCSS';\n $editor->setSettings($settings);\n $editor->save();\n\n // Case 2: CKEditor iframe instance CSS file.\n $expected = [\n 'llama_css' => [$this->getModulePath('ckeditor_test') . '/css/llama.css'],\n ];\n $this->assertSame($expected, $this->manager->getCssFiles($editor), 'Iframe instance CSS file found.');\n }", "public function testGetStyle()\n\t{\n\t\t$this->assertThat(\n\t\t\t$this->instance->getStyle(),\n\t\t\t$this->equalTo('31;47;5')\n\t\t);\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array of useless array keys This useless contact fields later will be removed, in 'reformatContact'
static public function getUselessContactData() { return array( 'id', 'customer_id', 'comment', 'created', 'updated', 'is_filled', 'birthday', 'url', 'company_url', 'company_vatin', 'company_kvk', 'company_address', ); }
[ "function UnusedFields()\n {\n $unuseds=array();\n foreach (array_keys($this->TableFields) as $data)\n {\n if (!isset($this->ItemData[ $data ]))\n {\n array_push($unuseds,$data);\n }\n }\n\n return $unuseds;\n }", "public function getContactgegevens() {\n\t\treturn array_filter_empty(array(\n\t\t\t'Email' => $this->getPrimaryEmail(),\n\t\t\t'LinkedIn' => $this->linkedin,\n\t\t\t'Website' => $this->website\n\t\t));\n\t}", "protected function _getKeys() {\n\t\t$keys = $this->Acl->Aro->Permission->schema();\n\t\t$newKeys = array();\n\t\t$keys = array_keys($keys);\n\t\tforeach ($keys as $key) {\n\t\t\tif (!in_array($key, array('id', 'aro_id', 'aco_id'))) {\n\t\t\t\t$newKeys[] = $key;\n\t\t\t}\n\t\t}\n\t\treturn $newKeys;\n\t}", "public function getContactDataFields();", "public function getContactsFields() {\n\t\t$contactsfields = array(\t\n\t\t\t\t\t'salutationtype',\n\t\t\t\t\t'firstname', //set to 'Customer'\n\t\t\t\t\t'lastname',\n\t\t\t\t\t'phone',\n\t\t\t\t\t'otherphone',\n\t\t\t\t\t'fax',\n\t\t\t\t\t'email',\n\t\t\t\t\t'mailingstreet',\n\t\t\t\t\t'mailingcity',\n\t\t\t\t\t'mailingstate',\n\t\t\t\t\t'mailingzip',\n\t\t\t\t\t'mailingcountry',\n\t\t\t\t\t'otherstreet',\n\t\t\t\t\t'othercity',\n\t\t\t\t\t'otherstate',\n\t\t\t\t\t'otherzip',\n\t\t\t\t\t'othercountry',\n\t\t\t);\t//TO-DO: to handle vatid\n\t\treturn $contactsfields;\n\t}", "public function keys() {\r\n\t\t\treturn array_keys( $this->fields );\r\n\t\t}", "function get_contact_columns()\n\t{\n\t\t$fields = $this->get_fields('all');\n\t\tforeach ((array)$this->customfields as $cfield => $coptions)\n\t\t{\n\t\t\t$fields[] = '#'.$cfield;\n\t\t}\n\t\treturn $fields;\n\t}", "protected function getNonVersionArrayKeys()\n {\n return array('description', 'alternative');\n }", "public function getLayoutFormFieldKeys(): array\n {\n return array_unique($this->getNestedFormFieldKeys());\n }", "protected function getUnmappedFields()\n {\n return [];\n }", "public function getNonHiddenWiredFieldNames() : array // used by WordPressConnector\n {\n $fields = array();\n \n if( $this->getProperty()->authorFieldVisibility != self::HIDDEN )\n $fields[] = self::AUTHOR;\n if( $this->getProperty()->descriptionFieldVisibility != self::HIDDEN )\n $fields[] = self::DESCRIPTION;\n if( $this->getProperty()->displayNameFieldVisibility != self::HIDDEN )\n $fields[] = self::DISPLAYNAME;\n if( $this->getProperty()->keywordsFieldVisibility != self::HIDDEN )\n $fields[] = self::KEYWORDS;\n if( $this->getProperty()->summaryFieldVisibility != self::HIDDEN )\n $fields[] = self::SUMMARY;\n if( $this->getProperty()->teaserFieldVisibility != self::HIDDEN )\n $fields[] = self::TEASER;\n if( $this->getProperty()->titleFieldVisibility != self::HIDDEN )\n $fields[] = self::TITLE;\n \n return $fields;\n }", "public function getNonMetadataFields(): array\n\t{\n\t\t$values = $this->fields;\n\t\t$values['name'] = $this->name;\n\t\t$values['slug'] = $this->slug;\n\t\t$values['_archived'] = $this->archived;\n\t\t$values['_draft'] = $this->draft;\n\n\t\treturn $values;\n\t}", "public function getContactFields()\n {\n return $this->getFields('Contact');\n }", "public function get_all_fields()\n {\n $raw_fields = get_object_vars($this);\n return array_diff_key($raw_fields, array('__one'=>'', '__many'=>'', '__manager'=>'', '__functions'=>'', '__constraints'=>''));\n }", "public function getFieldNamesWithoutPK();", "function getNonUniqueFields() {\n\t\t$res = array();\n\t\tforeach ( $this->getFields() as $field ) {\n\t\t\t$add = true;\n\t\t\tforeach ( $this->getIndexes()->getFieldsInUniqueKey() as $indexName => $fields ) {\n\t\t\t\tforeach ( $fields as $seqID => $indexField ) {\n\t\t\t\t\tif ( $field->getField() == $indexField->getColumnName() ) {\n\t\t\t\t\t\t$add = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif ( $add === true ) {\n\t\t\t\t$res[] = $field;\n\t\t\t}\n\t\t}\n\t\treturn $res;\n\t}", "public function getFieldKeys()\n {\n return array_keys($this->getFields());\n }", "protected function getNonVersionArrayKeys()\n {\n return array();\n }", "public function getMetaFieldKeys()\n {\n return array_keys($this->getFields());\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if 'uin' property is set, false otherwise
public function hasUin() { return $this->get(self::UIN) !== null; }
[ "public function hasUid()\n {\n return $this->get(self::UID) !== null;\n }", "public function uKeyExists() {\n\t\tif (isset($this->u_obj->u_key) && !empty($this->u_obj->u_key)) return true;\n\t\treturn false;\n\t}", "public function hasInn()\n {\n return $this->Inn !== null;\n }", "public function hasUpcIdType()\n {\n return $this->hasExtra('upc') && !empty($this->extras['upc']);\n }", "public function isUnoMember() {\n\t\treturn $this->getUnoMember();\n\t}", "public function hasSKU()\r\n {\r\n return !is_null($this->fields['SKU']['value']);\r\n }", "function isInUHCD ( ) { return $this->ifInUHCD() ; }", "public function getIsUnisexAttribute()\n {\n $identity = json_decode($this->identity);\n\n return in_array('UNISEX', $identity);\n }", "public function isEuMember()\n {\n return $this->get('extra.eu_member');\n }", "public function hasUserid()\n {\n return $this->get(self::USERID) !== null;\n }", "public function hasIata() : bool\n {\n return isset($this->iata);\n }", "public function isUttMember()\n\t{\n\t\treturn $this->isUser() && ! $this->user->getIsStudent() && ! $this->user->getKeepActive();\n\t}", "public function hasEUserInfo()\n {\n return $this->get(self::E_USER_INFO) !== null;\n }", "public function hasUuid() : bool\n {\n return isset($this->uuid);\n }", "public function isSetSku()\n {\n return !is_null($this->_fields['Sku']['FieldValue']);\n }", "function hasOptedOut($uid)\r\n {\r\n $uid = $this->dbh->sql_safe($uid);\r\n \r\n $sql = 'SELECT * '\r\n . 'FROM private_message_optout '\r\n . 'WHERE pmo_u_id = ' . $uid; \r\n \r\n $rs = $this->dbh->query_all($sql);\r\n $numRows = count($rs);\r\n if( $numRows == 0 )\r\n {\r\n return false;\r\n }\r\n else \r\n {\r\n return true;\r\n }\r\n }", "public function isUnMember() {\n\t\treturn $this->getUnMember();\n\t}", "public function hasValue()\n {\n return (isset($this->identity) || isset($this->instance));\n }", "public function isSetASIN()\n {\n return !is_null($this->_fields['ASIN']['FieldValue']);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests the behavior of fread when opening a file in writeonly mode
public function testFreadWhenWriteOnly() { $filename = static::$baseFile . '/fs/tmp.txt'; $fp = fopen($filename, 'w'); $this->assertSame(3, fwrite($fp, 'foo')); fseek($fp, 0); $this->assertSame('', fread($fp, 3)); fclose($fp); $this->assertSame('foo', file_get_contents($filename)); }
[ "public function testFwriteWhenReadOnly()\n {\n $filename = static::$baseFile . '/fs/tmp.txt';\n\n touch($filename);\n $fp = fopen($filename, 'r');\n $this->assertSame(0, fwrite($fp, 'foo'));\n fclose($fp);\n\n $this->assertSame('', file_get_contents($filename));\n }", "public function testFlockWithFilePutContents(): void\n {\n $processor = new StreamProcessor();\n $processor->intercept();\n\n $testData = 'test data';\n $testFilePath = 'tests/fixtures/file_put_contents';\n $res = file_put_contents($testFilePath, $testData, LOCK_EX);\n unlink($testFilePath);\n\n $processor->restore();\n $this->assertEquals(strlen($testData), $res);\n }", "public function testFlockWithFilePutContents(): void\n {\n $processor = new StreamProcessor();\n $processor->intercept();\n\n $testData = 'test data';\n $testFilePath = 'tests/fixtures/file_put_contents';\n $res = file_put_contents($testFilePath, $testData, \\LOCK_EX);\n unlink($testFilePath);\n\n $processor->restore();\n $this->assertEquals(\\strlen($testData), $res);\n }", "public function testGetChmod()\n {\n file_put_contents(self::$temp . DS . 'file.txt', 'Hello World');\n chmod(self::$temp . DS . 'file.txt', 0755);\n\n $actual = Storage::chmod(self::$temp . DS . 'file.txt');\n $expected = ('\\\\' === DS) ? '0666' : '0755';\n\n $this->assertTrue($expected === $actual);\n }", "function fread($handle, $length)\n{\n if (\\PhowerTest\\Http\\StreamTest::$freadReturns !== null) {\n return \\PhowerTest\\Http\\StreamTest::$freadReturns;\n }\n return \\fread($handle, $length);\n}", "public function testReadFile()\n {\n $file_name = $this->getTestFileName();\n $content = 'file content';\n $this->expectFileOperations($file_name);\n file_put_contents($file_name, $content);\n $this->assertEquals($content, $this->local_machine->readFile($file_name));\n }", "public function testAssertFileNotIsWritable() {\n\t\t$tempFile = \\tempnam( \\sys_get_temp_dir(), 'not_writable' );\n\t\t\\chmod( $tempFile, \\octdec( '0' ) );\n\n\t\t$this->assertFileNotIsWritable( $tempFile );\n\n\t\t\\chmod( $tempFile, \\octdec( '755' ) );\n\t\t\\unlink( $tempFile );\n\t}", "public function testIsWritable(): void\n {\n $this->assertFalse($this->createReadOnlyStream()->isWritable());\n $this->assertTrue($this->createWriteOnlyStream()->isWritable());\n $this->assertTrue($this->createReadWriteStream()->isWritable());\n\n // The method should not throw even if the resource is not valid.\n $stream = $this->createReadWriteStream();\n $stream->close();\n $this->assertFalse($stream->isWritable());\n }", "function fread ($handle, $length) {}", "public function testSeekThrowsIfFSeekFails(): void\n {\n $this->expectExceptionMessage(\"Call to fseek() failed.\");\n $stream = $this->createReadWriteStream();\n $stream->fseekOverride = -1;\n $stream->seek(0);\n }", "public function testConsecutiveReadWrite(): void\n {\n Cache::write('rw', 'first write', 'file_test');\n $result = Cache::read('rw', 'file_test');\n\n Cache::write('rw', 'second write', 'file_test');\n $resultB = Cache::read('rw', 'file_test');\n\n Cache::delete('rw', 'file_test');\n $this->assertSame('first write', $result);\n $this->assertSame('second write', $resultB);\n }", "public function isSeekable()\n\t{\n\t}", "public function testWrite()\n {\n\n // prepare the filename that has to be created\n $filename = '/var/www/html/test.txt';\n\n // mock the filesystem\n $mockFilesystem = $this->getMockBuilder('TechDivision\\Import\\Adapter\\FilesystemAdapterInterface')\n ->setMethods(get_class_methods('TechDivision\\Import\\Adapter\\FilesystemAdapterInterface'))\n ->getMock();\n $mockFilesystem->expects($this->once())\n ->method('write')\n ->with($filename, $data = 'test test test')\n ->willReturn(14);\n $mockFilesystem->expects($this->exactly(2))\n ->method('isFile')\n ->withConsecutive(\n array($filename),\n array($filename)\n )\n ->willReturnOnConsecutiveCalls(false, true);\n\n // set the mock filesystem\n $this->filesystemTrait->setFilesystemAdapter($mockFilesystem);\n\n // assert that the file has been created\n $this->assertFalse($this->filesystemTrait->isFile($filename));\n $this->assertSame(14, $this->filesystemTrait->write($filename, $data));\n $this->assertTrue($this->filesystemTrait->isFile($filename));\n }", "public function test_write_to_file_method_when_no_file_is_present()\n {\n unlink($this->file['location'] . $this->file['name']);\n\n $result = File::write_to_file(\n $this->file['location'] . $this->file['name'],\n $this->line\n );\n\n $this->assertNotNull($result);\n $this->assertIsInt($result);\n\n $this->assertFalse(File::write_to_file(NULL, NULL));\n }", "#[@test]\n public function overwritingExistant() {\n with ($data= 'Hello World', $appear= 'This should not appear'); {\n $this->writeData($this->file, $appear);\n $this->writeData($this->file, $data);\n\n $this->file->open(FILE_MODE_READ);\n $this->assertEquals($data, $this->file->read(strlen($data)));\n $this->file->close();\n }\n }", "function is_writable ($filename) {}", "function is_really_writable($file) {\n // If we're on a Unix server with safe_mode off we call is_writable\n if (DIRECTORY_SEPARATOR == '/' AND @ini_get(\"safe_mode\") == FALSE) {\n return is_writable($file);\n }\n\n // For windows servers and safe_mode \"on\" installations we'll actually\n // write a file then read it. Bah...\n if (is_dir($file)) {\n $file = rtrim($file, '/') . '/' . md5(mt_rand(1, 100) . mt_rand(1, 100));\n\n if (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) {\n return FALSE;\n }\n\n fclose($fp);\n @chmod($file, DIR_WRITE_MODE);\n @unlink($file);\n return TRUE;\n }\n elseif (!is_file($file) OR ($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) {\n return FALSE;\n }\n\n fclose($fp);\n return TRUE;\n}", "public function testInvokeReturnsStringIfTheFileIsReadable()\n {\n $filename = vfsStream::url('test/foo.txt');\n \n $contents = 'foo';\n \n file_put_contents($filename, $contents);\n \n $this->assertEquals($contents, (new Read())($filename));\n \n return; \n }", "public function testFileSaveData() {\n $contents = $this->randomMachineName(8);\n $this->setSetting('file_chmod_file', 0777);\n\n // No filename.\n /** @var \\Drupal\\Core\\File\\FileSystemInterface $file_system */\n $file_system = \\Drupal::service('file_system');\n\n // Provide a filename.\n $filepath = $file_system->saveData($contents, 'public://asdf.txt', FileSystemInterface::EXISTS_REPLACE);\n $this->assertNotFalse($filepath, 'Unnamed file saved correctly.');\n $this->assertEquals('asdf.txt', \\Drupal::service('file_system')->basename($filepath), 'File was named correctly.');\n $this->assertEquals($contents, file_get_contents($filepath), 'Contents of the file are correct.');\n $this->assertFilePermissions($filepath, 0777);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a channel variable. Pass false as $channel to set a global variable.
public function SetVar($channel, $variable, $value);
[ "public function setChannel(int $channel): void\n {\n }", "public function setChannel($channel)\n {\n if (strpos($channel, '#') !== 0) {\n $channel = \"#{$channel}\";\n }\n\n $this->channel = $channel;\n }", "function ts3client_setChannelVariableAsInt($serverConnectionHandlerID, $channelID, $flag, $value) {}", "public function channel($channel)\n {\n $this->channel = $channel;\n }", "public function setChannel($channel) {\n\t\t$this->hw_channel = $channel;\n\t}", "public function setChannel(ChannelInterface $channel = null);", "public function setDefaultChannel($channel)\n {\n $this->channel = $channel;\n }", "public function setChannelId()\n {\n }", "public function reset_global_channel() {\n\t\treturn $this->set_global_channel( static::DEFAULT_CHANNEL );\n\t}", "public function paymentChannel($channel = false)\n {\n $this->channel = $this->config['payment_channel'];\n\n if ( $channel )\n $this->channel = $channel;\n }", "public function setChannel($value)\n {\n return $this->set(self::channel, $value);\n }", "function setChannel($channel)\n {\n if (! preg_match('/^[a-z\\-_\\.]+$/i', $channel)) {\n return PEAR::raiseError(\"'$channel' is not a valid pear installer channel name\");\n }\n\n $this->channel = $channel;\n }", "public function setChannelId($value)\n {\n $this->_channelId = $value;\n }", "public static function setChannelType($type)\n {\n self::$_channelType = $type;\n\n }", "public function setActiveReleaseChannelId($channel)\n {\n $general = Config::getInstance()->General;\n $general['release_channel'] = $channel;\n Config::getInstance()->General = $general;\n }", "public function channel_set( $args ) {\n\n\t\t$addon = $this->get_addon( $args[0], true );\n\t\t$addon->subscribe_to_channel( $args[1] );\n\t\treturn \\WP_CLI::success( sprintf( 'Subscribed to the %s channel.', $args[1] ) );\n\n\t}", "public function setChannelStatus($channel)\n {\n if ((bool) $this->getConfig('FeedTicker.smartReader', false)) {\n $this->plugins->getPlugin('UserInfo');\n $users = $this->plugins->getPlugin('UserInfo')->getUsers($channel);\n if (count($users) > 1) {\n $this->channelsStatus[$channel] = time();\n } else {\n unset($this->channelsStatus[$channel]);\n }\n }\n }", "public function setChannel($var)\n {\n GPBUtil::checkString($var, True);\n $this->Channel = $var;\n\n return $this;\n }", "public function setSearchChannel($channelStr) {\n\t\tif (!isset($channelStr)) {return;}\n\t\t$this->channel = $channelStr;\n//\t\t$this->getBy = self::GET_BY_CHANNEL;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new primary key descriptor to be used by this descriptor.
public function newPrimaryKey($name) { // TODO: More options directly in this method $pk = new Db_Descriptor_PrimaryKey(); $pk->setColumn($name); return $pk; }
[ "protected function _createKey() {\n return new PapayaDatabaseRecordKeyAutoincrement('id');\n }", "function createPrimaryKey(Schema\\PrimaryKey $primaryKey, $table);", "public static function get_primary_key();", "protected function initPrimaryKey()\r\n {\r\n // columns have to be loaded first\r\n if (!$this->colsLoaded) $this->initColumns();\r\n include_once 'creole/metadata/PrimaryKeyInfo.php';\r\n \r\n if (!@mssql_select_db($this->dbname, $this->conn->getResource())) {\r\n throw new SQLException('No database selected');\r\n } \r\n \r\n $res = mssql_query(\"SELECT COLUMN_NAME \r\n FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS \r\n INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ON \r\n INFORMATION_SCHEMA.TABLE_CONSTRAINTS.CONSTRAINT_NAME = INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE.constraint_name\r\n WHERE (INFORMATION_SCHEMA.TABLE_CONSTRAINTS.CONSTRAINT_TYPE = 'PRIMARY KEY') AND \r\n (INFORMATION_SCHEMA.TABLE_CONSTRAINTS.TABLE_NAME = '\".$this->name.\"')\", $this->conn->getResource());\r\n \r\n // Loop through the returned results, grouping the same key_name together.\r\n // name of the primary key will be the first column name in the key.\r\n while($row = mssql_fetch_row($res)) {\r\n $name = $row[0]; \r\n if (!isset($this->primaryKey)) {\r\n $this->primaryKey = new PrimaryKeyInfo($name);\r\n }\r\n $this->primaryKey->addColumn($this->columns[ $name ]);\r\n } \r\n \r\n $this->pkLoaded = true;\r\n }", "protected function initPrimaryKey() {\r\n\r\n include_once 'creole/metadata/PrimaryKeyInfo.php';\r\n\r\n\r\n // columns have to be loaded first\r\n if (!$this->colsLoaded) $this->initColumns();\r\n\r\n // Primary Keys\r\n \r\n $result = pg_query($this->conn->getResource(), sprintf (\"SELECT\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t DISTINCT ON(cls.relname)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t cls.relname as idxname,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t indkey,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t indisunique\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM pg_index idx\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t JOIN pg_class cls ON cls.oid=indexrelid\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE indrelid = %s AND indisprimary\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY cls.relname\", $this->oid));\r\n if (!$result) {\r\n throw new SQLException(\"Could not list primary keys for table: \" . $this->name, pg_last_error($this->conn->getResource()));\r\n }\r\n\r\n // Loop through the returned results, grouping the same key_name together\r\n // adding each column for that key.\r\n\r\n while($row = pg_fetch_assoc($result)) {\r\n $arrColumns = explode (' ', $row['indkey']);\r\n foreach ($arrColumns as $intColNum)\r\n {\r\n\t $result2 = pg_query ($this->conn->getResource(), sprintf (\"SELECT a.attname\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON a.attrelid = c.oid\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE c.oid = '%s' AND a.attnum = %d AND NOT a.attisdropped\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY a.attnum\", $this->oid, $intColNum));\r\n\t\t\t\tif (!$result2)\r\n\t\t\t\t{\r\n \t\tthrow new SQLException(\"Could not list indexes keys for table: \" . $this->name, pg_last_error($this->conn->getResource()));\r\n\t\t\t\t}\r\n\t\t\t\t$row2 = pg_fetch_assoc($result2);\r\n\t\t\t\tif (!isset($this->primaryKey)) {\r\n\t\t\t\t\t$this->primaryKey = new PrimaryKeyInfo($row2['attname']);\r\n\t\t\t\t}\r\n\t $this->primaryKey->addColumn($this->columns[ $row2['attname'] ]);\r\n\t\t\t} // foreach ($arrColumns as $intColNum)\r\n }\r\n $this->pkLoaded = true;\r\n }", "private function generatePK() {\n // If you want to auto-increment, don't do anything. If you\n // want to generate a pk from an external resource such as \n // a ticket server, do that.\n }", "public function getPrimaryKey() : \\CoolBeans\\Contract\\PrimaryKey\n {\n return $this->primaryKey;\n }", "public static function primary_key() {\n\t\treturn static::$_primary_key;\n\t}", "public function get_primary_key() {\n return $this->primary_key;\n }", "public function addPrimary()\n {\n $columnName = self::ID_PREFIX . $this->tableName;\n $column = $this->addColumn($columnName);\n $this->addKeyPrimary([$columnName])->setAutoincremental();\n return $column;\n }", "function getPrimaryKey()\n {\n }", "public function primary_key() {\n $field = $this->_primary_key;\n return $this->$field;\n }", "function set_primary($primary_key)\n\t\t{\n\t\t\t$this->primary = $primary_key;\n\t\t}", "private function createPrimaryKeys()\n {\n $pks = [];\n\n foreach ($this->table->getFields() as $field) {\n if ($field->isPrimary()) {\n $pks[] = \"'\".$field->getName().\"'\";\n }\n }\n\n if (sizeof($pks) == 1) {\n return sprintf(\"\\$table->primary(%s);\", $pks[0]);\n } elseif (sizeof($pks) > 1) {\n return sprintf(\"\\$table->primary([%s]);\", implode(',', $pks));\n } else {\n return '';\n }\n }", "function getPrimaryKeyIdentifier() {\n\t}", "public static function primary_key(array $keys, $table)\r\n\t{\r\n\t\treturn new Database_Constraint_Primary($keys, $table);\r\n\t}", "protected function loadPK()\n {\n global $db;\n \n $sql = \"SHOW KEYS FROM $this->table \"\n . 'WHERE Key_name = \"PRIMARY\"';\n \n $result = $db->get_row($sql);\n if ($result) $this->pk = $result->Column_name;\n else $this->pk = '';\n \n }", "public function primary($constrainted, string $name=null);", "public function getPrimaryKeyMapper() : PrimaryKeyMapperInterface\n {\n return new PrimaryKeyMapper($this->pdo);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
preTypeFields Function for prepare the field type
public function preTypeFields($type, $name){ $fields = array(); switch($type){ case 'checkbox': $fields = array( $name => array( 'type' => 'INT', 'null' => TRUE, 'constraint' => 11 ), ); break; case 'datepicker': $fields = array( $name => array( 'type' => 'DATE', 'null' => TRUE, ), ); break; case 'email': case 'file': case 'password': case 'radio': case 'selectbox': case 'text': case 'timepicker': $fields = array( $name => array( 'type' => 'VARCHAR', 'constraint' => '255', 'null' => TRUE, ), ); break; case 'textarea': $fields = array( $name => array( 'type' => 'TEXT', 'null' => TRUE, ), ); break; default: break; } return $fields; }
[ "protected function setFieldsTypes()\n {\n }", "public function prepare_fields($fields, $type_name)\n {\n }", "function get_field_types()\n {\n }", "protected function _buildFieldsByType()\n {\n $this->object_fields_by_type = array(\n 'num'=>array(),\n 'str'=>array(),\n 'rel'=>array()\n );\n foreach ($this->getStructureEntry('structure') as $_field=>$_data) {\n if (\n preg_match('/^integer(\\((.*)\\))?/i', $_data['type']) ||\n preg_match('/^float(\\((.*)\\))?/i', $_data['type'])\n ) $this->object_fields_by_type['num'][] = $_field;\n elseif (\n preg_match('/^varchar(\\((.*)\\))?/i', $_data['type']) ||\n preg_match('/(.*)text$/i', $_data['type'])\n ) $this->object_fields_by_type['str'][] = $_field;\n elseif (\n preg_match('/^(.*)_id$/i', $_data['type'])\n ) $this->object_fields_by_type['rel'][] = $_field;\n }\n }", "protected function prepare_field($field_name, $field_config, $type_name)\n {\n }", "public function castFields()\n {\n foreach($this->table_desc as $field_name => $field_desc)\n {\n if($field_desc->php_type == 'integer' && $this->isEmpty($this->$field_name))\n $this->_fields[$field_name] = NULL;\n else if(isset($this->_fields[$field_name]) && !is_null($this->_fields[$field_name]))\n settype($this->_fields[$field_name], $field_desc->php_type);\n }\n }", "public function prepare_fields() {\n\t\t// Destroy existing fields\n\t\t$this->reset_fields();\n\n\t\t// Add fields in order\n\t\t$this->duration_field();\n\t\t$this->date_field();\n\n\t\t$this->fields = apply_filters( 'booking_form_fields', $this->fields );\n\t}", "protected function prepare_base_fields_for_storage( &$data_array, &$type_array ) {\n\n\t}", "function regenerate_fields( $type ){\n\n\t\t$this->remove_traces();\n\n\t\tif( $type == 'job' || $type == 'company'){\n\t\t\tself::init_fields();\n\t\t}\n\t}", "function prepare_fields() {\n\n\t\tfor ( $i = 0; $i < bf_count( $this->fields ); $i ++ ) {\n\n\t\t\tif ( isset( $this->fields[ $i ]['attr_id'] ) ) { // Backward compatibility\n\t\t\t\t$this->fields[ $i ]['id'] = $this->fields[ $i ]['attr_id'];\n\t\t\t}\n\t\t\t// do not do anything on fields that haven't ID, ex: group fields\n\t\t\tif ( ! isset( $this->fields[ $i ]['id'] ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$this->fields[ $i ]['input_name'] = $this->get_field_name( $this->fields[ $i ]['id'] );\n\n\t\t\t// TODO: check this\n\t\t\t// $this->fields[ $i ]['id'] = $this->get_field_id( $this->fields[ $i ]['id'] );\n\n\n\t\t\tif ( $this->fields[ $i ]['type'] == 'repeater' ) {\n\n\t\t\t\tforeach ( $this->fields[ $i ]['options'] as $_id => $_item ) {\n\n\t\t\t\t\t$this->fields[ $i ]['options'][ $_id ]['input_name'] = $this->fields[ $i ]['input_name'] . '[%d][' . $_item['id'] . ']';\n\t\t\t\t}\n\n\t\t\t} elseif ( $this->fields[ $i ]['type'] == 'select' && ! empty( $this->fields[ $i ]['multiple'] ) && $this->fields[ $i ]['multiple'] ) {\n\t\t\t\t$this->fields[ $i ]['input_name'] .= '[]';\n\t\t\t}\n\t\t}\n\t}", "protected function _prepare_post_type(/**\n * Filters XML-RPC-prepared date for the given post type.\n *\n * @since 3.4.0\n * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object.\n *\n * @param array $_post_type An array of post type data.\n * @param WP_Post_Type $post_type Post type object.\n */\n$post_type, /**\n * Filters XML-RPC-prepared date for the given post type.\n *\n * @since 3.4.0\n * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object.\n *\n * @param array $_post_type An array of post type data.\n * @param WP_Post_Type $post_type Post type object.\n */\n$fields) {}", "public function ChangeFieldTypePostHook()\n {\n }", "function internalInitFieldDefs() {}", "function getFieldsTypes()\n {\n return array(\n 'zoneId' => 'integer',\n 'publisherId' => 'integer',\n 'zoneName' => 'string',\n 'type' => 'integer',\n 'width' => 'integer',\n 'height' => 'integer',\n 'capping' => 'integer',\n 'sessionCapping' => 'integer',\n 'block' => 'integer',\n 'comments' => 'string',\n );\n }", "function prepare_field_for_import($field)\n {\n }", "function collect_fields(&$fields, $n_fields, $post_vars, $extract_type = true){\n\t$prefix = \"field_\";\n\t$name_suffix = \"_name\";\n\t$type_suffix = \"_type\";\n\tfor($i = 0; $i < $n_fields; $i++){\n\t\t$f_name = $post_vars[$prefix . $i . $name_suffix];\n\t\tif($extract_type)\n\t\t\t$fields[$f_name] = $post_vars[$prefix . $i . $type_suffix];\n\t\telse\n\t\t\t$fields[$f_name] = \"\";\n\t}\n}", "public function setup_fields() {\n\t\tif ( ! function_exists( 'register_api_field' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$post_types = papi_get_post_types();\n\n\t\tforeach ( $post_types as $post_type ) {\n\t\t\tregister_api_field( $post_type, 'fields', [\n\t\t\t\t'get_callback' => [$this, 'get_fields']\n\t\t\t] );\n\n\t\t\tregister_api_field( $post_type, 'page_type', [\n\t\t\t\t'get_callback' => [$this, 'get_page_type']\n\t\t\t] );\n\t\t}\n\t}", "private function fixFields()\n\t{\n\t\tforeach ($this->fields as $field => $type) {\n\t\t\tif (!isset($type[1]['name'])) {\n\n\t\t\t\tif ($field == 'id') {\n\t\t\t\t\t$this->fields[$field][1]['name'] = 'ID';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$this->fields[$field][1]['name'] = ucwords(str_replace('_', ' ', $field));\n\n\t\t\t\t\tif (substr($this->fields[$field][1]['name'], -3) === ' Id') {\n\t\t\t\t\t\t$this->fields[$field][1]['name'] = substr($this->fields[$field][1]['name'], 0, strlen($this->fields[$field][1]['name']) - 3);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function getPreparedTypeFieldName () {\n return null;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disables the runtimebased cache
public function disableRuntimeCache() {}
[ "public function disableCaching();", "protected function disableCache() {}", "public function disableCache();", "public function disable_caching()\n {\n $this->caching = 0; \n }", "public function disableCache() {\n\t\t$this->mUseCache = false;\n\t}", "function disable_cache()\r\n {\r\n $this->disable_cache = true;\r\n }", "public static function prevent_caching()\n {\n }", "public function stop_cache()\r\n {\r\n $this->ar_caching = FALSE;\r\n }", "public function removeCache(): void;", "public function doNotCache(): self;", "function disableCaching(){\n $this->componentCache = false;\n }", "public function stop_cache() {\n $this->ar_caching = FALSE;\n }", "public static function avoidCache()\r\n {\r\n self::$avoidCache = true;\r\n }", "public static function disableFrontendCache()\n {\n\t if (isset($GLOBALS['TSFE'])) {\n\t\t $GLOBALS['TSFE']->no_cache = true;\n\t }\n }", "public function forgetCache()\n {\n }", "public static function disableAll()\n {\n $app = Application::getFacadeApplication();\n $app->make('cache/request')->disable();\n $app->make('cache/expensive')->disable();\n $app->make('cache')->disable();\n }", "public function enableRuntimeCache() {}", "protected function stopCaching()\n {\n $this->cache_ttl = 0;\n }", "public function disableReflectionCache()\n {\n $this->_reflectionCacheEnabled = false;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add methods to slugify taken from Wordpress: Set the mbstring internal encoding to a binary safe encoding when func_overload is enabled. When mbstring.func_overload is in use for multibyte encodings, the results from strlen() and similar functions respect the utf8 characters, causing binary data to return incorrect lengths. This function overrides the mbstring encoding to a binarysafe encoding, and resets it to the users expected encoding afterwards through the `reset_mbstring_encoding` function. It is safe to recursively call this function, however each `mbstring_binary_safe_encoding()` call must be followed up with an equal number of `reset_mbstring_encoding()` calls.
function mbstring_binary_safe_encoding( $reset = false ) { static $encodings = array(); static $overloaded = null; if ( is_null( $overloaded ) ) $overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ); if ( false === $overloaded ) return; if ( ! $reset ) { $encoding = mb_internal_encoding(); array_push( $encodings, $encoding ); mb_internal_encoding( 'ISO-8859-1' ); } if ( $reset && $encodings ) { $encoding = array_pop( $encodings ); mb_internal_encoding( $encoding ); } }
[ "function reset_mbstring_encoding() {\n mbstring_binary_safe_encoding( true );\n }", "function reset_mbstring_encoding() {\r\n\tmbstring_binary_safe_encoding( true );\r\n}", "function reset_mbstring_encoding() {\n\tmbstring_binary_safe_encoding( true );\n}", "function mbstring_binary_safe_encoding( $reset = false ) {\n\tstatic $encodings = array();\n\tstatic $overloaded = null;\n\n\tif ( is_null( $overloaded ) )\n\t\t$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );\n\n\tif ( false === $overloaded )\n\t\treturn;\n\n\tif ( ! $reset ) {\n\t\t$encoding = mb_internal_encoding();\n\t\tarray_push( $encodings, $encoding );\n\t\tmb_internal_encoding( 'ISO-8859-1' );\n\t}\n\n\tif ( $reset && $encodings ) {\n\t\t$encoding = array_pop( $encodings );\n\t\tmb_internal_encoding( $encoding );\n\t}\n}", "protected static function _reset_mbstring_encoding() {\n\t\tself::_mbstring_binary_safe_encoding(true);\n\t}", "private function mbstring_binary_safe_encoding( $reset = false ) {\n\t\tstatic $encodings = array();\n\t\tstatic $overloaded = null;\n\n\t\tif ( is_null( $overloaded ) ) {\n\t\t\t$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );\n\t\t}\n\n\t\tif ( false === $overloaded ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! $reset ) {\n\t\t\t$encoding = mb_internal_encoding();\n\t\t\tarray_push( $encodings, $encoding );\n\t\t\tmb_internal_encoding( 'ISO-8859-1' );\n\t\t}\n\n\t\tif ( $reset && $encodings ) {\n\t\t\t$encoding = array_pop( $encodings );\n\t\t\tmb_internal_encoding( $encoding );\n\t\t}\n\t}", "public function reset_mbstring_encoding()\n {\n $this->mbstring_binary_safe_encoding(true);\n }", "private function normalizeEncoding()\n {\n if ($this->config['encoding']) {\n if ($this->env->isFunctionExists('mb_internal_encoding')) {\n $this->env->__call('mb_internal_encoding', [$this->config['encoding']]);\n }\n }\n }", "function reset_mbstring_encoding()\n {\n }", "public static function mbstringBinarySafeEncoding( $reset = false )\n\t{\n\t\tstatic $encodings = array();\n\t\tstatic $overloaded = null;\n\n\t\tif ( is_null( $overloaded ) )\n\t\t{\n\t\t\t$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );\n\t\t}\n\n\t\tif ( false === $overloaded )\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! $reset )\n\t\t{\n\t\t\t$encoding = mb_internal_encoding();\n\t\t\tarray_push( $encodings, $encoding );\n\t\t\tmb_internal_encoding( 'ISO-8859-1' );\n\t\t}\n\n\t\tif ( $reset && $encodings )\n\t\t{\n\t\t\t$encoding = array_pop( $encodings );\n\t\t\tmb_internal_encoding( $encoding );\n\t\t}\n\t}", "public static function mbstring_binary_safe_encoding($reset = false) {\n\t\tstatic $encodings = array();\n\t\tstatic $overloaded = null;\n\t\t\n\t\tif (is_null($overloaded))\n\t\t\t$overloaded = function_exists('mb_internal_encoding') && (ini_get('mbstring.func_overload') & 2);\n\t\t\n\t\tif (false === $overloaded)\n\t\t\treturn;\n\t\t\n\t\tif (!$reset) {\n\t\t\t$encoding = mb_internal_encoding();\n\t\t\tarray_push($encodings, $encoding);\n\t\t\tmb_internal_encoding('ISO-8859-1');\n\t\t}\n\t\t\n\t\tif ($reset && $encodings) {\n\t\t\t$encoding = array_pop($encodings);\n\t\t\tmb_internal_encoding($encoding);\n\t\t}\n\t}", "function fix_utf8($value) {\r\n if (is_null($value) or $value === '') {\r\n return $value;\r\n\r\n } else if (is_string($value)) {\r\n if ((string)(int)$value === $value) {\r\n // Shortcut.\r\n return $value;\r\n }\r\n // No null bytes expected in our data, so let's remove it.\r\n $value = str_replace(\"\\0\", '', $value);\r\n\r\n // Note: this duplicates min_fix_utf8() intentionally.\r\n static $buggyiconv = null;\r\n if ($buggyiconv === null) {\r\n $buggyiconv = (!function_exists('iconv') or @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');\r\n }\r\n\r\n if ($buggyiconv) {\r\n if (function_exists('mb_convert_encoding')) {\r\n $subst = mb_substitute_character();\r\n mb_substitute_character('');\r\n $result = mb_convert_encoding($value, 'utf-8', 'utf-8');\r\n mb_substitute_character($subst);\r\n\r\n } else {\r\n // Warn admins on admin/index.php page.\r\n $result = $value;\r\n }\r\n\r\n } else {\r\n $result = @iconv('UTF-8', 'UTF-8//IGNORE', $value);\r\n }\r\n\r\n return $result;\r\n\r\n } else if (is_array($value)) {\r\n foreach ($value as $k => $v) {\r\n $value[$k] = fix_utf8($v);\r\n }\r\n return $value;\r\n\r\n } else if (is_object($value)) {\r\n // Do not modify original.\r\n $value = clone($value);\r\n foreach ($value as $k => $v) {\r\n $value->$k = fix_utf8($v);\r\n }\r\n return $value;\r\n\r\n } else {\r\n // This is some other type, no utf-8 here.\r\n return $value;\r\n }\r\n}", "function fixEncoding($in_str) \r\n{ \r\n $cur_encoding = mb_detect_encoding($in_str) ; \r\n if($cur_encoding == \"UTF-8\" && mb_check_encoding($in_str,\"UTF-8\")) \r\n return $in_str; \r\n else \r\n return utf8_encode($in_str); \r\n}", "function fixEncoding($in_str)\n{\n $cur_encoding = mb_detect_encoding($in_str) ;\n if($cur_encoding == \"UTF-8\" && mb_check_encoding($in_str,\"UTF-8\"))\n return $in_str;\n else\n return utf8_encode($in_str);\n}", "public function sanitize()\n {\n $this->encoding = strtolower($this->encoding);\n\n if ($this->encoding === self::UTF8) {\n return;\n }\n\n if (! function_exists('mb_list_encodings')) {\n return;\n }\n\n static $knownEncodings = null;\n\n if (null === $knownEncodings) {\n $knownEncodings = array_map('strtolower', mb_list_encodings());\n }\n\n if (array_key_exists($this->encoding, self::MAPPINGS)) {\n $this->encoding = self::MAPPINGS[$this->encoding];\n }\n\n if (! in_array($this->encoding, $knownEncodings, true)) {\n $this->encoding = self::UNKNOWN;\n }\n }", "private static function mbstring_overloaded(): bool\n {\n /**\n * INI directive 'mbstring.func_overload' is deprecated since PHP 7.2\n */\n\n /** @noinspection PhpComposerExtensionStubsInspection */\n /** @noinspection PhpUsageOfSilenceOperatorInspection */\n /** @noinspection DeprecatedIniOptionsInspection */\n return \\defined('MB_OVERLOAD_STRING')\n &&\n ((int) @\\ini_get('mbstring.func_overload') & \\MB_OVERLOAD_STRING);\n }", "function utf8_sanitize($str, &$errors = null) {\n if ($errors !== null) {\n $errors = array();\n }\n $utf8 = '';\n $bytesNeeded = 0;\n $bytesSeen = 0;\n $lowerBoundary = 0x80;\n $upperBoundary = 0xBF;\n $char = '';\n for ($pos = 0, $length = strlen($str); $pos < $length; $pos++) {\n $byte = ord($str[$pos]);\n if ($bytesNeeded == 0) {\n if ($byte >= 0x00 and $byte <= 0x7F) {\n $utf8 .= $str[$pos];\n } elseif ($byte >= 0xC2 and $byte <= 0xDF) {\n $bytesNeeded = 1;\n } elseif ($byte >= 0xE0 and $byte <= 0xEF) {\n if ($byte == 0xE0) {\n $lowerBoundary = 0xA0;\n }\n if ($byte == 0xED) {\n $upperBoundary = 0x9F;\n }\n $bytesNeeded = 2;\n } elseif ($byte >= 0xF0 and $byte <= 0xF4) {\n if ($byte == 0xF0) {\n $lowerBoundary = 0x90;\n }\n if ($byte == 0xF4) {\n $upperBoundary = 0x8F;\n }\n $bytesNeeded = 3;\n } else {\n $utf8 .= UTF8_REPLACEMENT_CHARACTER;\n if ($errors !== null) $errors[] = $pos;\n }\n $char = $str[$pos];\n } elseif ($byte < $lowerBoundary or $byte > $upperBoundary) {\n $char = '';\n $bytesNeeded = 0;\n $bytesSeen = 0;\n $lowerBoundary = 0x80;\n $upperBoundary = 0xBF;\n $utf8 .= UTF8_REPLACEMENT_CHARACTER;\n if ($errors !== null) $errors[] = $pos;\n $pos--;\n } else {\n $lowerBoundary = 0x80;\n $upperBoundary = 0xBF;\n $bytesSeen++;\n $char .= $str[$pos];\n if ($bytesSeen == $bytesNeeded) {\n $utf8 .= $char;\n $char = '';\n $bytesNeeded = 0;\n $bytesSeen = 0;\n }\n }\n }\n if ($bytesNeeded > 0) {\n $utf8 .= UTF8_REPLACEMENT_CHARACTER;\n if ($errors !== null) $errors[] = $length;\n }\n return $utf8;\n}", "function utf8_force($stringOrArray, $replace4ByteUTF8 = false, $convertFromEncoding = '') {\r\n // NOTE: $replace4ByteUTF8 isn't needed for v3.11+ as we switched to utf8mb4 which supports 4-byte UTF8\r\n\r\n // error checking\r\n if (mb_internal_encoding() != 'UTF-8') {\r\n // we default to assuming an incoming encoding of utf-8, so we want to check that's the case\r\n // we generally don't want to support scripts that run with some other internal encoding\r\n die(__FUNCTION__ . \": mb_internal_encoding() must be UTF-8, not '\" .htmlencode(mb_internal_encoding()). \"'\");\r\n }\r\n if ($convertFromEncoding && !@mb_convert_encoding(1, $convertFromEncoding)) { // mb_convert_encoding() returns false if encoding isn't recognized\r\n die(__FUNCTION__ . \": unknown character set specified '\" .htmlencode($convertFromEncoding). \"'\");\r\n }\r\n\r\n // support recursively converting arrays\r\n if (is_array($stringOrArray)) {\r\n foreach ($stringOrArray as $index => $string) {\r\n $stringOrArray[$index] = utf8_force($string, $replace4ByteUTF8, $convertFromEncoding);\r\n }\r\n return $stringOrArray;\r\n }\r\n\r\n // convert string to UTF-8\r\n $string = $stringOrArray;\r\n $encoding = $convertFromEncoding ? $convertFromEncoding : 'UTF-8'; // Note: encoding from utf-8 to utf-8 \"fixes\" invalid utf-8 (replaces invalid sequences with a replacement char ?)\r\n $utf8String = mb_convert_encoding($string, 'UTF-8', $encoding); // mb_convert_encodin() replaces unknown/invalid sequences with ascii \"?\"\r\n\r\n // replace 4-byte utf-8 for mysql compatability, see: http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html\r\n // for security replace chars don't remove, see: http://unicode.org/reports/tr36/#Deletion_of_Noncharacters\r\n if ($replace4ByteUTF8) {\r\n $replacementChar = \"\\xEF\\xBF\\xBD\"; /* For security replace don't remove, official replacement char looks like this: <?> see: http://unicode.org/reports/tr36/#Deletion_of_Noncharacters */\r\n $utf8String = preg_replace('/[\\xF0-\\xF7].../s', $replacementChar, $utf8String); // replace 4-byte utf-8 sequences that start with binary: 11110xxx\r\n }\r\n\r\n //\r\n return $utf8String;\r\n}", "function fixEncoding($in_str)\n\n\t\t{\n\t\t//if(true)return $in_str;\n\t\t$cur_encoding = mb_detect_encoding($in_str) ;\n\n\t\tif($cur_encoding == \"UTF-8\" && mb_check_encoding($in_str,\"UTF-8\"))\n\n\t\treturn $in_str;\n\n\t\telse\n\n\t\treturn utf8_encode($in_str);\n\n\t\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get es search fields without coefficients
public function getSearchFieldsWithoutCoefficient() : array { $fields = $this->getSearchFields(); return array_map(fn($field) => preg_replace('/\^[0-9]+$/', '', $field), $fields); }
[ "public function getSearchFields();", "protected function _getWeightedSearchFields()\n {\n return $this->getSearchFields(\n Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Mapping_Abstract::SEARCH_TYPE_AUTOCOMPLETE\n );\n }", "public function getSearchFields()\n {\n //return $this->searchFields;\n return ['_all'];\n }", "public function getBoostQueryFields();", "public abstract function getSearchableFields() : array;", "public function getQueryFields();", "abstract public function getFieldsSearchable();", "public function getSearchFields()\n {\n return $this->searchFields;\n }", "public function expectedSearchFields(): array;", "public function _getBestSearchFields(){\n\n\t\t$result = self::getSearchFields();\n\n\t\tif($result){\n\t\t\treturn($result);\n\t\t}else{\n\t\t\tdie(\"DURC Model for $this_class_name could not get any reasonable fields for searching.. check your $db_table table..\");\n\t\t}\n\t}", "public function searchFieldsGlobalSearch()\n {\n return [];\n }", "public function getFieldsSearchable()\n {\n }", "public function getFieldsSearchable()\n {\n return [];\n }", "public function get_search_fields() : array {\n return $this->search_fields;\n }", "private function get_query_fields() {\n\n\t\t$option_search_fields_boosts = WPSOLR_Global::getOption()->get_search_fields_boosts();\n\n\n\t\t// Build a query fields with boosts\n\t\t$query_fields_str = '';\n\t\tforeach ( $option_search_fields_boosts as $search_field_name => $search_field_boost ) {\n\n\t\t\tif ( WpSolrSchema::_FIELD_NAME_CATEGORIES === $search_field_name ) {\n\n\t\t\t\t// Field 'categories' are now treated as other fields (dynamic string type)\n\t\t\t\t$search_field_name = WpSolrSchema::_FIELD_NAME_CATEGORIES_STR;\n\t\t\t}\n\n\t\t\tif ( '1' === $search_field_boost ) {\n\n\t\t\t\t// Boost of '1' is a default value. No need to add it with it's field.\n\t\t\t\t$query_fields_str .= sprintf( ' %s ', $search_field_name );\n\n\t\t\t} else {\n\n\t\t\t\t// Add field and it's (non default) boost value.\n\t\t\t\t$query_fields_str .= sprintf( ' %s^%s ', $search_field_name, $search_field_boost );\n\t\t\t}\n\t\t}\n\n\t\t$query_fields_str = trim( $query_fields_str );\n\n\t\treturn $query_fields_str;\n\t}", "public function getIndexFields() {\n return array_keys($this->index->getFields(TRUE)) ?: [];\n }", "function indexFields()\n\t{\n\t\tif (empty($this->name)) {\n\t\t\treturn null;\n\t\t}\n\n\t\t$set = array();\n\t\t// Field is not tokenized nor indexed, but is stored in the index.\n\n\t\t// Field is not tokenized, but is indexed and stored within the index\n\t\t$set[] = Zend_Search_Lucene_Field::Keyword('link','/' . strtolower(get_class($this)) . '/view/' . $this->id);\n\t\t$set[] = Zend_Search_Lucene_Field::Keyword('name',$this->name);\n\t\t// $set[] = Zend_Search_Lucene_Field::Keyword('title',$this->name);\n\n\t\t// Field is tokenized and indexed, but is not stored in the index.\n\t\t$content = null;\n\t\tforeach ($this->_properties as $p) {\n\t\t\t$x = substr($p,-2);\n\t\t\tif ( ($x=='id') || ($x=='ts') ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$content.= $this->$p . ' ';\n\t\t}\n\t\t$set[] = Zend_Search_Lucene_Field::UnStored('text',trim($content));\n\t\treturn $set;\n\t}", "protected function getSearchableFields()\n {\n if (isset($this->searchableFields) && count($this->searchableFields)) {\n return $this->searchableFields[0] === '*'\n ? $this->getAllModelTableFields()\n : $this->searchableFields;\n }\n\n return $this->getAllModelTableFields();\n }", "public function getFulltextSearchableFields()\n {\n return $this->fulltextSearchableFields;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operation getMetricsWithHttpInfo Retrieve workload performance metrics
public function getMetricsWithHttpInfo($zap_trace_span = null) { $request = $this->getMetricsRequest($zap_trace_span); $response = $this->defaultApi->sendRequest($request); $returnType = 'string'; $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() ]; }
[ "public function apiMetrics()\n {\n return $this->httpGet('/admin/apiMetrics');\n }", "public function listMonitoringMetricsAsyncWithHttpInfo()\n {\n $returnType = '\\MuxPhp\\Models\\ListMonitoringMetricsResponse';\n $request = $this->listMonitoringMetricsRequest();\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "protected function restSystemCloudMetricsGetRequest()\n {\n\n $resourcePath = '/rest/system/cloud/metrics';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['*/*']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['*/*'],\n []\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n if ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));\n } else {\n $httpBody = $_tempBody;\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function get_metrics()\n {\n //print_r($_GET);\n\n $client = (new Http())->getClient();\n\n $metrics = new Metrics($client);\n\n $this->metricsParam = $this->getMetricsArguments($_GET);\n $this->metricsParam['sub_account_id'] = $this->db['sub_account_id'];\n\n $result = $metrics->get($this->metricsParam);\n\n wp_send_json_success($result);\n }", "public function getServerMetrics()\n {\n $url = UrlHelper::appendParamsUrl(Urls::URL_ADMIN_METRICS, []);\n $response = $this->getConnection()->get($url);\n\n $metrics = [];\n\n foreach (explode(\"\\n\", $response->getBody()) as $line) {\n if (trim($line) == \"\") {\n continue;\n }\n\n if ($line[0] == \"#\") {\n // type or help\n if (!preg_match(\"/^#\\s*([^\\s]+)\\s+([^\\s]+)\\s+(.*)$/\", $line, $matches)) {\n throw new ClientException('Invalid metrics API output line: \"' . $line. '\"');\n }\n\n $metric = $matches[2];\n if (!isset($metrics[$metric])) {\n $metrics[$metric] = [\"name\" => $metric];\n }\n\n $metrics[$metric][strtolower($matches[1])] = $matches[3];\n } else {\n // metric value\n if (!preg_match(\"/^([^\\s\\{]+)(\\{.*?\\})?\\s*(.+)$\\s*$/\", $line, $matches)) {\n throw new ClientException('Invalid metrics API output line: \"' . $line. '\"');\n }\n\n $metric = $matches[1];\n $sub = null;\n if (preg_match(\"/_(sum|count|bucket)$/\", $metric, $sub)) {\n // sum, count, buckets\n $metric = substr($metric, 0, -1 - strlen($sub[1]));\n }\n \n if (!isset($metrics[$metric])) {\n $metrics[$metric] = [];\n }\n\n $le = null;\n // labels\n if ($matches[2] != \"\") {\n $labels = substr($matches[2], 1, strlen($matches[2]) - 2);\n if ($labels != \"\") {\n foreach (explode(\",\", $labels) as $label) {\n $parts = explode(\"=\", $label);\n $key = trim($parts[0]);\n $value = trim($parts[1], \" \\\"\");\n if (!isset($metrics[$metric][\"labels\"])) {\n $metrics[$metric][\"labels\"] = []; \n }\n if ($key != \"le\") {\n $metrics[$metric][\"labels\"][$key] = $value;\n } else {\n $le = $value;\n }\n }\n }\n }\n \n // cast to number\n $value = $matches[3];\n \n if ($sub == null) {\n // counter\n $metrics[$metric][\"value\"] = $value;\n } else if ($sub[1] == \"bucket\") {\n // bucket value\n if (!isset($metrics[$metric][\"buckets\"])) {\n $metrics[$metric][\"buckets\"] = [];\n }\n $metrics[$metric][\"buckets\"][$le] = $value;\n } else {\n // sum, count\n $metrics[$metric][$sub[1]] = $value;\n }\n }\n }\n\n return $metrics;\n }", "public function getMetrics();", "public function fetchMetrics();", "public function retrieveReactorMetrics()\n {\n return $this->start()->uri(\"/api/reactor/metrics\")\n ->get()\n ->go();\n }", "public function getInstanceMetrics($params)\n {\n return $this->lightSailClient->getInstanceMetricData([\n 'endTime' => $params['endTime'],//<integer || string || DateTime>, // REQUIRED\n 'instanceName' => $params['instanceName'], // REQUIRED\n 'metricName' => $params['metricName'],//'CPUUtilization|NetworkIn|NetworkOut|StatusCheckFailed|StatusCheckFailed_Instance|StatusCheckFailed_System', // REQUIRED\n 'period' => $params['period'], // REQUIRED\n 'startTime' => $params['startTime'],//<integer || string || DateTime>, // REQUIRED\n 'statistics' => [$params['statistics']],//['<string>', ...], // REQUIRED\n 'unit' => $params['unit']//'Seconds|Microseconds|Milliseconds|Bytes|Kilobytes|Megabytes|Gigabytes|Terabytes|Bits|Kilobits|Megabits|Gigabits|Terabits|Percent|Count|Bytes/Second|Kilobytes/Second|Megabytes/Second|Gigabytes/Second|Terabytes/Second|Bits/Second|Kilobits/Second|Megabits/Second|Gigabits/Second|Terabits/Second|Count/Second|None', // REQUIRED\n ]);\n }", "public function prometheusAsyncWithHttpInfo()\n {\n $returnType = '';\n $request = $this->prometheusRequest();\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function getMetricInfo($counterIds = []) {\n\t\t$result = $this->prepResult();\n\t\t\n\t\t$api_function = \"QueryPerfCounter\";\n\t\t\n\t\tif (is_array($counterIds) == false || count($counterIds) == 0) {\n\t\t\t$result['error'] = \"Invalid function call, must supply array of counterIds\";\n\t\t\treturn $result;\n\t\t}\n\t\t\n\t\tif (!$this->validSession) {\n\t\t\t$result['error'] = \"Must log in before issuing commands\";\n\t\t\treturn $result;\n\t\t}\n\t\t\n\t\t$counter_xml = \"\";\n\t\tforeach ($counterIds as $cid) $counter_xml .= \"<urn:counterId>\" . ($cid+0) . \"</urn:counterId>\\n\";\n\t\t\t\t\n\t\t$xml = \"<soapenv:Envelope xmlns:soapenv=\\\"http://schemas.xmlsoap.org/soap/envelope/\\\" xmlns:urn=\\\"urn:vim25\\\">\n\t\t\t\t\t<soapenv:Header/>\n\t\t\t\t\t<soapenv:Body>\n\t\t\t\t\t\t<urn:\" . $api_function . \">\n\t\t\t\t\t\t\t<urn:_this>\" . $this->api_info['perfManager'] . \"</urn:_this>\n\t\t\t\t\t\t\t\" . $counter_xml . \"\n\t\t\t\t\t\t</urn:\" . $api_function . \">\n\t\t\t\t\t</soapenv:Body>\n\t\t\t\t</soapenv:Envelope>\";\n\n\t\t$this->lastRaw = $this->_callApi($xml);\n\t\t$this->lastJson = $this->xml2json($this->lastRaw);\n\t\t$this->lastArray = json_decode($this->lastJson, true);\n\t\tif ($this->lastArray == false) $result['error'] = $this->lastRaw;\n\t\telseif (isset($this->lastArray[$api_function . 'Response'])) $this->lastArray = $this->lastArray[$api_function . 'Response'];\n\t\telseif (isset($this->lastArray)) $this->lastArray = $this->lastArray;\n\t\t\n\t\tif ($this->sendRaw) $result['raw'] = $this->lastRaw;\n\t\tif ($this->sendHeaders) $result['headers'] = $this->lastHeaders;\n\t\tif ($this->sendJson) $result['json'] = $this->lastJson;\n\t\tif ($this->sendArray) $result['array'] = $this->lastArray;\n\t\t\n\t\treturn $result;\n\t}", "public function getNodeMetricsAsyncWithHttpInfo($types = null)\n {\n $returnType = '\\Lnd\\Rest\\Model\\LnrpcNodeMetricsResponse';\n $request = $this->getNodeMetricsRequest($types);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function getMetricsRequest($page = 0, $count = 50)\n {\n if ($page !== null && $page < 0) {\n throw new \\InvalidArgumentException('invalid value for \"$page\" when calling MetricsApi.getMetrics, must be bigger than or equal to 0.');\n }\n\n if ($count !== null && $count > 100) {\n throw new \\InvalidArgumentException('invalid value for \"$count\" when calling MetricsApi.getMetrics, must be smaller than or equal to 100.');\n }\n if ($count !== null && $count < 1) {\n throw new \\InvalidArgumentException('invalid value for \"$count\" when calling MetricsApi.getMetrics, must be bigger than or equal to 1.');\n }\n\n\n $resourcePath = '/v1/metrics';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($page !== null) {\n if('form' === 'form' && is_array($page)) {\n foreach($page as $key => $value) {\n $queryParams[$key] = $value;\n }\n }\n else {\n $queryParams['page'] = $page;\n }\n }\n // query params\n if ($count !== null) {\n if('form' === 'form' && is_array($count)) {\n foreach($count as $key => $value) {\n $queryParams[$key] = $value;\n }\n }\n else {\n $queryParams['count'] = $count;\n }\n }\n\n\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\Query::build($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('api_key');\n if ($apiKey !== null) {\n $queryParams['api_key'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\Query::build($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function action_getEventMetrics(){\n $eventId = Request::get('eventId','',AnalyticsModule::PARAMS_LOCATION);\n $metrics = AnalyticsAggregator::getMetricsByEventId($eventId);\n return array(\"Metrics\"=>DataObject::objectListToArrayList($metrics));\n }", "public function index(MetricRequest $request)\n {\n return $request->availableMetrics();\n }", "function getMetrics()\n {\n if (!isset($this->metrics)) {\n $this->updateMetrics();\n }\n return $this->metrics;\n }", "public function listMonitoringMetrics()\n {\n list($response) = $this->listMonitoringMetricsWithHttpInfo();\n return $response;\n }", "public function getMessagingCountersAsyncWithHttpInfo()\n {\n $returnType = '\\TextMagic\\Models\\GetMessagingCountersResponse';\n $request = $this->getMessagingCountersRequest();\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function statisticsWithHttpInfo(string $contentType = self::contentTypes['statistics'][0])\n {\n $request = $this->statisticsRequest($contentType);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n } catch (ConnectException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n null,\n null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n switch($statusCode) {\n case 200:\n if ('\\Aternos\\ModrinthApi\\Model\\Statistics' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n if ('\\Aternos\\ModrinthApi\\Model\\Statistics' !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\Aternos\\ModrinthApi\\Model\\Statistics', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\Aternos\\ModrinthApi\\Model\\Statistics';\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Aternos\\ModrinthApi\\Model\\Statistics',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the ContextProvider for a given key
public function getContextProvider(string $key): ContextProviderInterface { if (!isset($this->contextProviders[$key])) { throw new KeyValueException(sprintf('Unable to find a ContextProvider for "%s"', $key)); } return $this->contextProviders[$key]; }
[ "abstract public function getProviderInformation($key);", "public function findContext($key) {\n return VTCore_Utility::searchArrayValueByKey($this->context, $key);\n }", "public function getChangeProviderClass( $key )\r\n {\r\n $providers =\r\n [\r\n 'Git' => 'Slicer\\\\Provider\\\\GitProvider',\r\n ];\r\n\r\n return $providers[ $key ];\r\n }", "protected function getProvider($key, $array)\n {\n if (array_key_exists($key, $array)) {\n return $array[$key];\n }\n\n return null;\n }", "public function get(string $key)\n {\n if (isset($this->lazyProviders[$key])) {\n $this->initServiceProvider($this->lazyProviders[$key]);\n unset($this->lazyProviders[$key]);\n }\n\n return parent::get($key);\n }", "private static function getCoroutineContext(string $key)\n {\n $coroutineId = self::getCoroutineId();\n if (!isset(self::$context[$coroutineId])) {\n return null;\n }\n\n $coroutineContext = self::$context[$coroutineId];\n if (isset($coroutineContext[$key])) {\n return $coroutineContext[$key];\n }\n return null;\n }", "public function getProviderKey()\n {\n return $this->providerKey;\n }", "public static function loadProviderByKey($key, $provider = TRUE) {\n // Only INNER supported - LEFT is only for backwards compatability with deprecated DrupalOAuthConsumer::load() from 6.x-3.0-beta3\n $join = $provider ? 'INNER' : 'LEFT';\n // For backwards compatibility with deprecated DrupalOAuthConsumer::load() from 6.x-3.0-beta3\n $where = $provider ? '' : ' AND pc.csid IS NULL';\n // For backwards compatibility with deprecated DrupalOAuthConsumer::load() from 6.x-3.0-beta3\n $fields = $provider ? 'pc.*, c.secret, c.configuration' : 'c.csid, c.consumer_key, c.secret, c.configuration, pc.created, pc.changed, pc.uid, pc.name, pc.context, pc.callback_url';\n\n $query = \"SELECT \" . $fields . \" FROM {oauth_common_consumer} c \" . $join . \" JOIN {oauth_common_provider_consumer} pc ON pc.csid = c.csid WHERE c.key_hash = :key_hash\" . $where;\n // TODO Please convert this statement to the D7 database API syntax.\n return self::fromResult(db_query($query, array(\n ':key_hash' => sha1($key),\n )));\n }", "final public function getContext($key,$default=null){\nif(isset($this->context[$key])){\nreturn $this->context[$key];\n}\nreturn $default;\n}", "public function getCollatorForKey($key);", "public function getContext()\n {\n return $this->getKey('Context');\n }", "public function getProvider($name);", "public function getProviderKey()\n {\n $rtn = $this->data['provider_key'];\n\n return $rtn;\n }", "public function getUnderlyingResource($key);", "public static function get(string $key)\n {\n return (self::$registeredServices[$key])();\n }", "public function getFeature($key);", "protected function getProvider()\n\t{\n\t\treturn $this->provider;\n\t}", "public static function &getAdapter ($key)\n\t{\n\t\treturn self::$_adapters[$key];\n\t}", "function get_by_key() {\t\n\t\t$sql = \"SELECT * \n\t\t\t\tFROM evs_database.evs_key_component\n\t\t\t\tWHERE kcp_id=?\";\n\t\t$this->db->query($sql, array($this->kcp_id));\n\t\treturn $query;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the phrase for the links in format "N item(s)"
private function itemsPhrase($count) { if ($count == 1) { return $this->paginator->itemPhrase($count); } else { return "$count " . $this->paginator->itemPhrase($count); } }
[ "protected function _link ()\r\n {\r\n if ($this->complete_text_url)\r\n {\r\n return \" [<a class=\\\"complete-text-link\\\" href=\\\"$this->complete_text_url\\\">More</a>]\";\r\n }\r\n \r\n return '';\r\n }", "private function generateLinks(): string\n {\n $entries = array_map(function (FeedItem $item): string {\n $image_string = '';\n\n if ($item->hasImage()) {\n $image_string = '<media:content xmlns:media=\"http://search.yahoo.com/mrss/\" ';\n $image_string .= \"url=\\\"{$item->imageUrl()}\\\" medium=\\\"image\\\" \";\n $image_string .= \"type=\\\"{$item->imageMimeType()}\\\" width=\\\"{$item->imageWidth()}\\\" \";\n $image_string .= \"height=\\\"{$item->imageHeight()}\\\" />\";\n }\n\n return \"<entry>\n <title>{$this->wrapContent($item->title())}</title>\n <link href=\\\"{$this->configuration->siteUrl()}/{$item->url()}\\\"/>\n <id>{$this->configuration->siteUrl()}/{$item->url()}</id>\n <updated>{$item->updatedAt()->toAtomString()}</updated>\n <published>{$item->createdAt()->toAtomString()}</published>\n <content type=\\\"html\\\">{$this->wrapContent($item->content())}</content>\n <summary>{$this->wrapContent($item->summary())}</summary>\n {$image_string}\n </entry>\\n\";\n }, $this->links);\n\n return implode('', $entries);\n }", "function link_keywords($string) {\n $keyword_lst = explode('|', $string);\n $count = 0;\n $result = \"\";\n foreach ($keyword_lst as $keyword) {\n if (trim($keyword) != \"\") {\n $link = str_replace(\" \",\"+\",$keyword);\n $item = \"<a href=\\\"keyword/$link\\\">$keyword</a>\";\n if ($count == 0) {\n $result = $result.$item;\n } else {\n $result = $result.\"; \".$item;\n }\n $count = $count + 1;\n }\n }\n return $result;\n}", "function count_word_link(){\n\t\treturn 34;\n\t}", "function rcms_prc_link_short($matches){\n\tif(mb_strlen($matches[2])>25){\n\t\treturn ' <a href=\"http://' . $matches[2] . '\" target=\"_blank\">' . mb_substr($matches[2], 0, 11) . '...' . mb_substr($matches[2], -11) . '</a>';\n\t} else return ' <a href=\"http://' . $matches[2] . '\" target=\"_blank\">' . $matches[2] . '</a>';\n}", "function makeResults() {\n global $resultLinks; // An array of strings whose value is\n $string = \"<p>\";\n reset($resultLinks);\n foreach ($resultLinks as $htmlLink) {\n $string .= \"$htmlLink<br/>\\n\";\n }\n $string .= \"</p>\\n\\n\";\n return $string;\n}", "function format_link($number) {\n\n $page1 = format_number($number);\n $page2 = format_number($number + 1);\n\n return \"http://www.paulnoll.com/Books/Clear-English/words-\".$page1.\"-\".$page2.\"-hundred.html\";\n}", "function process_artists($artists, $max_length) {\n $length = 0;\n foreach ($artists as $artist) {\n if (($length + strlen($artist[\"name\"])) <= $max_length) {\n $links[] = \"\\n\\t\\t\\t\\t\\t\\t\\t\\t\" . '<a class=\"index_link\" href=\"/artist/' . $artist[\"slug\"] . '\">' . $artist[\"name\"] . '</a>';\n $length += strlen($artist[\"name\"]);\n } else {\n $links[] = \"\\n\\t\\t\\t\\t\\t\\t\\t\" . ' ai.';\n break;\n }\n }\n return implode(\", \", $links);\n}", "function GetTitleAndAudience($item)\n{\n // Insert line breaks every 50 characters or so\n $audience = preg_replace('/(.{50,}?) /', '$1<br />', $item['audience']);\n \n return \"<b>{$item['name']}</b><div style='font-size: 10pt; margin-bottom: 6px;'>$audience</div>\";\n}", "public function links_list() {\n\t\t$str = \"\";\n\n\t\tforeach ($this->def_json[\"links\"] as $link) {\n\t\t\t$str .= Builder::root(\"li\", NULL,\n\t\t\t\tBuilder::child(\"a\", array(\"href\" => $link[\"url\"]), $link[\"title\"])\n\t\t\t)->saveHTML();\n\t\t}\n\n\t\treturn $str;\n\t}", "function get_topic_link($topic_id, $topic_title, $numposts)\n{\n global $postsperpage;\n \n $tp = array ('<a class=topiclink href=\"', format_html(get_topic_url($topic_id, 1)),'\">',format_html(trunc_url_title($topic_title)),'</a>');\n\n $lastpage = ceil($numposts/$postsperpage);\n \n if ($lastpage > 1)\n array_push($tp, '<sup>');\n\n if ($lastpage > 7)\n {\n array_push($tp, ' . ', get_topic_link2($topic_id, 2, 'topiclink', 2));\n array_push($tp, ' . ', get_topic_link2($topic_id, 3, 'topiclink', 3));\n array_push($tp, ' . ', get_topic_link2($topic_id, 4, 'topiclink', 4), ' . ');\n array_push($tp, ' . ', get_topic_link2($topic_id, $lastpage-2, 'topiclink', $lastpage-2));\n array_push($tp, ' . ', get_topic_link2($topic_id, $lastpage-1, 'topiclink', $lastpage-1));\n array_push($tp, ' . ', get_topic_link2($topic_id, $lastpage, 'topiclink', $lastpage));\n }\n else\n {\n for($i=2;$i<=$lastpage;++$i)\n {\n array_push($tp, ' . ', get_topic_link2($topic_id, $i, 'topiclink', $i));\n }\n }\n if ($lastpage > 1)\n array_push($tp, ' .</sup>');\n \n return implode('', $tp);\n}", "function add_description_to_menu($item_output, $item, $depth, $args) {\n if (strlen($item->description) > 0 ) {\n // append description after link\n $item_output .= sprintf('<span class=\"description\">%s</span>', esc_html($item->description));\n \n // insert description as last item *in* link ($input_output ends with \"</a>{$args->after}\")\n //$item_output = substr($item_output, 0, -strlen(\"</a>{$args->after}\")) . sprintf('<span class=\"description\">%s</span >', esc_html($item->description)) . \"</a>{$args->after}\";\n }\n \n return $item_output;\n}", "public function getStrLinkText()\n {\n return $this->get(self::STRLINKTEXT);\n }", "public function getLinkText()\n {\n return trim($this->getParsedValue()->Text ?? '');\n }", "public function getLinkDisplayNamePlural()\n {\n $displayNamePlural = 'links';\n $model = $this->linkTo;\n if (method_exists($model, 'getDisplayNamePlural')) {\n try {\n $displayNamePlural = $model::getDisplayNamePlural();\n } catch (DNotImplementedException $exception) {\n }\n }\n\n return $displayNamePlural;\n }", "public function getUpdatedTopCartLinks(){\r\n\t\t$count = Mage::helper('checkout/cart')->getSummaryCount();\r\n\t\t$cartUrl = Mage::helper('checkout/cart')->getCartUrl();\r\n\r\n\t\tif( $count == 1 ) {\r\n\t\t\t$text = $this->__('My Cart (%s item)', $count);\r\n\t\t} elseif( $count > 0 ) {\r\n\t\t\t$text = $this->__('My Cart (%s items)', $count);\r\n\t\t} else {\r\n\t\t\t$text = $this->__('My Cart');\r\n\t\t}\r\n\t\treturn $text;\r\n\t}", "public function showLinkLabels($N){\t\t\n\t\t$A=array();\n\t\t$B=array();\n\t\t$D=array();\n\t\tforeach($this->link as $a=>$os){\n\t\t\tforeach($os as $b=>$link)if($a<$b){\n\t\t\t\t$A[]=$a;\n\t\t\t\t$B[]=$b;\n\t\t\t\t$D[]=$this->getDistance($a,$b);\n\t\t\t}\n\t\t}\n\t\tarray_multisort($D,\"SORT_DESC\",$A,$B);\n\t\t$flag=array();\n\t\t$c=0;\n\t\tfor($i=0;$c<$N;$i++){\n\t\t\tif(!$flag[$A[$i]]){\n\t\t\t\t$flag[$A[$i]]=true;\n\t\t\t\t$c++;\n\t\t\t\tprintf(\"%d\\t%s\\n\",$A[$i],$this->getLabel($A[$i]));\n\t\t\t}\n\t\t\tif(!$flag[$B[$i]]){\n\t\t\t\t$flag[$B[$i]]=true;\n\t\t\t\t$c++;\n\t\t\t\tprintf(\"%d\\t%s\\n\",$B[$i],$this->getLabel($B[$i]));\n\t\t\t}\n\t\t}\n\t}", "function dh_link_to_item($text = null, $props = array(), $action = 'show', $item = null, $queryParams = array())\n{\n if (!$item) {\n $item = get_current_record('item');\n }\n $text = (!empty($text) ? $text : strip_formatting(metadata($item, array('Dublin Core', 'Title'))));\n return link_to($item, $action, $text, $props, $queryParams);\n}", "function shorten_newsString($string, $wordsreturned, $newsid, $newstitle) {\n $retval = $string; // Just in case of a problem\n $array = explode(\" \", $string); //Takes the string and explodes it into an array using the <space> as a separator\n\n if (count($array)<=$wordsreturned) { // Already short enough, return the whole thing\n $retval = $string;\n } else { // It's not short enough chop off words after wordsreturned.\n array_splice($array, $wordsreturned); //Cuts the array off after wordsreturned\n $retval = implode(\" \", $array).\" ... <a href=\\\"index.php?loc=news&newsid=\".$newsid.\"\\\" title=\\\"\".$newstitle.\"\\\">More</a>\"; //Creates the return string with More link\n }\n return $retval;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if an operator (LIKE/IN) requires an array.
protected function operatorRequiresArray($operator) { return in_array($operator, $this->needs_array); }
[ "public function isArrayOperatorType()\n {\n $op = $this->getOperator();\n return $op === '()' || $op === '!()' || in_array($this->getInputType(), $this->_arrayInputTypes);\n }", "protected function isArrayOperation(): bool\n {\n return $this->operation === 'in' || $this->operation === 'not in';\n }", "protected function supportedOperators() {\n return array(\n '=',\n 'IN',\n 'CONTAINS'\n );\n }", "public function in ()\n {\n return in_array($this->operand, explode(',', $this->validation->value));\n }", "public function isOperator($str);", "private function getAllowedOperators()\n {\n return [\n EntityMap::TYPE_STRING => [\n self::OPERATOR_EQ,\n self::OPERATOR_NEQ,\n self::OPERATOR_IS_NULL,\n self::OPERATOR_IS_NOT_NULL,\n self::OPERATOR_IN,\n self::OPERATOR_NOT_IN,\n self::OPERATOR_LIKE,\n self::OPERATOR_NOT_LIKE,\n ],\n EntityMap::TYPE_INTEGER => [\n self::OPERATOR_EQ,\n self::OPERATOR_NEQ,\n self::OPERATOR_IS_NULL,\n self::OPERATOR_IS_NOT_NULL,\n self::OPERATOR_IN,\n self::OPERATOR_NOT_IN,\n self::OPERATOR_GT,\n self::OPERATOR_GTE,\n self::OPERATOR_LT,\n self::OPERATOR_LTE,\n self::OPERATOR_BTW,\n ],\n EntityMap::TYPE_DOUBLE => [\n self::OPERATOR_EQ,\n self::OPERATOR_NEQ,\n self::OPERATOR_IS_NULL,\n self::OPERATOR_IS_NOT_NULL,\n self::OPERATOR_IN,\n self::OPERATOR_NOT_IN,\n self::OPERATOR_GT,\n self::OPERATOR_GTE,\n self::OPERATOR_LT,\n self::OPERATOR_LTE,\n self::OPERATOR_BTW,\n ],\n EntityMap::TYPE_BOOLEAN => [\n self::OPERATOR_EQ,\n self::OPERATOR_NEQ,\n self::OPERATOR_IS_NULL,\n self::OPERATOR_IS_NOT_NULL,\n ],\n EntityMap::TYPE_ARRAY => [\n self::OPERATOR_EQ,\n self::OPERATOR_NEQ,\n self::OPERATOR_IS_EMPTY,\n self::OPERATOR_IS_NOT_EMPTY,\n self::OPERATOR_HAS,\n self::OPERATOR_NOT_HAS,\n ],\n ];\n }", "function isOperand($data)\n\t{\n\t\t$operator = array(\"*\",\"/\",\":\",\"+\",\"-\");\n\t\t$type = array();\n\t\t\n\t\t$i = 0;\n\t\tforeach($data as $key=>$val)\n\t\t{\n\t\t\tforeach($operator as $opr)\n\t\t\t{\n\t\t\t\tif($opr == $val)\n\t\t\t\t{\n\t\t\t\t\t$type[$i] = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(!empty($type[$i]))\n\t\t\t{\n\t\t\t\t$type['operator']['key'][] = $key;\n\t\t\t\t$type['operator']['val'][] = $val;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$type['number']['key'][] = $key;\n\t\t\t\t$type['number']['val'][] = $val;\n\t\t\t}\n\t\t\t\n\t\t\t$i++;\n\t\t}\n\t\t\n\t\treturn $type;\n\t}", "public function availableOperators()\n {\n return array('me', 'group', 'groups', 'in', 'ins');\n }", "private function isOperator($string)\n {\n return in_array($string, ['&', '|', '^']);\n }", "private function operatorValidator($operator): bool\r\n {\r\n if(is_string($operator)) {\r\n if(!in_array($operator, ['and', 'or'])) throw new \\InvalidArgumentException(\"String operator must be 'and' or 'or'.\");\r\n return true;\r\n } else if(!($operator instanceof \\stdClass)) {\r\n throw new \\InvalidArgumentException(\"Operator must be string or stdClass.\");\r\n }\r\n\r\n return false;\r\n }", "public function isArray($expression): static;", "public function isOperator($str) {\n\t\treturn in_array($str, array('=', '<', '>', '>=', '<=', '<>', '!=', '&', '~', '|', '^', '<<', '>>'));\n\t}", "private function isOperatorExists($operator) {\n return in_array($operator, $this->_available_operators);\n }", "public static function prepareOperator($value)\n {\n if (is_array($value)) {\n $firstValue = reset($value);\n\n if (in_array($firstValue, self::$operatorList)) {\n $operator = array_shift($value);\n } else {\n $operator = self::OPERATOR_IN;\n }\n\n return array($operator, $value);\n }\n\n $operator = self::OPERATOR_EQUALS;\n foreach (self::$operatorList as $searchableOperator) {\n $length = strlen($searchableOperator);\n if (substr($value, 0, $length) === $searchableOperator) {\n $operator = $searchableOperator;\n $value = substr($value, $length + 1);\n\n if ($operator === self::OPERATOR_NOT_IN) {\n $value = explode(',', $value);\n }\n\n return array($operator, $value);\n }\n }\n\n return array($operator, $value);\n }", "public function testInArray_returnsFalse_ifMatchDoesNotExist()\n\t{\n\t\treturn $this->assertFalse(Arr::inArray('q*', array('foo', 'bar', 'baz')));\n\t}", "public function whereIn($col, array $value, $and = true, $not = false);", "protected function allowedLogicalOperators(): array\n {\n return [\n FieldCriteria::AND,\n FieldCriteria::OR,\n ];\n }", "public function isOperator($element){\n\t\tif(in_array($element,$this->lowOperator))\n\t\t\treturn (true);\n\t\tif(in_array($element,$this->highOperator))\n\t\t\treturn (true);\n\t\treturn (false);\n\t}", "private static function isValidOperator($operator) {\n\t\t$operator = strtoupper($operator);\n\t\treturn !in_array($operator, self::ALLOWED_OPERATORS);\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$data_dna=R::getRow( 'SELECT FROM dna WHERE dog_id = :id',
function do_dna($id){ // [':id' => $id]); $dna_id=ret_dna($id); $data_dna=R::getRow( 'SELECT * FROM randodna WHERE id = :id', [':id' => $dna_id]); ('Hrhr'==$data_dna['hr'] ? $Hr='hr1' : $Hr='hr0'); //hr1 Hrhr - голая // hr0 - hrhr - пух ('ww'==$data_dna['ww'] ? $W='w0' : $W='w1'); ('ff'==$data_dna['ff'] ? $F='f0' : $F='f1'); ('bb'==$data_dna['bb'] ? $B='b0' : $B='b1'); ('tt'==$data_dna['tt'] ? $T='t0' : $T='t1'); ('mm'==$data_dna['mm'] ? $M='m0' : $M='m1'); $dna=$Hr . $W . $F . $B . $T . $M; return $dna; /* индексы в data_dna hr0w0f1b0t0m1 [2] - 1пух/0гол -hr0 [4] - 1белый/0нет-wo [6] - 1рыжий/0нет-f1 [8] - 1черный/0шоко - b0 [10] - 1пятна есть/0 нету - t0 TT [12] - 1крап есть/0 нету - m0 MM */ }
[ "function get_BlogInfo($id){\n $query = selectRecord(TAB_BLOGINFO, \"id = $id\");\n return $query;\n}", "function get_by_id($id){\n $data = tbl_karir::where('karir_id',$id)\n ->select('karir.*')\n ->get();\n return $data;\n }", "public function getUserDeUnDogByUserId($id) {\n\n $requete_prepare = $this->connexion->prepare(\n \"SELECT * FROM userDog WHERE id = :id\");\n\n $requete_prepare -> execute(array(\"id\" => $id ));\n $userDog=$requete_prepare->fetchObject(\"userDog\");\n return $userDog; \n\n}", "function globallink_get_row($row_id) {\n $result = db_select('globallink_core', 'tc')\n ->fields('tc')\n ->condition('rid', $row_id, '=')\n ->execute();\n\n foreach ($result as $row) {\n return $row;\n }\n}", "function getRow($taxonid) {\n $query = sprintf(\"SELECT * FROM `bryozone_taxa` WHERE `taxonid`='%s'\",\n mysql_real_escape_string($taxonid)\n );\n return mysql_fetch_assoc(mysql_query($query));\n}", "public function getArticlebyid($id){\n // or this code \n $data=model::db()->row(\"select * from articles where id=?\",$id);\n // var_dump($data);die;\n return $data;\n }", "public function getDataPeg($id){\r\n $q = \"SELECT KOLOK, KLOGAD,SPMU FROM PERS_PEGAWAI1 WHERE NRK='\".$id.\"'\";\r\n //$q = \"SELECT KOLOK, KLOGAD,SPMU FROM \\\"vw_jabatan_terakhir\\\" WHERE NRK='\".$id.\"'\";\r\n $query = $this->db->query($q)->row();\r\n \r\n return $query;\r\n }", "function ambil_data_id($id)\n\t{\n\t\t$this->db->where($this->id,$id);\n\t\treturn $this->db->get($this->nama_table)->row();\n\n\t}", "function term_retrieve_by_id($id) {\n $query = \"SELECT * FROM term WHERE term_id=$1 LIMIT 1\";\n\n return pg_query_params($GLOBALS['CONNECTION'], $query, array($id));\n}", "function getById($id) {\n\t\t$data=$this->db->where('id',$id);\n\t\t$data=$this->db->get(\"tb_pengurus\");\n\t\treturn $data;\n\t}", "public function getDataPeg1($id){\r\n //$q = \"SELECT KOLOK, KLOGAD,SPMU FROM PERS_PEGAWAI1 WHERE NRK='\".$id.\"'\";\r\n $q = \"SELECT KOLOK, KLOGAD,SPMU FROM PERS_PEGAWAI1 WHERE NRK='\".$id.\"'\";\r\n $query = $this->db->query($q)->row();\r\n \r\n return $query;\r\n }", "function ambil_data_id($id)\n\t\t{\n\t\t\t$this->db->where($this->id,$id);\n\t\t\treturn $this->db->get($this->nama_table)->row();\n\t\t}", "function query_drinks() {\n\t\t$conn = db_connect;\n\t\t\n\t\t$query = \"SELECT name, price FROM drinks\";\n\t\treturn $result = pg_query($conn,$query);\n\t}", "public function readDataFromDb(){\r\n $sql = \"SELECT id,name FROM .$this->table\";\r\n $result = $this->conn->query($sql);\r\n \r\n// if ($result->num_rows > 0) {\r\n//// \r\n// while ($row = $result->fetch_assoc()) {\r\n// echo '<p></p>'.$row[\"name\"];\r\n// }\r\n// }\r\n \r\n return $result;\r\n }", "function retrieveDrums(PDO $db) : array {\n $query = $db->prepare(\"SELECT `name`, `manufacturer`, `inches`, `notes`, `color`, `img-url` FROM steeldrums;\");\n $query->execute();\n return $query->fetchAll();\n}", "function queryNaSeq($gid) {\n $pdo = getPDO();\n try {\n $sql = \"select * from na_seq where gid = :id\";\n $ps = $pdo->prepare($sql);\n $ps->bindValue(\":id\", $gid);\n $ps->execute();\n $ps->setFetchMode(PDO::FETCH_ASSOC);\n $result = $ps->fetchAll();\n } catch (Exception $ex) {\n $error = \"An Error has occurred in data accessing.\";\n exit();\n }\n return $result;\n}", "function getPlacesData($places_id) {\n global $places;\n $places->setPlaces_id($places_id);\n $result = $places->select_all_id();\n\n\n $row = pg_fetch_row($result);\n $bob = $row[1];\n echo $bob;\n\n}", "function get_data_rawatinap(){\n $query = $this->db->query(\"SELECT * FROM rawat_inap\");\n return $query;\n }", "function get_riddle($riddle_id) {\n return db_row_query(\"SELECT * FROM `riddle` WHERE `id` = {$riddle_id}\");\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init Login Inicia el login, en este caso es solo iniciar una session.
public static function initLogin(){ Session::start(); }
[ "private function _login() {\n $user = $this->_user;\n $this->_session->open();\n $this->_session->id = $user->UserId;\n $this->_session->firstName = $user->FirstName;\n $this->_session->lastName = $user->LastName;\n ($user->Admin) ? $this->_session->admin = $user->Admin : null;\n }", "function MyApp_Login_Init()\n {\n $this->LoginType=\"Public\";\n $this->Profile=\"Public\";\n if ($this->Authentication)\n {\n $this->AuthHash();\n\n $this->MyApp_Login_Detect();\n $this->MyApp_Profile_Detect();\n }\n else\n {\n $this->LoginType=\"Public\";\n $this->Profile=\"Public\";\n }\n }", "public static function initialize() {\r\n\t\t$current_user_id = Session::peek('current_user_id');\r\n\t\tif (empty($current_user_id)) {\r\n\t\t\t// Backward compatability\r\n\t\t\t$current_user = Session::pull('current_user');\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$current_user = self::get($current_user_id);\r\n\t\t}\r\n\t\t\r\n\t\tif (empty($current_user)) {\r\n\t\t\tself::check_permanent_login();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tself::do_login($current_user);\r\n\t\t}\r\n\t}", "public static function init(){\n // if( Session::$session_started == false)\n {\n @session_start();\n //Session::$session_started = true;\n }\n // $_SESSION[\"loggedIn\"]=false;\n }", "public function init()\n\t{\n\t\tparent::init();\n\t\tYii::app()->getSession()->open();\n\t\tif($this->getIsGuest() && $this->allowAutoLogin)\n\t\t\t$this->restoreFromCookie();\n\t\telseif($this->autoRenewCookie && $this->allowAutoLogin)\n\t\t\t$this->renewCookie();\n\t\tif($this->autoUpdateFlash)\n\t\t\t$this->updateFlash();\n\n\t\t$this->updateAuthStatus();\n\t}", "public function init()\n {\n parent::init();\n if (Yii::app()->getSession()->autoStart)\n Yii::app()->getSession()->open();\n if ($this->getIsGuest() && $this->allowAutoLogin)\n $this->restoreFromCookie();\n elseif ($this->autoRenewCookie && $this->allowAutoLogin)\n $this->renewCookie();\n if ($this->autoUpdateFlash)\n $this->updateFlash();\n $this->updateAuthStatus();\n }", "function MyApp_Session_User_InitByAuth()\n {\n $authok=0;\n $action=$this->GetGETOrPOST(\"Action\");\n\n if ($action==\"Logon\")\n {\n //Logon requested\n $authok=$this->MyApp_Session_Auth();\n }\n elseif ($this->PublicAllowed)\n {\n return;\n }\n else\n {\n //Logon required\n $authok=$this->MyApp_Session_Auth();\n }\n\n if ($authok>0)\n {\n $sid=$this->MyApp_Session_SID_New();\n\n $this->MyApp_Session_SID_2LoginData($sid);\n\n\n global $SessionInitialized;\n $SessionIntialized=1;\n }\n elseif ($this->GetPOST(\"Login\") || $this->GetPOST(\"Password\"))\n {\n $this->HtmlStatus=\n $this->MyLanguage_GetMessage(\"InvalidPassword\");\n\n $this->RegisterBadLogon();\n }\n }", "public static function createLoginSession()\n {\n //check if user have an existent logging instance in the database\n $getHash = Cookie::get(REM_COOKIE_NAME);\n $record = databaseAPI::getInstance()->selectData(\"*\", [ ['hash', '=',$getHash] ], \"sessions\");\n if (empty($record))\n self::clearLoggedTrace();\n else\n Session::set(LOGIN_SESSION_NAME, $record[0]->user_id);\n }", "public function onLoad()\n {\n $login_mode = FormUtil::get('login');\n if ($login_mode == 1) {\n UserSession::get()->login(FormUtil::post('user'), FormUtil::post('passwd'));\n } elseif ($login_mode == 2) {\n UserSession::get()->logout();\n }\n }", "public function init()\n\t{\n\t\tif ( isset( $_SESSION[\"logged_in\"] ) ) {\n\t\t\treturn;\n\t\t}\n\t\t$_SESSION[\"logged_in\"]\t\t= false;\n\t\t$_SESSION[\"user_id\"]\t\t= false;\n\t\t\n\t\t$_SESSION[\"firstname\"]\t\t= \"\";\n\t\t$_SESSION[\"lastname\"]\t\t= \"\";\n\t\t$_SESSION[\"email\"]\t\t= \"\";\n\t\t$_SESSION[\"username\"]\t\t= \"\";\n\t\t$_SESSION[\"klasse\"]\t\t= \"\";\n\t\t$_SESSION[\"profilbild\"]\t\t= \"\";\n\t\t$_SESSION[\"hintergrundbild\"]\t= \"\";\n\t\t$_SESSION[\"admin\"]\t\t= false;\n\t}", "public function initSession()\n {\n if (null === $this->session) {\n $sessionId = $this->request->cookies->get('sessionId');\n\n if (null !== $sessionId) {\n $this->session = $this->sessionRepository->find($sessionId);\n }\n \n if (null === $this->session) {\n $this->session = new Session();\n $this->setData(self::createDefaultSessionData());\n }\n }\n }", "public function login() {\n\t\t$this->insertLogByType(CMSYS_LOG_LOGIN);\n\t}", "public static function init()\n {\n if(self::$sessionStarted == false){\n session_start();\n self::$sessionStarted = true;\n }\n }", "public function logIn(){\n\n $username = $this->getUsername();\n $password = $this->get('password');\n\n if($username && $password){\n\n $loggedIn = Object::$_restClient->login($username,$password);\n\n if(Object::$_restClient->statusCode() == 200){\n $this->clearDirtyKeys();\n $this->updateAttributes((array)$loggedIn);\n $this->unsetAttr('password');\n\n session_start();\n $_SESSION['parse-session-token'] = $this->sessionToken;\n $_SESSION['sparse-user'] = $this->toJSON();\n\n User::$_current = $this;\n }\n }\n }", "public function initSession()\n {\n }", "public function initializeLogin()\n {\n /** @var Uri $uri */\n $uri = $this->grav['uri'];\n\n // Admin has its own login; make sure we're not in admin.\n if (!isset($this->grav['admin'])) {\n $this->route = $this->config->get('plugins.loginldap.route');\n }\n\n // Register route to login page if it has been set.\n if ($this->route && $this->route == $uri->path()) {\n $this->enable([\n 'onPagesInitialized' => ['addLoginPage', 0],\n ]);\n return;\n }\n\n // If not a known login-related page type...\n $this->enable([\n 'onOutputGenerated' => ['onOutputGenerated', 0]\n ]);\n }", "function init()\n {\n global $db;\n $this->id = $_SESSION['ID'] = (isset($_SESSION['ID'])) ? session_id($_SESSION['ID']) : session_id();\n $this->started = $_SESSION['STARTED'] = (isset($_SESSION['STARTED'])) ? $_SESSION['STARTED'] : time();\n $this->name = $_SESSION['NAME'] = (isset($_SESSION['NAME'])) ? $_SESSION['NAME'] : 'Guest';\n $this->otun = isset($_SESSION['OTUN']) ? $_SESSION['OTUN'] : null;\n\n if (isset($_COOKIE['user'])) {\n $this->getCookieVars();\n if (isset($this->cookie['otun'])) {\n if ($this->cookie['otun'] === $this->otun) {\n $this->user = $this->dbOtunMatchesUser();\n if ($this->user) {\n $this->updateOtun();\n $this->sessionCookieSave();\n $this->loggedIn = true;\n $this->userPermissions = $this->getUserPermissions($this->user);\n return;\n }\n }\n }\n $this->logout($this->otun);\n if (isset($this->cookie['otun'])) {\n $this->logout($this->cookie['otun']);\n }\n $this->resetSession();\n }\n }", "private function _checkLogin() {\n if(Controller_Request::session(\"id\")) {\n $this->userId = Controller_Request::session(\"id\");\n $this->_loggedIn = TRUE;\n $this->firstName = Controller_Request::session(\"firstname\");\n $this->setRank(Controller_Request::session(\"rank\"));\n $this->team = Controller_Request::session(\"team\");\n } else {\n unset($this->userId);\n $this->_loggedIn = FALSE;\n }\n }", "public function login()\n {\n Models\\User\\Login::create($this);\n $_SESSION['current_userID'] = $this->userID;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operation walletGetRecordsAsyncWithHttpInfo Get wallet fund records
public function walletGetRecordsAsyncWithHttpInfo($start_date = null, $end_date = null, $currency = null, $wallet_fund_type = null, $page = null, $limit = null) { $returnType = 'object'; $request = $this->walletGetRecordsRequest($start_date, $end_date, $currency, $wallet_fund_type, $page, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); if ($returnType !== 'string') { $content = json_decode($content); } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } ); }
[ "protected function walletGetRecordsRequest($start_date = null, $end_date = null, $currency = null, $wallet_fund_type = null, $page = null, $limit = null)\n {\n\n $resourcePath = '/open-api/wallet/fund/records';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($start_date !== null) {\n $queryParams['start_date'] = ObjectSerializer::toQueryValue($start_date);\n }\n // query params\n if ($end_date !== null) {\n $queryParams['end_date'] = ObjectSerializer::toQueryValue($end_date);\n }\n // query params\n if ($currency !== null) {\n $queryParams['currency'] = ObjectSerializer::toQueryValue($currency);\n }\n // query params\n if ($wallet_fund_type !== null) {\n $queryParams['wallet_fund_type'] = ObjectSerializer::toQueryValue($wallet_fund_type);\n }\n // query params\n if ($page !== null) {\n $queryParams['page'] = ObjectSerializer::toQueryValue($page);\n }\n // query params\n if ($limit !== null) {\n $queryParams['limit'] = ObjectSerializer::toQueryValue($limit);\n }\n\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json', 'application/x-www-form-urlencoded']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('api_key');\n if ($apiKey !== null) {\n $queryParams['api_key'] = $apiKey;\n }\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('sign');\n if ($apiKey !== null) {\n $queryParams['sign'] = $apiKey;\n }\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('timestamp');\n if ($apiKey !== null) {\n $queryParams['timestamp'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public static function wallets() {\n\n return ADAPAY::query(array(\n 'method' => 'GET',\n 'url' => '/wallets'\n ));\n\n }", "public function getUserWallets() \n {\n // Token is required for this method\n if (!$this->access_token) {\n throw new BitaloApi_Exception(\"Token is required for calling \" . __FUNCTION__, \n BitaloApi_Exception::TOKEN_MISSING);\n }\n\n return $this->request(\"GET\", self::API_URL . \"/user/wallets/\");\n }", "public function getWallets($account)\n {\n }", "public function getWalletHistory() {\n\n //parse inputs\n $resourcePath = \"/user/walletHistory\";\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n $method = \"GET\";\n $queryParams = array();\n $headerParams = array();\n $headerParams['Accept'] = 'application/json';\n $headerParams['Content-Type'] = 'application/json';\n\n // Generate form params\n if (! isset($body)) {\n $body = array();\n }\n if (empty($body)) {\n $body = null;\n }\n\n // Make the API Call\n $response = $this->apiClient->callAPI($resourcePath, $method,\n $queryParams, $body,\n $headerParams);\n\n\n if(! $response){\n return null;\n }\n\n $responseObject = $this->apiClient->deserialize($response,\n 'Array[Transaction]');\n return $responseObject;\n\n }", "protected function getWalletBalancesRequest()\n {\n\n $resourcePath = '/wallets/totals';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n\n if ($multipart) {\n $headers= $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n []\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n $httpBody = new MultipartStream($multipartContents); // for HTTP post (form)\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams); // for HTTP post (form)\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : '');\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n return new Request(\n 'GET',\n $url,\n $headers,\n $httpBody\n );\n }", "public function recordingsGet()\n {\n list($response) = $this->recordingsGetWithHttpInfo();\n return $response;\n }", "public function get_external_wallets()\n {\n return $this->apiClient->get_request(\"/v1/external_wallets\");\n }", "public function getWalletBalancesAsyncWithHttpInfo()\n {\n $returnType = '\\KnetikCloud\\Model\\PageResourceWalletTotalResponse_';\n $request = $this->getWalletBalancesRequest();\n\n return $this->client->sendAsync($request)->then(function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }, function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n \"[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})\",\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n });\n }", "function getUserWalletTransactions()\n {\n $token = refreshAuthToken();\n \n global $I_A_N;\n global $u_id;\n global $endpoint;\n global $wallet_currency;\n \n $user_wallet_currency = $wallet_currency;\n \n $curl = curl_init();\n\n $request_fields = [\n \"GetUserWalletTransactions\"=>[\n \"Request\"=>[\n \"IssuerAccountNumber\"=>$I_A_N,\n \"UserID\"=>$u_id,\n \"WalletCurrency\"=>$user_wallet_currency,\n \"Pagination\"=>[\n \"RecordsToSkip\"=>\"1\",\n \"RecordsToTake\"=>\"10\"\n ]\n ]\n ]\n ];\n\n $json_typed = json_encode($request_fields);\n \n curl_setopt_array($curl, array(\n CURLOPT_URL => $endpoint.'/API/V4/Wallet/GetUserWalletTransactions',\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => '',\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 0,\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => 'POST',\n CURLOPT_POSTFIELDS => $json_typed,\n CURLOPT_HTTPHEADER => array(\n \"Content-Type: application/json\",\n \"Authorization: Bearer \".$token\n )\n ));\n \n $response = curl_exec($curl);\n $err = curl_error($curl);\n\n curl_close($curl);\n\n $resp = json_decode($response, true);\n\n //global $go_home;\n\n if ($err) {\n echo \"cURL Error #:\" . $err;\n } else {\n echo \"<h1>User Wallet Transactions</h1>\";\n //echo \"<p><a href='\".$go_home.\"'>Return to API calls test page</a></p>\";\n foreach($resp as $resps){\n foreach($resps as $results){\n foreach($results as $transaction=>$part){\n echo $transaction.\" = \".$part.\"<br>\";\n }\n }\n }\n }\n }", "public function getRecordInformation() {\n\n $commands = $this->buildRequest(0x3C);\n\n $res = $this->request($commands, 0);\n\n $output = [];\n\n if ($res['ret'] == PHPAnviz::ACK_SUCCESS && $res['ack'] == 0xBC) {\n\n $data = [\n 'user_amount' => hexdec(implode(array_slice($res['data'], 0, 3))),\n 'fp_amount' => hexdec(implode(array_slice($res['data'], 3, 3))),\n 'password_amount' => hexdec(implode(array_slice($res['data'], 6, 3))),\n 'card_amount' => hexdec(implode(array_slice($res['data'], 9, 3))),\n 'all_record_amount' => hexdec(implode(array_slice($res['data'], 12, 3))),\n 'new_record_amount' => hexdec(implode(array_slice($res['data'], 15, 3))),\n ];\n\n $output = $data;\n\n return $output;\n }\n\n return false;\n }", "public function get(array $params = [])\n {\n return $this->handleMiddleware('get', $params, function(MiddlewareRequest $request) {\n $params = $request->getApiMethodArguments();\n $data = $params;\n $response = $this->apiInstance->leadsCallRecordsGet($data);\n return $this->handleResponse($response);\n });\n }", "public function getRecords(string $baseId, string $tableId, ?int $limit = null): AirtableResponseDataTransfer;", "public function get_internal_wallets()\n {\n return $this->apiClient->get_request(\"/v1/internal_wallets\");\n }", "public function getWallets(): array\n {\n return $this->manager->request('get_wallets', [], ChiaManager::WALLET_SERVER);\n }", "public function allWallets($page = 1, $limit = 20);", "public function getAccountsWithHttpInfo()\n {\n $request = $this->getAccountsRequest();\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n switch($statusCode) {\n case 200:\n if ('\\com.blockchain.exchange.rest\\com.blockchain.exchange.rest.model\\BalanceMap' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\com.blockchain.exchange.rest\\com.blockchain.exchange.rest.model\\BalanceMap', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\com.blockchain.exchange.rest\\com.blockchain.exchange.rest.model\\BalanceMap';\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\com.blockchain.exchange.rest\\com.blockchain.exchange.rest.model\\BalanceMap',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function getWalletTrades($wallet_id){\n\n if(!$wallet_id) return 'Wallet ID is missing, please enter the wallet id';\n\n $url = \"$this->base_url/wallets/$wallet_id/trades\";\n return $this->sendRequest('GET', $url);\n }", "public function getWalletData();" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns parsed profile from behat.yml
protected function getBehatConfig() { if (!$this->behatConfig) { $configPath = $this->getConfigFileName(); if (!file_exists($configPath)) { throw new \InvalidArgumentException("Cannot open config file '$configPath'."); } $this->behatConfig = Yaml::parse($configPath); } $profileName = $this->getConfigProfile(); if (!isset($this->behatConfig[$profileName])) { throw new \InvalidArgumentException("Profile '$profileName' is undefined in '$configPath'."); } return $this->behatConfig[$profileName]; }
[ "public function getProfile()\n {\n return $this->getValue(self::PROFILE);\n }", "function loadProfile() {\n $response = $this->client->get(\n sprintf(\"http://%s/v1/user/%s/profile\",\n SOCIAL_WS_HOSTNAME,\n urlencode($this->guid)));\n if(is_null($response) || $response[\"code\"] != 200) {\n return NULL;\n }\n\n $profile = json_decode($response[\"responseBody\"]);\n return $profile->profile;\n }", "public function getProfile()\n {\n return $this->_profile;\n }", "public function getProfile()\r\n\t{\r\n\t\treturn $this->profile;\r\n\t}", "public function getProfile();", "function drupal_get_profile() {\n global $install_state;\n\n if (isset($install_state['parameters']['profile'])) {\n $profile = $install_state['parameters']['profile'];\n }\n else {\n $profile = variable_get('install_profile', 'standard');\n }\n\n return $profile;\n}", "public function testProfile() {\n $profile = <<<PROFILE_TEST\ncore_version_requirement: '*'\nname: The Perfect Profile\ntype: profile\ndescription: 'This profile makes Drupal perfect. You should have no complaints.'\nPROFILE_TEST;\n\n vfsStream::setup('profiles');\n vfsStream::create([\n 'fixtures' => [\n 'invalid_profile.info.txt' => $profile,\n ],\n ]);\n $info = $this->infoParser->parse(vfsStream::url('profiles/fixtures/invalid_profile.info.txt'));\n $this->assertFalse($info['core_incompatible']);\n }", "private function get_profile() {\n\t\treturn monsterinsights_get_option( 'analytics_profile', false );\n\t}", "public function getResponseProfile()\n\t{\n\t\tif(isset($this->requestConfiguration['responseProfile']))\n\t\t{\n\t\t\treturn $this->requestConfiguration['responseProfile'];\n\t\t}\n\t\t\n\t\treturn null;\n\t}", "public function getProfile()\n {\n }", "function getUserProfile()\n {\n $this->api->curl_header = array(\n 'Authorization: Bearer '.$this->api->access_token,\n );\n $data = $this->api->get( $this->userProfileUrl );\n $data = VariableUtil::json2Array($data);\n\n /*\n * Get the base URL with the instance to store it along with the\n * Token data.\n */\n $urlParts = parse_url($data['profile']);\n $this->api->api_base_url = $urlParts['scheme'].'://'.$urlParts['host'];\n\n return $data;\n }", "public function getProfile()\n {\n if (! $this->kernel->getContainer()->has('profiler')) {\n return false;\n }\n\n return $this->kernel->getContainer()->get('profiler')->loadProfileFromResponse($this->response);\n }", "public function getProfile()\n {\n return isset($this->profile) ? $this->profile : null;\n }", "protected function getSymfonyProfile()\n {\n $profile = $this->getSymfonyClient()->getProfile();\n if (false === $profile) {\n throw new \\RuntimeException('No profile associated with the current client response');\n }\n\n return $profile;\n }", "public function getTheFirstProfile()\n {\n return $this->profiles[0];\n }", "public function getProfileText()\n {\n return $this->getValueByKey($this->response, 'profileText');\n }", "public function getProfileDesc()\n {\n return $this->profileDesc;\n }", "protected function getCurrentProfileName()\n {\n $input = new \\Symfony\\Component\\Console\\Input\\ArgvInput($_SERVER['argv']);\n $profileName = $input->getParameterOption(array('--profile', '-p')) ? : 'default';\n return $profileName;\n }", "public function getExecutionProfile(): string;" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether the set is a proper subset of other. In other words set <= other and set != other.
public function isProperSubset($other) { $this->_sanityCheck($other, __METHOD__); return count($this) < count($other) && $this->isSubset($other); }
[ "public function isSubset(EnumSet $other): bool\n {\n return $this->enumeration === $other->enumeration\n && ($this->bitset & $other->bitset) === $this->bitset;\n }", "function issubset($other) {\n $other= set($other);\n foreach($this->_dct as $e => $_)\n if(!isset($other[$e]))\n return false;\n return true;\n }", "public function subsetOf(Set|NonEmptySet $superset): bool;", "public static function isSubset(Set $lhs, Set $rhs) {\n foreach($lhs as $element)\n if (!$rhs->contains($element))\n return FALSE;\n return TRUE;\n }", "function isSubSet( $array1, $array2)\n\t{\n\t\t//$a2 = $array2;\t\t\n\t\tif( count($array1) > count($array2))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tforeach( $array1 as $letter )\n\t\t{\n\t\t\t$foundIn = array_search($letter, $array2);\n\t\t\tif( $foundIn !== FALSE )\n\t\t\t{\n\t\t\t\tunset($array2[$foundIn]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\t\t//error_log(\"Array1:\".implode(\"\", $array1).\" | TO BE EVALUATED:\".implode(\"\", $a2).\" Final:\".implode(\"\", $array2).\"\\n\");\n\n\t\treturn TRUE;\n\t}", "public function lteq($other) {\n return $this->compare($other)!=1;\n }", "public function issuperset($set) {\n return $set->issubset($this);\n }", "#[@test]\n public function doesNotEqualSetWithDifferentContents() {\n $other= new HashSet();\n $this->set->add(new String('blue'));\n $other->add(new String('yellow'));\n $this->assertFalse($this->set->equals($other));\n }", "public function isSubsetOf(Set $set) \n {\n if(count(array_diff($this->content, $set->getContent())) === 0)\n return true;\n return false;\n }", "public function issubset($set) {\n if ($set->size() < $this->size()) {\n return false;\n }\n foreach ($this as $idx => $element) {\n if (!$set->has($element)) {\n return false;\n }\n }\n return true;\n }", "function isdisjoint($other) {\n foreach(set($other) as $e)\n if(isset($this[$e]))\n return false;\n return true;\n }", "public function isEqual(EnumSet $other)\n {\n return $this->enumeration === $other->enumeration\n && $this->bitset === $other->bitset;\n }", "function isdisjoint($other) {\n foreach(set($other) as $e)\n if(isset($this[$e]))\n return false;\n return true;\n }", "function is_equal(tree $other): bool {\n // We must treat the triples array as an unordered set\n // (where the two sets are equal even if values are present\n // in a different order).\n // Therefore, we cannot simply check if array_values()\n // for each set is equal.\n foreach($this->triples as $k => $t) {\n $o = @$other->triples[$k];\n if(!$o || !$t->is_equal($o)){\n return false;\n }\n }\n foreach($other->triples as $k => $t) {\n $o = @$this->triples[$k];\n if(!$o || !$t->is_equal($o)){\n return false;\n }\n }\n return true;\n }", "public function startsAfterNonDisjoint(Interval $other) : bool\r\n\t{\r\n\t\treturn $this->start > $other->start && $this->start <= $other->stop; // this.b>=other.b implied\r\n\t}", "public static function isSubSet($array1, $array2)\n {\n foreach( $array1 as $key=>$value ) {\n if( isset($array2[$key]) ) {\n if( is_array($value) ) {\n if( !Utility::isSubSet($value, $array2[$key]) ) {\n return false;\n }\n }\n else {\n if( $value!==$array2[$key] ) {\n return false;\n }\n }\n }\n else {\n return false;\n }\n }\n return true;\n }", "public static function isSuperset(Common\\Mutable\\ISet $xs, Common\\Mutable\\ISet $ys) {\n\t\t\tforeach ($xs as $x) {\n\t\t\t\tif (!$ys->hasValue($x)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}", "public function intersect(Set|NonEmptySet $that): Set;", "function assertIsSubset($subset=array(), $set=array()){\n\t\t$check = $this->assertIsSubsetWrapped($subset,$set);\n\t\tif($check['match'] == true){\n\t\t\treturn $this->assertEqual(1,1);\n\t\t}else{\n\t\t\tif(!empty($check['errorMsg'])){\n\t\t\t\ttry {\n\t\t\t\t throw new Exception( $check['errorMsg']);\n\t\t\t\t} catch (Exception $e) {\n\t\t\t\t\techo 'Caught exception: ', $e->getMessage(), \"\\n\";\n\t\t\t\t // return $this->assertEqual(1,$check['errorMsg']);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t$matcherEvalString = '';\n\t\t\tforeach($check['keyTrail'] as $key){\n\t\t\t\t$matcherEvalString.=\"['$key']\";\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\teval('$first'.$matcherEvalString.' = \"'. $check['errorVals']['first'].'\";' );\n\t\t\teval('$second'.$matcherEvalString.' = \"'. $check['errorVals']['second'].'\";' );\n\t\t\t\n\t\t\treturn $this->assert(\n \tnew EqualExpectation($first),\n \t$second //, $message\n );\n\t\t}\n\t\t\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Plugin Name: CoAuthors Plus Rest API Description: Simple plugin to include coauthors in posts via WP Rest API. Version: 0.0.4 License: GPL2+
function init_endpoints() { if ( function_exists('get_coauthors') ) { add_action( 'rest_api_init', 'custom_register_coauthors' ); function custom_register_coauthors() { register_rest_field( 'post', 'coauthors', array( 'get_callback' => 'custom_get_coauthors', 'update_callback' => null, 'schema' => null, ) ); } function custom_get_coauthors( $object, $field_name, $request ) { $coauthors = get_coauthors($object['id']); $authors = array(); foreach ($coauthors as $author) { $authors[] = array( 'id' => $author->id, 'name' => $author->display_name, 'slug' => $author->user_nicename, 'description' => $author->description, 'email' => $author->user_email, 'avatar_urls' => rest_get_avatar_urls($author->user_email) ); }; return $authors; } } }
[ "function coauthors_plus_get_authors( $args = array() ) {\n\tglobal $coauthors_plus;\n\n\t/** Make sure the needed stuff is active. */\n\tif ( empty( $coauthors_plus ) ) {\n\t\treturn array();\n\t}\n\n\t$args = wp_parse_args( $args, array(\n\t\t'user_roles' => array( 'author', 'contributor' ),\n\n\t\t'user_fields' => array(\n\t\t\t'display_name' => array( 'column', 'display_name' ),\n\t\t\t'first_name' => array( 'meta', 'first_name' ),\n\t\t\t'last_name' => array( 'meta', 'last_name' ),\n\t\t\t'user_login' => array( 'column', 'user_login' ),\n\t\t\t'user_nicename' => array( 'column', 'user_nicename' ),\n\t\t\t'user_email' => array( 'column', 'user_email' ),\n\t\t\t'website' => array( 'column', 'user_url' ),\n\t\t\t'description' => array( 'meta', 'description' ),\n\t\t),\n\n\t\t'guest_fields' => array(\n\t\t\t'display_name' => array( 'meta', 'cap-display_name' ),\n\t\t\t'first_name' => array( 'meta', 'cap-first_name' ),\n\t\t\t'last_name' => array( 'meta', 'cap-last_name' ),\n\t\t\t'user_login' => array( 'meta', 'cap-user_login' ),\n\t\t\t'user_nicename' => array( 'column', 'post_name' ),\n\t\t\t'user_email' => array( 'meta', 'cap-user_email' ),\n\t\t\t'website' => array( 'meta', 'cap-website' ),\n\t\t\t'description' => array( 'meta', 'cap-description' ),\n\t\t),\n\n\t\t'resolve_images' => array(),\n\n\t\t'hide_empty' => false,\n\n\t\t'order' => array( 'display_name' => 'ASC' ),\n\t\t'number' => 5,\n\t\t'paged' => 1,\n\t) );\n\n\t/**\n\t * @filter `coauthors_plus_get_authors_query_args` Filter the arguments to add stuff if needed.\n\t * @param array $args The passed args.\n\t */\n\t$args = apply_filters( 'coauthors_plus_get_authors_query_args', $args );\n\n\tif ( implode( '|', array_keys( $args['user_fields'] ) ) != implode( '|', array_keys( $args['guest_fields'] ) ) ) {\n\t\tthrow new Exception( 'Number of column for users and guests have to match and be in the same order.' );\n\t}\n\n\tglobal $wpdb;\n\n\t/** Users. */\n\t$columns = array();\n\t$joins = array();\n\t$wheres = array();\n\n\t/** Header. */\n\t$user_header = array(\n\t\t'is_guest' => 'false',\n\t\t'ID' => 'u.ID',\n\t);\n\tforeach ( $user_header as $alias => $column ) {\n\t\t$columns []= sprintf( \"$column $alias\" );\n\t}\n\n\t/** User fields. */\n\tforeach ( $args['user_fields'] as $alias => $field ) {\n\t\tlist( $type, $column ) = $field;\n\t\tif ( $type == 'column' ) {\n\t\t\t$columns []= sprintf( \"u.$column $alias\" );\n\t\t} else {\n\t\t\t$columns []= sprintf( \"um_$alias.meta_value $alias\" );\n\t\t\t$joins []= sprintf( \"LEFT JOIN {$wpdb->usermeta} um_$alias ON um_$alias.user_ID = u.ID\" );\n\t\t\t$wheres []= sprintf( \"um_$alias.meta_key = '$column'\" );\n\t\t}\n\t}\n\n\t/** Filter users by capabilities. */\n\t$joins []= sprintf( \"LEFT JOIN {$wpdb->usermeta} caps ON caps.user_ID = u.ID\" );\n\t$caps_like = array_map( function( $role ) {\n\t\treturn \"caps.meta_value LIKE '%:\\\"$role\\\";%'\";\n\t}, $args['user_roles'] );\n\t$wheres []= sprintf( \"caps.meta_key = '%scapabilities' AND (%s)\", $wpdb->get_blog_prefix(), implode( ' OR ', $caps_like ) );\n\n\t/** Add post_count */\n\t$columns []= sprintf( \"tt.count post_count\" );\n\t$joins []= sprintf( \"LEFT JOIN {$wpdb->terms} t ON t.slug = concat('cap-', u.user_nicename)\" );\n\t$joins []= sprintf( \"LEFT JOIN {$wpdb->term_taxonomy} tt ON tt.term_id = t.term_id\" );\n\tif ( $args['hide_empty'] ) {\n\t\t$wheres []= sprintf( \"tt.count > 0\" );\n\t}\n\n\t/** Build half of the whole thing. */\n\t$sql = sprintf( \"SELECT\\n%s\", implode( \", \", $columns ) );\n\t$sql .= sprintf( \"\\nFROM {$wpdb->users} u\\n\" );\n\t$sql .= sprintf( \"%s\\n\", implode( \"\\n\", $joins ) );\n\t$sql .= sprintf( \"WHERE %s\\n\", implode( \"\\nAND \", $wheres ) );\n\n\tif ( $coauthors_plus->is_guest_authors_enabled() ) {\n\t\t/** Guests. */\n\t\t$columns = array();\n\t\t$joins = array();\n\t\t$wheres = array();\n\n\t\t/** Header. */\n\t\t$guest_header = array(\n\t\t\t'is_guest' => 'true',\n\t\t\t'ID' => 'g.ID',\n\t\t);\n\t\tforeach ( $guest_header as $alias => $column ) {\n\t\t\t$columns []= sprintf( \"$column $alias\" );\n\t\t}\n\n\t\t/** Guest fields. */\n\t\tforeach ( $args['guest_fields'] as $alias => $field ) {\n\t\t\tlist( $type, $column ) = $field;\n\t\t\tif ( $type == 'column' ) {\n\t\t\t\t$columns []= sprintf( \"g.$column $alias\" );\n\t\t\t} else {\n\t\t\t\t$columns []= sprintf( \"gm_$alias.meta_value $alias\" );\n\t\t\t\t$joins []= sprintf( \"LEFT JOIN {$wpdb->postmeta} gm_$alias ON gm_$alias.post_ID = g.ID\" );\n\t\t\t\t$wheres []= sprintf( \"gm_$alias.meta_key = '$column'\" );\n\t\t\t}\n\t\t}\n\n\t\t/** Filter by Guest post type. */\n\t\t$wheres []= \"g.post_type = '{$coauthors_plus->guest_authors->post_type}'\";\n\n\t\t/** Add post_count */\n\t\t$columns []= sprintf( \"tt.count post_count\" );\n\t\t$joins []= sprintf( \"LEFT JOIN {$wpdb->terms} t ON t.slug = g.post_name\" );\n\t\t$joins []= sprintf( \"LEFT JOIN {$wpdb->term_taxonomy} tt ON tt.term_id = t.term_id\" );\n\t\tif ( $args['hide_empty'] ) {\n\t\t\t$wheres []= sprintf( \"tt.count > 0\" );\n\t\t}\n\n\t\t/** Build half of the whole thing. */\n\t\t$sql .= sprintf( \"\\nUNION SELECT\\n%s\", implode( \", \", $columns ) );\n\t\t$sql .= sprintf( \"\\nFROM {$wpdb->posts} g\\n\" );\n\t\t$sql .= sprintf( \"%s\\n\", implode( \"\\n\", $joins ) );\n\t\t$sql .= sprintf( \"WHERE %s\\n\", implode( \"\\nAND \", $wheres ) );\n\t}\n\n\t/** Order. */\n\t$orders = array();\n\tforeach ( $args['order'] as $column => $direction ) {\n\t\t$orders []= \"$column $direction\";\n\t}\n\n\t$sql .= sprintf( \"ORDER BY %s\\n\", implode( \", \", $orders ) );\n\tif ( $args['number'] > 0 ) {\n\t\t$sql .= sprintf( \"LIMIT %d, %d\", ( $args['paged'] - 1 ) * $args['number'], $args['number'] );\n\t}\n\n\t$authors = $wpdb->get_results( $sql );\n\n\t/**\n\t * Fetch all attachments for resolution.\n\t */\n\t$attachment_ids = array();\n\tforeach ( $authors as $author ) {\n\t\tforeach ( $args['resolve_images'] as $image_field ) {\n\t\t\tif ( intval( $author->$image_field ) > 0 ) {\n\t\t\t\t$attachment_ids []= $author->$image_field;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( $attachment_ids ) {\n\t\t$attachments = array();\n\t\tforeach ( $wpdb->get_results( sprintf( \"SELECT post_ID, meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_wp_attached_file' AND post_ID IN (%s)\",\n\t\t\timplode( ',', array_map( 'intval', $attachment_ids ) ) ), ARRAY_N ) as $attachment ) {\n\t\t\t\t$attachments[$attachment[0]] = $attachment[1];\n\t\t\t}\n\n\t\tforeach ( $authors as $author ) {\n\t\t\tforeach ( $args['resolve_images'] as $image_field ) {\n\t\t\t\tif ( $author->$image_field && ! empty( $attachments[$author->$image_field] ) ) {\n\t\t\t\t\t$author->$image_field = $attachments[$author->$image_field];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn $authors;\n}", "function _vwrpae_add_author_name_to_post_show() {\n register_rest_field('post', 'author_name', array(\n 'get_callback' => function($post) {\n return get_the_author_meta('display_name', $post['author']);\n },\n 'scheme' => array(\n 'author_name' => __('author name'),\n 'type' => 'text',\n ),\n ));\n }", "function enable_co_authors_plus_on_all_post_types() {\n add_filter( 'coauthors_supported_post_types', function( $post_types ) { return array_merge( $post_types, array_keys($this->self->custom_types) ); } );\n // The following two lines place the co-author box on the right hand side\n // After the main page \"meta-data\" publish box...\n add_filter( 'coauthors_meta_box_context', function() { return 'side'; } ); // Move to right hand side\n add_filter( 'coauthors_meta_box_priority', function() { return 'low'; } ); // Place under other boxes\n return $this;\n }", "function gcap_post_author_link_handler() {\n if( function_exists( 'coauthors_links' ) ) {\n //return coauthors_links( null, null, '<span class=\"entry-author-name\" itemprop=\"name\">', '</span>', false );\n\n $authors = get_coauthors();\n $content = '';\n $counter = 1;\n\n foreach( $authors as $author ) {\n\n if( empty( $author->website ) ) {\n $content .= $author->display_name;\n } else {\n $content .= sprintf( '<a href=\"%s\" title=\"%s\" rel=\"external\">%s</a>',\n $author->website,\n esc_attr( sprintf(__(\"Visit %s&#8217;s website\"), $author->display_name) ),\n $author->display_name\n );\n }\n\n $counter++;\n\n if( $counter == count( $authors ) )\n $content .= ' and ';\n else if( $counter > count( $authors ) )\n $content .= '';\n else\n $content .= ', ';\n }\n return $content;\n\n } else {\n return genesis_post_author_link_shortcode();\n }\n\n}", "function social_sites_setup(){\n add_action( 'customize_register', 'social_sites_customizer' );\n social_sites_rest_api();\n }", "function add_post_source() {\n register_rest_field( 'post',\n 'blocks', \n array(\n 'get_callback' => 'get_post_src',\n 'update_callback' => null,\n 'schema' => null,\n )\n );\n}", "public static function registerApiHooks() {\n register_rest_field(\n self::$postTypeName,\n 'citation',\n array(\n 'get_callback' => function($post) {\n $field_type = self::getFieldType( $post['id'] );\n if( !$field_type ) return;\n self::setupCitationMeta( $post['id'] );\n $citation_meta = self::$CitationMeta;\n $citation_meta['rendered'] = self::getCitation( $post['id'] );\n\n return $citation_meta;\n },\n )\n );\n }", "function rs_add_params_to_json() {\n register_rest_field( 'post', 'featured_image_src', array(\n 'get_callback' => 'get_image_src',\n 'update_callback' => null,\n 'schema' => null,\n )\n );\n register_rest_field( 'post', 'author_name', array(\n 'get_callback' => 'get_author_display_name',\n 'update_callback' => null,\n 'schema' => null,\n )\n );\n register_rest_field( 'post', 'author_image', array(\n 'get_callback' => 'get_author_search_image',\n 'update_callback' => null,\n 'schema' => null,\n )\n );\n register_rest_field( 'post', 'full_categories', array(\n 'get_callback' => 'get_full_categories',\n 'update_callback' => null,\n 'schema' => null,\n )\n );\n register_rest_field( 'post', 'views', array(\n 'get_callback' => 'get_views',\n 'update_callback' => null,\n 'schema' => null,\n )\n );\n register_rest_field( 'post', 'real_date', array(\n 'get_callback' => 'rs_get_realdate',\n 'update_callback' => null,\n 'schema' => null,\n )\n );\n}", "public function get_authors();", "function quiescent_modify_post_response() {\n\t// adding a field for the featured image\n\tregister_rest_field( 'post', 'quiescent_featured_image', array(\n\t\t'get_callback'\t\t=> 'quiescent_get_featured_image',\n\t\t'update_callback'\t=> null,\n\t\t'schema'\t\t\t=> null\n\t) );\n\n\t// adding a field for author name\n\tregister_rest_field( 'post', 'quiescent_author_name', array(\n\t\t'get_callback'\t\t=> 'quiescent_get_author_name',\n\t\t'update_callback'\t=> null,\n\t\t'schema'\t\t\t=> null\n\t) );\n\n\t// adding a field for categories\n\tregister_rest_field( 'post', 'quiescent_categories', array(\n\t\t'get_callback'\t\t=> 'quiescent_get_categories',\n\t\t'update_callback'\t=> null,\n\t\t'schema'\t\t\t=> null\n\t) );\n}", "function wc_show_author() {\n global $post;\n echo \"This plugin was made by William Cayetano\";\n\n}", "function register_authors_for_post($post_id, $authors) {\n global $coauthors_plus;\n $coauthors = Array();\n\n if (empty($authors)) { \n //default to whatever acct is specified\n wp_update_post(array(\"post_author\" => DEFAULT_AUTHOR_ID, \"ID\" => $post_id));\n return;\n }\n \n foreach($authors as $author) {\n //generate_wp_username accepts firstname/lastname, but then just concatenates\n $name = sanitize_user($this->generate_wp_username($author['first_name'],$author['last_name'])); \n $coauthors[] = $name;\n }\n\n //coauthors requires an author to be set\n $author = $coauthors[0];\n if( $author ) {\n $author_data = get_user_by( 'login', $author );\n wp_update_post(array(\"post_author\" => $author_data->ID, \"ID\" => $post_id));\n }\n $coauthors_plus->add_coauthors($post_id, $coauthors);\n }", "function RBTM_RelPost_register_fields() {\n\t// Add Author Name\n\tregister_rest_field( 'post',\n\t\t'author_name',\n\t\tarray(\n\t\t\t'get_callback'\t\t=> 'RBTM_RelPost_get_author_name',\n\t\t\t'update_callback'\t=> null,\n\t\t\t'schema'\t\t=> null\n\t\t)\n\t);\n\n\t// Add Featured Image\n\tregister_rest_field( 'post',\n\t\t'featured_image_src',\n\t\tarray(\n\t\t\t'get_callback'\t\t=> 'RBTM_RelPost_get_image_src',\n\t\t\t'update_callback'\t=> null,\n\t\t\t'schema'\t\t=> null\n\t\t)\n\t);\n\n // Add Excerpt\n\tregister_rest_field( 'post',\n\t\t'excerpt_pst',\n\t\tarray(\n\t\t\t'get_callback'\t\t=> 'RBTM_RelPost_get_excerpt_pst',\n\t\t\t'update_callback'\t=> null,\n\t\t\t'schema'\t\t=> null\n\t\t)\n\t);\n // Add Excerpt\n\tregister_rest_field( 'post',\n\t\t'show_my_obj',\n\t\tarray(\n\t\t\t'get_callback'\t\t=> 'RBTM_RelPost_get_show_my_obj',\n\t\t\t'update_callback'\t=> null,\n\t\t\t'schema'\t\t=> null\n\t\t)\n\t);\n\n}", "function custom_author_base()\n{\n global $wp_rewrite;\n $wp_rewrite->author_base = \"about\";\n $wp_rewrite->author_structure =\n \"/\" . $wp_rewrite->author_base . \"/%author%\";\n}", "function dw_list_authors() {\n global $wpdb;\n\n $users = get_users(array());\n\n // Do a custom query to get post counts for everyone\n // This will save hundreds of queries over \"WordPress-style\" code\n $postsByUsersQuery = 'SELECT post_author, COUNT(*) as count, meta_value AS description FROM '.$wpdb->posts.' p, '.$wpdb->usermeta.' um WHERE post_status=\"publish\" AND um.meta_key = \"description\" AND um.user_id = p.post_author AND meta_value != \"\" AND post_type = \"post\" GROUP BY post_author';\n $postsByUsersResult = $wpdb->get_results($postsByUsersQuery, ARRAY_A);\n $postsByUsersIndex = array();\n foreach($postsByUsersResult as $result) {\n $postsByUsersIndex[$result['post_author']] = array('count'=>$result['count'], 'description'=>$result['description']);\n }\n\n // Sort by number of posts\n foreach($users as $user) {\n $count = $postsByUsersIndex[$user->ID]['count'];\n if($count == '') { $count = 0; }\n $user->total_posts = $count;\n $user->description = $postsByUsersIndex[$user->ID]['description'];\n }\n usort($users, 'sort_objects_by_total_posts');\n $users = array_reverse($users);\n\n // Prep column output\n $column1 = $column2 = array();\n $which = true;\n\n // Generate output for authors\n foreach($users as $index=>$user) {\n if($user->total_posts > 1 && $user->description) {\n $item = '<li class=\"vcard\" id=\"author-'.$user->user_login.'\">';\n $item.= '<h3><a class=\"url\" href=\"'.get_author_posts_url($user->ID).'\">';\n if (function_exists('get_avatar')) {\n $item.= get_avatar($user->user_email, 48);\n }\n $item.= '<cite class=\"fn\">'.$user->display_name.'</cite> <span class=\"post-count\">'.$user->total_posts.' post'.($user->total_posts > 1 ? 's' : '').'</span></a></h3>';\n $item.= '<p class=\"desc\">'.$user->description.'</p>';\n $item.= dw_get_author_meta($user->ID);\n $item.= '</li>';\n\n if($which) {\n array_push($column1, $item);\n }\n else {\n array_push($column2, $item);\n }\n $which = !$which;\n }\n }\n\n $return = '<ul class=\"author-list\">'.implode('', $column1).'</ul>';\n $return.= '<ul class=\"author-list\">'.implode('', $column2).'</ul>';\n\n return $return;\n}", "function lawyerist_get_coauthors() {\n\n\tglobal $wp_query;\n\n\t$coauthors = get_coauthors();\n\n\tif ( count( $coauthors ) > 1 ) {\n\n\t // Removes the primary author.\n\t unset( $coauthors[0] );\n\n $coauthor_list = array();\n\n foreach ( $coauthors as $coauthor ) {\n\n\t\t\t$profile_page_url = get_field( 'profile_page', 'user_' . $coauthor->data->ID );\n\n if ( count_user_posts( $coauthor->data->ID ) >= 5 && !empty( $profile_page_url ) ) {\n\n $coauthor_list[] = '<span class=\"vcard author\"><cite class=\"fn\"><a href=\"' . $profile_page_url . '\">' . $coauthor->data->display_name . '</a></cite></span>';\n\n } else {\n\n $coauthor_list[] = '<span class=\"vcard author\"><cite class=\"fn\">' . $coauthor->data->display_name . '</cite></span>';\n\n }\n\n }\n\n if ( count( $coauthor_list ) === 1 ) {\n\n echo $coauthor_list[ 0 ];\n\n } elseif ( count( $coauthor_list ) === 2 ) {\n\n echo implode( ' and ', $coauthor_list );\n\n } else {\n\n echo implode( ', ', array_slice( $coauthor_list, 0, -1 ) ) . ', and ' . end( $coauthor_list );\n\n }\n\n\t echo ' also contributed to this page.';\n\n\t}\n\n}", "function rest_get_content(WP_REST_Request $request, $type, $function_name)\n{\n if (! in_array($type, array( 'post', 'page' ))) {\n $type = 'post';\n }\n $slug = $request->get_param('slug');\n if (! $post = get_content_by_slug($slug, $type)) {\n return new WP_Error(\n $function_name,\n $slug . ' ' . $type . ' does not exist',\n array( 'status' => 404 )\n );\n };\n\n // Shortcut to WP admin page editor\n $edit = $request->get_param('edit');\n if ($edit === 'true') {\n header('Location: /wp-admin/post.php?post=' . $post->ID . '&action=edit');\n exit;\n }\n $controller = new WP_REST_Posts_Controller('post');\n $data = $controller->prepare_item_for_response($post, $request);\n $response = $controller->prepare_response_for_collection($data);\n\n return new WP_REST_Response($response);\n}", "function get_the_author_icq() {}", "function displet_auto_select_authors_during_import_enqueue() {\n wp_enqueue_script('displet-auto-select-authors-script', plugins_url('displet-auto-select-authors-during-import.js', __FILE__), array('jquery'));\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the header/footer subfile.
function MsWord_GetHeaderFooterFile($TbsCmd, $TbsType, $Offset = 0) { $this->MsWord_InitHeaderFooter(); $Place = 'header'; if ($TbsCmd==OPENTBS_SELECT_FOOTER) { $Place = 'footer'; } $Type = 'default'; if ($TbsType==OPENTBS_FIRST) { $Type = 'first'; } elseif ($TbsType==OPENTBS_EVEN) { $Type = 'even'; } $nb = 0; foreach($this->MsWord_HeaderFooter as $info) { if ( ($info['type']==$Type) && ($info['place']==$Place) ) { if ($nb==$Offset) { return $info['file']; } else { $nb++; } } } return false; }
[ "public function headerAndFooter() {\n if (strpos($_GET['url'], '/') !== false) {// if the url acceses a sub folder of the views map check if a special header and footer are needed\n $this->versionName = substr($_GET['url'], 0, strpos($_GET['url'], '/'));\n $this->pageName = substr($this->page, strpos($this->page, '/') + 1, strlen($this->page));\n if (in_array($this->versionName, PAGES)) {\n if (file_exists(FILES['ABSPATH']. \"elements/\".$this->versionName.\"_header_element.php\")) \n $this->headerVersion = $this->versionName. \"_\";\n if (file_exists(FILES['ABSPATH']. \"elements/\".$this->versionName.\"_footer_element.php\"))\n $this->footerVersion = $this->versionName. \"_\";\n }\n } else {//set the page name correct because otherwise some esthetic stuff do not work correctly\n $this->pageName = $this->page;\n }\n return;\n }", "public static function get_part() {\n\t\tif ( wpex_has_header() ) {\n\t\t\tget_template_part( 'partials/header/header-builder' );\n\t\t}\n\t}", "public function getFooter();", "function get_page_subheader( $post ) {\n\tob_start();\n\n\t$subheader = get_post_meta( $post->ID, 'page_subheader', true );\n\n\tif ( $subheader ) {\n\t\t$subheader_post = get_post( $subheader );\n\t\t$sub_img = get_post_meta( $subheader, 'subheader_sub_image', true );\n\t\t$sub_img_atts = array(\n\t\t\t'class'\t=> 'subheader-subimg',\n\t\t\t'alt' => $post->post_title,\n\t\t\t'title' => $post->post_title,\n\t\t);\n\t\t$student_name = get_post_meta( $subheader, 'subheader_student_name', true );\n\t\t$student_img = get_post_meta( $subheader, 'subheader_student_image', true );\n\t\t$student_img_atts = array(\n\t\t\t'class'\t=> 'subheader-studentimg',\n\t\t\t'alt' => get_post_meta( $subheader, 'subheader_student_name', true ),\n\t\t\t'title' => get_post_meta( $subheader, 'subheader_student_name', true ),\n\t\t);\n\t\t$adjustedColWidth = 8;\n\t\tif(!$sub_img || !$student_img){\n\t\t\t\t$adjustedColWidth = 10;\n\t\t\tif(!$student_img && !$sub_img){\n\t\t\t\t$adjustedColWidth = 12;\n\t\t\t}\n\t\t}\n\t?>\n\t\t<div class=\"col-md-10 col-sm-10 col-sm-push-2 col-md-push-2\">\n\t\t\t<div id=\"subheader\" role=\"complementary\">\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<?php if($sub_img){ ?>\n\t\t\t\t\t\t<div class=\"col-md-2 col-sm-2\">\n\t\t\t\t\t\t\t<?php echo wp_get_attachment_image( $sub_img, 'subpage-subimg', 0, $sub_img_atts ); ?>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t<?php } ?>\n\t\t\t\t\t<div class=\"col-md-<?= $adjustedColWidth ?> col-sm-<?= $adjustedColWidth ?>\">\n\t\t\t\t\t\t<blockquote class=\"subheader-quote\">\n\t\t\t\t\t\t\t<?php echo $subheader_post->post_content; ?>\n\t\t\t\t\t\t\t<p class=\"subheader-author text-right\"><?php echo $student_name; ?></p>\n\t\t\t\t\t\t</blockquote>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<?php if($student_img){\n\t\t\t\techo wp_get_attachment_image( $student_img, 'subpage-studentimg', 0, $student_img_atts ); \n\t\t\t\t}?>\n\t\t\t</div>\n\t\t</div>\n\t<?php\n\t}\n\n\treturn ob_get_clean();\n}", "public static function get_part() {\n\t\tif ( wpex_global_obj( 'has_footer' ) ) {\n\t\t\tget_template_part( 'partials/footer/footer-builder' );\n\t\t}\n\t}", "function get_header(){\n\t\tglobal $FANNIE_ROOT;\n\t\tob_start();\n\t\t$page_title = $this->title;\n\t\t$header = $this->header;\n\t\tinclude($FANNIE_ROOT.'src/header_install.html');\n\t\treturn ob_get_clean();\n\n\t}", "function get_header( $name = 'header' ) {\n return get_partial($name);\n}", "public function getFooterFile() {\n return $this->footer_file;\n }", "function getSection($integrateToFooter) {\n\t\tif ($integrateToFooter) {\n\t\t\treturn t3lib_PageRenderer::PART_FOOTER;\n\t\t} else {\n\t\t\treturn t3lib_PageRenderer::PART_HEADER;\n\t\t}\n\t}", "public function getFooter()\n {\n }", "public function getHeaderTemplateFile(): string;", "function MsWord_InitHeaderFooter() {\n\t\n\t\tif ($this->MsWord_HeaderFooter!==false) return;\n\n\t\t$types_ok = array('default' => true, 'first' => false, 'even' => false);\n\t\t\n\t\t// Is there a different header/footer for odd an even pages ?\n\t\t$idx = $this->FileGetIdx('word/settings.xml');\n\t\tif ($idx!==false) {\t\t\n\t\t\t$Txt = $this->TbsStoreGet($idx, 'GetHeaderFooterFile');\n\t\t\t$types_ok['even'] = (strpos($Txt, '<w:evenAndOddHeaders/>')!==false);\n\t\t\tunset($Txt);\n\t\t}\n\n\t\t// Is there a different header/footer for the first page ?\n\t\t$idx = $this->FileGetIdx('word/document.xml');\n\t\tif ($idx===false) return false;\n\t\t$Txt = $this->TbsStoreGet($idx, 'GetHeaderFooterFile');\n\t\t$types_ok['first'] = (strpos($Txt, '<w:titlePg/>')!==false);\n\n\t\t$places = array('header', 'footer');\n\t\t$files = array();\n\t\t$rels = $this->OpenXML_Rels_GetObj('word/document.xml', '');\n\t\t\n\t\tforeach ($places as $place) {\n\t\t\t$p = 0;\n\t\t\t$entity = 'w:' . $place . 'Reference';\n\t\t\twhile ($loc = clsTbsXmlLoc::FindStartTag($Txt, $entity, $p)) {\n\t\t\t\t$p = $loc->PosEnd;\n\t\t\t\t$type = $loc->GetAttLazy('w:type');\n\t\t\t\tif (isset($types_ok[$type]) && $types_ok[$type]) {\n\t\t\t\t\t$rid = $loc->GetAttLazy('r:id');\n\t\t\t\t\tif (isset($rels->TargetLst[$rid])) {\n\t\t\t\t\t\t$target = $rels->TargetLst[$rid];\n\t\t\t\t\t\t$files[] = array('file' => ('word/'.$target), 'type' => $type, 'place' => $place);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->MsWord_HeaderFooter = $files;\n\t\n\t}", "abstract protected function generateFileHeader();", "abstract function header();", "public static function getMainBottomSection()\n {\n return self::extractImage(\"main.image\");\n }", "private function _getPageHeader()\n\t{\n\t\t$page = $this->grav[\"page\"];\n\t\treturn $page->header();\t\n\t}", "public function getTrailer();", "public function docHeaderContent() {}", "private function get_printout_header(string $header_filename=' '): array { \r\n\t$lines=file($header_filename); \r\n\tfor($i=0; $i<count($lines); $i++) {\r\n\t\t$cut = strpos($lines[$i], '/'); \r\n\t\t$lines[$i] = substr($lines[$i], $cut+1);\r\n\t\t}\r\n\treturn $lines;\r\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds an edge between $a and $b to our graph. (From $a to $b, if this is a directed graph). Inherently adds vertices $a and $b, if not present.
public function addEdge($a, $b, $weight=0) { if (!is_numeric($weight)) { throw new Exception("Edge weight must be numeric"); } // Add vertices (will not add if they already exist) $this->addVertex($a); $this->addVertex($b); $this->_addEdge($a, $b, $weight, $this->_directed); }
[ "public function addEdge($a, $b);", "public function edge_add( $vertex1, $vertex2 ){\n \t$this->vertices[$vertex1]->add( $vertex2 );\n \t$this->vertices[$vertex2]->add( $vertex1 );\t\n $this->E++;\n }", "function addEdge($node1, $node2)\n {\n $nodes =& $this->getProperty('nodes');\n $nodes[$node1]->addAdjacentNode($node2);\n $nodes[$node2]->addAdjacentNode($node1);\n }", "public function addEdge($idA, $idB, $weight = 1) {\n\n assert(!is_array($weight) AND !is_object($weight));\n\n assert(FALSE !== array_key_exists($idA, $this->_edges));\n assert(FALSE !== array_key_exists($idB, $this->_edges[$idA]));\n assert(FALSE !== array_key_exists($idB, $this->_edges));\n assert(sizeof($this->_edges) == $this->numNodes());\n assert(sizeof($this->_edges[$idA]) == $this->numNodes());\n assert(sizeof($this->_edges[$idB]) == $this->numNodes());\n\n $this->_edges[$idA][$idB] = (double) $weight;\n\n if ($this->_directed === FALSE) {\n assert(FALSE !== array_key_exists($idA, $this->_edges[$idB]));\n $this->_edges[$idB][$idA] = (double) $weight;\n }\n }", "protected abstract function insertEdge(Edge $edge);", "public function hasEdge($a, $b);", "function addEdge($startId, $endId, $cost, $line){\n $startNode = $this->findNode($startId);\n $endNode = $this->findNode($endId);\n if($startNode != null && $endNode != null){\n $e = new Edge($endNode, $cost, $line);\n $startNode->addEdge($e);\n }\n }", "public function addEdge(Edge $edge)\n {\n $keyA = $edge->getNodeA()->getName();\n $keyB = $edge->getNodeB()->getName();\n \n if(!array_key_exists($keyA, $this->matrix)){\n $this->addNode($keyA);\n }\n \n if(!array_key_exists($keyB, $this->matrix)){\n $this->addNode($keyB);\n } \n \n switch($edge->getDirection()){\n case Edge::DIR_TWOWAY: \n $this->matrix[$keyA][$keyB] += 1;\n $this->matrix[$keyB][$keyA] += 1;\n break;\n case Edge::DIR_ONEWAY: \n $this->matrix[$keyA][$keyB] += 1;\n break;\n }\n }", "public function insertEdge($begin, $end) {\n\t\t\n\t\t// Add Vertices\n\t\t$this->addVertex($begin);\n\t\t$this->addVertex($end);\n\t\t\n\t\t// Add $begin as $end input vertex\n\t\t$this->inAdjacents[$end][] = $begin;\n\t\t\n\t\t// Add $end as $begin output vertex\n\t\t$this->outAdjacents[$begin][] = $end;\n\t}", "public function removeEdge($a, $b);", "public function addEdge(Edge $edge)\n {\n $this->edges[] = $edge;\n }", "public function createEdge(BaseNode $nodeA, BaseNode $nodeB, BaseEdge $edge)\n {\n $preparedData = [\n 'nodeIdA' => $nodeA->getId(),\n 'nodeIdB' => $nodeB->getId(),\n ];\n // @TODO add support for $props on the edge\n // @TODO Research prepared data for relationship name\n $this->lastQuery = \"MATCH (a:\".$nodeA::LABEL.\"),(b:\".$nodeB::LABEL.\")\\n\";\n $this->lastQuery .= \"WHERE a.id = {nodeIdA} AND b.id = {nodeIdB}\";\n $this->lastQuery .= \"CREATE (a)-[r:\".$edge::NAME.\"]->(b)\";\n $this->lastQuery .= \"RETURN r\";\n $this->client->sendCypherQuery($this->lastQuery, $preparedData);\n\n // @TODO Validate the result somehow\n //dd($this->client->getResult());\n // @TODO Return a BaseEdge or something? :)\n }", "public function insertEdge($from, $to, $weight, $info)\n\t{\n\t\tarray_push($this->edges, new Edge($from, $to, $weight, $info));\n\t}", "public static function add(self $a, self $b);", "public function testAddEdgeException1()\n {\n $graph = new PGraph(true);\n \n $graph[4] = \"test vertex\";\n \n $graph->addEdge(5, 4);\n }", "public function testAddEdgeException2()\n {\n $graph = new PGraph();\n \n $graph[10] = \"test vertex\";\n \n $graph->addEdge(10, 42);\n }", "public function removeEdge($a, $b) \n {\n \n $this->_removeEdge($a, $b, $this->_directed);\n }", "function addTransition($node1, $edge, $node2) {\n $node1 = $this->getOrCreateNode($node1);\n $node2 = $this->getOrCreateNode($node2);\n\n $node1->addTransition($edge, $node2);\n }", "public function createEdgeUndirected(Vertex $a, Vertex $b)\n {\n if ($a->getGraph() !== $this) {\n throw new InvalidArgumentException('Vertices have to be within this graph');\n }\n\n return new EdgeUndirected($a, $b);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ List countrycoordinates in array: Array ( [iso] => "de" [lat] => 51 [lon] => 9 )
function country_coordinates() { // Gather data start_sql(); $result = mysql_query("SELECT iso, lat, lon FROM `t_countries`"); if (!$result) { die("Error: SQL query failed with country_coordinates()"); } while ($row = mysql_fetch_array($result)) { $list[$row["iso"]]["iso"] = $row["iso"]; $list[$row["iso"]]["lat"] = $row["lat"]; $list[$row["iso"]]["lon"] = $row["lon"]; } return $list; }
[ "public static function get_countries()\n {\n $g = new Geoip3();\n $ge = new GeoIP();\n\n $countries_codes = $ge->GEOIP_COUNTRY_CODES;\n $countries_names = $ge->GEOIP_COUNTRY_NAMES;\n\n $countries = array();\n\n foreach ($countries_codes as $id=>$cc) \n {\n if ($cc!='' AND $cc!='AP' AND $cc!='EU' )\n $countries[$id] = array('code'=>$cc,\n 'name'=>$countries_names[$id]);\n }\n return $countries;\n }", "function locateIPS(){\n$myIPSArray = array(\"72.229.28.185\", \"4.34.54.2\");\n foreach ($myIPSArray as $ip) {\n # code...\n $url = \"http://www.telize.com/geoip/\".$ip;\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_URL, $url);\n $result=curl_exec($ch);\n curl_close($ch);\n $resulting = json_decode($result, true);\n print_r($resulting);\n echo \"<br><br>\";\n //just print out the country\n print_r($resulting['country']);\n}\n\n\n}", "public function getAllLocations() {\n $geo = new Country;\n $locations = $geo->locations;\n ksort($locations, SORT_NATURAL);\n return $locations;\n }", "public function getVisitorsPCountry(){\n\t\t$A=$GLOBALS['config']->get('config', 'dbprefix').\"CubeCart_addressbook\";\n\t\t$C=$GLOBALS['config']->get('config', 'dbprefix').\"CubeCart_geo_country\";\n\t\t$query = \"SELECT `\".$C.\"`.`name`, count(*) as `cnt` FROM `\".$A.\"`,`\".$C.\"` WHERE `\".$A.\"`.`country`=`\".$C.\"`.`numcode` GROUP BY `country`\";\n\t\t$res = $GLOBALS['db']->query($query);\n\t\t$countries = '';\n\t\t$users = '';\n\t\tforeach ($res as $value){\n\t\t\t$countries = $countries.'_c[]='.urlencode($value['name']).'&';\n\t\t\t$users = $users.'_u[]='.urlencode($value['cnt']).'&';\n\t\t}\n//\t\t$ret = array ('countries' => $countries, 'users' => $users);\n\t\t$ret['cchart'] = 'classes/chartcountry.php?'.$countries.'&'.$users;\n\t\treturn $ret;\n\t}", "public function getListOfCoordinates();", "private function getCoordinates()\n\t{\n\t\t// Check if we are overriding the default client's IP \n\t\t$ipSetting = \"\";\n\t\tif($this->ip != null) {\n\t\t\t$ipSetting = \"&IpAddress=\" . $this->ip;\n\t\t}\n\t\telse {\n\t\t\t$ipSetting = \"&IpAddress=\" . $_SERVER[\"REMOTE_ADDR\"];\n\t\t}\t\t\n\t\t$url = self::geobytesUrl . $ipSetting;\n\t\t$result = $this->getUrl($url);\n\t\t$arr = json_decode($result, true);\n\t\tif($arr[\"geobytes\"][\"latitude\"] == null || $arr[\"geobytes\"][\"longitude\"] == null) {\n\t\t\t$latitude = 0;\n\t\t\t$longitude = 0;\t\t\t\n\t\t}\n\t\telse {\n\t\t\t$latitude = $arr[\"geobytes\"][\"latitude\"];\n\t\t\t$longitude = $arr[\"geobytes\"][\"longitude\"];\n\t\t}\n\t\treturn array(\"latitude\"=>$latitude, \"longitude\"=>$longitude);\n\t}", "function getStatesListOfCountry($countryCode = null) {\n $states = array(['code' => 'R1', 'flag' => 'al', 'name' => 'Region 1'], ['code' => 'R2', 'flag' => 'ak', 'name' => 'Region 2'], ['code' => 'R3', 'flag' => 'az', 'name' => 'Region 3'],\n ['code' => 'R4', 'flag' => 'ar', 'name' => 'Region 4'], ['code' => 'R5', 'flag' => 'ca', 'name' => 'Region 5']\n );\n return $states;\n}", "public function getCountries();", "public function getSubscriberLocationCountries(): array\n {\n return $this->_subscriber_location_countries ?? [] ;\n }", "function tep_get_country_zones($country_id) {\n $zones_array = array();\n $zones_query = tep_db_query(\"select zone_id, zone_name from \" . TABLE_ZONES . \" where zone_country_id = '\" . (int)$country_id . \"' order by zone_name\");\n while ($zones = tep_db_fetch_array($zones_query)) {\n $zones_array[] = array('id' => $zones['zone_id'],\n 'text' => $zones['zone_name']);\n }\n\n return $zones_array;\n }", "function getCoordinates() {\n return explode( ',', $this->map_coordinates );\n }", "public function getCountries() {\r\n\t\r\n\t\t$url = $this->_buildURL('countries');\r\n\t\treturn $this->_call($url);\r\n\t}", "function tep_get_country_zones($country_id) {\n $zones_array = array();\n $zones_query = tep_db_query(\"select zone_id, zone_name from \" . TABLE_ZONES . \" where zone_country_id = '\" . (int)$country_id . \"' order by zone_name\");\n while ($zones = tep_db_fetch_array($zones_query)) {\n $zones_array[] = array('id' => $zones['zone_id'],\n 'text' => $zones['zone_name']);\n }\n\n return $zones_array;\n}", "public function getCoordinates(): array;", "public function getCountryInfo()\n\t{\n\t\t$location= LocationController::getLocation();\n\n\t\t/*fetch image url from google API ... code can be found at \n\t\thttp://stackoverflow.com/a/5694812/2786529\n\t\t*/\n\t\t$jsrc = \"https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=\".$location->country_name.\"%20landmark\";\n\t\t$json = file_get_contents($jsrc);\n\t\t$jset = json_decode($json, true);\n\n\t\t/*encode to json format*/\n\t\t$country=json_encode(['country_name'=>$location->country_name,'photourl'=>$jset[\"responseData\"][\"results\"][0][\"url\"]]);\n\t\t\n\t\treturn $country;\n\t}", "function get_country_cities($country, $ordered = 'Population') {\n //$result[0] = array( 'name' => 'Zaragoza', 'district' => 'Aragon', 'population' => 768000);\n\n\t\t$result = $this->query('select * from City order by '. $ordered . ' asc');\n \n return $result; \n }", "public function get_country_list() {\n\t\t$s = \"SELECT \" . self::COL_NAME . \" FROM \" . self::TBL_COUNTRY;\n\t\treturn $this->run($s, self::COL_NAME);\n\t}", "public function get_eurovoc_european_countries() {\n $query = 'SELECT DISTINCT ?narrower_term_name\n WHERE{\n ?micro_thesaruse skos:prefLabel ?micro_thesaruse_name. \n FILTER (REGEX (?micro_thesaruse_name, \"Northern Europe\") \n || REGEX (?micro_thesaruse_name,\"Southern Europe\") \n || REGEX (?micro_thesaruse_name, \"Western Europe\") \n || REGEX (?micro_thesaruse_name, \"Eastern Europe\")) \n OPTIONAL{?narrower_term skos:broader ?micro_thesaruse. \n ?narrower_term skos:prefLabel ?narrower_term_name.\n FILTER (LANG(?narrower_term_name)=\"en\")}\n } ORDER BY ?narrower_term_name';\n $results = SPARQL::runSPARQLQuery($query);\n $jsnResults = json_decode($results);\n $list_countries = [];\n if (!empty($jsnResults)) {\n foreach ($jsnResults->results->bindings as $res) {\n $list_countries[] = $res->narrower_term_name->value;\n }\n }\n return $list_countries;\n }", "public function country_list()\n {\n $result = common_select_values('id, name', 'ad_countries', '', 'result');\n return $result; \n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return phone number in local format
public function getLocalFormat() : string { return $this->_parser->getRawPhone(); }
[ "function getLocalisedPhoneNumber($phone_number, $country_code='KE') { \n\t$phone_number = PhoneNumber::make($phone_number, $country_code)->formatNational();\n\t//remove spaces\n\treturn str_replace(\" \", \"\", $phone_number);\n\n}", "function formatted_number(){\n $phone_number = \"({$this->area_code}) \" . substr_replace($this->number, '-', 3, 0);\n return $phone_number;\n }", "public function phone(){\n\t\tif(trim($this->mobile) != ''){\n\t\t\treturn $this->mobile;\n\t\t}else{\n\t\t\treturn $this->phone_areacode . $this->phone;\n\t\t}\n\t}", "public function getPhoneNumber()\n {\n $telephone = $this->getBillingTelephone();\n if(!$telephone) {\n return '';\n }\n \n $countryCode = $this->getDefaultCountryCode();\n $l = strlen($countryCode);\n if(substr($telephone, 0, $l) == $countryCode) {\n $telephone = substr($telephone, $l);\n }\n \n return $telephone;\n }", "public function getPhone()\n\t{\n\t\treturn sprintf('(%s) %s-%s', substr($this->phone, 0, 3),\n\t\t\tsubstr($this->phone, 3, 3), substr($this->phone, 6));\n\t}", "public function getFormattedPhoneNumber(): string\n {\n $phoneNumber = new PhoneNumberFormatter($this->phone);\n\n return $phoneNumber->format();\n }", "public function getPhoneLocalNumber()\n {\n return $this->phoneLocalNumber;\n }", "public function formatPhone()\n {\n // TODO: This handles the standard 10 digit North American phone number. Update to handle international formats\n if (isset($this->phone) && preg_match('/^(\\d\\d\\d)[\\s\\.\\-]?(\\d\\d\\d)[\\s\\.\\-]?(\\d\\d\\d\\d)$/', $this->phone, $matches)) {\n return \"({$matches[1]}) {$matches[2]}-{$matches[3]}\";\n }\n\n return $this->phone;\n }", "function format_phone_number($num) {\n\t$num = preg_replace('@[^\\d]@','',$num);\n\t\n\t//if(strlen($num) == 7) $num = '781' . $num; //Probably not a good idea to assume area codes.\n\tif(strlen($num) < 10)\n\t\treturn false;\n\t\n\t$formatted = '(' . substr($num, 0, 3) . ') - ' . substr($num, 3, 3) . '-' . substr($num, 6, 4);\n\tif(strlen($num) > 10) //Extensions, such as with teachers' phone numbers.\n\t\t$formatted .= 'x' . substr($num, 10);\n\treturn $formatted;\n}", "function format_telephone($number){\n\treturn preg_replace('[\\D]', '', $number);\n}", "public function getPhoneNumberAttribute()\n {\n return \"+\".@$this->attributes['country_code'].@$this->attributes['mobile_number'];\n }", "public function getUserPhoneNumber()\n {\n if ($this->customerSession->isLoggedIn()) {\n return $this->customerSession->getCustomer()->getPrimaryBillingAddress()->getTelephone();\n }\n return '';\n }", "public function getLocalNumber(): string;", "public function getPhoneNumber(): string {\r\n return $this->phone_number;\r\n }", "public function telephone()\n {\n $prefix = $this->getRandomKey('telephone');\n return string('0' . $prefix . randomNumber(7));\n }", "function formatTelephone($phone) {\n $n = \"\";\n \n if(!empty($phone['country_code'])) {\n // We'll only output + style if a country code was provided\n $n = \"+\" . $phone['country_code'];\n }\n \n if(!empty($phone['area_code'])) {\n if($n != \"\") {\n $n .= \" \";\n }\n \n $n .= $phone['area_code'];\n }\n \n if(!empty($phone['number'])) {\n if($n != \"\") {\n $n .= \" \";\n }\n \n $n .= $phone['number'];\n }\n \n if(!empty($phone['extension'])) {\n if($n != \"\") {\n $n .= \" \" . _txt('fd.telephone.ext');\n }\n \n $n .= $phone['extension'];\n }\n \n return $n;\n}", "public function get_phone(){\n\t\tprint $this->phone . \"\\n\";\n\t}", "public function getInternationalFormat() : string\n {\n return $this->_parser->getInternationalPhone();\n }", "public function getUserPhoneNumber() : string {\n\t\treturn $this->userPhoneNumber;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses a trait declaration.
private function parseTraitDeclaration() { $this->tokenStack->push(); $trait = $this->parseTraitSignature(); $trait = $this->parseTypeBody($trait); $trait->setTokens($this->tokenStack->pop()); $this->reset(); return $trait; }
[ "protected static function _traitNode() {\n\t\tstatic::_codeNode();\n\t\t$body = static::$_stream->current() . static::$_stream->next([';', '{']);\n\t\tstatic::$_states['body'] .= $body;\n\t\t$node = new TraitDef($body);\n\t\t$node->name = substr($body, 0, -1);\n\t\tstatic::$_states['nodes'][] = static::$_states['bracket'];\n\t\tstatic::$_states['current'] = static::_contextualize($node);\n\t}", "protected function validateTraitStatement(Trait_ $stmt)\n {\n $this->ensureCanDefine($stmt, self::TRAIT_TYPE);\n }", "public function testTraitUsingTrait()\n {\n $fqcnUser = 'Project\\ServiceUsingTrait';\n $fqcnTrait = 'Project\\ServiceTrait';\n $result = $this->callParse('ServiceTrait.php', 'ServiceUsingTrait.php');\n $this->assertCount(3, $result->getVertexSet());\n $this->assertEdges(array(\n array(\n array('Trait', $fqcnUser),\n array('Trait', $fqcnTrait)\n ),\n array(\n array('Impl', \"$fqcnTrait::someService\"),\n array('Trait', $fqcnTrait)\n ),\n array(\n array('Trait', $fqcnTrait),\n array('Impl', \"$fqcnTrait::someService\")\n )\n )\n , $result);\n }", "protected function _traitNode()\n {\n $this->_codeNode();\n\n $token = $this->_stream->current(true);\n $body = $token[1];\n $body .= $this->_stream->skipWhitespaces();\n $body .= $name = $this->_stream->current();\n $body .= $this->_stream->next([';', '{']);\n $this->_states['body'] .= $body;\n $node = new BlockDef($body, 'trait');\n $node->name = $name;\n return $this->_states['current'] = $this->_contextualize($node);\n }", "private function parseTraitAdaptation()\n {\n $this->tokenStack->push();\n\n $adaptation = $this->builder->buildAstTraitAdaptation();\n\n $this->consumeToken(Tokens::T_CURLY_BRACE_OPEN);\n\n do {\n $this->tokenStack->push();\n\n $reference = $this->parseTraitMethodReference();\n $this->consumeComments();\n\n $stmt = Tokens::T_AS === $this->tokenizer->peek()\n ? $this->parseTraitAdaptationAliasStatement($reference)\n : $this->parseTraitAdaptationPrecedenceStatement($reference);\n\n $this->consumeComments();\n $this->consumeToken(Tokens::T_SEMICOLON);\n\n $adaptation->addChild($this->setNodePositionsAndReturn($stmt));\n\n $this->consumeComments();\n } while (Tokens::T_CURLY_BRACE_CLOSE !== $this->tokenizer->peek());\n\n $this->consumeToken(Tokens::T_CURLY_BRACE_CLOSE);\n\n return $this->setNodePositionsAndReturn($adaptation);\n }", "function rawpheno_valid_trait_format($trait) {\n $is_valid = TRUE;\n $trait = trim($trait);\n // Test if the trait uses parenthesis.\n // ( and ) indicate that unit is supplied with the trait name,\n // otherwise, ignore this check (e.g. comments)\n if (preg_match('/[(|)]/', $trait) === 1 && $trait != 'Lodging (Scale: 1-5) upright - lodged') {\n // With these characters present, test if the format is trait name (unit).\n\n // Pattern: first string can be any chars but ( and ) followed by 0 or more space then 1 ( then any chars and )\n // plus optional any chars but ( and ) as the end of string.\n $is_valid = (preg_match('/\\A[^()]+\\s*\\({1}[^)(]+\\)[^)(]*\\z/i', $trait) === 1) ? TRUE : FALSE;\n }\n\n return $is_valid;\n}", "public function visitTraitAlias(Node $node);", "public function getDeclaringTraitName();", "public function isTrait(): bool\n {\n return $this->endsWith($this->getShortName(), 'Trait');\n }", "function Get_declared_traits($param) {\n return \"\";\n }", "protected function parseDeclaration($typoScriptLine) {\n\t\t$result = preg_match(self::SPLIT_PATTERN_DECLARATION, $typoScriptLine, $matches);\n\t\tif ($result !== 1 || !(isset($matches['declarationType']) && isset($matches['declaration']))) {\n\t\t\tthrow new Exception('Invalid declaration \"' . $typoScriptLine . '\"', 1180544656);\n\t\t}\n\n\t\tswitch ($matches['declarationType']) {\n\t\t\tcase 'namespace' :\n\t\t\t\t$this->parseNamespaceDeclaration($matches['declaration']);\n\t\t\t\tbreak;\n\t\t\tcase 'include' :\n\t\t\t\t$this->parseInclude($matches['declaration']);\n\t\t\t\tbreak;\n\t\t}\n\t}", "public function visitClassTrait(Node $node);", "public function visitTrait(ASTTrait $node)\n {\n if (!$node->isUserDefined()) {\n return;\n }\n\n $this->apply(new TraitNode($node));\n parent::visitTrait($node);\n }", "public function isTrait();", "private function getTraitNode(): Node\\Stmt\\TraitUse\n {\n return new Node\\Stmt\\TraitUse([\n new Node\\Name('\\\\' . $this->aopClassName)\n ]);\n }", "public function isTrait()\n {\n $this->scan();\n return $this->isTrait;\n }", "public function getDeclaringTrait()\n\t{\n\t\t$traitName = $this->reflection->getDeclaringTraitName();\n\t\treturn null === $traitName ? null : $this->classes[$traitName];\n\t}", "public function addTrait($trait);", "public function hasTrait($trait);" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Distance between a point and a plan.
function distancePointPlan(Point $point, Plan $plan) { }
[ "function distancePathPlan(Path $path, Plan $plan)\n{\n\n}", "function distance(Point $pt1): float {\n return sqrt(square($pt1->x() - $this->x()) + square($pt1->y() - $this->y()));\n }", "public function distance_to_point($point) {\n return $this->center->distance_to_point($point);\n }", "public function testDistance()\n {\n $milan = new Point(45.464161, 9.190336);\n $rome = new Point(41.893056, 12.482778);\n $route = new Route($milan, $rome);\n\n $this->assertEquals(477.17, $route->getDistance());\n }", "public function getDistance()\n {\n return round(\n sqrt(\n pow($this->transit->from_lat - $this->transit->to_lat, 2)\n + pow($this->transit->from_lng - $this->transit->to_lng, 2)\n ),\n 2\n );\n }", "public function testDistance()\n {\n $milan = new Point(45.464161, 9.190336);\n $rome = new Point(41.893056, 12.482778);\n $this->assertEquals(477.17, $milan->distance($rome));\n $this->assertEquals($rome->distance($milan), $milan->distance($rome));\n }", "function distanceFromTM(&$pt)\r\n\t{ \r\n\t\t$E1 = $pt->E(); \t$N1 = $pt->N();\r\n\t\t$E2 = $this->E(); \t$N2 = $this->N();\r\n \r\n\t\t$dist = sqrt(pow(($E1-$E2),2)+pow(($N1-$N2),2));\r\n\t\treturn $dist; \r\n\t}", "private function distanceToPoint(Point2D $pt)\n {\n $px = $pt->getX() - $this->getX();\n $py = $pt->getY() - $this->getY();\n return sqrt($px * $px + $py * $py);\n }", "public function getRouteDistance() : float\n {\n $distance = 0.0;\n for ($i = 1; $i < count($this->cities); $i++) {\n $distance += $this->getCitiesDistance($this->cities[$i], $this->cities[$i-1]);\n }\n\n return $distance;\n }", "public function calculateDistance() {\n $destination = $this->address . \",\" . $this->postcode;\n $url = \"https://maps.googleapis.com/maps/api/distancematrix/json?origins=95+Hoe+Lane,EN35SW&destinations=\" . $destination . \"&sensor=false&units=imperial\";\n $json = file_get_contents($url);\n $data = json_decode($json, TRUE);\n $meters = $data['rows'][0]['elements'][0]['distance']['value'];\n $this->distance = round($meters * 0.000621371);\n }", "function fGetDistance($point1, $point2){\n\t\t//based on\tHaversine formula\n\t\t$dLat = deg2rad($point2->y - $point1->y);\n\t\t$dLon = deg2rad($point2->x - $point1->x); \n\t\t$a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($point1->y)) * cos(deg2rad($point2->y)) * sin($dLon/2) * sin($dLon/2); \n\t\treturn floor(6371000 * 2 * atan2(sqrt($a), sqrt(1-$a)));\t\t\n\t}", "function distance2point(&$vertex){\r\n\t\t$distance = infinity; // start very far away\r\n\t\t// loop all vertices of polygon\r\n\t\t$va =& $this->first; \t// first vertex of first segment to check\r\n\t\t$vb =& $va->Next();\t\t// second vertex of segment\r\n\t\tdo{\r\n\t\t\t// get the distance of given vertex to current line segment\r\n\t\t\t$dist = $this->dist_line2point($va->X(),$va->Y(),$vb->X(),$vb->Y(),$vertex->X(),$vertex->Y());\r\n\t\t\t// save it if it is shortest distance so far\r\n\t\t\t$distance = ($dist<$distance)?$dist:$distance;\r\n\t\t\t// set next line segments' vertices\r\n\t\t\t$va =& $va->Next();\r\n\t\t\t$vb =& $va->Next();\r\n\t\t}while ($vb->id() != $this->first->id());\r\n\t\t// return distance if it was resolved, otherwise return null\r\n\t\treturn ($distance<infinity)?$distance:NULL;\t // if in geomode, distance is in meters\r\n\t}", "public function getDistance() {\n return $this->get(self::DISTANCE);\n }", "public function getDistance($location);", "public static function calculateDistance($x = 0, $y = 0) {\n $d = pow($x - MY_CITY_X,2) + pow($y - MY_CITY_Y,2);\n return round(sqrt($d),1);\n }", "function calcul_distance_points($point1,$point2)\r\n{\r\n return calcul_distance_gps($point1->latitude,$point1->longitude,$point2->latitude,$point2->longitude);\r\n}", "public function distance(): float;", "public function getDistance(): float {\n\t\treturn $this->distance;\n\t}", "public function distance($latitude1, $longitude1, $latitude2, $longitude2);" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new Ethnicity entity.
public function createAction(Request $request) { $entity = new Ethnicity(); $form = $this->createCreateForm($entity); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); return $this->redirect($this->generateUrl('ethnicity_show', array('id' => $entity->getId()))); } return array( 'entity' => $entity, 'form' => $form->createView(), ); }
[ "public function Ethnicity($optParams = array()) {\n $params = array();\n $params = array_merge($params, $optParams);\n $data = $this->__call('Ethnicity', array($params));\n return $data;\n }", "public function newAction()\n {\n $entity = new Ethnicity();\n $form = $this->createCreateForm($entity);\n\n return array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }", "private function createCreateForm(Ethnicity $entity)\n {\n $form = $this->createForm(new EthnicityType(), $entity, array(\n 'action' => $this->generateUrl('ethnicity_create'),\n 'method' => 'POST',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Create'));\n\n return $form;\n }", "public function createCharity()\n {\n // TODO: Implement createCharity() method.\n }", "public function getEthnicity()\n {\n return $this->ethnicity;\n }", "public function createEntity();", "public function ethnicity() {\n\n if (!isset($this->county) || !isset($this->state)) {\n echo \"Error: county param or state param not set properly\";\n die();\n }\n\n\n $ethnicity_map = array(\n \"ethnicity\" => array(\n \"_001E\" => array(\"title\" => \"Total\", \"quantity\" => \"\"),\n \"results\" => array(\n \"_002E\" => array(\"title\" => \"White\", \"quantity\" => \"\"),\n \"_003E\" => array(\"title\" => \"Black or African American\", \"quantity\" => \"\"),\n \"_004E\" => array(\"title\" => \"American Indian and Alaska Native\", \"quantity\" => \"\"),\n \"_005E\" => array(\"title\" => \"Asian\", \"quantity\" => \"\"),\n \"_006E\" => array(\"title\" => \"Native Hawaiian and Other Pacific Islander\", \"quantity\" => \"\"),\n \"_005E\" => array(\"title\" => \"Other race\", \"quantity\" => \"\"),\n )\n )\n );\n\n $this->buildMap($ethnicity_map, 'ethnicity', 'B02001');\n\n $this->included[] = 'ethnicity';\n\n return $ethnicity_map;\n }", "public function creating($charity) {\n DB::beginTransaction();\n }", "public static function createEntity();", "public function create() {\n $entity = new stdClass();\n $entity->ttid = 0; // Transaction Type-ID.\n $entity->active = 0; // Active?\n $entity->locked = 0; // Locked type, cannot be edited.\n $entity->selectable = 0; // Whether this item can be selected during a standard transaction.\n $entity->category = ''; // The category in which the Transaction Type should appear.\n $entity->name = ''; // Short name of the Transaction Type.\n $entity->description = ''; // Name of the Transaction Type.\n\n return $entity;\n }", "public function newAction()\n {\n $nationality = $this->getNationalityManager()->createNationality();\n $form = $this->createForm(new NationalityType(), $nationality, array(\n 'action' => $this->generateUrl('backend_nationality_create')\n ));\n\n return $this->render('AppBundle:Backend\\Nationality:new.html.twig', array(\n 'entity' => $nationality,\n 'form' => $form->createView()\n ));\n }", "public function createCharity();", "public function createExemption() {\n\t\t\t\t//Build create exemption json.\n $jsonString = '{\n\t\t\t\t \"Exemption\": {\n\t\t\t\t\t\"CustomerReference\": \"Sample Customer 45\",\n\t\t\t\t\t\"ExemptionReference\": \"Sample Exemption 45\",\n\t\t\t\t\t\"StartDate\": \"2014-01-13T00:00:00\",\n\t\t\t\t\t\"EndDate\": \"2015-01-13T00:00:00\",\n\t\t\t\t\t\"ExemptedStateCodes\": {\n\t\t\t\t\t \"StateCode\": [\n\t\t\t\t\t\t\"CA\",\n\t\t\t\t\t\t\"CO\"\n\t\t\t\t\t ]\n\t\t\t\t\t},\n\t\t\t\t\t\"ExemptionRate\": \"0.5\",\n\t\t\t\t\t\"SKUCode\": \"genMerch\",\n\t\t\t\t\t\"BusinessType\": \"Construction\",\n\t\t\t\t\t\"ExemptionReason\": \"other\"\n\t\t\t\t }\n\t\t\t\t}';\n \n\t\t\t\t//Replace ENTITY_ID placeholder with your actual entity id below. \n $curl = curl_init($this->URL.'entity/STX-02199-00/exemption/create');\n \n\t\t\t\t//Set other options for the call.\n curl_setopt($curl, CURLOPT_HTTPHEADER, $this->multiHeaders);\n curl_setopt($curl, CURLOPT_POST, 1);\n curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonString);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n \n\t\t\t\t//Make the call and then close the connection\n $response = curl_exec($curl);\n\t\t\t\tprint \"\\n\\nCreate Exemption Response::\\n\".$response;\n curl_close($curl);\n }", "public function postIndexCharity(Request $request) {\n $this->validate($request,[\n 'name' => 'required|max:99',\n 'description' => 'required|min:5',\n 'logo_or_pic' =>'required|min:5',\n 'website' => 'required|min:5',\n 'year_founded' =>'integer|between:1800,2020'\n ]);\n\n $charity = new \\P4\\Charity();\n $charity->name = $request->name;\n $charity->description = $request->description;\n $charity->city = $request->city;\n $charity->state = $request->state;\n $charity->mission = $request->mission;\n $charity->website = $request->website;\n $charity->year_founded = $request->year_founded;\n $charity->charity_or_crowdsource = 'crowdsource';\n $charity->logo_or_pic = $request->logo_or_pic;\n\n $charity->save();\n \\Session::flash('flash_message', 'Thank you! That charity is now added!');\n return redirect('/charity');\n }", "abstract function create(EntityInterface $entity);", "public function create() {\n $entity = new stdClass();\n $entity->tid = 0; // Transaction-ID\n $entity->rid = 0; // Recipient-ID\n $entity->sid = 0; // Sender-ID\n $entity->iid = 0; // Initiator-ID\n $entity->amount = 0; // Amount... d'uh\n $entity->tstamp = 0; // Timestamp \n $entity->txt = null; // Transaction-Text\n $entity->ttype = 0; // Transaction-Type (taxonomy reference)\n $entity->signature = null; // The transaction-checksum\n $entity->balance = 0; // The recipient's balance after a successful transaction\n\n $entity->counter = TRUE; // Whether we need a counter-transaction (false = adjustment)\n $entity->signature_ok = FALSE; // I'm not a very trusting soul...\n return $entity;\n }", "public function ethnicities()\n {\n return $this->hasMany(\"App\\EthnicityCriteria\");\n }", "public function exigency_createAction()\n {\n $entity = new Exigency();\n $request = $this->getRequest();\n $form = $this->createForm(new ExigencyType(), $entity);\n $form->bindRequest($request);\n\n if ($form->isValid()) {\n $em = $this->getDoctrine()->getEntityManager();\n $em->persist($entity);\n $em->flush();\n\n return $this->redirect($this->generateUrl('managerfront_exigency_show', array('id' => $entity->getId())));\n \n }\n\n return array(\n 'entity' => $entity,\n 'form' => $form->createView()\n );\n }", "public function CreateSpeciality(){\n if ($this->get_request_method() != \"POST\") {\n $this->response('', 406);\n }\n $user_id = $_POST['user_id'];\n $user_auth_key = $_POST['user_auth_key'];\n $speciality_name = $_POST['speciality_name'];\n $format = $_POST['format'];\n $this->dbConnect();\n $conn = $this->db;\n $res = new setService();\n if(!empty($user_id) && !empty($user_auth_key) && !empty($speciality_name)){\n $result = $res->CheckAuthentication($user_id,$user_auth_key,$conn);\n if($result!=false){\n $result=$res->create_speciality($user_id, $speciality_name, $conn);\n }\n else{\n $error = array('status' => \"0\",\"msg\" => \"Not authorised to do this\");\n ($_REQUEST['format'] == 'xml') ? $this->response($this->xml($error), 200) : $this->response($this->json($error), 200);\n }\n }\n else{\n $error = array('status' => \"0\", \"msg\" => \"Fill All Fields\");\n ($_REQUEST['format']=='xml')?$this->response($this->xml($error), 200):$this->response($this->json($error), 200);\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test case for creativesVideo1pasCreativeIdDelete Delete Creative.
public function testCreativesVideo1pasCreativeIdDelete() { }
[ "public function testCreativesVideo3pasCreativeIdDelete()\n {\n }", "public function testCreativesDisplay3pasCreativeIdDelete()\n {\n }", "public function testCreativesPushCreativeIdDelete()\n {\n }", "public function testCreativesVideo3pasCreativeIdGet()\n {\n }", "public function testCreativesVideo1pasCreativeIdGet()\n {\n }", "public function testDeleteCampaign()\n {\n }", "public function testCanDeleteCard()\n {\n $customer = $this->service->customers()->create(\n new Token('pm_card_visa'),\n 'software@pod-point.com',\n 'test'\n );\n\n $cards = $this->service->customers()->getCards($customer->uid);\n\n $this->service->cards()->delete($cards[0]->uid);\n\n $cards = $this->service->customers()->getCards($customer->uid);\n\n $this->assertEmpty($cards);\n }", "public function testDeleteAsset()\n {\n }", "public function testDeleteProgramCredit()\n {\n $response = $this->loginAsRole(Role::ADMIN)\n ->delete($this->url('program-credits/1'));\n\n $response->assertStatus(200);\n\n $response->assertJsonStructure([\n 'message'\n ]);\n }", "function paypalRESTVaultDelete($id) {\n\t\t\t$this->sendPayPalREST(\"vault/credit-card/$id\",\"\",\"DELETE\");\n\t\t}", "public function testDeleteCreditCardTokenWithPayerIdDeleted(){\n\t\tPayU::$apiLogin = PayUTestUtil::API_LOGIN;\n\t\tPayU::$apiKey = PayUTestUtil::API_KEY;\n\t\tEnvironment::setSubscriptionsCustomUrl(PayUTestUtil::SUBSCRIPTION_CUSTOM_URL);\n\t\n\t\t$customer = PayUCustomers::create(PayUTestUtil::buildSubscriptionParametersCustomer());\n\t\t$parameters = PayUTestUtil::buildSubscriptionParametersCreditCard();\n\t\t$parameters[PayUParameters::CUSTOMER_ID] = $customer->id;\t\t\n\t\t$creditCard = PayUCreditCards::create($parameters);\n\t\t$response = PayUCustomers::delete($parameters);\n\t\t\t\n\t\t$parameters = array(\n\t\t\t\tPayUParameters::TOKEN_ID => $creditCard->token,\n\t\t\t\tPayUParameters::CUSTOMER_ID => $customer->id\n\t\t);\n\t\t\n\t\t$response = PayUCreditCards::delete($parameters);\n\t\n\t\t$this->assertNotNull($response);\n\t\t$this->assertNotNull($response->description);\n\t}", "public function testMarketingCampaignsTypesIdDelete()\n {\n\n }", "public function testChallengeDelete()\n {\n }", "public function actionRemoveCreative($id) {\n\n $this->SD = new SiteScoutAPI();\n $this->SD->removeCreative($id);\n }", "function delete_video() {\n\t\t$error = false;\n\t\ttry {\n\t\t\t$this->playwire->deleteVideo($_GET['id']);\n\t\t\theader('Location: ?page=playwire-list');\n\t\t\texit();\n\t\t} catch (PlaywireException $exception) {\n\t\t\t$error = $exception->getMessage();\n\t\t}\n\t}", "public function testDeleteChallengeTemplate()\n {\n }", "public function testCadastresDelete()\n {\n }", "public function testChallengeMemberDelete()\n {\n }", "public function testV1DeleteVaration()\n {\n\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Void the card transaction through gateway
protected function _voidCardTransaction($payment, $card) { $authTransactionId = $card->getLastTransId(); $authTransaction = $payment->getTransaction($authTransactionId); $realAuthTransactionId = $authTransaction->getAdditionalInformation($this->_realTransactionIdKey); $payment->setAnetTransType(self::REQUEST_TYPE_VOID); $payment->setXTransId($realAuthTransactionId); $request= $this->_buildRequest($payment); $result = $this->_postRequest($request); switch ($result->getResponseCode()) { case self::RESPONSE_CODE_APPROVED: if ($result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_APPROVED) { $voidTransactionId = $result->getTransactionId() . '-void'; $card->setLastTransId($voidTransactionId); return $this->_addTransaction( $payment, $voidTransactionId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, array( 'is_transaction_closed' => 1, 'should_close_parent_transaction' => 1, 'parent_transaction_id' => $authTransactionId ), array($this->_realTransactionIdKey => $result->getTransactionId()), Mage::helper('paygate')->getTransactionMessage( $payment, self::REQUEST_TYPE_VOID, $result->getTransactionId(), $card ) ); } $exceptionMessage = $this->_wrapGatewayError($result->getResponseReasonText()); break; case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: if ($result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_NOT_FOUND && $this->_isTransactionExpired($realAuthTransactionId) ) { $voidTransactionId = $realAuthTransactionId . '-void'; return $this->_addTransaction( $payment, $voidTransactionId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, array( 'is_transaction_closed' => 1, 'should_close_parent_transaction' => 1, 'parent_transaction_id' => $authTransactionId ), array(), Mage::helper('paygate')->getExtendedTransactionMessage( $payment, self::REQUEST_TYPE_VOID, null, $card, false, false, Mage::helper('paygate')->__('Parent Authorize.Net transaction (ID %s) expired', $realAuthTransactionId) ) ); } $exceptionMessage = $this->_wrapGatewayError($result->getResponseReasonText()); break; default: $exceptionMessage = Mage::helper('paygate')->__('Payment voiding error.'); break; } $exceptionMessage = Mage::helper('paygate')->getTransactionMessage( $payment, self::REQUEST_TYPE_VOID, $realAuthTransactionId, $card, false, $exceptionMessage ); Mage::throwException($exceptionMessage); }
[ "function doVoid()\n {\n $id_unique = Tools::getValue($this->name . '_transaction_id');\n $usage = Tools::getValue($this->name . '_transaction_usage');\n $ip_addr = Tools::getRemoteAddr();\n\n // Apply settings\n $this->applyGenesisConfig();\n\n try {\n $transaction = EComProcessingTransaction::getByUniqueId($id_unique);\n\n if ($transaction->terminal) {\n \\Genesis\\Config::setToken($transaction->terminal);\n }\n\n $data = array(\n 'transaction_id' => md5(uniqid() . mt_rand() . microtime(true)),\n 'usage' => $usage,\n 'remote_ip' => $ip_addr,\n 'reference_id' => $transaction->id_unique,\n );\n\n $response = EComProcessingTransactionProcess::void($data);\n\n $transaction_response = new EComProcessingTransaction();\n $transaction_response->id_parent = $transaction->id_unique;\n $transaction_response->ref_order = $transaction->ref_order;\n $transaction_response->importResponse($response->getResponseObject());\n $transaction_response->updateOrderHistory(\n Configuration::get('PS_OS_CANCELED'), true\n );\n $transaction_response->add();\n } catch (\\Exception $e) {\n $this->logError($e);\n\n $this->setSessVar('error_transaction',\n $this->l('The transaction was unsuccessful, please check your Logs for more information')\n );\n }\n }", "public function processVoid(): void\n {\n $isVoid = $this->transaction->getTxnType() === TransactionInterface::TYPE_VOID;\n if ($isVoid && $this->config->getValue('order_status_voided') === 'canceled') {\n $this->orderManagement->cancel($this->order->getEntityId());\n }\n }", "public function voidPaymentAction()\n {\n if (!$order = $this->_initOrder()) {\n return;\n }\n try {\n $order->getPayment()->void(\n new Varien_Object() // workaround for backwards compatibility\n );\n $order->save();\n $this->_getSession()->addSuccess($this->__('The payment has been voided.'));\n } catch (Mage_Core_Exception $e) {\n $this->_getSession()->addError($e->getMessage());\n } catch (Exception $e) {\n $this->_getSession()->addError($this->__('Failed to void the payment.'));\n Mage::logException($e);\n }\n $this->_redirect('*/*/view', array('order_id' => $order->getId()));\n }", "public function void(Varien_Object $payment)\n {\n $transIds = array();\n \n $invoice = Mage::registry('current_invoice');\n if ($invoice && $invoice->getId() && $invoice->getTransactionId()) {\n $transIds[] = Mage::helper('fris_pay')->getTransactionIdBase($invoice->getTransactionId());\n }\n else {\n $collection = Mage::getModel('sales/order_payment_transaction')\n ->getCollection()\n ->addFieldToSelect('txn_id')\n ->addOrderIdFilter($payment->getOrder()->getId())\n ->addTxnTypeFilter(array(\n Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,\n Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE\n ));\n foreach ($collection->getColumnValues('txn_id') as $transId) {\n $baseId = Mage::helper('fris_pay')->getTransactionIdBase($transId);\n if (!in_array($baseId, $transIds)) {\n $transIds[] = $baseId;\n }\n }\n }\n foreach ($transIds as $transId) {\n $trans = Braintree_Transaction::find($transId);\n if ($trans->status !== Braintree_Transaction::SUBMITTED_FOR_SETTLEMENT &&\n $trans->status !== Braintree_Transaction::AUTHORIZED) {\n Mage::throwException(Mage::helper('fris_pay')\n ->__('Transaction already settled or voided. Cannot void.'));\n }\n if ($trans->status === Braintree_Transaction::SUBMITTED_FOR_SETTLEMENT) {\n $message = Mage::helper('fris_pay')->__('Voided capture.') ;\n }\n }\n $errors = '';\n foreach ($transIds as $transId) {\n $this->_debug('void-' . $transId);\n $result = Braintree_Transaction::void($transId);\n $this->_debug($result);\n if (!$result->success) {\n $errors .= ' ' . Mage::helper('fris_pay/error')->parseBraintreeError($result);\n }\n elseif (!empty($message)) {\n $payment->setMessage($message);\n }\n }\n if ($errors) {\n Mage::throwException(Mage::helper('fris_pay')->__('There was an error voiding the transaction') . ': ' . $errors);\n }\n else {\n $match = true;\n foreach ($transIds as $transId) {\n $collection = Mage::getModel('sales/order_payment_transaction')\n ->getCollection()\n ->addFieldToFilter('parent_txn_id', array('eq' => $transId))\n ->addFieldToFilter('txn_type', Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);\n if ($collection->getSize() < 1) {\n $match = false;\n }\n }\n if ($match) {\n $payment->setIsTransactionClosed(1);\n }\n }\n return $this;\n }", "public function testPaymentVoid() {\n $payment = $this->createEntity('commerce_payment', [\n 'payment_gateway' => $this->paymentGateway->id(),\n 'order_id' => $this->order->id(),\n 'amount' => new Price('10', 'USD'),\n ]);\n $this->paymentGateway->getPlugin()->createPayment($payment);\n\n $this->drupalGet($this->paymentUri . '/' . $payment->id() . '/operation/void');\n $this->assertSession()->pageTextContains('Are you sure you want to void the 10 USD payment?');\n $this->getSession()->getPage()->pressButton('Void');\n $this->assertSession()->addressEquals($this->paymentUri);\n $this->assertSession()->pageTextContains('Voided');\n\n \\Drupal::entityTypeManager()->getStorage('commerce_payment')->resetCache([$payment->id()]);\n $payment = Payment::load($payment->id());\n $this->assertEquals($payment->getState()->getLabel(), 'Voided');\n }", "public function dealCardToDealer();", "public function testBuildCreditCardVoid()\n {\n $config = new SinglePayConfig();\n $config->setServiceConfig(self::$testConfig);\n\n $card = new Card();\n $card->setToken('test-token')\n ->setName('TEST')\n ->setNumber('8696969')\n ->setExpiryMonth('09')\n ->setExpiryYear('18')\n ->setCvv('200');\n\n $data = new SinglePayData();\n $data->setOrderAmount('10.00')\n ->setCard($card);\n\n $creditCardVoid = ExpressFactory::buildCreditCardVoid($config, $data);\n $this->assertInstanceOf('\\SinglePay\\PaymentService\\Element\\Express\\Method\\CreditCardVoid', $creditCardVoid);\n $this->assertInternalType('array', $creditCardVoid->extendedParameters);\n $this->assertEquals('PaymentAccount', $creditCardVoid->extendedParameters[0]->Key);\n }", "public function doVoid(VoidTransaction $transaction): Response\n\t{\n\t\treturn $this->post('api/v2/transaction/void', $transaction);\n\t}", "public function testBuildCreditCardVoidFailWithNoToken()\n {\n $config = new SinglePayConfig();\n $config->setServiceConfig(self::$testConfig);\n\n $card = new Card();\n $card->setName('TEST')\n ->setNumber('8696969')\n ->setExpiryMonth('09')\n ->setExpiryYear('18')\n ->setCvv('200');\n\n $data = new SinglePayData();\n $data->setOrderAmount('10.00')\n ->setCard($card);\n\n $creditCardReversal = ExpressFactory::buildCreditCardVoid($config, $data);\n }", "public function testIsVoidable()\n {\n $this->stubRequest(\n 'POST',\n '/payouts/' . self::TEST_ID . '/void',\n [],\n [],\n [\n 'id' => self::TEST_ID\n ]\n );\n\n $result = Payouts::void(self::TEST_ID);\n\n $this->assertEquals($result['id'], self::TEST_ID);\n }", "public function deleteCard()\n {\n }", "abstract public function cancel_payment( Payment $payment );", "public function debitAction() {\n\n $this->_disableView();\n\n $request = $this->getRequest();\n $transId = $request->getParam('transaction');\n $secret = $request->getParam('secret');\n\n // get the transaction\n $dbTable = new Yourdelivery_Model_DbTable_Heidelpay_Wpf_Transactions();\n $dbRows = $dbTable->find($transId);\n $dbRow = $dbRows->current();\n if (!$dbRow) {\n $this->logger->err('Heidelpay DB: no transaction for transactionId: ' . $transId);\n return $this->_redirect(\"/error/throwpayment\");\n }\n\n $orderId = $dbRow->orderId;\n $response = $dbRow->getResponse();\n $uniqueId = $response['IDENTIFICATION_UNIQUEID'];\n\n // check order id\n if (!$orderId) {\n $this->logger->err('Heidelpay DB: called without order id');\n return $this->_redirect(\"/error/throwpayment\");\n }\n\n // set the default redirect url\n $redirect = \"/order_basis/payment\";\n\n // create order\n try {\n $order = new Yourdelivery_Model_Order($orderId);\n } catch (Yourdelivery_Exception_Database_Inconsistency $e) {\n $this->logger->err('Heidelpay DB: cannot find order #' . $orderId);\n return $this->_redirect(\"/error/throwpayment\");\n }\n\n // secure test\n if ($secret != sha1($order->getNr() . SALT)) {\n $this->logger->err('Heidelpay DB: called with wrong control key for order #' . $orderId);\n return $this->_redirect(\"/error/throwpayment\");\n }\n\n $heidelpay = new Yourdelivery_Payment_Heidelpay_Xml();\n\n $resp = false;\n try {\n $resp = $heidelpay->request($uniqueId, $order, true);\n } catch (Yourdelivery_Payment_Heidelpay_Exception $e) {\n $this->logger->err('Heidelpay DB Error: ' . $e->getMessage());\n return $this->_redirect(\"/error/throwpayment\");\n }\n\n // ack\n if (isset($resp['Result']) && strstr($resp['Result'], \"ACK\") && strstr($resp['Status'], \"NEW\")) {\n $this->logger->info('Heidelpay XML: receive ACK with status NEW for order #' . $orderId);\n\n $order->setStatus(Yourdelivery_Model_Order_Abstract::NOTAFFIRMED, \n new Yourdelivery_Model_Order_StatusMessage(Yourdelivery_Model_Order_StatusMessage::PAYMENT_SUCCESS_CREDIT) \n , true);\n $order->finalizeOrderAfterPayment('credit');\n\n $redirect = \"/order_private/success\";\n if ($order->getKind() == 'comp') {\n $redirect = \"/order_company/success\";\n }\n }\n // case for 3DSecure async redirect \n elseif ($resp['Result'] && strstr($resp['Result'], \"ACK\") && $resp['Status'] == \"WAITING\") {\n $this->logger->info('Heidelpay XML: receive ACK with status WAITING for order #' . $orderId);\n\n // save values in session\n if ($resp['RedirectUrl'] && $resp['RedirectParams']) {\n $this->session->CreditRedirectUrl = $resp['RedirectUrl'];\n $this->session->CreditRedirectParams = $resp['RedirectParams'];\n }\n $redirect = \"/payment_heidelpay/redirect\";\n }\n // fake ?\n elseif (isset($resp['Return']) && Yourdelivery_Payment_Heidelpay::isFake($resp['Return'])) {\n $msg = new Yourdelivery_Model_Order_StatusMessage(Yourdelivery_Model_Order_StatusMessage::PAYMENT_FAKE_CREDIT, $orderId, $resp['Reason'] , $resp['Return']); \n $this->logger->warn($msg->getRawMessage());\n $order->setStatus(Yourdelivery_Model_Order_Abstract::PAYMENT_NOT_AFFIRMED, $msg, true);\n $order->finalizeOrderAfterPayment('credit', true);\n\n $redirect = \"/order_private/success\";\n if ($order->getKind() == 'comp') {\n $redirect = \"/order_company/success\";\n }\n }\n // inform user\n else {\n $redirect .= \"?crediterror=1\";\n $msg = new Yourdelivery_Model_Order_StatusMessage(Yourdelivery_Model_Order_StatusMessage::PAYMENT_ERROR_CREDIT, $orderId, $resp['Reason'] , $resp['Return']); \n $this->logger->err($msg->getRawMessage());\n $order->setStatus(Yourdelivery_Model_Order_Abstract::PAYMENT_NOT_AFFIRMED, $msg);\n }\n\n return $this->_redirect($redirect);\n }", "public function chargecardAction() {\n \n }", "public function actionVoid($id)\n {\n $model = $this->findModel($id);\n\n $result = $model->void(Yii::$app->user->identity->username);\n \n if (empty($result))\n \tYii::$app->session->setFlash('success', \"Receipt successfully voided\");\n else {\n\t\t\tYii::$app->session->addFlash('error', 'Could not complete receipt void. Check log for details. Code `BC020`');\n\t\t\tYii::error(\"*** BC020 Receipt void error(s). Errors: \" . print_r($result, true) . \" Receipt: \" . print_r($model, true));\n }\n\n return $this->redirect(['view', 'id' => $model->id]);\n \n }", "function stripePaymentRequestHE($amount,$user_order,$user_id,$creditCardNo,$expDate,$cvv)\n{\n $rest = \"Error\";\n $cgConf['tid']='8804324';\n $cgConf['amount']=$amount;\n $cgConf['user']='pushstart';\n $cgConf['password']='OE2@38sz';\n $cgConf['cg_gateway_url']=\"https://cgpay5.creditguard.co.il/xpo/Relay\";\n\n $poststring = 'user='.$cgConf['user'];\n $poststring .= '&password='.$cgConf['password'];\n\n /*Build Ashrait XML to post*/\n $poststring.='&int_in=<ashrait>\n\t\t\t\t\t\t\t<request>\n\t\t\t\t\t\t\t<language>HEB</language>\n\t\t\t\t\t\t\t<command>doDeal</command>\n\t\t\t\t\t\t\t<requestId/>\n\t\t\t\t\t\t\t<version>1000</version>\n\t\t\t\t\t\t\t<doDeal>\n\t\t\t\t\t\t\t\t<terminalNumber>'.$cgConf['tid'].'</terminalNumber>\n\t\t\t\t\t\t\t\t<authNumber/>\n\t\t\t\t\t\t\t\t<transactionCode>Phone</transactionCode>\n\t\t\t\t\t\t\t\t<transactionType>Debit</transactionType>\n\t\t\t\t\t\t\t\t<total>'.$cgConf['amount'].'</total>\n\t\t\t\t\t\t\t\t<creditType>RegularCredit</creditType>\n\t\t\t\t\t\t\t\t<cardNo>'.$creditCardNo.'</cardNo>\n\t\t\t\t\t\t\t\t<cvv>'.$cvv.'</cvv>\n\t\t\t\t\t\t\t\t<cardExpiration>'.$expDate.'</cardExpiration>\n\t\t\t\t\t\t\t\t<validation>AutoComm</validation>\n\t\t\t\t\t\t\t\t<numberOfPayments/>\n\t\t\t\t\t\t\t\t<customerData>\n\t\t\t\t\t\t\t\t\t<userData1>'.$user_order['email'].'</userData1>\n\t\t\t\t\t\t\t\t\t<userData2/>\n\t\t\t\t\t\t\t\t\t<userData3/>\n\t\t\t\t\t\t\t\t\t<userData4/>\n\t\t\t\t\t\t\t\t\t<userData5/>\n\t\t\t\t\t\t\t\t</customerData>\n\t\t\t\t\t\t\t\t<currency>ILS</currency>\n\t\t\t\t\t\t\t\t<firstPayment/>\n\t\t\t\t\t\t\t\t<periodicalPayment/>\n\t\t\t\t\t\t\t\t<user>Push</user>\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<invoice>\n\n\t\t\t\t\t\t\t\t\t<invoiceCreationMethod>wait</invoiceCreationMethod>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceDate/>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceSubject>'.$user_order['restaurantTitle'].' Order# '.$user_id.'</invoiceSubject>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceDiscount/>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceDiscountRate/>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceItemCode>'.$user_id.'</invoiceItemCode>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceItemDescription>'.$user_order['restaurantTitle'].' food order from OrderApp</invoiceItemDescription>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceItemQuantity>1</invoiceItemQuantity>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceItemPrice>'.$amount.'</invoiceItemPrice>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceTaxRate/>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceComments/>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<companyInfo>OrderApp</companyInfo>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<sendMail>1</sendMail>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<mailTo>'.$user_order['email'].'</mailTo>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<isItemPriceWithTax>0</isItemPriceWithTax>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<ccDate>'.date(\"Y-m-d\").'</ccDate>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceSignature/>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<invoiceType>receipt</invoiceType>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<DocNotMaam/>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</invoice>\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t</doDeal>\n\t\t\t\t\t\t</request>\n\t\t\t\t\t</ashrait>';\n\n\n //init curl connection\n if( function_exists( \"curl_init\" )) {\n $CR = curl_init();\n curl_setopt($CR, CURLOPT_URL, $cgConf['cg_gateway_url']);\n curl_setopt($CR, CURLOPT_POST, 1);\n curl_setopt($CR, CURLOPT_FAILONERROR, true);\n curl_setopt($CR, CURLOPT_POSTFIELDS, $poststring);\n curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($CR, CURLOPT_FAILONERROR,true);\n\n\n //actual curl execution perfom\n $result = curl_exec( $CR );\n $error = curl_error ( $CR );\n\n // on error - die with error message\n if( !empty( $error )) {\n die($error);\n }\n\n curl_close($CR);\n\n $result = mb_convert_encoding( $result, \"HTML-ENTITIES\", \"UTF-8\");\n\n $xml = simplexml_load_string((string) $result);\n\n if($xml->response->result[0] == 000)\n {\n $rest = [\n\n \"response\" => 'success',\n \"trans_id\" => (string) $xml->response->tranId[0]\n ];\n\n }\n else{\n\n $rest = [\n\n \"response\" => (string) $xml->response->message[0]\n\n ];\n\n }\n\n }\n\n return $rest;\n}", "public function cancelAction()\r\n {\r\n\r\n if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {\r\n $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());\r\n if ($order->getId()) {\r\n // Flag the order as 'cancelled' and save it\r\n $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, 'Gateway has declined the payment.')->save();\r\n Mage::getSingleton('checkout/session')->unsQuoteId();\r\n Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));\r\n }\r\n }\r\n }", "public function cancelBlockedCards()\n {\n $timeout = Mage::getStoreConfig('payment/cardcadou/timeout', null);\n $transactionModel = Mage::getModel('cardcadou/transaction');\n $_apiCardCadou = Mage::getModel('cardcadou/cardcadou')->cardcadou();\n $transactionCollection = $transactionModel->getCollection()->addFieldToFilter('order_status', array('nlike' => 'ACCEPTED'))\n ->addFieldToFilter('cancel_status', array('nlike' => 'ACCEPTED'));\n $ordersCollection = Mage::getModel('sales/order');\n $nowDate = new DateTime(date('y-m-d h:m:s'));\n foreach ($transactionCollection as $item) {\n $date = new DateTime($item->getUpdatedAt());\n $min = \"+\" . $timeout . \" minutes\";\n $date->modify($min);\n if ($date < $nowDate) {\n $payment = $ordersCollection->load($item->getOrderId(), 'increment_id')->getPayment()->getMethodInstance()->getCode();\n\n if ($payment == 'cashondelivery') {\n $_orderType = $_apiCardCadou::TYPE_CONFIRM_RAMBURS;\n } else {\n $_orderType = $_apiCardCadou::TYPE_CONFIRM_ONLINE;\n }\n\n $result = $_apiCardCadou->cancelCard($item->getOrderId(), $_orderType);\n\n if (isset($result['error'])) {\n Mage::log($result, null, 'cardcadou.log');\n $transactionData = array(\n 'id' => $item->getId(),\n 'order_status' => $item->getOrderStatus(),\n 'order_deny_code' => $item->getOrderDenyCode(),\n 'confirmation_status' => '',\n 'deny_code' => 0,\n 'cancel_status' => 'API ERROR',\n 'cancel_deny_code' => 0,\n 'updated_at' => now(),\n );\n } else {\n $transactionData = array(\n 'id' => $item->getId(),\n 'order_status' => $item->getOrderStatus(),\n 'order_deny_code' => $item->getOrderDenyCode(),\n 'confirmation_status' => '',\n 'deny_code' => 0,\n 'cancel_status' => $result['confirmation_status'],\n 'cancel_deny_code' => $result['confirmation_deny_code'],\n 'uuid' => $result['transaction_uuid'],\n 'updated_at' => now(),\n );\n }\n $item->setData($transactionData);\n $item->save();\n }\n }\n }", "public function voidPayment(PaymentInterface $payment) {\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter the query on the id_expositor_feria column Example usage: $query>filterByIdExpositorFeria(1234); // WHERE id_expositor_feria = 1234 $query>filterByIdExpositorFeria(array(12, 34)); // WHERE id_expositor_feria IN (12, 34) $query>filterByIdExpositorFeria(array('min' => 12)); // WHERE id_expositor_feria > 12
public function filterByIdExpositorFeria($idExpositorFeria = null, $comparison = null) { if (is_array($idExpositorFeria)) { $useMinMax = false; if (isset($idExpositorFeria['min'])) { $this->addUsingAlias(StatusPeer::ID_EXPOSITOR_FERIA, $idExpositorFeria['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($idExpositorFeria['max'])) { $this->addUsingAlias(StatusPeer::ID_EXPOSITOR_FERIA, $idExpositorFeria['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { return $this; } if (null === $comparison) { $comparison = Criteria::IN; } } return $this->addUsingAlias(StatusPeer::ID_EXPOSITOR_FERIA, $idExpositorFeria, $comparison); }
[ "public function filterByIdFeria($idFeria = null, $comparison = null)\n\t{\n\t\tif (is_array($idFeria)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($idFeria['min'])) {\n\t\t\t\t$this->addUsingAlias(ActividadPeer::ID_FERIA, $idFeria['min'], Criteria::GREATER_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif (isset($idFeria['max'])) {\n\t\t\t\t$this->addUsingAlias(ActividadPeer::ID_FERIA, $idFeria['max'], Criteria::LESS_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif ($useMinMax) {\n\t\t\t\treturn $this;\n\t\t\t}\n\t\t\tif (null === $comparison) {\n\t\t\t\t$comparison = Criteria::IN;\n\t\t\t}\n\t\t}\n\t\treturn $this->addUsingAlias(ActividadPeer::ID_FERIA, $idFeria, $comparison);\n\t}", "public function filterByIdFeria($idFeria = null, $comparison = null)\n\t{\n\t\tif (is_array($idFeria)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($idFeria['min'])) {\n\t\t\t\t$this->addUsingAlias(FeriaSelloeditorialPeer::ID_FERIA, $idFeria['min'], Criteria::GREATER_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif (isset($idFeria['max'])) {\n\t\t\t\t$this->addUsingAlias(FeriaSelloeditorialPeer::ID_FERIA, $idFeria['max'], Criteria::LESS_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif ($useMinMax) {\n\t\t\t\treturn $this;\n\t\t\t}\n\t\t\tif (null === $comparison) {\n\t\t\t\t$comparison = Criteria::IN;\n\t\t\t}\n\t\t}\n\t\treturn $this->addUsingAlias(FeriaSelloeditorialPeer::ID_FERIA, $idFeria, $comparison);\n\t}", "public function filterByIdUsuario($idUsuario = null, $comparison = null)\n\t{\n\t\tif (is_array($idUsuario)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($idUsuario['min'])) {\n\t\t\t\t$this->addUsingAlias(ExpositorPeer::ID_USUARIO, $idUsuario['min'], Criteria::GREATER_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif (isset($idUsuario['max'])) {\n\t\t\t\t$this->addUsingAlias(ExpositorPeer::ID_USUARIO, $idUsuario['max'], Criteria::LESS_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif ($useMinMax) {\n\t\t\t\treturn $this;\n\t\t\t}\n\t\t\tif (null === $comparison) {\n\t\t\t\t$comparison = Criteria::IN;\n\t\t\t}\n\t\t}\n\t\treturn $this->addUsingAlias(ExpositorPeer::ID_USUARIO, $idUsuario, $comparison);\n\t}", "public function filterByIdTipoFeria($idTipoFeria = null, $comparison = null)\n\t{\n\t\tif (is_array($idTipoFeria)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($idTipoFeria['min'])) {\n\t\t\t\t$this->addUsingAlias(FeriaPeer::ID_TIPO_FERIA, $idTipoFeria['min'], Criteria::GREATER_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif (isset($idTipoFeria['max'])) {\n\t\t\t\t$this->addUsingAlias(FeriaPeer::ID_TIPO_FERIA, $idTipoFeria['max'], Criteria::LESS_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif ($useMinMax) {\n\t\t\t\treturn $this;\n\t\t\t}\n\t\t\tif (null === $comparison) {\n\t\t\t\t$comparison = Criteria::IN;\n\t\t\t}\n\t\t}\n\t\treturn $this->addUsingAlias(FeriaPeer::ID_TIPO_FERIA, $idTipoFeria, $comparison);\n\t}", "public function filterByIdUsuario($idUsuario = null, $comparison = null)\n {\n if (is_array($idUsuario)) {\n $useMinMax = false;\n if (isset($idUsuario['min'])) {\n $this->addUsingAlias(DatgenPeer::IDUSUARIO, $idUsuario['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($idUsuario['max'])) {\n $this->addUsingAlias(DatgenPeer::IDUSUARIO, $idUsuario['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(DatgenPeer::IDUSUARIO, $idUsuario, $comparison);\n }", "public function filterByIdFuncao($idFuncao = null, $comparison = null)\r\n {\r\n if (is_array($idFuncao)) {\r\n $useMinMax = false;\r\n if (isset($idFuncao['min'])) {\r\n $this->addUsingAlias(KitsEnsaioPeer::ID_FUNCAO, $idFuncao['min'], Criteria::GREATER_EQUAL);\r\n $useMinMax = true;\r\n }\r\n if (isset($idFuncao['max'])) {\r\n $this->addUsingAlias(KitsEnsaioPeer::ID_FUNCAO, $idFuncao['max'], Criteria::LESS_EQUAL);\r\n $useMinMax = true;\r\n }\r\n if ($useMinMax) {\r\n return $this;\r\n }\r\n if (null === $comparison) {\r\n $comparison = Criteria::IN;\r\n }\r\n }\r\n\r\n return $this->addUsingAlias(KitsEnsaioPeer::ID_FUNCAO, $idFuncao, $comparison);\r\n }", "public function filterByExpositorFeria($expositorFeria, $comparison = null)\n\t{\n\t\tif ($expositorFeria instanceof ExpositorFeria) {\n\t\t\treturn $this\n\t\t\t\t->addUsingAlias(FeriaPeer::ID, $expositorFeria->getIdFeria(), $comparison);\n\t\t} elseif ($expositorFeria instanceof PropelCollection) {\n\t\t\treturn $this\n\t\t\t\t->useExpositorFeriaQuery()\n\t\t\t\t\t->filterByPrimaryKeys($expositorFeria->getPrimaryKeys())\n\t\t\t\t->endUse();\n\t\t} else {\n\t\t\tthrow new PropelException('filterByExpositorFeria() only accepts arguments of type ExpositorFeria or PropelCollection');\n\t\t}\n\t}", "public function filterByIdventa($idventa = null, $comparison = null)\n {\n if (is_array($idventa)) {\n $useMinMax = false;\n if (isset($idventa['min'])) {\n $this->addUsingAlias(FacturaPeer::IDVENTA, $idventa['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($idventa['max'])) {\n $this->addUsingAlias(FacturaPeer::IDVENTA, $idventa['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(FacturaPeer::IDVENTA, $idventa, $comparison);\n }", "public function filterByIdCliente($idCliente = null, $comparison = null)\n\t{\n\t\tif (is_array($idCliente)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($idCliente['min'])) {\n\t\t\t\t$this->addUsingAlias(FacturaPeer::ID_CLIENTE, $idCliente['min'], Criteria::GREATER_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif (isset($idCliente['max'])) {\n\t\t\t\t$this->addUsingAlias(FacturaPeer::ID_CLIENTE, $idCliente['max'], Criteria::LESS_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif ($useMinMax) {\n\t\t\t\treturn $this;\n\t\t\t}\n\t\t\tif (null === $comparison) {\n\t\t\t\t$comparison = Criteria::IN;\n\t\t\t}\n\t\t}\n\t\treturn $this->addUsingAlias(FacturaPeer::ID_CLIENTE, $idCliente, $comparison);\n\t}", "public function filterByIdcliente($idcliente = null, $comparison = null)\n {\n if (is_array($idcliente)) {\n $useMinMax = false;\n if (isset($idcliente['min'])) {\n $this->addUsingAlias(ClientePeer::IDCLIENTE, $idcliente['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($idcliente['max'])) {\n $this->addUsingAlias(ClientePeer::IDCLIENTE, $idcliente['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(ClientePeer::IDCLIENTE, $idcliente, $comparison);\n }", "public function filterByIdservicio($idservicio = null, $comparison = null)\n {\n if (is_array($idservicio)) {\n $useMinMax = false;\n if (isset($idservicio['min'])) {\n $this->addUsingAlias(CargoconsultaPeer::IDSERVICIO, $idservicio['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($idservicio['max'])) {\n $this->addUsingAlias(CargoconsultaPeer::IDSERVICIO, $idservicio['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(CargoconsultaPeer::IDSERVICIO, $idservicio, $comparison);\n }", "public function filterByIdSelloeditorial($idSelloeditorial = null, $comparison = null)\n\t{\n\t\tif (is_array($idSelloeditorial)) {\n\t\t\t$useMinMax = false;\n\t\t\tif (isset($idSelloeditorial['min'])) {\n\t\t\t\t$this->addUsingAlias(FeriaSelloeditorialPeer::ID_SELLOEDITORIAL, $idSelloeditorial['min'], Criteria::GREATER_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif (isset($idSelloeditorial['max'])) {\n\t\t\t\t$this->addUsingAlias(FeriaSelloeditorialPeer::ID_SELLOEDITORIAL, $idSelloeditorial['max'], Criteria::LESS_EQUAL);\n\t\t\t\t$useMinMax = true;\n\t\t\t}\n\t\t\tif ($useMinMax) {\n\t\t\t\treturn $this;\n\t\t\t}\n\t\t\tif (null === $comparison) {\n\t\t\t\t$comparison = Criteria::IN;\n\t\t\t}\n\t\t}\n\t\treturn $this->addUsingAlias(FeriaSelloeditorialPeer::ID_SELLOEDITORIAL, $idSelloeditorial, $comparison);\n\t}", "function filterBy_S_A_F_E($SEDE, $AREA, $FACULTAD, $ESCUELA,$TABLE_I)\n{\n global $mysqli;\n $TINS = $TABLE_I;\n $query = new Query($mysqli, \"SELECT red,nombre,apellido,CONCAT(provincia,'-',clave,'-',tomo,'-',folio)AS cedula,n_ins,sede,fac_ia,esc_ia,car_ia,fac_iia,esc_iia,car_iia,fac_iiia,esc_iiia,car_iiia\n FROM \" .$TINS. \" where sede = ? AND area_i = ? AND fac_ia = ? AND esc_ia = ? \");\n $parametros = array(\"iiii\", &$SEDE, &$AREA, &$FACULTAD, &$ESCUELA);\n $data = $query->getresults($parametros);\n\n if (isset($data[0])) {\n return $data;\n } else {\n return null;\n }\n\n}", "public function testFilterById()\n {\n // find by single id\n $book = PropelQuery::from('Book b')\n ->where('b.Title like ?', 'Don%')\n ->orderBy('b.ISBN', 'desc')\n ->findOne();\n\n $c = BookQuery::create()->filterById($book->getId());\n\n $book2 = $c->findOne();\n\n $this->assertTrue($book2 instanceof Book);\n $this->assertEquals('Don Juan', $book2->getTitle());\n\n //find range\n $booksAll = PropelQuery::from('Book b')\n ->orderBy('b.ID', 'asc')\n ->find();\n\n $booksIn = BookQuery::create()\n ->filterById(array($booksAll[1]->getId(), $booksAll[2]->getId()))\n ->find();\n\n $this->assertTrue($booksIn[0] == $booksAll[1]);\n $this->assertTrue($booksIn[1] == $booksAll[2]);\n\n // filter by min value with greater equal\n $booksIn = null;\n\n $booksIn = BookQuery::create()\n ->filterById(\n array('min' => $booksAll[2]->getId()))\n ->find();\n\n $this->assertTrue($booksIn[1] == $booksAll[3]);\n\n // filter by max value with less equal\n $booksIn = null;\n\n $booksIn = BookQuery::create()\n ->filterById(\n array('max' => $booksAll[1]->getId()) )\n ->find();\n\n $this->assertTrue($booksIn[1] == $booksAll[1]);\n\n // check backwards compatibility:\n // SELECT FROM `book` WHERE book.id IN (:p1,:p2)\n // must be the same as\n // SELECT FROM `book` WHERE (book.id>=:p1 AND book.id<=:p2)\n\n $minMax = BookQuery::create()\n ->filterById(\n array('min' => $booksAll[1]->getId(),\n 'max' => $booksAll[2]->getId())\n )\n ->find();\n\n $In = BookQuery::create()\n ->filterById(\n array($booksAll[1]->getId(),\n $booksAll[2]->getId())\n )\n ->find();\n\n $this->assertTrue($minMax[0] === $In[0]);\n $this->assertTrue(count($minMax->getData()) === count($In->getData()));\n }", "public function filterByIdventa($idventa = null, $comparison = null)\n {\n if (is_array($idventa)) {\n $useMinMax = false;\n if (isset($idventa['min'])) {\n $this->addUsingAlias(VentadetallePeer::IDVENTA, $idventa['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($idventa['max'])) {\n $this->addUsingAlias(VentadetallePeer::IDVENTA, $idventa['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(VentadetallePeer::IDVENTA, $idventa, $comparison);\n }", "public function filtrar_equipo_usuario_valores($filtro){\n\t\t\t$query = \"SELECT ID_Equipo_Alumno, COD_Equipo, User, COD_Rol FROM Equipo, Usuario, Equipo_Usuario WHERE Equipo_Usuario.ID_Equipo = Equipo.ID_Equipo and Equipo_Usuario.ID_Usuario = Usuario.ID_Usuario\";\n\t\tif ($filtro['ID_Equipo'] != 0){\n\t\t\t$query = $query . \" and Equipo.ID_Equipo = \" . $filtro['ID_Equipo'];\n\t\t}\n\t\tif ($filtro['ID_Usuario'] != 0){\n\t\t\t$query = $query . \" and Usuario.ID_Usuario = \" . $filtro['ID_Usuario'];\n\t\t}\t\t\n\t\t$query = $this->db->query($query);\t\t\n\t\tif ($query->num_rows() > 0){\n\t\t\treturn $query;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "public function filterByIdautor($idautor = null, $comparison = null)\n {\n if (is_array($idautor)) {\n $useMinMax = false;\n if (isset($idautor['min'])) {\n $this->addUsingAlias(LibroPeer::IDAUTOR, $idautor['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($idautor['max'])) {\n $this->addUsingAlias(LibroPeer::IDAUTOR, $idautor['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(LibroPeer::IDAUTOR, $idautor, $comparison);\n }", "public function filterByUsuarioId($usuarioId = null, $comparison = null)\n {\n if (is_array($usuarioId)) {\n $useMinMax = false;\n if (isset($usuarioId['min'])) {\n $this->addUsingAlias(AumentoUsuarioPeer::USUARIO_ID, $usuarioId['min'], Criteria::GREATER_EQUAL);\n $useMinMax = true;\n }\n if (isset($usuarioId['max'])) {\n $this->addUsingAlias(AumentoUsuarioPeer::USUARIO_ID, $usuarioId['max'], Criteria::LESS_EQUAL);\n $useMinMax = true;\n }\n if ($useMinMax) {\n return $this;\n }\n if (null === $comparison) {\n $comparison = Criteria::IN;\n }\n }\n\n return $this->addUsingAlias(AumentoUsuarioPeer::USUARIO_ID, $usuarioId, $comparison);\n }", "public function getFilter($id);" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function extractDBParams Extract database params and return a array
private static function extractDBParams(array $params = []) : array { return self::extractParams($params, ["DB_", "DATABASE_"]); }
[ "public function getDatabaseParams()\n\t{\n\t\treturn $this->getParam( 'database' );\n\t}", "public function getDatabaseParameters()\r\n {\r\n $databaseParameters = [\r\n 'host' => \"localhost\",\r\n 'name' => \"root\",\r\n 'password' => \"\",\r\n 'database' => \"modera_test\",\r\n ];\r\n $result = $databaseParameters;\r\n\r\n return $result;\r\n }", "function getDbInfo(){\n\t$dbinfo = file_get_contents(\"./settings.conf\");\n\t$dbinfo = json_decode($dbinfo, true);\n\t$dbname = (string)$dbinfo[\"dbname\"];\n\t$dbpass = (string)$dbinfo[\"dbpass\"];\n\treturn(array($dbname, $dbpass));\n}", "abstract protected function getDatabaseConnectionParameters();", "private function getDBConnData() {\n //Read data from config file\n $config = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . '/../config.ini');\n\n //Return the DB config data\n return $dbParams = array(\n 'driver' => 'pdo_mysql',\n 'user' => $config['DBUSER'],\n 'password' => $config['DBPASS'],\n 'dbname' => $config['DBNAME']\n );\n }", "public function obtainDBCredentials()\n {\n $dbParams = $this->connection->getParams();\n\n return array(\n 'username' => $dbParams['user'],\n 'password' => $dbParams['password'],\n 'host' => $dbParams['host'],\n 'port' => 3306,\n 'name' => $dbParams['dbname'],\n );\n }", "public function getDbInfo();", "private function dbAccess() {\n\t\t$reg = $GLOBALS['_DB_DATAOBJECT']['RESULTS'][1]->dbh->dsn;\n\t\t$return = Array(\n\t\t\t'HOST' => $reg['hostspec'],\n\t\t\t'DATABASE' => $reg['database'],\n\t\t\t'USER' => $reg['username'],\n\t\t\t'PASSWORD' => $reg['password']\n\t\t);\n\t\treturn $return;\n\t}", "private function _extractDbVars()\n\t{\n\t\t// Now loop through the remaining (database-based) settings.\n\t\t$this->configVars = array_map(\n\t\t\tfunction ($configVar) {\n\t\t\t\t// We just saved the file-based settings, so skip their definitions.\n\t\t\t\tif (!is_array($configVar) || $configVar[2] === 'file')\n\t\t\t\t{\n\t\t\t\t\treturn '';\n\t\t\t\t}\n\n\t\t\t\t// Rewrite the definition a bit.\n\t\t\t\tif (is_array($configVar) && $configVar[2] === 'db')\n\t\t\t\t{\n\t\t\t\t\treturn array($configVar[3], $configVar[0]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// This is a regular config var requiring no special treatment.\n\t\t\t\t\treturn $configVar;\n\t\t\t\t}\n\t\t\t}, $this->configVars\n\t\t);\n\n\t\t// Save the new database-based settings, if any.\n\t\tparent::save();\n\t}", "function cubrid_get_db_parameter($conn_identifier): array\n{\n error_clear_last();\n $result = \\cubrid_get_db_parameter($conn_identifier);\n if ($result === false) {\n throw CubridException::createFromPhpError();\n }\n return $result;\n}", "function getDBOptions(){\r\n\t$dbOptions = array();\r\n\tif (strpos(getCWD(), 'php') !== FALSE || strpos(getCWD(), 'install') !== FALSE){\r\n\t\t$lines = file('../cfg/db.cfg');\r\n\t}else{\r\n\t\t$lines = file('cfg/db.cfg');\r\n\t}\r\n\t//parse through the config line finding the settings and adding them to the return array.\t\r\n\tforeach ($lines as $line_num => $line) {\r\n\t\tif (strpos($line, 'DB:') !== FALSE){\r\n\t\t\t$end = strpos($line, ';');\r\n\t\t\t$start = strpos($line, ':')+1;\r\n\t\t\t$length = $end - $start;\r\n\t\t\t$dbName = substr($line, $start, $length);\r\n\t\t\t$dbOptions[\"DB\"] = $dbName;\r\n\t\t}else if (strpos($line, 'USER:') !== FALSE){\r\n\t\t\t$end = strpos($line, ';');\r\n\t\t\t$start = strpos($line, ':')+1;\r\n\t\t\t$length = $end - $start;\r\n\t\t\t$user = substr($line, $start, $length);\r\n\t\t\t$dbOptions[\"USER\"] = $user;\r\n\t\t}else if (strpos($line, 'PASS:') !== FALSE){\r\n\t\t\t$end = strpos($line, ';');\r\n\t\t\t$start = strpos($line, ':')+1;\r\n\t\t\t$length = $end - $start;\r\n\t\t\t$pass = substr($line, $start, $length);\r\n\t\t\t$dbOptions[\"PASS\"] = $pass;\r\n\t\t}else if (strpos($line, 'IP:') !== FALSE){\r\n\t\t\t$end = strpos($line, ';');\r\n\t\t\t$start = strpos($line, ':')+1;\r\n\t\t\t$length = $end - $start;\r\n\t\t\t$ip = substr($line, $start, $length);\r\n\t\t\t$dbOptions[\"IP\"] = $ip;\r\n\t\t}else{\r\n\t\t\t//any other lines including blanks will be skipped\r\n\t\t}\r\n\t}\r\n\treturn $dbOptions;\r\n}", "function getParameters() {\n\n\t\t// execute query\n\t\t$parameters = $this->conn->query(\n\t\t\t'SELECT *\n\t\t\tFROM parameters'\n\t\t);\n\t\t// return the first row in an array\n\t\treturn $parameters->fetch_array();\n\t}", "private function get_entry_page_query_specs_from_config_db() {\n $db = new Connection(['database' => $this->configDBPath, 'dbdriver' => 'sqlite3']);\n\n foreach ($db->query(\"SELECT * FROM general_params\")->getResultArray() as $row) {\n switch ($row['name']) {\n case 'my_db_group':\n $this->query_parts->dbn = $row['value'];\n break;\n case 'entry_page_data_table':\n $this->query_parts->table = $row['value'];\n break;\n case 'entry_page_data_cols':\n $this->query_parts->columns = $row['value'];\n break;\n case 'entry_page_data_id_col':\n $col = $row['value'];\n // $name = \"pf_\".str_replace(' ', '_', strtolower($col));\n $a = array();\n $a['col'] = $col;\n $a['cmp'] = 'MatchesText'; // 'MatchesText'? 'Equals'?\n $a['label'] = $col;\n $this->primary_filter_specs[$row['name']] = $a;\n break;\n }\n }\n\n $db->close();\n }", "private static function parseDatabaseUrl(array $params)\n {\n if (!isset($params['url'])) {\n return $params;\n }\n \n // (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid\n $url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $params['url']);\n \n $url = parse_url($url);\n \n if ($url === false) {\n throw new DBALException('Malformed parameter \"url\".');\n }\n \n if (isset($url['scheme'])) {\n $params['driver'] = str_replace('-', '_', $url['scheme']); // URL schemes must not contain underscores, but dashes are ok\n if (isset(self::$driverSchemeAliases[$params['driver']])) {\n $params['driver'] = self::$driverSchemeAliases[$params['driver']]; // use alias like \"postgres\", else we just let checkParams decide later if the driver exists (for literal \"pdo-pgsql\" etc)\n }\n }\n \n if (isset($url['host'])) {\n $params['host'] = $url['host'];\n }\n if (isset($url['port'])) {\n $params['port'] = $url['port'];\n }\n if (isset($url['user'])) {\n $params['user'] = $url['user'];\n }\n if (isset($url['pass'])) {\n $params['password'] = $url['pass'];\n }\n \n if (isset($url['path'])) {\n if (!isset($url['scheme']) || (strpos($url['scheme'], 'sqlite') !== false && $url['path'] == ':memory:')) {\n $params['dbname'] = $url['path']; // if the URL was just \"sqlite::memory:\", which parses to scheme and path only\n } else {\n $params['dbname'] = substr($url['path'], 1); // strip the leading slash from the URL\n }\n }\n \n if (isset($url['query'])) {\n $query = array();\n parse_str($url['query'], $query); // simply ingest query as extra params, e.g. charset or sslmode\n $params = array_merge($params, $query); // parse_str wipes existing array elements\n }\n \n return $params;\n }", "function readDBConfig() {\r\n\t\t\tglobal $db;\r\n\t\t\t$fields = $db->getItems('table_fields', \"SELECT * FROM table_attributes WHERE publish='on' AND table_id=\".$this->id.\" ORDER by ord\");\r\n\t\t\tif (sizeof($fields) > 0) {\r\n\t\t\t\tforeach ($fields as $f) {\r\n\t\t\t\t\t$f['group_update'] = $f['group_update'] == 'on';\r\n\t\t\t\t\t$f['readonly'] = $f['readonly'] == 'on';\r\n\t\t\t\t\t$f['search'] = $f['search'] == 'on';\r\n\t\t\t\t\tif (!empty($f['params'])) {\r\n\t\t\t\t\t\t$aparams = explode(';', trim($f['params']));\r\n\t\t\t\t\t\tforeach ($aparams as $ap) {\r\n\t\t\t\t\t\t\tif (!empty($ap) && stristr($ap, ':')) {\r\n\t\t\t\t\t\t\t\t$vals = explode(':', $ap);\r\n\t\t\t\t\t\t\t\t$f[$vals[0]] = str_replace(\"`\", \"'\", $vals[1]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$this->fields[$f['name']] = $f;\r\n\t\t\t\t}\r\n \r\n\t\t\t\tforeach ($this->fields as $k => $f) {\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n } else {\r\n throw new Exception('No fields in table: '.$this->getDBTableName());\r\n }\r\n }", "private function build_db_array()\n\t{\n\t\t$db_list = $this->_sql_handler->db_list();\n\t\tif ( $db_list !== false )\n\t\t{\n\t\t\t$this->db_list = $db_list;\n\t\t}\n\t}", "private function getEzPublishDatabase()\n {\n // Fetch db connection data\n $siteaccess = $this->getContainer()->getParameter('data_transfer_bundle.siteaccess');\n\n $legacyParameter = sprintf('ezsettings.%s.database.params', $siteaccess);\n $repositoryParameter = sprintf('ezsettings.%s.repository', $siteaccess);\n if ($this->getContainer()->hasParameter($legacyParameter)) {\n $dbParams = $this->getContainer()->getParameter($legacyParameter);\n\n return array(\n 'dbName' => $dbParams['database'],\n 'dbUser' => $dbParams['user'],\n 'dbPass' => $dbParams['password'],\n 'dbHost' => $dbParams['host'],\n );\n } elseif ($this->getContainer()->hasParameter($repositoryParameter)) {\n $repository = $this->getContainer()->getParameter($repositoryParameter);\n $repositories = $this->getContainer()->getParameter('ezpublish.repositories');\n $connection = $repositories[$repository]['connection'];\n /** @var $dbalConnection Connection */\n $dbalConnection = $this->getContainer()->get(sprintf('doctrine.dbal.%s_connection', $connection));\n\n return array(\n 'dbName' => $dbalConnection->getDatabase(),\n 'dbUser' => $dbalConnection->getUsername(),\n 'dbPass' => $dbalConnection->getPassword(),\n 'dbHost' => $dbalConnection->getHost(),\n );\n } else {\n $message = \"Unable to find database settings from siteaccess. You need to define either %s or %s\";\n throw new \\Exception(sprintf($message, $legacyParameter, $repositoryParameter));\n }\n }", "private static function parseDatabaseUrl(\n #[SensitiveParameter]\n array $params\n ): array {\n if (! isset($params['url'])) {\n return $params;\n }\n\n Deprecation::trigger(\n 'doctrine/dbal',\n 'https://github.com/doctrine/dbal/pull/5843',\n 'The \"url\" connection parameter is deprecated. Please use %s to parse a database url before calling %s.',\n DsnParser::class,\n self::class,\n );\n\n $parser = new DsnParser(self::$driverSchemeAliases);\n try {\n $parsedParams = $parser->parse($params['url']);\n } catch (MalformedDsnException $e) {\n throw new Exception('Malformed parameter \"url\".', 0, $e);\n }\n\n if (isset($parsedParams['driver'])) {\n // The requested driver from the URL scheme takes precedence\n // over the default custom driver from the connection parameters (if any).\n unset($params['driverClass']);\n }\n\n $params = array_merge($params, $parsedParams);\n\n // If a schemeless connection URL is given, we require a default driver or default custom driver\n // as connection parameter.\n if (! isset($params['driverClass']) && ! isset($params['driver'])) {\n throw Exception::driverRequired($params['url']);\n }\n\n return $params;\n }", "function getDbArray()\n {\n return [\n 'ip' => $this->getIp(),\n 'uri' => $this->getUri(),\n 'query' => $this->getQuery(),\n ];\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the configuration node value.
public function setValue($value): ConfigNode { $this->nodeValue[] = $value; return $this; }
[ "private function setConfigValue($path, $value)\n {\n if (Mage::getConfig()->getNode($path) === false) {\n Mage::getConfig()->setNode($path, $value);\n }\n }", "public function setConfigurationProperty($name, $value) {}", "public function setConfig($key, $value);", "abstract protected function setNodeValue(?string $value): void;", "public function Config_Set($parameter, $value);", "public function tree_set_property($name, $value)\n\t{\n\t\tarray_key_exists($name, $this->configuration) and $this->configuration[$name] = $value;\n\t}", "public function setConfig($name, $value = null);", "public function setConfig($variable, $value);", "public function setValue($value) {}", "public function updateConfigValue($name, $value);", "function setValue($value) {\n $this->value = $value;\n }", "public function set($value) {}", "public function config_set($parameter, $value) {\n \t$this->proxy->setOption($parameter, $value);\n }", "abstract public function setValue(&$node, $value, $name = null, $asNode = false);", "function setValue($value)\n {\n $this->attributes['value'] = $value;\n }", "function setValue ($value) {\r\n $this->_value = $value;\r\n }", "public function setSetting($key, $value);", "public static function set($name,$value)\n {\n self::$config[$name] = $value;\n }", "protected function _set_parameter($key, $value)\n {\n clearos_profile(__METHOD__, __LINE__);\n\n $file = new File(self::FILE_CONFIG);\n\n if (! $file->exists())\n $file->create('root', 'root', '0644');\n\n $match = $file->replace_lines(\"/^$key\\s*=\\s*/\", \"$key = $value\\n\");\n\n if (!$match)\n $file->add_lines(\"$key = $value\\n\");\n\n $this->is_loaded = FALSE;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the composer command for the environment.
protected function _findComposer() { if (file_exists(getcwd() . '/composer.phar')) { return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; } return 'composer'; }
[ "public static function getCraftCommand(): string\n {\n if (is_string(getenv('CRAFT_COMMAND'))) {\n return getenv('CRAFT_COMMAND');\n }\n\n $projectRoot = realpath(dirname(Factory::getComposerFile()));\n $craftCommand = $projectRoot . DIRECTORY_SEPARATOR . 'craft';\n\n if (!file_exists($craftCommand)) {\n throw new \\LogicException(\"Missing 'craft' executable in '$projectRoot'\");\n }\n\n $finder = new PhpExecutableFinder();\n $php = $finder->find();\n\n return \"$php $craftCommand\";\n }", "protected function findComposer() {\n if ($this->files->exists($this->workingPath . '/composer.phar')) {\n return 'php ' . $this->workingPath . '/composer.phar';\n }\n\n return 'composer';\n }", "public function findComposer()\n {\n if (file_exists($this->getCurrentWorkingDirectory() . '/composer.phar')) {\n return '\"' . PHP_BINARY . '\" composer.phar';\n }\n\n return 'composer';\n }", "protected function findComposer()\n {\n if (file_exists(getcwd() . '/composer.phar')) {\n return '\"' . PHP_BINARY . '\" ' . getcwd() . '/composer.phar';\n }\n\n return 'composer';\n }", "protected function findComposer()\n {\n if (file_exists(getcwd().'/composer.phar')) {\n return '\"'.PHP_BINARY.'\" '.getcwd().'/composer.phar';\n }\n\n return 'composer';\n }", "public static function composer($cmd)\n\t{\n\t\t// Tell the script where composer is and if \n\t\tif(self::where(\"composer\"))\n\t\t\t$composer = \"composer \";\n\t\telse if(app::config(\"composer.path\") !== \"\" || app::config(\"composer.path\") !== null)\n\t\t\t$composer = app::config(\"composer.path\").\" \";\n\t\telse self::write(\"composer could not be found! \\nInstall it, or specify the path to the \\ncomposer.phar file in the environment.json file.\", \"light_red\");\n\t\t\n\t\treturn self::command($composer.$cmd);\n\t}", "public function getVersionComposer(): string\n {\n return $this->executeComposerCommand(sprintf('%s -V', self::APP_COMPOSER));\n }", "public function getCommand()\n {\n return $this->command;\n }", "public function getComposer()\n {\n /** @var WebApplication|ConsoleApplication $this */\n return $this->get('composer');\n }", "protected function command(): string\n {\n // Command we want to execute inside container\n $command = $this->argument('execute');\n // Collection of acceptable commands\n $options = [\n static::CMD_INSTALL => 'install',\n static::CMD_BUILD => 'run dev',\n static::CMD_WATCH => 'run watch',\n ];\n // Check if command option value or fallback to build\n if (!array_key_exists($command, $options)) {\n $command = $options[static::CMD_BUILD];\n }\n\n return (string) $command;\n }", "public function getCommand(): string\n {\n return $this->attributes->get('command', '');\n }", "public function getGitExecutable()\n {\n return $this->getConfiguration('git', 'git');\n }", "protected function buildCommand()\n {\n return $this->command;\n }", "public function getComposer()\n {\n if (! $this->composer) {\n $this->composer = json_decode($this->fsio->get('composer.json'));\n }\n return $this->composer;\n }", "public function getCmd()\n {\n return $this->taskSpec->getCommand();\n }", "private function get_composer_json_path() {\n\t\tstatic $composer_path;\n\n\t\tif ( null === $composer_path || getenv( 'WP_CLI_TEST_PACKAGE_GET_COMPOSER_JSON_PATH' ) ) {\n\n\t\t\tif ( getenv( 'WP_CLI_PACKAGES_DIR' ) ) {\n\t\t\t\t$composer_path = Utils\\trailingslashit( getenv( 'WP_CLI_PACKAGES_DIR' ) ) . 'composer.json';\n\t\t\t} else {\n\t\t\t\t$composer_path = Utils\\trailingslashit( Utils\\get_home_dir() ) . '.wp-cli/packages/composer.json';\n\t\t\t}\n\n\t\t\t// `composer.json` and its directory might need to be created\n\t\t\tif ( ! file_exists( $composer_path ) ) {\n\t\t\t\t$composer_path = $this->create_default_composer_json( $composer_path );\n\t\t\t} else {\n\t\t\t\t$composer_path = realpath( $composer_path );\n\t\t\t\tif ( false === $composer_path ) {\n\t\t\t\t\t$error = error_get_last();\n\t\t\t\t\tWP_CLI::error( sprintf( \"Composer path '%s' for packages/composer.json not found: %s\", $composer_path, $error['message'] ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $composer_path;\n\t}", "public function getCommand()\n {\n return $this->cmd;\n }", "public function getComposer()\n {\n return $this->composer;\n }", "public function getComposer() {\n return $this->composer;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operation pATCHExternalPromotionsExternalPromotionIdAsyncWithHttpInfo Update an external promotion
public function pATCHExternalPromotionsExternalPromotionIdAsyncWithHttpInfo($external_promotion_id, $external_promotion_update) { $returnType = ''; $request = $this->pATCHExternalPromotionsExternalPromotionIdRequest($external_promotion_id, $external_promotion_update); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri() ), $statusCode, $response->getHeaders(), (string) $response->getBody() ); } ); }
[ "public function pATCHExternalPromotionsExternalPromotionIdWithHttpInfo($external_promotion_id, $external_promotion_update)\n {\n $request = $this->pATCHExternalPromotionsExternalPromotionIdRequest($external_promotion_id, $external_promotion_update);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n throw $e;\n }\n }", "public function pATCHExternalPromotionsExternalPromotionIdAsync($external_promotion_id, $external_promotion_update)\n {\n return $this->pATCHExternalPromotionsExternalPromotionIdAsyncWithHttpInfo($external_promotion_id, $external_promotion_update)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }", "public function gETExternalPromotionsExternalPromotionIdWithHttpInfo($external_promotion_id)\n {\n $request = $this->gETExternalPromotionsExternalPromotionIdRequest($external_promotion_id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n switch($statusCode) {\n case 200:\n if ('\\OpenAPI\\Client\\Model\\ExternalPromotion' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\ExternalPromotion', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\OpenAPI\\Client\\Model\\ExternalPromotion';\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\ExternalPromotion',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function gETExternalPromotionsExternalPromotionIdAsyncWithHttpInfo($external_promotion_id)\n {\n $returnType = '\\OpenAPI\\Client\\Model\\ExternalPromotion';\n $request = $this->gETExternalPromotionsExternalPromotionIdRequest($external_promotion_id);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n );\n }", "public function gETExternalPromotionsWithHttpInfo()\n {\n $request = $this->gETExternalPromotionsRequest();\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n throw $e;\n }\n }", "public function pOSTExternalPromotionsWithHttpInfo($external_promotion_create)\n {\n $request = $this->pOSTExternalPromotionsRequest($external_promotion_create);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n throw $e;\n }\n }", "public function pOSTExternalPromotionsAsyncWithHttpInfo($external_promotion_create)\n {\n $returnType = '';\n $request = $this->pOSTExternalPromotionsRequest($external_promotion_create);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n );\n }", "public function gETExternalPromotionsAsyncWithHttpInfo()\n {\n $returnType = '';\n $request = $this->gETExternalPromotionsRequest();\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n return [null, $response->getStatusCode(), $response->getHeaders()];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n );\n }", "public function gETExternalPromotionIdMarketWithHttpInfo($external_promotion_id)\n {\n $request = $this->gETExternalPromotionIdMarketRequest($external_promotion_id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n throw $e;\n }\n }", "public function gETExternalPromotionIdCouponCodesPromotionRuleRequest($external_promotion_id)\n {\n // verify the required parameter 'external_promotion_id' is set\n if ($external_promotion_id === null || (is_array($external_promotion_id) && count($external_promotion_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $external_promotion_id when calling gETExternalPromotionIdCouponCodesPromotionRule'\n );\n }\n\n $resourcePath = '/external_promotions/{externalPromotionId}/coupon_codes_promotion_rule';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($external_promotion_id !== null) {\n $resourcePath = str_replace(\n '{' . 'externalPromotionId' . '}',\n ObjectSerializer::toPathValue($external_promotion_id),\n $resourcePath\n );\n }\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n []\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n [],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function gETExternalPromotions()\n {\n $this->gETExternalPromotionsWithHttpInfo();\n }", "public function update(string $promotion_id, ItemPromotionModel $Model): BaseResponse\n {\n return $this->client->request('updateItemPromotion', 'PUT', \"item_promotion/{$promotion_id}\",\n [\n 'json' => $Model->getArrayCopy(),\n ]\n );\n }", "public function pOSTExternalPromotions($external_promotion_create)\n {\n $this->pOSTExternalPromotionsWithHttpInfo($external_promotion_create);\n }", "public function editDocumentDocxSetCustomMetadataPropertiesAsyncWithHttpInfo($input)\n {\n $returnType = 'string';\n $request = $this->editDocumentDocxSetCustomMetadataPropertiesRequest($input);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function contactIdExternalmapPutWithHttpInfo($body, $id)\n {\n $returnType = '\\Swagger\\Client\\Model\\InlineResponse20027';\n $request = $this->contactIdExternalmapPutRequest($body, $id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if (!in_array($returnType, ['string','integer','bool'])) {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\InlineResponse20027',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function gETExternalPromotionIdAttachmentsRequest($external_promotion_id)\n {\n // verify the required parameter 'external_promotion_id' is set\n if ($external_promotion_id === null || (is_array($external_promotion_id) && count($external_promotion_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $external_promotion_id when calling gETExternalPromotionIdAttachments'\n );\n }\n\n $resourcePath = '/external_promotions/{externalPromotionId}/attachments';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($external_promotion_id !== null) {\n $resourcePath = str_replace(\n '{' . 'externalPromotionId' . '}',\n ObjectSerializer::toPathValue($external_promotion_id),\n $resourcePath\n );\n }\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n []\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n [],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function updateByID(Request $request, $promotion_id)\n {\n //dd($request->all());\n return $this->promotionsRepo->updatePromotionByID($request, $promotion_id);\n }", "public function gETExternalPromotionIdSkuListPromotionRuleRequest($external_promotion_id)\n {\n // verify the required parameter 'external_promotion_id' is set\n if ($external_promotion_id === null || (is_array($external_promotion_id) && count($external_promotion_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $external_promotion_id when calling gETExternalPromotionIdSkuListPromotionRule'\n );\n }\n\n $resourcePath = '/external_promotions/{externalPromotionId}/sku_list_promotion_rule';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($external_promotion_id !== null) {\n $resourcePath = str_replace(\n '{' . 'externalPromotionId' . '}',\n ObjectSerializer::toPathValue($external_promotion_id),\n $resourcePath\n );\n }\n\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n []\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n [],\n []\n );\n }\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function externalUpsertObject($external_field_name, $external_id, $type, $data)\n {\n $result = $this->sobject()->externalUpsert($external_field_name, $external_id, $type, $data);\n\n $array_result = $result->toArray();\n\n $array_result['Id'] = $result->id;\n\n if ($result->error->isValid()) {\n $array_result['message_string'] = $result->error->message;\n }\n\n return $array_result;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Relationships Assitences (One to Many)
public function assitences(){ return $this->hasMany('App\Models\Assistence','training_id'); }
[ "public function relationships();", "public function hasManyAssociations(){}", "public function setupAssociations() \n {\n \n }", "public function justifiedAbsences(){\n return $this->hasMany(Absence::class,'tutor');\n }", "public function absences()\n {\n return $this->hasMany(Absence::class);\n }", "public function relations();", "public function absences()\n {\n return $this->hasMany('App\\Absence', 'advisor_id');\n }", "abstract protected function Relations();", "public function athlets()\n {\n return $this->hasMany('App\\SportEventAthlete','A_id');\n }", "public function getRelationship();", "public function initializeRelations();", "public function getRelationships();", "public function withAllRelationships(): static;", "public function aviones(){\n\t\t//La relacion sería 1 fabricante hace muchos aviones\n\t\treturn $this->hasMany('App\\Avion');\n\t}", "public function setupAssociations()\n {\n\n $this->hasMany('foos', array(\n 'default_strategy' => 'Immediate',\n ));\n $this->hasMany('deleted_foos', array(\n 'default_strategy' => 'Immediate',\n 'table' => 'foos',\n 'class' => 'Foo',\n 'conditions' => 'deleted_foos.is_deleted = 1'\n ));\n $this->hasOne('bar');\n }", "public function entrants(): HasMany\n {\n return $this->hasMany(Entrant::class, 'promotion_id', 'id');\n }", "public function cardface_person_atag(){\n\t\treturn $this->hasMany('App\\cardface_person_atag','cardface_id','id');\n\t}", "public function aspectosAmbientales()\n {\n return $this->hasMany('App\\Models\\AspectosAmbientale','cia_id','id');\n }", "public function conceptRelationships(){\n return $this->hasMany(ConceptRelationship::class);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete editing decisions by submission ID.
function deleteDecisionsBySubmissionId($submissionId) { return $this->update( 'DELETE FROM edit_decisions WHERE submission_id = ?', (int) $submissionId ); }
[ "public function deleteSubmission($id)\n {\n \n \t$this->db->where('submissions_id', $id);\n \t$this->db->delete('submissions'); \n \n }", "public function delete()\n {\n $this->submissions()->each->delete();\n\n FormModel::where('handle', $this->handle())->delete();\n\n FormDeleted::dispatch($this);\n }", "public function delete() {\n EntryDao::deleteEntry( $this->issue );\n\n if ( is_null( $this->issue->rebutted_at ) ) {\n $chunk_review_model = new ChunkReviewModel( $this->chunk_review );\n $chunk_review_model->subtractPenaltyPoints( $this->issue->penalty_points, $this->project );\n }\n }", "private function DeleteSubmission() {\n $delete_submission = filter_input(INPUT_POST, 'delete_submission', FILTER_DEFAULT);\n\n if (!empty($delete_submission)) {\n dbquery(\"DELETE FROM \".DB_SUBMISSIONS.\" WHERE submit_id = :submitid AND submit_type = :submittype\", [':submitid' => (int)$delete_submission, ':submittype' => 'l']);\n addNotice('success', $this->locale['WLS_0061']);\n redirect(clean_request('', ['submit_id'], FALSE));\n }\n }", "private function process_action_delete_choice() {\n if (has_capability('mod/ratingallocate:modify_choices', $this->context)) {\n global $DB;\n $choiceid = optional_param('choiceid', 0, PARAM_INT);\n\n if ($choiceid) {\n $choice = $DB->get_record(this_db\\ratingallocate_choices::TABLE, array('id' => $choiceid));\n if ($choice) {\n // Delete related group associations, if any.\n $DB->delete_records(this_db\\ratingallocate_group_choices::TABLE, ['choiceid' => $choiceid]);\n $DB->delete_records(this_db\\ratingallocate_ch_gengroups::TABLE, ['choiceid' => $choiceid]);\n $DB->delete_records(this_db\\ratingallocate_choices::TABLE, array('id' => $choiceid));\n\n redirect(new moodle_url('/mod/ratingallocate/view.php',\n array('id' => $this->coursemodule->id, 'action' => ACTION_SHOW_CHOICES)),\n get_string('choice_deleted_notification', RATINGALLOCATE_MOD_NAME,\n $choice->{this_db\\ratingallocate_choices::TITLE}),\n null,\n \\core\\output\\notification::NOTIFY_SUCCESS);\n } else {\n redirect(new moodle_url('/mod/ratingallocate/view.php',\n array('id' => $this->coursemodule->id, 'action' => ACTION_SHOW_CHOICES)),\n get_string('choice_deleted_notification_error', RATINGALLOCATE_MOD_NAME),\n null,\n \\core\\output\\notification::NOTIFY_ERROR);\n }\n }\n redirect(new moodle_url('/mod/ratingallocate/view.php',\n array('id' => $this->coursemodule->id, 'action' => ACTION_SHOW_CHOICES)));\n }\n }", "public function actionDelete($id) {\n if (User::userIsAllowedTo('Remove interview guide template question')) {\n $model = $this->findModel($id);\n $name = $model->question;\n if ($model->delete()) {\n $audit = new AuditTrail();\n $audit->user = Yii::$app->user->id;\n $audit->action = \"Removed interview guide question: '$name' from the system.\";\n $audit->ip_address = Yii::$app->request->getUserIP();\n $audit->user_agent = Yii::$app->request->getUserAgent();\n $audit->save();\n Yii::$app->session->setFlash('success', \"Interview guide question was successfully removed.\");\n } else {\n Yii::$app->session->setFlash('error', \"Interview guide question could not be removed. Please try again!\");\n }\n\n return $this->redirect(['index']);\n } else {\n Yii::$app->session->setFlash('error', 'You are not authorised to perform that action.');\n return $this->redirect(['home/home']);\n }\n }", "function poasassignment_delete_instance($id) {\n // global $DB;\n $poasassignmentmodelinstance = poasassignment_model::get_instance($poasassignment);\n return $poasassignmentmodelinstance->delete_instance($id);\n}", "public function deletesubmission() {\n\t\t$SQL_ID = (isset($_REQUEST['id'])) ? Convert::raw2sql($_REQUEST['id']) : false;\n\t\tif($SQL_ID) {\n\t\t\t$submission = DataObject::get_by_id(\"SubmittedForm\", $SQL_ID);\n\t\t\tif($submission) {\n\t\t\t\t$submission->delete();\n\t\t\t\t\n\t\t\t\treturn (Director::is_ajax()) ? true : Director::redirectBack();\n\t\t\t}\n\t\t}\n\t\treturn (Director::is_ajax()) ? false : Director::redirectBack();\n\t}", "public function planner_delete_post_by_id() {\n \n // Save a post\n (new MidrubBaseUserAppsCollectionPlannerHelpers\\Posts)->planner_delete_post_by_id();\n \n }", "public function deleteAction()\n {\n /* Check if user is signed in and redirect to sign in if is not */\n $this->requireSignin();\n\n /* Getting current user's data */\n $user = Auth::getUser();\n\n /* Redirect link after deleting. By default index page */\n $returnUrl = (isset($_POST['return'])) ? '/'.$_POST['return'] : '/';\n\n /* Getting Question by id */\n $answer = Answer::getById(intval($_POST['id']));\n\n /* If Answer exists and is active */\n if ($answer) {\n\n /* Checking if signed in user is answer's author */\n if ($answer->user_id == $user->id) {\n\n /* Check if question deleted */\n if (Answer::delete($answer->id)) {\n\n Flash::addMessage(\"Answer deleted!\", Flash::INFO);\n \n } else {\n\n Flash::addMessage(\"You can not delete this answer!\", Flash::INFO);\n }\n\n } else {\n\n Flash::addMessage(\"You can not delete this answer!\", Flash::INFO);\n }\n\n } else {\n\n Flash::addMessage(\"You can not delete this answer!\", Flash::INFO);\n }\n\n /* Redirect back */\n $this->redirect($returnUrl);\n }", "public function delete_challenge($challenge_id);", "protected function deletedByModerator($event)\n {\n $this->putSubmissionInTheCache($event->submission);\n\n // remove all the reports related to this model\n Report::where([\n 'reportable_id' => $event->submission->id,\n 'reportable_type' => 'App\\Submission',\n ])->delete();\n }", "function webform_submission_delete_form($form_state, $node, $submission) {\r\n drupal_set_title(t('Delete Form Submission'));\r\n\r\n $form = array();\r\n $form['node'] = array('#type' => 'value', '#value' => $node);\r\n $form['submission'] = array('#type' => 'value', '#value' => $submission);\r\n $question = t('Are you sure you want to delete this submission?');\r\n\r\n if (isset($_GET['destination'])) {\r\n $destination = $_GET['destination'];\r\n }\r\n elseif (user_access('access webform results')) {\r\n $destination = 'node/'. $node->nid .'/webform-results';\r\n }\r\n else {\r\n $destination = 'node/'. $node->nid .'/submissions';\r\n }\r\n\r\n return confirm_form($form, $question, $destination, NULL, t('Delete'), t('Cancel'));\r\n}", "function action_delete_task()\n {\n $id = $_POST['task_id'];\n $task = new ProjectTask();\n $task->retrieve($id);\n $task->deleted = '1';\n $task->save();\n }", "public function delete() {\n\t\t$this->predictionsTable->delete($_POST['predictionId']);\n\t\t\n\t\t// redirects the browser to the list page\n\t\theader('location: /prediction/list');\n\t\t\n\t\t// End this program flow to prevent PHP warning in error log\n\t\tdie();\n\t}", "function deletedSubmission_method($bean, $event, $arguments) {\n global $db;\n\n $acceptable_modules = array('Accounts', 'Contacts', 'Leads', 'Prospects'); // acceptable module who contains survey submission record\n if (in_array($bean->module_name, $acceptable_modules)) {\n $GLOBALS['log']->debug(\"This is the deleted record : \" . print_r($bean->id, 1));\n foreach ($bean->field_defs as $field) {\n\n // If related module survey submission exists then remove related submission\n if ($field['module'] == 'bc_survey_submission') {\n\n $relationship_name = $field['relationship']; // relation ship name for submission\n $GLOBALS['log']->debug(\"This is the rel name : \" . print_r($relationship_name, 1));\n $submission_obj = $bean->get_linked_beans($relationship_name, 'bc_survey_submission');\n\n\n foreach ($submission_obj as $submission) {\n $survey = $submission->get_linked_beans('bc_survey_submission_bc_survey', 'bc_survey');\n $survey_id = $survey[0]->id;\n $GLOBALS['log']->debug(\"This is the submission id :--- \" . print_r($submission->id, 1));\n\n // Retrieve related submited data\n $submission_data_obj = $submission->get_linked_beans('bc_submission_data_bc_survey_submission', 'bc_submission_data');\n\n foreach ($submission_data_obj as $submited_data) {\n\n $GLOBALS['log']->debug(\"This is the submitted data :------- \" . print_r($submited_data->id, 1));\n // delete submited data\n $submited_data->deleted = 1;\n $submited_data->save();\n // deleted submission and submited data relationship\n $submission->bc_submission_data_bc_survey_submission->delete($submission->id, $submited_data->id);\n\n\n foreach ($submited_data->bc_submission_data_bc_survey_answers->getBeans() as $submited_ans) {\n\n $GLOBALS['log']->debug(\"This is the submitted answer :------- \" . print_r($submited_ans->id, 1));\n\n // deleted submission and answer relationship\n $submited_data->bc_submission_data_bc_survey_answers->delete($submited_data->id, $submited_ans->id);\n }\n\n foreach ($submited_data->bc_submission_data_bc_survey_questions->getBeans() as $submited_que) {\n\n $GLOBALS['log']->debug(\"This is the submitted question :------- \" . print_r($submited_que->id, 1));\n\n // deleted submission and question relationship\n $submited_data->bc_submission_data_bc_survey_questions->delete($submited_data->id, $submited_que->id);\n }\n }\n\n\n $oSurveys = $submission->get_linked_beans('bc_survey_submission_bc_survey', 'bc_survey');\n\n foreach ($oSurveys as $oSurvey) {\n $survey_id = $oSurvey->id;\n // Set Send Status as \"Unpublished\" if no any other submission found for current survey\n $oSubmissions = $oSurvey->get_linked_beans('bc_survey_submission_bc_survey', 'bc_survey_submission', array(), 0, 1, 0, \" bc_survey_submission.id!='{$submission->id}' \");\n if (count($oSubmissions) == 0) {\n $oSurvey->survey_send_status = 'inactive';\n $oSurvey->save();\n }\n }\n $rm_old_qry = \"delete from bc_survey_submit_answer_calculation WHERE \n submission_id = '{$submission->id}' \n \";\n $db->query($rm_old_qry);\n\n // Remove submissions entry from history table\n $rm_history_qry = \"delete from bc_submission_history_individual WHERE \n submission_id = '{$submission->id}' \n \";\n\n $db->query($rm_history_qry);\n\n\n $submission->load_relationship('bc_survey_submit_question_bc_survey_submission');\n foreach ($submission->bc_survey_submit_question_bc_survey_submission->getBeans() as $submited_que) {\n\n $GLOBALS['log']->debug(\"This is the submitted question :------- \" . print_r($submited_que->id, 1));\n\n // deleted submission and question relationship\n $submission->bc_survey_submit_question_bc_survey_submission->delete($submission->id, $submited_que->id);\n }\n \n // Delete Report supported module entries\n $submitted_Ques = $submission->get_linked_beans('bc_survey_submit_question_bc_survey_submission', 'bc_survey_submit_question');\n foreach ($submitted_Ques as $submitted_que) {\n $submitted_que->deleted = 1;\n $submitted_que->save();\n }\n\n $submission->deleted = 1; // delete submission\n $submission->save();\n }\n }\n }\n }\n }", "public function deleteAction(Request $request,$id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('IfeAloesBundle:GeneralObjective')->find($id); \t\n \t \n foreach($entity->getSpecificObjectives() as $specObj) {\n \t$em->remove($specObj); \n } \n \n $em->remove($entity);\n $em->flush();\n return $this->redirect($this->generateUrl('course_objective', array(\n 'id'=>$entity->getCourse()->getId()\n )));\n }", "function deleteCollaborator(){\n\t\t\t\n\t\t\t//gets from form and assigns to the private variables\n\t\t\t$id = $_POST[\"id\"];\n\t\t\t\n\t\t\t//calls the admin model and the collaboratorDelete method in that model and passes the ID to the method\n\t\t\t$this->Admin_model->collaboratorDelete($id);\t\t\t \n\t\t\t\n\t\t\t//redirects to the view\n\t\t\t$this->load->view('admin/collaborators');\n\t\t}", "public function delete($id){\n $this->datas['del_id'] = $id;\n if(isset($_POST['save_delete'])){\n $statement = 'DELETE FROM reservations WHERE id='.$id;\n $this->datas['database']->deleteEntry($statement);\n $this->loadView($this->datas, 'home');\n }\n elseif (isset($_POST['cancel_delete'])) {\n $this->loadView($this->datas, 'home');\n }\n else{\n $this->loadView($this->datas, 'delete');\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the list of active status robots owned by this player object
public function get_robots_active($sort = true){ $filters = array('player_id' => $this->player_id, 'robot_status' => 'active'); $player_robots = rpg_game::find_robots($filters); if ($sort){ usort($player_robots, function($a, $b){ if ($a->robot_position == 'active'){ return -1; } elseif ($b->robot_position == 'active'){ return 1; } elseif ($a->robot_key < $b->robot_key){ return -1; } elseif ($a->robot_key > $b->robot_key){ return 1; } else { return 0; } }); } return $player_robots; }
[ "public static function getActiveStatuses() : array\n {\n $statuses =[];\n $statuses[] = self::getById(self::STATUS_ACTIVE);\n $statuses[] = self::getById(self::STATUS_TESTING);\n return $statuses;\n }", "private function getAllStatus()\n {\n return $status = tb_csc_acordo_status::all();\n }", "public function getAvailableStatuses()\n {\n $statuses = new Varien_Object(array(\n self::STATUS_ENABLED => Mage::helper('profile')->__('Enabled'),\n self::STATUS_DISABLED => Mage::helper('profile')->__('Disabled'),\n ));\n\n Mage::dispatchEvent('profile_get_available_statuses', array('statuses' => $statuses));\n\n return $statuses->getData();\n }", "public static function getStatuses(): array;", "public function getStatuses(): array\n {\n return $this->statuses;\n }", "public function listar() {\n\t\t$conexao = new conexao();\n\t\t\n\t\t$sql = \"select * from ouv_status\";\n\t\t$resultado = $conexao -> query($sql);\n\t\t\n\t\treturn $resultado;\n\t}", "public static function getUserStatusesList() {\n self::getUserStatusConstants();\n return self::$userStatusConstants;\n }", "public function getAvailableStatuses()\n {\n $statuses = new Varien_Object(array(\n self::STATUS_ENABLED => Mage::helper('mybrand')->__('Enabled'),\n self::STATUS_DISABLED => Mage::helper('mybrand')->__('Disabled'),\n ));\n\n Mage::dispatchEvent('mybrand_manufacturer_get_available_statuses', array('statuses' => $statuses));\n\n return $statuses->getData();\n }", "public function getAllStatus()\n\t{\n\t\treturn $this->status;\n\t}", "public function getAvailableStatuses()\n {\n $statuses = new Varien_Object(array(\n self::STATUS_ENABLED => Mage::helper('cms')->__('Enabled'),\n self::STATUS_DISABLED => Mage::helper('cms')->__('Disabled'),\n ));\n\n Mage::dispatchEvent('cms_page_get_available_statuses', array('statuses' => $statuses));\n\n return $statuses->getData();\n }", "public function getStatusList()\n {\n return $this->model->getStatusList();\n }", "protected function get_status()\n\t{\n\t\t$params = $this->params;\n\t\tunset($params['status']);\n\n\t\t$is_ajax = $this->request->is_ajax();\n\t\t$url = $this->get_item_url($params);\n\n\t\t$status_list = array();\n\t\t$status_list[] = array(\n\t\t\t'NAME'\t\t=> $this->user->lang('STATUS_ALL'),\n\t\t\t'URL'\t\t=> ($is_ajax) ? str_replace('&amp;', '&', $url) : $url,\n\t\t\t'ACTIVE'\t=> empty($this->status),\n\t\t\t'ID'\t\t=> 'all',\n\t\t);\n\n\t\t// Set up how the URL will look\n\t\t$status_types = array(\n\t\t\t$this->user->lang('STATUS_APPROVED') => 'approved',\n\t\t\t$this->user->lang('STATUS_UNAPPROVED') => 'unapproved',\n\t\t);\n\n\t\tforeach ($status_types as $status_type => $status_type_url)\n\t\t{\n\t\t\t$params['status'] = $status_type_url;\n\t\t\t$url = $this->get_item_url($params);\n\n\t\t\t// Set to active if it's the one currently selected\n\t\t\t$status_list[] = array(\n\t\t\t\t'NAME'\t\t=> $status_type,\n\t\t\t\t'URL'\t\t=> ($is_ajax) ? str_replace('&amp;', '&', $url) : $url,\n\t\t\t\t'ACTIVE'\t=> $this->status == $status_type_url,\n\t\t\t\t'ID'\t\t=> $status_type_url,\n\t\t\t);\n\t\t}\n\n\t\treturn $status_list;\n\t}", "public static function active_all()\n {\n \treturn Pets::whereStatus('Active')->get();\n }", "public function all_active_status_types()\n {\n return array_filter(\n array_keys($this->_status),\n function($status_type) {\n return $this->_status[$status_type] >= STATUS_LEVEL_ACTIVE;\n }\n );\n }", "public function getStatuses(){\n if($this->mastodon_user_id > 0){\n \n //Create our object\n $http = HttpRequest::Instance($this->getApiURL());\n $statusses = $http::Get(\n \"api/v1/accounts/{$this->mastodon_user_id}/statuses\",\n null,\n $this->getHeaders()\n );\n if(is_array($statusses) && count($statusses) > 0){\n return $statusses;\n }\n \n }\n return false;\n }", "public function get_statuses()\n\t{\n\t\treturn $this->_config->statuses;\n\t}", "private function robots(){\n\t\treturn array(\n\t\t\t0=>\t'Googlebot', 'Googlebot-Image', 'MSNBot', 'Yahoo! Slurp', 'Yahoo', 'AskJeeves','FastCrawler','InfoSeek Robot 1.0', 'Lycos',\n\t\t\t\t'YandexBot','YahooSeeker'\n\t\t\t);\n\t}", "public static function getStatuses()\n {\n $sql = 'SELECT * FROM reservation_status';\n $command = Yii::app()->db->createCommand($sql);\n return $command->queryAll(true);\n }", "public function get_robots()\n\t{\n\t\treturn explode(', ', $this->CI->lib_cache->robots_actifs());\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a value that indicates whether this principal has a role specified by $rolename.
public function isInRole( $rolename ) { }
[ "public function hasRole($name);", "public function roleExists($roleName);", "function get_role_by_name($rolename)\t{\n return $this->dbc->get_record(\"role\",array('name'=>$rolename));\n }", "function getUserRole() {\n if ($this->getLoggedUser())\n {\n $result = $this->database->query(\"\n SELECT role_name\n FROM `user`\n WHERE `username` = '\".$this->getLoggedUser().\"';\n \");\n $result->fetchInto($result);\n return $result->role_name;\n }\n else\n {\n return false;\n }\n }", "public function hasRole();", "public function hasRole(): bool\n {\n return isset($this->role);\n }", "public function hasRole(string $role) : bool;", "public function hasRole($role);", "public function hasRole(Role $role): bool;", "public function userHasRole()\n {\n if(isset($_SESSION[\"role\"])){\n return true;\n }\n else{\n return false;\n }\n }", "public function hasRoleTo($role): bool;", "public function roleExists($role);", "private static function _get_role()\n {\n static $role = NULL;\n if (NULL !== $role)\n return ($role);\n\n if (!is_user_logged_in())\n return ($role = FALSE);\n\n $user = PeepSoUser::get_instance(get_current_user_id());\n return ($role = $user->get_user_role());\n }", "function cs_current_user_has_role( $role ) {\n\treturn cs_user_has_role( wp_get_current_user(), $role );\n}", "public function getRole($roleName);", "public function isExistingRole( $roleName);", "public function getRole($name)\n {\n if (empty($this->_roles[$name])) {\n return false;\n }\n return $this->_roles[$name];\n }", "public function roleUserExists()\n {\n $result = $this->_getResource()->roleUserExists($this);\n return ( is_array($result) && count($result) > 0 ) ? true : false;\n }", "public function hasRoles()\n {\n return $this->roles()->count() ? true : false;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Power up Blogolytics instance.
function Blogolytics() { return Blogolytics::instance(); }
[ "protected function configure()\n {\n try {\n $this\n ->setName('offensive-words')\n ->setDescription('Manages offensive words')\n ;\n } catch (\\Exception $e) {\n echo $e->getMessage();\n }\n }", "protected function bootPublishing()\n {\n if ($this->app->runningInConsole()) {\n $this->bootPublishingConfig();\n\n $this->bootPublishingController();\n\n $this->bootPublishingMigrations();\n }\n }", "private function setupWordpress() {\n\n\n\t\t// Set actions\n\t\tregister_deactivation_hook(__FILE__, array( $this, 'deactivatePlugin' ) );\n\t\tadd_action( 'init', array( $this, 'createPostType' ) );\n\t\tadd_action( 'socialStreamerCron', array( $this, 'iterator' ) );\n\t\tadd_action('admin_menu', array( $this, \"addAdminPageToMenu\" ) );\n\n\n\t\t// Add new cron schedule\n\t\tadd_filter( 'cron_schedules', 'add_schedule' );\n\t\tfunction add_schedule( $param ) {\n\t\t\treturn array( 'every_five_minutes' => array( \n\t\t\t\t'interval' => 300,\n\t\t\t\t'display' => __( 'Every 5 minutes' ) \n\t\t\t) );\n\t\t}\n\n\t\t// Add our cron entry\n\t\tif ( ! wp_next_scheduled('socialStreamerCron') ) {\n\t\t\twp_schedule_event( time(), 'every_five_minutes', 'socialStreamerCron' ); // hourly, daily and twicedaily\n\t\t}\n\n\n\t}", "function __construct() {\n\n self::marker( __LINE__, __METHOD__, __FILE__, 'Create AtomicStopwatch instance' );\n\n register_setting( 'general', 'my_ip_address', 'esc_attr' );\n\n add_action( 'admin_init', array( 'AtomicStopwatch', 'settings_fields' ) );\n\n self::set_ip_addresses();\n\n // Only initialize the plugin if the user's IP address matches the saved one.\n\n if ( self::can_run() ) {\n add_action( 'admin_enqueue_scripts', array( 'AtomicStopwatch', 'styles' ) );\n add_action( 'admin_bar_menu', array( 'AtomicStopwatch', 'admin_bar'), 900 );\n }\n\n add_action( 'init', array( 'AtomicStopwatch', 'start' ) );\n add_action( 'shutdown', array( 'AtomicStopwatch', 'stop' ) );\n\n }", "public function heatUp(): void\n {\n }", "private function editSupervisord()\n\t{\n\t\t// If this is a worker instance\n\t\tif($this->instanceType == \"boss\")\n\t\t{\n\t\t\t// Add instance specific daemon info\n\t\t\t$supervisord = \"[program:Boss]\\n\";\n\t\t\t$supervisord.= \"command=php /home/ec2-user/scraper/router.php boss\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/$this->instanceType.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/$this->instanceType-errors.log\\n\";\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=1\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\";\t\t\t\t\t\n\t\t\t\n\t\t\t// Add instance specific daemon info\n\t\t\t$supervisord.= \"[program:Cron]\\n\";\n\t\t\t$supervisord.= \"command=php /home/ec2-user/scraper/router.php cron\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/$this->instanceType.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/$this->instanceType-errors.log\\n\";\t\t\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=1\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\";\t\n\t\t\t\n\t\t\t// Run redis\n\t\t\t$supervisord.= \"[program:Redis]\\n\";\n\t\t\t$supervisord.= \"command=/home/ec2-user/redis/src/redis-server /home/ec2-user/scraper/config/redis.config.conf\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/redis.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/redis-errors.log\\n\";\t\t\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=1\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\";\t\t\t\t\t\t\t\n\t\t}\n\t\telseif($this->instanceType == \"redis\")\n\t\t{\n\t\t\t// Run redis\n\t\t\t$supervisord.= \"[program:Redis]\\n\";\n\t\t\t$supervisord.= \"command=/home/ec2-user/redis/src/redis-server /home/ec2-user/scraper/config/redis.config.conf\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/redis.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/redis-errors.log\\n\";\t\t\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=1\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\";\t\t\t\n\t\t}\n\t\t// If this instance is for bing\n\t\telseif($this->instanceType == \"bing\")\n\t\t{\n\t\t\t// Add workers for ranking updates\n\t\t\t$supervisord = \"[program:Bing]\\n\";\n\t\t\t$supervisord.= \"command=php /home/ec2-user/scraper/router.php worker bing %(process_num)s\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s-errors.log\\n\";\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=5\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\";\t\t\t\t\t\n\t\t}\n\t\t// All other instance types\n\t\telseif($this->instanceType == \"google\")\n\t\t{\t\n\t\t\t// Add workers for hourly google updates\n\t\t\t$supervisord = \"[program:GoogleHourly]\\n\";\n\t\t\t$supervisord.= \"command=php /home/ec2-user/scraper/router.php worker google %(process_num)s\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s-errors.log\\n\";\t\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t\n\t\t\t// If this is a high cpu instanct\n\t\t\tif($this->highCPU)\n\t\t\t{\n\t\t\t\t//$num = $this->checkProxies();\n\t\t\t\t$supervisord.= \"numprocs=10\\n\"; \t\t\t\t\n\t\t\t}\n\t\t\t// Normal micro instance\n\t\t\telse\n\t\t\t{\n\t\t\t\t$supervisord.= \"numprocs=5\\n\"; \n\t\t\t}\n\n\t\t\t$supervisord.= \"process_name=%(program_name)s_%(process_num)02d\\n\\n\"; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t}\t\t\t\t\n\t\t// If this instance is for bing\n\t\telseif($this->instanceType == \"domains\")\n\t\t{\n\t\t\t// Add workers for domain pagerank\n\t\t\t$supervisord = \"[program:prDaily]\\n\";\n\t\t\t$supervisord.= \"command=php /home/ec2-user/scraper/router.php worker pr %(process_num)s\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s-errors.log\\n\";\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=2\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\"; \t\n\t\t\t\n\t\t\t// Add workers for domain pagerank\n\t\t\t$supervisord.= \"[program:backlinksDaily]\\n\";\n\t\t\t$supervisord.= \"command=php /home/ec2-user/scraper/router.php worker backlinks %(process_num)s\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s-errors.log\\n\";\t\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=2\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\"; \t\n\t\t\t\n\t\t\t// Add workers for domain pagerank\n\t\t\t$supervisord.= \"[program:alexaDaily]\\n\";\n\t\t\t$supervisord.= \"command=php /home/ec2-user/scraper/router.php worker alexa %(process_num)s\\n\";\n\t\t\t$supervisord.= \"stdout_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s.log\\n\";\n\t\t\t$supervisord.= \"stdout_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"stderr_logfile=/home/ec2-user/scraper/logs/$this->instanceType.%(process_num)s-errors.log\\n\";\n\t\t\t$supervisord.= \"stderr_logfile_maxbytes=5MB\\n\";\t\t\t\t\t\t\n\t\t\t$supervisord.= \"autostart=true\\n\";\n\t\t\t$supervisord.= \"autorestart=true\\n\";\n\t\t\t$supervisord.= \"numprocs=2\\n\"; \n\t\t\t$supervisord.= \"process_name=%(process_num)s\\n\"; \t\t\t\t\n\t\t}\t\n\n\t\t// Write new supervisord config file\n\t\tfile_put_contents(\"core/supervisord.core.conf\", $supervisord);\n\n\t\t// Run supervisord daemon\n\t\texec(\"/usr/bin/supervisord &> /dev/null &\");\n\t}", "public function __construct() {\n\n\t\t$this->slug = 'hawaii-hotels';\n\t\t$this->labels = $this->customLabels();\n\t\t$this->capabilities = $this->defaultCapabilties();\n\t\t$this->args = $this->hotelArgs();\n\n\t\tadd_action( 'init', [ $this, 'register' ], 10, 0 );\n\t\tadd_action( 'init', [ $this, 'permastruct' ], 10, 0 );\n\t\tadd_action( 'init', [ $this, 'rewriteFilter' ], 10, 0 );\n\n\t\tadd_filter( 'post_type_link', [ $this, 'unslashPermalink' ], 10, 2 );\n\t\tadd_filter( 'redirect_canonical', [ $this, 'cancelCanonicalRedirect' ] );\n\n\t\tnew AdminColumns();\n\t\tnew HotelID();\n\t\tnew HotelData();\n\t\tnew HotelImages();\n\t\tnew HotelList();\n\t\tnew AttachedImage();\n\t\tnew Attached();\n\t\tnew Sideload();\n\t}", "public function console() {\n \n // Load Shortcut functions\n require APP_PATH . DS . 'Shortcodes.php';\n \n // Load KoolMinify\n require APP_PATH . DS . 'libs' . DS . 'KoolMinify' . DS . 'init.php';\n \n }", "public static function create_instances()\n {\n if (function_exists('set_time_limit')) {\n @set_time_limit(300);\n }\n $eventCalDelayed = get_option('ax_event_cal_delayed_creation');\n $workshopEnabled = get_option('ax_event_calendar_setting_w') === 'enabled';\n $programEnabled = get_option('ax_event_calendar_setting_p') === 'enabled';\n\n if (class_exists('Tribe__Events__API')) {\n if ($eventCalDelayed == 'enabled') {\n $taxonomy = TribeEvents::TAXONOMY;\n $anotherCycle = false;\n $instances = AX_Instances::getInstancesToCreate();\n /*check for empty array*/\n if (is_array($instances)) {\n $countInstances = count($instances);\n if ($countInstances < 20) {\n $limit = $countInstances;\n } else {\n $limit = 20;\n $anotherCycle = true;\n }\n $i = 0;\n if ($countInstances > 0) {\n foreach ($instances as $instance) {\n $i++;\n $instanceData = unserialize($instance->value);\n /*check to make sure that instance creation is enabled for the type.*/\n $type = explode('_', $instanceData['course_ref'])[1];\n if ($type === 'w' && !$workshopEnabled) {\n if (!empty($instanceData['complex_ref'])) {\n AX_Instances::clearInstance('ax_instance_' . $instanceData['complex_ref']);\n } else {\n AX_Instances::clearInstance('ax_instance_' . $instanceData['instance_ref']);\n }\n\n } elseif ($type === 'p' && !$programEnabled) {\n AX_Instances::clearInstance('ax_instance_' . $instanceData['instance_ref']);\n } else {\n /*create instance*/\n\n if (!empty($instanceData['update_existing'])) {\n if (!empty($instanceData['existing_id'])) {\n $newPostID = tribe_update_event($instanceData['existing_id'], $instanceData[\"event\"]);\n $test = array();\n wp_set_object_terms($newPostID, intval($instanceData[\"terms\"], 10), $taxonomy, true);\n $test['c'] = update_post_meta($newPostID, 'course_ref', $instanceData[\"course_ref\"]);\n $test['i'] = update_post_meta($newPostID, 'instance_ref', $instanceData[\"instance_ref\"]);\n if(key_exists('EncodedTime', $instanceData[\"event\"])){\n $test['e'] = update_post_meta($newPostID, 'encoded_time', $instanceData[\"event\"]['EncodedTime']);\n }\n \n $test['ax'] = update_post_meta($newPostID, 'ax_cost', $instanceData[\"event\"]['ax_cost']);\n if (!empty($instanceData[\"event\"]['ax_mapping_rule'])) {\n $test['mr'] = update_post_meta($newPostID, 'ax_mapping_rule', $instanceData[\"event\"]['ax_mapping_rule']);\n }\n if (!empty($instanceData['complex_ref'])) {\n $test['cid'] = update_post_meta($newPostID, 'complex_ref', $instanceData[\"complex_ref\"]);\n }\n //wp_mail(Axcelerate_Integration_Plugin::DEBUGEMAIL, 'Updating Event', json_encode($instanceData).\"||||}|}|}\".json_encode($test));\n }\n } else {\n $newPostID = tribe_create_event($instanceData[\"event\"]);\n wp_set_object_terms($newPostID, intval($instanceData[\"terms\"], 10), $taxonomy, true);\n add_post_meta($newPostID, 'course_ref', $instanceData[\"course_ref\"], true);\n add_post_meta($newPostID, 'instance_ref', $instanceData[\"instance_ref\"], true);\n if(key_exists('EncodedTime', $instanceData[\"event\"])){\n add_post_meta($newPostID, 'encoded_time', $instanceData[\"event\"]['EncodedTime'], true);\n }\n add_post_meta($newPostID, 'ax_cost', $instanceData[\"event\"]['ax_cost'], true);\n if (!empty($instanceData[\"event\"]['ax_mapping_rule'])) {\n add_post_meta($newPostID, 'ax_mapping_rule', $instanceData[\"event\"]['ax_mapping_rule'], true);\n }\n if (!empty($instanceData['complex_ref'])) {\n add_post_meta($newPostID, 'complex_ref', $instanceData[\"complex_ref\"], true);\n }\n //wp_mail(Axcelerate_Integration_Plugin::DEBUGEMAIL, 'Updating Event', json_encode($instanceData).\"||||}|}|}\".json_encode($test));\n }\n \n \n /*clear DB record*/\n if (!empty($instanceData['complex_ref'])) {\n AX_Instances::clearInstance('ax_instance_' . $instanceData['complex_ref']);\n } else {\n AX_Instances::clearInstance('ax_instance_' . $instanceData['instance_ref']);\n }\n /*make sure we haven't hit our limit on number of events created*/\n }\n if ($i == $limit) {\n break;\n }\n }\n }\n \n \n /*there were more than 20 instances to create, so add another create task*/\n if ($anotherCycle) {\n /*double check one hasn't already been scheduled by another task. The instance list is the same regardless*/\n if (!wp_next_scheduled('event_cal_create_instances')) {\n wp_schedule_single_event(time() + 1 * 60, 'event_cal_create_instances');\n }\n }\n }\n }\n }\n }", "public function attach_services() {\n\n\t\t// Attach your things, e.g.:\n\t\t// $this->example_service = new Example_Service();\n\n\t\t// Adds wp kickstart build for replacements to make this framework into your own plugin.\n\t\t$this->build_cli = new \\aubreypwd\\wpkickstart\\Build_CLI();\n\n\t\t// Adds wp kickstart release so we can distribute a zip file for use in installation.\n\t\t$this->release_cli = new \\aubreypwd\\wpkickstart\\Release_CLI();\n\t}", "public function run() {\n\t\t// include other classes\n\t\trequire_once plugin_dir_path ( __FILE__ ) . 'class-top-ratter-render.php';\n\t\trequire_once plugin_dir_path ( __FILE__ ) . 'class-top-ratter-sso.php';\n\t\t\n\t\t// enque styles for this plugin\n\t\tadd_action ( 'wp_enqueue_scripts', array (\n\t\t\t\t$this,\n\t\t\t\t'register_plugin_styles' \n\t\t) );\n\t\t// enque jquery scripts for this plugin\n\t\tadd_action ( 'wp_enqueue_scripts', array (\n\t\t\t\t$this,\n\t\t\t\t'register_plugin_script' \n\t\t) );\n\t\t// add submit action form to redirect and catch from admin.php\n\t\tadd_action ( 'admin_post_tr_action', array (\n\t\t\t\t$this,\n\t\t\t\t'prefix_admin_tr_action' \n\t\t) );\n\t\t\n\t\t// check if plugin tables exist\n\t\t$this->table_check ();\n\t\t\n\t\t// instantiate the render class for shortcodes to work\n\t\t$shortcodes = new Top_Ratter_Render ();\n\t}", "public function __construct() {\n register_activation_hook( __FILE__, array( $this, 'activate' ) );\n register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );\n\n // Localize our plugin\n add_action( 'init', array( $this, 'localization_setup' ) );\n add_action( 'init', array( $this, 'debug_run' ) );\n add_action('init', array($this, 'publish_post'));\n add_action( 'init', array( $this, 'register_post_type' ) );\n add_action('init',array($this, 'add_categories_to_cpt'));\n add_action( 'fbgr2wp_import', array( $this, 'do_import' ) );\n add_action( 'fbgr2wp_mailer', array( $this, 'send_mail' ) );\n add_filter( 'the_content', array( $this, 'the_content' ) );\n add_filter( 'pre_get_posts', array($this, 'my_get_posts') );\n if ( is_admin() ) {\n new WeDevs_FB_Group_To_WP_Admin();\n }\n }", "public function bootstrap();", "public function startup()\n {\n Nette\\Application\\UI\\Presenter::startup();\n }", "function setup_new_site() {\n\t$injector = Services::get_injector();\n\tif ( ! method_exists( $injector, 'make' ) ) {\n\t\treturn;\n\t}\n\n\t// Register web-story post type to setup rewrite rules.\n\t$story = $injector->make( Story_Post_Type::class );\n\t$story->register();\n\n\t// Flush rewrite rules after registering post type.\n\trewrite_flush();\n\n\t// Setup user capabilities.\n\t$capabilities = $injector->make( User\\Capabilities::class );\n\t$capabilities->add_caps_to_roles();\n\n\t// Not using Services::get(...) because the class is only registered on 'admin_init', which we might not be in here.\n\t$database_upgrader = $injector->make( Database_Upgrader::class );\n\t$database_upgrader->register();\n}", "public function initialise_blog_option_info() {}", "public function __construct() {\n register_activation_hook( __FILE__, array( $this, 'activate' ) );\n register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );\n\n // Localize our plugin\n add_action( 'init', array( $this, 'localization_setup' ) );\n add_action( 'init', array( $this, 'debug_run' ) );\n add_action( 'init', array( $this, 'register_post_type' ) );\n add_action( 'fbgr2wp_import', array( $this, 'do_import' ) );\n\n add_filter( 'the_content', array( $this, 'the_content' ) );\n\n if ( is_admin() ) {\n new WeDevs_FB_Group_To_WP_Admin();\n }\n }", "public static function setup() {\n\t\t// TODO: Own System Daemon\n\n\t\t// Make it possible to test in source directory\n\t\t//ini_set('include_path', ini_get('include_path').':..');\n\n\t\t// Include Class\n\t\terror_reporting(E_ALL);\n\t\timport(\"Daemon\");\n\n\t\t// Bare minimum setup\n\t\t$options = array(\n\t\t\t'appName' => 'greenmochi',\n\t\t\t'appDir' => BASE_PATH,\n\t\t\t'appDescription' => 'greenMochi!! Anime Downloader',\n\t\t\t'authorName' => 'Tonny Buse',\n\t\t\t'authorEmail' => 'tonnyb@casema.nl',\n\t\t\t'sysMaxExecutionTime' => '0',\n\t\t\t'sysMaxInputTime' => '0',\n\t\t\t'sysMemoryLimit' => '256M',\n\t\t\t'appRunAsGID' => 1001,\n\t\t\t'appRunAsUID' => 1001,\n\t\t\t'logLocation' => BASE_VAR . 'greenmochi.log',\n\t\t\t'appPidLocation' => BASE_VAR . '/greenmochi/greenmochi.pid',\n\t\t);\n\t\tSystem_Daemon::setOptions($options);\n\n\t\tSystem_Daemon::setSigHandler(SIGTERM, 'signalHandler');\n\t}", "public function run() {\n\t\t// handle settings page of this extension\n\t\tadd_action( 'w3tc_extension_page_example', array(\n\t\t\t\t$this,\n\t\t\t\t'w3tc_extension_page'\n\t\t\t) );\n\n\t\t// get control when configuration is changed by user\n\t\tadd_action( 'w3tc_config_ui_save', array(\n\t\t\t\t$this,\n\t\t\t\t'w3tc_config_ui_save'\n\t\t\t), 10, 2 );\n\n\t\t// Register widget on W3 Total Cache Dashboard page\n\t\tadd_action( 'w3tc_widget_setup', array(\n\t\t\t\t$this,\n\t\t\t\t'w3tc_widget_setup'\n\t\t\t) );\n\n\t\t// get control when extension is deactivated\n\t\tadd_action( 'w3tc_deactivate_extension_example', array(\n\t\t\t\t$this, 'w3tc_deactivate_extension' ) );\n\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A method to wait between cron runs. A cron is scheduled at a minimum of one minute, so we wait for this time. After every ten seconds, we check whether the schedule has been changed and abort the wait, as the schedule could affect the current minute.
protected function wait() { $i = 0; while (++$i <= 6) { if ($this->isReloadRequired()) { $this->reloadSchedule(); $this->removeReloadCronWorker(); break; } sleep(10); } }
[ "public function waitAction()\n {\n $timeout = $this->getArg('timeout') ? $this->getArg('timeout') : 60;\n $startTime = time();\n $sleepBetweenPolls = 2;\n $processManager = Mage::getModel('aoe_scheduler/processManager'); /* @var $processManager Aoe_Scheduler_Model_ProcessManager */\n do {\n sleep($sleepBetweenPolls);\n $aliveSchedules = 0;\n echo \"Currently running schedules:\\n\";\n foreach ($processManager->getAllRunningSchedules() as $schedule) { /* @var $schedule Aoe_Scheduler_Model_Schedule */\n $status = $schedule->isAlive();\n if (is_null($status)) {\n $status = '?';\n } else {\n $status = $status ? 'alive' : 'dead (updating status to \"disappeared\")';\n }\n if ($status) {\n $aliveSchedules++;\n }\n echo sprintf(\n \"%-30s %-10s %-10s %-10s %-10s\\n\",\n $schedule->getJobCode(),\n $schedule->getHost() ? $schedule->getHost() : '(no host)',\n $schedule->getPid() ? $schedule->getPid() : '(no pid)',\n $schedule->getLastSeen() ? $schedule->getLastSeen() : '(never)',\n $status\n );\n }\n if ($aliveSchedules == 0) {\n echo \"No schedules found\\n\";\n return;\n }\n } while (time() - $startTime < $timeout);\n echo \"Timeout reached\\n\";\n exit(1);\n }", "function cron() {\n $now = time();\n\n // Add a small negative buffer (1% of the entire period) to the time to account for slight difference in cron run length.\n $wait_time = $this->period - ($this->period * \\Drupal::config('backup_migrate.settings')->get('schedule.buffer'));\n\n if ($this->is_enabled() && ($now - $this->get('last_run')) >= $wait_time) {\n if ($settings = $this->get_profile()) {\n $settings->destination_id = $this->destination_id;\n $settings->source_id = $this->source_id;\n backup_migrate_perform_backup($settings);\n $this->update_last_run($now);\n $this->remove_expired_backups();\n }\n else {\n backup_migrate_backup_fail(\"Schedule '%schedule' could not be run because requires a profile which is missing.\", array('%schedule' => $schedule->get_name()), $settings);\n }\n }\n }", "function check_schedules_to_run() {\n\t\t$cron_time_running = time() - get_option('lepress-cron-is-running', 0);\n\t\tif(($jobs = $this->getJobs()) && $cron_time_running > 10) {\n\t\t\tforeach($jobs as $schedule_obj) {\n\t\t\t\tif($schedule_obj->scheduled_time <= time()) {\n\t\t\t\t\t$deleted = $this->delete_schedule($schedule_obj->hook);\n\t\t\t\t\tif($deleted) {\n\t\t\t\t\t\tdo_action($schedule_obj->hook);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdate_option('lepress-cron-is-running', time());\n\t\t}\n\t}", "public static function timeToNextCronJob()\n {\n // Set the timezone\n date_default_timezone_set('Europe/Amsterdam');\n\n // This will magically set the $datetime to the next 10 minute mark\n $datetime = new \\DateTime();\n $time_to_next_10_minutes = 10 - ($datetime->format('i') % 10);\n\n // return the difference between now and the next 10 minute mark\n return ceil($time_to_next_10_minutes);\n }", "protected function checkScheduledJobs() {\n global $database;\n // first get all active cronjobs\n $SQL = sprintf(\"SELECT * FROM %smod_kit_cj_cronjob WHERE `cronjob_status`='ACTIVE'\", TABLE_PREFIX);\n if (null ===($result = $database->query($SQL))) {\n $this->setError(sprintf('[%s _ %s] %s', __METHOD__, __LINE__, $database->get_error()));\n exit($this->getError());\n }\n $cronjobs = array();\n while (false !== ($job = $result->fetchRow(MYSQL_ASSOC))) {\n $cronjobs[$job['cronjob_id']] = $job;\n }\n foreach ($cronjobs as $cronjob) {\n $this->log[self::CRONJOB_ID] = $cronjob['cronjob_id'];\n $this->log[self::CRONJOB_NAME] = $cronjob['cronjob_name'];\n if ($cronjob['cronjob_next_run'] == '0000-00-00 00:00:00') {\n // this cronjob was never executed...\n $cronjob['cronjob_next_run'] = $this->calculateNextRun($cronjob);\n $cronjob['cronjob_last_status'] = 'First call, calculate the next regular run of this cronjob.';\n $cronjob['cronjob_last_run'] = date('Y-m-d H:i:s');\n $this->updateCronjob($cronjob);\n $this->log[self::LOG_MESSAGE] = 'First call, calculate the next regular run of this cronjob.';\n $this->log[self::LOG_STATUS] = self::STATUS_OK;\n $this->log[self::CRONJOB_RUN] = $cronjob['cronjob_last_run'];\n $this->log[self::CRONJOB_STATUS] = 'OK';\n $this->writeLog();\n }\n if (strtotime($cronjob['cronjob_next_run']) < time()) {\n // execute this cronjob\n if (false !== strpos($cronjob['cronjob_command'], LEPTON_URL)) {\n $cronjob['cronjob_command'] = substr($cronjob['cronjob_command'], strlen(LEPTON_URL));\n }\n if (false !== strpos($cronjob['cronjob_command'], LEPTON_PATH)) {\n $cronjob['cronjob_command'] = substr($cronjob['cronjob_command'], strlen(LEPTON_PATH));\n }\n if (strpos($cronjob['cronjob_command'], DIRECTORY_SEPARATOR) == 0) {\n $cronjob['cronjob_command'] = substr($cronjob['cronjob_command'], 1);\n }\n $execute = LEPTON_PATH.DIRECTORY_SEPARATOR.$cronjob['cronjob_command'];\n if (!file_exists($execute)) {\n // write the error to the log but continue with the next cronjob.\n $this->setError(sprintf('The relative path %s does not exists, please check the settings for this cronjob!', $cronjob['cronjob_command']));\n continue;\n }\n if (false === ($result = exec(sprintf(\"%s %s\", $this->php_exec, $execute)))) {\n // error executing - write log and continue\n $this->setError(sprintf('Error executing %s - no more informations available.', $cronjob['cronjob_command']));\n continue;\n }\n $this->log[self::LOG_MESSAGE] = $result;\n $this->log[self::LOG_STATUS] = self::STATUS_OK;\n $this->log[self::CRONJOB_RUN] = date('Y-m-d H:i:s');\n $this->log[self::CRONJOB_STATUS] = 'OK';\n $this->writeLog();\n $cronjob['cronjob_last_run'] = $this->log[self::CRONJOB_RUN];\n $cronjob['cronjob_last_status'] = $result;\n $cronjob['cronjob_next_run'] = $this->calculateNextRun($cronjob);\n $this->updateCronjob($cronjob);\n $this->cronjob_executed = true;\n }\n }\n }", "public function testCronRun() {\n $last_cron_time = \\Drupal::state()->get('system.cron_last');\n $this->cronRun();\n $this->assertSession()->statusCodeEquals(204);\n $next_cron_time = \\Drupal::state()->get('system.cron_last');\n\n $this->assertGreaterThan($last_cron_time, $next_cron_time);\n }", "function scheduled(){\n\t\t# Still running jobs\n\t\tif ($this->meta->running){\n\t\t\t# One exception: if it's running for more than the current time limit - it's probably dead\n\t\t\tif ((time() - $this->meta->exec_last) < ini_get('max_execution_time'))\n\t\t\t\treturn false; # yep, really is still running\n\t\t\t}\n\n\t\t# @cron if:\n\t\tif (!is_null($this->crondoc_if))\n\t\t\tif (!$this->crondoc_if)\n\t\t\t\treturn false;\n\n\t\t# @cron period:\n\t\tif (!is_null($this->crondoc_period)){\n\t\t\tif (is_null($this->meta->exec_last))\n\t\t\t\treturn true;\n\t\t\treturn ( time()+3 - $this->meta->exec_last ) >= $this->crondoc_period;\n\t\t\t}\n\n\t\treturn true;\n\t\t}", "public function time_for_cron() {\n if ($this->crontime == 0) {\n return false;\n }\n return (($this->lastcron + $this->crontime) < time());\n }", "public function testCronTabOnlyRunsOneTimePerMinute() {\n // Setup cron runner.\n // Important: at() is index based on all method calls on the mock, not just\n // the specified method. That means, that ->set() calls count against this\n // index. This could potentially cause volatility in these tests in the\n // future. We should look into a more steady solution in the future.\n $mock_state = $this->getMockState();\n $mock_state->expects($this->at(0))\n ->method('get')\n ->will($this->returnValue('0'));\n $mock_state->expects($this->at(2))\n ->method('get')\n ->will($this->returnValue('1501774146'));\n\n $cron_runner = $this->getCronRunner(['mock_state' => $mock_state]);\n\n $mock_web_page_archive = $this->getMockWebPageArchive('* * * * *');\n\n // Affirm run() only completes once.\n $mock_web_page_archive->expects($this->once())\n ->method('startNewRun')\n ->will($this->returnValue(TRUE));\n $this->assertTrue($cron_runner->run($mock_web_page_archive));\n $this->assertFalse($cron_runner->run($mock_web_page_archive));\n }", "public function scheduledRefresh()\n {\n static $lastRefresh = 0;\n $this->logger->debug(\"Scheduler: checking if schedules need refreshing.\");\n if (empty($this->remoteSchedules)) {\n $this->logger->debug(\"Scheduler: no remote schedules, thus none need refreshing.\");\n return;\n }\n\n $now = time();\n $nextRefreshIn = 900;\n foreach ($this->remoteSchedules as $name => $remote) {\n if (time() - $remote['last_updated'] > $remote['refresh']) {\n $this->logger->debug(\"Scheduler: $name needs refreshing\");\n $this->refresh($name);\n } else {\n $this->logger->debug(\"Scheduler: $name does not needs refreshing\");\n }\n }\n }", "public function checkCron() {\n\n\t\t$cron_interval = get_option( 'wpla_cron_schedule' );\n\t\t$next_scheduled = wp_next_scheduled( 'wpla_update_schedule' ) ;\n\t\tif ( 'external' == $cron_interval ) $cron_interval = false;\n\n\t\tif ( $cron_interval && ! $next_scheduled ) {\n\n\t\t\twpla_show_message( \n\t\t\t\t'<p>'\n\t\t\t\t. '<b>Warning: WordPress Cron Job has been disabled - scheduled WP-Lister tasks are not executed!</b>'\n\t\t\t\t. '<br><br>'\n\t\t\t\t. 'The task schedule has been reset just now in order to automatically fix this.'\n\t\t\t\t. '<br><br>'\n\t\t\t\t. 'If this message does not disappear, please visit the <a href=\"admin.php?page=wpla-settings&tab=settings\">Settings</a> page and click <i>Save Settings</i> or contact support.'\n\t\t\t\t. '</p>'\n\t\t\t,'warn');\n\n\t\t\t// this should fix it:\n\t\t\twp_schedule_event( time(), $cron_interval, 'wpla_update_schedule' );\n\n\t\t}\n\n\t\t// schedule daily event if not set yet\n\t\tif ( ! wp_next_scheduled( 'wpla_daily_schedule' ) ) {\n\t\t\twp_schedule_event( time(), 'daily', 'wpla_daily_schedule' );\n\t\t}\n\n\t\t// schedule FBA Shipment report request - if not set yet\n\t\tif ( ! wp_next_scheduled( 'wpla_fba_report_schedule' ) ) {\n\t\t\t$schedule = get_option( 'wpla_fba_report_schedule', 'daily' );\n\t\t\twp_schedule_event( time(), $schedule, 'wpla_fba_report_schedule' );\n\t\t}\n\n\t}", "public function test_finish_updates_rlastcron() {\n global $DB;\n $container = new Pimple(array(\n 'now' => mktime(5, 0, 0, 10, 1, 2013),\n ));\n $this->_cut = new mod_vocabcards_cron_manager($container);\n $this->_cut->finish();\n $expected = date('d/m/Y', $container['now']);\n $actual = $DB->get_field('config_plugins', 'value', array('plugin' => 'mod_vocabcards', 'name' => 'rlastcron'));\n $this->assertEquals($expected, $actual);\n }", "function CheckCron()\n\t{\n\t\t$cronok = false;\n\t\t$query = \"SELECT * FROM \" . SENDSTUDIO_TABLEPREFIX . \"settings\";\n\t\t$result = $this->Db->Query($query);\n\t\t$row = $this->Db->Fetch($result);\n\t\tif ($row['cronok'] == 1) {\n\t\t\t$cronok = true;\n\t\t}\n\n\t\t$this->cronok = $cronok;\n\t\t$this->cronrun1 = (int)$row['cronrun1'];\n\t\t$this->cronrun2 = (int)$row['cronrun2'];\n\n\t\tif (isset($row['database_version'])) {\n\t\t\t$this->database_version = $row['database_version'];\n\t\t} else {\n\t\t\t$query = \"ALTER TABLE \" . SENDSTUDIO_TABLEPREFIX . \"settings ADD COLUMN database_version INT\";\n\t\t\t$result = $this->Db->Query($query);\n\t\t\tif ($result) {\n\t\t\t\t$query = \"UPDATE \" . SENDSTUDIO_TABLEPREFIX . \"settings SET database_version='0'\";\n\t\t\t\t$result = $this->Db->Query($query);\n\t\t\t}\n\t\t}\n\n\t\t$query = \"SELECT * FROM \" . SENDSTUDIO_TABLEPREFIX . \"settings_cron_schedule\";\n\t\t$result = $this->Db->Query($query);\n\t\twhile ($row = $this->Db->Fetch($result)) {\n\n\t\t\t/**\n\t\t\t * check if the item is in the schedule array.\n\t\t\t * If it's not, then it may be an addon has defined a cron schedule but not cleaned itself up when it has been uninstalled/disabled.\n\t\t\t */\n\t\t\t$schedule_name = $row['jobtype'];\n\t\t\tif (!isset($this->Schedule[$schedule_name])) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$this->Schedule[$schedule_name] = array('lastrun' => $row['lastrun']);\n\t\t}\n\n\t\treturn $cronok;\n\t}", "public function checkScriptTime() {\r\n\t$time = $this->getTime();\r\n\tif($time > self::$cronMaxSeconds) {\r\n\t die(\"Script ran $time seconds - now terminating<br>\");\r\n\t}\r\n }", "function CheckNextJamSchedule($nextScheduledJamTime, $nextSuggestedJamTime){\n\tglobal $themes, $jams, $config;\n\tAddActionLog(\"CheckNextJamSchedule\");\n\tStartTimer(\"CheckNextJamSchedule\"); \n\n\t//print \"<br>CHECK JAM SCHEDULING\";\n\n\tif($config[\"JAM_AUTO_SCHEDULER_ENABLED\"][\"VALUE\"] == 0){\n\t\t//print \"<br>AUTO SCHEDULER DISABLED\";\n\t\tStopTimer(\"CheckNextJamSchedule\");\n\t\treturn;\n\t}\n\n\t//print \"<br>AUTO SCHEDULER ENABLED\";\n\t$autoScheduleThreshold = $config[\"JAM_AUTO_SCHEDULER_MINUTES_BEFORE_JAM\"][\"VALUE\"] * 60;\n\n\t$now = time();\n\t$timeToNextScheduledJam = $nextScheduledJamTime - $now;\n\t$timeToNextSuggestedJam = $nextSuggestedJamTime - $now;\n\n\t$isTimeToScheduleJam = $timeToNextSuggestedJam > 0 && $timeToNextSuggestedJam <= $autoScheduleThreshold;\n\t$isAJamAlreadyScheduled = $timeToNextScheduledJam > 0;\n\t$isAJamScheduledInAuthSchedulerThresholdTime = $isAJamAlreadyScheduled && $timeToNextScheduledJam <= $autoScheduleThreshold;\n\n\t//print \"<br>nextScheduledJamTime = \".gmdate(\"Y-m-d H:i:s\", $nextScheduledJamTime);\n\t//print \"<br>nextSuggestedJamTime = \".gmdate(\"Y-m-d H:i:s\", $nextSuggestedJamTime);\n\t//print \"<br>now = \".gmdate(\"Y-m-d H:i:s\", $now);\n\t//print \"<br>timeToNextScheduledJam = $timeToNextScheduledJam\";\n\t//print \"<br>timeToNextSuggestedJam = $timeToNextSuggestedJam\";\n\t//print \"<br>autoScheduleThreshold = $autoScheduleThreshold\";\n\t//print \"<br>isTimeToScheduleJam = \".($isTimeToScheduleJam ? \"YES\" : \"NO\");\n\t//print \"<br>isAJamAlreadyScheduled = \".($isAJamAlreadyScheduled ? \"YES\" : \"NO\");\n\t//print \"<br>isAJamScheduledInAuthSchedulerThresholdTime = \".($isAJamScheduledInAuthSchedulerThresholdTime ? \"YES\" : \"NO\");\n\n\t$colors = \"e38484|e3b684|dee384|ade384|84e38d|84e3be|84d6e3|84a4e3|9684e3|c784e3\";\n\n\tif($isTimeToScheduleJam){\n\t\t//print \"<br>IT IS TIME TO SCHEDULE A JAM\";\n\n\t\tif($isAJamScheduledInAuthSchedulerThresholdTime){\n\t\t\t//A future jam is already scheduled\n\t\t\t//print \"<br>A JAM IS ALREADY SCHEDULED\";\n\t\t\treturn;\n\t\t}\n\n\t\t$selectedTheme = \"\";\n\n\t\t$selectedTheme = SelectRandomThemeByVoteDifference();\n\t\tif($selectedTheme == \"\"){\n\t\t\t$selectedTheme = SelectRandomThemeByPopularity();\n\t\t}\n\t\tif($selectedTheme == \"\"){\n\t\t\t$selectedTheme = SelectRandomTheme();\n\t\t}\n\t\tif($selectedTheme == \"\"){\n\t\t\t$selectedTheme = \"Any theme\";\n\t\t}\n\n\t\t//print \"<br>A THEME WAS SELECTED\";\n\n\t\t$currentJamData = GetCurrentJamNumberAndID();\n\t\t$jamNumber = intval($currentJamData[\"NUMBER\"] + 1);\n\t\t//print \"<br>A JAM NUMBER WAS SELECTED: \".$jamNumber;\n\n\t\tAddJamToDatabase(\"127.0.0.1\", \"AUTO\", \"AUTOMATIC\", $jamNumber, $selectedTheme, \"\".gmdate(\"Y-m-d H:i\", $nextSuggestedJamTime), $colors);\n\t}\n\tStopTimer(\"CheckNextJamSchedule\");\n}", "public function i_wait_one_second()\n {\n sleep(1);\n }", "public static function engage_pinging_cron() {\n\n\t\t$when = time() + 28;\n\n\t\t// Because WordPress sorts the actions, we can't be sure if they're scrambled. Therefore: skew timing.\n\t\t// Note that when WP_CRON_LOCK_TIMEOUT expires, the subsequent actions will run, regardless if previous was successful.\n\t\treturn \\wp_schedule_single_event( ++$when, 'tsf_sitemap_cron_hook_before' )\n\t\t\t&& \\wp_schedule_single_event( ++$when, 'tsf_sitemap_cron_hook' )\n\t\t\t&& \\wp_schedule_single_event( ++$when, 'tsf_sitemap_cron_hook_after' );\n\t}", "public function testRunsWithoutWaitingForFinish()\n {\n $startTime = time();\n\n Mage::getModel('parallels/driver_exec')->exec('sleep 10');\n\n $resultTime = time() - $startTime;\n $this->assertLessThan(2, $resultTime);\n }", "private function executeReadyPeriodicTasks() {\n\t\tglobal $wgLocalDatabases, $wgMemc;\n\n\t\t$count = 0;\n\t\t$memcKey = 'jobqueue:periodic:lasttime';\n\t\t$timestamp = (int)$wgMemc->get( $memcKey ); // UNIX timestamp or 0\n\t\tif ( ( time() - $timestamp ) > 300 || mt_rand( 0, 999 ) == 0 ) { // 5 minutes\n\t\t\tif ( $wgMemc->add( \"$memcKey:rebuild\", 1, 1800 ) ) { // lock\n\t\t\t\tforeach ( $wgLocalDatabases as $db ) {\n\t\t\t\t\t$count += JobQueueGroup::singleton( $db )->executeReadyPeriodicTasks();\n\t\t\t\t}\n\t\t\t\t$wgMemc->set( $memcKey, time() );\n\t\t\t\t$wgMemc->delete( \"$memcKey:rebuild\" ); // unlock\n\t\t\t}\n\t\t}\n\n\t\treturn $count;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a map polyline
public function addPolyline(Overlays\Polyline $polyline) { $this->polylines[] = $polyline; if($this->autoZoom) $this->bound->extend($polyline); }
[ "function addPolyline($map_id, $id, $position, $options = array()){\n if($id == null || $map_id == null || $position == null) return null;\n\n if( !isset($position[\"start\"]) || !isset($position[\"end\"]) )\n return null;\n\n if( $options != null )\n {\n extract($options);\n }\n if( !isset($strokeColor) ) $strokeColor = $this->defaultStrokeColor;\n if( !isset($strokeOpacity) ) $strokeOpacity = $this->defaultStrokeOpacity;\n if( !isset($strokeWeight) ) $strokeWeight = $this->defaultStrokeWeight;\n\n // Check if position is array and has the two necessary elements\n if( is_array($position[\"start\"]) ){\n if( !isset($position[\"start\"][\"latitude\"]) || !isset($position[\"start\"][\"longitude\"]) )\n return null;\n $latitude_start = $position[\"start\"][\"latitude\"];\n $longitude_start = $position[\"start\"][\"longitude\"];\n }\n\n if( is_array($position[\"end\"]) ){\n if( !isset($position[\"end\"][\"latitude\"]) || !isset($position[\"end\"][\"longitude\"]) )\n return null;\n $latitude_end = $position[\"end\"][\"latitude\"];\n $longitude_end = $position[\"end\"][\"longitude\"];\n }\n\n $polyline = \"<script>\";\n\n if (!preg_match(\"/[-+]?\\b[0-9]*\\.?[0-9]+\\b/\", $latitude_start) || !preg_match(\"/[-+]?\\b[0-9]*\\.?[0-9]+\\b/\", $longitude_start)) return null;\n $polyline .= \"var start = new google.maps.LatLng({$latitude_start}, {$longitude_start}); \";\n\n if (!preg_match(\"/[-+]?\\b[0-9]*\\.?[0-9]+\\b/\", $latitude_end) || !preg_match(\"/[-+]?\\b[0-9]*\\.?[0-9]+\\b/\", $longitude_end)) return null;\n\n $polyline .= \"var end = new google.maps.LatLng({$latitude_end}, {$longitude_end}); \";\n\n $polyline .= \"\n var poly = [\n start,\n end\n ];\n var {$id}Polyline = new google.maps.Polyline({\n path: poly,\n strokeColor: '{$strokeColor}',\n strokeOpacity: {$strokeOpacity},\n strokeWeight: {$strokeWeight}\n });\n {$id}Polyline.setMap({$map_id});\n\n </script>\n \";\n return $polyline;\n }", "public function addPolyline(Polyline $polyline)\n {\n $this->polylines[] = $polyline;\n \n if($this->autoZoom)\n $this->bound->extend($polyline);\n }", "public function add_polyline($id, array $coordinates, array $options = array())\n\t{\n\t\tif (! isset($options['strokeColor']) OR ! Validate::color($options['strokeColor']))\n\t\t{\n\t\t\t$options['strokeColor'] = $this->_config->default_polyline_options['strokeColor'];\n\t\t} // if\n\n\t\tif (! isset($options['strokeOpacity']))\n\t\t{\n\t\t\t$options['strokeOpacity'] = $this->_config->default_polyline_options['strokeOpacity'];\n\t\t} // if\n\n\t\tif (! isset($options['strokeWeight']))\n\t\t{\n\t\t\t$options['strokeWeight'] = $this->_config->default_polyline_options['strokeWeight'];\n\t\t} // if\n\n\t\t$available_options = array(\n\t\t\t'strokeColor',\n\t\t\t'strokeOpacity',\n\t\t\t'strokeWeight',\n\t\t);\n\n\t\t$this->polylines[$id] = array(\n\t\t\t'id' => URL::title($id, '_', TRUE),\n\t\t\t'coords' => $coordinates,\n\t\t\t'options' => Arr::extract($options, $available_options),\n\t\t);\n\n\t\treturn $this;\n\t}", "public function polyline(array $coordinates = [], array $options = []);", "public function polyline()\n {\n if ( empty($this->attributes['stroke-width']) ) {\n $this->attributes['stroke-width'] = 1;\n }\n\n imagesetthickness($this->image, $this->attributes['stroke-width']);\n $color = $this->color->allocate($this->attributes['stroke'], $this->image, $this->getOpacity('stroke'));\n \n $points = explode(' ', $this->attributes['points']);\n foreach ( $points AS $key => $once ) {\n if ( empty($points[$key + 1]) ) {\n break;\n }\n \n list($x1, $y1) = explode(',', $once, 2);\n list($x2, $y2) = explode(',', $points[$key + 1], 2);\n \n imageline($this->image, $x1, $y1, $x2, $y2, $color);\n }\n }", "public function setPolyline(string $polyline): self\n {\n $this->polyline = $polyline;\n\n return $this;\n }", "public function polyline (array $coordinates) {}", "protected function addPolylineSection(ArrayNodeDefinition $node)\n {\n $node\n ->children()\n ->arrayNode('polyline')->addDefaultsIfNotSet()\n ->children()\n ->scalarNode('class')->end()\n ->scalarNode('helper_class')->end()\n ->scalarNode('prefix_javascript_variable')->end()\n ->arrayNode('options')\n ->useAttributeAsKey('options')\n ->prototype('scalar')->end()\n ->end()\n ->end()\n ->end()\n ->end();\n }", "public function polyline( $points, $attributes = array( ) ) \n { \n //Create the polyline element \n $polyline = $this->DOMDocument->createElement( 'polyline' ); \n\n //Add the element's attributes \n $polyline->appendChild( $this->DOMAttribute( 'points', $points ) ); \n\n //Add the optional DOMElement attributes to the element by reference \n $this->DOMAttributes( $polyline, $attributes ); \n\n //Append the polyline element to the document \n $this->root_element->appendChild( $polyline ); \n }", "protected function getIvoryGoogleMap_PolylineService()\n {\n return $this->get('ivory_google_map.polyline.builder')->build();\n }", "public function MapWithLines() {\n $map = $this->owner->getRenderableMap();\n $map->setZoom( $this->ZoomLevel );\n $map->setAdditionalCSSClasses( 'fullWidthMap' );\n $map->setShowInlineMapDivStyle( true );\n\n $scale = 0.3;\n\n // draw a triangle\n $point1 = array(\n $this->Lat - 0.5*$scale, $this->Lon\n );\n $point2 = array(\n $this->Lat + 0.5*$scale, $this->Lon-0.7*$scale\n );\n\n $point3 = array(\n $this->Lat + 0.5*$scale, $this->Lon+0.7*$scale\n );\n\n $map->addLine( $point1, $point2 );\n $map->addLine( $point2, $point3, '#000077' );\n $map->addLine( $point3, $point1, '#007700' );\n\n return $map;\n }", "static function polyline($pts, $stroke='black', $fill='transparent', $stroke_width=1) {\r\n $ptstrings = [];\r\n foreach ($pts as $pt)\r\n $ptstrings[] = sprintf(\"%d,%d\",$pt->x(), $pt->y());\r\n return\r\n sprintf(\"<polyline points='%s' stroke='%s' fill='%s' stroke-width='%d'/>\",\r\n implode(' ',$ptstrings), $stroke, $fill, $stroke_width);\r\n }", "public function addEncodedPolyline(Overlays\\EncodedPolyline $encodedPolyline)\n {\n $this->encodedPolylines[] = $encodedPolyline;\n\n if($this->autoZoom)\n $this->bound->extend($encodedPolyline);\n }", "public function addPolyLineByCoords($lon1, $lat1, $lon2, $lat2, $id = false, $color = '', $weight = 0, $opacity = 0)\n {\n if ($id !== false && isset($this->_polylines[$id]) && is_array($this->_polylines[$id])) {\n $_polyline = $this->_polylines[$id];\n } else {\n //only set color,weight,and opacity if new polyline\n $_polyline = [\n 'color' => $color,\n 'weight' => $weight,\n 'opacity'=> $opacity,\n ];\n }\n if (!isset($_polyline['coords']) || !is_array($_polyline['coords'])) {\n $_polyline['coords'] = [\n '0'=> ['lat'=>$lat1, 'long'=>$lon1],\n '1'=> ['lat'=>$lat2, 'long'=>$lon2],\n ];\n } else {\n $last_index = count($_polyline['coords']) - 1;\n //check if lat1/lon1 point is already on polyline\n if ($_polyline['coords'][$last_index]['lat'] != $lat1 || $_polyline['coords'][$last_index]['long'] != $lon1) {\n $_polyline['coords'][] = ['lat'=>$lat1, 'long'=>$lon1];\n }\n $_polyline['coords'][] = ['lat'=>$lat2, 'long'=>$lon2];\n }\n if ($id === false) {\n $this->_polylines[] = $_polyline;\n $id = count($this->_polylines) - 1;\n } else {\n $this->_polylines[$id] = $_polyline;\n }\n $this->adjustCenterCoords($lon1, $lat1);\n $this->adjustCenterCoords($lon2, $lat2);\n // return index of polyline\n return $id;\n }", "public function simplify(Polyline $polyline);", "function getPolyline($source_longitude,$source_latitude,$destination_longitude,$destination_latitude){\n$key = 'mapbox_api_key';\n\n$url='https://api.mapbox.com/directions/v5/mapbox/driving/'.$source_longitude.','.$source_latitude.';'.$destination_longitude.','.$destination_latitude.'?geometries=polyline&access_token='.$key.'&overview=full';\n\n//connection..\n$mapbox = curl_init();\n\ncurl_setopt($mapbox, CURLOPT_SSL_VERIFYHOST, false);\ncurl_setopt($mapbox, CURLOPT_SSL_VERIFYPEER, false);\n\ncurl_setopt($mapbox, CURLOPT_URL, $url);\ncurl_setopt($mapbox, CURLOPT_RETURNTRANSFER, true);\n\n//getting response from googleapis..\n$response = curl_exec($mapbox);\n$err = curl_error($mapbox);\n\ncurl_close($mapbox);\n\nif ($err) {\n\t echo \"cURL Error #:\" . $err;\n} else {\n\t echo \"200 : OK\\n\";\n}\n\n//extracting polyline from the JSON response..\n$data_mapbox = json_decode($response, true);\n//polyline..\n$p_mapbox = $data_mapbox['routes']['0']['geometry'];\n\nreturn $p_mapbox;\n}", "public function PolyLine($p, $style='', $line_style=array(), $fill_color=array()) {\n\t\t$this->Polygon($p, $style, $line_style, $fill_color, false);\n\t}", "function addPolyLineByAddress($address1,$address2,$color='#000000',$weight=10,$opacity=100) {\n $_geocode1 = $this->getGeocode($address1);\n $_geocode2 = $this->getGeocode($address2);\n $_polyline['lon1'] = $_geocode1['lon'];\n $_polyline['lat1'] = $_geocode1['lat'];\n $_polyline['lon2'] = $_geocode2['lon'];\n $_polyline['lat2'] = $_geocode2['lat'];\n $_polyline['color'] = $color;\n $_polyline['weight'] = $weight;\n $_polyline['opacity'] = $opacity;\n $this->_polylines[] = $_polyline;\n $this->adjustCenterCoords($_polyline['lon1'],$_polyline['lat1']);\n $this->adjustCenterCoords($_polyline['lon2'],$_polyline['lat2']);\n // return index of polylines\n return count($this->_polylines) - 1;\n }", "protected function importPolyline($pointer, $row){\n\t\t$fields = $this->prepareFields($row);\n\t\tif(!empty($fields)){\n\t\t\t$maps = $this->prepareMapList($fields);\n\n\t\t\tif(empty($fields->polydata)){\n\t\t\t\t$this->log(__(\"Missing polyline data\", \"wp-google-maps\"), \"error\", $pointer);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t\n\t\t\tif(!empty($maps)){\n\t\t\t\tforeach($maps as $mapId){\n\t\t\t\t\tif($this->mode === 'replace'){\n\t\t\t\t\t\t$this->truncateMap($mapId);\n\t\t\t\t\t}\n\n\t\t\t\t\t$polyline = false;\n\t\t\t\t\tif(isset($fields->id)){\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t$existing = \\WPGMZA\\Polyline::createInstance($fields->id);\n\t\t\t\t\t\t\t$polyline = $existing;\n\t\t\t\t\t\t} catch (\\Exception $ex){\n\t\t\t\t\t\t\t// Polyline doesn't exist\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(empty($polyline)){\n\t\t\t\t\t\t$polyline = \\WPGMZA\\Polyline::createInstance();\n\t\t\t\t\t}\n\n\t\t\t\t\t$fields->map_id = $mapId;\n\n\t\t\t\t\tif(isset($fields->id)){\n\t\t\t\t\t\t/* Read only */\n\t\t\t\t\t\tunset($fields->id);\n\t\t\t\t\t}\n\n\t\t\t\t\t$polyline->set($fields);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method returns the transitions associated with the state.
public function getTransitions() { return $this->transitions; }
[ "public function transitions()\n\t{\n\t\treturn array();\n\t}", "public function transitions()\n {\n return [\n new Transition('rate', 'rate', 'rated'),\n new Transition('wait_to_review', 'rated', 'review'),\n new Transition('review', 'review', 'reviewed'),\n ];\n }", "public function transitions()\n {\n return [\n new Transition('send', 'send', 'sent'),\n new Transition('wait_to_take', 'sent', 'take'),\n new Transition('take', 'take', 'took'),\n ];\n }", "public function getTransitions();", "public function getPossibleTransitions();", "public function getAvailableTransitions(): array\n {\n $currentState = $this->getCurrentState();\n $edges = $this->getEdgesFrom($currentState);\n\n return array_map(\n function (Edge $edge) {\n return $edge->getTransition();\n }, $edges\n );\n }", "public function get_outgoing_transitions() {\n $transitions = array();\n foreach ($this->states as $curstate) {\n $transitions = array_merge($transitions, $this->fa->get_adjacent_transitions($curstate));\n }\n return $transitions;\n }", "public static function getTransitions()\n {\n return array(\n self::STATUS_NEW => 'bb.i18n.workflow.core.task.transition.new',\n self::STATUS_ASSIGNED => 'bb.i18n.workflow.core.task.transition.assigned',\n self::STATUS_STARTED => 'bb.i18n.workflow.core.task.transition.started',\n self::STATUS_FINISHED => 'bb.i18n.workflow.core.task.transition.finished',\n self::STATUS_SENT => 'bb.i18n.workflow.core.task.transition.sent',\n self::STATUS_ARCHIVED => 'bb.i18n.workflow.core.task.transition.archived',\n );\n }", "public function getNextStateTransitions(): array\n {\n $transitions = [];\n \n foreach ($this->transitionNextStates as $state => $symNextMap) {\n foreach (\\array_keys($symNextMap) as $sym) {\n $transitions[] = [ $state, $sym, ];\n }\n }\n \n return $transitions;\n }", "public function getNextStateTransitions()\n {\n return $this->stateMachine->getNextTransitions();\n }", "public function getTransition();", "public function getConditionedTransitions();", "public function getAvailableTransitions(): array;", "public static function getAllTransitions()\n {\n return array(\n self::TRANS_AUDIO,\n self::TRANS_VIDEO,\n self::TRANS_AV_FIRST,\n self::TRANS_AV_LAST\n );\n }", "public function getArrivingTransitions() {\n\t\treturn $this->arrivingTransitions;\n\t}", "public function getTransitionSequence()\n\t{\n\t\treturn $this->transitionSequence; \n\n\t}", "public function getTransition()\n {\n return $this->transition;\n }", "abstract public function transitions();", "public function getTransitionDates()\n {\n $transitionDates = array();\n foreach($this->_transitionDates as $date) {\n $transitionDates[] = clone $date;\n }\n \n return $transitionDates;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check to see if a username is backlisted
function is_shareholder_blacklisted($Username){ $Query = "SELECT username FROM " . DB_TABLE_SHAREHOLDER_BLACKLIST . " WHERE username='" . $Username . "' AND deleted=0"; $Result = db_query($Query); $Count = row_count($Result); return ($Count == 0 ? FALSE : TRUE); }
[ "public function isBanned();", "function usernameBanned($username){\r\n if(!get_magic_quotes_gpc()){\r\n $username = addslashes($username);\r\n }\r\n $q = \"SELECT username FROM \".TBL_BANNED_USERS.\" WHERE username = '$username'\";\r\n $result = mysql_query($q, $this->connection);\r\n return (mysql_numrows($result) > 0);\r\n }", "function usernameBanned($username){\n if(!get_magic_quotes_gpc()){\n $username = addslashes($username);\n }\n $q = \"SELECT username FROM \".TBL_BANNED_USERS.\" WHERE username = '$username'\";\n $result = mysql_query($q, $this->connection);\n return (mysql_numrows($result) > 0);\n }", "function osc_is_username_blacklisted($username) {\n // Avoid numbers only usernames, this will collide with future users leaving the username field empty\n if(preg_replace('|(\\d+)|', '', $username)=='') {\n return true;\n }\n $blacklist = explode(\",\", osc_username_blacklist());\n foreach($blacklist as $bl) {\n if(stripos($username, $bl)!==false) {\n return true;\n }\n }\n return false;\n }", "function usernameBanned($username){\n if(!get_magic_quotes_gpc()){\n $username = addslashes($username);\n }\n $q = \"SELECT username FROM \".TBL_BANNED_USERS.\" WHERE username = '$username'\";\n $result = mysql_query($q, $this->connection);\n return (mysql_numrows($result) > 0);\n }", "function usernameBanned($username){\n\t\tif(!get_magic_quotes_gpc()){\n\t\t\t$username = addslashes($username);\n\t\t}\n\t\t$q = \"SELECT username FROM \".TBL_BANNED_USERS.\" WHERE username= '$username'\";\n\t\t$result = mysql_query($q, $this->connection);\n\t\treturn (mysql_numrows($result) > 0);\n\t}", "function usernameBanned($username) {\r\n if (!get_magic_quotes_gpc()) {\r\n $username = addslashes($username);\r\n }\r\n $q = \"SELECT username FROM \" . TBL_BANNED_USERS . \" WHERE username = '$username'\";\r\n $result = mysqli_query($this->connection, $q);\r\n return (mysqli_num_rows($result) > 0);\r\n }", "public function isNotBanned();", "function is_username_banned($username = '')\n\t{\n\t\tglobal $ilconfig, $ilance;\n\t\t$isbanned = false;\n\t\tif (!empty($ilconfig['registrationdisplay_userban']))\n\t\t{\n\t\t\t$bans = preg_split('/\\s+/', $ilconfig['registrationdisplay_userban'], -1, PREG_SPLIT_NO_EMPTY);\n\t\t\tforeach ($bans AS $banned)\n\t\t\t{\n\t\t\t\t$regex = '^' . preg_quote($banned, '#') . '$';\n\t\t\t\tif (preg_match(\"#$regex#i\", $username))\n\t\t\t\t{\n\t\t\t\t\t$isbanned = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n\t\t$pregextra = '';\n\t\t\n\t\t($apihook = $ilance->api('is_username_banned_end')) ? eval($apihook) : false;\n\t\t\n\t\tif ($ilconfig['registration_allow_special'] == 0)\n\t\t{\n\t\t\tif (preg_match('/[^a-zA-Z0-9' . $pregextra . '\\_.]+/', $username))\n\t\t\t{ // check if anything other than a to z, A to Z and 0 to 9 _ and .\n\t\t\t\t$isbanned = true;\n\t\t\t}\n\t\t\tif (preg_match(\"/\\\\s/\", $username))\n\t\t\t{ // check if user is using spaces\n\t\t\t\t$isbanned = true;\n\t\t\t}\n\t\t}\n\t\treturn $isbanned;\n\t}", "public function isBanned() : bool\n {\n return false;\n }", "public function userIsBlocked();", "public function available_username() {\n $exist = $this->Connect->fetch(\"SELECT id FROM users WHERE username = '$this->username' LIMIT 1\");\n return $exist\n ? false : true;\n }", "function validate_user() {\t\t\t\t\t\t\t\t\t\t\t\t//Start the validate user funciton\n\t\t$banned_array = $this->banned_array;\t\t\t\t\t\t\t//Get banned array\n\t\t$ip = trim($_SERVER['REMOTE_ADDR']);\t\t\t\t\t\t\t//Get IP Address\n\t\t$cpu = gethostbyaddr($ip);\n\t\t$count = count($banned_array);\t\t\t\t\t\t\t\t\t//Count the number of banned users\n\t\t\tif ($count < 1) {\t\t\t\t\t\t\t\t\t\t\t\t\t//Are there users in the list???\n\t\t\t\treturn true;\t\t\t\t\t\t\t\t\t\t\t\t\t//If not user is valid, if so check em!\n\t\t\t} else {\n\t\t\t\tforeach($banned_array as $key => $value) {\t\t\t\t//Start extraction of banned users from the array\n\t\t\t\t\tif ($value == $ip .\"-\". $cpu) {\t\t\t\t\t\t\t//If the user's IP address is found in list, continue\n\t\t\t\t\t\treturn false;\t\t\t\t\t\t\t\t\t\t\t//Function returns false if user is on list\n\t\t\t\t\t} else {\t\t\t\t\t\t\t\t\t\t\t\t\t//Else\n\t\t\t\t\t\treturn true;\t\t\t\t\t\t\t\t\t\t\t//the function returns true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t}", "function is_user_name_available($user_name){\r\n\r\nreturn validate_username($user_name) && !user_name_exists($user_name) && !in_array($user_name,scandir (HOME)) && !extension_exists($user_name);\r\n\r\n}", "function usernameDisallowed($username) {\n $query = \"select * from banlist where :username like concat('%',ban_username,'%') AND ban_username != ''\";\n $stmt = $this->db->prepare($query);\n $stmt->bindValue(':username', $username);\n $stmt->execute();\n $count = $stmt->rowCount();\n return ($count > 0);\n }", "public function IsBanned()\r\n {\r\n if ($result = $this->_db->ExecuteStmt(Statements::SELECT_USERS_BANNED, $this->_db->BuildStmtArray(\"i\", $this->GetId())))\r\n {\r\n if ($row = $result->fetch_assoc())\r\n {\r\n $banEnd = strtotime($row['ban_end']);\r\n if ($banEnd >= time() && $row['active'] == 1)\r\n return true;\r\n // Automatically unban the user if the time has expired\r\n elseif ($banEnd < time() && $row['active'] == 1)\r\n $this->SetBanned(false);\r\n }\r\n }\r\n return false;\r\n }", "public function banned()\n {\n return Blacklist::where('user_id', $this->id)->exists();\n }", "public function hasUserListings()\n\t{\n\t\treturn FALSE;\n\t}", "public static function onKickBannedIP()\n\t{\n\t\tif (false === isset($_SERVER['REMOTE_ADDR']))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t$path = GWF_PROTECTED_PATH.'temp_ban.lst.txt';\n\t\tif (false === Common::isFile($path))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tif ('' === ($bans = file_get_contents($path)))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t$ip = $_SERVER['REMOTE_ADDR'];\n\t\t$bans = explode(\"\\n\", $bans);\n\t\tforeach ($bans as $i => $ban)\n\t\t{\n\t\t\t$ban = explode(':', $ban);\n\t\t\tif (count($ban) === 2)\n\t\t\t{\n\t\t\t\tif ($ban[1] === $ip && $ban[0] > time())\n\t\t\t\t{\n\t\t\t\t\t# FIXME: WTF? and why not logDie ?\n\t\t\t\t\tdie(sprintf('You are banned until %s+UGZ.', date('Y-m-d H:i:s', $ban[0])));\n// \t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Integer values of 1 or 0 should not validate.
public function testIntegerRepresentations() { $rule = new Rule; $result = $rule->validate('foo', ['foo' => 1]); $this->assertFalse($result); $result = $rule->validate('foo', ['foo' => 0]); $this->assertFalse($result); }
[ "public function testIsValidReturnsFalseForInteger()\n {\n $this->assertFalse($this->validator->isValid(42));\n }", "public function testValidateZeroNumber(): void\n {\n $this->assertFalse($this->validate(0, [10, 20]));\n }", "public function testValidateMinusOne(): void\n {\n $this->assertFalse($this->validate(-1, [10, 20]));\n }", "public function testEqualFalse()\n {\n $a = rand(0,100);\n $b = rand(101, 200);\n\n $result = IntegerValidator::equal($a, $b);\n\n $this->assertFalse($result);\n }", "public function testNonNegativeInteger(): void\n {\n $validator = new Validator();\n $this->assertProxyMethod($validator, 'nonNegativeInteger', null, [true], 'naturalNumber');\n $this->assertNotEmpty($validator->validate(['username' => -1]));\n\n $fieldName = 'field_name';\n $rule = 'nonNegativeInteger';\n $expectedMessage = 'The provided value must be a non-negative integer';\n $this->assertValidationMessage($fieldName, $rule, $expectedMessage);\n }", "public function test_integer_returns_true_when_not_optional_and_input_int() {\n\t\t$optional = false;\n\n\t\t$result = self::$validator->validate( 1, $optional );\n\t\t$this->assertTrue( $result );\n\t}", "private function valid_integer($value){\n\t\t$value = (int) $value;\n\t\treturn ($value==0) ? false : $value;\n\t}", "public function testFailingValue()\n {\n $rule = new NumericRule();\n $this->assertFalse($rule->passes(false));\n $this->assertFalse($rule->passes('foo'));\n }", "public function testFalseToInt() {\n $this->assertEquals(0, $this->plugin->tamper(FALSE));\n }", "public function testIsNotNegative()\n {\n $this->assertTrue(Integer::isNotNegative(1));\n $this->assertTrue(Integer::isNotNegative(0));\n $this->assertFalse(Integer::isPositive(-1));\n }", "public function functionCanBeInterpretedAsIntegerInvalidDataProvider() {}", "public function testGenerateLengthIsPositive()\n {\n $int = mt_rand(-20, -10);\n $bool = IntegerValidator::is_positive($int);\n $this->assertFalse($bool,true);\n }", "public function testUnsigned(): void\n {\n $validator = new IntegerValidator(true);\n $result = $validator->validate(-9);\n\n $this->assertFalse($result->isValid());\n }", "public function testShouldInvalidateNonNumericalValues() {\n $data = ['number_1' => 'test'];\n\n $rule = ['/number_([0-9]+)/i' => 'numerical'];\n $this->validator->setRequest($data)->setRules($rule);\n $this->assertFalse($this->validator->run());\n }", "public function functionCanBeInterpretedAsIntegerValidDataProvider() {}", "public function testValidatorRejectsIntegersGreaterThanOne()\n {\n $this->assertRejects(2);\n }", "public function test_boolean_returns_true_when_not_optional_and_input_int_1() {\n\t\t$optional = false;\n\n\t\t$result = self::$validator->validate( 1, $optional );\n\t\t$this->assertTrue( $result );\n\t}", "public function testNormalizeIntBool()\n {\n $data = (bool) rand(0, 1);\n $subject = $this->createInstance();\n $_subject = $this->reflect($subject);\n\n $this->setExpectedException('InvalidArgumentException');\n $_subject->_normalizeInt($data);\n }", "public function test_integer_returns_true_when_optional_and_input_int() {\n\t\t$optional = true;\n\n\t\t$result = self::$validator->validate( 1, $optional );\n\t\t$this->assertTrue( $result );\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get absolute path to validation.xsd
public function getSchemaFile() { return __DIR__ . '/etc/validation.xsd'; }
[ "protected function _getFileXsd()\n {\n $urnResolver = new \\Magento\\Framework\\Config\\Dom\\UrnResolver();\n return $urnResolver->getRealPath('urn:magento:module:Magento_Webapi:etc/webapi.xsd');\n }", "protected function _getFileXsd()\n {\n return $this->urnResolver->getRealPath('urn:magento:framework:Indexer/etc/indexer.xsd');\n }", "public function getXsdValidationBasePath()\n {\n return __DIR__ . '/../Resources/config/schema';\n }", "function getXsdValidationBasePath()\n {\n }", "public function getXsdValidationBasePath()\n {\n return '';\n }", "public function getSchema()\n {\n return realpath(__DIR__ . '/../../etc/table.xsd');\n }", "public function getXsdValidationBasePath()\n {\n }", "public function getXsdValidationBasePath()\n {\n // TODO: Implement getXsdValidationBasePath() method.\n }", "protected function getSchemaFile()\n {\n return $this->getSchemaDir() . self::XSD;\n }", "public function getXsdValidationBasePath()\n {\n return null;\n }", "public function getPerFileSchema()\n {\n return $this->urnResolver->getRealPath('urn:genmato:module:Genmato_Sample:/etc/sample.xsd');\n }", "public static function getXsdPath()\n {\n return __DIR__ . '/routing.xsd';\n }", "public function getSchemaPath()\n {\n return realpath(__DIR__ . '/../../inventory.schema.json');\n }", "function getSchemaFilename() {\n\t\treturn 'pkp-users.xsd';\n\t}", "public function getXsdValidationBasePath()\n {\n return false;\n }", "public function getValidationDirectory(): string\n {\n return $this->validation_directory;\n }", "protected function _getKnownValidXml()\n {\n return __DIR__ . '/_files/valid.xml';\n }", "public function getValidationDirectory()\n {\n return $this->validation_directory;\n }", "protected function getSchemaDir()\n {\n return __DIR__ . '/../Schemas';\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether request has been made using any secure layer
public static function isSecureRequest() {}
[ "public function isSecureRequest(){ }", "public function isSecureRequest()\n {\n return $this->getRequest()->isSecure();\n }", "private function isSecureRequest(): bool\n {\n $request = $this->getRequest();\n\n $referrer = $request->getHeader('referer');\n $secure = false;\n\n if ($referrer) {\n $scheme = UriFactory::factory($referrer)->getScheme();\n $secure = $scheme === 'https';\n }\n\n return $secure && $request->isSecure();\n }", "private function isSecureRequest(): bool\n {\n $request = $this->getRequest();\n\n $referrer = $request->getHeader('referer');\n $secure = false;\n\n if ($referrer) {\n $scheme = parse_url($referrer, PHP_URL_SCHEME);\n $secure = $scheme === 'https';\n }\n\n return $secure && $request->isSecure();\n }", "public function isTrustedRequest(): bool\n {\n return $this->checkIp($this->request->getAttribute('ip'), static::IPS);\n }", "private function should_run_fingerprint_checks_for_request() {\n\n\t\tif ( ITSEC_Lib::is_loopback_request() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "abstract public function isSecure();", "private static function fnIsRequestValid(){\n return\n (isset($_SESSION['user']) &&\n $_SESSION['user']->ip_address === $_SERVER['REMOTE_ADDR'] &&\n $_SESSION['user']->user_agent === $_SERVER['HTTP_USER_AGENT']);\n }", "public function isSecured()\r\n {\r\n return $this->url->getScheme() === 'https';\r\n }", "public function isSecured(): bool\n\t{\n\t\treturn $this->url->getScheme() === 'https';\n\t}", "public function isSafe()\n\t{\n\t\treturn in_array(\n\t\t\t$this->method(),\n\t\t\tarray('GET', 'POST', 'OPTIONS', 'TRACE')\n\t\t);\n\t}", "function b_is_secured_page(): bool\n{\n if (isset($_SERVER[\"HTTP_HOST\"]) &&\n ((isset($_SERVER[\"HTTPS\"]) && $_SERVER[\"HTTPS\"] == \"on\") ||\n (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) ||\n (isset($_SERVER['HTTP_X_FORWARDED_PORT']) && $_SERVER['HTTP_X_FORWARDED_PORT'] == 443))\n ) {\n return true;\n } else {\n return false;\n }\n}", "private function isConnectionSecurityValid(RequestData $request)\n {\n return !$this->secure || $request->isSecure();\n }", "public function isSecure()\n {\n $hmac_string = $this->pxPayload.$this->pxCtx->getUserAgent();\n\n return $this->isHmacValid($hmac_string, $this->getHmac());\n }", "public static function isSecureUrl(){\n\t\treturn (!empty($_SERVER[self::HTTPS]) && $_SERVER[self::HTTPS] != self::OFF);\n\t}", "public function isUrlSecure();", "public function isSecure()\n {\n if (self::$trustedProxies && self::$trustedHeaders[self::HEADER_CLIENT_PROTO] && ($proto = $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_PROTO]))) {\n return in_array(strtolower($proto), array('https', 'on', '1'));\n }\n return 'on' == strtolower($this->server->get('HTTPS')) || 1 == $this->server->get('HTTPS');\n }", "public function isSecure($url);", "public function requestNeedsAuthentication() {\n\t\treturn TRUE;\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the description of the collection associated with the $url and $collection parameters.
abstract public function getInfo($url, $collectionId);
[ "function tainacan_the_collection_description() {\n\techo tainacan_get_the_collection_description();\n}", "public function collectionDetails(): CollectionDetails;", "protected function getCollectionName()\n\t{\n\t\treturn $this->_collection;\n\t}", "public function get($collection);", "public function getCollectionFromUrl($url)\n\t{\n\t\t// explode by the '/'\n\t\t$uri = explode('/', $url);\n\t\t// count the number of elements in the array\n\t\t$counter = count($uri);\n\t\t// decrements the count by 1 to get the last element from the array\n\t\t$counter--;\n\t\t// return the last element in the array i.e. which is the collection name\n\t\treturn $uri[$counter];\n\t}", "protected function collection()\n {\n return Route::$collection;\n }", "public function getEndpoint(string $collection): CollectionEndpoint;", "public function getCollectionName() {\r\n\t\treturn $this->collectionName;\r\n\t}", "public function getCollectionName();", "public function getCollectionURI()\n {\n $this->assertSame(\n 'a collection uri',\n (new ResourceList(['collectionURI' => 'a collection uri']))->getCollectionURI()\n );\n }", "public function getCollectionName() {\n return $this->collectionName;\n }", "protected function _addDescriptionElement($collection)\n {\n $descriptionElementId = $this->_getElementId('Dublin Core', 'Description');\n $this->_addElementText($collection['id'], 'Collection', $descriptionElementId, '0', $collection['description']);\n }", "protected function collection()\n {\n return $this->option('collection') ||\n Str::endsWith($this->argument('name'), 'Collection');\n }", "protected function _api_fetch_collection($collection_url, $item_class, $params = array())\n {\n\t\tif (substr($collection_url, 0,1) == '/')\n\t\t{\n\t\t\t$collection_url = substr($collection_url, 1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$collection_url = $this->url.'/'.$collection_url;\n\t\t}\n\t\t\n\t\treturn new Github_Collection($this->_github, $collection_url, $item_class, $params);\n }", "private function _collections()\n\t{\n\t\t$view = $this->view('collections', 'collection');\n\t\t$view->name = $this->_name;\n\t\t$view->option = $this->option;\n\t\t$view->member = $this->member;\n\t\t$view->params = $this->params;\n\t\t$view->model = $this->model;\n\n\t\t// Filters for returning results\n\t\t$view->filters = array(\n\t\t\t'limit' => Request::getInt('limit', Config::get('list_limit')),\n\t\t\t'start' => Request::getInt('limitstart', 0),\n\t\t\t'search' => Request::getString('search', ''),\n\t\t\t'state' => 1,\n\t\t\t'user_id' => User::get('id')\n\t\t);\n\n\t\t$count = array(\n\t\t\t'count' => true,\n\t\t\t'state' => 1,\n\t\t\t'collections' => $this->model->collections()\n\t\t);\n\n\t\tif (!$this->params->get('access-manage-collection'))\n\t\t{\n\t\t\t$view->filters['access'] = (User::isGuest() ? 0 : array(0, 1));\n\t\t\t$count['access'] = $view->filters['access'];\n\t\t}\n\n\t\t$view->filters['count'] = true;\n\t\t$view->total = $this->model->collections($view->filters);\n\n\t\t$view->filters['count'] = false;\n\t\t$view->rows = $this->model->collections($view->filters);\n\n\t\t$view->posts = $this->model->posts($count);\n\t\t$view->followers = $this->model->followers($count);\n\t\t$view->following = $this->model->following($count);\n\n\t\tforeach ($this->getErrors() as $error)\n\t\t{\n\t\t\t$view->setError($error);\n\t\t}\n\n\t\treturn $view->loadTemplate();\n\t}", "public function testDesignsGetCollection()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "public function getCollectionInfo($collection)\n {\n return $this->getToolbox($this->_currentConnection)->getCollectionManager()->getCollectionInfo($collection);\n }", "public function getCollectionEndPointUrl()\n {\n $val = $this->getStoreConfigValue(self::SETTINGS_ENDPOINT_CATEGORY);\n if ($val == 'stage') {\n return self::STAGING_API_ENDPOINT_COLLECTION;\n }\n return self::PRODUCTION_API_ENDPOINT_COLLECTION;\n }", "function link_to_collection($text = null, $props = array(), $action = 'show', $collectionObj = null)\n{\n if (!$collectionObj) {\n $collectionObj = get_current_record('collection');\n }\n\n $collectionTitle = metadata($collectionObj, array('Dublin Core', 'Title'));\n $text = !empty($text) ? $text : $collectionTitle;\n return link_to($collectionObj, $action, $text, $props);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace invalidcombo error valid user account / invalid user account same exact result
function bpspro_login_error_invalidcombo($text) { return str_replace( '<strong>ERROR</strong>: Invalid username or e-mail.', 'Password reset is not allowed for this user', $text ); }
[ "public function setValidateError($arr) {\n if(!Validation::isValidUser($arr['username'])) {\n helper::setValidateError('username', 'Invalided username. Please re-enter!');\n }\n if(!Validation::isValidPass($arr['password'])) {\n helper::setValidateError('password', 'Invalided password. Please re-enter!');\n }\n if(!Validation::isMatched($arr['password'], $arr['re-password'])) {\n helper::setValidateError('re-password', 'Unmatched. Please re-confirm password!');\n }\n }", "function seun_user_profile_nicename_error( $errors, $update, $user ) {\n\t\t\n\t\t\t$errors->add( 'user_nicename', __( '<strong>ERROR</strong>: This user nicename is already registered. Please choose another one.', 'seun' ) );\n\t\t\n\t\t}", "public function registerFailure() {\n\t\t$USERNAME_MIN_LENGTH = \\user\\model\\Username::MIN_LENGTH;\n\t\t$USERNAME_MAX_LENGTH = \\user\\model\\Username::MAX_LENGTH;\n\t\t$PASSWORD_MIN_LENGTH = \\user\\model\\Password::MIN_LENGTH;\n\t\t$PASSWORD_MAX_LENGTH = \\user\\model\\Password::MAX_LENGTH;\n\n\t\t//Boolean.\n\t\t$input_error = false;\n\n\t\t//If username is shorter than what is allowed.\n\t\tif(strlen($this->getUsername()) < $USERNAME_MIN_LENGTH) {\n\t\t\t$this->addErrorMessage(self::$ERROR_USERNAME_MINLENGTH);\n\t\t\t$input_error = true;\n\t\t}\n\n\t\t//If username is longer than what is allowed.\n\t\telseif(strlen($this->getUsername()) > $USERNAME_MAX_LENGTH) {\n\t\t\t$this->addErrorMessage(self::$ERROR_USERNAME_MAXLENGTH);\n\t\t\t$input_error = true;\n\t\t}\n\n\t\t//If password is shorter than what is allowed.\n\t\tif(strlen($this->getPassword()) < $PASSWORD_MIN_LENGTH) {\n\t\t\t$this->addErrorMessage(self::$ERROR_PASSWORD_MINLENGTH);\n\t\t\t$input_error = true;\n\t\t}\n\n\t\t//If password is longer than what is allowed.\n\t\telseif(strlen($this->getPassword()) > $PASSWORD_MAX_LENGTH) {\n\t\t\t$this->addErrorMessage(self::$ERROR_PASSWORD_MAXLENGTH);\n\t\t\t$input_error = true;\n\t\t}\n\n\t\t//If the two passwords doesn't match.\n\t\tif($this->getRepeatedPassword() != $this->getPassword()) {\n\t\t\t$this->addErrorMessage(self::$ERROR_PW_MISMATCH);\n\t\t\t$input_error = true;\n\t\t}\n\n\t\t//If it's none of the above then the username is already taken.\n\t\tif(!$input_error)\n\t\t\t$this->addErrorMessage(self::$ERROR_USERNAME_TAKEN);\n\t}", "public function Valid($cur) {\n\t\t$this->errors = array();\n\t\t$validity = TRUE;\n\t\t$password_valid = TRUE;\n\t\t$user_available = TRUE;\n\t\tif(preg_match(\"/^[a-zA-Z0-9]{1,12}$/\", $this->username) !== 1){\n\t\t\t$this->errors += array(\"username\"=>\"Invalid username. Your username must be between 1 and 12 characters long and may only contain alpha-numeric characters.\");\n\t\t\t$validity = False;\n\t\t}else{\n\t\t\t$user_available = $this->available($this->username,$cur);\n\t\t}\n\t\tif(!$user_available){\n\t\t\t$this->errors += array(\"username\"=>\"That username is already taken.\");\n\t\t\t$validity = False;\n\t\t}\n\t\tif(preg_match(\"/^[a-zA-Z0-9]{1,12}$/\", $this->password) !== 1){\n\t\t\t$this->errors += array(\"password\"=>\"Invalid password. Your password must be between 1 and 12 characters long and may only contain alpha-numeric characters.\");\n\t\t\t$validity = False;\n\t\t\t$password_valid = False;\n\t\t}\n\t\tif($password_valid && $this->re_password !== $this->password){\n\t\t\t$this->errors += array(\"password\"=>\"Invalid password. Your password and re-typed password do not match.\");\n\t\t\t$validity = False;\n\t\t}\n\t\tif(!filter_var($this->email, FILTER_VALIDATE_EMAIL)){\n\t\t\t$this->errors += array(\"email\"=>\"Invalid e-mail.\");\n\t\t\t$validity = False;\n\t\t}\n\t\tif(preg_match(\"/^[\\p{L}]+[ \\p{L}]*$/\", $this->name) !== 1){\n\t\t\t$this->errors += array(\"name\"=>\"Invalid name. Your name must be atleast 1 character long and may only contain alphabetical characters.\");\n\t\t\t$validity = False;\n\t\t}\n\t\tif(preg_match(\"/^[\\p{N}\\p{L} ,.-]+$/\", $this->addr1) !== 1){\n\t\t\t$this->errors += array(\"addr1\"=>\"Invalid address. Your address may only contain alphanumerical or ,.- characters\");\n\t\t\t$validity = False;\n\t\t}\n\t\tif(preg_match(\"/^[\\p{L}]+[ \\p{L}]*$/\", $this->city) !== 1){\n\t\t\t$this->errors += array(\"city\"=>\"Invalid city name. Your city name must be atleast 1 character long and may only contain alphabetical characters.\");\n\t\t\t$validity = False;\n\t\t}\n\t\tif(preg_match(\"/^[\\p{L}\\p{N}-]*[\\p{L}\\p{N}][\\p{L}\\p{N}-]*$/\", $this->zip) !== 1){\n\t\t\t$this->errors += array(\"zip\"=>\"Invalid zip/postal code. Your zip/postal code must contain atleast 1 character and may only contain alphanumericals and hyphens.\");\n\t\t\t$validity = False;\n\t\t}\n\t\t\n\t\treturn $validity;\n\t}", "public function invalidRegisterDataProvider()\n {\n return array(\n // empty strings\n array(\n array(\n 'firstName' => '',\n )\n ),\n array(\n array(\n 'lastName' => '',\n )\n ),\n array(\n array(\n 'email' => '',\n )\n ),\n array(\n array(\n 'password' => '',\n )\n ),\n array(\n array(\n 'passwordConfirm' => '',\n )\n ),\n \n // email format\n array(\n array(\n 'email' => 'user',\n )\n ),\n array(\n array(\n 'email' => 'user@',\n )\n ),\n array(\n array(\n 'email' => 'user@example',\n )\n ),\n \n // out of range\n array(\n array(\n 'firstName' => 'abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi a', //101\n )\n ),\n array(\n array(\n 'lastName' => 'abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi a', //101\n )\n ),\n \n // passwords match\n array(\n array(\n 'password' => 'a',\n 'passwordConfirm' => 'b',\n )\n ),\n );\n }", "public function ms_password_errors($result) {\n\t\t\tif (isset($_POST['stage']) && 'validate-user-signup' == $_POST['stage']) {\n\t\t\t\t$errors = $this->password_errors($result['errors'] ?? false);\n\t\t\t\tforeach ($errors->get_error_codes() as $code) {\n\t\t\t\t\tforeach ($errors->get_error_messages($code) as $error) {\n\t\t\t\t\t\t$result['errors']->add($code, preg_replace('/<strong>([^<]+)<\\/strong>: /', '', $error));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $result;\n\t\t}", "function checkUsernamePasswordCombination(){\n\t\techo $GLOBALS['badUsernamePassword'];\n\t}", "function sr_user_passchange_validate($form, &$form_state) {\r\n \r\n $name = $form_state['values']['adjective_hidden'].$form_state['values']['color_hidden'].$form_state['values']['animal_hidden'].$form_state['values']['number_hidden'];\r\n form_set_value($form['screen_name'], $name, $form_state);\r\n\t$errText = sr_user_validateScreenName($form_state['values']['screen_name']);\r\n\tif (strlen($errText) > 0) {\r\n\t\tform_set_error('screen_name', t($errText));\r\n\t}\r\n\telse {\r\n\t\tglobal $user;\r\n\t\tif ($user->name == trim($form_state['values']['screen_name'])) {\r\n\t\t\tform_set_error('screen_name', t('The chosen Screen Name is identical to your existing one. Please choose another.'));\r\n\t\t}\r\n\t}\r\n\tif (strlen(trim($form_state['values']['password'])) < 4) {\r\n\t\tform_set_error('password', t('password must contain at least 4 characters.'));\r\n }\r\n\tif (trim($form_state['values']['password']) == \"read\") {\r\n\t\tform_set_error('password', t('The chosen Password is forbidden. Please choose another.'));\r\n\t}\r\n \r\n}", "function secure_validate_woocommerce_register_form($validation_error, $user, $email){\n\tif (!$validation_error->get_error_code()){\n\t\tif (secure_is_failtoban_active()){\n\t\t\t$validation_error = secure_failtoban_validate_woocommerce_register_form($validation_error, $user, $email);\n\t\t}\n\t\tif (!$validation_error->get_error_code()){\n\t\t\tif (secure_is_captcha_active()){\n\t\t\t\t$validation_error = secure_captcha_validate_woocommerce_register_form($validation_error, $user, $email);\n\t\t\t}\n\t\t}\n\t}\n\treturn $validation_error;\n}", "protected function _resetPasswordErrors()\n {\n if (array_key_exists('password', $this->User->invalidFields())) {\n $this->data['User']['password'] = $this->data['User']['confirm_password'] = '';\n } else {\n $this->data['User']['password'] = $this->data['User']['confirm_password'];\n }\n }", "private function invalidUsernameError(): string {\n\t\treturn Text::get('invalidUsernameError') . ' \"a-z\", \"A-Z\", \".\", \"-\", \"_\", \"@\"';\n\t}", "public function testAddInvalidAccount()\n {\n $this->addToServers($this->objects[1]);\n }", "public function setInvalid();", "function confirmPassword(&$errors, $field_list, $field_name_a, $field_name_b)\n\t{\n\tif($field_list[$field_name_a] != $field_list[$field_name_b]) \n\t$errors[$field_name_a] = 'Passwords do not match!<br/>';\n\t}", "public function getInvalidUserResponse()\n {\n $result['responseCode'] = self::RESPONSE_INVALID_USER;\n return $result;\n }", "function getError($key, $value, $regular, $regular2, $form_values){\r\n\tif($key == 'email'){\r\n\t\tif (filter_var($value, FILTER_VALIDATE_EMAIL)) {\r\n\t\t\tif(form_validate_unique($value, $key)){\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn $form_values[$key] .' already in use.<br />';\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn 'Please enter a valid '. $form_values[$key] .'.<br />';\r\n\t\t}\r\n\t}\r\n\telseif($key == 'username'){\r\n\t\tif (preg_match($regular, $value)) {\r\n\t\t\tif(form_validate_unique($value, $key)){\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn $form_values[$key] .' already in use.<br />';\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn 'Please enter a valid '. $form_values[$key] .'(4-20 characters long).<br />';\r\n\t\t}\r\n\t}\r\n\telseif($key == 'phone'){\r\n\t\t$value = preg_replace('/\\D/', '', $value);\r\n\t\tif(strlen($value) == 11 && substr($value, 0, 1) == 1){\r\n\t\t\t$value = substr($value, 1);\r\n\t\t}\r\n\t\tif(preg_match($regular, $value)){\r\n\t\t\treturn '';\t\t\t\r\n\t\t}\r\n\t\telseif(preg_match($regular2, $value)){\r\n\t\t\treturn 'You need to enter an area code for your '. $form_values[$key] .'<br />';\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn $form_values[$key] .' needs to be valid characters and format 888-888-8888<br />';\r\n\t\t}\r\n\t}\r\n\telseif($key == 'password1' || $key == 'new-registration' || $key == 'add_child' || $key == 'user' || $key == 'address_change' || $key == 'info_change' || $key == 'add_school' || $key == 'password_change'){\r\n\t\treturn '';\r\n\t}\r\n\telse {\r\n\t\tif(preg_match($regular, $value)){\r\n\t\t\treturn '';\t\t\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif($key == 'zip'){\r\n\t\t\t\treturn $form_values[$key] .' needs to be 5 digits, or in the format 12345-1234<br />';\r\n\t\t\t}\r\n\t\t\telseif($key == 'password'){\r\n\t\t\t\treturn 'Your '. $form_values[$key] .' is not valid (Must be 6-20 characters long, contain at least one caps character and one number).<br />';\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn $form_values[$key] .' needs to be valid characters.<br />';\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n}", "public function testAccountsConfigIsNotIncorrect() {\n $accounts = $this->variables['test']['people']['accounts'];\n foreach ($accounts as $key => $value) {\n try {\n $fake = uniqid('value_', TRUE);\n $this->assertNotEquals(\n $fake,\n variable_get($key),\n \"Failed asserting that {$fake} is wrong in {$key}.\"\n );\n }\n catch (Exception $e) {\n $this->handleAssertException($e);\n }\n }\n // Verify if all contexts passed the test.\n $this->checkAllAssertionsPassedWholeTest();\n }", "public function validateAccount()\n {\n if (!$this->hasErrors()) {\n $user = $this->getUser();\n if ($user) {\n if (!$user->isConfirmed()) {\n $this->addError('username', Module::t('login', 'This account in not confirmed.'));\n } elseif (!$user->isActive()) {\n $this->addError('username', Module::t('login', 'This account in not activated.'));\n }\n }\n }\n }", "function error_password($pass, $pass_bis)\n{\n $error = array();\n if (strlen($pass) < 8 || strlen($pass) >= 255)\n array_push($error, \"error password must be longer than 8 and shorter than 255 \");\n if ($pass !== $pass_bis)\n array_push($error, \"password do not match\");\n if (!preg_match(\"/.*[0-9].*/\", $pass))\n array_push($error, \"password must have at least a number in it\");\n return ($error);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query the Business API by business_id
function get_business($business_id) { $business_path = $GLOBALS['BUSINESS_PATH'] . $business_id; return request($GLOBALS['API_HOST'], $business_path); }
[ "function get_business($business_id) {\n $business_path = $GLOBALS['BUSINESS_PATH'] . urlencode($business_id);\n\n return request($GLOBALS['API_HOST'], $business_path);\n }", "function get_business($business_id) {\n $business_path = $GLOBALS['BUSINESS_PATH'] . urlencode($business_id);\n \n return request($GLOBALS['API_HOST'], $business_path);\n}", "function get_business($business_id) {\n $business_path = $GLOBALS['BUSINESS_PATH'] . $business_id;\n \n return request($GLOBALS['API_HOST'], $business_path);\n}", "public function business($id)\n {\n $url = self::BUSINESS_API . '/' . $id;\n\n return $this->callYelpApi($url);\n }", "public function getBusinessById($bId) {\r\n $sqlQuery = \"SELECT * FROM business WHERE businessID = :id\";\r\n\r\n $statement = $this->connection->prepare($sqlQuery);\r\n $params = array(\r\n \"id\" => $bId\r\n );\r\n\r\n $status = $statement->execute($params);\r\n\r\n if (!$status) {\r\n die(\"Could not retrieve business\");\r\n }\r\n\r\n return $statement;\r\n }", "public function getBusinessId()\n {\n return $this->business_id;\n }", "function findBusiness( $id )\r\n {\r\n // Create a database connection\r\n global $dbhost, $dbuser, $dbpass, $dbname;\r\n \r\n $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);\r\n\r\n $query = \"SELECT * from ilr_business WHERE id = $id AND approved=1\";\r\n $result = mysqli_query( $connection, $query );\r\n\r\n if( $result )\r\n {\r\n if ($result->num_rows > 0)\r\n {\r\n return $result->fetch_assoc();\r\n }\r\n }\r\n else {echo \"DID NOT FIND Business\";}\r\n \r\n // close db connection\r\n mysqli_close($connection);\r\n\r\n return 0;\r\n }", "public function get_BusinessId()\n {\n return $this->businessId;\n }", "public function get_business_details($id) {\n $this->db->select('business_details.*');\n $this->db->from('business_details');\n $this->db->where('id', $id);\n $query = $this->db->get();\n $query_result = $query->result();\n if (count($query_result) == 0) {\n $business_details = $query_result;\n } else {\n $business_details = $query_result[0];\n }\n return $business_details;\n }", "public function get($id_business){\n // ->get(['id', 'nombre', 'clave', 'precio_contado', 'precio_oferta', 'avatar', 'thumb'])\n if($id_business == 0){\n $products = Product::where('situacion', 'Activo')->orderBy('created_at', 'DESC')\n ->paginate(20);\n }\n else{\n $products = Product::with(['stocks' => function($q) use($id_business){\n $q->where('business_id', $id_business);\n }])\n ->paginate(20); \n }\n \n return response()->json($products, 200);\n }", "function get_chamber_business(){\r\n $sql = $this->db->prepare(\"SELECT businessID, businessname FROM BUSINESS WHERE chamberID = :chamberid;\");\r\n\r\n $result = $sql->execute(array(\r\n \"chamberid\" => $_SESSION['chamber'],\r\n ));\r\n\r\n if ($result)\r\n return $sql->fetchAll(PDO::FETCH_ASSOC);\r\n else\r\n return false;\r\n }", "public function setBusinessId($var)\n {\n GPBUtil::checkString($var, True);\n $this->business_id = $var;\n }", "public function CallBookingById($id)\n {\n $req = \n \" SELECT *FROM booking\n INNER JOIN clients ON clients.id_client = booking.id_client\n INNER JOIN rooms ON rooms.id_room = booking.id_room\n WHERE id_booking=?\";\n return $this -> queryFetch($req,[$id]);\n \n }", "public function setBusinessId($var)\n {\n GPBUtil::checkInt32($var);\n $this->business_id = $var;\n\n return $this;\n }", "public function searchActiveBusinessByBusinessName($business_name){\n return $this->BusinessModel->searchActiveBusinessByBusinessName(strtolower((string)$business_name)) ;\n }", "private function getBebida(){\n if($this->get_request_method() != \"GET\"){\n $this->response('',406);\n }\n $idBebida = trim($this->_request['id']);\n $bebidaRepository = $this->em->getRepository('Bebida');\n $bebida = $bebidaRepository->find($idBebida);\n if($bebida!=NULL){\n $this->response($this->json($bebida),200);\n }\n $error = array('status' => \"Failed\", \"msg\" => \"Invalid Data\");\n $this->response($this->json($error), 400);\n\n }", "public function getBusiness()\n {\n return $this->business_details;\n }", "public function auBusinessGetBusinessesRequest($query = null, $filter = null, $orderby = null, $top = null, $skip = null, string $contentType = self::contentTypes['auBusinessGetBusinesses'][0])\n {\n\n\n\n\n\n\n\n $resourcePath = '/api/v2/business';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(\n $filter,\n '$filter', // param base name\n 'string', // openApiType\n '', // style\n false, // explode\n false // required\n ) ?? []);\n // query params\n $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(\n $orderby,\n '$orderby', // param base name\n 'string', // openApiType\n '', // style\n false, // explode\n false // required\n ) ?? []);\n // query params\n $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(\n $top,\n '$top', // param base name\n 'integer', // openApiType\n '', // style\n false, // explode\n false // required\n ) ?? []);\n // query params\n $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(\n $skip,\n '$skip', // param base name\n 'integer', // openApiType\n '', // style\n false, // explode\n false // required\n ) ?? []);\n\n // header params\n if ($query !== null) {\n $headerParams['query'] = ObjectSerializer::toHeaderValue($query);\n }\n\n\n\n $headers = $this->headerSelector->selectHeaders(\n ['application/json', 'text/json', 'application/xml', 'text/xml', ],\n $contentType,\n $multipart\n );\n\n // for model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\n }\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {\n # if Content-Type contains \"application/json\", json_encode the form parameters\n $httpBody = \\GuzzleHttp\\Utils::jsonEncode($formParams);\n } else {\n // for HTTP post (form)\n $httpBody = ObjectSerializer::buildQuery($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('apiKey');\n if ($apiKey !== null) {\n $headers['apiKey'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $operationHost = $this->config->getHost();\n $query = ObjectSerializer::buildQuery($queryParams);\n return new Request(\n 'GET',\n $operationHost . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function plinkdsOnBusiness(Request $request){\n $validator = Validator::make($request->all(), [\n 'business_id'=> 'required',\n ]);\n\n if ($validator->fails()) {\n return $this->respondWithValidationError($validator);\n }\n\n try{\n $response = $this->profileService->plinkdsOnBusiness($request);\n if(!$response){\n return response([\"status\"=>false, 'message'=>\"Invalid business id\"], 401); \n }\n return $this->respondWithSuccess($response);\n }\n catch(Exception $e){\n return $this->respondWithInternalServerError($e);\n } \n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the fight athlete records for the associated fightId
public function getByFightId(int $fightId) { $this->setFightId($fightId); $query = "SELECT FA.*, A.AthleteName, F.NumOfRounds FROM FightAthletes FA LEFT JOIN Athletes A on A.AthleteID = FA.AthleteID LEFT JOIN Fights F on FA.FightID = F.FightID WHERE FA.FightID = ?"; $query = $this->db->prepare($query); $query->execute([$this->fightId]); if ($query->rowCount() > 0) { $results = $query->fetchAll(); $this->results = $results; return $results; } return false; }
[ "public function getOne(int $fightAthleteId)\n {\n $this->setFightAthleteId($fightAthleteId);\n\n $query = \"SELECT \n *\n FROM \n FightAthletes \n WHERE\n FightAthleteID = ?\";\n\n $query = $this->db->prepare($query);\n $query->execute([$this->fightAthleteId]);\n\n if ($query->rowCount() > 0) {\n $results = $query->fetchAll();\n\n $this->results = $results;\n\n return $results;\n }\n\n return false;\n }", "public function athlets()\n {\n return $this->hasMany('App\\SportEventAthlete','A_id');\n }", "public function athlete() {\n return $this->hasOne(Athlete::class);\n }", "public function getAthleteInformation($athlete)\r\n {\r\n $sql = 'SELECT \r\n t.Team AS team,\r\n c.Country as country\r\n FROM\r\n countries c,\r\n teams t,\r\n athletes r\r\n WHERE\r\n r.Team_ID=t.id AND\r\n t.Country_ID=c.id AND\r\n r.id ='.$athlete.'\r\n ';\r\n $result = PDODAO::getDataArray($sql);\r\n return $result;\r\n }", "public function athlete() {\n return $this->belongsTo(Athlete::class, 'athlete_id');\n }", "public function allFighters($myid){\n $query=$this->find('all')->where(['player_id' => $myid])->order(['id'=> 'ASC']);\n //mettre la requete dans un tableau\n $allFighter=$query->toArray();\n \n return($allFighter);\n }", "public function athlete()\n {\n return $this->belongsTo(User::class, 'athlete_id');\n }", "public function athlete()\n {\n return $this->belongsTo('App\\Models\\Athlete');\n }", "public function fortFightAction() {\r\n\t\t$fortFightId = $this->params()->fromRoute('id', false);\r\n\t\t\r\n\t\tif(! $fortFightId) {\r\n\t\t\treturn $this->redirect()->toRoute('fort');\r\n\t\t}\r\n\t\t\r\n\t\t// Get information about the fort fight\r\n\t\t$fortFight = $this->getFortModel()->getFortFight($fortFightId);\r\n\t\t\r\n\t\t// Get information about the fort to be attacked\r\n\t\t$fort = $this->getFortModel()->getFort($fortFight->fortID);\r\n\t\t\r\n\t\t$displayOwnerSpecificInfo = false;\r\n\t\tif($this->playerId == $fortFight->owner) {\r\n\t\t\t$displayOwnerSpecificInfo = true;\r\n\t\t}\r\n\t\t\r\n\t\t// Check whether or not the player is in the attacking guild and therefore shall have guild specific info\r\n\t\t$playersInGuild = $this->getPlayerTable()->getPlayersInGuild($fortFight->guildID)->toArray();\r\n\t\t\r\n\t\t$displayGuildSpecificInfo = false;\r\n\t\tforeach($playersInGuild as $player) {\r\n\t\t\tif($player['playerID'] == $this->playerId) {\r\n\t\t\t\t$displayGuildSpecificInfo = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// Get fort fight invitations for this fort fight\r\n\t\t$fortFightInvitations = $this->getFortModel()->getFortFightInvitationsForFortFight($fortFightId)->toArray();\r\n\t\t\r\n\t\t// Get eventual messages in case of redirect\r\n\t\t$messages = $this->getMessageModel()->getMessagesForPlayer($this->playerId);\r\n\t\t\r\n\t\treturn array(\r\n\t\t\t'playerId' => $this->playerId,\r\n\t\t\t'fortFight' => $fortFight,\r\n\t\t\t'fort' => $fort,\r\n\t\t\t'displayOwnerSpecificInfo' => $displayOwnerSpecificInfo,\r\n\t\t\t'displayGuildSpecificInfo' => $displayGuildSpecificInfo,\r\n\t\t\t'playersInGuild' => $playersInGuild,\r\n\t\t\t'fortFightInvitations' => $fortFightInvitations,\r\n\t\t\t'flashMessages' => $this->flashMessenger()->getMessages()\r\n\t\t);\r\n\t}", "public function getFightData ($fight_id=\"current\") {\n\t\tif ($fight_id == \"current\") {\n\t\t\t// is there current phase \"fight\"?\n\t\t\t$current_phase = $this->getMapData()->getDetail ('phase');\n\t\t\tif ($current_phase !== \"fight\") return false;\n\t\t\t\n\t\t\t// just find the last fought fight to return\n\t\t\t$fight_id = $this->getDatabase()->getSingleValue (\"SELECT `fight_id` FROM `user_fight` WHERE `user_id` = \".$this->getId().\" ORDER BY `fight_id` DESC LIMIT 1\");\n\t\t}\n\t\n\t\t$Fight = new CharacterFight ($fight_id);\n\t\t\n\t\treturn ($Fight->exists()) ? $Fight : false;\n\t}", "public function athletes()\n {\n return $this->belongsToMany('App\\Athlete');\n }", "public function fight()\n {\n return $this->belongsToMany('App\\Http\\Models\\Fight', 'character_fight')->withTimestamps()->withPivot(['elo_change', 'elo_result'])->groupBy('fights.id');\n }", "public function get_employee_awards() {\n\t\t$session = $this->session->userdata('username');\n\t\t$id = $session['user_id'];\n\t\t$query = $this->db->query(\"SELECT * FROM awards where employee_id IN($id) order by award_id desc\");\n\t\t return $query->result();\n\t}", "public function getAwards($id) {\n if($this->obj_cnx->getConnect()) {\n\n $query = sprintf(\"SELECT aw.awardName as award FROM movie_has_award maw left join award aw on maw.award_id=aw.id where maw.movie_id = %s;\", $id);\n $res = mysql_query($query);\n return $res;\n }\n }", "public function getIIsGetFightAward()\n {\n return $this->get(self::IISGETFIGHTAWARD);\n }", "function getCombatByHeroId($id) {\n $retValue = false;\n $sql = sprintf(\"SELECT k.id, k.name, k.wert_def, hk.wert\n FROM kampf AS k\n LEFT JOIN held_kampf AS hk ON k.id = hk.id_kampf\n AND hk.id_held = %d;\",\n mysql_real_escape_string($id));\n return $this->queryDB($sql);\n }", "public function getAttraction($id){\n $attraction = Attraction::where('id', $id)->first();\n $attraction->load('details','addresses','addresses.city','addresses.city.districts','addresses.city.districts.country');\n\n //get business hours\n $business_hours = BusinessHours::where('attraction_id', $id)->get();\n\n return response()->json(['message' => 'Attraction by id Successfully Collected', 'data' => $attraction, 'hours' => $business_hours], 200);\n }", "public function get_fixtures_by_league($id_league)\n {\n global $wpdb;\n return $wpdb->get_results($wpdb->prepare(\"SELECT d.number, clhome.name as home_name, claway.name as away_name, g.goal_home, g.goal_away, g.played, g.id as game_id, g.id_team_home, g.id_team_away\n FROM $wpdb->team home, $wpdb->team away, $wpdb->match g, $wpdb->fixture d, $wpdb->club clhome, $wpdb->club claway\n WHERE g.id_team_home = home.id\n AND g.id_team_away = away.id\n AND d.id_league = %d\n AND home.id_club = clhome.id\n AND away.id_club = claway.id\n AND g.id_fixture = d.id\n ORDER BY d.number ASC, g.played ASC, clhome.name ASC\",\n $id_league));\n }", "public function getAthletes($universityID, $sportID)\n {\n return User::whereHas('info.university', function ($query) use ($universityID) {\n return $query->where('id', $universityID);\n })->has('sports')->get()->map(function ($user) {\n return collect(['id' => $user->id, 'name' => $user->fullname()]);\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gin up a random tempbased white setting
public function randomWhite() { $return = array(); $return['ct'] = rand( 150, 500 ); $return['bri'] = rand( 0, 255 ); return $return; }
[ "function set_tempature($season)\n\t{\t\n\t\t// Determine by how many degrees the habitat's temperature will fluctuate from it's average this month.\n\t\tif (mt_rand(1, 1000) > 5) // There is 99.5% chance of normal tempature fluctuation\n\t\t{\n\t\t\t// The tempature is allowed to fluctuate above/below the habitat's average tempature by up to 5 degrees.\n\t\t\t$tempature_modifier = mt_rand(-5, 5); \n\t\t}\n\t\telse // There is a 0.5% chance of extreme tempature fluctuation \n\t\t{\n\t\t\t// The tempature is permitted fluctuate by up to 15 degrees above/below the habitat's average tempature.\n\t\t\t$tempature_modifier = mt_rand(-15, 15); \n\t\t}\n\n\t\treturn $this->current_temperature = $this->average_temperature[$season] + $tempature_modifier; // Apply the fluctuation determined above to the habitat's average temperature taking into account the current season. Set and return the results.\n\t}", "public function warm(){\n\t\t$r = mt_rand(160,255);\n\t\t$g = mt_rand(0,150);\n\t\t$b = mt_rand(0,150);\n\t\t$warmHex = dechex($r . $g . $b);\n\n\t\treturn '#' . $warmHex;\t\t\n\t}", "public function swatRandomWasp()\n {\n $ramainingSwarm = $this->remaining_swarm();\n $swarmIndex = array_rand($ramainingSwarm);\n $ramainingSwarm[$swarmIndex]->swat();\n if($ramainingSwarm[$swarmIndex]->get_type() == \"QUEEN\"){\n if ($ramainingSwarm[$swarmIndex]->get_life() <= 0)\n {\n $_SESSION[\"queen_dead\"] = true;\n }\n }\n }", "protected function getRandomWeight() \n {\n return ((mt_rand(0, 1000) / 1000) - 0.5) / 2;\n }", "public function random()\n {\n $this->number = rand(Guess::GUESS_MIN, Guess::GUESS_MAX);\n $this->tries = 0;\n $this->state = \"INITIATED\";\n $this->recent = 0;\n }", "function toss_it(){\n\t\t\t\t$outcome = mt_rand(0,1);\n\t\t\t\treturn $outcome;\n\t\t\t}", "function mt_srand ($seed = null) {}", "public function useHeater()\n\t{\n\t\t$this->temperature += self::TEMP_VARIANCE;\n\t}", "private function frand()\n {\n return 0.0001 * mt_rand(0, 9999);\n }", "public function random()\n {\n $this->secretNumber = rand(0, 100);\n }", "function noise_saltpepper($image_name, $p, $image_name_noise) \r\n\t\t{\r\n\r\n\t\t\tif ($_SESSION['image_ext'] == \"jpg\" || $_SESSION['image_ext'] == \"jpeg\") \r\n\t\t\t{\r\n\t\t\t\t$image_source = imagecreatefromjpeg($image_name);\r\n\t\t\t}\r\n\t\t\telseif ($_SESSION['image_ext'] == \"png\") \r\n\t\t\t{\r\n\t\t\t\t$image_source = imagecreatefrompng($image_name);\r\n\t\t\t}\r\n\r\n\t\t\t$image_lebar = imagesx($image_source);\r\n\t\t\t$image_tinggi = imagesy($image_source);\r\n\r\n\r\n\r\n\t\t\tfor ($i=0; $i<$image_lebar; $i++) \r\n\t\t\t{\r\n\t\t\t\tfor ($j=0; $j<$image_tinggi; $j++) \r\n\t\t\t\t{\r\n\t\t\t\t\t$a = rand(0, 255);\r\n\t\t\t\t\t$x = round($p/100*$a);\r\n\r\n\t\t\t\t\t$rgb = imagecolorat($image_source, $i, $j);\r\n\r\n\t\t\t\t\t$red =(($rgb >> 16) & 0xFF); \r\n\t\t\t\t\t$green =(($rgb >> 8) & 0xFF);\r\n\t\t\t\t\t$blue = ($rgb & 0xFF);\r\n\r\n\t\t\t\t\t$new_red = validasi($red+$x);\r\n\t\t\t\t\t$new_green = validasi($green+$x);\r\n\t\t\t\t\t$new_blue = validasi($blue+$x);\r\n\r\n\t\t\t\t\tif ($a<$p)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$new_red = 255;\r\n\t\t\t\t\t\t$new_blue = 255;\r\n\t\t\t\t\t\t$new_green = 255;\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t$val = imagecolorallocate($image_source, validasi($new_red), validasi($new_green), validasi($new_blue));\r\n\r\n\t\t\t\t\timagesetpixel($image_source, $i, $j, $val);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ($_SESSION['image_ext'] == \"jpg\" || $_SESSION['image_ext'] == \"jpeg\") {\r\n\t\t\t\timagejpeg($image_source, $_SESSION['image_name_noise']);\r\n\t\t\t}\r\n\t\t\telseif ($_SESSION['image_ext'] == \"png\") {\r\n\t\t\t\timagepng($image_source, $_SESSION['image_name_noise']);\r\n\t\t\t}\r\n\r\n\t\t\treturn $gray;\r\n\t\t}", "public function make_noise();", "public function mutate(): void\n {\n $random = random_int(0, 2);\n if ($random === 0) {\n //mutate register\n $this->register1 = Config::getRandomSourceRegisterIndex();\n } elseif ($random === 1) {\n $this->register2 = Config::getRandomSourceRegisterIndex();\n } else {\n //mutate operator\n $operators = ['<', '>', '=='];\n $this->operator = $operators[random_int(0, 2)];\n }\n }", "public function random()\n {\n $this->setNumber(rand(1, 100));\n }", "function single_trial($cutoff) {\n global $PRIOR_LOWER_MAX;\n $lower_value = $PRIOR_LOWER_MAX * (float) rand() / (float) getrandmax(); \n $higher_value = 2 * $lower_value;\n if (rand(0, 1) == 0) {\n return $lower_value >= $cutoff ? $lower_value : $higher_value;\n } else {\n return $higher_value >= $cutoff ? $higher_value : $lower_value;\n }\n}", "function _seedRandom() {\n if(!$this->_srand) {\n srand((double)microtime() * 1000000);\n $this->_srand = true;\n }\n }", "function Random($MultiRandom = true){\n\tglobal $counter;\n\tglobal $seed;\n\tglobal $discard;\n\t//If we're using the \"Battle RNG\" value, we throw away that many values before keeping one.\n\t$discarded = 0; //Throw away this many values\n\tif($MultiRandom == true){\n\t\t$discarded = $discard + 1;\n\t}\n\tfor($j = 0; $j < $discarded+1; $j++){\n\t\tfor ($i = 0; $i < 16; $i++){\n\t\t\t$seed = (($seed << 1) % 65536) ^ ((($seed >> 15) ^ 1) ? 0x1021 : 0);\n\t\t\tif($seed >= 65536) $seed = $seed % 65536;\n\t\t}\n\t\t$counter++;\n\t\tif($counter >= 256) $counter = $counter % 256;\n\t}\n\treturn ($counter + $seed) % 256;\n}", "function random_0_1()\r\n{\r\n\treturn (float)rand()/(float)getrandmax();\r\n}", "function genereer_min() {\n\t\t// $uitkomst tijdelijke variabele ipv de this versie?\n\t\t$this->uitkomst = 2 * $this->bovengrens;\n\t\twhile ($this->uitkomst > $this->bovengrens) {\n\t\t\t$this->getal1 = rand($this->ondergrens,$this->bovengrens);\n\t\t\t$this->getal2 = rand($this->ondergrens,$this->bovengrens);\n\t\t\t$this->verwissel();\n\t\t\t$this->uitkomst = $this->getal1 - $this->getal2;\n\t\t\tif ($this->uitkomst < 0) $this->uitkomst = 2 * $this->bovengrens; // overbodig ivm verwissel??\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }