query
stringlengths 9
43.3k
| document
stringlengths 17
1.17M
| metadata
dict | negatives
listlengths 0
30
| negative_scores
listlengths 0
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Loads Work Experience instance information from the database | public function load($id)
{
$id = $this->db->real_escape_string($id);
if (!$result = $this->db->query("SELECT * FROM `work_experience` WHERE `id` = '$id';")) {
throw new \mysqli_sql_exception("Oops! Something has gone wrong on our end. Error Code: workExperienceLoad");
}
$result = $result->fetch_assoc();
$this->id = $id;
$this->owner_id = $result['owner_id'];
$this->role = $result['role'];
$this->employer = $result['employer'];
$this->duration = $result['duration'];
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function loadExperiences() {\n\t\t\t$query = \"SELECT id\n\t\t\t\tFROM test_experience\n\t\t\t\tWHERE userid = $1\n\t\t\t\tORDER BY startyear ASC, endyear ASC\";\n\t\t\t\t\n\t\t\t$args = array('id' => $this->getID());\n\t\t\t\n\t\t\t$result = $this->getDBConn()->query($query, $args);\n\t\t\t\n\t\t\tforeach($result as &$row) {\n\t\t\t\t$exp = new Experience();\n\t\t\t\t$exp->setDBConn($this->getDBConn());\n\t\t\t\t$exp->setID($row->id);\n\t\t\t\t$this->addExperience($row->id, $exp);\n\t\t\t}\n\t\t\t\n\t\t}",
"private function load()\r\n {\r\n $this->dbFields = MySQL::fetchRecord(MySQL::executeQuery('SELECT * FROM training_slideshow WHERE ts_id='.(int)$this->id),MySQL::fmAssoc);\r\n }",
"public function getExperience();",
"public function loadData(){\r\n $this->host = Team::find($this->host);\r\n $this->guest = Team::find($this->guest);\r\n $this->winner = Team::find($this->winner);\r\n $this->tournament = Tournament::find($this->tournamentID); \r\n }",
"protected function load(){\r\n\t\r\n\t$qq1 = Db::result(\"SELECT * FROM \"._SQLPREFIX_.$this->tableName.\" WHERE \".$this->fieldName.\" = \".(int)$this->id);\r\n\t$this->profileData = count($qq1)>0 ? $qq1[0]: null; \r\n\t\r\n\tif($this->metaUse){\r\n\t\t$qq2 = Db::result(\"SELECT * FROM \"._SQLPREFIX_.$this->metaTypesTableName.\" WHERE active = 1 ORDER BY public_ord, id\");\r\n\t\t$this->metaData = count($qq2)>0 ? $qq2: array(); \r\n\t}\r\n}",
"public function loadTheInstance();",
"public function run()\r\n {\r\n $expetrienceType = new ExperienceType();\r\n $expetrienceType->name = 'Project';\r\n $expetrienceType->save();\r\n }",
"public function show(Experience $experience)\n {\n //\n }",
"public function show(WorkExperience $workExperience)\n {\n return response($workExperience, 200);\n }",
"public function load(){\n parent::load();\n \n if($this->load_class)\n {\n // poziom wyksztalcenia nazwa\n $this->education_type_name = ClassEducationType::sqlGetItemNameByIdParent($this->id_education_type);\n \n // Nazwa statusu\n $this->status_name = ClassSoldierStatus::sqlGetItemNameByIdParent($this->id_status);\n \n // Zmiana daty na polski format\n $this->date_birthday = date('d.m.Y', strtotime($this->date_birthday));\n \n // nazwa plci\n $this->sex_name = self::getSexName($this->sex);\n \n // nazwa jednostki wojskowej\n $military = new ClassMilitary($this->id_military);\n $this->military_name = $military->name.', '.$military->location;\n }\n }",
"public function loadFromDB()\n {\n }",
"public function getEmployeeInfo() {\n\n $employeeModel = $GLOBALS[\"employeeModel\"];\n\n $GLOBALS[\"employee\"] = $employeeModel->getOneByEmployeeID($_SESSION[\"workerID\"]);\n }",
"function load() {\n\t\tglobal $mysql;\n //if(!$this->exists()) return;\n \t$id \t\t= $mysql->escape($this->id);\n \t$tablename \t= $this->class_name();\n \t$this->data = $mysql->executeSql(\"SELECT * FROM \".$tablename.\" WHERE id=$id;\");\n \t$this->id\t= $this->data['id'];\n \tunset($this->data['id']);\n }",
"private final function loadObjectFromDb()\n {\n # TODO: would be far preferable to use the objectsFromDestinations() code, possibly by refactoring into another shareable function. this is needed because otherwise we're in object A and OrmClass->load() is generating object B, instead of populating object A\n # TODO:NOTE01\n # TODO: must use $this->setLoadedFromDb() per class\n throw new Exception('TODO');\n }",
"public static function load_from_db() {\n // Sanitize $view;\n $view = isset($_GET['view']) ? (integer) $_GET['view'] : 0;\n $view = $view ? $view : false;\n System::$instances = db_get($view);\n }",
"public function loadModel()\n {\n $data = Contest::find($this->modelId);\n $this->title = $data->title;\n $this->description = $data->description;\n $this->image = $data->image;\n $this->featured_image = $data->featured_image;\n\n }",
"public function findById($experience_id);",
"public function load()\n {\n Registry::getPostgres()->transactional(function ($postgres) {\n $majorApiConfig = Registry::getMajorApiConfig();\n\n // Purges the database.\n $postgres->createQueryBuilder()\n ->delete('web_account')\n ->execute();\n\n // Create a new Account entity.\n $account = [\n 'created' => Registry::getTimeString(),\n 'updated' => Registry::getTimeString(),\n 'status' => Registry::STATUS_ENABLED,\n 'email' => $majorApiConfig['test_account_email'],\n 'password_hash' => $majorApiConfig['test_account_password'],\n 'first_name' => 'Vic',\n 'last_name' => 'Cherubini',\n 'role' => 'ROLE_ACCOUNT'\n ];\n\n $postgres->insert('web_account', $account);\n $accountId = $postgres->lastInsertId('web_account_id_seq');\n\n // Create a new Application entity.\n $application = [\n 'created' => Registry::getTimeString(),\n 'updated' => Registry::getTimeString(),\n 'status' => Registry::STATUS_ENABLED,\n 'account_id' => $accountId,\n 'name' => $majorApiConfig['test_application_username'],\n 'username' => $majorApiConfig['test_application_username'],\n 'api_key' => uniqid(),\n 'quickbooks_token' => uniqid()\n ];\n\n $postgres->insert('web_application', $application);\n $applicationId = $postgres->lastInsertId('web_application_id_seq');\n });\n\n return true;\n }",
"public function show(experience $experience)\n {\n //\n }",
"public function run()\n {\n Experience::create(['name'=>'Aventura','description'=>'Aventura']);\n Experience::create(['name'=>'Belleza y Salud','description'=>'Belleza y Salud']);\n Experience::create(['name'=>'Cursos y Talleres','description'=>'Cursos y Talleres']);\n Experience::create(['name'=>'Deporte','description'=>'Deporte']);\n Experience::create(['name'=>'Entretenimiento','description'=>'Entretenimiento']);\n Experience::create(['name'=>'Fiesta y Juerga','description'=>'Fiesta y Juerga']);\n Experience::create(['name'=>'Fotografía y Video','description'=>'Fotografía y Video']);\n Experience::create(['name'=>'Gastronomía','description'=>'Gastronomía']);\n\n }",
"function loadFromDb()\n\t{\n\t\tglobal $ilDB;\n\t\t$result = $ilDB->queryF(\"SELECT * FROM svy_svy WHERE obj_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getId())\n\t\t);\n\t\tif ($result->numRows() == 1) \n\t\t{\n\t\t\t$data = $ilDB->fetchAssoc($result);\n\t\t\t$this->setSurveyId($data[\"survey_id\"]);\n\t\t\t$this->setAuthor($data[\"author\"]);\n\t\t\tinclude_once(\"./Services/RTE/classes/class.ilRTE.php\");\n\t\t\t$this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc($data[\"introduction\"], 1));\n\t\t\tif (strcmp($data[\"outro\"], \"survey_finished\") == 0)\n\t\t\t{\n\t\t\t\t$this->setOutro($this->lng->txt(\"survey_finished\"));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->setOutro(ilRTE::_replaceMediaObjectImageSrc($data[\"outro\"], 1));\n\t\t\t}\n\t\t\t$this->setInvitation($data[\"invitation\"]);\n\t\t\t$this->setInvitationMode($data[\"invitation_mode\"]);\n\t\t\t$this->setShowQuestionTitles($data[\"show_question_titles\"]);\n\t\t\t$this->setStartDate($data[\"startdate\"]);\n\t\t\t$this->setEndDate($data[\"enddate\"]);\n\t\t\t$this->setAnonymize($data[\"anonymize\"]);\n\t\t\t$this->setEvaluationAccess($data[\"evaluation_access\"]);\n\t\t\t$this->loadQuestionsFromDb();\n\t\t\t$this->setStatus($data[\"status\"]);\n\t\t\t$this->setMailNotification($data['mailnotification']);\n\t\t\t$this->setMailAddresses($data['mailaddresses']);\n\t\t\t$this->setMailParticipantData($data['mailparticipantdata']);\n\t\t\t$this->setTemplate($data['template_id']);\n\t\t\t$this->setPoolUsage($data['pool_usage']);\n\t\t\t// 360°\n\t\t\t$this->set360Mode($data['mode_360']);\n\t\t\t$this->set360SelfEvaluation($data['mode_360_self_eval']);\n\t\t\t$this->set360SelfRaters($data['mode_360_self_rate']);\n\t\t\t$this->set360SelfAppraisee($data['mode_360_self_appr']);\n\t\t\t$this->set360Results($data['mode_360_results']);\n\t\t\t$this->set360SkillService($data['mode_360_skill_service']);\n\t\t\t// reminder/notification\n\t\t\t$this->setReminderStatus($data[\"reminder_status\"]);\n\t\t\t$this->setReminderStart($data[\"reminder_start\"] ? new ilDate($data[\"reminder_start\"], IL_CAL_DATE) : null);\n\t\t\t$this->setReminderEnd($data[\"reminder_end\"] ? new ilDate($data[\"reminder_end\"], IL_CAL_DATE) : null);\n\t\t\t$this->setReminderFrequency($data[\"reminder_frequency\"]);\n\t\t\t$this->setReminderTarget($data[\"reminder_target\"]);\n\t\t\t$this->setReminderLastSent($data[\"reminder_last_sent\"]);\n\t\t\t$this->setTutorNotificationStatus($data[\"tutor_ntf_status\"]);\n\t\t\t$this->setTutorNotificationRecipients(explode(\";\", $data[\"tutor_ntf_reci\"]));\n\t\t\t$this->setTutorNotificationTarget($data[\"tutor_ntf_target\"]);\n\t\t\t\n\t\t\t$this->setViewOwnResults($data[\"own_results_view\"]);\n\t\t\t$this->setMailOwnResults($data[\"own_results_mail\"]);\n\t\t}\n\t\t\n\t\t// moved activation to ilObjectActivation\n\t\tif($this->ref_id)\n\t\t{\n\t\t\tinclude_once \"./Services/Object/classes/class.ilObjectActivation.php\";\n\t\t\t$activation = ilObjectActivation::getItem($this->ref_id);\t\t\t\n\t\t\tswitch($activation[\"timing_type\"])\n\t\t\t{\t\t\t\t\n\t\t\t\tcase ilObjectActivation::TIMINGS_ACTIVATION:\t\n\t\t\t\t\t$this->setActivationLimited(true);\n\t\t\t\t\t$this->setActivationStartDate($activation[\"timing_start\"]);\n\t\t\t\t\t$this->setActivationEndDate($activation[\"timing_end\"]);\n\t\t\t\t\t$this->setActivationVisibility($activation[\"visible\"]);\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tdefault:\t\t\t\n\t\t\t\t\t$this->setActivationLimited(false);\n\t\t\t\t\tbreak;\t\t\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t}",
"public function run()\n {\n $expertise1 = new Expertise();\n $expertise1->name = 'Politik';\n $expertise1->save();\n\n $expertise2 = new Expertise();\n $expertise2->name = 'Sport';\n $expertise2->save();\n\n $expertise3 = new Expertise();\n $expertise3->name = 'Musik';\n $expertise3->save();\n }",
"private function load_interests(){\r\n $db = new Database();\r\n $sql = \"select * from \" . Person::PERSON_INTEREST_TABLE . \" where person_id=:person_id\";\r\n $stm = $db->pdo->prepare($sql);\r\n $stm->bindParam(':person_id', $this->id);\r\n $stm->execute();\r\n $its = $stm->fetchAll();\r\n foreach($its as $it){\r\n $this->interests[] = Interest::with_id($it[\"interest_id\"]);\r\n }\r\n }",
"public function info($experience_id = null){\n \n if($experience_id != null){\n $this->Experience->id = $experience_id;\n if (!$this->Experience->exists()) {\n throw new NotFoundException(__(\"Cette experience n'existe plus\"));\n }\n }\n \n //sets motives by alphabetical order\n $this->set('motives', $this->Experience->Motive->find('list', array(\n 'order' => array('Motive.name' => 'ASC'))));\n \n //set notification types by alphabetical order\n $this->set('typenotifications', $this->Experience->Typenotification->find('list', array(\n 'order' => array('Typenotification.id' => 'DESC'))));\n \n //includes google maps script for place autocomplete\n \t$this->set('jsIncludes',array('http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&language=fr&libraries=places','places_autocomplete', 'establishment_autocomplete'));\n \n $user_id = $this->Auth->user('id');\n $this->request->data['Experience']['user_id'] = $user_id;\n \n if ($this->request->is('post') || $this->request->is('put')) {\n \n $dateStart = $this->data['Experience']['dateStart']['year'].'-'.$this->data['Experience']['dateStart']['month'].'-'.$this->data['Experience']['dateStart']['day'];\n $dateEnd = $this->data['Experience']['dateEnd']['year'].'-'.$this->data['Experience']['dateEnd']['month'].'-'.$this->data['Experience']['dateEnd']['day'];\n \n //checks that dateEnd is after dateStart\n if ($dateEnd < $dateStart) {\n $this->Session->setFlash(__(\"La date de fin doit être après la date de début\"), 'alert', array(\n 'plugin' => 'BoostCake',\n 'class' => 'alert-danger'\n )); \n return;\n }\n \n //decrements experience number for this place if user is editing experience\n if($experience_id != null){\n $experience = $this->Experience->findById($experience_id);\n $this->_upload_experienceNumber($experience['Experience']['city_id'],-1);\n }\n \n //sets experience city id\n $city_id = $this->_createCityAndCountryIfNeeded($this->request->data, $this->request->data['City']);\n $this->request->data['Experience']['city_id'] = $city_id;\n \n //sets experience id if user is editing experience\n if($experience_id != null){\n $this->request->data['Experience']['id'] = $experience_id;\n }\n \t\n $this->Experience->create();\n \n //saves experience and increments experience number for this place\n if ($this->Experience->save($this->request->data) && $this->_upload_experienceNumber($city_id,1)) {\n \n $experience_id = $this->Experience->id;\n $experience = $this->Experience->findById($experience_id);\n \n $this->Session->setFlash(__(\"Les modifications ont bien été enregistrées\"), 'alert', array(\n 'plugin' => 'BoostCake',\n 'class' => 'alert-success'\n ));\n return $this->redirect(array('controller'=>'users', 'action' => 'profile')); \n }\n $this->Session->setFlash(__(\"Erreur lors de l'enregistrement\"), 'alert', array(\n 'plugin' => 'BoostCake',\n 'class' => 'alert-danger'\n ));\n }\n else{\n $this->request->data = $this->Experience->find('first', array('conditions' => array('Experience.id' => $experience_id), 'recursive' => 1));\n //sets countries\n $this->set('countries',$this->Experience->City->Country->find('list'));\n }\n }",
"public function loadModel()\n {\n $data = ModelsPegawai::find($this->dataId);\n $this->name = $data->name;\n $this->email = $data->email;\n $this->username = $data->username;\n $this->password = $data->password;\n $this->level = $data->level;\n\n }",
"public function loadProfileInformation() {\n\t\t\t$procedure = \"get\" . $this->mode_ . \"Information\"; \n\t\t\t$this->profileInformation_ = $this->dbHandler_->call($procedure, \"%d\", array($this->id_));\n\t\t}",
"public function load() {\n $this->homes = new Flintstone('homes', ['dir' => $this->plugin->getDataFolder(), 'gzip' => true]);\n\n # Check if we should migrate EssentialsTP data.\n if(count($this->homes->getAll()) === 0) {\n if(file_exists($this->plugin->getServer()->getPluginPath().'essentialsTP/essentials_tp.db')) {\n\n $essentialsDB = new \\SQLite3($this->plugin->getServer()->getPluginPath().'essentialsTP/essentials_tp.db');\n\n $sql = 'SELECT * FROM homes';\n\n $result = $essentialsDB->query($sql);\n\n while($row = $result->fetchArray(SQLITE3_ASSOC)) {\n $this->setHome(\n $row['player'],\n [\n 'name' => $row['title'],\n 'world' => $row['world'],\n 'x' => $row['x'],\n 'y' => $row['y'],\n 'z' => $row['z'],\n 'yaw' => 0.00,\n 'pitch' => 0.00,\n ]\n );\n $this->plugin->getLogger()->info('Imported a home for '.$row['player']);\n }\n\n # All done, close down the database.\n $essentialsDB->close();\n\n }\n }\n }",
"function load(){\n $sql = 'SELECT * FROM worlds where id=?';\n $w = $this->app['db']->fetchAssoc($sql, array($this->id));\n if(!$w){ \n return false;\n }\n $this->name = $w['name'];\n $this->world = $w['world_json'];\n return true;\n }",
"public function launch()\n {\n // $someModel->setConnection('mysql2');\n // $something = $someModel->find(1);\n // return $something;\n\n $agent=DB::connection('mysql2')->table('biller_profits')->first();\n dd($agent);\n // $blogs = DB::table('blogs')->orderBy('id', 'desc')->paginate(6);\n }",
"public static function load_work_periods($args = array()){\n $default_args = array(\n 'custom_date' => false, \n 'week_day' => false, \n 'service_id' => 0, \n 'agent_id' => 0, \n 'location_id' => 0, \n 'flexible_search' => true);\n if(isset($args['location_id']) && ($args['location_id'] === false)) $args['location_id'] = 0;\n if(isset($args['agent_id']) && ($args['agent_id'] === false)) $args['agent_id'] = 0;\n if(isset($args['service_id']) && ($args['service_id'] === false)) $args['service_id'] = 0;\n $args = array_merge($default_args, $args);\n\n OsWorkPeriodsHelper::set_default_working_hours();\n\n $work_periods_model = new OsWorkPeriodModel();\n $query_args = array();\n\n // Service query\n if($args['flexible_search'] && $args['service_id']){\n $query_args['service_id']['OR'] = array($args['service_id'], 0);\n }else{\n // search only for schedules that belong to passed service_id\n $query_args['service_id'] = $args['service_id'];\n }\n\n // Agent query\n if($args['flexible_search'] && $args['location_id']){\n $query_args['location_id']['OR'] = array($args['location_id'], 0);\n }else{\n // search only for schedules that belong to passed location_id\n $query_args['location_id'] = $args['location_id'];\n }\n\n // Agent query\n if($args['agent_id'] !== LATEPOINT_ALL){\n if($args['flexible_search'] && $args['agent_id']){\n $query_args['agent_id']['OR'] = array($args['agent_id'], 0);\n }else{\n // search only for schedules that belong to passed agent_id\n $query_args['agent_id'] = $args['agent_id'];\n }\n }\n\n // Week Day\n if($args['week_day'] && in_array($args['week_day'], OsUtilHelper::get_weekday_numbers())){\n $query_args['week_day'] = $args['week_day'];\n }\n\n // Custom Date\n if($args['custom_date']){\n $date_obj = new OsWpDateTime($args['custom_date']);\n $week_day = $date_obj->format('N');\n if($args['flexible_search']){\n $query_args['custom_date']['OR'] = array($date_obj->format('Y-m-d'), 'IS NULL');\n }else{\n $query_args['custom_date'] = $date_obj->format('Y-m-d');\n }\n $query_args['week_day'] = $week_day;\n }else{\n $query_args['custom_date'] = 'IS NULL';\n }\n\n $work_periods = $work_periods_model->where($query_args)->order_by('agent_id DESC, service_id DESC, location_id DESC, custom_date DESC, start_time asc')->get_results_as_models();\n // OsDebugHelper::log($work_periods_model->last_query);\n if($args['agent_id'] !== LATEPOINT_ALL){\n $work_periods = self::filter_periods($work_periods);\n }\n return $work_periods;\n }"
]
| [
"0.65872914",
"0.60283357",
"0.5895692",
"0.58336806",
"0.56206644",
"0.5442933",
"0.5407902",
"0.5384161",
"0.537604",
"0.5350523",
"0.53314996",
"0.5328047",
"0.5291346",
"0.52488106",
"0.5238636",
"0.5225366",
"0.5219189",
"0.5203415",
"0.51990175",
"0.51943463",
"0.51778513",
"0.5169692",
"0.5136073",
"0.51303345",
"0.5079448",
"0.50750005",
"0.5058495",
"0.50477386",
"0.5037767",
"0.5015017"
]
| 0.6088723 | 1 |
Saves the Work Experience instance information to the database | public function save()
{
$owner_id = $this->owner_id ?? "NULL";
$role = $this->role ?? "NULL";
$role = $this->db->real_escape_string($role);
$employer = $this->employer ?? "NULL";
$employer = $this->db->real_escape_string($employer);
$duration = $this->duration ?? "NULL";
$duration = $this->db->real_escape_string($duration);
if (!isset($this->id)) {
if (!$result = $this->db->query("INSERT INTO `work_experience` VALUES (NULL, '$owner_id', '$role', '$employer', '$duration');")) {
throw new \mysqli_sql_exception("Oops! Something has gone wrong on our end. Error Code: workExpSaveNew");
}
$this->id = $this->db->insert_id;
} else {
if (!$result = $this->db->query(
"UPDATE `work_experience` SET `owner_id` = '$owner_id', `role` = '$role', `employer` = '$employer',
`duration` = '$duration' WHERE `id` = $this->id;"
)
) {
throw new \mysqli_sql_exception("Oops! Something has gone wrong on our end. Error Code: workExpSaveExisting");
}
}
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function saveToDb() {\n parent::saveToDb();\n\n require_once 'models/Location.php';\n Location::saveToDb($this->preferredLocation);\n Location::saveToDb($this->currentLocation);\n\n require_once 'libs/DB.php';\n $conn = DB::connect();\n\n $seekerId = $this->id();\n\n // Update the seeker table\n $conn->exec(\"UPDATE seeker SET experience='$this->experience', pref_location_name='$this->preferredLocation', curr_location_name='$this->currentLocation' WHERE id='$seekerId'\");\n\n require_once 'models/Skill.php';\n foreach($this->skills as $skill) {\n Skill::saveToDb($skill);\n }\n\n // Delete old skills\n $conn->exec(\"DELETE FROM seeker_skill WHERE seeker_id='$seekerId'\");\n\n // Add new skills\n foreach($this->skills as $skill) {\n $conn->exec(\"INSERT INTO seeker_skill(seeker_id, skill_name) VALUES('$seekerId', '$skill')\");\n }\n }",
"public function save() {\n $db = Db::instance();\n $db_properties = array(\n 'action' => $this->action,\n 'url_mod' => $this->url_mod,\n 'description' => $this->description,\n 'target_id' => $this->target_id,\n 'target_name' => $this->target_name,\n 'creator_id' => $this->creator_id,\n 'creator_username' => $this->creator_username\n );\n $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);\n }",
"public function save()\n {\n $this->checkForNecessaryProperties();\n\n $this->update($this->getCurrentId(), $this->data);\n }",
"public function run()\r\n {\r\n $expetrienceType = new ExperienceType();\r\n $expetrienceType->name = 'Project';\r\n $expetrienceType->save();\r\n }",
"public function store(Request $request)\n {\n //\n $experience = new Experience;\n $experience->user_id = auth()->user()->id;\n $experience->workplace = request('work');\n $experience->from = request('from');\n $experience->to = request('to');\n $experience->desc_1 = request('desc_1');\n $experience->desc_2 = request('desc_2');\n $experience->desc_3 = request('desc_3');\n $experience->save();\n }",
"public function store(Request $request)\n {\n //return 'ok';\n \n $data = new Experience;\n $data->user_id = session('user.id');\n $data->resume_id = session('resume_id');\n $data->job_title = $request->job_title;\n $data->employer = $request->employer;\n $data->city = $request->city; \n $data->state = $request->state; \n $data->start_date = $request->start_date; \n $data->end_date = $request->end_date; \n $data->still_working = $request->still_working;\n $data->save();\n $experience_id= $data->id;\n\n session()->put('job_title', $request->job_title);\n session()->put('experience_id', $experience_id);\n \n return redirect()->route('experience-details')->with(session()->flash('alert-success', 'Work experience has been saved successfully!'));\n }",
"public function save() {}",
"public function save() {}",
"public function save() {}",
"protected function save()\n\t{\n\t\t$this->saveItems();\n\t\t//$this->saveAssignments();\n\t\t//$this->saveRules();\n\t}",
"public function save()\n\t{\n\t\n\t\tif ($this->id == null) throw new Exception(\"Cannot save. id is null\");\n\t\t\n\t\t//store the data in the content column so that our worker will be searchable.\n\t\t$wp_content = \"\";\n\t\t\n\t\tforeach($this->values as $field=>$value)\n\t\t{\n\t\t\tupdate_post_meta($this->id, $field, $value);\n\t\t\t$wp_content .= \"<div>$value</div>\";\n\t\t}\n\t\t\n\t\t//wp_die($wp_content);\n\n\t\t//save the data entry in wp_posts\n\t\tglobal $wpdb;\n\t\t$wpdb->update(\n\t\t\t$wpdb->posts, \n\t\t\tarray(\n\t\t\t\t\"post_content\" => $wp_content,\n\t\t\t\t\"post_title\" => \"{$this->values['lastname']}, {$this->values['firstname']} {$this->values['middlename']}\" \n\t\t\t),\n\t\t\tarray(\"ID\" => $this->id),\n\t\t\tarray(\"%s\"),\n\t\t\tarray(\"%d\")\n\t\t);\n\t\t\n\t\t\n\t}",
"public function store(ExperienceRequest $request)\n {\n $experience = Experience::create($request->all());\n if($request->current){\n $experiences = Experience::where('id', '<>', $experience->id)->get();\n foreach ($experiences as $experience) {\n $experience->current = false;\n $experience->update();\n }\n }\n Flashy::message('Experience Added Successfully', route('experiences.index'));\n return redirect()->route('experiences.index');\n }",
"public function save() {\n $db = Db::instance();\n // omit id \n $db_properties = array(\n 'firstName' => $this->firstName,\n 'lastName' => $this->lastName,\n 'description' => $this->description,\n 'user' => $this->user,\n 'password' => $this->password,\n 'image' => $this->image,\n 'gender' => $this->gender,\n 'topic_id' => $this->topic_id,\n 'topic_id1' => $this->topic_id1,\n 'role_id' => $this->role_id,\n );\n $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);\n }",
"public function saveAction(){\n //d'you post?\n if ($this->getRequest()->isPost()){\n $knight = $this->getKnight();\n $knight->setName( $this->getRequest()->getPost(\"name\") );\n $knight->setArmor( $this->getRequest()->getPost(\"armor\") );\n //persist the knight\n $this->getDM()->persist($knight);\n $this->getDM()->flush();\n }\n //go back to home (indexAction) to show the grid of knights\n $this->redirect()->toRoute(\"home\");\n }",
"public function save()\n {\n $this->save_meta_value('_sim_city_main_info', $this->city_main_info);\n\n $this->save_meta_value('_sim_city_shops', $this->city_shops);\n }",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();",
"public function save();"
]
| [
"0.6872893",
"0.6741848",
"0.6596988",
"0.6438809",
"0.6285333",
"0.628445",
"0.6226343",
"0.6226343",
"0.6225878",
"0.6196731",
"0.61889",
"0.6156235",
"0.6103569",
"0.60649776",
"0.6042066",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423",
"0.6039423"
]
| 0.71726793 | 0 |
Find Monday prints out the previous monday. Scott Hurring scott at hurring dot com | function get_monday($startdate = null, $week_offset = 0) {
if ($startdate) {
$startdate = strtotime($startdate);
} else {
$startdate = time();
}
$dow = date("w", $startdate);
//print "Today is dow $dow (Monday is 1)\n";
// How many days ago was monday?
$offset = ($dow -1);
if ($offset <0) {
$offset = 6;
}
//print "Offset = $offset\n";
if ($week_offset > 0) {
$offset = $offset - ($week_offset * 7);
}
$monday = date("Y-m-d", mktime(0,0,0,date('m', $startdate), date('d', $startdate)-$offset, date('Y', $startdate) ));
//print "Previous monday is $monday";
return $monday;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function find_start_of_week()\n {\n $this->move_to_start_of_day();\n $this->move_to_start_of_day();\n while ($this->get_day_of_week()>0)\n {\n $this->move_forward_n_days(-1);\n }\n }",
"function next_weekday($weekday) {\n global $week_names;\n $date = new DateTime();\n $i = (int)$date->format(\"w\"); // 0=Sunday\n $j = array_search($weekday, $week_names); // 0=Monday\n $diff = (($j+1) - $i + 7); // days til next $weekday [0..6]\n $diff = ($diff+6)%7+1; // days til next $weekday [1..7]\n $date->modify(\"+$diff days\");\n return $date;\n}",
"function nextWeek(){ return $this->_getDate(7);\t}",
"function previousWeek(){ return $this->_getDate(-7); }",
"function week_class($monday) {\n $class = '';\n \n $this_monday = get_monday();\n \n if ($monday == $this_monday) {\n $class = 'currentweek';\n } elseif ($monday < $this_monday) {\n $class = 'past';\n }\n \n \n \n return $class;\n}",
"function lastDayOfWeek($year,$month,$day){\n global $ld;\n $dayOfWeek=date(\"w\");\n $saturday_offset=(6-$dayOfWeek) * 60 * 60 * 24 ;\n $ld = date(\"Y-m-d\", mktime(0,0,0,$month,$day+1,$year) + $saturday_offset);\n return $ld;\n}",
"public static function getNextWeek(){\n\t\t\t$cur = DB::select('SELECT WEEKDAY((SELECT CURDATE())) as cur')[0]->cur;\n\n\t\t\t// SQL find this monday\n\t\t\t$fir = DB::select('SELECT DATE_SUB( (SELECT CURDATE()), INTERVAL ?-6 DAY) as fir', array($cur))[0]->fir;\n\t\t\t$firstDay = DB::select('SELECT UNIX_TIMESTAMP(?) as firstDay', array($fir))[0]->firstDay;\n\n\t\t\t// SQL find this sunday\n\t\t\t$lst = DB::select('SELECT DATE_SUB( (SELECT CURDATE()), INTERVAL ?-12 DAY) as lst', array($cur))[0]->lst;\n\t\t\t$lastDay = DB::select('SELECT UNIX_TIMESTAMP(?) as lastDay', array($lst))[0]->lastDay;\n\n\t\t\t// Number, String\n\t\t\treturn array(array($firstDay, $lastDay + 86399), array($fir, $lst));\n\n\t\t}",
"function getFirstDayOfWeek($y=NULL, $m=NULL, $d=NULL)\n {\n return 1;\n }",
"function mondayFirst()\r\n {\r\n if ( $this->MondayFirst == \"yes\" )\r\n {\r\n return true;\r\n }\r\n else\r\n {\r\n return false;\r\n }\r\n }",
"public function mondays()\n {\n return $this->days(1);\n }",
"public function getMondayOfTheWeek($date) {\n $weekno = self::getISOWeekNo($date);\n return date('Y-m-d', strtotime(\"$date - $weekno days\"));\n }",
"public function getWeekDay($day)\n {\n return dt('%A', strtotime('next Monday +'.($day - 1).' days'));\n }",
"function get_day_of_week()\n {\n if (date(\"D\", $this->timestamp)==\"Sun\")\n {\n return 0;\n } else if (date(\"D\", $this->timestamp)==\"Mon\")\n {\n return 1;\n } else if (date(\"D\", $this->timestamp)==\"Tue\")\n {\n return 2;\n } else if (date(\"D\", $this->timestamp)==\"Wed\")\n {\n return 3;\n } else if (date(\"D\", $this->timestamp)==\"Thu\")\n {\n return 4;\n } else if (date(\"D\", $this->timestamp)==\"Fri\")\n {\n return 5;\n } else if (date(\"D\", $this->timestamp)==\"Sat\")\n {\n return 6;\n } else\n {\n return \"error\";\n }\n }",
"public function skipWeekend()\r\n {\r\n if ($this->getDayOfWeek() == 7)\r\n {\r\n $this->addDay(1);\r\n }\r\n else if ($this->getDayOfWeek() == 6)\r\n {\r\n $this->addDay(2);\r\n }\r\n }",
"public function _getWeekBeginningDate($date) {\n\t\t$dateTime = strtotime(\"2:00 \" . $date);\n\t\tif(date('w',$dateTime) == '1') {\n\t\t\t// It's Monday, so return the same date\n\t\t\treturn $dateTime;\n\t\t} else {\n\t\t\t// return last Monday's date\n\t\t\treturn strtotime('this week last monday', $dateTime);\n\t\t}\n\t}",
"function firstDayOfWeek($year,$month,$day){\n global $fd;\n $dayOfWeek=date(\"w\");\n $sunday_offset=$dayOfWeek * 60 * 60 * 24;\n $fd = date(\"Y-m-d\", mktime(0,0,0,$month,$day+1,$year) - $sunday_offset);\n return $fd;\n}",
"public function getDayOfTheWeek();",
"function the_weekday()\n {\n }",
"function dayOfWeek($timestamp) { \n\t\treturn intval(strftime(\"%w\",$timestamp))+1; \n\t}",
"function get_day_of_week($day)\n{\n return jddayofweek($day, 1);\n}",
"public function weekdayControl(){\n\t\t$weekday = date('w', time());\n\t\t//remakes $weekday to the weekdays name\n\t\tswitch($weekday){\n\t\t\tcase 0:\t$weekday = \"Söndag\"; break;\n\t\t\tcase 1:\t$weekday = \"Måndag\"; break;\n\t\t\tcase 2:\t$weekday = \"Tisdag\"; break;\t\n\t\t\tcase 3:\t$weekday = \"Onsdag\"; break;\n\t\t\tcase 4:\t$weekday = \"Torsdag\";break;\n\t\t\tcase 5:\t$weekday = \"Fredag\"; break;\n\t\t\tcase 6:\t$weekday = \"Lördag\"; break;\n\t\t}\t\t\t\n\t\t\n\t\treturn $weekday; \n\t}",
"function maandagmorgen($ts){\n\t\t$monday=strtotime(\"last Monday\",$ts);\n\t\t$info=getdate($ts);\n\t\tif($info['wday']==1){\n\t\t\t//$ts is al een maandag\n\t\t\t$monday=$ts;\n\t\t}\n\t\t\n\t\t$result= date('D d M Y',$monday);\n\t\treturn $result;\n\t}",
"public function getNextWeekDay($day) {\n $result = null;\n switch(strtolower($day)) {\n case Weekday::SUNDAY:\n $result = Weekday::MONDAY;\n break;\n case Weekday::MONDAY:\n $result = Weekday::TUESDAY;\n break;\n case Weekday::TUESDAY:\n $result = Weekday::WEDNESDAY;\n break;\n case Weekday::WEDNESDAY:\n $result = Weekday::THURSDAY;\n break;\n case Weekday::THURSDAY:\n $result = Weekday::FRIDAY;\n break;\n case Weekday::FRIDAY:\n $result = Weekday::SATURDAY;\n break;\n case Weekday::SATURDAY:\n $result = Weekday::SUNDAY;\n break;\n }\n return $result;\n }",
"public static function getThisWeek(){\n\t\t\t$cur = DB::select('SELECT WEEKDAY((SELECT CURDATE())) as cur')[0]->cur;\n\n\t\t\t// SQL find this monday\n\t\t\t$fir = DB::select('SELECT DATE_SUB( (SELECT CURDATE()), INTERVAL ?+1 DAY) as fir', array($cur))[0]->fir;\n\t\t\t$firstDay = DB::select('SELECT UNIX_TIMESTAMP(?) as firstDay', array($fir))[0]->firstDay;\n\n\t\t\t// SQL find this sunday\n\t\t\t$lst = DB::select('SELECT DATE_SUB( (SELECT CURDATE()), INTERVAL ?-5 DAY) as lst', array($cur))[0]->lst;\n\t\t\t$lastDay = DB::select('SELECT UNIX_TIMESTAMP(?) as lastDay', array($lst))[0]->lastDay;\n\t\t\t\n\t\t\t// Number, String\n\t\t\treturn array(array($firstDay, $lastDay+ 86399), array($fir, $lst));\n\t\t}",
"public function getDayOfWeek()\r\n {\r\n return date('N', $this->getTimestampUnix());\r\n }",
"public function getFirstDay(){$day = getdate(mktime(0, 0, 0, $this->getMonth(), 1, $this->getYear())); return $day['wday'];}",
"public function getSundayOfTheWeek($date) {\n $weekno = self::getISOWeekNo($date);\n return date('Y-m-d', strtotime(\"$date + \".(6 - $weekno).\" days\"));\n }",
"static public function timestampThisWeek()\n {\n // On Su, 2013/03/24, it returned timestamp of Mo, 2013/03/25\n // instead of timestamp of Mo, 2013/03/18\n // \n // return strtotime( 'this week' );\n \n return self::timestampCalendarWeek( self::weekOfTheYear() );\n }",
"public function getPreviousWeekDay($day) {\n $result = null;\n switch(strtolower($day)) {\n case Weekday::SUNDAY:\n $result = Weekday::SATURDAY;\n break;\n case Weekday::MONDAY:\n $result = Weekday::SUNDAY;\n break;\n case Weekday::TUESDAY:\n $result = Weekday::MONDAY;\n break;\n case Weekday::WEDNESDAY:\n $result = Weekday::TUESDAY;\n break;\n case Weekday::THURSDAY:\n $result = Weekday::WEDNESDAY;\n break;\n case Weekday::FRIDAY:\n $result = Weekday::THURSDAY;\n break;\n case Weekday::SATURDAY:\n $result = Weekday::FRIDAY;\n break;\n }\n return $result;\n }",
"function get_week_no($cur_date){\n $date_split=split(\"-\",$cur_date);\n return date(\"W\",mktime (0,0,0,$date_split[1],2,$date_split[2]));\n }"
]
| [
"0.69790924",
"0.6759206",
"0.6467386",
"0.6466914",
"0.6459266",
"0.6314403",
"0.6292568",
"0.6190502",
"0.616553",
"0.6124096",
"0.6071699",
"0.6070996",
"0.6068305",
"0.6060525",
"0.60241544",
"0.6022667",
"0.6020586",
"0.600916",
"0.6008341",
"0.5983578",
"0.5967052",
"0.5937908",
"0.59181416",
"0.59133816",
"0.5854157",
"0.58490646",
"0.5845374",
"0.584158",
"0.58400214",
"0.5782048"
]
| 0.6909412 | 1 |
Returns an array of src's for a media background 's s by breakpoint. $img_size_prefix is expected to be a prefix for a set of registered image sizes, which has dimensions defined for each of Athena's responsive breakpoints. For example, if given a prefix 'bgimg', it is expected that bgimg, bgimgsm, bgimgmd, bgimglg, and bgimgxl are valid registered image sizes. | function get_media_background_picture_srcs( $attachment_xs_id, $attachment_sm_id, $img_size_prefix ) {
$bg_images = array();
if ( $attachment_sm_id ) {
$bg_images = array_merge(
$bg_images,
array(
'xl' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-xl' ),
'lg' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-lg' ),
'md' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-md' ),
'sm' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-sm' )
)
);
// Try to get a fallback -xs image if needed
if ( !$attachment_xs_id ) {
$bg_images = array_merge(
$bg_images,
array( 'xs' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix ) )
);
}
// Remove duplicate image sizes, in case an old image isn't pre-cropped
$bg_images = array_unique( $bg_images );
// Use the largest-available image as the fallback <img>
$bg_images['fallback'] = reset( $bg_images );
}
if ( $attachment_xs_id ) {
$bg_images = array_merge(
$bg_images,
array( 'xs' => get_attachment_src_by_size( $attachment_xs_id, $img_size_prefix ) )
);
}
// Strip out false-y values (in case an attachment failed to return somewhere)
$bg_images = array_filter( $bg_images );
return $bg_images;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_media_background_picture( $srcs ) {\n\tob_start();\n\n\tif ( isset( $srcs['fallback'] ) ) :\n?>\n\t<?php\n\t// Define classes for the <picture> element\n\t$picture_classes = 'media-background-picture ';\n\tif ( !isset( $srcs['xs'] ) ) {\n\t\t// Hide the <picture> element at -xs breakpoint when no mobile image\n\t\t// is available\n\t\t$picture_classes .= 'hidden-xs-down';\n\t}\n\t?>\n\t<picture class=\"<?php echo $picture_classes; ?>\">\n\t\t<?php if ( isset( $srcs['xl'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['xl']; ?>\" media=\"(min-width: 1200px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['lg'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['lg']; ?>\" media=\"(min-width: 992px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['md'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['md']; ?>\" media=\"(min-width: 768px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['sm'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['sm']; ?>\" media=\"(min-width: 576px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['xs'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['xs']; ?>\" media=\"(max-width: 575px)\">\n\t\t<?php endif; ?>\n\n\t\t<img class=\"media-background object-fit-cover\" src=\"<?php echo $srcs['fallback']; ?>\" alt=\"\">\n\t</picture>\n<?php\n\tendif;\n\n\treturn ob_get_clean();\n}",
"function photonfill_get_breakpoint_urls( $attachment_id, $img_size, $pixel_density = 1 ) {\n\treturn Photonfill()->get_breakpoint_urls( $attachment_id, $img_size, $pixel_density );\n}",
"function psa_get_post_images_src( $size = 'thumbnail' ) {\n\tglobal $post;\n\t\n\t$images = get_children( array('exclude' => get_post_thumbnail_id( $post->ID ), 'post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order') );\n\t\t\n\t$results = array();\n\n\tif ( $images ) {\n\t\tforeach ( $images as $image ) {\n\t\t\t// get the correct image html for the selected size\n\t\t\t$results[] = wp_get_attachment_image_src( $image->ID, $size );\n\t\t}\n\t}\n\t\n\treturn $results;\n}",
"public function getResponsiveSrcset($sizes = false)\n {\n if (!$sizes || !is_array($sizes)) {\n if (!$sizes = Settings::get('breakpoints', false))\n return false;\n }\n\n $paths = $this->getPaths(false, $sizes);\n $numPaths = count($paths) - 1;\n $extensionLength = strlen($this->file->getExtension()) + 1;\n $srcset = '';\n\n foreach ($paths as $i => $path) {\n $fileName = substr($path, strpos($path, 'resimg_') + 7, -$extensionLength);\n list($modelId, $width) = explode('_', $fileName);\n\n $srcset .= $path.' '.$width.'w';\n if ($i < $numPaths) $srcset .= ', ';\n }\n\n return $srcset;\n }",
"public function GetImageSRC($size = 'default')\n\t{\treturn $this->imagelocation . $this->InputSafeString($size) . '/' . (int)$this->id . '.png';\n\t}",
"public function get_background_image_srcset( $image_id, $default_size = \"medium\" ){\n\t\t$html = 'data-bg-srcset=\"' . wp_get_attachment_image_srcset( $image_id, $size = $default_size ) . '\"';\n\t\treturn $html;\n\t}",
"function wp_get_list_image_size() {\n\tglobal $_wp_additional_image_sizes;\n\t$sizes = array();\n\tforeach ( get_intermediate_image_sizes() as $_size ) {\n\t\tif ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {\n\t\t\t$sizes[] = $_size;\n\t\t} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {\n\t\t\t$sizes[] = $_size;\n\t\t}\n\t}\n\treturn $sizes;\n}",
"function _captcha_show_gd_img_get_backgrounds()\n\t{\n\t\t//-----------------------------------------\n\t\t// INIT\n\t\t//-----------------------------------------\n\t\t\n\t\t$images = array();\n\t\t$_path = $this->path_background;\n\t\t\n\t\tif ( $_dir = @opendir( $_path ) )\n\t\t{\n\t\t\twhile( false !== ( $_file = @readdir( $_dir ) ) )\n\t\t\t{\n\t\t\t\tif ( preg_match( \"#\\.(gif|jpeg|jpg|png)$#i\", $_file ) )\n\t\t\t\t{\n\t\t\t\t\t$images[] = $_path . '/' . $_file;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $images;\n\t}",
"function drush_large_images_list($dir, $min_size) {\n $images = large_images_find_images($dir, $min_size);\n if (!empty($images)) {\n foreach ($images as $image) {\n $img_size = getimagesize($image);\n drush_log(dt('!size !wx!h !path', array(\n '!path' => $image,\n '!w' => str_pad($img_size[0], 5, ' ', STR_PAD_LEFT),\n '!h' => str_pad($img_size[1], 5, ' ', STR_PAD_RIGHT),\n '!size' => str_pad(large_images_human_filesize(filesize($image)), 9, ' '),\n )), 'ok');\n }\n }\n else {\n drush_log(dt('No image files found.'), 'ok');\n }\n}",
"public function getMediaGroupImages()\n {\n return [\n 'gif',\n 'jpg',\n 'png',\n 'swf',\n 'psd',\n 'bmp',\n 'tiff',\n 'jpc',\n 'jp2',\n 'jpx',\n 'jb2',\n 'swc',\n 'iff',\n 'wbmp',\n 'jp2',\n 'xbm',\n 'ico',\n 'ai',\n ];\n }",
"function get_mob_template_imgs($mob_oper) {\n return $this->Trader_mdl->get_mobprefix($mob_oper);\n }",
"function pendrell_sizes_media_queries( $queries = array(), $size = '', $width = '', $context = '' ) {\n\n // Exit early if we don't have the required size and width data\n if ( empty( $size ) || !is_string( $size ) || empty( $width ) || !is_int( $width ) )\n return $queries;\n\n // Limit width by the content width; what we're interested in here is the *rendered size* of an image which won't be larger than the container\n global $content_width, $medium_width;\n if ( PENDRELL_COLUMNS === 1 ) {\n $width = min( $width, $content_width );\n } else {\n $width = min( $width, $medium_width );\n }\n\n // Test the context object for various scenarios; this allows the theme to handle the sizes attribute in different ways depending on how images are being used\n $group = ubik_imagery_context( $context, 'group' );\n $responsive = ubik_imagery_context( $context, 'responsive' );\n $static = ubik_imagery_context( $context, 'static' );\n\n // The margins can be filtered; this is mostly in case the inner margin (the space *between* grouped images) is not the same as the page margins\n // Example: your outer page margins are 30px on each side but the spacing between images is 20px\n // Such functionality is superfluous for this theme as margins are all handled in increments of 30px\n $margin = (int) apply_filters( 'pendrell_sizes_margin', PENDRELL_BASELINE );\n $margin_inner = (int) apply_filters( 'pendrell_sizes_margin_inner', PENDRELL_BASELINE );\n\n // Breakpoints replicated from `src/scss/config/_settings.scss`\n $tiny = ceil( $medium_width / 1.5 ); // 390px\n $small = ceil( $medium_width / 1.2 ); // 520px\n $medium = $medium_width + ( $margin * 3 ); // 714px\n $large = $medium_width + ( $margin * 8 ); // 864px\n $full = $content_width + ( $margin * 3 ); // 990px\n\n // Usable space for each breakpoint; for comparison with $width\n $tiny_content = ceil( $medium_width / 1.5 ) - $margin; // 360px\n $small_content = ceil( $medium_width / 1.2 ) - ( $margin * 2 ); // 460px\n $medium_content = $medium_width; // 624px\n $large_content = $medium_width + ( $margin * 5 ); // 774px\n\n // This first chunk of code deals with grouped fractional width images\n // These sizes are defined as fractions of $content_width by `ubik_imagery_add_fractional_sizes()`\n // Note: this only works when images are explicitly grouped (i.e. with the `[group]` shortcode or by passing `group` to the context object when calling `ubik_imagery`); otherwise they are treated like any other image\n if ( $group === true || $responsive === true ) {\n\n // Multiplier for use with fractional width sizes\n $factor = 2; // $group is true so we expect two images in a row by default\n if ( in_array( $size, array( 'third', 'third-square' ) ) )\n $factor = 3;\n if ( in_array( $size, array( 'quarter', 'quarter-square' ) ) )\n $factor = 4;\n\n // We lead with a media query specifying the minimum pixel width at which an image is *fixed* in size (not fluid)\n $queries[] = '(min-width: ' . $full . 'px) ' . $width . 'px';\n\n // A regular grouped gallery; a helper class like `gallery-columns-3` and the corresponding image size (e.g. `third-square`) must be passed to Ubik Imagery\n if ( $responsive === false ) {\n\n // This next media query handles the medium breakpoint\n // By this point all images are rendered smaller than their intrinsic sizes and will be sized based on a percentage width of the viewport minus page margins and margins between images within a group\n // For example: third-width images will take up one third of the viewport width minus one third of the total width of the inner margins (of which there will be two in this case) minus the *fixed* width of the page margins (hence the use of `calc`)\n // Note: these values won't add up to 100 due to the presence of the inner margins\n $viewport = round( ( 1 / $factor - ( ( ( $margin_inner * ( $factor - 1 ) ) / $content_width ) ) / $factor ) * 100, 5 );\n $queries[] = '(min-width: ' . $medium . 'px) calc(' . $viewport . 'vw - ' . round( ( $margin * 3 ) / $factor, 5 ) . 'px)';\n\n // Special case: for non-static galleries the 4 column layout collapses into a 2 column layout below the medium breakpoint\n if ( $static === false && $factor === 4 ) {\n $factor = 2;\n $viewport = round( ( 1 / $factor - ( ( ( $margin_inner * ( $factor - 1 ) ) / $content_width ) ) / $factor ) * 100, 5 );\n }\n\n // The 2 and 3 column layouts only need to have the page margins progressively reduced; everything else remains the same\n $queries[] = '(min-width: ' . $small . 'px) calc(' . $viewport . 'vw - ' . round( ( $margin * 2 ) / $factor, 5 ) . 'px)';\n $queries[] = '(min-width: ' . $tiny . 'px) calc(' . $viewport . 'vw - ' . round( $margin / $factor, 5 ) . 'px)';\n\n // Responsive gallery handling; no need to specify a column count or work with factors here\n // This is a special case that allows for a portfolio-like tiling of images in rows of 3, 2, or 1 image depending on the size of the viewport window\n // Naturally this works best with posts per page equally divisible by all three factors e.g. 6, 12, 18, etc.\n } else {\n\n // Medium: 3x columns, 3x page margins\n // Small: 2x columns, 2x page margins\n // Tiny: 2x columns, 1x page margins\n // Default: 1x columns, 1x page margins; handled by `pendrell_sizes_default()`\n $queries[] = '(min-width: ' . $medium . 'px) calc(' . round( ( 1 / 3 - ( ( ( $margin_inner * 2 ) / $content_width ) ) / 3 ) * 100, 5 ) . 'vw - ' . round( ( $margin * 3 ) / 3, 5 ) . 'px)';\n $queries[] = '(min-width: ' . $small . 'px) calc(' . round( ( 1 / 2 - ( ( $margin_inner / $content_width ) ) / 2 ) * 100, 5 ) . 'vw - ' . round( ( $margin * 2 ) / 2, 5 ) . 'px)';\n $queries[] = '(min-width: ' . $tiny . 'px) calc(' . round( ( 1 / 2 - ( ( $margin_inner / $content_width ) ) / 2 ) * 100, 5 ) . 'vw - ' . round( $margin / 2, 5 ) . 'px)';\n }\n } else {\n\n // As before, the first media query must specify the minimum width at which an image is rendered at the *requested* width\n // Page margins also introduce some ambiguity at the small and medium breakpoints\n // Note: viewport calculations will *not* add up to 100 due to the presence of margins around the content area\n if ( ( $width + ( $margin * 2 ) ) > $medium ) {\n $queries[] = '(min-width: ' . ( $width + ( $margin * 3 ) ) . 'px) ' . $width . 'px';\n $queries[] = '(min-width: ' . $medium . 'px) calc(100vw - ' . ( $margin * 3 ) . 'px)';\n $queries[] = '(min-width: ' . $small . 'px) calc(100vw - ' . ( $margin * 2 ) . 'px)';\n } elseif ( ( $width + $margin ) > $small ) {\n $queries[] = '(min-width: ' . ( $width + ( $margin * 2 ) ) . 'px) ' . $width . 'px';\n $queries[] = '(min-width: ' . $small . 'px) calc(100vw - ' . ( $margin * 2 ) . 'px)';\n } else {\n $queries[] = '(min-width: ' . ( $width + $margin ) . 'px) ' . $width . 'px';\n }\n }\n\n // Return an array of arrays (required by Ubik Imagery)\n return $queries;\n}",
"function get_image_sizes() {\n global $_wp_additional_image_sizes;\n\n $sizes = [];\n\n $default_sizes = [ 'thumbnail', 'medium', 'medium_large', 'large', 'full' ];\n\n foreach ( get_intermediate_image_sizes() as $size ) {\n if ( in_array( $size, $default_sizes ) ) {\n $sizes[ $size ]['width'] = (int) get_option( \"{$size}_size_w\" );\n $sizes[ $size ]['height'] = (int) get_option( \"{$size}_size_h\" );\n $sizes[ $size ]['crop'] = (bool) get_option( \"{$size}_size_crop\" );\n }\n elseif ( isset( $_wp_additional_image_sizes[ $size ] ) ) {\n $sizes[ $size ] = $_wp_additional_image_sizes[ $size ];\n }\n }\n\n return $sizes;\n }",
"private function get_image_sizes() {\n\n\t\treturn array(\n\t\t\t'square_medium' => array( 200, 200 ),\n\t\t\t'full' => array( 1200, 1200 ),\n\t\t);\n\n\t}",
"function photonfill_get_breakpoint_url( $attachment_id, $img_size, $breakpoint, $pixel_density = 1 ) {\n\treturn Photonfill()->get_breakpoint_url( $attachment_id, $img_size, $breakpoint, $pixel_density );\n}",
"public function srcset( $size = 'full' ) {\n\t\t$thumbnail_id = $this->id;\n\t\t// will return false if only one image matches the aspect ratio.\n\t\t$srcset = wp_get_attachment_image_srcset( $thumbnail_id, $size );\n\n\t\tif ( ! $srcset ) {\n\t\t\t$img = wp_get_attachment_image_src( $thumbnail_id, $size );\n\t\t\tif ( $img ) {\n\t\t\t\t$srcset = $img[0];\n\t\t\t}\n\t\t}\n\n\t\treturn $srcset;\n\t}",
"function get_image_sizes() {\n\tglobal $_wp_additional_image_sizes;\n\n\t$sizes = array();\n\n\tforeach ( get_intermediate_image_sizes() as $_size ) {\n\t\tif ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {\n\t\t\t$sizes[ $_size ]['width'] = get_option( \"{$_size}_size_w\" );\n\t\t\t$sizes[ $_size ]['height'] = get_option( \"{$_size}_size_h\" );\n\t\t\t$sizes[ $_size ]['crop'] = (bool) get_option( \"{$_size}_crop\" );\n\t\t} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {\n\t\t\t$sizes[ $_size ] = array(\n\t\t\t\t'width' => $_wp_additional_image_sizes[ $_size ]['width'],\n\t\t\t\t'height' => $_wp_additional_image_sizes[ $_size ]['height'],\n\t\t\t\t'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],\n\t\t\t);\n\t\t}\n\t}\n\n\treturn $sizes;\n}",
"protected static function image_sizes() {\n\t\tif ( null === self::$image_sizes ) {\n\t\t\tglobal $_wp_additional_image_sizes;\n\n\t\t\t// Populate an array matching the data structure of $_wp_additional_image_sizes so we have a consistent structure for image sizes.\n\t\t\t$images = [\n\t\t\t\t'thumb' => [\n\t\t\t\t\t'width' => intval( get_option( 'thumbnail_size_w' ) ),\n\t\t\t\t\t'height' => intval( get_option( 'thumbnail_size_h' ) ),\n\t\t\t\t\t'crop' => (bool) get_option( 'thumbnail_crop' ),\n\t\t\t\t],\n\t\t\t\t'medium' => [\n\t\t\t\t\t'width' => intval( get_option( 'medium_size_w' ) ),\n\t\t\t\t\t'height' => intval( get_option( 'medium_size_h' ) ),\n\t\t\t\t\t'crop' => false,\n\t\t\t\t],\n\t\t\t\t'medium_large' => [\n\t\t\t\t\t'width' => intval( get_option( 'medium_large_size_w' ) ),\n\t\t\t\t\t'height' => intval( get_option( 'medium_large_size_h' ) ),\n\t\t\t\t\t'crop' => false,\n\t\t\t\t],\n\t\t\t\t'large' => [\n\t\t\t\t\t'width' => intval( get_option( 'large_size_w' ) ),\n\t\t\t\t\t'height' => intval( get_option( 'large_size_h' ) ),\n\t\t\t\t\t'crop' => false,\n\t\t\t\t],\n\t\t\t\t'full' => [\n\t\t\t\t\t'width' => null,\n\t\t\t\t\t'height' => null,\n\t\t\t\t\t'crop' => false,\n\t\t\t\t],\n\t\t\t];\n\n\t\t\t// Compatibility mapping as found in wp-includes/media.php.\n\t\t\t$images['thumbnail'] = $images['thumb'];\n\n\t\t\t// Update class variable, merging in $_wp_additional_image_sizes if any are set.\n\t\t\tif ( is_array( $_wp_additional_image_sizes ) && ! empty( $_wp_additional_image_sizes ) ) {\n\t\t\t\tself::$image_sizes = array_merge( $images, $_wp_additional_image_sizes );\n\t\t\t} else {\n\t\t\t\tself::$image_sizes = $images;\n\t\t\t}\n\t\t}\n\n\t\treturn is_array( self::$image_sizes ) ? self::$image_sizes : [];\n\t}",
"public function getImagePrefix()\n {\n $value = $this->_config->get('dataprocessing/images/image_prefix');\n\n if ($value === null) {\n $value = '';\n }\n\n return $value;\n }",
"public function get_product_images() : array {\n\t\tpreg_match( '/imageBigViewURL=\\[\\n(.*?)\\r?\\n?\\];/si', $this->request, $matches );\n\n\t\tif ( empty( $matches[1] ) ) {\n\t\t\treturn [ 'product_images' => [] ];\n\t\t}\n\n\t\t$matched_urls = array_map( 'trim', explode( ',', str_replace( '\"', '', $matches[1] ) ) );\n\t\tif ( empty( $matched_urls ) ) {\n\t\t\treturn [ 'product_images' => [] ];\n\t\t}\n\n\t\treturn [ 'product_images' => array_map( 'esc_url_raw', $matched_urls ) ];\n\t}",
"public static function getAllImageSizes()\n {\n $sizes = array();\n // make thumbnails and other intermediate sizes\n global $_wp_additional_image_sizes;\n\n foreach (get_intermediate_image_sizes() as $s) {\n $sizes[$s] = array('width' => '', 'height' => '', 'crop' => false);\n if (isset($_wp_additional_image_sizes[$s]['width']))\n $sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']); // For theme-added sizes\n else\n $sizes[$s]['width'] = get_option(\"{$s}_size_w\"); // For default sizes set in options\n if (isset($_wp_additional_image_sizes[$s]['height']))\n $sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']); // For theme-added sizes\n else\n $sizes[$s]['height'] = get_option(\"{$s}_size_h\"); // For default sizes set in options\n if (isset($_wp_additional_image_sizes[$s]['crop']))\n $sizes[$s]['crop'] = intval($_wp_additional_image_sizes[$s]['crop']); // For theme-added sizes\n else\n $sizes[$s]['crop'] = get_option(\"{$s}_crop\"); // For default sizes set in options\n }\n\n $sizes = apply_filters('intermediate_image_sizes_advanced', $sizes);\n return $sizes;\n }",
"function PREFIX_add_image_sizes() {\n\t/*\n\t// 16:9\n\tadd_image_size( 'wide-xsmall', 295, 165, true );\n\tadd_image_size( 'wide-small', 360, 202, true );\n\tadd_image_size( 'wide-medium', 470, 264, true );\n\tadd_image_size( 'wide-large', 770, 433, true );\n\tadd_image_size( 'wide-xlarge', 1440, 810, true );\n\n\t// 4x3\n\tadd_image_size( 'ratio-4-3-small', 300, 225, true );\n\tadd_image_size( 'ratio-4-3-medium', 470, 353, true );\n\tadd_image_size( 'ratio-4-3-large', 740, 555, true );\n\tadd_image_size( 'ratio-4-3-xlarge', 1440, 1080, true );\n\n\t// Golden Ratio\n\tadd_image_size( 'ratio-gold-small', 300, 300 * 0.618, true );\n\tadd_image_size( 'ratio-gold-medium', 470, 470 * 0.618, true );\n\tadd_image_size( 'ratio-gold-large', 740, 740 * 0.618, true );\n\tadd_image_size( 'ratio-gold-xlarge', 1440, 1440 * 0.618, true );\n\n\t// Square\n\tadd_image_size( 'square-xsmall', 160, 160, true );\n\tadd_image_size( 'square-small', 300, 300, true );\n\tadd_image_size( 'square-medium', 470, 470, true );\n\tadd_image_size( 'square-large', 800, 800, true );\n\t*/\n}",
"public function getResponsiveImages($viewport = false, $sizes = false)\n {\n\n $images = [];\n $extensionLength = strlen($this->file->getExtension()) + 1;\n $paths = $this->getPaths($viewport, $sizes);\n $numPaths = count($paths);\n\n foreach ($paths as $path) {\n $fileName = substr($path, strpos($path, 'resimg_') + 7, -$extensionLength);\n list($modelId, $width, $height) = explode('_', $fileName);\n $images[] = [\n 'path' => $path,\n 'width' => intval($width),\n 'height' => intval($height),\n ];\n }\n\n return $images;\n }",
"function image_src($id, $size = 'full', $background_image = false, $height = false) {\n if ($image = wp_get_attachment_image_src($id, $size, true)) {\n return $background_image ? 'background-image: url('.$image[0].');' . ($height?'height:'.$image[2].'px':'') : $image[0];\n }\n}",
"public function getImages($size = 'md', $field = 'image')\n {\n $image = $this->$field;\n $config = $this->config;\n \n if (!is_array($image) || empty($image)) {\n return ['img/default/' . $size . '.jpg'];\n }\n\n if (in_array($field, $this->uploads['single'])) {\n return [\"image/{$size}/{$config}/\" . folder_encode($image['folder']) . '/' . $image['file']];\n }\n\n foreach ($image as $key => $img) {\n $image[$key] = \"image/{$size}/{$config}/\" . folder_encode($img['folder']) . '/' . $img['file'];\n }\n\n return $image;\n }",
"public function imgsrc() {\n\t\t$theImagePathList = func_get_args();\n\t\tif (!empty($theImagePathList)) {\n\t\t\t//since this operation may be expensive, check session cache first\n\t\t\t$theSessionVarName = 'imgsrc_cache/'.get_called_class().implode('/',$theImagePathList);\n\t\t\tif (!empty($this->_director[$theSessionVarName])) {\n\t\t\t\treturn $this->_director[$theSessionVarName];\n\t\t\t} else {\n\t\t\t\t$theFilename = array_pop($theImagePathList);\n\t\t\t\t$theResult = $this->getImgResSrc($theImagePathList,$theFilename);\n\t\t\t\t//cache this result\n\t\t\t\t$this->_director[$theSessionVarName] = $theResult;\n\t\t\t\treturn $theResult;\n\t\t\t}\n\t\t}\n\t}",
"public function responsive_image_src( $attachment_id, $image_size = 'large' ) \n\t\t{\n\t\t\t$img_src = wp_get_attachment_image_src( $attachment_id, $image_size );\n\t\t\t\n\t\t\tif( false === $img_src )\n\t\t\t{\n\t\t\t\treturn $img_src;\n\t\t\t}\n\t\t\t\n\t\t\t$img_src['srcset'] = '';\n\t\t\t$img_src['sizes'] = '';\n\t\t\t\n\t\t\tif( ! $this->responsive_images_active() )\n\t\t\t{\n\t\t\t\treturn $img_src;\n\t\t\t}\n\t\t\t\n\t\t\t$img = \"<img src='{$img_src[0]}' width='{$img_src[1]}' height='{$img_src[2]}' />\";\n\t\t\t\n\t\t\t$img = $this->make_image_responsive( $img, $attachment_id );\n\t\t\t\n\t\t\t$attrs = array( 'srcset', 'sizes' );\n\t\t\t\n\t\t\tforeach( $attrs as $attr ) \n\t\t\t{\n\t\t\t\t$match = array();\n\t\t\t\tif( preg_match( \"/{$attr}='([^']+)'/\", $img, $match ) )\n\t\t\t\t{\n\t\t\t\t\t$img_src[ $attr ] = $match[1];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif( preg_match( \"/{$attr}=\\\"([^\\\"]+)\\\"/\", $img, $match ) )\n\t\t\t\t{\n\t\t\t\t\t$img_src[ $attr ] = $match[1];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn $img_src;\n\t\t}",
"function generate_image_sizes() {\n\t$display_options = get_customizer_settings()[ WPM_PREFIX . 'collection_style' ];\n\n\tadd_image_size(\n\t\tWPM_PREFIX . 'list_thumb',\n\t\t$display_options['list_image_max_width'],\n\t\t$display_options['list_image_max_height']\n\t);\n}",
"function image_src($id, $size = 'full', $background_image = false, $height = false) {\n if ($image = wp_get_attachment_image_src($id, $size, true)) {\n return $background_image ? 'background-image: url('.$image[0].');' . ($height?'min-height:'.$image[2].'px':'') : $image[0];\n }\n}",
"function dahz_get_image_size_links() {\n\n\t/* If not viewing an image attachment page, return. */\n\tif ( !wp_attachment_is_image( get_the_ID() ) )\n\t\treturn;\n\n\t/* Set up an empty array for the links. */\n\t$links = array();\n\n\t/* Get the intermediate image sizes and add the full size to the array. */\n\t$sizes = get_intermediate_image_sizes();\n\t$sizes[] = 'full';\n\n\t/* Loop through each of the image sizes. */\n\tforeach ( $sizes as $size ) {\n\n\t\t/* Get the image source, width, height, and whether it's intermediate. */\n\t\t$image = wp_get_attachment_image_src( get_the_ID(), $size );\n\n\t\t/* Add the link to the array if there's an image and if $is_intermediate (4th array value) is true or full size. */\n\t\tif ( !empty( $image ) && ( true === $image[3] || 'full' == $size ) ) {\n\n\t\t\t/* Translators: Media dimensions - 1 is width and 2 is height. */\n\t\t\t$label = sprintf( __( '%1$s × %2$s', 'dahz-core' ), number_format_i18n( absint( $image[1] ) ), number_format_i18n( absint( $image[2] ) ) );\n\n\t\t\t$links[] = sprintf( '<a class=\"image-size-link\">%s</a>', $label );\n\t\t}\n\t}\n\n\t/* Join the links in a string and return. */\n\treturn join( ' <span class=\"sep\">/</span> ', $links );\n}"
]
| [
"0.57852054",
"0.5536155",
"0.5137959",
"0.5085397",
"0.5027953",
"0.49293694",
"0.4849443",
"0.4841104",
"0.48388913",
"0.47839338",
"0.47412345",
"0.47120392",
"0.4706144",
"0.4695875",
"0.46948662",
"0.46663937",
"0.46431273",
"0.46386942",
"0.4619642",
"0.46121848",
"0.4602186",
"0.4596183",
"0.4589298",
"0.4582509",
"0.45792654",
"0.45752367",
"0.45744324",
"0.4574154",
"0.45662996",
"0.4559323"
]
| 0.72476286 | 0 |
Returns markup for a media background , given an array of media background picture src's from get_media_background_picture_srcs(). | function get_media_background_picture( $srcs ) {
ob_start();
if ( isset( $srcs['fallback'] ) ) :
?>
<?php
// Define classes for the <picture> element
$picture_classes = 'media-background-picture ';
if ( !isset( $srcs['xs'] ) ) {
// Hide the <picture> element at -xs breakpoint when no mobile image
// is available
$picture_classes .= 'hidden-xs-down';
}
?>
<picture class="<?php echo $picture_classes; ?>">
<?php if ( isset( $srcs['xl'] ) ) : ?>
<source srcset="<?php echo $srcs['xl']; ?>" media="(min-width: 1200px)">
<?php endif; ?>
<?php if ( isset( $srcs['lg'] ) ) : ?>
<source srcset="<?php echo $srcs['lg']; ?>" media="(min-width: 992px)">
<?php endif; ?>
<?php if ( isset( $srcs['md'] ) ) : ?>
<source srcset="<?php echo $srcs['md']; ?>" media="(min-width: 768px)">
<?php endif; ?>
<?php if ( isset( $srcs['sm'] ) ) : ?>
<source srcset="<?php echo $srcs['sm']; ?>" media="(min-width: 576px)">
<?php endif; ?>
<?php if ( isset( $srcs['xs'] ) ) : ?>
<source srcset="<?php echo $srcs['xs']; ?>" media="(max-width: 575px)">
<?php endif; ?>
<img class="media-background object-fit-cover" src="<?php echo $srcs['fallback']; ?>" alt="">
</picture>
<?php
endif;
return ob_get_clean();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_media_background_picture_srcs( $attachment_xs_id, $attachment_sm_id, $img_size_prefix ) {\n\t$bg_images = array();\n\n\tif ( $attachment_sm_id ) {\n\t\t$bg_images = array_merge(\n\t\t\t$bg_images,\n\t\t\tarray(\n\t\t\t\t'xl' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-xl' ),\n\t\t\t\t'lg' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-lg' ),\n\t\t\t\t'md' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-md' ),\n\t\t\t\t'sm' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix . '-sm' )\n\t\t\t)\n\t\t);\n\n\t\t// Try to get a fallback -xs image if needed\n\t\tif ( !$attachment_xs_id ) {\n\t\t\t$bg_images = array_merge(\n\t\t\t\t$bg_images,\n\t\t\t\tarray( 'xs' => get_attachment_src_by_size( $attachment_sm_id, $img_size_prefix ) )\n\t\t\t);\n\t\t}\n\n\t\t// Remove duplicate image sizes, in case an old image isn't pre-cropped\n\t\t$bg_images = array_unique( $bg_images );\n\n\t\t// Use the largest-available image as the fallback <img>\n\t\t$bg_images['fallback'] = reset( $bg_images );\n\t}\n\tif ( $attachment_xs_id ) {\n\t\t$bg_images = array_merge(\n\t\t\t$bg_images,\n\t\t\tarray( 'xs' => get_attachment_src_by_size( $attachment_xs_id, $img_size_prefix ) )\n\t\t);\n\t}\n\n\t// Strip out false-y values (in case an attachment failed to return somewhere)\n\t$bg_images = array_filter( $bg_images );\n\n\treturn $bg_images;\n}",
"function PREFIX_responsive_background( $images = false ) {\n\tif ( ! $images ) {\n\t\treturn false;\n\t}\n\n\treturn htmlentities( json_encode( array( 'source' => $images ) ) );\n}",
"function _captcha_show_gd_img_get_backgrounds()\n\t{\n\t\t//-----------------------------------------\n\t\t// INIT\n\t\t//-----------------------------------------\n\t\t\n\t\t$images = array();\n\t\t$_path = $this->path_background;\n\t\t\n\t\tif ( $_dir = @opendir( $_path ) )\n\t\t{\n\t\t\twhile( false !== ( $_file = @readdir( $_dir ) ) )\n\t\t\t{\n\t\t\t\tif ( preg_match( \"#\\.(gif|jpeg|jpg|png)$#i\", $_file ) )\n\t\t\t\t{\n\t\t\t\t\t$images[] = $_path . '/' . $_file;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $images;\n\t}",
"function gs_image_markup_responsive_background( $attributes, $image = null ) {\n\n\tif ( isset( $attributes['src'] ) ) {\n\t\t$attributes['data-src'] = $attributes['src'];\n\t\t$attributes['src'] = ''; //could add default small image or a base64 encoded small image here\n\t}\n\tif ( isset( $attributes['srcset'] ) ) {\n\t\t$attributes['data-srcset'] = $attributes['srcset'];\n\t\t$attributes['srcset'] = '';\n\t}\n\tif ( $image ) { //mainly for IE 11 support\n\t\t$attributes['data-fallback'] = wp_get_attachment_image_url( $image->ID, 'large' );\n\t}\n\n\treturn $attributes;\n\n}",
"function backgroundToImg($htmlContent)\n{\n $regex = '/background-image[ ]{0,}:[ ]{0,}url\\([\\'\"]{0,}(.*?)[\\'\"]{0,}\\)/';\n $htmlContent = str_get_html($htmlContent);\n\n foreach ($htmlContent->find('*') as $element) {\n if (preg_match($regex, $element->style, $matches) > 0) {\n $element->outertext = '<img style=\"display:block;\" src=\"' . $matches[1] . '\" />';\n }\n }\n\n return $htmlContent;\n}",
"function bgimg($img){\n\treturn \"background: url('\".$img.\"'); background-size: cover; background-position: 0 50%;\";\n}",
"function get_background_image()\n {\n }",
"function getSrc($content) {\n $specs = array(1280, 540, 500, 400, 250);\n\n foreach ($specs as $spec) {\n $pattern = \"<(?:content|src)=\\\"((?:https?://\\d+\\.media\\.tumblr\\.com)/(?:\\w+/)?(?:tumblr_\\w+_$spec\\.(?:png|jpg|gif)))\\\">i\";\n if (preg_match($pattern, $content, $match)) return $match[1];\n }\n\n foreach ($specs as $spec) {\n $pattern = \"<(?:content|src)=\\\"((?:https?://\\d+\\.media\\.tumblr\\.com)/(?:\\w+/)?(?:\\w+_$spec\\.(?:png|jpg|gif)))\\\">i\";\n if (preg_match($pattern, $content, $match)) return $match[1];\n }\n\n return false;\n}",
"public static function loadBackgroundImages() {\n $dir = scandir('../img/bgs');\n $bg_images = array();\n foreach ($dir as $file) {\n if ($file != \".\" && $file != \"..\") {\n if (file_exists(\"../img/bgs/\" . $file)) {\n $currFileExt = pathinfo(\"../img/bgs/\" . $file, 4);\n if ($currFileExt == \"jpg\" || $currFileExt == \"png\" || $currFileExt == \"gif\" || $currFileExt == \"jpeg\" || $currFileExt == \"bmp\") {\n $bg_images[] = $file;\n }\n }\n }\n }\n $curr_page = isset($_POST['curr_page']) ? intval($_POST['curr_page']) : 1;\n $max_bgs_per_page = 9;\n $offset = $curr_page * $max_bgs_per_page - $max_bgs_per_page;\n $slice = array_slice($bg_images, $offset, $max_bgs_per_page);\n\n $counter = 0;\n $middleClass = \"\";\n foreach ($slice as $bg) {\n $counter++;\n if ($counter == 1) {\n ?><div class=\"cs-product-row\"><?php\n }\n if ($counter == 2) {\n $middleClass = \"cs-prd-middle\";\n }\n else {\n $middleClass = \"\";\n }\n ?>\n <?php $bg_index = self::parseInt($bg); ?>\n <div class=\"cs-product pad-bot thumb_za_pozadini <?php echo $middleClass; ?>\"\n index_za_pozadina_e=\"<?php echo $bg_index; ?>\"> \n\n <img src=\"img/bgs/<?php echo $bg ?>\" width=\"97\" height=\"126\" data-bgname=\"<?php echo $bg ?>\" class=\"cs-main-bg\" />\n </div>\n <?php\n if ($counter == 3) {\n ?></div><?php\n $counter = 0;\n }\n }\n }",
"function wprt_background_css( $bg ) {\n\t// Define vars\n\t$css = '';\n\t$bg_style = $bg .'_style';\n\n\tif ( $bg_img = wprt_get_mod( $bg, null ) ) {\n\t\t$css .= 'background-image: url('. esc_url( $bg_img ). ');';\n\t}\n\n\tif ( $bg_style = wprt_get_mod( $bg_style ) ) {\n\t\tif ( 'fixed' == $bg_style ) {\n\t\t\t$css .= ' background-position: center center; background-repeat: no-repeat; background-attachment: fixed; background-size: cover;';\n\t\t} elseif ( 'fixed-top' == $bg_style ) {\n\t\t\t$css .= ' background-position: center top; background-repeat: no-repeat; background-attachment: fixed; background-size: cover;';\n\t\t} elseif ( 'fixed-bottom' == $bg_style ) {\n\t\t\t$css .= ' background-position: center bottom; background-repeat: no-repeat; background-attachment: fixed; background-size: cover;';\n\t\t} elseif ( 'cover' == $bg_style ) {\n\t\t\t$css .= ' background-repeat: no-repeat; background-position: center center; background-size: cover;';\n\t\t} elseif ( 'center-top' == $bg_style ) {\n\t\t\t$css .= ' background-repeat: no-repeat; background-position: center top;';\n\t\t} elseif ( 'repeat' == $bg_style ) {\n\t\t\t$css .= ' background-repeat: repeat;';\n\t\t} elseif ( 'repeat-x' == $bg_style ) {\n\t\t\t$css .= ' background-repeat: repeat-x;';\n\t\t} elseif ( 'repeat-y' == $bg_style ) {\n\t\t\t$css .= ' background-repeat: repeat-y;';\n\t\t}\n\t}\n\n\treturn esc_attr( $css );\n}",
"function get_picture( $args = array() ) {\n\t$defaults = array(\n\t\t\"image\" => null,\n\t\t\"id\" => - 1,\n\t\t\"width\" => 0,\n\t\t\"height\" => 0,\n\t\t\"thumbs\" => array(\n\t\t\t\"default\" => \"large\",\n\t\t\t\"screen-xs\" => \"\",\n\t\t\t\"screen-sm\" => \"\",\n\t\t\t\"screen-md\" => \"\",\n\t\t\t\"screen-lg\" => \"\",\n\t\t\t\"retina\" => \"\"\n\t\t)\n\t);\n\t$r = wp_parse_args( $args, $defaults );\n\n\t$thumbs = $r[\"thumbs\"];\n\n $id = $r['id'] == - 1 ? get_post_thumbnail_id() : $r['id'];\n\n\tif ( empty( $thumbs[\"screen-xs\"] ) && empty( $thumbs[\"screen-sm\"] ) && empty( $thumbs[\"screen-md\"] ) && empty( $thumbs[\"screen-lg\"] ) && empty( $thumbs[\"retina\"] ) ) {\n\t\t$r['thumb'] = $thumbs[\"default\"];\n\t\t$img = get_picture_attributes( $r );\n\t\t$picture = '<img src=\"' . $img['src'] . '\" alt=\"' . $img['alt'] . '\" width=\"' . $img['width'] . '\" height=\"' . $img['height'] . '\">';\n\t} else {\n\t\t$picture = '<picture>';\n\t\tif ( ! empty( $thumbs[\"screen-xs\"] ) ) {\n\t\t\t$r['thumb'] = $thumbs[\"screen-xs\"];\n\t\t\t$img = get_picture_attributes( $r );\n\t\t\t$picture .= '<source srcset=\"' . $img['src'] . '\" media=\"(min-width: 480px)\">';\n\t\t}\n\t\tif ( ! empty( $thumbs[\"screen-sm\"] ) ) {\n\t\t\t$r['thumb'] = $thumbs[\"screen-sm\"];\n\t\t\t$img = get_picture_attributes( $r );\n\t\t\t$picture .= '<source srcset=\"' . $img['src'] . '\" media=\"(min-width: 768px)\">';\n\t\t}\n\t\tif ( ! empty( $thumbs[\"screen-md\"] ) ) {\n\t\t\t$r['thumb'] = $thumbs[\"screen-md\"];\n\t\t\t$img = get_picture_attributes( $r );\n\t\t\t$picture .= '<source srcset=\"' . $img['src'] . '\" media=\"(min-width: 992px)\">';\n\t\t}\n\t\tif ( ! empty( $thumbs[\"screen-lg\"] ) ) {\n\t\t\t$r['thumb'] = $thumbs[\"screen-lg\"];\n\t\t\t$img = get_picture_attributes( $r );\n\t\t\t$picture .= '<source srcset=\"' . $img['src'] . '\" media=\"(min-width: 1200px)\">';\n\t\t}\n\t\tif ( ! empty( $thumbs[\"retina\"] ) ) {\n\t\t\t$r['thumb'] = $thumbs[\"retina\"];\n\t\t\t$img = get_picture_attributes( $r );\n\t\t\t$picture .= '<source srcset=\"' . $img['src'] . '\" media=\"(min-device-width : 768px) and (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) \">';\n\t\t}\n\t\tif ( ! empty( $thumbs[\"default\"] ) ) {\n\t\t\t$r['thumb'] = $thumbs[\"default\"];\n\t\t\t$img = get_picture_attributes( $r );\n\t\t\t$picture .= '<img srcset=\"' . $img['src'] . '\" alt=\"' . $img['alt'] . '\" width=\"' . $img['width'] . '\" height=\"' . $img['height'] . '\">';\n\t\t}\n\t\t$picture .= '</picture>';\n\t}\n\n\n\treturn $picture;\n}",
"function featuredBG($size = 'full', $pos_x = 'center', $pos_y = 'center', $repeat = 'no-repeat'){\n $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $size );\n $url = $thumb['0'];\n echo 'style=\"background: url('. $url .')'. $pos_x .' '. $pos_y .' ' . $repeat .'\"';\n}",
"function generate_video_bg_html( $webm = '', $ogv = '', $mp4 = '', $poster = '', $echo = false, $autoplay = true, $loop = true ) {\n $attr_auto = $autoplay ? 'autoplay' : '';\n $attr_loop = $loop ? 'loop' : '';\n $attr_poster = $poster[0] ? \"poster='{$poster[0]}'\" : '';\n $source_webm = $webm ? \"<source src='{$webm}' type='video/mp4' />\" : '';\n $source_ogv = $ogv ? \"<source src='{$ogv}' type='video/webm' />\" : '';\n $source_mp4 = $mp4 ? \"<source src='{$mp4}' type='video/ogg' />\" : '';\n $img_poster = $poster[0] ? \"<img src='{$poster[0]}' alt='' />\" : '';\n $is_sources = ($source_webm || $source_ogv || $source_mp4 || $poster);\n\n /* If there is anything that we can show, go on */\n $output = $is_sources ? \"\n <video class='background-video' {$attr_poster} {$attr_auto} {$attr_loop}>\n {$source_webm}\n {$source_ogv}\n {$source_mp4}\n {$img_poster}\n </video> \n \" : '';\n\n if ($echo) :\n echo $output;\n else : \n return $output;\n endif;\n}",
"public function getMediaImageShortCode($attributes, $content, $tag)\n {\n if ($attributes) {\n $image = wp_get_attachment_image_src($attributes[0], '');\n return '<!-- '. $content .' --><img src=\"' . $image[0] . '\" width=\"' . $image[1] . '\" height=\"' . $image[2] . '\" class=\"' . $tag . '\" />';\n }\n\n return null;\n }",
"public function set_background_card(String $_background_picture){\n $this->_background_card = $_background_picture;\n\n return $this;\n }",
"function get_background($page_id){\n\n\t$custom_meta = get_post_custom($page_id);\n\t\n\tif(isset($custom_meta['lumen_page_background']) && isset($custom_meta['lumen_page_background'][0]) && $page_id != \"default\"){\n\t\t$background = unserialize($custom_meta['lumen_page_background'][0]);\t\n\t\tif($background['background-color'] == \"\" && $background['background-image'] == \"\") {\n\t\t\t$background = ot_get_option('lumen_site_default_background');\n\t\t}\n\t}\telse {\n\t\t$background = ot_get_option('lumen_site_default_background');\n\t}\n\t\n\t$background_image = \"\";\n\tif(isset($background['background-image'])){\n\t\t$background_image = $background['background-image'];\n\t\tif(strlen($background_image) > 0) {\n\t\t\t$background_image = 'url('.$background_image.')';\n\t\t}\n\t}\n\t\n\t$output = \"\";\n\t$background_repeat = false;\n\t\n\tif(isset($background['background-color'])){ $output .= $background['background-color'].\" \"; }\n\t$output .= $background_image.\" \";\n\tif(isset($background['background-repeat'])){ \n\t\t$output .= $background['background-repeat'].\" \"; \n\t\tif($background['background-repeat'] == \"repeat\"){\n\t\t\t$background_repeat = true;\t\t\n\t\t} \n\t}\n\tif(isset($background['background-attachment'])){ $output .= $background['background-attachment'].\" \"; }\n\tif(isset($background['background-position'])){ $output .= $background['background-position'].\" \"; }\n\t\n\tif(strlen(trim($output)) > 0 && $background_repeat) { \n\t\treturn 'background: '.$output.'; background-size: inherit!important;'; \n\t}else{\n\t\treturn 'background: '.$output; \n\t}\n\t\n\treturn \"\";\n}",
"function constructHTML_media($boundary) {\n\t\t\t// media is added\n\t\tif (is_array($this->theParts['html']['media']) && $this->includeMedia) {\n\t\t\tforeach ($this->theParts['html']['media'] as $key => $media) {\n\t\t\t\tif (!$this->mediaList || t3lib_div::inList($this->mediaList,$key))\t{\n\t\t\t\t\t$this->add_message(\"--\".$boundary);\n\t\t\t\t\t$this->add_message(\"Content-Type: \".$media[\"ctype\"]);\n\t\t\t\t\t$this->add_message(\"Content-ID: <part\".$key.\".\".$this->messageid.\">\");\n\t\t\t\t\t$this->add_message(\"Content-Transfer-Encoding: base64\");\n\t\t\t\t\t$this->add_message('');\n\t\t\t\t\t$this->add_message($this->makeBase64($media[\"content\"]));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->add_message(\"--\".$boundary.\"--\\n\");\n\t}",
"protected function getPackedContent( Array $media_list, $prepend_string = '' )\n\t{\n\t\t$content = $prepend_string;\n\t\tforeach ( $media_list as $media )\n\t\t{\n\t\t\t$filename = ROOT_PATH . '/' . $media['filename'];\n\n\t\t\tif ( is_file( $filename ) )\n\t\t\t{\n\t\t\t\t$content .= \"/* BEGIN {$media['name']} */\\n\\n\" . chr( 13 );\n\t\t\t\t$content .= file_get_contents( $filename ) . chr( 13 );\n\t\t\t\t$content .= \"\\n\\n/* END {$media['name']} */\" . chr( 13 );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$content .= \"alert( 'File {$media['name']} not found' );\";\n\t\t\t}\n\t\t}\n\n\t\treturn $content;\n\n\t}",
"function background_img($link){\n\t\t\t\techo \"<style> body{background: url(\". $link. \");\n\t\t\t\t\t\t\t\t\tbackground-repeat: no-repeat;\n\t\t\t\t\t\t\t\t\tbackground-size: cover;\n\t\t\t\t\t\t\t\t\t} </style>\";\n\t\t\t}",
"public function get_background_image_srcset( $image_id, $default_size = \"medium\" ){\n\t\t$html = 'data-bg-srcset=\"' . wp_get_attachment_image_srcset( $image_id, $size = $default_size ) . '\"';\n\t\treturn $html;\n\t}",
"function image_src($id, $size = 'full', $background_image = false, $height = false) {\n if ($image = wp_get_attachment_image_src($id, $size, true)) {\n return $background_image ? 'background-image: url('.$image[0].');' . ($height?'height:'.$image[2].'px':'') : $image[0];\n }\n}",
"function get_media_background_video( $videos, $loop=false ) {\n\tob_start();\n?>\n\t<video class=\"hidden-xs-down media-background media-background-video object-fit-cover\" autoplay muted playsinline <?php if ( $loop ) { ?>loop<?php } ?>>\n\t\t<?php if ( isset( $videos['webm'] ) ) : ?>\n\t\t<source src=\"<?php echo $videos['webm']; ?>\" type=\"video/webm\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $videos['mp4'] ) ) : ?>\n\t\t<source src=\"<?php echo $videos['mp4']; ?>\" type=\"video/mp4\">\n\t\t<?php endif; ?>\n\t</video>\n\t<button class=\"media-background-video-toggle btn play-enabled hidden-xs-up\" type=\"button\" data-toggle=\"button\" aria-pressed=\"false\" aria-label=\"Play or pause background videos\">\n\t\t<span class=\"fa fa-pause media-background-video-pause\" aria-hidden=\"true\"></span>\n\t\t<span class=\"fa fa-play media-background-video-play\" aria-hidden=\"true\"></span>\n\t</button>\n<?php\n\treturn ob_get_clean();\n}",
"public function getBackgroundImage()\r\n {\r\n $orientation = $this->getOrientation();\r\n $backgroundImage = '';\r\n /** @var $helperImage Mage_XmlConnect_Helper_Image */\r\n $helperImage = Mage::helper('xmlconnect/image');\r\n\r\n switch ($orientation) {\r\n case Mage_XmlConnect_Helper_Ipad::ORIENTATION_LANDSCAPE:\r\n $configPath = 'conf/body/backgroundIpadLandscapeImage';\r\n $imageUrlOrig = $this->getData($configPath);\r\n if ($imageUrlOrig) {\r\n $width = Mage_XmlConnect_Helper_Ipad::PREVIEW_LANDSCAPE_BACKGROUND_WIDTH;\r\n $height = Mage_XmlConnect_Helper_Ipad::PREVIEW_LANDSCAPE_BACKGROUND_HEIGHT;\r\n $backgroundImage = $helperImage->getCustomSizeImageUrl($imageUrlOrig, $width, $height);\r\n } else {\r\n $backgroundImage = $this->getPreviewImagesUrl('ipad/background_home_landscape.jpg');\r\n }\r\n break;\r\n case Mage_XmlConnect_Helper_Ipad::ORIENTATION_PORTRAIT:\r\n $configPath = 'conf/body/backgroundIpadPortraitImage';\r\n $imageUrlOrig = $this->getData($configPath);\r\n if ($imageUrlOrig) {\r\n $width = Mage_XmlConnect_Helper_Ipad::PREVIEW_PORTRAIT_BACKGROUND_WIDTH;\r\n $height = Mage_XmlConnect_Helper_Ipad::PREVIEW_PORTRAIT_BACKGROUND_HEIGHT;\r\n $backgroundImage = $helperImage->getCustomSizeImageUrl($imageUrlOrig, $width, $height);\r\n } else {\r\n $backgroundImage = $this->getPreviewImagesUrl('ipad/background_portrait.jpg');\r\n }\r\n break;\r\n default:\r\n Mage::throwException(\r\n Mage::helper('xmlconnect')->__('Wrong Ipad background image orientation has been specified: \"%s\".', $orientation)\r\n );\r\n break;\r\n }\r\n return $backgroundImage;\r\n }",
"function background_image()\n {\n }",
"function get_css_files_media_array();",
"function image_src($id, $size = 'full', $background_image = false, $height = false) {\n if ($image = wp_get_attachment_image_src($id, $size, true)) {\n return $background_image ? 'background-image: url('.$image[0].');' . ($height?'min-height:'.$image[2].'px':'') : $image[0];\n }\n}",
"function images($category) {\n\tglobal $mediadb, $db_host, $db_user, $db_pwd;\n\t\n\t$mediadb = mysqli_connect(\"$db_host\",\"$db_user\",\"$db_pwd\",\"mediaDb\");\n mysqli_set_charset($mediadb,'utf8'); \n\t\t?>\n\t\t\t<B>Available images:</B><BR><BR>\n\t\t\tBackground - For display behind text<BR>\n\t\t\tImage - For standalone display<BR><BR>\n\t\t\t<TABLE BORDER=2>\n\t\t\t\t<TR>\n\t\t\t\t\t<TH>Description</TH>\n\t\t\t\t\t<TH>Type</TH>\n\t\t\t\t</TR>\n\t\t<?\n\t\t\t$results = mysqli_query($mediadb,\"SELECT description, type, id, format FROM media WHERE category='$category' ORDER BY description\");\n\t\t\t\n\t\t\twhile ($row = mysqli_fetch_row($results)) {\n\t\t\t\techo \"<TR><TD>$row[0]</TD>\";\n\t\t\t\tif ($row[1] == \"bg\") {\n\t\t\t\t\techo \"<TD>Background</TD>\";\t\n\t\t\t\t} elseif ($row[1] == \"img\") {\n\t\t\t\t\techo \"<TD>Image</TD>\";\n\t\t\t\t} else {\n\t\t\t\t\techo \"<TD>Unknown</TD>\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\techo \"<TD><A HREF=\\\"viewer.php?imageid=$row[2]&format=$row[3]\\\" target=\\\"_new\\\">Show</A></TD></TR>\";\n\t\t\t\t\n\t\t\t}\n\t\t?>\n\t\t\t</TABLE>\n\t\t<?\n\t}",
"public function buildMeme($arrElement)\n {\n if (!empty($arrElement['strBackground'])) {\n $arrImage = explode(',', $arrElement['strBackground']);\n $strBase64prefx = $arrImage[0];\n array_shift($arrImage);\n $strImageBlob = base64_decode(join(',', $arrImage));\n\n\n $objFinfo = finfo_open(FILEINFO_MIME);\n $strMimeType = finfo_buffer($objFinfo, $strImageBlob);\n finfo_close($objFinfo);\n if (strpos($strMimeType, ';') !== false) {\n $arrTokens = explode(';', $strMimeType);\n $strMimeType = trim($arrTokens[0]);\n } else {\n $strBaseMimeType = str_replace(array('data:', ';base64'), '', $strBase64prefx);\n $strMimeType = File::extensionToMimeType($strBaseMimeType);\n }\n $strFileExtension = File::mimetypeToExtension($strMimeType);\n\n\n $strFileName = sprintf('%s.%s', String::slug($arrElement['strTitle']), $strFileExtension);\n $strFilePath = __DIR__ . '/../../../../var/tmp/' . $strFileName;\n file_put_contents($strFilePath, $strImageBlob);\n // $arrElement['strTmpFilePath'] = $strFilePath;\n\n $thumb = new \\PHPThumb\\GD($strFilePath, array(\n 'resizeUp' => true\n ));\n $arrOrginalDimensions = $thumb->getCurrentDimensions();\n $numRatio = $arrOrginalDimensions['width'] / $arrElement['numWidth'];\n $numNewHeight = round($arrOrginalDimensions['height'] / $numRatio);\n $thumb->resize($arrElement['numWidth'], $numNewHeight);\n\n\n $strImageBlob = $thumb->getImageAsString();\n unlink($strFilePath);\n\n\n $strBackgroundFilename = String::random(64) . '.' . $strFileExtension;\n $arrBackgroundAddResult = MemeBackgroundController::add($strBackgroundFilename, $strImageBlob, $arrElement['strTitle']);\n\n $arrElement['numMemeBackgroundId'] = $arrBackgroundAddResult['result']['numBackgroundId'];\n } else {\n $objMememBackgroundModel = new MemeBackgroundModel();\n $arrMemeBackground = $objMememBackgroundModel->getById($arrElement['numMemeBackgroundId']);\n $strMemeBackgroundUrl = $arrMemeBackground['image_path'] . '/' . $arrMemeBackground['image_filename'];\n $strImageBlob = file_get_contents($strMemeBackgroundUrl);\n\n $arrFilenameTokens = explode('.', $arrMemeBackground['image_filename']);\n $strFileExtension = array_pop($arrFilenameTokens);\n\n $arrSizes = getimagesize($strMemeBackgroundUrl);\n $arrOrginalDimensions = array(\n 'width' => $arrSizes[0],\n 'height' => $arrSizes[1]\n );\n $numRatio = $arrOrginalDimensions['width'] / $arrElement['numWidth'];\n $numNewHeight = round($arrOrginalDimensions['height'] / $numRatio);\n }\n\n\n $arrElement['strExtension'] = $strFileExtension;\n\n\n $im = imagecreatefromstring($strImageBlob);\n\n $objColorWhite = new GDText\\Color(255, 255, 255);\n $objColorBlack = new GDText\\Color(0, 0, 0);\n\n $box = new GDText\\Box($im);\n// $box->enableDebug();\n $box->setFontFace(APP_DIR . '/impact.ttf');\n $box->setFontColor($objColorWhite);\n $box->addTextShadow($objColorBlack, 3, 3);\n $box->addTextShadow($objColorBlack, -3, -3);\n $box->addTextShadow($objColorBlack, 3, -3);\n $box->addTextShadow($objColorBlack, -3, 3);\n $box->addTextShadow($objColorBlack, 0, 3);\n $box->addTextShadow($objColorBlack, 0, -3);\n $box->addTextShadow($objColorBlack, 3, 0);\n $box->addTextShadow($objColorBlack, -3, 0);\n\n $box->setFontSize(60);\n $box->setBox(20, 20, $arrElement['numWidth'] - 40, 150);\n $box->setTextAlign('center', 'top');\n $box->draw(mb_strtoupper($arrElement['strTitle'], 'UTF-8'));\n\n\n $box->setTextShadow($objColorBlack, 2, 2);\n $box->addTextShadow($objColorBlack, -2, -2);\n $box->addTextShadow($objColorBlack, 2, -2);\n $box->addTextShadow($objColorBlack, -2, 2);\n $box->addTextShadow($objColorBlack, 0, 2);\n $box->addTextShadow($objColorBlack, 0, -2);\n $box->addTextShadow($objColorBlack, 2, 0);\n $box->addTextShadow($objColorBlack, -2, 0);\n\n $box->setFontSize(30);\n $box->setBox(20, $numNewHeight - 20 - 105, $arrElement['numWidth'] - 40, 113);\n $box->setTextAlign('center', 'bottom');\n $box->draw(mb_strtoupper($arrElement['strDescription'], 'UTF-8'));\n\n ob_start();\n imagejpeg($im, null, 75);\n $arrElement['strImageBlob'] = ob_get_contents();\n ob_clean();\n\n\n return $arrElement;\n\n }",
"function render($src = '', $index_page = FALSE, $additional = '') {\n $link = array();\n if (is_array($src)) {\n $link = $src;\n $link['class'] = isset($src['class']) ? $src['class'] . ' img-responsive' : 'img-responsive';\n $title = isset($src['title']) ? $src['title'] : '';\n $data_title = isset($src['data-title']) ? $src['data-title'] : $title;\n $url = isset($src['src']) ? $src['src'] : '';\n $link['src'] = isset($src['thumb']) ? $src['thumb'] : $url;\n unset($link['thumb']);\n } else {\n $link['class'] = 'img-responsive';\n $link['src'] = $src;\n $title = $data_title = '';\n $url = $src;\n }\n $image = img($link, $index_page);\n return <<<EOF\n <a href=\"$url\" data-toggle=\"lightbox\" data-title=\"$data_title\" $additional>\n $image\n </a>\nEOF;\n }",
"public function prepare_background( $data ) {\n\n\t\t\tif ( ! is_array( $data ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tunset( $data['image'] );\n\n\t\t\t$result = '';\n\t\t\t$format = 'background-%s:%s;';\n\n\t\t\tforeach ( $data as $prop => $value ) {\n\n\t\t\t\tif ( ! $value ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tswitch ( $prop ) {\n\t\t\t\t\tcase 'color':\n\t\t\t\t\t\t$value = $this->sanitize_hex_color( $value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'position':\n\t\t\t\t\t\t$value = str_replace( '-', ' ', $value );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$result .= sprintf( $format, $prop, $value );\n\t\t\t}\n\n\t\t\treturn $result;\n\t\t}"
]
| [
"0.6536556",
"0.5887311",
"0.5790553",
"0.5657168",
"0.55560076",
"0.5473525",
"0.54461557",
"0.5433338",
"0.541618",
"0.5413314",
"0.5358382",
"0.53219867",
"0.5315457",
"0.5312631",
"0.52845126",
"0.52441555",
"0.51738805",
"0.5092402",
"0.50889355",
"0.5043791",
"0.5006097",
"0.50046",
"0.49734905",
"0.4961944",
"0.49585247",
"0.4950586",
"0.49375564",
"0.48783606",
"0.48733118",
"0.48690474"
]
| 0.7484566 | 0 |
Returns markup for a media background element. $videos is expected to be an array whose keys correspond to supported filetypes; e.g. $videos = array( 'webm' => '...', 'mp4' => '...' ). Values should be video urls. Note: we never display autoplay videos at the xs breakpoint. | function get_media_background_video( $videos, $loop=false ) {
ob_start();
?>
<video class="hidden-xs-down media-background media-background-video object-fit-cover" autoplay muted playsinline <?php if ( $loop ) { ?>loop<?php } ?>>
<?php if ( isset( $videos['webm'] ) ) : ?>
<source src="<?php echo $videos['webm']; ?>" type="video/webm">
<?php endif; ?>
<?php if ( isset( $videos['mp4'] ) ) : ?>
<source src="<?php echo $videos['mp4']; ?>" type="video/mp4">
<?php endif; ?>
</video>
<button class="media-background-video-toggle btn play-enabled hidden-xs-up" type="button" data-toggle="button" aria-pressed="false" aria-label="Play or pause background videos">
<span class="fa fa-pause media-background-video-pause" aria-hidden="true"></span>
<span class="fa fa-play media-background-video-play" aria-hidden="true"></span>
</button>
<?php
return ob_get_clean();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generate_video_bg_html( $webm = '', $ogv = '', $mp4 = '', $poster = '', $echo = false, $autoplay = true, $loop = true ) {\n $attr_auto = $autoplay ? 'autoplay' : '';\n $attr_loop = $loop ? 'loop' : '';\n $attr_poster = $poster[0] ? \"poster='{$poster[0]}'\" : '';\n $source_webm = $webm ? \"<source src='{$webm}' type='video/mp4' />\" : '';\n $source_ogv = $ogv ? \"<source src='{$ogv}' type='video/webm' />\" : '';\n $source_mp4 = $mp4 ? \"<source src='{$mp4}' type='video/ogg' />\" : '';\n $img_poster = $poster[0] ? \"<img src='{$poster[0]}' alt='' />\" : '';\n $is_sources = ($source_webm || $source_ogv || $source_mp4 || $poster);\n\n /* If there is anything that we can show, go on */\n $output = $is_sources ? \"\n <video class='background-video' {$attr_poster} {$attr_auto} {$attr_loop}>\n {$source_webm}\n {$source_ogv}\n {$source_mp4}\n {$img_poster}\n </video> \n \" : '';\n\n if ($echo) :\n echo $output;\n else : \n return $output;\n endif;\n}",
"function thb_portfolio_video() {\n\t$id = get_the_ID();\n\t$portfolio_header_video = get_post_meta($id, 'portfolio_header_video', true);\n\t$portfolio_header_video_url = wp_get_attachment_url($portfolio_header_video);\n\tif ($portfolio_header_video_url) {\n\t\t$portfolio_header_video_poster = get_post_meta($id, 'portfolio_header_video_poster', true);\n\t\t$portfolio_header_video_poster_url = wp_get_attachment_url($portfolio_header_video_poster);\n\t\t$video_type = wp_check_filetype( $portfolio_header_video_url, wp_get_mime_types() );\n\t\t$poster_type = wp_check_filetype( $portfolio_header_video_poster_url, wp_get_mime_types() );\n\t\t$portfolio_header_video_loop = get_post_meta($id, 'portfolio_header_video_loop', true) !== 'off' ? 'true' : 'false';\n\n\t\t$attributes[] = 'data-vide-bg=\"'.$video_type['ext'].': '. esc_attr($portfolio_header_video_url) . ($portfolio_header_video_poster_url ? ', poster: '.esc_attr($portfolio_header_video_poster_url) : '').'\"';\n\n\t\t$attributes[] = 'data-vide-options=\"posterType: ' . ( $poster_type['ext'] ? esc_attr($poster_type['ext']) : 'none' ) . ', loop: '.$portfolio_header_video_loop.', muted: true, position: 50% 50%, resizing: true\"';\n\t} else {\n\t\t$attributes[] = '';\n\t}\n\treturn $attributes;\n}",
"public function video_tag($sources, $attributes = NULL){\n if (is_array($sources)) {\n $html_content = \"\";\n\n foreach ($sources as $source) {\n if (is_string($source))\n $html_content .= content_tag(\"source\", NULL, array(\"src\" => $source));\n else\n $html_content .= content_tag(\"source\", NULL, $source);\n }\n\n return content_tag(\"video\", $html_content, $attributes);\n }\n else {\n $options = array(\"src\" => $sources);\n if (is_array($attributes)){\n $options = array_merge($options, $attributes);\n }\n return content_tag(\"video\", NULL, $options);\n }\n }",
"public function videos()\n {\n $this->videos->videosAttrs = ['title', 'url', ['thumb', 'medium']];\n $this->videos->limit = 2;\n $records = $this->videos->all();\n\n return ['videos' => $records];\n }",
"function timeless_video_attributes_body() {\n\t$attributes['class'] = join( ' ', get_body_class() );\n\t$attributes['itemscope'] = 'itemscope';\n\t$attributes['itemtype'] = 'http://schema.org/WebPage';\n\t$attributes['data-vide-bg'] = 'mp4: ' . get_theme_mod( 'homepage_background_video', get_stylesheet_directory_uri() . '/images/video-default.mp4' ) . ', poster: ' . get_theme_mod( 'default_background_image', get_stylesheet_directory_uri() . '/images/bkg-default.jpg' );\n\t$attributes['data-vide-options'] = 'className: bg-video, posterType: jpg';\n\n\treturn $attributes;\n}",
"function get_media_background_picture( $srcs ) {\n\tob_start();\n\n\tif ( isset( $srcs['fallback'] ) ) :\n?>\n\t<?php\n\t// Define classes for the <picture> element\n\t$picture_classes = 'media-background-picture ';\n\tif ( !isset( $srcs['xs'] ) ) {\n\t\t// Hide the <picture> element at -xs breakpoint when no mobile image\n\t\t// is available\n\t\t$picture_classes .= 'hidden-xs-down';\n\t}\n\t?>\n\t<picture class=\"<?php echo $picture_classes; ?>\">\n\t\t<?php if ( isset( $srcs['xl'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['xl']; ?>\" media=\"(min-width: 1200px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['lg'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['lg']; ?>\" media=\"(min-width: 992px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['md'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['md']; ?>\" media=\"(min-width: 768px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['sm'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['sm']; ?>\" media=\"(min-width: 576px)\">\n\t\t<?php endif; ?>\n\n\t\t<?php if ( isset( $srcs['xs'] ) ) : ?>\n\t\t<source srcset=\"<?php echo $srcs['xs']; ?>\" media=\"(max-width: 575px)\">\n\t\t<?php endif; ?>\n\n\t\t<img class=\"media-background object-fit-cover\" src=\"<?php echo $srcs['fallback']; ?>\" alt=\"\">\n\t</picture>\n<?php\n\tendif;\n\n\treturn ob_get_clean();\n}",
"function video_list_thumbnail($videoList)\n{\n\tforeach ($videoList as $video) {\n\t\t$id = $video->video_id;\n\t\t$title = $video->video_title;\n\t\t$year = $video->video_year;\n\t\techo \"<div class='col-md-6' data-toggle='tooltip' data-placement='top' title='$title'> \";\n\t\t\techo a_open(\"thumbnail\", base_url().\"video/$id\");\n\t\t\t\techo img(\"data/music/videos/$id/cover.png\");\n\t\t\techo a_close();\n\t\techo div_close();\n\t}\n}",
"function _video($src, $width, $height, $atts = null) {\n // prepare width and height\n if(is_null($atts)) $atts = array();\n $atts['width'] = (int) $width;\n $atts['height'] = (int) $height;\n if(!$atts['width']) $atts['width'] = 320;\n if(!$atts['height']) $atts['height'] = 240;\n\n $posterUrl = '';\n $files = array();\n $isExternal = media_isexternal($src);\n\n if ($isExternal) {\n // take direct source for external files\n list(/*ext*/, $srcMime) = mimetype($src);\n $files[$srcMime] = $src;\n } else {\n // prepare alternative formats\n $extensions = array('webm', 'ogv', 'mp4');\n $files = media_alternativefiles($src, $extensions);\n $poster = media_alternativefiles($src, array('jpg', 'png'));\n if(!empty($poster)) {\n $posterUrl = ml(reset($poster), '', true, '&');\n }\n }\n\n $out = '';\n // open video tag\n $out .= '<video '.buildAttributes($atts).' controls=\"controls\"';\n if($posterUrl) $out .= ' poster=\"'.hsc($posterUrl).'\"';\n $out .= '>'.NL;\n $fallback = '';\n\n // output source for each alternative video format\n foreach($files as $mime => $file) {\n if ($isExternal) {\n $url = $file;\n $linkType = 'externalmedia';\n } else {\n $url = ml($file, '', true, '&');\n $linkType = 'internalmedia';\n }\n $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file)));\n\n $out .= '<source src=\"'.hsc($url).'\" type=\"'.$mime.'\" />'.NL;\n // alternative content (just a link to the file)\n $fallback .= $this->$linkType($file, $title, null, null, null, $cache = null, $linking = 'linkonly', $return = true);\n }\n\n // finish\n $out .= $fallback;\n $out .= '</video>'.NL;\n return $out;\n }",
"function getVideos($url, $width, $height, $config) {\r\n \t$video = '';\r\n\r\n\t\t$url = trim($url);\r\n\t\t$url = str_replace('http://', '', $url);\r\n\r\n // youtube\r\n if (strpos($url,'outube.com')) {\r\n $found = 1;\r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://www.youtube.com/v/'.$split[1].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");';\r\n // Dailymotion\r\n } elseif (strpos($url,'ailymotion.co')) {\r\n $found = 1;\r\n $video = 'new SWFObject(\"http://'.$url.'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");';\r\n // video.google.com/.de\r\n } elseif (strpos($url,'ideo.google.')) {\r\n $found = 1; \r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://video.google.com/googleplayer.swf?docId='.$split[1].'&hl='.$GLOBALS['TSFE']->lang.'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // Metacafe\r\n } elseif (strpos($url,'metacafe.')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://www.metacafe.com/fplayer/'.$split[2].'/.swf\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // MyVideo.de\r\n } elseif (strpos($url,'yvideo.de')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://www.myvideo.de/movie/'.$split[2].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n // clipfish.de\r\n\t\t} elseif (strpos($url,'lipfish.de')) {\r\n $found = 1;\r\n $split = explode('=',$url);\r\n $video = 'new SWFObject(\"http://www.clipfish.de/videoplayer.swf?as=0&videoid='.$split[1].'\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n\t\t// sevenload\r\n\t\t} elseif (strpos($url,'sevenload.com')) {\r\n $found = 1;\r\n $split = explode('/',$url);\r\n $video = 'new SWFObject(\"http://de.sevenload.com/pl/'.$split[2].'/'.$width.'x'.$height.'/swf\", \"sfwvideo\", \"'.$width.'\",\"'.$height.'\", \"9\", \"#'.$config['backgroundColor'].'\", \"wmode\", \"transparent\");'; \r\n } \r\n\r\n\t\treturn $video;\r\n\t}",
"protected function _extract_videos($src=null)\n {\n $this->log('Extracting video clips');\n\n if (null === $src) {\n $src = &$this->_response;\n }\n\n if (!preg_match_all(\n '#<div class=\"cat-cnt-item-th\">(.+?)</div>#',\n $src,\n $m\n )) {\n return false;\n }\n\n $videos = array();\n foreach ($m[1] as &$s) {\n if (!preg_match(\n '#href=\"(?P<url>[^\"]+)\" title=\"(?P<desc>[^\"]+)#',\n $s,\n $a\n )) {\n continue;\n }\n\n preg_match('#<span>(?P<title>[^<]+)</span>#', $s, $b);\n if (!preg_match(\n '#src=\"[^\"]+/media/(?P<filename>[^\"]+)_\\d{4}_thumb\\.jpg#',\n $s,\n $c\n )) {\n $resp = $this->_connection->get($a['url']);\n if (preg_match(\n '#sGlobalFileName=\\'([^\\']+)\\'#',\n $resp,\n $c1\n ) && preg_match(\n '#sGlobalContentFilePath=\\'([^\\']+)\\'#',\n $resp,\n $c2\n )) {\n $c = array('filename' => \"{$c2[1]}/{$c1[1]}\");\n } else {\n $c = null;\n }\n }\n\n if (!empty($c['filename'])) {\n $c['url'] = sprintf(self::FLV_FILE_URL, $c['filename']);\n $videos[] = array_combine(\n array('url', 'filename', 'title', 'description'),\n array_map('trim', array_map(\n 'html_entity_decode',\n array($c['url'], $c['filename'], $b['title'], $a['desc'])\n ))\n );\n }\n }\n return $videos;\n }",
"function getVideoEmebed($url, $config, $width, $height) {\r\n\t\t$uniqueUid = ' rgmi'.$this->getUniqueID().' '; \r\n\t\t$video = '<span class=\"rgmediaimages-player'.$uniqueUid.'\">\r\n <embed src=\"'.t3lib_extMgm::siteRelpath('rgmediaimages').'res/mediaplayer.swf\" width=\"'.$width.'\" height=\"'.$height.'\" allowfullscreen=\"true\" allowscriptaccess=\"always\" flashvars=\"&file='.$url.'&'.$config.'\" />\r\n </span>';\r\n\t\treturn $video;\t\r\n\t}",
"function wp_underscore_video_template() {\n\t$video_types = wp_get_video_extensions();\n\t?>\n<# var w_rule = '', classes = [],\n\t\tw, h, settings = wp.media.view.settings,\n\t\tisYouTube = isVimeo = false;\n\n\tif ( ! _.isEmpty( data.model.src ) ) {\n\t\tisYouTube = data.model.src.match(/youtube|youtu\\.be/);\n\t\tisVimeo = -1 !== data.model.src.indexOf('vimeo');\n\t}\n\n\tif ( settings.contentWidth && data.model.width >= settings.contentWidth ) {\n\t\tw = settings.contentWidth;\n\t} else {\n\t\tw = data.model.width;\n\t}\n\n\tif ( w !== data.model.width ) {\n\t\th = Math.ceil( ( data.model.height * w ) / data.model.width );\n\t} else {\n\t\th = data.model.height;\n\t}\n\n\tif ( w ) {\n\t\tw_rule = 'width: ' + w + 'px; ';\n\t}\n\n\tif ( isYouTube ) {\n\t\tclasses.push( 'youtube-video' );\n\t}\n\n\tif ( isVimeo ) {\n\t\tclasses.push( 'vimeo-video' );\n\t}\n\n#>\n<div style=\"{{ w_rule }}\" class=\"wp-video\">\n<video controls\n\tclass=\"wp-video-shortcode {{ classes.join( ' ' ) }}\"\n\t<# if ( w ) { #>width=\"{{ w }}\"<# } #>\n\t<# if ( h ) { #>height=\"{{ h }}\"<# } #>\n\t<?php\n\t$props = array(\n\t\t'poster' => '',\n\t\t'preload' => 'metadata',\n\t);\n\tforeach ( $props as $key => $value ) :\n\t\tif ( empty( $value ) ) {\n\t\t\t?>\n\t\t<#\n\t\tif ( ! _.isUndefined( data.model.<?php echo $key; ?> ) && data.model.<?php echo $key; ?> ) {\n\t\t\t#> <?php echo $key; ?>=\"{{ data.model.<?php echo $key; ?> }}\"<#\n\t\t} #>\n\t\t\t<?php\n\t\t} else {\n\t\t\techo $key\n\t\t\t?>\n\t\t\t=\"{{ _.isUndefined( data.model.<?php echo $key; ?> ) ? '<?php echo $value; ?>' : data.model.<?php echo $key; ?> }}\"\n\t\t\t<?php\n\t\t}\n\tendforeach;\n\t?>\n\t<#\n\t<?php\n\tforeach ( array( 'autoplay', 'loop' ) as $attr ) :\n\t\t?>\n\tif ( ! _.isUndefined( data.model.<?php echo $attr; ?> ) && data.model.<?php echo $attr; ?> ) {\n\t\t#> <?php echo $attr; ?><#\n\t}\n\t<?php endforeach ?>#>\n>\n\t<# if ( ! _.isEmpty( data.model.src ) ) {\n\t\tif ( isYouTube ) { #>\n\t\t<source src=\"{{ data.model.src }}\" type=\"video/youtube\" />\n\t\t<# } else if ( isVimeo ) { #>\n\t\t<source src=\"{{ data.model.src }}\" type=\"video/vimeo\" />\n\t\t<# } else { #>\n\t\t<source src=\"{{ data.model.src }}\" type=\"{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}\" />\n\t\t<# }\n\t} #>\n\n\t<?php\n\tforeach ( $video_types as $type ) :\n\t\t?>\n\t<# if ( data.model.<?php echo $type; ?> ) { #>\n\t<source src=\"{{ data.model.<?php echo $type; ?> }}\" type=\"{{ settings.embedMimes[ '<?php echo $type; ?>' ] }}\" />\n\t<# } #>\n\t<?php endforeach; ?>\n\t{{{ data.model.content }}}\n</video>\n</div>\n\t<?php\n}",
"function bb_video($arguments = array()) {\n\t\t$content = $this->parseArray(array('[/video]'), array());\n\n\t\t$params['width'] = 570;\n\t\t$params['height'] = 360;\n\t\t$params['iframe'] = true;\n\t\t$previewthumb = '';\n\n\t\t$type = null;\n\t\t$id = null;\n\t\t$matches = array();\n\n\t\t//match type and id\n\t\tif (strstr($content, 'youtube.com') OR strstr($content, 'youtu.be')) {\n\t\t\t$type = 'youtube';\n\t\t\tif (preg_match('#(?:youtube\\.com/watch\\?v=|youtu.be/)([0-9a-zA-Z\\-_]{11})#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['src'] = '//www.youtube.com/embed/' . $id . '?autoplay=1';\n\t\t\t$previewthumb = 'https://img.youtube.com/vi/' . $id . '/0.jpg';\n\t\t} elseif (strstr($content, 'vimeo')) {\n\t\t\t$type = 'vimeo';\n\t\t\tif (preg_match('#vimeo\\.com/(?:clip\\:)?(\\d+)#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['src'] = '//player.vimeo.com/video/' . $id . '?autoplay=1';\n\n\t\t\t$videodataurl = 'http://vimeo.com/api/v2/video/' . $id . '.php';\n\t\t\t$data = '';\n\t\t\t$downloader = new UrlDownloader;\n\t\t\tif ($downloader->isAvailable()) {\n\t\t\t\t$data = $downloader->file_get_contents($videodataurl);\n\t\t\t}\n\t\t\tif ($data) {\n\t\t\t\t$data = unserialize($data);\n\t\t\t\t$previewthumb = $data[0]['thumbnail_medium'];\n\t\t\t}\n\t\t} elseif (strstr($content, 'dailymotion')) {\n\t\t\t$type = 'dailymotion';\n\t\t\tif (preg_match('#dailymotion\\.com/video/([a-z0-9]+)#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['src'] = '//www.dailymotion.com/embed/video/' . $id . '?autoPlay=1';\n\t\t\t$previewthumb = 'http://www.dailymotion.com/thumbnail/video/' . $id;\n\t\t} elseif (strstr($content, 'godtube')) {\n\t\t\t$type = 'godtube';\n\t\t\tif (preg_match('#godtube\\.com/watch/\\?v=([a-zA-Z0-9]+)#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['id'] = $id;\n\t\t\t$params['iframe'] = false;\n\n\t\t\t$previewthumb = 'http://www.godtube.com/resource/mediaplayer/' . $id . '.jpg';\n\t\t}\n\n\t\tif (empty($type) OR empty($id)) {\n\t\t\treturn '[video] Niet-ondersteunde video-website (' . htmlspecialchars($content) . ')';\n\t\t}\n\t\treturn $this->video_preview($params, $previewthumb);\n\t}",
"function show_one_video($video_id,$width,$height,$skin_media='default.zip'){\n\n\t\t$str_select=\"*\";\n\t\t$arr_where=array($this->_table.'.video_id'=>$video_id);\n\n\t\t$this->db->select($str_select);\n\t\t$this->db->where($arr_where);\n\n\t\t$query=$this->db->get($this->_table);\n\t\t$arr_video=$query->row_array();\n\n\t\t$string_video='';\n\n\t\tif(is_array($arr_video) && !empty($arr_video)){\n\n\t\t\tif(preg_match(\"/youtube.com/\",element('video_file',$arr_video,''))){\n\n\t\t\t\t$string_youtube=\"<iframe width='\".$width.\"' height='\".$height.\"' src='\".element('video_file',$arr_video,'').\"' frameborder='0' allowfullscreen></iframe>\";\n\t\t\t\treturn $string_youtube;\n\t\t\t}\n\n\t\t\t$string_flashvars=\"netstreambasepath=\".base_url();\n\t\t\t$string_flashvars.= \"&playlist.position=none\";\n\t\t\t$string_flashvars.= \"&playlist.size=0\";\n\t\t\t$string_flashvars.= \"&skin=\".base_url().DIR_PUBLIC.\"mediaplayer/skin/\".$skin_media;\n\t\t\t$string_flashvars.= \"&config=\".base_url().DIR_PUBLIC.\"mediaplayer/config/config.xml\";\n\t\t\t$string_flashvars.= \"&title=\".element('video_name',$arr_video,'');\n\t\t\t$string_flashvars.= \"&file=\".base_src_video(element('video_file',$arr_video,''));\n\t\t\tif(element('video_img',$arr_video,'') != \"\")\n\t\t\t\t$string_flashvars.= \"&image=\".base_src_img(element('video_img',$arr_video,''));\n\n\t\t\t$string_video=\"<object width='\".$width.\"' height='\".$height.\"' \";\n\t\t\t$string_video.= \"classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' \";\n\t\t\t$string_video.= \"codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' \";\n\t\t\t$string_video.= \"align='center' style='overflow:hidden'>\";\n\n\t\t\t$string_video.= \"<param name='movie' value='\".base_url().DIR_PUBLIC.\"mediaplayer/player.swf'>\";\n\t\t\t$string_video.= \"<param name='quality' value='high'>\";\n\t\t\t$string_video.= \"<param name='allowscriptaccess' value='always'>\";\n\t\t\t$string_video.= \"<param name='wmode' value='transparent'>\";\n\t\t\t$string_video.= \"<param name='allowfullscreen' value='true'>\";\n\t\t\t$string_video.= \"<param name='flashvars' value='\".$string_flashvars.\"'>\";\n\t\t\t$string_video.= \"<embed width='\".$width.\"' height='\".$height.\"' \";\n\t\t\t$string_video.= \"type='application/x-shockwave-flash' \";\n\t\t\t$string_video.= \"pluginspage='http://www.macromedia.com/go/getflashplayer' \";\n\t\t\t$string_video.= \"align='center' style='overflow:hidden' \";\n\n\t\t\t$string_video.= \"src='\".base_url().DIR_PUBLIC.\"mediaplayer/player.swf' \";\n\t\t\t$string_video.= \"quality='high' \";\n\t\t\t$string_video.= \"allowscriptaccess='always' \";\n\t\t\t$string_video.= \"wmode='transparent' \";\n\t\t\t$string_video.= \"allowfullscreen='true' \";\n\t\t\t$string_video.= \"flashvars='\".$string_flashvars.\"'>\";\n\t\t\t$string_video.= \"</object>\";\n\t\t}\n\t\treturn $string_video;\n\n\t}",
"static public function mediaYoutube($url) {\n $media = array();\n if (preg_match(\"/(.*?)v=(.*?)($|&)/i\", $url, $matching)) {\n $vid = $matching[2];\n array_push($media, \"http://i2.ytimg.com/vi/$vid/hqdefault.jpg\");\n array_push($media, '<iframe id=\"' . date(\"YmdHis\") . $vid . '\" width=\"%video_width%\" height=\"%video_height%\" src=\"http://www.youtube.com/embed/' . $vid . '%video_autostart%\" allowfullscreen></iframe>');\n } else {\n array_push($media, \"\", \"\");\n }\n return $media;\n }",
"static public function mediaMetacafe($url) {\n $media = array();\n preg_match('|metacafe\\.com/watch/([\\w\\-\\_]+)(.*)|', $url, $matching);\n if($matching[1]!=\"\") {\n $vid = $matching[1];\n $vtitle=trim($matching[2], \"/\");\n array_push($media, \"http://s4.mcstatic.com/thumb/{$vid}/0/6/videos/0/6/{$vtitle}.jpg\");\n array_push($media, '<iframe id=\"' . date(\"YmdHis\") . $vid . '\" width=\"%video_width%\" height=\"%video_height%\" src=\"http://www.metacafe.com/embed/'.$vid.'%video_autostart%\" allowFullScreen></iframe>');\n } else {\n array_push($media, \"\", \"\");\n }\n return $media;\n }",
"function pavi_shortcode_video($atts = array()){\n \n return pavi_get_display_video($atts);\n}",
"public function getEmbeddedMedia($types = array())\n {\n $content = apply_filters('the_content', $this->getContent());\n $embed = get_media_embedded_in_content($content, $types);\n\n if (in_array('audio', $types)):\n $output = str_replace('?visual=true', '?visual=false', $embed[0]); else:\n $output = $embed[0];\n endif;\n\n return $output;\n }",
"function me_theme_jetpack_responsive_videos() {\n\tadd_theme_support( 'jetpack-responsive-videos' );\n}",
"function onPrepareContent(&$row, &$params, $limitstart) {\r\n\t\t$db = JFactory::getDBO();\r\n\r\n\t\t//Fetch Inputs for Player from article content.\r\n\t\t$regexwidth = '/\\[hdplay videoid(.*?)]/i';\r\n\t\tpreg_match_all($regexwidth, $row->text, $matches);\r\n\r\n\t\t$widthm = $matches[0];\r\n\t\t$cnt = count($widthm);\r\n\r\n\t\t$width = 0;\r\n\t\t$height = 0;\r\n\t\t$enablexml = 0;\r\n $filepath = $videos = $thumImg = '';\r\n\t\tfor ($i = 0; $i < $cnt; $i++) {\r\n\t\t\t$strwhole = $widthm[$i];\r\n\r\n\t\t\t$playname = '';\r\n\t\t\t$autoplay = 'false';\r\n\t\t\t$width = 0;\r\n\t\t\t$height = 0;\r\n\t\t\t$enablexml = 0;\r\n\r\n\t\t\t//Fetch No.of Inputs given\r\n\t\t\t$no = explode(\" \", $strwhole);\r\n\r\n\t\t\t//Fetch Width, Height,Playlist Id, Video Id, Autoplay values from given content.\r\n\t\t\tfor ($k = 0; $k < count($no); $k++) {\r\n\t\t\t\t$str = $no[$k];\r\n\t\t\t\tif (strstr($str, 'videoid')) {\r\n\t\t\t\t\t$fileidarr = explode(\"=\", $str);\r\n\t\t\t\t\t$idval = $this->removesextraspace(trim($fileidarr[1]));\r\n\t\t\t\t\t$idval = rtrim($idval);\r\n\t\t\t\t}\r\n\t\t\t\tif (strstr($str, 'width')) {\r\n\t\t\t\t\t$widtharr = explode(\"=\", $no[$k]);\r\n\t\t\t\t\t$width = $this->removesextraspace(trim($widtharr[1]));\r\n\r\n\t\t\t\t}\r\n\t\t\t\tif (strstr($str, 'height')) {\r\n\t\t\t\t\t$heightarr = explode(\"=\", $no[$k]);\r\n\t\t\t\t\t$height = $this->removesextraspace(trim($heightarr[1]));\r\n\r\n\t\t\t\t}\r\n\t\t\t\tif (strstr($str, 'playlist')) {\r\n\t\t\t\t\t$playlistarr = explode(\"=\", $no[$k]);\r\n\t\t\t\t\t$playname = $this->removesextraspace(trim($playlistarr[1]));\r\n\r\n\t\t\t\t}\r\n\t\t\t\tif (strstr($str, 'autoplay')) {\r\n\t\t\t\t\t$autoplayarr = explode(\"=\", $no[$k]);\r\n\t\t\t\t\t$autoplay = $this->removesextraspace(trim($autoplayarr[1]));\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//Fetch filepath,videourl,thumburl values for given Video or Video from Playlist\r\n\t\t\tif ($idval != '') {\r\n\r\n\t\t\t\t$query = 'SELECT filepath,videourl,thumburl FROM #__hdflvplayerupload WHERE id='.$idval;\r\n\t\t\t\t$db->setQuery($query);\r\n\t\t\t\t$field = $db->loadObjectList();\r\n\t\t\t}\r\n\t\t\telseif ($idval != '' && $playname != '') {\r\n\r\n\t\t\t\t$query = 'SELECT filepath,videourl,thumburl FROM #__hdflvplayerupload WHERE playlistid='.$playname.' AND id='.$idval;\r\n\t\t\t\t$db->setQuery($query);\r\n\t\t\t\t$field = $db->loadObjectList();\r\n\t\t\t}\r\n\r\n\t\t\t//Checks for File path\r\n if(!empty($field))\r\n {\r\n\t\t\t$filepath = $field[0]->filepath;\r\n\r\n\t\t\t//If file option File or FFMpeg then, below fetch will work for Video & Thumb URL\r\n\t\t\tif ($filepath == \"File\" || $filepath == \"FFmpeg\") {\r\n\t\t\t\t$current_path = \"components/com_hdflvplayer/videos/\";\r\n\t\t\t\t$videos = JURI::base() . $current_path . $field[0]->videourl;\r\n\t\t\t\t$thumImg = JURI::base() . $current_path . $field[0]->thumburl;\r\n\t\t\t}\r\n\t\t\t//If file option Youtube then, below fetch will work for Video & Thumb URL\r\n\t\t\telseif ($filepath == \"Youtube\") {\r\n\t\t\t\t$videos = $field[0]->videourl;\r\n\t\t\t\t$thumImg = $field[0]->thumburl;\r\n\t\t\t}\r\n }\r\n\t\t\t//If Width, Height params empty, then set default values.\r\n\t\t\tif ($width == 0)\r\n\t\t\t{\r\n\t\t\t\t$width = 700;\r\n\t\t\t}\r\n\t\t\tif ($height == 0)\r\n\t\t\t{\r\n\t\t\t\t$height = 400;\r\n\t\t\t}\r\n\t\t\t$video = '';\r\n\t\t\t$regex = $strwhole;\r\n\r\n\t\t\t//Function calling for load player with necessary inputs.\r\n\t\t\t$replace = $this->addVideoHdplayer($video, $width, $height, $enablexml, $idval, $playname, $autoplay, $filepath, $videos, $thumImg);\r\n\t\t\t$row->text = str_replace($regex, $replace, $row->text);\r\n\t\t}\r\n\r\n\t}",
"function wpex_get_portfolio_post_video() {\n\n\t// Get video URl\n\t$video = wpex_get_post_video_html();\n\n\t// Return if no video\n\tif ( empty( $video ) ) {\n\t\treturn;\n\t}\n\n\t// Return video\n\treturn '<div class=\"portfolio-featured-video clr\">'. $video .'</div>';\n\n}",
"function video() {\n echo json_encode(array('element' => '<video controls autoplay> <source src=\"skysignagelight.1564484463.mp4\" type=\"video/mp4\"></video>'));\n exit;\n }",
"function emc_video() {\r\n\r\n\t// get the URL field\r\n\t$url = get_field( 'url' );\r\n\tif ( empty( $url ) ) {\r\n\t\t_e( '<em>URL field is empty.</em>', 'emc' );\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif ( strpos( $url, 'rackcdn.com' ) ) {\r\n\r\n\t\t// get the URL for the medium featured image, to serve as video poster\r\n\t\t$thumb_id = get_post_thumbnail_id( get_the_ID() );\r\n\t\t$thumb_src = wp_get_attachment_image_src( $thumb_id, 'large' );\r\n\r\n\t\t// assemble our EMC RackSpace HTML5 video embed with Flash fallback\r\n\t\t$shortcode = sprintf( '[video mp4=\"%1$s\" poster=\"%2$s\" width=\"%3$s\" height=\"%4$s\"]',\r\n\t\t\tesc_url( $url ),\r\n\t\t\tesc_attr( $thumb_src[0] ),\r\n\t\t\t'100%',\r\n\t\t\t'auto'\r\n\t\t);\r\n\r\n\t\t$video = do_shortcode( $shortcode );\r\n\r\n\t} else {\r\n\r\n\t\t// we have something other than RackSpace for a video link\r\n\t\t$video = wp_oembed_get( esc_url( get_field( 'url' ) ) );\r\n\r\n\t}\r\n\r\n\t// Determine the duration\r\n\t$duration = ( get_field( 'duration' ) ) ? get_field( 'duration' ) : __( 'Not specified', 'emc' );\r\n\t$duration = sprintf( __( 'Duration: %s', 'emc' ), esc_html( $duration ) );\r\n\r\n\t// Get help text\r\n\t$help = get_page_by_path( 'video-problems-text', OBJECT, 'post' );\r\n\r\n\t// Assemble our final HTML\r\n\t$html = '<div class=\"emc-video\">';\r\n\t$html .= $video;\r\n\t$html .= '<div class=\"emc-toggle-section emc-video-meta\">';\r\n\t$html .= '<span class=\"emc-video-duration\">' . esc_html( $duration ) . '</span>';\r\n\t$html .= '<a class=\"emc-toggle-link\">' . esc_html__( 'Having video problems?', 'emc' ) . '</a>';\r\n\t$html .= '<div class=\"emc-toggle-content\">';\r\n\t$html .= apply_filters( 'the_content', $help->post_content );\r\n\t$html .= '</div><!-- .emc-toggle-content -->';\r\n\t$html .= '</div><!-- .emc-video-meta -->';\r\n\t$html .= '</div><!-- .emc-video -->';\r\n\r\n\techo $html;\r\n\r\n}",
"function jetpackme_responsive_videos_setup() {\n\tadd_theme_support( 'jetpack-responsive-videos' );\n}",
"function show_one_video_front_end($video_id,$menu_class,$cate_lang,$width,$height,$skin_media='default.zip'){\n\n\t\t$str_select=\"*\";\n\t\t$arr_where=array($this->_table.'.video_public'=>1,$this->_table.'.video_id'=>$video_id,'category_sub.menu_class'=>$menu_class,'category_sub.cate_lang'=>$cate_lang,'category_sub.cate_public'=>1);\n\n\t\t$this->db->select($str_select);\n\t\t$this->db->join('category_sub',$this->_table.'.cate_id=category_sub.cate_id');\n\t\t$this->db->where($arr_where);\n\n\t\t$query=$this->db->get($this->_table);\n\t\t$arr_video=$query->row_array();\n\n\t\t$string_video='';\n\n\t\tif(is_array($arr_video) && !empty($arr_video)){\n\n\t\t\tif(preg_match(\"/youtube.com/\",element('video_file',$arr_video,''))){\n\n\t\t\t\t$string_youtube=\"<iframe width='\".$width.\"' height='\".$height.\"' src='\".element('video_file',$arr_video,'').\"' frameborder='0' allowfullscreen></iframe>\";\n\t\t\t\treturn $string_youtube;\n\t\t\t}\n\n\t\t\t$string_flashvars=\"netstreambasepath=\".base_url();\n\t\t\t$string_flashvars.= \"&playlist.position=none\";\n\t\t\t$string_flashvars.= \"&playlist.size=0\";\n\t\t\t$string_flashvars.= \"&skin=\".base_url().DIR_PUBLIC.\"mediaplayer/skin/\".$skin_media;\n\t\t\t$string_flashvars.= \"&config=\".base_url().DIR_PUBLIC.\"mediaplayer/config/config.xml\";\n\t\t\t$string_flashvars.= \"&title=\".element('video_name',$arr_video,'');\n\t\t\t$string_flashvars.= \"&file=\".base_src_video(element('video_file',$arr_video,''));\n\t\t\tif(element('video_img',$arr_video,'') != \"\")\n\t\t\t\t$string_flashvars.= \"&image=\".base_src_img(element('video_img',$arr_video,''));\n\n\t\t\t$string_video=\"<object width='\".$width.\"' height='\".$height.\"' \";\n\t\t\t$string_video.= \"classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' \";\n\t\t\t$string_video.= \"codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' \";\n\t\t\t$string_video.= \"align='center' style='overflow:hidden'>\";\n\n\t\t\t$string_video.= \"<param name='movie' value='\".base_url().DIR_PUBLIC.\"mediaplayer/player.swf'>\";\n\t\t\t$string_video.= \"<param name='quality' value='high'>\";\n\t\t\t$string_video.= \"<param name='allowscriptaccess' value='always'>\";\n\t\t\t$string_video.= \"<param name='wmode' value='transparent'>\";\n\t\t\t$string_video.= \"<param name='allowfullscreen' value='true'>\";\n\t\t\t$string_video.= \"<param name='flashvars' value='\".$string_flashvars.\"'>\";\n\t\t\t$string_video.= \"<embed width='\".$width.\"' height='\".$height.\"' \";\n\t\t\t$string_video.= \"type='application/x-shockwave-flash' \";\n\t\t\t$string_video.= \"pluginspage='http://www.macromedia.com/go/getflashplayer' \";\n\t\t\t$string_video.= \"align='center' style='overflow:hidden' \";\n\n\t\t\t$string_video.= \"src='\".base_url().DIR_PUBLIC.\"mediaplayer/player.swf' \";\n\t\t\t$string_video.= \"quality='high' \";\n\t\t\t$string_video.= \"allowscriptaccess='always' \";\n\t\t\t$string_video.= \"wmode='transparent' \";\n\t\t\t$string_video.= \"allowfullscreen='true' \";\n\t\t\t$string_video.= \"flashvars='\".$string_flashvars.\"'>\";\n\t\t\t$string_video.= \"</object>\";\n\t\t}\n\t\treturn $string_video;\n\n\t}",
"function avia_video_slideshow_filter($current_post)\n\t{\n\t \t$current_post['content'] = preg_replace( '|^\\s*(https?://[^\\s\"]+)\\s*$|im', \"[embed]$1[/embed]\", $current_post['content'] );\n\n\t\t//extrect embed and av_video codes from the content. if any were found execute them and prepend them to the post\n\t\tpreg_match(\"!\\[embed.+?\\]|\\[av_video.+?\\]!\", $current_post['content'], $match_video);\n\n\t\tif(!empty($match_video))\n\t\t{\n\t\t\tglobal $wp_embed;\n\t\t\t$video = $match_video[0];\n\t\t\t$current_post['before_content'] = do_shortcode($wp_embed->run_shortcode($video));\n\t\t\t$current_post['content'] = str_replace($match_video[0], \"\", $current_post['content']);\n\t\t\t$current_post['slider'] = \"\";\n\t\t}\n\n\t\treturn avia_default_title_filter($current_post);\n\t}",
"function video($src, string $unsupportedMessage = '', string $attributes = '', array $tracks = [], bool $indexPage = false): string\n {\n if (is_array($src)) {\n return _media('video', $src, $unsupportedMessage, $attributes, $tracks);\n }\n\n $video = '<video';\n\n if (_has_protocol($src)) {\n $video .= ' src=\"' . $src . '\"';\n } elseif ($indexPage === true) {\n $video .= ' src=\"' . site_url($src) . '\"';\n } else {\n $video .= ' src=\"' . slash_item('baseURL') . $src . '\"';\n }\n\n if ($attributes !== '') {\n $video .= ' ' . $attributes;\n }\n\n $video .= \">\\n\";\n\n foreach ($tracks as $track) {\n $video .= _space_indent() . $track . \"\\n\";\n }\n\n if (! empty($unsupportedMessage)) {\n $video .= _space_indent()\n . $unsupportedMessage\n . \"\\n\";\n }\n\n return $video . \"</video>\\n\";\n }",
"public static function video() {\n return new Media_Video();\n }",
"public function forgeVideo()\n {\n // Check if we have a video creation array.\n if ($this->provider && isset($this->provider['render']['video'])) {\n // Start iframe tag.\n $video = '<video';\n\n foreach ($this->provider['render']['video'] as $attribute => $val) {\n if (! is_array($val)) {\n $video .= sprintf(' %s=\"%s\"', $attribute, $val);\n }\n }\n // Close start of video tag.\n $video .='>';\n\n // Add inner elements.\n $video .= $this->forgeInnerElements($this->provider['render']['video'], true);\n\n // Wrap video tag.\n $video .= '</video>';\n\n $video .= $this->forgeScript();\n\n return $video;\n }\n }",
"protected function composeVideo(array $video)\n {\n $xmlCode = '<video:video>';\n\n if (isset($video['thumbnailUrl'])) {\n $xmlCode .= '<video:thumbnail_loc>' . $video['thumbnailUrl'] . '</video:thumbnail_loc>';\n }\n if (isset($video['title'])) {\n $xmlCode .= '<video:title><![CDATA[' . $video['title'] . ']]></video:title>';\n }\n if (isset($video['description'])) {\n $xmlCode .= '<video:description><![CDATA[' . $video['description'] . ']]></video:description>';\n }\n if (isset($video['contentUrl'])) {\n $xmlCode .= '<video:content_loc>' . $video['contentUrl'] . '</video:content_loc>';\n }\n if (isset($video['duration'])) {\n $xmlCode .= '<video:duration>' . $video['duration'] . '</video:duration>';\n }\n if (isset($video['expirationDate'])) {\n $xmlCode .= '<video:expiration_date>' . $this->normalizeDateValue($video['expirationDate']) . '</video:expiration_date>';\n }\n if (isset($video['rating'])) {\n $xmlCode .= '<video:rating>' . $video['rating'] . '</video:rating>';\n }\n if (isset($video['viewCount'])) {\n $xmlCode .= '<video:view_count>' . $video['viewCount'] . '</video:view_count>';\n }\n if (isset($video['publicationDate'])) {\n $xmlCode .= '<video:publication_date>' . $this->normalizeDateValue($video['publicationDate']) . '</video:publication_date>';\n }\n if (isset($video['familyFriendly'])) {\n $xmlCode .= '<video:family_friendly>' . $video['familyFriendly'] . '</video:family_friendly>';\n }\n if (isset($video['requiresSubscription'])) {\n $xmlCode .= '<video:requires_subscription>' . $video['requiresSubscription'] . '</video:requires_subscription>';\n }\n if (isset($video['live'])) {\n $xmlCode .= '<video:live>' . $video['live'] . '</video:live>';\n }\n if (isset($video['player'])) {\n $xmlCode .= '<video:player_loc allow_embed=\"' . $this->normalizeBooleanValue($video['player']['allowEmbed']) . '\" autoplay=\"' . $this->normalizeBooleanValue($video['player']['autoplay']) . '\">'\n . $video['player']['url']\n . '</video:player_loc>';\n }\n if (isset($video['restriction'])) {\n $xmlCode .= '<video:restriction relationship=\"' . $video['restriction']['relationship'] . '\">' . $video['restriction']['restriction'] . '</video:restriction>';\n }\n if (isset($video['gallery'])) {\n $xmlCode .= '<video:gallery_loc title=\"' . $video['gallery']['title'] . '\">' . $video['gallery']['url'] . '</video:gallery_loc>';\n }\n if (isset($video['price'])) {\n $xmlCode .= '<video:price currency=\"' . $video['price']['currency'] . '\">' . $video['price']['price'] . '</video:price>';\n }\n if (isset($video['uploader'])) {\n $xmlCode .= '<video:uploader info=\"' . $video['uploader']['info'] . '\">' . $video['uploader']['uploader'] . '</video:uploader>';\n }\n\n $xmlCode .= '</video:video>';\n\n return $xmlCode;\n }"
]
| [
"0.6138203",
"0.5287491",
"0.52021366",
"0.5139258",
"0.51036334",
"0.5017667",
"0.49913386",
"0.4968697",
"0.48368695",
"0.4833316",
"0.48286858",
"0.48103324",
"0.48009604",
"0.47831422",
"0.47594485",
"0.47454742",
"0.4724376",
"0.46919125",
"0.46754646",
"0.4671803",
"0.4665846",
"0.46521968",
"0.46497452",
"0.46441978",
"0.46368104",
"0.46313855",
"0.46268046",
"0.46236408",
"0.46220213",
"0.46155527"
]
| 0.67865235 | 0 |
body field Test with body fields empty. | public function test_create_task_body_empty()
{
$credential = [
'body' => ''
];
$token = User::factory()->create()->createToken('my-app-token')->plainTextToken;
$response = $this->json('POST', '/api/tasks', $credential, ['Accept' => 'application/json', 'Authorization' => 'Bearer '.$token]);
$response
->assertStatus(422)
->assertJsonValidationErrors('body')
->assertJsonPath('errors.body', ["The body field is required."]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testGetBody() {\n $request = $this->createRequest();\n\n static::setInput('hello world');\n $this->assertEquals('hello world', $request->getBody());\n $this->assertEquals('hello world', $request->body);\n }",
"public function testEmptyField()\n {\n $config = array('subject_field' => array('description'), 'fields' => array ());\n $record = array(\n 'From'=>'Singapore',\n 'To'=>'London', 'Miles'=>'12000',\n 'description' => 'Flight From %origin% To %destination% for %price% miles'\n );\n\n $node_replace = new \\Giift\\Etl\\Transformer\\Replace($config);\n $node_replace->addOutput($this->node_loader);\n\n $node_replace->processRecord($record);\n\n $rs = $this->node_loader->getResult();\n\n $this->assertNotNull($rs);\n $this->assertNotEmpty($rs);\n foreach ($rs as $result) {\n $this->assertNotEquals(\"Flight From Singapore To London for 12000 miles\", $result['description']);\n }\n }",
"public function test_a_task_requires_a_body()\n {\n $this->signIn();\n\n $project = auth()->user()->projects()->create(\n factory('App\\Project')->raw()\n );\n\n // 'make' ga nyimpen di db (return object), 'create' nyimpen di db (return object), 'raw' (return array)\n $attributes = factory('App\\Task')->raw(['body' => '']);\n $this->post($project->path() . '/tasks', $attributes)->assertSessionHasErrors('body');\n }",
"public function is_true_body_empty()\n {\n return $this->get_true_body() === '' || $this->get_true_body() === null;\n }",
"public function testGetRawBody0()\n{\n\n $actual = $this->sqsJob->getRawBody();\n $expected = null; // TODO: Expected value here\n $this->assertEquals($expected, $actual);\n}",
"public function testGetBody()\n {\n $xml = '<people type=\"array\"><person><id>1</id></person></people>';\n $req = new Mad_Controller_Request_Mock();\n $req->setBody($xml);\n\n $this->assertEquals($xml, $req->getBody());\n }",
"public function body($body);",
"public function setBody($body) {}",
"public function testBodyGenerateText()\n {\n /* @var $body \\Zend\\Mime\\Message */\n $this->message->setBody( '<b>foo-bar</b>' );\n $body = $this->message->getBody();\n\n $this->assertInstanceOf( 'Zend\\Mime\\Message', $body );\n $this->assertMimeMessages(\n array(\n 'text/html' => '<b>foo-bar</b>',\n 'text/plain' => 'foo-bar',\n ),\n $body\n );\n }",
"public function setBody($s) {$this->_body = $s;}",
"public function setBody($body);",
"public function setBody($body);",
"public function testNoHead(): void\n {\n // setup\n $htmlReport = new Html();\n\n // test body\n $htmlReport->body();\n\n // assertions\n $this->assertEquals('<html><body></body></html>', $htmlReport->compile());\n }",
"public function get_body()\n {\n }",
"public function test_create_task_body_not_a_string()\n {\n $credential = [\n 'body' => 231\n ];\n\n $token = User::factory()->create()->createToken('my-app-token')->plainTextToken;\n\n $response = $this->json('POST', '/api/tasks', $credential, ['Accept' => 'application/json', 'npm install -g @stoplight/cli' => 'Bearer '.$token]);\n\n $response\n ->assertStatus(422)\n ->assertJsonValidationErrors('body')\n ->assertJsonPath('errors.body', [\"The body must be a string.\"]);\n }",
"public function getBody()\n {\n return null;\n }",
"function Body( $body )\r\n\t\t{\r\n\t\t$this->body= $body;\r\n\t\t}",
"abstract public function setBody();",
"public function testEmptyFields()\n {\n \t/*\n \t * Visit the site with middleware enabled. The user should see the generic greeting.\n \t */\n $this->visit('/')\n ->see('Welcome to Booj Reading List!');\n \n /*\n * Confirm the error text when submitting empty fields to the registration form\n */\n $this->visit('/register')\n \t\t->type('', 'name')\n \t\t->type('', 'email')\n \t\t->type('', 'password')\n \t\t->type('', 'password_confirmation')\n \t\t->press('Register')\n \t\t->see('The name field is required.')\n \t\t->see('The email field is required.')\n \t\t->see('The password field is required.');\n $this->assertNull(App\\User::first());\n \n /*\n * Confirm the error session keys when explicitly posting the registration form\n */\n \t\t\n \t$this->post('/register', [\n \t\t\t'name' => '', \n \t\t\t'email' => '', \n \t\t\t'password' => '', \n \t\t\t'password_confirmation' => '', \n \t\t\t'_token' => csrf_token() \t\t\t\n \t\t])\t\n \t\t->assertRedirectedTo('/register')\n \t\t->assertSessionHasErrors(['name', 'email', 'password']);\n \t$this->assertNull(App\\User::first());\n }",
"public function testCreateNoContent()\n {\n // Do Request\n $this->_request('POST', '/api/1.5.0/news-create',['token' => '123','title'=>'news'])\n ->_result(['error' => 'no-content']);\n }",
"public function testElementMatchingWithNoText() \n {\n $mock = Mockery::mock('ZafBoxRequest');\n\n $test_result = new stdClass;\n $test_result->status_code = 200;\n $test_result->body = '<html><body><h1></h1></body></html>';\n $mock->shouldReceive('get')->andReturn($test_result);\n\n // set the requests object to be our stub\n IoC::instance('requests', $mock);\n\n $tester = IoC::resolve('tester');\n\n $result = $tester->test('element', 'http://dhwebco.com', array(\n 'tag' => 'h1',\n ));\n\n $this->assertTrue($result);\n }",
"public function testFromNoContentResponse() : void {\n $this->assertEmpty(Result::fromResponse(Response::fromName(\"no content\"))->toArray());\n }",
"public function testBodyShow()\n {\n $page = Page::inRandomOrder()->first();\n $response = $this->actingAs(User::inRandomOrder()->first(), 'api')->json('GET', \"/api/pages/{$page->slug}/body\");\n $response\n ->assertStatus(200)\n ->assertJsonStructure([\n 'data' => [\n \"type\",\n \"content\",\n ],\n 'links' => [\n \"self\",\n ],\n 'relationships' => [\n \"page\" => [\n \"links\" => [\n \"self\",\n ],\n \"data\" => [\n \"id\",\n \"name\",\n \"slug\",\n ],\n ],\n\n ],\n ]);\n }",
"public function body() {}",
"public function getBodyContent() {}",
"public function testIsInvalidEmptyPost() {\n\t\t$this->assertFalse($this->match->validate(array()));\n\t}",
"public function createBody()\n {\n }",
"public function testFailContentEmpty()\n {\n $request = Request::create(\n '/test',\n 'POST',\n [],\n [],\n [],\n [],\n null\n );\n\n $this->expectException(JsonRpcRequestException::class);\n $this->expectExceptionMessage('Request content is null');\n\n new JsonRpcRequest($request);\n }",
"public function getBody() {}",
"public function testPostEmpty()\n {\n $this->assertArrayEmpty($this->get_reflection_property_value('post'));\n }"
]
| [
"0.6944558",
"0.6340694",
"0.6314011",
"0.6298491",
"0.6273958",
"0.62459564",
"0.6179643",
"0.60944164",
"0.6081358",
"0.60631424",
"0.60598934",
"0.60598934",
"0.60475147",
"0.60281163",
"0.60190886",
"0.60148436",
"0.59887713",
"0.59886557",
"0.5984511",
"0.5972786",
"0.5970054",
"0.5956827",
"0.5932398",
"0.59304833",
"0.5921294",
"0.5902161",
"0.5897767",
"0.58490235",
"0.58455735",
"0.58369404"
]
| 0.7024294 | 0 |
Test with body is not a string. | public function test_create_task_body_not_a_string()
{
$credential = [
'body' => 231
];
$token = User::factory()->create()->createToken('my-app-token')->plainTextToken;
$response = $this->json('POST', '/api/tasks', $credential, ['Accept' => 'application/json', 'npm install -g @stoplight/cli' => 'Bearer '.$token]);
$response
->assertStatus(422)
->assertJsonValidationErrors('body')
->assertJsonPath('errors.body', ["The body must be a string."]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testAssertResponseNotRegExp(): void\n {\n $this->_response = new Response();\n $this->_response = $this->_response->withStringBody('Some content');\n\n $this->assertResponseNotRegExp('/cant/');\n }",
"public function noteBody(string $body):bool\n {\n $bool = null;\n if (isset($body)) {\n if(strlen($body) < 1000) {\n $bool = true;\n } else {\n $bool = false;\n }\n }\n return $bool;\n }",
"public function testGetBody() {\n $request = $this->createRequest();\n\n static::setInput('hello world');\n $this->assertEquals('hello world', $request->getBody());\n $this->assertEquals('hello world', $request->body);\n }",
"public function body($body);",
"protected function body($str)\n\t{\n }",
"function hasBody() {\n\t\t$body = strip_tags($this->body, \"<img><a>\");\n\t\t$body = trim($body);\n\t\tif (empty($body)) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}",
"public function canHaveBody() {\n return ( $this->status < 100 || $this->status >= 200 ) &&\n (!in_array($this->status, array(201, 204, 304)));\n }",
"private function testResponseBody($body)\n {\n\n if ( empty($body) ) {\n\n throw (new LarastackPaystackException());\n }\n\n $bodyArray = json_decode($body, true);\n\n if ( empty($bodyArray['status']) || !$bodyArray['status'] || empty($bodyArray['data'])) {\n\n throw (new LarastackPaystackException());\n }\n\n return $bodyArray['data'];\n }",
"public function testAssertResponseNotContains(): void\n {\n $this->_response = new Response();\n $this->_response = $this->_response->withStringBody('Some content');\n\n $this->assertResponseNotContains('contents');\n }",
"public static function isValidBodyType($type) {\n $types = array(\n self::TYPE_BEST,\n self::TYPE_HTML,\n self::TYPE_TEXT,\n );\n\n return in_array($type, $types);\n }",
"public function theResponseShouldNotContain($text)\n {\n $expectedRegexp = '/' . preg_quote($text) . '/';\n $actual = (string) $this->response->getBody();\n Assertions::assertNotRegExp($expectedRegexp, $actual);\n }",
"public function theResponseShouldNotContain($text)\n {\n $expectedRegexp = '/' . preg_quote($text) . '/';\n $actual = (string) $this->response->getBody();\n Assertions::assertDoesNotMatchRegularExpression($expectedRegexp, $actual);\n }",
"function getBody($string)\n{\n $string = stristr($string, \"\\n\\r\", false);\n $string = removeUnnecessaryCharas($string);\n return $string;\n}",
"public function testGetBody()\n {\n $xml = '<people type=\"array\"><person><id>1</id></person></people>';\n $req = new Mad_Controller_Request_Mock();\n $req->setBody($xml);\n\n $this->assertEquals($xml, $req->getBody());\n }",
"public function isText() {}",
"public function testInvalidElementMatchingWithText() \n {\n $mock = Mockery::mock('ZafBoxRequest');\n\n $test_result = new stdClass;\n $test_result->status_code = 200;\n $test_result->body = '<html><body><h1>Some Text</h1></body></html>';\n $mock->shouldReceive('get')->andReturn($test_result);\n\n // set the requests object to be our stub\n IoC::instance('requests', $mock);\n\n $tester = IoC::resolve('tester');\n\n $result = $tester->test('element', 'http://dhwebco.com', array(\n 'tag' => 'h1',\n 'inner_text' => 'This is not the right text',\n ));\n\n $this->assertFalse($result);\n }",
"function isJsonRequestBody($jsonRequestBody)\n {\n if (!empty($jsonRequestBody) && empty(json_decode($jsonRequestBody))) { // if received json from raw body is not valid\n return abort(400, 'Invalid json');\n }\n\n }",
"public function isExpectingDocument();",
"public function isPlain()\n\t{\n\t\treturn Str::contains($this->getHeaderLine('Content-Type'), '/plain');\n\t}",
"public function getBodyIsText()\n {\n return $this->bodyIsText;\n }",
"public function getBodyIsText()\n {\n return $this->bodyIsText;\n }",
"public function testNotString(): void\n {\n $validator = new LengthValidator();\n $result = $validator->validate(9);\n\n $this->assertFalse($result->isValid());\n }",
"public function testAcceptContentTypeWithoutBody()\n {\n\n $config = ['accepts' => ['text/html']];\n $response = m::mock(Response::class);\n $headers = m::mock(stdClass::class);\n $response->headers = $headers;\n $request = m::mock(Request::class);\n $app = m::mock(ApplicationContract::class);\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n\n $response\n ->shouldReceive('isRedirection')->once()->andReturn(false)\n ->shouldReceive('getContent')->once()->andReturn('')\n ->shouldReceive('setContent')->once();\n $headers->shouldReceive('get')->with('Content-type')->once()->andReturn('text/html');\n $request->shouldReceive('ajax')->once()->andReturn(false);\n $tracy = new Tracy($config, $app, $request);\n $excepted = $tracy->renderResponse($response);\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n\n $this->assertSame($excepted, $response);\n }",
"public function testBodyGenerateText()\n {\n /* @var $body \\Zend\\Mime\\Message */\n $this->message->setBody( '<b>foo-bar</b>' );\n $body = $this->message->getBody();\n\n $this->assertInstanceOf( 'Zend\\Mime\\Message', $body );\n $this->assertMimeMessages(\n array(\n 'text/html' => '<b>foo-bar</b>',\n 'text/plain' => 'foo-bar',\n ),\n $body\n );\n }",
"public function testBodyCustomMimeTypes()\n {\n $bodies = array(\n 'text/plain' => 'foo',\n 'application/octet-stream' => 'bar',\n );\n\n $this->message->setBody( new ArrayIterator( $bodies ) );\n $body = $this->message->getBody();\n\n $this->assertInstanceOf( 'Zend\\Mime\\Message', $body );\n $this->assertMimeMessages( $bodies, $body );\n }",
"public function testInvalidElementMatchingWithNoText() \n {\n $mock = Mockery::mock('ZafBoxRequest');\n\n $test_result = new stdClass;\n $test_result->status_code = 200;\n $test_result->body = '<html><body><h1></h1></body></html>';\n $mock->shouldReceive('get')->andReturn($test_result);\n\n // set the requests object to be our stub\n IoC::instance('requests', $mock);\n\n $tester = IoC::resolve('tester');\n\n $result = $tester->test('element', 'http://dhwebco.com', array(\n 'tag' => 'invalidelement',\n ));\n\n $this->assertFalse($result);\n }",
"public function getBodyType(): string\n {\n return $this->requireString('body_type');\n }",
"function setBody(string $body);",
"public function testNotString()\n {\n $values = array(\n 1, 1.4, null, new stdClass(), true, false\n );\n\n foreach ($values as $value) {\n $this->assertSame(false, $this->_validator->isValid($value));\n }\n }",
"function testIfnotWithoutRegex(){\n\t\t\n\t\t(new Param('email'))->filters()->ifnot('@', 'Email address should contain a @');\n\n\t\t$error = Param::get('email')->process(['email'=>'myemail.domain.com'])->error;\n\n\t\t$this->assertContains('should', $error);\n\n\t}"
]
| [
"0.6213765",
"0.61955667",
"0.6150439",
"0.610408",
"0.609081",
"0.60714984",
"0.6005276",
"0.59473145",
"0.5895591",
"0.5883382",
"0.5825824",
"0.57798445",
"0.5747272",
"0.5699985",
"0.5646366",
"0.56418586",
"0.5608713",
"0.5604929",
"0.5597107",
"0.5579723",
"0.5579723",
"0.5557043",
"0.5552767",
"0.5507786",
"0.55073196",
"0.5500544",
"0.5498517",
"0.5493892",
"0.5484096",
"0.54740375"
]
| 0.64790547 | 0 |
Ellipsoid model constants (actual values here are for WGS84) | function geodetictoutm($lat, $lon) {
$sm_a = 6378137.0;
$sm_b = 6356752.314;
$sm_EccSquared = 0.000669437999013;
$UTMScaleFactor = 0.9996;
// get UTM XY from Lat Lon
$zone = floor(($lon + 180.0) / 6) + 1;
// Compute the UTM zone
$phi = $lat / 180 * Pi();
$lambda = $lon / 180 * Pi();
$lambda0 = (-183 + ($zone * 6))/ 180 * Pi(); //center merdian
// Precalculate ep2
$ep2 = (pow($sm_a,2) - pow($sm_b,2) ) / pow($sm_b,2);
// Precalculate nu2
$nu2 = $ep2 * pow(cos($phi),2);
// Precalculate N
$N = pow($sm_a,2) / ($sm_b * sqrt(1 + $nu2));
// Precalculate t
$t = tan ($phi);
$t2 = $t * $t;
$tmp = pow($t2,3) - pow($t,6);
// Precalculate l
$l = $lambda - $lambda0;
//Precalculate coefficients for l**n in the equations below
//so a normal human being can read the expressions for easting and northing
$l3coef = 1 - $t2 + $nu2;
$l4coef = 5 - $t2 + 9 * $nu2 + 4 * ($nu2 * $nu2);
$l5coef = 5 - 18 * $t2 + ($t2 * $t2) + 14 * $nu2 - 58 * $t2 * $nu2;
$l6coef = 61 - 58 * $t2 + ($t2 * $t2) + 270 * $nu2 - 330 * $t2 * $nu2;
$l7coef = 61 - 479 * $t2 + 179 * ($t2 * $t2) - ($t2 * $t2 * $t2);
$l8coef = 1385 - 3111 * $t2 + 543 * ($t2 * $t2) - ($t2 * $t2 * $t2);
// ArcLengthOfMeridian
//Precalculate n
$n2 = ($sm_a - $sm_b) / ($sm_a + $sm_b);
//Precalculate alpha
$alpha = (($sm_a + $sm_b) / 2) * (1 + (pow($n2,2) / 4) + (pow($n2,4) / 64));
//Precalculate beta
$beta = (-3 * $n2 / 2) + (9 * pow($n2,3) / 16) + (-3 * pow($n2,5) / 32);
//Precalculate gamma
$gamma = (15 * pow($n2,2) / 16) + (-15 * pow($n2,4) / 32);
//Precalculate delta
$delta = (-35 * pow($n2,3) / 48) + (105 * pow($n2,5) / 256);
//Precalculate epsilon
$epsilon = (315 * pow($n2,4) / 512);
//Now calculate the sum of the series and return
$ArcLengthOfMeridian = $alpha * ($phi + ($beta * sin(2 * $phi)) + ($gamma * sin(4 * $phi)) + ($delta * sin (6 * $phi)) + ($epsilon * sin(8 * $phi)));
//Calculate easting(x)
$x = $N * cos($phi) * $l
+ ($N / 6 * pow(cos($phi),3) * $l3coef * pow($l,3))
+ ($N / 120 * pow(cos($phi),5) * $l5coef * pow($l,5))
+ ($N / 5040 * pow(cos($phi),7) * $l7coef * pow($l,7));
//Calculate northing(y)
$y = $ArcLengthOfMeridian
+ ($t / 2 * $N * pow(cos($phi),2) * pow($l,2))
+ ($t / 24 * $N * pow(cos($phi),4) * $l4coef * pow($l,4))
+ ($t / 720 * $N* pow(cos($phi),6) * $l6coef * pow($l,6))
+ ($t / 40320 * $N * pow(cos($phi),8) * $l8coef * pow($l,8));
$x = $x * $UTMScaleFactor + 500000;
$y = $y * $UTMScaleFactor;
//print_r(get_defined_vars ( ));die;
return array($x, $y, $zone);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getEllipsoid() {\n\n\t\t\treturn $this->_ellipsoid;\n\t\t}",
"public function ToLL($north, $east, $utmZone)\n {\n $LngOrigin = Deg2Rad($utmZone * 6 - 183);\n\n // The following set of class constants define characteristics of the\n // ellipsoid, as defined my the WGS84 datum. These values need to be\n // changed if a different dataum is used.\n\n $FalseNorth = 10000000; // South or North?\n //if (lat < 0.) FalseNorth = 10000000. // South or North?\n //else FalseNorth = 0.\n\n $Ecc = 0.081819190842622; // Eccentricity\n $EccSq = $Ecc * $Ecc;\n $Ecc2Sq = $EccSq / (1. - $EccSq);\n $Ecc2 = sqrt($Ecc2Sq); // Secondary eccentricity\n $E1 = ( 1 - sqrt(1-$EccSq) ) / ( 1 + sqrt(1-$EccSq) );\n $E12 = $E1 * $E1;\n $E13 = $E12 * $E1;\n $E14 = $E13 * $E1;\n\n $SemiMajor = 6378137.0; // Ellipsoidal semi-major axis (Meters)\n $FalseEast = 500000.0; // UTM East bias (Meters)\n $ScaleFactor = 0.9996; // Scale at natural origin\n\n // Calculate the Cassini projection parameters\n\n $M1 = ($north - $FalseNorth) / $ScaleFactor;\n $Mu1 = $M1 / ( $SemiMajor * (1 - $EccSq/4.0 - 3.0*$EccSq*$EccSq/64.0 - 5.0*$EccSq*$EccSq*$EccSq/256.0) );\n\n $Phi1 = $Mu1 + (3.0*$E1/2.0 - 27.0*$E13/32.0) * sin(2.0*$Mu1);\n + (21.0*$E12/16.0 - 55.0*$E14/32.0) * sin(4.0*$Mu1);\n + (151.0*$E13/96.0) * sin(6.0*$Mu1);\n + (1097.0*$E14/512.0) * sin(8.0*$Mu1);\n\n $sin2phi1 = sin($Phi1) * sin($Phi1);\n $Rho1 = ($SemiMajor * (1.0-$EccSq) ) / pow(1.0-$EccSq*$sin2phi1,1.5);\n $Nu1 = $SemiMajor / sqrt(1.0-$EccSq*$sin2phi1);\n\n // Compute parameters as defined in the POSC specification. T, C and D\n\n $T1 = tan($Phi1) * tan($Phi1);\n $T12 = $T1 * $T1;\n $C1 = $Ecc2Sq * cos($Phi1) * cos($Phi1);\n $C12 = $C1 * $C1;\n $D = ($east - $FalseEast) / ($ScaleFactor * $Nu1);\n $D2 = $D * $D;\n $D3 = $D2 * $D;\n $D4 = $D3 * $D;\n $D5 = $D4 * $D;\n $D6 = $D5 * $D;\n\n // Compute the Latitude and Longitude and convert to degrees\n $lat = $Phi1 - $Nu1*tan($Phi1)/$Rho1 * ( $D2/2.0 - (5.0 + 3.0*$T1 + 10.0*$C1 - 4.0*$C12 - 9.0*$Ecc2Sq)*$D4/24.0 + (61.0 + 90.0*$T1 + 298.0*$C1 + 45.0*$T12 - 252.0*$Ecc2Sq - 3.0*$C12)*$D6/720.0 );\n\n $lat = Rad2Deg($lat);\n\n $lon = $LngOrigin + ($D - (1.0 + 2.0*$T1 + $C1)*$D3/6.0 + (5.0 - 2.0*$C1 + 28.0*$T1 - 3.0*$C12 + 8.0*$Ecc2Sq + 24.0*$T12)*$D5/120.0) / cos($Phi1);\n\n $lon = Rad2Deg($lon);\n\n // Create a object to store the calculated Latitude and Longitude values\n $PC_LatLon['lat'] = $lat;\n $PC_LatLon['lon'] = $lon;\n\n // Returns a PC_LatLon object\n return $PC_LatLon;\n //return \"['latitude' => \".$lat.\", 'longitude' => \".$lon.\"], \";\n }",
"function convert($utm_x, $utm_y, $utmZone)\n {\n $LngOrigin = Deg2Rad($utmZone * 6 - 183);\n\n // The following set of class constants define characteristics of the\n // ellipsoid, as defined my the WGS84 datum. These values need to be\n // changed if a different dataum is used.\n\n $FalseNorth = 0; // South or North?\n //if (lat < 0.) FalseNorth = 10000000. // South or North?\n //else FalseNorth = 0.\n\n $Ecc = 0.081819190842622; // Eccentricity\n $EccSq = $Ecc * $Ecc;\n $Ecc2Sq = $EccSq / (1. - $EccSq);\n $Ecc2 = sqrt($Ecc2Sq); // Secondary eccentricity\n $E1 = (1 - sqrt(1 - $EccSq)) / (1 + sqrt(1 - $EccSq));\n $E12 = $E1 * $E1;\n $E13 = $E12 * $E1;\n $E14 = $E13 * $E1;\n\n $SemiMajor = 6378137.0; // Ellipsoidal semi-major axis (Meters)\n $FalseEast = 500000.0; // UTM East bias (Meters)\n $ScaleFactor = 0.9996; // Scale at natural origin\n\n // Calculate the Cassini projection parameters\n\n $M1 = ($utm_x - $FalseNorth) / $ScaleFactor;\n $Mu1 = $M1 / ($SemiMajor * (1 - $EccSq / 4.0 - 3.0 * $EccSq * $EccSq / 64.0 - 5.0 * $EccSq * $EccSq * $EccSq / 256.0));\n\n $Phi1 = $Mu1 + (3.0 * $E1 / 2.0 - 27.0 * $E13 / 32.0) * sin(2.0 * $Mu1);\n +(21.0 * $E12 / 16.0 - 55.0 * $E14 / 32.0) * sin(4.0 * $Mu1);\n +(151.0 * $E13 / 96.0) * sin(6.0 * $Mu1);\n +(1097.0 * $E14 / 512.0) * sin(8.0 * $Mu1);\n\n $sin2phi1 = sin($Phi1) * sin($Phi1);\n $Rho1 = ($SemiMajor * (1.0 - $EccSq)) / pow(1.0 - $EccSq * $sin2phi1, 1.5);\n $Nu1 = $SemiMajor / sqrt(1.0 - $EccSq * $sin2phi1);\n\n // Compute parameters as defined in the POSC specification. T, C and D\n\n $T1 = tan($Phi1) * tan($Phi1);\n $T12 = $T1 * $T1;\n $C1 = $Ecc2Sq * cos($Phi1) * cos($Phi1);\n $C12 = $C1 * $C1;\n $D = ($utm_y - $FalseEast) / ($ScaleFactor * $Nu1);\n $D2 = $D * $D;\n $D3 = $D2 * $D;\n $D4 = $D3 * $D;\n $D5 = $D4 * $D;\n $D6 = $D5 * $D;\n\n // Compute the Latitude and Longitude and convert to degrees\n $lat = $Phi1 - $Nu1 * tan($Phi1) / $Rho1 * ($D2 / 2.0 - (5.0 + 3.0 * $T1 + 10.0 * $C1 - 4.0 * $C12 - 9.0 * $Ecc2Sq) * $D4 / 24.0 + (61.0 + 90.0 * $T1 + 298.0 * $C1 + 45.0 * $T12 - 252.0 * $Ecc2Sq - 3.0 * $C12) * $D6 / 720.0);\n\n $lat = Rad2Deg($lat);\n\n $lon = $LngOrigin + ($D - (1.0 + 2.0 * $T1 + $C1) * $D3 / 6.0 + (5.0 - 2.0 * $C1 + 28.0 * $T1 - 3.0 * $C12 + 8.0 * $Ecc2Sq + 24.0 * $T12) * $D5 / 120.0) / cos($Phi1);\n\n $lon = Rad2Deg($lon);\n\n // Create a object to store the calculated Latitude and Longitude values\n $PC_LatLon['lat'] = $lat;\n $PC_LatLon['lon'] = $lon;\n\n // Returns a PC_LatLon object\n return $PC_LatLon;\n }",
"function RD2WGS84($x, $y){\n\n $dX = ($x - 155000) * pow(10,-5);\n $dY = ($y - 463000) * pow(10,-5);\n\n $SomN = (3235.65389 * $dY) + (-32.58297 * pow($dX,2)) + (-0.2475 * pow($dY,2)) + (-0.84978 * pow($dX,2) * $dY) + (-0.0655 * pow($dY,3)) + (-0.01709 * pow($dX,2) * pow($dY,2)) + (-0.00738 * $dX) + (0.0053 * pow($dX,4)) + (-0.00039 * pow($dX,2) * pow($dY,3)) + (0.00033 * pow($dX,4) * $dY) + (-0.00012 * $dX * $dY);\n $SomE = (5260.52916 * $dX) + (105.94684 * $dX * $dY) + (2.45656 * $dX * pow($dY,2)) + (-0.81885 * pow($dX,3)) + (0.05594 * $dX * pow($dY,3)) + (-0.05607 * pow($dX,3) * $dY) + (0.01199 * $dY) + (-0.00256 * pow($dX,3) * pow($dY,2)) + (0.00128 * $dX * pow($dY,4)) + (0.00022 * pow($dY,2)) + (-0.00022 * pow($dX,2)) + (0.00026 * pow($dX,5));\n\n $lat = 52.15517 + ($SomN / 3600);\n $lon = 5.387206 + ($SomE / 3600);\n \n return(Array($lat, $lon));\n }",
"public function getE()\n {\n $es = $this->getES();\n\n return sqrt($es);\n }",
"public function __construct(array $params = null)\n {\n // If no parameters provided, then default to WGS84 ellipsoid.\n if (empty($params)) {\n $params = [\n 'a' => 6378137.0,\n 'rf' => 298.257223563,\n 'code' => 'WGS84',\n 'name' => 'WGS 84'\n ];\n }\n\n // Go through the parameters and take set up each in turn.\n foreach($params as $key => $value) {\n switch (strtolower($key)) {\n case 'a':\n $this->a = (float)$value;\n break;\n case 'b':\n if (isset($value)) {\n $this->setB($value);\n }\n break;\n case 'f':\n if (isset($value)) {\n $this->setF($value);\n }\n break;\n case 'rf':\n if (isset($value)) {\n $this->setRF($value);\n }\n break;\n case 'es':\n // TODO: set the essentricity squared, and use that to derive other values.\n break;\n case 'code':\n $this->code = $value;\n break;\n case 'name':\n $this->name = $value;\n break;\n case 'ellps':\n // TODO: get the parameters from the name.\n // The value of ellps will be the code.\n break;\n }\n }\n\n // Raise an exception if at least 'a' and one of 'b', 'f' or 'rf' are not set.\n if ( ! isset($this->a)) {\n throw new Exception('');\n }\n }",
"public static function UTMtoGeog($east, $north, $utmZone) {\n $LngOrigin = Deg2Rad($utmZone * 6 - 183);\n\n // The following set of class constants define characteristics of the\n // ellipsoid, as defined my the WGS84 datum. These values need to be\n // changed if a different dataum is used.\n\n $FalseNorth = 0; // South or North?\n //if (lat < 0.) FalseNorth = 10000000. // South or North?\n //else FalseNorth = 0.\n\n $Ecc = 0.081819190842622; // Eccentricity\n $EccSq = $Ecc * $Ecc;\n $Ecc2Sq = $EccSq / (1. - $EccSq);\n $Ecc2 = sqrt($Ecc2Sq); // Secondary eccentricity\n $E1 = ( 1 - sqrt(1-$EccSq) ) / ( 1 + sqrt(1-$EccSq) );\n $E12 = $E1 * $E1;\n $E13 = $E12 * $E1;\n $E14 = $E13 * $E1;\n\n $SemiMajor = 6378137.0; // Ellipsoidal semi-major axis (Meters)\n $FalseEast = 500000.0; // UTM East bias (Meters)\n $ScaleFactor = 0.9996; // Scale at natural origin\n\n // Calculate the Cassini projection parameters\n\n $M1 = ($north - $FalseNorth) / $ScaleFactor;\n $Mu1 = $M1 / ( $SemiMajor * (1 - $EccSq/4.0 - 3.0*$EccSq*$EccSq/64.0 - 5.0*$EccSq*$EccSq*$EccSq/256.0) );\n\n $Phi1 = $Mu1 + (3.0*$E1/2.0 - 27.0*$E13/32.0) * sin(2.0*$Mu1);\n + (21.0*$E12/16.0 - 55.0*$E14/32.0) * sin(4.0*$Mu1);\n + (151.0*$E13/96.0) * sin(6.0*$Mu1);\n + (1097.0*$E14/512.0) * sin(8.0*$Mu1);\n\n $sin2phi1 = sin($Phi1) * sin($Phi1);\n $Rho1 = ($SemiMajor * (1.0-$EccSq) ) / pow(1.0-$EccSq*$sin2phi1,1.5);\n $Nu1 = $SemiMajor / sqrt(1.0-$EccSq*$sin2phi1);\n\n // Compute parameters as defined in the POSC specification. T, C and D\n\n $T1 = tan($Phi1) * tan($Phi1);\n $T12 = $T1 * $T1;\n $C1 = $Ecc2Sq * cos($Phi1) * cos($Phi1);\n $C12 = $C1 * $C1;\n $D = ($east - $FalseEast) / ($ScaleFactor * $Nu1);\n $D2 = $D * $D;\n $D3 = $D2 * $D;\n $D4 = $D3 * $D;\n $D5 = $D4 * $D;\n $D6 = $D5 * $D;\n\n // Compute the Latitude and Longitude and convert to degrees\n $lat = $Phi1 - $Nu1*tan($Phi1)/$Rho1 * ( $D2/2.0 - (5.0 + 3.0*$T1 + 10.0*$C1 - 4.0*$C12 - 9.0*$Ecc2Sq)*$D4/24.0 + (61.0 + 90.0*$T1 + 298.0*$C1 + 45.0*$T12 - 252.0*$Ecc2Sq - 3.0*$C12)*$D6/720.0 );\n\n $lat = Rad2Deg($lat);\n\n $lon = $LngOrigin + ($D - (1.0 + 2.0*$T1 + $C1)*$D3/6.0 + (5.0 - 2.0*$C1 + 28.0*$T1 - 3.0*$C12 + 8.0*$Ecc2Sq + 24.0*$T12)*$D5/120.0) / cos($Phi1);\n\n $lon = Rad2Deg($lon);\n\n return array('lat'=>$lat, 'lon'=>$lon);\n}",
"public function getES()\n {\n // Calculate from a and b, if b has been supplied.\n if (isset($this->b)) {\n $a2 = $this->a * $this->a;\n $b = $this->b;\n $b2 = $this->b * $this->b;\n\n return ($a2 - $b2) / $a2;\n } else {\n // Otherwise use f.\n // FIXME: F will be infinite for a sphere. Can we use RF?\n $f = $this->getF();\n\n return (2 * $f) - ($f * $f);\n }\n }",
"function Ellipse($x,$y,$rx,$ry,$style='D')\n\t\t{\n\t\t\tif($style=='F') $op='f';\n\t\t\telseif($style=='FD' or $style=='DF') $op='B';\n\t\t\telse $op='S';\n\t\t\t$lx=4/3*(M_SQRT2-1)*$rx;\n\t\t\t$ly=4/3*(M_SQRT2-1)*$ry;\n\t\t\t$k=$this->k;\n\t\t\t$h=$this->h;\n\t\t\t$this->_out(sprintf('%.2f %.2f m %.2f %.2f %.2f %.2f %.2f %.2f c',\n\t\t\t\t($x+$rx)*$k,($h-$y)*$k,\n\t\t\t\t($x+$rx)*$k,($h-($y-$ly))*$k,\n\t\t\t\t($x+$lx)*$k,($h-($y-$ry))*$k,\n\t\t\t\t$x*$k,($h-($y-$ry))*$k));\n\t\t\t$this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',\n\t\t\t\t($x-$lx)*$k,($h-($y-$ry))*$k,\n\t\t\t\t($x-$rx)*$k,($h-($y-$ly))*$k,\n\t\t\t\t($x-$rx)*$k,($h-$y)*$k));\n\t\t\t$this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',\n\t\t\t\t($x-$rx)*$k,($h-($y+$ly))*$k,\n\t\t\t\t($x-$lx)*$k,($h-($y+$ry))*$k,\n\t\t\t\t$x*$k,($h-($y+$ry))*$k));\n\t\t\t$this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c %s',\n\t\t\t\t($x+$lx)*$k,($h-($y+$ry))*$k,\n\t\t\t\t($x+$rx)*$k,($h-($y+$ly))*$k,\n\t\t\t\t($x+$rx)*$k,($h-$y)*$k,\n\t\t\t\t$op));\n\t\t}",
"public function getSurface() {\r\n return 6 * $this -> lato * $this -> lato;\r\n }",
"function guifi_ED502WG84 ( $lon, $lat, $datum ) {\n // Transformar WG84 to ED50\n $XYZ_ED50 = guifi_lonlat2XYZ($datum, $lon, $lat, 0);\n $XYZ_WG84 = guifi_ND50_WG84( $XYZ_ED50[0], $XYZ_ED50[1], $XYZ_ED50[2], 1);\n $lonLat_WG84 = guifi_XYZ2lonlat(0, $XYZ_WG84[0], $XYZ_WG84[1], $XYZ_WG84[2]);\n \n return $lonLat_WG84;\n}",
"function guifi_WG842ED50 ( $lon, $lat, $datum ) {\n // Transformar WG84 to ED50\n $XYZ_WG84 = guifi_lonlat2XYZ(0, $lon, $lat, 0);\n $XYZ_ED50 = guifi_ND50_WG84( $XYZ_WG84[0], $XYZ_WG84[1], $XYZ_WG84[2], 0);\n $lonLat_ED50 = guifi_XYZ2lonlat($datum, $XYZ_ED50[0], $XYZ_ED50[1], $XYZ_ED50[2]);\n \n return $lonLat_ED50;\n}",
"function redfearnGridtoLL($Easting, $Northing, $Zone = 55, $TmDefinition = \"GDA-MGA\")\n{\n switch ($TmDefinition) {\n case \"GDA-MGA\":\n $FalseEasting = 500000.0000;\n $FalseNorthing = 10000000.0000;\n $CentralScaleFactor = 0.9996;\n $ZoneWidthDegrees = 6;\n $LongitudeOfTheCentralMeridianOfZone1Degrees = -177;\n $EllipsoidDefinition = \"GRS80\";\n break;\n default:\n $TmDefinition = \"GDA-MGA\";\n $FalseEasting = 500000.0000;\n $FalseNorthing = 10000000.0000;\n $CentralScaleFactor = 0.9996;\n $ZoneWidthDegrees = 6;\n $LongitudeOfTheCentralMeridianOfZone1Degrees = -177;\n $EllipsoidDefinition = \"GRS80\";\n }\n\n switch ($EllipsoidDefinition) {\n case \"GRS80\":\n $SemiMajorAxis = 6378137.000;\n $InverseFlattening = 298.257222101000;\n break;\n default:\n $EllipsoidDefinition = \"GRS80\";\n $SemiMajorAxis = 6378137.000;\n $InverseFlattening = 298.257222101000;\n }\n\n $Flattening = 1 / $InverseFlattening;\n $SemiMinorAxis = $SemiMajorAxis * (1 - $Flattening);\n $Eccentricity = (2 * $Flattening) - ($Flattening * $Flattening);\n $n = ($SemiMajorAxis - $SemiMinorAxis) / ($SemiMajorAxis + $SemiMinorAxis);\n $n2 = pow($n, 2);\n $n3 = pow($n, 3);\n $n4 = pow($n, 4);\n $G = $SemiMajorAxis * (1 - $n) * (1 - $n2) * (1 + (9 * $n2) / 4 + (225 * $n4) / 64) * PI() / 180;\n $LongitudeOfWesternEdgeOfZoneZeroDegrees = $LongitudeOfTheCentralMeridianOfZone1Degrees - (1.5 * $ZoneWidthDegrees);\n $CentralMeridianOfZoneZeroDegrees = $LongitudeOfWesternEdgeOfZoneZeroDegrees + ($ZoneWidthDegrees / 2);\n\n $NewE = ($Easting - $FalseEasting);\n $NewEScaled = $NewE / $CentralScaleFactor;\n $NewN = ($Northing - $FalseNorthing);\n $NewNScaled = $NewN / $CentralScaleFactor;\n $Sigma = ($NewNScaled * PI()) / ($G * 180);\n $Sigma2 = 2 * $Sigma;\n $Sigma4 = 4 * $Sigma;\n $Sigma6 = 6 * $Sigma;\n $Sigma8 = 8 * $Sigma;\n\n $FootPointLatitudeTerm1 = $Sigma;\n $FootPointLatitudeTerm2 = ((3 * $n / 2) - (27 * $n3 / 32)) * sin($Sigma2);\n $FootPointLatitudeTerm3 = ((21 * $n2 / 16) - (55 * $n4 / 32)) * sin($Sigma4);\n $FootPointLatitudeTerm4 = (151 * $n3) * sin($Sigma6) / 96;\n $FootPointLatitudeTerm5 = 1097 * $n4 * sin($Sigma8) / 512;\n $FootPointLatitude = $FootPointLatitudeTerm1 + $FootPointLatitudeTerm2 + $FootPointLatitudeTerm3 + $FootPointLatitudeTerm4 + $FootPointLatitudeTerm5;\n\n $SinFootPointLatitude = sin($FootPointLatitude);\n $SecFootPointLatitude = 1 / cos($FootPointLatitude);\n\n $Rho = $SemiMajorAxis * (1 - $Eccentricity) / pow(1 - $Eccentricity * pow($SinFootPointLatitude, 2), 1.5);\n $Nu = $SemiMajorAxis / pow(1 - $Eccentricity * pow($SinFootPointLatitude, 2), 0.5);\n\n $x1 = $NewEScaled / $Nu;\n $x3 = pow($x1, 3);\n $x5 = pow($x1, 5);\n $x7 = pow($x1, 7);\n\n $t1 = tan($FootPointLatitude);\n $t2 = pow($t1, 2);\n $t4 = pow($t1, 4);\n $t6 = pow($t1, 6);\n\n $Psi1 = $Nu / $Rho;\n $Psi2 = pow($Psi1, 2);\n $Psi3 = pow($Psi1, 3);\n $Psi4 = pow($Psi1, 4);\n\n $LatitudeTerm1 = -(($t1 / ($CentralScaleFactor * $Rho)) * $x1 * $NewE / 2);\n $LatitudeTerm2 = ($t1 / ($CentralScaleFactor * $Rho)) * ($x3 * $NewE / 24) * (-4 * $Psi2 + 9 * $Psi1 * (1 - $t2) + 12 * $t2);\n $LatitudeTerm3 = -($t1 / ($CentralScaleFactor * $Rho)) * ($x5 * $NewE / 720) * (8 * $Psi4 * (11 - 24 * $t2) - 12 * $Psi3 * (21 - 71 * $t2) + 15 * $Psi2 * (15 - 98 * $t2 + 15 * $t4) + 180 * $Psi1 * (5 * $t2 - 3 * $t4) + 360 * $t4);\n $LatitudeTerm4 = ($t1 / ($CentralScaleFactor * $Rho)) * ($x7 * $NewE / 40320) * (1385 + 3633 * $t2 + 4095 * $t4 + 1575 * $t6);\n $LatitudeRadians = $FootPointLatitude + $LatitudeTerm1 + $LatitudeTerm2 + $LatitudeTerm3 + $LatitudeTerm4;\n $LatitudeDegrees = ($LatitudeRadians / PI()) * 180;\n\n $CentralMeridianDegrees = ($Zone * $ZoneWidthDegrees) + $LongitudeOfTheCentralMeridianOfZone1Degrees - $ZoneWidthDegrees;\n $CentralMeridianRadians = ($CentralMeridianDegrees / 180) * PI();\n $LongitudeTerm1 = $SecFootPointLatitude * $x1;\n $LongitudeTerm2 = -$SecFootPointLatitude * ($x3 / 6) * ($Psi1 + 2 * $t2);\n $LongitudeTerm3 = $SecFootPointLatitude * ($x5 / 120) * (-4 * $Psi3 * (1 - 6 * $t2) + $Psi2 * (9 - 68 * $t2) + 72 * $Psi1 * $t2 + 24 * $t4);\n $LongitudeTerm4 = -$SecFootPointLatitude * ($x7 / 5040) * (61 + 662 * $t2 + 1320 * $t4 + 720 * $t6);\n $LongitudeRadians = $CentralMeridianRadians + $LongitudeTerm1 + $LongitudeTerm2 + $LongitudeTerm3 + $LongitudeTerm4;\n $LongitudeDegrees = ($LongitudeRadians / PI()) * 180;\n\n $GridConvergenceTerm1 = -($x1 * $t1);\n $GridConvergenceTerm2 = ($t1 * $x3 / 3) * (-2 * $Psi2 + 3 * $Psi1 + $t2);\n $GridConvergenceTerm3 = -($t1 * $x5 / 15) * ($Psi4 * (11 - 24 * $t2) - 3 * $Psi3 * (8 - 23 * $t2) + 5 * $Psi2 * (3 - 14 * $t2) + 30 * $Psi1 * $t2 + 3 * $t4);\n $GridConvergenceTerm4 = ($t1 * $x7 / 315) * (17 + 77 * $t2 + 105 * $t4 + 45 * $t6);\n $GridConvergenceRadians = $GridConvergenceTerm1 + $GridConvergenceTerm2 + $GridConvergenceTerm3 + $GridConvergenceTerm4;\n $GridConvergenceDegrees = ($GridConvergenceRadians / PI()) * 180;\n\n $PointScaleFactor1 = pow($NewEScaled, 2) / ($Rho*$Nu);\n $PointScaleFactor2 = pow($PointScaleFactor1, 2);\n $PointScaleFactor3 = pow($PointScaleFactor1, 3);\n $PointScaleTerm1 = 1 + $PointScaleFactor1 / 2;\n $PointScaleTerm2 = ($PointScaleFactor2 / 24) * (4 * $Psi1 * (1 - 6 * $t2) - 3 * (1 - 16 * $t2) - 24 * $t2 / $Psi1);\n $PointScaleTerm3 = $PointScaleFactor3 / 720;\n $PointScale = $CentralScaleFactor * ($PointScaleTerm1 + $PointScaleTerm2 + $PointScaleTerm3);\n\n $Point[\"Latitude\"] = $LatitudeDegrees;\n $Point[\"Longitude\"] = $LongitudeDegrees;\n $Point[\"GridConvergence\"] = $GridConvergenceDegrees;\n $Point[\"PointScale\"] = $PointScale;\n\n return $Point;\n}",
"function redfearnGridtoLL($Easting, $Northing, $Zone = 55, $TmDefinition = \"GDA-MGA\")\n{\n switch ($TmDefinition) {\n case \"GDA-MGA\":\n $FalseEasting = 500000.0000;\n $FalseNorthing = 10000000.0000;\n $CentralScaleFactor = 0.9996;\n $ZoneWidthDegrees = 6;\n $LongitudeOfTheCentralMeridianOfZone1Degrees = -177;\n $EllipsoidDefinition = \"GRS80\";\n break;\n default:\n $TmDefinition = \"GDA-MGA\";\n $FalseEasting = 500000.0000;\n $FalseNorthing = 10000000.0000;\n $CentralScaleFactor = 0.9996;\n $ZoneWidthDegrees = 6;\n $LongitudeOfTheCentralMeridianOfZone1Degrees = -177;\n $EllipsoidDefinition = \"GRS80\";\n }\n\n switch ($EllipsoidDefinition) {\n case \"GRS80\":\n $SemiMajorAxis = 6378137.000;\n $InverseFlattening = 298.257222101000;\n break;\n default:\n $EllipsoidDefinition = \"GRS80\";\n $SemiMajorAxis = 6378137.000;\n $InverseFlattening = 298.257222101000;\n }\n\n $Flattening = 1 / $InverseFlattening;\n $SemiMinorAxis = $SemiMajorAxis * (1 - $Flattening);\n $Eccentricity = (2 * $Flattening) - ($Flattening * $Flattening);\n $n = ($SemiMajorAxis - $SemiMinorAxis) / ($SemiMajorAxis + $SemiMinorAxis);\n $n2 = pow($n, 2);\n $n3 = pow($n, 3);\n $n4 = pow($n, 4);\n $G = $SemiMajorAxis * (1 - $n) * (1 - $n2) * (1 + (9 * $n2) / 4 + (225 * $n4) / 64) * PI() / 180;\n $LongitudeOfWesternEdgeOfZoneZeroDegrees = $LongitudeOfTheCentralMeridianOfZone1Degrees - (1.5 * $ZoneWidthDegrees);\n $CentralMeridianOfZoneZeroDegrees = $LongitudeOfWesternEdgeOfZoneZeroDegrees + ($ZoneWidthDegrees / 2);\n\n $NewE = ($Easting - $FalseEasting);\n $NewEScaled = $NewE / $CentralScaleFactor;\n $NewN = ($Northing - $FalseNorthing);\n $NewNScaled = $NewN / $CentralScaleFactor;\n $Sigma = ($NewNScaled * PI()) / ($G * 180);\n $Sigma2 = 2 * $Sigma;\n $Sigma4 = 4 * $Sigma;\n $Sigma6 = 6 * $Sigma;\n $Sigma8 = 8 * $Sigma;\n\n $FootPointLatitudeTerm1 = $Sigma;\n $FootPointLatitudeTerm2 = ((3 * $n / 2) - (27 * $n3 / 32)) * sin($Sigma2);\n $FootPointLatitudeTerm3 = ((21 * $n2 / 16) - (55 * $n4 / 32)) * sin($Sigma4);\n $FootPointLatitudeTerm4 = (151 * $n3) * sin($Sigma6) / 96;\n $FootPointLatitudeTerm5 = 1097 * $n4 * sin($Sigma8) / 512;\n $FootPointLatitude = $FootPointLatitudeTerm1 + $FootPointLatitudeTerm2 + $FootPointLatitudeTerm3 + $FootPointLatitudeTerm4 + $FootPointLatitudeTerm5;\n\n $SinFootPointLatitude = sin($FootPointLatitude);\n $SecFootPointLatitude = 1 / cos($FootPointLatitude);\n\n $Rho = $SemiMajorAxis * (1 - $Eccentricity) / pow(1 - $Eccentricity * pow($SinFootPointLatitude, 2), 1.5);\n $Nu = $SemiMajorAxis / pow(1 - $Eccentricity * pow($SinFootPointLatitude, 2), 0.5);\n\n $x1 = $NewEScaled / $Nu;\n $x3 = pow($x1, 3);\n $x5 = pow($x1, 5);\n $x7 = pow($x1, 7);\n\n $t1 = tan($FootPointLatitude);\n $t2 = pow($t1, 2);\n $t4 = pow($t1, 4);\n $t6 = pow($t1, 6);\n\n $Psi1 = $Nu / $Rho;\n $Psi2 = pow($Psi1, 2);\n $Psi3 = pow($Psi1, 3);\n $Psi4 = pow($Psi1, 4);\n\n $LatitudeTerm1 = -(($t1 / ($CentralScaleFactor * $Rho)) * $x1 * $NewE / 2);\n $LatitudeTerm2 = ($t1 / ($CentralScaleFactor * $Rho)) * ($x3 * $NewE / 24) * (-4 * $Psi2 + 9 * $Psi1 * (1 - $t2) + 12 * $t2);\n $LatitudeTerm3 = -($t1 / ($CentralScaleFactor * $Rho)) * ($x5 * $NewE / 720) * (8 * $Psi4 * (11 - 24 * $t2) - 12 * $Psi3 * (21 - 71 * $t2) + 15 * $Psi2 * (15 - 98 * $t2 + 15 * $t4) + 180 * $Psi1 * (5 * $t2 - 3 * $t4) + 360 * $t4);\n $LatitudeTerm4 = ($t1 / ($CentralScaleFactor * $Rho)) * ($x7 * $NewE / 40320) * (1385 + 3633 * $t2 + 4095 * $t4 + 1575 * $t6);\n $LatitudeRadians = $FootPointLatitude + $LatitudeTerm1 + $LatitudeTerm2 + $LatitudeTerm3 + $LatitudeTerm4;\n $LatitudeDegrees = ($LatitudeRadians / PI()) * 180;\n\n $CentralMeridianDegrees = ($Zone * $ZoneWidthDegrees) + $LongitudeOfTheCentralMeridianOfZone1Degrees - $ZoneWidthDegrees;\n $CentralMeridianRadians = ($CentralMeridianDegrees / 180) * PI();\n $LongitudeTerm1 = $SecFootPointLatitude * $x1;\n $LongitudeTerm2 = -$SecFootPointLatitude * ($x3 / 6) * ($Psi1 + 2 * $t2);\n $LongitudeTerm3 = $SecFootPointLatitude * ($x5 / 120) * (-4 * $Psi3 * (1 - 6 * $t2) + $Psi2 * (9 - 68 * $t2) + 72 * $Psi1 * $t2 + 24 * $t4);\n $LongitudeTerm4 = -$SecFootPointLatitude * ($x7 / 5040) * (61 + 662 * $t2 + 1320 * $t4 + 720 * $t6);\n $LongitudeRadians = $CentralMeridianRadians + $LongitudeTerm1 + $LongitudeTerm2 + $LongitudeTerm3 + $LongitudeTerm4;\n $LongitudeDegrees = ($LongitudeRadians / PI()) * 180;\n\n $GridConvergenceTerm1 = -($x1 * $t1);\n $GridConvergenceTerm2 = ($t1 * $x3 / 3) * (-2 * $Psi2 + 3 * $Psi1 + $t2);\n $GridConvergenceTerm3 = -($t1 * $x5 / 15) * ($Psi4 * (11 - 24 * $t2) - 3 * $Psi3 * (8 - 23 * $t2) + 5 * $Psi2 * (3 - 14 * $t2) + 30 * $Psi1 * $t2 + 3 * $t4);\n $GridConvergenceTerm4 = ($t1 * $x7 / 315) * (17 + 77 * $t2 + 105 * $t4 + 45 * $t6);\n $GridConvergenceRadians = $GridConvergenceTerm1 + $GridConvergenceTerm2 + $GridConvergenceTerm3 + $GridConvergenceTerm4;\n $GridConvergenceDegrees = ($GridConvergenceRadians / PI()) * 180;\n\n $PointScaleFactor1 = pow($NewEScaled, 2) / ($Rho*$Nu);\n $PointScaleFactor2 = pow($PointScaleFactor1, 2);\n $PointScaleFactor3 = pow($PointScaleFactor1, 3);\n $PointScaleTerm1 = 1 + $PointScaleFactor1 / 2;\n $PointScaleTerm2 = ($PointScaleFactor2 / 24) * (4 * $Psi1 * (1 - 6 * $t2) - 3 * (1 - 16 * $t2) - 24 * $t2 / $Psi1);\n $PointScaleTerm3 = $PointScaleFactor3 / 720;\n $PointScale = $CentralScaleFactor * ($PointScaleTerm1 + $PointScaleTerm2 + $PointScaleTerm3);\n\n $Point[\"Latitude\"] = $LatitudeDegrees;\n $Point[\"Longitude\"] = $LongitudeDegrees;\n $Point[\"GridConvergence\"] = $GridConvergenceDegrees;\n $Point[\"PointScale\"] = $PointScale;\n\n return $Point;\n}",
"public function volumeSphere()\n { // 4/3 PI R3\n return number_format(((pow(parent::getDiametre()/2,3)*pi()*4)/3),2);\n }",
"function guifi_ND50_WG84 ( $Xs, $Ys, $Zs, $type=0 ) {\n/* $Tx = 181.5; $Ty = 90.3; $Tz = 187.2;\n $Rx = deg2rad(0.144/3600); $Ry = deg2rad(0.492/3600); $Rz = deg2rad(-0.394/3600);\n $D = 17.57 / 1000000.0 ;\n $Tx = 131.0; $Ty = 100.3; $Tz = 163.4;\n $Rx = deg2rad(-1.244/3600); $Ry = deg2rad(-0.020/3600); $Rz = deg2rad(-1.144/3600);\n $D = 9.39 / 1000000.0 ;\n*/ $Tx = 131.03; $Ty = 100.25; $Tz = 163.35;\n $Rx = deg2rad(-1.244/3600); $Ry = deg2rad(-0.019/3600); $Rz = deg2rad(-1.144/3600);\n $D = 9.39 / 1000000.0 ;\n \n if ($type) {\n $Tx = -$Tx; $Ty = -$Ty; $Tz = -$Tz; \n $Rx = -$Rx; $Ry = -$Ry; $Rz = -$Rz; \n $D = -$D;\n }\n \n $D = $D + 1.0 ;\n $Xs = $D * $Xs;\n $Ys = $D * $Ys;\n $Zs = $D * $Zs;\n\n $Xt = $Tx + ( $Xs + $Rz*$Ys - $Ry*$Zs );\n $Yt = $Ty + ( -$Rz*$Xs + $Ys + $Rx*$Zs );\n $Zt = $Tz + ( $Ry*$Xs - $Rx*$Ys + $Zs );\n \n return array( $Xt, $Yt, $Zt );\n}",
"function redfearnGridtoLLDebug($Easting, $Northing, $Zone = 55, $TmDefinition = \"GDA-MGA\")\n{\n switch ($TmDefinition) {\n case \"GDA-MGA\":\n $FalseEasting = 500000.0000;\n $FalseNorthing = 10000000.0000;\n $CentralScaleFactor = 0.9996;\n $ZoneWidthDegrees = 6;\n $LongitudeOfTheCentralMeridianOfZone1Degrees = -177;\n $EllipsoidDefinition = \"GRS80\";\n break;\n default:\n $TmDefinition = \"GDA-MGA\";\n $FalseEasting = 500000.0000;\n $FalseNorthing = 10000000.0000;\n $CentralScaleFactor = 0.9996;\n $ZoneWidthDegrees = 6;\n $LongitudeOfTheCentralMeridianOfZone1Degrees = -177;\n $EllipsoidDefinition = \"GRS80\";\n }\n\n switch ($EllipsoidDefinition) {\n case \"GRS80\":\n $SemiMajorAxis = 6378137.000;\n $InverseFlattening = 298.257222101000;\n break;\n default:\n $EllipsoidDefinition = \"GRS80\";\n $SemiMajorAxis = 6378137.000;\n $InverseFlattening = 298.257222101000;\n }\n\n $Flattening = 1 / $InverseFlattening;\n $SemiMinorAxis = $SemiMajorAxis * (1 - $Flattening);\n $Eccentricity = (2 * $Flattening) - ($Flattening * $Flattening);\n $n = ($SemiMajorAxis - $SemiMinorAxis) / ($SemiMajorAxis + $SemiMinorAxis);\n $n2 = pow($n, 2);\n $n3 = pow($n, 3);\n $n4 = pow($n, 4);\n $G = $SemiMajorAxis * (1 - $n) * (1 - $n2) * (1 + (9 * $n2) / 4 + (225 * $n4) / 64) * PI() / 180;\n $LongitudeOfWesternEdgeOfZoneZeroDegrees = $LongitudeOfTheCentralMeridianOfZone1Degrees - (1.5 * $ZoneWidthDegrees);\n $CentralMeridianOfZoneZeroDegrees = $LongitudeOfWesternEdgeOfZoneZeroDegrees + ($ZoneWidthDegrees / 2);\n\n\techo(\"Flattening = $Flattening<br>\");\n\techo(\"SemiMinorAxis = $SemiMinorAxis<br>\");\n\techo(\"Eccentricity = $Eccentricity<br>\");\n\techo(\"n = $n<br>\");\n\techo(\"n2 = $n2<br>\");\n\techo(\"n3 = $n3<br>\");\n\techo(\"n4 = $n4<br>\");\n\techo(\"G = $G<br>\");\n\techo(\"LongitudeOfWesternEdgeOfZoneZeroDegrees = $LongitudeOfWesternEdgeOfZoneZeroDegrees<br>\");\n\techo(\"CentralMeridianOfZoneZeroDegrees = $CentralMeridianOfZoneZeroDegrees<br>\");\n\n $NewE = ($Easting - $FalseEasting);\n $NewEScaled = $NewE / $CentralScaleFactor;\n $NewN = ($Northing - $FalseNorthing);\n $NewNScaled = $NewN / $CentralScaleFactor;\n $Sigma = ($NewNScaled * PI()) / ($G * 180);\n $Sigma2 = 2 * $Sigma;\n $Sigma4 = 4 * $Sigma;\n $Sigma6 = 6 * $Sigma;\n $Sigma8 = 8 * $Sigma;\n\n\techo(\"NewE = $NewE<br>\");\n\techo(\"NewEScaled = $NewEScaled<br>\");\n\techo(\"NewN = $NewN<br>\");\n\techo(\"NewNScaled = $NewNScaled<br>\");\n\techo(\"Sigma = $Sigma<br>\");\n\techo(\"Sigma2 = $Sigma2<br>\");\n\techo(\"Sigma4 = $Sigma4<br>\");\n\techo(\"Sigma6 = $Sigma6<br>\");\n\techo(\"Sigma8 = $Sigma8<br>\");\n\n $FootPointLatitudeTerm1 = $Sigma;\n $FootPointLatitudeTerm2 = ((3 * $n / 2) - (27 * $n3 / 32)) * sin($Sigma2);\n $FootPointLatitudeTerm3 = ((21 * $n2 / 16) - (55 * $n4 / 32)) * sin($Sigma4);\n $FootPointLatitudeTerm4 = (151 * $n3) * sin($Sigma6) / 96;\n $FootPointLatitudeTerm5 = 1097 * $n4 * sin($Sigma8) / 512;\n $FootPointLatitude = $FootPointLatitudeTerm1 + $FootPointLatitudeTerm2 + $FootPointLatitudeTerm3 + $FootPointLatitudeTerm4 + $FootPointLatitudeTerm5;\n\n\techo(\"FootPointLatitudeTerm1 = $FootPointLatitudeTerm1<br>\");\n\techo(\"FootPointLatitudeTerm2 = $FootPointLatitudeTerm2<br>\");\n\techo(\"FootPointLatitudeTerm3 = $FootPointLatitudeTerm3<br>\");\n\techo(\"FootPointLatitudeTerm4 = $FootPointLatitudeTerm4<br>\");\n\techo(\"FootPointLatitudeTerm5 = $FootPointLatitudeTerm5<br>\");\n\techo(\"FootPointLatitude = $FootPointLatitude<br>\");\n\t\n $SinFootPointLatitude = sin($FootPointLatitude);\n $SecFootPointLatitude = 1 / cos($FootPointLatitude);\n\n\techo(\"SinFootPointLatitude = $SinFootPointLatitude<br>\");\n\techo(\"SecFootPointLatitude = $SecFootPointLatitude<br>\");\n\n $Rho = $SemiMajorAxis * (1 - $Eccentricity) / pow(1 - $Eccentricity * pow($SinFootPointLatitude, 2), 1.5);\n $Nu = $SemiMajorAxis / pow(1 - $Eccentricity * pow($SinFootPointLatitude, 2), 0.5);\n\n\techo(\"Rho = $Rho<br>\");\n\techo(\"Nu = $Nu<br>\");\n\n $x1 = $NewEScaled / $Nu;\n $x3 = pow($x1, 3);\n $x5 = pow($x1, 5);\n $x7 = pow($x1, 7);\n\t\n\techo(\"x1 = $x1<br>\");\n\techo(\"x3 = $x3<br>\");\n\techo(\"x5 = $x5<br>\");\n\techo(\"x7 = $x7<br>\");\n\n $t1 = tan($FootPointLatitude);\n $t2 = pow($t1, 2);\n $t4 = pow($t1, 4);\n $t6 = pow($t1, 6);\n\n\techo(\"t1 = $t1<br>\");\n\techo(\"t2 = $t2<br>\");\n\techo(\"t4 = $t4<br>\");\n\techo(\"t6 = $t6<br>\");\n\n $Psi1 = $Nu / $Rho;\n $Psi2 = pow($Psi1, 2);\n $Psi3 = pow($Psi1, 3);\n $Psi4 = pow($Psi1, 4);\n\n\techo(\"Psi1 = $Psi1<br>\");\n\techo(\"Psi2 = $Psi2<br>\");\n\techo(\"Psi3 = $Psi3<br>\");\n\techo(\"Psi4 = $Psi4<br>\");\n\n $LatitudeTerm1 = -(($t1 / ($CentralScaleFactor * $Rho)) * $x1 * $NewE / 2);\n $LatitudeTerm2 = ($t1 / ($CentralScaleFactor * $Rho)) * ($x3 * $NewE / 24) * (-4 * $Psi2 + 9 * $Psi1 * (1 - $t2) + 12 * $t2);\n $LatitudeTerm3 = -($t1 / ($CentralScaleFactor * $Rho)) * ($x5 * $NewE / 720) * (8 * $Psi4 * (11 - 24 * $t2) - 12 * $Psi3 * (21 - 71 * $t2) + 15 * $Psi2 * (15 - 98 * $t2 + 15 * $t4) + 180 * $Psi1 * (5 * $t2 - 3 * $t4) + 360 * $t4);\n $LatitudeTerm4 = ($t1 / ($CentralScaleFactor * $Rho)) * ($x7 * $NewE / 40320) * (1385 + 3633 * $t2 + 4095 * $t4 + 1575 * $t6);\n $LatitudeRadians = $FootPointLatitude + $LatitudeTerm1 + $LatitudeTerm2 + $LatitudeTerm3 + $LatitudeTerm4;\n $LatitudeDegrees = ($LatitudeRadians / PI()) * 180;\n\n\techo(\"LatitudeTerm1 = $LatitudeTerm1<br>\");\n\techo(\"LatitudeTerm2 = $LatitudeTerm2<br>\");\n\techo(\"LatitudeTerm3 = $LatitudeTerm3<br>\");\n\techo(\"LatitudeTerm4 = $LatitudeTerm4<br>\");\n\techo(\"LatitudeRadians = $LatitudeRadians<br>\");\n\techo(\"LatitudeDegrees = $LatitudeDegrees<br>\");\n\t\n $CentralMeridianDegrees = ($Zone * $ZoneWidthDegrees) + $LongitudeOfTheCentralMeridianOfZone1Degrees - $ZoneWidthDegrees;\n $CentralMeridianRadians = ($CentralMeridianDegrees / 180) * PI();\n $LongitudeTerm1 = $SecFootPointLatitude * $x1;\n $LongitudeTerm2 = -$SecFootPointLatitude * ($x3 / 6) * ($Psi1 + 2 * $t2);\n $LongitudeTerm3 = $SecFootPointLatitude * ($x5 / 120) * (-4 * $Psi3 * (1 - 6 * $t2) + $Psi2 * (9 - 68 * $t2) + 72 * $Psi1 * $t2 + 24 * $t4);\n $LongitudeTerm4 = -$SecFootPointLatitude * ($x7 / 5040) * (61 + 662 * $t2 + 1320 * $t4 + 720 * $t6);\n $LongitudeRadians = $CentralMeridianRadians + $LongitudeTerm1 + $LongitudeTerm2 + $LongitudeTerm3 + $LongitudeTerm4;\n $LongitudeDegrees = ($LongitudeRadians / PI()) * 180;\n\n\techo(\"CentralMeridianDegrees = $CentralMeridianDegrees<br>\");\n\techo(\"CentralMeridianRadians = $CentralMeridianRadians<br>\");\n\techo(\"LongitudeTerm1 = $LongitudeTerm1<br>\");\n\techo(\"LongitudeTerm2 = $LongitudeTerm2<br>\");\n\techo(\"LongitudeTerm3 = $LongitudeTerm3<br>\");\n\techo(\"LongitudeTerm4 = $LongitudeTerm4<br>\");\n\techo(\"LongitudeRadians = $LongitudeRadians<br>\");\n\techo(\"LongitudeDegrees = $LongitudeDegrees<br>\");\n\t\n $GridConvergenceTerm1 = -($x1 * $t1);\n $GridConvergenceTerm2 = ($t1 * $x3 / 3) * (-2 * $Psi2 + 3 * $Psi1 + $t2);\n $GridConvergenceTerm3 = -($t1 * $x5 / 15) * ($Psi4 * (11 - 24 * $t2) - 3 * $Psi3 * (8 - 23 * $t2) + 5 * $Psi2 * (3 - 14 * $t2) + 30 * $Psi1 * $t2 + 3 * $t4);\n $GridConvergenceTerm4 = ($t1 * $x7 / 315) * (17 + 77 * $t2 + 105 * $t4 + 45 * $t6);\n $GridConvergenceRadians = $GridConvergenceTerm1 + $GridConvergenceTerm2 + $GridConvergenceTerm3 + $GridConvergenceTerm4;\n $GridConvergenceDegrees = ($GridConvergenceRadians / PI()) * 180;\n\n\techo(\"GridConvergenceTerm1 = $GridConvergenceTerm1<br>\");\n\techo(\"GridConvergenceTerm2 = $GridConvergenceTerm2<br>\");\n\techo(\"GridConvergenceTerm3 = $GridConvergenceTerm3<br>\");\n\techo(\"GridConvergenceTerm4 = $GridConvergenceTerm4<br>\");\n\techo(\"GridConvergenceRadians = $GridConvergenceRadians<br>\");\n\techo(\"GridConvergenceDegrees = $GridConvergenceDegrees<br>\");\n\t\n $PointScaleFactor1 = pow($NewEScaled, 2) / ($Rho*$Nu);\n $PointScaleFactor2 = pow($PointScaleFactor1, 2);\n $PointScaleFactor3 = pow($PointScaleFactor1, 3);\n $PointScaleTerm1 = 1 + $PointScaleFactor1 / 2;\n $PointScaleTerm2 = ($PointScaleFactor2 / 24) * (4 * $Psi1 * (1 - 6 * $t2) - 3 * (1 - 16 * $t2) - 24 * $t2 / $Psi1);\n $PointScaleTerm3 = $PointScaleFactor3 / 720;\n $PointScale = $CentralScaleFactor * ($PointScaleTerm1 + $PointScaleTerm2 + $PointScaleTerm3);\n\n\techo(\"PointScaleFactor1 = $PointScaleFactor1<br>\");\n\techo(\"PointScaleFactor2 = $PointScaleFactor2<br>\");\n\techo(\"PointScaleFactor3 = $PointScaleFactor3<br>\");\n\techo(\"PointScaleTerm1 = $PointScaleTerm1<br>\");\n\techo(\"PointScaleTerm2 = $PointScaleTerm2<br>\");\n\techo(\"PointScaleTerm3 = $PointScaleTerm3<br>\");\n\techo(\"PointScale = $PointScale<br>\");\n\t\n $Point[\"Latitude\"] = $LatitudeDegrees;\n $Point[\"Longitude\"] = $LongitudeDegrees;\n $Point[\"GridConvergence\"] = $GridConvergenceDegrees;\n $Point[\"PointScale\"] = $PointScale;\n\n return $Point;\n}",
"protected function _setLimits() {\n\n\n\n $north = $this->_point->getRelativePoint($this->_radius, '0', $this->_unit);\n $south = $this->_point->getRelativePoint($this->_radius, '180', $this->_unit);\n\n $this->_limits['n'] = $north->lat;\n $this->_limits['s'] = $south->lat;\n\n $radDist = $this->_radius / Earth::radius($this->_unit);\n $minLat = deg2rad($this->_limits['s']);\n $maxLat = deg2rad($this->_limits['n']);\n $radLon = $this->_point->longitudeToRad();\n //if ($minLat > deg2rad(-90) && $maxLat < deg2rad(90)) {\n $deltaLon = asin(sin($radDist) / cos($this->_point->latitudeToRad()));\n $minLon = $radLon - $deltaLon;\n if ($minLon < deg2rad(-180)) {\n $minLon += 2 * pi();\n }\n $maxLon = $radLon + $deltaLon;\n if ($maxLon > deg2rad(180)){\n $maxLon -= 2 * pi();\n }\n //}\n //\n $this->_limits['w'] = rad2deg($minLon);\n $this->_limits['e'] = rad2deg($maxLon);\n }",
"public function init() {\r\n #$temp; /* temporary variable\t\t */\r\n if( $this->lat0 == 0 )\r\n $this->lat0 = 90; //$this->lat0 ca\r\n\r\n /* Place parameters in static storage for common use\r\n ------------------------------------------------- */\r\n $this->temp = $this->b / $this->a;\r\n $this->es = 1.0 - pow( $this->temp, 2 ); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles \r\n $this->e = sqrt( $this->es );\r\n $this->e0 = Proj4php::$common->e0fn( $this->es );\r\n $this->e1 = Proj4php::$common->e1fn( $this->es );\r\n $this->e2 = Proj4php::$common->e2fn( $this->es );\r\n $this->e3 = Proj4php::$common->e3fn( $this->es );\r\n $this->ml0 = Proj4php::$common->mlfn( $this->e0, $this->e1, $this->e2, $this->e3, $this->lat0 ); //si que des zeros le calcul ne se fait pas\r\n //if (!$this->ml0) {$this->ml0=0;}\r\n }",
"public function toWGS84()\n {\n $gkProjection = new GaussKreugerProjection();\n $gkProjection->swedish_params($this->getProjectionString($this->projection));\n $lat_lon = $gkProjection->grid_to_geodetic($this->latitude, $this->longitude);\n\n $newPos = new WGS84Position($lat_lon[0], $lat_lon[1]);\n\n return $newPos;\n }",
"function UTMtoGeog_v1($Easting,$Northing,$UtmZone,$SouthofEquator=false) {\n\t//Declarations\n\t//Symbols as used in USGS PP 1395: Map Projections - A Working Manual\n\t$k0 = 0.9996;//scale on central meridian\n\t$a = 6378137.0;//equatorial radius, meters.\n\t$f = 1/298.2572236;//polar flattening.\n\t$b = $a*(1-$f);//polar axis.\n\t$e = sqrt(1 - $b*$b/$a*$a);//eccentricity\n\t$drad = pi()/180;//Convert degrees to radians)\n\t$phi = 0;//latitude (north +, south -), but uses phi in reference\n\t$e0 = $e/sqrt(1 - $e*$e);//e prime in reference\n\n\t$lng = 0;//Longitude (e = +, w = -)\n\t$lng0 = 0;//longitude of central meridian\n\t$lngd = 0;//longitude in degrees\n\t$M = 0;//M requires calculation\n\t$x = 0;//x coordinate\n\t$y = 0;//y coordinate\n\t$k = 1;//local scale\n\t$zcm = 0;//zone central meridian\n\t//End declarations\n\n\n\t//Convert UTM Coordinates to Geographic\n\n\t$k0 = 0.9996;//scale on central meridian\n\t$b = $a*(1-$f);//polar axis.\n\t$e = sqrt(1 - ($b/$a)*($b/$a));//eccentricity\n\t$e0 = $e/sqrt(1 - $e*$e);//Called e prime in reference\n\t$esq =(1 - ($b/$a)*($b/$a));//e squared for use in expansions\n\t$e0sq =$e*$e/(1-$e*$e);// e0 squared - always even powers\n\t$x = $Easting;\n\n\t/*\n\tif ($x<160000 || $x>840000)\n\t\techo \"($x,$y) Outside permissible range of easting values \\n Results may be unreliable \\n Use with caution\\n<br />\";\n\t$y = $Northing;\n\tif ($y<0)\n\t\techo \"Negative values not allowed \\n Results may be unreliable \\n Use with caution\\n\";\n\tif ($y>10000000)\n\t\techo \"Northing may not exceed 10,000,000 \\n Results may be unreliable \\n Use with caution\\n\";\n\t*/\n\n\t$zcm =3 + 6*($UtmZone-1) - 180;//Central meridian of zone\n\t$e1 =(1 - sqrt(1 - $e*$e))/(1 + sqrt(1 - $e*$e));//Called e1 in USGS PP 1395 also\n\t$M0 =0;//In case origin other than zero lat - not needed for standard UTM\n\t$M =$M0 + $y/$k0;//Arc length along standard meridian.\n\tif ($SouthofEquator === true)\n\t$M=$M0+($y-10000000)/$k;\n\t$mu =$M/($a*(1 - $esq*(1/4 + $esq*(3/64 + 5*$esq/256))));\n\t$phi1 =$mu + $e1*(3/2 - 27*$e1*$e1/32)*sin(2*$mu) + $e1*$e1*(21/16 -55*$e1*$e1/32)*sin(4*$mu);//Footprint Latitude\n\t$phi1 =$phi1 + $e1*$e1*$e1*(sin(6*$mu)*151/96 + $e1*sin(8*$mu)*1097/512);\n\t$C1 =$e0sq*pow(cos($phi1),2);\n\t$T1 =pow(tan($phi1),2);\n\t$N1 =$a/sqrt(1-pow($e*sin($phi1),2));\n\t$R1 =$N1*(1-$e*$e)/(1-pow($e*sin($phi1),2));\n\t$D =($x-500000)/($N1*$k0);\n\t$phi =($D*$D)*(1/2 - $D*$D*(5 + 3*$T1 + 10*$C1 - 4*$C1*$C1 - 9*$e0sq)/24);\n\t$phi =$phi + pow($D,6)*(61 + 90*$T1 + 298*$C1 + 45*$T1*$T1 -252*$e0sq - 3*$C1*$C1)/720;\n\t$phi =$phi1 - ($N1*tan($phi1)/$R1)*$phi;\n\t//Longitude\n\t$lng =$D*(1 + $D*$D*((-1 -2*$T1 -$C1)/6 + $D*$D*(5 - 2*$C1 + 28*$T1 - 3*$C1*$C1 +8*$e0sq + 24*$T1*$T1)/120))/cos($phi1);\n\t$lngd = $zcm+$lng/$drad;\n\n\treturn array(floor(1000000*$phi/$drad)/1000000,floor(1000000*$lngd)/1000000); //Latitude,Longitude\n\t}",
"public function getCenter() : Vector3{\n\t\treturn $this->center;\n\t}",
"private function RiseSetAngle()\n\t{\n\t\t//var earthRad = 6371009; // in meters\n\t\t//var angle = DegreeMath.Acos(earthRad/(earthRad+ elv));\n\t\t$angle = 0.0347 * sqrt($this->_elv); // an approximation\n\t\treturn 0.833 + $angle;\n\t}",
"protected function getValueOfSquareEccentricity()\n {\n return (pow(OOW_EARTH_MAJOR_RADIUS, 2) - pow(OOW_EARTH_MINOR_RADIUS, 2)) / pow(OOW_EARTH_MAJOR_RADIUS, 2);\n }",
"public function toCartesian()\n {\n $phi = deg2rad($this->getLatitude());\n $lambda = deg2rad($this->getLongitude());\n\n $H = $this->getHeight();\n $a = $this->getEllipsoid()->getA();\n $b = $this->getEllipsoid()->getB();\n\n $sin_phi = sin($phi);\n $cos_phi = cos($phi);\n $sin_lambda = sin($lambda);\n $cos_lambda = cos($lambda);\n\n $eSq = (pow($a, 2) - pow($b, 2)) / (pow($a, 2));\n $nu = $a / sqrt(1 - $eSq * $sin_phi * $sin_phi);\n\n $x = ($nu + $H) * $cos_phi * $cos_lambda;\n $y = ($nu + $H) * $cos_phi * $sin_lambda;\n $z = ((1 - $eSq) * $nu + $H) * $sin_phi;\n\n // TODO: return a cartesian coordinate object, not an array.\n // The object will provide the means for converting back again.\n $point = array($x, $y, $z);\n\n return $point;\n }",
"function rd2wgs($x, $y) {\n // Calculate WGS84 coördinates\n $dX = ($x - 155000) * pow(10, - 5);\n $dY = ($y - 463000) * pow(10, - 5);\n $SomN = (3235.65389 * $dY) + (- 32.58297 * pow($dX, 2)) + (- 0.2475 *\n pow($dY, 2)) + (- 0.84978 * pow($dX, 2) *\n $dY) + (- 0.0655 * pow($dY, 3)) + (- 0.01709 *\n pow($dX, 2) * pow($dY, 2)) + (- 0.00738 *\n $dX) + (0.0053 * pow($dX, 4)) + (- 0.00039 *\n pow($dX, 2) * pow($dY, 3)) + (0.00033 * pow(\n $dX, 4) * $dY) + (- 0.00012 *\n $dX * $dY);\n $SomE = (5260.52916 * $dX) + (105.94684 * $dX * $dY) + (2.45656 *\n $dX * pow($dY, 2)) + (- 0.81885 * pow(\n $dX, 3)) + (0.05594 *\n $dX * pow($dY, 3)) + (- 0.05607 * pow(\n $dX, 3) * $dY) + (0.01199 *\n $dY) + (- 0.00256 * pow($dX, 3) * pow(\n $dY, 2)) + (0.00128 *\n $dX * pow($dY, 4)) + (0.00022 * pow($dY,\n 2)) + (- 0.00022 * pow(\n $dX, 2)) + (0.00026 *\n pow($dX, 5));\n\n $Latitude = 52.15517 + ($SomN / 3600);\n $Longitude = 5.387206 + ($SomE / 3600);\n\n return array(\n 'latitude' => $Latitude ,\n 'longitude' => $Longitude);\n}",
"function __construct($Latitude, $Longitude, $Miles) {\n global $maxLat, $minLat, $maxLong, $minLong;\n $EQUATOR_LAT_MILE = 69.172; // in MIles\n $maxLat = $Latitude + $Miles / $EQUATOR_LAT_MILE;\n $minLat = $Latitude - ($maxLat - $Latitude);\n $maxLong = $Longitude + $Miles / (cos($minLat * M_PI / 180) * $EQUATOR_LAT_MILE);\n $minLong = $Longitude - ($maxLong - $Longitude);\n }",
"public function getVolume(){ // calcolo il volume del cubo che è area del quadrato * lato (lato * lato * lato)\n return parent::getArea() * $this -> side; \n }",
"function e4fn( $x ) {\r\n #$con;\r\n #$com;\r\n $con = 1.0 + $x;\r\n $com = 1.0 - $x;\r\n return (sqrt( (pow( $con, $con )) * (pow( $com, $com )) ));\r\n}",
"public function inverse( $p ) {\n\n $x = $p->x;\n $y = $p->y;\n\n $delta_x = $x - $this->x0;\n $delta_y = $y - $this->y0;\n\n // 1. Calculate z\n $z_re = $delta_y / $this->a;\n $z_im = $delta_x / $this->a;\n\n // 2a. Calculate theta - first approximation gives km accuracy\n $z_n_re = 1;\n $z_n_im = 0; // z^0\n $z_n_re1;\n $z_n_im1;\n\n $th_re = 0;\n $th_im = 0;\n for( $n = 1; $n <= 6; $n++ ) {\n $z_n_re1 = $z_n_re * $z_re - $z_n_im * $z_im;\n $z_n_im1 = $z_n_im * $z_re + $z_n_re * $z_im;\n $z_n_re = $z_n_re1;\n $z_n_im = $z_n_im1;\n $th_re = $th_re + $this->C_re[$n] * $z_n_re - $this->C_im[$n] * $z_n_im;\n $th_im = $th_im + $this->C_im[$n] * $z_n_re + $this->C_re[$n] * $z_n_im;\n }\n\n // 2b. Iterate to refine the accuracy of the calculation\n // 0 iterations gives km accuracy\n // 1 iteration gives m accuracy -- good enough for most mapping applications\n // 2 iterations bives mm accuracy\n for( $i = 0; $i < $this->iterations; $i++ ) {\n $th_n_re = $th_re;\n $th_n_im = $th_im;\n $th_n_re1;\n $th_n_im1;\n\n $num_re = $z_re;\n $num_im = $z_im;\n for( $n = 2; $n <= 6; $n++ ) {\n $th_n_re1 = $th_n_re * th_re - $th_n_im * $th_im;\n $th_n_im1 = $th_n_im * $th_re + $th_n_re * $th_im;\n $th_n_re = $th_n_re1;\n $th_n_im = $th_n_im1;\n $num_re = $num_re + ($n - 1) * ($this->B_re[$n] * $th_n_re - $this->B_im[$n] * $th_n_im);\n $num_im = $num_im + (n - 1) * ($this->B_im[$n] * $th_n_re + $this->B_re[$n] * $th_n_im);\n }\n\n $th_n_re = 1;\n $th_n_im = 0;\n $den_re = $this->B_re[1];\n $den_im = $this->B_im[1];\n for( $n = 2; $n <= 6; $n++ ) {\n $th_n_re1 = $th_n_re * $th_re - $th_n_im * $th_im;\n $th_n_im1 = $th_n_im * $th_re + $th_n_re * $th_im;\n $th_n_re = $th_n_re1;\n $th_n_im = $th_n_im1;\n $den_re = $den_re + $n * ($this->B_re[$n] * $th_n_re - $this->B_im[$n] * $th_n_im);\n $den_im = $den_im + $n * ($this->B_im[n] * $th_n_re + $this->B_re[$n] * $th_n_im);\n }\n\n // Complex division\n $den2 = $den_re * $den_re + $den_im * $den_im;\n $th_re = ($num_re * $den_re + $num_im * $den_im) / $den2;\n $th_im = ($num_im * $den_re - $num_re * $den_im) / $den2;\n }\n\n // 3. Calculate d_phi ... // and d_lambda\n $d_psi = $th_re;\n $d_lambda = $th_im;\n $d_psi_n = 1; // d_psi^0\n\n $d_phi = 0;\n for( $n = 1; $n <= 9; $n++ ) {\n $d_psi_n = $d_psi_n * $d_psi;\n $d_phi = $d_phi + $this->D[$n] * $d_psi_n;\n }\n\n // 4. Calculate latitude and longitude\n // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.\n $lat = $this->lat0 + ($d_phi * Proj4php::$common->SEC_TO_RAD * 1E5);\n $lon = $this->long0 + $d_lambda;\n\n $p->x = $lon;\n $p->y = $lat;\n\n return $p;\n }"
]
| [
"0.71659565",
"0.54162073",
"0.53115654",
"0.520053",
"0.51840913",
"0.51316226",
"0.5100031",
"0.50891846",
"0.49779677",
"0.49558923",
"0.47250822",
"0.46776083",
"0.4674652",
"0.4672881",
"0.46249285",
"0.4568563",
"0.45235556",
"0.4498608",
"0.4482498",
"0.44588915",
"0.44222713",
"0.43939024",
"0.4392709",
"0.43708283",
"0.43707246",
"0.43676215",
"0.42985487",
"0.42960888",
"0.4294672",
"0.42715728"
]
| 0.5509769 | 1 |
get mail charset by email | protected function _getCharset($email)
{
$pieces = explode('@', $email);
$domain = array_pop($pieces);
//if is aol
if (strcmp(strtolower($domain), 'aol.com') == 0) {
return 'utf-8';
}
return 'iso-2022-jp';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getHeaderCharset($connection, $msgnum) {\n $headerString = imap_fetchheader($connection, $msgnum);\n $headers = explode(\"\\n\", $headerString);\n for($i = 0; $i < count($headers); $i++)\n if(preg_match(\"/charset=(.*)\\r/\", $headers[$i], $matches))\n\treturn $matches[1];\n\n return \"\";\n}",
"protected function _getEncoding($email)\n {\n $pieces = explode('@', $email);\n $domain = array_pop($pieces);\n\n require_once 'Zend/Mime.php';\n\n //waseda.jp\n //This might be better to use in regular expression.\n if (stristr($domain, 'waseda.jp') != false) {\n return Zend_Mime::ENCODING_7BIT;\n }\n\n //Use Base64 for other mail addresses.\n return Zend_Mime::ENCODING_BASE64;\n }",
"public function getCharset();",
"public function getCharset();",
"public abstract function getCharset();",
"public function getBodyCharset($part)\n {\n\t\tforeach ($part->parameters as $pair) {\n if (isset($pair->attribute) && $pair->attribute == 'charset') {\n return $pair->value;\n }\n }\n return NULL;\n }",
"function atkGetCharset()\n{\n\treturn atkconfig('default_charset',atktext('charset','atk'));\n}",
"function getCharset()\n {\n return $this->getAttribute(\"charset\");\n }",
"Public Function getCharset() { Return $this->charset; }",
"function getCharset(): ?string;",
"public function getCharSet() {}",
"public function get_charset()\n {\n return $this->charset;\n }",
"public function getCharset(): string\n {\n return $this->charset;\n }",
"public function getCharset(): string\n {\n return $this->charset;\n }",
"public function get_charset(){\n return $this->_charset;\n }",
"public function getCharset(): ?string;",
"public function getCharset()\n\t{\n\t\treturn $this->getContentTypeAttribute('charset');\n\t}",
"public function getEncoding()\n {\n $content = $this->getHeaderLine('content-type');\n if (!$content) {\n return null;\n }\n preg_match('/charset\\s?=\\s?[\\'\"]?([a-z0-9-_]+)[\\'\"]?/i', $content, $matches);\n if (empty($matches[1])) {\n return null;\n }\n\n return $matches[1];\n }",
"public function getCharset()\n {\n return $this->options['charset'];\n }",
"protected function getCharsetConversion() {}",
"public function get_charset_collate()\n {\n }",
"public function getCharset(): string {\n\t\treturn $this->charset;\n\t}",
"function detectCharset() {\r\n\t\t//print('ascii strlen: ');var_dump(mb_strlen($this->code, 'ascii'));\r\n\t\t//print('utf-8 strlen: ');var_dump(mb_strlen($this->code, 'utf-8'));\r\n\t\t//exit(0);\r\n\t\tif(mb_strlen($this->code, 'ascii') !== mb_strlen($this->code, 'utf-8')) {\r\n\t\t\treturn 'utf-8';\r\n\t\t} else {\r\n\t\t\t//return 'ascii';\r\n\t\t\treturn 'iso-8859-1';\r\n\t\t}\r\n\t}",
"function getEncoding($filename) {\n\t$info = finfo_open(FILEINFO_MIME_ENCODING);\n $type = finfo_buffer($info, file_get_contents($filename));\n finfo_close($info);\n\n return $type;\n}",
"function getCharset ()\n\t{\n\t\treturn $this->doc->charset;\n\t}",
"public function getMessageEncoding() {\n\t\treturn $this->messageEncoding ?: static::config()->default_message_encoding;\n\t}",
"public function getCharset()\n {\n $charset = Config::get('view.charset');\n return ($charset !== null) ? $charset : $this->charset;\n }",
"public function getCharset()\n {\n if ($this->headers->hasAttribute(\"Content-Type\", \"charset\"))\n {\n return $this->headers->getAttribute(\"Content-Type\", \"charset\");\n }\n else\n {\n return null;\n }\n }",
"public function getContentTypeCharset(): string\n {\n $charset = strtoupper($this->charset);\n if (array_key_exists($charset, $this->contentTypeCharset)) {\n return strtoupper($this->contentTypeCharset[$charset]);\n }\n\n return strtoupper($this->charset);\n }",
"function getCharset($input)\n {\n $cs = XML_WBXML::MBUInt32ToInt($input, $this->_strpos);\n return XML_WBXML::getCharsetString($cs);\n }"
]
| [
"0.7265433",
"0.70772034",
"0.6591157",
"0.6591157",
"0.6405593",
"0.62891537",
"0.62836266",
"0.62392575",
"0.621362",
"0.62089634",
"0.61643994",
"0.61203885",
"0.6094275",
"0.6094275",
"0.6078577",
"0.6057762",
"0.60425913",
"0.60331434",
"0.60320765",
"0.6028808",
"0.59823525",
"0.5980911",
"0.5974548",
"0.5962434",
"0.59620214",
"0.5910842",
"0.58988106",
"0.5893338",
"0.58718336",
"0.58536005"
]
| 0.7579713 | 0 |
get mail encoding by email | protected function _getEncoding($email)
{
$pieces = explode('@', $email);
$domain = array_pop($pieces);
require_once 'Zend/Mime.php';
//waseda.jp
//This might be better to use in regular expression.
if (stristr($domain, 'waseda.jp') != false) {
return Zend_Mime::ENCODING_7BIT;
}
//Use Base64 for other mail addresses.
return Zend_Mime::ENCODING_BASE64;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function _getCharset($email)\n {\n $pieces = explode('@', $email);\n $domain = array_pop($pieces);\n\n //if is aol\n if (strcmp(strtolower($domain), 'aol.com') == 0) {\n return 'utf-8';\n }\n\n return 'iso-2022-jp';\n }",
"function plainMailEncoded($email,$subject,$message,$headers='',$enc='8bit',$charset='ISO-8859-1',$urlmode=null)\t{\n\n\t\tif ($urlmode)\t{\n\t\t\t$message=t3lib_div::substUrlsInPlainText($message,$urlmode);\n\t\t}\n\n\t\tt3lib_div::plainMailEncoded(\n\t\t\t$email,\n\t\t\t$subject,\n\t\t\t$message,\n\t\t\t$headers,\n\t\t\t$enc,\n\t\t\t$charset\n\t\t);\n\t}",
"public function getSubject($encoding = 'UTF-8') {}",
"public function getSubject($encoding = 'UTF-8') {}",
"function encode_email_address( $email ) {\n\n $output = '';\n\n for ($i = 0; $i < strlen($email); $i++) \n { \n $output .= '&#'.ord($email[$i]).';'; \n }\n\n return $output;\n}",
"protected function getEncEmail($email)\n {\n $encEmail = $email;\n\n // decode entities\n $encEmail = html_entity_decode($encEmail);\n\n // rot13 encoding\n $encEmail = str_rot13($encEmail);\n\n // replace @\n $encEmail = str_replace('@', '[at]', $encEmail);\n\n return $encEmail;\n }",
"public function encode_email($email)\n\t{\n\t\treturn str_replace('@', '@', $this->obfuscate($email));\n\t}",
"function mail_utf82($to, $from_user, $from_email, $subject = '(No subject)', $message = ''){\n $from_user = \"=?UTF-8?B?\".base64_encode($from_user).\"?=\"; // $from_user = \"=?utf-8?Q?\".($from_user).\"=\";\n //$from_user = \"=?UTF-8?Q?\".($from_user).\"?=\";\n //$from_user = \"=?utf-8?Q?=D0=A4=D0=BE=D0=BD=D0=B4?=\";\n\n\n $subject = \"=?UTF-8?B?\".base64_encode($subject).\"?=\"; //Content-type: text/html;\n $mime = \"\\r\\nMIME-Version: 1.0\" . \"Content-type: multipart/alternative; charset=UTF-8\";\n $mime = \"\\r\\nMIME-Version: 1.0\" . \"Content-type: text/html; charset=UTF-8 \\r\\nContent-Transfer-Encoding: 7bit\";\n\n $headers = \"From: $from_user <$from_email> $mime\"; $headers = \"From: <$from_email>\"; // . \"\\r\\n\"\n\n return mail($to, $subject, $message, $headers);\n }",
"public function getEncoding();",
"public static function email($email) {\n\t\treturn str_replace('@', '@', static::obfuscate($email));\n\t}",
"function encode_email_address( $email ) {\n\n $output = '';\n\n for ($i = 0; $i < strlen($email); $i++) \n { \n $output .= '&#'.ord($email[$i]).';'; \n }\n\n return $output;\n}",
"public function getContentEncoding();",
"function getHeaderCharset($connection, $msgnum) {\n $headerString = imap_fetchheader($connection, $msgnum);\n $headers = explode(\"\\n\", $headerString);\n for($i = 0; $i < count($headers); $i++)\n if(preg_match(\"/charset=(.*)\\r/\", $headers[$i], $matches))\n\treturn $matches[1];\n\n return \"\";\n}",
"public function getMail();",
"public function getEmail($email) {\n\t\tif (!isset($this->emails[$email])) {\n\t\t\t$this->emails[$email] = file_get_contents(INCLUDE_PATH.'/content/'.$this->getLocale().'/'.$email.'.html');\n\t\t}\n\t\treturn $this->emails[$email];\n\t}",
"protected function getDecodedEmailProperty($email, $property): string\n {\n if ((string) $property !== '') {\n if (!empty($email->Content->Headers->{'Content-Transfer-Encoding'}) && in_array(\n 'quoted-printable',\n $email->Content->Headers->{'Content-Transfer-Encoding'},\n true\n )\n ) {\n $property = quoted_printable_decode($property);\n }\n if (!empty($email->Content->Headers->{'Content-Type'}[0]) &&\n strpos($email->Content->Headers->{'Content-Type'}[0], 'multipart/mixed') !== false\n ) {\n $property = quoted_printable_decode($property);\n }\n if (stripos($property, '=?utf-8?Q?') !== false) {\n if (extension_loaded('iconv')) {\n $property = iconv_mime_decode($property);\n } elseif (extension_loaded('mbstring')) {\n $property = mb_decode_mimeheader($property);\n }\n }\n }\n\n return $property;\n }",
"public function getEncoding(): string;",
"public function encodeMail($address)\n {\n if ($this->_getRenderer() instanceof Kwf_Component_Renderer_Mail) {\n return $text;\n }\n $address = trim($address);\n $address = preg_replace('/^(.+)@(.+)\\.([^\\.\\s]+)$/i',\n '$1'.$this->_atEncoding.'$2'.$this->_dotEncoding.'$3',\n $address\n );\n return $address;\n }",
"public function getMessageEncoding() {\n\t\treturn $this->messageEncoding ?: static::config()->default_message_encoding;\n\t}",
"function encode_email($mail, $text=\"\", $class=\"\", $prefix)\n{\n $encmail =\"\";\n for($i=0; $i<strlen($mail); $i++)\n {\n $encMod = rand(0,2);\n switch ($encMod) {\n case 0: // None\n $encmail .= substr($mail,$i,1);\n break;\n case 1: // Decimal\n $encmail .= \"&#\".ord(substr($mail,$i,1)).';';\n break;\n case 2: // Hexadecimal\n $encmail .= \"&#x\".dechex(ord(substr($mail,$i,1))).';';\n break;\n }\n }\n $encprefix =\"\";\n for($i=0; $i<strlen($prefix); $i++)\n {\n $encMod = rand(0,2);\n switch ($encMod) {\n case 0: // None\n $encprefix .= substr($prefix,$i,1);\n break;\n case 1: // Decimal\n $encprefix .= \"&#\".ord(substr($prefix,$i,1)).';';\n break;\n case 2: // Hexadecimal\n $encprefix .= \"&#x\".dechex(ord(substr($prefix,$i,1))).';';\n break;\n }\n }\n\n if(!$text)\n {\n $text = $encmail;\n }\n $encmail = $prefix.$encmail;\n return \"<a class='$class' href='$encmail'>$text</a>\";\n}",
"private function payload_to_utf8($payload) {\n\n foreach($payload['recipients'] as &$item) {\n\n $item['email'] = mb_detect_encoding($item['email'], 'UTF-8', true) === false ? utf8_encode($item['email']) : $item['email'];\n\n if(array_key_exists('header_to', $item)) {\n $item['header_to'] = mb_detect_encoding($item['header_to'], 'UTF-8', true) === false ? utf8_encode($item['header_to']) : $item['header_to'];\n }\n if(array_key_exists('name', $item)) {\n $item['name'] = mb_detect_encoding($item['name'], 'UTF-8', true) === false ? utf8_encode($item['name']) : $item['name'];\n }\n }\n\n $payload['content']['from']['email'] = mb_detect_encoding($payload['content']['from']['email'], 'UTF-8', true) === false ? utf8_encode($payload['content']['from']['email']) : $payload['content']['from']['email'];\n if(array_key_exists('name', $payload['content']['from'])) {\n $payload['content']['from']['name'] = mb_detect_encoding($payload['content']['from']['name'], 'UTF-8', true) === false ? utf8_encode($payload['content']['from']['name']) : $payload['content']['from']['name'];\n }\n\n $payload['content']['subject'] = mb_detect_encoding($payload['content']['subject'], 'UTF-8', true) === false ? utf8_encode($payload['content']['subject']) : $payload['content']['subject'];\n\n $payload['content']['text'] = mb_detect_encoding($payload['content']['text'], 'UTF-8', true) === false ? utf8_encode($payload['content']['text']) : $payload['content']['text'];\n $payload['content']['html'] = mb_detect_encoding($payload['content']['html'], 'UTF-8', true) === false ? utf8_encode($payload['content']['html']) : $payload['content']['html'];\n\n\n if($payload->headers->CC) {\n $item['name'] = mb_detect_encoding($payload->headers->CC, 'UTF-8', true) === false ? utf8_encode($payload->headers->CC) : $payload->headers->CC;\n }\n\n if($payload['content']['reply_to']) {\n $payload['content']['reply_to'] = mb_detect_encoding($payload['content']['reply_to'], 'UTF-8', true) === false ? utf8_encode($payload['content']['reply_to']) : $payload['content']['reply_to'];\n }\n\n return $payload;\n\n }",
"public function getMailMIME()\n {\n }",
"public function getMimeEncoding()\n\t{\n\t\treturn $this->_mime;\n\t}",
"protected function getEmailBody($email): string\n {\n return $this->getDecodedEmailProperty($email, $email->Content->Body);\n }",
"function getEncoding($filename) {\n\t$info = finfo_open(FILEINFO_MIME_ENCODING);\n $type = finfo_buffer($info, file_get_contents($filename));\n finfo_close($info);\n\n return $type;\n}",
"function sendecode()\n {\n $to = html_escape($this->input->post('email'));\n $message = html_escape($this->input->post('message'));\n $from = $this->session->userdata('sname');\n $refcode = $this->db->get_where('superuser', array('email' => $from))->row()->ref;\n $subject = 'Referrel Code :' . $refcode;\n $this->Email_model->send_smtp_mail($message, $subject, $to, $from);\n $this->session->set_flashdata('emailsent', \"Email Sent Successfully\");\n $this->vemailmodal();\n }",
"public function decomposeCompleteEmail($email) {\n $return = array('name' => '', 'email' => '');\n $email = urldecode(str_replace('+', '%2B', $email));\n if (is_string($email) && mb_strpos($email, '@') !== false) {\n $return['email'] = trim(str_replace(array('<', '>'), '', mb_substr($email, mb_strrpos($email, '<'))));\n $decomposedName = trim(str_replace(array('\"', '+'), array('', ' '), mb_substr($email, 0, mb_strrpos($email, '<'))));\n\n if (mb_strpos($decomposedName, '=?') === 0) {\n $decodedHeader = $this->mimeHeaderDecode($decomposedName);\n if (!empty($decodedHeader[0]->text)) {\n $entireName = '';\n foreach ($decodedHeader as $namePart) {\n $entireName .= trim($this->_convertCharset($namePart->charset, $this->charset, $namePart->text)).' ';\n }\n $decomposedName = trim($entireName);\n }\n }\n\n $return['name'] = $decomposedName;\n }\n\n return $return;\n }",
"function wp_staticize_emoji_for_email($mail)\n {\n }",
"function send_mime_mail(\r\n\t$name_from, // имя отправителя\r\n\t$email_from, // email отправителя\r\n\t$name_to, // имя получателя\r\n\t$email_to, // email получателя\r\n\t$data_charset, // кодировка переданных данных\r\n\t$send_charset, // кодировка письма\r\n\t$subject, // тема письма\r\n\t$body // текст письма\r\n\t) {\r\n\t\r\n\t$email_to = explode(',', trim(trim($email_to),','));\r\n\r\n\tforeach($email_to as $email)\r\n\t{\r\n\t\t$emails[] = mime_header_encode($name_to, $data_charset, $send_charset) . ' <' . trim($email) . '>';\r\n\t}\r\n\t$to = implode(',', $emails);\r\n\t\r\n\t$subject = mime_header_encode($subject, $data_charset, $send_charset);\r\n\t$from = mime_header_encode($name_from, $data_charset, $send_charset) .' <' . $email_from . '>';\r\n\t\r\n\tif($data_charset != $send_charset) {\r\n\t\t$body = iconv($data_charset, $send_charset, $body);\r\n\t}\r\n\t\r\n\t$headers = \"From: $from\\r\\n\";\r\n\t$headers .= \"Content-type: text/html; charset=$send_charset\\r\\n\";\r\n\t$headers .= \"Mime-Version: 1.0\\r\\n\";\r\n\t\r\n\treturn mail($to, $subject, $body, $headers);\r\n}",
"private function decode_mail_envelope_address($address) {\n\n $decoded_address = '';\n\n if (strlen($address) > 0) {\n\n // '$address' could be '[email protected]' or 'Max Power <[email protected]>' or FALSE if not found\n\n $pos = strpos($address, '<');\n\n if ($pos !== false) {\n\n // alias found - split alias, user and domain\n\n $alias = substr($address, 0, ($pos - 1));\n $address = substr($address, ($pos + 1), (strlen($address) - 2));\n\n list($user, $domain) = explode('@', $address);\n\n $decoded_address = '((\"' . $alias . '\" NIL \"' . $user . '\" \"' . $domain . '\"))';\n } else {\n\n // alias not found - split user and domain\n\n list($user, $domain) = explode('@', $address);\n\n $decoded_address = '((NIL NIL \"' . $user . '\" \"' . $domain . '\"))';\n }\n } else {\n // nothing found\n $decoded_address = 'NIL';\n }\n\n return $decoded_address;\n }"
]
| [
"0.67797655",
"0.65473366",
"0.6417348",
"0.6417291",
"0.6387145",
"0.63708484",
"0.6348614",
"0.6275838",
"0.6273872",
"0.62461543",
"0.62379825",
"0.6217796",
"0.61888146",
"0.6142511",
"0.6016232",
"0.6015304",
"0.6011391",
"0.6001446",
"0.5944534",
"0.59176284",
"0.5903801",
"0.58845323",
"0.5848878",
"0.58164114",
"0.5812851",
"0.5783209",
"0.57498074",
"0.5734993",
"0.5725662",
"0.5715376"
]
| 0.76205844 | 0 |
$Id: restorelib.php,v 1.1 2008/04/30 10:20:06 skodak Exp $ This php script contains all the stuff to backup/restore exercise mods This is the "graphical" structure of the exercise mod: exercise (CL,pk>id) | | | ||| | | | | | exercise_submissions | (UL,pk>id,fk>exerciseid,files) | | | | | | | || || | | | | | | | exercise_elements exercise_grades exercise_assessments (CL,pk>id,fk>exerciseid) (UL,pk>id,fk>assessmentid) (UL,pk>id,fk>submissionid) | ( fk>elementno ) | | exercise_rubrics (CL,pk>id,fk>elementno) Meaning: pk>primary key field of the table fk>foreign key to link with parent nt>nested field (recursive data) CL>course level info UL>user level info files>table may have files) This function executes all the restore procedure about this mod | function exercise_restore_mods($mod,$restore) {
global $CFG;
$status = true;
//Get record from backup_ids
$data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);
if ($data) {
//Now get completed xmlized object
$info = $data->info;
// if necessary, write to restorelog and adjust date/time fields
if ($restore->course_startdateoffset) {
restore_log_date_changes('Exercise', $restore, $info['MOD']['#'], array('DEADLINE'));
}
//traverse_xmlize($info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the exercise record structure
$exercise->course = $restore->course_id;
$exercise->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$exercise->nelements = backup_todb($info['MOD']['#']['NELEMENTS']['0']['#']);
$exercise->phase = backup_todb($info['MOD']['#']['PHASE']['0']['#']);
$exercise->gradingstrategy = backup_todb($info['MOD']['#']['GRADINGSTRATEGY']['0']['#']);
$exercise->usemaximum = backup_todb($info['MOD']['#']['USEMAXIMUM']['0']['#']);
$exercise->assessmentcomps = backup_todb($info['MOD']['#']['ASSESSMENTCOMPS']['0']['#']);
$exercise->anonymous = backup_todb($info['MOD']['#']['ANONYMOUS']['0']['#']);
$exercise->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
$exercise->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);
$date = usergetdate($exercise->deadline);
fwrite ($restorelog_file,"<br/>The Exercise - ".$exercise->name." <br/>");
fwrite ($restorelog_file,"The DEADLINE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
$exercise->deadline += $restore->course_startdateoffset;
$date = usergetdate($exercise->deadline);
fwrite ($restorelog_file," the DEADLINE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br/>");
$exercise->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
$exercise->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
$exercise->gradinggrade = backup_todb($info['MOD']['#']['GRADINGGRADE']['0']['#']);
$exercise->showleaguetable = backup_todb($info['MOD']['#']['SHOWLEAGUETABLE']['0']['#']);
$exercise->usepassword = backup_todb($info['MOD']['#']['USEPASSWORD']['0']['#']);
$exercise->password = backup_todb($info['MOD']['#']['PASSWORD']['0']['#']);
//The structure is equal to the db, so insert the exercise
$newid = insert_record ("exercise",$exercise);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>".get_string("modulename","exercise")." \"".format_string(stripslashes($exercise->name),true)."\"</li>";
}
backup_flush(300);
if ($newid) {
//We have the newid, update backup_ids
backup_putid($restore->backup_unique_code,$mod->modtype,
$mod->id, $newid);
//We have to restore the exercise_elements table now (course level table)
$status = exercise_elements_restore($newid,$info,$restore);
//restore the teacher submissions and optionally the student submissions
$status = exercise_submissions_restore($mod->id, $newid,$info,$restore);
} else {
$status = false;
}
} else {
$status = false;
}
return $status;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function exercise_submissions_restore($old_exercise_id, $new_exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the submissions array (teacher submissions)\n $submissions = $info['MOD']['#']['SUBMISSIONS']['0']['#']['SUBMISSION'];\n //Iterate over submissions\n for($i = 0; $i < sizeof($submissions); $i++) {\n $sub_info = $submissions[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($sub_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($sub_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_SUBMISSIONS record structure\n $submission->exerciseid = $new_exercise_id;\n $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);\n $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']);\n $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);\n $submission->resubmit = backup_todb($sub_info['#']['RESUBMIT']['0']['#']);\n $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);\n $submission->isexercise = backup_todb($sub_info['#']['ISEXERCISE']['0']['#']);\n $submission->late = backup_todb($sub_info['#']['LATE']['0']['#']);\n\n // always save the exercise descriptions and optionally the student submissions\n if ($submission->isexercise or restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $submission->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_submission\n $newid = insert_record (\"exercise_submissions\",$submission);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_submissions\",$oldid,\n $newid);\n\n //Now copy moddata associated files\n $status = exercise_restore_files($oldid, $newid,$restore); \n //Now we need to restore exercise_assessments (user level table)\n if ($status and restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n $status = exercise_assessments_restore($new_exercise_id, $newid,$sub_info,$restore);\n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"function exercise_elements_restore($exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the exercise_elements array\n $elements = $info['MOD']['#']['ELEMENTS']['0']['#']['ELEMENT'];\n\n //Iterate over exercise_elements\n for($i = 0; $i < sizeof($elements); $i++) {\n $ele_info = $elements[$i];\n //traverse_xmlize($ele_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the exercise_ELEMENTS record structure\n $element->exerciseid = $exercise_id;\n $element->elementno = backup_todb($ele_info['#']['ELEMENTNO']['0']['#']);\n $element->description = backup_todb($ele_info['#']['DESCRIPTION']['0']['#']);\n $element->scale = backup_todb($ele_info['#']['SCALE']['0']['#']);\n $element->maxscore = backup_todb($ele_info['#']['MAXSCORE']['0']['#']);\n $element->weight = backup_todb($ele_info['#']['WEIGHT']['0']['#']);\n\n //The structure is equal to the db, so insert the exercise_elements\n $newid = insert_record (\"exercise_elements\",$element);\n\n //Do some output\n if (($i+1) % 10 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 200 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have to restore the exercise_rubrics table now (course level table)\n $status = exercise_rubrics_restore($exercise_id,$element->elementno,$ele_info,$restore);\n } else {\n $status = false;\n }\n }\n\n return $status;\n }",
"function exercise_grades_restore_mods($new_exercise_id, $new_assessment_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the grades array (optional)\n if (isset($info['#']['GRADES']['0']['#']['GRADE'])) {\n $grades = $info['#']['GRADES']['0']['#']['GRADE'];\n\n //Iterate over grades\n for($i = 0; $i < sizeof($grades); $i++) {\n $gra_info = $grades[$i];\n //traverse_xmlize($gra_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the exercise_GRADES record structure\n $grade->exerciseid = $new_exercise_id;\n $grade->assessmentid = $new_assessment_id;\n $grade->elementno = backup_todb($gra_info['#']['ELEMENTNO']['0']['#']);\n $grade->feedback = backup_todb($gra_info['#']['FEEDBACK']['0']['#']);\n $grade->grade = backup_todb($gra_info['#']['GRADE_VALUE']['0']['#']);\n\n //The structure is equal to the db, so insert the exercise_grade\n $newid = insert_record (\"exercise_grades\",$grade);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"function exercise_rubrics_restore($exercise_id,$elementno,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the exercise_rubrics array (optional)\n if (isset($info['#']['RUBRICS']['0']['#']['RUBRIC'])) {\n $rubrics = $info['#']['RUBRICS']['0']['#']['RUBRIC'];\n\n //Iterate over exercise_rubrics\n for($i = 0; $i < sizeof($rubrics); $i++) {\n $rub_info = $rubrics[$i];\n //traverse_xmlize($rub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the exercise_RUBRICS record structure\n $rubric->exerciseid = $exercise_id;\n $rubric->elementno = $elementno;\n $rubric->rubricno = backup_todb($rub_info['#']['RUBRICNO']['0']['#']);\n $rubric->description = backup_todb($rub_info['#']['DESCRIPTION']['0']['#']);\n\n //The structure is equal to the db, so insert the exercise_rubrics\n $newid = insert_record (\"exercise_rubrics\",$rubric);\n\n //Do some output\n if (($i+1) % 10 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 200 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n }\n return $status;\n }",
"function exercise_assessments_restore($new_exercise_id, $new_submission_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the assessments array (optional)\n if (isset($info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'])) {\n $assessments = $info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'];\n\n //Iterate over assessments\n for($i = 0; $i < sizeof($assessments); $i++) {\n $ass_info = $assessments[$i];\n //traverse_xmlize($ass_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($ass_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($ass_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_ASSESSMENTS record structure\n $assessment->exerciseid = $new_exercise_id;\n $assessment->submissionid = $new_submission_id;\n $assessment->userid = backup_todb($ass_info['#']['USERID']['0']['#']);\n $assessment->timecreated = backup_todb($ass_info['#']['TIMECREATED']['0']['#']);\n $assessment->timegraded = backup_todb($ass_info['#']['TIMEGRADED']['0']['#']);\n $assessment->grade = backup_todb($ass_info['#']['GRADE']['0']['#']);\n $assessment->gradinggrade = backup_todb($ass_info['#']['GRADINGGRADE']['0']['#']);\n $assessment->mailed = backup_todb($ass_info['#']['MAILED']['0']['#']);\n $assessment->generalcomment = backup_todb($ass_info['#']['GENERALCOMMENT']['0']['#']);\n $assessment->teachercomment = backup_todb($ass_info['#']['TEACHERCOMMENT']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $assessment->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_assessment\n $newid = insert_record (\"exercise_assessments\",$assessment);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_assessments\",$oldid,\n $newid);\n\n //Now we need to restore exercise_grades (user level table) \n if ($status) {\n $status = exercise_grades_restore_mods ($new_exercise_id, $newid,$ass_info,$restore); \n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"function exercise_restore_files ($oldsubmiss, $newsubmiss, $restore) {\n\n global $CFG;\n\n $status = true;\n $todo = false;\n $moddata_path = \"\";\n $exercise_path = \"\";\n $temp_path = \"\";\n\n //First, we check to \"course_id\" exists and create is as necessary\n //in CFG->dataroot\n $dest_dir = $CFG->dataroot.\"/\".$restore->course_id;\n $status = check_dir_exists($dest_dir,true);\n\n //Now, locate course's moddata directory\n $moddata_path = $CFG->dataroot.\"/\".$restore->course_id.\"/\".$CFG->moddata;\n \n //Check it exists and create it\n $status = check_dir_exists($moddata_path,true);\n\n //Now, locate exercise directory\n if ($status) {\n $exercise_path = $moddata_path.\"/exercise\";\n //Check it exists and create it\n $status = check_dir_exists($exercise_path,true);\n }\n\n //Now locate the temp dir we are gong to restore\n if ($status) {\n $temp_path = $CFG->dataroot.\"/temp/backup/\".$restore->backup_unique_code.\n \"/moddata/exercise/\".$oldsubmiss;\n //Check it exists\n if (is_dir($temp_path)) {\n $todo = true;\n }\n }\n\n //If todo, we create the neccesary dirs in course moddata/exercise\n if ($status and $todo) {\n //First this exercise id\n $this_exercise_path = $exercise_path.\"/\".$newsubmiss;\n $status = check_dir_exists($this_exercise_path,true);\n //And now, copy temp_path to this_exercise_path\n $status = backup_copy_file($temp_path, $this_exercise_path); \n }\n \n return $status;\n }",
"function lesson_restore_mods($mod,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get record from backup_ids\n $data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);\n\n if ($data) {\n //Now get completed xmlized object\n $info = $data->info;\n //if necessary, write to restorelog and adjust date/time fields\n if ($restore->course_startdateoffset) {\n restore_log_date_changes('Lesson', $restore, $info['MOD']['#'], array('AVAILABLE', 'DEADLINE'));\n }\n //traverse_xmlize($info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the lesson record structure\n $lesson->course = $restore->course_id;\n $lesson->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);\n $lesson->practice = backup_todb($info['MOD']['#']['PRACTICE']['0']['#']);\n $lesson->modattempts = backup_todb($info['MOD']['#']['MODATTEMPTS']['0']['#']);\n $lesson->usepassword = backup_todb($info['MOD']['#']['USEPASSWORD']['0']['#']);\n $lesson->password = backup_todb($info['MOD']['#']['PASSWORD']['0']['#']); \n $lesson->dependency = isset($info['MOD']['#']['DEPENDENCY']['0']['#'])?backup_todb($info['MOD']['#']['DEPENDENCY']['0']['#']):'';\n $lesson->conditions = isset($info['MOD']['#']['CONDITIONS']['0']['#'])?backup_todb($info['MOD']['#']['CONDITIONS']['0']['#']):'';\n $lesson->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);\n $lesson->custom = backup_todb($info['MOD']['#']['CUSTOM']['0']['#']);\n $lesson->ongoing = backup_todb($info['MOD']['#']['ONGOING']['0']['#']);\n $lesson->usemaxgrade = backup_todb($info['MOD']['#']['USEMAXGRADE']['0']['#']);\n $lesson->maxanswers = backup_todb($info['MOD']['#']['MAXANSWERS']['0']['#']);\n $lesson->maxattempts = backup_todb($info['MOD']['#']['MAXATTEMPTS']['0']['#']);\n $lesson->review = backup_todb($info['MOD']['#']['REVIEW']['0']['#']);\n $lesson->nextpagedefault = backup_todb($info['MOD']['#']['NEXTPAGEDEFAULT']['0']['#']);\n $lesson->feedback = isset($info['MOD']['#']['FEEDBACK']['0']['#'])?backup_todb($info['MOD']['#']['FEEDBACK']['0']['#']):'';\n $lesson->minquestions = backup_todb($info['MOD']['#']['MINQUESTIONS']['0']['#']);\n $lesson->maxpages = backup_todb($info['MOD']['#']['MAXPAGES']['0']['#']);\n $lesson->timed = backup_todb($info['MOD']['#']['TIMED']['0']['#']);\n $lesson->maxtime = backup_todb($info['MOD']['#']['MAXTIME']['0']['#']);\n $lesson->retake = backup_todb($info['MOD']['#']['RETAKE']['0']['#']);\n $lesson->activitylink = isset($info['MOD']['#']['ACTIVITYLINK']['0']['#'])?backup_todb($info['MOD']['#']['ACTIVITYLINK']['0']['#']):'';\n $lesson->mediafile = isset($info['MOD']['#']['MEDIAFILE']['0']['#'])?backup_todb($info['MOD']['#']['MEDIAFILE']['0']['#']):'';\n $lesson->mediaheight = isset($info['MOD']['#']['MEDIAHEIGHT']['0']['#'])?backup_todb($info['MOD']['#']['MEDIAHEIGHT']['0']['#']):'';\n $lesson->mediawidth = isset($info['MOD']['#']['MEDIAWIDTH']['0']['#'])?backup_todb($info['MOD']['#']['MEDIAWIDTH']['0']['#']):'';\n $lesson->mediaclose = isset($info['MOD']['#']['MEDIACLOSE']['0']['#'])?backup_todb($info['MOD']['#']['MEDIACLOSE']['0']['#']):'';\n $lesson->slideshow = backup_todb($info['MOD']['#']['SLIDESHOW']['0']['#']);\n $lesson->width = backup_todb($info['MOD']['#']['WIDTH']['0']['#']);\n $lesson->height = backup_todb($info['MOD']['#']['HEIGHT']['0']['#']);\n $lesson->bgcolor = backup_todb($info['MOD']['#']['BGCOLOR']['0']['#']);\n $lesson->displayleft = isset($info['MOD']['#']['DISPLAYLEFT']['0']['#'])?backup_todb($info['MOD']['#']['DISPLAYLEFT']['0']['#']):'';\n $lesson->displayleftif = isset($info['MOD']['#']['DISPLAYLEFTIF']['0']['#'])?backup_todb($info['MOD']['#']['DISPLAYLEFTIF']['0']['#']):'';\n $lesson->progressbar = isset($info['MOD']['#']['PROGRESSBAR']['0']['#'])?backup_todb($info['MOD']['#']['PROGRESSBAR']['0']['#']):'';\n $lesson->highscores = backup_todb($info['MOD']['#']['SHOWHIGHSCORES']['0']['#']);\n $lesson->maxhighscores = backup_todb($info['MOD']['#']['MAXHIGHSCORES']['0']['#']);\n $lesson->available = backup_todb($info['MOD']['#']['AVAILABLE']['0']['#']);\n $lesson->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);\n $lesson->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);\n\n //The structure is equal to the db, so insert the lesson\n $newid = insert_record(\"lesson\", $lesson);\n\n //Do some output\n if (!defined('RESTORE_SILENTLY')) {\n echo \"<li>\".get_string(\"modulename\",\"lesson\").\" \\\"\".format_string(stripslashes($lesson->name),true).\"\\\"</li>\";\n }\n backup_flush(300);\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,$mod->modtype,\n $mod->id, $newid);\n //We have to restore the lesson pages which are held in their logical order...\n $userdata = restore_userdata_selected($restore,\"lesson\",$mod->id);\n $status = lesson_pages_restore_mods($newid,$info,$restore,$userdata);\n //...and the user grades, high scores, and timer (if required)\n if ($status) {\n if ($userdata) {\n if(!lesson_grades_restore_mods($newid,$info,$restore)) {\n return false;\n }\n if (!lesson_high_scores_restore_mods($newid,$info,$restore)) {\n return false;\n }\n if (!lesson_timer_restore_mods($newid,$info,$restore)) {\n return false;\n }\n }\n // restore the default for the course. Only do this once by checking for an id for lesson_default\n $lessondefault = backup_getid($restore->backup_unique_code,'lesson_default',$restore->course_id);\n if (!$lessondefault) {\n $status = lesson_default_restore_mods($info,$restore);\n }\n \n }\n } else {\n $status = false;\n }\n } else {\n $status = false;\n }\n return $status;\n }",
"function lesson_attempts_restore($lessonid, $pageid, $answerid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the attempts array (optional)\n if (isset($info['#']['ATTEMPTS']['0']['#']['ATTEMPT'])) {\n $attempts = $info['#']['ATTEMPTS']['0']['#']['ATTEMPT'];\n //Iterate over attempts\n for($i = 0; $i < sizeof($attempts); $i++) {\n $attempt_info = $attempts[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($attempt_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_attempts record structure\n $attempt->lessonid = $lessonid;\n $attempt->pageid = $pageid;\n $attempt->answerid = $answerid;\n $attempt->userid = backup_todb($attempt_info['#']['USERID']['0']['#']);\n $attempt->retry = backup_todb($attempt_info['#']['RETRY']['0']['#']);\n $attempt->correct = backup_todb($attempt_info['#']['CORRECT']['0']['#']);\n $attempt->useranswer = backup_todb($attempt_info['#']['USERANSWER']['0']['#']);\n $attempt->timeseen = backup_todb($attempt_info['#']['TIMESEEN']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $attempt->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the lesson_attempt\n $newid = insert_record (\"lesson_attempts\",$attempt);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n }\n }\n\n return $status;\n }",
"function restore_database()\n\t{\n\t\t# Get the file name and replace all back slashes with forward slashes\n\t\t# TODO: It does not work for mapped drives or files accessed via a network research/investigate why or find a work around\n\t\t$cleaned_filename = str_replace(\"\\\\\\\\\", \"\\\\\", $_POST['physical_filename']);\n\t\t\t\n\t\t# Read the file contents into a string\n\t\t$contents = file_get_contents($cleaned_filename);\n\t\t# Check if the file is empty\n\t\tif ($contents != \"\") \n\t\t{\t\n\t\t\t# Reset the error code, 0 means successful and 1 means failed\n\t\t\t$return_code = 0; \n\t\t\t$result = array(); \n\t\t\t# Build the command to be passed to the mysql client\n\t\t\t$command = \"mysql -h \".DB_HOST.\" -u \".DB_USERNAME; \n\t\t\t# Check if the password is blank, therefore do not add the password option\n\t\t\tif (trim(DB_PASSWORD) != \"\") {\n\t\t\t\t$command .= \" -p \".DB_PASSWORD;\n\t\t\t} \n\t\t\t$command .= \" -D \".DB_NAME.\" < \\\"\".$cleaned_filename.\"\\\"\";\n\t\t\t$error = exec($command, $result, $return_code);\n\t\t\t\n\t\t\t$message = \"\";\n\t\t\t# Do some error handling\n\t\t\tif ( $return_code != 0 ) \n\t\t\t{ \n\t\t\t\t$data['msg'] = \"ERROR: Errors occured while restoring the backup script \".$error;\n\t\t\t} \n\t\t\telse \n\t\t\t{ \n\t\t\t\t$data['msg'] = \"The backup script has been applied successfully.\";\n\t\t\t} \n\t\t} else {\n\t\t\t$data['msg'] = \"ERROR: The backup script you selected is empty, please check it and try again\";\n\t\t}\n\t\t\n\t\t$data['action'] = 'restore';\n\t\t$data['userdetails'] = $this->session->userdata('alluserdata');\n\t\t$this->load->view('settings/backupform_view', $data);\n\t}",
"function tab_restore_mods($mod,$restore) {\r\n\r\n global $CFG;\r\n\r\n $status = true;\r\n\r\n //Get record from backup_ids\r\n $data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);\r\n\r\n if ($data) {\r\n //Now get completed xmlized object\r\n $info = $data->info;\r\n //traverse_xmlize($info); //Debug\r\n //print_object ($GLOBALS['traverse_array']); //Debug\r\n //$GLOBALS['traverse_array']=\"\"; //Debug\r\n \r\n //Now, build the tab record structure\r\n $tab->course = $restore->course_id;\r\n $tab->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);\r\n $tab->tab1 = backup_todb($info['MOD']['#']['TAB1']['0']['#']);\r\n\t\t\t$tab->tab2 = backup_todb($info['MOD']['#']['TAB2']['0']['#']);\r\n\t\t\t$tab->tab3 = backup_todb($info['MOD']['#']['TAB3']['0']['#']);\r\n\t\t\t$tab->tab4 = backup_todb($info['MOD']['#']['TAB4']['0']['#']);\r\n\t\t\t$tab->tab5 = backup_todb($info['MOD']['#']['TAB5']['0']['#']);\r\n\t\t\t$tab->tab6 = backup_todb($info['MOD']['#']['TAB6']['0']['#']);\r\n\t\t\t$tab->tab7 = backup_todb($info['MOD']['#']['TAB7']['0']['#']);\r\n\t\t\t$tab->tab8 = backup_todb($info['MOD']['#']['TAB8']['0']['#']);\r\n\t\t\t$tab->tab9 = backup_todb($info['MOD']['#']['TAB9']['0']['#']);\r\n\t\t\t$tab->tab0 = backup_todb($info['MOD']['#']['TAB0']['0']['#']);\r\n\t\t\t$tab->tab1content = backup_todb($info['MOD']['#']['TAB1CONTENT']['0']['#']);\r\n\t\t\t$tab->tab2content = backup_todb($info['MOD']['#']['TAB2CONTENT']['0']['#']);\r\n\t\t\t$tab->tab3content = backup_todb($info['MOD']['#']['TAB3CONTENT']['0']['#']);\r\n\t\t\t$tab->tab4content = backup_todb($info['MOD']['#']['TAB4CONTENT']['0']['#']);\r\n\t\t\t$tab->tab5content = backup_todb($info['MOD']['#']['TAB5CONTENT']['0']['#']);\r\n\t\t\t$tab->tab6content = backup_todb($info['MOD']['#']['TAB6CONTENT']['0']['#']);\r\n\t\t\t$tab->tab7content = backup_todb($info['MOD']['#']['TAB7CONTENT']['0']['#']);\r\n\t\t\t$tab->tab8content = backup_todb($info['MOD']['#']['TAB8CONTENT']['0']['#']);\r\n\t\t\t$tab->tab9content = backup_todb($info['MOD']['#']['TAB9CONTENT']['0']['#']);\r\n\t\t\t$tab->tab0content = backup_todb($info['MOD']['#']['TAB0CONTENT']['0']['#']);\r\n\t\t\t$tab->css = backup_todb($info['MOD']['#']['CSS']['0']['#']);\r\n\t\t\t$tab->menucss = backup_todb($info['MOD']['#']['MENUCSS']['0']['#']);\r\n\t\t\t$tab->displaymenu = backup_todb($info['MOD']['#']['DISPLAYMENU']['0']['#']);\r\n\t\t\t$tab->menuname = backup_todb($info['MOD']['#']['MENUNAME']['0']['#']);\r\n $tab->timemodified = $info['MOD']['#']['TIMEMODIFIED']['0']['#'];\r\n \r\n //The structure is equal to the db, so insert the tab\r\n $newid = insert_record (\"tab\",$tab);\r\n\r\n //Do some output \r\n if (!defined('RESTORE_SILENTLY')) {\r\n echo \"<li>\".get_string(\"modulename\",\"tab\").\" \\\"\".format_string(stripslashes($tab->name),true).\"\\\"</li>\";\r\n }\r\n backup_flush(300);\r\n\r\n if ($newid) {\r\n //We have the newid, update backup_ids\r\n backup_putid($restore->backup_unique_code,$mod->modtype,\r\n $mod->id, $newid);\r\n \r\n } else {\r\n $status = false;\r\n }\r\n } else {\r\n $status = false;\r\n }\r\n\r\n return $status;\r\n }",
"function lesson_branch_restore($lessonid, $pageid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the branch array (optional)\n if (isset($info['#']['BRANCHES']['0']['#']['BRANCH'])) {\n $branches = $info['#']['BRANCHES']['0']['#']['BRANCH'];\n //Iterate over branches\n for($i = 0; $i < sizeof($branches); $i++) {\n $branch_info = $branches[$i];\n //traverse_xmlize($branch_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($branch_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_attempts record structure\n $branch->lessonid = $lessonid;\n $branch->userid = backup_todb($branch_info['#']['USERID']['0']['#']);\n $branch->pageid = $pageid;\n $branch->retry = backup_todb($branch_info['#']['RETRY']['0']['#']);\n $branch->flag = backup_todb($branch_info['#']['FLAG']['0']['#']);\n $branch->timeseen = backup_todb($branch_info['#']['TIMESEEN']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $branch->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the lesson_attempt\n $newid = insert_record (\"lesson_branch\",$branch);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n }\n }\n\n return $status;\n }",
"function lesson_grades_restore_mods($lessonid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the grades array (optional)\n if (isset($info['MOD']['#']['GRADES']['0']['#']['GRADE'])) {\n $grades = $info['MOD']['#']['GRADES']['0']['#']['GRADE'];\n\n //Iterate over grades\n for($i = 0; $i < sizeof($grades); $i++) {\n $grade_info = $grades[$i];\n //traverse_xmlize($grade_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($grade_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_GRADES record structure\n $grade->lessonid = $lessonid;\n $grade->userid = backup_todb($grade_info['#']['USERID']['0']['#']);\n $grade->grade = backup_todb($grade_info['#']['GRADE_VALUE']['0']['#']);\n $grade->late = backup_todb($grade_info['#']['LATE']['0']['#']);\n $grade->completed = backup_todb($grade_info['#']['COMPLETED']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $grade->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the lesson_grade\n $newid = insert_record (\"lesson_grades\",$grade);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"function lesson_pages_restore_mods($lessonid,$info,$restore,$userdata=false) {\n\n global $CFG;\n\n $status = true;\n\n //Get the lesson_elements array\n $pages = $info['MOD']['#']['PAGES']['0']['#']['PAGE'];\n\n //Iterate over lesson pages (they are held in their logical order)\n $prevpageid = 0;\n for($i = 0; $i < sizeof($pages); $i++) {\n $page_info = $pages[$i];\n //traverse_xmlize($ele_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($page_info['#']['PAGEID']['0']['#']);\n\n //Now, build the lesson_pages record structure\n $page->lessonid = $lessonid;\n $page->prevpageid = $prevpageid;\n $page->qtype = backup_todb($page_info['#']['QTYPE']['0']['#']);\n $page->qoption = backup_todb($page_info['#']['QOPTION']['0']['#']);\n $page->layout = backup_todb($page_info['#']['LAYOUT']['0']['#']);\n $page->display = backup_todb($page_info['#']['DISPLAY']['0']['#']);\n $page->timecreated = backup_todb($page_info['#']['TIMECREATED']['0']['#']);\n $page->timemodified = backup_todb($page_info['#']['TIMEMODIFIED']['0']['#']);\n $page->title = backup_todb($page_info['#']['TITLE']['0']['#']);\n $page->contents = backup_todb($page_info['#']['CONTENTS']['0']['#']);\n\n //The structure is equal to the db, so insert the lesson_pages\n $newid = insert_record (\"lesson_pages\",$page);\n\n //Fix the forwards link of the previous page\n if ($prevpageid) {\n if (!set_field(\"lesson_pages\", \"nextpageid\", $newid, \"id\", $prevpageid)) {\n error(\"Lesson restorelib: unable to update link\");\n }\n }\n $prevpageid = $newid;\n\n //Do some output\n if (($i+1) % 10 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 200 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids (restore logs will use it!!)\n backup_putid($restore->backup_unique_code,\"lesson_pages\", $oldid, $newid);\n //We have to restore the lesson_answers table now (a page level table)\n $status = lesson_answers_restore($lessonid,$newid,$page_info,$restore,$userdata);\n \n //Need to update useranswer field (which has answer id's in it)\n //for matching and multi-answer multi-choice questions\n if ($userdata) { // first check to see if we even have to do this\n // if multi-answer multi-choice question or matching\n if (($page->qtype == 3 && $page->qoption) ||\n $page->qtype == 5) {\n // get all the attempt records for this page\n if ($attempts = get_records(\"lesson_attempts\", \"pageid\", $newid)) {\n foreach ($attempts as $attempt) {\n unset($newuseranswer);\n if ($attempt->useranswer != NULL) {\n // explode the user answer. Each element in\n // $useranswer is an old answer id, so needs to be updated\n $useranswer = explode(\",\", $attempt->useranswer);\n foreach ($useranswer as $oldanswerid) {\n $backupdata = backup_getid($restore->backup_unique_code,\"lesson_answers\",$oldanswerid);\n $newuseranswer[] = $backupdata->new_id;\n }\n // get the useranswer in the right format\n $attempt->useranswer = implode(\",\", $newuseranswer);\n // update it\n update_record(\"lesson_attempts\", $attempt);\n }\n }\n }\n }\n } \n \n // backup branch table info for branch tables.\n if ($status && $userdata) {\n if (!lesson_branch_restore($lessonid,$newid,$page_info,$restore)) {\n return false;\n }\n }\n } else {\n $status = false;\n }\n }\n\n //We've restored all the pages and answers, we now need to fix the jumps in the\n //answer records if they are absolute\n if ($answers = get_records(\"lesson_answers\", \"lessonid\", $lessonid)) {\n foreach ($answers as $answer) {\n if ($answer->jumpto > 0) {\n // change the absolute page id\n $page = backup_getid($restore->backup_unique_code,\"lesson_pages\",$answer->jumpto);\n if ($page) {\n if (!set_field(\"lesson_answers\", \"jumpto\", $page->new_id, \"id\", $answer->id)) {\n error(\"Lesson restorelib: unable to reset jump\");\n }\n }\n }\n }\n }\n return $status;\n }",
"function restore($DBhost,$DBuser,$DBpass,$DBName,$filename)\r\n{\t\r\n\t$sqlErrorText = '';\r\n\t$sqlErrorCode = 0;\r\n\t$sqlStmt = '';\r\n\t\r\n\t// Restore the backup\r\n\t$con = mysql_connect($DBhost,$DBuser,$DBpass);\r\n\tif ($con !== false){\r\n\t // Load and explode the sql file\r\n\t mysql_select_db(\"$DBName\");\r\n\t $f = fopen($filename,\"r+\");\r\n\t $sqlFile = fread($f,filesize($filename));\r\n\t $sqlArray = explode(';<|||||||>',$sqlFile);\r\n\t\t\t \r\n\t // Process the sql file by statements\r\n\t foreach ($sqlArray as $stmt) {\r\n\t\tif (strlen($stmt)>3){\r\n\t\t\t $result = mysql_query($stmt);\r\n\t\t}\r\n\t }\r\n\t}\r\n\t\r\n\t// Print message (error or success)\r\n\tif ($sqlErrorCode == 0){\r\n\t print(\"Database restored successfully!<br>\\n\");\r\n\t print(\"Backup used: \" . $filename . \"<br>\\n\");\r\n\t} else {\r\n\t print(\"An error occurred while restoring backup!<br><br>\\n\");\r\n\t print(\"Error code: $sqlErrorCode<br>\\n\");\r\n\t print(\"Error text: $sqlErrorText<br>\\n\");\r\n\t print(\"Statement:<br/> $sqlStmt<br>\");\r\n\t}\r\n\t\r\n\t// Close the connection\r\n\tmysql_close();\r\n}",
"function restore($old_question_id,$new_question_id,$info,$restore) {\n global $DB;\n\n $status = true;\n\n //Get the calculated-s array\n $calculateds = $info['#']['CALCULATED'];\n\n //Iterate over calculateds\n for($i = 0; $i < sizeof($calculateds); $i++) {\n $cal_info = $calculateds[$i];\n //traverse_xmlize($cal_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the question_calculated record structure\n $calculated->question = $new_question_id;\n $calculated->answer = backup_todb($cal_info['#']['ANSWER']['0']['#']);\n $calculated->tolerance = backup_todb($cal_info['#']['TOLERANCE']['0']['#']);\n $calculated->tolerancetype = backup_todb($cal_info['#']['TOLERANCETYPE']['0']['#']);\n $calculated->correctanswerlength = backup_todb($cal_info['#']['CORRECTANSWERLENGTH']['0']['#']);\n $calculated->correctanswerformat = backup_todb($cal_info['#']['CORRECTANSWERFORMAT']['0']['#']);\n\n ////We have to recode the answer field\n $answer = backup_getid($restore->backup_unique_code,\"question_answers\",$calculated->answer);\n if ($answer) {\n $calculated->answer = $answer->new_id;\n }\n\n //The structure is equal to the db, so insert the question_calculated\n $newid = $DB->insert_record (\"question_calculated\",$calculated);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n //Now restore numerical_units\n $status = question_restore_numerical_units ($old_question_id,$new_question_id,$cal_info,$restore);\n\n //Now restore dataset_definitions\n if ($status && $newid) {\n $status = question_restore_dataset_definitions ($old_question_id,$new_question_id,$cal_info,$restore);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n\n return $status;\n }",
"function restorePaper($paperid) {\n\t$q = \"SELECT * FROM `\" . OCC_TABLE_WITHDRAWN . \"` WHERE `paperid`='\" . safeSQLstr($paperid) . \"'\";\n\t$r = ocsql_query($q) or err('Unable to retrieve submission information');\n\tif (ocsql_num_rows($r) == 1) {\n\t\t// paper\n\t\t$l = ocsql_fetch_assoc($r);\n\t\tocsql_query($l['papersql']) or err('Unable to restore paper');\n\t\tif (!empty($l['authorsql'])) {\n\t\t\tocsql_query($l['authorsql']) or err('Unable to restore ' . oc_strtolower(OCC_WORD_AUTHOR) . ' information');\n\t\t}\n\t\tif (!empty($l['topicsql'])) {\n\t\t\tocsql_query($l['topicsql']) or err('Unable to restore topic information');\n\t\t}\n\t\tocsql_query(\"DELETE FROM `\" . OCC_TABLE_WITHDRAWN . \"` WHERE `paperid`='\" . safeSQLstr($paperid) . \"'\") or err('Unable to update withdrawn submission status');\n\t\t// restore\t\t\n\t\tif (oc_hookSet('restore_paper')) {\n\t\t\tforeach ($GLOBALS['OC_hooksAR']['restore_paper'] as $inc) {\n\t\t\t\tinclude $inc;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// log\n\t\tocsql_query(\"INSERT INTO `\" . OCC_TABLE_LOG . \"` SET `datetime`='\" . safeSQLstr(gmdate('Y-m-d H:i:s')) . \"', `type`='submission', `entry`='\" . safeSQLstr('Submission ID ' . $paperid . ' restored') . \"'\");\n\n\t} else {\n\t\tprint \" SUBMISSION NOT FOUND<p />\\n\";\n\t}\n}",
"function lesson_answers_restore($lessonid,$pageid,$info,$restore,$userdata=false) {\n\n global $CFG;\n\n $status = true;\n\n //Get the lesson_answers array (optional)\n if (isset($info['#']['ANSWERS']['0']['#']['ANSWER'])) {\n // The following chunk of code is a fix for matching questions made\n // pre moodle 1.5. Matching questions need two answer fields designated\n // for correct and wrong responses before the rest of the answer fields.\n if ($restore->backup_version <= 2004083124) { // Backup version for 1.4.5+\n if ($ismatching = get_record('lesson_pages', 'id', $pageid)) { // get the page we just inserted\n if ($ismatching->qtype == 5) { // check to make sure it is a matching question\n $time = time(); // this may need to be changed\n // make our 2 response answers\n $newanswer->lessonid = $lessonid;\n $newanswer->pageid = $pageid;\n $newanswer->timecreated = $time;\n $newanswer->timemodified = 0;\n insert_record('lesson_answers', $newanswer);\n insert_record('lesson_answers', $newanswer);\n }\n }\n }\n\n $answers = $info['#']['ANSWERS']['0']['#']['ANSWER'];\n\n //Iterate over lesson_answers\n for($i = 0; $i < sizeof($answers); $i++) {\n $answer_info = $answers[$i];\n //traverse_xmlize($rub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($answer_info['#']['ID']['0']['#']);\n\n //Now, build the lesson_answers record structure\n $answer->lessonid = $lessonid;\n $answer->pageid = $pageid;\n // the absolute jumps will need fixing later\n $answer->jumpto = backup_todb($answer_info['#']['JUMPTO']['0']['#']);\n $answer->grade = backup_todb($answer_info['#']['GRADE']['0']['#']);\n $answer->score = backup_todb($answer_info['#']['SCORE']['0']['#']);\n $answer->flags = backup_todb($answer_info['#']['FLAGS']['0']['#']);\n $answer->timecreated = backup_todb($answer_info['#']['TIMECREATED']['0']['#']);\n $answer->timemodified = backup_todb($answer_info['#']['TIMEMODIFIED']['0']['#']);\n $answer->answer = backup_todb($answer_info['#']['ANSWERTEXT']['0']['#']);\n $answer->response = backup_todb($answer_info['#']['RESPONSE']['0']['#']);\n\n //The structure is equal to the db, so insert the lesson_answers\n $newid = insert_record (\"lesson_answers\",$answer);\n\n //Do some output\n if (($i+1) % 10 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 200 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n // need to store the id so we can update the useranswer\n // field in attempts. This is done in the lesson_pages_restore_mods\n backup_putid($restore->backup_unique_code,\"lesson_answers\", $oldid, $newid); \n\n if ($userdata) {\n //We have to restore the lesson_attempts table now (a answers level table)\n $status = lesson_attempts_restore($lessonid, $pageid, $newid, $answer_info, $restore);\n }\n } else {\n $status = false;\n }\n }\n }\n return $status;\n }",
"function restore_backup()\n\t{\n\t\tmove_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/backup.sql');\n\t\t$this->load->dbutil();\n\t\t\n\t\t\n\t\t$prefs = array(\n 'filepath'\t\t\t\t\t\t=> 'uploads/backup.sql',\n\t\t\t'delete_after_upload'\t\t\t=> TRUE,\n\t\t\t'delimiter'\t\t\t\t\t\t=> ';'\n );\n\t\t$restore =& $this->dbutil->restore($prefs); \n\t\tunlink($prefs['filepath']);\n\t}",
"function restore_backup()\n\t{\n\t\tmove_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/backup.sql');\n\t\t$this->load->dbutil();\n\t\t\n\t\t\n\t\t$prefs = array(\n 'filepath'\t\t\t\t\t\t=> 'uploads/backup.sql',\n\t\t\t'delete_after_upload'\t\t\t=> TRUE,\n\t\t\t'delimiter'\t\t\t\t\t\t=> ';'\n );\n\t\t$restore =& $this->dbutil->restore($prefs); \n\t\tunlink($prefs['filepath']);\n\t}",
"public function prepare_restore() {\n\n\t\tglobal $updraftplus;\n\n\t\t// on restore start job_id is empty but if we needed file system permissions or this is a resumption then we have already started a job so reuse it\n\t\t$restore_job_id = empty($_REQUEST['job_id']) ? false : $_REQUEST['job_id'];\n\n\t\t// Set up nonces, log files etc.\n\t\t$updraftplus->initiate_restore_job($restore_job_id);\n\t\t\n\t\t// If this is the start of a restore then get the restore data from the posted data and put it into jobdata.\n\t\tif (isset($_REQUEST['action']) && 'updraft_restore' == $_REQUEST['action']) {\n\t\t\t\n\t\t\tif (empty($restore_job_id)) {\n\t\t\t\t$jobdata_to_save = array();\n\t\t\t\tforeach ($_REQUEST as $key => $value) {\n\t\t\t\t\tif (false !== strpos($key, 'updraft_') || 'backup_timestamp' == $key || 'meta_foreign' == $key) {\n\t\t\t\t\t\tif ('updraft_restorer_restore_options' == $key) parse_str(stripslashes($value), $value);\n\t\t\t\t\t\t$jobdata_to_save[$key] = $value;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (isset($jobdata_to_save['updraft_restorer_restore_options']['updraft_restore_table_options']) && !empty($jobdata_to_save['updraft_restorer_restore_options']['updraft_restore_table_options'])) {\n\t\t\t\t\t\n\t\t\t\t\t$restore_table_options = $jobdata_to_save['updraft_restorer_restore_options']['updraft_restore_table_options'];\n\t\t\t\t\t\n\t\t\t\t\t$include_unspecified_tables = false;\n\t\t\t\t\t$tables_to_restore = array();\n\t\t\t\t\t$tables_to_skip = array();\n\n\t\t\t\t\tforeach ($restore_table_options as $table) {\n\t\t\t\t\t\tif ('udp_all_other_tables' == $table) {\n\t\t\t\t\t\t\t$include_unspecified_tables = true;\n\t\t\t\t\t\t} elseif ('udp-skip-table-' == substr($table, 0, 15)) {\n\t\t\t\t\t\t\t$tables_to_skip[] = substr($table, 15);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$tables_to_restore[] = $table;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$jobdata_to_save['updraft_restorer_restore_options']['include_unspecified_tables'] = $include_unspecified_tables;\n\t\t\t\t\t$jobdata_to_save['updraft_restorer_restore_options']['tables_to_restore'] = $tables_to_restore;\n\t\t\t\t\t$jobdata_to_save['updraft_restorer_restore_options']['tables_to_skip'] = $tables_to_skip;\n\t\t\t\t\tunset($jobdata_to_save['updraft_restorer_restore_options']['updraft_restore_table_options']);\n\t\t\t\t}\n\n\t\t\t\t$updraftplus->jobdata_set_multi($jobdata_to_save);\n\n\t\t\t\t// Use a site option, as otherwise on multisite when all the array of options is updated via UpdraftPlus_Options::update_site_option(), it will over-write any restored UD options from the backup\n\t\t\t\tupdate_site_option('updraft_restore_in_progress', $updraftplus->nonce);\n\t\t\t}\n\t\t}\n\n\t\t// If this is the start of an ajax restore then end execution here so it can then be booted over ajax\n\t\tif (isset($_REQUEST['updraftplus_ajax_restore']) && 'start_ajax_restore' == $_REQUEST['updraftplus_ajax_restore']) {\n\t\t\t// return to prevent any more code from running\n\t\t\treturn $this->prepare_ajax_restore();\n\n\t\t} elseif (isset($_REQUEST['updraftplus_ajax_restore']) && 'continue_ajax_restore' == $_REQUEST['updraftplus_ajax_restore']) {\n\t\t\t// If we enter here then in order to restore we needed to require the filesystem credentials we should save these before returning back to the browser and load them back after the AJAX call, this prevents us asking for the filesystem credentials again\n\t\t\t$filesystem_credentials = array(\n\t\t\t\t'hostname' => '',\n\t\t\t\t'username' => '',\n\t\t\t\t'password' => '',\n\t\t\t\t'connection_type' => '',\n\t\t\t\t'upgrade' => '',\n\t\t\t);\n\n\t\t\t$credentials_found = false;\n\n\t\t\tforeach ($_REQUEST as $key => $value) {\n\t\t\t\tif (array_key_exists($key, $filesystem_credentials)) {\n\t\t\t\t\t$filesystem_credentials[$key] = stripslashes($value);\n\t\t\t\t\t$credentials_found = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($credentials_found) $updraftplus->jobdata_set('filesystem_credentials', $filesystem_credentials);\n\n\t\t\t// return to prevent any more code from running\n\t\t\treturn $this->prepare_ajax_restore();\n\t\t}\n\n\t\tif (!empty($_REQUEST['updraftplus_ajax_restore'])) add_filter('updraftplus_logline', array($this, 'updraftplus_logline'), 10, 5);\n\t\t\n\t\t$is_continuation = ('updraft_ajaxrestore_continue' == $_REQUEST['action']) ? true : false;\n\n\t\tif ($is_continuation) {\n\t\t\t$restore_in_progress = get_site_option('updraft_restore_in_progress');\n\t\t\tif ($restore_in_progress != $_REQUEST['job_id']) {\n\t\t\t\t$abort_restore_already = true;\n\t\t\t\t$updraftplus->log(__('Sufficient information about the in-progress restoration operation could not be found.', 'updraftplus') . ' (job_id_mismatch)', 'error', 'job_id_mismatch');\n\t\t\t} else {\n\t\t\t\t$restore_jobdata = $updraftplus->jobdata_getarray($restore_in_progress);\n\t\t\t\tif (is_array($restore_jobdata) && isset($restore_jobdata['job_type']) && 'restore' == $restore_jobdata['job_type'] && isset($restore_jobdata['second_loop_entities']) && !empty($restore_jobdata['second_loop_entities']) && isset($restore_jobdata['job_time_ms']) && isset($restore_jobdata['backup_timestamp'])) {\n\t\t\t\t\t$backup_timestamp = $restore_jobdata['backup_timestamp'];\n\t\t\t\t\t$continuation_data = $restore_jobdata;\n\t\t\t\t\t$continuation_data['updraftplus_ajax_restore'] = 'continue_ajax_restore';\n\t\t\t\t} else {\n\t\t\t\t\t$abort_restore_already = true;\n\t\t\t\t\t$updraftplus->log(__('Sufficient information about the in-progress restoration operation could not be found.', 'updraftplus') . ' (job_id_nojobdata)', 'error', 'job_id_nojobdata');\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif (isset($_REQUEST['updraftplus_ajax_restore']) && 'do_ajax_restore' == $_REQUEST['updraftplus_ajax_restore']) {\n\t\t\t$backup_timestamp = $updraftplus->jobdata_get('backup_timestamp');\n\t\t\t$continuation_data = array('updraftplus_ajax_restore' => 'do_ajax_restore');\n\t\t} else {\n\t\t\t$backup_timestamp = $_REQUEST['backup_timestamp'];\n\t\t\t$continuation_data = null;\n\t\t}\n\n\t\t$filesystem_credentials = $updraftplus->jobdata_get('filesystem_credentials', array());\n\n\t\tif (!empty($filesystem_credentials)) {\n\t\t\t$continuation_data['updraftplus_ajax_restore'] = 'continue_ajax_restore';\n\t\t\t// If the filesystem credentials are not empty then we now need to load these back into $_POST so that WP_Filesystem can access them\n\t\t\tforeach ($filesystem_credentials as $key => $value) {\n\t\t\t\t$_POST[$key] = $value;\n\t\t\t}\n\t\t}\n\n\t\tif (empty($abort_restore_already)) {\n\t\t\t$backup_success = $this->restore_backup($backup_timestamp, $continuation_data);\n\t\t} else {\n\t\t\t$backup_success = false;\n\t\t}\n\n\t\tif (empty($updraftplus->errors) && true === $backup_success) {\n\t\t\t// TODO: Deal with the case of some of the work having been deferred\n\t\t\techo '<p class=\"updraft_restore_successful\"><strong>';\n\t\t\t$updraftplus->log_e('Restore successful!');\n\t\t\techo '</strong></p>';\n\t\t\t$updraftplus->log('Restore successful');\n\t\t\t$s_val = 1;\n\t\t\tif (!empty($this->entities_to_restore) && is_array($this->entities_to_restore)) {\n\t\t\t\tforeach ($this->entities_to_restore as $v) {\n\t\t\t\t\tif ('db' != $v) $s_val = 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$pval = $updraftplus->have_addons ? 1 : 0;\n\n\t\t\techo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href=\"' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&updraft_restore_success=' . $s_val . '&pval=' . $pval . '\">' . __('Return to UpdraftPlus configuration', 'updraftplus') . '</a>';\n\t\t\treturn;\n\n\t\t} elseif (is_wp_error($backup_success)) {\n\t\t\techo '<p class=\"updraft_restore_error\">';\n\t\t\t$updraftplus->log_e('Restore failed...');\n\t\t\techo '</p>';\n\t\t\t$updraftplus->log_wp_error($backup_success);\n\t\t\t$updraftplus->log('Restore failed');\n\t\t\techo '<div class=\"updraft_restore_errors\">';\n\t\t\t$updraftplus->list_errors();\n\t\t\techo '</div>';\n\t\t\techo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href=\"' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus\">' . __('Return to UpdraftPlus configuration', 'updraftplus') . '</a>';\n\t\t\treturn;\n\t\t} elseif (false === $backup_success) {\n\t\t\t// This means, \"not yet - but stay on the page because we may be able to do it later, e.g. if the user types in the requested information\"\n\t\t\techo '<p class=\"updraft_restore_error\">';\n\t\t\t$updraftplus->log_e('Restore failed...');\n\t\t\techo '</p>';\n\t\t\t$updraftplus->log(\"Restore failed\");\n\t\t\techo '<div class=\"updraft_restore_errors\">';\n\t\t\t$updraftplus->list_errors();\n\t\t\techo '</div>';\n\t\t\techo '<strong>' . __('Actions', 'updraftplus') . ':</strong> <a href=\"' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus\">' . __('Return to UpdraftPlus configuration', 'updraftplus') . '</a>';\n\t\t\treturn;\n\t\t}\n\t}",
"public function test_restore() {\n global $DB;\n\n $startcount = $DB->count_records('course_modules');\n\n // Delete the course module.\n course_delete_module($this->quiz->cmid);\n\n // Try restoring.\n $recyclebin = new \\tool_recyclebin\\course_bin($this->course->id);\n foreach ($recyclebin->get_items() as $item) {\n $recyclebin->restore_item($item);\n }\n\n // Check that it was restored and removed from the recycle bin.\n $this->assertEquals($startcount, $DB->count_records('course_modules'));\n $this->assertEquals(0, count($recyclebin->get_items()));\n }",
"function restore_backup()\n {\n move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/backup.sql');\n $this->load->dbutil();\n\n\n $prefs = array(\n 'filepath' => 'uploads/backup.sql',\n 'delete_after_upload' => TRUE,\n 'delimiter' => ';'\n );\n $restore = & $this->dbutil->restore($prefs);\n unlink($prefs['filepath']);\n }",
"function restore($version, $id)\r\n\t{\r\n\t\t// delete current field values\r\n\t\t$query = 'DELETE FROM #__flexicontent_fields_item_relations WHERE item_id = '.(int)$id;\r\n\t\t$this->_db->setQuery($query);\r\n\t\t$this->_db->query();\r\n\t\t\r\n\t\t// load field values from the version to restore\r\n\t\t$query \t= 'SELECT item_id, field_id, value, valueorder, iscore'\r\n\t\t\t\t. ' FROM #__flexicontent_items_versions as iv'\r\n\t\t\t\t. ' LEFT JOIN #__flexicontent_fields as f ON iv.field_id=f.id'\r\n\t\t\t\t. ' WHERE item_id = '. (int)$id\r\n\t\t\t\t. ' AND version = '. (int)$version\r\n\t\t\t\t;\r\n\t\t$this->_db->setQuery($query);\r\n\t\t$versionrecords = $this->_db->loadObjectList();\r\n\t\t\r\n\t\t// restore the old values\r\n\t\tforeach ($versionrecords as $versionrecord) {\r\n\t\t\tif(!(int)$versionrecord->iscore)\r\n\t\t\t\t$this->_db->insertObject('#__flexicontent_fields_item_relations', $versionrecord);\r\n\t\t}\r\n\t\t$query = \"UPDATE #__content SET version='$version' WHERE id='$id';\";\r\n\t\t$this->_db->setQuery($query);\r\n\t\t$this->_db->query($query);\r\n\t\t// handle the maintext not very elegant but functions properly\r\n\t\t$row =& $this->getTable('flexicontent_items', '');\r\n\t\t$row->load($id);\r\n\r\n\t\tif (@$versionrecords[0]->value) {\r\n\t\t\t// Search for the {readmore} tag and split the text up accordingly.\r\n\t\t\t$text \t\t= $versionrecords[0]->value;\r\n\t\t\t$pattern \t= '#<hr\\s+id=(\"|\\')system-readmore(\"|\\')\\s*\\/*>#i';\r\n\t\t\t$tagPos\t\t= preg_match($pattern, $text);\r\n\r\n\t\t\tif ($tagPos == 0) {\r\n\t\t\t\t$row->introtext\t= $text;\r\n\t\t\t} else \t{\r\n\t\t\t\tlist($row->introtext, $row->fulltext) = preg_split($pattern, $text, 2);\r\n\t\t\t}\r\n\t\t}\r\n\t\t//$row->store();\r\n\t\t$row->checkin();\r\n\t}",
"public function restoreAction() {\r\n\t\t$request = reqEbbs::get('post');\r\n\t\t$response = new responseEbbs();\r\n\t\t$filename = $request['filename'];\r\n\t\t$model = $this->getModel();\r\n\r\n // This block for pro-version module 'scrambler'\r\n $needKeyToDecryptDB = dispatcherEbbs::applyFilters('checkIsNeedSecretKeyToEncryptedDB', false, $filename, $request);\r\n if($needKeyToDecryptDB){\r\n $response->addData(array('need' => 'secretKey'));\r\n return $response->ajaxExec();\r\n }\r\n\r\n\t\t$result = $model->restore($filename);\r\n\r\n\t\tif (false === $result) {\r\n $errors = array_merge($model->getDatabase()->getErrors(), $model->getFilesystem()->getErrors());\r\n if (empty($errors)) {\r\n $errors = __('Unable to restore from ' . $filename, EBBS_LANG_CODE);\r\n }\r\n\t\t\t$response->addError($errors);\r\n\t\t}\r\n elseif(is_array($result) && array_key_exists('error', $result)) {\r\n $response->addError($result['error']);\r\n }\r\n elseif(is_array($result) && !empty($result)) {\r\n $content = __('Unable to restore backup files. Check folder or files writing permissions. Try to set 766 permissions to the:', EBBS_LANG_CODE) . ' <br>'. implode('<br>', $result);\r\n $response->addError($content);\r\n }\r\n\t\telse {\r\n\t\t\t$response->addData($result);\r\n\t\t\t$response->addMessage(__('Done!', EBBS_LANG_CODE));\r\n\t\t}\r\n\r\n $response->addData(array('result' => $result));\r\n return $response->ajaxExec();\r\n\t}",
"function lesson_high_scores_restore_mods($lessonid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the highscores array (optional)\n if (isset($info['MOD']['#']['HIGHSCORES']['0']['#']['HIGHSCORE'])) {\n $highscores = $info['MOD']['#']['HIGHSCORES']['0']['#']['HIGHSCORE'];\n //Iterate over highscores\n for($i = 0; $i < sizeof($highscores); $i++) {\n $highscore_info = $highscores[$i];\n //traverse_xmlize($highscore_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($highscore_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_highscores record structure\n $highscore->lessonid = $lessonid;\n $highscore->userid = backup_todb($highscore_info['#']['USERID']['0']['#']);\n $highscore->gradeid = backup_todb($highscore_info['#']['GRADEID']['0']['#']);\n $highscore->nickname = backup_todb($highscore_info['#']['NICKNAME']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $highscore->userid = $user->new_id;\n }\n \n //The structure is equal to the db, so insert the lesson_grade\n $newid = insert_record (\"lesson_high_scores\",$highscore);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"public function after_restore(){\n \tglobal $DB;\n \t\n \t\n \t$pagemenuid = $this->get_activityid();\n\n \tif ($modulelinks = $DB->get_records('pagemenu_links', array('pagemenuid' => $pagemenuid))){\n \t\tforeach($modulelinks as $ml){\n \t\t\t\n \t\t\t$ml->previd = $this->get_mappingid('pagemenu_links', $ml->previd);\n \t\t\t$ml->nextid = $this->get_mappingid('pagemenu_links', $ml->nextid);\n\n\t\t\t\tif ($ml->type == 'module'){\n\t \t\t\tif ($link = $DB->get_record('pagemenu_link_data', array('linkid' => $ml->id))){\n\t \t\t\t\t$link->value = $this->get_mappingid('course_module', $link->value);\n\t \t\t\t\t$DB->update_record('pagemenu_link_data', $link);\n\t \t\t\t} else {\n\t\t\t\t\t\t$this->get_logger()->process(\"Failed to restore dependency for pagemenu link '$ml->name'. \", backup::LOG_ERROR); \t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$DB->update_record('pagemenu_links', $ml);\n \t\t}\n \t} \t \t\n }",
"function restore($old_question_id, $new_question_id, $info, $restore) {\n //print('restore' . '<br />');\n $status = true;\n\n // update the question _answers table with the additional information\n if ($new_question_id > 0) {\n $answers = $info['#']['ANSWERS']['0']['#']['ANSWER'];\n for ($i = 0; $i < sizeof($answers); $i++) {\n $ans_info = $answers[$i];\n\n $answer = new stdClass;\n $answer->question = $new_question_id;\n $answer->answer = backup_todb($ans_info['#']['ANSWER_TEXT']['0']['#']);\n $answer->fraction = backup_todb($ans_info['#']['FRACTION']['0']['#']);\n $answer->feedback = backup_todb($ans_info['#']['FEEDBACK']['0']['#']);\n $answer->answersound = backup_todb($ans_info['#']['ANSWERSOUND']['0']['#']);\n $answer->feedbacksound = backup_todb($ans_info['#']['FEEDBACKSOUND']['0']['#']);\n $answer->tur_answer_truefalse = backup_todb($ans_info['#']['TUR_ANSWER_TRUEFALSE']['0']['#']);\n\n $ansid = get_record('question_answers', 'question', $new_question_id, 'answer', $answer->answer, 'fraction', $answer->fraction, 'id');\n $answer->id = $ansid->id;\n\n $chckans = update_record(question_answers, $answer);\n }\n }\n\n //Get the multichoices array\n $multichoices = $info['#']['TURPROVE'];\n\n //Iterate over multichoices\n for ($i = 0; $i < sizeof($multichoices); $i++) {\n $mul_info = $multichoices[$i];\n\n //Now, build the question_multichoice record structure\n $multichoice = new stdClass;\n $multichoice->question = $new_question_id;\n $multichoice->layout = backup_todb($mul_info['#']['LAYOUT']['0']['#']);\n $multichoice->answers = backup_todb($mul_info['#']['ANSWERS']['0']['#']);\n $multichoice->single = backup_todb($mul_info['#']['SINGLE']['0']['#']);\n $multichoice->shuffleanswers = isset($mul_info['#']['SHUFFLEANSWERS']['0']['#']) ? backup_todb($mul_info['#']['SHUFFLEANSWERS']['0']['#']) : '';\n if (array_key_exists(\"CORRECTFEEDBACK\", $mul_info['#'])) {\n $multichoice->correctfeedback = backup_todb($mul_info['#']['CORRECTFEEDBACK']['0']['#']);\n } else {\n $multichoice->correctfeedback = '';\n }\n if (array_key_exists(\"PARTIALLYCORRECTFEEDBACK\", $mul_info['#'])) {\n $multichoice->partiallycorrectfeedback = backup_todb($mul_info['#']['PARTIALLYCORRECTFEEDBACK']['0']['#']);\n } else {\n $multichoice->partiallycorrectfeedback = '';\n }\n if (array_key_exists(\"INCORRECTFEEDBACK\", $mul_info['#'])) {\n $multichoice->incorrectfeedback = backup_todb($mul_info['#']['INCORRECTFEEDBACK']['0']['#']);\n } else {\n $multichoice->incorrectfeedback = '';\n }\n\n if (array_key_exists(\"QUESTIONSOUND\", $mul_info['#'])) {\n $multichoice->questionsound = backup_todb($mul_info['#']['QUESTIONSOUND']['0']['#']);\n } else {\n $multichoice->questionsound = '';\n }\n\n if (array_key_exists(\"AUTOPLAY\", $mul_info['#'])) {\n $multichoice->autoplay = backup_todb($mul_info['#']['AUTOPLAY']['0']['#']);\n } else {\n $multichoice->autoplay = '';\n }\n\n if (array_key_exists(\"QDIFFICULTY\", $mul_info['#'])) {\n $multichoice->qdifficulty = backup_todb($mul_info['#']['QDIFFICULTY']['0']['#']);\n } else {\n $multichoice->qdifficulty = '';\n }\n\n //We have to recode the answers field (a list of answers id)\n //Extracts answer id from sequence\n $answers_field = \"\";\n $in_first = true;\n $tok = strtok($multichoice->answers, \",\");\n while ($tok) {\n //Get the answer from backup_ids\n $answer = backup_getid($restore->backup_unique_code, \"question_answers\", $tok);\n if ($answer) {\n if ($in_first) {\n $answers_field .= $answer->new_id;\n $in_first = false;\n } else {\n $answers_field .= \",\" . $answer->new_id;\n }\n }\n //check for next\n $tok = strtok(\",\");\n }\n //We have the answers field recoded to its new ids\n $multichoice->answers = $answers_field;\n\n //The structure is equal to the db, so insert the question_shortanswer\n $newid = insert_record(\"question_turprove\", $multichoice);\n\n //Do some output\n if (($i + 1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i + 1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n\n return $status;\n }",
"function lesson_timer_restore_mods($lessonid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n //Get the timer array (optional)\n if (isset($info['MOD']['#']['TIMES']['0']['#']['TIME'])) {\n $times = $info['MOD']['#']['TIMES']['0']['#']['TIME'];\n //Iterate over times\n for($i = 0; $i < sizeof($times); $i++) {\n $time_info = $times[$i];\n //traverse_xmlize($time_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($time_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_time record structure\n $time->lessonid = $lessonid;\n $time->userid = backup_todb($time_info['#']['USERID']['0']['#']);\n $time->starttime = backup_todb($time_info['#']['STARTTIME']['0']['#']);\n $time->lessontime = backup_todb($time_info['#']['LESSONTIME']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $time->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the lesson_grade\n $newid = insert_record (\"lesson_timer\",$time);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"private function course_bin_item_restored($event) {\n global $DB;\n $objectid = $event->objectid;\n $courseid = $event->courseid;\n $course = $DB->get_record('course', array('id' => $courseid), 'visible');\n $coursecontext = context_course::instance($courseid);\n\n $restoreditem = $event->get_record_snapshot('tool_recyclebin_course', $objectid);\n $section = $restoreditem->section;\n $module = $restoreditem->module;\n $sql = 'SELECT id, visible\n FROM {course_modules}\n WHERE course = :courseid\n AND module = :module\n AND section = :section\n ORDER BY id DESC\n LIMIT 1';\n $cm = $DB->get_record_sql($sql, array('courseid' => $courseid, 'module' => $module, 'section' => $section));\n $cmid = $cm->id;\n $cmcontext = context_module::instance($cmid);\n\n $users = $this->get_google_authenticated_users($courseid);\n $fileids = $this->get_fileids($cmid);\n $insertcalls = array();\n\n if ($fileids) {\n foreach ($fileids as $fileid) {\n foreach ($users as $user) {\n if (has_capability('moodle/course:view', $coursecontext, $user->userid)) {\n // Manager; do nothing (permission should already exist).\n } elseif (is_enrolled($coursecontext, $user->userid, null, true) && has_capability('moodle/course:manageactivities', $cmcontext, $user->userid)) {\n // Teacher (enrolled) (active); do nothing (permission should already exist).\n } elseif (is_enrolled($coursecontext, $user->userid, null, true)) {\n // Student (enrolled) (active); continue checks for reader permission.\n if ($course->visible == 1) {\n // Course is visible, continue checks.\n rebuild_course_cache($courseid, true);\n $modinfo = get_fast_modinfo($courseid, $user->userid);\n $cminfo = $modinfo->get_cm($cmid);\n $sectionnumber = $this->get_cm_sectionnum($cmid);\n $secinfo = $modinfo->get_section_info($sectionnumber);\n if ($cminfo->uservisible && $secinfo->available) {\n // Course module is visible and accessible, section is accessible; insert reader permission.\n $call = new stdClass();\n $call->fileid = $fileid;\n $call->gmail = $user->gmail;\n $call->role = 'reader';\n $insertcalls[] = $call;\n if (count($insertcalls) == 1000) {\n $this->batch_insert_permissions($insertcalls);\n $insertcalls = array();\n }\n }\n // Course module or section not visible or available; do nothing.\n }\n // Course not visible, do nothing.\n } \n // User is not enrolled; do nothing.\n }\n\n // Store cmid and reference(s).\n $newdata = new stdClass();\n $newdata->courseid = $courseid;\n $newdata->cmid = $cmid;\n $newdata->reference = $fileid;\n $DB->insert_record('repository_gdrive_references', $newdata);\n }\n }\n\n // Call any remaining batch requests.\n if (count($insertcalls) > 0) {\n $this->batch_insert_permissions($insertcalls);\n }\n }",
"function archiveTables($course_id, $course_code, $archivedir) {\n // backup subsystems from main db\n $sql_course = \"course_id = $course_id\";\n $archive_conditions = array(\n 'course' => \"id = $course_id\",\n 'user' => \"id IN (SELECT user_id FROM course_user\n WHERE course_id = $course_id)\",\n 'course_user' => \"course_id = $course_id\",\n 'course_settings' => \"course_id = $course_id\",\n 'course_department' => \"course = $course_id\",\n 'course_module' => $sql_course,\n 'hierarchy' => \"id IN (SELECT department FROM course_department\n WHERE course = $course_id)\",\n 'announcement' => $sql_course,\n 'group_properties' => $sql_course,\n 'group_category' => $sql_course,\n 'group' => $sql_course,\n 'group_members' => \"group_id IN (SELECT id FROM `group`\n WHERE course_id = $course_id)\",\n 'document' => $sql_course,\n 'link_category' => $sql_course,\n 'link' => $sql_course,\n 'ebook' => $sql_course,\n 'ebook_section' => \"ebook_id IN (SELECT id FROM ebook\n WHERE course_id = $course_id)\",\n 'ebook_subsection' => \"section_id IN (SELECT ebook_section.id\n FROM ebook, ebook_section\n WHERE ebook.id = ebook_id AND\n course_id = $course_id)\",\n 'course_units' => $sql_course,\n 'unit_resources' => \"unit_id IN (SELECT id FROM course_units\n WHERE course_id = $course_id)\",\n 'forum' => $sql_course,\n 'forum_category' => $sql_course,\n 'forum_topic' => \"forum_id IN (SELECT id FROM forum\n WHERE course_id = $course_id)\",\n 'forum_post' => \"topic_id IN (SELECT forum_topic.id\n FROM forum, forum_topic\n WHERE forum.id = forum_id AND\n course_id = $course_id)\",\n 'forum_notify' => $sql_course,\n 'forum_user_stats' => $sql_course,\n 'course_description' => $sql_course,\n 'glossary' => $sql_course,\n 'glossary_category' => $sql_course,\n 'video_category' => $sql_course,\n 'video' => $sql_course,\n 'videolink' => $sql_course,\n 'dropbox_msg' => $sql_course,\n 'dropbox_attachment' => \"msg_id IN (SELECT id from dropbox_msg WHERE course_id = $course_id)\",\n 'dropbox_index' => \"msg_id IN (SELECT id from dropbox_msg WHERE course_id = $course_id)\",\n 'lp_learnPath' => $sql_course,\n 'lp_module' => $sql_course,\n 'lp_asset' => \"module_id IN (SELECT module_id FROM lp_module WHERE course_id = $course_id)\",\n 'lp_rel_learnPath_module' => \"learnPath_id IN (SELECT learnPath_id FROM lp_learnPath WHERE course_id = $course_id)\",\n 'lp_user_module_progress' => \"learnPath_id IN (SELECT learnPath_id FROM lp_learnPath WHERE course_id = $course_id)\",\n 'wiki_properties' => $sql_course,\n 'wiki_acls' => \"wiki_id IN (SELECT id FROM wiki_properties WHERE course_id = $course_id)\",\n 'wiki_pages' => \"wiki_id IN (SELECT id FROM wiki_properties WHERE course_id = $course_id)\",\n 'wiki_pages_content' => \"pid IN (SELECT id FROM wiki_pages\n WHERE wiki_id IN (SELECT id FROM wiki_properties\n WHERE course_id = $course_id))\",\n 'poll' => $sql_course,\n 'poll_question' => \"pid IN (SELECT pid FROM poll WHERE course_id = $course_id)\",\n 'poll_to_specific' => \"poll_id IN (SELECT pid FROM poll WHERE course_id = $course_id)\",\n 'poll_answer_record' => \"poll_user_record_id IN (SELECT id FROM poll_user_record WHERE pid IN (SELECT pid FROM poll WHERE course_id = $course_id))\",\n 'poll_user_record' => \"pid IN (SELECT pid FROM poll WHERE course_id = $course_id)\",\n 'poll_question_answer' => \"pqid IN (SELECT pqid FROM poll_question\n WHERE pid IN (SELECT pid FROM poll\n WHERE course_id = $course_id))\",\n 'assignment' => $sql_course,\n 'assignment_to_specific' => \"assignment_id IN (SELECT id FROM assignment WHERE course_id = $course_id)\",\n 'assignment_submit' => \"assignment_id IN (SELECT id FROM assignment\n WHERE course_id = $course_id)\",\n 'gradebook' => $sql_course,\n 'gradebook_activities' => \"gradebook_id IN (SELECT id FROM gradebook\n WHERE course_id = $course_id)\",\n 'gradebook_book' => \"gradebook_activity_id IN (SELECT gradebook_activities.id FROM gradebook_activities, gradebook\n WHERE gradebook.course_id = $course_id AND gradebook_activities.gradebook_id = gradebook.id)\",\n 'gradebook_users' => \"gradebook_id IN (SELECT id FROM gradebook WHERE course_id = $course_id)\",\n 'attendance' => $sql_course,\n 'attendance_activities' => \"attendance_id IN (SELECT id FROM attendance\n WHERE course_id = $course_id)\",\n 'attendance_book' => \"attendance_activity_id IN (SELECT attendance_activities.id FROM attendance_activities, attendance\n WHERE attendance.course_id = $course_id AND attendance_activities.attendance_id = attendance.id)\",\n 'attendance_users' => \"attendance_id IN (SELECT id FROM attendance WHERE course_id = $course_id)\",\n 'agenda' => $sql_course,\n 'exercise' => $sql_course,\n 'exercise_to_specific' => \"exercise_id IN (SELECT id FROM exercise WHERE course_id = $course_id)\",\n 'exercise_question' => $sql_course,\n 'exercise_answer' => \"question_id IN (SELECT id FROM exercise_question\n WHERE course_id = $course_id)\",\n 'exercise_user_record' => \"eid IN (SELECT id FROM exercise WHERE course_id = $course_id)\",\n 'exercise_with_questions' => \"question_id IN (SELECT id FROM exercise_question\n WHERE course_id = $course_id) OR\n exercise_id IN (SELECT id FROM exercise\n WHERE course_id = $course_id)\",\n 'exercise_question_cats' => $sql_course,\n 'exercise_answer_record' => \"question_id IN (SELECT id FROM exercise_question\n WHERE course_id = $course_id)\",\n 'tc_session' => \"course_id IN (SELECT id FROM tc_session WHERE course_id = $course_id)\",\n 'blog_post' => $sql_course,\n 'comments' => \"(rtype = 'blogpost' AND rid IN (SELECT id FROM blog_post WHERE course_id = $course_id)) OR (rtype = 'course' AND rid = $course_id) OR\n (rtype = 'wallpost' AND rid IN (SELECT id FROM wall_post WHERE course_id = $course_id))\",\n 'rating' => \"(rtype = 'blogpost' AND rid IN (SELECT id FROM blog_post WHERE course_id = $course_id)) OR (rtype = 'course' AND rid = $course_id) OR\n (rtype = 'forum_post' AND rid IN (SELECT forum_post.id FROM forum_post INNER JOIN forum_topic on forum_post.topic_id = forum_topic.id INNER JOIN forum on forum_topic.forum_id = forum.id\n WHERE forum.course_id = $course_id)) OR (rtype = 'link' AND rid IN (SELECT id FROM link WHERE course_id = $course_id)) OR (rtype = 'wallpost' AND rid IN (SELECT id FROM wall_post WHERE course_id = $course_id))\",\n 'rating_cache' => \"(rtype = 'blogpost' AND rid IN (SELECT id FROM blog_post WHERE course_id = $course_id)) OR (rtype = 'course' AND rid = $course_id) OR\n (rtype = 'forum_post' AND rid IN (SELECT forum_post.id FROM forum_post INNER JOIN forum_topic on forum_post.topic_id = forum_topic.id INNER JOIN forum on forum_topic.forum_id = forum.id\n WHERE forum.course_id = $course_id)) OR (rtype = 'link' AND rid IN (SELECT id FROM link WHERE course_id = $course_id)) OR (rtype = 'wallpost' AND rid IN (SELECT id FROM wall_post WHERE course_id = $course_id))\",\n 'abuse_report' => $sql_course,\n 'wall_post' => $sql_course,\n 'wall_post_resources' => \"post_id IN (SELECT id FROM wall_post WHERE course_id = $course_id)\",\n 'note' => \"(reference_obj_course IS NOT NULL AND reference_obj_course = $course_id)\",\n 'activity_heading' => 'true',\n 'activity_content' => $sql_course,\n 'certificate' => $sql_course,\n 'certificate_criterion' => \"certificate IN (SELECT id FROM certificate WHERE course_id = $course_id)\",\n 'certificate_template' => 'true',\n 'badge' => $sql_course,\n 'badge_criterion' => \"badge IN (SELECT id FROM badge WHERE course_id = $course_id)\",\n 'badge_icon' => 'true',\n 'category' => 'true',\n 'category_value' => 'true',\n 'course_category' => $sql_course,\n 'h5p_content' => $sql_course,\n 'h5p_content_dependency' => \"content_id IN (SELECT id FROM h5p_content WHERE course_id = $course_id)\"\n );\n\n foreach ($archive_conditions as $table => $condition) {\n backup_table($archivedir, $table, $condition);\n }\n\n file_put_contents(\"$archivedir/config_vars\",\n serialize(array(\n 'urlServer' => $GLOBALS['urlServer'],\n 'urlAppend' => $GLOBALS['urlAppend'],\n 'siteName' => $GLOBALS['siteName'],\n 'version' => get_config('version'))));\n}"
]
| [
"0.69757617",
"0.6735819",
"0.667734",
"0.6620086",
"0.6588452",
"0.6448809",
"0.6275817",
"0.62128186",
"0.61416084",
"0.6122781",
"0.6080984",
"0.6043849",
"0.5980194",
"0.59601855",
"0.5838933",
"0.5748088",
"0.56690407",
"0.5654498",
"0.5654498",
"0.56330836",
"0.5594757",
"0.5571386",
"0.55073994",
"0.54972386",
"0.5450811",
"0.5448666",
"0.5399866",
"0.5396183",
"0.53821677",
"0.53502023"
]
| 0.7045794 | 0 |
This function restores the exercise_elements | function exercise_elements_restore($exercise_id,$info,$restore) {
global $CFG;
$status = true;
//Get the exercise_elements array
$elements = $info['MOD']['#']['ELEMENTS']['0']['#']['ELEMENT'];
//Iterate over exercise_elements
for($i = 0; $i < sizeof($elements); $i++) {
$ele_info = $elements[$i];
//traverse_xmlize($ele_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the exercise_ELEMENTS record structure
$element->exerciseid = $exercise_id;
$element->elementno = backup_todb($ele_info['#']['ELEMENTNO']['0']['#']);
$element->description = backup_todb($ele_info['#']['DESCRIPTION']['0']['#']);
$element->scale = backup_todb($ele_info['#']['SCALE']['0']['#']);
$element->maxscore = backup_todb($ele_info['#']['MAXSCORE']['0']['#']);
$element->weight = backup_todb($ele_info['#']['WEIGHT']['0']['#']);
//The structure is equal to the db, so insert the exercise_elements
$newid = insert_record ("exercise_elements",$element);
//Do some output
if (($i+1) % 10 == 0) {
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if (($i+1) % 200 == 0) {
echo "<br />";
}
}
backup_flush(300);
}
if ($newid) {
//We have to restore the exercise_rubrics table now (course level table)
$status = exercise_rubrics_restore($exercise_id,$element->elementno,$ele_info,$restore);
} else {
$status = false;
}
}
return $status;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function resetElementsToBeDeleted() {}",
"function clear()\r\n\t\t{\r\n\t\t\t$this->elements = array();\r\n\t\t}",
"public function clear() {\n $this->elements = array();\n }",
"public function clear()\r\n\t{\r\n\t\t$this->isLoaded = false;\r\n\t\t$this->elements = array();\r\n\t\t$this->keyAssocation = array();\r\n\t\t$this->i = 0;\r\n\t\t$this->count = 0;\r\n\t}",
"protected function resetNestedElementCalls() {}",
"function exercise_assessments_restore($new_exercise_id, $new_submission_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the assessments array (optional)\n if (isset($info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'])) {\n $assessments = $info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'];\n\n //Iterate over assessments\n for($i = 0; $i < sizeof($assessments); $i++) {\n $ass_info = $assessments[$i];\n //traverse_xmlize($ass_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($ass_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($ass_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_ASSESSMENTS record structure\n $assessment->exerciseid = $new_exercise_id;\n $assessment->submissionid = $new_submission_id;\n $assessment->userid = backup_todb($ass_info['#']['USERID']['0']['#']);\n $assessment->timecreated = backup_todb($ass_info['#']['TIMECREATED']['0']['#']);\n $assessment->timegraded = backup_todb($ass_info['#']['TIMEGRADED']['0']['#']);\n $assessment->grade = backup_todb($ass_info['#']['GRADE']['0']['#']);\n $assessment->gradinggrade = backup_todb($ass_info['#']['GRADINGGRADE']['0']['#']);\n $assessment->mailed = backup_todb($ass_info['#']['MAILED']['0']['#']);\n $assessment->generalcomment = backup_todb($ass_info['#']['GENERALCOMMENT']['0']['#']);\n $assessment->teachercomment = backup_todb($ass_info['#']['TEACHERCOMMENT']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $assessment->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_assessment\n $newid = insert_record (\"exercise_assessments\",$assessment);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_assessments\",$oldid,\n $newid);\n\n //Now we need to restore exercise_grades (user level table) \n if ($status) {\n $status = exercise_grades_restore_mods ($new_exercise_id, $newid,$ass_info,$restore); \n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"public function clear(): void {\n\t\t$this->m_elements = [];\n\t}",
"public function clear() \r\n {\r\n unset($this->elements);\r\n $this->elements = array();\r\n }",
"protected function tearDown() {\n $this->element = null;\n }",
"public function postClone() {\n\t\t// Clone common parent objects.\n\t\tparent::postClone();\n\n\t\t$tempQuestions = new ArrayCollection();\n\t\tforeach ($this->questions as $question) {\n\t\t\t$newQuestion = clone $question;\n\t\t\t$newQuestion->postClone();\n\t\t\t$newQuestion->setExercise($this);\n\t\t\t$tempQuestions->add($newQuestion);\n\t\t}\n\t\t$this->questions = $tempQuestions;\n\t}",
"public function unpopulate();",
"function exercise_submissions_restore($old_exercise_id, $new_exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the submissions array (teacher submissions)\n $submissions = $info['MOD']['#']['SUBMISSIONS']['0']['#']['SUBMISSION'];\n //Iterate over submissions\n for($i = 0; $i < sizeof($submissions); $i++) {\n $sub_info = $submissions[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($sub_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($sub_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_SUBMISSIONS record structure\n $submission->exerciseid = $new_exercise_id;\n $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);\n $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']);\n $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);\n $submission->resubmit = backup_todb($sub_info['#']['RESUBMIT']['0']['#']);\n $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);\n $submission->isexercise = backup_todb($sub_info['#']['ISEXERCISE']['0']['#']);\n $submission->late = backup_todb($sub_info['#']['LATE']['0']['#']);\n\n // always save the exercise descriptions and optionally the student submissions\n if ($submission->isexercise or restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $submission->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_submission\n $newid = insert_record (\"exercise_submissions\",$submission);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_submissions\",$oldid,\n $newid);\n\n //Now copy moddata associated files\n $status = exercise_restore_files($oldid, $newid,$restore); \n //Now we need to restore exercise_assessments (user level table)\n if ($status and restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n $status = exercise_assessments_restore($new_exercise_id, $newid,$sub_info,$restore);\n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"public function reset()\n {\n $this->values[self::_EXP] = null;\n $this->values[self::_MONEY] = null;\n $this->values[self::_ITEMS] = array();\n }",
"public function rewind() {\n reset($this->elements);\n }",
"public function reset()\n {\n $this->values[self::EQUIPMENTING_ITEM] = array();\n $this->values[self::HAVING_ITEM] = array();\n }",
"public function clearQuestionOffensives()\n\t{\n\t\t$this->collQuestionOffensives = null; // important to set this to NULL since that means it is uninitialized\n\t}",
"public function clear() {\n\t\t\t$this->elements = array();\n\t\t\t$this->size = 0;\n\t}",
"public function clear() {\n\t\t\t$this->elements = array();\n\t\t\t$this->size = 0;\n\t}",
"function resetAnswers() {\n\t\tunset($this->_answers);\n\t\t$this->_answers = array();\n\t}",
"public function reset()\n {\n $this->values[self::_RESULT] = null;\n $this->values[self::_ITEMS] = array();\n $this->values[self::_HERO] = array();\n $this->values[self::_DIAMOND] = null;\n }",
"function Reset()\n\t{\t$this->details = array();\n\t\t$this->courses = array();\n\t\t$this->id = 0;\n\t}",
"private function resetAll(){\n $this->score = ['heritage'=> 0,'relax'=> 0,'sightseeing'=> 0,'weather'=> 0,'populated'=> 0];\n $this->answeredQuestions = [];\n $this->answersId = [];\n }",
"public function reset()\n {\n $this->values[self::_ITEMS] = array();\n $this->values[self::_GOLD] = null;\n $this->values[self::_SKILL_POINT] = null;\n }",
"public function reset()\n {\n $this->values[self::_RESULT] = null;\n $this->values[self::_HERO] = null;\n $this->values[self::_ITEMS] = array();\n }",
"public function reset()\n {\n $this->values[self::_INDEX] = null;\n $this->values[self::_ITEM_ID] = null;\n $this->values[self::_EXP] = null;\n }",
"public function clearEmbargo();",
"public function reset()\n {\n $this->values[self::_SUMMARY] = array();\n $this->values[self::_SELF_RANKING] = null;\n $this->values[self::_SELF_SUMMARY] = null;\n }",
"public function reset_tableaux() {\n\t\treturn $this->setArbreMoniteurs ( array () )\n\t\t\t->setArbreGroupes ( array () )\n\t\t\t->setArbreMachines ( array () )\n\t\t\t->setDependance ( array () )\n\t\t\t->setGroupeNumbers ( array () );\n\t}",
"public function removeElements() {\n\t\t$this->elements = array();\n\t\treturn $this;\n\t}",
"protected static function restore() {}"
]
| [
"0.6231813",
"0.60105073",
"0.5924636",
"0.57976806",
"0.5770478",
"0.57321894",
"0.56962526",
"0.5667369",
"0.5643168",
"0.5607145",
"0.5548793",
"0.5510094",
"0.5485775",
"0.54796505",
"0.5470792",
"0.5461399",
"0.54578465",
"0.54578465",
"0.5421869",
"0.5408836",
"0.5400341",
"0.53985834",
"0.5398054",
"0.53678185",
"0.5360793",
"0.5329842",
"0.5304611",
"0.525776",
"0.5255483",
"0.5234312"
]
| 0.65604395 | 0 |
This function restores the exercise_rubrics | function exercise_rubrics_restore($exercise_id,$elementno,$info,$restore) {
global $CFG;
$status = true;
//Get the exercise_rubrics array (optional)
if (isset($info['#']['RUBRICS']['0']['#']['RUBRIC'])) {
$rubrics = $info['#']['RUBRICS']['0']['#']['RUBRIC'];
//Iterate over exercise_rubrics
for($i = 0; $i < sizeof($rubrics); $i++) {
$rub_info = $rubrics[$i];
//traverse_xmlize($rub_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the exercise_RUBRICS record structure
$rubric->exerciseid = $exercise_id;
$rubric->elementno = $elementno;
$rubric->rubricno = backup_todb($rub_info['#']['RUBRICNO']['0']['#']);
$rubric->description = backup_todb($rub_info['#']['DESCRIPTION']['0']['#']);
//The structure is equal to the db, so insert the exercise_rubrics
$newid = insert_record ("exercise_rubrics",$rubric);
//Do some output
if (($i+1) % 10 == 0) {
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if (($i+1) % 200 == 0) {
echo "<br />";
}
}
backup_flush(300);
}
if (!$newid) {
$status = false;
}
}
}
return $status;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function restore(User $user, Exercise $exercise)\n {\n //\n }",
"function exercise_assessments_restore($new_exercise_id, $new_submission_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the assessments array (optional)\n if (isset($info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'])) {\n $assessments = $info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'];\n\n //Iterate over assessments\n for($i = 0; $i < sizeof($assessments); $i++) {\n $ass_info = $assessments[$i];\n //traverse_xmlize($ass_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($ass_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($ass_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_ASSESSMENTS record structure\n $assessment->exerciseid = $new_exercise_id;\n $assessment->submissionid = $new_submission_id;\n $assessment->userid = backup_todb($ass_info['#']['USERID']['0']['#']);\n $assessment->timecreated = backup_todb($ass_info['#']['TIMECREATED']['0']['#']);\n $assessment->timegraded = backup_todb($ass_info['#']['TIMEGRADED']['0']['#']);\n $assessment->grade = backup_todb($ass_info['#']['GRADE']['0']['#']);\n $assessment->gradinggrade = backup_todb($ass_info['#']['GRADINGGRADE']['0']['#']);\n $assessment->mailed = backup_todb($ass_info['#']['MAILED']['0']['#']);\n $assessment->generalcomment = backup_todb($ass_info['#']['GENERALCOMMENT']['0']['#']);\n $assessment->teachercomment = backup_todb($ass_info['#']['TEACHERCOMMENT']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $assessment->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_assessment\n $newid = insert_record (\"exercise_assessments\",$assessment);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_assessments\",$oldid,\n $newid);\n\n //Now we need to restore exercise_grades (user level table) \n if ($status) {\n $status = exercise_grades_restore_mods ($new_exercise_id, $newid,$ass_info,$restore); \n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"protected static function restore() {}",
"public function restored(InterviewQuestion $interviewQuestion): void\n {\n //\n }",
"function exercise_submissions_restore($old_exercise_id, $new_exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the submissions array (teacher submissions)\n $submissions = $info['MOD']['#']['SUBMISSIONS']['0']['#']['SUBMISSION'];\n //Iterate over submissions\n for($i = 0; $i < sizeof($submissions); $i++) {\n $sub_info = $submissions[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($sub_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($sub_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_SUBMISSIONS record structure\n $submission->exerciseid = $new_exercise_id;\n $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);\n $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']);\n $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);\n $submission->resubmit = backup_todb($sub_info['#']['RESUBMIT']['0']['#']);\n $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);\n $submission->isexercise = backup_todb($sub_info['#']['ISEXERCISE']['0']['#']);\n $submission->late = backup_todb($sub_info['#']['LATE']['0']['#']);\n\n // always save the exercise descriptions and optionally the student submissions\n if ($submission->isexercise or restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $submission->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_submission\n $newid = insert_record (\"exercise_submissions\",$submission);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_submissions\",$oldid,\n $newid);\n\n //Now copy moddata associated files\n $status = exercise_restore_files($oldid, $newid,$restore); \n //Now we need to restore exercise_assessments (user level table)\n if ($status and restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n $status = exercise_assessments_restore($new_exercise_id, $newid,$sub_info,$restore);\n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"function restore()\n {\n }",
"public function restore()\n {\n }",
"protected function _processRevertToDefault()\n {\n }",
"public function restore() {}",
"public function restore() {\n self::restoreAll($this->chapterID);\n }",
"public function restore()\n {\n //\n }",
"function exercise_elements_restore($exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the exercise_elements array\n $elements = $info['MOD']['#']['ELEMENTS']['0']['#']['ELEMENT'];\n\n //Iterate over exercise_elements\n for($i = 0; $i < sizeof($elements); $i++) {\n $ele_info = $elements[$i];\n //traverse_xmlize($ele_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the exercise_ELEMENTS record structure\n $element->exerciseid = $exercise_id;\n $element->elementno = backup_todb($ele_info['#']['ELEMENTNO']['0']['#']);\n $element->description = backup_todb($ele_info['#']['DESCRIPTION']['0']['#']);\n $element->scale = backup_todb($ele_info['#']['SCALE']['0']['#']);\n $element->maxscore = backup_todb($ele_info['#']['MAXSCORE']['0']['#']);\n $element->weight = backup_todb($ele_info['#']['WEIGHT']['0']['#']);\n\n //The structure is equal to the db, so insert the exercise_elements\n $newid = insert_record (\"exercise_elements\",$element);\n\n //Do some output\n if (($i+1) % 10 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 200 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have to restore the exercise_rubrics table now (course level table)\n $status = exercise_rubrics_restore($exercise_id,$element->elementno,$ele_info,$restore);\n } else {\n $status = false;\n }\n }\n\n return $status;\n }",
"function exercise_restore_files ($oldsubmiss, $newsubmiss, $restore) {\n\n global $CFG;\n\n $status = true;\n $todo = false;\n $moddata_path = \"\";\n $exercise_path = \"\";\n $temp_path = \"\";\n\n //First, we check to \"course_id\" exists and create is as necessary\n //in CFG->dataroot\n $dest_dir = $CFG->dataroot.\"/\".$restore->course_id;\n $status = check_dir_exists($dest_dir,true);\n\n //Now, locate course's moddata directory\n $moddata_path = $CFG->dataroot.\"/\".$restore->course_id.\"/\".$CFG->moddata;\n \n //Check it exists and create it\n $status = check_dir_exists($moddata_path,true);\n\n //Now, locate exercise directory\n if ($status) {\n $exercise_path = $moddata_path.\"/exercise\";\n //Check it exists and create it\n $status = check_dir_exists($exercise_path,true);\n }\n\n //Now locate the temp dir we are gong to restore\n if ($status) {\n $temp_path = $CFG->dataroot.\"/temp/backup/\".$restore->backup_unique_code.\n \"/moddata/exercise/\".$oldsubmiss;\n //Check it exists\n if (is_dir($temp_path)) {\n $todo = true;\n }\n }\n\n //If todo, we create the neccesary dirs in course moddata/exercise\n if ($status and $todo) {\n //First this exercise id\n $this_exercise_path = $exercise_path.\"/\".$newsubmiss;\n $status = check_dir_exists($this_exercise_path,true);\n //And now, copy temp_path to this_exercise_path\n $status = backup_copy_file($temp_path, $this_exercise_path); \n }\n \n return $status;\n }",
"public function restore();",
"public function testPreprocessingUnrotate()\n {\n }",
"protected function postFixtureRestore()\n {\n }",
"abstract protected function _restoreStandardValues();",
"function restore($old_question_id, $new_question_id, $info, $restore) {\n //print('restore' . '<br />');\n $status = true;\n\n // update the question _answers table with the additional information\n if ($new_question_id > 0) {\n $answers = $info['#']['ANSWERS']['0']['#']['ANSWER'];\n for ($i = 0; $i < sizeof($answers); $i++) {\n $ans_info = $answers[$i];\n\n $answer = new stdClass;\n $answer->question = $new_question_id;\n $answer->answer = backup_todb($ans_info['#']['ANSWER_TEXT']['0']['#']);\n $answer->fraction = backup_todb($ans_info['#']['FRACTION']['0']['#']);\n $answer->feedback = backup_todb($ans_info['#']['FEEDBACK']['0']['#']);\n $answer->answersound = backup_todb($ans_info['#']['ANSWERSOUND']['0']['#']);\n $answer->feedbacksound = backup_todb($ans_info['#']['FEEDBACKSOUND']['0']['#']);\n $answer->tur_answer_truefalse = backup_todb($ans_info['#']['TUR_ANSWER_TRUEFALSE']['0']['#']);\n\n $ansid = get_record('question_answers', 'question', $new_question_id, 'answer', $answer->answer, 'fraction', $answer->fraction, 'id');\n $answer->id = $ansid->id;\n\n $chckans = update_record(question_answers, $answer);\n }\n }\n\n //Get the multichoices array\n $multichoices = $info['#']['TURPROVE'];\n\n //Iterate over multichoices\n for ($i = 0; $i < sizeof($multichoices); $i++) {\n $mul_info = $multichoices[$i];\n\n //Now, build the question_multichoice record structure\n $multichoice = new stdClass;\n $multichoice->question = $new_question_id;\n $multichoice->layout = backup_todb($mul_info['#']['LAYOUT']['0']['#']);\n $multichoice->answers = backup_todb($mul_info['#']['ANSWERS']['0']['#']);\n $multichoice->single = backup_todb($mul_info['#']['SINGLE']['0']['#']);\n $multichoice->shuffleanswers = isset($mul_info['#']['SHUFFLEANSWERS']['0']['#']) ? backup_todb($mul_info['#']['SHUFFLEANSWERS']['0']['#']) : '';\n if (array_key_exists(\"CORRECTFEEDBACK\", $mul_info['#'])) {\n $multichoice->correctfeedback = backup_todb($mul_info['#']['CORRECTFEEDBACK']['0']['#']);\n } else {\n $multichoice->correctfeedback = '';\n }\n if (array_key_exists(\"PARTIALLYCORRECTFEEDBACK\", $mul_info['#'])) {\n $multichoice->partiallycorrectfeedback = backup_todb($mul_info['#']['PARTIALLYCORRECTFEEDBACK']['0']['#']);\n } else {\n $multichoice->partiallycorrectfeedback = '';\n }\n if (array_key_exists(\"INCORRECTFEEDBACK\", $mul_info['#'])) {\n $multichoice->incorrectfeedback = backup_todb($mul_info['#']['INCORRECTFEEDBACK']['0']['#']);\n } else {\n $multichoice->incorrectfeedback = '';\n }\n\n if (array_key_exists(\"QUESTIONSOUND\", $mul_info['#'])) {\n $multichoice->questionsound = backup_todb($mul_info['#']['QUESTIONSOUND']['0']['#']);\n } else {\n $multichoice->questionsound = '';\n }\n\n if (array_key_exists(\"AUTOPLAY\", $mul_info['#'])) {\n $multichoice->autoplay = backup_todb($mul_info['#']['AUTOPLAY']['0']['#']);\n } else {\n $multichoice->autoplay = '';\n }\n\n if (array_key_exists(\"QDIFFICULTY\", $mul_info['#'])) {\n $multichoice->qdifficulty = backup_todb($mul_info['#']['QDIFFICULTY']['0']['#']);\n } else {\n $multichoice->qdifficulty = '';\n }\n\n //We have to recode the answers field (a list of answers id)\n //Extracts answer id from sequence\n $answers_field = \"\";\n $in_first = true;\n $tok = strtok($multichoice->answers, \",\");\n while ($tok) {\n //Get the answer from backup_ids\n $answer = backup_getid($restore->backup_unique_code, \"question_answers\", $tok);\n if ($answer) {\n if ($in_first) {\n $answers_field .= $answer->new_id;\n $in_first = false;\n } else {\n $answers_field .= \",\" . $answer->new_id;\n }\n }\n //check for next\n $tok = strtok(\",\");\n }\n //We have the answers field recoded to its new ids\n $multichoice->answers = $answers_field;\n\n //The structure is equal to the db, so insert the question_shortanswer\n $newid = insert_record(\"question_turprove\", $multichoice);\n\n //Do some output\n if (($i + 1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i + 1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n\n return $status;\n }",
"function restore($old_question_id,$new_question_id,$info,$restore) {\n global $DB;\n\n $status = true;\n\n //Get the calculated-s array\n $calculateds = $info['#']['CALCULATED'];\n\n //Iterate over calculateds\n for($i = 0; $i < sizeof($calculateds); $i++) {\n $cal_info = $calculateds[$i];\n //traverse_xmlize($cal_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the question_calculated record structure\n $calculated->question = $new_question_id;\n $calculated->answer = backup_todb($cal_info['#']['ANSWER']['0']['#']);\n $calculated->tolerance = backup_todb($cal_info['#']['TOLERANCE']['0']['#']);\n $calculated->tolerancetype = backup_todb($cal_info['#']['TOLERANCETYPE']['0']['#']);\n $calculated->correctanswerlength = backup_todb($cal_info['#']['CORRECTANSWERLENGTH']['0']['#']);\n $calculated->correctanswerformat = backup_todb($cal_info['#']['CORRECTANSWERFORMAT']['0']['#']);\n\n ////We have to recode the answer field\n $answer = backup_getid($restore->backup_unique_code,\"question_answers\",$calculated->answer);\n if ($answer) {\n $calculated->answer = $answer->new_id;\n }\n\n //The structure is equal to the db, so insert the question_calculated\n $newid = $DB->insert_record (\"question_calculated\",$calculated);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n //Now restore numerical_units\n $status = question_restore_numerical_units ($old_question_id,$new_question_id,$cal_info,$restore);\n\n //Now restore dataset_definitions\n if ($status && $newid) {\n $status = question_restore_dataset_definitions ($old_question_id,$new_question_id,$cal_info,$restore);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n\n return $status;\n }",
"public function tear_down() {\n\t\tremove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );\n\t\tparent::tear_down();\n\t}",
"function recycle_quizzes()\n\t{\n\t\tif ($this->course->has_resources(RESOURCE_QUIZ))\n\t\t{\n\t\t\t//$table_qui_que = Database :: get_course_table(TABLE_QUIZ_QUESTION);\n\t\t\t//$table_qui_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER);\n\t\t\t$table_qui = Database :: get_course_table(TABLE_QUIZ_TEST);\n\t\t\t$table_rel = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);\n\t\t\t$ids = implode(',', (array_keys($this->course->resources[RESOURCE_QUIZ])));\n\t\t\t$sql = \"DELETE FROM \".$table_qui.\" WHERE id IN(\".$ids.\")\";\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t\t$sql = \"DELETE FROM \".$table_rel.\" WHERE exercice_id IN(\".$ids.\")\";\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t}\n\t}",
"function lesson_answers_restore($lessonid,$pageid,$info,$restore,$userdata=false) {\n\n global $CFG;\n\n $status = true;\n\n //Get the lesson_answers array (optional)\n if (isset($info['#']['ANSWERS']['0']['#']['ANSWER'])) {\n // The following chunk of code is a fix for matching questions made\n // pre moodle 1.5. Matching questions need two answer fields designated\n // for correct and wrong responses before the rest of the answer fields.\n if ($restore->backup_version <= 2004083124) { // Backup version for 1.4.5+\n if ($ismatching = get_record('lesson_pages', 'id', $pageid)) { // get the page we just inserted\n if ($ismatching->qtype == 5) { // check to make sure it is a matching question\n $time = time(); // this may need to be changed\n // make our 2 response answers\n $newanswer->lessonid = $lessonid;\n $newanswer->pageid = $pageid;\n $newanswer->timecreated = $time;\n $newanswer->timemodified = 0;\n insert_record('lesson_answers', $newanswer);\n insert_record('lesson_answers', $newanswer);\n }\n }\n }\n\n $answers = $info['#']['ANSWERS']['0']['#']['ANSWER'];\n\n //Iterate over lesson_answers\n for($i = 0; $i < sizeof($answers); $i++) {\n $answer_info = $answers[$i];\n //traverse_xmlize($rub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($answer_info['#']['ID']['0']['#']);\n\n //Now, build the lesson_answers record structure\n $answer->lessonid = $lessonid;\n $answer->pageid = $pageid;\n // the absolute jumps will need fixing later\n $answer->jumpto = backup_todb($answer_info['#']['JUMPTO']['0']['#']);\n $answer->grade = backup_todb($answer_info['#']['GRADE']['0']['#']);\n $answer->score = backup_todb($answer_info['#']['SCORE']['0']['#']);\n $answer->flags = backup_todb($answer_info['#']['FLAGS']['0']['#']);\n $answer->timecreated = backup_todb($answer_info['#']['TIMECREATED']['0']['#']);\n $answer->timemodified = backup_todb($answer_info['#']['TIMEMODIFIED']['0']['#']);\n $answer->answer = backup_todb($answer_info['#']['ANSWERTEXT']['0']['#']);\n $answer->response = backup_todb($answer_info['#']['RESPONSE']['0']['#']);\n\n //The structure is equal to the db, so insert the lesson_answers\n $newid = insert_record (\"lesson_answers\",$answer);\n\n //Do some output\n if (($i+1) % 10 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 200 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n // need to store the id so we can update the useranswer\n // field in attempts. This is done in the lesson_pages_restore_mods\n backup_putid($restore->backup_unique_code,\"lesson_answers\", $oldid, $newid); \n\n if ($userdata) {\n //We have to restore the lesson_attempts table now (a answers level table)\n $status = lesson_attempts_restore($lessonid, $pageid, $newid, $answer_info, $restore);\n }\n } else {\n $status = false;\n }\n }\n }\n return $status;\n }",
"public function restored(Testimonials $testimonials)\n {\n //\n }",
"abstract public function revert();",
"public function revert(){\n\t}",
"protected function reset() {}",
"protected function reset() {}",
"protected function reset() {}",
"public function reversal()\n {\n }",
"protected function _resetEverything()\n {\n // Process the formatting strings to prepare the SKU, name, description, and short description\n $this->_sku = $this->_formatString($this->_formatSKU);\n $this->_name = $this->_formatString($this->_formatName);\n $this->_desc = $this->_formatString($this->_formatDesc);\n $this->_shortDesc = $this->_formatString($this->_formatShortDesc);\n // Call the parent implementation\n parent::_resetEverything();\n }"
]
| [
"0.5792206",
"0.5786452",
"0.578095",
"0.5754369",
"0.568435",
"0.5542776",
"0.5418231",
"0.5406629",
"0.5373367",
"0.53665197",
"0.53626835",
"0.53456044",
"0.5249897",
"0.52312374",
"0.51813525",
"0.5166251",
"0.51600045",
"0.5157707",
"0.5156187",
"0.51431817",
"0.513886",
"0.5109438",
"0.51069665",
"0.5084786",
"0.5065052",
"0.5060398",
"0.5059835",
"0.50594234",
"0.5010517",
"0.50088805"
]
| 0.6243859 | 0 |
This function restores the exercise_assessments | function exercise_assessments_restore($new_exercise_id, $new_submission_id,$info,$restore) {
global $CFG;
$status = true;
//Get the assessments array (optional)
if (isset($info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'])) {
$assessments = $info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'];
//Iterate over assessments
for($i = 0; $i < sizeof($assessments); $i++) {
$ass_info = $assessments[$i];
//traverse_xmlize($ass_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//We'll need this later!!
$oldid = backup_todb($ass_info['#']['ID']['0']['#']);
$olduserid = backup_todb($ass_info['#']['USERID']['0']['#']);
//Now, build the exercise_ASSESSMENTS record structure
$assessment->exerciseid = $new_exercise_id;
$assessment->submissionid = $new_submission_id;
$assessment->userid = backup_todb($ass_info['#']['USERID']['0']['#']);
$assessment->timecreated = backup_todb($ass_info['#']['TIMECREATED']['0']['#']);
$assessment->timegraded = backup_todb($ass_info['#']['TIMEGRADED']['0']['#']);
$assessment->grade = backup_todb($ass_info['#']['GRADE']['0']['#']);
$assessment->gradinggrade = backup_todb($ass_info['#']['GRADINGGRADE']['0']['#']);
$assessment->mailed = backup_todb($ass_info['#']['MAILED']['0']['#']);
$assessment->generalcomment = backup_todb($ass_info['#']['GENERALCOMMENT']['0']['#']);
$assessment->teachercomment = backup_todb($ass_info['#']['TEACHERCOMMENT']['0']['#']);
//We have to recode the userid field
$user = backup_getid($restore->backup_unique_code,"user",$olduserid);
if ($user) {
$assessment->userid = $user->new_id;
}
//The structure is equal to the db, so insert the exercise_assessment
$newid = insert_record ("exercise_assessments",$assessment);
//Do some output
if (($i+1) % 50 == 0) {
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br />";
}
}
backup_flush(300);
}
if ($newid) {
//We have the newid, update backup_ids
backup_putid($restore->backup_unique_code,"exercise_assessments",$oldid,
$newid);
//Now we need to restore exercise_grades (user level table)
if ($status) {
$status = exercise_grades_restore_mods ($new_exercise_id, $newid,$ass_info,$restore);
}
} else {
$status = false;
}
}
}
return $status;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function restored(InterviewQuestion $interviewQuestion): void\n {\n //\n }",
"public function restored(Testimonials $testimonials)\n {\n //\n }",
"public function restored(assignment $assignment)\n {\n //code...\n }",
"public function restoring(assignment $assignment)\n {\n //code...\n }",
"public function resetStored()\n\t{\n\t\t$_SESSION[__CLASS__][$this->questionId] = null;\n\t}",
"public function restore() {}",
"public function restore()\n {\n //\n }",
"function exercise_submissions_restore($old_exercise_id, $new_exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the submissions array (teacher submissions)\n $submissions = $info['MOD']['#']['SUBMISSIONS']['0']['#']['SUBMISSION'];\n //Iterate over submissions\n for($i = 0; $i < sizeof($submissions); $i++) {\n $sub_info = $submissions[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($sub_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($sub_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_SUBMISSIONS record structure\n $submission->exerciseid = $new_exercise_id;\n $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);\n $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']);\n $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);\n $submission->resubmit = backup_todb($sub_info['#']['RESUBMIT']['0']['#']);\n $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);\n $submission->isexercise = backup_todb($sub_info['#']['ISEXERCISE']['0']['#']);\n $submission->late = backup_todb($sub_info['#']['LATE']['0']['#']);\n\n // always save the exercise descriptions and optionally the student submissions\n if ($submission->isexercise or restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $submission->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_submission\n $newid = insert_record (\"exercise_submissions\",$submission);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_submissions\",$oldid,\n $newid);\n\n //Now copy moddata associated files\n $status = exercise_restore_files($oldid, $newid,$restore); \n //Now we need to restore exercise_assessments (user level table)\n if ($status and restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n $status = exercise_assessments_restore($new_exercise_id, $newid,$sub_info,$restore);\n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"private function resetAll(){\n $this->score = ['heritage'=> 0,'relax'=> 0,'sightseeing'=> 0,'weather'=> 0,'populated'=> 0];\n $this->answeredQuestions = [];\n $this->answersId = [];\n }",
"public function restore() {\n self::restoreAll($this->chapterID);\n }",
"public function restored(Instructor $instructor)\n {\n //\n }",
"public function restored(PersonalAssignment $personalAssignment)\n {\n //\n }",
"public function restore(User $user, Exercise $exercise)\n {\n //\n }",
"public function restore()\n {\n }",
"public function restore();",
"protected static function restore() {}",
"public function reset()\n {\n $this->values[self::_CURRENT_RAID_ID] = null;\n $this->values[self::_SUMMARY] = array();\n $this->values[self::_STAGE_PASS] = null;\n $this->values[self::_IS_CAN_JUMP] = null;\n }",
"function restore()\n {\n }",
"public function reset()\n {\n $this->values[self::_SUMMARY] = null;\n $this->values[self::_RESULT] = null;\n $this->values[self::_REWARDS] = array();\n $this->values[self::_APPLY_REWARDS] = array();\n $this->values[self::_STAGE_OLD_PROGRESS] = null;\n $this->values[self::_JOIN_TIMES] = null;\n $this->values[self::_BREAK_HISTORY] = null;\n }",
"public function restored(TrainingByTitleDetail $trainingByTitleDetail)\n {\n //\n }",
"public function restored(AssignmentFinishRecord $assignmentFinishRecord)\n {\n //\n }",
"public function restored(Asistencia $asistencia)\n {\n //\n }",
"public function clearAnswers()\n {\n $this->emissions = null;\n $this->cabotage = null;\n $this->trips = null;\n $this->internationalJourneys = null;\n $this->sectors = null;\n $this->updatePermitsRequired(null);\n $this->resetCountrys();\n $this->resetCheckAnswersAndDeclaration();\n }",
"public function restore(User $user, ExamRoom $examRoom)\n {\n //\n }",
"public function save()\n {\n $_SESSION['quiz'][$this->_testId] = serialize($this->_answers);\n }",
"public function restored(Gym $gym)\n {\n //\n }",
"public function resetWorkflow()\n {\n $this->setWorkflowState('approved');\n $workflowHelper = new SurveyManager_Util_Workflow(ServiceUtil::getManager());\n $schemaName = $workflowHelper->getWorkflowName($this['_objectType']);\n $this['__WORKFLOW__'] = array(\n 'module' => 'SurveyManager',\n 'state' => $this['workflowState'],\n 'obj_table' => $this['_objectType'],\n 'obj_idcolumn' => 'id',\n 'obj_id' => 0,\n 'schemaname' => $schemaName);\n }",
"public function reset()\n {\n $this->values[self::_RESULT] = null;\n $this->values[self::_STAGE_ID] = null;\n $this->values[self::_REWARDS] = array();\n $this->values[self::_HEROES] = array();\n }",
"private function restore()\n {\n if ($this->session->has('sergsxm_form_'.$this->formId)) {\n $this->parameters = $this->session->get('sergsxm_form_'.$this->formId);\n } else {\n $this->parameters = array();\n }\n }",
"public function reset()\n {\n $this->values[self::_OPENED_ACT_STAGE] = array();\n }"
]
| [
"0.6294185",
"0.62858266",
"0.6281231",
"0.62416166",
"0.6029512",
"0.60294724",
"0.6026094",
"0.59961265",
"0.5994378",
"0.59780556",
"0.5975691",
"0.5969955",
"0.5967983",
"0.59153354",
"0.5891621",
"0.5887972",
"0.5880483",
"0.5875639",
"0.58158344",
"0.5768288",
"0.57631546",
"0.57600045",
"0.57329226",
"0.5730747",
"0.57288015",
"0.56776917",
"0.5668503",
"0.5656083",
"0.56402594",
"0.5625569"
]
| 0.71317357 | 0 |
This function restores the exercise_grades | function exercise_grades_restore_mods($new_exercise_id, $new_assessment_id,$info,$restore) {
global $CFG;
$status = true;
//Get the grades array (optional)
if (isset($info['#']['GRADES']['0']['#']['GRADE'])) {
$grades = $info['#']['GRADES']['0']['#']['GRADE'];
//Iterate over grades
for($i = 0; $i < sizeof($grades); $i++) {
$gra_info = $grades[$i];
//traverse_xmlize($gra_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the exercise_GRADES record structure
$grade->exerciseid = $new_exercise_id;
$grade->assessmentid = $new_assessment_id;
$grade->elementno = backup_todb($gra_info['#']['ELEMENTNO']['0']['#']);
$grade->feedback = backup_todb($gra_info['#']['FEEDBACK']['0']['#']);
$grade->grade = backup_todb($gra_info['#']['GRADE_VALUE']['0']['#']);
//The structure is equal to the db, so insert the exercise_grade
$newid = insert_record ("exercise_grades",$grade);
//Do some output
if (($i+1) % 50 == 0) {
if (!defined('RESTORE_SILENTLY')) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br />";
}
}
backup_flush(300);
}
if (!$newid) {
$status = false;
}
}
}
return $status;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function exercise_assessments_restore($new_exercise_id, $new_submission_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the assessments array (optional)\n if (isset($info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'])) {\n $assessments = $info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'];\n\n //Iterate over assessments\n for($i = 0; $i < sizeof($assessments); $i++) {\n $ass_info = $assessments[$i];\n //traverse_xmlize($ass_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($ass_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($ass_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_ASSESSMENTS record structure\n $assessment->exerciseid = $new_exercise_id;\n $assessment->submissionid = $new_submission_id;\n $assessment->userid = backup_todb($ass_info['#']['USERID']['0']['#']);\n $assessment->timecreated = backup_todb($ass_info['#']['TIMECREATED']['0']['#']);\n $assessment->timegraded = backup_todb($ass_info['#']['TIMEGRADED']['0']['#']);\n $assessment->grade = backup_todb($ass_info['#']['GRADE']['0']['#']);\n $assessment->gradinggrade = backup_todb($ass_info['#']['GRADINGGRADE']['0']['#']);\n $assessment->mailed = backup_todb($ass_info['#']['MAILED']['0']['#']);\n $assessment->generalcomment = backup_todb($ass_info['#']['GENERALCOMMENT']['0']['#']);\n $assessment->teachercomment = backup_todb($ass_info['#']['TEACHERCOMMENT']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $assessment->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_assessment\n $newid = insert_record (\"exercise_assessments\",$assessment);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_assessments\",$oldid,\n $newid);\n\n //Now we need to restore exercise_grades (user level table) \n if ($status) {\n $status = exercise_grades_restore_mods ($new_exercise_id, $newid,$ass_info,$restore); \n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"public function restored(assignment $assignment)\n {\n //code...\n }",
"public function restoring(assignment $assignment)\n {\n //code...\n }",
"public function restored(Instructor $instructor)\n {\n //\n }",
"public function restore(User $user, Exercise $exercise)\n {\n //\n }",
"public function restored(PersonalAssignment $personalAssignment)\n {\n //\n }",
"function exercise_submissions_restore($old_exercise_id, $new_exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the submissions array (teacher submissions)\n $submissions = $info['MOD']['#']['SUBMISSIONS']['0']['#']['SUBMISSION'];\n //Iterate over submissions\n for($i = 0; $i < sizeof($submissions); $i++) {\n $sub_info = $submissions[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($sub_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($sub_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_SUBMISSIONS record structure\n $submission->exerciseid = $new_exercise_id;\n $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);\n $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']);\n $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);\n $submission->resubmit = backup_todb($sub_info['#']['RESUBMIT']['0']['#']);\n $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);\n $submission->isexercise = backup_todb($sub_info['#']['ISEXERCISE']['0']['#']);\n $submission->late = backup_todb($sub_info['#']['LATE']['0']['#']);\n\n // always save the exercise descriptions and optionally the student submissions\n if ($submission->isexercise or restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $submission->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_submission\n $newid = insert_record (\"exercise_submissions\",$submission);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_submissions\",$oldid,\n $newid);\n\n //Now copy moddata associated files\n $status = exercise_restore_files($oldid, $newid,$restore); \n //Now we need to restore exercise_assessments (user level table)\n if ($status and restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n $status = exercise_assessments_restore($new_exercise_id, $newid,$sub_info,$restore);\n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"public function restore(User $user, ExamRoom $examRoom)\n {\n //\n }",
"public function restore() {\n self::restoreAll($this->chapterID);\n }",
"public function restored(Testimonials $testimonials)\n {\n //\n }",
"public function restored(AssignmentFinishRecord $assignmentFinishRecord)\n {\n //\n }",
"private function resetAll(){\n $this->score = ['heritage'=> 0,'relax'=> 0,'sightseeing'=> 0,'weather'=> 0,'populated'=> 0];\n $this->answeredQuestions = [];\n $this->answersId = [];\n }",
"function restore()\n {\n }",
"public function restored(Student $student)\n {\n //\n }",
"public function restore()\n {\n //\n }",
"function lesson_grades_restore_mods($lessonid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the grades array (optional)\n if (isset($info['MOD']['#']['GRADES']['0']['#']['GRADE'])) {\n $grades = $info['MOD']['#']['GRADES']['0']['#']['GRADE'];\n\n //Iterate over grades\n for($i = 0; $i < sizeof($grades); $i++) {\n $grade_info = $grades[$i];\n //traverse_xmlize($grade_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($grade_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_GRADES record structure\n $grade->lessonid = $lessonid;\n $grade->userid = backup_todb($grade_info['#']['USERID']['0']['#']);\n $grade->grade = backup_todb($grade_info['#']['GRADE_VALUE']['0']['#']);\n $grade->late = backup_todb($grade_info['#']['LATE']['0']['#']);\n $grade->completed = backup_todb($grade_info['#']['COMPLETED']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $grade->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the lesson_grade\n $newid = insert_record (\"lesson_grades\",$grade);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n\n if (!$newid) {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"private function fixGrades( Submission $submission ) {\n\t\tif( $submission->getStateID() == '' ) {\n\t\t\t$this->output->writeln( sprintf( '<fg=red>Submission ID: %d does not have a State ID. So grades were entered in wrong.</fg=red>' , $submission->getId() ) );\n\t\t\treturn;\n\t\t}\n\n\t\t$iNowGrades = $this->getContainer()->get('doctrine')->getRepository('IIABMagnetBundle:StudentGrade')->findGradesByStateID( $submission->getStateID() );\n\n\t\tif( count( $iNowGrades ) == 0 ) {\n\t\t\t$this->output->writeln( sprintf( '<fg=red>Submission ID: %d does not have any grades in iNow</fg=red>' , $submission->getId() ) );\n\t\t\treturn;\n\t\t}\n\n\t\t/** @var \\IIAB\\MagnetBundle\\Entity\\SubmissionGrade $grade */\n\t\tforeach( $submission->getGrades() as $grade ) {\n\n\t\t\t$submission->removeGrade( $grade );\n\n\t\t\t$this->getContainer()->get('doctrine')->getManager()->remove( $grade );\n\t\t}\n\n\t\t$this->output->writeln( sprintf( '<fg=green>Submission ID: %d removed old grades.</fg=green>' , $submission->getId() ) );\n\n\t\t/** @var \\IIAB\\MagnetBundle\\Entity\\StudentGrade $grade */\n\t\tforeach( $iNowGrades as $grade ) {\n\n\t\t\t$submissionGrade = new SubmissionGrade();\n\t\t\t$submissionGrade->setAcademicYear( $grade->getAcademicYear() );\n\t\t\t$submissionGrade->setAcademicTerm( $grade->getAcademicTerm() );\n\t\t\t$submissionGrade->setCourseTypeID( $grade->getCourseTypeID() );\n\t\t\t$submissionGrade->setCourseType( $grade->getCourseType() );\n\t\t\t$submissionGrade->setCourseName( $grade->getCourseName() );\n\t\t\t$submissionGrade->setSectionNumber( $grade->getSectionNumber() );\n\t\t\t$submissionGrade->setNumericGrade( $grade->getNumericGrade() );\n\n\t\t\t$submission->addGrade( $submissionGrade );\n\n\t\t\t$this->getContainer()->get('doctrine')->getManager()->persist( $submissionGrade );\n\n\t\t}\n\n\t\t$this->getContainer()->get('doctrine')->getManager()->flush();\n\t\t$this->output->writeln( sprintf( '<fg=green>Submission ID: %d grades were updated.</fg=green>' , $submission->getId() ) );\n\n\t}",
"public function restore()\n {\n }",
"function questionnaire_reset_userdata($data) {\n global $CFG, $DB;\n require_once($CFG->libdir . '/questionlib.php');\n require_once($CFG->dirroot.'/mod/questionnaire/locallib.php');\n\n $componentstr = get_string('modulenameplural', 'questionnaire');\n $status = array();\n\n if (!empty($data->reset_questionnaire)) {\n $surveys = questionnaire_get_survey_list($data->courseid, $type = '');\n\n // Delete responses.\n foreach ($surveys as $survey) {\n // Get all responses for this questionnaire.\n $sql = \"SELECT R.id, R.survey_id, R.submitted, R.username\n FROM {questionnaire_response} R\n WHERE R.survey_id = ?\n ORDER BY R.id\";\n $resps = $DB->get_records_sql($sql, array($survey->id));\n if (!empty($resps)) {\n $questionnaire = $DB->get_record(\"questionnaire\", array(\"sid\" => $survey->id));\n $questionnaire->course = $DB->get_record(\"course\", array(\"id\" => $questionnaire->course));\n foreach ($resps as $response) {\n questionnaire_delete_response($response, $questionnaire);\n }\n }\n // Remove this questionnaire's grades (and feedback) from gradebook (if any).\n $select = \"itemmodule = 'questionnaire' AND iteminstance = \".$survey->qid;\n $fields = 'id';\n if ($itemid = $DB->get_record_select('grade_items', $select, null, $fields)) {\n $itemid = $itemid->id;\n $DB->delete_records_select('grade_grades', 'itemid = '.$itemid);\n\n }\n }\n $status[] = array(\n 'component' => $componentstr,\n 'item' => get_string('deletedallresp', 'questionnaire'),\n 'error' => false);\n\n $status[] = array(\n 'component' => $componentstr,\n 'item' => get_string('gradesdeleted', 'questionnaire'),\n 'error' => false);\n }\n return $status;\n}",
"function dataform_update_grades($data=null, $userid=0, $nullifnone=true, $grades=null) {\n global $CFG, $DB;\n require_once(\"$CFG->libdir/gradelib.php\");\n\n if ($data != null) {\n if ($data->grade) {\n if ($grades or $grades = dataform_get_user_grades($data, $userid)) {\n dataform_grade_item_update($data, $grades);\n\n } else if ($userid and $nullifnone) {\n $grade = new object();\n $grade->userid = $userid;\n $grade->rawgrade = NULL;\n dataform_grade_item_update($data, $grade);\n\n } else {\n dataform_grade_item_update($data);\n }\n } else {\n dataform_grade_item_delete($data);\n }\n }\n}",
"public function restore() {}",
"function lesson_attempts_restore($lessonid, $pageid, $answerid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the attempts array (optional)\n if (isset($info['#']['ATTEMPTS']['0']['#']['ATTEMPT'])) {\n $attempts = $info['#']['ATTEMPTS']['0']['#']['ATTEMPT'];\n //Iterate over attempts\n for($i = 0; $i < sizeof($attempts); $i++) {\n $attempt_info = $attempts[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($attempt_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_attempts record structure\n $attempt->lessonid = $lessonid;\n $attempt->pageid = $pageid;\n $attempt->answerid = $answerid;\n $attempt->userid = backup_todb($attempt_info['#']['USERID']['0']['#']);\n $attempt->retry = backup_todb($attempt_info['#']['RETRY']['0']['#']);\n $attempt->correct = backup_todb($attempt_info['#']['CORRECT']['0']['#']);\n $attempt->useranswer = backup_todb($attempt_info['#']['USERANSWER']['0']['#']);\n $attempt->timeseen = backup_todb($attempt_info['#']['TIMESEEN']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $attempt->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the lesson_attempt\n $newid = insert_record (\"lesson_attempts\",$attempt);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n }\n }\n\n return $status;\n }",
"public function restored(InterviewQuestion $interviewQuestion): void\n {\n //\n }",
"abstract protected function _restoreStandardValues();",
"public function reset()\n {\n $this->values[self::_SKILL_LEVEL_UP] = null;\n }",
"public function restored(Gym $gym)\n {\n //\n }",
"public function restored(QuizRegister $quizRegister)\n {\n //\n }",
"public function restored(Expense $expense)\n {\n //\n }",
"public function restore();",
"protected static function restore() {}"
]
| [
"0.6324801",
"0.62449604",
"0.6115566",
"0.600716",
"0.59721863",
"0.59225106",
"0.59095603",
"0.5864436",
"0.5838307",
"0.5801615",
"0.5688602",
"0.56801236",
"0.5669299",
"0.56603",
"0.56298095",
"0.5620554",
"0.5620079",
"0.5553733",
"0.55499816",
"0.55031914",
"0.5497563",
"0.54896396",
"0.5486221",
"0.5484033",
"0.54801625",
"0.54726094",
"0.5463279",
"0.54558724",
"0.5452727",
"0.5439623"
]
| 0.6457978 | 0 |
This function copies the exercise related info from backup temp dir to course moddata folder, creating it if needed and recoding everything (submission_id) | function exercise_restore_files ($oldsubmiss, $newsubmiss, $restore) {
global $CFG;
$status = true;
$todo = false;
$moddata_path = "";
$exercise_path = "";
$temp_path = "";
//First, we check to "course_id" exists and create is as necessary
//in CFG->dataroot
$dest_dir = $CFG->dataroot."/".$restore->course_id;
$status = check_dir_exists($dest_dir,true);
//Now, locate course's moddata directory
$moddata_path = $CFG->dataroot."/".$restore->course_id."/".$CFG->moddata;
//Check it exists and create it
$status = check_dir_exists($moddata_path,true);
//Now, locate exercise directory
if ($status) {
$exercise_path = $moddata_path."/exercise";
//Check it exists and create it
$status = check_dir_exists($exercise_path,true);
}
//Now locate the temp dir we are gong to restore
if ($status) {
$temp_path = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code.
"/moddata/exercise/".$oldsubmiss;
//Check it exists
if (is_dir($temp_path)) {
$todo = true;
}
}
//If todo, we create the neccesary dirs in course moddata/exercise
if ($status and $todo) {
//First this exercise id
$this_exercise_path = $exercise_path."/".$newsubmiss;
$status = check_dir_exists($this_exercise_path,true);
//And now, copy temp_path to this_exercise_path
$status = backup_copy_file($temp_path, $this_exercise_path);
}
return $status;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function exercise_submissions_restore($old_exercise_id, $new_exercise_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the submissions array (teacher submissions)\n $submissions = $info['MOD']['#']['SUBMISSIONS']['0']['#']['SUBMISSION'];\n //Iterate over submissions\n for($i = 0; $i < sizeof($submissions); $i++) {\n $sub_info = $submissions[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($sub_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($sub_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_SUBMISSIONS record structure\n $submission->exerciseid = $new_exercise_id;\n $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);\n $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']);\n $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);\n $submission->resubmit = backup_todb($sub_info['#']['RESUBMIT']['0']['#']);\n $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);\n $submission->isexercise = backup_todb($sub_info['#']['ISEXERCISE']['0']['#']);\n $submission->late = backup_todb($sub_info['#']['LATE']['0']['#']);\n\n // always save the exercise descriptions and optionally the student submissions\n if ($submission->isexercise or restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $submission->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_submission\n $newid = insert_record (\"exercise_submissions\",$submission);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_submissions\",$oldid,\n $newid);\n\n //Now copy moddata associated files\n $status = exercise_restore_files($oldid, $newid,$restore); \n //Now we need to restore exercise_assessments (user level table)\n if ($status and restore_userdata_selected($restore,'exercise',$old_exercise_id)) {\n $status = exercise_assessments_restore($new_exercise_id, $newid,$sub_info,$restore);\n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"function shared_files_assignment_file_submission($entry, $assignment) {\r\n/// Copies a file to the teacher's assignment directory for that course\r\n\tglobal $CFG, $USER;\r\n\t$pathnew = \"$assignment->course/moddata/assignment/$assignment->id/$USER->id\";\r\n\t$pathold = \"$CFG->dataroot/shared_files/users/$entry->userid\";\r\n\r\n\tmake_upload_directory($pathnew);\r\n\r\n\tif (!copy(\"$pathold/$entry->attachment\", \"$CFG->dataroot/$pathnew/$entry->attachment\")) {\r\n\t\terror (\"Failed to copy file!\", \"view.php?id={$id}&rootdir={$rootdir}\");\r\n\t}\r\n}",
"public function save_settings(stdClass $data) {\r\n global $USER, $DB;\r\n\r\n //$data = (object) array_merge((array) $data, (array) $mydata); \r\n\r\n $this->set_config('defaultproglang', $data->assignsubmission_codehandin_proglang);\r\n $this->set_config('mustattemptcompile', $data->assignsubmission_codehandin_mustattemptcompile);\r\n $assignmentid = $this->assignment->get_instance()->id; //should exists by now\r\n //$assignmentid = 0;\r\n //echo var_dump($data);\r\n\r\n $context = $this->assignment->get_context();\r\n $course = $this->assignment->get_course();\r\n\r\n file_save_draft_area_files($data->assignsubmission_codehandin_testinput, $context->id, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, (7000000000 + $assignmentid), array(\r\n 'subdirs' => 0,\r\n 'maxbytes' => $course->maxbytes,\r\n 'maxfiles' => 1,\r\n 'accepted_types' => '*'\r\n ));\r\n\r\n file_save_draft_area_files($data->assignsubmission_codehandin_testoutput, $context->id, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, (8000000000 + $assignmentid), array(\r\n 'subdirs' => 0,\r\n 'maxbytes' => $course->maxbytes,\r\n 'maxfiles' => 1,\r\n 'accepted_types' => '*'\r\n ));\r\n\r\n file_save_draft_area_files($data->assignsubmission_codehandin_teststderr, $context->id, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, (9000000000 + $assignmentid), array(\r\n 'subdirs' => 0,\r\n 'maxbytes' => $course->maxbytes,\r\n 'maxfiles' => 1,\r\n 'accepted_types' => '*'\r\n ));\r\n\r\n// $codehandin = new stdClass();\r\n// $codehandin->id = $assignmentid;\r\n// $codehandin->mustattemptcompile = $data->assignsubmission_codehandin_mustattemptcompile;\r\n// $codehandin->proglang = $data->assignsubmission_codehandin_proglang;\r\n //$DB->insert_record(\"codehandin\", $codehandin);\r\n\r\n $codehandin_cp = new stdClass();\r\n $codehandin_cp->assignmentid = $assignmentid;\r\n $codehandin_cp->name = $data->assignsubmission_codehandin_cpname;\r\n $codehandin_cp->description = $data->assignsubmission_codehandin_cpdescription;\r\n $codehandin_cp->runtimeargs = $data->assignsubmission_codehandin_cpruntimeargs;\r\n $codehandin_cp->ordering = $data->assignsubmission_codehandin_cpordering;\r\n $cpid = $DB->insert_record(\"codehandin_checkpoint\", $codehandin_cp, true, false);\r\n\r\n $this->get_codehandin_submission_assignfiles($assignmentid);\r\n $this->get_codehandin_submission_assignfiles(0);\r\n\r\n $codehandin_test = new stdClass();\r\n $codehandin_test->checkpointid = $cpid;\r\n $codehandin_test->description = $data->assignsubmission_codehandin_testdescription;\r\n $codehandin_test->assessment = $data->assignsubmission_codehandin_testassessment;\r\n $codehandin_test->input = 0; //$data->assignsubmission_codehandin_testinput;\r\n $codehandin_test->output = 0; //$data->assignsubmission_codehandin_testoutput;\r\n $codehandin_test->stderr = 0; //$data->assignsubmission_codehandin_teststderr;\r\n $codehandin_test->retval = $data->assignsubmission_codehandin_testretval;\r\n $DB->insert_record(\"codehandin_test\", $codehandin_test, false, false);\r\n //$DB->update_record('glossary_entries', $entry);\r\n\r\n return true;\r\n }",
"function readdata($filename) {\n global $CFG;\n \n $unique_code = time();\n $temp_dir = $CFG->dataroot.\"/temp/webworkquiz_import/\".$unique_code;\n $this->temp_dir = $temp_dir;\n //failures we cannot handle\n if (!$this->check_and_create_import_dir($unique_code)) {\n error(\"Could not create temporary directory\");\n return;\n }\n if(!is_readable($filename)) {\n error (\"Could not read uploaded file\");\n return;\n }\n if (!copy($filename, \"$temp_dir/webwork.zip\")) {\n error(\"Could not copy backup file\");\n return;\n }\n if(!unzip_file(\"$temp_dir/webwork.zip\", '', false)) {\n print \"filename: $filename<br />tempdir: $temp_dir <br />\";\n error(\"Could not unzip file.\");\n return; \n }\n $data = array();\n //open the directory\n $this->process_directory($data,$temp_dir);\n return $data;\n }",
"public function sword_submissions($assignment_type,$submissions_id, $swordid) {\n global $CFG,$DB;\n require_once($CFG->libdir.'/filelib.php');\n\t\n \n $submissions=$DB->get_records(\"assignment_submissions\", array(\"assignment\"=>$assignment_type->assignment->id));\n $select_submissions = array();\n foreach ($submissions as $submission) {\n if (in_array($submission->id,$submissions_id)) { \n $select_submissions[]=$submission;\n }\n }\n \n \n \n $context = context_module::instance($assignment_type->assignment->id);\n\t\n $fs = get_file_storage();\n\n $groupmode = groups_get_activity_groupmode($assignment_type->cm);\n $groupid = 0; // All users\n $groupname = '';\n \n if ($groupmode) {\n $groupid = groups_get_activity_group($$assignment_type->cm, true);\n $groupname = groups_get_group_name($groupid).'-';\n }\n $error = false;\n \n $cm_sword = get_coursemodule_from_id('sword', $swordid, 0, false, MUST_EXIST);\n $sword=$DB->get_record('sword', array('id' => $cm_sword->instance));\n \n foreach ($select_submissions as $submission) {\n \n $a_userid = $submission->userid; //get userid\n if ((groups_is_member($groupid,$a_userid)or !$groupmode or !$groupid)) { \n \n \n $files = $fs->get_area_files($assignment_type->context->id, 'mod_assignment', 'submission', $submission->id, \"timemodified\", false);\n $arr=NULL;\n foreach ($files as $file) {\n if($file) {\n $filetitle=$file->get_filename();\n $newstring = substr($filetitle, -3);\n if($newstring==\"txt\"){\n $contents = $file->get_content();\n $arr = explode(\"\\n\", $contents); \n } \n \n $this->copyFileToTemp($file);\n \n $paquete = $this->makePackage($files, $sword, $arr, $a_userid, $assignment_type->assignment->id);\n \n $resultado = $this->sendToRepository($paquete,$submission->id, $sword);;\n $error = $error || $resultado;\n }\n \n\n }\n \n }\n } \n \n if ($error==true) {\n\t echo get_string('msg_error', 'sword');\n } else {\n\t echo get_string('msg_send', 'sword');\n }\n \n }",
"function doArchive($course_id, $course_code) {\n global $webDir, $tool_content, $langGeneralError;\n\n // Remove previous back-ups older than 10 minutes\n touch(\"$webDir/courses/archive/index.html\");\n cleanup(\"$webDir/courses/archive\", 600);\n\n $basedir = \"$webDir/courses/archive/$_SESSION[csrf_token]/$course_code\";\n file_exists($basedir) or make_dir($basedir);\n\n $backup_date = date('Ymd-His');\n $backup_date_short = date('Ymd');\n\n $archivedir = $basedir . '/' . $backup_date;\n file_exists($archivedir) or make_dir($archivedir);\n\n archiveTables($course_id, $course_code, $archivedir);\n\n $zipfile = \"$webDir/courses/archive/$_SESSION[csrf_token]/$course_code-$backup_date_short.zip\";\n if (file_exists($zipfile)) {\n unlink($zipfile);\n }\n\n // create zip file\n $zip = new ZipArchive;\n if ($zip->open($zipfile, ZipArchive::CREATE) !== true) {\n //Session::Messages($langGeneralError, 'alert-danger');\n Session::flash('message',$langGeneralError);\n Session::flash('alert-class', 'alert-danger');\n redirect_to_home_page('modules/course_info/index.php?course=' . $course_code);\n }\n $result = $zip->addGlob($archivedir . '/*', GLOB_NOSORT, [\n 'remove_path' => \"$webDir/courses/archive/$_SESSION[csrf_token]\" ]) &&\n addDir($zip, \"$webDir/courses/$course_code\", \"$course_code/$backup_date/html\") &&\n addDir($zip, \"$webDir/video/$course_code\", \"$course_code/$backup_date/video_files\");\n $zip->close();\n removeDir($basedir);\n\n if (!$result) {\n //Session::Messages($langGeneralError, 'alert-danger');\n Session::flash('message',$langGeneralError);\n Session::flash('alert-class', 'alert-danger');\n redirect_to_home_page('modules/course_info/index.php?course=' . $course_code);\n }\n\n return $zipfile;\n}",
"function exercise_assessments_restore($new_exercise_id, $new_submission_id,$info,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the assessments array (optional)\n if (isset($info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'])) {\n $assessments = $info['#']['ASSESSMENTS']['0']['#']['ASSESSMENT'];\n\n //Iterate over assessments\n for($i = 0; $i < sizeof($assessments); $i++) {\n $ass_info = $assessments[$i];\n //traverse_xmlize($ass_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $oldid = backup_todb($ass_info['#']['ID']['0']['#']);\n $olduserid = backup_todb($ass_info['#']['USERID']['0']['#']);\n\n //Now, build the exercise_ASSESSMENTS record structure\n $assessment->exerciseid = $new_exercise_id;\n $assessment->submissionid = $new_submission_id;\n $assessment->userid = backup_todb($ass_info['#']['USERID']['0']['#']);\n $assessment->timecreated = backup_todb($ass_info['#']['TIMECREATED']['0']['#']);\n $assessment->timegraded = backup_todb($ass_info['#']['TIMEGRADED']['0']['#']);\n $assessment->grade = backup_todb($ass_info['#']['GRADE']['0']['#']);\n $assessment->gradinggrade = backup_todb($ass_info['#']['GRADINGGRADE']['0']['#']);\n $assessment->mailed = backup_todb($ass_info['#']['MAILED']['0']['#']);\n $assessment->generalcomment = backup_todb($ass_info['#']['GENERALCOMMENT']['0']['#']);\n $assessment->teachercomment = backup_todb($ass_info['#']['TEACHERCOMMENT']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $assessment->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the exercise_assessment\n $newid = insert_record (\"exercise_assessments\",$assessment);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br />\";\n }\n }\n backup_flush(300);\n }\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,\"exercise_assessments\",$oldid,\n $newid);\n\n //Now we need to restore exercise_grades (user level table) \n if ($status) {\n $status = exercise_grades_restore_mods ($new_exercise_id, $newid,$ass_info,$restore); \n }\n } else {\n $status = false;\n }\n }\n }\n\n return $status;\n }",
"function importpostprocess() {\n /// Argument is a simple array of question ids that \n /// have just been added.\n \n // need to clean up temporary directory\n return $this->clean_temp_dir();\n }",
"function copyTestCases(&$smartyObj,$template_dir,&$tsuiteMgr,&$tcaseMgr,$argsObj)\r\n{\r\n $op = array('refreshTree' => false, 'userfeedback' => '');\r\n if( ($qty=sizeof($argsObj->tcaseSet)) > 0)\r\n {\r\n $msg_id = $qty == 1 ? 'one_testcase_copied' : 'testcase_set_copied';\r\n $op['userfeedback'] = sprintf(lang_get($msg_id),$qty);\r\n\r\n $copyOpt = array('check_duplicate_name' => config_get('check_names_for_duplicates'),\r\n 'action_on_duplicate_name' => config_get('action_on_duplicate_name'),\r\n 'stepAsGhost' => $argsObj->stepAsGhost);\r\n $copyOpt['copy_also'] = array('keyword_assignments' => $argsObj->copyKeywords,\r\n 'requirement_assignments' => $argsObj->copyRequirementAssignments);\r\n\r\n $copy_op =array();\r\n foreach($argsObj->tcaseSet as $key => $tcaseid)\r\n {\r\n $copy_op[$tcaseid] = $tcaseMgr->copy_to($tcaseid, $argsObj->containerID, $argsObj->userID, $copyOpt);\r\n }\r\n $guiObj = new stdClass();\r\n $guiObj->attachments = getAttachmentInfosFrom($tsuiteMgr,$argsObj->objectID);\r\n $guiObj->id = $argsObj->objectID;\r\n $guiObj->refreshTree = true;\r\n $op['refreshTree'] = true;\r\n }\r\n return $op;\r\n}",
"function ipal_save_student_response($question_id, $answer_id, $active_question_id,$a_text,$instructor){\r\n\tglobal $ipal;\r\n\tglobal $DB;\r\n\tglobal $CFG;\r\n\tglobal $USER;\r\n\tglobal $course;\r\n\r\n// Create insert for archive\r\n\t$record_arc = new stdClass();\r\n\t$record_arc->id = '';\r\n\t$record_arc->user_id = $USER->id;\r\n\t$record_arc->question_id = $question_id;\r\n\t$record_arc->quiz_id = $ipal->id;\r\n\t$record_arc->answer_id = $answer_id;\r\n\t$record_arc->a_text = $a_text;\r\n\t$record_arc->class_id = $course->id;\r\n\t$record_arc->ipal_id = $ipal->id;\r\n\t$record_arc->ipal_code = '1';\r\n\t$record_arc->shortname = $course->shortname;\r\n\t$record_arc->instructor = $instructor;\r\n\t$record_arc->time_created = time();\r\n\t$lastinsertid = $DB->insert_record('ipal_answered_archive', $record_arc);\r\n\r\n//Create insert for current question\r\n $record = new stdClass();\r\n $record->id = '';\r\n $record->user_id = $USER->id;\r\n $record->question_id = $question_id;\r\n $record->quiz_id = $ipal->id;\r\n $record->answer_id = $answer_id;\r\n $record->a_text = $a_text;\r\n $record->class_id = $course->id;\r\n $record->ipal_id = $ipal->id;\r\n $record->ipal_code = $active_question_id;\r\n $record->time_created = time();\r\n\r\n if($DB->record_exists('ipal_answered', array('user_id'=>$USER->id, 'question_id'=>$question_id, 'ipal_id'=>$ipal->id ))){\r\n$mybool=$DB->delete_records('ipal_answered', array('user_id'=>$USER->id, 'question_id'=>$question_id, 'ipal_id'=>$ipal->id ));\r\n}\r\n $lastinsertid = $DB->insert_record('ipal_answered', $record);\r\n\r\n}",
"function tmpToDB($temp_file, $dbcon){\n\t\t$courseid = 150;\n\t\t$questionBank = array();\n\t\t$index = 0;\t\t\n\t\t$questionFile = fopen($temp_file, \"r\") or die(\"file not found\");\n\t\t//iterate over question document, check if it is a question or an answer. add to appropriate array.\t\n\t\twhile(!feof($questionFile)){\t\n\t\t\t$line = fgets($questionFile);\n\n\t\t\t//find chapter number\n\t\t\tif(strpos($line,\"Chapter \")!==FALSE){\n\t\t\t\t$lineArray = explode(\" \", $line);\n\t\t\t\t$insertChapter = $lineArray[1];\n\t\t\t}\n\t\t\t\n\t\t\t//check if it's a question\n\t\t\tif(is_numeric(substr($line,0,1))){\n\t\t\t\t$question = substr($line,3);\n\t\t\t\t$question = trim($question, ' \\0\\t\\n\\x0b\\r');\n\t\t\t\t$questionBank[\"question\"] = $question;\n\t\t\t}\n\t\t\t//check if it's a possible answer operates under the assumption a b c and d are the only choices.\n\t\t\t//can probably spruce this up a little nicer. cascading switch statement maybe?\n\t\t\tif(strtoupper(substr($line,0,2)) == 'A)' | strtoupper(substr($line,0,2)) == 'B)' | strtoupper(substr($line,0,2)) == 'C)' | strtoupper(substr($line,0,2)) == 'D)'){\n\t\t\t\t$choice = strtoupper(substr($line,0,1));\n\t\t\t\t$choice = trim($choice, ' \\0\\t\\n\\x0b\\r');\n\t\t\t\t$choices[$choice] = substr($line,3);\n\t\t\t\t$questionBank[\"choices\"] = $choices;\t\t\t\n\t\t\t}\n\t\t\t//assign questions, choices and answers to question bank.\n\t\t\tif(strtoupper(substr($line,0,6)) == \"ANSWER\"){\n\t\t\t\t$answer= substr($line,7,8);\n\t\t\t\t$answer = trim($answer, ' \\0\\t\\n\\x0b\\r');\n\t\t\t\t//php seems to require this before it recognizes A as A.\n\t\t\t\t$a = ord($answer);\n\t\t\t\t$a = chr($a);\n\t\t\t\t//remove $index when loading into db.\n\t\t\t\t$questionBank[\"question\"] = $question;\n\t\t\t\t$questionBank[\"choices\"] = $choices;\n\t\t\t\t$questionBank[\"answer\"] = $answer;\n\t\t\t\n\t\t\t\t//TODO database tom foolery\n\t\t\t\t//insert statements to questiontable.\n\t\t\t\t\n\t\t\t\t//bound params\n\t\t\t\t//$stmt = $dbcon->prepare(\"INSERT INTO db.table (question, chapter, courseid)) VALUES(?,?)\");\n\t\t\t\t//$stmt->bind_param(\"data_types\",$insertQuestion, $insertChaper);\n\t\t\t\t\n\t\t\t\t//PDO prefer to use this\n\t\t\t\t$insertQuestion = json_encode($questionBank);\n\t\t\t\t$stmt = $dbcon->prepare(\"INSERT INTO question (questionid, question, chapter, courseid) VALUES (null, :question, :chapter, :courseid)\");\n\t\t\t\t$stmt->bindParam(':question', $insertQuestion);\n\t\t\t\t$stmt->bindParam(':chapter', $insertChapter);\n\t\t\t\t$stmt->bindParam(':courseid', $courseid);\n\t\t\t\tif($stmt->execute()){\n\t\t\t\t\t$index+=1;\n\t\t\t\t}else{\n\t\t\t\t\techo 'error <br>';\n\t\t\t\t\t$arr = $stmt->errorInfo();\n\t\t\t\t\tprint_r($arr);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//close db connection\n\t\t$conn=null;\n\t\t//close file\n\t\tfclose($questionFile);\n\t\techo $index . \" questions uploaded for chapter \" . $insertChapter . \" on course: \" . $courseid;\n\t\t//this is only for debug purposes, uncomment PDO statements when ready.\n\t\t//$qbjson = json_encode($questionBank);\n\t\t//echo $qbjson;\n\n\t}",
"function copyTestSuite(&$smartyObj,$template_dir,&$tsuiteMgr,$argsObj,$l18n)\r\n{\r\n $guiObj = new stdClass();\r\n $guiObj->btn_reorder_testcases = $l18n['btn_reorder_testcases'];;\r\n\r\n $exclude_node_types=array('testplan' => 1, 'requirement' => 1, 'requirement_spec' => 1);\r\n \r\n $options = array();\r\n $options['check_duplicate_name'] = config_get('check_names_for_duplicates');\r\n $options['action_on_duplicate_name'] = config_get('action_on_duplicate_name');\r\n $options['copyKeywords'] = $argsObj->copyKeywords;\r\n $options['copyRequirements'] = $argsObj->copyRequirementAssignments;\r\n\r\n\r\n // copy_to($source,$destination,...)\r\n $op = $tsuiteMgr->copy_to($argsObj->objectID, $argsObj->containerID, $argsObj->userID,$options);\r\n if( $op['status_ok'] )\r\n {\r\n $tsuiteMgr->tree_manager->change_child_order($argsObj->containerID,$op['id'],\r\n $argsObj->target_position,$exclude_node_types);\r\n\r\n\r\n // get info to provide feedback\r\n $dummy = $tsuiteMgr->tree_manager->get_node_hierarchy_info(array($argsObj->objectID, $argsObj->containerID));\r\n\r\n $msgk = $op['name_changed'] ? 'tsuite_copied_ok_name_changed' : 'tsuite_copied_ok';\r\n $guiObj->user_feedback = sprintf(lang_get($msgk),$dummy[$argsObj->objectID]['name'],\r\n $dummy[$argsObj->containerID]['name'],$op['name']);\r\n }\r\n $guiObj->refreshTree = $op['status_ok'] && $argsObj->refreshTree;\r\n $guiObj->attachments = getAttachmentInfosFrom($tsuiteMgr,$argsObj->objectID);\r\n $guiObj->id = $argsObj->objectID;\r\n $guiObj->treeFormToken = $guiObj->form_token = $argsObj->treeFormToken;\r\n \r\n $guiObj->direct_link = $tsuiteMgr->buildDirectWebLink($_SESSION['basehref'],\r\n $guiObj->id,$argsObj->tprojectID);\r\n\r\n $tsuiteMgr->show($smartyObj,$guiObj,$template_dir,$argsObj->objectID,null,'ok');\r\n\r\n return $op['status_ok'];\r\n}",
"function local_ltiprovider_duplicate_module( $cmid, $courseid, $newidnumber, $lticontext ) {\n global $CFG, $DB, $USER;\n\n require_once( $CFG->dirroot . '/backup/util/includes/backup_includes.php' );\n require_once( $CFG->dirroot . '/backup/util/includes/restore_includes.php' );\n require_once( $CFG->libdir . '/filelib.php' );\n\n if ( empty( $USER ) ) {\n // Emulate session.\n cron_setup_user();\n }\n\n $course = $DB->get_record( 'course', array( 'id' => $courseid ), '*', MUST_EXIST );\n $cm = get_coursemodule_from_id( '', $cmid, 0, true, MUST_EXIST );\n $cmcontext = context_module::instance( $cm->id );\n $context = context_course::instance( $course->id );\n\n\n if ( ! plugin_supports( 'mod', $cm->modname, FEATURE_BACKUP_MOODLE2 ) ) {\n $url = course_get_url( $course, $cm->sectionnum );\n print_error( 'duplicatenosupport', 'error', $url );\n }\n\n // backup the activity\n $admin = get_admin();\n\n $bc = new backup_controller( backup::TYPE_1ACTIVITY, $cm->id, backup::FORMAT_MOODLE,\n backup::INTERACTIVE_NO, backup::MODE_IMPORT, $admin->id );\n\n $backupid = $bc->get_backupid();\n $backupbasepath = $bc->get_plan()->get_basepath();\n\n $bc->execute_plan();\n\n $bc->destroy();\n\n // restore the backup immediately\n\n $rc = new restore_controller( $backupid, $courseid,\n backup::INTERACTIVE_NO, backup::MODE_IMPORT, $admin->id, backup::TARGET_CURRENT_ADDING );\n\n if ( ! $rc->execute_precheck() ) {\n $precheckresults = $rc->get_precheck_results();\n if ( is_array( $precheckresults ) && ! empty( $precheckresults['errors'] ) ) {\n if ( empty( $CFG->keeptempdirectoriesonbackup ) ) {\n fulldelete( $backupbasepath );\n }\n print_r( $precheckresults );\n die();\n }\n }\n\n $rc->execute_plan();\n\n $newcmid = null;\n $tasks = $rc->get_plan()->get_tasks();\n foreach ( $tasks as $task ) {\n if ( is_subclass_of( $task, 'restore_activity_task' ) ) {\n if ( $task->get_old_contextid() == $cmcontext->id ) {\n $newcmid = $task->get_moduleid();\n break;\n }\n }\n }\n\n $rc->destroy();\n\n\n if ( ! $DB->get_record( 'course_modules', array( 'idnumber' => $newidnumber ) ) ) {\n if ( $module = $DB->get_record( 'course_modules', array( 'id' => $newcmid ) ) ) {\n $module->idnumber = $newidnumber;\n $DB->update_record( 'course_modules', $module );\n }\n } else {\n if ( empty( $CFG->keeptempdirectoriesonbackup ) ) {\n fulldelete( $backupbasepath );\n }\n\n return $newcmid;\n }\n\n\n $newtoolid = 0;\n $newcmcontext = context_module::instance( $newcmid );\n if ( $tools = $DB->get_records( 'local_ltiprovider', array( 'contextid' => $cmcontext->id ) ) ) {\n foreach ( $tools as $tool ) {\n $tool->courseid = $course->id;\n $tool->contextid = $newcmcontext->id;\n $newtoolid = $DB->insert_record( 'local_ltiprovider', $tool );\n }\n }\n\n if ( ! $newtoolid ) {\n $tool = local_ltiprovider_create_tool( $course->id, $newcmcontext->id, $lticontext );\n }\n\n if ( empty( $CFG->keeptempdirectoriesonbackup ) ) {\n fulldelete( $backupbasepath );\n }\n\n return $newcmid;\n\n}",
"public function save(stdClass $submission, stdClass $data) {\n global $USER, $DB, $OUTPUT;\n\n $assignmentid = $this->assignment->get_instance()->id;\n $submissionid = $submission->id;\n\n\n // Rely upon the files uploaded by the mod_assign_submission_file; let's not\n // reinvent the wheel.\n $fs = get_file_storage();\n $files = $fs->get_area_files($this->assignment->get_context()->id,\n 'assignsubmission_file',\n ASSIGNSUBMISSION_FILE_FILEAREA,\n $submission->id,\n 'id',\n false);\n\n\n $count = count($files);\n\n $result = array();\n $requests = array();\n $filenames = array();\n\n $records = array();\n $updaterecords = array();\n foreach ($files as $file) {\n\n $filenamenoext = pathinfo($file->get_filename())['filename'];\n\n $sketchfab_data = array(\n 'token' => $data->sketchfab_api_token,\n 'modelFileName' => $file->get_filename(),\n 'modelFile' => $file,\n 'name' => $filenamenoext,\n 'description' => 'Automatically uploaded from Moodle.'\n );\n $requests[$file->get_filename()] = $sketchfab_data;\n\n $curlrequest = new curl();\n $curlsuccess = $curlrequest->post(\n $data->sketchfab_api_url,\n $sketchfab_data,\n array(\n 'CURLOPT_RETURNTRANSFER' => 1\n )\n );\n\n $curlmetadata = new stdClass();\n $curlmetadata->success = $curlsuccess;\n $curlmetadata->errno = $curlrequest->errno;\n $curlmetadata->error = $curlrequest->error;\n $curlmetadata->response = $curlrequest->response;\n\n $sketchfabUID = \"\";\n\n // Did the request succeed?\n if (!empty($curlsuccess)) {\n // Parse JSON for the unique ID.\n $sketchfabUID = json_decode($curlsuccess, true)[\"uid\"];\n }\n $result[$file->get_filename()] = $sketchfabUID;\n\n // Build a record and add it to a list.\n $record = array(\n 'assignment' => $assignmentid,\n 'submission' => $submissionid,\n 'model' => $sketchfabUID\n );\n $records[] = $record;\n }\n\n\n // @todo: Stop making the baby robot Jesus cry.\n // Delete existing rows for this user's submission.\n $DB->delete_records(\n SKETCHFAB_DB_TABLE,\n array(\n 'assignment' => $assignmentid,\n 'submission' => $submissionid\n )\n );\n\n // Add new rows for this user's submission.\n $DB->insert_records(SKETCHFAB_DB_TABLE, $records);\n\n\n return true;\n }",
"private function copyFileToTemp($file) \n {\n @mkdir(sys_get_temp_dir().'/moodle');\n $tempFile=@fopen(sys_get_temp_dir().'/moodle/'. $file->get_filename(),\"wb\"); \n if ($tempFile ) {\n fwrite($tempFile,$file->get_content());\n fclose($tempFile); \n } \n }",
"function backup($bf, $preferences, $question, $level = 6) {\n //print('backup()');\n $status = true;\n $multichoices = get_records(\"question_turprove\", \"question\", $question, \"id\");\n //If there are multichoices\n if ($multichoices) {\n //Iterate over each multichoice\n foreach ($multichoices as $multichoice) {\n $status = fwrite($bf, start_tag(\"turprove\", $level, true));\n //Print multichoice contents\n fwrite($bf, full_tag(\"LAYOUT\", $level + 1, false, $multichoice->layout));\n fwrite($bf, full_tag(\"ANSWERS\", $level + 1, false, $multichoice->answers));\n fwrite($bf, full_tag(\"SINGLE\", $level + 1, false, $multichoice->single));\n fwrite($bf, full_tag(\"SHUFFLEANSWERS\", $level + 1, false, $multichoice->shuffleanswers));\n fwrite($bf, full_tag(\"CORRECTFEEDBACK\", $level + 1, false, $multichoice->correctfeedback));\n fwrite($bf, full_tag(\"PARTIALLYCORRECTFEEDBACK\", $level + 1, false, $multichoice->partiallycorrectfeedback));\n fwrite($bf, full_tag(\"INCORRECTFEEDBACK\", $level + 1, false, $multichoice->incorrectfeedback));\n\n fwrite($bf, full_tag(\"QUESTIONSOUND\", $level + 1, false, $multichoice->questionsound));\n fwrite($bf, full_tag(\"AUTOPLAY\", $level + 1, false, $multichoice->autoplay));\n fwrite($bf, full_tag(\"QDIFFICULTY\", $level + 1, false, $multichoice->qdifficulty));\n\n $status = fwrite($bf, end_tag(\"turprove\", $level, true));\n }\n\n //Now print question_answers\n // $status = backup_answers();\n // $status = question_backup_answers_tur($bf,$preferences,$question);\n $answers = get_records(\"question_answers\", \"question\", $question, \"id\");\n //If there are answers\n if ($answers) {\n\n\n $status = $status && fwrite($bf, start_tag(\"ANSWERS\", $level, true));\n //Iterate over each answer\n foreach ($answers as $answer) {\n $status = $status && fwrite($bf, start_tag(\"ANSWER\", $level + 1, true));\n //Print answer contents\n fwrite($bf, full_tag(\"ID\", $level + 2, false, $answer->id));\n fwrite($bf, full_tag(\"ANSWER_TEXT\", $level + 2, false, $answer->answer));\n fwrite($bf, full_tag(\"FRACTION\", $level + 2, false, $answer->fraction));\n fwrite($bf, full_tag(\"FEEDBACK\", $level + 2, false, $answer->feedback));\n\n if ($answer->answersound == null) {\n fwrite($bf, full_tag(\"ANSWERSOUND\", $level + 2, false, ''));\n } else {\n fwrite($bf, full_tag(\"ANSWERSOUND\", $level + 2, false, $answer->answersound));\n }\n\n if ($answer->feedbacksound == null) {\n fwrite($bf, full_tag(\"FEEDBACKSOUND\", $level + 2, false, ''));\n } else {\n fwrite($bf, full_tag(\"FEEDBACKSOUND\", $level + 2, false, $answer->feedbacksound));\n }\n\n if ($answer->tur_answer_truefalse == null) {\n fwrite($bf, full_tag(\"TUR_ANSWER_TRUEFALSE\", $level + 2, false, ''));\n } else {\n fwrite($bf, full_tag(\"TUR_ANSWER_TRUEFALSE\", $level + 2, false, $answer->tur_answer_truefalse));\n }\n\n $status = $status && fwrite($bf, end_tag(\"ANSWER\", $level + 1, true));\n }\n $status = $status && fwrite($bf, end_tag(\"ANSWERS\", $level, true));\n }\n\n //Now print question_answers\n // $status = question_backup_answers($bf, $preferences, $question);\n }\n return $status;\n }",
"private function create_clone_backup() { // phpcs:ignore -- Current complexity is the only way to achieve desired results, pull request solutions appreciated.\r\n\t\tMainWP_Helper::end_session();\r\n\t\t$files = glob( WP_CONTENT_DIR . '/dbBackup*.sql' );\r\n\t\tforeach ( $files as $file ) {\r\n\t\t\tunlink( $file );\r\n\t\t}\r\n\t\tif ( file_exists( ABSPATH . 'clone/config.txt' ) ) {\r\n\t\t\tunlink( ABSPATH . 'clone/config.txt' );\r\n\t\t}\r\n\t\tif ( MainWP_Helper::is_dir_empty( ABSPATH . 'clone' ) ) {\r\n\t\t\trmdir( ABSPATH . 'clone' );\r\n\t\t}\r\n\r\n\t\t$wpversion = isset( $_POST['wpversion'] ) ? sanitize_text_field( wp_unslash( $_POST['wpversion'] ) ) : '';\r\n\t\tglobal $wp_version;\r\n\t\t$includeCoreFiles = ( $wpversion !== $wp_version );\r\n\t\t$excludes = ( isset( $_POST['exclude'] ) ? explode( ',', wp_unslash( $_POST['exclude'] ) ) : array() );\r\n\t\t$excludes[] = str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '/uploads/mainwp';\r\n\t\t$uploadDir = MainWP_Helper::get_mainwp_dir();\r\n\t\t$uploadDir = $uploadDir[0];\r\n\t\t$excludes[] = str_replace( ABSPATH, '', $uploadDir );\r\n\t\t$excludes[] = str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '/object-cache.php';\r\n\t\tif ( version_compare( phpversion(), '5.3.0' ) >= 0 || ! ini_get( 'safe_mode' ) ) {\r\n\t\t\tset_time_limit( 6000 );\r\n\t\t}\r\n\r\n\t\t$newExcludes = array();\r\n\t\tforeach ( $excludes as $exclude ) {\r\n\t\t\t$newExcludes[] = rtrim( $exclude, '/' );\r\n\t\t}\r\n\r\n\t\t$method = ( ! isset( $_POST['zipmethod'] ) ? 'tar.gz' : wp_unslash( $_POST['zipmethod'] ) );\r\n\t\tif ( 'tar.gz' === $method && ! function_exists( 'gzopen' ) ) {\r\n\t\t\t$method = 'zip';\r\n\t\t}\r\n\r\n\t\t$file = false;\r\n\t\tif ( isset( $_POST['f'] ) ) {\r\n\t\t\t$file = ! empty( $_POST['f'] ) ? wp_unslash( $_POST['f'] ) : false;\r\n\t\t} elseif ( isset( $_POST['file'] ) ) {\r\n\t\t\t$file = ! empty( $_POST['file'] ) ? wp_unslash( $_POST['file'] ) : false;\r\n\t\t}\r\n\r\n\t\t$res = MainWP_Backup::get()->create_full_backup( $newExcludes, $file, true, $includeCoreFiles, 0, false, false, false, false, $method );\r\n\t\tif ( ! $res ) {\r\n\t\t\t$information['backup'] = false;\r\n\t\t} else {\r\n\t\t\t$information['backup'] = $res['file'];\r\n\t\t\t$information['size'] = $res['filesize'];\r\n\t\t}\r\n\r\n\t\t$plugins = array();\r\n\t\t$dir = WP_CONTENT_DIR . '/plugins/';\r\n\t\t$fh = opendir( $dir );\r\n\t\twhile ( $entry = readdir( $fh ) ) {\r\n\t\t\tif ( ! is_dir( $dir . $entry ) ) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif ( ( '.' === $entry ) || ( '..' === $entry ) ) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t$plugins[] = $entry;\r\n\t\t}\r\n\t\tclosedir( $fh );\r\n\t\t$information['plugins'] = $plugins;\r\n\r\n\t\t$themes = array();\r\n\t\t$dir = WP_CONTENT_DIR . '/themes/';\r\n\t\t$fh = opendir( $dir );\r\n\t\twhile ( $entry = readdir( $fh ) ) {\r\n\t\t\tif ( ! is_dir( $dir . $entry ) ) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif ( ( '.' === $entry ) || ( '..' === $entry ) ) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t$themes[] = $entry;\r\n\t\t}\r\n\t\tclosedir( $fh );\r\n\t\t$information['themes'] = $themes;\r\n\t\tMainWP_Helper::write( $information );\r\n\t}",
"public function data_preprocessing(&$default_values) {\r\n global $DB;\r\n $context = $this->assignment->get_context();\r\n $course = $this->assignment->get_course();\r\n\r\n $drafttestinputid = file_get_submitted_draft_itemid('assignsubmission_codehandin_testinput');\r\n $drafttestoutputid = file_get_submitted_draft_itemid('assignsubmission_codehandin_testoutput');\r\n $draftteststderr = file_get_submitted_draft_itemid('assignsubmission_codehandin_teststderr');\r\n\r\n if ($context) {\r\n // existing submission\r\n\r\n $assignmentid = $this->assignment->get_instance()->id;\r\n\r\n file_prepare_draft_area($drafttestinputid, $context->id, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, (ASSIGNSUBMISSION_CODEHANDIN_INPUTFILES_START + $assignmentid), array(\r\n 'subdirs' => 0,\r\n 'maxbytes' => $course->maxbytes,\r\n 'maxfiles' => 1,\r\n 'accepted_types' => '*'\r\n ));\r\n file_prepare_draft_area($drafttestoutputid, $context->id, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, (ASSIGNSUBMISSION_CODEHANDIN_OUTPUTFILES_START + $assignmentid), array(\r\n 'subdirs' => 0,\r\n 'maxbytes' => $course->maxbytes,\r\n 'maxfiles' => 1\r\n ));\r\n file_prepare_draft_area($draftteststderr, $context->id, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, (ASSIGNSUBMISSION_CODEHANDIN_OUTPUTERRFILES_START + $assignmentid), array(\r\n 'subdirs' => 0,\r\n 'maxbytes' => $course->maxbytes,\r\n 'maxfiles' => 1\r\n ));\r\n\r\n\r\n //$assignment = $DB->get_records('codehandin', array('id' => $assignmentid));\r\n $checkpoints = $DB->get_records('codehandin_checkpoint', array('assignmentid' => $assignmentid), $sort = 'ordering ASC');\r\n\r\n echo '<pre>';\r\n print_r($checkpoints);\r\n echo '</pre>';\r\n\r\n// echo '<pre>';\r\n// echo $assignmentid;\r\n// echo '</pre>';\r\n//\r\n// echo '<pre>';\r\n// print_r($checkpoints);\r\n// echo '</pre>';\r\n// $assignment = (array) $assignment;\r\n// //$assignment->checkpoints = $checkpoints;\r\n// $assignment['checkpoints'] = $checkpoints;\r\n// $assignment = (object) $assignment;\r\n\r\n foreach ($checkpoints as $cp) {\r\n\r\n $tests = $DB->get_records('codehandin_test', array('checkpointid' => $cp->id));\r\n// $cp = (array) $cp;\r\n// $cp['tests'] = $tests;\r\n// $cp = (object) $cp;\r\n// \r\n// echo '<pre>';\r\n// print_r($tests);\r\n// echo '</pre>';\r\n }\r\n\r\n// echo '<pre>';\r\n// print_r($checkpoints);\r\n// echo '</pre>';\r\n// echo '<pre>';\r\n// print_r($cpids);\r\n// echo '</pre>';\r\n// echo '<pre>';\r\n// print_r($tests);\r\n// echo '</pre>';\r\n // assignment is now fancy packed\r\n\r\n\r\n\r\n foreach ($checkpoints as $cp) {\r\n $default_values['assignsubmission_codehandin_cpname'] = $cp->name;\r\n $default_values['assignsubmission_codehandin_cpdescription'] = $cp->description;\r\n $default_values['assignsubmission_codehandin_cpruntimeargs'] = $cp->runtimeargs;\r\n $default_values['assignsubmission_codehandin_cpordering'] = $cp->ordering;\r\n foreach ($tests as $test) {\r\n $default_values['assignsubmission_codehandin_testassessment'] = $test->assessment;\r\n $default_values['assignsubmission_codehandin_testdescription'] = $test->description;\r\n $default_values['assignsubmission_codehandin_testretval'] = $test->retval;\r\n }\r\n }\r\n } else {\r\n file_prepare_draft_area($drafttestinputid, null, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, 0, array(\r\n 'subdirs' => 0,\r\n 'maxbytes' => $course->maxbytes,\r\n 'maxfiles' => 1,\r\n 'accepted_types' => '*'\r\n ));\r\n }\r\n\r\n // $DB->update_record($table, $dataobject, $bulk=false)\r\n\r\n $default_values['assignsubmission_codehandin_testinput'] = $drafttestinputid;\r\n $default_values['assignsubmission_codehandin_testoutput'] = $drafttestoutputid;\r\n $default_values['assignsubmission_codehandin_teststderr'] = $draftteststderr;\r\n }",
"function wwassignment_backup_mods($bf,$preferences) {\n //error_log(\"wwassignment_backup_mods\");\n ////error_log(\"preferences \".print_r($preferences,true));\n global $CFG;\n\n $status = true;\n\n //Iterate over assignment table\n $wwassignments = get_records (\"wwassignment\",\"course\",$preferences->backup_course);\n if ($wwassignments) {\n foreach ($wwassignments as $wwassignment) {\n ////error_log(\"backing up wwassignment \".$wwassignment->id);\n if (backup_mod_selected($preferences,'wwassignment',$wwassignment->id)) {\n $status = wwassignment_backup_one_mod($bf,$preferences,$wwassignment);\n // backup files happens in backup_one_mod now too.\n }\n }\n }\n \n\n \n //error_log(\"end wwassignment_backup_mods\");\n return $status; \n }",
"public function save()\n {\n if (!isset($_POST) || !isset($_POST[\"cloneID\"])) {\n return false;\n }\n\n // Delete files to copy listing\n $this->cache->delete(\"files_to_copy\");\n\n // Generate Options\n $this->options->clone = preg_replace(\"#\\W+#\", '-', strtolower($_POST[\"cloneID\"]));\n $this->options->cloneDirectoryName = preg_replace(\"#\\W+#\", '-', strtolower($this->options->clone));\n $this->options->cloneNumber = 1;\n $this->options->prefix = $this->setStagingPrefix();\n $this->options->includedDirectories = [];\n $this->options->excludedDirectories = [];\n $this->options->extraDirectories = [];\n $this->options->excludedFiles = [\n '.htaccess',\n '.DS_Store',\n '*.git',\n '*.svn',\n '*.tmp',\n 'desktop.ini',\n '.gitignore',\n '*.log',\n 'web.config', // Important: Windows IIS configuration file. Must not be in the staging site!\n '.wp-staging' // Determines if a site is a staging site\n ];\n $this->options->excludedFilesFullPath = [\n 'wp-content' . DIRECTORY_SEPARATOR . 'db.php',\n 'wp-content' . DIRECTORY_SEPARATOR . 'object-cache.php',\n 'wp-content' . DIRECTORY_SEPARATOR . 'advanced-cache.php'\n ];\n $this->options->currentStep = 0;\n\n // Job\n $this->options->job = new \\stdClass();\n\n // Check if clone data already exists and use that one\n if (isset($this->options->existingClones[$this->options->clone])) {\n $this->options->cloneNumber = $this->options->existingClones[$this->options->clone]->number;\n\n $this->options->prefix = isset($this->options->existingClones[$this->options->clone]->prefix) ?\n $this->options->existingClones[$this->options->clone]->prefix :\n $this->setStagingPrefix();\n }\n // Clone does not exist but there are other clones in db\n // Get data and increment it\n elseif (!empty($this->options->existingClones)) {\n $this->options->cloneNumber = count($this->options->existingClones) + 1;\n }\n\n // Included Tables\n if (isset($_POST[\"includedTables\"]) && is_array($_POST[\"includedTables\"])) {\n $this->options->tables = $_POST[\"includedTables\"];\n } else {\n $this->options->tables = [];\n }\n\n // Excluded Directories\n if (isset($_POST[\"excludedDirectories\"]) && is_array($_POST[\"excludedDirectories\"])) {\n $this->options->excludedDirectories = wpstg_urldecode($_POST[\"excludedDirectories\"]);\n }\n\n $this->options->uploadsSymlinked = isset($_POST['uploadsSymlinked']) && $_POST['uploadsSymlinked'] === 'true';\n\n // Excluded Directories TOTAL\n // Do not copy these folders and plugins\n $excludedDirectories = [\n WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'cache',\n WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wps-hide-login',\n WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wp-super-cache',\n WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'peters-login-redirect',\n WPStaging::getWPpath() . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'wp-spamshield',\n ];\n\n // Add upload folder to list of excluded directories for push if symlink option is enabled\n if ($this->options->uploadsSymlinked) {\n $wpUploadsFolder = (new WpDefaultDirectories())->getUploadPath();\n $excludedDirectories[] = rtrim($wpUploadsFolder, '/\\\\');\n }\n\n $this->options->excludedDirectories = array_merge($excludedDirectories, wpstg_urldecode($this->options->excludedDirectories));\n\n array_unshift($this->options->directoriesToCopy, WPStaging::getWPpath());\n\n // Included Directories\n if (isset($_POST[\"includedDirectories\"]) && is_array($_POST[\"includedDirectories\"])) {\n $this->options->includedDirectories = wpstg_urldecode($_POST[\"includedDirectories\"]);\n }\n\n // Extra Directories\n if (isset($_POST[\"extraDirectories\"]) && !empty($_POST[\"extraDirectories\"])) {\n $this->options->extraDirectories = wpstg_urldecode($_POST[\"extraDirectories\"]);\n }\n\n // Directories to Copy\n $this->options->directoriesToCopy = array_merge(\n $this->options->includedDirectories,\n $this->options->extraDirectories\n );\n $this->options->databaseServer = 'localhost';\n if (isset($_POST[\"databaseServer\"]) && !empty($_POST[\"databaseServer\"])) {\n $this->options->databaseServer = $_POST[\"databaseServer\"];\n }\n $this->options->databaseUser = '';\n if (isset($_POST[\"databaseUser\"]) && !empty($_POST[\"databaseUser\"])) {\n $this->options->databaseUser = $_POST[\"databaseUser\"];\n }\n $this->options->databasePassword = '';\n if (isset($_POST[\"databasePassword\"]) && !empty($_POST[\"databasePassword\"])) {\n $this->options->databasePassword = stripslashes($_POST[\"databasePassword\"]);\n }\n $this->options->databaseDatabase = '';\n if (isset($_POST[\"databaseDatabase\"]) && !empty($_POST[\"databaseDatabase\"])) {\n $this->options->databaseDatabase = $_POST[\"databaseDatabase\"];\n }\n $this->options->databasePrefix = '';\n if (isset($_POST[\"databasePrefix\"]) && !empty($_POST[\"databasePrefix\"])) {\n $this->options->databasePrefix = $this->appendUnderscore($_POST[\"databasePrefix\"]);\n }\n $this->options->cloneDir = '';\n if (isset($_POST[\"cloneDir\"]) && !empty($_POST[\"cloneDir\"])) {\n $this->options->cloneDir = trailingslashit(wpstg_urldecode($_POST[\"cloneDir\"]));\n }\n $this->options->cloneHostname = '';\n if (isset($_POST[\"cloneHostname\"]) && !empty($_POST[\"cloneHostname\"])) {\n $this->options->cloneHostname = trim($_POST[\"cloneHostname\"]);\n }\n\n // Make sure it is always enabled for free version\n $this->options->emailsAllowed = true;\n if (defined('WPSTGPRO_VERSION')) {\n $this->options->emailsAllowed = apply_filters(\n 'wpstg_cloning_email_allowed',\n isset($_POST['emailsAllowed']) && $_POST['emailsAllowed'] !== \"false\"\n );\n }\n\n $this->options->destinationHostname = $this->getDestinationHostname();\n $this->options->destinationDir = $this->getDestinationDir();\n\n $helper = new Helper();\n $this->options->homeHostname = $helper->getHomeUrlWithoutScheme();\n\n // Process lock state\n $this->options->isRunning = true;\n\n // id of the user creating the clone\n $this->options->ownerId = get_current_user_id();\n\n // Save Clone data\n $this->saveClone();\n\n return $this->saveOptions();\n }",
"function exercise_restore_mods($mod,$restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get record from backup_ids\n $data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);\n\n if ($data) {\n //Now get completed xmlized object\n $info = $data->info;\n // if necessary, write to restorelog and adjust date/time fields\n if ($restore->course_startdateoffset) {\n restore_log_date_changes('Exercise', $restore, $info['MOD']['#'], array('DEADLINE'));\n }\n //traverse_xmlize($info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //Now, build the exercise record structure\n $exercise->course = $restore->course_id;\n $exercise->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);\n $exercise->nelements = backup_todb($info['MOD']['#']['NELEMENTS']['0']['#']);\n $exercise->phase = backup_todb($info['MOD']['#']['PHASE']['0']['#']);\n $exercise->gradingstrategy = backup_todb($info['MOD']['#']['GRADINGSTRATEGY']['0']['#']);\n $exercise->usemaximum = backup_todb($info['MOD']['#']['USEMAXIMUM']['0']['#']);\n $exercise->assessmentcomps = backup_todb($info['MOD']['#']['ASSESSMENTCOMPS']['0']['#']);\n $exercise->anonymous = backup_todb($info['MOD']['#']['ANONYMOUS']['0']['#']);\n $exercise->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']); \n $exercise->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);\n $date = usergetdate($exercise->deadline);\n fwrite ($restorelog_file,\"<br/>The Exercise - \".$exercise->name.\" <br/>\");\n fwrite ($restorelog_file,\"The DEADLINE was \" .$date['weekday'].\", \".$date['mday'].\" \".$date['month'].\" \".$date['year'].\"\"); \n $exercise->deadline += $restore->course_startdateoffset;\n $date = usergetdate($exercise->deadline);\n fwrite ($restorelog_file,\" the DEADLINE is now \" .$date['weekday'].\", \".$date['mday'].\" \".$date['month'].\" \".$date['year'].\"<br/>\"); \n $exercise->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);\n $exercise->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);\n $exercise->gradinggrade = backup_todb($info['MOD']['#']['GRADINGGRADE']['0']['#']);\n $exercise->showleaguetable = backup_todb($info['MOD']['#']['SHOWLEAGUETABLE']['0']['#']);\n $exercise->usepassword = backup_todb($info['MOD']['#']['USEPASSWORD']['0']['#']);\n $exercise->password = backup_todb($info['MOD']['#']['PASSWORD']['0']['#']);\n\n //The structure is equal to the db, so insert the exercise\n $newid = insert_record (\"exercise\",$exercise);\n\n //Do some output \n if (!defined('RESTORE_SILENTLY')) {\n echo \"<li>\".get_string(\"modulename\",\"exercise\").\" \\\"\".format_string(stripslashes($exercise->name),true).\"\\\"</li>\";\n }\n backup_flush(300);\n\n if ($newid) {\n //We have the newid, update backup_ids\n backup_putid($restore->backup_unique_code,$mod->modtype,\n $mod->id, $newid);\n //We have to restore the exercise_elements table now (course level table)\n $status = exercise_elements_restore($newid,$info,$restore);\n //restore the teacher submissions and optionally the student submissions\n $status = exercise_submissions_restore($mod->id, $newid,$info,$restore);\n } else {\n $status = false;\n }\n } else {\n $status = false;\n }\n\n return $status;\n }",
"public function postSubmission()\n {\n $this->app->response->setStatus( 201 );\n $body = $this->app->request->getBody();\n\n $submissions = Submission::decodeSubmission($body);\n\n // always been an array\n $arr = true;\n if ( !is_array( $submissions ) ){\n $submissions = array( $submissions );\n $arr = false;\n }\n\n\n $res = array( );\n foreach ( $submissions as $submission ){\n $fail = false;\n\n $process = new Process();\n $process->setRawSubmission($submission);\n\n $eid = $submission->getExerciseId();\n // load processor data from database\n $result = Request::routeRequest(\n 'GET',\n '/process/exercise/'.$eid,\n array(),\n '',\n $this->_processorDb,\n 'process'\n );\n\n $processors = null;\n if ( $result['status'] >= 200 &&\n $result['status'] <= 299 ){\n $processors = Process::decodeProcess( $result['content'] );\n } else {\n if ($result['status'] != 404){\n $submission->addMessage(\"Interner Fehler\");\n $res[] = $submission;\n $this->app->response->setStatus( 409 );\n continue;\n }\n }\n\n $result2 = Request::routeRequest(\n 'GET',\n '/exercisefiletype/exercise/'.$eid,\n array(),\n '',\n $this->_getExerciseExerciseFileType,\n 'exercisefiletype'\n );\n\n $exerciseFileTypes = null;\n if ( $result2['status'] >= 200 &&\n $result2['status'] <= 299 ){\n $exerciseFileTypes = ExerciseFileType::decodeExerciseFileType( $result2['content'] );\n if (!is_array($exerciseFileTypes)) $exerciseFileTypes = array($exerciseFileTypes);\n\n $filePath = null;\n if ($submission->getFile()!=null){\n $file = $submission->getFile()->getBody( true );\n\n if ($file !== null){\n $fileHash = sha1($file);\n\n $filePath = '/tmp/'.$fileHash;\n if ($submission->getFile()->getDisplayName() != null){\n LProcessor::generatepath($filePath);\n file_put_contents($filePath . '/' . $submission->getFile()->getDisplayName(), $file);\n $filePath .= '/' . $submission->getFile()->getDisplayName();\n } else {\n LProcessor::generatepath($filePath);\n file_put_contents($filePath . '/tmp', $file);\n $filePath .= '/tmp';\n }\n }\n }\n\n // check file type\n if ($filePath!=null){\n $found = false;\n $types = array();\n $mimeType = MimeReader::get_mime($filePath);\n $foundExtension = strtolower(isset(pathinfo($filePath)['extension']) ? pathinfo($filePath)['extension'] : '-');\n\n foreach ($exerciseFileTypes as $type){\n $types[] = $type->getText();\n $type = explode(' ',str_replace('*','',$type->getText()));\n//echo MimeReader::get_mime($filePath);\n if (strpos($mimeType,$type[0])!==false && (!isset($type[1]) || (('.'.$foundExtension) == strtolower($type[1])))) {\n $found = true;\n break;\n }\n }\n\n if (!$found && count($exerciseFileTypes)>0){\n $submission->addMessage(\"falscher Dateityp \\nGefunden: \".$mimeType.\" .\".$foundExtension.\"\\nErlaubt: \".implode(',',$types));\n $res[] = $submission;\n $this->app->response->setStatus( 409 );\n unlink($filePath);\n continue;\n }\n unlink($filePath);\n }\n\n } else {\n if ($result2['status'] != 404){\n $submission->addMessage(\"Interner Fehler\");\n $res[] = $submission;\n $this->app->response->setStatus( 409 );\n continue;\n }\n }\n\n // process submission\n if ($processors !== null){\n if (!is_array($processors)) $processors = array($processors);\n\n foreach($processors as $pro){\n $component = $pro->getTarget();\n\n if ($process->getExercise()===null)\n $process->setExercise($pro->getExercise());\n\n $process->setParameter($pro->getParameter());\n $process->setAttachment($pro->getAttachment());\n $process->setTarget($pro->getTarget());\n $process->setWorkFiles($pro->getWorkFiles());\n $process->setProcessId($pro->getProcessId());\n \n//echo Process::encodeProcess($process).\"_______\";// return;\n\n $result = Request::post($component->getAddress().'/process', array(), Process::encodeProcess($process));\n//echo $result['content'].'_______';\n if ( $result['status'] >= 200 &&\n $result['status'] <= 299 ){\n if (isset($result['content']) && trim($result['content']) != \"\"){\n //$process = Process::decodeProcess( $result['content'] );\n \n $content = Process::decodeProcess($result['content']); \n //$submission->setStatus($content->getStatus());\n $submission = $content->getSubmission();\n if ($submission===null){$submission = $process->getRawSubmission();}\n if ($submission!==null){$submission->addMessages($content->getMessages());}\n $process = $content;\n } \n\n } else {\n $fail = true;\n $submission->addMessage(\"Beim Verarbeiten der Einsendung ist ein Fehler aufgetreten\");\n\n if (isset($result['content'])){\n $content = Process::decodeProcess($result['content']);\n $submission->setStatus($content->getStatus());\n $submission->addMessages($content->getMessages());\n }\n break;\n }\n }\n }\n\n if ($fail){\n if (isset($submission))\n $submission->setFile(null);\n\n $res[] = $submission;\n $this->app->response->setStatus( 409 );\n continue;\n }\n\n // upload submission\n $uploadSubmission = $process->getSubmission();\n if ($uploadSubmission===null){\n $uploadSubmission = $process->getRawSubmission();\n if ($uploadSubmission->getFile()!=null){\n $file = $uploadSubmission->getFile();\n if ($file->getDisplayName()==null)\n $file->setDisplayName($submission->getExerciseName());\n }\n }\n\n if ($uploadSubmission!==null){\n///echo Submission::encodeSubmission($uploadSubmission);return;\n $result = Request::routeRequest(\n 'POST',\n '/submission',\n array(),\n Submission::encodeSubmission($uploadSubmission),\n $this->_submission,\n 'submission'\n );\n//var_dump($result);return;\n // checks the correctness of the query\n if ( $result['status'] >= 200 &&\n $result['status'] <= 299 ){\n $queryResult = Submission::decodeSubmission( $result['content'] );\n $uploadSubmission->setId($queryResult->getId());\n $uploadSubmission->setFile($queryResult->getFile());\n if ($process->getMarking()!==null){\n $process->getMarking()->setSubmission($queryResult);\n }\n\n } else {\n $uploadSubmission->addMessage(\"Beim Speichern der Einsendung ist ein Fehler aufgetreten.\");\n//var_dump($uploadSubmission); return;\n if (isset($result['content'])){\n $content = Submission::decodeSubmission($result['content']);\n $uploadSubmission->setStatus($content->getStatus());\n $uploadSubmission->addMessages($content->getMessages());\n }\n\n $uploadSubmission->setStatus(409);\n $res[] = $uploadSubmission;\n $this->app->response->setStatus( 409 );\n continue;\n }\n }\n\n // postprocess submission\n if ($processors !== null){\n if (!is_array($processors)) $processors = array($processors);\n \n foreach($processors as $pro){\n $component = $pro->getTarget();\n \n if ($process->getExercise()===null)\n $process->setExercise($pro->getExercise());\n \n /*$process->setParameter($pro->getParameter());\n $process->setAttachment($pro->getAttachment());\n $process->setTarget($pro->getTarget());\n $process->setWorkFiles($pro->getWorkFiles());*/\n \n//echo Process::encodeProcess($process).\"_______\";// return;\n\n $result = Request::post($component->getAddress().'/postprocess', array(), Process::encodeProcess($process));\n//echo $result['content'].'_______';\n if ( $result['status'] >= 200 && \n $result['status'] <= 299 ){\n /*\n * evaluating for response of postprocess is possible here\n */\n } elseif ($result['status'] == 404) {\n // skip if no postprocess command is found\n continue;\n } /*else {\n $submission->addMessage(\"Beim Nachbearbeiten der Einsendung ist ein Fehler aufgetreten\");\n\n if (isset($result['content'])){\n $content = Process::decodeProcess($result['content']); \n $submission->setStatus($content->getStatus()); \n $submission->addMessages($content->getMessages());\n }\n break;\n }*/\n }\n }\n \n // upload marking\n if ($process->getMarking()!==null){\n//echo Marking::encodeMarking($process->getMarking());\n $result = Request::routeRequest(\n 'POST',\n '/marking',\n array(),\n Marking::encodeMarking($process->getMarking()),\n $this->_marking,\n 'marking'\n );\n\n // checks the correctness of the query\n if ( $result['status'] >= 200 &&\n $result['status'] <= 299 ){\n $queryResult = Marking::decodeMarking( $result['content'] );\n } else {\n $uploadSubmission->addMessage(\"Beim Speichern der Korrektur ist ein Fehler aufgetreten\");\n if (isset($result['content'])){\n $content = Marking::decodeMarking($result['content']);\n $uploadSubmission->addMessages($content->getMessages());\n }\n $res[] = $uploadSubmission;\n $this->app->response->setStatus( 409 );\n continue;\n }\n }\n\n $rr = $process->getSubmission();\n if ($rr===null)$rr = $process->getRawSubmission();\n $res[] = $rr;\n\n }\n\n if ( !$arr && count( $res ) == 1 ){\n $this->app->response->setBody( Submission::encodeSubmission( $res[0] ) );\n } else\n $this->app->response->setBody( Submission::encodeSubmission( $res ) );\n }",
"function wwassignment_check_backup_mods($course,$user_data=false,$backup_unique_code,$instances=null) {\n ////error_log(\"wwassignment_check_backup_mods \");\n ////error_log(\"user_data \".print_r($user_data,true) );\n ////error_log(\"backup code \".print_r($backup_unique_code,true));\n ////error_log(\"instance \".print_r($instance,true));\n $info=array();\n if (!empty($instances) && is_array($instances) && count($instances)) {\n foreach ($instances as $id => $instance) {\n $info += wwassignment_check_backup_mods_instances($instance,$backup_unique_code);\n }\n return $info;\n }\n //First the course data\n $info[0][0] = get_string(\"modulenameplural\",\"wwassignment\");\n if ($ids = wwassignment_ids ($course)) {\n $info[0][1] = count($ids);\n } else {\n $info[0][1] = 0;\n }\n \n ////error_log(\"end wwassignment_check_backup_mods\");\n\n return $info;\n }",
"function lesson_attempts_restore($lessonid, $pageid, $answerid, $info, $restore) {\n\n global $CFG;\n\n $status = true;\n\n //Get the attempts array (optional)\n if (isset($info['#']['ATTEMPTS']['0']['#']['ATTEMPT'])) {\n $attempts = $info['#']['ATTEMPTS']['0']['#']['ATTEMPT'];\n //Iterate over attempts\n for($i = 0; $i < sizeof($attempts); $i++) {\n $attempt_info = $attempts[$i];\n //traverse_xmlize($sub_info); //Debug\n //print_object ($GLOBALS['traverse_array']); //Debug\n //$GLOBALS['traverse_array']=\"\"; //Debug\n\n //We'll need this later!!\n $olduserid = backup_todb($attempt_info['#']['USERID']['0']['#']);\n\n //Now, build the lesson_attempts record structure\n $attempt->lessonid = $lessonid;\n $attempt->pageid = $pageid;\n $attempt->answerid = $answerid;\n $attempt->userid = backup_todb($attempt_info['#']['USERID']['0']['#']);\n $attempt->retry = backup_todb($attempt_info['#']['RETRY']['0']['#']);\n $attempt->correct = backup_todb($attempt_info['#']['CORRECT']['0']['#']);\n $attempt->useranswer = backup_todb($attempt_info['#']['USERANSWER']['0']['#']);\n $attempt->timeseen = backup_todb($attempt_info['#']['TIMESEEN']['0']['#']);\n\n //We have to recode the userid field\n $user = backup_getid($restore->backup_unique_code,\"user\",$olduserid);\n if ($user) {\n $attempt->userid = $user->new_id;\n }\n\n //The structure is equal to the db, so insert the lesson_attempt\n $newid = insert_record (\"lesson_attempts\",$attempt);\n\n //Do some output\n if (($i+1) % 50 == 0) {\n if (!defined('RESTORE_SILENTLY')) {\n echo \".\";\n if (($i+1) % 1000 == 0) {\n echo \"<br/>\";\n }\n }\n backup_flush(300);\n }\n }\n }\n\n return $status;\n }",
"function schedule_backup_course_execute($preferences,$starttime = 0) {\n\n global $CFG;\n\n $status = true;\n\n //Another Info to add\n $preferences->moodle_version = $CFG->version;\n $preferences->moodle_release = $CFG->release;\n $preferences->backup_version = $CFG->backup_version;\n $preferences->backup_release = $CFG->backup_release;\n\n //Some parts of the backup doesn't know about $preferences, so we\n //put a copy of it inside that CFG (always global) to be able to\n //use it. Then, when needed I search for preferences inside CFG\n //Used to avoid some problems in full_tag() when preferences isn't\n //set globally (i.e. in scheduled backups)\n $CFG->backup_preferences = $preferences;\n\n //Check for temp and backup and backup_unique_code directory\n //Create them as needed\n schedule_backup_log($starttime,$preferences->backup_course,\" checking temp structures\");\n $status = check_and_create_backup_dir($preferences->backup_unique_code);\n //Empty backup dir\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" cleaning current dir\");\n $status = clear_backup_dir($preferences->backup_unique_code);\n }\n\n //Create the moodle.xml file\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" creating backup file\");\n //Obtain the xml file (create and open) and print prolog information\n $backup_file = backup_open_xml($preferences->backup_unique_code);\n //Prints general info about backup to file\n if ($backup_file) {\n schedule_backup_log($starttime,$preferences->backup_course,\" general info\");\n $status = backup_general_info($backup_file,$preferences);\n } else {\n $status = false;\n }\n\n //Prints course start (tag and general info)\n if ($status) {\n $status = backup_course_start($backup_file,$preferences);\n }\n\n //Metacourse information\n if ($status && $preferences->backup_metacourse) {\n schedule_backup_log($starttime,$preferences->backup_course,\" metacourse info\");\n $status = backup_course_metacourse($backup_file,$preferences);\n }\n\n //Block info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" blocks info\");\n $status = backup_course_blocks($backup_file,$preferences);\n }\n\n //Section info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" sections info\");\n $status = backup_course_sections($backup_file,$preferences);\n }\n\n //User info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" user info\");\n $status = backup_user_info($backup_file,$preferences);\n }\n\n //If we have selected to backup messages and we are\n //doing a SITE backup, let's do it\n if ($status && $preferences->backup_messages && $preferences->backup_course == SITEID) {\n schedule_backup_log($starttime,$preferences->backup_course,\" messages\");\n if (!$status = backup_messages($backup_file,$preferences)) {\n notify(\"An error occurred while backing up messages\");\n }\n }\n\n //If we have selected to backup quizzes, backup categories and\n //questions structure (step 1). See notes on mod/quiz/backuplib.php\n if ($status and $preferences->mods['quiz']->backup) {\n schedule_backup_log($starttime,$preferences->backup_course,\" categories & questions\");\n $status = backup_question_categories($backup_file,$preferences);\n }\n\n //Print logs if selected\n if ($status) {\n if ($preferences->backup_logs) {\n schedule_backup_log($starttime,$preferences->backup_course,\" logs\");\n $status = backup_log_info($backup_file,$preferences);\n }\n }\n\n //Print scales info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" scales\");\n $status = backup_scales_info($backup_file,$preferences);\n }\n\n //Print groupings info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" groupings\");\n $status = backup_groupings_info($backup_file,$preferences);\n }\n\n //Print groups info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" groups\");\n $status = backup_groups_info($backup_file,$preferences);\n }\n\n //Print events info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" events\");\n $status = backup_events_info($backup_file,$preferences);\n }\n\n //Print gradebook info\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" gradebook\");\n $status = backup_gradebook_info($backup_file,$preferences);\n }\n\n //Module info, this unique function makes all the work!!\n //db export and module fileis copy\n if ($status) {\n $mods_to_backup = false;\n //Check if we have any mod to backup\n foreach ($preferences->mods as $module) {\n if ($module->backup) {\n $mods_to_backup = true;\n }\n }\n //If we have to backup some module\n if ($mods_to_backup) {\n schedule_backup_log($starttime,$preferences->backup_course,\" modules\");\n //Start modules tag\n $status = backup_modules_start ($backup_file,$preferences);\n //Iterate over modules and call backup\n foreach ($preferences->mods as $module) {\n if ($module->backup and $status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" $module->name\");\n $status = backup_module($backup_file,$preferences,$module->name);\n }\n }\n //Close modules tag\n $status = backup_modules_end ($backup_file,$preferences);\n }\n }\n\n //Backup course format data, if any.\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" course format data\");\n $status = backup_format_data($backup_file,$preferences);\n }\n\n //Prints course end\n if ($status) {\n $status = backup_course_end($backup_file,$preferences);\n }\n\n //Close the xml file and xml data\n if ($backup_file) {\n backup_close_xml($backup_file);\n }\n }\n\n //Now, if selected, copy user files\n if ($status) {\n if ($preferences->backup_user_files) {\n schedule_backup_log($starttime,$preferences->backup_course,\" copying user files\");\n $status = backup_copy_user_files ($preferences);\n }\n }\n\n //Now, if selected, copy course files\n if ($status) {\n if ($preferences->backup_course_files) {\n schedule_backup_log($starttime,$preferences->backup_course,\" copying course files\");\n $status = backup_copy_course_files ($preferences);\n }\n }\n\n //Now, zip all the backup directory contents\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" zipping files\");\n $status = backup_zip ($preferences);\n }\n\n //Now, copy the zip file to course directory\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" copying backup\");\n $status = copy_zip_to_course_dir ($preferences);\n }\n\n //Now, clean temporary data (db and filesystem)\n if ($status) {\n schedule_backup_log($starttime,$preferences->backup_course,\" cleaning temp data\");\n $status = clean_temp_data ($preferences);\n }\n\n //Unset CFG->backup_preferences only needed in scheduled backups\n unset ($CFG->backup_preferences);\n\n return $status;\n}",
"function list_assignments() {\n global $id, $tool_content, $langWorks, $langChoice, $langGroupWorkDeadline_of_Submission,\n $langAddModulesButton, $langNoAssign, $langPassCode, $course_id, $course_code, $urlServer;\n\n $result = Database::get()->queryArray(\"SELECT * FROM assignment WHERE course_id = ?d ORDER BY title\", $course_id);\n if (count($result) == 0) {\n $tool_content .= \"<div class='col-sm-12'><div class='alert alert-warning'>$langNoAssign</div></div>\";\n } else {\n $tool_content .= \"<form action='insert.php?course=$course_code' method='post'>\" .\n \"<input type='hidden' name='id' value='$id'>\" .\n \"<div class='table-responsive'><table class='table-default'>\" .\n \"<tr class='list-header'>\" .\n \"<th style='width:20px;' class='text-center'>$langChoice</th>\" .\n \"<th class='text-start'> $langWorks</th>\" .\n \"<th width='150'>$langGroupWorkDeadline_of_Submission</th>\" .\n\n \"</tr>\";\n foreach ($result as $row) {\n if ($row->password_lock) {\n $exclamation_icon = \" <span class='fa fa-exclamation-triangle space-after-icon' data-toggle='tooltip' data-placement='right' data-html='true' data-title='$langPassCode'></span>\";\n } else {\n $exclamation_icon = '';\n }\n if (!$row->active) {\n $vis = 'not_visible';\n } else {\n $vis = '';\n }\n $description = empty($row->description) ? '' :\n \"<div class='margin-top: 10px;'>\" . mathfilter($row->description, 12 , \"../../courses/mathimg/\"). \"</div>\";\n $tool_content .= \"<tr class='$vis'>\" .\n \"<td class='text-center'><input name='work[]' value='$row->id' type='checkbox' /></td>\" .\n \"<td><a href='{$urlServer}modules/work/index.php?course=$course_code&id=$row->id'>\" . q($row->title) . \"</a>$exclamation_icon $description</td>\" .\n \"<td class='text-center'>\".format_locale_date(strtotime($row->submission_date), 'short').\"</td>\" .\n \"</tr>\";\n }\n $tool_content .=\n \"</table></div>\" .\n \"<div class='d-flex justify-content-center mt-3'><input class='btn submitAdminBtn' type='submit' name='submit_work' value='$langAddModulesButton' /></div></th></form>\";\n }\n}",
"public function upgrade(context $oldcontext, stdClass $oldassignment, stdClass $oldsubmission, stdClass $submission, & $log) {\r\n// global $DB;\r\n//\r\n// $codehandin = new stdClass();\r\n//\r\n// $codehandin->numfiles = $oldsubmission->numfiles;\r\n// $codehandin->submission = $submission->id;\r\n// $codehandin->assignment = $this->assignment->get_instance()->id;\r\n//\r\n// if (!$DB->insert_record('assignsubmission_codehandin', $codehandin) > 0) {\r\n// $log .= get_string('couldnotconvertsubmission', 'mod_assign', $submission->userid);\r\n// return false;\r\n// }\r\n//\r\n// // Now copy the area files.\r\n// $this->assignment->copy_area_codehandin_submission_for_upgrade($oldcontext->id, 'mod_assignment', 'submission', $oldsubmission->id, $this->assignment->get_context()->id, 'assignsubmission_codehandin', ASSIGNSUBMISSION_CODEHANDIN_FILEAREA, $submission->id);\r\n//\r\n// return true;\r\n return false;\r\n }",
"private function loadSubmissionFiles() {\n $submitter_id = $this->graded_gradeable->getSubmitter()->getId();\n $gradeable = $this->graded_gradeable->getGradeable();\n $course_path = $this->core->getConfig()->getCoursePath();\n $config = $gradeable->getAutogradingConfig();\n\n // Get the path to load files from (based on submission type)\n $dirs = $gradeable->isVcs() ? ['submissions', 'checkout'] : ['submissions'];\n\n\n foreach ($dirs as $dir) {\n $this->meta_files[$dir] = [];\n $this->files[$dir][0] = [];\n\n $path = FileUtils::joinPaths($course_path, $dir, $gradeable->getId(), $submitter_id, $this->version);\n\n // Now load all files in the directory, flattening the results\n $submitted_files = FileUtils::getAllFiles($path, [], true);\n foreach ($submitted_files as $file => $details) {\n if (substr(basename($file), 0, 1) === '.') {\n $this->meta_files[$dir][$file] = $details;\n }\n else {\n $this->files[$dir][0][$file] = $details;\n }\n }\n // If there is only one part (no separation of upload files),\n // be sure to set the \"Part 1\" files to the \"all\" files\n if ($config->getNumParts() === 1 && !$config->isNotebookGradeable()) {\n $this->files[$dir][1] = $this->files[$dir][0];\n }\n\n $part_names = $config->getPartNames();\n $notebook_model = null;\n if ($config->isNotebookGradeable()) {\n $notebook_model = $config->getUserSpecificNotebook($submitter_id);\n\n $part_names = range(1, $notebook_model->getNumParts());\n }\n\n // A second time, look through the folder, but now split up based on part number\n foreach ($part_names as $i => $name) {\n foreach ($submitted_files as $file => $details) {\n $dir_name = \"part{$i}/\";\n $index = $i;\n if ($config->isNotebookGradeable() && isset($notebook_model->getFileSubmissions()[$i])) {\n $dir_name = $notebook_model->getFileSubmissions()[$i][\"directory\"];\n $index = $name;\n }\n\n if (substr($file, 0, strlen($dir_name)) === $dir_name) {\n $this->files[$dir][$index][substr($file, strlen($dir_name))] = $details;\n }\n }\n }\n }\n }",
"private function course_restored($event) {\n global $DB;\n $courseid = $event->courseid;\n $course = $DB->get_record('course', array('id' => $courseid), 'visible');\n $coursecontext = context_course::instance($courseid);\n $siteadmins = $this->get_siteadmins();\n $users = $this->get_google_authenticated_users($courseid);\n $coursemodinfo = get_fast_modinfo($courseid, -1);\n $cms = $coursemodinfo->get_cms();\n $insertcalls = array();\n $deletecalls = array();\n foreach ($cms as $cm) {\n $cmid = $cm->id;\n $cmcontext = context_module::instance($cmid);\n $fileids = $this->get_fileids($cmid);\n if ($fileids) {\n foreach ($fileids as $fileid) {\n foreach ($users as $user) {\n if (has_capability('moodle/course:view', $coursecontext, $user->userid)) {\n // Manager; insert writer permission.\n $call = new stdClass();\n $call->fileid = $fileid;\n $call->gmail = $user->gmail;\n $call->role = 'writer';\n $insertcalls[] = $call;\n if (count($insertcalls) == 1000) {\n $this->batch_insert_permissions($insertcalls);\n $insertcalls = array();\n }\n } elseif (is_enrolled($coursecontext, $user->userid, null, true) && has_capability('moodle/course:manageactivities', $cmcontext, $user->userid)) {\n // Enrolled teacher; insert writer permission.\n $call = new stdClass();\n $call->fileid = $fileid;\n $call->gmail = $user->gmail;\n $call->role = 'writer';\n $insertcalls[] = $call;\n if (count($insertcalls) == 1000) {\n $this->batch_insert_permissions($insertcalls);\n $insertcalls = array();\n }\n } elseif (is_enrolled($coursecontext, $user->userid, null, true)) {\n // Enrolled student; continue checks for reader permission.\n if ($course->visible == 1) {\n // Course is visible, continue checks.\n if ($cm->visible == 1) {\n // Course module is visible, continue checks.\n rebuild_course_cache($courseid, true);\n $modinfo = get_fast_modinfo($courseid, $user->userid);\n $cminfo = $modinfo->get_cm($cmid);\n $sectionnumber = $this->get_cm_sectionnum($cmid);\n $secinfo = $modinfo->get_section_info($sectionnumber);\n if ($cminfo->uservisible && $secinfo->available) {\n // Course module is visible and accessible, section is accessible; insert reader permission.\n $call = new stdClass();\n $call->fileid = $fileid;\n $call->gmail = $user->gmail;\n $call->role = 'reader';\n $insertcalls[] = $call;\n if (count($insertcalls) == 1000) {\n $this->batch_insert_permissions($insertcalls);\n $insertcalls = array();\n }\n }\n // User cannot access course module or section, do nothing.\n }\n // Course module not visible, do nothing.\n }\n // Course not visible, do nothing.\n } else {\n // User is not enrolled; do nothing.\n }\n }\n\n $newdata = new stdClass();\n $newdata->courseid = $courseid;\n $newdata->cmid = $cmid;\n $newdata->reference = $fileid;\n $DB->insert_record('repository_gdrive_references', $newdata);\n \n // Insert writer permissions for site admins.\n foreach ($siteadmins as $siteadmin) {\n $call = new stdClass();\n $call->fileid = $fileid;\n $call->gmail = $siteadmin->gmail;\n $call->role = 'writer';\n $insertcalls[] = $call;\n if (count($insertcalls) == 1000) {\n $this->batch_insert_permissions($insertcalls);\n $insertcalls = array();\n }\n }\n }\n }\n\n // Call any remaining batch requests.\n if (count($insertcalls) > 0) {\n $this->batch_insert_permissions($insertcalls);\n }\n\n if (count($deletecalls) > 0) {\n $this->batch_delete_permissions($deletecalls);\n }\n }\n }",
"function save_question($question, $form, $course) {\n $wizardnow = optional_param('wizardnow', '', PARAM_ALPHA);\n $id = optional_param('id', 0, PARAM_INT); // question id\n // in case 'question'\n // for a new question $form->id is empty\n // when saving as new question\n // $question->id = 0, $form is $data from question2.php\n // and $data->makecopy is defined as $data->id is the initial question id\n // edit case. If it is a new question we don't necessarily need to\n // return a valid question object\n\n // See where we're coming from\n switch($wizardnow) {\n case '' :\n case 'question': // coming from the first page, creating the second\n if (empty($form->id)) { // for a new question $form->id is empty\n $question = parent::save_question($question, $form, $course);\n //prepare the datasets using default $questionfromid\n $this->preparedatasets($form);\n $form->id = $question->id;\n $this->save_dataset_definitions($form);\n } else if (!empty($form->makecopy)){\n $questionfromid = $form->id ;\n $question = parent::save_question($question, $form, $course);\n //prepare the datasets\n $this->preparedatasets($form,$questionfromid);\n $form->id = $question->id;\n $this->save_as_new_dataset_definitions($form,$questionfromid );\n } else {// editing a question\n $question = parent::save_question($question, $form, $course);\n //prepare the datasets\n $this->preparedatasets($form,$question->id);\n $form->id = $question->id;\n $this->save_dataset_definitions($form);\n }\n break;\n case 'datasetdefinitions':\n\n $this->save_dataset_definitions($form);\n break;\n case 'datasetitems':\n $this->save_dataset_items($question, $form);\n $this->save_question_calculated($question, $form);\n break;\n default:\n print_error('invalidwizardpage', 'question');\n break;\n }\n return $question;\n }"
]
| [
"0.65191954",
"0.6164413",
"0.59511393",
"0.5880361",
"0.5857614",
"0.5804662",
"0.57233393",
"0.5720782",
"0.5687899",
"0.56742966",
"0.5619235",
"0.5560069",
"0.5545155",
"0.5534895",
"0.55311716",
"0.5520246",
"0.55107296",
"0.5455882",
"0.5404742",
"0.54013354",
"0.53829414",
"0.5298219",
"0.5212599",
"0.51983565",
"0.517569",
"0.51635337",
"0.51377076",
"0.5127735",
"0.51260096",
"0.51135504"
]
| 0.6646464 | 0 |
Set the default format that should be returned by this RespondScope | public function default(string $format): RespondScope
{
$this->defaultFormat = $format;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function defaultFormat()\n\t{\n\t\treturn $this->format();\n\t}",
"public function getRequestFormat($default = 'html')\n {\n if (null === $this->format) {\n $this->format = $this->get('_format', $default);\n }\n\n return $this->format;\n }",
"public static function getDefaultFormat()\n {\n return self::$defaultFormat;\n }",
"public function format($default = 'html')\n {\n return parent::format($default);\n }",
"public static function setDefaultFormat($format)\n {\n self::$default_format = $format;\n }",
"public function setDefaultFormat($format)\n {\n foreach (parent::all() as $route) {\n $route->setDefault('_format', $format);\n }\n }",
"public static function setDefaultFormat($format)\n {\n self::$defaultFormat = $format;\n }",
"public function format($format = null)\n\t{\n\t\treturn parent::format($format ? $format : $this->defaultFormat);\n\t}",
"public function to(string $format): RespondScope\n {\n $this->ensureCurrenntFormatHasResponse();\n $this->setCurrentFormat($format);\n\n return $this;\n }",
"protected function desiredResponseFormat($request) {\n return $request->responseFormat ?? $request->format() ?? 'html';\n }",
"public function provideSetFormat()\n {\n return [\n 'json' => [\n 'format' => 'json',\n ],\n 'html' => [\n 'format' => 'html',\n ],\n 'plain' => [\n 'format' => 'text',\n ],\n 'xml' => [\n 'format' => 'xml',\n ],\n ];\n }",
"public static function getDefaultFormat(): string\n {\n return static::$default_format;\n }",
"abstract protected function setFormat();",
"static function setResponseFormatPlain(){\n self::$responseFormat = 'plain';\n }",
"public function setFormat($format);",
"public function setFormat($format);",
"public function setFormat($format);",
"public function format() {\n return $this->format;\n }",
"public function setDefaultFormat( $sFormat ) {\n\t\t$this->defaultFormat = $sFormat;\n\t}",
"public function getFormat() {}",
"public function getFormat() {}",
"public function getFormat() {}",
"public function getFormat() { return $this->_format; }",
"public function format() {\r\n\t\t$this->resource->format();\r\n\t}",
"public function with($response = null): RespondScope\n {\n $this->formats[$this->currentFormat] = $response;\n\n return $this;\n }",
"public function getDefaultResourceFormatter(): DefaultResourceFormatter;",
"public function setFormat($value) {}",
"public function setFormat($format) { $this->_format = $format; }",
"public function setFormat($val)\n {\n $this->_propDict[\"format\"] = $val;\n return $this;\n }",
"public function getFormat($format){\n\t\t$this->_format = $format;\n\t}"
]
| [
"0.69388825",
"0.6875316",
"0.64943033",
"0.64198655",
"0.63429993",
"0.6292432",
"0.6276714",
"0.62698555",
"0.6217694",
"0.6181287",
"0.6171663",
"0.61587006",
"0.6130278",
"0.60930896",
"0.6040013",
"0.6040013",
"0.6040013",
"0.60008717",
"0.5993148",
"0.5974236",
"0.5974236",
"0.5974236",
"0.59706897",
"0.59639186",
"0.5942824",
"0.59317297",
"0.5929509",
"0.59173286",
"0.58996624",
"0.58712596"
]
| 0.7875316 | 0 |
Ensure the current format has a response. | protected function ensureCurrenntFormatHasResponse(): void
{
if (!$this->currentFormat) {
return;
}
if ($this->formats[$this->currentFormat] === static::NOT_SET) {
throw new MissingWithException(
"Missing `with` for response format {$this->currentFormat}"
);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function checkResponseFormat(){\n\n }",
"abstract protected function checkExistingResponse();",
"public function isValidResponse(){\n\t\treturn $this->isLoaded(); \n\t}",
"public function testSuccessfulResponseDataFormatForConfirmProcessWithValidSuccessfulStatus(): void\n {\n $this->tryTestWithRequest();\n $this->assertTrue($this->response->getOriginalResponse()->isSuccessful());\n }",
"public function validateResponseField() {\n // Active or default version set in configuration for a given\n // major version. Information is available in the call_asset/configuration.\n $active_version = (string) $this->call_asset['configuration']['active_version'];\n\n if (!isset($this->response_field[ $active_version ])) {\n // With the active version configuration, test against the call\n // response field versions if a response field for that version\n // has been defined (data can be mapped to a response field).\n\n // Call version not implemented.\n $response = [\n 'code' => 501, // Not Implemented.\n 'message' => 'Call : Call version not implemented.'\n ];\n TripalWebServiceResponse::errorResponse($response);\n }\n }",
"private function checkResponseIsSet()\n {\n if ($this->response === null) {\n $this->fail('Must call call() before assertions');\n }\n }",
"public function parseResponse() {\r\r\n\r\r\n return true;\r\r\n }",
"function deliver_response($format, $api_response)\n {\n\n // Define HTTP responses\n $http_response_code = array(200 => 'OK', 400 => 'Bad Request', 401 => 'Unauthorized', 403 => 'Forbidden', 404 => 'Not Found');\n\n // Set HTTP Response\n header('HTTP/1.1 ' . $api_response['status'] . ' ' . $http_response_code[$api_response['status']]);\n header('Content-Type: application/json; charset=utf-8');\n\n $json_response = json_encode($api_response);\n echo $json_response;\n exit;\n\n }",
"public function test_receive_throwsBadResponseFormat_ifBadFormat()\n\t{\n\t\t$this->setExpectedException('Jstewmc\\\\Api\\\\Exception\\\\BadResponseFormat');\n\t\t\n\t\t$this->url\n\t\t\t->getQuery()\n\t\t\t\t->setParameter('code', 200)\n\t\t\t\t->setParameter('format', 'json')\n\t\t\t\t->setParameter('output', '{\"foo\":}');\n\t\t\n\t\t(new Client())\n\t\t\t->send(new Request\\Get((string) $this->url))\n\t\t\t->receive(new Response\\Json());\n\t\t\n\t\treturn;\n\t}",
"function response() {\n\t\t\t$this->setInfo('Function incorrectly structured.');\n\t\t\treturn false;\n\t\t}",
"private function checkResponseStatus($response, $format)\n {\n $status = $this->curlLib->getStatus();\n if ( $status >= 400 ){\n switch($format){\n case 'json':\n default:\n $data = json_decode($response);\n if ( $status >= 500 ){\n if ( $data === null ){\n throw new PipeStackServerException('A server error has occurred. Please try again soon.');\n }\n throw new PipeStackServerException($this->jsonException($data));\n }\n switch($status){\n case 400:\n case 405:\n if ( $data === null ){\n throw new PipeStackRequestException('Invalid request. Please double check parameters and request method.');\n }\n throw new PipeStackRequestException($this->jsonException($data));\n case 401:\n case 403:\n if ( $data === null ){\n throw new PipeStackPermissionException('Invalid permissions and/or authorization. Please check your access token verify endpoint permission requirements.');\n }\n throw new PipeStackPermissionException($this->jsonException($data));\n\n case 404:\n if ( $data === null ){\n throw new PipeStackRequestException('You have requested an endpoint which does not exist. Please double check the endpoint parameter and try again.');\n }\n throw new PipeStackRequestException($this->jsonException($data));\n break;\n default:\n if ( $data === null ){\n throw new PipeStackException('An unknown PipeStack API error has occurred. Please contact PipeStack customer service.');\n }\n throw new PipeStackException($this->jsonException($data));\n break;\n }\n break;\n }\n }\n }",
"function check_esewa_response() {\n\n\t\t\t@ob_clean();\n\n\t\t\tif ( ! empty( $_REQUEST ) && $this->check_esewa_response_is_valid() ) {\n\n\t\t\t\tdo_action( 'valid-esewa-standard-response' );\n\n\t\t\t} else {\n\n\t\t\t\twp_die( 'eSewa Response Validation Failure' );\n\n\t\t\t}\n\n\t\t}",
"protected function _response() {}",
"public function isValid()\n\t{\n\t\treturn $this->response\n\t\t\t&& $this->response->isValid();\n\t}",
"public function hasResponse()\n {\n return null !== $this->response;\n }",
"public function getResponseFormatInstance()\n\t{\n\t\t### check the _responseFormatInstance property\n\t\tif (is_null($this->_responseFormatInstance)) {\n\t\t\t// the format class instance is not set, find it\n\t\t\t$requestedMimeTypes = $this->parseHTTPAcceptHeader();\n\t\t\t\n\t\t\t// loop through them, if a supported mime is found, return it\n\t\t\tforeach ($requestedMimeTypes as $requestedFormat) {\n\t\t\t\tforeach ($this->_responseFormats as $supportedFormat) {\n\t\t\t\t\tif ($requestedFormat['data_format'] === $supportedFormat['format_content_type']) {\n\t\t\t\t\t\t// match found, create instance, and set the property\n\t\t\t\t\t\t$this->_responseFormatInstance = new $supportedFormat['format_class']();\n\t\t\t\t\t\tbreak 2; // dont need to loop any further\n\t\t\t\t\t} // end if match found\n\t\t\t\t} // end inner loop (supported)\n\t\t\t} // end outer loop (requested)\n\t\t\t\n\t\t\t### if the format class was not set (and json class exists as it MUST), set it as json\n\t\t\tif ( is_null($this->_responseFormatInstance) && class_exists('ResponseFormatJSON') ) {\n\t\t\t\t// set the property as an instance of ResponseFormatJSON (a default response format/ failsafe)\n\t\t\t\t$this->_responseFormatInstance = new ResponseFormatJSON(); // included in addResponseFormat()\n\t\t\t}\n\t\t\t# if the instance is null and the json class D.N.E, normal json_encode will be used on \n\t\t\t# the response (which is definitely an error) because the json class d.n.e - automatically added by framework\n\t\t\t\n\t\t} // end if instance is set\n\t\t\n\t\t// the format class instance is not null (set in _responseFormatInstance property) return it\n\t\treturn $this->_responseFormatInstance;\n\t}",
"protected function prepare()\n {\n if ($this->stream !== null) {\n return;\n }\n if (isset($this->formatters[$this->format])) {\n $formatter = $this->formatters[$this->format];\n if (!is_object($formatter)) {\n $this->formatters[$this->format] = $formatter = \\Yii::createObject($formatter);\n }\n if ($formatter instanceof ResponseFormatterInterface) {\n $formatter->format($this);\n } else {\n throw new InvalidConfigException(\"The '{$this->format}' response formatter is invalid. It must implement the ResponseFormatterInterface.\");\n }\n } elseif ($this->format === self::FORMAT_RAW) {\n if ($this->data !== null) {\n $this->content = $this->data;\n }\n } else {\n throw new InvalidConfigException(\"Unsupported response format: {$this->format}\");\n }\n\n if (is_array($this->content)) {\n\n throw new InvalidParamException(\"Response content must not be an array.\");\n } elseif (is_object($this->content)) {\n if (method_exists($this->content, '__toString')) {\n $this->content = $this->content->__toString();\n } else {\n throw new InvalidParamException(\"Response content must be a string or an object implementing __toString().\");\n }\n }\n }",
"public function get_valid_response()\n {\n return $this->valid_response;\n }",
"public function test_send_returnsSelf_ifFormatIsBad()\n\t{\n\t\t$this->url\n\t\t\t->getQuery()\n\t\t\t\t->setParameter('code', 200)\n\t\t\t\t->setParameter('format', 'json')\n\t\t\t\t->setParameter('output', '{foo:}');\n\t\t\n\t\t$request = new Request\\Get((string) $this->url);\n\t\t\n\t\t$client = new Client();\n\t\t\n\t\t$this->assertSame($client, $client->send($request));\n\t\t\n\t\treturn;\n\t}",
"function deliver_response($format, $api_response){\n\n\t// Define HTTP responses\n\t$http_response_code = array(\n\t\t200 => 'OK',\n\t\t400 => 'Bad Request',\n\t\t401 => 'Unauthorized',\n\t\t403 => 'Forbidden',\n\t\t404 => 'Not Found'\n\t);\n\n\t// Set HTTP Response\n\theader('HTTP/1.1 '.$api_response['status'].' '.$http_response_code[ $api_response['status'] ]);\n\n\t// Process different content types\n\tif( strcasecmp($format,'json') == 0 ){\n\n\t\t// Set HTTP Response Content Type\n\t\theader('Content-Type: application/json; charset=utf-8');\n\n\t\t// Format data into a JSON response\n\t\t$json_response = json_encode($api_response);\n\n\t\t// Deliver formatted data\n\t\techo $json_response;\n\n\t}elseif( strcasecmp($format,'xml') == 0 ){\n\n\t\t// Set HTTP Response Content Type\n\t\theader('Content-Type: application/xml; charset=utf-8');\n\n\t\t// Format data into an XML response (This is only good at handling string data, not arrays)\n\t\t$xml_response = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'.\"\\n\".\n\t\t\t'<response>'.\"\\n\".\n\t\t\t\"\\t\".'<code>'.$api_response['code'].'</code>'.\"\\n\".\n\t\t\t\"\\t\".'<data>'.$api_response['data'].'</data>'.\"\\n\".\n\t\t\t'</response>';\n\n\t\t// Deliver formatted data\n\t\techo $xml_response;\n\n\t}else{\n\n\t\t// Set HTTP Response Content Type (This is only good at handling string data, not arrays)\n\t\theader('Content-Type: text/html; charset=utf-8');\n\n\t\t// Deliver formatted data\n\t\techo $api_response['data'];\n\n\t}\n\n\t// End script process\n\texit;\n\n}",
"protected function response()\r\n {\r\n return true;\r\n }",
"public function hasResponse(): bool\n {\n return $this->response !== null;\n }",
"public function isResponse(): bool {\n return $this->options['response'] ?? false;\n }",
"public function hasResponse(): bool\n {\n return null !== $this->response;\n }",
"public function check_response() {\n\n\t\t// To test in live mode ($_post)\n\t\t$post = ( file_get_contents( 'php://input' ) );\n\n\t\tif ( ! empty( $post ) ) {\n\t\t\tdo_action( 'valid-oyst-one-click-request', $post );\n\t\t\texit;\n\t\t}\n\t\tWC_Oyst_One_Click::log( 'Retour One Click vide', 'error' );\n\t\twp_die( 'Erreur de requête One Click', '1-Click', array( 'response' => 500 ) );\n\n\t}",
"protected function not_yet_response() {\n\t\t$error = new error( 'not-implemented-yet', __( 'Route Not Yet Implemented :(', 'your-domain' ) );\n\t\treturn new response( $error, 501, [] );\n\t}",
"public function checkValidResponse()\n {\n // do nothing if validation is disabled or request method not set\n if ( ! $this->options['validate'] || empty( $this->method ) ) return;\n\n $this->expected = $this->expectByMethod( $this->method );\n\n if ( $this->check( $this->getStatusCode(), $this->expected ) ) return;\n\n $exception = new ResponseException( \"The request was not successful! Response message was: '{$this->response}'\", $this->getStatusCode() );\n\n $exception->setExpectedStatusCode( $this->expected );\n\n throw $exception;\n }",
"public function hasResponse(): bool\n {\n return ! ($this->response === null);\n }",
"public function setResponse() {\n }",
"abstract public function response();"
]
| [
"0.7448187",
"0.68363947",
"0.6492226",
"0.638529",
"0.63733166",
"0.63580716",
"0.62774634",
"0.6240022",
"0.62112623",
"0.620083",
"0.61964935",
"0.6149381",
"0.604394",
"0.60399824",
"0.6038295",
"0.6031772",
"0.60216033",
"0.59795487",
"0.59560084",
"0.59162855",
"0.590956",
"0.5869391",
"0.5868208",
"0.5846374",
"0.5777626",
"0.5775259",
"0.5774619",
"0.5765993",
"0.57626057",
"0.5746101"
]
| 0.7007805 | 1 |
Check if file directory is writable, if not set error | private function __isWritableDir()
{
if(!$this->__getDir()->exists())
{
$this->error = 'Directory \'' . $this->__getDir()->getPath() . '\' does not exist';
return false;
}
if(!$this->__getDir()->writable())
{
$this->error = 'Directory \'' . $this->__getDir()->getPath() . '\' is not writable';
return false;
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function isWritable()\n\t{\n\t\t$this->tossIfException();\n\t\t\n\t\treturn is_writable($this->directory);\n\t}",
"public function writable()\n\t{\n\t\tif($this->exists()) // file exists check if writable\n\t\t{\n\t\t\treturn parent::writable();\n\t\t}\n\n\t\t// new file, check if directory writable\n\t\treturn $this->__getDir()->writable();\n\t}",
"public function isWriteable()\n {\n $this->is_writable = null;\n\n if ($this->exists === true) {\n } else {\n return;\n }\n\n if ($this->is_file === true) {\n } else {\n return;\n }\n\n $w = substr($this->temp_files[$this->path]->permissions, 2, 1);\n\n if ($w == 'w') {\n $this->is_writable = true;\n } else {\n $this->is_writable = false;\n }\n\n return;\n }",
"public function checkIsWritable($path);",
"public function canWriteFiles()\n {\n return is_writable(__FILE__);\n }",
"function writable() {\n\t\treturn is_file($this->path) && is_writable($this->path);\n\t}",
"function folder_is_writable(string $folder)\n{\n if (file_exists($folder)) {\n if (!is_writable($folder)) {\n throw new Exception(\"no_rights\", 1);\n } else {\n return true;\n }\n }\n return false;\n}",
"function win_is_writable($path)\n {\n }",
"private function is_writable($file) {\r\n\t\tif (file_exists($file) || is_dir($file)) { return is_writable($file); } else { return is_writable(dirname($file)); }\r\n\t}",
"function fn_check_writable_path_permissions($path)\n{\n if (is_writable($path)) {\n $result = true;\n\n } elseif (is_dir($path)) {\n $result = $path;\n\n } else {\n $result = call_user_func(__FUNCTION__, dirname($path));\n }\n\n return $result;\n}",
"function writable($file)\n{\n\treturn (file_exists($file) && is_writable($file));\n}",
"private function checkDestinationWritable()\n {\n $destination = $this->getDestination();\n $dirName = dirname($destination);\n\n if (@is_writable($dirName) && @is_executable($dirName)) {\n // all is well\n return;\n }\n\n // The above might fail on Windows, even though dir is writable\n // So, to be absolute sure that we cannot write, we make an actual write test (writing a dummy file)\n // No harm in doing that for non-Windows systems either.\n if (file_put_contents($destination, 'dummy') !== false) {\n // all is well, after all\n unlink($destination);\n return;\n }\n\n throw new CreateDestinationFileException(\n 'Cannot create file: ' . basename($destination) . ' in dir:' . dirname($destination)\n );\n }",
"public function is_writable($file);",
"public function isWritable(): bool\n {\n return is_writable($this->directory->getPath().'/'.$this->filename);\n }",
"function ensure_writable_dir($dir)\n{\n\tif (is_dir(\"./\" . $dir))\n\t{\n\t\tif (check_writeable($dir))\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn 2;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (@makedir($dir))\n\t\t{\n\t\t\t// dir created\n\t\t\tif (check_writeable($dir))\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn 3;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// dir not creatable\n\t\t\treturn 4;\n\t\t}\n\t}\n}",
"public function writable()\n {\n return is_writable($this->path);\n }",
"function file_is_writable($path, $check_for_existance = true) {\n if(is_file($path)) {\n $open = @fopen($path, 'a+');\n if($open === false) {\n return false;\n } // if\n\n @fclose($open);\n return true;\n } else {\n if($check_for_existance) {\n return false;\n } else {\n return folder_is_writable(dirname($path));\n } // if\n } // if\n }",
"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 is_writable($path)\n {\n }",
"public function is_writable($path)\n {\n }",
"public function is_writable($path)\n {\n }",
"public function is_writable($path)\n {\n }",
"public function is_writable($path)\n {\n }",
"static function checkPermissions() {\n\t\tif ( !@file_exists(self::getConfig()->getPathLogs()) || !@is_writable(self::getConfig()->getPathLogs()) ) {\n\t\t\texit(\"The LOGS folder cannot be written to by the current process: \".self::getConfig()->getPathLogs());\n\t\t}\n\t\tif ( !@file_exists(self::getConfig()->getPathTemp()) || !@is_writable(self::getConfig()->getPathTemp()) ) {\n\t\t\texit(\"The TEMP folder cannot be written to by the current process: \".self::getConfig()->getPathTemp());\n\t\t}\n\t}",
"public function isWritable() {\n\n $folder = new Folder($this->root());\n\n if(!$folder->isWritable()) return false;\n\n foreach($folder->files() as $f) {\n if(!$f->isWritable()) return false;\n }\n\n return true;\n\n }",
"private function isDirWritable($cacheDir) {\n\t\ttry {\n\t\t\tif (!is_writable(BASEPATH . $cacheDir)) {\n\t\t\t\tthrow new Fari_Exception('Cache directory ' . $cacheDir . ' is not writable.');\n\t\t\t}\n\t\t} catch (Fari_Exception $exception) { $exception->fire(); }\n\t}",
"function CheckFilePermission($filename) {\n\t//can we write?\n\tif(!is_writable($filename)) {\n\t\t//no we can't.\n\t\tif(!@chmod($filename, 0666)) {\n\t\t\t$pathtofilename = dirname($filename);\n\t\t\t//Lets check if parent directory is writable.\n\t\t\tif(!is_writable($pathtofilename)) {\n\t\t\t\t//it's not writeable too.\n\t\t\t\tif(!@chmod($pathtoffilename, 0666)) {\n\t\t\t\t\t//darn couldn't fix up parrent directory this hosting is foobar.\n\t\t\t\t\t//Lets error because of the permissions problems.\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//we can write, return 1/true/happy dance.\n\treturn true;\n}",
"function N_writable($pathfile) {\r\n\t//fix windows acls bug\r\n\t$isDir = substr($pathfile,-1)=='/' ? true : false;\r\n\tif ($isDir) {\r\n\t\tif (is_dir($pathfile)) {\r\n\t\t\tmt_srand((double)microtime()*1000000);\r\n\t\t\t$pathfile = $pathfile.'pw_'.uniqid(mt_rand()).'.tmp';\r\n\t\t} elseif (@mkdir($pathfile)) {\r\n\t\t\treturn N_writable($pathfile);\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\t@chmod($pathfile,0777);\r\n\t$fp = @fopen($pathfile,'ab');\r\n\tif ($fp===false) return false;\r\n\tfclose($fp);\r\n\t$isDir && @unlink($pathfile);\r\n\treturn true;\r\n}",
"function ensure_file_writable($path, $base_path = '') {\n $result = false;\n if ($base_path != '') {\n $base_path = rtrim($base_path, '/').'/';\n $path = trim(substr($path, count($base_path) - 1), '/');\n }\n if (file_exists($base_path.$path)) {\n $result = is_file($base_path.$path) && is_writable($base_path.$path);\n } else {\n $result = ensure_directory_writable(dirname($path), $base_path);\n }\n return $result;\n}",
"function Pico_IsWritable($file, $update_perms = false)\n{\n\tif ( (!file_exists($file)) or (is_file($file)) )\n\t{\n\t\t// check to see if parent folder is writable\n\t\t$parent_dir = dirname($file);\n\t\t\n\t\tif (is_writable($parent_dir))\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t\telseif ($update_perms == TRUE)\n\t\t{\n\t\t\t// atempt to make writable\n\t\t\tif (is_dir($parent_dir))\n\t\t\t{\n\t\t\t\t$folder_is_writable = Pico_IsWritable($parent_dir, TRUE);\n\t\t\t\treturn $folder_is_writable;\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\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\t$is_writable = is_writable($file);\n\t\n\tif (!$is_writable)\n\t{\n\t\tif ($update_perms == TRUE)\n\t\t{\n\t\t\t// try to connect via FTP and make this file writable\n\t\t\t$ftp = @Pico_ConnectFTP();\n\t\t\tif (!is_object($ftp))\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (is_file($file))\n\t\t\t\t{\n\t\t\t\t\t@$ftp->chmod($file, 0666);\n\t\t\t\t}\n\t\t\t\telseif (is_dir($file))\n\t\t\t\t{\n\t\t\t\t\t@$ftp->chmod($file, 0777);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (is_writable($file))\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\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn TRUE;\n\t}\n}"
]
| [
"0.75184405",
"0.7488649",
"0.7471751",
"0.7410834",
"0.73520565",
"0.7338351",
"0.7326392",
"0.72937536",
"0.72867465",
"0.72292745",
"0.71605533",
"0.7101645",
"0.7097808",
"0.7066095",
"0.70596075",
"0.70518583",
"0.70457953",
"0.69591564",
"0.69518423",
"0.69508433",
"0.69508433",
"0.69508433",
"0.6949939",
"0.69451314",
"0.6926219",
"0.68567467",
"0.68444353",
"0.683051",
"0.68161124",
"0.6781605"
]
| 0.7620781 | 0 |
That action will load widget with direction register with just appended LIS medcard id | public function actionLoadWidget() {
try {
if (($id = Yii::app()->getRequest()->getQuery("medcard")) == null) {
throw new CException("Can't resolve \"medcard\" identification number as query parameter");
}
if (Laboratory_Medcard::model()->findByPk($id) == null) {
throw new CException("Unresolved laboratory's medcard identification number \"{$id}\"");
}
$widget = $this->getWidget("AutoForm", [
"model" => new Laboratory_Form_Direction("laboratory.treatment.register", [
"medcard_id" => $id
])
]);
$this->leave([
"component" => $widget,
"status" => true
]);
} catch (Exception $e) {
$this->exception($e);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function wpb_load_widget() {\n register_widget( 'lrq_widget' );\n }",
"function duende_load_widget() {\n\tregister_widget( 'duende_widget' );\n}",
"function widget_load() {\n\t\tregister_widget('ilgelo_wSocial');\n\t\tregister_widget('ilgelo_wTwitter');\n\t\tregister_widget('ilgelo_banner');\n\t}",
"function gardenia_load_widget() {\n\tregister_widget( 'gardenia_widget' );\n}",
"function cm_load_widget_r() {\n\tregister_widget( 'cm_widget_r' );\n}",
"function wpb_load_widget() {\n\t\tregister_widget( 'dmv_widget' );\n\t}",
"function abc_load_widget()\n{\n register_widget('awesome_bmi_widget');\n}",
"function aw_add_load_widget() {\r\n\t\tregister_widget( 'AW_AddFeed' );\r\n\t}",
"function load_widget() {\n\n\t\tregister_widget( 'WordpressConnectWidgetActivityFeed' );\n\t\tregister_widget( 'WordpressConnectWidgetComments' );\n\t\tregister_widget( 'WordpressConnectWidgetFacepile' );\n\t\tregister_widget( 'WordpressConnectWidgetLikeBox' );\n\t\tregister_widget( 'WordpressConnectWidgetLikeButton' );\n\t\tregister_widget( 'WordpressConnectWidgetLiveStream' );\n\t\tregister_widget( 'WordpressConnectWidgetLoginButton' );\n\t\tregister_widget( 'WordpressConnectWidgetRecommendations' );\n\t\tregister_widget( 'WordpressConnectWidgetSendButton' );\n\n\t}",
"private function initializeWidgetIdentifier() {}",
"function wpwl_load_widget() {\n register_widget( 'wpwl_widget' );\n}",
"function wpb_load_widget()\n{\n register_widget( 'WC_External_API_Widget' );\n}",
"function hw_load_widget() {\n\tregister_widget( 'hw_cal_widget' );\n\tregister_widget( 'hw_custom_post_list_widget' );\n}",
"function wpc_load_widget()\n{\n register_widget('expat_category_widget');\n}",
"function d7_schema_info_widget_load_widget() {\n\tregister_widget( 'd7_schema_info_widget' );\n}",
"function load_dashboard_widget() {\n\t\tadd_action('wp_dashboard_setup', array($this,'dashboard_widget'));\n\t}",
"function load_widget_plugin_name() {\n register_widget( 'widget_plugin_name' );\n}",
"function whichet_load_widget() {\n\tregister_widget( 'WHICHet_widget' );\n\tadd_action( 'wp_enqueue_script', 'WHICHet_scripts' );\n}",
"function rs_load_widget()\n{\n\tregister_widget('rs_Widget_Agenda');\n}",
"function load_type_widget() {\n register_widget( 'custom_type_widget' );\n}",
"function ois_load_widgets() {\r\n register_widget( 'OptinSkin_Widget' );\r\n}",
"function hotpro_load_widget() {register_widget( 'data_hotpro_widget' );}",
"function MWX__load_widgets() {\n register_widget( 'widget_MWX__list_pages' );\n}",
"function dpla_search_widget_load() {\n wp_register_script('add-dpla-widget-dcplumer-js', 'http://www.dcplumer.com/dpla/dpla-search-widget-dcplumer.js', '', null,'');\n wp_enqueue_script('add-dpla-widget-dcplumer-js');\n}",
"function wp_render_widget_control($id)\n {\n }",
"function msdlab_load_contributor_widget() {\n register_widget('MSDLab_Contributor_Widget');\n}",
"function wpb_load_widget() {\r\n\tregister_widget( 'wpb_widget' );\r\n}",
"function bootstrap_side_nav_widget_load_widget() {\n\t\tregister_widget( 'bootstrap_side_nav_widget' );\n\t}",
"function ftagementor_description_Widget() {\r\r\n register_widget( 'ftagementor_description_Widget' );\r\r\n}",
"function example_load_widgets()\n{\n\tregister_widget('GuildNews_Widget');\n}"
]
| [
"0.6496114",
"0.6418215",
"0.63296527",
"0.63195854",
"0.62820244",
"0.62673897",
"0.6234906",
"0.62105554",
"0.6161001",
"0.614109",
"0.60771",
"0.6039221",
"0.5980526",
"0.5964328",
"0.58754987",
"0.5870166",
"0.58274585",
"0.5814425",
"0.5804099",
"0.5769951",
"0.57607055",
"0.57598484",
"0.57221544",
"0.5713543",
"0.5706881",
"0.5705068",
"0.5690514",
"0.56706494",
"0.5644479",
"0.5631662"
]
| 0.743349 | 0 |
Check support active flag in current company | public function check_support_company_active($cid){
$this->db->select('*')->from('t_support');
$this->db->where(array(
'cid'=>$cid,
'active_flag'=>1,
'delete_flg '=>0
));
$query = $this->db->get();
return ($query->num_rows() > 0) ? true : false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function companyIsActive()\n {\n return true ;\n }",
"public function is_active(): bool;",
"public function is_active();",
"public function check_activation_status () {\n $licenses_link = get_option( $this->token . '-url', '' );\n //echo \"<pre>\"; print_r( $this ); echo \"</pre>\"; die();\n $products = $this->get_detected_products();\n //echo \"<pre>\"; print_r( $products ); echo \"</pre>\"; die();\n $messages = array();\n if ( 0 < count( $products ) ) {\n foreach ( $products as $k => $v ) {\n if ( isset( $v['product_status'] ) && 'inactive' == $v['product_status'] ) {\n if( !empty( $licenses_link ) ) {\n $message = sprintf( __( '%s License is not active. To get started, activate it <a href=\"%s\">here</a>.', $this->domain ), $v['product_name'], $licenses_link );\n } else {\n $message = sprintf( __( '%s License is not active.', $this->domain ), $v['product_name'] );\n }\n if( !empty( $v[ 'errors_callback' ] ) && is_callable( $v[ 'errors_callback' ] ) ) {\n call_user_func_array( $v[ 'errors_callback' ], array( $message, 'warning' ) );\n } else {\n $messages[] = $message;\n }\n }\n }\n }\n if( !empty( $messages ) ) {\n $this->messages = $messages;\n }\n\n /**\n * We also ping UD server once per 24h\n * for getting any specific information.\n */\n $this->maybe_ping_ud();\n }",
"public function check_addon_status()\n {\n $checker = array('unique_identifier' => $this->unique_identifier);\n $this->db->where($checker);\n $addon_details = $this->db->get('addons')->row_array();\n if ($addon_details['status']) {\n return true;\n } else {\n redirect(site_url(), 'refresh');\n }\n }",
"public function ticketIsActive()\n {\n return true ;\n }",
"function getIsActive() ;",
"public function is_active( $curr ){\n\t\t$bypass_list = self::get_option( 'bypass_list', array() );\n\t\treturn ! in_array( $curr, $bypass_list );\n\t}",
"public static function isFeatureActive()\n {\n }",
"public function checkGlobalActive() {\r\n\t\tif (Mage::getStoreConfig('b2bprofessional/generalsettings/active') == 1) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}",
"public function is_company_active($company_name) {\r\n\t\t\t$query = 'SELECT `companyid`FROM `company` WHERE `company_name` = :company_name AND `active` = 1';\r\n\t\t\t$statement = $this->con->prepare($query);\r\n\t\t\t$statement->bindValue(':company_name', $company_name);\r\n\t\t\t$statement->execute();\r\n\t\t\t$valid = ($statement->rowCount() == 1);\r\n\t\t\t$statement->closeCursor();\r\n\t\t\treturn $valid;\r\n\t\t}",
"private function _current_exist() {\n return D( 'Service' )->service_exist_verifition( array( 'usr_login_id_buyer' => ( get_session_id() ), 'service_status' => array( '2' ) ) );\n }",
"public function contactIsActive()\n {\n return true ;\n }",
"public function isActive() \n {\t\n \t// if PIWIK tracking is activated return TRUE\n \tif (Mage::getStoreConfig('piwik/piwik/active')) {\n \t\treturn true;\n \t}\n \t// return FALSE otherwise\n \treturn false;\n }",
"public function IsActive ();",
"public function isActive() {}",
"public function isActive() {}",
"public function isActive() {}",
"public function isActive() {}",
"public function isActive() {}",
"public function isActive() {}",
"function genesis_extender_essentials_is_active_nag()\n\t\t{\t\t\t\n\t\t\techo '<div id=\"update-nag\">';\n\t\t\tprintf( __( '<strong>Genesis Extender & Genesis Essentials Are Currently Active!</strong> These two Cobalt Apps products are not to be used together so deactivate <a href=\"%s\">Genesis Extender</a> or <a href=\"%s\">Genesis Essentials</a>.', 'extender' ), admin_url( 'plugins.php' ), admin_url( 'plugins.php' ) );\n\t\t\techo '</div>';\n\t\t}",
"public function isActive();",
"public function isActive();",
"public function isActive();",
"public function isActive();",
"public function getIsActive() {}",
"public function isTagalysActive()\n\t{\n\t\t//$status = $this->scopeConfig->getValue('tgs_search/default/status', \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE);\n\t\t$status = $this->scopeConfig->getValue('tagalys_tglssearch/general/enable', \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE);\n\n\t\tif ($status)\n\t\t{\n\n\t\t\t//$service = $this->tglssearchClientConnector;\n\t\t\t$service = $this->tglssearchClientConnector;\n\t\t $tagalys = $service->isRequestSuccess();\n\t\t if($tagalys)\n\t\t\t{\n\t\t\t\t//print_r('if');die;\n\t\t \treturn $service;\n\t\t }\n\t\t\telse\n\t\t\t{\n\t\t\t\t//print_r('else');die;\n\t\t \treturn false;\n\t\t }\n\n\t\t} else\n\t\t{\n\t\t\t//print_r('false');die;\n\t\t\treturn false;\n\t\t}\n\t\t//print_r('nthg');die;\n\t}",
"public function is_needed() {\n\t\treturn $this->context->site_represents === 'company';\n\t}",
"public function checkCompanyStoreOfCurrentDate()\n {\n $hFunction = new \\Hfunction();\n $modelStaff = new QcStaff();\n $modelCompanyStoreCheck = new QcCompanyStoreCheck();\n $dataStaffLogin = $modelStaff->loginStaffInfo();\n if ($hFunction->checkCount($dataStaffLogin)) {\n $dataCompanyStaffWorkLogin = $modelStaff->loginCompanyStaffWork();\n $companyLoginId = $dataCompanyStaffWorkLogin->companyId();\n # chua duoc phan cong\n $checkHourDefault = date('Y-m-d H:i', strtotime(date('Y-m-d 08:10')));\n $checkHourCurrent = date('Y-m-d H:i');\n # phan cong kiem tra do nghe duoc duyet sau gio cham cong - (chi phan cho nguoi di lam)\n if ($checkHourDefault < $checkHourCurrent) {\n $checkDate = date('Y-m-d');\n # kiem tra ngay hien tai duoc phan cong kiem tra hay chua cua 1 cong cty\n if (!$modelCompanyStoreCheck->checkExistDateOfCompany($companyLoginId, $checkDate)) {\n # lay danh sach lam viec cua bo phan thi cong cap nhan vien\n $dataStaffWorkConstruction = $this->infoActivityConstructionStaffRankOfCompany($companyLoginId);\n if ($hFunction->checkCount($dataStaffWorkConstruction)) {\n $selectedStaffWorkId = null;\n $workStatus = false; // trang thai nv thi cong co di lam - xet tranh refesh vong lap vo tan\n foreach ($dataStaffWorkConstruction as $staffWorkConstruction) {\n $workId = $staffWorkConstruction->workId();\n # co bao cham cong\n if ($this->checkTimekeepingProvisionalOfCurrentDate($workId)) {\n # chưa duoc phan cong trong vong kiem tra\n if (!$modelCompanyStoreCheck->checkExistWorkReceived($workId)) {\n $selectedStaffWorkId = $workId;\n break;\n }\n $workStatus = true;\n }\n\n }\n # co nhan vien dc chon\n if (!$hFunction->checkEmpty($selectedStaffWorkId)) {\n # them vao phan cong kiem tra do nghe\n $modelCompanyStoreCheck->insert($selectedStaffWorkId);\n } else {\n # van co nv thi cong di lam viec - tao lai vong moi\n if ($workStatus) {\n # lam moi lại vong kiem tra\n $modelCompanyStoreCheck->refreshCheckAround();\n # phan cong lai\n $this->checkCompanyStoreOfCurrentDate();\n } else {\n # khong ai cham cong - giu nguyen\n }\n }\n }\n }\n } else {\n # kiem tra ton tai phan cong chua xac nhan kiem tra\n $dataCompanyStoreCheck = $modelCompanyStoreCheck->lastInfoUnConfirmOfCompany($companyLoginId);\n if ($hFunction->checkCount($dataCompanyStoreCheck)) {\n # cap nhat tu dong\n $modelCompanyStoreCheck->autoConfirm($dataCompanyStoreCheck->checkId());\n }\n }\n }\n\n }"
]
| [
"0.70643556",
"0.6656848",
"0.66546786",
"0.6404912",
"0.63591754",
"0.6288274",
"0.62856793",
"0.6234793",
"0.62048984",
"0.6181672",
"0.6169948",
"0.61626506",
"0.6129062",
"0.6117339",
"0.61054987",
"0.60971445",
"0.60971445",
"0.60971445",
"0.60971445",
"0.60948503",
"0.60948503",
"0.6093209",
"0.609304",
"0.609304",
"0.609304",
"0.609304",
"0.60912806",
"0.60741955",
"0.60615444",
"0.6055553"
]
| 0.6950414 | 1 |
Search company reward point | public function get_search_reward_point($reward_point,$limit, $start,$reward = 'pt'){
$this->db->select("t_company.name as company, m_category.category_name as category,t_support.company_reward_id as company_reward_id");
$this->db->from("t_support");
$this->db->join("t_company","t_company.cid = t_support.cid");
$this->db->join("m_category","m_category.category_id = t_company.category_id");
$this->db->limit($limit, $start);
if($reward == 'rate'){
$this->db->where('t_support.reward_point_rate >=',($reward_point*2));//result display in UC-17 ->t_support.reward_point 50%
}
else{
$this->db->where('t_support.reward_point >=',($reward_point*2));//result display in UC-17 ->t_support.reward_point 50%
}
$this->db->where(" t_support.delete_flg",0);
$this->db->where(" t_support.active_flag",1);
$this->db->where(" t_company.delete_flg",0);
// var_dump($this->db->get_compiled_select());exit();
$query = $this->db->get();
return $query->num_rows() > 0 ? $query->result_object() : false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function search()\n {\n auth_admin();\n if ($_SERVER['REQUEST_METHOD'] == 'POST') {\n $post = $this->input->post();\n $query = $this->Redeem_Point->GetAllRedeem($post['card_id'], $post['username'], $post['police_number'],\n $post['vin_number']);\n if ($query->num_rows() > 0) {\n $no = 0;\n $path_uri = $this->path_uri;\n foreach ($query->result_array() as $buf) {\n $no++;\n $id = $buf['id'];\n $uname = $buf['username'];\n $car = $buf['brands'] . ' ' . $buf['types'] . ' ' . $buf['series'] . ' ' . $buf['model']; // . ' ' . $buf['transmisi'] . ' ' . $buf['engine'] . ' ' . $buf['car_cc'] . ' ' .$buf['color'];\n $pnumber = $buf['police_number'];\n $vnumber = $buf['vin_number'];\n $reward = $buf['point_reward'];\n // $reward\t\t= $buf['stnk_date'];\n\n $edit_href = ($reward > 0) ? site_url($path_uri . '/edit/' . $id) : '#';\n $list_data[] = array(\n 'no' => $no,\n 'id' => $id,\n 'uname' => $uname,\n 'car' => $car,\n 'reward' => $reward,\n 'pnumber' => $pnumber,\n 'vnumber' => $vnumber,\n 'edit_href' => $edit_href,\n 'hist' => '<a href=\"javascript:void(0)\" onclick=\"show(\\'' . $id . '\\');\">view</a>'\n );\n }\n $dbuf = array(\n 'base_url' => base_url(),\n 'file_app' => $this->ctrl,\n 'menu_title' => $this->title,\n 'list_data' => $list_data,\n 'path_app' => $this->path,\n );\n\n $data = $this->parser->parse($this->template . '/list_item.html', $dbuf, true);\n echo $data, exit;\n }\n }\n echo '0', exit;\n }",
"public static function SearchOffer(){\n\n\n\n\t\t}",
"public function advanceSearch($data) {\n /**\n * Initilizing price for filter\n */\n $amount = explode ( \"-\", $data [\"amount\"] );\n $minval = $amount [0];\n $maxval = $amount [1]; \n /**\n * Filter by booking enable\n */ \n $copycollection = Mage::getModel ( 'catalog/product' )->getCollection ()->addAttributeToSelect ( '*' )->addFieldToFilter ( array (\n array (\n 'attribute' => 'status',\n 'eq' => '1' \n ) \n ) )->addFieldToFilter ( array (\n array (\n 'attribute' => 'propertyapproved',\n 'eq' => '1' \n ) \n ) ); \n /**\n * Filter by price\n */ \n if (Mage::getStoreConfig ( 'airhotels/max_min/price_select' ) == 0) {\n $copycollection->setOrder ( 'price', 'asc' );\n } else {\n $copycollection->setOrder ( 'price', 'desc' );\n } \n $copycollection->addFieldToFilter ( 'price', array (\n 'gteq' => $minval \n ) ); \n $copycollection->addFieldToFilter ( 'price', array (\n 'lteq' => $maxval \n ) ); \n /**\n * Filter by city, state, country value from address value\n */\n $copycollection = Mage::getModel('airhotels/status')->roomTypeFilter($data,$copycollection); \n $copycollection = Mage::getModel('airhotels/status')->searchResult($data,$copycollection); \n if ($data [\"amenityVal\"] != '') {\n /**\n * Filter by amenity\n */\n $amenityString = $data [\"amenityVal\"];\n $amenityArray = explode ( \",\", $amenityString );\n if (count ( $amenityArray ) >= 1) {\n foreach ( $amenityArray as $amenity ) { \n $copycollection->addFieldToFilter ( array (\n array (\n 'attribute' => 'amenity',\n 'like' => \"%$amenity%\" \n ) \n ) );\n }\n } else { \n $copycollection->addFieldToFilter ( array (\n array (\n 'attribute' => 'amenity',\n 'like' => \"%$amenityString%\" \n ) \n ) );\n }\n }\n $copycollection = Mage::getModel('airhotels/status')->availableProducts($data,$copycollection);\n /**\n * Set page size for display result\n */ \n $copycollection->setPage ( $data [\"pageno\"], 6 ); \n return $copycollection;\n }",
"public function search();",
"public function search();",
"function getMarketResearchesDirectPayment($game_id,$round_number,$company_id){\r\n\t\t\t$market=new Model_DbTable_Decisions_MarketResearches();\r\n\t\t\t$param_marketresearches=new Model_DbTable_Games_Param_Markets_MarketResearches();\r\n\t\t\t//funcionando correctamente. Estudios de mercado solicitados y costes\r\n\t\t\t$marketresearches_solicited=$market->getMarketResearchesSolicited($game_id, $company_id, $round_number);\r\n\t\t\t$marketresearches_costs=$param_marketresearches->getMarketResearchesCosts($game_id);\r\n\t\t\t\r\n\t\t\t$research_number=1;\r\n\t\t\t$totalCost=0;\r\n\t\t\t\r\n\t\t\t$names[0]=array('value'=>1, 'descriptor'=>'channelResearch');\r\n\t\t\t$names[1]=array('value'=>2, 'descriptor'=>'pricesResearch');\r\n\t\t\t$names[2]=array('value'=>3, 'descriptor'=>'mktResearch');\r\n\t\t\t$names[3]=array('value'=>4, 'descriptor'=>'spectedResearch');\r\n\t\t\t$names[4]=array('value'=>5, 'descriptor'=>'accountResearch');\r\n\t\t\t\r\n\t\t\twhile(isset($marketresearches_costs['marketResearch_number_'.$research_number])) {\t\t\t\t\r\n\t\t\t\t$aux=$marketresearches_solicited[$names[$research_number-1]['descriptor']];\r\n\t\t\t\t$cost=$marketresearches_costs['marketResearch_number_'.$research_number];\r\n\t\t\t\t$totalCost=$totalCost+($aux*$cost);\r\n\t\t\t\t$research_number++;\r\n\t\t\t}\r\n\t\t\treturn $totalCost;\r\n\t\t}",
"public function search() {\r\n\t\t$mintURL = $this->Configuration->findByName('Mint URL');\r\n\t\t$queryURL = $mintURL['Configuration']['value'];\r\n\t\t$query = '';\r\n\t\tif (isset($this->params['url']['query'])) {\r\n\t\t\t$query = $this->params['url']['query'];\r\n\t\t}\r\n\r\n\t\t$queryURL = $queryURL.\"/Parties_People/opensearch/lookup?searchTerms=\".$query;\r\n\t\t$queryResponse = \"error\";\r\n\n\t\t$ch = curl_init();\r\n\t\t$timeout = 5;\r\n\t\tcurl_setopt($ch,CURLOPT_URL,$queryURL);\r\n\t\tcurl_setopt($ch,CURLOPT_RETURNTRANSFER,1);\r\n\t\tcurl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);\r\n\t\t$queryResponse = curl_exec($ch);\r\n\t\tcurl_close($ch);\r\n\r\n\t\t$this->autoRender = false;\r\n\t\t$this->response->type('json');\r\n\r\n\t\t$this->response->body($queryResponse);\r\n\t}",
"public function index()\n {\n $search['q'] = request('q');\n\n $creditRequests = CreditRequest::with('quotation.user','user','credits')->search($search['q'])->paginate(10);\n \n \n \n\n return view('credit.credits.index', compact('credits','search'));\n \n }",
"public function search(){}",
"public function search(){\n //includes google maps script for place autocomplete and to get experiences\n \t$this->set('jsIncludes',array('http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&language=fr&libraries=places','places_autocomplete','get_experiences','logo_fly','jquery.dropdown','cookies'));\n \n //sets motives, schools and departments by alphbetical order\n $this->__set_motives_schools_and_departments();\n }",
"function search() {}",
"function findcompanys() {\n $this->auth(SUPPORT_ADM_LEVEL);\n $search_word = $this->input->post('search');\n if($search_word == '-1'){ //initial listing\n $data['records'] = $this->m_company->getAll(40);\n } else { //regular search\n $data['records'] = $this->m_company->getByWildcard($search_word);\n }\n $data['search_word'] = $search_word;\n $this->load->view('/admin/support/v_companys_search_result', $data);\n }",
"public function search()\n\t{\n\t\t\n\t}",
"public function getSearch();",
"public function searchAction(){\r\n \t$request = $this->getRequest();\r\n \t$q = $request->query->get('q');\r\n \tif(trim($q) == null || trim($q) == \"Encontre cupons de compra coletiva\"){\r\n \t\treturn $this->redirectFlash($this->generateUrl('aggregator_aggregator_index'), 'Digite um termo para a busca', 'error');\r\n \t}\r\n \t$ret['q'] = $q;\r\n \t$ret['breadcrumbs'][]['title'] = 'Resultado da busca por \"'.$q.'\" em '.$this->get('session')->get('reurbano.user.cityName');\r\n \treturn $ret;\r\n }",
"public function getCreditRequests()\n {\n $search['q'] = request('q');\n\n $partner = auth()->user()->companies->first();\n\n $creditRequests = CreditRequest::search($search['q'])->with('quotation.user','user','credits')->paginate(10);\n\n return $creditRequests;\n /*$creditRequestsPublic = CreditRequest::search($search['q'])->where('public',1)->with('quotation.user','user','shippings')->get()->all();\n \n $creditRequestsPrivate = CreditRequest::search($search['q'])->where('public', 0)->whereHas('suppliers', function($q) use($partner){\n $q->where('shipping_request_supplier.supplier_id', $partner->id);\n })->get()->all();\n\n $creditRequests = array_collapse([$creditRequestsPublic, $creditRequestsPrivate]);\n\n // dd($creditRequests);\n \n \n $paginator = paginate($creditRequests, 10);\n \n return $paginator; */\n \n \n\n \n \n }",
"function match_survey()\n {\n $type_array = $this->input->post('company_type');\n $pace_array = $this->input->post('company_pace');\n $lifecycle_array = $this->input->post('lifecycle');\n $corp_citizenship = $this->input->post('corp_citizenship');\n\n //put the values from those arrays into strings so they can be added to the query\n $imploded_type = implode(\" OR \", $type_array);\n $imploded_pace = implode(\" OR \", $pace_array);\n $imploded_lifecycle = implode(\" OR \", $lifecycle_array);\n\n $sql = 'SELECT id,company_name FROM company where (type_id = '.$imploded_type.')\n AND (pace_id = '.$imploded_pace.')\n AND (lifecycle_id = '.$imploded_lifecycle.')';\n //run the query\n $query = $this->db->query($sql);\n //return $query->result(); \n if ($query->num_rows() > 0)\n {\n //build array of company ids that came from the last query...so we can use them in the upcoming query\n foreach ($query->result_array() as $row) {\n //$companyid_array[]=$row;\n $companyid_array[]=$row['id'];\n }\n $queried_comp_ids = implode(',', $companyid_array);\n \n //get the user submitted benefits ranking\n $user_benefits_array = $this->input->post('users_benefits'); \n \n //$this->output->enable_profiler(TRUE);\n \n //get all the companies (that meet the previous criteria) and their associated benefits\n $sql2 = 'SELECT company_id,benefits_id FROM company_benefits WHERE company_id IN ('.$queried_comp_ids.')';\n $query2 = $this->db->query($sql2);\n \n //build an array with a specific format to be used in the upcoming scoring process\n $company_set = array();\n foreach ($query2->result_array() as $row) {\n $company_set[$row['company_id']][]=$row['benefits_id'];\n }\n \n $scores = array();\n // For every company, we will assign it a score based on what benefits it has\n // and how the user ranked that benefit. Higher ranks are more valuable, so the highest\n // total score wins.\n foreach($company_set as $company_id => $array_row)\n { \n $score = 0;\n foreach ($array_row as $key=>$benefit_id)\n {\n //this line grabs the user's ranking for the benefit_id that this particular company has\n //and assigns it to the score variable. this will be added to the scores matrix\n //and a tally will be kept for each company. \n //KEY POINT: The benefit that is most desired has the highest rank value. For example,\n // if there are 10 options, the user's most desired benefit has a rank of 10. The least\n // desired has a rank of 1.\n \n $score += $user_benefits_array[$benefit_id]['rank'];\n }\n $scores[$company_id] = $score;\n\n }\n \n arsort($scores);\n /* echo \"scores: <br>\";\n print_r($scores);*/\n //reset($scores);\n //$first_key = key($scores);\n //echo \"Best score is company id: \".$first_key;\n //Array ( [1] => 88 [3] => 67 [4] => 65 )\n $ranked_comps = array_keys($scores);\n //return $ranked_comps;\n return $scores;\n\n } else {\n //echo \"<br>from the model: there were no results.\";\n }\n \n }",
"public function haz_eff_hea(){\n $this->search_list();\n\t}",
"function fb_find($agent_name) {\n session_start();\n $realtor_search_array = array(\"realtor\", \"real estate agent\", \"real estate\", \"realty\", \"agent\", \"broker\", \"associate\",\"owner\", \"team\");\n\n // Include the required dependencies.\n require_once( 'vendor/autoload.php' );\n include(\"db_config\");\n\n // Initialize the Facebook PHP SDK v5.\n $fb = new Facebook\\Facebook([\n 'app_id' => '',\n 'app_secret' => '',\n 'default_graph_version' => 'v2.8',\n ]);\n\n $token = json_decode(file_get_contents(\"https://graph.facebook.com/oauth/access_token?client_id=&client_secret=&grant_type=client_credentials\"));\n $fb->setDefaultAccessToken($token->access_token);\n\n try {\n $response = $fb->get('/search?q=Maryalice+Ryan+real+estate&type=page');\n } catch(Facebook\\Exceptions\\FacebookResponseException $e) {\n // When Graph returns an error\n echo 'Graph returned an error: ' . $e->getMessage();\n exit;\n } catch(Facebook\\Exceptions\\FacebookSDKException $e) {\n // When validation fails or other local issues\n echo 'Facebook SDK returned an error: ' . $e->getMessage();\n exit;\n }\n\n //$output = $response->getGraphObject();\n $output = $response->getGraphEdge();\n $num_results = count($output);\n foreach($output as $graphNode) {\n $page_id = $graphNode->getField('id');\n $name = $graphNode->getField('name');\n $company = array(\"Coldwell\", \"Banker\", \"Residential\", \"Brokerage\", \"Westfield\", \"East\", \"Office\");\n $confidence = 0;\n if(contains($name, $company)) {\n $confidence += 5;\n }\n\n if(contains($name, $realtor_search_array)) {\n $confidence += 2;\n }\n\n $page_details = $fb->get('/'.$id.'?fields=about,phone,emails');\n $details = $page_details->getGraphObject();\n $emails = $details->getField('emails');\n $phone = $details->getField('phone');\n\n if($confidence >= 7 || $num_results == 1) {\n return $emails[0];\n break;\n }\n else if($confidence == 2) {\n preg_match(\"/\\((\\d\\d\\d)\\)\", $phone, $matches);\n if(checkAreaCode($matches[1], $addressState)) {\n return $emails[0];\n break;\n }\n\n }\n }\n}",
"public function searchRechargeEspece()\n {\n $this->utils->Restreindre($this->userConnecter->admin, $this->utils->Est_autoriser(46, $this->userConnecter->profil));\n $data['lang'] = $this->lang->getLangFile($this->getSession()->getAttribut('lang'));\n $params = array('view' => 'compte/recharge-espece-carte-search');\n $this->view($params, $data);\n }",
"function searchAction() {\n\t\t$this->getModel()->setPage($this->getPageFromRequest());\n\t\t$this->getInputManager()->setLookupGlobals(utilityInputManager::LOOKUPGLOBALS_GET);\n\t\t$inData = $this->getInputManager()->doFilter();\n\t\t$this->addInputToModel($inData, $this->getModel());\n\t\t$oView = new userView($this);\n\t\t$oView->showSearchLeaderboard();\n\t}",
"function points_vouchers()\n\t\t{\n\t\t\tif ( ! $this->data['user'])\n\t\t\t{\n\t\t\t\t$this->flexi_cart_admin->set_error_message('You must login to view reward points and vouchers.', 'public', TRUE);\n\t\t\t\tredirect('login');\n\t\t\t}\n\n\t\t\t$user_id = $this->data['user']->id;\n\n\t\t\t$this->load->library('flexi_cart_admin');\n\n\t\t\t$this->load->model('demo_cart_admin_model');\n\n\t\t\t// Check if POST data has been submitted, if so, call the custom demo model function to handle the submitted data.\n\t\t\tif ($this->input->post('convert_reward_points'))\n\t\t\t{\n\t\t\t\t$this->demo_cart_admin_model->demo_convert_reward_points($user_id);\n\t\t\t\t// Set a message to the CI flashdata so that it is available after the page redirect.\n\t\t\t\t$this->session->set_flashdata('message', $this->flexi_cart->get_messages());\n\t\t\t\tredirect(current_url());\n\t\t\t}\n\n\t\t\t$this->load->model('users_model');\n\n\t\t\t// Variable \"person\" is used because \"user\" is already being used for currently signed in user.\n\t\t\t$this->data['person'] = $this->users_model->get_details($user_id);\n\n\t\t\t// Get an array of all the reward vouchers filtered by the id in the url.\n\t\t\t// Using flexi cart SQL functions, join the demo user table with the discount table.\n\t\t\t$sql_where = array($this->flexi_cart_admin->db_column('discounts', 'user') => $user_id);\n\t\t\t// $this->flexi_cart_admin->sql_join('demo_users', 'user_id = '.$this->flexi_cart_admin->db_column('discounts', 'user'));\n\t\t\t$this->data['voucher_data_array'] = $this->flexi_cart_admin->get_db_voucher_query(FALSE, $sql_where)->result_array();\n\n\t\t\t// Get user remaining reward points.\n\t\t\t$summary_data = $this->flexi_cart_admin->get_db_reward_point_summary($user_id);\n\t\t\t$this->data['points_data'] = array(\n\t\t\t\t'total_points' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points')],\n\t\t\t\t'total_points_pending' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_pending')],\n\t\t\t\t'total_points_active' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_active')],\n\t\t\t\t'total_points_active' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_active')],\n\t\t\t\t'total_points_expired' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_expired')],\n\t\t\t\t'total_points_converted' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_converted')],\n\t\t\t\t'total_points_cancelled' => $summary_data[$this->flexi_cart_admin->db_column('reward_points', 'total_points_cancelled')]\n\t\t\t);\n\n\t\t\t// Get an array of a demo user and their related reward points from a custom demo model function, filtered by the id in the url.\n\t\t\t$reward_data = $this->demo_cart_admin_model->demo_reward_point_summary($user_id);\n\t\t\t\n\t\t\t// Note: The custom function returns a multi-dimensional array, of which we only need the first array, so get the first row '$user_data[0]'.\n\t\t\t$this->data['reward_data'] = $reward_data[0];\n\n\t\t\t// Get the conversion tier values for converting reward points to vouchers.\n\t\t\t$conversion_tiers = $this->data['reward_data'][$this->flexi_cart_admin->db_column('reward_points', 'total_points_active')];\n\t\t\t$this->data['conversion_tiers'] = $this->flexi_cart_admin->get_reward_point_conversion_tiers($conversion_tiers);\n\n\t\t\t// Get an array of all reward points for a user.\n\t\t\t$sql_select = array(\n\t\t\t\t$this->flexi_cart_admin->db_column('reward_points', 'order_number'),\n\t\t\t\t$this->flexi_cart_admin->db_column('reward_points', 'description'),\n\t\t\t\t$this->flexi_cart_admin->db_column('reward_points', 'order_date')\n\t\t\t);\t\n\t\t\t$sql_where = array($this->flexi_cart_admin->db_column('reward_points', 'user') => $user_id);\n\t\t\t$this->data['points_awarded_data'] = $this->flexi_cart_admin->get_db_reward_points_query($sql_select, $sql_where)->result_array();\n\t\t\t\n\t\t\t// Call a custom function that returns a nested array of reward voucher codes and the reward point data used to create the voucher.\n\t\t\t$this->data['points_converted_data'] = $this->demo_cart_admin_model->demo_converted_reward_point_history($user_id);\n\n\t\t\t// Get any status message that may have been set.\n\t\t\t$this->data['message'] = $this->session->flashdata('message');\n\n\t\t\t$this->load->view('public/dashboard/points_and_vouchers_view', $this->data);\n\t\t}",
"private function findRecommendation(){\n $placeModel = new Place();\n $places = $placeModel->getAllCategorized();\n $bestScore = PHP_INT_MAX;\n $idBest = 0;\n\n foreach($places as $place){\n $currScore = 0;\n $currScore += abs($place->heritage - $this->score['heritage'] );\n $currScore += abs($place->relax - $this->score['relax'] );\n $currScore += abs($place->sightseeing - $this->score['sightseeing']);\n $currScore += abs($place->weather - $this->score['weather']) ;\n $currScore += abs($place->populated - $this->score['populated'] );\n\n if($currScore < $bestScore){\n $bestScore = $currScore;\n $idBest = $place->id_plc;\n }\n\n }\n\n return $idBest;\n }",
"public function searchPrint()\n {\n // should not be searched.\n\n $criteria=new CDbCriteria;\n\t\t$criteria->compare('bodymassindex_id',$this->bodymassindex_id);\n\t\t$criteria->compare('LOWER(bmi_range)',strtolower($this->bmi_range),true);\n\t\t$criteria->compare('bmi_minimum',$this->bmi_minimum);\n\t\t$criteria->compare('bmi_maksimum',$this->bmi_maksimum);\n\t\t$criteria->compare('LOWER(bmi_sign)',strtolower($this->bmi_sign),true);\n\t\t$criteria->compare('LOWER(bmi_defenisi)',strtolower($this->bmi_defenisi),true);\n\t\t$criteria->compare('LOWER(bmi_pesan)',strtolower($this->bmi_pesan),true);\n\t\t$criteria->compare('bodymassindex_aktif',$this->bodymassindex_aktif);\n // Klo limit lebih kecil dari nol itu berarti ga ada limit \n $criteria->limit=-1; \n\n return new CActiveDataProvider($this, array(\n 'criteria'=>$criteria,\n 'pagination'=>false,\n ));\n }",
"public static function search() {\r\n $result = lC_Default::find($_GET['q']);\r\n\r\n echo $result;\r\n }",
"function controlSearch($result){\n\t\t$bookIDs = $this->getBookIDs($result);\n\t\t$bookObjects = array();\n\n\t\tfor($i = 0; $i < count($bookIDs); $i++){\n\t\t\t$bookObject = constructBook($bookIDs[$i]);\n\t\t\t$bookObjects[$i] = $bookObject;\n\t\t}\n\t\t\n\t\t$currentPatronID = $_SESSION['currentPatronID'];\n\t\t$currentPatron = constructPatron($currentPatronID);\n\t\t$patronDep = $currentPatron->getDepartment();\n\n\t\t$suggestedBooks = $this->executeSuggestion($patronDep);\n\t\t\n\t\t$result_one=$this->displaySearch($bookObjects, $suggestedBooks);\n\t\t\n\t\treturn $result_one;\n\t}",
"public function searchAction() {\n $search = $this->getParam('search');\n\n\n $queryBuilder = new Application_Util_QueryBuilder($this->getLogger());\n\n $queryBuilderInput = array(\n 'searchtype' => 'simple',\n 'start' => '0',\n 'rows' => '10',\n 'sortOrder' => 'desc',\n 'sortField'=> 'score',\n 'docId' => null,\n 'query' => $search,\n 'author' => '',\n 'modifier' => 'contains_all',\n 'title' => '',\n 'titlemodifier' => 'contains_all',\n 'persons' => '',\n 'personsmodifier' => 'contains_all',\n 'referee' => '',\n 'refereemodifier' => 'contains_all',\n 'abstract' => '',\n 'abstractmodifier' => 'contains_all',\n 'fulltext' => '',\n 'fulltextmodifier' => 'contains_all',\n 'year' => '',\n 'yearmodifier' => 'contains_all',\n 'author_facetfq' => '',\n 'languagefq' => '',\n 'yearfq' => '',\n 'doctypefq' => '',\n 'has_fulltextfq' => '',\n 'belongs_to_bibliographyfq' => '',\n 'subjectfq' => '',\n 'institutefq' => ''\n );\n\n\n $query = $queryBuilder->createSearchQuery($queryBuilderInput, $this->getLogger());\n\n $result = array();\n\n $searcher = new Opus_SolrSearch_Searcher();\n try {\n $result = $searcher->search($query);\n }\n catch (Opus_SolrSearch_Exception $ex) {\n var_dump($ex);\n }\n\n $matches = $result->getReturnedMatches();\n\n $this->view->total = $result->getAllMatchesCount();\n $this->view->matches = $matches;\n }",
"public function searchPrint()\n {\n // should not be searched.\n\n $criteria=new CDbCriteria;\n\t\t$criteria->compare('rekening3_id',$this->rekening3_id);\n//\t\t$criteria->compare('rekening1_id',$this->rekening1_id);\n\t\t$criteria->compare('rekening2_id',$this->rekening2_id);\n\t\t$criteria->compare('LOWER(kdrekening3)',strtolower($this->kdrekening3),true);\n\t\t$criteria->compare('LOWER(nmrekening3)',strtolower($this->nmrekening3),true);\n\t\t$criteria->compare('LOWER(nmrekeninglain3)',strtolower($this->nmrekeninglain3),true);\n\t\t$criteria->compare('rekening3_aktif',$this->rekening3_aktif);\n // Klo limit lebih kecil dari nol itu berarti ga ada limit \n $criteria->limit=-1; \n\n return new CActiveDataProvider($this, array(\n 'criteria'=>$criteria,\n 'pagination'=>false,\n ));\n }",
"public function search()\n {\n $criteria = new CDbCriteria();\n\n if ($this->scenario == 'search_global') {\n $criteria->addColumnCondition(array('isGlobal' => 1));\n if ($this->relaxId == '1') {\n $criteria->addCondition('relaxId IS NOT NULL AND status = \"'.self::STATUS_APPROVED.'\"');\n } elseif ($this->relaxId == '0') {\n $criteria->addCondition('relaxId IS NULL AND status = \"'.self::STATUS_APPROVED.'\"');\n }\n } elseif ($this->scenario == 'search_users') {\n $criteria->addCondition('userId IS NOT NULL AND isGlobal = 0 AND (status = \"'.self::STATUS_APPROVED.'\" OR status = \"'.self::STATUS_DECLINED.'\")');\n } elseif ($this->scenario == 'search_on_validation') {\n $criteria->addCondition('userId IS NOT NULL AND isGlobal = 0 AND status = \"'.self::STATUS_WAITING.'\"');\n } elseif($this->scenario == 'search_from_relax') {\n $criteria->addCondition('relaxId IS NOT NULL AND isGlobal = 1 AND status = \"'.self::STATUS_WAITING.'\"');\n }\n\n $criteria->compare('eventId', $this->eventId, true);\n $criteria->compare('category', $this->category, true);\n $criteria->compare('publisherName', $this->publisherName, true);\n $criteria->compare('name', $this->name, true);\n $criteria->compare('cityObject.name', $this->searchCityObject->name, true);\n $criteria->compare('dateStart', strtotime($this->dateStart), true);\n $criteria->compare('timeStart', $this->timeStart, true);\n $criteria->compare('dateCreated', strtotime($this->dateCreated), true);\n\n return new CActiveDataProvider($this, array(\n 'criteria' => $criteria,\n 'sort'=>array(\n 'defaultOrder'=>'dateCreated DESC',\n )\n ));\n }",
"public function search()\n\t{\n\t\t// @todo Please modify the following code to remove attributes that should not be searched.\n\n\t\t$criteria=new CDbCriteria;\n\n\t\t$criteria->compare('co_plan_cpra',$this->co_plan_cpra);\n\t\t$criteria->compare('co_ppto',$this->co_ppto);\n\t\t$criteria->compare('actv_plan_cpra',$this->actv_plan_cpra,true);\n\t\t$criteria->compare('nb_und_mdda',$this->nb_und_mdda,true);\n\t\t$criteria->compare('nb_fmla',$this->nb_fmla,true);\n\t\t$criteria->compare('nb_cod_sap',$this->nb_cod_sap,true);\n\t\t$criteria->compare('cntd_1',$this->cntd_1);\n\t\t$criteria->compare('cntd_2',$this->cntd_2);\n\t\t$criteria->compare('cntd_3',$this->cntd_3);\n\t\t$criteria->compare('cntd_4',$this->cntd_4);\n\t\t$criteria->compare('cntd_5',$this->cntd_5);\n\t\t$criteria->compare('cntd_6',$this->cntd_6);\n\t\t$criteria->compare('cntd_7',$this->cntd_7);\n\t\t$criteria->compare('cntd_8',$this->cntd_8);\n\t\t$criteria->compare('cntd_9',$this->cntd_9);\n\t\t$criteria->compare('cntd_10',$this->cntd_10);\n\t\t$criteria->compare('cntd_11',$this->cntd_11);\n\t\t$criteria->compare('cntd_12',$this->cntd_12);\n\t\t$criteria->compare('cntd_ttl',$this->cntd_ttl);\n\t\t$criteria->compare('vrsn',$this->vrsn);\n\t\t$criteria->compare('nb_resp',$this->nb_resp,true);\n\t\t$criteria->compare('tlf_resp',$this->tlf_resp,true);\n\t\t$criteria->compare('email_resp',$this->email_resp,true);\n\t\t$criteria->compare('fe_crea',$this->fe_crea,true);\n\t\t$criteria->compare('fe_modf',$this->fe_modf,true);\n\t\t$criteria->compare('usr_crea',$this->usr_crea,true);\n\t\t$criteria->compare('usr_modf',$this->usr_modf,true);\n\t\t$criteria->compare('in_stat',$this->in_stat,true);\n\t\t$criteria->compare('tx_desc',$this->tx_desc,true);\n\n\t\treturn new CActiveDataProvider($this, array(\n\t\t\t'criteria'=>$criteria,\n\t\t));\n\t}"
]
| [
"0.6240323",
"0.59849787",
"0.5749444",
"0.57264185",
"0.57264185",
"0.56460017",
"0.56175977",
"0.56067085",
"0.56019723",
"0.5484756",
"0.5477431",
"0.5475566",
"0.54014677",
"0.53575164",
"0.5330975",
"0.5317063",
"0.52969563",
"0.5279873",
"0.52777165",
"0.5277353",
"0.52716655",
"0.5268154",
"0.5266948",
"0.52609205",
"0.5258128",
"0.5258095",
"0.5254721",
"0.52502894",
"0.52156675",
"0.5212057"
]
| 0.690593 | 0 |
Generate a nested treelist Takes the data passed in as $data, in the form as generated by the Tree behaviour "generatetreelist" and outputs an HTML structure of nested unordered lists. The following $settings are required: model which model in the $data to use The following $settings are optional: title name of the field to use to display link wether the list items should be links controller if a link, the controller to link to action if a link, the action to link to ajaxtarget if set, the link is a js ajax link and this is the id to update div the id for the outermost containing div additional an array of additional items to add to the end of the menu | function generate($data, $settings = null) {
if (is_null($settings)) {
$settings = array();
}
$this->__settings = array_merge(array(
'model' => null,
'title' => 'name',
'depth' => 0,
'link' => true,
'div' => 'tree',
'controller' => null,
'action' => null,
'ajaxtarget' => null,
'additional' => null,
), (array) $settings);
extract($this->__settings);
$html = "\n";
$html .= $this->__generate($data, $settings);
// inject the additional items before the end of the list
if (is_array($additional)) {
$html = substr($html, 0, strrpos($html, '</ul>'));
foreach ($additional as $item) {
$html .= "<li>$item</li>\n";
}
$html .= "</ul>\n";
}
$js = '';
$js .= '$(function() {';
$js .= '$("#tree").treeview({';
$js .= 'collapsed: true,';
$js .= 'animated: "medium",';
$js .= 'control:"#sidetreecontrol",';
$js .= 'persist: "location"';
$js .= '});';
$js .= '})';
$this->Html->scriptBlock($js, array('inline' => false));
return $html;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function __generate($data) {\n extract($this->__settings);\n $html = '';\n\n $id = '';\n if ($depth == 0) {\n $id = ' id=\"' . $div . '\"';\n }\n\n $whitespace = str_repeat(\"\\t\", $depth);\n\n $html .= \"<ul\" . $id . \">\\n\";\n foreach ($data as $item) {\n $html .= \"<li>\";\n if ($link) {\n\n if ($ajaxtarget == null) {\n $html .= $this->Html->link(\n $item[$model][$title], array(\n 'controller' => $controller,\n 'action' => $action,\n $item[$model]['id']\n ));\n } else {\n $html .= $this->Js->link(\n $item[$model][$title], array(\n 'controller' => $controller,\n 'action' => $action,\n $item[$model]['id']\n ), array(\n 'update' => '#' . $ajaxtarget,\n 'before' => $this->Js->get('#' . $ajaxtarget)->effect('fadeOut'),\n 'complete' => $this->Js->get('#' . $ajaxtarget)->effect('fadeIn'),\n )\n );\n }\n } else {\n $html .= $item[$model][$title];\n }\n if (count($item['children']) > 0) {\n $this->__settings['depth'] = $depth + 1;\n $html .= $this->__generate($item['children'], $this->__settings);\n }\n $html .= \"</li>\\n\";\n }\n $html .= \"</ul>\\n\";\n $html = str_replace(\"\\n\", \"\\n\" . $whitespace, $html);\n return $html;\n }",
"public function build()\n {\n\n if ($this->html)\n return $this->html;\n\n if (count($this->data) == 0) {\n $this->html .= '<ul id=\"'.$this->id.'\" class=\"wgt_tree\" >'.NL;\n $this->html .= '</ul>'.NL;\n\n return $this->html;\n }\n\n $html = '';\n\n $html .= '<ul id=\"'.$this->id.'\" class=\"wgt_tree\" >'.NL;\n\n\n foreach ($this->data as $id => $row) {\n\n $entry = $this->buildTreeNode($row);\n\n $html .= <<<HTML\n<li id=\"{$this->id}_{$id}\" >\n\n {$entry}\n <ul id=\"{$this->id}_{$id}_tree\" ></ul>\n\n</li>\n\nHTML;\n\n\n }\n\n $html .= '</ul>'.NL;\n\n\n $this->html = $html;\n\n return $this->html;\n\n }",
"function createMenu($data, $htmlOptions = array()) {\r\n $this->htmlTree .= Html::beginTag('ul', $htmlOptions);\r\n foreach ($data as $item) {\r\n $this->htmlTree .= Html::beginTag('li') . Html::a($item['title'], $item['url']);\r\n if (isset($item['children']) AND !empty($item['children']))\r\n $this->createMenu($item['children']);\r\n $this->htmlTree .= Html::endTag('li');\r\n }\r\n $this->htmlTree .= Html::endTag('ul');\r\n return $this->htmlTree;\r\n }",
"private function build_tree()\n\t\t{\n\t\t\t$this->html_result .= '<ul class=\"'.$this->style.'_ul_first\" onkeydown=\"return input_main_key(event,\\''.$this->internal_id.'\\')\">';\n\n\t\t\t//==================================================================\n\t\t\t// Always first this row in tree ( edit mode only )\n\t\t\t//==================================================================\n\t\t\tif ($this->edit_mode)\n\t\t\t{\n\t\t\t\t$this->html_result .= '<div class=\"'.$this->style.'_interow\" id=\"'.$this->internal_id.'INT_0\" OnClick=\"add_new_node(\\''.$this->internal_id.'\\',0)\"></div>';\n\t\t\t}\n\t\t\t//==================================================================\n\t\t\t\n\t\t\t$this->scan_level(0,$this->get_any_child(1));\n\n\t\t\t$this->html_result .= '<ul class=\"'.$this->style.'_ul\">';\n\t\t}",
"private function buildLinktree($admin_include_data)\n\t{\n\t\tglobal $txt, $context;\n\n\t\t// Build the link tree.\n\t\t$context['linktree'][] = array(\n\t\t\t'url' => getUrl('admin', ['action' => 'admin']),\n\t\t\t'name' => $txt['admin_center'],\n\t\t);\n\n\t\tif (isset($admin_include_data['current_area']) && $admin_include_data['current_area'] != 'index')\n\t\t{\n\t\t\t$context['linktree'][] = array(\n\t\t\t\t'url' => getUrl('admin', ['action' => 'admin', 'area' => $admin_include_data['current_area'], '{session_data}']),\n\t\t\t\t'name' => $admin_include_data['label'],\n\t\t\t);\n\t\t}\n\n\t\tif (isset($admin_include_data['current_subsection'], $admin_include_data['subsections'][$admin_include_data['current_subsection']])\n\t\t\t&& $admin_include_data['subsections'][$admin_include_data['current_subsection']]['label'] != $admin_include_data['label'])\n\t\t{\n\t\t\t$context['linktree'][] = array(\n\t\t\t\t'url' => getUrl('admin', ['action' => 'admin', 'area' => $admin_include_data['current_area'], 'sa' => $admin_include_data['current_subsection'], '{session_data}']),\n\t\t\t\t'name' => $admin_include_data['subsections'][$admin_include_data['current_subsection']]['label'],\n\t\t\t);\n\t\t}\n\t}",
"public function renderTree()\n {\n $structure = $this->_module->treeStructure + $this->_module->dataStructure;\n extract($structure);\n $nodeDepth = $currDepth = $counter = 0;\n $jsSelect = '$('.$this->id.').treeview(\"collapseAll\");';\n $out = Html::beginTag('ul', ['class' => 'kv-tree']) . \"\\n\";\n foreach ($this->_nodes as $node) {\n /**\n * @var Tree $node\n */\n if (!$this->isAdmin && !$node->isVisible() || !$this->showInactive && !$node->isActive()) {\n continue;\n }\n /** @noinspection PhpUndefinedVariableInspection */\n $nodeDepth = $node->$depthAttribute;\n /** @noinspection PhpUndefinedVariableInspection */\n $nodeLeft = $node->$leftAttribute;\n /** @noinspection PhpUndefinedVariableInspection */\n $nodeRight = $node->$rightAttribute;\n /** @noinspection PhpUndefinedVariableInspection */\n $nodeKey = $node->$keyAttribute;\n /** @noinspection PhpUndefinedVariableInspection */\n $nodeName = $node->$nameAttribute;\n /** @noinspection PhpUndefinedVariableInspection */\n $nodeIcon = $node->$iconAttribute;\n /** @noinspection PhpUndefinedVariableInspection */\n $nodeIconType = $node->$iconTypeAttribute;\n\n $isChild = ($nodeRight == $nodeLeft + 1);\n $indicators = '';\n\n if (isset($this->nodeLabel)) {\n $label = $this->nodeLabel;\n $nodeName = is_callable($label) ? $label($node) :\n (is_array($label) ? ArrayHelper::getValue($label, $nodeKey, $nodeName) : $nodeName);\n }\n if ($nodeDepth == $currDepth) {\n if ($counter > 0) {\n $out .= \"</li>\\n\";\n }\n } elseif ($nodeDepth > $currDepth) {\n $out .= Html::beginTag('ul') . \"\\n\";\n $currDepth = $currDepth + ($nodeDepth - $currDepth);\n } elseif ($nodeDepth < $currDepth) {\n $out .= str_repeat(\"</li>\\n</ul>\", $currDepth - $nodeDepth) . \"</li>\\n\";\n $currDepth = $currDepth - ($currDepth - $nodeDepth);\n }\n if (trim($indicators) == null) {\n $indicators = ' ';\n }\n $nodeOptions = [\n 'data-key' => $nodeKey,\n 'data-lft' => $nodeLeft,\n 'data-rgt' => $nodeRight,\n 'data-lvl' => $nodeDepth,\n 'data-readonly' => static::parseBool($node->isReadonly()),\n 'data-movable-u' => static::parseBool($node->isMovable('u')),\n 'data-movable-d' => static::parseBool($node->isMovable('d')),\n 'data-movable-l' => static::parseBool($node->isMovable('l')),\n 'data-movable-r' => static::parseBool($node->isMovable('r')),\n 'data-removable' => static::parseBool($node->isRemovable()),\n 'data-removable-all' => static::parseBool($node->isRemovableAll()),\n ];\n\n $css = [];\n if (!$isChild) {\n $css[] = 'kv-parent ';\n }\n if (!$node->isVisible() && $this->isAdmin) {\n $css[] = 'kv-invisible';\n }\n if ($this->showCheckbox && in_array($node->id, $this->selected)) {\n $css[] = 'kv-selected ';\n $jsSelect .= '$('.$this->id.').treeview(\"checkNode\", \"'.$node->id.'\");';\n }\n if ($node->isCollapsed()) {\n $css[] = 'kv-collapsed ';\n }\n if ($node->isDisabled()) {\n $css[] = 'kv-disabled ';\n }\n if (!$node->isActive()) {\n $css[] = 'kv-inactive ';\n }\n $indicators .= $this->renderToggleIconContainer(false) . \"\\n\";\n $indicators .= $this->showCheckbox ? $this->renderCheckboxIconContainer(false) . \"\\n\" : '';\n if (!empty($css)) {\n Html::addCssClass($nodeOptions, $css);\n }\n $out .= Html::beginTag('li', $nodeOptions) . \"\\n\" .\n Html::beginTag('div', ['tabindex' => -1, 'class' => 'kv-tree-list']) . \"\\n\" .\n Html::beginTag('div', ['class' => 'kv-node-indicators']) . \"\\n\" .\n $indicators . \"\\n\" .\n '</div>' . \"\\n\" .\n Html::beginTag('div', ['tabindex' => -1, 'class' => 'kv-node-detail']) . \"\\n\" .\n $this->renderNodeIcon($nodeIcon, $nodeIconType, $isChild) . \"\\n\" .\n Html::tag('span', $nodeName, ['class' => 'kv-node-label']) . \"\\n\" .\n '</div>' . \"\\n\" .\n '</div>' . \"\\n\";\n ++$counter;\n }\n if (isset($jsSelect)) {\n $this->view->registerJs(\n $jsSelect,\n View::POS_READY,\n 'treeviewinput-selected'\n );\n }\n $out .= str_repeat(\"</li>\\n</ul>\", $nodeDepth) . \"</li>\\n\";\n $out .= \"</ul>\\n\";\n return Html::tag('div', $this->renderRoot() . $out, $this->treeOptions);\n }",
"function renderTree($arvore) {\n $lastLevel = 0;\n//Outer list item\n $html = \"<ul class=\\\"jstree\\\">\";\n//Iterating tree from tree root\n foreach ($arvore->fetchTree() as $node) {\n//If we are on the item of the same level, closing <li> tag before printing item\n if (($node['level'] == $lastLevel) and ($lastLevel > 0)) {\n $html .= '</li>';\n }\n//If we are printing a next-level item, starting a new <ul>\n if ($node['level'] > $lastLevel) {\n $html .= '<ul>';\n }\n//If we are going to return back by several levels, closing appropriate tags\n if ($node['level'] < $lastLevel) {\n $html .= str_repeat(\"</li></ul>\", $lastLevel - $node['level']) . '</li>';\n }\n//Priting item without closing tag\n $html .= '\n <li id=\"tree_node[' . $node['uuid'] . ']\">\n <ins class=\"jstree-icon\"> </ins>\n <a><ins class=\"jstree-icon\"> </ins>' . $node['nome'] . '</a>';\n//Refreshing last level of the item\n $lastLevel = $node['level'];\n }\n $html .= \"</ul>\";\n return $html;\n}",
"function renderTree($tree, $options)\n {\n $current_depth = 0;\n $counter = 0;\n $result = '';\n $folders = isset($options['folders']);\n $plans = isset($options['plans']);\n\n foreach($tree as $node)\n {\n $curr = $node['Category'];\n $node_depth = $curr['level'];\n $node_name = $curr['title'];\n $node_id = $curr['cat_id'];\n $node_count = $curr['listing_count'];\n\n if($node_depth == $current_depth)\n {\n if($counter > 0) $result .= '</li>';\n }\n elseif($node_depth > $current_depth)\n {\n $result .= '<ul'.($folders ? ' class=\"filetree\"' : '').'>';\n $current_depth = $current_depth + ($node_depth - $current_depth);\n }\n elseif($node_depth < $current_depth)\n {\n $result .= str_repeat('</li></ul>',$current_depth - $node_depth).'</li>';\n $current_depth = $current_depth - ($current_depth - $node_depth);\n }\n $result .= '<li class=\"jr-tree-cat-'.$node_id.' closed\"';\n $result .= '>';\n $folders and $result .= '<span class=\"folder\"> ';\n $result .= !$plans ?\n $this->Routes->category($node)\n :\n $this->Routes->category($node,array(\"onclick\"=>\"JRPaid.Plans.load({'cat_id':\".$node_id.\"});return false;\"))\n ;\n $this->Config->dir_cat_num_entries and $result .= ' (' .$node_count . ')';\n $folders and $result .= '</span>';\n ++$counter;\n }\n\n $result .= str_repeat('</li></ul>',$node_depth);\n\n return $result;\n }",
"private function _recursive_list_view_html($merchant_id, $rule_category, $listarray, $build_list = TRUE, $debughey=0)\r\n {\r\n $make_json = array();\r\n $final_loop = FALSE;\r\n\r\n if(is_array($listarray))\r\n {\r\n foreach ($listarray as $v)\r\n {\r\n $newchild = $li_open = $li_close = \"\";\r\n $rule_obj = $v[\"rule_obj\"];\r\n if(is_object($rule_obj))\r\n {\r\n $first_list_html = $this->_makePromoViewList($merchant_id, $rule_obj);\r\n if($build_list) {\r\n $li_open = \"<li style=\\\"line-height: 1.8 em\\\">\";\r\n $li_close = \"</li> \\n\";\r\n }\r\n\r\n $list_html .= $li_open . $first_list_html . $li_close;\r\n }\r\n else\r\n {\r\n # at the final loop, there is no rule_obj\r\n $level = \"1\";\r\n $final_loop = TRUE;\r\n }\r\n\r\n if(is_array($v[\"children\"]))\r\n {\r\n $children_html = $this->_recursive_list_view_html($merchant_id, $rule_category, $v[\"children\"], TRUE, 1);\r\n\r\n $list_html .= \"<ul>\";\r\n $list_html .= $children_html[\"list_html\"];\r\n\r\n\r\n if(!$final_loop)\r\n $list_html .= \"</ul>\\n\";\r\n }\r\n\r\n # if this is the final array, need to insert the child selector for level one (IF ANY/ALL IS TRUE/FALSE)\r\n # before closing the <ul> tag\r\n if($final_loop)\r\n $list_html .= \"</ul>\\n\";\r\n }\r\n }\r\n\r\n $ret[\"list_html\"] = $list_html;\r\n\r\n return $ret;\r\n }",
"function renderTreeOrgaos($arvore) {\n $lastLevel = 1;\n//Outer list item\n $html = \"<ul class=\\\"jstree\\\">\";\n//Iterating tree from tree root\n foreach ($arvore as $node) {\n//If we are on the item of the same level, closing <li> tag before printing item\n if (($node['level'] == $lastLevel) and ($lastLevel > 0)) {\n $html .= '</li>';\n }\n//If we are printing a next-level item, starting a new <ul>\n if ($node['level'] > $lastLevel) {\n $html .= '<ul>';\n }\n//If we are going to return back by several levels, closing appropriate tags\n if ($node['level'] < $lastLevel) {\n $html .= str_repeat(\"</li></ul>\", $lastLevel - $node['level']) . '</li>';\n }\n//Priting item without closing tag\n $html .= '\n <li id=\"tree_node[' . $node['uuid'] . ']\">\n <ins class=\"jstree-icon\"> </ins>\n <a><ins class=\"jstree-icon\"> </ins>' . $node['nome'] . '</a>';\n//Refreshing last level of the item\n $lastLevel = $node['level'];\n }\n $html .= \"</ul>\";\n return $html;\n}",
"public function actionAjaxFillTree()\n {\n \t$this->allowUser(SUPERADMINISTRATOR);\n // accept only AJAX request (comment this when debugging)\n if (!Yii::app()->request->isAjaxRequest) {\n exit();\n }\n // parse the user input\n $parentId = \"NULL\";\n if (isset($_GET['root']) && $_GET['root'] !== 'source') {\n $parentId = (int) $_GET['root'];\n }\n // read the data (this could be in a model)\n $children = Yii::app()->db->createCommand(\n \"SELECT m1.id, m1.name AS text, m2.id IS NOT NULL AS hasChildren \"\n . \"FROM cms_term AS m1 LEFT JOIN cms_term AS m2 ON m1.id=m2.parent_id \"\n . \"WHERE m1.parent_id <=> $parentId \"\n . \"GROUP BY m1.id ORDER BY m1.order ASC\"\n )->queryAll();\n\t\t\n\t\t$cnt = 0;\n\t\tforeach ($children as $child){\n\t\t//\tif ($child['hasChildren']==0) {\n\t\t//\t\t$children[$cnt]['text'] = '<a href='.Yii::app()->baseUrl.'\"/backend.php/term/update/'.$child['id'].'\">'.$child['text'].'</a>';\n\t\t//\t} else {\n\t\t\t\n\t\t\t\t$children[$cnt]['text'] = $child['text']\n\t\t\t\t.'<a href='.Yii::app()->baseUrl.'\"/backend.php/term/update/'.$child['id'].'\"> '.TbHtml::icon(TbHtml::ICON_PENCIL)\n\t\t\t\t.'</a> <a href='.Yii::app()->baseUrl.'\"/backend.php/TermDescription/update/'.$child['id'].'\"> '.TbHtml::icon(TbHtml::ICON_EDIT).'</a>';\n\t\t\t$cnt++;\t\n\t\t}\n\t\t\n\t\t\n echo str_replace(\n '\"hasChildren\":\"0\"',\n '\"hasChildren\":false',\n CTreeView::saveDataAsJson($children)\n );\n }",
"public function init()\n\t{\n\t\tif(isset($this->htmlOptions['id']))\n\t\t\t$id=$this->htmlOptions['id'];\n\t\telse\n\t\t\t$id=$this->htmlOptions['id']=$this->getId();\n\t\tif($this->url!==null)\n\t\t\t$this->url=CHtml::normalizeUrl($this->url);\n\t\t$cs=Yii::app()->getClientScript();\n\t\t$cs->registerCoreScript('treeview');\n\t\t$options=$this->getClientOptions();\n\t\t$options=$options===array()?'{}' : CJavaScript::encode($options);\n\t\t$cs->registerScript('Yii.CTreeView#'.$id,\"jQuery(\\\"#{$id}\\\").treeview($options);\");\n\t\tif($this->cssFile===null)\n\t\t\t$cs->registerCssFile($cs->getCoreScriptUrl().'/treeview/jquery.treeview.css');\n\t\telseif($this->cssFile!==false)\n\t\t\t$cs->registerCssFile($this->cssFile);\n\n\t\techo CHtml::tag('ul',$this->htmlOptions,false,false).\"\\n\";\n\t\techo self::saveDataAsHtml($this->data);\n\t}",
"public function render()\n {\n $fromListTree = array();\n $this->getFromListTree($fromListTree);\n $style = $this->getStyle();\n $func = $this->getFunction();\n $valueList = array(); $valueArray = array();\n $this->getFromList($valueList, $this->getSelectedList());\n foreach ($valueList as $vl) {\n $valueArray[] = $vl['val'];\n }\n $sHTML = \"<script>\n \t\t\t\tvar \".$this->m_Name.\"_optlist = new Array(); \n \t\t\t\tvar \".$this->m_Name.\"_optlist_default = new Array();\n \t\t\t</script>\";\n $sHTML .= \"<div name=\\\"\" . $this->m_Name . \"\\\" ID=\\\"\" . $this->m_Name .\"\\\" $this->m_HTMLAttr $style>\";\n\t\t$sHTML .= \"<ul>\";\n\t\t$i = 0;\n foreach ($fromListTree as $treeNode)\n {\n\n //$sHTML .= \"<input type=\\\"checkbox\\\" name=\\\"\".$this->m_Name.\"[]\\\" VALUE=\\\"\" . $option['val'] . \"\\\" $selectedStr></input>\" . $option['txt'] . \"<br/>\";\n $sHTML .= \"<li style=\\\"padding-top:10px;\\\">\".str_repeat(\"- - \", $treeNode[\"level\"]).\"<strong>\".$treeNode['txt'].\"</strong>\".\"</li>\";\n $sublist = array();\n $this->getDOFromList($sublist, $this->getSelectFrom().\",[folder_id]='\".$treeNode['id'].\"'\");\n foreach($sublist as $option){\n $test = array_search($option['val'], $valueArray);\n\t if ($test === false)\n\t {\n\t $selectedStr = '';\n\t }\n\t else\n\t {\n\t $selectedStr = \"CHECKED\";\n\t $sHTML .= \"<script>\".$this->m_Name.\"_optlist_default.push('\".$this->m_Name.\"_\".$i.\"'); </script>\";\n\t } \t\n \t$sHTML .= \"<li><label style=\\\"float:none;color:#888888;display:inline;\\\">\".str_repeat(\"- - \", $treeNode[\"level\"]).\"<input type=\\\"checkbox\\\" id=\\\"\".$this->m_Name.\"_\".$i.\"\\\" name=\\\"\".$this->m_Name.\"[]\\\" VALUE=\\\"\" . $option['val'] . \"\\\" $selectedStr></input>\" . $option['txt'] . \"</label></li>\";\n \t$sHTML .= \"<script>\".$this->m_Name.\"_optlist.push('\".$this->m_Name.\"_\".$i.\"'); </script>\";\n \t$i++;\n }\n \n }\n $sHTML .= \"</ul></div>\";\n return $sHTML;\n }",
"public function run()\n\t{\n\t\tlist($name,$id)=$this->resolveNameID();\n\n\t\tif(isset($this->htmlOptions['id']))\n\t\t\t$id=$this->htmlOptions['id'];\n\t\telse\n\t\t\t$this->htmlOptions['id']=$id;\n\t\tif(isset($this->htmlOptions['name']))\n\t\t\t$name=$this->htmlOptions['name'];\n\t\telse\n\t\t\t$this->htmlOptions['name']=$name;\n\t\t\n\t\t//$items = $this->data->roots()->findAll($this->dataCondition, $this->paramsCondition);\n\t\t$items = $this->listRoots;\n\t\t$html = '';\n\t\t$html .= CHtml::openTag('div', array('class' => 'jlb_tree_drop_down_list'));\n\t\t$html .= CHtml::openTag('select', $this->htmlOptions);\n\t\tif (count($items)) {\n\t\t\tforeach($items as $item) {\n\t\t\t\t$htmlOptions = array();\n\t\t\t\t$htmlOptions['value'] = $item->id;\n\t\t\t\tif ($this->model->parent_id == $item->id)\n\t\t\t\t\t$htmlOptions['selected'] = 'selected';\n\t\t\t\t$html .= CHtml::openTag('option', $htmlOptions);\n\t\t\t\t$html .= CHtml::encode($item->name);\n\t\t\t\t$html .= CHtml::closeTag('option');\n\t\t\t\t$descendants = $item->descendants()->findAllByAttributes($this->findByAttributes);\n\t\t\t\t$trees = $item->toArray($descendants);\n\t\t\t\t$html .= $this->renderDropDownList($trees);\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\t$html .= CHtml::tag('option', array('value'=>'root'), 'Root', false);\n\t\t}\n\t\t$html .= CHtml::closeTag('select');\n\t\t$html .= CHtml::closeTag('div');\n\t\techo $html;\n\t\t//Yii::app()->clientScript->registerScript(__CLASS__.'#'.$this->htmlOptions['id'], $this->_getScript(), CClientScript::POS_READY);\n\t}",
"function make_list($data, $options = array())\n\t{\n\t\tif (count($data) == 0)\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t$menu_data = array(\n\t\t\t'items' => array(),\n\t\t\t'parents' => array()\n\t\t);\n\t\t\n\t\tforeach ($data as $menu_item)\n\t\t{\n\t\t\t$menu_data['items'][$menu_item['cat_id']] = $menu_item;\n\t\t\t$menu_data['parents'][$menu_item['cat_parent']][] = $menu_item['cat_id'];\n\t\t}\n\t\t\n\t\t$parent_id = 0;\n\t\t\n\t\tif (isset($options['parent_id']))\n\t\t{\n\t\t\t$parent_id = $options['parent_id'];\n\t\t}\n\t\t\n\t\t// Here we setup the bench mark just to be sure this doesn't runaway.\n\t\t$this->_ci->benchmark->mark('walk_categories_start');\n\t\t\n\t\t$cats = $this->_walk_categories($parent_id, $menu_data, $options);\n\t\t\n\t\t$this->_ci->benchmark->mark('walk_categories_end');\n\t\t\n\t\treturn $cats;\n\t}",
"private function buildTree ( &$tree, $parentId = null ) {\r\n\t\tif ( !isset ( $parentId ) ) $parentId = 0;\r\n\t\t$param = array(\r\n\t\t\t'conditions' => array('parent_id' => $parentId),\r\n\t\t\t'fields' => array('id','lorder','rorder','CategoryDetail.name'),\r\n\t\t\t'order' => array('CategoryDetail.name')\r\n\t\t );\r\n\t\t$arrRes = $this->Category->find('all', $param);\r\n $tree .= \"<ul>\";\r\n foreach ( $arrRes as $node ) {\r\n \t$tree .= \"<li><a id='\".$node['Category']['id'].\"' ctrl='categories'>\".\r\n \t\t $node['CategoryDetail']['name'].\"</a>\";\r\n if ( $node['Category']['rorder'] - $node['Category']['lorder'] == 1 ) $tree .= \"</li>\";\r\n else {\r\n $this->buildTree ( $tree, $node['Category']['id'] );\r\n $tree .= \"</li>\";\r\n }\r\n\t /*if ( $node['Category']['rorder'] - $node['Category']['lorder'] > 1 ) {\r\n\t \t\t$tree .= \"<li><a id='\".$node['Category']['id'].\"' ctrl='categories'>\".\r\n \t\t $node['CategoryDetail']['name'].\"</a>\";\r\n\t\t\t\r\n\t\t\t $this->buildTree ( $tree, $node['Category']['id'] );\r\n\t $tree .= \"</li>\";\r\n\t }*/\r\n }\r\n $tree .= \"</ul>\";\r\n\t}",
"static function menuBuild($obj, $parent=0){\n if(!empty($obj)){\n $response = '<ul>';\n\n foreach($obj as $items){\n $checked = !empty($items->user_levels_id)?' checked ':'';\n $response .= '<li><label for=\"nav'.$items->id.'\"><input type=\"checkbox\" name=\"nav_id[]\" id=\"nav'.$items->id.'\" value=\"'.$items->id.'\"'. $checked .' > '.$items->name.'</label>';\n if (!empty($items->children)){\n $response .= self::menuBuild($items->children, $items->id);\n }\n $response .= '</li>';\n }\n\n $response .= '</ul>';\n\n return $response;\n\n }else{\n return \"Sorry No data found\";\n }\n }",
"function getMenuNodeHTML(&$data, $page_name = null, $id = \"\")\n {\n $html = \"<div id='site_menu_node$id'><ul>\";\n\n $last = count($data) - 1;\n for ($i = 0; $i <= $last; $i++) {\n $item =& $data[$i];\n\n if ($item[\"visible\"] == \"0\" || ($item[\"access_mode\"] == \"admin\" && $this->dialog->usertype < USERTYPE_ADMIN)) continue;\n\n // li\n $css_classes = array();\n if ($item[\"url\"] == $page_name) {\n $css_classes[] = \"active\";\n }\n if (count($item[\"childs\"])) {\n $css_classes[] = \"parent\";\n }\n if ($i == 0) {\n $css_classes[] = \"first\";\n } else if ($i == $last) {\n $css_classes[] = \"last\";\n }\n\n if (count($css_classes)) {\n $css_classes = \"class='\" . implode(\" \", $css_classes) . \"'\";\n } else {\n $css_classes = \"\";\n }\n\n\n $url = $this->formatItemURL($item);\n $target = $item[\"blank_page\"] == 1 ? \" target='_blank'\" : \"\";\n\n $html .= \"<li $css_classes id='site_menu_li\" . $item[\"id\"] . \"'><a href='$url' $target>\" . $item[\"title\"];\n if ($item[\"hint\"]) {\n $html .= \"<span>\" . $item[\"hint\"] . \"</span>\";\n }\n $html .= \"</a>\";\n\n\n // submenu\n if (count($item[\"childs\"])) {\n $html .= $this->getMenuNodeHTML($item[\"childs\"], $page_name, $item[\"id\"]);\n }\n\n // li\n $html .= \"</li>\";\n }\n return $html . \"</ul></div>\";\n }",
"function buildMenu($parent_id, $menuData) \n{ \n $html = ''; \n\n if (isset($menuData['parents'][$parent_id])) \n { \n $html = '<ul>'; \n foreach ($menuData['parents'][$parent_id] as $itemId) \n { \n\t\t\t\n\t\t\tif ($menuData['items'][$itemId]['page_id'] != 0)\n\t\t\t{\n\t\t\t\t$link_page_id = $menuData['items'][$itemId]['page_id'];\n\t\t\t\t$html .= '<a href=\"index.php?pid='. $link_page_id;\n \t$html .= '\">';\n\t\t\t\t$html .= '<li>'. $menuData['items'][$itemId]['name']; \n\t\t\t\t$html .= '</a>'; \n\t\t\t\t$html .= '';\n\t // find childitems recursively \n\t $html .= buildMenu($itemId, $menuData); \n\n \t $html .= '</li>' ;\n\t\t\t\t\n\t\t\t}\n\t\t\telse if ($menuData['items'][$itemId]['post_id'] != 0)\n\t\t\t{\n\t\t\t\t$html .= '<a href=\"#='.$menuData['items'][$itemId]['post_id'];\n\t $html .= '\">';\n\t\t\t\t$html .= '<li>'. $menuData['items'][$itemId]['name']; \n\t\t\t\t$html .= '</a>'; \n\t\t\t\t$html .= '';\n\t // find childitems recursively \n \t $html .= buildMenu($itemId, $menuData); \n\n \t $html .= '</li>' ;\n\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$html .= '<a href=\"'.$menuData['items'][$itemId]['link'];\n \t $html .= '\">';\n\t\t\t\t$html .= '<li>'. $menuData['items'][$itemId]['name']; \n\t\t\t\t$html .= '</a>'; \n\t\t\t\t$html .= '';\n \t// find childitems recursively \n\t $html .= buildMenu($itemId, $menuData); \n\t\n \t $html .= '</li>' ;\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n } \n $html .= '</ul>'; \n } \n\n return $html; \n}",
"public function renderData($data, $idKey = null)\n {\n\n if ($this->html)\n return $this->html;\n\n if (is_string($data))\n $data = json_decode($data);\n\n if ($idKey)\n $htmlId = $this->getIdByKey($idKey);\n else\n $htmlId = $this->getId();\n\n $html = <<<HTML\n <ul id=\"{$this->getId()}\" class=\"wgt-tree ui-widget\" >\nHTML;\n\n foreach ($data as $child => $childNode) {\n if (is_scalar($childNode)) {\n $html .= <<<HTML\n <li><label>{$child}</label> => {$childNode}</li>\nHTML;\n } else {\n $html .= <<<HTML\n <li><label>{$child}</label> => {$this->renderNode($childNode)}</li>\nHTML;\n }\n }\n\n $html .= <<<HTML\n </ul>\nHTML;\n\n $this->html = $html;\n\n return $html;\n\n }",
"public function tree()\n {\n// try {\n $root = $this->model->root();\n if ($root) {\n $items = $root->getDescendants();\n }\n\n $items = $this->recursiveNestable($items->toArray(), $root->id);\n\n return view('admin.menus.tree', compact('items', 'root'))->with('parentId', $root->id);\n// } catch (Exception $e) {\n// return $this->returnWithError($e->getMessage());\n// }\n }",
"private function prepareRecursiveHTML($obj){\n\t$myarr=$obj->getAppendedChildrenArray();\n\tfor($i=0; $i<count($myarr); $i++){\n\t\t$a=\"\";\n\t if($myarr[$i]->getAClass()!=\"\") $a.=\" class=\\\"\".$myarr[$i]->getAClass().\"\\\"\";\n\t if($myarr[$i]->getAId()!=\"\") $a.=\" id=\\\"\".$myarr[$i]->getAId().\"\\\"\";\n\t $ul=\"\";\n\t if($myarr[$i]->getUlClass()!=\"\") $ul.=\" class=\\\"\".$myarr[$i]->getUlClass().\"\\\"\";\n\t if($myarr[$i]->getUlId()!=\"\") $ul.=\" id=\\\"\".$myarr[$i]->getUlId().\"\\\"\";\n\t $li=\"\";\n\t if($myarr[$i]->getLiClass()!=\"\") $li.=\" class=\\\"\".$myarr[$i]->getLiClass().\"\\\"\";\n\t if($myarr[$i]->getLiId()!=\"\") $li.=\" id=\\\"\".$myarr[$i]->getLiId().\"\\\"\";\n\t\n\t\tif($i==0)$this->html = $this->replace_last_occurence($this->html, \"</a>\", \n\t\t\"</a>\\n<ul>\\n<li\".$li.\"><a\".$a.\" href=\\\"\".$myarr[0]->getLink().\"\\\">\".$myarr[0]->getText().\"</a></li>\\n</ul>\");\n\t\t\n\t\telse $this->html = $this->replace_last_occurence($this->html, \"</a></li>\\n</ul>\", \n\t\t\"</a></li>\\n<li\".$li.\"><a\".$a.\" href=\\\"\".$myarr[$i]->getLink().\"\\\">\".$myarr[$i]->getText().\"</a></li>\\n</ul>\");\n\n if(count($myarr[$i]->getAppendedChildrenArray())) $this->prepareRecursiveHTML($myarr[$i]);\n\t}\n\t\t\n}",
"public function run()\n {\n $data = [\n\n // Parents\n \t[\n 'nama' => 'Beranda',\n 'link' => '/beranda',\n 'icon' => 'fa-home',\n 'submenu' => 0\n ],\n [\n 'nama' => 'Data Sekolah',\n 'link' => '/sekolah',\n 'icon' => 'fa-building',\n 'submenu' => 0\n ],\n [\n \t\t'nama' => 'Data Master',\n \t\t'link' => '#',\n 'icon' => 'fa-bars',\n 'submenu' => 0\n ],\n [\n 'nama' => 'Data Siswa',\n 'link' => '#',\n 'icon' => 'fa-users',\n 'submenu' => 0\n ],\n [\n 'nama' => 'Data Guru',\n 'link' => '#',\n 'icon' => 'fa-graduation-cap',\n 'submenu' => 0\n ],\n \t[\n \t\t'nama' => 'Jadwal Pelajaran',\n \t\t'link' => '/jadwal',\n \t\t'icon' => 'fa-calendar',\n \t\t'submenu' => 0\n \t],\n [\n 'nama' => 'Laporan Nilai',\n 'link' => '/laporan',\n 'icon' => 'fa-file-excel',\n 'submenu' => 0\n ],\n [\n 'nama' => 'Pembayaran',\n 'link' => '#',\n 'icon' => 'fa-money-bill-wave',\n 'submenu' => 0\n ],\n [\n 'nama' => 'Kirim Pesan',\n 'link' => '#',\n 'icon' => 'fa-envelope',\n 'submenu' => 0\n ],\n [\n 'nama' => 'Editor',\n 'link' => '#',\n 'icon' => 'fa-edit',\n 'submenu' => 0\n ],\n [\n 'nama' => 'Konfigurasi',\n 'link' => '#',\n 'icon' => 'fa-cog',\n 'submenu' => 0\n ],\n\n // Childs\n [\n 'nama' => 'Mata Pelajaran',\n 'link' => '/mapel',\n 'icon' => 'fa-book',\n 'submenu' => 3\n ],\n [\n 'nama' => 'Ruangan Kelas',\n 'link' => '/ruangan',\n 'icon' => 'fa-building',\n 'submenu' => 3\n ],\n [\n 'nama' => 'Tahun Akademik',\n 'link' => '/tahun-akademik',\n 'icon' => 'fa-calendar-alt',\n 'submenu' => 3\n ],\n [\n 'nama' => 'Angkatan',\n 'link' => '/angkatan',\n 'icon' => 'fa-list-alt',\n 'submenu' => 3\n ],\n [\n 'nama' => 'Rombongan Belajar',\n 'link' => '/rombel',\n 'icon' => 'fa-users',\n 'submenu' => 3\n ],\n [\n 'nama' => 'Kurikulum',\n 'link' => '/kurikulum',\n 'icon' => 'fa-newspaper',\n 'submenu' => 3\n ],\n [\n 'nama' => 'Peserta Didik',\n 'link' => '/peserta-didik',\n 'icon' => 'fa-pencil-alt',\n 'submenu' => 4\n ],\n [\n 'nama' => 'Seluruh Siswa',\n 'link' => '/siswa',\n 'icon' => 'fa-users',\n 'submenu' => 4\n ],\n [\n 'nama' => 'Walikelas',\n 'link' => '/walikelas',\n 'icon' => 'fa-users',\n 'submenu' => 5\n ],\n [\n 'nama' => 'Seluruh Guru',\n 'link' => '/guru',\n 'icon' => 'fa-graduation-cap',\n 'submenu' => 5\n ],\n [\n 'nama' => 'Data Pembayaran',\n 'link' => '/pembayaran',\n 'icon' => 'fa-money-check-alt',\n 'submenu' => 8\n ],\n [\n 'nama' => 'Jenis Pembayaran',\n 'link' => '/jenis-pembayaran',\n 'icon' => 'fa-dollar-sign',\n 'submenu' => 8\n ],\n [\n 'nama' => 'Form Pesan',\n 'link' => '/form-pesan',\n 'icon' => 'fa-comments',\n 'submenu' => 9\n ],\n [\n 'nama' => 'Template Pesan',\n 'link' => '/template-pesan',\n 'icon' => 'fa-sticky-note',\n 'submenu' => 9\n ],\n [\n 'nama' => 'Kontak',\n 'link' => '/kontak',\n 'icon' => 'fa-address-book',\n 'submenu' => 9\n ],\n [\n 'nama' => 'Grup Kontak',\n 'link' => '/grup-kontak',\n 'icon' => 'fa-layer-group',\n 'submenu' => 9\n ],\n [\n 'nama' => 'Peserta Didik Editor',\n 'link' => '/peserta-didik-editor',\n 'icon' => 'fa-pencil-alt',\n 'submenu' => 10\n ],\n [\n 'nama' => 'Jadwal Pelajaran Editor',\n 'link' => '/jadwal-pelajaran-editor',\n 'icon' => 'fa-calendar',\n 'submenu' => 10\n ],\n [\n 'nama' => 'Pengguna Sistem',\n 'link' => '/pengguna',\n 'icon' => 'fa-cubes',\n 'submenu' => 11\n ],\n [\n 'nama' => 'Hak Akses',\n 'link' => '/hak-akses',\n 'icon' => 'fa-lock',\n 'submenu' => 11\n ],\n ];\n\n DB::table('menu')->truncate();\n DB::table('menu')->insert($data);\n }",
"function _create_selection_list_wiki_page_tree(&$wiki_seen, $select, $id, $breadcrumbs, $title, $use_compound_list = false, $ins_format = false)\n{\n $wiki_seen[] = $id;\n\n $sub_breadcrumbs = ($breadcrumbs == '') ? ($title . ' > ') : ($breadcrumbs . $title . ' > ');\n\n $rows = $GLOBALS['SITE_DB']->query_select('wiki_children', array('*'), array('parent_id' => $id), 'ORDER BY title', intval(get_option('general_safety_listing_limit'))/*reasonable limit*/);\n $compound_list = strval($id) . ',';\n $_below = new Tempcode();\n foreach ($rows as $i => $myrow) {\n if (!in_array($myrow['child_id'], $wiki_seen)) {\n if (!has_category_access(get_member(), 'wiki_page', strval($myrow['child_id']))) {\n continue;\n }\n\n if (is_null($myrow['title'])) {\n $temp_rows = $GLOBALS['SITE_DB']->query_select('wiki_pages', array('title'), array('id' => $myrow['child_id']), '', 1);\n $myrow['title'] = get_translated_text($temp_rows[0]['title']);\n $rows[$i]['title'] = $myrow['title'];\n $GLOBALS['SITE_DB']->query_update('wiki_children', array('title' => $myrow['title']), array('parent_id' => $id, 'child_id' => $myrow['child_id']));\n }\n $below = _create_selection_list_wiki_page_tree($wiki_seen, $select, $myrow['child_id'], $sub_breadcrumbs, $myrow['title'], $use_compound_list, $ins_format);\n if ($use_compound_list) {\n list($below, $_compound_list) = $below;\n $compound_list .= $_compound_list;\n }\n $_below->attach($below);\n }\n }\n\n /*$out = form_input_list_entry(strval($id), ($select == $id), do_template('WIKI_LIST_TREE_LINE', array('_GUID' => 'd9d4a951df598edd3f08f87be634965b', 'BREADCRUMBS' => $breadcrumbs, 'TITLE' => $title, 'ID' => $id)));\n $out = '<option value=\"' . (!$use_compound_list ? $id : $compound_list) . '\">' . $breadcrumbs . escape_html($title) . '</option>' . \"\\n\";\n $out .= $_below;*/\n $out = form_input_list_entry(((!$use_compound_list) ? strval($id) : $compound_list) . ($ins_format ? ('!' . $title) : ''), false, $breadcrumbs . $title);\n $out->attach($_below);\n\n if ($use_compound_list) {\n return array($out, $compound_list);\n } else {\n return $out;\n }\n}",
"function wpdm_init_tree()\r\n{\r\n if(!current_user_can('edit_posts')) return;\r\n if (!isset($_GET['task']) || $_GET['task'] != 'wpdm_init_tree') return;\r\n global $wpdb;\r\n\r\n echo \"<ul class=\\\"jqueryFileTree\\\" style=\\\"display: none;\\\">\";\r\n // All Cats\r\n $_POST['dir'] = !isset($_POST['dir']) || $_POST['dir'] == '/' ? null : $_POST['dir'];\r\n $cats = get_terms('wpdmcategory', array('hide_empty' => false, 'parent' => $_POST['dir']));\r\n\r\n foreach ($cats as $cat) {\r\n\r\n echo \"<li class=\\\"directory collapsed\\\"><a href=\\\"#\\\" rel=\\\"\" . $cat->term_id . \"\\\">\" . $cat->name . \"</a></li>\";\r\n }\r\n\r\n // All files\r\n\r\n $qparams = array('post_type'=>'wpdmpro', 'posts_per_page'=>9999,'post_status'=>array('publish','private'));\r\n\r\n if ($_POST['dir'])\r\n $qparams['tax_query'] = array(array('taxonomy'=>'wpdmcategory','terms'=>array($_POST['dir']), 'include_children'=>false));\r\n\r\n $ndata = get_posts($qparams);\r\n\r\n\r\n $sap = '?'; //count($_GET)>0?'&':'?';\r\n\r\n foreach ($ndata as $data) {\r\n $html = '';\r\n\r\n //$link = \"<a href='\" . get_permalink($data->ID) . \"' >\".$data->post_title.\"</a>\";\r\n $exts = function_exists('wpdm_package_filetypes')?wpdm_package_filetypes($data->ID, false):array();\r\n $ext = (count($exts)>1)?'zip':((count($exts)==0)?\"\":$exts[0]);\r\n $template = \"<li class=\\\"wpdm_clink file ext_$ext\\\"><a href='#' rel='\".$data->ID.\"' >\".$data->post_title.\"</a></li>\";\r\n $html .= $template;\r\n\r\n\r\n echo $html;\r\n\r\n\r\n }\r\n echo \"</ul>\";\r\n die();\r\n\r\n\r\n}",
"function makeList($array) \n { \n //Base case: an empty array produces no list \n if (empty($array)) return '';\n\n //Recursive Step: make a list with child lists \n $output = '<ol class=\"dd-list\">'; \n foreach ($array as $key => $subArray) { \n $output .= '<li class=\"dd-item dd3-item\" data-id=\"' . $subArray['ID'] .'\">\n\t\t\t\t\t\t\t\t\t<div class=\"dd-handle dd3-handle\" > </div>\n\t\t\t\t\t\t\t\t\t<div class=\"dd3-content\" >' . $subArray['Title'] .'</div>'. makeList($subArray['children']) . '\n\t\t\t\t\t\t</li>'; \n } \n $output .= '</ol>'; \n \n return $output; \n }",
"function _data_recurse($id, &$children,$list=array(), $maxlevel=9999, $level=0,$indent='',$data=array())\n {\n // pr($children);\n $id_parent=$id;\n if (@$children[$id] && $level <= $maxlevel)\n {\n $field_parent_id =$this->field_parent_id ; $fieldtitle=$this->field_parent_name; $fieldkey = $this->key;\n foreach ($children[$id] as $t)\n {\n //echo \"<br>Ifieldkey=\".$fieldkey;\n $id = $t->$fieldkey;\n $tmp = $t;\n //$tmp['children'] = count(@$children[$id]);\n\n //== Su ly parent\n /* $tmp->{'_parent'} =array();\n if($data && $id_parent > 0) {\n foreach($data as $p)\n if($p->$fieldkey == $id_parent)\n $tmp->{'_parent'} = $p;\n }*/\n //== Su ly sub\n $tmp->{'_subs'} = @$children[$id]?(@$children[$id]):array();\n $tmp->{'_sub_ids'} = array();\n if($tmp->{'_subs'}){\n //$sub_ids=array();\n foreach($tmp->{'_subs'} as $it)\n {\n $tmp->{'_sub_ids'}[]= $it->$fieldkey;\n }\n }\n $pre \t= '|-- '; $spacer = ' ';\n //$pre \t= ''; $spacer = '';\n //== Su ly hien thi moi lien he cha con\n if ($t->$field_parent_id == 0) {\n $txt \t= $t->$fieldtitle;\n } else {\n /*foreach($children as $key => $vs){\n foreach($vs as $v){\n if($t->$field_parent_id == $v->$fieldkey){\n $pre = $v->$fieldtitle.' >> ';\n break;\n }\n }\n if($pre) break;\n\n }*/\n $txt \t= $pre . $t->$fieldtitle;\n }\n $tmp->{'_'.$this->field_name} = \"$indent$txt\";// add more field service for display tree\n $list[$id] = $tmp ;\n $list = $this->_data_recurse($id, $children,$list, $maxlevel, $level+1, $indent . $spacer,$data);\n\n }\n }\n return $list;\n }",
"public static function build_comment_structure($obj, $currentID = 0, $depth = 0)\n {\n \t// Quit out if we don't have any children\n global $wpdb;\n $user_id = get_current_user_id();\n \tif (!array_key_exists($currentID, $obj))\n \t{\n \t\treturn;\n \t}\n \t$children = $obj[$currentID];\n\n \t// Each node prints its own contents, then prints the contents of its children\n \techo \"<ul class='indented-list'>\";\n \tforeach ($children as $comment)\n \t{\n $nonce = wp_create_nonce(\"comment_nonce\");\n $upvoted = $wpdb->get_results(\n $wpdb->prepare(\n \"SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key='user_upvote_id' AND meta_value=%d AND comment_id=%d\",\n $user_id,\n $comment['comment_ID']\n )\n );\n ?>\n \t\t<li class=\"comment-node\" id=\"<?php echo $comment['comment_ID']?>\" data-nonce=\"<?php echo $nonce?>\">\n <div class=\"commenter\">by <?php echo $comment['comment_author'] ?></div>\n <div class=\"comment-time\"><?php echo human_time_diff(strtotime($comment['comment_date_gmt']), current_time('timestamp', 1)) . ' ago'; ?></div>\n <?php\n // $link = admin_url('admin-ajax.php?action=vote_on_comment&comment_id='.$comment['comment_ID'].'&nonce='.$nonce);\n echo '<div class=\"comment-content\">' . $comment['comment_content'] . '</div>';\n ?>\n <a class=\"vote_on_comment\" data-upordown=\"up\">\n <?php if ($upvoted[0]->{'COUNT(*)'} == 1 ){\n echo 'unvote';\n }\n else {\n echo '++';\n }?>\n </a>\n <div class=\"reply-to-comment\">reply</div>\n <div class=\"comment-reply-container\"><textarea name=\"comment-reply-content\" id=\"comment-reply-content\" ></textarea><a class=\"submit-reply\">Reply</a><div class=\"remove-reply\">cancel</div></div>\n <hr>\n <?php\n \t\t// Print all our children\n \t\tself::build_comment_structure($obj, $comment['comment_ID'], $depth + 1);\n \t}\n \techo \"</ul>\";\n }",
"public function tree(SS_HTTPRequest $request) {\n\t\t$isSubTree = false;\n\n\t\t$ID = $request->param('ID');\n\t\tif ($ID && ExternalContentAdmin::isValidId($ID)) {\n\n\t\t\t$obj = ExternalContent::getDataObjectFor($ID);\n\t\t\t$isSubTree = true;\n\n\t\t\tif (!$obj) {\n\t\t\t\tthrow new Exception(\n\t\t\t\t\t\t\"TreeDropdownField->tree(): the object #$ID of type $this->sourceObject could not be found\"\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tif ($this->baseID) {\n\t\t\t\t$obj = ExternalContent::getDataObjectFor($this->baseID);\n\t\t\t}\n\n\t\t\tif (!$this->baseID || !$obj)\n\t\t\t\t$obj = singleton($this->sourceObject);\n\t\t}\n\n\t\tif ($this->filterCallback) {\n\t\t\t$obj->setMarkingFilterFunction($this->filterCallback);\n\t\t} elseif ($this->sourceObject == 'Folder') {\n\t\t\t$obj->setMarkingFilter('ClassName', 'Folder');\n\t\t}\n\n\t\t$obj->markPartialTree(1, null);\n\n\t\tif ($forceValues = $this->value) {\n\t\t\tif (($values = preg_split('/,\\s*/', $forceValues)) && count($values))\n\t\t\t\tforeach ($values as $value) {\n\t\t\t\t\t$obj->markToExpose($this->objectForKey($value));\n\t\t\t\t}\n\t\t}\n\n\t\t$eval = '\"<li id=\\\"selector-' . $this->getName() . '-{$child->' . $this->keyField . '}\\\" class=\\\"$child->class\"' .\n\t\t\t\t' . $child->markingClasses() . \"\\\"><a rel=\\\"$child->ID\\\">\" . $child->' . $this->labelField . ' . \"</a>\"';\n\n\t\tif ($isSubTree) {\n\t\t\treturn substr(trim($obj->getChildrenAsUL('', $eval, null, true)), 4, -5);\n\t\t}\n\n\t\treturn $obj->getChildrenAsUL('class=\"tree\"', $eval, null, true);\n\t}",
"private function formTree($data)\n {\n if (!is_array($data)) return false;\n $tree = [];\n foreach ($data as $value) {\n $tree[$value['parent_id']][] = $value;\n }\n\n return $tree;\n }"
]
| [
"0.7546041",
"0.68082625",
"0.6783864",
"0.67141086",
"0.6528834",
"0.64719945",
"0.64542335",
"0.62023467",
"0.6125524",
"0.60964555",
"0.6077728",
"0.60607713",
"0.6040383",
"0.5967046",
"0.59510374",
"0.5919558",
"0.5905031",
"0.59027284",
"0.5899051",
"0.5891888",
"0.58843786",
"0.58438784",
"0.58400315",
"0.58343506",
"0.5828041",
"0.5820379",
"0.5819252",
"0.5789979",
"0.57887053",
"0.5765608"
]
| 0.77040505 | 0 |
Get a record given a provider's NPI number | public function byProviderNpi($npi)
{
$results = $this->getArray('ByProviderNPI/' . $npi);
return !empty($results[0]) && is_array($results[0]) ? $results[0] : null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getRecord()\n {\n return $this->options['peoplefinder']->getByNUID($this->nu_id);\n }",
"public function getProvider($provider_id);",
"function get_record($recordType, $params = array())\n{\n $record = get_records($recordType, $params, 1);\n return reset($record);\n}",
"public function getRecord();",
"public function getForRecord($record);",
"public function getRecord() {}",
"public function getRecord() {}",
"public function getRecord() {}",
"function get_itemidbyrecno($recno, $debug = false) {\n\t\t$q = (new QueryBuilder())->table('itemsearch');\n\t\t$q->field('itemid');\n\t\t$q->where('recno', $recno);\n\t\t$sql = DplusWire::wire('database')->prepare($q->render());\n\n\t\tif ($debug) {\n\t\t\treturn $q->generate_sqlquery($q->params);\n\t\t} else {\n\t\t\t$sql->execute($q->params);\n\t\t\treturn $sql->fetchColumn();\n\t\t}\n\t}",
"public function find_external_by_provider($provider) {\n\t\treturn ORM::factory('user_external')->where(array('user_id' => $this->id, 'provider' => $provider))->find();\n\t}",
"function get_provider_info_by_id($id,$param)\n{\n $ci=& get_instance();\n $ci->load->model('provider_m');\n\n return $ci->provider_m->get_provider_info($id, $param);\n}",
"function lr_get($pid) {\n list($ns, $pidn) = explode(':', $pid);\n $db = lr_connect();\n $table = lr_make_table($db, $ns);\n\n if ($pidn != '*') {\n list($rec, $sort) = explode('.', $pidn);\n $sql = \"SELECT * FROM ?n WHERE rec=?i, sort=?i\";\n $record = $db->getAll($sql, $table, $rec, $sort);\n if (empty($record)) {\n return FALSE;\n } else {\n return $record[0];\n }\n\n } else {\n $sql = \"SELECT * FROM ?n\";\n $record = $db->getAll($sql, $table);\n if (empty($record)) {\n return FALSE;\n } else {\n return $record;\n }\n }\n}",
"public function getData($npk,$table)\n {\n return $this->db->get_where($table,array('npk' => $npk));\n }",
"function getPublicationRecord($rawdata_id, $connection) {\r\n\r\n\t// Get publicatin_id from table \"publications\"\r\n\t$dbQuery = \"select publication_auto_id, pmid, cover_image_id, pdf_file_id, supplement_file_id from publications where rawdata_id=\".$rawdata_id;\r\n\r\n\t// Run the query\r\n\tif (!($result = @ mysql_query($dbQuery, $connection)))\r\n\t\tshowerror();\r\n\r\n\tif( @ mysql_num_rows($result) == 0) {\r\n\t\t// Not found\r\n\t\treturn -1;\r\n\t}\r\n\r\n\t$record['publication_auto_id'] = @ mysql_result($result, 0, \"publication_auto_id\");\r\n\t$record['pmid'] = @ mysql_result($result, 0, \"pmid\");\r\n\t$record['cover_image_id'] = @ mysql_result($result, 0, \"cover_image_id\");\r\n\t$record['pdf_file_id'] = @ mysql_result($result, 0, \"pdf_file_id\");\r\n\t$record['supplement_file_id'] = @ mysql_result($result, 0, \"supplement_file_id\");\r\n\r\n\treturn $record;\r\n}",
"function fetchRecordInfo($identifier) {\n $db_obj = new db_class();\n $primary_key = $db_obj->getPrimaryKey($this->table_title);\n $sql = 'SELECT * FROM ' . $this->table_title . ' WHERE ' . $primary_key . '=?';\n \n $keyTypeHash = $db_obj->columnTypeHash($this->table_title);\n $keyType = $keyTypeHash[$this->primary_key];\n $db_table = $db_obj->simpleOneParamRequest($sql, $keyType, $identifier);\n $db_obj->closeDB();\n \n return $db_table[0];\n }",
"public function getProvider($provider)\n {\n return array_values($this->getProviders($provider))[0] ?? null;\n }",
"public function getByDeviceSN ($deviceSN) {\r\n\t\t$sql = $this->select()\r\n\t\t\t->from($this->t1, '*')\r\n\t\t\t->where(\"{$this->t1}.DEVICE_SN = ?\", $deviceSN);\r\n\t\t\r\n\t\t$deviceBindCamera = $this->dbr()->fetchRow($sql);\r\n\t\treturn $deviceBindCamera;\r\n\t}",
"public function getDataWithTypeParentRecordNumber() {}",
"function jget_roshine_record($sid)\n{\n global $DB;\n return $DB->get_record('roshine', array('id' => $sid));\n}",
"private function get_pinn_number() {\r\n\t\treturn $this->pinn_number; \r\n\t}",
"function getItemByNumber($num)\n {\n $this->db->select('*');\n $this->db->from('tbl_user');\n $this->db->where('userid', $num);\n $query = $this->db->get();\n $result = $query->result();\n if (count($result) == 0) $result[0] = NULL;\n return $result[0];\n }",
"public function getRecord($uid,$did){\n\n\t\t// get database\n\t\t$db = JFactory::getDBo();\n\n\t\t$query = $db->getQuery(true);\n\t\t$query ->select('*')\n\t\t\t ->from($this->name)\n\t\t\t\t->where(array(\n\t\t\t\t\t'user_id='.(int)$uid,\n\t\t\t\t 'discount_id='.(int)$did\n\t\t\t\t ))\n\t\t\t\t->limit(1);\n\t\t$db->setQuery($query);\n\n\t\treturn $db->loadObject();\n\t}",
"public function getProvider();",
"public function getProvider();",
"public function getProvider();",
"public static function findByProvider($provider, $identifier);",
"public function detail($id) {\n\t\t$this->db->select(\"*\");\n\t\t$this->db->where('providers_id = \"'.$id.'\"');\n\t\t$q = $this->db->get('t_providers');\n if ($q->num_rows() > 0) {\n $resultat = $q->row();\n return $resultat;\n }\n else {\n return null;\n }\n }",
"public function getProviderId();",
"public function getRecordInformation() {}",
"public function getByCardNumber($card_number)\n {\n $card_number = $this->toSqlString($card_number);\n\n $query = \"SELECT * FROM $this->table WHERE card_number = $card_number\";\n $stmt = $this->db->prepare($query);\n\n if ($stmt->execute()) {\n $stmt = $stmt->get_result();\n if ($stmt->num_rows > 0) {\n return $this->toArray($stmt)[0];\n }\n }\n\n return null;\n }"
]
| [
"0.5920571",
"0.584921",
"0.5604278",
"0.5591872",
"0.55142355",
"0.54588807",
"0.5458852",
"0.5458852",
"0.54250246",
"0.5420796",
"0.53499657",
"0.5339139",
"0.52471644",
"0.5240895",
"0.5224843",
"0.52122706",
"0.5210811",
"0.51900023",
"0.5188061",
"0.5186431",
"0.5179962",
"0.5176715",
"0.5161301",
"0.5161301",
"0.5161301",
"0.51576316",
"0.5136149",
"0.5120507",
"0.5096738",
"0.50663334"
]
| 0.6648751 | 0 |
Get all records given an organization npi number | public function byOrganizationNpi($npi)
{
return $this->getArray('ByOrganizationNPI/' . $npi);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAllOwners($currpg,$url)\n\t{\n\t\t$sql = \"Select * from tblowner order by organization_name\";\t// sql statement \n\t\t$result = paging($sql,$currpg, $this->pagesize,$url); // execute sql statement \n\t\treturn $result;\t\t\t\t\t\t// return result from sql \n\t}",
"public function public_ids_get()\n {\n $from = \"0\";\n $size = \"10\";\n $lastModified = NULL;\n \n $temp = $this->input->get('from', TRUE);\n if(!is_null($temp) & is_numeric($temp))\n $from = $temp;\n \n $temp = $this->input->get('size', TRUE);\n if(!is_null($temp) & is_numeric($temp))\n $size = $temp;\n \n $temp = $this->input->get('lastModified', TRUE);\n if(!is_null($temp) & is_numeric($temp))\n $lastModified = intval($temp);\n \n $cutil = new CILServiceUtil();\n $result = $cutil->getAllPublicIds($from, $size,$lastModified);\n $this->response($result);\n \n }",
"function load_org()\n {\n $query = $this->db->query('SELECT * FROM `organization`');\n return $query->result_array();\n }",
"public function getAllOrganizations()\n {\n $sql = \"SELECT * FROM organization\";\n $values=array();\n $org=$this->getInfo($sql,$values);\n return $org;\n }",
"function get_emp_list11($email1 ,$year1)\r\n\t{\r\n\t\t$email = trim(Yii::app()->user->getState(\"employee_email\"));\r\n\t\t$connection=Yii::app()->db;\r\n\t\t$sql = \"select distinct `Employee_id` from `kpi_auto_save` use index (emp_index) where appraisal_id1 = '\".$email.\"' and (final_kra_status !='') AND (`goal_set_year`='\".$year1.\"') \";\r\n\t\t$command=$connection->createCommand($sql);\r\n\t\t$rows=$command->queryAll();\t\t\r\n\t\treturn $rows;\r\n\t}",
"public function getData($npk,$table)\n {\n return $this->db->get_where($table,array('npk' => $npk));\n }",
"public function getByPage($pageNo) {}",
"public function byProviderNpi($npi)\n {\n $results = $this->getArray('ByProviderNPI/' . $npi);\n return !empty($results[0]) && is_array($results[0]) ? $results[0] : null;\n }",
"public function fetchNrRecordsToGet();",
"function cicleinscription_get_report_inscriptions($page = 0, $perpage = 0, $username = null, $organid = null, $courseid = null, $cicleinscriptionid, $sort = \"u.firstname ASC\"){\n\tglobal $DB;\n\n\t$limitsql = '';\n\t$page = (int) $page;\n\t$perpage = (int) $perpage;\n\n\t# Iniciando paginacao\n\tif($page || $perpage){\n\t\tif ($page < 0) {\n\t\t\t$page = 0;\n\t\t}else if ($perpage < 1) {\n\t\t\t$perpage = ITEMS_PER_PAGE;\n\t\t}\n\t\t$limitsql = \" LIMIT $perpage\" . \" OFFSET \" . $page * $perpage;\n\t}\n\n\t// validando filtro\n\t$andfilter = false;\n\t$arrayfilter = array($cicleinscriptionid);\n\n\tif($username){\n\t$andfilter = 'AND ci.username = ?';\n\t\tarray_push($arrayfilter, $username);\n\t}\n\tif ($courseid){\n\t$andfilter .= 'AND ci.course_prematriculationid = ?';\n\t\tarray_push($arrayfilter, $courseid);\n\t}\n\tif ($organid){\n\t$andfilter .= 'AND ci.organid = ?';\n\t\tarray_push($arrayfilter, $organid);\n\t}\n\n\t// recupera itens cadastrados\n\t$rs = $DB->get_recordset_sql(\"\n\tSELECT Concat(u.firstname, ' ', u.lastname) as userfullname,\n\t o.name as organ,\n\t c.fullname as course,\n\t u.city as city,\n\t u.id as userid\n\tFROM\n\t {ci_prematriculation} AS ci\n\tINNER JOIN\n\t {user} u\n\t ON ci.username = u.username\n\tINNER JOIN\n\t\t{ci_organ} o\n\tON ci.organid = o.id\n\tINNER JOIN\n\t\t{course} c\n\tON ci.course_prematriculationid = c.id\n\tWHERE\n\t ci.cicleinscriptionid = ?\n\tAND ci.status_prematriculationid = 1\n\t{$andfilter}\n\tORDER BY {$sort} {$limitsql}\",\n\t$arrayfilter);\n\n\treturn $rs;\n}",
"public function obtain_of_i_p($acc_number)\n\t{\n\t return $this->db->select('of_i_p')\n\t\t ->from('pamm_accounts') \n\t\t ->where(\"login\",$acc_number)\n\t\t ->get()->result();\n\t}",
"public static function get_procecution_ids_using_identity_no($identity_number,$office_id,$ended){\n $Procecution_ids=array();\n $conn= DBConnect::getConnection();\n if ($conn->connect_error) {\n die(\"Connection failed: \" . $conn->connect_error);\n }\n $sql=\"SELECT id FROM procecutions where customer_id=(\n SELECT id FROM customers where identity_number= $identity_number and office_id = $office_id ) and ended=$ended;\";\n $result=$conn->query($sql);\n if ($result->num_rows ==0 ) { \n echo \" p u identity error\" ;\n }else{\n while($row = $result->fetch_assoc()) {\n $Procecution_ids[]=$row[\"id\"];\n }\n }\n return $Procecution_ids;\n\n }",
"function getRecordsNPagination($wheres = '', $orderby = '', $searchby = '', $limit = '', $groupby = '', $select = '') {\n $records = $this->getRecords($wheres, $orderby, $searchby, $limit, $groupby, $select);\n //echo $this->db->last_query();\n $total_rows = $this->getNumRecordsPagination($wheres, $searchby);\n $pagination_str = $this->getPaginationString($total_rows, $limit);\n //echo $this->db->last_query();\t\n return array('records' => $records, 'pagination' => $pagination_str);\n }",
"function vcn_findwork_results_get_data_by_onetcode($params, $print_jurl=false, $jobpagemax=500) {\r\n\r\n\t$laytitles_array = vcn_rest_wrapper('vcnoccupationsvc', 'vcnlaytitle', 'getactivelaytitlesforoccupation',\r\n\t\t\tarray('onetcode' => $params['onetcode'], 'industry' => vcn_get_industry()), 'json', 'post', false);\r\n\t$common_keywords = vcn_rest_wrapper('vcnoccupationsvc', 'vcncommonkeywords', 'getcommonkeywords', NULL, 'json', 'post', false);\r\n\r\n\t/*this code is used to merge the original occupation title with the laytitles in such a way that the original title always comes as the first in the search criteria\r\n\t *we have to use stdClass because the $laytitles_array returned by the REST call is an array of objects\r\n\t* Try: var_dump($laytitles_array);\r\n\t* */\r\n\t$occupation_obj = new stdClass();\r\n\t$occupation_obj->laytitle = vcn_findwork_clean_up_title($params['career_title']);\r\n\t$occupation_obj->onetcode = $params['onetcode'];\r\n\t$occupation_obj_array = array($occupation_obj);\r\n\t/* ==== end === */\r\n\r\n\t$combined_array = array_merge($occupation_obj_array, $laytitles_array);\r\n\r\n\t$find_job_query_string = '';\r\n\t$i = 0;\r\n\tforeach ($combined_array as $value) {\r\n\t\t$laytitle_query_string = vcn_prepend_the_word_Title($value->laytitle, $common_keywords);\r\n\t\tif ($i == 0) {\r\n\t\t\t$find_job_query_string .= $laytitle_query_string;\r\n\t\t} else {\r\n\t\t\t$find_job_query_string .= ' or '.$laytitle_query_string;\r\n\t\t}\r\n\t\t$i++;\r\n\t}\r\n\r\n\tif ($params['zipcode']) {\r\n\t\t$find_job_query_string .= \"&zc1=\".$params['zipcode'].\"&rd1=\".$params['distance'];\r\n\t}\r\n\r\n\treturn vcn_get_data_from_apiusjobs($find_job_query_string, $print_jurl, $jobpagemax);\r\n}",
"public function getUsers(Repository $repository, $issueNumber): array;",
"public function listaPerfiles($cn) {\n $sql = \"select g.ID_GRUPO,g.DESCRIPCION,g.ID_DEPENDENCIA,d.DEPENDENCIA\n from db_general.dbo.grupo g\n inner join DB_GENERAL.jcardenas.H_DEPENDENCIA d on d.CODIGO_DEPENDENCIA = g.ID_DEPENDENCIA\n where ID_DEPENDENCIA=22 and ID_APLICACION=1\n ORDER BY DESCRIPCION\";\n $query = $cn->prepare($sql);\n $query->execute();\n $result_query = $query->fetchAll();\n\n return $result_query; \n }",
"public function getPersonalRecords() {\n\t\tif(!$data = $this->getNikePlusFile('http://nikerunning.nike.com/nikeplus/v2/services/app/personal_records.jsp?_plus=true')) {\n\t\t\tthrow new Exception($this->feedErrorMessage);\n\t\t}\n\t\treturn $data;\n\t}",
"public function organizationList(){\n if($this->request->all()){\n $regionIds = array_flatten($this->request->all());\n $sorted = $this->organization->select('id','name')->whereIn('region_id',$regionIds)->get()->sortBy('name');\n return $sorted->values()->all();\n }else{\n $sorted = $this->organization->select('id','name')->get()->sortBy('name');\n return $sorted->values()->all();\n }\n }",
"function person_list($person_id=-1) {\n\tglobal $_DB, $_STATE;\n\n\t//get each person in this org, then get their rate records; if no rate, return NULLs\n\t$sql = \"SELECT c00.person_id, c00.lastname, c00.firstname,\n\t\t\t\t\t\tc02.rate_id, c02.rate, c02.effective_asof, c02.expire_after,\n\t\t\t\t\t\tc00.inactive_asof\n\t\t\tFROM (\n\t\t\t\tSELECT c00.person_id, c00.lastname, c00.firstname, c10.inactive_asof\n\t\t\t\tFROM \".$_DB->prefix.\"c00_person AS c00\n\t\t\t\tINNER JOIN \".$_DB->prefix.\"c10_person_organization AS c10\n\t\t\t\tON c10.person_idref = c00.person_id\n\t\t\t\tWHERE c10.organization_idref = \".$_SESSION[\"organization_id\"].\"\n\t\t\t\t) AS c00\n\t\t\t\tLEFT OUTER JOIN (\n\t\t\t\tSELECT rate_id, person_idref, rate, effective_asof, expire_after\n\t\t\t\tFROM \".$_DB->prefix.\"c02_rate\n\t\t\t\tWHERE project_idref = \".$_STATE->project_id.\"\n\t\t\t\t) AS c02\n\t\t\t\tON c00.person_id = c02.person_idref\";\n\tif ($person_id > 0) $sql .= \"\n\t\t\tWHERE c00.person_id = \".$person_id;\n\t$sql .= \"\n\t\t\tORDER BY c00.lastname, c00.person_id, c02.effective_asof DESC;\";\n\t$stmt = $_DB->query($sql);\n\t$_STATE->records = array();\n\t$rates = array();\n\t$EOF = -1;\n\twhile ($EOF < 1) {\n\t\tif (!$row = $stmt->fetchObject()) { //EOF\n\t\t\tif ($EOF == -1) break; //no people!!??\n\t\t\t$EOF = 1;\n\t\t} else {\n\t\t\tif ($EOF == -1) $row_sav = $row; //first record\n\t\t\t$EOF = 0;\n\t\t}\n\t\tif (($EOF == 1) || ($row_sav->person_id != $row->person_id)) {\n\t\t\t$record = array(\n\t\t\t\t\"ID\" => $row_sav->person_id,\n\t\t\t\t\"name\" => $row_sav->lastname.\", \".$row_sav->firstname,\n\t\t\t\t\"inactive_asof\"=>new DATE_FIELD($row_sav->inactive_asof), //provides formatting only\n\t\t\t\t\"rates\" => $rates,\n\t\t\t\t);\n\t\t\t$_STATE->records[strval($row_sav->person_id)] = $record;\n\t\t\tif ($EOF == 1) break; //all done\n\t\t\t$rates = array();\n\t\t\t$row_sav = $row;\n\t\t}\n\t\t$rates[] = array(\n\t\t\t\"ID\" => $row->rate_id,\n\t\t\t\"update\" => false,\n\t\t\t\"rate\" => $row->rate,\n\t\t\t\t\t\t\t//pagename,DBname,load from DB?,write to DB?,required?,maxlength,disabled,value\n\t\t\t\"eff\"=>new DATE_FIELD(\"txtEff\",\"effective_asof\",FALSE,FALSE,FALSE,0,FALSE,$row->effective_asof),\n\t\t\t\"exp\"=>new DATE_FIELD(\"txtExp\",\"expire_after\",FALSE,FALSE,FALSE,0,FALSE,$row->expire_after),\n\t\t\t);\n\t}\n\t$stmt->closeCursor();\n}",
"public function getNursings()\n {\n $db = PDOController::getInstance();\n $req = $db->prepare('SELECT lastname, firstname, email, role ,id \n FROM persons \n WHERE role =?');\n $req->execute([1]);\n return $req->fetchAll();\n }",
"function get_records($recordType, $params = array(), $limit = 10)\n{\n return get_db()->getTable($recordType)->findBy($params, $limit);\n}",
"function get_emp_list($email1)\r\n\t{\r\n\t\t$email = trim(Yii::app()->user->getState(\"employee_email\"));\r\n\t\t$connection=Yii::app()->db;\r\n\t\t$sql = \"select distinct `Employee_id` from `kpi_auto_save` use index (emp_index) where appraisal_id1 = '\".$email.\"' and (final_kra_status !='')\";\r\n\t\t$command=$connection->createCommand($sql);\r\n\t\t$rows=$command->queryAll();\t\t\r\n\t\treturn $rows;\r\n\t}",
"public function getAllRecords();",
"public function get(){\n\t\t\t\t\t $this->db->setTablename($this->tablename);\n\t\t\t\t\t $condition = array(\"IDP\" =>$this->IDP);\n return $this->db->getRows(array(\"where\"=>$condition,\"return_type\"=>\"single\"));\n\t\t\t\t\t }",
"public function queryOrdernumber($ordn) {\n\t\t$q = $this->query();\n\t\t$q->filterByOrdernumber($ordn);\n\t\treturn $q;\n\t}",
"function get_entradas_boni_gral_list($offset, $per_page, $ubicacion)\n\t{\n\t\t$u = new Entrada();\n\t\t$sql=\"select distinct(e.pr_facturas_id), e.id as id1, e.fecha, sum(costo_total) as importe_factura, pr.razon_social as proveedor,prf.folio_factura, prf.pr_pedido_id, ef.tag as espacio_fisico, eg.tag as estatus from entradas as e left join cproveedores as pr on pr.id=e.cproveedores_id left join pr_facturas as prf on prf.id=e.pr_facturas_id left join espacios_fisicos as ef on ef.id=e.espacios_fisicos_id left join estatus_general as eg on eg.id=e.estatus_general_id where e.estatus_general_id=1 and ctipo_entrada=9 group by e.id, e.fecha, pr.razon_social, prf.folio_factura, prf.pr_pedido_id, ef.tag, eg.tag, e.pr_facturas_id, e.cproveedores_id order by e.fecha desc limit $per_page offset $offset\";\n\n\t\t//Buscar en la base de datos\n\t\t$u->query($sql);\n\t\tif($u->c_rows > 0){\n\t\t\treturn $u;\n\t\t} else {\n\t\t\treturn FALSE;\n\t\t}\n\t}",
"function get_entradas_boni_list($offset, $per_page, $ubicacion)\n\t{\n\t\t$u = new Entrada();\n\t\t$sql=\"select distinct(e.pr_facturas_id), e.id as id1, e.fecha, sum(costo_total) as importe_factura, pr.razon_social as proveedor,prf.folio_factura, prf.pr_pedido_id, ef.tag as espacio_fisico, eg.tag as estatus from entradas as e left join cproveedores as pr on pr.id=e.cproveedores_id left join pr_facturas as prf on prf.id=e.pr_facturas_id left join espacios_fisicos as ef on ef.id=e.espacios_fisicos_id left join estatus_general as eg on eg.id=e.estatus_general_id where e.espacios_fisicos_id=$ubicacion and e.estatus_general_id=1 and ctipo_entrada=9 group by e.id, e.fecha, pr.razon_social, prf.folio_factura, prf.pr_pedido_id, ef.tag, eg.tag, e.pr_facturas_id, e.cproveedores_id order by e.fecha desc limit $per_page offset $offset\";\n\n\t\t//Buscar en la base de datos\n\t\t$u->query($sql);\n\t\tif($u->c_rows > 0){\n\t\t\treturn $u;\n\t\t} else {\n\t\t\treturn FALSE;\n\t\t}\n\t}",
"function get_info_by_organization($user) {\n\t$parsed_json = json_decode(my_get_json(\"rate_limit?access_token=a6f162fe9dd5745cfaa1e387321b3ce59ede3a27\"),true);\n\tif ($parsed_json['rate']['remaining'] != 0)\n\t{\n\t\t$repos_orgarnization = my_get_repo($user);\n\t\t//test\n\t\t//var_dump($repos_orgarnization[$i]['full_name']);\n\t\tget_nbr_contrib($repos_orgarnization);\n\t\tget_commit_activity($repos_orgarnization);\n\t\tget_code_frequency($repos_orgarnization);\n\t\tget_punch_card($repos_orgarnization);\n\t\tget_participation($repos_orgarnization);\n\t}\n\telse\n\t{\n\t\techo \"Une erreur est apparue (limite ou autres)<br/>\";\n\t}\n}",
"private function get_recs() {\n\tglobal $_DB;\n\n\t$sql = \"SELECT e00.name, e00.property_id AS name_id,\n\t\t\t\te02.name AS value, e02.prop_value_id AS value_id\n\t\t\tFROM (\n\t\t\t\tSELECT property_id, name FROM \".$_DB->prefix.\"e00_property\n\t\t\t\tWHERE organization_idref = \".$_SESSION[\"organization_id\"].\"\n\t\t\t) AS e00\n\t\t\tJOIN \".$_DB->prefix.\"e02_prop_value AS e02 ON e02.property_idref = e00.property_id\n\t\t\tORDER BY name, value;\";\n\t$stmt = $_DB->query($sql);\n\t$this->records = array();\n\twhile ($row = $stmt->fetchObject()) {\n\t\t$record = array(\n\t\t\t\t\"name\" =>\t\t$row->name,\n\t\t\t\t\"name_id\" =>\t$row->name_id,\n\t\t\t\t\"value\" =>\t\t$row->value,\n\t\t\t\t\"value_id\" =>\t$row->value_id,\n\t\t);\n\t\t$this->records[] = $record;\n\t}\n\t$stmt->closeCursor();\n}",
"public function getRecordsNumbers() {}"
]
| [
"0.5901007",
"0.5520959",
"0.54629564",
"0.54338115",
"0.542864",
"0.5411147",
"0.5296516",
"0.5291697",
"0.52428615",
"0.519653",
"0.51785046",
"0.5176827",
"0.51631397",
"0.5112919",
"0.510209",
"0.50565207",
"0.50380456",
"0.5037972",
"0.50161606",
"0.49936584",
"0.4987956",
"0.49736845",
"0.4973167",
"0.4972625",
"0.49694973",
"0.496045",
"0.49593005",
"0.49409956",
"0.4939946",
"0.4931703"
]
| 0.70589024 | 0 |
Get all records given a zip code range | public function byZipCodeRange($startZipCode, $endZipCode)
{
return $this->getArray('ByZipcodeRange/' . $startZipCode . '/' . $endZipCode);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function set_random_zipcode_by_range($zip1, $zip2)\r\n{\r\n\t$skip_token = '%';\r\n\r\n\tif ( $this->debug ) $this->print_d(__FUNCTION__ . \" : setting a zipcode between $zip1 & $zip2\");\r\n\t\r\n\t// order zips\r\n\tif ( $zip1 > $zip2 )\r\n\t{\r\n\t\t$_numt = $zip2;\r\n\t\t$zip2 = $zip1;\r\n\t\t$zip1 = $_numt;\r\n\t}\r\n\t\r\n\t// rip file\r\n\t$_LINES = $this->rip_file_to_array($this->SOURCE['us_zipcodes'], $include_empty=0, $mode='rb');\r\n\t\r\n\t// select zip codes in range\r\n\tforeach ( $_LINES as $i => $_line )\r\n\t{\r\n\t\t$_zip = substr($_line, 0, 5);\r\n\t\tif ( ( substr($_line,0,1) <> $skip_token ) && $_zip >= $zip1 && $_zip <= $zip2 )\r\n\t\t{\r\n\t\t\t$_ZIP_POOL[] = $_line;\r\n\t\t\tif ($this->debug) $this->print_d(\"adding record to zip pool: $_line\");\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t// validity check\r\n\tif ( empty($_ZIP_POOL) )\r\n\t{\r\n\t\ttrigger_error(\"unable to find any zips in range: $zip1 - $zip2\", E_USER_WARNING);\r\n\t\treturn 0;\r\n\t}\r\n\t\r\n\t// pick at random\r\n\t$data_line = $this->Randomizer->pick_random_array_item($_ZIP_POOL);\r\n\t$ZIP_DATA = explode(',', $data_line);\r\n\tif ( $this->debug ) $this->print_d(__FUNCTION__ . \" : picked data line > $data_line\");\r\n\t\r\n\t// parse result\r\n\t$this->zipcode = trim($ZIP_DATA[0]);\r\n\t$this->state = trim($ZIP_DATA[1]);\r\n\t$this->city = trim(ucwords(strtolower($ZIP_DATA[2])));\r\n\treturn;\r\n}",
"public function getLocationsFromZipCode(string $zipcode): array;",
"public function getAddressByZipCode($zip_code)\r\n\t{\r\n\t\t//echo \"Obtener direccion a partir del CP Model\"; exit;\r\n\r\n\t\t$sql = new Sql($this->dbAdapter);\r\n\t\t$select = $sql->select();\r\n\t\t$select->from(array('n' => 'neighborhood'));\r\n\t\t$select->columns(array('id_neighborhood' => 'id','colony','postal_code', 'district_id', 'state_id'));\r\n\t\r\n\t\t//$select->join(array('i_u'=>'users_details'),'users.id = i_u.id_user',array('id_user','name','surname', 'campus', 'phone', 'addres','image','pin','key_inventory'), 'Left');\r\n\t\t\r\n\t\t$select->where(array('n.postal_code' => $zip_code ));\r\n\r\n\t\t$selectString = $sql->getSqlStringForSqlObject($select);\r\n $execute = $this->dbAdapter->query($selectString, Adapter::QUERY_MODE_EXECUTE);\r\n $result=$execute->toArray(); \r\n\r\n\t\t//echo \"<pre>\";print_r($result);exit;\r\n\t\treturn $result;\r\n\t}",
"public function getZipCodeData(string $zipcode);",
"function build_us_profile_by_zip_range($zip1, $zip2, $gender='*', $first_name='*', $last_name='*')\r\n{\r\n\t$this->set_identity($gender, $first_name, $last_name);\r\n\t$this->set_street_address();\r\n\t$this->set_random_zipcode_by_range($zip1, $zip2);\r\n\t$this->set_random_us_phone($this->state);\r\n}",
"protected function generate_postal_code_list()\n {\n $sql = \"SELECT PostalCode FROM zip_list\";\n $conn = $this -> connect();\n $stmt = $this -> query($conn, $sql);\n $this -> disconnect($conn);\n\n $list = [];\n while($row = $stmt -> fetch()): $list[] = $row['PostalCode']; endwhile;\n return $list;\n }",
"function cjpopups_geo_address_by_zipcode($zip, $only_zip = false){\n\t$url = \"http://maps.googleapis.com/maps/api/geocode/json?address=\".urlencode($zip).\"&sensor=false\";\n\t$json = @file_get_contents($url);\n\t$data = json_decode($json, true);\n\t$status = $data['status'];\n\tif($status==\"OK\"){\n\t\tif(count($data['results']) > 0){\n\t\t\tforeach ($data['results'] as $key => $result) {\n\t\t\t\t$location = $data['results'][$key]['geometry']['location'];\n\t\t\t\t$address = cjpopups_geo_address_by_latlng($location['lat'], $location['lng']);\n\t\t\t\tif(is_array($address)){\n\t\t\t\t\tforeach ($address as $key => $adval) {\n\t\t\t\t\t\tif($only_zip){\n\t\t\t\t\t\t\tif($adval['zipcode'] != ''){\n\t\t\t\t\t\t\t\t$return[] = $adval;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$return[] = $adval;\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$return = is_array($return) ? array_values($return) : '';\n\t }else{\n\t \t$return = __('No locations found.', 'cjpopups');\n\t }\n\t}else{\n\t $return = __('No locations found.', 'cjpopups');\n\t}\n\treturn $return;\n}",
"public function getZipEntries(): array;",
"function map_postalcode($postalcode)\r\n\t{\r\n\t\t// query postalcode DB\r\n\t\t$sql = '\r\n\t\t\tSELECT PostalCode, Latitude, Longitude\r\n\t\t\tFROM canada_codes\r\n\t\t\tWHERE PostalCode LIKE \"'.$this->db->escape_like_str($postalcode).'%\"\r\n\t\t\tLIMIT 1';\r\n\r\n\t\t//TODO error handle where no results are returned\r\n\r\n $sql_query = $this->db->query($sql);\r\n\t\tif($sql_query->num_rows() > 0){\r\n\r\n foreach($sql_query->result_array() as $row){\r\n\t\t\t\t$data[] = $row;\r\n }\r\n\r\n\r\n return $data;\r\n\r\n }else{\r\n return \"No results found\";\r\n }\r\n\r\n\t}",
"public function getLnt($zip) {\n $url = \"http://maps.googleapis.com/maps/api/geocode/json?address=\n\" . urlencode($zip) . \"&sensor=false\";\n $result_string = file_get_contents($url);\n $result = json_decode($result_string, true);\n $result1[] = $result['results'][0];\n $result2[] = $result1[0]['geometry'];\n $result3[] = $result2[0]['location'];\n return $result3[0];\n }",
"function getZipCodeRadius($zipcode,$zipmiles,$zipCountry)\n\t{\n\t\tglobal $maindb;\n\t\t\n\t\t$questr = \"\";\n\t\t$zipCodes = array();\n\t\t\n\t\t// Checks whether Country selected is United States (code = 243) or Canada (code = 42)\n\t\tif($zipCountry == \"243\")\n\t\t\t$questr\t= \" AND Country='U'\";\n\t\telse if($zipCountry == \"42\")\n\t\t\t$questr\t= \" AND Country='C'\";\n\t\telse\n\t\t\t$questr = \"\";\n\t\t\n\t\t$que \t= \"SELECT Latitude,Longitude FROM zipcodedb WHERE ZipCode = '$zipcode'\".$questr;\n\t\t$res \t= mysql_query($que, $maindb);\n\t\t$row \t= mysql_fetch_assoc($res);\n\n\t\t$zipCodeLatitude \t= $row['Latitude'];\n\t\t$zipCodeLongitude \t= $row['Longitude'];\t\t\n\t\t\n\t\t$iDistance\t= $zipmiles; // user preferred zipcode radius in miles\n\t\t//$iRadius = 6371; // earth radius in km\n\t\t$iRadius \t= 3958; // earth radius in miles\n\t\t$fLat \t\t= $zipCodeLatitude; // user preferred zipcode's latitude\n\t\t$fLon \t\t= $zipCodeLongitude; // user preferred zipcode's longitude\t\t\n\t\t\n\t\t$selQuery \t= \"SELECT\n\t\t\t\tLatitude, Longitude, ZipCode,\n\t\t\t\t$iRadius * 2 * ASIN(SQRT(POWER(SIN(( $fLat - ABS(Latitude)) * PI() / 180 / 2),2) + COS( $fLat * PI()/180) * COS(ABS(Latitude) * PI() / 180) * POWER(SIN(( $fLon - Longitude) * PI() / 180 / 2), 2) )) AS distance\n\t\t\t\tFROM zipcodedb\n\t\t\t\tHAVING distance < $iDistance \n\t\t\t\tORDER BY distance\";\n\t\t\t\t\n\t\t$resGeo \t= mysql_query($selQuery, $maindb);\n\t\twhile($rowGeo = mysql_fetch_assoc($resGeo))\n\t\t{\n\t\t\t$zipCodes[] = $rowGeo['ZipCode'];\t\t\t\n\t\t}\n\t\t$zipCodes = array_unique($zipCodes);\n\t\treturn $zipCodes;\t\t\t\n\t\t\t \n\t}",
"public function getZip() {}",
"public function rangeAllRecords($start, $end)\n\t{\n\t\treturn $this->with(['applicant.department.college.branch', \n\t\t\t'project', 'projectType'])\n\t\t\t->whereBetween('created_at', [$start, $end])\n ->get();\n\t}",
"public function get($postcode);",
"public function zipcodes()\n {\n // App\\Models\\CityComposite::where('state','CA')->where('name', 'Los Angeles')->first()->zipcodes\n return $this->hasMany(City::class, ['city', 'state_code'], ['name', 'state']);\n }",
"public function geocode($zip)\n {\n $args = array(\n 'postal' => $zip,\n 'flags' => 'PC',\n 'appId' => YAHOO_APIKEY,\n 'count' => 1,\n 'locale' => 'en_US',\n 'country' => 'USA'\n );\n\n $url = 'http://where.yahooapis.com/geocode?' . http_build_query($args);\n \n $geoData = unserialize($this->_getCurl($url));\n\n _log('Yahoo API: ' . $url);\n\n if ($geoData['ResultSet']['Error'] != 0 || $geoData['ResultSet']['Found'] == 0) {\n throw new Exception('Could not determine location. Please try again.');\n }\n\n $data = array(\n 'lat' => $geoData['ResultSet']['Result'][0]['latitude'],\n 'lng' => $geoData['ResultSet']['Result'][0]['longitude']\n );\n\n _log('Found location at lat: ' . $data['lat'] . ', lng: ' . $data['lng']);\n\n return $data;\n }",
"function get_all_internships_detail($start, $end) {\n $conn = db_connect();\n\n $sql = \"SELECT * FROM internship_detail where InternshipId between $start and $end\";\n $result = mysqli_query($conn, $sql);\n while ($row = $result->fetch_assoc()) { \n $output[] = $row;\n }\n\n //clean-up result set and connection\n mysqli_free_result($result);\n mysqli_close($conn);\n return $output;\n}",
"function getLnt($zip){\r\n $url = \"http://maps.googleapis.com/maps/api/geocode/json?address=\r\n \".urlencode($zip).\"&sensor=false\";\r\n $result_string = file_get_contents($url);\r\n $result = json_decode($result_string, true);\r\n //print_r($result);die();\r\n return $result['results'][0]['geometry']['location'];\r\n }",
"public function getSearchRange() {}",
"public function getSearchRange() {}",
"public function get_inventory_by_location_code($code='',$limit='', $start='')\n\t{\n\t\t$this->db->select(\n\t\t\t$this->datas_table.\".id, \".\n\t\t\t$this->datas_table.\".code, \".\n\t\t\t$this->datas_table.\".brand, \".\n\t\t\t$this->datas_table.\".model, \".\n\t\t\t$this->datas_table.\".serial_number, \".\n\t\t\t$this->datas_table.\".status, \".\n\t\t\t$this->datas_table.\".color, \".\n\t\t\t$this->datas_table.\".length, \".\n\t\t\t$this->datas_table.\".width, \".\n\t\t\t$this->datas_table.\".height, \".\n\t\t\t$this->datas_table.\".weight, \".\n\t\t\t$this->datas_table.\".price, \".\n\t\t\t$this->datas_table.\".date_of_purchase, \".\n\t\t\t$this->datas_table.\".photo, \".\n\t\t\t$this->datas_table.\".thumbnail, \".\n\t\t\t$this->datas_table.\".description, \".\n\t\t\t$this->datas_table.\".deleted, \".\n\t\t\t$this->datas_table.\".category_id, \".\n\t\t\t$this->categories_table.\".name AS category_name, \".\n\t\t\t$this->datas_table.\".location_id, \".\n\t\t\t$this->locations_table.\".name AS location_name, \".\n\t\t\t$this->users_table.\".username, \".\n\t\t\t$this->users_table.\".first_name, \".\n\t\t\t$this->users_table.\".last_name\"\n\t\t);\n\t\t$this->db->from($this->datas_table);\n\n\t\t// join categories table\n\t\t$this->db->join(\n\t\t\t$this->categories_table,\n\t\t\t$this->datas_table.'.category_id = '.$this->categories_table.'.id',\n\t\t\t'left');\n\n\t\t// join locations table\n\t\t$this->db->join(\n\t\t\t$this->locations_table,\n\t\t\t$this->datas_table.'.location_id = '.$this->locations_table.'.id',\n\t\t\t'left');\n\n\t\t// join user table\n\t\t$this->db->join(\n\t\t\t$this->users_table,\n\t\t\t$this->datas_table.'.created_by = '.$this->users_table.'.username',\n\t\t\t'left');\n\n\t\t$this->db->where($this->datas_table.'.deleted', '0');\n\n\t\t// if code provided\n\t\tif ($code!='') {\n\t\t\t$this->db->where($this->locations_table.'.code', $code);\n\t\t}\n\n\t\t// if limit and start provided\n\t\tif ($limit!=\"\") {\n\t\t\t$this->db->limit($limit, $start);\n\t\t}\n\n\t\t$this->db->order_by($this->datas_table.'.id', 'desc');\n\t\t$datas = $this->db->get();\n\t\treturn $datas;\n\t}",
"static function get_address($code){\n \t$address = DB::table('es_mx')\n\t\t ->select('id','colony','state','town','country','code','postal_code')\n ->where('postal_code','=',$code)->get()->toArray();\n\n\t return $address;\n }",
"public function retrieveAllIds()\n {\n try\n {\n $result = $this->db->fetchCol('SELECT FROM '.ZipCode::TABLENAME);\n }\n catch(Exception $e)\n {\n throw new Exception(\"No se pudieron obtener los ids\\n\" . $e->getMessage());\n }\n return $result;\n }",
"public function booking($offset,$limit,$orderid,$pincode)\n\t{\n\t\t$this->db->select('*');\n\t\t$this->db->from($this->pro->prifix.$this->pro->booking);\n\t\t$this->db->join($this->pro->prifix.$this->pro->user,$this->pro->user.\"_id = \".$this->pro->booking.\"_userId\",\"inner\");\n\t\t\n\t\tif($orderid !='0' )\n\t\t{\n\t\t\t $this->db->like($this->pro->booking.'_invoiceId',$orderid);\n\t\t}\n\t\t\n\t\tif($pincode !='0' )\n\t\t{\n\t\t\t $this->db->where($this->pro->user.'_zipcode',$pincode);\n\t\t}\n\t\t\n\t\t$this->db->order_by($this->pro->booking.'_id','desc');\n\t\t$this->db->limit($limit,$offset);\n\t\t$rs = $this->db->get();\n\t\t//echo $this->db->last_query();\n\t\treturn $rs->result_array();\n\t\t\n\t}",
"public function getLocationfromZipCode($api, $args)\n {\n $this->requireArgs($args, array('zipcode'));\n $locations = array();\n $country = '';\n $query = \"SELECT * FROM zipcodes WHERE postal_code LIKE '\" . $args[\"zipcode\"] . \"' AND deleted = 0\";\n $result = $GLOBALS['db']->query($query);\n\n if ($result->num_rows > 0) {\n while ($row = $GLOBALS['db']->fetchByAssoc($result)) {\n $locations[] = $row['location'];\n $country = $row['country'];\n }\n }\n\n return array('cities' => $locations, 'country' => $country);\n }",
"public function search($postcode);",
"public function getAddressBooks();",
"function getLocation($zipcode) {\n global $pdo;\n $sql = \"select * \"\n . \"FROM a6_locations \"\n . \"WHERE zipcode = ? \"\n . \"LIMIT 1\";\n $query = $pdo->prepare($sql);\n $params = array($zipcode);\n $query->execute($params);\n if ($query->rowCount() > 0) {\n return $query->fetchObject();\n } else {\n return null;\n }\n }",
"public function validateZipCode(Request $request) {\n $client = new Client([\n 'timeout' => 15,\n ]);\n $_response = $client->get(\"http://www.geonames.org/postalCodeLookupJSON\", [\n 'query' => array(\n 'country' => 'US',\n 'callback' => '',\n 'postalcode' => $request->get('zip_code'),\n ),\n ]);\n $bodyObj = $_response->getBody();\n $response = (string)$bodyObj;\n $response = substr($response, 1, strlen($response) - 3);\n return response($response);\n }",
"public function setZipCode($zipCode)\n {\n if (!preg_match('/^\\d{5}(\\-\\d{4})?$/', $zipCode))\n {\n throw new Exception(sprintf('The given zip code \"%s\"does not match \"ddddd\" or \"ddddd-dddd\" pattern', $zipCode));\n }\n\n $this->setParameter('zip', $zipCode);\n\n return $this;\n }"
]
| [
"0.6472941",
"0.6376088",
"0.61929035",
"0.60153025",
"0.58382225",
"0.5723015",
"0.57100785",
"0.56565326",
"0.55631703",
"0.55520344",
"0.5472927",
"0.53350693",
"0.53143084",
"0.5298191",
"0.5289566",
"0.5266698",
"0.52427554",
"0.5174394",
"0.51678693",
"0.5166935",
"0.51435065",
"0.5125044",
"0.512217",
"0.5120413",
"0.51070404",
"0.5056722",
"0.50461143",
"0.50446254",
"0.5010953",
"0.49909276"
]
| 0.6895352 | 0 |
Checks if FFprobe available. | function isFFprobeAvailable($app) {
if (!array_key_exists('ffprobe_alt', $app->config)) { return false; }
return (bool) (file_exists($app->config['ffprobe_alt']) & is_executable($app->config['ffprobe_alt']));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function probe() {\n $this->probe_errors = array();\n if (!function_exists('mysql_connect')){\n $this->probe_errors[] = sprintf(DB_ERR_EXTENSION_UNAVAILABLE,'MySQL');\n return false;\n }\n if (!($conn = @mysql_connect($this->server.(($this->port==\"\")?\"\":\":\".$this->port),\n $this->login,\n $this->password )) ) {\n $this->probe_errors[] = sprintf(DB_ERR_CONNECT_SERVER,$this->server);\n return false;\n }\n if (!@mysql_select_db($this->db,$conn)){\n $this->probe_errors[] = sprintf(DB_ERR_CONNECT_DATABASE,$this->db);\n return false;\n }\n return true;\n }",
"function available() {\n\t\treturn function_exists('fsockopen');\n\t}",
"public function probe() {\n return ($this->callWbs('once', 'probe') === false) ? false : true;\n }",
"public function isAvailable() {\n $path = $this->path();\n return file_exists($path);\n }",
"public static function available()\n\t{\n\t\treturn function_exists('curl_init');\n\t}",
"public static function isSupported()\n {\n return function_exists('finfo_open');\n }",
"public static function finfo_loaded(): bool\n {\n return \\class_exists('finfo');\n }",
"function isAvailable() ;",
"function isAvailable() ;",
"function _isBrowserLinuxFF($ua_ok) {\r\n\t\t return ( (eregi( \"Linux\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"rv:[1]\\.[7]\\.[5]\", $ua_ok ) && eregi( \"[1]\\.[0]\", $ua_ok ) ) ||\r\n\t\t\t\t\t(eregi( \"Linux\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"[1]\\.[8]\\.[1]\\.[1]\", $ua_ok ) ) ||\r\n\t\t\t\t\t(eregi( \"Linux\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"[1]\\.[0]\\.[7]\", $ua_ok ) ) ||\r\n\t\t\t\t\t(eregi( \"Linux\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"[1]\\.[5]\\.[0]\", $ua_ok ) ) ||\r\n\t\t\t\t\t(eregi( \"Linux\", $ua_ok ) && eregi( \"mozilla\", $ua_ok ) && eregi( \"rv:[1]\\.[7]\\.[12]\", $ua_ok ) )\r\n\t\t\t\t );\r\n\t}",
"protected function checkProcOpenFunctionExists() {\n\t\t$pass = function_exists('proc_open');\n\n\t\t$this->reports[] = t3lib_div::makeInstance('tx_reports_reports_status_Status',\n\t\t\t'proc_open() is available', // title\n\t\t\t$pass ? 'OK' : 'Disallowed', // value\n\t\t\t$pass ? '' : 'proc_open() is need to call the wkhtmltopdf binary. If it is disabled please ask your Administrator or Hoster for help.' , //message\n\t\t\t$pass ? tx_reports_reports_status_Status::OK : tx_reports_reports_status_Status::ERROR //severity\n\t\t);\n\n\t\treturn $pass;\n\t}",
"function available() {\n\t\treturn function_exists('curl_init');\n\t}",
"public static function is_available()\n {\n }",
"function isAvailable()\n {\n }",
"public static function isAvailable ()\n\t{\n\t\tif (!function_exists('curl_version')){\n\t\t\treturn false;\n\t\t}\n\n\t\t$versionInfo = curl_version();\n\t\t$versionTab = explode('.', $versionInfo['version']);\n\n\t\tif ($versionTab[0] < 7 || ($versionTab[0] == 7 && $versionTab[1] < 10) || ($versionTab[0] == 7 && $versionTab[1] == 10 && $versionTab[2] < 5)){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}",
"public static function checkFFMPEG()\r\n {\r\n $ffmpegBin = null;\r\n // We only resolve this once per session and then cache the result.\r\n if ($ffmpegBin === null) {\r\n @exec('ffmpeg -version 2>&1', $output, $statusCode);\r\n if ($statusCode === 0) {\r\n $ffmpegBin = 'ffmpeg';\r\n } else {\r\n @exec('avconv -version 2>&1', $output, $statusCode);\r\n if ($statusCode === 0) {\r\n $ffmpegBin = 'avconv';\r\n } else {\r\n $ffmpegBin = false; // Nothing found!\r\n }\r\n }\r\n }\r\n\r\n return $ffmpegBin;\r\n }",
"public function checkFeatureImplemented();",
"function getIsAvailable() ;",
"public static function isAvailable()\n\t{\n\t\treturn true;\n\t}",
"function _isBrowserWinFF($ua_ok) {\r\n\t\treturn ( (eregi( \"Windows\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"[1]\\.[9]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"[1]\\.[8]\\.[1]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"[1]\\.[5]\\.[0]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"firefox\", $ua_ok ) && eregi( \"[1]\\.[0]\\.[7]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"mozilla\", $ua_ok ) && !eregi( \"netscape\", $ua_ok ) && eregi( \"rv:[1]\\.[7]\\.[12]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"mozilla\", $ua_ok ) && eregi( \"rv:[1]\\.[6]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"mozilla\", $ua_ok ) && eregi( \"[4]\\.[78]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"netscape\", $ua_ok ) && eregi( \"[6]\", $ua_ok ) ) ||\r\n\t\t\t\t (eregi( \"Windows\", $ua_ok ) && eregi( \"netscape\", $ua_ok ) && eregi( \"[7]\", $ua_ok ) )\r\n\t\t\t );\r\n\t}",
"public function isAvailable(): bool;",
"public function providerHasDevices(): bool;",
"function spectra_node_isalive ()\n\t{\n\t\t$info = getinfo ();\n\t\t\n\t\tif (isset ($info[\"error\"]) && is_array ($info[\"error\"]))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t}",
"public function isAvailable() {}",
"public function isAvailable() {}",
"public function isAvailable() {}",
"public function isAvailable() {}",
"public function isAvailable() {}",
"public function isAvailable() {}",
"public function isAvailable() {}"
]
| [
"0.6245987",
"0.62175316",
"0.60258996",
"0.56282955",
"0.56245035",
"0.5606402",
"0.5601424",
"0.55907977",
"0.55907977",
"0.5578447",
"0.5564225",
"0.55252886",
"0.5485559",
"0.54779154",
"0.54546636",
"0.54245746",
"0.5403667",
"0.5365387",
"0.5341879",
"0.53140813",
"0.5294539",
"0.5272314",
"0.5251888",
"0.52501315",
"0.52501315",
"0.52501315",
"0.52494437",
"0.52494437",
"0.52494437",
"0.52494437"
]
| 0.78013134 | 0 |
Returns all current live channels' livestream IDs as an array, and FALSE when encountering an error or no livestreams available. | function getActiveChannels() {
global $debug, $logdir, $logfile, $app;
$channels = null;
$model = $app->bootstrap->getModel('channels');
$now = date("Y-m-d H:i:s");
$query = "SELECT"
." ch.id,"
." ch.starttimestamp,"
." ch.endtimestamp,"
." ch.title,"
." ch.isliveevent,"
." lf.id AS locationid,"
." lf.name AS locationname,"
." lf.issecurestreamingforced,"
." lf.indexphotofilename,"
." lfs.id AS livefeedstreamid,"
." lfs.qualitytag AS streamname,"
." lfs.keycode AS streamid,"
." lfs.contentkeycode AS contentstreamid"
." FROM"
." channels AS ch,"
." livefeeds AS lf,"
." livefeed_streams AS lfs"
." WHERE"
." ch.starttimestamp <= '" . $now . "' AND"
." ch.endtimestamp >= '" . $now . "' AND"
." ch.id = lf.channelid AND"
." lf.id = lfs.livefeedid AND"
." lf.issecurestreamingforced = 0"
." ORDER BY"
." ch.id";
try {
$rs_channels = $model->safeExecute($query);
$channels = $rs_channels->GetArray();
} catch (Exception $err) {
$debug->log($logdir, $logfile, "[ERROR] SQL query failed (". $err->getTraceAsString() .")\nSQL QUERY:\n'". trim($query) ."'", false);
return false;
}
// Check if any record returned
if (count($channels) < 1) { return false; }
return $channels;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function available()\n {\n return array_keys(self::$streams);\n }",
"public function get_channel_ids($use_cache = TRUE)\r\n\t{\r\n\t\t//cache?\r\n\t\tif ($use_cache AND isset($this->cache['channel_ids']['full']))\r\n\t\t{\r\n\t\t\treturn $this->cache['channel_ids']['full'];\r\n\t\t}\r\n\r\n\t\t$query = $this->EE->db\r\n\t\t\t\t\t\t->select('preference_value')\r\n\t\t\t\t\t\t->where('preference_name', 'channel_ids')\r\n\t\t\t\t\t\t->get('user_preferences');\r\n\r\n\t\tif ($query->num_rows() == 0)\r\n\t\t{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\t$this->cache['channel_ids']['full'] = unserialize(\r\n\t\t\t$query->row('preference_value')\r\n\t\t);\r\n\r\n\t\treturn $this->cache['channel_ids']['full'];\r\n\t}",
"public function getChannels(){\n\t\t//TODO: Change query\n\t\t$query = sprintf(\"SELECT idChannel FROM Channels limit 1\");\n\n\t\t$this->dbObj->Query($query);\n\n\t\tif ($this->dbObj->numErr) {\n\t\t\t$this->parent->SetError(5);\n\t\t}\n\n\t\t$out = NULL;\n\t\twhile (!$this->dbObj->EOF) {\n\t \t\t$out[] = $this->dbObj->GetValue(\"idChannel\");\n\t\t\t$this->dbObj->Next();\n\t\t}\n\n\t \treturn $out;\n\t}",
"public function getAllChannels()\n {\n //$query=\"select c.channel_id, c.channel_name, c.address From \".$this->conf->db_prefix.\"channel c\";\n $query=\t\" SELECT * From \".CHANNEL_TYPE_T.\" ct\"\n\t\t\t .\" INNER JOIN \".CHANNEL_T.\" ch ON ct.channel_type_id = ch.channel_type_id\";\n\n // $this->LastMsg.\"Helloosds\";\n if(($result=$this->db->CustomQuery( $query))!=null)\n {\n return $result;\n }\n\n\n \t$this->mlog->LogMsg(__CLASS__,__METHOD__, __FILE__,__LINE__,\"User: \".$_SESSION['user_id'].\"\\r\\nFailed to add: $start\");\n \t$this->LastMsg.\"Channel not found! <br>\";\n return false;\n\n }",
"public function iN_GetLiveStreamingDetailsByID($liveID) {\n\t\t$query = mysqli_query($this->db, \"SELECT * FROM i_live WHERE live_id = '$liveID' ORDER BY live_id DESC LIMIT 1\") or die(mysqli_error($this->db));\n\t\tif (mysqli_num_rows($query) == 1) {\n\t\t\t$row = mysqli_fetch_array($query, MYSQLI_ASSOC);\n\t\t\treturn $row;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function onChannels(): ?array\n {\n return null;\n }",
"public function iN_GetLiveStreamingDetails($userID) {\n\t\t$query = mysqli_query($this->db, \"SELECT * FROM i_live WHERE live_uid_fk = '$userID' ORDER BY live_id DESC LIMIT 1\") or die(mysqli_error($this->db));\n\t\tif (mysqli_num_rows($query) == 1) {\n\t\t\t$row = mysqli_fetch_array($query, MYSQLI_ASSOC);\n\t\t\treturn $row;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"public function getChannels();",
"function get_all_streams()\n {\n $this->db->order_by('id', 'desc');\n return $this->db->get('streams')->result_array();\n }",
"public function channels()\n {\n return $this->send('channels');\n }",
"function get_stream($id)\n {\n return $this->db->get_where('streams', array('id' => $id))->row_array();\n }",
"public function all(): array\n {\n return $this->channels;\n }",
"public function available() {\r\n\t\t// All streams were read\r\n\t\tif($this->_streamsCount===0) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// The current stream has more data\r\n\t\tif(reset($this->_streams)->available()) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\t// Check the other streams, if they have data\r\n\t\tforeach($this->_streams as $stream) {\r\n\t\t\tif($stream->available()) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn false;\r\n\t}",
"public function playlists()\n\t{\n\t\treturn $this->CLI->arrayQuery(\"alarm playlists\");\n\t}",
"public function explore_live_streams()\n {\n $user = auth()->user();\n $condition = [\n ['deleted_at', null],\n ['status', 'live'],\n ];\n $live_streams = $this->live_stream->get_all($condition);\n $view = [\n 'live_streams' => $live_streams,\n 'user' => $user,\n ];\n\n return view('dashboard.all_active_live_streams', $view);\n }",
"public function nowPlaying(): array\n {\n return Http::withToken($this->token)\n ->get($this->url . self::NOW_PLAYING)\n ->json()['results'];\n }",
"public function getEpisodeIds(){\n $result = array();\n $progam = null;\n $con = $this->mysqli->prepare(\n \"SELECT EpNum FROM episode where programName=? and callsign=?\");\n $con->bind_param('ss',$this->name,$this->callsign);\n $con->bind_result($progam);\n if($con->execute()){\n while($con->fetch()){\n array_push($result, $progam);\n }\n return $result;\n }\n else{return false;}\n }",
"public function getAllChannelTypes()\n {\n $query=\"select channel_type_id, channel_type_name From \".$this->conf->db_prefix.\"channel_type\";\n if(($result=$this->db->CustomQuery( $query))!=null)\n {\n return $result;\n }\n\n \t$this->mlog->LogMsg(__CLASS__,__METHOD__, __FILE__,__LINE__,\"User: \".$_SESSION['user_id'].\"\\r\\nFailed to add: $start\");\n \t$this->LastMsg.\"Channel id not found <br>\";\n return false;\n }",
"public function getPlaysIds(): array\n {\n return $this->playsIds;\n }",
"public static function getAvailable()\n {\n $associated_ids = DB::table('campaigns')->pluck('website_id');\n return DB::table('websites')->whereNotIn('id', $associated_ids)\n ->pluck('url', 'id')\n ->toArray();\n }",
"public function getStreams()\n {\n $c = $this->getWSConnection();\n $c->send(\"streams\");\n $answer = json_decode($c->receive(), true);\n\n $this->streams = $answer['streams'];\n\n\n $c->send(\"read_config\");\n $answer_read = json_decode($c->receive(), true);\n\n foreach ($this->streams as $index => $stream){\n $this->streams[$index]['transcoding_options'] = '';\n\n if (!empty($answer_read['data']['streams'][$stream['name']]['transcoder'])){\n $transcoding_options = $answer_read['data']['streams'][$stream['name']]['transcoder'];\n\n $this->streams[$index]['transcoding_options'] = $this->serializeTranscoder($transcoding_options);\n }\n\n }\n\n foreach ($this->streams as $stream) {\n $streamObj = FlussonicStream::createFromArray($stream);\n $this->streams_objs[$streamObj->name] = $streamObj;\n }\n\n return $this->streams;\n }",
"public function getAllChannels()\n {\n return Channel::with('subChannel.display')->active()->alive()->get()->toArray();\n }",
"public function getPlayLists();",
"function get_playlists_no_more_cb26()\r\n\t{\r\n\t\tglobal $db;\r\n\t\t$result = $db->select(tbl($this->playlist_tbl),\"*\",\" playlist_type='\".$this->type.\"' AND userid='\".userid().\"'\");\r\n\t\t\r\n\t\tif(count($result)>0)\r\n\t\t\treturn $result;\r\n\t\treturn false;\r\n\t}",
"public function getStreams();",
"public function getChannelStreams($channel) { \r\n return $this->makeRequest('get', \"/streams/{$channel}/\");\r\n }",
"public function getOnlineList()\n {\n $online = [];\n if ( $this->online )\n {\n $id = 0;\n $pack = pack( 'N*', -1, 1, $id ) . $this->gamed->packString( '1' );\n $pack = $this->gamed->createHeader( 352, $pack );\n $send = $this->gamed->SendToDelivery( $pack );\n $data = $this->gamed->deleteHeader($send);\n $data = $this->gamed->unmarshal( $data, $this->data['RoleList'] );\n\n if ( isset( $data['users'] ) )\n {\n foreach ( $data['users'] as $user )\n {\n $online[] = $user;\n //$id = $this->gamed->MaxOnlineUserID( $data['users'] );\n }\n }\n }\n return $online;\n }",
"public function getAllChannels()\n {\n return $this->_channel;\n }",
"public function GetTVShows()\n {\n $KodiData = new Kodi_RPC_Data(self::$Namespace);\n $KodiData->GetTVShows(array(\"properties\" => static::$TvShowItemList));\n $ret = $this->SendDirect($KodiData);\n if (is_null($ret))\n return false;\n if ($ret->limits->total > 0)\n return json_decode(json_encode($ret->tvshows), true);\n return array();\n }",
"public function getUpstreams();"
]
| [
"0.62273186",
"0.60276705",
"0.6020863",
"0.5844132",
"0.5757944",
"0.55814606",
"0.5565892",
"0.5518544",
"0.55145526",
"0.5512933",
"0.5492114",
"0.5482048",
"0.54657114",
"0.54343843",
"0.5399234",
"0.5394631",
"0.53118134",
"0.5300579",
"0.5275318",
"0.5209813",
"0.5183014",
"0.5177405",
"0.51663107",
"0.51560885",
"0.51486707",
"0.5148636",
"0.51430297",
"0.5142396",
"0.51410586",
"0.50831586"
]
| 0.6700836 | 0 |
print("worker error happening [workerId=$workerId, workerPid=$workerPid, exitCode=$exitCode, signalNo=$sigNo]..."); | public function onWorkerError(Swoole\Server $swooleServer, $workerId, $workerPid, $exitCode, $sigNo)
{
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function onWorkerError($serv, $worker_id, $worker_pid, $exit_code, $signal)\n {\n Console::warn(\"Vary Worker_%s - (%s, %s)\", [$worker_pid, $exit_code, $signal]);\n }",
"function signalHandler()\n{\n exit(1);\n}",
"function Err()\n{\n ob_end_clean();\n fprintf (STDERR, \"Chyba - Zadan spatny pocet argumentu, spatne typy operandu nebo vase instrukce neodpovida zadnemu regularnimu vyrazu!\\n\");\n exit(23);\n}",
"function kill($msg = STR_EMP, $fatal = false) {\n\tif($fatal) {\n\t\techo \"**** FATAL ERROR:\\n\";\n\t}\n\techo $msg . \"\\n\";\n\techo \"............process ended\\n\";\n\texit;\n}",
"public function reportProblemLogAndExit(){\nself::encodeAndOutputMessage($this->message);\n$this->logMessage(self::$normalErrorLog);\nexit;\n}",
"function errorOnProcessLunch() {\n print \"Failed to lunch process \\n\";\n}",
"function toDie($msg) {\n $data = array(\"error\" => $msg);\n print_result($data);\n die();\n}",
"function myExeptionHandler($exeption) {\n\techo \"Triton: Uncaught exeption; <p>\" . $exeption->getMessage() . \"<p><pre>\" . $exeption->getTraceAsString(), \"</pre>\"; // punkt här emellan???\n}",
"function seterr($msg)\n{\n\tif (php_sapi_name() == 'cli') {\n\t\texit($msg .\"\\n\");\n\t} else {\n\t\texit('<p class=\"alert\">'. $msg .'</p></body></html>');\n\t}\n}",
"function err($message,$code){\n fwrite(STDERR, \"ERR:\".\"$message\\n\");\n exit($code);\n }",
"function kill($error) {\n echo $error.\"<br /><br />\";\n die();\n }",
"function exit_program($message, $code)\n{\n fwrite(fopen('php://stderr', 'w+'), $message);\n exit($code);\n}",
"function websend_fatal_error($msg) {\n websend_command('PrintToConsole', 'Websend Error: ' . $msg, null);\n error_log(\"Websend error: \" . $msg);\n die();\n}",
"public function gearmanRunOnceBeforeExit()\n {\n echo \"i am handling signal!\\n\";\n if (!isset($this->_app)) {\n $this->_app = CApp::getApp();\n }\n// var_dump($this->sub_process_keys);\n foreach ($this->sub_process_keys as $_k => $_subProcessKey) {\n $workeName = $this->_gearmanFuncNamePre.\"_\".$_subProcessKey;\n $this->_app->logger->log(\"i am worker {$workeName},i am tring to run last worker before exit\", \"NOTICE\");\n $dataDir = $this->_app->systemDataDir;\n $workingJobsDir = $dataDir.DIRECTORY_SEPARATOR.self::WORKING_JOBS_DIRNANE;\n if (!file_exists($workingJobsDir)) {\n mkdir($workingJobsDir);\n }\n $registerFuncName = $this->_gearmanFuncNamePre.\"_\".$_subProcessKey;\n $workingJobFile = $workingJobsDir.DIRECTORY_SEPARATOR.$registerFuncName;\n var_dump($workingJobFile);\n if (!file_exists($workingJobFile)) {\n $this->_app->logger->log(\"i am worker {$workeName},i am not working when i am nicely killed\", \"NOTICE\");\n // when job isn't running kill the working process\n posix_kill($this->_forkedPids[$_k], SIGKILL);\n } \n else {\n echo \"the worker $workeName is running\\n\";\n }\n }\n }",
"function printError($errorMessage, $code){\n fwrite(STDERR, \"Error : $errorMessage \\n\");\n exit($code);\n}",
"function errorMsg($number)\n{\n switch ($number) {\n case 10:\n fwrite(STDERR, \"Missing parameter or wrong number of parameters\");\n exit(10);\n break;\n }\n}",
"function report_error($msg) {\r\n print $msg;\r\n exit;\r\n}",
"public function gracefulStop(){\n $this->handleWorkerOutput('warn', \"Work done, exiting now.\");\n $this->stop();\n }",
"private function error_report($msg){\n die($msg);\n }",
"function bye($msg=null){\n print $msg . \"\\n\";\n exit;\n}",
"public function __invoke()\n {\n pcntl_signal_dispatch();\n }",
"public static function reportOtherExceptionAndExit($e){\nself::encodeAndOutputMessage(self::translate('System error.'));\n$msg=date(\"Y-m-d H:i:s T\");\n$msg.=':'.(string)$e.\"\\n\"; //Let the exception describe itself\nforeach(self::$details as $k=>$v)$msg.=\"$k=$v\\n\";\nLogger::log(self::$systemErrorLog,$msg);\nexit;\n}",
"function pcntl_wexitstatus($status)\n{\n}",
"function error($code, $message = '') {\n\tfwrite(STDERR, 'Error [' . $code . ']: ' . $message . \"\\n\");\n\tfwrite(STDERR, 'Usage: php ' . $_SERVER['SCRIPT_NAME'] . ' {N}' . \"\\n\");\n\texit($code);\n}",
"function customError($errNo,$errStr,$errFile,$errLine){\n echo \"<b>Custom error:</b>[$errNo] $errStr</br>\";\n echo \"Error on line $errLine in $errFile</br>\";\n echo \"Ending Script\";\n $errText=\"Custom error $errNo on line $errLine in $errFile on \".date('Y-m-d H:i:s',time());\n writerErrLog($errText);\n}",
"function exception_handler($ex) {\n // now let the plugin send the exception to client\n $this->send_error($ex);\n // not much else we can do now, add some logging later\n exit(1);\n }",
"function error_and_die($msg) {\n echo ('<p><span style=\"color:#ff0000; font-size:1.5em;\">SubmissionBox Error Encountered</span></p>');\n echo ('<p><span style=\"color:#ff0000;\">Message: ' . $msg . '</span></p></body></html>');\n die;\n }",
"function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {\n\techo \"Error: $err_no - $err_msg, $filename($linenum)\\n\";\n}",
"protected function doJob()\n {\n $this->logInfo('Triggering an error.');\n trigger_error('Very nice! How much?');\n }",
"function qa_exit($reason = null)\n{\n\tqa_report_process_stage('shutdown', $reason);\n\n\t$code = $reason === 'error' ? 1 : 0;\n\texit($code);\n}"
]
| [
"0.6938193",
"0.6281733",
"0.6057927",
"0.5820252",
"0.58146775",
"0.57606804",
"0.5671542",
"0.5650327",
"0.56491935",
"0.56440705",
"0.5629215",
"0.54926896",
"0.5482729",
"0.5458968",
"0.5413406",
"0.5395372",
"0.5383938",
"0.5359324",
"0.5338928",
"0.5334206",
"0.53021973",
"0.5279381",
"0.5264819",
"0.52564275",
"0.5246139",
"0.5228796",
"0.5223412",
"0.5217222",
"0.5168543",
"0.51616"
]
| 0.6817389 | 1 |
Order by Calories function | function orderCal($count) {
global $conn;
if($count == 1) {
$sql = "SELECT * FROM `candy` ORDER BY `candy`.`caloriesId` ASC";
}
else {
$sql = "SELECT * FROM `candy` ORDER BY `candy`.`caloriesId` DESC";
}
$statement = $conn->prepare($sql);
$statement->execute();
$candies = $statement->fetchAll(PDO::FETCH_ASSOC);
return $candies;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function order();",
"public function getCalories()\n {\n return $this->calories;\n }",
"public function &getOrderBy();",
"function getOrderings() ;",
"public function getCalories()\n\t{\n\t\treturn $this->calories;\n\t}",
"function getOrder()\n {\n return 50;\n }",
"function hentAlleAktiviteter()\n{\n return Aktivitet::All()->sortByDesc(\"Dato\");\n}",
"function orderHotelsByRate($array)\n{\n return collect($array)->sortByDesc('hotelRate');\n}",
"function View_Cat_Industry_Order()\n\t{\n\t\tglobal $db;\n\t\t$sql= \"SELECT * FROM \".INDUSTRY_MASTER\n\t \t\t .\" ORDER BY display_order ASC \";\n\t\t$db->query($sql);\n\t}",
"function getOrder()\n {\n return 10;\n }",
"function publisher_getOrderBy($sort)\r\n{\r\n if ($sort == \"datesub\") {\r\n return \"DESC\";\r\n } else if ($sort == \"counter\") {\r\n return \"DESC\";\r\n } else if ($sort == \"weight\") {\r\n return \"ASC\";\r\n }\r\n}",
"function getOrder()\n {\n return 20;\n }",
"function getOrder()\n {\n return 20;\n }",
"function sortByPrice($a, $b) { \n return $a['menor_valor'] - $b['menor_valor'];\n}",
"public function getOrderings();",
"function getOrder();",
"function es_change_default_category_orderby( $order_by ) {\n\tglobal $wp_query;\n\t$cat_id = $wp_query->get_queried_object()->term_id;\n\n\t// Category id E-learning Subscriptions is 190\n\tif ( $cat_id == 190 )\n\t\treturn 'price';\n\telse\n\t\treturn $order_by;\n}",
"public function getOrder()\n {\n return 30;\n }",
"public function getTotalCalories(){\n return $this->totalCalories;\n }",
"public function getOrderings() {}",
"function orderPrice($count) {\n global $conn;\n if($count == 1) {\n $sql = \"SELECT * FROM `candy` ORDER BY `candy`.`priceId` ASC\";\n }\n else {\n $sql = \"SELECT * FROM `candy` ORDER BY `candy`.`priceId` DESC\"; \n }\n $statement = $conn->prepare($sql);\n $statement->execute();\n $candies = $statement->fetchAll(PDO::FETCH_ASSOC);\n return $candies;\n}",
"public function sortSalestransactions(Request $request,$column) {\n //get the collection from the seesion variable\n $salestransactions = $request->session()->get('salestransactions');\n // now sort the collection\n // first check the session variable to see if we are sorting on the same column\n // if so, reverse the sort\n $txcol = $request->session()->get('txcol');\n $txord = $request->session()->get('txord');\n $ord = 'A';\n if ($txcol == $column) {\n if ($txord == 'A') {\n $ord = 'D';\n }\n }\n // check if column is either last name or city - need special sort\n\n if ($column == 'salesperson_name') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->salesperson->last_name . ',' . $salestransactions->salesperson->first_name . ' ' . $salestransactions->transaction_date;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->salesperson->last_name . ',' . $salestransactions->salesperson->first_name . ' ' . $salestransactions->transaction_date;\n });\n }\n } elseif ($column == 'product_id') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->product->product_id . ' ' . $salestransactions->transaction_date;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->product->product_id . ' ' . $salestransactions->transaction_date;\n });\n }\n } elseif ($column == 'product_name') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->product->product_name . ' ' . $salestransactions->transaction_date;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->product->product_name . ' ' . $salestransactions->transaction_date;\n });\n }\n } elseif ($column == 'total') {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy(function($salestransactions) {\n return $salestransactions->quantity * $salestransactions->product->price;\n });\n } else {\n $salestransactions = $salestransactions->sortByDesc(function($salestransactions) {\n return $salestransactions->quantity * $salestransactions->product->price;\n });\n }\n } else {\n if ($ord == 'A') {\n $salestransactions = $salestransactions->sortBy($column);\n } else {\n $salestransactions = $salestransactions->sortByDesc($column);\n }\n }\n\n $salestransactions->values()->all();\n // set the session variable to refelect the current sort\n $request->session()->put('txcol',$column);\n $request->session()->put('txord',$ord);\n $request->session()->put('salestransactions',$salestransactions);\n return view('salestransactions', ['sortOrder' => $column], ['salestransactions' => $salestransactions]);\n }",
"public function asort() {}",
"public function order()\n {\n return 117;\n }",
"public function getOrder();",
"public function getOrder();",
"public function getOrder();",
"public function getOrder();",
"public function getOrder();",
"public function getOrder();"
]
| [
"0.60604525",
"0.58553493",
"0.5847133",
"0.5773071",
"0.57723063",
"0.5623755",
"0.56071186",
"0.5599128",
"0.5597255",
"0.55289733",
"0.5527258",
"0.5490703",
"0.5490703",
"0.54586613",
"0.5445468",
"0.54426897",
"0.54046404",
"0.53769463",
"0.53734857",
"0.5361265",
"0.53535724",
"0.5309726",
"0.5303081",
"0.5295664",
"0.52911156",
"0.52911156",
"0.52911156",
"0.52911156",
"0.52911156",
"0.52911156"
]
| 0.6418158 | 0 |
Sets a new transforms | public function setTransforms(array $transforms)
{
$this->transforms = $transforms;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setTransform(array $transform)\n {\n $this->transform = $transform;\n return $this;\n }",
"public function setPreTransforms(iterable $transforms): self\n\t{\n\t\tif (!\\is_array($transforms)) {\n\t\t\t$transforms = iterator_to_array($transforms, false);\n\t\t}\n\n\t\tforeach (array_reverse($transforms) as $transform) {\n\t\t\t$this->assertTransform($transform);\n\t\t\t$this->addTransform($transform);\n\t\t}\n\n\t\treturn $this;\n\t}",
"public function setPostTransforms(iterable $transforms): self\n\t{\n\t\tforeach ($transforms as $transform) {\n\t\t\t$this->assertTransform($transform);\n\t\t\t$this->addTransform($transform, false);\n\t\t}\n\n\t\treturn $this;\n\t}",
"function setTransformation($transformation){\n\t\tif($transformation){\n\t\t\t$transformation = clone $transformation;\n\t\t}\n\t\t$this->transformation = $transformation;\n\t}",
"static function registerTransform($class, $name=false) {\n static::$transforms[$name ?: $class::$name] = [get_called_class(), $class];\n }",
"abstract public function transform();",
"private function initializeTransformers()\n {\n $this->transformers = [];\n\n foreach ($this->configuration->get(Configuration::KEY_TRANSFORMERS) as $transformerClass) {\n $this->transformers[$transformerClass] = new $transformerClass(\n ...$this->getTransformerDependencies($transformerClass)\n );\n }\n }",
"public function transform($transformationType, $value);",
"public function setTransformer($callback)\n {\n $this->transformCallback = $callback;\n }",
"public function transform($transformer);",
"public function setTransformer() {\n\t\tif ($this->isPassword()) {\n\t\t\t$this->addTransformer('password');\n\t\t} else {\n\t\t\t$dbType = $this->getDbType();\n\t\t\tif ($dbType == 'datetime') {\n\t\t\t\t$this->addTransformer('datetime');\n\t\t\t}\n\t\t}\n\t}",
"public function initializeObject() {\n\t\t$transformClassNames = static::getTransformImplementationClassNames($this->objectManager);\n\t\tforeach ($transformClassNames as $transformClassName) {\n\t\t\t/** @var TransformInterface $transform */\n\t\t\t$transform = $this->objectManager->get($transformClassName);\n\t\t\tif (isset($this->transforms[$transform->getAttributeType()][$transform->getPriority()])) {\n\t\t\t\tthrow new DuplicateTransformException('There is more than one transform that can transform the attribute type ' . $transform->getAttributeType() . ' with priority ' . $transform->getPriority() . ' and ' . get_class($transform) . '.', 1391459078);\n\t\t\t}\n\t\t\t$this->transforms[$transform->getAttributeType()][$transform->getPriority()] = $transform;\n\t\t}\n\t}",
"public function testTransform() {\n\t\t$this->object->addTransformer(new CropTransformer(array('width' => 100)));\n\t\t$this->object->addTransformer(new CropTransformer(array('height' => 100)));\n\n\t\ttry {\n\t\t\tif ($this->object->upload()) {\n\t\t\t\t$this->object->transform();\n\n\t\t\t\t$files = $this->object->getTransformedFiles();\n\n\t\t\t\t$this->assertEquals(2, count($files));\n\n\t\t\t\t$this->object->rollback();\n\t\t\t}\n\n\t\t\t$this->assertTrue(true);\n\n\t\t} catch (Exception $e) {\n\t\t\t$this->assertTrue(false, $e->getMessage());\n\t\t}\n\t}",
"final protected function transformFiles(&$files)\n {\n // ... transform?\n }",
"public function addCurrentTransformationMatrix($a, $b, $c, $d, $e, $f) {}",
"public function addCurrentTransformationMatrix($a, $b, $c, $d, $e, $f) {}",
"public function addCurrentTransformationMatrix($a, $b, $c, $d, $e, $f) {}",
"function clearTransformers()\n {\n $this->getTransformerContainer()->clearTransformers();\n }",
"public function setTransformationPath($path)\n {\n $this->transformationPath = $path;\n return $this;\n }",
"public function testTransform()\n {\n $img = new P4Cms_Image();\n $data = file_get_contents(TEST_ASSETS_PATH . '/images/luigi.png');\n $img->setData($data);\n\n // test the behavior of scale with width and height\n $img->transform('scale', array(258, 355));\n $this->assertSame(\n $img->getImageSize(),\n array('width' => 258, 'height' => 355),\n 'Expected image to be scaled to 258x355 pixels.'\n );\n\n // test the behavior of scale with width only\n // 516/710 = 400/h => h = 550\n $img->transform('scale', array(400));\n $this->assertSame(\n $img->getImageSize(),\n array('width' => 400, 'height' => 550),\n 'Expected image to be scaled to 300x300 pixels.'\n );\n\n // test the behavior of crop\n $img->transform('crop', array(100, 100, 50, 50));\n $this->assertSame(\n $img->getImageSize(),\n array('width' => 100, 'height' => 100),\n 'Expected image to be cropped to 100x100 pixels.'\n );\n\n // test the behavior of unsupported transform\n try {\n $img->transform('foo');\n $this->fail('Expected failure with an unsupported transform.');\n } catch (P4Cms_Image_Exception $e) {\n $this->assertSame($e->getMessage(), \"Transform \\\"foo\\\" is not supported.\");\n } catch (Exception $e) {\n $this->fail('Unexpected exception: '. $e->getMessage());\n }\n }",
"public function eagerLoadTransforms($files, $transforms)\n\t{\n\t\tif (!$files || !$transforms)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Index the files by ID\n\t\t$filesById = array();\n\t\tforeach ($files as $file)\n\t\t{\n\t\t\t$filesById[$file->id] = $file;\n\t\t}\n\n\t\t// Get the index conditions\n\t\t$transformsByFingerprint = array();\n\t\t$indexConditions = array();\n\n\t\tforeach ($transforms as $transform)\n\t\t{\n\t\t\t$transform = $this->normalizeTransform($transform);\n\t\t\t$location = $fingerprint = $this->_getTransformFolderName($transform);\n\n\t\t\t$condition = array('and', array('location' => $location));\n\n\t\t\tif (is_null($transform->format))\n\t\t\t{\n\t\t\t\t$condition[] = 'format IS NULL';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$condition[] = array('format' => $transform->format);\n\t\t\t\t$fingerprint .= ':'.$transform->format;\n\t\t\t}\n\n\t\t\t$indexConditions[] = $condition;\n\t\t\t$transformsByFingerprint[$fingerprint] = $transform;\n\t\t}\n\n\t\tif (count($indexConditions) == 1)\n\t\t{\n\t\t\t$indexConditions = $indexConditions[0];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tarray_unshift($indexConditions, 'or');\n\t\t}\n\n\t\t// Query for the indexes\n\t\t$results = craft()->db->createCommand()\n\t\t\t->select('*')\n\t\t\t->from('assettransformindex')\n\t\t\t->where(array('and',\n\t\t\t\tarray('in', 'fileId', array_keys($filesById)),\n\t\t\t\t$indexConditions\n\t\t\t))\n\t\t\t->queryAll();\n\n\t\t// Index the valid transform indexes by fingerprint, and capture the IDs of indexes that should be deleted\n\t\t$resultsByFingerprint = array();\n\t\t$invalidIndexIds = array();\n\n\t\tforeach ($results as $result)\n\t\t{\n\t\t\t// Get the transform's fingerprint\n\t\t\t$transformFingerprint = $result['location'];\n\n\t\t\tif ($result['format'])\n\t\t\t{\n\t\t\t\t$transformFingerprint .= ':'.$result['format'];\n\t\t\t}\n\n\t\t\t// Is it still valid?\n\t\t\t$transform = $transformsByFingerprint[$transformFingerprint];\n\t\t\t$file = $filesById[$result['fileId']];\n\n\t\t\tif ($this->validateTransformIndexResult($result, $transform, $file))\n\t\t\t{\n\t\t\t\t$indexFingerprint = $result['fileId'].':'.$transformFingerprint;\n\t\t\t\t$this->_eagerLoadedTransformIndexes[$indexFingerprint] = $result;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$invalidIndexIds[] = $result['id'];\n\t\t\t}\n\t\t}\n\n\t\t// Delete any invalid indexes\n\t\tif ($invalidIndexIds)\n\t\t{\n\t\t\tcraft()->db->createCommand()->delete('assettransformindex', array('in', 'id', $invalidIndexIds));\n\t\t}\n\t}",
"public function setTintTransform(\\SetaPDF_Core_Type_AbstractType $tintTransform) {}",
"public function setTintTransform(\\SetaPDF_Core_Type_AbstractType $tintTransform) {}",
"protected function applyTransformation() {\n // no transformation for index\n }",
"public function resetViewTransformers()\n {\n $this->viewTransformers = array();\n\n return $this;\n }",
"public function setUp() {\n $this->transformation = new Modulate();\n }",
"public function transform(){\r\n\t\tswitch($this->processor){\r\n\t\t\tcase 'saxon':\r\n\t\t\t\t$this->runSaxon();\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'salbotron':\r\n\t\t\tdefault:\r\n\t\t\t\t$this->runSalbatron();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}",
"public function setTransformations($field, $transformations = [])\n {\n if (!isset($this->schema[$field])) {\n $this->schema[$field] = [];\n }\n\n $this->schema[$field]['transformations'] = $transformations;\n\n return $this;\n }",
"public static function transformer();",
"public function setTransformResults($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\Google\\Cloud\\Firestore\\V1beta1\\Value::class);\n $this->transform_results = $arr;\n\n return $this;\n }"
]
| [
"0.67482024",
"0.6428424",
"0.6295611",
"0.6131577",
"0.5741104",
"0.56767595",
"0.5367187",
"0.53330857",
"0.52893543",
"0.51413953",
"0.5122323",
"0.5120078",
"0.5066926",
"0.49677467",
"0.49369854",
"0.49369854",
"0.4936074",
"0.49254164",
"0.49250823",
"0.49235037",
"0.49069613",
"0.48857772",
"0.48857772",
"0.48832375",
"0.48830992",
"0.47868958",
"0.47516945",
"0.47249442",
"0.47027037",
"0.47000986"
]
| 0.7306797 | 0 |
Sets a new digestMethod | public function setDigestMethod(\BankId\Merchant\Library\Schemas\ds\DigestMethod $digestMethod)
{
$this->digestMethod = $digestMethod;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setDigest(string $digest) : self\n {\n $this->initialized['digest'] = true;\n $this->digest = $digest;\n return $this;\n }",
"public function setDigest($digest)\n {\n $this->_getPadesModule()->setDigest($digest);\n }",
"public function setMethod($method);",
"public function setMethod($method);",
"public function setMethod($value) { $this->_method = $value; }",
"protected function setMethod($method) {\n $this->_method = $method;\n }",
"public function setMethod($request_method) {}",
"public function setMethod($method)\n {\n $this->method = $method;\n }",
"public function set_method($method) {\n $this->_method = (string)$method;\n }",
"public function set_method($method)\n {\n }",
"public function setMethod($method)\n {\n $this->method = $method;\n }",
"public function setMethod($method)\n {\n $this->method = $method;\n }",
"public function setMethod($method)\n {\n $this->method = $method;\n }",
"public function setMethod($method)\n {\n $this->method = $method;\n }",
"public function setMethod($method)\n {\n $this->setAttribute('method', strtolower($method));\n }",
"public function setMethod( $method )\n\t{\n\t\t$this->setAttribute( \"method\", $method );\n\t}",
"private function setMethod(string $method): void\n {\n $this->method = $method;\n }",
"public function setMethod($method)\n {\n $this->method = strtolower($method);\n }",
"public function setMethod(string $method): self;",
"public function setMethod($requestMethod)\n {\n $this->_method = $requestMethod;\n }",
"public function setMethod($method)\n {\n $this->env['REQUEST_METHOD'] = strtoupper($method);\n return $this;\n }",
"public function setMethod (string $method)\n {\n $this->method = $method;\n $this->save();\n return $this;\n }",
"public function setMethod($method)\n {\n $method = strtoupper($method);\n $this->method = $method;\n return $this;\n }",
"public function setMethod($var)\n {\n GPBUtil::checkInt64($var);\n $this->method = $var;\n\n return $this;\n }",
"public function SetMethod ($method = NULL);",
"public function setMethod($method)\n {\n $this->method = (string) strtoupper($method);\n\n return $this;\n }",
"public static function setMethod($val) \n { \n emailSettings::$method = $val; \n }",
"public function setMethod($method)\n {\n $method = strtoupper($method);\n $allowed = [\"GET\", \"POST\", \"PUT\", \"DELETE\"];\n if (in_array($method, $allowed) === false) {\n throw new GreenFieldSDKException(\n \"Provided method ({$method}) is not permitted. Allowed methods: \" . implode(\",\", $allowed)\n );\n }\n $this->method = $method;\n return $this;\n }",
"private function setMethod($method) {\n return;\n }",
"public function setMethod($method){\n\t\tswitch ($method){\n\t\t\tcase self::GET: $this->method = self::GET;\n\t\t\t\tbreak;\n\t\t\tcase self::PUT: $this->method = self::PUT;\n\t\t\t\tbreak;\n\t\t\tcase self::POST: $this->method = self::POST;\n\t\t\t\tbreak;\n\t\t\tcase self::HEAD: $this->method = self::HEAD;\n\t\t\t\tbreak;\n\t\t\tcase self::DELETE: $this->method = self::DELETE;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new \\InvalidArgumentException('Unknown method: ' . $method);\n\t\t}\n\t}"
]
| [
"0.6204438",
"0.6184714",
"0.60311073",
"0.60311073",
"0.5880494",
"0.5876479",
"0.5865864",
"0.5852258",
"0.5850791",
"0.5792011",
"0.57880557",
"0.57880557",
"0.57880557",
"0.57880557",
"0.5759439",
"0.5729375",
"0.56839466",
"0.56752086",
"0.5661068",
"0.55990076",
"0.5560137",
"0.5547309",
"0.5532897",
"0.55005634",
"0.54819417",
"0.5467245",
"0.5459645",
"0.5459431",
"0.5455126",
"0.5450636"
]
| 0.7290157 | 0 |
Sets a new digestValue | public function setDigestValue($digestValue)
{
$this->digestValue = $digestValue;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setDigest(string $digest) : self\n {\n $this->initialized['digest'] = true;\n $this->digest = $digest;\n return $this;\n }",
"public function setDigest($digest)\n {\n $this->_getPadesModule()->setDigest($digest);\n }",
"public function setCertDigest(\\Digipost\\Signature\\API\\XML\\Thirdparty\\XAdES\\DigestAlgAndValueType $certDigest)\n {\n $this->certDigest = $certDigest;\n return $this;\n }",
"public function setFingerprint(?string $value): void {\n $this->getBackingStore()->set('fingerprint', $value);\n }",
"public function addDigests(\\obiba\\mica\\DocumentDigestDto $value) {\n return $this->_add(2, $value);\n }",
"public function addDigests(\\obiba\\mica\\DocumentDigestDto $value) {\n return $this->_add(2, $value);\n }",
"public function addDigests(\\obiba\\mica\\DocumentDigestDto $value) {\n return $this->_add(3, $value);\n }",
"public function setPasswordAttribute( $value )\n {\n $this->attributes[ 'password' ] = Hash::make( $value );\n }",
"protected function setPasswordAttribute($value) \n { \n $this->attributes['password'] = \\Hash::needsRehash($value) ? Hash::make($value) : $value;\n }",
"public function setHash(/*string*/ $value) /*: this*/ {\n $this->hash = $value;\n return $this;\n }",
"public function setPasswordAttribute( $value ) {\n $this->attributes['password'] = Hash::make( $value );\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = \\Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = \\Hash::make($value);\n }",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = \\Hash::make($value);\n }",
"public function setSha1(?string $value): void {\n $this->getBackingStore()->set('sha1', $value);\n }",
"public function setPasswordAttribute($value) {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value) {\n $this->attributes['password'] = Hash::make($value);\n }",
"public function setPasswordAttribute($value) {\n $this->attributes['password'] = \\Hash::make($value);\n }",
"public function addDigest(string $algorithm, string $value): void\n {\n if (!in_array(\n $algorithm,\n [\n \"MD5\",\n \"UNIXsum\",\n \"UNIXcksum\",\n \"SHA\",\n \"SHA-256\",\n \"SHA-512\"\n ]\n )\n ) {\n throw new UserException(\"Invalid value for header: Digest\");\n }\n $this->digest[] = $algorithm.\"=\".$value;\n }",
"public function setPasswordAttribute($value) {\n \t$this->attributes['password'] = Hash::make($value);\n\t}",
"public function setPasswordAttribute($value)\n {\n $this->attributes['password'] = Hash::needsRehash($value) ? Hash::make($value) : $value;\n }"
]
| [
"0.67569166",
"0.6705292",
"0.60863984",
"0.5808145",
"0.5689865",
"0.5689865",
"0.56781065",
"0.5674755",
"0.5515177",
"0.55138534",
"0.5503347",
"0.54998976",
"0.54998976",
"0.54998976",
"0.54998976",
"0.54998976",
"0.54998976",
"0.54998976",
"0.54998976",
"0.54998976",
"0.54832506",
"0.54832506",
"0.54832506",
"0.5453486",
"0.54519135",
"0.54519135",
"0.5449242",
"0.5440626",
"0.54034775",
"0.5393593"
]
| 0.7257669 | 0 |
Show the form for creating a new Usuarios. | public function create()
{
return view('usuarios.create');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function create() {\n return view('fuse.cadastros.usuarios.create');\n }",
"public function create()\n {\n return view(\"usuarios.create\");\n }",
"public function create()\n {\n return view(\"usuarios.create\");\n }",
"public function create()\n {\n return view('usuarios.create' );\n }",
"public function create()\n {\n return view('automotores.usuarios.create');\n }",
"public function create()\n\t{\n\t\tValidaAccesoController::validarAcceso('usuarios','escritura');\n\t\t$form_data = array('route' => array('usuarios.store'), 'method' => 'post');\n $action = 'Crear';\n $usuario = null;\n\t\treturn View::make('admin/usuario',compact('usuario','form_data','action'));\n\t}",
"public function create()\n {\n return view('admin.usuarios.create');\n }",
"public function create() {\n return view('usuarios.create');\n }",
"public function create()\n {\n return view('registro_usuarios.create');\n }",
"public function create()\n {\n return view('usuarios.create');\n }",
"public function create()\n {\n return view('usuarios.create');\n }",
"public function create()\n {\n return view('usuarios.create');\n }",
"public function create() {\n // Obtiene las categorias en que es posible publicar\n $categorias = Categoria::all();\n\n // Se muestra el formulario (se envian las cateogiras para llenar el combobox)\n return view('usuario.create')->with('categorias', $categorias);\n }",
"public function create()//mostra formulário de criação de usuários\n {\n $form = \\FormBuilder::create(UserForm::class,[\n 'url' => route('admin.users.store'),\n 'method' => 'POST'\n ]); //classe de formulario, url de ação do formulario e método http\n\n return view('admin.users.create', compact('form'));\n }",
"public function create()\n\t{\n\t\treturn view('usuario.create');\n\t}",
"public function create()\n {\n return view('usuarios.crear_usuario');\n }",
"public function create()\n {\n $this->checkPermission('cadastrar_usuario');\n return view('user.create');\n }",
"public function create()\n {\n return view('respostas_usuarios.create');\n }",
"public function newAction()\n {\n $entity = new Usuario();\n $form = $this->createCreateForm($entity);\n\n return $this->render('RegistroEventosCoreBundle:Usuario:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'error' => '',\n ));\n }",
"public function create()\n {\n return view('usuario.create');\n }",
"public function create()\n {\n return view('usuario.create');\n }",
"public function create()\n {\n return view('usuario.create');\n }",
"public function create()\n {\n return view('usuario.create');\n }",
"public function create()\n {\n return view('usuario.create');\n }",
"public function create()\n {\n return view('usuario.create');\n }",
"public function create()\n {\n return View::make('usuario.create');\n }",
"public function create()\n {\n return view(\"users.usersform\");\n }",
"public function create()\n {\n //\n return view(\"local.usuario.create\");\n }",
"public function create()\n {\n return view('admin.dashboard.usuarios.tecnico.create');\n }",
"public function create()\n {\n return view('usuarios.crear');\n }"
]
| [
"0.8380529",
"0.8194342",
"0.8194342",
"0.81804204",
"0.8172279",
"0.81284326",
"0.8093861",
"0.8093206",
"0.8086385",
"0.80469316",
"0.80469316",
"0.80469316",
"0.8033251",
"0.80324244",
"0.80306935",
"0.8016607",
"0.7960712",
"0.7951692",
"0.7897805",
"0.7861079",
"0.7861079",
"0.7861079",
"0.7861079",
"0.7861079",
"0.7861079",
"0.7859679",
"0.78430957",
"0.7839594",
"0.78347945",
"0.7833445"
]
| 0.81954455 | 1 |
Order form: fields in the order form repeated .marketplaceapps.v1.OrderFormField order_form = 1; | public function getOrderForm()
{
return $this->order_form;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setOrderForm(&$var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\Marketplaceapps\\V1\\OrderFormField::class);\n $this->order_form = $arr;\n }",
"public function OrderForm()\n {\n $config = new Config();\n\n $app = new ALLApp();\n $app->configs = $config;\n\n //address\n $column = new Form();\n $column->dbType = dbTypeInteger;\n $column->widget = ZSelect2Widget::class;\n $column->options = [\n 'data' => Az::$app->market->address->getUserAddresses(11),\n 'name' => 'address_id',\n 'label' => ShopShipment::shipment_type\n ];\n $app->columns['address_id'] = $column;\n //address\n\n //shipment_type_id\n $column = new Form();\n $column->dbType = dbTypeString;\n $column->widget = ZMRadioWidget::class;\n $column->options = [\n 'config' => [\n 'hasPlace' => true\n ],\n 'data' => ShopShipment::shipment_type,\n 'name' => 'shipment_type',\n ];\n $column->rules = [\n ['zetsoft\\\\system\\\\validate\\\\ZRequiredValidator']\n ];\n $app->columns['shipment_type'] = $column;\n //shipment_type_id\n\n //contact\n $column = new Form();\n $column->dbType = dbTypeJsonb;\n $column->widget = ZFormWidget::class;\n $column->valueWidget = ZFormViewWidget::class;\n $column->options = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n 'title' => Az::l(\"Ваши контакты\"),\n 'titleClass' => ZColor::color['success-color']\n ],\n ];\n $column->valueOptions = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n\n ],\n ];\n $app->columns['contact_info'] = $column;\n //contact\n\n $app->cards = [];\n return Az::$app->forms->former->model($app);\n }",
"protected function form()\n {\n return Form::make(new Order(), function (Form $form) {\n $form->display('id');\n $form->text('order_no');\n $form->text('user_id');\n $form->text('address');\n $form->text('total_amount');\n $form->text('remark');\n $form->text('paid_at');\n $form->text('payment_method');\n $form->text('payment_no');\n $form->text('refund_status');\n $form->text('refund_no');\n $form->text('closed');\n $form->text('reviewed');\n $form->text('ship_status');\n $form->text('ship_data');\n $form->text('extra');\n\n $form->display('created_at');\n $form->display('updated_at');\n });\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n $form->text('no', __('No'));\n $form->number('user_id', __('User id'));\n $form->textarea('address', __('Address'));\n $form->decimal('total_amount', __('Total amount'));\n $form->textarea('remark', __('Remark'));\n $form->datetime('paid_at', __('Paid at'))->default(date('Y-m-d H:i:s'));\n $form->text('payment_method', __('Payment method'));\n $form->text('payment_no', __('Payment no'));\n $form->text('refund_status', __('Refund status'))->default('pending');\n $form->text('refund_no', __('Refund no'));\n $form->switch('closed', __('Closed'));\n $form->switch('reviewed', __('Reviewed'));\n $form->text('ship_status', __('Ship status'))->default('pending');\n $form->textarea('ship_data', __('Ship data'));\n $form->textarea('extra', __('Extra'));\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n $form->text('no', 'No');\n $form->number('user_id', 'User id');\n $form->textarea('address', 'Address');\n $form->decimal('total_amount', 'Total amount');\n $form->textarea('remark', 'Remark');\n $form->datetime('paid_at', 'Paid at')->default(date('Y-m-d H:i:s'));\n $form->text('payment_method', 'Payment method');\n $form->text('payment_no', 'Payment no');\n $form->text('refund_status', 'Refund status')->default('pending');\n $form->text('refund_no', 'Refund no');\n $form->switch('closed', 'Closed');\n $form->switch('reviewed', 'Reviewed');\n $form->text('ship_status', 'Ship status')->default('pending');\n $form->textarea('ship_data', 'Ship data');\n $form->textarea('extra', 'Extra');\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n $form->text('currency', __('Currency'));\n $form->number('amount', __('Amount'));\n $form->number('state', __('State'));\n $form->number('game_id', __('Game id'));\n $form->number('user_id', __('User id'));\n $form->text('product_id', __('Product id'));\n $form->text('product_name', __('Product name'));\n $form->text('cp_order_id', __('Cp order id'));\n $form->text('callback_url', __('Callback url'));\n $form->text('callback_info', __('Callback info'));\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order());\n\n $form->switch('paid', __('Paid'));\n $form->datetime('reservation_expires', __('Reservation expires'))->default(date('Y-m-d H:i:s'));\n $form->decimal('price', __('Price'));\n\n $form->tools(function (Form\\Tools $tools) {\n $tools->disableView();\n });\n\n\n\n return $form;\n }",
"function displayOrderForm() {\n $output = '<div class=\"c-order\">\n\t\t\t<div class=\"c-order-select\">\n\t\t\t\t<form name=\"ChangeOrder\" action=\"\">\n\t\t\t\t\t<select name=\"TheOrder\">\n\t\t\t\t\t\t<option value=\"0\">' .\n wfMessage( 'comments-sort-by-date' )->plain() .\n '</option>\n\t\t\t\t\t\t<option value=\"1\">' .\n wfMessage( 'comments-sort-by-score' )->plain() .\n '</option>\n\t\t\t\t\t</select>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t<div id=\"spy\" class=\"c-spy\">\n\t\t\t\t<a href=\"javascript:void(0)\">' .\n wfMessage( 'comments-auto-refresher-enable' )->plain() .\n '</a>\n\t\t\t</div>\n\t\t\t<div class=\"cleared\"></div>\n\t\t</div>\n\t\t<br />' . \"\\n\";\n\n return $output;\n }",
"function uc_order_view_update_form($form, &$form_state, $order) {\n $form['order_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an order comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['order_comment_field']['order_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Order comments are used primarily to communicate with the customer.'),\n );\n\n $form['admin_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an admin comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['admin_comment_field']['admin_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Admin comments are only seen by store administrators.'),\n );\n\n $form['current_status'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_status,\n );\n\n $form['order_id'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_id,\n );\n\n $form['controls'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('uc-inline-form', 'clearfix')),\n '#weight' => 10,\n );\n\n foreach (uc_order_status_list() as $status) {\n $options[$status['id']] = $status['title'];\n }\n $form['controls']['status'] = array(\n '#type' => 'select',\n '#title' => t('Order status'),\n '#default_value' => $order->order_status,\n '#options' => $options,\n );\n\n $form['controls']['notify'] = array(\n '#type' => 'checkbox',\n '#title' => t('Send e-mail notification on update.'),\n );\n\n $form['controls']['actions'] = array('#type' => 'actions');\n $form['controls']['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n );\n\n return $form;\n}",
"public function generate_azericard_form($order_id){\r\n\r\n $admin_settings = $this->get_admin_settings();\r\n\r\n $order = new WC_Order( $order_id );\r\n $amount = $order->total;\r\n $currency = $order->currency;\r\n $description = 'Order #'.$order_id;\r\n\r\n $db_row['AMOUNT'] = $amount; // 2.5\r\n $db_row['CURRENCY'] = $currency;\r\n $db_row['ORDER'] = $this->genOrderID_az($order_id);\r\n\r\n // These fields will be always static\r\n $db_row['DESC'] = $description;\r\n $db_row['MERCH_NAME'] = $this->merch_name;\r\n $db_row['MERCH_URL'] = $this->merch_url;\r\n $db_row['TERMINAL'] = $admin_settings['terminal']; // That is your personal ID in payment system\r\n $db_row['EMAIL'] = $this->email;\r\n $db_row['TRTYPE'] = '1'; // That is the type of operation, 0 - Authorization\r\n $db_row['COUNTRY'] = 'AZ';\r\n $db_row['MERCH_GMT'] = '+4';\r\n $db_row['BACKREF'] = $this->backref;\r\n\r\n // These fields are generated automatically every request\r\n $oper_time = gmdate(\"YmdHis\"); // Date and time UTC\r\n $nonce = substr(md5(rand()),0,16); // Random data\r\n\r\n // Creating form hidden fields\r\n\r\n $form .= \"\r\n <input name=\\\"AMOUNT\\\" value=\\\"{$db_row['AMOUNT']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"CURRENCY\\\" value=\\\"{$db_row['CURRENCY']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"ORDER\\\" value=\\\"{$db_row['ORDER']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"DESC\\\" value=\\\"{$db_row['DESC']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"MERCH_NAME\\\" value=\\\"{$db_row['MERCH_NAME']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"MERCH_URL\\\" value=\\\"{$db_row['MERCH_URL']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"TERMINAL\\\" value=\\\"{$db_row['TERMINAL']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"EMAIL\\\" value=\\\"{$db_row['EMAIL']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"TRTYPE\\\" value=\\\"{$db_row['TRTYPE']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"COUNTRY\\\" value=\\\"{$db_row['COUNTRY']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"MERCH_GMT\\\" value=\\\"{$db_row['MERCH_GMT']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"TIMESTAMP\\\" value=\\\"{$oper_time}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"NONCE\\\" value=\\\"{$nonce}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"BACKREF\\\" value=\\\"{$db_row['BACKREF']}\\\" type=\\\"hidden\\\">\r\n \";\r\n\r\n // ------------------------------------------------\r\n\r\n // Making P_SIGN (MAC) - Checksum of request\r\n // All following fields must be equal with hidden fields above\r\n\r\n $to_sign = \"\".strlen($db_row['AMOUNT']).$db_row['AMOUNT']\r\n .strlen($db_row['CURRENCY']).$db_row['CURRENCY']\r\n .strlen($db_row['ORDER']).$db_row['ORDER']\r\n .strlen($db_row['DESC']).$db_row['DESC']\r\n .strlen($db_row['MERCH_NAME']).$db_row['MERCH_NAME']\r\n .strlen($db_row['MERCH_URL']).$db_row['MERCH_URL'].\"-\"\r\n .strlen($db_row['TERMINAL']).$db_row['TERMINAL']\r\n .strlen($db_row['EMAIL']).$db_row['EMAIL']\r\n .strlen($db_row['TRTYPE']).$db_row['TRTYPE']\r\n .strlen($db_row['COUNTRY']).$db_row['COUNTRY']\r\n .strlen($db_row['MERCH_GMT']).$db_row['MERCH_GMT']\r\n .strlen($oper_time).$oper_time\r\n .strlen($nonce).$nonce\r\n .strlen($db_row['BACKREF']).$db_row['BACKREF'];\r\n\r\n $p_sign = hash_hmac('sha1', $to_sign, $this->hex2bin_az($admin_settings['key_for_sign']));\r\n\r\n $form .= \"<input name=\\\"P_SIGN\\\" value=\\\"$p_sign\\\" type=\\\"hidden\\\">\".PHP_EOL;\r\n\r\n return '<style type=\"text/css\"> #page{display:none;} </style>\r\n <form action=\"'.$admin_settings['url'].'\" method=\"POST\" id=\"azericard_payment_form\">\r\n ' . $form . '\r\n <input type=\"submit\" class=\"button-alt\" id=\"submit_azericard_payment_form\" value=\"'.__('Pay via Azericard', 'azericard').'\" />\r\n <script type=\"text/javascript\">\r\n jQuery(\"#submit_azericard_payment_form\").click();\r\n </script>\r\n </form>';\r\n }",
"function form_order($name, $order_fields, $data='') {\n\n\tglobal $request;\n\n\t$html = form_select('field', $order_fields, $name, $data['field']);\n\t$html .= ' ';\n\t$html .= form_select('direction', array('ASC' => 'ASC', 'DESC' => 'DESC'), $name, $data['direction']);\n\n\treturn $html;\n\n}",
"public function getFormFields()\n\t{\n\t\tMage::log(\" --- Snap* Hosted Payments API : getFormFields --- \");\n\n\t\t$aOBFields = array();\n\t\t$billing = $this->getOrder()->getBillingAddress();\n\t\t$shipping = $this->getOrder()->getShippingAddress();\n\t\t$items = $this->getOrder()->getAllItems();\n\n\t\t// customer info\n\t\t$aOBFields['customer[merchant_customer_id]'] = $this->getOrder()->getCustomerId();\n\t\t$aOBFields['customer[email]'] = $this->getOrder()->getCustomerEmail();\n\t\t$aOBFields['customer[first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['customer[last_name]'] = $billing->getLastname();\n\t\t$aOBFields['customer[phone]'] = $billing->getTelephone();\n\n\t\t// order header\n\t\t$aOBFields['order[merchant_order_id]'] = $this->getOrder()->getRealOrderId();\n\t\t$aOBFields['order[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\t\t$aOBFields['order[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t$aOBFields['order[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t$aOBFields['order[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t$aOBFields['order[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\t\t//$aOBFields['order[ship_method]'] = '';\n\n\t\t// billing fields\n\t\t$aOBFields['order[billto_company]'] = $billing->getCompany();\n\t\t$aOBFields['order[billto_first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['order[billto_last_name]'] = $billing->getLastname();\n\t\t$aOBFields['order[billto_address1]'] = $billing->getStreet1();\n\t\t$aOBFields['order[billto_address2]'] = $billing->getStreet2();\n\t\t$aOBFields['order[billto_city]'] = $billing->getCity();\n\t\t$aOBFields['order[billto_state]'] = $billing->getRegionCode();\n\t\t$aOBFields['order[billto_country]'] = $billing->getCountry();\n\t\t$aOBFields['order[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t// shipping fields\n\t\tif(!empty($shipping))\n\t\t{\n\t\t\t$aOBFields['order[shipto_company]'] = $shipping->getCompany();\n\t\t\t$aOBFields['order[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t$aOBFields['order[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t$aOBFields['order[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t$aOBFields['order[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t$aOBFields['order[shipto_city]'] = $shipping->getCity();\n\t\t\t$aOBFields['order[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t$aOBFields['order[shipto_country]'] = $shipping->getCountry();\n\t\t\t$aOBFields['order[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t}\n\n\t\t// items\n\t\tif (!empty($items))\n\t\t{\n\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t{\n\t\t\t\t$aOBFields['order_item['.$nCount.'][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][name]'] = $items[$nCount]->getName();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][price]'] = self::_currencyAmount($items[$nCount]->getPrice());\n\t\t\t\t$aOBFields['order_item['.$nCount.'][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][tax]'] = self::_currencyAmount($items[$nCount]->getTaxAmount());\n\t\t\t}\n\t\t}\n\n\t\t// return URLs\n\t\t$aOBFields['return_url'] = Mage::getUrl('hostedpayments/standard/success', array('_secure' => true));\n\t\t$aOBFields['cancel_url'] = Mage::getUrl('hostedpayments/standard/cancel', array('_secure' => true));\n\n\t\t// check to see if the aheadWorks SARP module is being used and is enabled. if it is then we need to\n\t\t// add additional fields to the post fields array\n\t\tif($this->_isUsingSARP() === true)\n\t\t{\n\t\t\tMage::log(\"is using SARP \");\n\n\t\t\t$aSubscriptionIDs = array();\n\t\t\t$aSubscriptionIDs = $this->_getSubscriptionByOrderID($this->getOrder()->getId());\n\n\t\t\t/*\n\t\t\tforeach($aSubscriptionIDs as $nID)\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($nID);\n\t\t\t}\n\t\t\t*/\n\n\t\t\tif(!empty($aSubscriptionIDs))\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($aSubscriptionIDs[0]);\n\t\t\t\t$dStartDate = new Zend_Date($oSubscription->getNextSubscriptionEventDate($oSubscription->getDateStart()), Zend_Date::DATE_LONG);\n\t\t\t\t$nTotalOccurrences = 0;\n\n\t\t\t\tif($oSubscription->isInfinite())\n\t\t\t\t\t$nTotalOccurrences = 9999;\n\t\t\t\telse\n\t\t\t\t\t$nTotalOccurrences = Mage::getModel('sarp/sequence')->getCollection()->addSubscriptionFilter($oSubscription)->count();\n\n\t\t\t\t//Mage::log(\"Subscription ID: \" . $aSubscriptionIDs[0]);\n\t\t\t\t//Mage::log(\"Subscription Inerval: \" . $oSubscription->getPeriod()->getPeriodType().\"s\");\n\t\t\t\t//Mage::log(\"Subscription Occurences: \" . $nTotalOccurrences);\n\n\t\t\t\t$aOBFields['sub[auto_process]'] = 0;\n\t\t\t\t$aOBFields['sub[start_date]'] = $dStartDate;\n\t\t\t\t$aOBFields['sub[interval_length]'] = $oSubscription->getPeriod()->getPeriodValue();\n\t\t\t\t$aOBFields['sub[interval_unit]'] = $oSubscription->getPeriod()->getPeriodType().\"s\";\n\t\t\t\t$aOBFields['sub[total_occurrences]'] = $nTotalOccurrences;\n\n\t\t\t\t$aOBFields['sub[trial_occurrences]'] = '';\n\t\t\t\t$aOBFields['sub[trial_amount]'] = 0.00;\n\n\t\t\t\t// order header\n\t\t\t\t$aOBFields['sub[merchant_subscription_id]'] = $this->getOrder()->getRealOrderId();\n\t\t\t\t//$aOBFields['sub[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\n\t\t\t\t// grand total should be the normal price not the first period price\n\n\t\t\t\t$aOBFields['sub[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t\t\t$aOBFields['sub[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t\t\t$aOBFields['sub[ship_method]'] = '';\n\t\t\t\t$aOBFields['sub[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\n\t\t\t\t// billing fields\n\t\t\t\t$aOBFields['sub[billto_company]'] = $billing->getCompany();\n\t\t\t\t$aOBFields['sub[billto_first_name]'] = $billing->getFirstname();\n\t\t\t\t$aOBFields['sub[billto_last_name]'] = $billing->getLastname();\n\t\t\t\t$aOBFields['sub[billto_address1]'] = $billing->getStreet1();\n\t\t\t\t$aOBFields['sub[billto_address2]'] = $billing->getStreet2();\n\t\t\t\t$aOBFields['sub[billto_city]'] = $billing->getCity();\n\t\t\t\t$aOBFields['sub[billto_state]'] = $billing->getRegionCode();\n\t\t\t\t$aOBFields['sub[billto_country]'] = $billing->getCountry();\n\t\t\t\t$aOBFields['sub[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t\t\t// shipping fields\n\t\t\t\tif(!empty($shipping))\n\t\t\t\t{\n\t\t\t\t\t$aOBFields['sub[shipto_company]'] = $shipping->getCompany();\n\t\t\t\t\t$aOBFields['sub[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t\t\t$aOBFields['sub[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t\t\t$aOBFields['sub[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t\t\t$aOBFields['sub[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t\t\t$aOBFields['sub[shipto_city]'] = $shipping->getCity();\n\t\t\t\t\t$aOBFields['sub[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t\t\t$aOBFields['sub[shipto_country]'] = $shipping->getCountry();\n\t\t\t\t\t$aOBFields['sub[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t\t\t}\n\n\t\t\t\t$items = $this->getOrder()->getAllItems();\n\t\t\t\t$nCount = 0;\n\t\t\t\t$nSubCount = 0;\n\t\t\t\t$aOBFields['sub[total_subtotal]'] = 0;\n\t\t\t\t$aOBFields['sub[total]'] = 0;\n\n\t\t\t\t// items\n\t\t\t\tif (!empty($items))\n\t\t\t\t{\n\t\t\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t\t\t{\n\t\t\t\t\t\t$oItem = $items[$nCount];\n\n\t\t\t\t\t\tif(Mage::helper('sarp')->isSubscriptionType($items[$nCount]) == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$productId = $oItem->getProductId();\n\t\t\t\t\t\t\t$oProduct = Mage::getModel('catalog/product')->load($productId);\n\t\t\t\t\t\t\t$nFirstPeriodPrice = self::_currencyAmount($oProduct->getAwSarpFirstPeriodPrice());\n\t\t\t\t\t\t\t$nNormalPrice = self::_currencyAmount((!empty($nFirstPeriodPrice) ? $oProduct->getAwSarpSubscriptionPrice() : $items[$nCount]->getPrice()));\n\n\t\t\t\t\t\t\tMage::log(\"Normal Price:\" . $nNormalPrice);\n\t\t\t\t\t\t\tMage::log(\"First Period Price:\" . $nFirstPeriodPrice);\n\n\t\t\t\t\t\t\tif ($oItem->canInvoice()) $qtys[$oItem->getId()] = $oItem->getQtyToInvoice();\n\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][name]'] = $items[$nCount]->getName();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][price]'] = $nNormalPrice;\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t\t\t\t//$aOBFields['sub_item[' . $nSubCount . '][details]'] = '';\n\n\t\t\t\t\t\t\tif ($oItem->getIsVirtual())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = 0.00;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t$aOBFields['sub[trial_amount]'] = $nFirstPeriodPrice;\n\t\t\t\t\t\t\t*/\n\n\t\t\t\t\t\t\t$aOBFields['sub[total_subtotal]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\t\t\t\t\t\t\t$aOBFields['sub[total]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\n\t\t\t\t\t\t\t$nSubCount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tMage::log(\"Not a subscription item: \" . $items[$nCount]->getName());\n\t\t\t\t\t}\n\t\t\t\t\tMage::log(\"Sub. Sub Total: \" . $aOBFields['sub[total_subtotal]']);\n\t\t\t\t\tMage::log(\"Sub. Total: \" . $aOBFields['sub[total]']);\n\t\t\t\t}\n\n\t\t\t\t$aOBFields['sub[total]'] = $aOBFields['sub[total]'] + $aOBFields['sub[total_shipping]'];\n\t\t\t}\n\t\t}\n\n\t\t// generate the MAC and add it as the final param\n\t\t$aOBFields['mac'] = $this->getFormFieldsMAC($aOBFields);\n\n\t\tMage::log(print_r($aOBFields, true));\n\n\t\treturn $aOBFields;\n\t}",
"public function testOrdersOneForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->orderId\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}",
"protected function _prepareForm()\n {\n /** @var \\Magento\\Framework\\Data\\Form $form */\n $form = $this->_formFactory->create();\n $form->setHtmlIdPrefix('item_');\n $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Select order')]);\n $fieldset->addField(\n 'direction',\n 'select',\n [\n 'name' => 'direction',\n 'label' => __('Direction'),\n 'title' => __('Direction'),\n 'required' => true,\n 'options' => ['shipment' => 'Store -> Customer', 'invert' => 'Customer -> Store', 'refund' => 'RMA (return)']\n ]\n );\n $fieldset->addField(\n 'order_id',\n 'text',\n [\n 'name' => 'order_id',\n 'label' => __('Order #'),\n 'title' => __('Order #'),\n 'required' => true\n ]\n );\n $this->setForm($form);\n return parent::_prepareForm();\n }",
"public function getFormFields($order, $requestParams)\n {\n if (empty($order)) {\n if (!($order = $this->getOrder())) {\n return array();\n }\n }\n $payment = $order->getPayment()->getMethodInstance();\n $formFields = array();\n $formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());\n $formFields['AMOUNT'] = $this->getHelper()->getAmount($order->getBaseGrandTotal());\n $formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();\n $formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order);\n $formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();\n $formFields['PM'] = $payment->getOpsCode($order->getPayment());\n $formFields['EMAIL'] = $order->getCustomerEmail();\n\n $methodDependendFields = $this->getMethodDependendFormFields($order, $requestParams);\n if (is_array($methodDependendFields)) {\n $formFields = array_merge($formFields, $methodDependendFields);\n }\n\n $paymentAction = $this->_getOPSPaymentOperation();\n if ($paymentAction ) {\n $formFields['OPERATION'] = $paymentAction;\n }\n\n\n if ($this->getConfig()->getConfigData('template')=='ops') {\n $formFields['TP']= '';\n $formFields['PMLISTTYPE'] = $this->getConfig()->getConfigData('pmlist');\n } else {\n $formFields['TP']= $this->getConfig()->getPayPageTemplate();\n }\n $formFields['TITLE'] = $this->getConfig()->getConfigData('html_title');\n $formFields['BGCOLOR'] = $this->getConfig()->getConfigData('bgcolor');\n $formFields['TXTCOLOR'] = $this->getConfig()->getConfigData('txtcolor');\n $formFields['TBLBGCOLOR'] = $this->getConfig()->getConfigData('tblbgcolor');\n $formFields['TBLTXTCOLOR'] = $this->getConfig()->getConfigData('tbltxtcolor');\n $formFields['BUTTONBGCOLOR'] = $this->getConfig()->getConfigData('buttonbgcolor');\n $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor');\n $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype');\n $formFields['LOGO'] = $this->getConfig()->getConfigData('logo');\n $formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'home')) : 'NONE';\n $formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'catalog')) : '';\n $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();\n $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();\n $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();\n $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();\n $formFields['BACKURL'] = $this->getConfig()->getCancelUrl();\n\n $shaSign = Mage::helper('ops/payment')->shaCrypt(Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()));\n\n $helper = Mage::helper('ops');\n $helper->log($helper->__(\"Register Order %s in Ingenico Payment Services \\n\\nAll form fields: %s\\nIngenico Payment Services String to hash: %s\\nHash: %s\",\n $order->getIncrementId(),\n serialize($formFields),\n Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()),\n $shaSign\n ));\n\n $formFields['SHASIGN'] = $shaSign;\n return $formFields;\n }",
"public function getSeparateOrderForms()\n {\n return $this->separate_order_forms;\n }",
"protected function form()\n {\n $form = new Form(new TaskOrder);\n\n $form->display('ID');\n $form->text('eid',\"快递单号\");\n $form->text('sname','客服名称');\n $form->select('store','快递网点')->options(storedatas(1));\n $form->select('etype','快递公司')->options(edatas());\n $form->display('Created at');\n $form->display('Updated at');\n\n return $form;\n }",
"public function getFormFields()\n {\n $order_id = $this->getOrder()->getRealOrderId();\n $billing = $this->getOrder()->getBillingAddress();\n if ($this->getOrder()->getBillingAddress()->getEmail()) {\n $email = $this->getOrder()->getBillingAddress()->getEmail();\n } else {\n $email = $this->getOrder()->getCustomerEmail();\n }\n\n $params = array(\n 'merchant_fields' => 'partner',\n 'partner' => 'magento',\n 'pay_to_email' => Mage::getStoreConfig(Paynova_Paynovapayment_Helper_Data::XML_PATH_EMAIL),\n 'transaction_id' => $order_id,\n 'return_url' => Mage::getUrl('paynovapayment/processing/success', array('transaction_id' => $order_id)),\n 'cancel_url' => Mage::getUrl('paynovapayment/processing/cancel', array('transaction_id' => $order_id)),\n 'status_url' => Mage::getUrl('paynovapayment/processing/status'),\n 'language' => $this->getLocale(),\n 'amount' => round($this->getOrder()->getGrandTotal(), 2),\n 'currency' => $this->getOrder()->getOrderCurrencyCode(),\n 'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),\n 'firstname' => $billing->getFirstname(),\n 'lastname' => $billing->getLastname(),\n 'address' => $billing->getStreet(-1),\n 'postal_code' => $billing->getPostcode(),\n 'city' => $billing->getCity(),\n 'country' => $billing->getCountryModel()->getIso3Code(),\n 'pay_from_email' => $email,\n 'phone_number' => $billing->getTelephone(),\n 'detail1_description' => Mage::helper('paynovapayment')->__('Order ID'),\n 'detail1_text' => $order_id,\n 'payment_methods' => $this->_paymentMethod,\n 'hide_login' => $this->_hidelogin,\n 'new_window_redirect' => '1'\n );\n\n // add optional day of birth\n if ($billing->getDob()) {\n $params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');\n }\n\n return $params;\n }",
"protected function form()\n {\n $form = new Form(new ScanRechargeOrder());\n $form->select('scan_recharge_channel_id', __('scan-recharge::order.scan_recharge_channel_id'))\n ->options(ScanRechargeChannel::select('id', 'name')->pluck('name', 'id'))\n ->required();\n $form->text('user_id', __('scan-recharge::order.user_id'))\n ->required()\n ->help(__('scan-recharge::order.user_id_help'));\n $form->currency('amount', __('scan-recharge::order.amount'))->symbol('¥')\n ->default(0)\n ->required();\n $form->textarea('desc', __('scan-recharge::order.desc'))\n ->required()\n ->help(__('scan-recharge::order.desc_help'));\n $form->textarea('reply', __('scan-recharge::order.reply'))\n ->help(__('scan-recharge::order.reply_help'));\n $form->select('status', __('scan-recharge::order.status'))\n ->options(__('scan-recharge::order.status_value'));\n $form->saving(function (Form $form) {\n if ($form->status == 1 && $form->model()->id) {\n RechargeSuccessUserAccountJob::dispatch(ScanRechargeOrder::find($form->model()->id));\n }\n });\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n $statuses = Label::pluck('label_name', 'id');\n $payment_status = PaymentStatus::pluck('title', 'id');\n// print_r($payment_status);\n $time_slot = [];\n foreach (TimeSlot::all() as $time){\n $time_slot[$time->time_from .' to '. $time->time_to] =$time->time_from .' to '. $time->time_to;\n }\n\n $delivery_boys = DeliveryBoy::where('status',1)->pluck('delivery_boy_name', 'id');\n $form->text('order_id', __('Order id'))->readonly();\n $form->select('delivered_by', __('Delivered by'))->options($delivery_boys)->rules(function ($form) {\n return 'required';\n });\n $form->select('status', __('Status'))->options($statuses)->default(1)->rules(function ($form) {\n return 'required';\n });\n $form->select('payment_status', __('Payment Status'))->options($payment_status)->rules(function ($form) {\n return 'required';\n });\n $form->date('expected_delivery_date', __('Delivery date'))->rules(function ($form) {\n return 'required';\n });\n $form->select('drop_time', __('Delivery slot'))->options($time_slot)->rules(function ($form) {\n return 'required';\n });\n $form->saving(function (Form $form) {\n if($form->delivered_by > 0 && $form->status == 1){\n $error = new MessageBag([\n 'title' => 'Warning',\n 'message' => 'Please change order status...',\n ]);\n\n return back()->with(compact('error'));\n }\n });\n $form->saved(function (Form $form) {\n// $this->update_history($form->model()->id);\n\n $message = DB::table('fcm_notification_messages')->where('id',$form->model()->status)->first();\n $order_id = $form->model()->order_id;\n $customer_token = Customer::where('id',$form->model()->customer_id)->value('fcm_token');\n\n $this->send_fcm($message->customer_title.'('.$order_id.')', $message->customer_description, $customer_token);\n $noti_details = ['order_id' => $order_id,'fcm_msg_id' => $message->id,'user_id' =>$form->model()->customer_id,'created_at' => date('y-m-d H:i:s') ];\n\n $past_user_noti = DB::table('user_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('user_id',$form->model()->customer_id)->get();\n if (sizeof($past_user_noti) > 0){\n DB::table('user_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('user_id',$form->model()->customer_id)->delete();\n }\n\n DB::table('user_notifications')->insert($noti_details);\n if($form->model()->status == 2 || $form->model()->status == 5){\n $delivery_boy_token = DeliveryBoy::where('id',$form->model()->delivered_by)->value('fcm_token');\n $this->send_fcm($message->delivery_title.'('.$order_id.')', $message->delivery_description, $delivery_boy_token);\n $noti_details = ['order_id' => $order_id,'fcm_msg_id' => $message->id,'driver_id' =>$form->model()->delivered_by,'created_at' => date('y-m-d H:i:s') ];\n\n $past_driver_noti = DB::table('driver_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('driver_id',$form->model()->delivered_by)->get();\n if (sizeof($past_driver_noti) > 0){\n DB::table('driver_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('driver_id' ,$form->model()->delivered_by)->delete();\n }\n DB::table('driver_notifications')->insert($noti_details);\n }\n NotiHelper::SyncEarning([\n 'order_id' => $order_id,\n 'amount' => $form->model()->total,\n 'statement' => 'Rs '. $form->model()->total.' for order '.$order_id,\n ]);\n\n });\n $form->tools(function (Form\\Tools $tools) {\n $tools->disableDelete();\n $tools->disableView();\n });\n $form->footer(function ($footer) {\n $footer->disableViewCheck();\n $footer->disableEditingCheck();\n $footer->disableCreatingCheck();\n });\n return $form;\n }",
"public function getFormFields() {\r\r\n\r\r\n $billing = $this->getOrder()->getBillingAddress();\r\r\n $shipping = $this->getOrder()->getShippingAddress();\r\r\n $addr_entity_id = $shipping->getCustomerAddressId();\r\r\n $shippingaddress = Mage::getModel('sales/order_address');\r\r\n $shippingaddress->load($addr_entity_id);\r\r\n $shipaddgetdat = $shippingaddress->getData();\r\r\n\r\r\n\r\r\n\r\r\n $biladdr_entity_id = $billing->getCustomerAddressId();\r\r\n ;\r\r\n $billingaddress = Mage::getModel('sales/order_address');\r\r\n $billingaddress->load($biladdr_entity_id);\r\r\n $billaddgetdat = $billingaddress->getData();\r\r\n\r\r\n $coFields = array();\r\r\n $items = $this->getQuote()->getAllItems();\r\r\n\r\r\n if ($items) {\r\r\n $i = 1;\r\r\n foreach ($items as $item) {\r\r\n if ($item->getParentItem()) {\r\r\n continue;\r\r\n }\r\r\n $coFields['c_prod_' . $i] = $this->cleanString($item->getSku());\r\r\n $coFields['c_name_' . $i] = $this->cleanString($item->getName());\r\r\n $coFields['c_description_' . $i] = $this->cleanString($item->getDescription());\r\r\n $coFields['c_price_' . $i] = number_format($item->getPrice(), 2, '.', '');\r\r\n $i++;\r\r\n }\r\r\n }\r\r\n\r\r\n $request = '';\r\r\n foreach ($coFields as $k => $v) {\r\r\n $request .= '<' . $k . '>' . $v . '</' . $k . '>';\r\r\n }\r\r\n\r\r\n\r\r\n $key = Mage::getStoreConfig('payment/payucheckout_shared/key');\r\r\n $salt = Mage::getStoreConfig('payment/payucheckout_shared/salt');\r\r\n $debug_mode = Mage::getStoreConfig('payment/payucheckout_shared/debug_mode');\r\r\n\r\r\n $orderid = $this->getOrder()->getRealOrderId();\r\r\n $orderInfo = $this->getOrder();\r\r\n $order = Mage::getModel('sales/order')->loadByIncrementId($orderid);\r\r\n// get order total value\r\r\n $orderValue = number_format($order->getGrandTotal(), 2, '.', $thousands_sep = '');\r\r\n// get order item collection\r\r\n $orderItems = $order->getItemsCollection();\r\r\n $productInfo = array();\r\r\n $productInfo2 = array();\r\r\n \r\r\n \r\r\n foreach ($orderItems as $item) {\r\r\n \r\r\n $item->getName();\r\r\n $product_id = $item->product_id;\r\r\n $product_sku = $item->sku;\r\r\n $product_name = $item->getName();\r\r\n $_product = Mage::getModel('catalog/product')->load($product_id);\r\r\n $cats = $_product->getCategoryIds();\r\r\n $category_id = $cats[0]; // just grab the first id\r\r\n $category = Mage::getModel('catalog/category')->load($category_id);\r\r\n $category_name = $category->getName();\r\r\n\r\r\n $productInfo['name'] = $this->cleanString($item->getName());\r\r\n $productInfo['description'] = $this->cleanString(substr($_product->getDescription(),0,100));\r\r\n $productInfo['value'] = $orderValue;\r\r\n $productInfo['isRequired'] = true;\r\r\n $productInfo['settlementEvent'] = \"EmailConfirmation\";\r\r\n $productInfo2[] = $productInfo;\r\r\n }\r\r\n $productIndoFilterData['paymentParts'] = $productInfo2;\r\r\n $jsonProductInfo = json_encode($productIndoFilterData);\r\r\n\r\r\n $txnid = $orderid;\r\r\n\r\r\n $coFields['key'] = $key;\r\r\n $coFields['txnid'] = $txnid;\r\r\n $coFields['udf2'] = $txnid;\r\r\n $coFields['amount'] = number_format($this->getOrder()->getBaseGrandTotal(), 0, '', '');\r\r\n $coFields['productinfo'] = $jsonProductInfo;\r\r\n $coFields['address'] = $billaddgetdat['street'];\r\r\n $coFields['firstname'] = $billing->getFirstname();\r\r\n $coFields['Lastname'] = $billing->getLastname();\r\r\n $coFields['City'] = $billing->getCity();\r\r\n $coFields['State'] = $billing->getRegion();\r\r\n $coFields['Country'] = $billing->getCountry();\r\r\n $coFields['Zipcode'] = $billing->getPostcode();\r\r\n $coFields['email'] = $this->getOrder()->getCustomerEmail();\r\r\n $coFields['phone'] = $billing->getTelephone();\r\r\n\r\r\n $coFields['ship_name'] = $shipping->getFirstname() . \" \" . $shipping->getLastname();\r\r\n $coFields['ship_address'] = $shipaddgetdat['street'];\r\r\n $coFields['ship_zipcode'] = $shipping->getPostcode();\r\r\n $coFields['ship_city'] = $shipping->getCity();\r\r\n $coFields['ship_state'] = $shipping->getRegion();\r\r\n $coFields['ship_country'] = $shipping->getCountry();\r\r\n $coFields['ship_phone'] = $shipping->getTelephone();\r\r\n $coFields['website'] = Mage::getBaseUrl();\r\r\n $coFields['surl'] = Mage::getBaseUrl() . 'payucheckout/shared/success/';\r\r\n $coFields['furl'] = Mage::getBaseUrl() . 'payucheckout/shared/failure/';\r\r\n $coFields['curl'] = Mage::getBaseUrl() . 'payucheckout/shared/canceled/id/' . $this->getOrder()->getRealOrderId();\r\r\n $coFields['Pg'] = $billing->getpg();\r\r\n $coFields['bankcode'] = $billing->getbankcode();\r\r\n $coFields['ccnum'] = $billing->getccnum();\r\r\n $coFields['ccvv'] = $billing->getccvv();\r\r\n $coFields['ccexpmon'] = $billing->getccexpmon();\r\r\n $coFields['ccexpyr'] = $billing->getccexpyr();\r\r\n $coFields['ccname'] = $billing->getccname();\r\r\n $coFields['service_provider'] = 'payu_paisa';\r\r\n\r\r\n $debugId = '';\r\r\n \r\r\n\r\r\n if ($debug_mode == 1) {\r\r\n\r\r\n $requestInfo = $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '||||||||||' . $salt;\r\r\n $debug = Mage::getModel('payucheckout/api_debug')\r\r\n ->setRequestBody($requestInfo)\r\r\n ->save();\r\r\n\r\r\n $debugId = $debug->getId();\r\r\n\r\r\n $coFields['udf1'] = $debugId;\r\r\n $coFields['Hash'] = hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '|' . $coFields['udf2'] . '|||||||||' . $salt);\r\r\n } else {\r\r\n $coFields['Hash'] = strtolower(hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '||' . $coFields['udf2'] . '|||||||||' . $salt));\r\r\n }\r\r\n return $coFields;\r\r\n }",
"function theme_pi_authoring_order_activities_form($form) {\n\t$output = '';\n\t$output .= '<div>Drag the arrows up and down to to change the order of the activity and click save to finish.</div>';\n\tdrupal_add_tabledrag('pi-authoring-order-activities-sort', 'order', 'sibling', 'pi-authoring-order-activities-element');\n\t$header = array(array('data' => '', 'width' => '29'), 'Activity', 'Description', 'Position');\n\n\t$rows = array();\n\tforeach (element_children($form['order_activities_activities']) as $key)\n\t{\n\t\t// Add class to group weight fields for drag and drop.\n\t\t$form['order_activities_activities'][$key]['weight']['#attributes']['class'] = 'pi-authoring-order-activities-element';\n\n\t\t$row = array('');\n\t\t$row[] = l(drupal_render($form['order_activities_activities'][$key]['title']), \"node/$key/edit\");\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['body']);\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['weight']);\n\n\t\t$rows[] = array('data' => $row, 'class' => 'draggable');\n\t}\n\t$output .= theme('table', $header, $rows, array('id' => 'pi-authoring-order-activities-sort'));\n\t$output .= drupal_render($form);\n\treturn $output;\n}",
"public function payment_form( $order_id ) {\n\n\t\t$this->log( 'Render Payment Form' );\n\n\t\tif( !$order_id or !$this->product_id or !$this->merchant_id or !$this->secret_word ) {\n\n\t\t\t$this->log( 'Error: Empty payment parameters' );\n\n\t\t\treturn;\n\t\t}\n\n\t\t$this->order = new WC_Order( $order_id );\n\n\t\t$amount = ( $this->test_total_price_value > 0 ) ? $this->test_total_price_value : $this->order->get_total();\n\n\t\t$language = get_locale();\n\t\tswitch( $language ) {\n\t\t\tcase 'ru_RU':\n\t\t\t\t$language = 'ru';\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$language = 'en';\n\t\t\tbreak;\n\t\t}\n\n\t\t$form_fields = array(\n\t\t\t'product_id'\t=> $this->product_id,\n\t\t\t'product_name'\t=> sprintf( $this->product_order_purpose, $order_id ),\n\t\t\t'token'\t\t\t=> md5( \n\t\t\t\t\t\t\t\t\t$this->merchant_id . \n\t\t\t\t\t\t\t\t\t$this->product_id . \n\t\t\t\t\t\t\t\t\t$amount . \n\t\t\t\t\t\t\t\t\t$order_id . \n\t\t\t\t\t\t\t\t\t$this->secret_word \n\t\t\t\t\t\t\t\t),\n\t\t\t'amount'\t\t=> $amount,\n\t\t\t'cf'\t\t\t=> $order_id,\n\t\t\t'email'\t\t\t=> $this->order->get_billing_email(),\n\t\t\t'phone'\t\t\t=> $this->order->get_billing_phone(),\n\t\t\t'cb_url'\t\t=> get_home_url() . '/wc-api/' . $this->id, // callback url\n\t\t\t'ok_url'\t\t=> $this->order->get_checkout_order_received_url(), // success return to \"/order-received\"\n\t\t\t'ko_url'\t\t=> $this->order->get_checkout_payment_url(), // cancel return to \"/order-pay\"\n\t\t\t'language'\t\t=> $language,\n\t\t);\n\n\t\t$result ='';\n\t\t$result .= sprintf( '<form name=\"pay_form\" method=\"POST\" action=\"%s\">', $this->pay_url );\n\n\t\tforeach( $form_fields as $key => $val ) {\n \t\t\t$result .= sprintf( '<input type=\"hidden\" name=\"%s\" value=\"%s\">', $key, $form_fields[$key] );\n\t\t}\n\n\t\t// Show link to Terms Page\n\t\tif ( $this->terms_page_id ) {\n\n\t\t\t$result .= sprintf( '<div class=\"%s__textblock\">%s <a href=\"%s\" target=\"_blank\">%s</a></div>', \n\t\t\t\t$this->id,\n\t\t\t\t$this->terms_page_prefix,\n\t\t\t\tesc_url( get_page_link( $this->terms_page_id ) ), \n\t\t\t\tget_the_title( $this->terms_page_id ) );\n\t\t}\n\n\t\t$result .= sprintf( '<input type=\"submit\" value=\"%s\">', $this->pay_button_title );\n\t\t$result .= '</form>';\n\n\t\treturn $result;\n\t}",
"protected function form()\n {\n $form = new Form(new WithdrawDepositOrder);\n\n $form->number('apply_amount', __('Apply amount'));\n $form->number('transfer_amount', __('Transfer amount'));\n $form->number('master_id', __('Master id'));\n $form->switch('status', __('Status'));\n $form->textarea('comment', __('Comment'));\n\n return $form;\n }",
"function getOrderForm() {\n global $PRODUCTS;\n $tbl = new HTML_Table('', 'demoTbl');\n $frm = new HTML_Form();\n \n // header row\n $tbl->addRow();\n $tbl->addCell('Image', 'first', 'header');\n $tbl->addCell('Product', '', 'header');\n $tbl->addCell('Price', '', 'header');\n $tbl->addCell('Quantity', '', 'header');\n $tbl->addCell('Totals', '', 'header');\n \n // display product info/form elements\n foreach($PRODUCTS as $product) {\n list($abbr, $img, $name, $price) = $product;\n \n // quantity text input\n $qty_el = $frm->addInput('text', $abbr . '_qty', 0, \n array('size'=>4, 'class'=>'cur', 'pattern'=>'[0-9]+', 'placeholder'=>0, \n 'onchange'=>'getProductTotal(this)',\n 'onclick'=>'checkValue(this)', 'onblur'=>'reCheckValue(this)') );\n \n // total text input\n $tot_el = $frm->addInput('text', $abbr . '_tot', 0, array('readonly'=>true, 'size'=>8, 'class'=>'cur') );\n \n // price hidden input\n $price_el = $frm->addInput('hidden', $abbr . '_price', $price);\n \n $tbl->addRow();\n $tbl->addCell(\"<img src='\" .$img. \"'alt='Sonic Screwdriver'>\");\n $tbl->addCell($name);\n $tbl->addCell('$' . number_format($price, 2) . $price_el, 'cur' );\n $tbl->addCell( $qty_el, 'qty');\n $tbl->addCell( $tot_el );\n }\n \n // total row\n $tbl->addRow();\n $tbl->addCell( 'Total: ', 'total', 'data', array('colspan'=>3) );\n $tbl->addCell( $frm->addInput('text', 'total', 0, array('readonly'=>true, 'size'=>8, 'class'=>'cur') ) );\n \n // submit button\n $tbl->addRow();\n $tbl->addCell( $frm->addInput('submit', 'submit', 'Submit'),\n 'submit', 'data', array('colspan'=>4) );\n \n $frmStr = $frm->startForm('ex1_result.php', 'post', '', array('onsubmit'=>'return checkSubmit(this);') ) .\n $tbl->display() . $frm->endForm();\n \n return $frmStr;\n}",
"function generate_form( $order_id ) {\n\t\tglobal $woocommerce, $wc_authorize_sim;\n\t\t\n\t\t$order = new WC_Order( $order_id );\n\t\t\n\t\t$this->add_log( 'Generating payment form for order #' . $order->id);\n\t\t\n\t\t$pay_url = $this->get_gateway_url();\n\t\t\n\t\t$params = $this->get_params( $order );\n\t\t\n\t\t$time = time();\n $fp_hash = AuthorizeNetSIM_Form::getFingerprint( $this->login_id, $this->tran_key, $params['x_amount'], $params['x_fp_sequence'], $time );\n\t\t\n\t\t$params['x_fp_timestamp'] \t= $time;\n\t\t$params['x_fp_hash'] \t\t= $fp_hash;\n\t\t\n\t\t$this->add_log( \"Sending request: \" . print_r( $params,true ));\n\t\t\n\t\t$form = new AuthorizeNetSIM_Form($params);\n\t\t\n\t\twc_enqueue_js( \n\t\t\t'$.blockUI({\n\t\t\t\tmessage: \"' . esc_js( __( 'Thank you for your order. We are now redirecting you to 2checkout to make payment.', WC_Authorize_SIM::TEXT_DOMAIN ) ) . '\",\n\t\t\t\tbaseZ: 99999,\n\t\t\t\toverlayCSS:\n\t\t\t\t{\n\t\t\t\t\tbackground: \"#fff\",\n\t\t\t\t\topacity: 0.6\n\t\t\t\t},\n\t\t\t\tcss: {\n\t\t\t\t\tpadding: \"20px\",\n\t\t\t\t\tzindex: \"9999999\",\n\t\t\t\t\ttextAlign: \"center\",\n\t\t\t\t\tcolor: \"#555\",\n\t\t\t\t\tborder: \"3px solid #aaa\",\n\t\t\t\t\tbackgroundColor:\"#fff\",\n\t\t\t\t\tcursor: \"wait\",\n\t\t\t\t\tlineHeight:\t\t\"24px\",\n\t\t\t\t}\n\t\t\t});\n\t\t\tjQuery(\"#authorize_sim_payment_form input[type=submit]\").click();' \n\t\t);\n?>\n<form action=\"<?php echo $pay_url ?>\" method=\"post\" id=\"authorize_sim_payment_form\">\n\t<?php echo $form->getHiddenFieldString(); ?>\n\t<?php echo implode( '', $this->line_items ) ?>\n\t<input type=\"submit\" class=\"button button-alt\" id=\"submit_authorize_sim_payment_form\" value=\"<?php _e('Pay via Authorize.Net SIM', WC_Authorize_SIM::TEXT_DOMAIN) ?>\" /> \n\t<a class=\"button cancel\" href=\"<?php echo $order->get_cancel_order_url() ?>\"><?php _e('Cancel order & restore cart', WC_Authorize_SIM::TEXT_DOMAIN) ?></a>\n</form>\n<?php\n\t}",
"protected function form() {\n\t\t$form = new Form(new Payment);\n\n\t\t$form->text('user.nickname', __('用户'))->disable();\n\t\t// $form->number('app_id', __('App id'));\n\t\t$form->decimal('price', __('金额'));\n\t\t$form->text('transaction_id', __('三方订单号'));\n\t\t$form->text('out_trade_no', __('平台订单号'))->disable();\n\t\t$form->radio('type', __('订单类型'))->options(['20' => '商城订单']);\n\t\t$form->radio('status', __('状态'))->options(['0' => '未支付', '1' => '已支付'])->default('0');\n\t\t// $form->text('other', __('Other'));\n\t\t$form->datetime('payment_at', __('支付时间'))->default(date('Y-m-d H:i:s'));\n\t\treturn $form;\n\t}",
"private function _writeWorldpayFormOrder()\r\n\t{\r\n\t\t//mail('[email protected]', 'wp', 'init');\r\n\t\t\r\n\t\t// Create sagepay form order data\r\n\t\t$order = array('WorldpayFormOrder' => array(\r\n\t\t\t'order_id' \t\t=> $this->_controller->orderID,\r\n\t\t\t'cartId' \t\t=> $this->_values['cartId'],\r\n\t\t\t'amount' \t\t=> $this->_values['amount'],\r\n\t\t\t'authMode' \t\t=> $this->_values['authMode'],\r\n\t\t\t'testMode' \t\t=> $this->_values['testMode'],\r\n\t\t\t'transId' \t\t=> $this->_values['transId'],\r\n\t\t\t'transStatus' \t=> $this->_values['transStatus'],\r\n\t\t\t'transTime' \t=> $this->_values['transTime'],\r\n\t\t\t'authAmount' \t=> $this->_values['authAmount'],\r\n\t\t\t'cardType' \t\t=> $this->_values['cardType'],\r\n\t\t\t'countryMatch' \t=> $this->_values['countryMatch'],\r\n\t\t\t'AVS' \t\t\t=> $this->_values['AVS'],\r\n\t\t\t'ipAddress' \t=> $this->_values['ipAddress']\r\n\t\t));\r\n\t\t\r\n\t\t//mail('[email protected]', 'wp', var_export($order, true));\r\n\t\t\r\n\t\t// Create sagepay form order record\r\n\t\t$this->_controller->Order->WorldpayFormOrder->create();\r\n\t\t$worldpayFormResult = $this->_controller->Order->WorldpayFormOrder->save($order);\r\n\t\t\r\n\t\t//mail('[email protected]', 'wp', var_export($this->_controller->Order->WorldpayFormOrder->validationErrors, true));\r\n\t\t\r\n\t}",
"public function testOrdersAllForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->from/$this->to\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}"
]
| [
"0.7563066",
"0.7238099",
"0.69634765",
"0.69239974",
"0.6818531",
"0.6769661",
"0.663851",
"0.66112447",
"0.6513412",
"0.65053225",
"0.6468488",
"0.64599824",
"0.6437168",
"0.6405464",
"0.6285269",
"0.62471306",
"0.6184422",
"0.61812323",
"0.61026824",
"0.61021656",
"0.6102109",
"0.6070521",
"0.6067344",
"0.6042254",
"0.6015723",
"0.6014957",
"0.597954",
"0.5968729",
"0.5931942",
"0.59270567"
]
| 0.7358358 | 1 |
Order form: fields in the order form repeated .marketplaceapps.v1.OrderFormField order_form = 1; | public function setOrderForm(&$var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Marketplaceapps\V1\OrderFormField::class);
$this->order_form = $arr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getOrderForm()\n {\n return $this->order_form;\n }",
"public function OrderForm()\n {\n $config = new Config();\n\n $app = new ALLApp();\n $app->configs = $config;\n\n //address\n $column = new Form();\n $column->dbType = dbTypeInteger;\n $column->widget = ZSelect2Widget::class;\n $column->options = [\n 'data' => Az::$app->market->address->getUserAddresses(11),\n 'name' => 'address_id',\n 'label' => ShopShipment::shipment_type\n ];\n $app->columns['address_id'] = $column;\n //address\n\n //shipment_type_id\n $column = new Form();\n $column->dbType = dbTypeString;\n $column->widget = ZMRadioWidget::class;\n $column->options = [\n 'config' => [\n 'hasPlace' => true\n ],\n 'data' => ShopShipment::shipment_type,\n 'name' => 'shipment_type',\n ];\n $column->rules = [\n ['zetsoft\\\\system\\\\validate\\\\ZRequiredValidator']\n ];\n $app->columns['shipment_type'] = $column;\n //shipment_type_id\n\n //contact\n $column = new Form();\n $column->dbType = dbTypeJsonb;\n $column->widget = ZFormWidget::class;\n $column->valueWidget = ZFormViewWidget::class;\n $column->options = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n 'title' => Az::l(\"Ваши контакты\"),\n 'titleClass' => ZColor::color['success-color']\n ],\n ];\n $column->valueOptions = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n\n ],\n ];\n $app->columns['contact_info'] = $column;\n //contact\n\n $app->cards = [];\n return Az::$app->forms->former->model($app);\n }",
"protected function form()\n {\n return Form::make(new Order(), function (Form $form) {\n $form->display('id');\n $form->text('order_no');\n $form->text('user_id');\n $form->text('address');\n $form->text('total_amount');\n $form->text('remark');\n $form->text('paid_at');\n $form->text('payment_method');\n $form->text('payment_no');\n $form->text('refund_status');\n $form->text('refund_no');\n $form->text('closed');\n $form->text('reviewed');\n $form->text('ship_status');\n $form->text('ship_data');\n $form->text('extra');\n\n $form->display('created_at');\n $form->display('updated_at');\n });\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n $form->text('no', __('No'));\n $form->number('user_id', __('User id'));\n $form->textarea('address', __('Address'));\n $form->decimal('total_amount', __('Total amount'));\n $form->textarea('remark', __('Remark'));\n $form->datetime('paid_at', __('Paid at'))->default(date('Y-m-d H:i:s'));\n $form->text('payment_method', __('Payment method'));\n $form->text('payment_no', __('Payment no'));\n $form->text('refund_status', __('Refund status'))->default('pending');\n $form->text('refund_no', __('Refund no'));\n $form->switch('closed', __('Closed'));\n $form->switch('reviewed', __('Reviewed'));\n $form->text('ship_status', __('Ship status'))->default('pending');\n $form->textarea('ship_data', __('Ship data'));\n $form->textarea('extra', __('Extra'));\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n $form->text('no', 'No');\n $form->number('user_id', 'User id');\n $form->textarea('address', 'Address');\n $form->decimal('total_amount', 'Total amount');\n $form->textarea('remark', 'Remark');\n $form->datetime('paid_at', 'Paid at')->default(date('Y-m-d H:i:s'));\n $form->text('payment_method', 'Payment method');\n $form->text('payment_no', 'Payment no');\n $form->text('refund_status', 'Refund status')->default('pending');\n $form->text('refund_no', 'Refund no');\n $form->switch('closed', 'Closed');\n $form->switch('reviewed', 'Reviewed');\n $form->text('ship_status', 'Ship status')->default('pending');\n $form->textarea('ship_data', 'Ship data');\n $form->textarea('extra', 'Extra');\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n $form->text('currency', __('Currency'));\n $form->number('amount', __('Amount'));\n $form->number('state', __('State'));\n $form->number('game_id', __('Game id'));\n $form->number('user_id', __('User id'));\n $form->text('product_id', __('Product id'));\n $form->text('product_name', __('Product name'));\n $form->text('cp_order_id', __('Cp order id'));\n $form->text('callback_url', __('Callback url'));\n $form->text('callback_info', __('Callback info'));\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n\n\n\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order());\n\n $form->switch('paid', __('Paid'));\n $form->datetime('reservation_expires', __('Reservation expires'))->default(date('Y-m-d H:i:s'));\n $form->decimal('price', __('Price'));\n\n $form->tools(function (Form\\Tools $tools) {\n $tools->disableView();\n });\n\n\n\n return $form;\n }",
"function displayOrderForm() {\n $output = '<div class=\"c-order\">\n\t\t\t<div class=\"c-order-select\">\n\t\t\t\t<form name=\"ChangeOrder\" action=\"\">\n\t\t\t\t\t<select name=\"TheOrder\">\n\t\t\t\t\t\t<option value=\"0\">' .\n wfMessage( 'comments-sort-by-date' )->plain() .\n '</option>\n\t\t\t\t\t\t<option value=\"1\">' .\n wfMessage( 'comments-sort-by-score' )->plain() .\n '</option>\n\t\t\t\t\t</select>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t<div id=\"spy\" class=\"c-spy\">\n\t\t\t\t<a href=\"javascript:void(0)\">' .\n wfMessage( 'comments-auto-refresher-enable' )->plain() .\n '</a>\n\t\t\t</div>\n\t\t\t<div class=\"cleared\"></div>\n\t\t</div>\n\t\t<br />' . \"\\n\";\n\n return $output;\n }",
"function uc_order_view_update_form($form, &$form_state, $order) {\n $form['order_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an order comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['order_comment_field']['order_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Order comments are used primarily to communicate with the customer.'),\n );\n\n $form['admin_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an admin comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['admin_comment_field']['admin_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Admin comments are only seen by store administrators.'),\n );\n\n $form['current_status'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_status,\n );\n\n $form['order_id'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_id,\n );\n\n $form['controls'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('uc-inline-form', 'clearfix')),\n '#weight' => 10,\n );\n\n foreach (uc_order_status_list() as $status) {\n $options[$status['id']] = $status['title'];\n }\n $form['controls']['status'] = array(\n '#type' => 'select',\n '#title' => t('Order status'),\n '#default_value' => $order->order_status,\n '#options' => $options,\n );\n\n $form['controls']['notify'] = array(\n '#type' => 'checkbox',\n '#title' => t('Send e-mail notification on update.'),\n );\n\n $form['controls']['actions'] = array('#type' => 'actions');\n $form['controls']['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n );\n\n return $form;\n}",
"public function generate_azericard_form($order_id){\r\n\r\n $admin_settings = $this->get_admin_settings();\r\n\r\n $order = new WC_Order( $order_id );\r\n $amount = $order->total;\r\n $currency = $order->currency;\r\n $description = 'Order #'.$order_id;\r\n\r\n $db_row['AMOUNT'] = $amount; // 2.5\r\n $db_row['CURRENCY'] = $currency;\r\n $db_row['ORDER'] = $this->genOrderID_az($order_id);\r\n\r\n // These fields will be always static\r\n $db_row['DESC'] = $description;\r\n $db_row['MERCH_NAME'] = $this->merch_name;\r\n $db_row['MERCH_URL'] = $this->merch_url;\r\n $db_row['TERMINAL'] = $admin_settings['terminal']; // That is your personal ID in payment system\r\n $db_row['EMAIL'] = $this->email;\r\n $db_row['TRTYPE'] = '1'; // That is the type of operation, 0 - Authorization\r\n $db_row['COUNTRY'] = 'AZ';\r\n $db_row['MERCH_GMT'] = '+4';\r\n $db_row['BACKREF'] = $this->backref;\r\n\r\n // These fields are generated automatically every request\r\n $oper_time = gmdate(\"YmdHis\"); // Date and time UTC\r\n $nonce = substr(md5(rand()),0,16); // Random data\r\n\r\n // Creating form hidden fields\r\n\r\n $form .= \"\r\n <input name=\\\"AMOUNT\\\" value=\\\"{$db_row['AMOUNT']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"CURRENCY\\\" value=\\\"{$db_row['CURRENCY']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"ORDER\\\" value=\\\"{$db_row['ORDER']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"DESC\\\" value=\\\"{$db_row['DESC']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"MERCH_NAME\\\" value=\\\"{$db_row['MERCH_NAME']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"MERCH_URL\\\" value=\\\"{$db_row['MERCH_URL']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"TERMINAL\\\" value=\\\"{$db_row['TERMINAL']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"EMAIL\\\" value=\\\"{$db_row['EMAIL']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"TRTYPE\\\" value=\\\"{$db_row['TRTYPE']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"COUNTRY\\\" value=\\\"{$db_row['COUNTRY']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"MERCH_GMT\\\" value=\\\"{$db_row['MERCH_GMT']}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"TIMESTAMP\\\" value=\\\"{$oper_time}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"NONCE\\\" value=\\\"{$nonce}\\\" type=\\\"hidden\\\">\r\n <input name=\\\"BACKREF\\\" value=\\\"{$db_row['BACKREF']}\\\" type=\\\"hidden\\\">\r\n \";\r\n\r\n // ------------------------------------------------\r\n\r\n // Making P_SIGN (MAC) - Checksum of request\r\n // All following fields must be equal with hidden fields above\r\n\r\n $to_sign = \"\".strlen($db_row['AMOUNT']).$db_row['AMOUNT']\r\n .strlen($db_row['CURRENCY']).$db_row['CURRENCY']\r\n .strlen($db_row['ORDER']).$db_row['ORDER']\r\n .strlen($db_row['DESC']).$db_row['DESC']\r\n .strlen($db_row['MERCH_NAME']).$db_row['MERCH_NAME']\r\n .strlen($db_row['MERCH_URL']).$db_row['MERCH_URL'].\"-\"\r\n .strlen($db_row['TERMINAL']).$db_row['TERMINAL']\r\n .strlen($db_row['EMAIL']).$db_row['EMAIL']\r\n .strlen($db_row['TRTYPE']).$db_row['TRTYPE']\r\n .strlen($db_row['COUNTRY']).$db_row['COUNTRY']\r\n .strlen($db_row['MERCH_GMT']).$db_row['MERCH_GMT']\r\n .strlen($oper_time).$oper_time\r\n .strlen($nonce).$nonce\r\n .strlen($db_row['BACKREF']).$db_row['BACKREF'];\r\n\r\n $p_sign = hash_hmac('sha1', $to_sign, $this->hex2bin_az($admin_settings['key_for_sign']));\r\n\r\n $form .= \"<input name=\\\"P_SIGN\\\" value=\\\"$p_sign\\\" type=\\\"hidden\\\">\".PHP_EOL;\r\n\r\n return '<style type=\"text/css\"> #page{display:none;} </style>\r\n <form action=\"'.$admin_settings['url'].'\" method=\"POST\" id=\"azericard_payment_form\">\r\n ' . $form . '\r\n <input type=\"submit\" class=\"button-alt\" id=\"submit_azericard_payment_form\" value=\"'.__('Pay via Azericard', 'azericard').'\" />\r\n <script type=\"text/javascript\">\r\n jQuery(\"#submit_azericard_payment_form\").click();\r\n </script>\r\n </form>';\r\n }",
"function form_order($name, $order_fields, $data='') {\n\n\tglobal $request;\n\n\t$html = form_select('field', $order_fields, $name, $data['field']);\n\t$html .= ' ';\n\t$html .= form_select('direction', array('ASC' => 'ASC', 'DESC' => 'DESC'), $name, $data['direction']);\n\n\treturn $html;\n\n}",
"public function getFormFields()\n\t{\n\t\tMage::log(\" --- Snap* Hosted Payments API : getFormFields --- \");\n\n\t\t$aOBFields = array();\n\t\t$billing = $this->getOrder()->getBillingAddress();\n\t\t$shipping = $this->getOrder()->getShippingAddress();\n\t\t$items = $this->getOrder()->getAllItems();\n\n\t\t// customer info\n\t\t$aOBFields['customer[merchant_customer_id]'] = $this->getOrder()->getCustomerId();\n\t\t$aOBFields['customer[email]'] = $this->getOrder()->getCustomerEmail();\n\t\t$aOBFields['customer[first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['customer[last_name]'] = $billing->getLastname();\n\t\t$aOBFields['customer[phone]'] = $billing->getTelephone();\n\n\t\t// order header\n\t\t$aOBFields['order[merchant_order_id]'] = $this->getOrder()->getRealOrderId();\n\t\t$aOBFields['order[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\t\t$aOBFields['order[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t$aOBFields['order[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t$aOBFields['order[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t$aOBFields['order[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\t\t//$aOBFields['order[ship_method]'] = '';\n\n\t\t// billing fields\n\t\t$aOBFields['order[billto_company]'] = $billing->getCompany();\n\t\t$aOBFields['order[billto_first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['order[billto_last_name]'] = $billing->getLastname();\n\t\t$aOBFields['order[billto_address1]'] = $billing->getStreet1();\n\t\t$aOBFields['order[billto_address2]'] = $billing->getStreet2();\n\t\t$aOBFields['order[billto_city]'] = $billing->getCity();\n\t\t$aOBFields['order[billto_state]'] = $billing->getRegionCode();\n\t\t$aOBFields['order[billto_country]'] = $billing->getCountry();\n\t\t$aOBFields['order[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t// shipping fields\n\t\tif(!empty($shipping))\n\t\t{\n\t\t\t$aOBFields['order[shipto_company]'] = $shipping->getCompany();\n\t\t\t$aOBFields['order[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t$aOBFields['order[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t$aOBFields['order[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t$aOBFields['order[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t$aOBFields['order[shipto_city]'] = $shipping->getCity();\n\t\t\t$aOBFields['order[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t$aOBFields['order[shipto_country]'] = $shipping->getCountry();\n\t\t\t$aOBFields['order[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t}\n\n\t\t// items\n\t\tif (!empty($items))\n\t\t{\n\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t{\n\t\t\t\t$aOBFields['order_item['.$nCount.'][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][name]'] = $items[$nCount]->getName();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][price]'] = self::_currencyAmount($items[$nCount]->getPrice());\n\t\t\t\t$aOBFields['order_item['.$nCount.'][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][tax]'] = self::_currencyAmount($items[$nCount]->getTaxAmount());\n\t\t\t}\n\t\t}\n\n\t\t// return URLs\n\t\t$aOBFields['return_url'] = Mage::getUrl('hostedpayments/standard/success', array('_secure' => true));\n\t\t$aOBFields['cancel_url'] = Mage::getUrl('hostedpayments/standard/cancel', array('_secure' => true));\n\n\t\t// check to see if the aheadWorks SARP module is being used and is enabled. if it is then we need to\n\t\t// add additional fields to the post fields array\n\t\tif($this->_isUsingSARP() === true)\n\t\t{\n\t\t\tMage::log(\"is using SARP \");\n\n\t\t\t$aSubscriptionIDs = array();\n\t\t\t$aSubscriptionIDs = $this->_getSubscriptionByOrderID($this->getOrder()->getId());\n\n\t\t\t/*\n\t\t\tforeach($aSubscriptionIDs as $nID)\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($nID);\n\t\t\t}\n\t\t\t*/\n\n\t\t\tif(!empty($aSubscriptionIDs))\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($aSubscriptionIDs[0]);\n\t\t\t\t$dStartDate = new Zend_Date($oSubscription->getNextSubscriptionEventDate($oSubscription->getDateStart()), Zend_Date::DATE_LONG);\n\t\t\t\t$nTotalOccurrences = 0;\n\n\t\t\t\tif($oSubscription->isInfinite())\n\t\t\t\t\t$nTotalOccurrences = 9999;\n\t\t\t\telse\n\t\t\t\t\t$nTotalOccurrences = Mage::getModel('sarp/sequence')->getCollection()->addSubscriptionFilter($oSubscription)->count();\n\n\t\t\t\t//Mage::log(\"Subscription ID: \" . $aSubscriptionIDs[0]);\n\t\t\t\t//Mage::log(\"Subscription Inerval: \" . $oSubscription->getPeriod()->getPeriodType().\"s\");\n\t\t\t\t//Mage::log(\"Subscription Occurences: \" . $nTotalOccurrences);\n\n\t\t\t\t$aOBFields['sub[auto_process]'] = 0;\n\t\t\t\t$aOBFields['sub[start_date]'] = $dStartDate;\n\t\t\t\t$aOBFields['sub[interval_length]'] = $oSubscription->getPeriod()->getPeriodValue();\n\t\t\t\t$aOBFields['sub[interval_unit]'] = $oSubscription->getPeriod()->getPeriodType().\"s\";\n\t\t\t\t$aOBFields['sub[total_occurrences]'] = $nTotalOccurrences;\n\n\t\t\t\t$aOBFields['sub[trial_occurrences]'] = '';\n\t\t\t\t$aOBFields['sub[trial_amount]'] = 0.00;\n\n\t\t\t\t// order header\n\t\t\t\t$aOBFields['sub[merchant_subscription_id]'] = $this->getOrder()->getRealOrderId();\n\t\t\t\t//$aOBFields['sub[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\n\t\t\t\t// grand total should be the normal price not the first period price\n\n\t\t\t\t$aOBFields['sub[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t\t\t$aOBFields['sub[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t\t\t$aOBFields['sub[ship_method]'] = '';\n\t\t\t\t$aOBFields['sub[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\n\t\t\t\t// billing fields\n\t\t\t\t$aOBFields['sub[billto_company]'] = $billing->getCompany();\n\t\t\t\t$aOBFields['sub[billto_first_name]'] = $billing->getFirstname();\n\t\t\t\t$aOBFields['sub[billto_last_name]'] = $billing->getLastname();\n\t\t\t\t$aOBFields['sub[billto_address1]'] = $billing->getStreet1();\n\t\t\t\t$aOBFields['sub[billto_address2]'] = $billing->getStreet2();\n\t\t\t\t$aOBFields['sub[billto_city]'] = $billing->getCity();\n\t\t\t\t$aOBFields['sub[billto_state]'] = $billing->getRegionCode();\n\t\t\t\t$aOBFields['sub[billto_country]'] = $billing->getCountry();\n\t\t\t\t$aOBFields['sub[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t\t\t// shipping fields\n\t\t\t\tif(!empty($shipping))\n\t\t\t\t{\n\t\t\t\t\t$aOBFields['sub[shipto_company]'] = $shipping->getCompany();\n\t\t\t\t\t$aOBFields['sub[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t\t\t$aOBFields['sub[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t\t\t$aOBFields['sub[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t\t\t$aOBFields['sub[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t\t\t$aOBFields['sub[shipto_city]'] = $shipping->getCity();\n\t\t\t\t\t$aOBFields['sub[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t\t\t$aOBFields['sub[shipto_country]'] = $shipping->getCountry();\n\t\t\t\t\t$aOBFields['sub[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t\t\t}\n\n\t\t\t\t$items = $this->getOrder()->getAllItems();\n\t\t\t\t$nCount = 0;\n\t\t\t\t$nSubCount = 0;\n\t\t\t\t$aOBFields['sub[total_subtotal]'] = 0;\n\t\t\t\t$aOBFields['sub[total]'] = 0;\n\n\t\t\t\t// items\n\t\t\t\tif (!empty($items))\n\t\t\t\t{\n\t\t\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t\t\t{\n\t\t\t\t\t\t$oItem = $items[$nCount];\n\n\t\t\t\t\t\tif(Mage::helper('sarp')->isSubscriptionType($items[$nCount]) == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$productId = $oItem->getProductId();\n\t\t\t\t\t\t\t$oProduct = Mage::getModel('catalog/product')->load($productId);\n\t\t\t\t\t\t\t$nFirstPeriodPrice = self::_currencyAmount($oProduct->getAwSarpFirstPeriodPrice());\n\t\t\t\t\t\t\t$nNormalPrice = self::_currencyAmount((!empty($nFirstPeriodPrice) ? $oProduct->getAwSarpSubscriptionPrice() : $items[$nCount]->getPrice()));\n\n\t\t\t\t\t\t\tMage::log(\"Normal Price:\" . $nNormalPrice);\n\t\t\t\t\t\t\tMage::log(\"First Period Price:\" . $nFirstPeriodPrice);\n\n\t\t\t\t\t\t\tif ($oItem->canInvoice()) $qtys[$oItem->getId()] = $oItem->getQtyToInvoice();\n\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][name]'] = $items[$nCount]->getName();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][price]'] = $nNormalPrice;\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t\t\t\t//$aOBFields['sub_item[' . $nSubCount . '][details]'] = '';\n\n\t\t\t\t\t\t\tif ($oItem->getIsVirtual())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = 0.00;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t$aOBFields['sub[trial_amount]'] = $nFirstPeriodPrice;\n\t\t\t\t\t\t\t*/\n\n\t\t\t\t\t\t\t$aOBFields['sub[total_subtotal]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\t\t\t\t\t\t\t$aOBFields['sub[total]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\n\t\t\t\t\t\t\t$nSubCount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tMage::log(\"Not a subscription item: \" . $items[$nCount]->getName());\n\t\t\t\t\t}\n\t\t\t\t\tMage::log(\"Sub. Sub Total: \" . $aOBFields['sub[total_subtotal]']);\n\t\t\t\t\tMage::log(\"Sub. Total: \" . $aOBFields['sub[total]']);\n\t\t\t\t}\n\n\t\t\t\t$aOBFields['sub[total]'] = $aOBFields['sub[total]'] + $aOBFields['sub[total_shipping]'];\n\t\t\t}\n\t\t}\n\n\t\t// generate the MAC and add it as the final param\n\t\t$aOBFields['mac'] = $this->getFormFieldsMAC($aOBFields);\n\n\t\tMage::log(print_r($aOBFields, true));\n\n\t\treturn $aOBFields;\n\t}",
"public function testOrdersOneForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->orderId\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}",
"protected function _prepareForm()\n {\n /** @var \\Magento\\Framework\\Data\\Form $form */\n $form = $this->_formFactory->create();\n $form->setHtmlIdPrefix('item_');\n $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Select order')]);\n $fieldset->addField(\n 'direction',\n 'select',\n [\n 'name' => 'direction',\n 'label' => __('Direction'),\n 'title' => __('Direction'),\n 'required' => true,\n 'options' => ['shipment' => 'Store -> Customer', 'invert' => 'Customer -> Store', 'refund' => 'RMA (return)']\n ]\n );\n $fieldset->addField(\n 'order_id',\n 'text',\n [\n 'name' => 'order_id',\n 'label' => __('Order #'),\n 'title' => __('Order #'),\n 'required' => true\n ]\n );\n $this->setForm($form);\n return parent::_prepareForm();\n }",
"public function getFormFields($order, $requestParams)\n {\n if (empty($order)) {\n if (!($order = $this->getOrder())) {\n return array();\n }\n }\n $payment = $order->getPayment()->getMethodInstance();\n $formFields = array();\n $formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());\n $formFields['AMOUNT'] = $this->getHelper()->getAmount($order->getBaseGrandTotal());\n $formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();\n $formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order);\n $formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();\n $formFields['PM'] = $payment->getOpsCode($order->getPayment());\n $formFields['EMAIL'] = $order->getCustomerEmail();\n\n $methodDependendFields = $this->getMethodDependendFormFields($order, $requestParams);\n if (is_array($methodDependendFields)) {\n $formFields = array_merge($formFields, $methodDependendFields);\n }\n\n $paymentAction = $this->_getOPSPaymentOperation();\n if ($paymentAction ) {\n $formFields['OPERATION'] = $paymentAction;\n }\n\n\n if ($this->getConfig()->getConfigData('template')=='ops') {\n $formFields['TP']= '';\n $formFields['PMLISTTYPE'] = $this->getConfig()->getConfigData('pmlist');\n } else {\n $formFields['TP']= $this->getConfig()->getPayPageTemplate();\n }\n $formFields['TITLE'] = $this->getConfig()->getConfigData('html_title');\n $formFields['BGCOLOR'] = $this->getConfig()->getConfigData('bgcolor');\n $formFields['TXTCOLOR'] = $this->getConfig()->getConfigData('txtcolor');\n $formFields['TBLBGCOLOR'] = $this->getConfig()->getConfigData('tblbgcolor');\n $formFields['TBLTXTCOLOR'] = $this->getConfig()->getConfigData('tbltxtcolor');\n $formFields['BUTTONBGCOLOR'] = $this->getConfig()->getConfigData('buttonbgcolor');\n $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor');\n $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype');\n $formFields['LOGO'] = $this->getConfig()->getConfigData('logo');\n $formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'home')) : 'NONE';\n $formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'catalog')) : '';\n $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();\n $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();\n $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();\n $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();\n $formFields['BACKURL'] = $this->getConfig()->getCancelUrl();\n\n $shaSign = Mage::helper('ops/payment')->shaCrypt(Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()));\n\n $helper = Mage::helper('ops');\n $helper->log($helper->__(\"Register Order %s in Ingenico Payment Services \\n\\nAll form fields: %s\\nIngenico Payment Services String to hash: %s\\nHash: %s\",\n $order->getIncrementId(),\n serialize($formFields),\n Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()),\n $shaSign\n ));\n\n $formFields['SHASIGN'] = $shaSign;\n return $formFields;\n }",
"public function getSeparateOrderForms()\n {\n return $this->separate_order_forms;\n }",
"protected function form()\n {\n $form = new Form(new TaskOrder);\n\n $form->display('ID');\n $form->text('eid',\"快递单号\");\n $form->text('sname','客服名称');\n $form->select('store','快递网点')->options(storedatas(1));\n $form->select('etype','快递公司')->options(edatas());\n $form->display('Created at');\n $form->display('Updated at');\n\n return $form;\n }",
"public function getFormFields()\n {\n $order_id = $this->getOrder()->getRealOrderId();\n $billing = $this->getOrder()->getBillingAddress();\n if ($this->getOrder()->getBillingAddress()->getEmail()) {\n $email = $this->getOrder()->getBillingAddress()->getEmail();\n } else {\n $email = $this->getOrder()->getCustomerEmail();\n }\n\n $params = array(\n 'merchant_fields' => 'partner',\n 'partner' => 'magento',\n 'pay_to_email' => Mage::getStoreConfig(Paynova_Paynovapayment_Helper_Data::XML_PATH_EMAIL),\n 'transaction_id' => $order_id,\n 'return_url' => Mage::getUrl('paynovapayment/processing/success', array('transaction_id' => $order_id)),\n 'cancel_url' => Mage::getUrl('paynovapayment/processing/cancel', array('transaction_id' => $order_id)),\n 'status_url' => Mage::getUrl('paynovapayment/processing/status'),\n 'language' => $this->getLocale(),\n 'amount' => round($this->getOrder()->getGrandTotal(), 2),\n 'currency' => $this->getOrder()->getOrderCurrencyCode(),\n 'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),\n 'firstname' => $billing->getFirstname(),\n 'lastname' => $billing->getLastname(),\n 'address' => $billing->getStreet(-1),\n 'postal_code' => $billing->getPostcode(),\n 'city' => $billing->getCity(),\n 'country' => $billing->getCountryModel()->getIso3Code(),\n 'pay_from_email' => $email,\n 'phone_number' => $billing->getTelephone(),\n 'detail1_description' => Mage::helper('paynovapayment')->__('Order ID'),\n 'detail1_text' => $order_id,\n 'payment_methods' => $this->_paymentMethod,\n 'hide_login' => $this->_hidelogin,\n 'new_window_redirect' => '1'\n );\n\n // add optional day of birth\n if ($billing->getDob()) {\n $params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');\n }\n\n return $params;\n }",
"protected function form()\n {\n $form = new Form(new ScanRechargeOrder());\n $form->select('scan_recharge_channel_id', __('scan-recharge::order.scan_recharge_channel_id'))\n ->options(ScanRechargeChannel::select('id', 'name')->pluck('name', 'id'))\n ->required();\n $form->text('user_id', __('scan-recharge::order.user_id'))\n ->required()\n ->help(__('scan-recharge::order.user_id_help'));\n $form->currency('amount', __('scan-recharge::order.amount'))->symbol('¥')\n ->default(0)\n ->required();\n $form->textarea('desc', __('scan-recharge::order.desc'))\n ->required()\n ->help(__('scan-recharge::order.desc_help'));\n $form->textarea('reply', __('scan-recharge::order.reply'))\n ->help(__('scan-recharge::order.reply_help'));\n $form->select('status', __('scan-recharge::order.status'))\n ->options(__('scan-recharge::order.status_value'));\n $form->saving(function (Form $form) {\n if ($form->status == 1 && $form->model()->id) {\n RechargeSuccessUserAccountJob::dispatch(ScanRechargeOrder::find($form->model()->id));\n }\n });\n return $form;\n }",
"protected function form()\n {\n $form = new Form(new Order);\n $statuses = Label::pluck('label_name', 'id');\n $payment_status = PaymentStatus::pluck('title', 'id');\n// print_r($payment_status);\n $time_slot = [];\n foreach (TimeSlot::all() as $time){\n $time_slot[$time->time_from .' to '. $time->time_to] =$time->time_from .' to '. $time->time_to;\n }\n\n $delivery_boys = DeliveryBoy::where('status',1)->pluck('delivery_boy_name', 'id');\n $form->text('order_id', __('Order id'))->readonly();\n $form->select('delivered_by', __('Delivered by'))->options($delivery_boys)->rules(function ($form) {\n return 'required';\n });\n $form->select('status', __('Status'))->options($statuses)->default(1)->rules(function ($form) {\n return 'required';\n });\n $form->select('payment_status', __('Payment Status'))->options($payment_status)->rules(function ($form) {\n return 'required';\n });\n $form->date('expected_delivery_date', __('Delivery date'))->rules(function ($form) {\n return 'required';\n });\n $form->select('drop_time', __('Delivery slot'))->options($time_slot)->rules(function ($form) {\n return 'required';\n });\n $form->saving(function (Form $form) {\n if($form->delivered_by > 0 && $form->status == 1){\n $error = new MessageBag([\n 'title' => 'Warning',\n 'message' => 'Please change order status...',\n ]);\n\n return back()->with(compact('error'));\n }\n });\n $form->saved(function (Form $form) {\n// $this->update_history($form->model()->id);\n\n $message = DB::table('fcm_notification_messages')->where('id',$form->model()->status)->first();\n $order_id = $form->model()->order_id;\n $customer_token = Customer::where('id',$form->model()->customer_id)->value('fcm_token');\n\n $this->send_fcm($message->customer_title.'('.$order_id.')', $message->customer_description, $customer_token);\n $noti_details = ['order_id' => $order_id,'fcm_msg_id' => $message->id,'user_id' =>$form->model()->customer_id,'created_at' => date('y-m-d H:i:s') ];\n\n $past_user_noti = DB::table('user_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('user_id',$form->model()->customer_id)->get();\n if (sizeof($past_user_noti) > 0){\n DB::table('user_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('user_id',$form->model()->customer_id)->delete();\n }\n\n DB::table('user_notifications')->insert($noti_details);\n if($form->model()->status == 2 || $form->model()->status == 5){\n $delivery_boy_token = DeliveryBoy::where('id',$form->model()->delivered_by)->value('fcm_token');\n $this->send_fcm($message->delivery_title.'('.$order_id.')', $message->delivery_description, $delivery_boy_token);\n $noti_details = ['order_id' => $order_id,'fcm_msg_id' => $message->id,'driver_id' =>$form->model()->delivered_by,'created_at' => date('y-m-d H:i:s') ];\n\n $past_driver_noti = DB::table('driver_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('driver_id',$form->model()->delivered_by)->get();\n if (sizeof($past_driver_noti) > 0){\n DB::table('driver_notifications')->where('order_id',$order_id)->where('fcm_msg_id',$message->id)->where('driver_id' ,$form->model()->delivered_by)->delete();\n }\n DB::table('driver_notifications')->insert($noti_details);\n }\n NotiHelper::SyncEarning([\n 'order_id' => $order_id,\n 'amount' => $form->model()->total,\n 'statement' => 'Rs '. $form->model()->total.' for order '.$order_id,\n ]);\n\n });\n $form->tools(function (Form\\Tools $tools) {\n $tools->disableDelete();\n $tools->disableView();\n });\n $form->footer(function ($footer) {\n $footer->disableViewCheck();\n $footer->disableEditingCheck();\n $footer->disableCreatingCheck();\n });\n return $form;\n }",
"public function getFormFields() {\r\r\n\r\r\n $billing = $this->getOrder()->getBillingAddress();\r\r\n $shipping = $this->getOrder()->getShippingAddress();\r\r\n $addr_entity_id = $shipping->getCustomerAddressId();\r\r\n $shippingaddress = Mage::getModel('sales/order_address');\r\r\n $shippingaddress->load($addr_entity_id);\r\r\n $shipaddgetdat = $shippingaddress->getData();\r\r\n\r\r\n\r\r\n\r\r\n $biladdr_entity_id = $billing->getCustomerAddressId();\r\r\n ;\r\r\n $billingaddress = Mage::getModel('sales/order_address');\r\r\n $billingaddress->load($biladdr_entity_id);\r\r\n $billaddgetdat = $billingaddress->getData();\r\r\n\r\r\n $coFields = array();\r\r\n $items = $this->getQuote()->getAllItems();\r\r\n\r\r\n if ($items) {\r\r\n $i = 1;\r\r\n foreach ($items as $item) {\r\r\n if ($item->getParentItem()) {\r\r\n continue;\r\r\n }\r\r\n $coFields['c_prod_' . $i] = $this->cleanString($item->getSku());\r\r\n $coFields['c_name_' . $i] = $this->cleanString($item->getName());\r\r\n $coFields['c_description_' . $i] = $this->cleanString($item->getDescription());\r\r\n $coFields['c_price_' . $i] = number_format($item->getPrice(), 2, '.', '');\r\r\n $i++;\r\r\n }\r\r\n }\r\r\n\r\r\n $request = '';\r\r\n foreach ($coFields as $k => $v) {\r\r\n $request .= '<' . $k . '>' . $v . '</' . $k . '>';\r\r\n }\r\r\n\r\r\n\r\r\n $key = Mage::getStoreConfig('payment/payucheckout_shared/key');\r\r\n $salt = Mage::getStoreConfig('payment/payucheckout_shared/salt');\r\r\n $debug_mode = Mage::getStoreConfig('payment/payucheckout_shared/debug_mode');\r\r\n\r\r\n $orderid = $this->getOrder()->getRealOrderId();\r\r\n $orderInfo = $this->getOrder();\r\r\n $order = Mage::getModel('sales/order')->loadByIncrementId($orderid);\r\r\n// get order total value\r\r\n $orderValue = number_format($order->getGrandTotal(), 2, '.', $thousands_sep = '');\r\r\n// get order item collection\r\r\n $orderItems = $order->getItemsCollection();\r\r\n $productInfo = array();\r\r\n $productInfo2 = array();\r\r\n \r\r\n \r\r\n foreach ($orderItems as $item) {\r\r\n \r\r\n $item->getName();\r\r\n $product_id = $item->product_id;\r\r\n $product_sku = $item->sku;\r\r\n $product_name = $item->getName();\r\r\n $_product = Mage::getModel('catalog/product')->load($product_id);\r\r\n $cats = $_product->getCategoryIds();\r\r\n $category_id = $cats[0]; // just grab the first id\r\r\n $category = Mage::getModel('catalog/category')->load($category_id);\r\r\n $category_name = $category->getName();\r\r\n\r\r\n $productInfo['name'] = $this->cleanString($item->getName());\r\r\n $productInfo['description'] = $this->cleanString(substr($_product->getDescription(),0,100));\r\r\n $productInfo['value'] = $orderValue;\r\r\n $productInfo['isRequired'] = true;\r\r\n $productInfo['settlementEvent'] = \"EmailConfirmation\";\r\r\n $productInfo2[] = $productInfo;\r\r\n }\r\r\n $productIndoFilterData['paymentParts'] = $productInfo2;\r\r\n $jsonProductInfo = json_encode($productIndoFilterData);\r\r\n\r\r\n $txnid = $orderid;\r\r\n\r\r\n $coFields['key'] = $key;\r\r\n $coFields['txnid'] = $txnid;\r\r\n $coFields['udf2'] = $txnid;\r\r\n $coFields['amount'] = number_format($this->getOrder()->getBaseGrandTotal(), 0, '', '');\r\r\n $coFields['productinfo'] = $jsonProductInfo;\r\r\n $coFields['address'] = $billaddgetdat['street'];\r\r\n $coFields['firstname'] = $billing->getFirstname();\r\r\n $coFields['Lastname'] = $billing->getLastname();\r\r\n $coFields['City'] = $billing->getCity();\r\r\n $coFields['State'] = $billing->getRegion();\r\r\n $coFields['Country'] = $billing->getCountry();\r\r\n $coFields['Zipcode'] = $billing->getPostcode();\r\r\n $coFields['email'] = $this->getOrder()->getCustomerEmail();\r\r\n $coFields['phone'] = $billing->getTelephone();\r\r\n\r\r\n $coFields['ship_name'] = $shipping->getFirstname() . \" \" . $shipping->getLastname();\r\r\n $coFields['ship_address'] = $shipaddgetdat['street'];\r\r\n $coFields['ship_zipcode'] = $shipping->getPostcode();\r\r\n $coFields['ship_city'] = $shipping->getCity();\r\r\n $coFields['ship_state'] = $shipping->getRegion();\r\r\n $coFields['ship_country'] = $shipping->getCountry();\r\r\n $coFields['ship_phone'] = $shipping->getTelephone();\r\r\n $coFields['website'] = Mage::getBaseUrl();\r\r\n $coFields['surl'] = Mage::getBaseUrl() . 'payucheckout/shared/success/';\r\r\n $coFields['furl'] = Mage::getBaseUrl() . 'payucheckout/shared/failure/';\r\r\n $coFields['curl'] = Mage::getBaseUrl() . 'payucheckout/shared/canceled/id/' . $this->getOrder()->getRealOrderId();\r\r\n $coFields['Pg'] = $billing->getpg();\r\r\n $coFields['bankcode'] = $billing->getbankcode();\r\r\n $coFields['ccnum'] = $billing->getccnum();\r\r\n $coFields['ccvv'] = $billing->getccvv();\r\r\n $coFields['ccexpmon'] = $billing->getccexpmon();\r\r\n $coFields['ccexpyr'] = $billing->getccexpyr();\r\r\n $coFields['ccname'] = $billing->getccname();\r\r\n $coFields['service_provider'] = 'payu_paisa';\r\r\n\r\r\n $debugId = '';\r\r\n \r\r\n\r\r\n if ($debug_mode == 1) {\r\r\n\r\r\n $requestInfo = $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '||||||||||' . $salt;\r\r\n $debug = Mage::getModel('payucheckout/api_debug')\r\r\n ->setRequestBody($requestInfo)\r\r\n ->save();\r\r\n\r\r\n $debugId = $debug->getId();\r\r\n\r\r\n $coFields['udf1'] = $debugId;\r\r\n $coFields['Hash'] = hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '|' . $coFields['udf2'] . '|||||||||' . $salt);\r\r\n } else {\r\r\n $coFields['Hash'] = strtolower(hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '||' . $coFields['udf2'] . '|||||||||' . $salt));\r\r\n }\r\r\n return $coFields;\r\r\n }",
"function theme_pi_authoring_order_activities_form($form) {\n\t$output = '';\n\t$output .= '<div>Drag the arrows up and down to to change the order of the activity and click save to finish.</div>';\n\tdrupal_add_tabledrag('pi-authoring-order-activities-sort', 'order', 'sibling', 'pi-authoring-order-activities-element');\n\t$header = array(array('data' => '', 'width' => '29'), 'Activity', 'Description', 'Position');\n\n\t$rows = array();\n\tforeach (element_children($form['order_activities_activities']) as $key)\n\t{\n\t\t// Add class to group weight fields for drag and drop.\n\t\t$form['order_activities_activities'][$key]['weight']['#attributes']['class'] = 'pi-authoring-order-activities-element';\n\n\t\t$row = array('');\n\t\t$row[] = l(drupal_render($form['order_activities_activities'][$key]['title']), \"node/$key/edit\");\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['body']);\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['weight']);\n\n\t\t$rows[] = array('data' => $row, 'class' => 'draggable');\n\t}\n\t$output .= theme('table', $header, $rows, array('id' => 'pi-authoring-order-activities-sort'));\n\t$output .= drupal_render($form);\n\treturn $output;\n}",
"public function payment_form( $order_id ) {\n\n\t\t$this->log( 'Render Payment Form' );\n\n\t\tif( !$order_id or !$this->product_id or !$this->merchant_id or !$this->secret_word ) {\n\n\t\t\t$this->log( 'Error: Empty payment parameters' );\n\n\t\t\treturn;\n\t\t}\n\n\t\t$this->order = new WC_Order( $order_id );\n\n\t\t$amount = ( $this->test_total_price_value > 0 ) ? $this->test_total_price_value : $this->order->get_total();\n\n\t\t$language = get_locale();\n\t\tswitch( $language ) {\n\t\t\tcase 'ru_RU':\n\t\t\t\t$language = 'ru';\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$language = 'en';\n\t\t\tbreak;\n\t\t}\n\n\t\t$form_fields = array(\n\t\t\t'product_id'\t=> $this->product_id,\n\t\t\t'product_name'\t=> sprintf( $this->product_order_purpose, $order_id ),\n\t\t\t'token'\t\t\t=> md5( \n\t\t\t\t\t\t\t\t\t$this->merchant_id . \n\t\t\t\t\t\t\t\t\t$this->product_id . \n\t\t\t\t\t\t\t\t\t$amount . \n\t\t\t\t\t\t\t\t\t$order_id . \n\t\t\t\t\t\t\t\t\t$this->secret_word \n\t\t\t\t\t\t\t\t),\n\t\t\t'amount'\t\t=> $amount,\n\t\t\t'cf'\t\t\t=> $order_id,\n\t\t\t'email'\t\t\t=> $this->order->get_billing_email(),\n\t\t\t'phone'\t\t\t=> $this->order->get_billing_phone(),\n\t\t\t'cb_url'\t\t=> get_home_url() . '/wc-api/' . $this->id, // callback url\n\t\t\t'ok_url'\t\t=> $this->order->get_checkout_order_received_url(), // success return to \"/order-received\"\n\t\t\t'ko_url'\t\t=> $this->order->get_checkout_payment_url(), // cancel return to \"/order-pay\"\n\t\t\t'language'\t\t=> $language,\n\t\t);\n\n\t\t$result ='';\n\t\t$result .= sprintf( '<form name=\"pay_form\" method=\"POST\" action=\"%s\">', $this->pay_url );\n\n\t\tforeach( $form_fields as $key => $val ) {\n \t\t\t$result .= sprintf( '<input type=\"hidden\" name=\"%s\" value=\"%s\">', $key, $form_fields[$key] );\n\t\t}\n\n\t\t// Show link to Terms Page\n\t\tif ( $this->terms_page_id ) {\n\n\t\t\t$result .= sprintf( '<div class=\"%s__textblock\">%s <a href=\"%s\" target=\"_blank\">%s</a></div>', \n\t\t\t\t$this->id,\n\t\t\t\t$this->terms_page_prefix,\n\t\t\t\tesc_url( get_page_link( $this->terms_page_id ) ), \n\t\t\t\tget_the_title( $this->terms_page_id ) );\n\t\t}\n\n\t\t$result .= sprintf( '<input type=\"submit\" value=\"%s\">', $this->pay_button_title );\n\t\t$result .= '</form>';\n\n\t\treturn $result;\n\t}",
"function getOrderForm() {\n global $PRODUCTS;\n $tbl = new HTML_Table('', 'demoTbl');\n $frm = new HTML_Form();\n \n // header row\n $tbl->addRow();\n $tbl->addCell('Image', 'first', 'header');\n $tbl->addCell('Product', '', 'header');\n $tbl->addCell('Price', '', 'header');\n $tbl->addCell('Quantity', '', 'header');\n $tbl->addCell('Totals', '', 'header');\n \n // display product info/form elements\n foreach($PRODUCTS as $product) {\n list($abbr, $img, $name, $price) = $product;\n \n // quantity text input\n $qty_el = $frm->addInput('text', $abbr . '_qty', 0, \n array('size'=>4, 'class'=>'cur', 'pattern'=>'[0-9]+', 'placeholder'=>0, \n 'onchange'=>'getProductTotal(this)',\n 'onclick'=>'checkValue(this)', 'onblur'=>'reCheckValue(this)') );\n \n // total text input\n $tot_el = $frm->addInput('text', $abbr . '_tot', 0, array('readonly'=>true, 'size'=>8, 'class'=>'cur') );\n \n // price hidden input\n $price_el = $frm->addInput('hidden', $abbr . '_price', $price);\n \n $tbl->addRow();\n $tbl->addCell(\"<img src='\" .$img. \"'alt='Sonic Screwdriver'>\");\n $tbl->addCell($name);\n $tbl->addCell('$' . number_format($price, 2) . $price_el, 'cur' );\n $tbl->addCell( $qty_el, 'qty');\n $tbl->addCell( $tot_el );\n }\n \n // total row\n $tbl->addRow();\n $tbl->addCell( 'Total: ', 'total', 'data', array('colspan'=>3) );\n $tbl->addCell( $frm->addInput('text', 'total', 0, array('readonly'=>true, 'size'=>8, 'class'=>'cur') ) );\n \n // submit button\n $tbl->addRow();\n $tbl->addCell( $frm->addInput('submit', 'submit', 'Submit'),\n 'submit', 'data', array('colspan'=>4) );\n \n $frmStr = $frm->startForm('ex1_result.php', 'post', '', array('onsubmit'=>'return checkSubmit(this);') ) .\n $tbl->display() . $frm->endForm();\n \n return $frmStr;\n}",
"protected function form()\n {\n $form = new Form(new WithdrawDepositOrder);\n\n $form->number('apply_amount', __('Apply amount'));\n $form->number('transfer_amount', __('Transfer amount'));\n $form->number('master_id', __('Master id'));\n $form->switch('status', __('Status'));\n $form->textarea('comment', __('Comment'));\n\n return $form;\n }",
"function generate_form( $order_id ) {\n\t\tglobal $woocommerce, $wc_authorize_sim;\n\t\t\n\t\t$order = new WC_Order( $order_id );\n\t\t\n\t\t$this->add_log( 'Generating payment form for order #' . $order->id);\n\t\t\n\t\t$pay_url = $this->get_gateway_url();\n\t\t\n\t\t$params = $this->get_params( $order );\n\t\t\n\t\t$time = time();\n $fp_hash = AuthorizeNetSIM_Form::getFingerprint( $this->login_id, $this->tran_key, $params['x_amount'], $params['x_fp_sequence'], $time );\n\t\t\n\t\t$params['x_fp_timestamp'] \t= $time;\n\t\t$params['x_fp_hash'] \t\t= $fp_hash;\n\t\t\n\t\t$this->add_log( \"Sending request: \" . print_r( $params,true ));\n\t\t\n\t\t$form = new AuthorizeNetSIM_Form($params);\n\t\t\n\t\twc_enqueue_js( \n\t\t\t'$.blockUI({\n\t\t\t\tmessage: \"' . esc_js( __( 'Thank you for your order. We are now redirecting you to 2checkout to make payment.', WC_Authorize_SIM::TEXT_DOMAIN ) ) . '\",\n\t\t\t\tbaseZ: 99999,\n\t\t\t\toverlayCSS:\n\t\t\t\t{\n\t\t\t\t\tbackground: \"#fff\",\n\t\t\t\t\topacity: 0.6\n\t\t\t\t},\n\t\t\t\tcss: {\n\t\t\t\t\tpadding: \"20px\",\n\t\t\t\t\tzindex: \"9999999\",\n\t\t\t\t\ttextAlign: \"center\",\n\t\t\t\t\tcolor: \"#555\",\n\t\t\t\t\tborder: \"3px solid #aaa\",\n\t\t\t\t\tbackgroundColor:\"#fff\",\n\t\t\t\t\tcursor: \"wait\",\n\t\t\t\t\tlineHeight:\t\t\"24px\",\n\t\t\t\t}\n\t\t\t});\n\t\t\tjQuery(\"#authorize_sim_payment_form input[type=submit]\").click();' \n\t\t);\n?>\n<form action=\"<?php echo $pay_url ?>\" method=\"post\" id=\"authorize_sim_payment_form\">\n\t<?php echo $form->getHiddenFieldString(); ?>\n\t<?php echo implode( '', $this->line_items ) ?>\n\t<input type=\"submit\" class=\"button button-alt\" id=\"submit_authorize_sim_payment_form\" value=\"<?php _e('Pay via Authorize.Net SIM', WC_Authorize_SIM::TEXT_DOMAIN) ?>\" /> \n\t<a class=\"button cancel\" href=\"<?php echo $order->get_cancel_order_url() ?>\"><?php _e('Cancel order & restore cart', WC_Authorize_SIM::TEXT_DOMAIN) ?></a>\n</form>\n<?php\n\t}",
"protected function form() {\n\t\t$form = new Form(new Payment);\n\n\t\t$form->text('user.nickname', __('用户'))->disable();\n\t\t// $form->number('app_id', __('App id'));\n\t\t$form->decimal('price', __('金额'));\n\t\t$form->text('transaction_id', __('三方订单号'));\n\t\t$form->text('out_trade_no', __('平台订单号'))->disable();\n\t\t$form->radio('type', __('订单类型'))->options(['20' => '商城订单']);\n\t\t$form->radio('status', __('状态'))->options(['0' => '未支付', '1' => '已支付'])->default('0');\n\t\t// $form->text('other', __('Other'));\n\t\t$form->datetime('payment_at', __('支付时间'))->default(date('Y-m-d H:i:s'));\n\t\treturn $form;\n\t}",
"private function _writeWorldpayFormOrder()\r\n\t{\r\n\t\t//mail('[email protected]', 'wp', 'init');\r\n\t\t\r\n\t\t// Create sagepay form order data\r\n\t\t$order = array('WorldpayFormOrder' => array(\r\n\t\t\t'order_id' \t\t=> $this->_controller->orderID,\r\n\t\t\t'cartId' \t\t=> $this->_values['cartId'],\r\n\t\t\t'amount' \t\t=> $this->_values['amount'],\r\n\t\t\t'authMode' \t\t=> $this->_values['authMode'],\r\n\t\t\t'testMode' \t\t=> $this->_values['testMode'],\r\n\t\t\t'transId' \t\t=> $this->_values['transId'],\r\n\t\t\t'transStatus' \t=> $this->_values['transStatus'],\r\n\t\t\t'transTime' \t=> $this->_values['transTime'],\r\n\t\t\t'authAmount' \t=> $this->_values['authAmount'],\r\n\t\t\t'cardType' \t\t=> $this->_values['cardType'],\r\n\t\t\t'countryMatch' \t=> $this->_values['countryMatch'],\r\n\t\t\t'AVS' \t\t\t=> $this->_values['AVS'],\r\n\t\t\t'ipAddress' \t=> $this->_values['ipAddress']\r\n\t\t));\r\n\t\t\r\n\t\t//mail('[email protected]', 'wp', var_export($order, true));\r\n\t\t\r\n\t\t// Create sagepay form order record\r\n\t\t$this->_controller->Order->WorldpayFormOrder->create();\r\n\t\t$worldpayFormResult = $this->_controller->Order->WorldpayFormOrder->save($order);\r\n\t\t\r\n\t\t//mail('[email protected]', 'wp', var_export($this->_controller->Order->WorldpayFormOrder->validationErrors, true));\r\n\t\t\r\n\t}",
"public function testOrdersAllForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->from/$this->to\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}"
]
| [
"0.7359091",
"0.72387",
"0.69628686",
"0.6923959",
"0.68185186",
"0.6769846",
"0.6638858",
"0.66114026",
"0.6513442",
"0.6504811",
"0.6469479",
"0.6459403",
"0.6438287",
"0.640587",
"0.62849355",
"0.6248706",
"0.6186252",
"0.618254",
"0.6103748",
"0.61027",
"0.6102484",
"0.607201",
"0.6069202",
"0.6040519",
"0.6016256",
"0.60160834",
"0.59794873",
"0.5969185",
"0.59320146",
"0.59277517"
]
| 0.75621516 | 0 |
Order form: common form fields .marketplaceapps.v1.IncludedCommonFormFields common_form = 2; | public function setCommonForm(&$var)
{
GPBUtil::checkMessage($var, \Marketplaceapps\V1\IncludedCommonFormFields::class);
$this->common_form = $var;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setCommonFormRequiredFields(&$var)\n {\n GPBUtil::checkMessage($var, \\Marketplaceapps\\V1\\IncludedCommonFormFields::class);\n $this->common_form_required_fields = $var;\n }",
"public function getCommonFormRequiredFields()\n {\n return $this->common_form_required_fields;\n }",
"public function getCommonForm()\n {\n return $this->common_form;\n }",
"public function getFormFields()\n\t{\n\t\tMage::log(\" --- Snap* Hosted Payments API : getFormFields --- \");\n\n\t\t$aOBFields = array();\n\t\t$billing = $this->getOrder()->getBillingAddress();\n\t\t$shipping = $this->getOrder()->getShippingAddress();\n\t\t$items = $this->getOrder()->getAllItems();\n\n\t\t// customer info\n\t\t$aOBFields['customer[merchant_customer_id]'] = $this->getOrder()->getCustomerId();\n\t\t$aOBFields['customer[email]'] = $this->getOrder()->getCustomerEmail();\n\t\t$aOBFields['customer[first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['customer[last_name]'] = $billing->getLastname();\n\t\t$aOBFields['customer[phone]'] = $billing->getTelephone();\n\n\t\t// order header\n\t\t$aOBFields['order[merchant_order_id]'] = $this->getOrder()->getRealOrderId();\n\t\t$aOBFields['order[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\t\t$aOBFields['order[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t$aOBFields['order[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t$aOBFields['order[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t$aOBFields['order[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\t\t//$aOBFields['order[ship_method]'] = '';\n\n\t\t// billing fields\n\t\t$aOBFields['order[billto_company]'] = $billing->getCompany();\n\t\t$aOBFields['order[billto_first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['order[billto_last_name]'] = $billing->getLastname();\n\t\t$aOBFields['order[billto_address1]'] = $billing->getStreet1();\n\t\t$aOBFields['order[billto_address2]'] = $billing->getStreet2();\n\t\t$aOBFields['order[billto_city]'] = $billing->getCity();\n\t\t$aOBFields['order[billto_state]'] = $billing->getRegionCode();\n\t\t$aOBFields['order[billto_country]'] = $billing->getCountry();\n\t\t$aOBFields['order[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t// shipping fields\n\t\tif(!empty($shipping))\n\t\t{\n\t\t\t$aOBFields['order[shipto_company]'] = $shipping->getCompany();\n\t\t\t$aOBFields['order[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t$aOBFields['order[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t$aOBFields['order[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t$aOBFields['order[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t$aOBFields['order[shipto_city]'] = $shipping->getCity();\n\t\t\t$aOBFields['order[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t$aOBFields['order[shipto_country]'] = $shipping->getCountry();\n\t\t\t$aOBFields['order[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t}\n\n\t\t// items\n\t\tif (!empty($items))\n\t\t{\n\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t{\n\t\t\t\t$aOBFields['order_item['.$nCount.'][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][name]'] = $items[$nCount]->getName();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][price]'] = self::_currencyAmount($items[$nCount]->getPrice());\n\t\t\t\t$aOBFields['order_item['.$nCount.'][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][tax]'] = self::_currencyAmount($items[$nCount]->getTaxAmount());\n\t\t\t}\n\t\t}\n\n\t\t// return URLs\n\t\t$aOBFields['return_url'] = Mage::getUrl('hostedpayments/standard/success', array('_secure' => true));\n\t\t$aOBFields['cancel_url'] = Mage::getUrl('hostedpayments/standard/cancel', array('_secure' => true));\n\n\t\t// check to see if the aheadWorks SARP module is being used and is enabled. if it is then we need to\n\t\t// add additional fields to the post fields array\n\t\tif($this->_isUsingSARP() === true)\n\t\t{\n\t\t\tMage::log(\"is using SARP \");\n\n\t\t\t$aSubscriptionIDs = array();\n\t\t\t$aSubscriptionIDs = $this->_getSubscriptionByOrderID($this->getOrder()->getId());\n\n\t\t\t/*\n\t\t\tforeach($aSubscriptionIDs as $nID)\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($nID);\n\t\t\t}\n\t\t\t*/\n\n\t\t\tif(!empty($aSubscriptionIDs))\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($aSubscriptionIDs[0]);\n\t\t\t\t$dStartDate = new Zend_Date($oSubscription->getNextSubscriptionEventDate($oSubscription->getDateStart()), Zend_Date::DATE_LONG);\n\t\t\t\t$nTotalOccurrences = 0;\n\n\t\t\t\tif($oSubscription->isInfinite())\n\t\t\t\t\t$nTotalOccurrences = 9999;\n\t\t\t\telse\n\t\t\t\t\t$nTotalOccurrences = Mage::getModel('sarp/sequence')->getCollection()->addSubscriptionFilter($oSubscription)->count();\n\n\t\t\t\t//Mage::log(\"Subscription ID: \" . $aSubscriptionIDs[0]);\n\t\t\t\t//Mage::log(\"Subscription Inerval: \" . $oSubscription->getPeriod()->getPeriodType().\"s\");\n\t\t\t\t//Mage::log(\"Subscription Occurences: \" . $nTotalOccurrences);\n\n\t\t\t\t$aOBFields['sub[auto_process]'] = 0;\n\t\t\t\t$aOBFields['sub[start_date]'] = $dStartDate;\n\t\t\t\t$aOBFields['sub[interval_length]'] = $oSubscription->getPeriod()->getPeriodValue();\n\t\t\t\t$aOBFields['sub[interval_unit]'] = $oSubscription->getPeriod()->getPeriodType().\"s\";\n\t\t\t\t$aOBFields['sub[total_occurrences]'] = $nTotalOccurrences;\n\n\t\t\t\t$aOBFields['sub[trial_occurrences]'] = '';\n\t\t\t\t$aOBFields['sub[trial_amount]'] = 0.00;\n\n\t\t\t\t// order header\n\t\t\t\t$aOBFields['sub[merchant_subscription_id]'] = $this->getOrder()->getRealOrderId();\n\t\t\t\t//$aOBFields['sub[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\n\t\t\t\t// grand total should be the normal price not the first period price\n\n\t\t\t\t$aOBFields['sub[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t\t\t$aOBFields['sub[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t\t\t$aOBFields['sub[ship_method]'] = '';\n\t\t\t\t$aOBFields['sub[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\n\t\t\t\t// billing fields\n\t\t\t\t$aOBFields['sub[billto_company]'] = $billing->getCompany();\n\t\t\t\t$aOBFields['sub[billto_first_name]'] = $billing->getFirstname();\n\t\t\t\t$aOBFields['sub[billto_last_name]'] = $billing->getLastname();\n\t\t\t\t$aOBFields['sub[billto_address1]'] = $billing->getStreet1();\n\t\t\t\t$aOBFields['sub[billto_address2]'] = $billing->getStreet2();\n\t\t\t\t$aOBFields['sub[billto_city]'] = $billing->getCity();\n\t\t\t\t$aOBFields['sub[billto_state]'] = $billing->getRegionCode();\n\t\t\t\t$aOBFields['sub[billto_country]'] = $billing->getCountry();\n\t\t\t\t$aOBFields['sub[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t\t\t// shipping fields\n\t\t\t\tif(!empty($shipping))\n\t\t\t\t{\n\t\t\t\t\t$aOBFields['sub[shipto_company]'] = $shipping->getCompany();\n\t\t\t\t\t$aOBFields['sub[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t\t\t$aOBFields['sub[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t\t\t$aOBFields['sub[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t\t\t$aOBFields['sub[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t\t\t$aOBFields['sub[shipto_city]'] = $shipping->getCity();\n\t\t\t\t\t$aOBFields['sub[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t\t\t$aOBFields['sub[shipto_country]'] = $shipping->getCountry();\n\t\t\t\t\t$aOBFields['sub[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t\t\t}\n\n\t\t\t\t$items = $this->getOrder()->getAllItems();\n\t\t\t\t$nCount = 0;\n\t\t\t\t$nSubCount = 0;\n\t\t\t\t$aOBFields['sub[total_subtotal]'] = 0;\n\t\t\t\t$aOBFields['sub[total]'] = 0;\n\n\t\t\t\t// items\n\t\t\t\tif (!empty($items))\n\t\t\t\t{\n\t\t\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t\t\t{\n\t\t\t\t\t\t$oItem = $items[$nCount];\n\n\t\t\t\t\t\tif(Mage::helper('sarp')->isSubscriptionType($items[$nCount]) == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$productId = $oItem->getProductId();\n\t\t\t\t\t\t\t$oProduct = Mage::getModel('catalog/product')->load($productId);\n\t\t\t\t\t\t\t$nFirstPeriodPrice = self::_currencyAmount($oProduct->getAwSarpFirstPeriodPrice());\n\t\t\t\t\t\t\t$nNormalPrice = self::_currencyAmount((!empty($nFirstPeriodPrice) ? $oProduct->getAwSarpSubscriptionPrice() : $items[$nCount]->getPrice()));\n\n\t\t\t\t\t\t\tMage::log(\"Normal Price:\" . $nNormalPrice);\n\t\t\t\t\t\t\tMage::log(\"First Period Price:\" . $nFirstPeriodPrice);\n\n\t\t\t\t\t\t\tif ($oItem->canInvoice()) $qtys[$oItem->getId()] = $oItem->getQtyToInvoice();\n\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][name]'] = $items[$nCount]->getName();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][price]'] = $nNormalPrice;\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t\t\t\t//$aOBFields['sub_item[' . $nSubCount . '][details]'] = '';\n\n\t\t\t\t\t\t\tif ($oItem->getIsVirtual())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = 0.00;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t$aOBFields['sub[trial_amount]'] = $nFirstPeriodPrice;\n\t\t\t\t\t\t\t*/\n\n\t\t\t\t\t\t\t$aOBFields['sub[total_subtotal]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\t\t\t\t\t\t\t$aOBFields['sub[total]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\n\t\t\t\t\t\t\t$nSubCount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tMage::log(\"Not a subscription item: \" . $items[$nCount]->getName());\n\t\t\t\t\t}\n\t\t\t\t\tMage::log(\"Sub. Sub Total: \" . $aOBFields['sub[total_subtotal]']);\n\t\t\t\t\tMage::log(\"Sub. Total: \" . $aOBFields['sub[total]']);\n\t\t\t\t}\n\n\t\t\t\t$aOBFields['sub[total]'] = $aOBFields['sub[total]'] + $aOBFields['sub[total_shipping]'];\n\t\t\t}\n\t\t}\n\n\t\t// generate the MAC and add it as the final param\n\t\t$aOBFields['mac'] = $this->getFormFieldsMAC($aOBFields);\n\n\t\tMage::log(print_r($aOBFields, true));\n\n\t\treturn $aOBFields;\n\t}",
"abstract public function get_gateway_form_fields();",
"public function getFormFields() {\r\r\n\r\r\n $billing = $this->getOrder()->getBillingAddress();\r\r\n $shipping = $this->getOrder()->getShippingAddress();\r\r\n $addr_entity_id = $shipping->getCustomerAddressId();\r\r\n $shippingaddress = Mage::getModel('sales/order_address');\r\r\n $shippingaddress->load($addr_entity_id);\r\r\n $shipaddgetdat = $shippingaddress->getData();\r\r\n\r\r\n\r\r\n\r\r\n $biladdr_entity_id = $billing->getCustomerAddressId();\r\r\n ;\r\r\n $billingaddress = Mage::getModel('sales/order_address');\r\r\n $billingaddress->load($biladdr_entity_id);\r\r\n $billaddgetdat = $billingaddress->getData();\r\r\n\r\r\n $coFields = array();\r\r\n $items = $this->getQuote()->getAllItems();\r\r\n\r\r\n if ($items) {\r\r\n $i = 1;\r\r\n foreach ($items as $item) {\r\r\n if ($item->getParentItem()) {\r\r\n continue;\r\r\n }\r\r\n $coFields['c_prod_' . $i] = $this->cleanString($item->getSku());\r\r\n $coFields['c_name_' . $i] = $this->cleanString($item->getName());\r\r\n $coFields['c_description_' . $i] = $this->cleanString($item->getDescription());\r\r\n $coFields['c_price_' . $i] = number_format($item->getPrice(), 2, '.', '');\r\r\n $i++;\r\r\n }\r\r\n }\r\r\n\r\r\n $request = '';\r\r\n foreach ($coFields as $k => $v) {\r\r\n $request .= '<' . $k . '>' . $v . '</' . $k . '>';\r\r\n }\r\r\n\r\r\n\r\r\n $key = Mage::getStoreConfig('payment/payucheckout_shared/key');\r\r\n $salt = Mage::getStoreConfig('payment/payucheckout_shared/salt');\r\r\n $debug_mode = Mage::getStoreConfig('payment/payucheckout_shared/debug_mode');\r\r\n\r\r\n $orderid = $this->getOrder()->getRealOrderId();\r\r\n $orderInfo = $this->getOrder();\r\r\n $order = Mage::getModel('sales/order')->loadByIncrementId($orderid);\r\r\n// get order total value\r\r\n $orderValue = number_format($order->getGrandTotal(), 2, '.', $thousands_sep = '');\r\r\n// get order item collection\r\r\n $orderItems = $order->getItemsCollection();\r\r\n $productInfo = array();\r\r\n $productInfo2 = array();\r\r\n \r\r\n \r\r\n foreach ($orderItems as $item) {\r\r\n \r\r\n $item->getName();\r\r\n $product_id = $item->product_id;\r\r\n $product_sku = $item->sku;\r\r\n $product_name = $item->getName();\r\r\n $_product = Mage::getModel('catalog/product')->load($product_id);\r\r\n $cats = $_product->getCategoryIds();\r\r\n $category_id = $cats[0]; // just grab the first id\r\r\n $category = Mage::getModel('catalog/category')->load($category_id);\r\r\n $category_name = $category->getName();\r\r\n\r\r\n $productInfo['name'] = $this->cleanString($item->getName());\r\r\n $productInfo['description'] = $this->cleanString(substr($_product->getDescription(),0,100));\r\r\n $productInfo['value'] = $orderValue;\r\r\n $productInfo['isRequired'] = true;\r\r\n $productInfo['settlementEvent'] = \"EmailConfirmation\";\r\r\n $productInfo2[] = $productInfo;\r\r\n }\r\r\n $productIndoFilterData['paymentParts'] = $productInfo2;\r\r\n $jsonProductInfo = json_encode($productIndoFilterData);\r\r\n\r\r\n $txnid = $orderid;\r\r\n\r\r\n $coFields['key'] = $key;\r\r\n $coFields['txnid'] = $txnid;\r\r\n $coFields['udf2'] = $txnid;\r\r\n $coFields['amount'] = number_format($this->getOrder()->getBaseGrandTotal(), 0, '', '');\r\r\n $coFields['productinfo'] = $jsonProductInfo;\r\r\n $coFields['address'] = $billaddgetdat['street'];\r\r\n $coFields['firstname'] = $billing->getFirstname();\r\r\n $coFields['Lastname'] = $billing->getLastname();\r\r\n $coFields['City'] = $billing->getCity();\r\r\n $coFields['State'] = $billing->getRegion();\r\r\n $coFields['Country'] = $billing->getCountry();\r\r\n $coFields['Zipcode'] = $billing->getPostcode();\r\r\n $coFields['email'] = $this->getOrder()->getCustomerEmail();\r\r\n $coFields['phone'] = $billing->getTelephone();\r\r\n\r\r\n $coFields['ship_name'] = $shipping->getFirstname() . \" \" . $shipping->getLastname();\r\r\n $coFields['ship_address'] = $shipaddgetdat['street'];\r\r\n $coFields['ship_zipcode'] = $shipping->getPostcode();\r\r\n $coFields['ship_city'] = $shipping->getCity();\r\r\n $coFields['ship_state'] = $shipping->getRegion();\r\r\n $coFields['ship_country'] = $shipping->getCountry();\r\r\n $coFields['ship_phone'] = $shipping->getTelephone();\r\r\n $coFields['website'] = Mage::getBaseUrl();\r\r\n $coFields['surl'] = Mage::getBaseUrl() . 'payucheckout/shared/success/';\r\r\n $coFields['furl'] = Mage::getBaseUrl() . 'payucheckout/shared/failure/';\r\r\n $coFields['curl'] = Mage::getBaseUrl() . 'payucheckout/shared/canceled/id/' . $this->getOrder()->getRealOrderId();\r\r\n $coFields['Pg'] = $billing->getpg();\r\r\n $coFields['bankcode'] = $billing->getbankcode();\r\r\n $coFields['ccnum'] = $billing->getccnum();\r\r\n $coFields['ccvv'] = $billing->getccvv();\r\r\n $coFields['ccexpmon'] = $billing->getccexpmon();\r\r\n $coFields['ccexpyr'] = $billing->getccexpyr();\r\r\n $coFields['ccname'] = $billing->getccname();\r\r\n $coFields['service_provider'] = 'payu_paisa';\r\r\n\r\r\n $debugId = '';\r\r\n \r\r\n\r\r\n if ($debug_mode == 1) {\r\r\n\r\r\n $requestInfo = $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '||||||||||' . $salt;\r\r\n $debug = Mage::getModel('payucheckout/api_debug')\r\r\n ->setRequestBody($requestInfo)\r\r\n ->save();\r\r\n\r\r\n $debugId = $debug->getId();\r\r\n\r\r\n $coFields['udf1'] = $debugId;\r\r\n $coFields['Hash'] = hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '|' . $coFields['udf2'] . '|||||||||' . $salt);\r\r\n } else {\r\r\n $coFields['Hash'] = strtolower(hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '||' . $coFields['udf2'] . '|||||||||' . $salt));\r\r\n }\r\r\n return $coFields;\r\r\n }",
"public function getFormFields()\n {\n $order_id = $this->getOrder()->getRealOrderId();\n $billing = $this->getOrder()->getBillingAddress();\n if ($this->getOrder()->getBillingAddress()->getEmail()) {\n $email = $this->getOrder()->getBillingAddress()->getEmail();\n } else {\n $email = $this->getOrder()->getCustomerEmail();\n }\n\n $params = array(\n 'merchant_fields' => 'partner',\n 'partner' => 'magento',\n 'pay_to_email' => Mage::getStoreConfig(Paynova_Paynovapayment_Helper_Data::XML_PATH_EMAIL),\n 'transaction_id' => $order_id,\n 'return_url' => Mage::getUrl('paynovapayment/processing/success', array('transaction_id' => $order_id)),\n 'cancel_url' => Mage::getUrl('paynovapayment/processing/cancel', array('transaction_id' => $order_id)),\n 'status_url' => Mage::getUrl('paynovapayment/processing/status'),\n 'language' => $this->getLocale(),\n 'amount' => round($this->getOrder()->getGrandTotal(), 2),\n 'currency' => $this->getOrder()->getOrderCurrencyCode(),\n 'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),\n 'firstname' => $billing->getFirstname(),\n 'lastname' => $billing->getLastname(),\n 'address' => $billing->getStreet(-1),\n 'postal_code' => $billing->getPostcode(),\n 'city' => $billing->getCity(),\n 'country' => $billing->getCountryModel()->getIso3Code(),\n 'pay_from_email' => $email,\n 'phone_number' => $billing->getTelephone(),\n 'detail1_description' => Mage::helper('paynovapayment')->__('Order ID'),\n 'detail1_text' => $order_id,\n 'payment_methods' => $this->_paymentMethod,\n 'hide_login' => $this->_hidelogin,\n 'new_window_redirect' => '1'\n );\n\n // add optional day of birth\n if ($billing->getDob()) {\n $params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');\n }\n\n return $params;\n }",
"protected function addCommonFields(Container &$form, $args = null)\n {\n $form->addText('title', 'title of song:')\n ->addRule(Form::FILLED, 'Mandatory field - Title');\n $form->addTextArea('text', 'lyrics:')\n ->addRule(Form::FILLED, 'Mandatory field - Lyrics');\n $form->addText('artist', 'artist:')\n ->addRule(Form::FILLED, 'Mandatory field - Artist');\n $form->addSubmit('send', 'Save');\n }",
"function add_specific_form_fields() {\n\t\treturn false;\n\t}",
"function init_form_fields() {\n\n \tinclude ( SUMO_SAGEPLUGINPATH . 'includes/sagepay-form-admin.php' );\n\n }",
"private function getConfigurationFields($oForm)\n {\n $oForm->setWidgets(\n\t\t\tarray(\n\t\t\t\t\t'cem_cemetery_id' \t=> __('Select Cemetery'),\n\t\t\t\t\t'country_id'\t\t=> __('Select Country'),\n\t\t\t\t )\n\t\t);\n\n $oForm->setLabels(\n array(\n\t\t\t\t'country_id' \t=> __('Country'),\n\t\t\t\t'cem_cemetery_id' \t=> __('Cemetery'),\n 'import_file' => __('Select File')\n )\n );\n\n $oForm->setValidators(\n array(\n\t\t\t\t\t'import_file' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select file'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'invalid' => __('Please select only EXCEL and CSV file'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'maxsize' => __('The file size is too large')\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'country_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select country')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'cem_cemetery_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select cemetery')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t)\n );\n }",
"private function getConfigurationFields($oForm)\n {\n $oForm->setWidgets(\n\t\t\tarray(\n\t\t\t\t\t'date_next'\t=> __('Next'),\n\t\t\t\t\t'date_prev'\t=> __('Previous'),\n\t\t\t\t\t'cem_id' => __('Select Cemetery'),\n\t\t\t\t\t\n\t\t\t\t\t'grantee_identity_id' => __('Select Grantee Identity')\n\t\t\t\t )\n\t\t);\n\n $oForm->setLabels(\n array(\n\t\t\t\t'cem_id' => __('Select Cemetery'),\n 'grantee_first_name' \t \t=> __('Grantee First Name'),\n 'grantee_middle_name'\t\t=> __('Grantee Middle Name'),\n 'grantee_surname' \t\t\t=> __('Grantee Surname'),\n 'grantee_relationship' \t=> __('Grantee Relationship'),\n 'grantee_address' \t\t\t=> __('Grantee Address'),\n 'grantee_dob'\t\t\t\t=> __('Grantee DOB'),\n 'grantee_id_number' \t\t=> __('Grantee Id Number'),\n 'town' \t\t\t\t\t=> __('Suburb/Town'),\n 'phone' \t\t\t\t\t=> __('Telephone'),\n\t\t\t\t'contact_mobile' \t\t\t=> __('Mobile'),\n 'grantee_email'\t\t\t\t=> __('Grantee Email'),\n\t\t\t\t'postal_code' \t\t\t\t=> __('Postal Code'),\n\t\t\t\t'area_code' \t\t\t\t=> __('Telephone Area Code'),\n\t\t\t\t'fax_area_code' \t\t\t=> __('Fax Area Code'),\n 'remarks_1' \t\t\t\t=> __('Remarks 1'),\n 'remarks_2' \t\t\t\t=> __('Remarks 2'),\n\t\t\t\t'grantee_identity_id' \t\t=> __('Grantee Identity'),\n 'grantee_identity_number'\t=> __('Grantee Identity Number'),\n\t\t\t\t'date_of_purchase'\t\t\t=> __('Tenure From'),\n\t\t\t\t'tenure_expiry_date'\t\t=> __('Tenure To')\n )\n );\n\n $oForm->setValidators(\n array(\n\t\t\t\t\t'cem_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select cemetery')\n\t\t\t\t\t\t\t\t\t\t\t), \n\t 'grantee_first_name'\t=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please enter grantee first name')\n\t\t\t\t\t\t\t\t\t\t\t),\n\t 'grantee_middle_name'\t=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please enter grantee middle name')\n\t\t\t\t\t\t\t\t\t\t\t),\n\t 'grantee_surname'\t=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please enter grantee surname')\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t'grantee_email'\t=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t'invalid' => __('Please enter valid email')\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t'tenure_expiry_date' \t=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t'invalid' => __('Tenure To date must be grater than Tenure From')\n\t\t\t\t\t\t\t\t\t\t\t\t), \n\t\t\t\t)\n );\n }",
"public function getFormFields($order, $requestParams)\n {\n if (empty($order)) {\n if (!($order = $this->getOrder())) {\n return array();\n }\n }\n $payment = $order->getPayment()->getMethodInstance();\n $formFields = array();\n $formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());\n $formFields['AMOUNT'] = $this->getHelper()->getAmount($order->getBaseGrandTotal());\n $formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();\n $formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order);\n $formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();\n $formFields['PM'] = $payment->getOpsCode($order->getPayment());\n $formFields['EMAIL'] = $order->getCustomerEmail();\n\n $methodDependendFields = $this->getMethodDependendFormFields($order, $requestParams);\n if (is_array($methodDependendFields)) {\n $formFields = array_merge($formFields, $methodDependendFields);\n }\n\n $paymentAction = $this->_getOPSPaymentOperation();\n if ($paymentAction ) {\n $formFields['OPERATION'] = $paymentAction;\n }\n\n\n if ($this->getConfig()->getConfigData('template')=='ops') {\n $formFields['TP']= '';\n $formFields['PMLISTTYPE'] = $this->getConfig()->getConfigData('pmlist');\n } else {\n $formFields['TP']= $this->getConfig()->getPayPageTemplate();\n }\n $formFields['TITLE'] = $this->getConfig()->getConfigData('html_title');\n $formFields['BGCOLOR'] = $this->getConfig()->getConfigData('bgcolor');\n $formFields['TXTCOLOR'] = $this->getConfig()->getConfigData('txtcolor');\n $formFields['TBLBGCOLOR'] = $this->getConfig()->getConfigData('tblbgcolor');\n $formFields['TBLTXTCOLOR'] = $this->getConfig()->getConfigData('tbltxtcolor');\n $formFields['BUTTONBGCOLOR'] = $this->getConfig()->getConfigData('buttonbgcolor');\n $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor');\n $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype');\n $formFields['LOGO'] = $this->getConfig()->getConfigData('logo');\n $formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'home')) : 'NONE';\n $formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'catalog')) : '';\n $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();\n $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();\n $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();\n $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();\n $formFields['BACKURL'] = $this->getConfig()->getCancelUrl();\n\n $shaSign = Mage::helper('ops/payment')->shaCrypt(Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()));\n\n $helper = Mage::helper('ops');\n $helper->log($helper->__(\"Register Order %s in Ingenico Payment Services \\n\\nAll form fields: %s\\nIngenico Payment Services String to hash: %s\\nHash: %s\",\n $order->getIncrementId(),\n serialize($formFields),\n Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()),\n $shaSign\n ));\n\n $formFields['SHASIGN'] = $shaSign;\n return $formFields;\n }",
"private function getConfigurationFieldsForCustomCemetery($oForm)\n {\n $oForm->setWidgets(\n\t\t\tarray(\n\t\t\t\t\t'cem_cemetery_id' \t=> __('Select Cemetery'),\n\t\t\t\t\t'country_id'\t\t=> __('Select Country'),\n\t\t\t\t )\n\t\t);\n\t\t\n\t\tif(sfContext::getInstance()->getRequest()->getParameter('back'))\n\t\t\t$oForm->setDefault('country_id', $this->getUser()->getAttribute('countryid'));\n\n $oForm->setLabels(\n array(\n\t\t\t\t'country_id' \t=> __('Country'),\n\t\t\t\t'cem_cemetery_id' \t=> __('Cemetery'),\n )\n );\n\n $oForm->setValidators(\n array(\n \t 'country_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select country')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'cem_cemetery_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select cemetery')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t)\n );\n }",
"private function getConfigurationFields($oForm)\n {\n $oForm->setWidgets(\n\t\t\tarray(\n\t\t\t\t\t'country_id' => __('Select Country'),\n\t\t\t\t\t'cem_cemetery_id' => __('Select Cemetery'),\n\t\t\t\t )\n\t\t);\n\n $oForm->setLabels(\n array(\n\t\t\t\t'country_id' => __('Select Country'),\n\t\t\t\t'cem_cemetery_id' => __('Select Cemetery'),\n 'area_name' => __('Area Name'),\n 'area_code' => __('Area Code'),\n 'area_description' => __('Area Description'),\n 'area_control_numberr'\t=> __('Area Control Number'),\n 'area_user' => __('Area User'),\n 'is_enabled' \t\t=> __('Enabled')\n )\n );\n\n $oForm->setValidators(\n array(\n\t 'area_name' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please enter area name')\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t'area_code' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please enter area code')\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'country_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select country')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'cem_cemetery_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select cemetery')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t)\n );\n }",
"function init_form_fields() {\n \n \t$this->form_fields = array(\n\t\t\t'enabled' => array(\n\t\t\t\t'title' => __( 'Enable/Disable', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'label' => __( 'Enable Authorize.Net SIM Payment Module', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'description' => '', \n\t\t\t\t'default' => 'no'\n\t\t\t), \n\t\t\t'title' => array(\n\t\t\t\t'title' => __( 'Title' ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This controls the title which the user sees during checkout.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => __( 'Authorize.net SIM', WC_Authorize_SIM::TEXT_DOMAIN ),\n\t\t\t\t'css' => \"width: 300px;\"\n\t\t\t), \n\t\t\t'description' => array(\n\t\t\t\t'title' => __( 'Description', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'textarea', \n\t\t\t\t'description' => __( 'This controls the description which the user sees during checkout.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'Pay with your credit card via Authorize.net.'\n\t\t\t),\n\t\t\t'debug' => array(\n\t\t\t\t'title' => __( 'Debug', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'label' => __( 'Enable logging (<code>woocommerce/logs/authorize_sim.txt</code>)', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'no'\n\t\t\t),\n\t\t\t'testmode' => array(\n\t\t\t\t'title' => __( 'Test mode', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'label' => __( 'Test Mode allows you to submit test transactions to the payment gateway', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'checkbox', \n\t\t\t\t'description' => __( 'You may want to set to true if testing against production', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => 'no'\n\t\t\t), \n\t\t\t'login_id' => array(\n\t\t\t\t'title' => __( 'API Login ID', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This is API Lgoin supplied by Authorize.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t), \n\t\t\t'tran_key' => array(\n\t\t\t\t'title' => __( 'Transaction Key', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'This is Transaction Key supplied by Authorize.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t),\n\t\t\t'md5_hash' => array(\n\t\t\t\t'title' => __( 'MD5 Hash', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'text', \n\t\t\t\t'description' => __( 'The MD5 hash value to verify transactions', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'default' => ''\n\t\t\t),\n\t\t\t'type' => array(\n\t\t\t\t'title' => __( 'Sale Method', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'select', \n\t\t\t\t'description' => __( 'Select which sale method to use. Authorize Only will authorize the customers card for the purchase amount only. Authorize & Capture will authorize the customer\\'s card and collect funds.', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'options' => array(\n\t\t\t\t\t'AUTH_CAPTURE'=>'Authorize & Capture',\n\t\t\t\t\t'AUTH_ONLY'=>'Authorize Only'\n\t\t\t\t),\n\t\t\t\t'default' => 'AUTH_CAPTURE'\n\t\t\t),\n\t\t\t'tran_mode' => array(\n\t\t\t\t'title' => __( 'Transaction Mode', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'type' => 'select', \n\t\t\t\t'description' => __( 'Transaction mode used for processing orders', WC_Authorize_SIM::TEXT_DOMAIN ), \n\t\t\t\t'options' => array('live'=>'Live', 'sandbox'=>'Sandbox'),\n\t\t\t\t'default' => 'live'\n\t\t\t),\n\t\t\t\n\t\t);\n }",
"function init_form_fields() {\n $enabled_field = array(\n 'title' => __('Enable/Disable', 'wcis'),\n 'type' => 'checkbox',\n 'label' => __('Enable Indo Shipping', 'wcis'),\n 'default' => 'yes'\n );\n\n $key_field = array(\n 'title' => __('API Key', 'wcis'),\n 'type' => 'text',\n 'description' => __('Signup at <a href=\"http://rajaongkir.com/akun/daftar\" target=\"_blank\">rajaongkir.com</a> and choose Pro license (Paid). Paste the API Key here', 'wcis'),\n );\n\n $city_field = array(\n 'title' => __('City Origin', 'wcis'),\n 'type' => 'select',\n // 'class' => 'wc-enhanced-select', // bugged!! doesn't save the value\n 'description' => __('Ship from where? <br> Change your province at General > Base Location <br> Save this to refresh the City selection', 'wcis'),\n 'options' => array()\n );\n\n $this->form_fields = array(\n 'key' => $key_field\n );\n\n // if key is valid, show the other setting fields\n if($this->check_key_valid() ) {\n $city_field['options'] = $this->get_cities_origin();\n\n $this->form_fields['enabled'] = $enabled_field;\n $this->form_fields['city'] = $city_field;\n\n // set service fields by each courier\n $couriers = WCIS_Data::get_couriers();\n foreach($couriers as $id => $name) {\n $this->form_fields[$id . '_services'] = array(\n 'title' => $name,\n 'type' => 'multiselect',\n 'class' => 'wc-enhanced-select',\n 'description' => __(\"Choose allowed services by { $name }.\", 'wcis'),\n 'options' => WCIS_Data::get_services($id, true)\n );\n }\n\n } // if valid\n }",
"public function init_form_fields() {\n\n $gatewayids = $this->get_gatewayids();\n $this->form_fields = apply_filters( 'wc_fabric_form_fields', array(\n 'enabled' => array(\n 'title' => 'Enable/Disable',\n 'type' => 'checkbox',\n 'label' => 'Enable PayFabric',\n 'default' => 'yes',\n ),\n 'title' => array(\n 'title' => 'Title',\n 'type' => 'text',\n 'description' => '',\n 'default' => 'PayFabric',\n 'desc_tip' => true,\n ),\n 'description' => array(\n 'title' => 'Description',\n 'type' => 'textarea',\n 'description' => '',\n 'default' => 'Description here',\n 'desc_tip' => true,\n ),\n 'instructions' => array(\n 'title' => 'Instructions',\n 'type' => 'textarea',\n 'description' => '',\n 'default' => 'Instructions here',\n 'desc_tip' => true,\n ),\n 'deviceId' => array(\n 'title' => 'Device ID',\n 'type' => 'text',\n 'description' => '',\n 'default' => '',\n 'desc_tip' => true,\n ),\n 'password' => array(\n 'title' => 'Device Password',\n 'type' => 'password',\n 'description' => '',\n 'default' => '',\n 'desc_tip' => true,\n ),\n 'gatewayid' => array(\n 'title' => 'Gateway Account Name',\n 'type' => 'select',\n 'description' => 'Required set Device ID and Password',\n 'default' => '',\n 'desc_tip' => true,\n 'options' => $gatewayids,\n ),\n 'book' => array(\n 'title' => 'Book',\n 'type' => 'checkbox',\n 'default' => 'no',\n 'description' => 'Enable Pre-Authorization Only',\n ),\n 'production' => array(\n 'title' => 'Production',\n 'type' => 'checkbox',\n 'default' => 'no',\n 'description' => 'Enable Production',\n ),\n ));\n }",
"public static function get_common_fields() {\n $fields = null;\n $metaboxes_to_compare = apply_filters( 'inventor_compare_metaboxes', array(\n 'details', 'color', 'listing_category',\n 'date', 'time', 'date_interval', 'datetime_interval',\n 'time_interval', 'date_and_time_interval') );\n\n $ignored_fields = apply_filters( 'inventor_compare_ignored_fields', array(\n INVENTOR_LISTING_PREFIX . 'map_location',\n INVENTOR_LISTING_PREFIX . 'map_location_polygon',\n INVENTOR_LISTING_PREFIX . 'street_view',\n INVENTOR_LISTING_PREFIX . 'street_view_location',\n INVENTOR_LISTING_PREFIX . 'inside_view',\n INVENTOR_LISTING_PREFIX . 'inside_view_location',\n INVENTOR_LISTING_PREFIX . 'metabox_general_title',\n ) );\n\n $compare = self::get_comparison_list();\n\n foreach( $compare as $lising_id ) {\n $post_type = get_post_type( $lising_id );\n $post_type_metaboxes = Inventor_Metaboxes::get_for_post_type( $post_type );\n\n $post_type_fields = array();\n\n foreach( $post_type_metaboxes as $metabox_id => $cmb ) {\n $metabox_key = Inventor_Metaboxes::get_metabox_key( $metabox_id, $post_type );\n\n if ( ! in_array( $metabox_key, $metaboxes_to_compare ) ) {\n continue;\n }\n\n foreach ( $cmb->meta_box['fields'] as $field_id => $field_attrs ) {\n if( isset( $field_attrs['name'] ) && ! in_array( $field_id, $ignored_fields ) ) {\n $field_name = esc_attr( $field_attrs['name'] );\n $post_type_fields[ $field_id ] = $field_name;\n }\n }\n }\n\n if ( $fields === null ) {\n $fields = $post_type_fields;\n } else {\n // TODO: add customization settings: inventor_compare_policy: common fields, all fields\n// $fields = array_merge( $fields, $post_type_fields );\n $fields = array_intersect_assoc( $fields, $post_type_fields );\n }\n }\n\n return $fields === null ? array() : $fields;\n }",
"public function init_form_fields() {\n\t\t$this->form_fields = array_merge(\n\t\t\tarray(\n\t\t\t\t'enabled' => array(\n\t\t\t\t\t'title' => __( 'Enable/Disable', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t\t'label' => __( 'Enable Gateway', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'default' => 'no',\n\t\t\t\t),\n\t\t\t\t'title' => array(\n\t\t\t\t\t'title' => __( 'Title', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'description' => __( 'This controls the title which the user sees during checkout.', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'default' => __( 'Credit Card', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'desc_tip' => true,\n\t\t\t\t),\n\t\t\t),\n\t\t\t$this->get_gateway_form_fields(),\n\t\t\tarray(\n\t\t\t\t'payment_action' => array(\n\t\t\t\t\t'title' => __( 'Payment Action', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t'description' => __( 'Choose whether you wish to capture funds immediately, authorize payment only for a delayed capture, or verify and capture when the order ships.', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'default' => 'sale',\n\t\t\t\t\t'desc_tip' => true,\n\t\t\t\t\t'options' => array(\n\t\t\t\t\t\tself::TXN_TYPE_SALE => __( 'Authorize + Capture', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t\tself::TXN_TYPE_AUTHORIZE => __( 'Authorize only', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t\tself::TXN_TYPE_VERIFY => __( 'Verify only', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\t'allow_card_saving' => array(\n\t\t\t\t\t'title' => __( 'Allow Card Saving', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'label' => __( 'Allow Card Saving', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t\t'description' => sprintf(\n\t\t\t\t\t\t/* translators: %s: Email address of support team */\n\t\t\t\t\t\t__( 'Note: to use the card saving feature, you must have multi-use token support enabled on your account. Please contact <a href=\"mailto:%s?Subject=WooCommerce%%20Transaction%%20Descriptor%%20Option\">support</a> with any questions regarding this option.', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t\t$this->get_first_line_support_email()\n\t\t\t\t\t),\n\t\t\t\t\t'default' => 'no',\n\t\t\t\t),\n\t\t\t\t'txn_descriptor' => array(\n\t\t\t\t\t'title' => __( 'Order Transaction Descriptor', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'description' => sprintf(\n\t\t\t\t\t\t/* translators: %s: Email address of support team */\n\t\t\t\t\t\t__( 'During a Capture or Authorize payment action, this value will be passed along as the transaction-specific descriptor listed on the customer\\'s bank account. Please contact <a href=\"mailto:%s?Subject=WooCommerce%%20Transaction%%20Descriptor%%20Option\">support</a> with any questions regarding this option.', 'globalpayments-gateway-provider-for-woocommerce' ),\n\t\t\t\t\t\t$this->get_first_line_support_email()\n\t\t\t\t\t),\n\t\t\t\t\t'default' => '',\n\t\t\t\t\t'class' => 'txn_descriptor',\n\t\t\t\t\t'custom_attributes' => array(\n\t\t\t\t\t\t'maxlength' => 18,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t)\n\t\t);\n\t}",
"public function getFrontEndRequiredFields();",
"public function init_form_fields(){\n \n $this->form_fields = apply_filters( 'wc_pay_on_credit_form_fields', array(\n 'enabled' => array(\n 'title' => __( 'Enable/Disable', $this->domain ),\n 'type' => 'checkbox',\n 'label' => __( 'Enable Pay On Credit', $this->domain ),\n 'default' => 'yes'\n ),\n 'title' => array(\n 'title' => __( 'Title', $this->domain ),\n 'type' => 'text',\n 'description' => __( 'This controls the title for the payment method the customer sees during checkout.', $this->domain ),\n 'default' => __( 'Pay On Credit', $this->domain ),\n 'desc_tip' => true,\n ),\n 'description' => array(\n 'title' => __( 'Description', $this->domain ),\n 'type' => 'textarea',\n 'description' => __( 'Payment method description that the customer will see on your checkout.', $this->domain ),\n 'default' => __( 'Split your cost over a period and pay', $this->domain ),\n 'desc_tip' => true,\n ),\n 'instructions' => array(\n 'title' => __( 'Instructions', $this->domain ),\n 'type' => 'textarea',\n 'description' => __( 'Instructions that will be added to the thank you page and emails.', $this->domain ),\n 'default' => '', // Empty by default\n 'desc_tip' => true,\n ),\n 'order_status' => array(\n 'title' => __( 'Order Status', $this->domain ),\n 'type' => 'select',\n 'description' => __( 'Choose whether order status you wish after checkout.', $this->domain ),\n 'default' => 'wc-completed',\n 'desc_tip' => true,\n 'class' => 'wc-enhanced-select',\n 'options' => wc_get_order_statuses()\n ),\n 'status_text' => array(\n 'title' => __( 'Order Status Text', $this->domain ),\n 'type' => 'text',\n 'description' => __( 'Set the text for the selected order status.', $this->domain ),\n 'default' => __( 'Order is completed', $this->domain ),\n 'desc_tip' => true,\n ),\n ) );\n }",
"public function init_form_fields()\n {\n $this->log(' [Info] Entered init_form_fields()...');\n $log_file = 'btcpay-' . sanitize_file_name( wp_hash( 'btcpay' ) ) . '-log';\n $logs_href = get_bloginfo('wpurl') . '/wp-admin/admin.php?page=wc-status&tab=logs&log_file=' . $log_file;\n\n $this->form_fields = array(\n 'title' => array(\n 'title' => __('Title', 'btcpay-for-woocommerce'),\n 'type' => 'text',\n 'description' => __('Controls the name of this payment method as displayed to the customer during checkout.', 'btcpay-for-woocommerce'),\n 'default' => __('Bitcoin', 'btcpay-for-woocommerce'),\n 'desc_tip' => true,\n ),\n 'description' => array(\n 'title' => __('Customer Message', 'btcpay-for-woocommerce'),\n 'type' => 'textarea',\n 'description' => __('Message to explain how the customer will be paying for the purchase.', 'btcpay-for-woocommerce'),\n 'default' => 'You will be redirected to BTCPay to complete your purchase.',\n 'desc_tip' => true,\n ),\n 'api_token' => array(\n 'type' => 'api_token'\n ),\n 'transaction_speed' => array(\n 'title' => __('Invoice pass to \"confirmed\" state after', 'btcpay-for-woocommerce'),\n 'type' => 'select',\n 'description' => 'An invoice becomes confirmed after the payment has...',\n 'options' => array(\n 'default' => 'Keep store level configuration',\n 'high' => '0 confirmation on-chain',\n 'medium' => '1 confirmation on-chain',\n 'low-medium' => '2 confirmations on-chain',\n 'low' => '6 confirmations on-chain',\n ),\n 'default' => 'default',\n 'desc_tip' => true,\n ),\n 'order_states' => array(\n 'type' => 'order_states'\n ),\n 'debug' => array(\n 'title' => __('Debug Log', 'btcpay-for-woocommerce'),\n 'type' => 'checkbox',\n 'label' => sprintf(__('Enable logging <a href=\"%s\" class=\"button\">View Logs</a>', 'btcpay-for-woocommerce'), $logs_href),\n 'default' => 'no',\n 'description' => sprintf(__('Log BTCPay events, such as IPN requests, inside <code>%s</code>', 'btcpay-for-woocommerce'), wc_get_log_file_path('btcpay')),\n 'desc_tip' => true,\n ),\n 'notification_url' => array(\n 'title' => __('Notification URL', 'btcpay-for-woocommerce'),\n 'type' => 'url',\n 'description' => __('BTCPay will send IPNs for orders to this URL with the BTCPay invoice data', 'btcpay-for-woocommerce'),\n 'default' => '',\n 'placeholder' => WC()->api_request_url('WC_Gateway_BtcPay'),\n 'desc_tip' => true,\n ),\n 'redirect_url' => array(\n 'title' => __('Redirect URL', 'btcpay-for-woocommerce'),\n 'type' => 'url',\n 'description' => __('After paying the BTCPay invoice, users will be redirected back to this URL', 'btcpay-for-woocommerce'),\n 'default' => '',\n 'placeholder' => $this->get_return_url(),\n 'desc_tip' => true,\n ),\n 'additional_tokens' => array(\n 'title' => __('Additional token configuration', 'btcpay-for-woocommerce'),\n 'type' => 'textarea',\n 'description' => __('You can configure additional tokens here, one per line. e.g. \"HAT;Hat Token;promotion\" See documentation for details. Each one will be available as their own payment method.', 'btcpay-for-woocommerce'),\n 'default' => '',\n 'desc_tip' => true,\n ),\n\t\t\t 'additional_tokens_limit_payment' => array(\n\t\t\t\t\t'title' => __('Additional tokens: Enforce payment tokens', 'btcpay-for-woocommerce'),\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t\t'label' => __('Limit default payment methods to listed \"payment\" tokens.', 'btcpay-for-woocommerce'),\n\t\t\t\t\t'default' => 'no',\n\t\t\t\t\t'value' => 'yes',\n\t\t\t\t\t'description' => __('This will override the default btcpay payment method (defaults to all supported by BTCPay Server) and enforce to tokens of type \"payment\". This is useful if you want full control on what is available on BTCPay Server payment page.', 'btcpay-for-woocommerce'),\n\t\t\t\t\t'desc_tip' => true,\n\t\t\t ),\n 'support_details' => array(\n 'title' => __( 'Plugin & Support Information', 'btcpay' ),\n 'type' => 'title',\n 'description' => sprintf(__('This plugin version is %s and your PHP version is %s. If you need assistance, please come on our chat https://chat.btcpayserver.org. Thank you for using BTCPay!', 'btcpay-for-woocommerce'), constant(\"BTCPAY_VERSION\"), PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION),\n ),\n );\n\n $this->log(' [Info] Initialized form fields: ' . var_export($this->form_fields, true));\n $this->log(' [Info] Leaving init_form_fields()...');\n }",
"public function init_form_fields() {\n\t\t\t$this->form_fields = array(\n\t\t\t\t'enabled' => array(\n\t\t\t\t\t'title' => __('Enable/Disable', 'Cointopay'),\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t\t'label' => __('Enable Cointopay', 'Cointopay'),\n\t\t\t\t\t'default' => 'yes',\n\t\t\t\t),\n\t\t\t\t'title' => array(\n\t\t\t\t\t'title' => __('Title', 'Cointopay'),\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'description' => __('This controls the title the user can see during checkout.', 'Cointopay'),\n\t\t\t\t\t'default' => __('Cointopay', 'Cointopay'),\n\t\t\t\t),\n\t\t\t\t'description' => array(\n\t\t\t\t\t'title' => __('Description', 'Cointopay'),\n\t\t\t\t\t'type' => 'textarea',\n\t\t\t\t\t'description' => __('This controls the title the user can see during checkout.', 'Cointopay'),\n\t\t\t\t\t'default' => __('You will be redirected to cointopay.com to complete your purchase.', 'Cointopay'),\n\t\t\t\t),\n\t\t\t\t'merchantid' => array(\n\t\t\t\t\t'title' => __('Your MerchantID', 'Cointopay'),\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'description' => __('Please enter your Cointopay Merchant ID, You can get this information in: <a href=\"' . esc_url( 'https://cointopay.com' ) . '\" target=\"_blank\">Cointopay Account</a>.', 'Cointopay'),\n\t\t\t\t\t'default' => '',\n\t\t\t\t),\n\t\t\t\t'secret' => array(\n\t\t\t\t\t'title' => __('SecurityCode', 'Cointopay'),\n\t\t\t\t\t'type' => 'password',\n\t\t\t\t\t'description' => __('Please enter your Cointopay SecurityCode, You can get this information in: <a href=\"' . esc_url( 'https://cointopay.com' ) . '\" target=\"_blank\">Cointopay Account</a>.', 'Cointopay'),\n\t\t\t\t\t'default' => '',\n\t\t\t\t),\n\t\t\t);\n\n\t\t}",
"function init_form_fields() {\n\n $default_site_name = home_url() ;\n\n\t\t\t$this->form_fields = array(\n\n\t\t\t\t'enabled' => array(\n\t\t\t\t\t'title' => __( 'Enable/Disable', 'woothemes' ),\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t\t'label' => __( 'Enable Payment Express', 'woothemes' ),\n\t\t\t\t\t'default' => 'yes'\n\t\t\t\t),\n\n\t\t\t\t'title' => array(\n\t\t\t\t\t'title' => __( 'Title', 'woothemes' ),\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'description' => __( 'This controls the title which the user sees during checkout.', 'woothemes' ),\n\t\t\t\t\t'default' => __( 'Payment Express', 'woothemes' ),\n\t\t\t\t\t'css' => 'width: 400px;'\n\t\t\t\t),\n\n\t\t\t\t'description' => array(\n\t\t\t\t\t'title' => __( 'Description', 'woothemes' ),\n\t\t\t\t\t'type' => 'textarea',\n\t\t\t\t\t'description' => __( 'This controls the description which the user sees during checkout.', 'woothemes' ),\n\t\t\t\t\t'default' => __(\"Allows credit card payments by Payment Express PX-Pay method\", 'woothemes')\n\t\t\t\t),\n\n\t\t\t\t'site_name' => array(\n\t\t\t\t\t//'title' => __( 'Px-Pay Access Key', 'woothemes' ),\n 'title' => 'Merchant Reference',\n 'description' => 'A name (or URL) to identify this site in the \"Merchant Reference\" field (shown when viewing transactions in the site\\'s Digital Payment Express back-end). This name <b>plus</b> the longest Order/Invoice Number used by the site must be <b>no longer than 53 characters</b>.',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'default' => $default_site_name,\n\t\t\t\t\t'css' => 'width: 400px;',\n 'custom_attributes' => array( 'maxlength' => '53' )\n ),\n\n\t\t\t\t'access_userid' => array(\n\t\t\t\t\t//'title' => __( 'Access User Id', 'woothemes' ),\n\t\t\t\t\t'title' => __( 'Px-Pay Access User ID', 'woothemes' ),\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'default' => '',\n\t\t\t\t\t'css' => 'width: 400px;'\n\t\t\t\t),\n\n\t\t\t\t'access_key' => array(\n\t\t\t\t\t//'title' => __( 'Access Key', 'woothemes' ),\n\t\t\t\t\t'title' => __( 'Px-Pay Access Key', 'woothemes' ),\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t'default' => '',\n\t\t\t\t\t'css' => 'width: 400px;'\n\t\t\t\t)\n\n\t\t\t);\n\n\t\t}",
"public function init_form_fields()\n {\n $this->form_fields = array(\n\n 'enabled' => array(\n 'title' => __('Of/Off', 'woocommerce'),\n 'type' => 'checkbox',\n 'label' => __('On', 'woocommerce'),\n 'default' => 'yes',\n ),\n\n 'title' => array(\n 'title' => __('Name of payment method', 'woocommerce'),\n 'type' => 'text',\n 'description' => __('User see this title in order checkout.', 'woocommerce'),\n 'default' => __('Paysto', 'woocommerce'),\n ),\n\n 'paysto_x_description' => array(\n 'title' => __('Comment for payment', 'woocommerce'),\n 'type' => 'text',\n 'required' => true,\n 'description' => __('Fill this field obligatory', 'woocommerce'),\n 'default' => __('Payment in my store throw Paysto payment system', 'woocommerce'),\n ),\n\n 'paysto_x_login' => array(\n 'title' => __('Code of your store', 'woocommerce'),\n 'type' => 'text',\n 'required' => true,\n 'description' => __('Please find your merchant id in merchant in Paysto merchant backoffice',\n 'woocommerce'),\n 'default' => '',\n ),\n\n 'paysto_secret' => array(\n 'title' => __('Secret', 'woocommerce'),\n 'type' => 'password',\n 'description' => __('Paysto secret word, please set it also in Paysto merchant backoffice',\n 'woocommerce'),\n 'default' => '',\n ),\n\n 'paysto_order_status' => array(\n 'title' => __('Order status', 'woocommerce'),\n 'type' => 'select',\n 'options' => wc_get_order_statuses(),\n 'description' => __('Setup order status after successfull payment', 'woocommerce'),\n ),\n\n 'paysto_vat_products' => array(\n 'title' => __('VAT for products', 'woocommerce'),\n 'type' => 'select',\n 'options' => array(\n 1 => __('With VAT', 'woocommerce'),\n 0 => __('Without VAT', 'woocommerce')\n ),\n 'description' => __('Set VAT for products in checkout', 'woocommerce'),\n 'default' => '0',\n ),\n\n 'paysto_vat_delivery' => array(\n 'title' => __('VAT for delivery', 'woocommerce'),\n 'type' => 'select',\n 'options' => array(\n 1 => __('With VAT', 'woocommerce'),\n 0 => __('Without VAT', 'woocommerce')\n ),\n 'description' => __('Set VAT for delivery in checkout', 'woocommerce'),\n 'default' => '0',\n ),\n\n 'paysto_ips_servers' => array(\n 'title' => __('IPs Addresses of Paysto callback servers', 'woocommerce'),\n 'type' => 'textarea',\n 'description' => __('This options need for security reason. Each server IP must begin in new line.',\n 'woocommerce'),\n 'default' => '95.213.209.218\n95.213.209.219\n95.213.209.220\n95.213.209.221\n95.213.209.222',\n ),\n\n 'paysto_only_from_ips' => array(\n 'title' => __('Only approved server', 'woocommerce'),\n 'type' => 'checkbox',\n 'label' => __('Use only callbacks from approved Paysto servers', 'woocommerce'),\n 'default' => 'yes',\n ),\n\n 'debug' => array(\n 'title' => __('Debug', 'woocommerce'),\n 'type' => 'checkbox',\n 'label' => __('Switch on logging in file (<code>woocommerce/logs/paysto.txt</code>)',\n 'woocommerce'),\n 'default' => 'no',\n ),\n\n 'description' => array(\n 'title' => __('Description', 'woocommerce'),\n 'type' => 'textarea',\n 'description' => __('Description of payment method which user can see in you site.',\n 'woocommerce'),\n 'default' => __('Payment with Paysto service.', 'woocommerce'),\n ),\n\n 'instructions' => array(\n 'title' => __('Instructions', 'woocommerce'),\n 'type' => 'textarea',\n 'description' => __('Instructions which can added in page of thank-you-payment page.',\n 'woocommerce'),\n 'default' => __('Payment with Paysto service. Thank you very much for you payment.',\n 'woocommerce'),\n ),\n );\n }",
"function uc_order_view_update_form($form, &$form_state, $order) {\n $form['order_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an order comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['order_comment_field']['order_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Order comments are used primarily to communicate with the customer.'),\n );\n\n $form['admin_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an admin comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['admin_comment_field']['admin_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Admin comments are only seen by store administrators.'),\n );\n\n $form['current_status'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_status,\n );\n\n $form['order_id'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_id,\n );\n\n $form['controls'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('uc-inline-form', 'clearfix')),\n '#weight' => 10,\n );\n\n foreach (uc_order_status_list() as $status) {\n $options[$status['id']] = $status['title'];\n }\n $form['controls']['status'] = array(\n '#type' => 'select',\n '#title' => t('Order status'),\n '#default_value' => $order->order_status,\n '#options' => $options,\n );\n\n $form['controls']['notify'] = array(\n '#type' => 'checkbox',\n '#title' => t('Send e-mail notification on update.'),\n );\n\n $form['controls']['actions'] = array('#type' => 'actions');\n $form['controls']['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n );\n\n return $form;\n}",
"public function payment_fields()\r\n {\r\n \r\n // ok, let's display some description before the payment form\r\n if ($this->description) {\r\n // display the description with <p> tags etc.\r\n echo wpautop(wp_kses_post($this->description));\r\n }\r\n \r\n // I will echo() the form, but you can close PHP tags and print it directly in HTML\r\n echo '<fieldset id=\"wc-' . esc_attr($this->id) . '-cc-form\" class=\"wc-credit-card-form wc-payment-form\" style=\"background:transparent;\">';\r\n \r\n // Add this action hook if you want your custom gateway to support it\r\n do_action('woocommerce_momo_form_start', $this->id);\r\n \r\n // I recommend to use inique IDs, because other gateways could already use #ccNo, #expdate, #cvc\r\n echo '<div class=\"form-row form-row-wide\"><label>Mobile Wallet Provider <span class=\"required\">*</span></label>\r\n\t\t\t\t<select id=\"epaygh_mobile_wallet_network\" name=\"epaygh_mobile_wallet_network\">\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"mtn\" selected>MTN</option>\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"airtel\">Airtel</option>\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"tigo\">Tigo</option>\r\n\t\t\t\t\t<option name=\"epaygh_mobile_wallet_network\" value=\"vodafone\">Vodafone</option>\r\n\t\t\t\t</select>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"form-row form-row-wide\"><label>Mobile Wallet Number <span class=\"required\">*</span></label>\r\n\t\t\t\t<input id=\"epaygh_mobile_wallet_number\" name=\"epaygh_mobile_wallet_number\" type=\"tel\">\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"form-row form-row-wide\"><label>Voucher </label>\r\n\t\t\t\t\t<input id=\"epaygh_payment_voucher\" name=\"epaygh_payment_voucher\" type=\"text\" autocomplete=\"off\"><br>\r\n\t\t\t\t\t<span class=\"required\">Leave empty if mobile network is not Vodafone</span>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div class=\"clear\"></div>';\r\n \r\n do_action('woocommerce_momo_form_end', $this->id);\r\n \r\n echo '<div class=\"clear\"></div></fieldset>';\r\n }",
"public function init_form_fields() {\n $this->form_fields = apply_filters('wc_openpay_settings', array(\n 'enabled' => array(\n 'title' => __('Enable/Disable', 'openpay-woosubscriptions'),\n 'label' => __('Enable Openpay', 'openpay-woosubscriptions'),\n 'type' => 'checkbox',\n 'description' => '',\n 'default' => 'no'\n ),\n 'testmode' => array(\n 'title' => __('Sandbox mode', 'openpay-woosubscriptions'),\n 'label' => __('Enable Sandbox', 'openpay-woosubscriptions'),\n 'type' => 'checkbox',\n 'description' => __('Place the payment gateway in test mode using test API keys.', 'openpay-woosubscriptions'),\n 'default' => 'yes'\n ),\n 'title' => array(\n 'title' => __('Title', 'openpay-woosubscriptions'),\n 'type' => 'text',\n 'description' => __('This controls the title which the user sees during checkout.', 'openpay-woosubscriptions'),\n 'default' => __('Tarjeta de crédito o débito', 'openpay-woosubscriptions')\n ),\n 'description' => array(\n 'title' => __('Description', 'openpay-woosubscriptions'),\n 'type' => 'textarea',\n 'description' => __('This controls the description which the user sees during checkout.', 'openpay-woosubscriptions'),\n 'default' => __('Pay with your credit card via Openpay.', 'openpay-woosubscriptions')\n ),\n 'merchant_id' => array(\n 'title' => __('Production Merchant ID', 'openpay-woosubscriptions'),\n 'type' => 'text',\n 'description' => __('Get your API keys from your openpay account.', 'openpay-woosubscriptions'),\n 'default' => ''\n ),\n 'secret_key' => array(\n 'title' => __('Production Secret Key', 'openpay-woosubscriptions'),\n 'type' => 'text',\n 'description' => __('Get your API keys from your openpay account.', 'openpay-woosubscriptions'),\n 'default' => ''\n ),\n 'publishable_key' => array(\n 'title' => __('Production Public Key', 'openpay-woosubscriptions'),\n 'type' => 'text',\n 'description' => __('Get your API keys from your openpay account.', 'openpay-woosubscriptions'),\n 'default' => ''\n ),\n 'test_merchant_id' => array(\n 'title' => __('Sandbox Merchant ID', 'openpay-woosubscriptions'),\n 'type' => 'text',\n 'description' => __('Get your API keys from your openpay account.', 'openpay-woosubscriptions'),\n 'default' => ''\n ),\n 'test_secret_key' => array(\n 'title' => __('Sandbox Secret Key', 'openpay-woosubscriptions'),\n 'type' => 'text',\n 'description' => __('Get your API keys from your openpay account.', 'openpay-woosubscriptions'),\n 'default' => ''\n ),\n 'test_publishable_key' => array(\n 'title' => __('Sandbox Public Key', 'openpay-woosubscriptions'),\n 'type' => 'text',\n 'description' => __('Get your API keys from your openpay account.', 'openpay-woosubscriptions'),\n 'default' => ''\n )\n ));\n }",
"function init_form_fields() {\n\n $this->form_fields = array(\n 'enabled' => array(\n 'title' => __( 'Enable/Disable', 'esewa-payment-gateway-for-woocommerce' ),\n 'type' => 'checkbox',\n 'label' => __( 'Enable eSewa Payment Method', 'esewa-payment-gateway-for-woocommerce' ),\n 'default' => 'yes',\n ),\n 'title' => array(\n 'title' => __( 'Title', 'esewa-payment-gateway-for-woocommerce' ),\n 'type' => 'text',\n 'description' => __( 'This controls the title which the user sees during checkout.', 'esewa-payment-gateway-for-woocommerce' ),\n 'default' => __( 'eSewa', 'esewa-payment-gateway-for-woocommerce' ),\n 'desc_tip' => true,\n ),\n 'description' => array(\n 'title' => __( 'Customer Message', 'esewa-payment-gateway-for-woocommerce' ),\n 'type' => 'textarea',\n 'description' => __( 'Enter description of payment gateway', 'esewa-payment-gateway-for-woocommerce' ),\n 'default' => __( 'eSewa is the first online payment gateway of Nepal. It facilitates its users to pay and get paid online.', 'esewa-payment-gateway-for-woocommerce' ),\n ),\n 'merchant' => array(\n 'title' => __( 'Merchant ID', 'esewa-payment-gateway-for-woocommerce' ),\n 'type' => 'text',\n 'description' => __( 'Enter Merchant ID. Eg. 0000ETM', 'esewa-payment-gateway-for-woocommerce' ),\n 'default' => '',\n 'placeholder' => __( 'Enter Merchant ID', 'esewa-payment-gateway-for-woocommerce' ),\n ),\n 'testing' => array(\n 'title' => __( 'For Developers', 'esewa-payment-gateway-for-woocommerce' ),\n 'type' => 'title',\n 'description' => '',\n ),\n 'testmode' => array(\n 'title' => __( 'Test mode', 'esewa-payment-gateway-for-woocommerce' ),\n 'type' => 'checkbox',\n 'label' => __( 'Enable Test mode', 'esewa-payment-gateway-for-woocommerce' ),\n 'default' => 'no',\n 'description' => __( 'Used for development purpose', 'esewa-payment-gateway-for-woocommerce' ),\n ),\n 'debug' => array(\n 'title' => __( 'Debug Log', 'esewa-payment-gateway-for-woocommerce' ),\n 'type' => 'checkbox',\n 'label' => __( 'Enable logging', 'esewa-payment-gateway-for-woocommerce' ),\n 'default' => 'no',\n 'description' => sprintf( __( 'Log eSewa events, inside <code>%s</code>', 'esewa-payment-gateway-for-woocommerce' ),\n wc_get_log_file_path( 'esewa' )\n ),\n ),\n );\n\n\t\t}"
]
| [
"0.6819203",
"0.6489444",
"0.64718676",
"0.60903",
"0.5970113",
"0.59332573",
"0.5795539",
"0.56389683",
"0.56306463",
"0.5602111",
"0.55994266",
"0.55826324",
"0.5541529",
"0.5524208",
"0.54108953",
"0.53888583",
"0.5377876",
"0.53662336",
"0.5357527",
"0.53391755",
"0.5317522",
"0.5316016",
"0.5314887",
"0.5303197",
"0.52798325",
"0.5269576",
"0.52638",
"0.52525437",
"0.52377146",
"0.5231264"
]
| 0.71022403 | 0 |
Order form: should a multiactivatable app/addon use a separate order form for each activation bool separate_order_forms = 4; | public function getSeparateOrderForms()
{
return $this->separate_order_forms;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setSeparateOrderForms($var)\n {\n GPBUtil::checkBool($var);\n $this->separate_order_forms = $var;\n }",
"public function OrderForm()\n {\n $config = new Config();\n\n $app = new ALLApp();\n $app->configs = $config;\n\n //address\n $column = new Form();\n $column->dbType = dbTypeInteger;\n $column->widget = ZSelect2Widget::class;\n $column->options = [\n 'data' => Az::$app->market->address->getUserAddresses(11),\n 'name' => 'address_id',\n 'label' => ShopShipment::shipment_type\n ];\n $app->columns['address_id'] = $column;\n //address\n\n //shipment_type_id\n $column = new Form();\n $column->dbType = dbTypeString;\n $column->widget = ZMRadioWidget::class;\n $column->options = [\n 'config' => [\n 'hasPlace' => true\n ],\n 'data' => ShopShipment::shipment_type,\n 'name' => 'shipment_type',\n ];\n $column->rules = [\n ['zetsoft\\\\system\\\\validate\\\\ZRequiredValidator']\n ];\n $app->columns['shipment_type'] = $column;\n //shipment_type_id\n\n //contact\n $column = new Form();\n $column->dbType = dbTypeJsonb;\n $column->widget = ZFormWidget::class;\n $column->valueWidget = ZFormViewWidget::class;\n $column->options = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n 'title' => Az::l(\"Ваши контакты\"),\n 'titleClass' => ZColor::color['success-color']\n ],\n ];\n $column->valueOptions = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n\n ],\n ];\n $app->columns['contact_info'] = $column;\n //contact\n\n $app->cards = [];\n return Az::$app->forms->former->model($app);\n }",
"public function ShowFormInEditableOrderTable()\n {\n return false;\n }",
"function wcfmgs_group_manager_show_marketplace_orders( $is_show ) {\r\n \treturn true;\r\n }",
"function uc_order_pane_line_items($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'view':\n case 'customer':\n $line_items = $order->line_items;\n $items = _uc_line_item_list();\n foreach ($items as $item) {\n if (isset($item['display_only']) && $item['display_only'] == TRUE) {\n $result = $item['callback']('display', $order);\n if (is_array($result)) {\n foreach ($result as $line) {\n $line_items[] = array(\n 'title' => $line['title'],\n 'amount' => $line['amount'],\n 'weight' => $item['weight']\n );\n }\n }\n }\n }\n usort($line_items, 'uc_weight_sort');\n\n $build['line_items'] = array(\n '#prefix' => '<table class=\"line-item-table\">',\n '#suffix' => '</table>',\n );\n foreach ($line_items as $item) {\n $table_row = array(\n '#prefix' => '<tr>',\n '#suffix' => '</tr>',\n );\n\n $table_row['title'] = array(\n '#markup' => check_plain($item['title']),\n '#prefix' => '<td class=\"li-title\">',\n '#suffix' => '</td>',\n );\n\n $table_row['amount'] = array(\n '#theme' => 'uc_price',\n '#price' => $item['amount'],\n '#prefix' => '<td class=\"li-amount\">',\n '#suffix' => '</td>',\n );\n\n $build['line_items'][] = $table_row;\n }\n\n return $build;\n\n case 'edit-form':\n $options = array();\n $items = _uc_line_item_list();\n $line_items = $order->line_items;\n foreach ($items as $item) {\n if (isset($item['add_list']) && $item['add_list'] === TRUE) {\n $options[$item['id']] = check_plain($item['title']);\n }\n if (isset($item['display_only']) && $item['display_only'] == TRUE) {\n $result = $item['callback']('display', $order);\n if (is_array($result)) {\n foreach ($result as $line) {\n $line_items[] = array(\n 'line_item_id' => $line['id'],\n 'title' => $line['title'],\n 'amount' => $line['amount'],\n 'vat_rate' => $line['vat_rate'],\n 'weight' => $item['weight'],\n );\n }\n }\n }\n }\n usort($line_items, 'uc_weight_sort');\n\n $form['add_line_item'] = array('#type' => 'container');\n\n $form['add_line_item']['li_type_select'] = array(\n '#type' => 'select',\n '#title' => t('Add a line item'),\n '#options' => $options,\n );\n $form['add_line_item']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Add line'),\n '#submit' => array('uc_order_pane_line_items_submit', 'uc_order_pane_line_items_add'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_line_items_update',\n ),\n );\n $form['line_items'] = array(\n '#tree' => TRUE,\n '#theme' => 'uc_order_pane_line_items',\n '#prefix' => '<div id=\"order-line-items\">',\n '#suffix' => '</div>',\n );\n\n foreach ($line_items as $item) {\n $form['line_items'][$item['line_item_id']]['li_id'] = array(\n '#type' => 'hidden',\n '#value' => $item['line_item_id'],\n );\n if (isset($item['type']) && _uc_line_item_data($item['type'], 'stored') == TRUE) {\n $form['line_items'][$item['line_item_id']]['remove'] = array(\n '#type' => 'image_button',\n '#title' => t('Remove line item.'),\n '#src' => drupal_get_path('module', 'uc_store') . '/images/error.gif',\n '#button_type' => 'remove',\n '#submit' => array('uc_order_pane_line_items_submit', 'uc_order_pane_line_items_remove'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_line_items_update',\n ),\n '#return_value' => $item['line_item_id'],\n );\n $form['line_items'][$item['line_item_id']]['title'] = array(\n '#type' => 'textfield',\n '#title' => t('Title'),\n '#default_value' => $item['title'],\n '#size' => 40,\n '#maxlength' => 128,\n );\n $form['line_items'][$item['line_item_id']]['amount'] = array(\n '#type' => 'uc_price',\n '#title' => t('Amount'),\n '#default_value' => $item['amount'],\n '#size' => 6,\n '#allow_negative' => TRUE,\n );\n $form['line_items'][$item['line_item_id']]['vat_rate'] = array(\n '#type' => 'uc_vat_rate',\n '#title' => t('VAT rate'),\n '#default_value' => $item['vat_rate'],\n '#size' => 6,\n '#allow_negative' => FALSE,\n );\n }\n else {\n $form['line_items'][$item['line_item_id']]['title'] = array(\n '#markup' => check_plain($item['title']),\n );\n $form['line_items'][$item['line_item_id']]['amount'] = array(\n '#theme' => 'uc_price',\n '#price' => $item['amount'],\n );\n $form['line_items'][$item['line_item_id']]['vat_rate'] = array(\n '#theme' => 'uc_vat_rate',\n '#price' => $item['vat_rate'],\n );\n }\n }\n return $form;\n\n case 'edit-theme':\n return drupal_render($form['add_line_item'])\n . drupal_render($form['line_items']);\n\n case 'edit-process':\n uc_order_pane_line_items_submit($form, $form_state);\n return;\n }\n}",
"function uc_order_view_update_form($form, &$form_state, $order) {\n $form['order_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an order comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['order_comment_field']['order_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Order comments are used primarily to communicate with the customer.'),\n );\n\n $form['admin_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an admin comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['admin_comment_field']['admin_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Admin comments are only seen by store administrators.'),\n );\n\n $form['current_status'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_status,\n );\n\n $form['order_id'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_id,\n );\n\n $form['controls'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('uc-inline-form', 'clearfix')),\n '#weight' => 10,\n );\n\n foreach (uc_order_status_list() as $status) {\n $options[$status['id']] = $status['title'];\n }\n $form['controls']['status'] = array(\n '#type' => 'select',\n '#title' => t('Order status'),\n '#default_value' => $order->order_status,\n '#options' => $options,\n );\n\n $form['controls']['notify'] = array(\n '#type' => 'checkbox',\n '#title' => t('Send e-mail notification on update.'),\n );\n\n $form['controls']['actions'] = array('#type' => 'actions');\n $form['controls']['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n );\n\n return $form;\n}",
"public function testOrdersOneForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->orderId\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}",
"function uc_order_pane_products($op, $order, &$form = NULL, &$form_state = NULL) {\n\n switch ($op) {\n case 'view':\n return tapir_get_table('uc_op_products_view_table', $order);\n\n case 'customer':\n return tapir_get_table('uc_op_products_customer_table', $order);\n\n case 'edit-form':\n $form['add_product_button'] = array(\n '#type' => 'submit',\n '#value' => t('Add product'),\n '#submit' => array('uc_order_pane_products_select'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_products_ajax_callback',\n 'wrapper' => 'product-controls',\n ),\n );\n $form['add_blank_line_button'] = array(\n '#type' => 'submit',\n '#value' => t('Add blank line'),\n '#submit' => array('uc_order_edit_products_add_blank'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_products_ajax_callback',\n 'wrapper' => 'product-controls',\n ),\n );\n\n $form['product_controls'] = array(\n '#tree' => TRUE,\n '#prefix' => '<div id=\"product-controls\">',\n '#suffix' => '</div>',\n );\n\n $controls = array();\n\n if (isset($form_state['products_action'])) {\n switch ($form_state['products_action']) {\n case 'select':\n $controls = uc_order_product_select_form($form['product_controls'], $form_state, $order);\n break;\n case 'add_product':\n $controls = uc_order_add_product_form($form['product_controls'], $form_state, $order, $form_state['node']);\n break;\n }\n }\n\n $form['product_controls'] += $controls;\n\n $form += uc_order_edit_products_form($form, $form_state, $order->products);\n\n return $form;\n\n case 'edit-theme':\n $output = drupal_render($form['add_product_button']);\n $output .= drupal_render($form['add_blank_line_button']);\n $output .= drupal_render($form['product_controls']);\n $output .= drupal_render($form['products']);\n\n return $output;\n\n case 'edit-process':\n if (isset($form_state['values']['products'])) {\n foreach ($form_state['values']['products'] as $key => $product) {\n $product['data'] = unserialize($product['data']);\n uc_order_product_save($order->order_id, (object) $product);\n }\n }\n\n break;\n }\n}",
"function MyShop_Order($args) {\n global $_CONF, $_TABLES, $_MYSHOP_CONF;\n\n $sql = \"SELECT orderid,productid,email,quantity,status from {$_TABLES['myshop_order']}\";\n $result = DB_query($sql);\n $num = DB_numrows($result);\n\n if($num > 0)\n {\n for ($i = 0; $i < $num; $i++)\n {\n $A = DB_fetchArray($result);\n \n $product_name = DB_getItem($_TABLES['myshop_product'], 'name', \"productid={$A['productid']}\");\n if($A['status'] == \"on\"){\n $ship = \" checked\";\n }\n \n $row .= \"<form action=\\\"index.php\\\" METHOD=\\\"POST\\\"><tr>\\n\";\n $row .= \"<input type=\\\"hidden\\\" name=\\\"orderid\\\" value=\\\"{$A['orderid']}\\\">\\n\";\n $row .= \"<td>$product_name</td>\";\n $row .= \"<td>{$A['quantity']}</td>\";\n $row .= \"<td>{$A['email']}</td>\";\n $row .= \"<td><input type=\\\"checkbox\\\" name=\\\"status\\\"{$ship}></td>\";\n $row .= \"<td><button type=\\\"submit\\\" name=\\\"mode\\\" value=\\\"order_save\\\" class=\\\"uk-button uk-button-primary\\\">変更</button>\";\n $row .= \"<button type=\\\"submit\\\" name=\\\"mode\\\" value=\\\"order_delete\\\" class=\\\"uk-button\\\">削除</button></td>\\n\";\n $row .= \"</tr></form>\\n\";\n }\n }\n else {\n $row = MyShop_str('no_order');\n }\n\n $T = new Template($_CONF['path'] . 'plugins/myshop/templates');\n\n $T->set_file(array (\n 'topmenu' => 'topmenu.thtml',\n 'table' => 'table.thtml',\n ));\n\n $T->set_var(array(\n 'lang_piname' => $_MYSHOP_CONF['pi_display_name'],\n 'icon_url' => $_CONF['site_url'] . '/myshop/images/myshop.png',\n 'title' => MyShop_str('pi_name'),\n 'caption' => MyShop_str('top_menu_caption'),\n 'menu1' => MyShop_str('top_menu1'),\n 'menu2' => MyShop_str('top_menu2'),\n 'menu3' => MyShop_str('top_menu3'),\n 'menu4' => MyShop_str('top_menu4'),\n 'notfound' => $notfound,\n 'h1' => MyShop_str('product_name'),\n 'h2' => MyShop_str('tbl_head_amount'),\n 'h3' => MyShop_str('publish'),\n 'h4' => MyShop_str('finish'),\n 'h5' => \"-\",\n 'list' => $row,\n ));\n\n $T->parse('output', 'topmenu');\n $content .= $T->finish($T->get_var('output'));\n\n $T->parse('output', 'table');\n $content .= $T->finish($T->get_var('output'));\n \n $display = COM_createHTMLDocument($content);\n COM_output($display);\n}",
"public function form_order_type() {\n\t\tglobal $current_user;\n\n\t\tget_currentuserinfo();\n\n\t\t$data = array();\n\n\t\tif ( !isset( $_REQUEST['page'] ) )\n\t\t\treturn;\n\n\t\tif ( 'visual-form-builder-pro' !== $_REQUEST['page'] )\n\t\t\treturn;\n\n\t\tif ( isset( $_REQUEST['mode'] ) ) :\n\t\t\t$user_id = $current_user->ID;\n\n\t\t\t$type = get_user_meta( $user_id, 'vfb-form-order-type', true );\n\n\t\t\t$meta_value = ( in_array( $_REQUEST['mode'], array( 'order', 'list' ) ) ) ? esc_html( $_REQUEST['mode'] ) : '';\n\t\t\tupdate_user_meta( $user_id, 'vfb-form-order-type', $meta_value );\n\n\t\tendif;\n\t}",
"public function activateOrderAddons(\\Model_ClientOrder $order)\n {\n if (!$order->group_master) {\n return false;\n }\n\n $list = $this->getOrderAddonsList($order);\n foreach ($list as $addon) {\n try {\n $this->di['events_manager']->fire(array('event' => 'onBeforeAdminOrderActivate', 'params' => array('id' => $addon->id)));\n $this->createFromOrder($addon);\n $this->di['events_manager']->fire(array('event' => 'onBeforeAdminOrderActivate', 'params' => array('id' => $addon->id)));\n } catch (\\Exception $e) {\n error_log($e->getMessage());\n }\n }\n return true;\n }",
"function activate_wcfm_order_splitter() {\n\trequire 'includes/class-wcfmos-order-splitter-activator.php';\n\tWCFMOS_Order_Splitter_Activator::run();\n}",
"function uc_order_pane_customer($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'view':\n $build['uid'] = array('#markup' => t('Customer number: !user_link', array('!user_link' => $order->uid ? l($order->uid, 'user/' . $order->uid) : '0')));\n $build['primary_email'] = array('#markup' => '<br />' . t('Primary e-mail:') . '<br />' . check_plain($order->primary_email));\n\n return $build;\n\n case 'edit-form':\n $form['customer']['uid'] = array(\n '#type' => 'hidden',\n '#default_value' => $order->uid,\n );\n $form['customer']['uid_text'] = array(\n '#type' => 'textfield',\n '#title' => t('Customer number'),\n '#default_value' => $order->uid,\n '#maxlength' => 10,\n '#size' => 10,\n '#disabled' => TRUE,\n );\n $form['customer']['primary_email'] = array(\n '#type' => 'textfield',\n '#title' => t('E-mail address'),\n '#default_value' => $order->primary_email,\n '#maxlength' => 64,\n '#size' => 32,\n );\n return $form;\n\n case 'edit-theme':\n $output = '<div class=\"order-pane-icons\">';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/order_view.gif\" alt=\"' . t('Search for an existing customer.') . '\" '\n . 'title=\"' . t('Search for an existing customer.') . '\" onclick=\"load_customer_search();\" />';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/menu_customers_small.gif\" alt=\"' . t('Create a new customer.') . '\" '\n . 'title=\"' . t('Create a new customer.') . '\" onclick=\"load_new_customer_form();\" />';\n $output .= '</div>';\n $output .= '<div id=\"customer-select\"></div>';\n $output .= drupal_render($form['customer']);\n return $output;\n\n case 'edit-process':\n $changes['uid'] = $form_state['values']['uid'];\n $changes['primary_email'] = $form_state['values']['primary_email'];\n return $changes;\n }\n}",
"function pi_authoring_order_activities_form(&$form_state, $activities) {\n\t$form = array();\n\t$form['#theme'] = 'pi_authoring_order_activities_form';\n\t$form['#title'] = 'Inquiry Activities';\n\t\n\t$form['order_activities_activities'] = array(\n\t\t'#tree' => TRUE\n\t);\n\t\n\t$position = 0;\n\tforeach($activities as $nid => $activity)\n\t{\n\t\t$form['order_activities_activities'][$nid]['title'] =\n\t\t \tarray(\n\t\t \t\t'#value' => $activity['title']\n\t\t \t);\n\t\t$form['order_activities_activities'][$nid]['body'] = \n\t\t\tarray(\n\t\t\t\t'#value' => $activity['body']\n\t\t\t);\n\t\t$form['order_activities_activities'][$nid]['weight'] = \n\t\t\tarray(\n\t '#type' => 'weight',\n\t '#delta' => count($activity),\n\t '#default_value' => $position\n\t );\n \n $position++;\n\t}\n\t$form['submit'] = array(\n\t\t'#type' => 'submit',\n\t\t'#value' => t('Save'),\n \t);\n \treturn $form;\t\n}",
"function uc_order_pane_bill_to($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'view':\n case 'customer':\n $build = array('#markup' => uc_order_address($order, 'billing') . '<br />' . check_plain($order->billing_phone));\n return $build;\n\n case 'edit-form':\n $form['bill_to'] = array(\n '#type' => 'uc_address',\n '#default_value' => $order,\n '#required' => FALSE,\n '#attributes' => array('class' => array('uc-store-address-field')),\n '#key_prefix' => 'billing',\n );\n return $form;\n\n case 'edit-theme':\n $output = '<div class=\"order-pane-icons\">';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/address_book.gif\" alt=\"' . t('Select from address book.') . '\" '\n . 'title=\"' . t('Select from address book.') . '\" onclick=\"load_address_select(' . $form['order_uid']['#value'] . ', \\'#billing_address_select\\', \\'billing\\');\" />';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/copy.gif\" alt=\"' . t('Copy shipping information.') . '\" title=\"'\n . t('Copy shipping information.') . '\" onclick=\"uc_order_copy_shipping_to_billing();\" />';\n $output .= '</div>';\n $output .= '<div id=\"billing_address_select\"></div>';\n return $output . drupal_render($form['bill_to']);\n\n case 'edit-process':\n foreach ($form_state['values'] as $key => $value) {\n if (substr($key, 0, 8) == 'billing_') {\n if (uc_address_field_enabled(substr($key, 8))) {\n $changes[$key] = $value;\n }\n }\n }\n return $changes;\n }\n}",
"public function action_order() {\n $field = $this->field($_POST[\"fieldid\"]);\n // Load pre-set emailaddress\n $address = Wi3::inst()->model->factory(\"site_data\")->setref($field)->setname(\"emailaddress\")->load()->data;\n if (empty($address)) {\n echo json_encode(\n Array(\n \"scriptsbefore\" => Array(\n \"0\" => \"$(wi3.popup.getDOM()).fadeOut(100,function() { $(this).html('Bestelling kon <strong>niet</strong> geplaatst worden! Stel de eigenaar van de site hiervan op de hoogte.').fadeIn(); } );\"\n )\n )\n );\n } else {\n // Send an email to client and to the pre-set emailaddress\n $presetemailaddress = $address;\n // Set folder to $_POST to store\n $folderid = Wi3::inst()->model->factory(\"site_data\")->setref($field)->setname(\"folder\")->load()->data;\n $_POST[\"folderid\"] = $folderid;\n // Store order\n $orders = Wi3::inst()->model->factory(\"site_data\")->setref($field)->setname(\"orders\")->load();\n if (!$orders->loaded())\n {\n $orders->create();\n }\n $ordersdata = unserialize($orders->data);\n $ordersdata[] = $_POST;\n $orders->data = serialize($ordersdata);\n $orders->update();\n // Create mail\n $message = $this->view(\"mail\")->set(\"post\", $_POST)->render();\n $clientmessage = $this->view(\"clientmail\")->set(\"post\", $_POST)->render();\n $subject = \"Bestelling foto's\";\n // Send mail to 'us' and to client\n mail($presetemailaddress, $subject, $message);\n mail($_POST[\"emailaddress\"], $subject, $clientmessage);\n echo json_encode(\n Array(\n \"scriptsbefore\" => Array(\n \"0\" => \"$(wi3.popup.getDOM()).fadeOut(100,function() { $(this).html('Bestelling succesvol geplaatst!').fadeIn(); } );\"\n )\n )\n );\n }\n }",
"function show() {\n global $_SERVER;\n global $lang;\n global $theme;\n global $_SESSION;\n global $__order_register;\n global $__order_register_tab;\n global $_REQUEST;\n global $sess;\n \n // odczytaj jakie sa ustawienia sortowania obecnie\n if (! empty($_SESSION[\"__order_register_set\"])){\n $tab=$_SESSION[\"__order_register_set\"];\n } else {\n $tab['partner']=0;\n $tab['amount']=0;\n $tab['rake_off']=0;\n }\n\n if (! empty($_REQUEST['order'])) {\n $order=$_REQUEST['order']; $set=false; \n $order=intval($order);\n \n switch ($order) {\n case \"1\":$tab['partner']=-1; $set=true; // zmien \"strzalke\" (kierunek sortowania)\n break;\n case \"2\":$tab['amount']=-1; $set=true;\n break;\n case \"3\":$tab['rake_off']=-1; $set=true;\n break;\n case \"-1\":$tab['partner']=1; $set=true;\n break;\n case \"-2\":$tab['amount']=1; $set=true;\n break;\n case \"-3\":$tab['rake_off']=1; $set=true;\n break;\n default:$tab['partner']=-1; $set=true;\n break;\n } // end switch\n \n } // end if\n\n // start: sprawdz czy wybrano jakiekolwiek sortowanie, jesli nie to wstaw sortowanie wg ceny od najmniejszej\n // chyba ze jest to wyszukiwanie wedlug slowa, wtedy wstaw sortowanie wedlug dopasowania\n if (@$set!=true) {\n $tab['partner']=-1;\n } \n // end:\n\n // zapamietaj tablice sortowania w sesji\n $__order_main_tab_register=&$tab;\n $sess->register(\"__order_register_tab\",$order_register_tab);\n $__order_main_register=&$order;\n $sess->register(\"__order_register\",$__order_register);\n\n $url=$_SERVER['REQUEST_URI'];\n \n // pomin sesje, uniknij duplikacji zmiennej sesji\n $url=preg_replace(\"/&session_id=[a-z0-9]+$/\",\"\",$url);\n $url=ereg_replace(\"\\?order=[0-9-]+$\",\"\",$url);\n \n // sortowanie wg nazwy\n if ($tab['partner']==1) {\n print \"<a href=$url?order=1><u>\".$lang->order_by['partner'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/up.png\"); print \"> \";\n } elseif ($tab['partner']==-1) {\n print \"<a href=$url?order=-1><u>\".$lang->order_by['partner'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/down.png\"); print \"> \";\n } else {\n print \"<a href=$url?order=1><u>\".$lang->order_by['partner'].\"</u></a> \";\n }\n\n // sortowanie wg ceny\n if ($tab['amount']==1) {\n print \"<a href=$url?order=2><u>\".$lang->order_by['amount'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/up.png\"); print \"> \"; \n } elseif ($tab['amount']==-1) {\n print \"<a href=$url?order=-2><u>\".$lang->order_by['amount'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/down.png\"); print \"> \"; \n } else {\n print \"<a href=$url?order=2><u>\".$lang->order_by['amount'].\"</u></a> \";\n } \n\n // sortowanie wg producenta\n if ($tab['rake_off']==1) {\n print \"<a href=$url?order=3><u>\".$lang->order_by['rake_off'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/up.png\"); print \"> \";\n } elseif ($tab['rake_off']==-1) {\n print \"<a href=$url?order=-3><u>\".$lang->order_by['rake_off'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/down.png\"); print \"> \";\n } else {\n print \"<a href=$url?order=3><u>\".$lang->order_by['rake_off'].\"</u></a> \";\n }\n\n return;\n }",
"private function processOrdersForms($crawler)\n\t{\n\t\t$orders_one_form = $crawler->filter('button#order_id_Search')->form([\n\t\t\t'order_id[id]'\t=> $this->orderId,\n\t\t]);\n\n\t\t$orders_all_form = $crawler->filter('button#from_to_Search')->form([\n\t\t\t'from_to[from]' => $this->from,\n\t\t\t'from_to[to]'\t=> $this->to,\n\t\t]);\n\n\t\tif ($this->client->submit($orders_one_form) || $this->client->submit($orders_all_form)) {\n\t\t\t$this->assertSame(Response::HTTP_FOUND, $this->client->getResponse()->getStatusCode());\n\t\t\t\n\t\t\t$crawler = $this->client->followRedirect();\n\t\t\t$this->assertNotNull($crawler->getUri());\n\t\t}\n\t}",
"public function ShowFormOutsideEditableOrderTable()\n {\n return false;\n }",
"function theme_pi_authoring_order_activities_form($form) {\n\t$output = '';\n\t$output .= '<div>Drag the arrows up and down to to change the order of the activity and click save to finish.</div>';\n\tdrupal_add_tabledrag('pi-authoring-order-activities-sort', 'order', 'sibling', 'pi-authoring-order-activities-element');\n\t$header = array(array('data' => '', 'width' => '29'), 'Activity', 'Description', 'Position');\n\n\t$rows = array();\n\tforeach (element_children($form['order_activities_activities']) as $key)\n\t{\n\t\t// Add class to group weight fields for drag and drop.\n\t\t$form['order_activities_activities'][$key]['weight']['#attributes']['class'] = 'pi-authoring-order-activities-element';\n\n\t\t$row = array('');\n\t\t$row[] = l(drupal_render($form['order_activities_activities'][$key]['title']), \"node/$key/edit\");\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['body']);\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['weight']);\n\n\t\t$rows[] = array('data' => $row, 'class' => 'draggable');\n\t}\n\t$output .= theme('table', $header, $rows, array('id' => 'pi-authoring-order-activities-sort'));\n\t$output .= drupal_render($form);\n\treturn $output;\n}",
"function uc_order_pane_ship_to($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'customer':\n if (!uc_order_is_shippable($order)) {\n return;\n }\n case 'view':\n $build = array('#markup' => uc_order_address($order, 'delivery') . '<br />' . check_plain($order->delivery_phone));\n return $build;\n\n case 'edit-form':\n $form['ship_to'] = array(\n '#type' => 'uc_address',\n '#default_value' => $order,\n '#required' => FALSE,\n '#attributes' => array('class' => array('uc-store-address-field')),\n '#key_prefix' => 'delivery',\n );\n return $form;\n\n case 'edit-theme':\n $output = '<div class=\"order-pane-icons\">';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/address_book.gif\" alt=\"' . t('Select from address book.') . '\" '\n . 'title=\"' . t('Select from address book.') . '\" onclick=\"load_address_select(' . $form['order_uid']['#value'] . ', \\'#delivery_address_select\\', \\'delivery\\');\" />';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/copy.gif\" alt=\"' . t('Copy billing information.') . '\" title=\"'\n . t('Copy billing information.') . '\" onclick=\"uc_order_copy_billing_to_shipping();\" />';\n $output .= '</div>';\n $output .= '<div id=\"delivery_address_select\"></div>';\n return $output . drupal_render($form['ship_to']);\n\n case 'edit-process':\n foreach ($form_state['values'] as $key => $value) {\n if (substr($key, 0, 9) == 'delivery_') {\n if (uc_address_field_enabled(substr($key, 9))) {\n $changes[$key] = $value;\n }\n }\n }\n return $changes;\n }\n}",
"function wyz_ajax_business_tabs_save_form() {\n\n\t$form_data = json_decode( stripslashes_deep( $_REQUEST['form_data'] ),true );\n\tif ( ! empty( $form_data ) && is_array( $form_data ) ) {\n\t\tforeach ( $form_data as $key => $value ) {\n\t\t\t$form_data[ $key ]['hidden'] = true;\n\t\t}\n\t}\n\tupdate_option( 'wyz_business_tabs_order_data', $form_data );\n\twp_die();\n}",
"function commerce_quickbooks_settings_form($form, &$form_state) {\n\n $form['commerce_quickbooks_commerce_cron'] = array(\n '#type' => 'checkbox',\n '#title' => t('Enable Drupal Commerce cron'),\n '#default_value' => variable_get('commerce_quickbooks_commerce_cron'),\n '#description' => t('Warning - This setting will send all your customers, products and orders to QuickBooks online during cron runs.'),\n );\n \n // Build an array of order status options grouped by order state.\n $options = array();\n foreach (commerce_order_state_get_title() as $name => $title) {\n foreach (commerce_order_statuses(array('state' => $name)) as $order_status) {\n\n // Only include enabled statues and the current order status.\n if (!empty($order_status['status']) || $order->status == $order_status['name']) {\n $options[check_plain($title)][$order_status['name']] = check_plain($order_status['title']);\n }\n }\n }\n \n $form['commerce_quickbooks_order_status'] = array(\n '#type' => 'select',\n '#title' => t('Order status to send'),\n '#multiple' => TRUE,\n '#options' => $options,\n '#default_value' => variable_get('commerce_quickbooks_order_status'),\n '#description' => t('Select the order statuses that should be considered ready to send. You will want to select the final status. Not one that gets systematically updated. <br>This is because the queue gets built by querying the database for orders matching this status.'),\n );\n\n return(system_settings_form($form));\n\n}",
"function showForm()\n{\n global $items;\n echo \"<h2>Make your order</h2>\";\n echo '<form action=\"index.php\" method=\"post\">';\n foreach ($items as $item) {\n //create a text input in the form for each item.\n //name attribute is \"item_[item->ID]\"\n echo '<p><b>' .$item->Name . '</b> <input type=\"number\" min=\"0\" name=\"item_' . $item->ID . '\" /></p><p>';\n $extraCounter = 0;\n foreach ($item->Extras as $extra) {\n //create a checkbox for each extra under the current item.\n //name attribute is \"extra_[item->ID]_[0,1,2,3,...]\"\"\n echo '<input type=\"checkbox\" name=\"extra_' . $item->ID . '_' . $extraCounter . '\"/>' . $extra . ' ';\n $extraCounter++;\n }\n echo '</p>';\n }\n echo '<p>* Each extra is $ 0.25.</p>';\n //create submit button and hidden input\n echo '<p>\n <input type=\"submit\" value=\"Submit\" id=\"submit\">\n </p>\n <input type=\"hidden\" name=\"action\" value=\"display\" />\n </form>';\n\n \n}",
"public function onRsformBackendAfterShowFormEditTabs(): void\n\t{\n\t\t$formId = $this->app->input->getInt('formId');\n\t\t$tables = $this->db->getTableList();\n\t\t$table = $this->db->getPrefix() . 'rsform_jdideal';\n\n\t\tif (!in_array($table, $tables, true))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Load the settings\n\t\t$settings = $this->loadFormSettings($formId);\n\n\t\t$form = new Form('ropayments');\n\t\t$form->loadFile(__DIR__ . '/configuration.xml');\n\t\t$form->bind(['roPaymentsParams' => $settings->toArray()]);\n\n\t\tHTMLHelper::_('formbehavior.chosen');\n\n\t\t?>\n\t\t<div id=\"ropayments\" class=\"form-horizontal <?php\n\t\techo Version::MAJOR_VERSION === 3 ? 'ropayments3' : ''; ?>\">\n\t\t\t<?php\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.startTabSet', 'ropayments-config',\n\t\t\t\t['active' => 'ropayments-general']\n\t\t\t);\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-general',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_GENERAL')\n\t\t\t);\n\t\t\techo $form->renderField('profileAlias', 'roPaymentsParams');\n\t\t\techo $form->renderField('currency', 'roPaymentsParams');\n\t\t\techo $form->renderField('allowEmpty', 'roPaymentsParams');\n\t\t\techo $form->renderField('showMessage', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-currency',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_PRICE')\n\t\t\t);\n\t\t\techo $form->renderField('thousands', 'roPaymentsParams');\n\t\t\techo $form->renderField('decimal', 'roPaymentsParams');\n\t\t\techo $form->renderField('numberDecimals', 'roPaymentsParams');\n\t\t\techo $form->renderField('priceMask', 'roPaymentsParams');\n\t\t\techo $form->renderField('amountMask', 'roPaymentsParams');\n\t\t\techo '<div class=\"totalPriceMask\">';\n\t\t\techo $form->renderField('totalMask', 'roPaymentsParams');\n\t\t\techo '</div>';\n\t\t\techo $form->renderField('taxType', 'roPaymentsParams');\n\t\t\techo $form->renderField('taxValue', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-fields',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_FIELDS')\n\t\t\t);\n\t\t\techo $form->renderField('fieldOrderNumber', 'roPaymentsParams');\n\t\t\techo $form->renderField('fieldName', 'roPaymentsParams');\n\t\t\techo $form->renderField('fieldEmail', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-emails',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_MAIL')\n\t\t\t);\n\t\t\techo $form->renderField('userEmail', 'roPaymentsParams');\n\t\t\techo $form->renderField('adminEmail', 'roPaymentsParams');\n\t\t\techo $form->renderField('additionalEmails', 'roPaymentsParams');\n\t\t\techo $form->renderField(\n\t\t\t\t'sendEmailOnFailedPayment', 'roPaymentsParams'\n\t\t\t);\n\t\t\techo $form->renderField('confirmationEmail', 'roPaymentsParams');\n\t\t\techo '<div class=\"control-group ro-confirmation-info\" data-showon=\\'[{\"field\":\"roPaymentsParams[confirmationEmail]\",\"values\":[\"1\"],\"sign\":\"=\",\"op\":\"\"}]\\' style=\"display: none;\">';\n\t\t\techo '<div class=\"text-info\">' . Text::_(\n\t\t\t\t\t'PLG_RSFP_JDIDEAL_CONFIRMATIONHELP'\n\t\t\t\t) . '</div>';\n\t\t\techo '</div>';\n\t\t\techo $form->renderField(\n\t\t\t\t'confirmationRecipient', 'roPaymentsParams'\n\t\t\t);\n\t\t\techo $form->renderField('confirmationSubject', 'roPaymentsParams');\n\t\t\techo $form->renderField('confirmationMessage', 'roPaymentsParams');\n\t\t\techo $form->renderField('includeNonSelected', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_('bootstrap.endTabSet');\n\t\t\t?>\n\t\t</div>\n\t\t<?php\n\t}",
"public function init()\n {\n parent::init();\n \n $this->addCssFile(\"/css/library/Account/Form/activate-accounts.css\");\n $this->addJsFile(\"/js/library/Account/Form/activate-accounts.js\");\n \n //add js file to do cool input masking\n $this->addJsFile(\"/js/jquery.maskedinput-1.3.js\");\n \n $this->setDecorators(self::$_formDecorators);\n \n foreach ($this->order->order_configurations as $config) {\n $subform = new \\Account_Form_ActivateAccountsSubForm($config->id);\n $this->addSubForm($subform, \"orderConfiguration_\" . $config->id);\n }\n \n $emailEveryone = new Zend_Form_Element_Checkbox(\"emailEveryone\");\n $emailEveryone->setLabel(\"Send email to account holders with their login information.\")\n ->setDecorators(self::$checkboxDecorators)\n ->setValue(1);\n $this->addElement($emailEveryone);\n \n $orderId = new Zend_Form_Element_Hidden(\"orderId\");\n $orderId->setDecorators(array('ViewHelper'));\n $this->addElement($orderId);\n\n $saveButton = new Fisdap_Form_Element_SaveButton(\"saveButton\");\n $saveButton->setLabel(\"Save\")\n ->setDecorators(self::$buttonDecorators);\n $this->addElement($saveButton);\n \n if ($this->order->id) {\n $this->setDefaults(array(\n 'orderId' => $this->order->id,\n ));\n }\n }",
"function displayOrderForm() {\n $output = '<div class=\"c-order\">\n\t\t\t<div class=\"c-order-select\">\n\t\t\t\t<form name=\"ChangeOrder\" action=\"\">\n\t\t\t\t\t<select name=\"TheOrder\">\n\t\t\t\t\t\t<option value=\"0\">' .\n wfMessage( 'comments-sort-by-date' )->plain() .\n '</option>\n\t\t\t\t\t\t<option value=\"1\">' .\n wfMessage( 'comments-sort-by-score' )->plain() .\n '</option>\n\t\t\t\t\t</select>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t<div id=\"spy\" class=\"c-spy\">\n\t\t\t\t<a href=\"javascript:void(0)\">' .\n wfMessage( 'comments-auto-refresher-enable' )->plain() .\n '</a>\n\t\t\t</div>\n\t\t\t<div class=\"cleared\"></div>\n\t\t</div>\n\t\t<br />' . \"\\n\";\n\n return $output;\n }",
"public function display_account_orders( ){\n\t\tif( $this->is_page_visible( \"orders\" ) ){\n\t\t\tif( file_exists( WP_PLUGIN_DIR . '/wp-easycart-data/design/layout/' . get_option( 'ec_option_base_layout' ) . '/ec_account_orders.php' ) )\t\n\t\t\t\tinclude( WP_PLUGIN_DIR . '/wp-easycart-data/design/layout/' . get_option( 'ec_option_base_layout' ) . '/ec_account_orders.php' );\n\t\t\telse\n\t\t\t\tinclude( WP_PLUGIN_DIR . \"/\" . EC_PLUGIN_DIRECTORY . '/design/layout/' . get_option( 'ec_option_latest_layout' ) . '/ec_account_orders.php' );\n\t\t}\n\t}",
"public function testOrdersAllForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->from/$this->to\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}",
"function envision_wsclient_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {\n\n}"
]
| [
"0.68128073",
"0.6222908",
"0.5846859",
"0.57626",
"0.5725412",
"0.5666967",
"0.56310606",
"0.5621187",
"0.5586009",
"0.55457044",
"0.55250883",
"0.55127203",
"0.5504466",
"0.54901034",
"0.5459834",
"0.54594934",
"0.5438751",
"0.5426124",
"0.5404935",
"0.5387009",
"0.53732264",
"0.5369784",
"0.5351656",
"0.53439677",
"0.5336907",
"0.53308946",
"0.53285396",
"0.5292313",
"0.5289883",
"0.5284841"
]
| 0.6328597 | 1 |
Order form: should a multiactivatable app/addon use a separate order form for each activation bool separate_order_forms = 4; | public function setSeparateOrderForms($var)
{
GPBUtil::checkBool($var);
$this->separate_order_forms = $var;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getSeparateOrderForms()\n {\n return $this->separate_order_forms;\n }",
"public function OrderForm()\n {\n $config = new Config();\n\n $app = new ALLApp();\n $app->configs = $config;\n\n //address\n $column = new Form();\n $column->dbType = dbTypeInteger;\n $column->widget = ZSelect2Widget::class;\n $column->options = [\n 'data' => Az::$app->market->address->getUserAddresses(11),\n 'name' => 'address_id',\n 'label' => ShopShipment::shipment_type\n ];\n $app->columns['address_id'] = $column;\n //address\n\n //shipment_type_id\n $column = new Form();\n $column->dbType = dbTypeString;\n $column->widget = ZMRadioWidget::class;\n $column->options = [\n 'config' => [\n 'hasPlace' => true\n ],\n 'data' => ShopShipment::shipment_type,\n 'name' => 'shipment_type',\n ];\n $column->rules = [\n ['zetsoft\\\\system\\\\validate\\\\ZRequiredValidator']\n ];\n $app->columns['shipment_type'] = $column;\n //shipment_type_id\n\n //contact\n $column = new Form();\n $column->dbType = dbTypeJsonb;\n $column->widget = ZFormWidget::class;\n $column->valueWidget = ZFormViewWidget::class;\n $column->options = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n 'title' => Az::l(\"Ваши контакты\"),\n 'titleClass' => ZColor::color['success-color']\n ],\n ];\n $column->valueOptions = [\n 'config' => [\n 'formClass' => 'zetsoft\\\\former\\\\auth\\\\AuthContactForm',\n\n ],\n ];\n $app->columns['contact_info'] = $column;\n //contact\n\n $app->cards = [];\n return Az::$app->forms->former->model($app);\n }",
"public function ShowFormInEditableOrderTable()\n {\n return false;\n }",
"function wcfmgs_group_manager_show_marketplace_orders( $is_show ) {\r\n \treturn true;\r\n }",
"function uc_order_pane_line_items($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'view':\n case 'customer':\n $line_items = $order->line_items;\n $items = _uc_line_item_list();\n foreach ($items as $item) {\n if (isset($item['display_only']) && $item['display_only'] == TRUE) {\n $result = $item['callback']('display', $order);\n if (is_array($result)) {\n foreach ($result as $line) {\n $line_items[] = array(\n 'title' => $line['title'],\n 'amount' => $line['amount'],\n 'weight' => $item['weight']\n );\n }\n }\n }\n }\n usort($line_items, 'uc_weight_sort');\n\n $build['line_items'] = array(\n '#prefix' => '<table class=\"line-item-table\">',\n '#suffix' => '</table>',\n );\n foreach ($line_items as $item) {\n $table_row = array(\n '#prefix' => '<tr>',\n '#suffix' => '</tr>',\n );\n\n $table_row['title'] = array(\n '#markup' => check_plain($item['title']),\n '#prefix' => '<td class=\"li-title\">',\n '#suffix' => '</td>',\n );\n\n $table_row['amount'] = array(\n '#theme' => 'uc_price',\n '#price' => $item['amount'],\n '#prefix' => '<td class=\"li-amount\">',\n '#suffix' => '</td>',\n );\n\n $build['line_items'][] = $table_row;\n }\n\n return $build;\n\n case 'edit-form':\n $options = array();\n $items = _uc_line_item_list();\n $line_items = $order->line_items;\n foreach ($items as $item) {\n if (isset($item['add_list']) && $item['add_list'] === TRUE) {\n $options[$item['id']] = check_plain($item['title']);\n }\n if (isset($item['display_only']) && $item['display_only'] == TRUE) {\n $result = $item['callback']('display', $order);\n if (is_array($result)) {\n foreach ($result as $line) {\n $line_items[] = array(\n 'line_item_id' => $line['id'],\n 'title' => $line['title'],\n 'amount' => $line['amount'],\n 'vat_rate' => $line['vat_rate'],\n 'weight' => $item['weight'],\n );\n }\n }\n }\n }\n usort($line_items, 'uc_weight_sort');\n\n $form['add_line_item'] = array('#type' => 'container');\n\n $form['add_line_item']['li_type_select'] = array(\n '#type' => 'select',\n '#title' => t('Add a line item'),\n '#options' => $options,\n );\n $form['add_line_item']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Add line'),\n '#submit' => array('uc_order_pane_line_items_submit', 'uc_order_pane_line_items_add'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_line_items_update',\n ),\n );\n $form['line_items'] = array(\n '#tree' => TRUE,\n '#theme' => 'uc_order_pane_line_items',\n '#prefix' => '<div id=\"order-line-items\">',\n '#suffix' => '</div>',\n );\n\n foreach ($line_items as $item) {\n $form['line_items'][$item['line_item_id']]['li_id'] = array(\n '#type' => 'hidden',\n '#value' => $item['line_item_id'],\n );\n if (isset($item['type']) && _uc_line_item_data($item['type'], 'stored') == TRUE) {\n $form['line_items'][$item['line_item_id']]['remove'] = array(\n '#type' => 'image_button',\n '#title' => t('Remove line item.'),\n '#src' => drupal_get_path('module', 'uc_store') . '/images/error.gif',\n '#button_type' => 'remove',\n '#submit' => array('uc_order_pane_line_items_submit', 'uc_order_pane_line_items_remove'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_line_items_update',\n ),\n '#return_value' => $item['line_item_id'],\n );\n $form['line_items'][$item['line_item_id']]['title'] = array(\n '#type' => 'textfield',\n '#title' => t('Title'),\n '#default_value' => $item['title'],\n '#size' => 40,\n '#maxlength' => 128,\n );\n $form['line_items'][$item['line_item_id']]['amount'] = array(\n '#type' => 'uc_price',\n '#title' => t('Amount'),\n '#default_value' => $item['amount'],\n '#size' => 6,\n '#allow_negative' => TRUE,\n );\n $form['line_items'][$item['line_item_id']]['vat_rate'] = array(\n '#type' => 'uc_vat_rate',\n '#title' => t('VAT rate'),\n '#default_value' => $item['vat_rate'],\n '#size' => 6,\n '#allow_negative' => FALSE,\n );\n }\n else {\n $form['line_items'][$item['line_item_id']]['title'] = array(\n '#markup' => check_plain($item['title']),\n );\n $form['line_items'][$item['line_item_id']]['amount'] = array(\n '#theme' => 'uc_price',\n '#price' => $item['amount'],\n );\n $form['line_items'][$item['line_item_id']]['vat_rate'] = array(\n '#theme' => 'uc_vat_rate',\n '#price' => $item['vat_rate'],\n );\n }\n }\n return $form;\n\n case 'edit-theme':\n return drupal_render($form['add_line_item'])\n . drupal_render($form['line_items']);\n\n case 'edit-process':\n uc_order_pane_line_items_submit($form, $form_state);\n return;\n }\n}",
"function uc_order_view_update_form($form, &$form_state, $order) {\n $form['order_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an order comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['order_comment_field']['order_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Order comments are used primarily to communicate with the customer.'),\n );\n\n $form['admin_comment_field'] = array(\n '#type' => 'fieldset',\n '#title' => t('Add an admin comment'),\n '#collapsible' => TRUE,\n '#collapsed' => TRUE,\n );\n $form['admin_comment_field']['admin_comment'] = array(\n '#type' => 'textarea',\n '#description' => t('Admin comments are only seen by store administrators.'),\n );\n\n $form['current_status'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_status,\n );\n\n $form['order_id'] = array(\n '#type' => 'hidden',\n '#value' => $order->order_id,\n );\n\n $form['controls'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('uc-inline-form', 'clearfix')),\n '#weight' => 10,\n );\n\n foreach (uc_order_status_list() as $status) {\n $options[$status['id']] = $status['title'];\n }\n $form['controls']['status'] = array(\n '#type' => 'select',\n '#title' => t('Order status'),\n '#default_value' => $order->order_status,\n '#options' => $options,\n );\n\n $form['controls']['notify'] = array(\n '#type' => 'checkbox',\n '#title' => t('Send e-mail notification on update.'),\n );\n\n $form['controls']['actions'] = array('#type' => 'actions');\n $form['controls']['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Update'),\n );\n\n return $form;\n}",
"public function testOrdersOneForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->orderId\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}",
"function uc_order_pane_products($op, $order, &$form = NULL, &$form_state = NULL) {\n\n switch ($op) {\n case 'view':\n return tapir_get_table('uc_op_products_view_table', $order);\n\n case 'customer':\n return tapir_get_table('uc_op_products_customer_table', $order);\n\n case 'edit-form':\n $form['add_product_button'] = array(\n '#type' => 'submit',\n '#value' => t('Add product'),\n '#submit' => array('uc_order_pane_products_select'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_products_ajax_callback',\n 'wrapper' => 'product-controls',\n ),\n );\n $form['add_blank_line_button'] = array(\n '#type' => 'submit',\n '#value' => t('Add blank line'),\n '#submit' => array('uc_order_edit_products_add_blank'),\n '#ajax' => array(\n 'callback' => 'uc_order_pane_products_ajax_callback',\n 'wrapper' => 'product-controls',\n ),\n );\n\n $form['product_controls'] = array(\n '#tree' => TRUE,\n '#prefix' => '<div id=\"product-controls\">',\n '#suffix' => '</div>',\n );\n\n $controls = array();\n\n if (isset($form_state['products_action'])) {\n switch ($form_state['products_action']) {\n case 'select':\n $controls = uc_order_product_select_form($form['product_controls'], $form_state, $order);\n break;\n case 'add_product':\n $controls = uc_order_add_product_form($form['product_controls'], $form_state, $order, $form_state['node']);\n break;\n }\n }\n\n $form['product_controls'] += $controls;\n\n $form += uc_order_edit_products_form($form, $form_state, $order->products);\n\n return $form;\n\n case 'edit-theme':\n $output = drupal_render($form['add_product_button']);\n $output .= drupal_render($form['add_blank_line_button']);\n $output .= drupal_render($form['product_controls']);\n $output .= drupal_render($form['products']);\n\n return $output;\n\n case 'edit-process':\n if (isset($form_state['values']['products'])) {\n foreach ($form_state['values']['products'] as $key => $product) {\n $product['data'] = unserialize($product['data']);\n uc_order_product_save($order->order_id, (object) $product);\n }\n }\n\n break;\n }\n}",
"function MyShop_Order($args) {\n global $_CONF, $_TABLES, $_MYSHOP_CONF;\n\n $sql = \"SELECT orderid,productid,email,quantity,status from {$_TABLES['myshop_order']}\";\n $result = DB_query($sql);\n $num = DB_numrows($result);\n\n if($num > 0)\n {\n for ($i = 0; $i < $num; $i++)\n {\n $A = DB_fetchArray($result);\n \n $product_name = DB_getItem($_TABLES['myshop_product'], 'name', \"productid={$A['productid']}\");\n if($A['status'] == \"on\"){\n $ship = \" checked\";\n }\n \n $row .= \"<form action=\\\"index.php\\\" METHOD=\\\"POST\\\"><tr>\\n\";\n $row .= \"<input type=\\\"hidden\\\" name=\\\"orderid\\\" value=\\\"{$A['orderid']}\\\">\\n\";\n $row .= \"<td>$product_name</td>\";\n $row .= \"<td>{$A['quantity']}</td>\";\n $row .= \"<td>{$A['email']}</td>\";\n $row .= \"<td><input type=\\\"checkbox\\\" name=\\\"status\\\"{$ship}></td>\";\n $row .= \"<td><button type=\\\"submit\\\" name=\\\"mode\\\" value=\\\"order_save\\\" class=\\\"uk-button uk-button-primary\\\">変更</button>\";\n $row .= \"<button type=\\\"submit\\\" name=\\\"mode\\\" value=\\\"order_delete\\\" class=\\\"uk-button\\\">削除</button></td>\\n\";\n $row .= \"</tr></form>\\n\";\n }\n }\n else {\n $row = MyShop_str('no_order');\n }\n\n $T = new Template($_CONF['path'] . 'plugins/myshop/templates');\n\n $T->set_file(array (\n 'topmenu' => 'topmenu.thtml',\n 'table' => 'table.thtml',\n ));\n\n $T->set_var(array(\n 'lang_piname' => $_MYSHOP_CONF['pi_display_name'],\n 'icon_url' => $_CONF['site_url'] . '/myshop/images/myshop.png',\n 'title' => MyShop_str('pi_name'),\n 'caption' => MyShop_str('top_menu_caption'),\n 'menu1' => MyShop_str('top_menu1'),\n 'menu2' => MyShop_str('top_menu2'),\n 'menu3' => MyShop_str('top_menu3'),\n 'menu4' => MyShop_str('top_menu4'),\n 'notfound' => $notfound,\n 'h1' => MyShop_str('product_name'),\n 'h2' => MyShop_str('tbl_head_amount'),\n 'h3' => MyShop_str('publish'),\n 'h4' => MyShop_str('finish'),\n 'h5' => \"-\",\n 'list' => $row,\n ));\n\n $T->parse('output', 'topmenu');\n $content .= $T->finish($T->get_var('output'));\n\n $T->parse('output', 'table');\n $content .= $T->finish($T->get_var('output'));\n \n $display = COM_createHTMLDocument($content);\n COM_output($display);\n}",
"public function form_order_type() {\n\t\tglobal $current_user;\n\n\t\tget_currentuserinfo();\n\n\t\t$data = array();\n\n\t\tif ( !isset( $_REQUEST['page'] ) )\n\t\t\treturn;\n\n\t\tif ( 'visual-form-builder-pro' !== $_REQUEST['page'] )\n\t\t\treturn;\n\n\t\tif ( isset( $_REQUEST['mode'] ) ) :\n\t\t\t$user_id = $current_user->ID;\n\n\t\t\t$type = get_user_meta( $user_id, 'vfb-form-order-type', true );\n\n\t\t\t$meta_value = ( in_array( $_REQUEST['mode'], array( 'order', 'list' ) ) ) ? esc_html( $_REQUEST['mode'] ) : '';\n\t\t\tupdate_user_meta( $user_id, 'vfb-form-order-type', $meta_value );\n\n\t\tendif;\n\t}",
"public function activateOrderAddons(\\Model_ClientOrder $order)\n {\n if (!$order->group_master) {\n return false;\n }\n\n $list = $this->getOrderAddonsList($order);\n foreach ($list as $addon) {\n try {\n $this->di['events_manager']->fire(array('event' => 'onBeforeAdminOrderActivate', 'params' => array('id' => $addon->id)));\n $this->createFromOrder($addon);\n $this->di['events_manager']->fire(array('event' => 'onBeforeAdminOrderActivate', 'params' => array('id' => $addon->id)));\n } catch (\\Exception $e) {\n error_log($e->getMessage());\n }\n }\n return true;\n }",
"function activate_wcfm_order_splitter() {\n\trequire 'includes/class-wcfmos-order-splitter-activator.php';\n\tWCFMOS_Order_Splitter_Activator::run();\n}",
"function uc_order_pane_customer($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'view':\n $build['uid'] = array('#markup' => t('Customer number: !user_link', array('!user_link' => $order->uid ? l($order->uid, 'user/' . $order->uid) : '0')));\n $build['primary_email'] = array('#markup' => '<br />' . t('Primary e-mail:') . '<br />' . check_plain($order->primary_email));\n\n return $build;\n\n case 'edit-form':\n $form['customer']['uid'] = array(\n '#type' => 'hidden',\n '#default_value' => $order->uid,\n );\n $form['customer']['uid_text'] = array(\n '#type' => 'textfield',\n '#title' => t('Customer number'),\n '#default_value' => $order->uid,\n '#maxlength' => 10,\n '#size' => 10,\n '#disabled' => TRUE,\n );\n $form['customer']['primary_email'] = array(\n '#type' => 'textfield',\n '#title' => t('E-mail address'),\n '#default_value' => $order->primary_email,\n '#maxlength' => 64,\n '#size' => 32,\n );\n return $form;\n\n case 'edit-theme':\n $output = '<div class=\"order-pane-icons\">';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/order_view.gif\" alt=\"' . t('Search for an existing customer.') . '\" '\n . 'title=\"' . t('Search for an existing customer.') . '\" onclick=\"load_customer_search();\" />';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/menu_customers_small.gif\" alt=\"' . t('Create a new customer.') . '\" '\n . 'title=\"' . t('Create a new customer.') . '\" onclick=\"load_new_customer_form();\" />';\n $output .= '</div>';\n $output .= '<div id=\"customer-select\"></div>';\n $output .= drupal_render($form['customer']);\n return $output;\n\n case 'edit-process':\n $changes['uid'] = $form_state['values']['uid'];\n $changes['primary_email'] = $form_state['values']['primary_email'];\n return $changes;\n }\n}",
"function pi_authoring_order_activities_form(&$form_state, $activities) {\n\t$form = array();\n\t$form['#theme'] = 'pi_authoring_order_activities_form';\n\t$form['#title'] = 'Inquiry Activities';\n\t\n\t$form['order_activities_activities'] = array(\n\t\t'#tree' => TRUE\n\t);\n\t\n\t$position = 0;\n\tforeach($activities as $nid => $activity)\n\t{\n\t\t$form['order_activities_activities'][$nid]['title'] =\n\t\t \tarray(\n\t\t \t\t'#value' => $activity['title']\n\t\t \t);\n\t\t$form['order_activities_activities'][$nid]['body'] = \n\t\t\tarray(\n\t\t\t\t'#value' => $activity['body']\n\t\t\t);\n\t\t$form['order_activities_activities'][$nid]['weight'] = \n\t\t\tarray(\n\t '#type' => 'weight',\n\t '#delta' => count($activity),\n\t '#default_value' => $position\n\t );\n \n $position++;\n\t}\n\t$form['submit'] = array(\n\t\t'#type' => 'submit',\n\t\t'#value' => t('Save'),\n \t);\n \treturn $form;\t\n}",
"public function action_order() {\n $field = $this->field($_POST[\"fieldid\"]);\n // Load pre-set emailaddress\n $address = Wi3::inst()->model->factory(\"site_data\")->setref($field)->setname(\"emailaddress\")->load()->data;\n if (empty($address)) {\n echo json_encode(\n Array(\n \"scriptsbefore\" => Array(\n \"0\" => \"$(wi3.popup.getDOM()).fadeOut(100,function() { $(this).html('Bestelling kon <strong>niet</strong> geplaatst worden! Stel de eigenaar van de site hiervan op de hoogte.').fadeIn(); } );\"\n )\n )\n );\n } else {\n // Send an email to client and to the pre-set emailaddress\n $presetemailaddress = $address;\n // Set folder to $_POST to store\n $folderid = Wi3::inst()->model->factory(\"site_data\")->setref($field)->setname(\"folder\")->load()->data;\n $_POST[\"folderid\"] = $folderid;\n // Store order\n $orders = Wi3::inst()->model->factory(\"site_data\")->setref($field)->setname(\"orders\")->load();\n if (!$orders->loaded())\n {\n $orders->create();\n }\n $ordersdata = unserialize($orders->data);\n $ordersdata[] = $_POST;\n $orders->data = serialize($ordersdata);\n $orders->update();\n // Create mail\n $message = $this->view(\"mail\")->set(\"post\", $_POST)->render();\n $clientmessage = $this->view(\"clientmail\")->set(\"post\", $_POST)->render();\n $subject = \"Bestelling foto's\";\n // Send mail to 'us' and to client\n mail($presetemailaddress, $subject, $message);\n mail($_POST[\"emailaddress\"], $subject, $clientmessage);\n echo json_encode(\n Array(\n \"scriptsbefore\" => Array(\n \"0\" => \"$(wi3.popup.getDOM()).fadeOut(100,function() { $(this).html('Bestelling succesvol geplaatst!').fadeIn(); } );\"\n )\n )\n );\n }\n }",
"function uc_order_pane_bill_to($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'view':\n case 'customer':\n $build = array('#markup' => uc_order_address($order, 'billing') . '<br />' . check_plain($order->billing_phone));\n return $build;\n\n case 'edit-form':\n $form['bill_to'] = array(\n '#type' => 'uc_address',\n '#default_value' => $order,\n '#required' => FALSE,\n '#attributes' => array('class' => array('uc-store-address-field')),\n '#key_prefix' => 'billing',\n );\n return $form;\n\n case 'edit-theme':\n $output = '<div class=\"order-pane-icons\">';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/address_book.gif\" alt=\"' . t('Select from address book.') . '\" '\n . 'title=\"' . t('Select from address book.') . '\" onclick=\"load_address_select(' . $form['order_uid']['#value'] . ', \\'#billing_address_select\\', \\'billing\\');\" />';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/copy.gif\" alt=\"' . t('Copy shipping information.') . '\" title=\"'\n . t('Copy shipping information.') . '\" onclick=\"uc_order_copy_shipping_to_billing();\" />';\n $output .= '</div>';\n $output .= '<div id=\"billing_address_select\"></div>';\n return $output . drupal_render($form['bill_to']);\n\n case 'edit-process':\n foreach ($form_state['values'] as $key => $value) {\n if (substr($key, 0, 8) == 'billing_') {\n if (uc_address_field_enabled(substr($key, 8))) {\n $changes[$key] = $value;\n }\n }\n }\n return $changes;\n }\n}",
"function show() {\n global $_SERVER;\n global $lang;\n global $theme;\n global $_SESSION;\n global $__order_register;\n global $__order_register_tab;\n global $_REQUEST;\n global $sess;\n \n // odczytaj jakie sa ustawienia sortowania obecnie\n if (! empty($_SESSION[\"__order_register_set\"])){\n $tab=$_SESSION[\"__order_register_set\"];\n } else {\n $tab['partner']=0;\n $tab['amount']=0;\n $tab['rake_off']=0;\n }\n\n if (! empty($_REQUEST['order'])) {\n $order=$_REQUEST['order']; $set=false; \n $order=intval($order);\n \n switch ($order) {\n case \"1\":$tab['partner']=-1; $set=true; // zmien \"strzalke\" (kierunek sortowania)\n break;\n case \"2\":$tab['amount']=-1; $set=true;\n break;\n case \"3\":$tab['rake_off']=-1; $set=true;\n break;\n case \"-1\":$tab['partner']=1; $set=true;\n break;\n case \"-2\":$tab['amount']=1; $set=true;\n break;\n case \"-3\":$tab['rake_off']=1; $set=true;\n break;\n default:$tab['partner']=-1; $set=true;\n break;\n } // end switch\n \n } // end if\n\n // start: sprawdz czy wybrano jakiekolwiek sortowanie, jesli nie to wstaw sortowanie wg ceny od najmniejszej\n // chyba ze jest to wyszukiwanie wedlug slowa, wtedy wstaw sortowanie wedlug dopasowania\n if (@$set!=true) {\n $tab['partner']=-1;\n } \n // end:\n\n // zapamietaj tablice sortowania w sesji\n $__order_main_tab_register=&$tab;\n $sess->register(\"__order_register_tab\",$order_register_tab);\n $__order_main_register=&$order;\n $sess->register(\"__order_register\",$__order_register);\n\n $url=$_SERVER['REQUEST_URI'];\n \n // pomin sesje, uniknij duplikacji zmiennej sesji\n $url=preg_replace(\"/&session_id=[a-z0-9]+$/\",\"\",$url);\n $url=ereg_replace(\"\\?order=[0-9-]+$\",\"\",$url);\n \n // sortowanie wg nazwy\n if ($tab['partner']==1) {\n print \"<a href=$url?order=1><u>\".$lang->order_by['partner'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/up.png\"); print \"> \";\n } elseif ($tab['partner']==-1) {\n print \"<a href=$url?order=-1><u>\".$lang->order_by['partner'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/down.png\"); print \"> \";\n } else {\n print \"<a href=$url?order=1><u>\".$lang->order_by['partner'].\"</u></a> \";\n }\n\n // sortowanie wg ceny\n if ($tab['amount']==1) {\n print \"<a href=$url?order=2><u>\".$lang->order_by['amount'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/up.png\"); print \"> \"; \n } elseif ($tab['amount']==-1) {\n print \"<a href=$url?order=-2><u>\".$lang->order_by['amount'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/down.png\"); print \"> \"; \n } else {\n print \"<a href=$url?order=2><u>\".$lang->order_by['amount'].\"</u></a> \";\n } \n\n // sortowanie wg producenta\n if ($tab['rake_off']==1) {\n print \"<a href=$url?order=3><u>\".$lang->order_by['rake_off'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/up.png\"); print \"> \";\n } elseif ($tab['rake_off']==-1) {\n print \"<a href=$url?order=-3><u>\".$lang->order_by['rake_off'].\"</u></a> \";\n print \"<img src=\";$theme->img(\"_img/down.png\"); print \"> \";\n } else {\n print \"<a href=$url?order=3><u>\".$lang->order_by['rake_off'].\"</u></a> \";\n }\n\n return;\n }",
"private function processOrdersForms($crawler)\n\t{\n\t\t$orders_one_form = $crawler->filter('button#order_id_Search')->form([\n\t\t\t'order_id[id]'\t=> $this->orderId,\n\t\t]);\n\n\t\t$orders_all_form = $crawler->filter('button#from_to_Search')->form([\n\t\t\t'from_to[from]' => $this->from,\n\t\t\t'from_to[to]'\t=> $this->to,\n\t\t]);\n\n\t\tif ($this->client->submit($orders_one_form) || $this->client->submit($orders_all_form)) {\n\t\t\t$this->assertSame(Response::HTTP_FOUND, $this->client->getResponse()->getStatusCode());\n\t\t\t\n\t\t\t$crawler = $this->client->followRedirect();\n\t\t\t$this->assertNotNull($crawler->getUri());\n\t\t}\n\t}",
"public function ShowFormOutsideEditableOrderTable()\n {\n return false;\n }",
"function theme_pi_authoring_order_activities_form($form) {\n\t$output = '';\n\t$output .= '<div>Drag the arrows up and down to to change the order of the activity and click save to finish.</div>';\n\tdrupal_add_tabledrag('pi-authoring-order-activities-sort', 'order', 'sibling', 'pi-authoring-order-activities-element');\n\t$header = array(array('data' => '', 'width' => '29'), 'Activity', 'Description', 'Position');\n\n\t$rows = array();\n\tforeach (element_children($form['order_activities_activities']) as $key)\n\t{\n\t\t// Add class to group weight fields for drag and drop.\n\t\t$form['order_activities_activities'][$key]['weight']['#attributes']['class'] = 'pi-authoring-order-activities-element';\n\n\t\t$row = array('');\n\t\t$row[] = l(drupal_render($form['order_activities_activities'][$key]['title']), \"node/$key/edit\");\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['body']);\n\t\t$row[] = drupal_render($form['order_activities_activities'][$key]['weight']);\n\n\t\t$rows[] = array('data' => $row, 'class' => 'draggable');\n\t}\n\t$output .= theme('table', $header, $rows, array('id' => 'pi-authoring-order-activities-sort'));\n\t$output .= drupal_render($form);\n\treturn $output;\n}",
"function uc_order_pane_ship_to($op, $order, &$form = NULL, &$form_state = NULL) {\n switch ($op) {\n case 'customer':\n if (!uc_order_is_shippable($order)) {\n return;\n }\n case 'view':\n $build = array('#markup' => uc_order_address($order, 'delivery') . '<br />' . check_plain($order->delivery_phone));\n return $build;\n\n case 'edit-form':\n $form['ship_to'] = array(\n '#type' => 'uc_address',\n '#default_value' => $order,\n '#required' => FALSE,\n '#attributes' => array('class' => array('uc-store-address-field')),\n '#key_prefix' => 'delivery',\n );\n return $form;\n\n case 'edit-theme':\n $output = '<div class=\"order-pane-icons\">';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/address_book.gif\" alt=\"' . t('Select from address book.') . '\" '\n . 'title=\"' . t('Select from address book.') . '\" onclick=\"load_address_select(' . $form['order_uid']['#value'] . ', \\'#delivery_address_select\\', \\'delivery\\');\" />';\n $output .= ' <img src=\"' . base_path() . drupal_get_path('module', 'uc_store')\n . '/images/copy.gif\" alt=\"' . t('Copy billing information.') . '\" title=\"'\n . t('Copy billing information.') . '\" onclick=\"uc_order_copy_billing_to_shipping();\" />';\n $output .= '</div>';\n $output .= '<div id=\"delivery_address_select\"></div>';\n return $output . drupal_render($form['ship_to']);\n\n case 'edit-process':\n foreach ($form_state['values'] as $key => $value) {\n if (substr($key, 0, 9) == 'delivery_') {\n if (uc_address_field_enabled(substr($key, 9))) {\n $changes[$key] = $value;\n }\n }\n }\n return $changes;\n }\n}",
"function wyz_ajax_business_tabs_save_form() {\n\n\t$form_data = json_decode( stripslashes_deep( $_REQUEST['form_data'] ),true );\n\tif ( ! empty( $form_data ) && is_array( $form_data ) ) {\n\t\tforeach ( $form_data as $key => $value ) {\n\t\t\t$form_data[ $key ]['hidden'] = true;\n\t\t}\n\t}\n\tupdate_option( 'wyz_business_tabs_order_data', $form_data );\n\twp_die();\n}",
"function commerce_quickbooks_settings_form($form, &$form_state) {\n\n $form['commerce_quickbooks_commerce_cron'] = array(\n '#type' => 'checkbox',\n '#title' => t('Enable Drupal Commerce cron'),\n '#default_value' => variable_get('commerce_quickbooks_commerce_cron'),\n '#description' => t('Warning - This setting will send all your customers, products and orders to QuickBooks online during cron runs.'),\n );\n \n // Build an array of order status options grouped by order state.\n $options = array();\n foreach (commerce_order_state_get_title() as $name => $title) {\n foreach (commerce_order_statuses(array('state' => $name)) as $order_status) {\n\n // Only include enabled statues and the current order status.\n if (!empty($order_status['status']) || $order->status == $order_status['name']) {\n $options[check_plain($title)][$order_status['name']] = check_plain($order_status['title']);\n }\n }\n }\n \n $form['commerce_quickbooks_order_status'] = array(\n '#type' => 'select',\n '#title' => t('Order status to send'),\n '#multiple' => TRUE,\n '#options' => $options,\n '#default_value' => variable_get('commerce_quickbooks_order_status'),\n '#description' => t('Select the order statuses that should be considered ready to send. You will want to select the final status. Not one that gets systematically updated. <br>This is because the queue gets built by querying the database for orders matching this status.'),\n );\n\n return(system_settings_form($form));\n\n}",
"function showForm()\n{\n global $items;\n echo \"<h2>Make your order</h2>\";\n echo '<form action=\"index.php\" method=\"post\">';\n foreach ($items as $item) {\n //create a text input in the form for each item.\n //name attribute is \"item_[item->ID]\"\n echo '<p><b>' .$item->Name . '</b> <input type=\"number\" min=\"0\" name=\"item_' . $item->ID . '\" /></p><p>';\n $extraCounter = 0;\n foreach ($item->Extras as $extra) {\n //create a checkbox for each extra under the current item.\n //name attribute is \"extra_[item->ID]_[0,1,2,3,...]\"\"\n echo '<input type=\"checkbox\" name=\"extra_' . $item->ID . '_' . $extraCounter . '\"/>' . $extra . ' ';\n $extraCounter++;\n }\n echo '</p>';\n }\n echo '<p>* Each extra is $ 0.25.</p>';\n //create submit button and hidden input\n echo '<p>\n <input type=\"submit\" value=\"Submit\" id=\"submit\">\n </p>\n <input type=\"hidden\" name=\"action\" value=\"display\" />\n </form>';\n\n \n}",
"public function onRsformBackendAfterShowFormEditTabs(): void\n\t{\n\t\t$formId = $this->app->input->getInt('formId');\n\t\t$tables = $this->db->getTableList();\n\t\t$table = $this->db->getPrefix() . 'rsform_jdideal';\n\n\t\tif (!in_array($table, $tables, true))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// Load the settings\n\t\t$settings = $this->loadFormSettings($formId);\n\n\t\t$form = new Form('ropayments');\n\t\t$form->loadFile(__DIR__ . '/configuration.xml');\n\t\t$form->bind(['roPaymentsParams' => $settings->toArray()]);\n\n\t\tHTMLHelper::_('formbehavior.chosen');\n\n\t\t?>\n\t\t<div id=\"ropayments\" class=\"form-horizontal <?php\n\t\techo Version::MAJOR_VERSION === 3 ? 'ropayments3' : ''; ?>\">\n\t\t\t<?php\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.startTabSet', 'ropayments-config',\n\t\t\t\t['active' => 'ropayments-general']\n\t\t\t);\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-general',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_GENERAL')\n\t\t\t);\n\t\t\techo $form->renderField('profileAlias', 'roPaymentsParams');\n\t\t\techo $form->renderField('currency', 'roPaymentsParams');\n\t\t\techo $form->renderField('allowEmpty', 'roPaymentsParams');\n\t\t\techo $form->renderField('showMessage', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-currency',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_PRICE')\n\t\t\t);\n\t\t\techo $form->renderField('thousands', 'roPaymentsParams');\n\t\t\techo $form->renderField('decimal', 'roPaymentsParams');\n\t\t\techo $form->renderField('numberDecimals', 'roPaymentsParams');\n\t\t\techo $form->renderField('priceMask', 'roPaymentsParams');\n\t\t\techo $form->renderField('amountMask', 'roPaymentsParams');\n\t\t\techo '<div class=\"totalPriceMask\">';\n\t\t\techo $form->renderField('totalMask', 'roPaymentsParams');\n\t\t\techo '</div>';\n\t\t\techo $form->renderField('taxType', 'roPaymentsParams');\n\t\t\techo $form->renderField('taxValue', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-fields',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_FIELDS')\n\t\t\t);\n\t\t\techo $form->renderField('fieldOrderNumber', 'roPaymentsParams');\n\t\t\techo $form->renderField('fieldName', 'roPaymentsParams');\n\t\t\techo $form->renderField('fieldEmail', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_(\n\t\t\t\t'bootstrap.addTab',\n\t\t\t\t'ropayments-config',\n\t\t\t\t'ropayments-emails',\n\t\t\t\tText::_('PLG_RSFP_JDIDEAL_CONFIG_MAIL')\n\t\t\t);\n\t\t\techo $form->renderField('userEmail', 'roPaymentsParams');\n\t\t\techo $form->renderField('adminEmail', 'roPaymentsParams');\n\t\t\techo $form->renderField('additionalEmails', 'roPaymentsParams');\n\t\t\techo $form->renderField(\n\t\t\t\t'sendEmailOnFailedPayment', 'roPaymentsParams'\n\t\t\t);\n\t\t\techo $form->renderField('confirmationEmail', 'roPaymentsParams');\n\t\t\techo '<div class=\"control-group ro-confirmation-info\" data-showon=\\'[{\"field\":\"roPaymentsParams[confirmationEmail]\",\"values\":[\"1\"],\"sign\":\"=\",\"op\":\"\"}]\\' style=\"display: none;\">';\n\t\t\techo '<div class=\"text-info\">' . Text::_(\n\t\t\t\t\t'PLG_RSFP_JDIDEAL_CONFIRMATIONHELP'\n\t\t\t\t) . '</div>';\n\t\t\techo '</div>';\n\t\t\techo $form->renderField(\n\t\t\t\t'confirmationRecipient', 'roPaymentsParams'\n\t\t\t);\n\t\t\techo $form->renderField('confirmationSubject', 'roPaymentsParams');\n\t\t\techo $form->renderField('confirmationMessage', 'roPaymentsParams');\n\t\t\techo $form->renderField('includeNonSelected', 'roPaymentsParams');\n\t\t\techo HTMLHelper::_('bootstrap.endTab');\n\t\t\techo HTMLHelper::_('bootstrap.endTabSet');\n\t\t\t?>\n\t\t</div>\n\t\t<?php\n\t}",
"public function init()\n {\n parent::init();\n \n $this->addCssFile(\"/css/library/Account/Form/activate-accounts.css\");\n $this->addJsFile(\"/js/library/Account/Form/activate-accounts.js\");\n \n //add js file to do cool input masking\n $this->addJsFile(\"/js/jquery.maskedinput-1.3.js\");\n \n $this->setDecorators(self::$_formDecorators);\n \n foreach ($this->order->order_configurations as $config) {\n $subform = new \\Account_Form_ActivateAccountsSubForm($config->id);\n $this->addSubForm($subform, \"orderConfiguration_\" . $config->id);\n }\n \n $emailEveryone = new Zend_Form_Element_Checkbox(\"emailEveryone\");\n $emailEveryone->setLabel(\"Send email to account holders with their login information.\")\n ->setDecorators(self::$checkboxDecorators)\n ->setValue(1);\n $this->addElement($emailEveryone);\n \n $orderId = new Zend_Form_Element_Hidden(\"orderId\");\n $orderId->setDecorators(array('ViewHelper'));\n $this->addElement($orderId);\n\n $saveButton = new Fisdap_Form_Element_SaveButton(\"saveButton\");\n $saveButton->setLabel(\"Save\")\n ->setDecorators(self::$buttonDecorators);\n $this->addElement($saveButton);\n \n if ($this->order->id) {\n $this->setDefaults(array(\n 'orderId' => $this->order->id,\n ));\n }\n }",
"function displayOrderForm() {\n $output = '<div class=\"c-order\">\n\t\t\t<div class=\"c-order-select\">\n\t\t\t\t<form name=\"ChangeOrder\" action=\"\">\n\t\t\t\t\t<select name=\"TheOrder\">\n\t\t\t\t\t\t<option value=\"0\">' .\n wfMessage( 'comments-sort-by-date' )->plain() .\n '</option>\n\t\t\t\t\t\t<option value=\"1\">' .\n wfMessage( 'comments-sort-by-score' )->plain() .\n '</option>\n\t\t\t\t\t</select>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t<div id=\"spy\" class=\"c-spy\">\n\t\t\t\t<a href=\"javascript:void(0)\">' .\n wfMessage( 'comments-auto-refresher-enable' )->plain() .\n '</a>\n\t\t\t</div>\n\t\t\t<div class=\"cleared\"></div>\n\t\t</div>\n\t\t<br />' . \"\\n\";\n\n return $output;\n }",
"public function display_account_orders( ){\n\t\tif( $this->is_page_visible( \"orders\" ) ){\n\t\t\tif( file_exists( WP_PLUGIN_DIR . '/wp-easycart-data/design/layout/' . get_option( 'ec_option_base_layout' ) . '/ec_account_orders.php' ) )\t\n\t\t\t\tinclude( WP_PLUGIN_DIR . '/wp-easycart-data/design/layout/' . get_option( 'ec_option_base_layout' ) . '/ec_account_orders.php' );\n\t\t\telse\n\t\t\t\tinclude( WP_PLUGIN_DIR . \"/\" . EC_PLUGIN_DIRECTORY . '/design/layout/' . get_option( 'ec_option_latest_layout' ) . '/ec_account_orders.php' );\n\t\t}\n\t}",
"public function testOrdersAllForms()\n\t{\n\t\t$crawler = $this->client->request('GET', \"/orders/$this->from/$this->to\");\n\n\t\t$this->processOrdersForms($crawler);\n\t}",
"function envision_wsclient_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {\n\n}"
]
| [
"0.6329592",
"0.62232304",
"0.58490294",
"0.5764547",
"0.57261634",
"0.5667029",
"0.5632284",
"0.5621149",
"0.55868584",
"0.55476135",
"0.5525275",
"0.55119634",
"0.5504955",
"0.5491058",
"0.54601866",
"0.54596144",
"0.5440218",
"0.5426925",
"0.54066586",
"0.5387982",
"0.537339",
"0.5370366",
"0.5351521",
"0.53449726",
"0.5335245",
"0.5331221",
"0.53302187",
"0.5292582",
"0.52915615",
"0.52843785"
]
| 0.6813406 | 0 |
Order form: required common form fields .marketplaceapps.v1.IncludedCommonFormFields common_form_required_fields = 5; | public function getCommonFormRequiredFields()
{
return $this->common_form_required_fields;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setCommonFormRequiredFields(&$var)\n {\n GPBUtil::checkMessage($var, \\Marketplaceapps\\V1\\IncludedCommonFormFields::class);\n $this->common_form_required_fields = $var;\n }",
"public function setCommonForm(&$var)\n {\n GPBUtil::checkMessage($var, \\Marketplaceapps\\V1\\IncludedCommonFormFields::class);\n $this->common_form = $var;\n }",
"public function getFrontEndRequiredFields();",
"public function getFormFields()\n\t{\n\t\tMage::log(\" --- Snap* Hosted Payments API : getFormFields --- \");\n\n\t\t$aOBFields = array();\n\t\t$billing = $this->getOrder()->getBillingAddress();\n\t\t$shipping = $this->getOrder()->getShippingAddress();\n\t\t$items = $this->getOrder()->getAllItems();\n\n\t\t// customer info\n\t\t$aOBFields['customer[merchant_customer_id]'] = $this->getOrder()->getCustomerId();\n\t\t$aOBFields['customer[email]'] = $this->getOrder()->getCustomerEmail();\n\t\t$aOBFields['customer[first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['customer[last_name]'] = $billing->getLastname();\n\t\t$aOBFields['customer[phone]'] = $billing->getTelephone();\n\n\t\t// order header\n\t\t$aOBFields['order[merchant_order_id]'] = $this->getOrder()->getRealOrderId();\n\t\t$aOBFields['order[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\t\t$aOBFields['order[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t$aOBFields['order[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t$aOBFields['order[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t$aOBFields['order[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\t\t//$aOBFields['order[ship_method]'] = '';\n\n\t\t// billing fields\n\t\t$aOBFields['order[billto_company]'] = $billing->getCompany();\n\t\t$aOBFields['order[billto_first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['order[billto_last_name]'] = $billing->getLastname();\n\t\t$aOBFields['order[billto_address1]'] = $billing->getStreet1();\n\t\t$aOBFields['order[billto_address2]'] = $billing->getStreet2();\n\t\t$aOBFields['order[billto_city]'] = $billing->getCity();\n\t\t$aOBFields['order[billto_state]'] = $billing->getRegionCode();\n\t\t$aOBFields['order[billto_country]'] = $billing->getCountry();\n\t\t$aOBFields['order[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t// shipping fields\n\t\tif(!empty($shipping))\n\t\t{\n\t\t\t$aOBFields['order[shipto_company]'] = $shipping->getCompany();\n\t\t\t$aOBFields['order[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t$aOBFields['order[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t$aOBFields['order[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t$aOBFields['order[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t$aOBFields['order[shipto_city]'] = $shipping->getCity();\n\t\t\t$aOBFields['order[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t$aOBFields['order[shipto_country]'] = $shipping->getCountry();\n\t\t\t$aOBFields['order[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t}\n\n\t\t// items\n\t\tif (!empty($items))\n\t\t{\n\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t{\n\t\t\t\t$aOBFields['order_item['.$nCount.'][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][name]'] = $items[$nCount]->getName();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][price]'] = self::_currencyAmount($items[$nCount]->getPrice());\n\t\t\t\t$aOBFields['order_item['.$nCount.'][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][tax]'] = self::_currencyAmount($items[$nCount]->getTaxAmount());\n\t\t\t}\n\t\t}\n\n\t\t// return URLs\n\t\t$aOBFields['return_url'] = Mage::getUrl('hostedpayments/standard/success', array('_secure' => true));\n\t\t$aOBFields['cancel_url'] = Mage::getUrl('hostedpayments/standard/cancel', array('_secure' => true));\n\n\t\t// check to see if the aheadWorks SARP module is being used and is enabled. if it is then we need to\n\t\t// add additional fields to the post fields array\n\t\tif($this->_isUsingSARP() === true)\n\t\t{\n\t\t\tMage::log(\"is using SARP \");\n\n\t\t\t$aSubscriptionIDs = array();\n\t\t\t$aSubscriptionIDs = $this->_getSubscriptionByOrderID($this->getOrder()->getId());\n\n\t\t\t/*\n\t\t\tforeach($aSubscriptionIDs as $nID)\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($nID);\n\t\t\t}\n\t\t\t*/\n\n\t\t\tif(!empty($aSubscriptionIDs))\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($aSubscriptionIDs[0]);\n\t\t\t\t$dStartDate = new Zend_Date($oSubscription->getNextSubscriptionEventDate($oSubscription->getDateStart()), Zend_Date::DATE_LONG);\n\t\t\t\t$nTotalOccurrences = 0;\n\n\t\t\t\tif($oSubscription->isInfinite())\n\t\t\t\t\t$nTotalOccurrences = 9999;\n\t\t\t\telse\n\t\t\t\t\t$nTotalOccurrences = Mage::getModel('sarp/sequence')->getCollection()->addSubscriptionFilter($oSubscription)->count();\n\n\t\t\t\t//Mage::log(\"Subscription ID: \" . $aSubscriptionIDs[0]);\n\t\t\t\t//Mage::log(\"Subscription Inerval: \" . $oSubscription->getPeriod()->getPeriodType().\"s\");\n\t\t\t\t//Mage::log(\"Subscription Occurences: \" . $nTotalOccurrences);\n\n\t\t\t\t$aOBFields['sub[auto_process]'] = 0;\n\t\t\t\t$aOBFields['sub[start_date]'] = $dStartDate;\n\t\t\t\t$aOBFields['sub[interval_length]'] = $oSubscription->getPeriod()->getPeriodValue();\n\t\t\t\t$aOBFields['sub[interval_unit]'] = $oSubscription->getPeriod()->getPeriodType().\"s\";\n\t\t\t\t$aOBFields['sub[total_occurrences]'] = $nTotalOccurrences;\n\n\t\t\t\t$aOBFields['sub[trial_occurrences]'] = '';\n\t\t\t\t$aOBFields['sub[trial_amount]'] = 0.00;\n\n\t\t\t\t// order header\n\t\t\t\t$aOBFields['sub[merchant_subscription_id]'] = $this->getOrder()->getRealOrderId();\n\t\t\t\t//$aOBFields['sub[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\n\t\t\t\t// grand total should be the normal price not the first period price\n\n\t\t\t\t$aOBFields['sub[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t\t\t$aOBFields['sub[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t\t\t$aOBFields['sub[ship_method]'] = '';\n\t\t\t\t$aOBFields['sub[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\n\t\t\t\t// billing fields\n\t\t\t\t$aOBFields['sub[billto_company]'] = $billing->getCompany();\n\t\t\t\t$aOBFields['sub[billto_first_name]'] = $billing->getFirstname();\n\t\t\t\t$aOBFields['sub[billto_last_name]'] = $billing->getLastname();\n\t\t\t\t$aOBFields['sub[billto_address1]'] = $billing->getStreet1();\n\t\t\t\t$aOBFields['sub[billto_address2]'] = $billing->getStreet2();\n\t\t\t\t$aOBFields['sub[billto_city]'] = $billing->getCity();\n\t\t\t\t$aOBFields['sub[billto_state]'] = $billing->getRegionCode();\n\t\t\t\t$aOBFields['sub[billto_country]'] = $billing->getCountry();\n\t\t\t\t$aOBFields['sub[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t\t\t// shipping fields\n\t\t\t\tif(!empty($shipping))\n\t\t\t\t{\n\t\t\t\t\t$aOBFields['sub[shipto_company]'] = $shipping->getCompany();\n\t\t\t\t\t$aOBFields['sub[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t\t\t$aOBFields['sub[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t\t\t$aOBFields['sub[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t\t\t$aOBFields['sub[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t\t\t$aOBFields['sub[shipto_city]'] = $shipping->getCity();\n\t\t\t\t\t$aOBFields['sub[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t\t\t$aOBFields['sub[shipto_country]'] = $shipping->getCountry();\n\t\t\t\t\t$aOBFields['sub[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t\t\t}\n\n\t\t\t\t$items = $this->getOrder()->getAllItems();\n\t\t\t\t$nCount = 0;\n\t\t\t\t$nSubCount = 0;\n\t\t\t\t$aOBFields['sub[total_subtotal]'] = 0;\n\t\t\t\t$aOBFields['sub[total]'] = 0;\n\n\t\t\t\t// items\n\t\t\t\tif (!empty($items))\n\t\t\t\t{\n\t\t\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t\t\t{\n\t\t\t\t\t\t$oItem = $items[$nCount];\n\n\t\t\t\t\t\tif(Mage::helper('sarp')->isSubscriptionType($items[$nCount]) == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$productId = $oItem->getProductId();\n\t\t\t\t\t\t\t$oProduct = Mage::getModel('catalog/product')->load($productId);\n\t\t\t\t\t\t\t$nFirstPeriodPrice = self::_currencyAmount($oProduct->getAwSarpFirstPeriodPrice());\n\t\t\t\t\t\t\t$nNormalPrice = self::_currencyAmount((!empty($nFirstPeriodPrice) ? $oProduct->getAwSarpSubscriptionPrice() : $items[$nCount]->getPrice()));\n\n\t\t\t\t\t\t\tMage::log(\"Normal Price:\" . $nNormalPrice);\n\t\t\t\t\t\t\tMage::log(\"First Period Price:\" . $nFirstPeriodPrice);\n\n\t\t\t\t\t\t\tif ($oItem->canInvoice()) $qtys[$oItem->getId()] = $oItem->getQtyToInvoice();\n\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][name]'] = $items[$nCount]->getName();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][price]'] = $nNormalPrice;\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t\t\t\t//$aOBFields['sub_item[' . $nSubCount . '][details]'] = '';\n\n\t\t\t\t\t\t\tif ($oItem->getIsVirtual())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = 0.00;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t$aOBFields['sub[trial_amount]'] = $nFirstPeriodPrice;\n\t\t\t\t\t\t\t*/\n\n\t\t\t\t\t\t\t$aOBFields['sub[total_subtotal]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\t\t\t\t\t\t\t$aOBFields['sub[total]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\n\t\t\t\t\t\t\t$nSubCount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tMage::log(\"Not a subscription item: \" . $items[$nCount]->getName());\n\t\t\t\t\t}\n\t\t\t\t\tMage::log(\"Sub. Sub Total: \" . $aOBFields['sub[total_subtotal]']);\n\t\t\t\t\tMage::log(\"Sub. Total: \" . $aOBFields['sub[total]']);\n\t\t\t\t}\n\n\t\t\t\t$aOBFields['sub[total]'] = $aOBFields['sub[total]'] + $aOBFields['sub[total_shipping]'];\n\t\t\t}\n\t\t}\n\n\t\t// generate the MAC and add it as the final param\n\t\t$aOBFields['mac'] = $this->getFormFieldsMAC($aOBFields);\n\n\t\tMage::log(print_r($aOBFields, true));\n\n\t\treturn $aOBFields;\n\t}",
"function get_apr_mandatory_fields(){\n $fields = array(\n 'field_ef_date_and_partici_bm',\n 'field_ef_working_methods_rating',\n 'field_ef_general_kind_access',\n 'field_ef_related_acess',\n 'field_ef_general_kind_useful',\n 'field_ef_related_deliv_useful',\n 'field_ef_support_admin_rating',\n 'field_ef_support_deliver_rating',\n //'field_ef_invoicing_policy_rating',\n //'field_ef_ef_adherence_rating',\n //'field_ef_yammer_rating',\n 'field_ef_cms_system_rating',\n //'field_ef_network_tend_main_area',\n //'field_ef_completed_by',\n );\n\n return $fields;\n}",
"function give_get_required_fields( $form_id ) {\n\n\t$posted_data = give_clean( filter_input_array( INPUT_POST ) );\n\t$payment_mode = give_get_chosen_gateway( $form_id );\n\n\t$required_fields = array(\n\t\t'give_email' => array(\n\t\t\t'error_id' => 'invalid_email',\n\t\t\t'error_message' => __( 'Please enter a valid email address.', 'give' ),\n\t\t),\n\t\t'give_first' => array(\n\t\t\t'error_id' => 'invalid_first_name',\n\t\t\t'error_message' => __( 'Please enter your first name.', 'give' ),\n\t\t),\n\t);\n\n\t$name_title_prefix = give_is_name_title_prefix_required( $form_id );\n\tif ( $name_title_prefix ) {\n\t\t$required_fields['give_title'] = array(\n\t\t\t'error_id' => 'invalid_title',\n\t\t\t'error_message' => __( 'Please enter your title.', 'give' ),\n\t\t);\n\t}\n\t\n\t// If credit card fields related actions exists then check for the cc fields validations.\n\tif (\n\t\thas_action(\"give_{$payment_mode}_cc_form\", 'give_get_cc_form' ) ||\n\t\thas_action('give_cc_form', 'give_get_cc_form' )\n\t) {\n\t\t\n\t\t// Validate card number field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_number'] ) &&\n\t\t\tempty( $posted_data['card_number'] )\n\t\t) {\n\t\t\t$required_fields['card_number'] = array(\n\t\t\t\t'error_id' => 'empty_card_number',\n\t\t\t\t'error_message' => __( 'Please enter a credit card number.', 'give' ),\n\t\t\t);\n\t\t}\n\t\t\n\t\t// Validate card cvc field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_cvc'] ) &&\n\t\t\tempty( $posted_data['card_cvc'] )\n\t\t) {\n\t\t\t$required_fields['card_cvc'] = array(\n\t\t\t\t'error_id' => 'empty_card_cvc',\n\t\t\t\t'error_message' => __( 'Please enter a credit card CVC information.', 'give' ),\n\t\t\t);\n\t\t}\n\t\t\n\t\t// Validate card name field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_name'] ) &&\n\t\t\tempty( $posted_data['card_name'] )\n\t\t) {\n\t\t\t$required_fields['card_name'] = array(\n\t\t\t\t'error_id' => 'empty_card_name',\n\t\t\t\t'error_message' => __( 'Please enter a name of your credit card account holder.', 'give' ),\n\t\t\t);\n\t\t}\n\t\t\n\t\t// Validate card expiry field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_expiry'] ) &&\n\t\t\tempty( $posted_data['card_expiry'] )\n\t\t) {\n\t\t\t$required_fields['card_expiry'] = array(\n\t\t\t\t'error_id' => 'empty_card_expiry',\n\t\t\t\t'error_message' => __( 'Please enter a credit card expiry date.', 'give' ),\n\t\t\t);\n\t\t}\n\t}\n\n\t$require_address = give_require_billing_address( $payment_mode );\n\n\tif ( $require_address ) {\n\t\t$required_fields['card_address'] = array(\n\t\t\t'error_id' => 'invalid_card_address',\n\t\t\t'error_message' => __( 'Please enter your primary billing address.', 'give' ),\n\t\t);\n\t\t$required_fields['card_zip'] = array(\n\t\t\t'error_id' => 'invalid_zip_code',\n\t\t\t'error_message' => __( 'Please enter your zip / postal code.', 'give' ),\n\t\t);\n\t\t$required_fields['card_city'] = array(\n\t\t\t'error_id' => 'invalid_city',\n\t\t\t'error_message' => __( 'Please enter your billing city.', 'give' ),\n\t\t);\n\t\t$required_fields['billing_country'] = array(\n\t\t\t'error_id' => 'invalid_country',\n\t\t\t'error_message' => __( 'Please select your billing country.', 'give' ),\n\t\t);\n\n\n\t\t$required_fields['card_state'] = array(\n\t\t\t'error_id' => 'invalid_state',\n\t\t\t'error_message' => __( 'Please enter billing state / province / County.', 'give' ),\n\t\t);\n\n\t\t$country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.\n\n\t\t// Check if billing country already exists.\n\t\tif ( $country ) {\n\n\t\t\t// Check if states is empty or not.\n\t\t\tif ( array_key_exists( $country, give_states_not_required_country_list() ) ) {\n\t\t\t\t// If states is empty remove the required fields of state in billing cart.\n\t\t\t\tunset( $required_fields['card_state'] );\n\t\t\t}\n\n\t\t\t// Check if city is empty or not.\n\t\t\tif ( array_key_exists( $country, give_city_not_required_country_list() ) ) {\n\t\t\t\t// If states is empty remove the required fields of city in billing cart.\n\t\t\t\tunset( $required_fields['card_city'] );\n\t\t\t}\n\t\t}\n\t} // End if().\n\n\tif ( give_is_company_field_enabled( $form_id ) ) {\n\t\t$form_option = give_get_meta( $form_id, '_give_company_field', true );\n\t\t$global_setting = give_get_option( 'company_field' );\n\n\t\t$is_company_field_required = false;\n\n\t\tif ( ! empty( $form_option ) && give_is_setting_enabled( $form_option, array( 'required' ) ) ) {\n\t\t\t$is_company_field_required = true;\n\n\t\t} elseif ( 'global' === $form_option && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {\n\t\t\t$is_company_field_required = true;\n\n\t\t} elseif ( empty( $form_option ) && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {\n\t\t\t$is_company_field_required = true;\n\n\t\t}\n\n\t\tif ( $is_company_field_required ) {\n\t\t\t$required_fields['give_company_name'] = array(\n\t\t\t\t'error_id' => 'invalid_company',\n\t\t\t\t'error_message' => __( 'Please enter Company Name.', 'give' ),\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Filters the donation form required field.\n\t *\n\t * @since 1.7\n\t */\n\t$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );\n\n\treturn $required_fields;\n\n}",
"public function getRequiredExtraFields(): array\n {\n return [];\n }",
"protected function setRequiredFieldsConditional()\n {\n $requiredFieldsConditional = [\n 'billing_country' => [\n 'US' => ['billing_state'],\n 'CA' => ['billing_state']\n ]\n ];\n\n $this->requiredFieldsConditional = \\Genesis\\Utils\\Common::createArrayObject($requiredFieldsConditional);\n\n $requiredFieldValuesConditional = [\n 'currency' => [\n 'CNY' => [\n [\n 'bank_code' => ['CITIC', 'GDB', 'PSBC', 'BOC', 'ABC', 'CEB', 'CCB', 'ICBC', 'CMBC', 'QUICKPAY']\n ]\n ],\n 'THB' => [\n [\n 'bank_code' => ['SCB_THB', 'KTB_THB', 'BAY_THB', 'UOB_THB', 'KKB_THB', 'BBL_THB']\n ]\n ],\n 'MYR' => [\n [\n 'bank_code' => ['CIMB_MYR', 'PBE_MYR', 'RHB_MYR', 'HLE_MYR', 'MAY_MYR']\n ]\n ],\n 'IDR' => [\n [\n 'bank_code' => [\n 'MDR_IDR', 'BNI_IDR', 'BCA_IDR', 'BRI_IDR',\n 'PMB_IDR', 'CIMB_IDR', 'DMN_IDR', 'BTN_IDR', 'VA'\n ]\n ]\n ],\n 'INR' => [\n [\n 'bank_code' => ['NB', 'UI']\n ]\n ]\n ]\n ];\n\n $this->requiredFieldValuesConditional = \\Genesis\\Utils\\Common::createArrayObject(\n $requiredFieldValuesConditional\n );\n }",
"public function getFormFields() {\r\r\n\r\r\n $billing = $this->getOrder()->getBillingAddress();\r\r\n $shipping = $this->getOrder()->getShippingAddress();\r\r\n $addr_entity_id = $shipping->getCustomerAddressId();\r\r\n $shippingaddress = Mage::getModel('sales/order_address');\r\r\n $shippingaddress->load($addr_entity_id);\r\r\n $shipaddgetdat = $shippingaddress->getData();\r\r\n\r\r\n\r\r\n\r\r\n $biladdr_entity_id = $billing->getCustomerAddressId();\r\r\n ;\r\r\n $billingaddress = Mage::getModel('sales/order_address');\r\r\n $billingaddress->load($biladdr_entity_id);\r\r\n $billaddgetdat = $billingaddress->getData();\r\r\n\r\r\n $coFields = array();\r\r\n $items = $this->getQuote()->getAllItems();\r\r\n\r\r\n if ($items) {\r\r\n $i = 1;\r\r\n foreach ($items as $item) {\r\r\n if ($item->getParentItem()) {\r\r\n continue;\r\r\n }\r\r\n $coFields['c_prod_' . $i] = $this->cleanString($item->getSku());\r\r\n $coFields['c_name_' . $i] = $this->cleanString($item->getName());\r\r\n $coFields['c_description_' . $i] = $this->cleanString($item->getDescription());\r\r\n $coFields['c_price_' . $i] = number_format($item->getPrice(), 2, '.', '');\r\r\n $i++;\r\r\n }\r\r\n }\r\r\n\r\r\n $request = '';\r\r\n foreach ($coFields as $k => $v) {\r\r\n $request .= '<' . $k . '>' . $v . '</' . $k . '>';\r\r\n }\r\r\n\r\r\n\r\r\n $key = Mage::getStoreConfig('payment/payucheckout_shared/key');\r\r\n $salt = Mage::getStoreConfig('payment/payucheckout_shared/salt');\r\r\n $debug_mode = Mage::getStoreConfig('payment/payucheckout_shared/debug_mode');\r\r\n\r\r\n $orderid = $this->getOrder()->getRealOrderId();\r\r\n $orderInfo = $this->getOrder();\r\r\n $order = Mage::getModel('sales/order')->loadByIncrementId($orderid);\r\r\n// get order total value\r\r\n $orderValue = number_format($order->getGrandTotal(), 2, '.', $thousands_sep = '');\r\r\n// get order item collection\r\r\n $orderItems = $order->getItemsCollection();\r\r\n $productInfo = array();\r\r\n $productInfo2 = array();\r\r\n \r\r\n \r\r\n foreach ($orderItems as $item) {\r\r\n \r\r\n $item->getName();\r\r\n $product_id = $item->product_id;\r\r\n $product_sku = $item->sku;\r\r\n $product_name = $item->getName();\r\r\n $_product = Mage::getModel('catalog/product')->load($product_id);\r\r\n $cats = $_product->getCategoryIds();\r\r\n $category_id = $cats[0]; // just grab the first id\r\r\n $category = Mage::getModel('catalog/category')->load($category_id);\r\r\n $category_name = $category->getName();\r\r\n\r\r\n $productInfo['name'] = $this->cleanString($item->getName());\r\r\n $productInfo['description'] = $this->cleanString(substr($_product->getDescription(),0,100));\r\r\n $productInfo['value'] = $orderValue;\r\r\n $productInfo['isRequired'] = true;\r\r\n $productInfo['settlementEvent'] = \"EmailConfirmation\";\r\r\n $productInfo2[] = $productInfo;\r\r\n }\r\r\n $productIndoFilterData['paymentParts'] = $productInfo2;\r\r\n $jsonProductInfo = json_encode($productIndoFilterData);\r\r\n\r\r\n $txnid = $orderid;\r\r\n\r\r\n $coFields['key'] = $key;\r\r\n $coFields['txnid'] = $txnid;\r\r\n $coFields['udf2'] = $txnid;\r\r\n $coFields['amount'] = number_format($this->getOrder()->getBaseGrandTotal(), 0, '', '');\r\r\n $coFields['productinfo'] = $jsonProductInfo;\r\r\n $coFields['address'] = $billaddgetdat['street'];\r\r\n $coFields['firstname'] = $billing->getFirstname();\r\r\n $coFields['Lastname'] = $billing->getLastname();\r\r\n $coFields['City'] = $billing->getCity();\r\r\n $coFields['State'] = $billing->getRegion();\r\r\n $coFields['Country'] = $billing->getCountry();\r\r\n $coFields['Zipcode'] = $billing->getPostcode();\r\r\n $coFields['email'] = $this->getOrder()->getCustomerEmail();\r\r\n $coFields['phone'] = $billing->getTelephone();\r\r\n\r\r\n $coFields['ship_name'] = $shipping->getFirstname() . \" \" . $shipping->getLastname();\r\r\n $coFields['ship_address'] = $shipaddgetdat['street'];\r\r\n $coFields['ship_zipcode'] = $shipping->getPostcode();\r\r\n $coFields['ship_city'] = $shipping->getCity();\r\r\n $coFields['ship_state'] = $shipping->getRegion();\r\r\n $coFields['ship_country'] = $shipping->getCountry();\r\r\n $coFields['ship_phone'] = $shipping->getTelephone();\r\r\n $coFields['website'] = Mage::getBaseUrl();\r\r\n $coFields['surl'] = Mage::getBaseUrl() . 'payucheckout/shared/success/';\r\r\n $coFields['furl'] = Mage::getBaseUrl() . 'payucheckout/shared/failure/';\r\r\n $coFields['curl'] = Mage::getBaseUrl() . 'payucheckout/shared/canceled/id/' . $this->getOrder()->getRealOrderId();\r\r\n $coFields['Pg'] = $billing->getpg();\r\r\n $coFields['bankcode'] = $billing->getbankcode();\r\r\n $coFields['ccnum'] = $billing->getccnum();\r\r\n $coFields['ccvv'] = $billing->getccvv();\r\r\n $coFields['ccexpmon'] = $billing->getccexpmon();\r\r\n $coFields['ccexpyr'] = $billing->getccexpyr();\r\r\n $coFields['ccname'] = $billing->getccname();\r\r\n $coFields['service_provider'] = 'payu_paisa';\r\r\n\r\r\n $debugId = '';\r\r\n \r\r\n\r\r\n if ($debug_mode == 1) {\r\r\n\r\r\n $requestInfo = $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '||||||||||' . $salt;\r\r\n $debug = Mage::getModel('payucheckout/api_debug')\r\r\n ->setRequestBody($requestInfo)\r\r\n ->save();\r\r\n\r\r\n $debugId = $debug->getId();\r\r\n\r\r\n $coFields['udf1'] = $debugId;\r\r\n $coFields['Hash'] = hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '|' . $coFields['udf2'] . '|||||||||' . $salt);\r\r\n } else {\r\r\n $coFields['Hash'] = strtolower(hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '||' . $coFields['udf2'] . '|||||||||' . $salt));\r\r\n }\r\r\n return $coFields;\r\r\n }",
"public static function getMandatoryField() {\n\t\t$mandatory['AU'] = array('bsb' => 'required','account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required', 'routing_number' => 'required');\n\t\t$mandatory['CA'] = array('transit_number' => 'required','account_number' => 'required','institution_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required', 'routing_number' => 'required');\n\t\t$mandatory['GB'] = array('sort_code' => 'required', 'account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['HK'] = array('clearing_code' => 'required', 'account_number' => 'required', 'branch_code' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['JP'] = array('bank_code' => 'required','bank_code' => 'required', 'account_number' => 'required', 'branch_code' => 'required', 'bank_name' => 'required', 'branch_name' => 'required', 'account_owner_name' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['NZ'] = array('routing_number' => 'required', 'account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['SG'] = array('bank_code' => 'required', 'account_number' => 'required', 'branch_code' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['US'] = array('routing_number' => 'required', 'account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required', 'ssn_last_4' => 'required');\n\t\t$mandatory['AT'] = array('iban' => 'required','account_number'=>'required','account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['BE'] = array('iban' => 'required','account_holder_name' => 'required','currency' => 'required','account_number'=>'required');\n\t\t$mandatory['CH'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['DE'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['DK'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['ES'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['FI'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['FR'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['IE'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['IT'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['LU'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['NL'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['NO'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['PT'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['SE'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['OT'] = array('account_number' => 'required', 'bank_name' => 'required', 'account_holder_name' => 'required','branch_name' => 'required');\n\n\t\treturn $mandatory;\n\t}",
"abstract public function get_gateway_form_fields();",
"protected function setRequiredFields()\n {\n $requiredFields = [\n 'transaction_id',\n 'remote_ip',\n 'return_success_url',\n 'return_failure_url',\n 'amount',\n 'currency',\n 'bank_code'\n ];\n\n $this->requiredFields = \\Genesis\\Utils\\Common::createArrayObject($requiredFields);\n\n $requiredFieldValues = [\n 'currency' => [\n 'CNY', 'THB', 'IDR', 'MYR', 'INR'\n ]\n ];\n\n $this->requiredFieldValues = \\Genesis\\Utils\\Common::createArrayObject($requiredFieldValues);\n\n $this->setRequiredFieldsConditional();\n }",
"function add_specific_form_fields() {\n\t\treturn false;\n\t}",
"function storms_wcbcf_billing_fields( $fields ) {\n\n\t\t$fields['billing_neighborhood']['required'] = true;\n\n\t\treturn $fields;\n\t}",
"public function getFormFields()\n {\n $order_id = $this->getOrder()->getRealOrderId();\n $billing = $this->getOrder()->getBillingAddress();\n if ($this->getOrder()->getBillingAddress()->getEmail()) {\n $email = $this->getOrder()->getBillingAddress()->getEmail();\n } else {\n $email = $this->getOrder()->getCustomerEmail();\n }\n\n $params = array(\n 'merchant_fields' => 'partner',\n 'partner' => 'magento',\n 'pay_to_email' => Mage::getStoreConfig(Paynova_Paynovapayment_Helper_Data::XML_PATH_EMAIL),\n 'transaction_id' => $order_id,\n 'return_url' => Mage::getUrl('paynovapayment/processing/success', array('transaction_id' => $order_id)),\n 'cancel_url' => Mage::getUrl('paynovapayment/processing/cancel', array('transaction_id' => $order_id)),\n 'status_url' => Mage::getUrl('paynovapayment/processing/status'),\n 'language' => $this->getLocale(),\n 'amount' => round($this->getOrder()->getGrandTotal(), 2),\n 'currency' => $this->getOrder()->getOrderCurrencyCode(),\n 'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),\n 'firstname' => $billing->getFirstname(),\n 'lastname' => $billing->getLastname(),\n 'address' => $billing->getStreet(-1),\n 'postal_code' => $billing->getPostcode(),\n 'city' => $billing->getCity(),\n 'country' => $billing->getCountryModel()->getIso3Code(),\n 'pay_from_email' => $email,\n 'phone_number' => $billing->getTelephone(),\n 'detail1_description' => Mage::helper('paynovapayment')->__('Order ID'),\n 'detail1_text' => $order_id,\n 'payment_methods' => $this->_paymentMethod,\n 'hide_login' => $this->_hidelogin,\n 'new_window_redirect' => '1'\n );\n\n // add optional day of birth\n if ($billing->getDob()) {\n $params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');\n }\n\n return $params;\n }",
"function get_registration_required_fields() {\n\t\t$requiredFields = new RequiredFields(\n\t\t\t'FirstName',\n\t\t\t'Surname',\n\t\t\t'Email'\n\t\t);\n\t\t//TODO: don't add ticket field when multiple attendees allowed\n\t\t//if(!$event->MultipleBooking)\n\t\t\t$requiredFields->addRequiredField('Ticket');\n\t\t// Allow decorators to add extra required fields\n\t\t//$this->extend('updateRegistrationRequiredFields', $requiredFields);\n\t\treturn $requiredFields;\n\t}",
"public function getFormFields($order, $requestParams)\n {\n if (empty($order)) {\n if (!($order = $this->getOrder())) {\n return array();\n }\n }\n $payment = $order->getPayment()->getMethodInstance();\n $formFields = array();\n $formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());\n $formFields['AMOUNT'] = $this->getHelper()->getAmount($order->getBaseGrandTotal());\n $formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();\n $formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order);\n $formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();\n $formFields['PM'] = $payment->getOpsCode($order->getPayment());\n $formFields['EMAIL'] = $order->getCustomerEmail();\n\n $methodDependendFields = $this->getMethodDependendFormFields($order, $requestParams);\n if (is_array($methodDependendFields)) {\n $formFields = array_merge($formFields, $methodDependendFields);\n }\n\n $paymentAction = $this->_getOPSPaymentOperation();\n if ($paymentAction ) {\n $formFields['OPERATION'] = $paymentAction;\n }\n\n\n if ($this->getConfig()->getConfigData('template')=='ops') {\n $formFields['TP']= '';\n $formFields['PMLISTTYPE'] = $this->getConfig()->getConfigData('pmlist');\n } else {\n $formFields['TP']= $this->getConfig()->getPayPageTemplate();\n }\n $formFields['TITLE'] = $this->getConfig()->getConfigData('html_title');\n $formFields['BGCOLOR'] = $this->getConfig()->getConfigData('bgcolor');\n $formFields['TXTCOLOR'] = $this->getConfig()->getConfigData('txtcolor');\n $formFields['TBLBGCOLOR'] = $this->getConfig()->getConfigData('tblbgcolor');\n $formFields['TBLTXTCOLOR'] = $this->getConfig()->getConfigData('tbltxtcolor');\n $formFields['BUTTONBGCOLOR'] = $this->getConfig()->getConfigData('buttonbgcolor');\n $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor');\n $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype');\n $formFields['LOGO'] = $this->getConfig()->getConfigData('logo');\n $formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'home')) : 'NONE';\n $formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'catalog')) : '';\n $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();\n $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();\n $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();\n $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();\n $formFields['BACKURL'] = $this->getConfig()->getCancelUrl();\n\n $shaSign = Mage::helper('ops/payment')->shaCrypt(Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()));\n\n $helper = Mage::helper('ops');\n $helper->log($helper->__(\"Register Order %s in Ingenico Payment Services \\n\\nAll form fields: %s\\nIngenico Payment Services String to hash: %s\\nHash: %s\",\n $order->getIncrementId(),\n serialize($formFields),\n Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()),\n $shaSign\n ));\n\n $formFields['SHASIGN'] = $shaSign;\n return $formFields;\n }",
"function get_required_fields($field, $html = false) {\n\n $meta_keys = fields\\get_field_ids($field, $html);\n\n if (isset($field['required'])) {\n if (gettype($field['required']) == 'boolean' && $field['required']) return $meta_keys;\n if (is_array($field['required'])) {\n if (count($field['required']) == count($meta_keys)) {\n $meta_keys = lib\\array_mask($meta_keys, $field['required']);\n } else {\n log\\error('INVALID_FIELD', 'The field is invalid because the length of the required array != number of meta keys ids for this type of field. Details '.json_encode($field));\n }\n } \n } else if ($field['type'] == 'REPEAT-GROUP') {\n $res = array_map(function($f) { return get_required_fields($f, true);}, $field['fields']);\n $meta_keys = lib\\array_flatten($res);\n }\n\n return $meta_keys;\n}",
"abstract protected function getMandatoryModelsFields();",
"function init_form_fields() {\n\n \tinclude ( SUMO_SAGEPLUGINPATH . 'includes/sagepay-form-admin.php' );\n\n }",
"public static function getRequiredFields()\n\t{\n\t\t$requiredFields = [\n\t\t\t'url' => 'string',\n\t\t\t'name' => 'string',\n\t\t\t'price' => 'float',\n\t\t\t'devise' => 'string',\n\t\t\t'edition_idEdition' => 'int',\n\t\t];\n\n\t\treturn $requiredFields;\n\t}",
"public function getCommonForm()\n {\n return $this->common_form;\n }",
"function getfaircoin_edd_required_checkout_fields( $required_fields ) {\r\n $required_fields['edd_fairaddress'] = array(\r\n 'error_id' => 'invalid_fairaddress',\r\n 'error_message' => __('Please enter a valid Faircoin Address', 'edd-getfaircoin')\r\n );\r\n return $required_fields;\r\n}",
"protected function getRequiredFieldList()\n {\n return RequiredFields::create(\n $this->getBareRequiredFieldList()\n )\n ->setForm($this);\n }",
"public static function getRequiredFields()\n\t{\n\t\t$requiredFields = [\n\t\t\t'content' => 'string',\n\t\t\t'console_names' => 'string',\n\t\t\t'game_idGame' => 'int',\n\t\t];\n\n\t\treturn $requiredFields;\n\t}",
"private function getConfigurationFields($oForm)\n {\n $oForm->setWidgets(\n\t\t\tarray(\n\t\t\t\t\t'cem_cemetery_id' \t=> __('Select Cemetery'),\n\t\t\t\t\t'country_id'\t\t=> __('Select Country'),\n\t\t\t\t )\n\t\t);\n\n $oForm->setLabels(\n array(\n\t\t\t\t'country_id' \t=> __('Country'),\n\t\t\t\t'cem_cemetery_id' \t=> __('Cemetery'),\n 'import_file' => __('Select File')\n )\n );\n\n $oForm->setValidators(\n array(\n\t\t\t\t\t'import_file' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select file'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'invalid' => __('Please select only EXCEL and CSV file'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'maxsize' => __('The file size is too large')\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'country_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select country')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'cem_cemetery_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select cemetery')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t)\n );\n }",
"private function getRequiredFields()\n\t{\n\t\treturn $this->endpointRequiredFields;\n\t}",
"function wc_elshaddai_bfield( $fields ) {\n $fields['billing_number']['maxlength'] = 5;\n $fields['billing_address_2']['maxlength'] = 30;\n $fields['billing_address_2']['label_class'] = array('');\n $fields['billing_neighborhood']['required'] = true;\n return $fields;}",
"function pw_edd_purchase_form_required_fields( $required_fields ) {\n \n \t// Set a field as required\n $required_fields['edd_last'] = array( \n 'error_id' => 'invalid_last_name',\n 'error_message' => __( 'Please enter your last name.', 'edd' )\n );\n\n /*\n * If you wanted to remove a field from required list\n\t * you would simply unset the array key\n\t */\n // unset( $required_fields['edd_first'] );\n \n return $required_fields;\n}",
"public function required_fields(array $fields)\n\t{\n\t\tif (count($fields) > 0)\n\t\t{\n\t\t\tforeach ($fields as $field)\n\t\t\t{\n\t\t\t\t$this->_required_fields[$field] = TRUE;\n\t\t\t}\n\t\t}\n\t}"
]
| [
"0.7522929",
"0.6429002",
"0.6403835",
"0.6036171",
"0.5994697",
"0.5939956",
"0.59308875",
"0.5896248",
"0.58345157",
"0.582579",
"0.58136475",
"0.5786623",
"0.57420844",
"0.5703814",
"0.5640297",
"0.5622622",
"0.562043",
"0.55969733",
"0.5595727",
"0.5560667",
"0.55164367",
"0.5485999",
"0.5485387",
"0.54844624",
"0.54482794",
"0.54381657",
"0.5431275",
"0.53972334",
"0.53933394",
"0.53920484"
]
| 0.7337752 | 1 |
Order form: required common form fields .marketplaceapps.v1.IncludedCommonFormFields common_form_required_fields = 5; | public function setCommonFormRequiredFields(&$var)
{
GPBUtil::checkMessage($var, \Marketplaceapps\V1\IncludedCommonFormFields::class);
$this->common_form_required_fields = $var;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getCommonFormRequiredFields()\n {\n return $this->common_form_required_fields;\n }",
"public function setCommonForm(&$var)\n {\n GPBUtil::checkMessage($var, \\Marketplaceapps\\V1\\IncludedCommonFormFields::class);\n $this->common_form = $var;\n }",
"public function getFrontEndRequiredFields();",
"public function getFormFields()\n\t{\n\t\tMage::log(\" --- Snap* Hosted Payments API : getFormFields --- \");\n\n\t\t$aOBFields = array();\n\t\t$billing = $this->getOrder()->getBillingAddress();\n\t\t$shipping = $this->getOrder()->getShippingAddress();\n\t\t$items = $this->getOrder()->getAllItems();\n\n\t\t// customer info\n\t\t$aOBFields['customer[merchant_customer_id]'] = $this->getOrder()->getCustomerId();\n\t\t$aOBFields['customer[email]'] = $this->getOrder()->getCustomerEmail();\n\t\t$aOBFields['customer[first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['customer[last_name]'] = $billing->getLastname();\n\t\t$aOBFields['customer[phone]'] = $billing->getTelephone();\n\n\t\t// order header\n\t\t$aOBFields['order[merchant_order_id]'] = $this->getOrder()->getRealOrderId();\n\t\t$aOBFields['order[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\t\t$aOBFields['order[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t$aOBFields['order[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t$aOBFields['order[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t$aOBFields['order[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\t\t//$aOBFields['order[ship_method]'] = '';\n\n\t\t// billing fields\n\t\t$aOBFields['order[billto_company]'] = $billing->getCompany();\n\t\t$aOBFields['order[billto_first_name]'] = $billing->getFirstname();\n\t\t$aOBFields['order[billto_last_name]'] = $billing->getLastname();\n\t\t$aOBFields['order[billto_address1]'] = $billing->getStreet1();\n\t\t$aOBFields['order[billto_address2]'] = $billing->getStreet2();\n\t\t$aOBFields['order[billto_city]'] = $billing->getCity();\n\t\t$aOBFields['order[billto_state]'] = $billing->getRegionCode();\n\t\t$aOBFields['order[billto_country]'] = $billing->getCountry();\n\t\t$aOBFields['order[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t// shipping fields\n\t\tif(!empty($shipping))\n\t\t{\n\t\t\t$aOBFields['order[shipto_company]'] = $shipping->getCompany();\n\t\t\t$aOBFields['order[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t$aOBFields['order[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t$aOBFields['order[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t$aOBFields['order[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t$aOBFields['order[shipto_city]'] = $shipping->getCity();\n\t\t\t$aOBFields['order[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t$aOBFields['order[shipto_country]'] = $shipping->getCountry();\n\t\t\t$aOBFields['order[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t}\n\n\t\t// items\n\t\tif (!empty($items))\n\t\t{\n\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t{\n\t\t\t\t$aOBFields['order_item['.$nCount.'][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][name]'] = $items[$nCount]->getName();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][price]'] = self::_currencyAmount($items[$nCount]->getPrice());\n\t\t\t\t$aOBFields['order_item['.$nCount.'][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t$aOBFields['order_item['.$nCount.'][tax]'] = self::_currencyAmount($items[$nCount]->getTaxAmount());\n\t\t\t}\n\t\t}\n\n\t\t// return URLs\n\t\t$aOBFields['return_url'] = Mage::getUrl('hostedpayments/standard/success', array('_secure' => true));\n\t\t$aOBFields['cancel_url'] = Mage::getUrl('hostedpayments/standard/cancel', array('_secure' => true));\n\n\t\t// check to see if the aheadWorks SARP module is being used and is enabled. if it is then we need to\n\t\t// add additional fields to the post fields array\n\t\tif($this->_isUsingSARP() === true)\n\t\t{\n\t\t\tMage::log(\"is using SARP \");\n\n\t\t\t$aSubscriptionIDs = array();\n\t\t\t$aSubscriptionIDs = $this->_getSubscriptionByOrderID($this->getOrder()->getId());\n\n\t\t\t/*\n\t\t\tforeach($aSubscriptionIDs as $nID)\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($nID);\n\t\t\t}\n\t\t\t*/\n\n\t\t\tif(!empty($aSubscriptionIDs))\n\t\t\t{\n\t\t\t\t$oSubscription = Mage::getSingleton('sarp/subscription')->load($aSubscriptionIDs[0]);\n\t\t\t\t$dStartDate = new Zend_Date($oSubscription->getNextSubscriptionEventDate($oSubscription->getDateStart()), Zend_Date::DATE_LONG);\n\t\t\t\t$nTotalOccurrences = 0;\n\n\t\t\t\tif($oSubscription->isInfinite())\n\t\t\t\t\t$nTotalOccurrences = 9999;\n\t\t\t\telse\n\t\t\t\t\t$nTotalOccurrences = Mage::getModel('sarp/sequence')->getCollection()->addSubscriptionFilter($oSubscription)->count();\n\n\t\t\t\t//Mage::log(\"Subscription ID: \" . $aSubscriptionIDs[0]);\n\t\t\t\t//Mage::log(\"Subscription Inerval: \" . $oSubscription->getPeriod()->getPeriodType().\"s\");\n\t\t\t\t//Mage::log(\"Subscription Occurences: \" . $nTotalOccurrences);\n\n\t\t\t\t$aOBFields['sub[auto_process]'] = 0;\n\t\t\t\t$aOBFields['sub[start_date]'] = $dStartDate;\n\t\t\t\t$aOBFields['sub[interval_length]'] = $oSubscription->getPeriod()->getPeriodValue();\n\t\t\t\t$aOBFields['sub[interval_unit]'] = $oSubscription->getPeriod()->getPeriodType().\"s\";\n\t\t\t\t$aOBFields['sub[total_occurrences]'] = $nTotalOccurrences;\n\n\t\t\t\t$aOBFields['sub[trial_occurrences]'] = '';\n\t\t\t\t$aOBFields['sub[trial_amount]'] = 0.00;\n\n\t\t\t\t// order header\n\t\t\t\t$aOBFields['sub[merchant_subscription_id]'] = $this->getOrder()->getRealOrderId();\n\t\t\t\t//$aOBFields['sub[total_subtotal]'] = self::_currencyAmount($this->getOrder()->getSubtotal());\n\n\t\t\t\t// grand total should be the normal price not the first period price\n\n\t\t\t\t$aOBFields['sub[total_discount]'] = self::_currencyAmount(abs($this->getOrder()->getDiscountAmount()));\n\t\t\t\t$aOBFields['sub[total_tax]'] = self::_currencyAmount($this->getOrder()->getTaxAmount());\n\t\t\t\t$aOBFields['sub[ship_method]'] = '';\n\t\t\t\t$aOBFields['sub[total]'] = self::_currencyAmount($this->getOrder()->getBaseGrandTotal());\n\n\t\t\t\t// billing fields\n\t\t\t\t$aOBFields['sub[billto_company]'] = $billing->getCompany();\n\t\t\t\t$aOBFields['sub[billto_first_name]'] = $billing->getFirstname();\n\t\t\t\t$aOBFields['sub[billto_last_name]'] = $billing->getLastname();\n\t\t\t\t$aOBFields['sub[billto_address1]'] = $billing->getStreet1();\n\t\t\t\t$aOBFields['sub[billto_address2]'] = $billing->getStreet2();\n\t\t\t\t$aOBFields['sub[billto_city]'] = $billing->getCity();\n\t\t\t\t$aOBFields['sub[billto_state]'] = $billing->getRegionCode();\n\t\t\t\t$aOBFields['sub[billto_country]'] = $billing->getCountry();\n\t\t\t\t$aOBFields['sub[billto_zipcode]'] = $billing->getPostcode();\n\n\t\t\t\t// shipping fields\n\t\t\t\tif(!empty($shipping))\n\t\t\t\t{\n\t\t\t\t\t$aOBFields['sub[shipto_company]'] = $shipping->getCompany();\n\t\t\t\t\t$aOBFields['sub[shipto_first_name]'] = $shipping->getFirstname();\n\t\t\t\t\t$aOBFields['sub[shipto_last_name]'] = $shipping->getLastname();\n\t\t\t\t\t$aOBFields['sub[shipto_address1]'] = $shipping->getStreet1();\n\t\t\t\t\t$aOBFields['sub[shipto_address2]'] = $shipping->getStreet2();\n\t\t\t\t\t$aOBFields['sub[shipto_city]'] = $shipping->getCity();\n\t\t\t\t\t$aOBFields['sub[shipto_state]'] = $shipping->getRegionCode();\n\t\t\t\t\t$aOBFields['sub[shipto_country]'] = $shipping->getCountry();\n\t\t\t\t\t$aOBFields['sub[shipto_zipcode]'] = $shipping->getPostcode();\n\t\t\t\t}\n\n\t\t\t\t$items = $this->getOrder()->getAllItems();\n\t\t\t\t$nCount = 0;\n\t\t\t\t$nSubCount = 0;\n\t\t\t\t$aOBFields['sub[total_subtotal]'] = 0;\n\t\t\t\t$aOBFields['sub[total]'] = 0;\n\n\t\t\t\t// items\n\t\t\t\tif (!empty($items))\n\t\t\t\t{\n\t\t\t\t\tfor($nCount=0; $nCount<count($items); $nCount++)\n\t\t\t\t\t{\n\t\t\t\t\t\t$oItem = $items[$nCount];\n\n\t\t\t\t\t\tif(Mage::helper('sarp')->isSubscriptionType($items[$nCount]) == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$productId = $oItem->getProductId();\n\t\t\t\t\t\t\t$oProduct = Mage::getModel('catalog/product')->load($productId);\n\t\t\t\t\t\t\t$nFirstPeriodPrice = self::_currencyAmount($oProduct->getAwSarpFirstPeriodPrice());\n\t\t\t\t\t\t\t$nNormalPrice = self::_currencyAmount((!empty($nFirstPeriodPrice) ? $oProduct->getAwSarpSubscriptionPrice() : $items[$nCount]->getPrice()));\n\n\t\t\t\t\t\t\tMage::log(\"Normal Price:\" . $nNormalPrice);\n\t\t\t\t\t\t\tMage::log(\"First Period Price:\" . $nFirstPeriodPrice);\n\n\t\t\t\t\t\t\tif ($oItem->canInvoice()) $qtys[$oItem->getId()] = $oItem->getQtyToInvoice();\n\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][sku]'] = $items[$nCount]->getSku();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][name]'] = $items[$nCount]->getName();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][price]'] = $nNormalPrice;\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][qty]'] = $items[$nCount]->getQtyOrdered();\n\t\t\t\t\t\t\t$aOBFields['sub_item[' . $nSubCount . '][description]'] = $items[$nCount]->getDescription();\n\t\t\t\t\t\t\t//$aOBFields['sub_item[' . $nSubCount . '][details]'] = '';\n\n\t\t\t\t\t\t\tif ($oItem->getIsVirtual())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = 0.00;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$aOBFields['sub[total_shipping]'] = self::_currencyAmount($this->getOrder()->getShippingAmount());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t$aOBFields['sub[trial_amount]'] = $nFirstPeriodPrice;\n\t\t\t\t\t\t\t*/\n\n\t\t\t\t\t\t\t$aOBFields['sub[total_subtotal]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\t\t\t\t\t\t\t$aOBFields['sub[total]'] += $aOBFields['sub_item[' . $nSubCount . '][price]'];\n\n\t\t\t\t\t\t\t$nSubCount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tMage::log(\"Not a subscription item: \" . $items[$nCount]->getName());\n\t\t\t\t\t}\n\t\t\t\t\tMage::log(\"Sub. Sub Total: \" . $aOBFields['sub[total_subtotal]']);\n\t\t\t\t\tMage::log(\"Sub. Total: \" . $aOBFields['sub[total]']);\n\t\t\t\t}\n\n\t\t\t\t$aOBFields['sub[total]'] = $aOBFields['sub[total]'] + $aOBFields['sub[total_shipping]'];\n\t\t\t}\n\t\t}\n\n\t\t// generate the MAC and add it as the final param\n\t\t$aOBFields['mac'] = $this->getFormFieldsMAC($aOBFields);\n\n\t\tMage::log(print_r($aOBFields, true));\n\n\t\treturn $aOBFields;\n\t}",
"function get_apr_mandatory_fields(){\n $fields = array(\n 'field_ef_date_and_partici_bm',\n 'field_ef_working_methods_rating',\n 'field_ef_general_kind_access',\n 'field_ef_related_acess',\n 'field_ef_general_kind_useful',\n 'field_ef_related_deliv_useful',\n 'field_ef_support_admin_rating',\n 'field_ef_support_deliver_rating',\n //'field_ef_invoicing_policy_rating',\n //'field_ef_ef_adherence_rating',\n //'field_ef_yammer_rating',\n 'field_ef_cms_system_rating',\n //'field_ef_network_tend_main_area',\n //'field_ef_completed_by',\n );\n\n return $fields;\n}",
"function give_get_required_fields( $form_id ) {\n\n\t$posted_data = give_clean( filter_input_array( INPUT_POST ) );\n\t$payment_mode = give_get_chosen_gateway( $form_id );\n\n\t$required_fields = array(\n\t\t'give_email' => array(\n\t\t\t'error_id' => 'invalid_email',\n\t\t\t'error_message' => __( 'Please enter a valid email address.', 'give' ),\n\t\t),\n\t\t'give_first' => array(\n\t\t\t'error_id' => 'invalid_first_name',\n\t\t\t'error_message' => __( 'Please enter your first name.', 'give' ),\n\t\t),\n\t);\n\n\t$name_title_prefix = give_is_name_title_prefix_required( $form_id );\n\tif ( $name_title_prefix ) {\n\t\t$required_fields['give_title'] = array(\n\t\t\t'error_id' => 'invalid_title',\n\t\t\t'error_message' => __( 'Please enter your title.', 'give' ),\n\t\t);\n\t}\n\t\n\t// If credit card fields related actions exists then check for the cc fields validations.\n\tif (\n\t\thas_action(\"give_{$payment_mode}_cc_form\", 'give_get_cc_form' ) ||\n\t\thas_action('give_cc_form', 'give_get_cc_form' )\n\t) {\n\t\t\n\t\t// Validate card number field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_number'] ) &&\n\t\t\tempty( $posted_data['card_number'] )\n\t\t) {\n\t\t\t$required_fields['card_number'] = array(\n\t\t\t\t'error_id' => 'empty_card_number',\n\t\t\t\t'error_message' => __( 'Please enter a credit card number.', 'give' ),\n\t\t\t);\n\t\t}\n\t\t\n\t\t// Validate card cvc field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_cvc'] ) &&\n\t\t\tempty( $posted_data['card_cvc'] )\n\t\t) {\n\t\t\t$required_fields['card_cvc'] = array(\n\t\t\t\t'error_id' => 'empty_card_cvc',\n\t\t\t\t'error_message' => __( 'Please enter a credit card CVC information.', 'give' ),\n\t\t\t);\n\t\t}\n\t\t\n\t\t// Validate card name field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_name'] ) &&\n\t\t\tempty( $posted_data['card_name'] )\n\t\t) {\n\t\t\t$required_fields['card_name'] = array(\n\t\t\t\t'error_id' => 'empty_card_name',\n\t\t\t\t'error_message' => __( 'Please enter a name of your credit card account holder.', 'give' ),\n\t\t\t);\n\t\t}\n\t\t\n\t\t// Validate card expiry field for empty check.\n\t\tif (\n\t\t\tisset( $posted_data['card_expiry'] ) &&\n\t\t\tempty( $posted_data['card_expiry'] )\n\t\t) {\n\t\t\t$required_fields['card_expiry'] = array(\n\t\t\t\t'error_id' => 'empty_card_expiry',\n\t\t\t\t'error_message' => __( 'Please enter a credit card expiry date.', 'give' ),\n\t\t\t);\n\t\t}\n\t}\n\n\t$require_address = give_require_billing_address( $payment_mode );\n\n\tif ( $require_address ) {\n\t\t$required_fields['card_address'] = array(\n\t\t\t'error_id' => 'invalid_card_address',\n\t\t\t'error_message' => __( 'Please enter your primary billing address.', 'give' ),\n\t\t);\n\t\t$required_fields['card_zip'] = array(\n\t\t\t'error_id' => 'invalid_zip_code',\n\t\t\t'error_message' => __( 'Please enter your zip / postal code.', 'give' ),\n\t\t);\n\t\t$required_fields['card_city'] = array(\n\t\t\t'error_id' => 'invalid_city',\n\t\t\t'error_message' => __( 'Please enter your billing city.', 'give' ),\n\t\t);\n\t\t$required_fields['billing_country'] = array(\n\t\t\t'error_id' => 'invalid_country',\n\t\t\t'error_message' => __( 'Please select your billing country.', 'give' ),\n\t\t);\n\n\n\t\t$required_fields['card_state'] = array(\n\t\t\t'error_id' => 'invalid_state',\n\t\t\t'error_message' => __( 'Please enter billing state / province / County.', 'give' ),\n\t\t);\n\n\t\t$country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.\n\n\t\t// Check if billing country already exists.\n\t\tif ( $country ) {\n\n\t\t\t// Check if states is empty or not.\n\t\t\tif ( array_key_exists( $country, give_states_not_required_country_list() ) ) {\n\t\t\t\t// If states is empty remove the required fields of state in billing cart.\n\t\t\t\tunset( $required_fields['card_state'] );\n\t\t\t}\n\n\t\t\t// Check if city is empty or not.\n\t\t\tif ( array_key_exists( $country, give_city_not_required_country_list() ) ) {\n\t\t\t\t// If states is empty remove the required fields of city in billing cart.\n\t\t\t\tunset( $required_fields['card_city'] );\n\t\t\t}\n\t\t}\n\t} // End if().\n\n\tif ( give_is_company_field_enabled( $form_id ) ) {\n\t\t$form_option = give_get_meta( $form_id, '_give_company_field', true );\n\t\t$global_setting = give_get_option( 'company_field' );\n\n\t\t$is_company_field_required = false;\n\n\t\tif ( ! empty( $form_option ) && give_is_setting_enabled( $form_option, array( 'required' ) ) ) {\n\t\t\t$is_company_field_required = true;\n\n\t\t} elseif ( 'global' === $form_option && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {\n\t\t\t$is_company_field_required = true;\n\n\t\t} elseif ( empty( $form_option ) && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {\n\t\t\t$is_company_field_required = true;\n\n\t\t}\n\n\t\tif ( $is_company_field_required ) {\n\t\t\t$required_fields['give_company_name'] = array(\n\t\t\t\t'error_id' => 'invalid_company',\n\t\t\t\t'error_message' => __( 'Please enter Company Name.', 'give' ),\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Filters the donation form required field.\n\t *\n\t * @since 1.7\n\t */\n\t$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );\n\n\treturn $required_fields;\n\n}",
"public function getRequiredExtraFields(): array\n {\n return [];\n }",
"protected function setRequiredFieldsConditional()\n {\n $requiredFieldsConditional = [\n 'billing_country' => [\n 'US' => ['billing_state'],\n 'CA' => ['billing_state']\n ]\n ];\n\n $this->requiredFieldsConditional = \\Genesis\\Utils\\Common::createArrayObject($requiredFieldsConditional);\n\n $requiredFieldValuesConditional = [\n 'currency' => [\n 'CNY' => [\n [\n 'bank_code' => ['CITIC', 'GDB', 'PSBC', 'BOC', 'ABC', 'CEB', 'CCB', 'ICBC', 'CMBC', 'QUICKPAY']\n ]\n ],\n 'THB' => [\n [\n 'bank_code' => ['SCB_THB', 'KTB_THB', 'BAY_THB', 'UOB_THB', 'KKB_THB', 'BBL_THB']\n ]\n ],\n 'MYR' => [\n [\n 'bank_code' => ['CIMB_MYR', 'PBE_MYR', 'RHB_MYR', 'HLE_MYR', 'MAY_MYR']\n ]\n ],\n 'IDR' => [\n [\n 'bank_code' => [\n 'MDR_IDR', 'BNI_IDR', 'BCA_IDR', 'BRI_IDR',\n 'PMB_IDR', 'CIMB_IDR', 'DMN_IDR', 'BTN_IDR', 'VA'\n ]\n ]\n ],\n 'INR' => [\n [\n 'bank_code' => ['NB', 'UI']\n ]\n ]\n ]\n ];\n\n $this->requiredFieldValuesConditional = \\Genesis\\Utils\\Common::createArrayObject(\n $requiredFieldValuesConditional\n );\n }",
"public function getFormFields() {\r\r\n\r\r\n $billing = $this->getOrder()->getBillingAddress();\r\r\n $shipping = $this->getOrder()->getShippingAddress();\r\r\n $addr_entity_id = $shipping->getCustomerAddressId();\r\r\n $shippingaddress = Mage::getModel('sales/order_address');\r\r\n $shippingaddress->load($addr_entity_id);\r\r\n $shipaddgetdat = $shippingaddress->getData();\r\r\n\r\r\n\r\r\n\r\r\n $biladdr_entity_id = $billing->getCustomerAddressId();\r\r\n ;\r\r\n $billingaddress = Mage::getModel('sales/order_address');\r\r\n $billingaddress->load($biladdr_entity_id);\r\r\n $billaddgetdat = $billingaddress->getData();\r\r\n\r\r\n $coFields = array();\r\r\n $items = $this->getQuote()->getAllItems();\r\r\n\r\r\n if ($items) {\r\r\n $i = 1;\r\r\n foreach ($items as $item) {\r\r\n if ($item->getParentItem()) {\r\r\n continue;\r\r\n }\r\r\n $coFields['c_prod_' . $i] = $this->cleanString($item->getSku());\r\r\n $coFields['c_name_' . $i] = $this->cleanString($item->getName());\r\r\n $coFields['c_description_' . $i] = $this->cleanString($item->getDescription());\r\r\n $coFields['c_price_' . $i] = number_format($item->getPrice(), 2, '.', '');\r\r\n $i++;\r\r\n }\r\r\n }\r\r\n\r\r\n $request = '';\r\r\n foreach ($coFields as $k => $v) {\r\r\n $request .= '<' . $k . '>' . $v . '</' . $k . '>';\r\r\n }\r\r\n\r\r\n\r\r\n $key = Mage::getStoreConfig('payment/payucheckout_shared/key');\r\r\n $salt = Mage::getStoreConfig('payment/payucheckout_shared/salt');\r\r\n $debug_mode = Mage::getStoreConfig('payment/payucheckout_shared/debug_mode');\r\r\n\r\r\n $orderid = $this->getOrder()->getRealOrderId();\r\r\n $orderInfo = $this->getOrder();\r\r\n $order = Mage::getModel('sales/order')->loadByIncrementId($orderid);\r\r\n// get order total value\r\r\n $orderValue = number_format($order->getGrandTotal(), 2, '.', $thousands_sep = '');\r\r\n// get order item collection\r\r\n $orderItems = $order->getItemsCollection();\r\r\n $productInfo = array();\r\r\n $productInfo2 = array();\r\r\n \r\r\n \r\r\n foreach ($orderItems as $item) {\r\r\n \r\r\n $item->getName();\r\r\n $product_id = $item->product_id;\r\r\n $product_sku = $item->sku;\r\r\n $product_name = $item->getName();\r\r\n $_product = Mage::getModel('catalog/product')->load($product_id);\r\r\n $cats = $_product->getCategoryIds();\r\r\n $category_id = $cats[0]; // just grab the first id\r\r\n $category = Mage::getModel('catalog/category')->load($category_id);\r\r\n $category_name = $category->getName();\r\r\n\r\r\n $productInfo['name'] = $this->cleanString($item->getName());\r\r\n $productInfo['description'] = $this->cleanString(substr($_product->getDescription(),0,100));\r\r\n $productInfo['value'] = $orderValue;\r\r\n $productInfo['isRequired'] = true;\r\r\n $productInfo['settlementEvent'] = \"EmailConfirmation\";\r\r\n $productInfo2[] = $productInfo;\r\r\n }\r\r\n $productIndoFilterData['paymentParts'] = $productInfo2;\r\r\n $jsonProductInfo = json_encode($productIndoFilterData);\r\r\n\r\r\n $txnid = $orderid;\r\r\n\r\r\n $coFields['key'] = $key;\r\r\n $coFields['txnid'] = $txnid;\r\r\n $coFields['udf2'] = $txnid;\r\r\n $coFields['amount'] = number_format($this->getOrder()->getBaseGrandTotal(), 0, '', '');\r\r\n $coFields['productinfo'] = $jsonProductInfo;\r\r\n $coFields['address'] = $billaddgetdat['street'];\r\r\n $coFields['firstname'] = $billing->getFirstname();\r\r\n $coFields['Lastname'] = $billing->getLastname();\r\r\n $coFields['City'] = $billing->getCity();\r\r\n $coFields['State'] = $billing->getRegion();\r\r\n $coFields['Country'] = $billing->getCountry();\r\r\n $coFields['Zipcode'] = $billing->getPostcode();\r\r\n $coFields['email'] = $this->getOrder()->getCustomerEmail();\r\r\n $coFields['phone'] = $billing->getTelephone();\r\r\n\r\r\n $coFields['ship_name'] = $shipping->getFirstname() . \" \" . $shipping->getLastname();\r\r\n $coFields['ship_address'] = $shipaddgetdat['street'];\r\r\n $coFields['ship_zipcode'] = $shipping->getPostcode();\r\r\n $coFields['ship_city'] = $shipping->getCity();\r\r\n $coFields['ship_state'] = $shipping->getRegion();\r\r\n $coFields['ship_country'] = $shipping->getCountry();\r\r\n $coFields['ship_phone'] = $shipping->getTelephone();\r\r\n $coFields['website'] = Mage::getBaseUrl();\r\r\n $coFields['surl'] = Mage::getBaseUrl() . 'payucheckout/shared/success/';\r\r\n $coFields['furl'] = Mage::getBaseUrl() . 'payucheckout/shared/failure/';\r\r\n $coFields['curl'] = Mage::getBaseUrl() . 'payucheckout/shared/canceled/id/' . $this->getOrder()->getRealOrderId();\r\r\n $coFields['Pg'] = $billing->getpg();\r\r\n $coFields['bankcode'] = $billing->getbankcode();\r\r\n $coFields['ccnum'] = $billing->getccnum();\r\r\n $coFields['ccvv'] = $billing->getccvv();\r\r\n $coFields['ccexpmon'] = $billing->getccexpmon();\r\r\n $coFields['ccexpyr'] = $billing->getccexpyr();\r\r\n $coFields['ccname'] = $billing->getccname();\r\r\n $coFields['service_provider'] = 'payu_paisa';\r\r\n\r\r\n $debugId = '';\r\r\n \r\r\n\r\r\n if ($debug_mode == 1) {\r\r\n\r\r\n $requestInfo = $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '||||||||||' . $salt;\r\r\n $debug = Mage::getModel('payucheckout/api_debug')\r\r\n ->setRequestBody($requestInfo)\r\r\n ->save();\r\r\n\r\r\n $debugId = $debug->getId();\r\r\n\r\r\n $coFields['udf1'] = $debugId;\r\r\n $coFields['Hash'] = hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '|' . $debugId . '|' . $coFields['udf2'] . '|||||||||' . $salt);\r\r\n } else {\r\r\n $coFields['Hash'] = strtolower(hash('sha512', $key . '|' . $coFields['txnid'] . '|' . $coFields['amount'] . '|' .\r\r\n $jsonProductInfo . '|' . $coFields['firstname'] . '|' . $coFields['email'] . '||' . $coFields['udf2'] . '|||||||||' . $salt));\r\r\n }\r\r\n return $coFields;\r\r\n }",
"public static function getMandatoryField() {\n\t\t$mandatory['AU'] = array('bsb' => 'required','account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required', 'routing_number' => 'required');\n\t\t$mandatory['CA'] = array('transit_number' => 'required','account_number' => 'required','institution_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required', 'routing_number' => 'required');\n\t\t$mandatory['GB'] = array('sort_code' => 'required', 'account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['HK'] = array('clearing_code' => 'required', 'account_number' => 'required', 'branch_code' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['JP'] = array('bank_code' => 'required','bank_code' => 'required', 'account_number' => 'required', 'branch_code' => 'required', 'bank_name' => 'required', 'branch_name' => 'required', 'account_owner_name' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['NZ'] = array('routing_number' => 'required', 'account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['SG'] = array('bank_code' => 'required', 'account_number' => 'required', 'branch_code' => 'required', 'account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['US'] = array('routing_number' => 'required', 'account_number' => 'required', 'account_holder_name' => 'required', 'currency' => 'required', 'ssn_last_4' => 'required');\n\t\t$mandatory['AT'] = array('iban' => 'required','account_number'=>'required','account_holder_name' => 'required', 'currency' => 'required');\n\t\t$mandatory['BE'] = array('iban' => 'required','account_holder_name' => 'required','currency' => 'required','account_number'=>'required');\n\t\t$mandatory['CH'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['DE'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['DK'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['ES'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['FI'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['FR'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number' => 'required');\n\t\t$mandatory['IE'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['IT'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['LU'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['NL'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['NO'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['PT'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['SE'] = array('iban' => 'required', 'account_holder_name' => 'required', 'currency' => 'required','account_number'=>'required');\n\t\t$mandatory['OT'] = array('account_number' => 'required', 'bank_name' => 'required', 'account_holder_name' => 'required','branch_name' => 'required');\n\n\t\treturn $mandatory;\n\t}",
"abstract public function get_gateway_form_fields();",
"protected function setRequiredFields()\n {\n $requiredFields = [\n 'transaction_id',\n 'remote_ip',\n 'return_success_url',\n 'return_failure_url',\n 'amount',\n 'currency',\n 'bank_code'\n ];\n\n $this->requiredFields = \\Genesis\\Utils\\Common::createArrayObject($requiredFields);\n\n $requiredFieldValues = [\n 'currency' => [\n 'CNY', 'THB', 'IDR', 'MYR', 'INR'\n ]\n ];\n\n $this->requiredFieldValues = \\Genesis\\Utils\\Common::createArrayObject($requiredFieldValues);\n\n $this->setRequiredFieldsConditional();\n }",
"function add_specific_form_fields() {\n\t\treturn false;\n\t}",
"function storms_wcbcf_billing_fields( $fields ) {\n\n\t\t$fields['billing_neighborhood']['required'] = true;\n\n\t\treturn $fields;\n\t}",
"public function getFormFields()\n {\n $order_id = $this->getOrder()->getRealOrderId();\n $billing = $this->getOrder()->getBillingAddress();\n if ($this->getOrder()->getBillingAddress()->getEmail()) {\n $email = $this->getOrder()->getBillingAddress()->getEmail();\n } else {\n $email = $this->getOrder()->getCustomerEmail();\n }\n\n $params = array(\n 'merchant_fields' => 'partner',\n 'partner' => 'magento',\n 'pay_to_email' => Mage::getStoreConfig(Paynova_Paynovapayment_Helper_Data::XML_PATH_EMAIL),\n 'transaction_id' => $order_id,\n 'return_url' => Mage::getUrl('paynovapayment/processing/success', array('transaction_id' => $order_id)),\n 'cancel_url' => Mage::getUrl('paynovapayment/processing/cancel', array('transaction_id' => $order_id)),\n 'status_url' => Mage::getUrl('paynovapayment/processing/status'),\n 'language' => $this->getLocale(),\n 'amount' => round($this->getOrder()->getGrandTotal(), 2),\n 'currency' => $this->getOrder()->getOrderCurrencyCode(),\n 'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),\n 'firstname' => $billing->getFirstname(),\n 'lastname' => $billing->getLastname(),\n 'address' => $billing->getStreet(-1),\n 'postal_code' => $billing->getPostcode(),\n 'city' => $billing->getCity(),\n 'country' => $billing->getCountryModel()->getIso3Code(),\n 'pay_from_email' => $email,\n 'phone_number' => $billing->getTelephone(),\n 'detail1_description' => Mage::helper('paynovapayment')->__('Order ID'),\n 'detail1_text' => $order_id,\n 'payment_methods' => $this->_paymentMethod,\n 'hide_login' => $this->_hidelogin,\n 'new_window_redirect' => '1'\n );\n\n // add optional day of birth\n if ($billing->getDob()) {\n $params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');\n }\n\n return $params;\n }",
"function get_registration_required_fields() {\n\t\t$requiredFields = new RequiredFields(\n\t\t\t'FirstName',\n\t\t\t'Surname',\n\t\t\t'Email'\n\t\t);\n\t\t//TODO: don't add ticket field when multiple attendees allowed\n\t\t//if(!$event->MultipleBooking)\n\t\t\t$requiredFields->addRequiredField('Ticket');\n\t\t// Allow decorators to add extra required fields\n\t\t//$this->extend('updateRegistrationRequiredFields', $requiredFields);\n\t\treturn $requiredFields;\n\t}",
"public function getFormFields($order, $requestParams)\n {\n if (empty($order)) {\n if (!($order = $this->getOrder())) {\n return array();\n }\n }\n $payment = $order->getPayment()->getMethodInstance();\n $formFields = array();\n $formFields['PSPID'] = $this->getConfig()->getPSPID($order->getStoreId());\n $formFields['AMOUNT'] = $this->getHelper()->getAmount($order->getBaseGrandTotal());\n $formFields['CURRENCY'] = Mage::app()->getStore()->getBaseCurrencyCode();\n $formFields['ORDERID'] = Mage::helper('ops/order')->getOpsOrderId($order);\n $formFields['LANGUAGE'] = Mage::app()->getLocale()->getLocaleCode();\n $formFields['PM'] = $payment->getOpsCode($order->getPayment());\n $formFields['EMAIL'] = $order->getCustomerEmail();\n\n $methodDependendFields = $this->getMethodDependendFormFields($order, $requestParams);\n if (is_array($methodDependendFields)) {\n $formFields = array_merge($formFields, $methodDependendFields);\n }\n\n $paymentAction = $this->_getOPSPaymentOperation();\n if ($paymentAction ) {\n $formFields['OPERATION'] = $paymentAction;\n }\n\n\n if ($this->getConfig()->getConfigData('template')=='ops') {\n $formFields['TP']= '';\n $formFields['PMLISTTYPE'] = $this->getConfig()->getConfigData('pmlist');\n } else {\n $formFields['TP']= $this->getConfig()->getPayPageTemplate();\n }\n $formFields['TITLE'] = $this->getConfig()->getConfigData('html_title');\n $formFields['BGCOLOR'] = $this->getConfig()->getConfigData('bgcolor');\n $formFields['TXTCOLOR'] = $this->getConfig()->getConfigData('txtcolor');\n $formFields['TBLBGCOLOR'] = $this->getConfig()->getConfigData('tblbgcolor');\n $formFields['TBLTXTCOLOR'] = $this->getConfig()->getConfigData('tbltxtcolor');\n $formFields['BUTTONBGCOLOR'] = $this->getConfig()->getConfigData('buttonbgcolor');\n $formFields['BUTTONTXTCOLOR'] = $this->getConfig()->getConfigData('buttontxtcolor');\n $formFields['FONTTYPE'] = $this->getConfig()->getConfigData('fonttype');\n $formFields['LOGO'] = $this->getConfig()->getConfigData('logo');\n $formFields['HOMEURL'] = $this->getConfig()->hasHomeUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'home')) : 'NONE';\n $formFields['CATALOGURL'] = $this->getConfig()->hasCatalogUrl() ? $this->getConfig()->getContinueUrl(array('redirect' => 'catalog')) : '';\n $formFields['ACCEPTURL'] = $this->getConfig()->getAcceptUrl();\n $formFields['DECLINEURL'] = $this->getConfig()->getDeclineUrl();\n $formFields['EXCEPTIONURL'] = $this->getConfig()->getExceptionUrl();\n $formFields['CANCELURL'] = $this->getConfig()->getCancelUrl();\n $formFields['BACKURL'] = $this->getConfig()->getCancelUrl();\n\n $shaSign = Mage::helper('ops/payment')->shaCrypt(Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()));\n\n $helper = Mage::helper('ops');\n $helper->log($helper->__(\"Register Order %s in Ingenico Payment Services \\n\\nAll form fields: %s\\nIngenico Payment Services String to hash: %s\\nHash: %s\",\n $order->getIncrementId(),\n serialize($formFields),\n Mage::helper('ops/payment')->getSHASign($formFields, null, $order->getStoreId()),\n $shaSign\n ));\n\n $formFields['SHASIGN'] = $shaSign;\n return $formFields;\n }",
"function get_required_fields($field, $html = false) {\n\n $meta_keys = fields\\get_field_ids($field, $html);\n\n if (isset($field['required'])) {\n if (gettype($field['required']) == 'boolean' && $field['required']) return $meta_keys;\n if (is_array($field['required'])) {\n if (count($field['required']) == count($meta_keys)) {\n $meta_keys = lib\\array_mask($meta_keys, $field['required']);\n } else {\n log\\error('INVALID_FIELD', 'The field is invalid because the length of the required array != number of meta keys ids for this type of field. Details '.json_encode($field));\n }\n } \n } else if ($field['type'] == 'REPEAT-GROUP') {\n $res = array_map(function($f) { return get_required_fields($f, true);}, $field['fields']);\n $meta_keys = lib\\array_flatten($res);\n }\n\n return $meta_keys;\n}",
"abstract protected function getMandatoryModelsFields();",
"function init_form_fields() {\n\n \tinclude ( SUMO_SAGEPLUGINPATH . 'includes/sagepay-form-admin.php' );\n\n }",
"public static function getRequiredFields()\n\t{\n\t\t$requiredFields = [\n\t\t\t'url' => 'string',\n\t\t\t'name' => 'string',\n\t\t\t'price' => 'float',\n\t\t\t'devise' => 'string',\n\t\t\t'edition_idEdition' => 'int',\n\t\t];\n\n\t\treturn $requiredFields;\n\t}",
"protected function getRequiredFieldList()\n {\n return RequiredFields::create(\n $this->getBareRequiredFieldList()\n )\n ->setForm($this);\n }",
"function getfaircoin_edd_required_checkout_fields( $required_fields ) {\r\n $required_fields['edd_fairaddress'] = array(\r\n 'error_id' => 'invalid_fairaddress',\r\n 'error_message' => __('Please enter a valid Faircoin Address', 'edd-getfaircoin')\r\n );\r\n return $required_fields;\r\n}",
"public function getCommonForm()\n {\n return $this->common_form;\n }",
"public static function getRequiredFields()\n\t{\n\t\t$requiredFields = [\n\t\t\t'content' => 'string',\n\t\t\t'console_names' => 'string',\n\t\t\t'game_idGame' => 'int',\n\t\t];\n\n\t\treturn $requiredFields;\n\t}",
"private function getConfigurationFields($oForm)\n {\n $oForm->setWidgets(\n\t\t\tarray(\n\t\t\t\t\t'cem_cemetery_id' \t=> __('Select Cemetery'),\n\t\t\t\t\t'country_id'\t\t=> __('Select Country'),\n\t\t\t\t )\n\t\t);\n\n $oForm->setLabels(\n array(\n\t\t\t\t'country_id' \t=> __('Country'),\n\t\t\t\t'cem_cemetery_id' \t=> __('Cemetery'),\n 'import_file' => __('Select File')\n )\n );\n\n $oForm->setValidators(\n array(\n\t\t\t\t\t'import_file' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select file'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'invalid' => __('Please select only EXCEL and CSV file'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'maxsize' => __('The file size is too large')\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'country_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select country')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n \t 'cem_cemetery_id' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'required' => __('Please select cemetery')\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t)\n );\n }",
"private function getRequiredFields()\n\t{\n\t\treturn $this->endpointRequiredFields;\n\t}",
"function wc_elshaddai_bfield( $fields ) {\n $fields['billing_number']['maxlength'] = 5;\n $fields['billing_address_2']['maxlength'] = 30;\n $fields['billing_address_2']['label_class'] = array('');\n $fields['billing_neighborhood']['required'] = true;\n return $fields;}",
"public function required_fields(array $fields)\n\t{\n\t\tif (count($fields) > 0)\n\t\t{\n\t\t\tforeach ($fields as $field)\n\t\t\t{\n\t\t\t\t$this->_required_fields[$field] = TRUE;\n\t\t\t}\n\t\t}\n\t}",
"function pw_edd_purchase_form_required_fields( $required_fields ) {\n \n \t// Set a field as required\n $required_fields['edd_last'] = array( \n 'error_id' => 'invalid_last_name',\n 'error_message' => __( 'Please enter your last name.', 'edd' )\n );\n\n /*\n * If you wanted to remove a field from required list\n\t * you would simply unset the array key\n\t */\n // unset( $required_fields['edd_first'] );\n \n return $required_fields;\n}"
]
| [
"0.73391706",
"0.64274025",
"0.6404952",
"0.6034123",
"0.5996517",
"0.59390277",
"0.5932513",
"0.58979553",
"0.58324975",
"0.5827117",
"0.58121955",
"0.5788349",
"0.5741503",
"0.5704144",
"0.563808",
"0.5624313",
"0.5618433",
"0.5598123",
"0.5597772",
"0.55590117",
"0.55190516",
"0.5486573",
"0.54852843",
"0.54831666",
"0.5450723",
"0.54366237",
"0.5433349",
"0.53961045",
"0.5395005",
"0.5393432"
]
| 0.75235206 | 0 |
Alter the entity edit form thirdparty elements structure. This works around the problem that Drupal core nests each invokation of 'field_formatter_third_party_settings_form' and 'field_widget_third_party_settings_form' under the machine name of the module that implements it, which would be the name of this module and not the modules that subscribe to our event. | public function formAlter(FormIdAlterEvent $event): void {
$form = &$event->getForm();
// $form['#fields'] lists all field name keys on this entity.
foreach ($form['#fields'] as $fieldName) {
// Skip any fields that have no field_event_dispatcher third-party
// settings.
if (!isset($form['fields'][$fieldName]['plugin']['settings_edit_form']['third_party_settings']['field_event_dispatcher'])) {
continue;
}
$thirdPartySettings = &$form['fields'][$fieldName]['plugin']['settings_edit_form']['third_party_settings'];
$thirdPartySettings = NestedArray::mergeDeep(
$thirdPartySettings,
$thirdPartySettings['field_event_dispatcher']
);
unset($thirdPartySettings['field_event_dispatcher']);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ou_ouice3_form_system_theme_settings_alter(&$form, &$form_state) {\n // OU ICE settings fieldset\n $form['ouice'] = array(\n '#type' => 'fieldset',\n '#title' => t('OU ICE Settings'),\n );\n\n // Create header and footer form, Forms API\n $form['ouice']['header_choice'] = array(\n '#type' => 'select',\n '#title' => t('Select OU header and footer pair to display'),\n '#default_value' => theme_get_setting('header_choice'),\n '#options' => array(\n // Standard OU ICE header selections\n 'OU ICE' => array(\n 'ou-ia-about' => 'About',\n 'ou-ia-study' => 'Study',\n 'ou-ia-research' => 'Research',\n 'ou-ia-community' => 'Community',\n 'ou-ia-learning' => 'Learning',\n '' => 'No IA',\n ),\n 'Intranet' => array(\n 'intranet' => 'Default',\n ),\n 'legacy' => 'Legacy',\n 'none' => 'None',\n ),\n );\n\n // Create body classes form, Forms API\n $form['ouice']['body_classes'] = array(\n '#type' => 'checkboxes',\n '#title' => t('Select which OUICE body classes to apply'),\n '#default_value' => theme_get_setting('body_classes'),\n '#options' => array(\n 'ou-connected' => 'Connected',\n 'ou-sections' => 'Sections',\n 'ou-pure' => 'Pure',\n 'ou-three' => 'Three',\n 'ou-panels' => 'Panel',\n 'ou-subtle' => 'Subtle',\n 'ou-unboxed' => 'Unboxed',\n 'ou-altnav' => 'Altnav',\n 'ou-neutral' => 'Neutral',\n ),\n );\n\n // Create faculty classes form, Forms API\n $form['ouice']['faculty_classes'] = array(\n '#type' => 'radios',\n '#title' => t('Select OU faculty to customise'),\n '#default_value' => theme_get_setting('faculty_classes'),\n '#options' => array(\n 'none' => 'no faculty style selected',\n 'ou-arts' => 'Faculty of Arts',\n 'ou-fels' => 'Faculty of Education & Language Studies (FELS)',\n 'ou-hsc' => 'Faculty of Health & Social Care (HSC)',\n 'ou-mct' => 'Faculty of Mathematics, Computing & Technology (MCT)',\n 'ou-science' => 'Faculty of Science',\n 'ou-ss' => 'Faculty of Social Sciences',\n 'ou-iet' => 'Institute of Educational Technology (IET)',\n 'ou-bs' => 'Open University Business School (OUBS)',\n 'ou-law' => 'Law',\n 'ou-kmi' => 'KMI',\n 'ou-esteem' => 'Esteem',\n 'ou-intranet' => 'Intranet',\n ),\n );\n\n // Create menu type Forms API\n $form['ouice']['nav_type'] = array(\n '#type' => 'radios',\n '#title' => t('Select OUICE menu type to display'),\n '#default_value' => theme_get_setting('nav_type'),\n '#options' => array(\n 'ou-full-nav' => 'OUICE full navigation',\n 'ou-context-nav' => 'OUICE context navigation',\n ),\n );\n}",
"function layout_builder_post_update_section_third_party_settings_schema() {\n // Empty post-update hook.\n}",
"function thumbwhere_host_edit_form($form, &$form_state, $thumbwhere_host) {\n\n // Add the default field elements.\n $form['fk_hosttype'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereHost fk_hosttype'),\n '#default_value' => isset($thumbwhere_host->fk_hosttype) ? $thumbwhere_host->fk_hosttype : '',\n //'#maxlength' => 255,\n /// '#required' => TRUE,\n '#weight' => -5,\n '#autocomplete_path' => 'entity-autocomplete/thumbwhere_hosttype',\n );\n // Add the default field elements.\n $form['fk_hostcredential'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereHost fk_hostcredential'),\n '#default_value' => isset($thumbwhere_host->fk_hostcredential) ? $thumbwhere_host->fk_hostcredential : '',\n //'#maxlength' => 255,\n /// '#required' => TRUE,\n '#weight' => -5,\n '#autocomplete_path' => 'entity-autocomplete/thumbwhere_hostcredential',\n );\n // Add the default field elements.\n $form['address'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereHost address'),\n '#default_value' => isset($thumbwhere_host->address) ? $thumbwhere_host->address : '',\n // '#maxlength' => 255,\n // '#required' => TRUE,\n '#weight' => -5,\n );\n // Add the default field elements.\n $form['online'] = array(\n '#type' => 'checkbox',\n '#title' => t('ThumbWhereHost online'),\n '#default_value' => isset($thumbwhere_host->online) ? $thumbwhere_host->online : 0,\n // '#maxlength' => 255,\n // '#required' => TRUE,\n '#weight' => -5,\n );\n\n\n\n $form['data']['#tree'] = TRUE;\n\n /*\n $form['data']['sample_data'] = array(\n '#type' => 'checkbox',\n '#title' => t('An interesting thumbwhere_host switch'),\n '#default_value' => isset($thumbwhere_host->data['sample_data']) ? $thumbwhere_host->data['sample_data'] : 1,\n );\n */\n\n\n // Add the field related form elements.\n $form_state['thumbwhere_host'] = $thumbwhere_host;\n field_attach_form('thumbwhere_host', $thumbwhere_host, $form, $form_state);\n\n $form['actions'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('form-actions')),\n '#weight' => 400,\n );\n\n // We add the form's #submit array to this button along with the actual submit\n // handler to preserve any submit handlers added by a form callback_wrapper.\n $submit = array();\n\n if (!empty($form['#submit'])) {\n $submit += $form['#submit'];\n }\n\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save thumbwhere_host'),\n '#submit' => $submit + array('thumbwhere_host_edit_form_submit'),\n );\n\n // Do we show the delete button?\n if (!empty($thumbwhere_host->pk_host)) {\n $form['actions']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete thumbwhere_host'),\n '#suffix' => l(t('Cancel'), 'admin/thumbwhere/thumbwhere_hosts'),\n '#submit' => $submit + array('thumbwhere_host_form_submit_delete'),\n '#weight' => 45,\n );\n }\n\n // We append the validate handler to #validate in case a form callback_wrapper\n // is used to add validate handlers earlier.\n $form['#validate'][] = 'thumbwhere_host_edit_form_validate';\n return $form;\n}",
"public function testThirdPartySettings() {\n $third_party_settings = [\n 'field_test' => [\n 'foo' => 'bar',\n ],\n ];\n $component = $this->display->getComponent($this->fieldName);\n $component['third_party_settings'] = $third_party_settings;\n $this->display->setComponent($this->fieldName, $component)->save();\n $entity = EntityTestRev::create([]);\n\n $entity->{$this->fieldName}->value = $this->randomString();\n $build = $entity->{$this->fieldName}->view('default');\n $this->assertEquals($third_party_settings, $build['#third_party_settings']);\n }",
"function commerce_oz_eway_3p_settings_form($settings = NULL) {\n\n $form = array();\n \n\n\t$logopath = '/' . drupal_get_path('module', 'commerce_oz') . '/image/eway_68.png';\n\t\n\t$descText = '<a href=\"http://www.eway.com.au\"><img src=\"' . $logopath . '\" align =\"left\" /></a>Payment Method for the <a href=\"http://www.eway.com.au/how-it-works/what-products-are-included-\">eWay Shared</a> (3 party) provided by <a href=\"http://www.eway.com.au/company\">eWay Payment Service</a> (Australia).<br />No settings are provided here.';\n\n $form['commerce_oz_intro_settings'] = array(\n '#type' => 'fieldset',\n '#title' => t('eWay Shared'),\n '#collapsible' => FALSE, \n \t'#collapsed' => FALSE,\n '#description' => t($descText),\n );\n\n return $form;\n}",
"function islandora_related_content_form_islandora_related_content_form_alter(&$form, &$formstate){\n $hooks = array();\n\n // Object\n $object = islandora_object_load($formstate['islandora']['object']);\n if(array_intersect(array('fedora-system:ContentModel-3.0'), $object->models))\n {\n unset($form['Add']);\n unset($form['View']);\n }\n\n\n\n // Related CModel\n $related_cmodel_id = $formstate['islandora']['cmodel'];\n $related_cmodel_types = islandora_cmodel_types($related_cmodel_id);\n\n $rcm_count = 0;\n // Iterate through array of types and make the function safe version of them.\n foreach($related_cmodel_types as $rcm){\n $rcm_str_replaced = str_replace(array(':', '.', '-'), '_', $rcm);\n $related_cmodel_types[$rcm_count] = $rcm_str_replaced;\n\n // Hook function string.\n $hook = \"form_islandora_related_{$rcm_str_replaced}_content_form\";\n drupal_alter($hook, $form, $formstate);\n $rcm_count++;\n }\n\n $object_models = islandora_object_models($object);\n\n // Iterate through the Object's CModels, making them function safe.\n foreach($object_models as $ocm){\n $object_cmodel = str_replace(array(':', '.', '-'), '_', $ocm);\n\n drupal_alter(\"form_islandora_{$object_cmodel}_related_content_form\", $form, $formstate);\n\n foreach($related_cmodel_types as $rcm){\n $hook = \"form_islandora_{$object_cmodel}_related_{$rcm}_content_form\";\n drupal_alter($hook, $form, $formstate);\n }\n }\n}",
"function weldata_form_alter(&$form, &$form_state){\n\n}",
"function gwt_drupal_form_node_form_alter(&$form, &$form_state, $form_id) {\n // Remove if #1245218 is backported to D7 core.\n foreach (array_keys($form) as $item) {\n if (strpos($item, 'field_') === 0) {\n if (!empty($form[$item]['#attributes']['class'])) {\n foreach ($form[$item]['#attributes']['class'] as &$class) {\n // Core bug: the field-type-text-with-summary class is used as a JS hook.\n if ($class != 'field-type-text-with-summary' && strpos($class, 'field-type-') === 0 || strpos($class, 'field-name-') === 0) {\n // Make the class different from that used in theme_field().\n $class = 'form-' . $class;\n }\n }\n }\n }\n }\n}",
"function facebook_instant_articles_field_ui_fields_save($form, &$form_state) {\n // Setup some variables.\n $entity_type = $form['#entity_type'];\n $bundle = $form['#bundle'];\n $view_mode = $form['#view_mode'];\n\n // Delete previous field configuration configuration.\n db_delete('facebook_instant_articles_field_settings')\n ->condition('entity_type', $entity_type)\n ->condition('bundle', $bundle)\n ->condition('view_mode', $view_mode)\n ->execute();\n\n if (empty($form_state['layout_saved'])) {\n return;\n }\n\n $field_settings = array();\n\n // Save settings for each field.\n $fields = $form['#fbia_fields'];\n foreach ($fields as $field) {\n\n // Field settings.\n $field_values = $form_state['values']['fields'][$field];\n\n // In case the region is hidden, do not save.\n if (isset($field_values['region']) && $field_values['region'] == 'hidden') {\n continue;\n }\n\n // Build settings.\n $settings = array();\n $settings['weight'] = $field_values['weight'];\n $settings['label'] = $field_values['label'];\n $settings['format'] = $field_values['format']['type'];\n\n // Any formatter settings.\n if (isset($form_state['formatter_settings'][$field])) {\n $settings['formatter_settings'] = $form_state['formatter_settings'][$field];\n }\n\n $field_settings[$field] = $settings;\n }\n\n // Allow other modules to modify the field settings before they get saved.\n drupal_alter('facebook_instant_articles_field_settings', $field_settings, $form, $form_state);\n\n // Save the record.\n if (!empty($field_settings)) {\n $record = new stdClass();\n $record->id = $form['#export_id'];\n $record->entity_type = $entity_type;\n $record->bundle = $bundle;\n $record->view_mode = $view_mode;\n $record->settings = $field_settings;\n drupal_write_record('facebook_instant_articles_field_settings', $record);\n }\n\n // Clear the field cache.\n cache_clear_all('facebook_instant_articles_fields:', 'cache', TRUE);\n cache_clear_all('facebook_instant_articles_field_settings', 'cache');\n}",
"function thumbwhere_contentcollectionitem_edit_form($form, &$form_state, $thumbwhere_contentcollectionitem) {\n\n // Add the default field elements.\n $form['fk_contentcollection'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereContentCollectionItem fk_contentcollection'),\n '#default_value' => isset($thumbwhere_contentcollectionitem->fk_contentcollection) ? $thumbwhere_contentcollectionitem->fk_contentcollection : '',\n //'#maxlength' => 255,\n /// '#required' => TRUE,\n '#weight' => -5,\n '#autocomplete_path' => 'entity-autocomplete/thumbwhere_contentcollection',\n );\n // Add the default field elements.\n $form['fk_content'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereContentCollectionItem fk_content'),\n '#default_value' => isset($thumbwhere_contentcollectionitem->fk_content) ? $thumbwhere_contentcollectionitem->fk_content : '',\n //'#maxlength' => 255,\n /// '#required' => TRUE,\n '#weight' => -5,\n '#autocomplete_path' => 'entity-autocomplete/thumbwhere_content',\n );\n // Add the default field elements.\n $form['weight'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereContentCollectionItem weight'),\n '#default_value' => isset($thumbwhere_contentcollectionitem->weight) ? $thumbwhere_contentcollectionitem->weight : 1,\n // '#maxlength' => 255,\n // '#required' => TRUE,\n '#weight' => -5,\n );\n\n\n\n $form['data']['#tree'] = TRUE;\n\n /*\n $form['data']['sample_data'] = array(\n '#type' => 'checkbox',\n '#title' => t('An interesting thumbwhere_contentcollectionitem switch'),\n '#default_value' => isset($thumbwhere_contentcollectionitem->data['sample_data']) ? $thumbwhere_contentcollectionitem->data['sample_data'] : 1,\n );\n */\n\n\n // Add the field related form elements.\n $form_state['thumbwhere_contentcollectionitem'] = $thumbwhere_contentcollectionitem;\n field_attach_form('thumbwhere_contentcollectionitem', $thumbwhere_contentcollectionitem, $form, $form_state);\n\n $form['actions'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('form-actions')),\n '#weight' => 400,\n );\n\n // We add the form's #submit array to this button along with the actual submit\n // handler to preserve any submit handlers added by a form callback_wrapper.\n $submit = array();\n\n if (!empty($form['#submit'])) {\n $submit += $form['#submit'];\n }\n\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save thumbwhere_contentcollectionitem'),\n '#submit' => $submit + array('thumbwhere_contentcollectionitem_edit_form_submit'),\n );\n\n // Do we show the delete button?\n if (!empty($thumbwhere_contentcollectionitem->pk_contentcollectionitem)) {\n $form['actions']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete thumbwhere_contentcollectionitem'),\n '#suffix' => l(t('Cancel'), 'admin/thumbwhere/thumbwhere_contentcollectionitems'),\n '#submit' => $submit + array('thumbwhere_contentcollectionitem_form_submit_delete'),\n '#weight' => 45,\n );\n }\n\n // We append the validate handler to #validate in case a form callback_wrapper\n // is used to add validate handlers earlier.\n $form['#validate'][] = 'thumbwhere_contentcollectionitem_edit_form_validate';\n return $form;\n}",
"function opensky_form_islandora_scholar_upload_form_alter (&$form, &$form_state, $form_id) {\n unset ($form['upload_document']['usage']);\n\n // we also want to change an aspect of this form's submit process (see\n // islandora_scholar_upload_form_submit).\n\n // We replace islandora_scholar_upload_submit because we need to change the way it \n // modifies the MODS with values from the form.\n\n foreach ($form['#submit'] as $key=>$submit_fn) {\n if ($submit_fn == 'islandora_scholar_upload_form_submit') {\n $form['#submit'][$key] = 'opensky_upload_form_submit';\n }}\n}",
"function opensky_form_islandora_scholar_modify_form_alter (array &$form, array &$form_state) {\n\n // grab object from form_state\n $object = $form_state['build_info']['args'][0];\n $pid = $object->id;\n // dpm (\"pid: $pid\");\n \n // get the version from the opensky-specific location in the MODS stream\n $mods_str = trim($object['MODS']->content);\n\n $mods_doc = new DOMDocument();\n $mods_doc->loadXML($mods_str);\n $mods_xpath = new DOMXPath($mods_doc);\n $mods_xpath->registerNamespace('m', 'http://www.loc.gov/mods/v3');\n $mods_versions = $mods_xpath->query('//m:mods/m:physicalDescription/m:note[@type=\"version\"]');\n \n if ($mods_versions->length > 0) {\n $version = $mods_versions->item(0)->textContent;\n $form['version']['#markup'] = $version;\n }\n}",
"function _ec_partners_content_default_fields() {\n $fields = array();\n\n // Exported field: field_partner_address\n $fields[] = array(\n 'field_name' => 'field_partner_address',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'weight' => '-2',\n 'parent' => '',\n 'label' => array(\n 'format' => 'inline',\n ),\n 'teaser' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'full' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'text',\n 'required' => '0',\n 'multiple' => '0',\n 'module' => 'text',\n 'active' => '1',\n 'text_processing' => '0',\n 'max_length' => '',\n 'allowed_values' => '',\n 'allowed_values_php' => '',\n 'widget' => array(\n 'rows' => 5,\n 'size' => '60',\n 'default_value' => array(\n '0' => array(\n 'value' => '',\n '_error_element' => 'default_value_widget][field_partner_address][0][value',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'Address',\n 'weight' => '-1',\n 'description' => '',\n 'type' => 'text_textfield',\n 'module' => 'text',\n ),\n );\n\n // Exported field: field_partner_city\n $fields[] = array(\n 'field_name' => 'field_partner_city',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'weight' => '-1',\n 'parent' => '',\n 'label' => array(\n 'format' => 'inline',\n ),\n 'teaser' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'full' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'text',\n 'required' => '0',\n 'multiple' => '0',\n 'module' => 'text',\n 'active' => '1',\n 'text_processing' => '0',\n 'max_length' => '',\n 'allowed_values' => '',\n 'allowed_values_php' => '',\n 'widget' => array(\n 'rows' => 5,\n 'size' => '60',\n 'default_value' => array(\n '0' => array(\n 'value' => '',\n '_error_element' => 'default_value_widget][field_partner_city][0][value',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'City',\n 'weight' => 0,\n 'description' => '',\n 'type' => 'text_textfield',\n 'module' => 'text',\n ),\n );\n\n // Exported field: field_partner_country\n $fields[] = array(\n 'field_name' => 'field_partner_country',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'weight' => 0,\n 'parent' => '',\n 'label' => array(\n 'format' => 'inline',\n ),\n 'teaser' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'full' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'text',\n 'required' => '0',\n 'multiple' => '0',\n 'module' => 'text',\n 'active' => '1',\n 'text_processing' => '0',\n 'max_length' => '',\n 'allowed_values' => '',\n 'allowed_values_php' => '',\n 'widget' => array(\n 'rows' => 5,\n 'size' => '60',\n 'default_value' => array(\n '0' => array(\n 'value' => '',\n '_error_element' => 'default_value_widget][field_partner_country][0][value',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'Country',\n 'weight' => '1',\n 'description' => '',\n 'type' => 'text_textfield',\n 'module' => 'text',\n ),\n );\n\n // Exported field: field_partner_grandparentref\n $fields[] = array(\n 'field_name' => 'field_partner_grandparentref',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'label' => array(\n 'format' => 'above',\n 'exclude' => 0,\n ),\n 'teaser' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'full' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'nodereference',\n 'required' => '0',\n 'multiple' => '0',\n 'module' => 'nodereference',\n 'active' => '1',\n 'referenceable_types' => array(\n 'master' => 'master',\n 'feed' => 0,\n 'feed_2' => 0,\n 'feed_item2' => 0,\n 'feed_item' => 0,\n 'glance' => 0,\n 'glance_details' => 0,\n 'glance_feed' => 0,\n 'image' => 0,\n 'master_feed' => 0,\n 'page' => 0,\n 'partner' => 0,\n 'partner_feed' => 0,\n 'story' => 0,\n 'xml_item' => 0,\n ),\n 'advanced_view' => '',\n 'advanced_view_args' => '',\n 'widget' => array(\n 'autocomplete_match' => 'contains',\n 'size' => 60,\n 'default_value' => array(\n '0' => array(\n 'nid' => '',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'Master ',\n 'weight' => '-4',\n 'description' => '',\n 'type' => 'nodereference_select',\n 'module' => 'nodereference',\n ),\n );\n\n // Exported field: field_partner_location\n $fields[] = array(\n 'field_name' => 'field_partner_location',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'weight' => '-3',\n 'parent' => '',\n 'label' => array(\n 'format' => 'above',\n ),\n 'teaser' => array(\n 'format' => 'default',\n 'exclude' => 1,\n ),\n 'full' => array(\n 'format' => 'default',\n 'exclude' => 1,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'openlayers_wkt',\n 'required' => '1',\n 'multiple' => '0',\n 'module' => 'openlayers_cck',\n 'active' => '1',\n 'openlayers_cck_feature_types' => array(\n 'point' => 'point',\n 'path' => 0,\n 'polygon' => 0,\n ),\n 'widget' => array(\n 'openlayers_cck_preset_map' => 'partner_location',\n 'default_value' => array(\n '0' => array(\n 'openlayers_wkt' => '',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'Location',\n 'weight' => '-2',\n 'description' => '',\n 'type' => 'openlayers_geocoder_widget',\n 'module' => 'openlayers_geocoder',\n ),\n );\n\n // Exported field: field_partner_logo\n $fields[] = array(\n 'field_name' => 'field_partner_logo',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'weight' => '-4',\n 'parent' => '',\n 'label' => array(\n 'format' => 'hidden',\n ),\n 'teaser' => array(\n 'format' => 'partner-m_default',\n 'exclude' => 0,\n ),\n 'full' => array(\n 'format' => 'partner-m_default',\n 'exclude' => 0,\n ),\n '4' => array(\n 'format' => 'image_plain',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'image_plain',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'image_plain',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'image_plain',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'filefield',\n 'required' => '1',\n 'multiple' => '0',\n 'module' => 'filefield',\n 'active' => '1',\n 'list_field' => '0',\n 'list_default' => 1,\n 'description_field' => '0',\n 'widget' => array(\n 'file_extensions' => 'png gif jpg jpeg',\n 'file_path' => '',\n 'progress_indicator' => 'bar',\n 'max_filesize_per_file' => '',\n 'max_filesize_per_node' => '',\n 'max_resolution' => 0,\n 'min_resolution' => 0,\n 'alt' => '',\n 'custom_alt' => 0,\n 'title' => '',\n 'custom_title' => 0,\n 'title_type' => 'textfield',\n 'default_image' => NULL,\n 'use_default_image' => 0,\n 'label' => 'Logo',\n 'weight' => '-3',\n 'description' => 'Upload the logo (or coat of arms) of your partner.',\n 'type' => 'imagefield_widget',\n 'module' => 'imagefield',\n ),\n );\n\n // Exported field: field_partner_marker\n $fields[] = array(\n 'field_name' => 'field_partner_marker',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'label' => array(\n 'format' => 'above',\n 'exclude' => 0,\n ),\n 'teaser' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'full' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'text',\n 'required' => '1',\n 'multiple' => '0',\n 'module' => 'text',\n 'active' => '1',\n 'text_processing' => '0',\n 'max_length' => '',\n 'allowed_values' => 'marker_01.png|Green\r\nmarker_02.png|Pink\r\nmarker_03.png|Blue\r\nmarker_04.png|Orange\r\nmarker_05.png|Brown\r\nmarker_06.png|Violet\r\nmarker_07.png|Grey\r\nmarker_08.png|Light brown\r\nmarker_09.png|Red\r\nmarker_10.png|Yellow\r\n',\n 'allowed_values_php' => '',\n 'widget' => array(\n 'default_value' => array(\n '0' => array(\n 'value' => '',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'Marker',\n 'weight' => '2',\n 'description' => 'Choose the color of the marker which will be used on the map.',\n 'type' => 'optionwidgets_select',\n 'module' => 'optionwidgets',\n ),\n );\n\n // Exported field: field_partner_order\n $fields[] = array(\n 'field_name' => 'field_partner_order',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'weight' => '3',\n 'parent' => '',\n 'label' => array(\n 'format' => 'above',\n ),\n 'teaser' => array(\n 'format' => 'hidden',\n 'exclude' => 1,\n ),\n 'full' => array(\n 'format' => 'hidden',\n 'exclude' => 1,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'number_integer',\n 'required' => '0',\n 'multiple' => '0',\n 'module' => 'number',\n 'active' => '1',\n 'prefix' => '',\n 'suffix' => '',\n 'min' => '1',\n 'max' => '20',\n 'allowed_values' => '1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20',\n 'allowed_values_php' => '',\n 'widget' => array(\n 'default_value' => array(\n '0' => array(\n 'value' => '',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'Order',\n 'weight' => '4',\n 'description' => 'The order determines the position of this partner in a listing. Number 1 will be shown first, and number 20 will be shown last. ',\n 'type' => 'optionwidgets_select',\n 'module' => 'optionwidgets',\n ),\n );\n\n // Exported field: field_partner_website\n $fields[] = array(\n 'field_name' => 'field_partner_website',\n 'type_name' => 'partner',\n 'display_settings' => array(\n 'weight' => '2',\n 'parent' => '',\n 'label' => array(\n 'format' => 'inline',\n ),\n 'teaser' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'full' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '4' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '2' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n '3' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n 'token' => array(\n 'format' => 'default',\n 'exclude' => 0,\n ),\n ),\n 'widget_active' => '1',\n 'type' => 'link',\n 'required' => '0',\n 'multiple' => '0',\n 'module' => 'link',\n 'active' => '1',\n 'attributes' => array(\n 'target' => 'default',\n 'rel' => '',\n 'class' => '',\n ),\n 'display' => array(\n 'url_cutoff' => '80',\n ),\n 'url' => 0,\n 'title' => 'none',\n 'title_value' => '',\n 'enable_tokens' => 0,\n 'widget' => array(\n 'default_value' => array(\n '0' => array(\n 'title' => '',\n 'url' => '',\n ),\n ),\n 'default_value_php' => NULL,\n 'label' => 'Website',\n 'weight' => '3',\n 'description' => 'Put the link of your partner\\'s website here. Don\\'t forget the <code>http://</code> prefix: write <code>http://www.youthagora.org</code> instead of <code>www.youthagora.org</code>.',\n 'type' => 'link',\n 'module' => 'link',\n ),\n );\n\n // Translatables\n array(\n t('Address'),\n t('City'),\n t('Country'),\n t('Location'),\n t('Logo'),\n t('Marker'),\n t('Master '),\n t('Order'),\n t('Website'),\n );\n\n return $fields;\n}",
"function layout_builder_post_update_add_extra_fields(&$sandbox = NULL) {\n $entity_field_manager = \\Drupal::service('entity_field.manager');\n \\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'entity_view_display', function (LayoutEntityDisplayInterface $display) use ($entity_field_manager) {\n if (!$display->isLayoutBuilderEnabled()) {\n return FALSE;\n }\n\n $extra_fields = $entity_field_manager->getExtraFields($display->getTargetEntityTypeId(), $display->getTargetBundle());\n $components = $display->getComponents();\n // Sort the components to avoid them being reordered by setComponent().\n uasort($components, 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement');\n $result = FALSE;\n foreach ($components as $name => $component) {\n if (isset($extra_fields['display'][$name])) {\n $display->setComponent($name, $component);\n $result = TRUE;\n }\n }\n return $result;\n });\n}",
"function thumbwhere_contentcollection_edit_form($form, &$form_state, $thumbwhere_contentcollection) {\n\n // Add the default field elements.\n $form['fk_actor'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereContentCollection fk_actor'),\n '#default_value' => isset($thumbwhere_contentcollection->fk_actor) ? $thumbwhere_contentcollection->fk_actor : '',\n //'#maxlength' => 255,\n /// '#required' => TRUE,\n '#weight' => -5,\n '#autocomplete_path' => 'entity-autocomplete/thumbwhere_actor',\n );\n // Add the default field elements.\n $form['title'] = array(\n '#type' => 'textfield',\n '#title' => t('ThumbWhereContentCollection title'),\n '#default_value' => isset($thumbwhere_contentcollection->title) ? $thumbwhere_contentcollection->title : 'Hello',\n // '#maxlength' => 255,\n // '#required' => TRUE,\n '#weight' => -5,\n );\n\n\n\n $form['data']['#tree'] = TRUE;\n\n /*\n $form['data']['sample_data'] = array(\n '#type' => 'checkbox',\n '#title' => t('An interesting thumbwhere_contentcollection switch'),\n '#default_value' => isset($thumbwhere_contentcollection->data['sample_data']) ? $thumbwhere_contentcollection->data['sample_data'] : 1,\n );\n */\n\n\n // Add the field related form elements.\n $form_state['thumbwhere_contentcollection'] = $thumbwhere_contentcollection;\n field_attach_form('thumbwhere_contentcollection', $thumbwhere_contentcollection, $form, $form_state);\n\n $form['actions'] = array(\n '#type' => 'container',\n '#attributes' => array('class' => array('form-actions')),\n '#weight' => 400,\n );\n\n // We add the form's #submit array to this button along with the actual submit\n // handler to preserve any submit handlers added by a form callback_wrapper.\n $submit = array();\n\n if (!empty($form['#submit'])) {\n $submit += $form['#submit'];\n }\n\n $form['actions']['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save thumbwhere_contentcollection'),\n '#submit' => $submit + array('thumbwhere_contentcollection_edit_form_submit'),\n );\n\n // Do we show the delete button?\n if (!empty($thumbwhere_contentcollection->pk_contentcollection)) {\n $form['actions']['delete'] = array(\n '#type' => 'submit',\n '#value' => t('Delete thumbwhere_contentcollection'),\n '#suffix' => l(t('Cancel'), 'admin/thumbwhere/thumbwhere_contentcollections'),\n '#submit' => $submit + array('thumbwhere_contentcollection_form_submit_delete'),\n '#weight' => 45,\n );\n }\n\n // We append the validate handler to #validate in case a form callback_wrapper\n // is used to add validate handlers earlier.\n $form['#validate'][] = 'thumbwhere_contentcollection_edit_form_validate';\n return $form;\n}",
"function ef_notifications_form_node_form_alter(&$form, $form_state) {\n if (workbench_moderation_node_type_moderated($form['type']['#value'])) {\n $available = FALSE;\n // Workbench Moderation uses \"options\" fieldset in favor of \"revision information\"\n // if \"administer roles\" perm is given to content moderator.\n if (isset($form['revision_information']['workbench_moderation_state_new'])) {\n $wrapper_id = 'revision_information';\n $available = TRUE;\n }\n else if (isset($form['options']['workbench_moderation_state_new'])) {\n $wrapper_id = 'options';\n $available = TRUE;\n }\n\n if (!$available) {\n return;\n }\n\n $form[$wrapper_id]['workbench_moderation_state_new']['#ajax'] = array(\n 'callback' => 'ef_notifications_form_node_callback',\n 'wrapper' => 'wv-workflow-form-node',\n 'effect' => 'fade',\n 'event' => 'change',\n );\n\n $form[$wrapper_id]['workflow_email'] = array(\n '#prefix' => '<div id=\"wv-workflow-form-node\">',\n '#suffix' => '</div>',\n '#tree' => TRUE,\n );\n\n // Determine current state.\n if (isset($form['#node']->workbench_moderation['current']->state)) {\n $current_from_state = $form['#node']->workbench_moderation['current']->state;\n }\n else {\n $current_from_state = variable_get('workbench_moderation_default_state_' . $form['type']['#value'], workbench_moderation_state_none());\n }\n\n if ($current_from_state == workbench_moderation_state_published()) {\n $current_from_state = workbench_moderation_state_none();\n }\n\n // Initialize to the current state.\n $form_moderation_state = $current_from_state;\n if (empty($form_state['values'])) {\n $form_moderation_state = $current_from_state;\n }\n if (!empty($form_state['values']) &&\n isset($form_state['values']['workbench_moderation_state_new'])) {\n $form_moderation_state = $form_state['values']['workbench_moderation_state_new'];\n }\n if (!empty($form_state['values']) &&\n isset($form_state['values'][$wrapper_id]['workbench_moderation_state_new'])) {\n $form_moderation_state = $form_state['values'][$wrapper_id]['workbench_moderation_state_new'];\n }\n\n $ef_notifications = ef_notifications_get();\n foreach ($ef_notifications as $transition => $notification_roles) {\n foreach ($notification_roles as $rid => $notification_transition) {\n if ($notification_transition->from_name == $current_from_state\n && $notification_transition->to_name == $form_moderation_state) {\n ef_notifications_create_form_element($form, $notification_transition);\n }\n }\n }\n\n $form['actions']['submit']['#submit'][] = 'ef_notifications_notification_submit';\n }\n}",
"function os2forms_nemid_webform_edit_component($component) {\n $form = array();\n $form['value'] = array(\n '#type' => 'textfield',\n '#title' => t('Default value'),\n '#default_value' => $component['value'],\n '#description' => t('The default value of the field.') . ' ' . theme('webform_token_help'),\n '#size' => 60,\n '#maxlength' => 1024,\n '#weight' => 0,\n );\n $form['display']['placeholder'] = array(\n '#type' => 'textfield',\n '#title' => t('Placeholder'),\n '#default_value' => $component['extra']['placeholder'],\n '#description' => t('The placeholder will be shown in the field until the user starts entering a value.'),\n '#weight' => 10,\n '#parents' => array('extra', 'placeholder'),\n );\n $form['display']['disabled'] = array(\n '#type' => 'checkbox',\n '#title' => t('Readonly'),\n '#default_value' => $component['extra']['disabled'],\n '#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),\n '#weight' => 20,\n '#parents' => array('extra', 'disabled'),\n );\n $form['display']['element_hidden'] = array(\n '#type' => 'checkbox',\n '#title' => t('Hidden'),\n '#default_value' => $component['extra']['hidden'],\n '#description' => t('Make this field hidden.'),\n '#weight' => 10,\n '#parents' => array('extra', 'hidden'),\n );\n return $form;\n}",
"function facebook_instant_articles_field_ui_fields($entity_type, $bundle, $view_mode, array &$form, array &$form_state) {\n\n // Do not add the fields if there is no layout.\n if (!isset($form['#fbia_layout'])) {\n return;\n }\n\n // Get the fields and put them on the form.\n $fields = facebook_instant_articles_get_fields($entity_type, FALSE);\n\n // Get field settings.\n $field_settings = facebook_instant_articles_get_field_settings($entity_type, $bundle, $view_mode, FALSE);\n $form['#field_settings'] = $field_settings;\n\n $table = &$form['fields'];\n $form['#fbia_fields'] = array();\n\n $field_label_options = array(\n 'above' => t('Above'),\n 'inline' => t('Inline'),\n 'hidden' => t('<Hidden>'),\n );\n drupal_alter('facebook_instant_articles_label_options', $field_label_options);\n\n foreach ($fields as $key => $field) {\n\n $form['#fbia_fields'][] = $key;\n\n // Check on formatter settings.\n if (isset($form_state['formatter_settings'][$key])) {\n $field['formatter_settings'] = $form_state['formatter_settings'][$key];\n }\n elseif (isset($field_settings[$key]['formatter_settings'])) {\n $field['formatter_settings'] = $field_settings[$key]['formatter_settings'];\n $form_state['formatter_settings'][$key] = $field['formatter_settings'];\n }\n\n if (!isset($field_settings[$key]['ft']) && isset($field_settings[$key]['ft'])) {\n $form_state['formatter_settings'][$key]['ft'] = $field_settings[$key]['ft'];\n }\n\n $hidden = array('hidden' => t('<Hidden>'));\n $formatters = isset($field['properties']['formatters']) ? $hidden + $field['properties']['formatters'] : $hidden + array('default' => t('Default'));\n\n $table[$key] = array(\n '#row_type' => 'field',\n '#js_settings' => array('field'),\n '#region_callback' => 'field_ui_display_overview_row_region',\n '#attributes' => array('class' => array('draggable', 'tabledrag-leaf')),\n 'human_name' => array(\n '#markup' => check_plain($field['title']),\n ),\n 'weight' => array(\n '#type' => 'textfield',\n '#default_value' => isset($field_settings[$key]['weight']) ? $field_settings[$key]['weight'] : 0,\n '#size' => 3,\n '#attributes' => array('class' => array('field-weight')),\n ),\n 'parent_wrapper' => array(\n 'parent' => array(\n '#type' => 'select',\n '#empty_value' => '',\n '#options' => array(),\n '#attributes' => array('class' => array('field-parent')),\n '#parents' => array('fields', $key, 'parent'),\n ),\n 'hidden_name' => array(\n '#type' => 'hidden',\n '#default_value' => $key,\n '#attributes' => array('class' => array('field-name')),\n ),\n ),\n 'label' => array(\n '#type' => 'select',\n '#options' => $field_label_options,\n '#default_value' => isset($field_settings[$key]['label']) ? $field_settings[$key]['label'] : 'hidden',\n ),\n 'format' => array(\n 'type' => array(\n '#type' => 'select',\n '#options' => $formatters,\n '#default_value' => isset($field_settings[$key]['format']) ? $field_settings[$key]['format'] : 'hidden',\n '#attributes' => array('class' => array('field-formatter-type')),\n ),\n ),\n 'settings_summary' => array(),\n 'settings_edit' => array(),\n );\n\n $field['name'] = $key;\n $field['entity_type'] = $entity_type;\n $field['bundle'] = $bundle;\n $field['view_mode'] = $view_mode;\n }\n\n // Add fields submit handler.\n $form['#submit'][] = 'facebook_instant_articles_field_ui_fields_save';\n}",
"function workflow_hide_fields_option_elements($options = array()) {\r\n $form = array();\r\n\r\n // General Settings\r\n $form['general_settings'] = array(\r\n '#type' => 'fieldset',\r\n '#title' => t('General Settings'),\r\n );\r\n\r\n $nodeTypes['_select_an_item'] = t('Please select an item');\r\n $nodeTypes = array_merge($nodeTypes, node_type_get_names());\r\n $form['general_settings']['nodeType'] = array(\r\n '#type' => 'select',\r\n '#title' => t('Node type'),\r\n '#multiple' => FALSE,\r\n '#description' => t('The Node type'),\r\n '#options' => $nodeTypes,\r\n '#default_value' => $options['nodeType'],\r\n // Bind an ajax callback to the change event (which is the default for the\r\n // select form type) of the first dropdown. It will replace the second\r\n // dropdown when rebuilt.\r\n '#ajax' => array(\r\n // When 'event' occurs, Drupal will perform an ajax request in the\r\n // background. Usually the default value is sufficient (eg. change for\r\n // select elements), but valid values include any jQuery event,\r\n // most notably 'mousedown', 'blur', and 'submit'.\r\n 'event' => 'change',\r\n 'callback' => 'ajax_fields_callback',\r\n 'wrapper' => 'fields-replace',\r\n ),\r\n );\r\n \r\n // General Settings\r\n $form['general_settings']['fields'] = array(\r\n '#type' => 'fieldset',\r\n '#title' => t('Fields'),\r\n // The entire enclosing div created here gets replaced when dropdown_first\r\n // is changed.\r\n '#prefix' => '<div id=\"fields-replace\">',\r\n '#suffix' => '</div>',\r\n );\r\n\r\n $form['general_settings']['fields']['fieldResponsible'] = array(\r\n '#type' => 'select',\r\n '#title' => t('Field Responsible'),\r\n '#description' => t('The Field Responsible'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => isset($options['fieldResponsible']) ? $options['fieldResponsible'] : '',\r\n );\r\n\r\n $form['general_settings']['fields']['fieldRating'] = array(\r\n '#type' => 'select',\r\n '#title' => t('Field Rating'),\r\n '#description' => t('The Field Rating'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => isset($options['fieldRating']) ? $options['fieldRating'] : '',\r\n );\r\n\r\n $form['general_settings']['fields']['fieldState'] = array(\r\n '#type' => 'select',\r\n '#title' => t('Field State'),\r\n '#description' => t('The Field State'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => isset($options['fieldState']) ? $options['fieldState'] : '',\r\n );\r\n\r\n $form['general_settings']['fields']['fieldsWritableOnlyOnCreation'] = array(\r\n '#type' => 'select',\r\n '#title' => t('Fields Writable Only On Creation'),\r\n '#description' => t('The Fields Writable Only On Creation'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => isset($options['fieldsWritableOnlyOnCreation']) ? $options['fieldsWritableOnlyOnCreation'] : '',\r\n '#multiple' => 'true',\r\n );\r\n\r\n\r\n $form['general_settings']['stateResponsibleAssignment'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('State Responsible Assignment'),\r\n '#description' => t('The State Responsible Assignment'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => $options['stateResponsibleAssignment'],\r\n '#size' => 30,\r\n );\r\n $form['general_settings']['statesFinal'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('States Final'),\r\n '#description' => t('The States Final'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => $options['statesFinal'],\r\n '#size' => 30,\r\n );\r\n $form['general_settings']['statesRating'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('States Rating'),\r\n '#description' => t('The States where the author rates the task'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => $options['statesRating'],\r\n '#size' => 30,\r\n );\r\n $form['general_settings']['statesResponsibleAssigned'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('States Responsible Assigned'),\r\n '#description' => t('The States Responsible Assigned'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => $options['statesResponsibleAssigned'],\r\n '#size' => 30,\r\n );\r\n $form['general_settings']['roleSupervisor'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('Role Supervisor'),\r\n '#description' => t('The Role Supervisor'),\r\n////// '#element_validate' => array('_elexslider_validate_positive_integer'),\r\n '#default_value' => $options['roleSupervisor'],\r\n '#size' => 30,\r\n );\r\n\r\n return $form;\r\n}",
"function _erpal_contract_helper_alter_calendar_config_form(&$form, $form_state) {\n \n $field_names = array('field_cancelation_period', 'field_cancelation_period_con', 'field_date');\n $entity_type = 'node';\n $bundle_name = 'erpal_contract';\n \n foreach ($field_names as $field_name) {\n $form['date_item_tags'][$entity_type][$bundle_name][$field_name] = array(\n '#type' => 'textfield',\n '#title' => t('Tags for field !field_name', array('!field_name' => $field_name)),\n '#description' => t('This tag will be added as category to entities with this field'),\n '#default_value' => _erpal_calendar_helper_field_tag($entity_type, $bundle_name, $field_name),\n );\n }\n}",
"function init_form_fields() {\n parent::init_form_fields();\n WC_Midtrans_Utils::array_insert( $this->form_fields, 'enable_3d_secure', array(\n 'method_enabled' => array(\n 'title' => __( 'Allowed Payment Method', 'midtrans-woocommerce' ),\n 'type' => 'text',\n 'description' => __( 'Customize allowed payment method, separate payment method code with coma. e.g: bank_transfer,credit_card. <br>Leave it default if you are not sure.', 'midtrans-woocommerce' ),\n 'default' => 'credit_card'\n ),\n 'bin_number' => array(\n 'title' => __( 'Allowed CC BINs', 'midtrans-woocommerce'),\n 'type' => 'text',\n 'label' => __( 'Allowed CC BINs', 'midtrans-woocommerce' ),\n 'description' => __( 'Fill with CC BIN numbers (or bank name) that you want to allow to use this payment button. </br> Separate BIN number with coma Example: 4,5,4811,bni,mandiri', 'midtrans-woocommerce' ),\n 'default' => ''\n ),\n 'promo_code' => array(\n 'title' => __( 'Promo Code', 'midtrans-woocommerce' ),\n 'type' => 'text',\n 'description' => __( 'Promo Code that would be used for discount. Leave blank if you are not using promo code.', 'midtrans-woocommerce' ),\n 'default' => 'onlinepromomid'\n )\n ));\n }",
"function _webform_edit_file($currfield) {\r\n $edit_fields = array();\r\n $edit_fields['#theme'] = 'webform_edit_file';\r\n $edit_fields['extra']['filtering'] = array(\r\n '#type' => 'fieldset',\r\n '#collapsible' => TRUE,\r\n '#collapsed' => FALSE,\r\n '#title' => t('Upload Filtering'),\r\n '#description' => t('Select the types of uploads you would like to allow.'),\r\n '#element_validate' => array('_webform_edit_file_filtering_validate'),\r\n );\r\n\r\n // Find the list of all currently valid extensions.\r\n $current_types = isset($currfield['extra']['filtering']['types']) ? $currfield['extra']['filtering']['types'] : array();\r\n\r\n $types = array('gif', 'jpg', 'png');\r\n $edit_fields['extra']['filtering']['types']['webimages'] = array(\r\n '#type' => 'checkboxes',\r\n '#title' => t('Web Images'),\r\n '#options' => drupal_map_assoc($types),\r\n '#default_value' => array_intersect($current_types, $types),\r\n );\r\n\r\n $types = array('bmp', 'eps', 'tif', 'pict', 'psd');\r\n $edit_fields['extra']['filtering']['types']['desktopimages'] = array(\r\n '#type' => 'checkboxes',\r\n '#title' => t('Desktop Images'),\r\n '#options' => drupal_map_assoc($types),\r\n '#default_value' => array_intersect($current_types, $types),\r\n );\r\n\r\n $types = array('txt', 'rtf', 'html', 'odf', 'pdf', 'doc', 'ppt', 'xls', 'xml');\r\n $edit_fields['extra']['filtering']['types']['documents'] = array(\r\n '#type' => 'checkboxes',\r\n '#title' => t('Documents'),\r\n '#options' => drupal_map_assoc($types),\r\n '#default_value' => array_intersect($current_types, $types),\r\n );\r\n\r\n $types = array('avi', 'mov', 'mp3', 'ogg', 'wav');\r\n $edit_fields['extra']['filtering']['types']['media'] = array(\r\n '#type' => 'checkboxes',\r\n '#title' => t('Media'),\r\n '#options' => drupal_map_assoc($types),\r\n '#default_value' => array_intersect($current_types, $types),\r\n );\r\n\r\n $types = array('bz2', 'dmg', 'gz', 'jar', 'rar', 'sit', 'tar', 'zip');\r\n $edit_fields['extra']['filtering']['types']['archives'] = array(\r\n '#type' => 'checkboxes',\r\n '#title' => t('Archives'),\r\n '#options' => drupal_map_assoc($types),\r\n '#default_value' => array_intersect($current_types, $types),\r\n );\r\n\r\n $edit_fields['extra']['filtering']['addextensions'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('Additional Extensions'),\r\n '#default_value' => $currfield['extra']['filtering']['addextensions'],\r\n '#description' => t('Enter a list of additional file extensions for this upload field, seperated by commas.<br /> Entered extensions will be appended to checked items above.'),\r\n '#size' => 60,\r\n '#weight' => 3,\r\n '#default_value' => $currfield['extra']['filtering']['addextensions'],\r\n );\r\n\r\n $edit_fields['extra']['filtering']['size'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('Max Upload Size'),\r\n '#default_value' => $currfield['extra']['filtering']['size'],\r\n '#description' => t('Enter the max file size a user may upload (in KB).'),\r\n '#size' => 10,\r\n '#weight' => 3,\r\n '#default_value' => $currfield['extra']['filtering']['size'],\r\n );\r\n $edit_fields['extra']['savelocation'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('Upload Directory'),\r\n '#default_value' => $currfield['extra']['savelocation'],\r\n '#description' => '<div style=\"display: block\">'. t('Webform uploads are always saved in the site files directory. You may optionally specify a subfolder to store your files.') .'</div>',\r\n '#weight' => 3,\r\n '#element_validate' => array('_webform_edit_file_check_directory', '_webform_edit_file_validate'),\r\n '#after_build' => array('_webform_edit_file_check_directory'),\r\n );\r\n $edit_fields['extra']['width'] = array(\r\n '#type' => 'textfield',\r\n '#title' => t('Width'),\r\n '#default_value' => $currfield['extra']['width'],\r\n '#description' => t('Width of the file field.') .' '. t('Leaving blank will use the default size.'),\r\n '#size' => 5,\r\n '#maxlength' => 10,\r\n '#weight' => 4,\r\n );\r\n return $edit_fields;\r\n}",
"function opensky_form_islandora_scholar_embargo_form_alter (&$form, &$form_state, $form_id) {\n // dpm ('opensky_form_islandora_scholar_embargo_form_alter');\n\n $options = array(\n 'object' => t('Object-level embargo'),\n 'datastream' => t('Datastream'),\n );\n\n // add options for the object datastreams\n $pid = $form['pid']['#value'];\n $object = islandora_object_load($pid);\n foreach ($object as $datastream) {\n $options[$datastream->id] = $datastream->label;\n }\n\n // allowable options - these are the only \"embargop options\" allowed in opensky\n $allowed_options = array (\n 'object' => '',\n 'PDF' => '', // OPenSky added PDF to original \n 'OBJ' => '',\n 'PROXY_MP3' => '',\n );\n\n // reduce options to those allowable\n $options = array_intersect_key($options, $allowed_options);\n $form['dsid']['#options'] = $options;\n\n // stick opensky form submit handler in before islandora_scholar version\n module_load_include('inc', 'opensky', 'includes/utilities');\n // array_splice ($form['#submit'], 0, 0, 'opensky_embargo_form_submit');\n\n \n $form['#submit'] = array('opensky_embargo_form_submit');\n\n // dpm ($form);\n\n}",
"public function fieldWidgetFormAlter(array &$element,\n FormStateInterface $form_state,\n array $context) {\n /** @var \\Drupal\\Core\\Field\\WidgetBaseInterface $widget */\n $widget = $context['widget'];\n $widget_definition = $widget->getPluginDefinition();\n /** @var \\Drupal\\Core\\Field\\EntityReferenceFieldItemList $field */\n $field = $context['items'];\n /** @var \\Drupal\\Core\\Field\\FieldDefinitionInterface $field_definition */\n $field_definition = $field->getFieldDefinition();\n $settings = $field_definition->getSettings();\n if (isset($widget_definition['id']) && isset($settings['handler']) &&\n $settings['handler'] == 'parent_field_reference' &&\n isset($settings['handler_settings'])) {\n if ($form_state->getformObject()) {\n switch ($widget_definition['id']) {\n case 'entity_reference_autocomplete':\n case 'entity_reference_autocomplete_tags':\n $field_definition->addConstraint('ValidParentReference', [\n 'parents' => $this->getParents($settings['handler_settings'], $form_state),\n ]);\n $element['target_id']['#type'] = 'entity_autocomplete_by_parent';\n break;\n\n // @todo: other widge types change.\n }\n }\n }\n }",
"function alter_comment_form_fields($fields){\n \n $fields = array(\n 'author' =>\n '<div class=\"row\"><div class=\"col-md-6 comment-form-author \"><div class=\"action-wrapper\">' . \n '<input id=\"author\" name=\"author\" type=\"text\" value=\"' . esc_attr( $commenter['comment_author'] ) .\n '\" size=\"30\"' . $aria_req . ' />' . \n '<label for=\"author\">' . __( 'Name', 'domainreference' ) . '</label> ' .\n '</div></div>',\n\n 'email' =>\n '<div class=\"col-md-6 comment-form-email\"><div class=\"action-wrapper\">' . \n '<input id=\"email\" name=\"email\" type=\"text\" value=\"' . esc_attr( $commenter['comment_author_email'] ) .\n '\" size=\"30\"' . $aria_req . ' />' . \n '<label for=\"email\">' . __( 'Email', 'domainreference' ) . '</label> ' .\n '</div></div></div>',\n\n 'url' => '',\n );\n\n return $fields;\n}",
"function form_alter(&$form, &$form_state) {\n }",
"function regional_content_form_block_add_block_form_alter(&$form, &$form_state, $form_id) {\n regional_content_form_block_admin_configure_alter($form, $form_state, $form_id);\n}",
"function ccdev_hosting_form($form, &$form_state, $entity) {\n $form['site_name'] = array(\n '#type' => 'textfield',\n '#title' => t('Site Name'),\n '#required' => TRUE,\n '#default_value' => $entity->site_name,\n );\n $form['site_domain'] = array(\n '#type' => 'textfield',\n '#title' => t('Site Domain'),\n '#required' => TRUE,\n '#default_value' => $entity->site_domain,\n );\n $form['site_description'] = array(\n '#type' => 'textfield',\n '#title' => t('Description'),\n '#required' => FALSE,\n '#default_value' => $entity->site_description,\n );\n $form['site_cms'] = array(\n '#type' => 'textfield',\n '#title' => t('Site CMS'),\n '#required' => TRUE,\n '#default_value' => $entity->site_cms,\n );\n $form['group_price'] = array(\n '#type' => 'textfield',\n '#title' => t('Package'),\n '#required' => TRUE,\n '#default_value' => $entity->group_price,\n );\n\n $form['basic_entity'] = array(\n '#type' => 'value',\n '#value' => $entity,\n );\n field_attach_form('ccdev_hosting', $entity, $form, $form_state);\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Create Host'),\n '#weight' => 100,\n );\n\n return $form;\n}",
"function rebound_form_alter(&$form, &$form_state) {\n $form['comment_body']['#after_build'][] = 'rebound_customize_form';\n\t\n\tif($form['#node']->type == \"guild_application\") {\n\t\t$form['body']['#after_build'][] = 'rebound_customize_form';\n\t\t$form['application_references']['#after_build'][] = 'rebound_customize_form';\n\t\t$form['application_raid_experience']['#after_build'][] = 'rebound_customize_form';\n\t\t$form['application_raid_availablity']['#after_build'][] = 'rebound_customize_form';\n\t}\n\n}",
"function ting_extended_search_settings_fields_form($form, &$form_state) {\n $form = array(\n '#tree' => TRUE,\n );\n\n $form['fields'] = array(\n '#prefix' => '<div id=\"ting-ext-search-wrapper\">',\n '#suffix' => '</div>',\n '#type' => 'fieldset',\n '#title' => t('Fields'),\n '#theme' => 'ting_ext_search_fields_table',\n '#header' => array(\n t('Title'),\n '',\n t('Placeholder'),\n t('Well index'),\n t('Type'),\n '', // Keep it for value\n ),\n );\n\n $fields = variable_get('ting_ext_search_fields_settings', array());\n $form_state['fields'] = $fields;\n if (!isset($form_state['fields_count'])) {\n $form_state['fields_count'] = empty($fields) ? 1 : count($fields);\n }\n $fields_count = $form_state['fields_count'];\n $field_types = array(\n 'textfield' => t('Textfield'),\n 'select' => t('Dropdown'),\n 'checkboxes' => t('Checkboxes'),\n 'radios' => t('Radios'),\n );\n\n $value_types = array(\n 'ting_well_types' => t('Well types'),\n 'ting_well_sources' => t('Well sources'),\n 'pickup_branches' => t('Pickup branches'),\n 'custom_list' => t('Custom list'),\n );\n\n for ($i = 0; $i < $fields_count; $i++) {\n $form['fields'][$i]['title'] = array(\n '#type' => 'textfield',\n '#default_value' => isset($fields[$i]['title']) ? $fields[$i]['title'] : '',\n );\n\n $form['fields'][$i]['machine_name'] = array(\n '#type' => 'machine_name',\n '#default_value' => isset($fields[$i]['machine_name']) ? $fields[$i]['machine_name'] : '',\n '#machine_name' => array(\n 'source' => array('fields', $i, 'title'),\n 'exists' => '_ting_extended_search_field_exists',\n ),\n '#disabled' => isset($fields[$i]['machine_name']),\n );\n\n $form['fields'][$i]['placeholder'] = array(\n '#type' => 'textfield',\n '#default_value' => isset($fields[$i]['placeholder']) ? $fields[$i]['placeholder'] : '',\n );\n\n $form['fields'][$i]['index'] = array(\n '#type' => 'textfield',\n '#default_value' => isset($fields[$i]['index']) ? $fields[$i]['index'] : '',\n );\n\n $form['fields'][$i]['type'] = array(\n '#type' => 'select',\n '#options' => $field_types,\n '#default_value' => isset($fields[$i]['type']) ? $fields[$i]['type'] : 'textfield',\n );\n $form['fields'][$i]['values']['type'] = array(\n '#type' => 'select',\n '#options' => $value_types,\n '#default_value' => isset($fields[$i]['values']['type']) ? $fields[$i]['values']['type'] : 'ting_well_types',\n '#states' => array(\n 'invisible' => array(\n ':input[name=\"fields[' . $i . '][type]\"]' => array(\n 'value' => 'textfield'\n ),\n ),\n ),\n );\n $value = '';\n if (isset($fields[$i]['values']['list']) && !empty($fields[$i]['values']['list']) && is_array($fields[$i]['values']['list'])) {\n $list = $fields[$i]['values']['list'];\n array_walk($list, function(&$i, $k) {\n $i = \"{$k}|{$i}\";\n });\n $value = implode(\"\\r\\n\", $list);\n }\n $form['fields'][$i]['values']['list'] = array(\n '#type' => 'textarea',\n '#rows' => 8,\n '#cols' => 5,\n '#default_value' => $value,\n '#states' => array(\n 'visible' => array(\n ':input[name=\"fields[' . $i . '][values][type]\"]' => array('value' => 'custom_list'),\n ),\n ),\n );\n }\n\n $form['fields']['more'] = array(\n '#type' => 'submit',\n '#value' => t('Add another one'),\n '#submit' => array('ting_ext_search_more_submit'),\n '#limit_validation_errors' => array(),\n '#ajax' => array(\n 'callback' => 'ting_ext_search_callback',\n 'wrapper' => 'ting-ext-search-wrapper',\n ),\n );\n\n $form['submit'] = array(\n '#type' => 'submit',\n '#value' => t('Save'),\n );\n return $form;\n}"
]
| [
"0.61327195",
"0.60635215",
"0.60341996",
"0.6000065",
"0.5919999",
"0.57671237",
"0.5756835",
"0.5745274",
"0.57365584",
"0.5730201",
"0.5708492",
"0.56766075",
"0.5672952",
"0.56406915",
"0.5622354",
"0.56167394",
"0.5612493",
"0.56088036",
"0.5602433",
"0.5575455",
"0.5524137",
"0.55226815",
"0.55157393",
"0.55154335",
"0.5497825",
"0.5463938",
"0.5437638",
"0.54294485",
"0.54194546",
"0.5415515"
]
| 0.65952516 | 0 |
Get sum right node binarytree | function getSumRight($id){
$result = 0;
$right = $this->getRight($id);
if($right){
$result +=1;
$result += $this->getSumMember($right);
}
return $result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSumNumberMember($node){\n\t\t$result = 0;\n\t\treturn $result;\t\n\t}",
"public function count_node()\n\t\t{\n\t\t\t$query = \"SELECT\n\t\t\t\t\t\tCOUNT(1) AS 'total' \n\t\t\t\t\tFROM \n\t\t\t\t\t\t`\".$this->tree_caption.\"`\n\t\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t\tAND `language` = '\".$this->language.\"'\n\t\t\t\t\t\tAND `application_release` = '\".$this->application_release.\"'\";\n\t\t\t\n\t\t\t$result = $this->link_mt->query($query);\n\t\t\t$row = $result->fetch_array(MYSQLI_ASSOC);\n\t\t\t\n\t\t\t$this->total_node = $row['total'];\n\t\t\t\n\t\t\treturn $this->total_node;\n\t\t}",
"public function totalNode(){\r\n return $this->count;\r\n }",
"public function nodeTotal(): int\n {\n return $this->nodeTotal;\n }",
"public function testAddNode() {\n\n\t\t$objBuilder = new LeftRightTreeTraversal\\TreeBuilder();\n\n\t\t$this->boolean($objBuilder->addNode(new LeftRightTreeTraversal\\Node(0)))->isTrue();\n\t\t$arrayResult = $objBuilder->compute()->export();\n\n\t\t$this\n\t\t\t->array($arrayResult)\n\t\t\t\t->hasKey(0)\n\t\t\t\t->size->isEqualTo(1)\n\t\t\t->array($arrayResult[0])\n\t\t\t\t->hasKey('id')\n\t\t\t\t->hasKey('left')\n\t\t\t\t->hasKey('right')\n\t\t;\n\n\t\t/*\n\t\t * Same test with a custom config\n\t\t */\n\n\t\t$hashConfig = array(\n\t\t\t\t'key_left' \t\t=>\t'custom_left',\n\t\t\t\t'key_right'\t\t=>\t'custom_right',\n\t\t\t\t'key_id'\t\t=>\t'custom_id',\n\t\t\t\t'key_parent'\t=>\t'custom_parent'\n\t\t);\n\t\t$objBuilder = new LeftRightTreeTraversal\\TreeBuilder($hashConfig);\n\t\t$this->boolean($objBuilder->addNode(new LeftRightTreeTraversal\\Node(0)))->isTrue();\n\n\t\t$arrayResult = $objBuilder->compute()->export();\n\n\t\t$this\n\t\t\t->object($objBuilder)\n\t\t\t->isNotNull($objBuilder)\n\t\t\t->isInstanceOf('LeftRightTreeTraversal\\TreeBuilder')\n\n\t\t\t->array($arrayResult)\n\t\t\t\t->hasKey(0)\n\t\t\t\t->size->isEqualTo(1)\n\t\t\t->array($arrayResult[0])\n\t\t\t\t->hasKey('custom_id')\n\t\t\t\t->hasKey('custom_left')\n\t\t\t\t->hasKey('custom_right')\n\t\t\t->integer($arrayResult[0]['custom_id'])\n\t\t\t\t->isEqualTo(0)\n\t\t\t->integer($arrayResult[0]['custom_left'])\n\t\t\t\t->isEqualTo(0)\n\t\t\t->integer($arrayResult[0]['custom_right'])\n\t\t\t\t->isEqualTo(1)\n\t\t;\n\n\t}",
"function getSumMember($id){\t\t\n\t\t\n\t\t$result = 0;\n\t\t$left = $this->getLeft($id);\n\t\t$right = $this->getRight($id);\n\t\tif($left){\n\t\t\t$checkActive = $this->checkActiveUser($left);\n\t\t\tif($checkActive == 1){\n\t\t\t\t$result +=1;\n\t\t\t}\n\t\t\t$result += $this->getSumMember($left);\n\t\t}\n\t\tif($right){\n\t\t\t$checkActive = $this->checkActiveUser($right);\n\t\t\tif($checkActive == 1){\n\t\t\t\t$result +=1;\n\t\t\t}\n\t\t\t$result += $this->getSumMember($right);\n\t\t}\n\t\t\n\t\t//print_r($result);\n\t\treturn $result;\n\t}",
"public function getNodeBin()\n {\n return $this->nodeBin;\n }",
"public function getTreeCount(){\n\t\t\t$sql = mysql_query(\"\n SELECT\n count(*) AS `count`\n FROM\n `structure`\n \");\n\n $result = mysql_fetch_row($sql);\n\t\t\treturn $result[0];\n\t\t}",
"public function testGetNodeWithRightValue() {\n\n\t\t$objBuilder = new LeftRightTreeTraversal\\TreeBuilder();\n\n\t\t$objNode1 = new LeftRightTreeTraversal\\Node(1);\n\t\t$objBuilder->addNode($objNode1);\n\t\t$objNode2 = new LeftRightTreeTraversal\\Node(2);\n\t\t$objBuilder->addNode($objNode2);\n\t\t$objNode3 = new LeftRightTreeTraversal\\Node(3);\n\t\t$objBuilder->addNode($objNode3);\n\t\t$objNode4 = new LeftRightTreeTraversal\\Node(4);\n\t\t$objBuilder->addNode($objNode4);\n\n\t\t$objNode2->setParentNode($objNode1);\n\t\t$objNode3->setParentNode($objNode1);\n\t\t$objNode4->setParentNode($objNode2);\n\n\t\t// non-existent node right-value, without graph computation\n\t\t$this->variable($objBuilder->getNodeWithRightValue(42))->isNull();\n\t\t// existent node right-value, without graph computation\n\t\t$this->variable($objBuilder->getNodeWithRightValue(5))->isNull();\n\n\t\t$objBuilder->compute();\n\n\t\t// non-existent node right-value, without graph computation\n\t\t$this->variable($objBuilder->getNodeWithRightValue(42))->isNull();\n\t\t// existent node right-value, with graph computation\n\t\t$this->object($objBuilder->getNodeWithRightValue(6))->isIdenticalTo($objNode3);\n\t\t// existent node right-value, with graph computation\n\t\t$this->variable($objBuilder->getNodeWithRightValue(5))->isNull();\n\t}",
"public function sum();",
"public function sum() {\n\t\treturn array_sum($this->_value);\n\t}",
"public function sum() {\n\t\t$sum = 0;\n\t\tforeach ($this as $value) {\n\t\t\t$sum += $value;\n\t\t}\n\t\treturn $sum;\n\t}",
"function get_RPN($tree = array()) {\n\t\t$RPN = \"\";\n\t\tif (empty($tree)) { // first call\n\t\t\t$tree = $this->_parse_tree;\n\t\t}\n\t\tif (is_array($tree[\"left\"])) {\n\t\t\t$RPN .= $this->get_RPN($tree[\"left\"]);\n\t\t}\n\t\telse if($tree[\"left\"] != \"\") { // final node\n\t\t\t$RPN .= $this->_convert($tree[\"left\"]);\n\t\t}\n\t\tif (is_array($tree[\"right\"])) {\n\t\t\t$RPN .= $this->get_RPN($tree[\"right\"]);\n\t\t}\n\t\telse if($tree[\"right\"] != \"\") { // final node\n\t\t\t$RPN .= $this->_convert($tree[\"right\"]);\n\t\t}\n\t\t$RPN .= $this->_convert($tree[\"value\"]);\n\t\treturn $RPN;\n\t}",
"function sumate2(array $n,int $r) {\r\n if ($r < 0) {\r\n return 0;\r\n } else {\r\n print($n[$r]);\r\n print \"<br> \";\r\n return ($n[$r]) + sumate2($n, $r-1);\r\n }\r\n}",
"public function right(): ?Node\n {\n return $this->right;\n }",
"public function getSum(): float;",
"function getValNode(){\n\t\t$clase=$this->nmclass;\n\t\t$node=$this->anode;\n\t\t$valor=$this->nodos[$clase][$node];\n\n\t\tif($valor!=''){\n\t\t\treturn $valor;\n\t\t}\n\t\telse{\n\t\t\treturn -1;\n\t\t}\n\t}",
"function solution($T) {\n if (!is_object($T) ) {\n return -1;\n }\n //elseif ((is_null($T->l) && is_null($T->r)) {\n // return 0; //no children\n //}\n \n $heightLeft = -1;\n $heightRight = -1;\n \n if($T->l != null) {\n $heightLeft = solution($T->l);\n }\n if($T->r != null) {\n $heightRight = solution($T->r);\n }\n \n if($heightLeft > $heightRight){\n return $heightLeft+1;\n }\n else{\n return $heightRight+1;\n }\n \n return -1; //empty\n}",
"function get_root()\n {\t\n\t\t$query = ee()->db->get_where( $this->tree_table, array('lft' => 1), 1 );\n\t\treturn ( $query->num_rows() ) ? $query->row_array() : FALSE;\n }",
"public function rebuild_tree($left = 1, $target = NULL)\n {\n // check if using target or self as root and load if not loaded\n if (is_null($target) AND ! $this->loaded)\n {\n return FALSE;\n }\n elseif (is_null($target))\n {\n $target = $this;\n }\n\n if ( ! $target->loaded)\n {\n $target = $this->factory_item($target);\n }\n\n // Use the current node left value for entire tree\n if (is_null($left))\n {\n $left = $target->left;\n }\n\n $target->lock();\n $right = $left + 1;\n $children = $target->children();\n\n foreach ($children as $child)\n {\n $right = $child->rebuild_tree($right);\n }\n\n $target->left = $left;\n $target->right = $right;\n $target->save();\n $target->unlock();\n\n return $right + 1;\n }",
"public function updateValue(){\n\n\t\t$this->value += (int)max($this->left_parent_value,$this->right_parent_value);\n\t}",
"public function getNumberOfDescendants(BaseObject $node)\n {\n $right = $node->getRightValue();\n $left = $node->getLeftValue();\n $num = ($right - $left - 1) / 2;\n\n return $num;\n }",
"public function getSum()\n {\n return array_sum($this->values);\n }",
"protected function get_root_value()\n {\n }",
"public function getRightValue(BaseObject $node)\n {\n $getter = self::forgeMethodName($node, 'get', 'right');\n return $node->$getter();\n }",
"function getValNode_dif($node){\n\t\t$clase=$this->nmclass;\n\t\t$valor=$this->nodos[$clase][$node];\n\n\t\tif($valor!=''){\n\t\t\treturn $valor;\n\t\t}\n\t\telse{\n\t\t\treturn -1;\n\t\t}\n\t}",
"public function sum()\n {\n return array_sum($this->data);\n }",
"public static function add($left, $right) {\n return self::toInt(bcadd($left, $right));\n }",
"function getActualNode(){\n\t\treturn $this->anode;\n\t}",
"function FullTree();"
]
| [
"0.63745993",
"0.61165345",
"0.6069575",
"0.6044676",
"0.54980236",
"0.5458691",
"0.54213977",
"0.538563",
"0.5377958",
"0.53754956",
"0.5289404",
"0.5255348",
"0.5246257",
"0.52340966",
"0.52315646",
"0.5229283",
"0.5139439",
"0.51266164",
"0.5096015",
"0.5094353",
"0.5089921",
"0.50843626",
"0.5063027",
"0.50464153",
"0.5034307",
"0.50287426",
"0.5027938",
"0.50107616",
"0.49688008",
"0.49236163"
]
| 0.64133006 | 0 |
Store a newly created Earning in storage. | public function store(CreateEarningRequest $request)
{
$input = $request->all();
$customFields = $this->customFieldRepository->findByField('custom_field_model', $this->earningRepository->model());
try {
$earning = $this->earningRepository->create($input);
$earning->customFieldsValues()->createMany(getCustomFieldsValues($customFields,$request));
} catch (ValidatorException $e) {
Flash::error($e->getMessage());
}
Flash::success(__('lang.saved_successfully',['operator' => __('lang.earning')]));
return redirect(route('earnings.index'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function store(Request $request)\n {\n $request->validate([\n 'employee_id' => 'required',\n 'salary' => 'required'\n ]);\n $salary = Salary::create([\n 'employee_id' => $request->employee_id,\n 'balance' => $request->salary,\n 'quantity' => $request->quantity,\n 'rate' => $request->rate,\n 'note' => $request->note,\n 'qty_desc' => $request->quantity,\n 'designation' => $request->designation,\n 'working_day' => $request->working_day,\n 'month' => $request->month,\n 'paid_salary' => $request->paid_salary\n\n ]);\n $eh = ExpensesHead::where('title', 'Salary Purpose')->first();\n\n Expense::create([\n 'title' => $salary->employee->name,\n 'amount' => $salary->balance,\n 'expenses_head_id' => $eh->id,\n 'date'=> Carbon::now(),\n 'note' => $salary->note,\n ]);\n\n return redirect()->route('expenses.index')->with('success', 'Salary Paid Successfuly !!');\n\n }",
"public function store()\n\t{\n\t\t$data = Input::all();\n\t\t\n\t\t$validation = Validator::make($data, [\n\t\t\t'description'\t=>\t'required|min:3',\n\t\t\t'memo'\t\t\t=>\t'',\n\t\t\t'amount'\t\t=>\t'required|numeric',\n\t\t\t'quantity'\t\t=>\t'required|numeric'\n\t\t]);\n\t\t\n\t\t$errorMessages = new MessageBag;\n\t\t\n\t\tif($validation->fails()){\n\t\t\t$errorMessages->merge($validation->errors()->toArray());\n\t\t}\n\t\t\n\t\t//$cash = new Expense;\n\t\t\n\t\t$cashInHand = Expense::cashInHand();\n\t\t\n\t\t$ex = ($data['amount'] * $data['quantity']);\n\t\t\n\t\tif($ex > $cashInHand){\n\t\t\t$errorMessages->add('amount', 'You cannot make an expense exceeding cash in hand');\n\t\t}\n\t\t\n\t\t//return dd($errorMessages);\n\t\t//die;\n\t\t\n\t\tif(count($errorMessages) > 0){\n\t\t\treturn Redirect::route('getAddExpense')\n\t\t\t\t\t->withInput()\n\t\t\t\t\t->withErrors($errorMessages);\n\t\t} else {\n\t\t\t$expense = Expense::create([\n\t\t\t\t'description'\t=> \t$data['description'],\n\t\t\t\t'amount'\t\t=>\t$data['amount'],\n\t\t\t\t'memo'\t\t\t=>\t$data['memo'],\n\t\t\t\t'quantity'\t\t=>\t$data['quantity']\n\t\t\t]);\n\t\t\t\n\t\t\tif($expense){\n\t\t\t\treturn Redirect::route('getExpenses')->with('success','Expense added successfully');\n\t\t\t} else {\n\t\t\t\treturn Redirect::route('getExpenses')->with('fail','An error occured while saving the expense');\n\t\t\t}\n\t\t}\n\t}",
"public function store(CreateMarketsPayoutRequest $request)\n {\n $input = $request->all();\n $earning = $this->earningRepository->findByField('market_id',$input['market_id'])->first();\n if($input['amount'] > $earning->market_earning){\n Flash::error('The payout amount must be less than market earning');\n return redirect(route('marketsPayouts.create'))->withInput($input);\n }\n $input['paid_date'] = Carbon::now();\n $customFields = $this->customFieldRepository->findByField('custom_field_model', $this->marketsPayoutRepository->model());\n try {\n $this->earningRepository->update(['market_earning'=>$earning->market_earning - $input['amount']], $earning->id);\n $marketsPayout = $this->marketsPayoutRepository->create($input);\n $marketsPayout->customFieldsValues()->createMany(getCustomFieldsValues($customFields, $request));\n\n } catch (ValidatorException $e) {\n Flash::error($e->getMessage());\n }\n\n Flash::success(__('lang.saved_successfully', ['operator' => __('lang.markets_payout')]));\n\n return redirect(route('marketsPayouts.index'));\n }",
"public function store()\n\t{\n\t\t$entry = new Offering;\n\t\t$entry->deposit_id = Input::get('deposit_id');\t\t\n\t\t$entry->name = Input::get('name');\n\t\t$entry->created_at = Input::get('created_at');\n\t\t$entry->memo = Input::get('memo');\n\t\t$entry->save();\n\t \n\t\treturn Redirect::to('accounting/deposits/'.$entry->deposit->id.'#'.$entry->name)->with('message', 'Offering Successfully created!');\n\t}",
"public function store()\n\t{ \n $nextId = OrdenEsM::nextId();\n $input = Input::all();\n $ordenD = new OrdenEsD();\n $ordenD->upc = $input['upc'];\n $ordenD->epc = $input['epc'];\n $ordenD->quantity = $input['quantity'];\n $ordenD->created_at = $input['created_at'];\n $ordenD->updated_at = $input['updated_at'];\n $ordenD->orden_es_m_id = $nextId;\n $ordenD->save();\n\t}",
"public function create()\n {\n\n $markets = $this->marketRepository->all();\n foreach ($markets as $market){\n $marketId = $market->id;\n $this->earningRepository->firstOrCreate(['market_id'=>$marketId])->first();\n }\n return redirect(route('earnings.index'));\n }",
"public function store(Request $request)\n {\n \n $requestData = $request->all();\n \n Expense::create($requestData);\n\n return redirect('admin/expense')->with('flash_message', 'Expense added!');\n }",
"public function store(Request $request) {\n\t\t\n\t\t$salary = request()->validate([\n\t\t\t'employee_type' => 'required',\n\t\t\t'basic_salary' => 'required|numeric',\n\t\t]);\n\n\t\t$result = Payroll::create($salary + ['created_by' => auth()->user()->id, 'user_id' => $request->user_id]);\n\t\t$inserted_id = $result->id;\n\n\t\tif (!empty($inserted_id)) {\n\t\t\treturn redirect('/hrm/payroll/salary-list')->with('message', 'Add successfully.');\n\t\t}\n\t\treturn redirect('/hrm/payroll/salary-list')->with('exception', 'Operation failed !');\n\t}",
"public function store( Request $request )\n {\n $request->validate( [\n 'details' => 'required',\n 'amount' => 'required|numeric',\n ] );\n\n $expense = new Expense();\n $expense->details = $request->details;\n $expense->amount = $request->amount;\n $expense->date = date( 'Y-m-d' );\n $expense->save();\n }",
"public function store(Request $request)\n {\n $this->validate($request, [\n 'account_' => 'integer|required',\n 'category_' => 'integer|required',\n 'amount_' => 'numeric|required',\n 'date_' => 'required|date_format:d/m/Y'\n ]);\n \n $account_id = $request->input('account_');\n $amount = str_replace(',', '.', $request->input('amount_'));\n\n $account = Account::find($account_id);\n\n if($account->balance >= $amount)\n {\n //Create Expense\n $expense = new Expense;\n $expense->user_id = auth()->user()->id;\n $expense->account_id = $account_id;\n $expense->category_id = $request->input('category_');\n $expense->amount = $amount;\n $expense->date = Carbon::createFromFormat('d/m/Y', $request->input('date_'));\n $expense->save();\n\n //Update the balance\n $new_balance = $account->balance - abs($amount);\n $account->balance = $new_balance;\n $account->save();\n\n return redirect('/operations')->with('success','<strong>'.$account->name.'</strong> balance is now: <strong>'.$account->balance.' '.$account->currency()->first()->sign.'</strong>');\n }\n else\n {\n return redirect('/operations')->with('error','You don’t have enough funds in this account. <strong>'.$account->name.'</strong> balance is: <strong>'.$account->balance.' '.$account->currency()->first()->sign.'</strong>')->withInput();\n }\n \n }",
"public function store(StoreIncome $request)\n {\n $request->saveIncome();\n\n return back()->with('flash', 'Income has been added!');\n }",
"public function store(Request $request)\n {\n $transaction = new IncomeExpense;\n $transaction->title = $request->title;\n $transaction->description = $request->description;\n $transaction->amount = $request->amount;\n $transaction->type = $request->type;\n\n $transaction->save();\n \n // // $transactions = IncomeExpense::all();\n // $transactions = IncomeExpense::all();\n // return view('pages.index', compact('transactions'));\n\n return redirect('/');\n\n }",
"public function store(Request $request)\n {\n $this->validate($request, [\n 'date' => 'required',\n 'name' => 'required',\n 'total' => 'required'\n ]);\n\n $expence = new Expence();\n $expence->date = $request->date;\n $expence->name = $request->name;\n $expence->details = $request->details;\n $expence->total = $request->total;\n $expence->save();\n return redirect()->route('expences.index')->with('success', 'Expence added successfully');\n }",
"public function store( Request $request ) {\n $property_id = $request->input( 'property_id' );\n $expense_title = ucwords( $request->input( 'expense_title' ) );\n $expense_amount = $request->input( 'expense_amount' );\n\n $expense = new Expenses();\n $expense->exp_property_id = $property_id;\n $expense->expense_title = $expense_title;\n $expense->expense_amount = $expense_amount;\n\n $expense->save();\n\n Toastr::success( 'Expense added successfully' );\n return back();\n }",
"public function store(Request $request)\n {\n $input = \\Request::all();\n $expense = new Expense($input);\n \\Auth::user()->expenses()->save($expense);\n \n return redirect('home');\n }",
"public function store(array $request): void{\n $this->money->store($request);\n Redirect::run('/salario');\n }",
"public function store(Request $request)\n {\n $seller_id = $request->get('seller_id');\n\n $this->validate($request, [\n 'seller_id' => 'required',\n 'tonase' => 'required|integer',\n 'price' => 'required',\n 'payment' => 'required',\n ]);\n $item = new Item;\n $item->seller_id = $request->get('seller_id');\n $item->tonase = $request->get('tonase');\n $item->price = $request->get('price');\n $item->payment = $request->get('payment');\n $item->status = 'process';\n $item->save();\n\n $sellers = Seller::findOrFail($seller_id);\n\n $JournalLedger = new JournalLedger;\n $JournalLedger->user_id = Auth::id();\n $JournalLedger->description = \"Pembelian Salak Ke \" . $sellers->name;\n $JournalLedger->status = \"kredit\";\n $JournalLedger->nominal = $request->get('price');\n $JournalLedger->item_id = $item->id;\n $JournalLedger->date = Carbon::now()->timezone('Asia/Jakarta')->format('Y-m-d');\n $JournalLedger->save();\n\n return redirect()->route('barang.index', $seller_id)->with('status', 'Barang berhasil ditambah');\n }",
"public function store(CreateIncomeRequest $request)\n {\n $input = $request->all();\n $input['user_id'] = Auth::id();\n /** @var Income $income */\n $income = Income::create($input);\n\n Flash::success('Income saved successfully.');\n\n return redirect(route('incomes.index'));\n }",
"public function store(Request $request)\n {\n\t\t$request->validate([\n 'expense_name' => 'required',\n\t\t\t'expense_date' => 'required',\n\t\t\t'expense_amount' => 'required',\n ]);\n \n $expenses = new Expenses;\n\t\t$expenses->name = strip_tags($request->expense_name);\n $expenses->expense_category_id = $request->expense_category;\n $expenses->expense_amount = $request->expense_amount;\n $expenses->expense_date = date(\"Y-m-d\", strtotime($request->expense_date));\n $expenses->expense_notes = strip_tags($request->notes);\n $expenses->customer_id = $request->customer;\n $expenses->vendor_id = $request->vendor_id;\n \n $expenses->user_id = auth()->user()->id;\n\t\t$expenses->company_id = auth()->user()->company->id;\n $expenses->save();\n \n return redirect()->route('expenses.index')->withStatus(__('Expense successfully created!'));\n }",
"public function store() {\n \n }",
"public function store()\n {\n request()->validate([\n 'brewery_id'=>['required'],\n 'packaging_id'=>['required']\n ]);\n\n $beer = Beer::create(request([\n 'code', 'name', 'description',\n 'abv', 'ibu', 'plato', 'stock',\n 'brewery_id', 'packaging_id',\n 'style_id', 'color_id', 'taste_id'\n ]) + [\n 'isactive' => request()->has('isactive')\n ]);\n\n $beer->price()->create(request([\n 'horeca', 'horeca_unit', 'discount',\n 'purchase', 'purchase_unit',\n 'distribution', 'distribution_unit', 'margin'\n ]) + [\n 'fixed_margin' => request()->has('fixed_margin')\n ]);\n\n return redirect(request()->getRequestUri());\n\n }",
"public function store(Request $request)\n {\n $sale = new Sale;\n $sale->user_id = $request->user_id;\n $sale->amountDue = session('salePrice');\n $sale->save();\n\n $soldProds = [];\n\n session( [ 'sale_id' => $sale->id ] );\n\n //session(['soldProds' => []]);\n //session(['salePrice' => 0]);\n\n Session::flash('message', env(\"SAVE_SUCCESS_MSG\",\"Saved succesfully!\"));\n\n\n return redirect(route('payments.create'));\n\n }",
"public function store(Request $request)\n {\n $expenseData = ['name' => $request->name,\n 'category_id' => $request->category_id,\n 'due_date' => $request->due_date,\n 'repeat' => $request->repeat,\n 'note' => $request->note,\n 'amount' => $request->amount, ];\n\n $expense = new Expense($expenseData);\n $expense->createdBy()->associate(Auth::user());\n $expense->updatedBy()->associate(Auth::user());\n $expense->save();\n\n if ($request->due_date <= Carbon::today()->format('Y-m-d')) {\n $expense->paid = \\constPaymentStatus::Paid;\n } else {\n $expense->paid = \\constPaymentStatus::Unpaid;\n }\n\n $expense->createdBy()->associate(Auth::user());\n\n $expense->save();\n flash()->success('Expense was successfully added');\n\n return redirect('expenses/all');\n }",
"public function store(Request $request)\n {\n $payroll = Payroll::LatestOpen()->first();\n\n $payrollEntry = new PayrollEntry($request->toArray());\n $payrollEntry->date_applied = Carbon::now();\n $payrollEntry->payroll_pay_period = $payroll->pay_period;\n $payrollEntry->payroll_generated = false;\n\n $payrollEntry->save();\n\n return;\n }",
"public function store()\n\t{\n\t\n\t\t$amount = Input::get('amount');\n\t\t$amount = $amount * 100;\n\t\t$currency = Input::get('currency');\n\t\t$name = Input::get('name');\n\t\t$interval = Input::get('interval');\n\t\t\t\t\t\n\t\t$offer = Laramill::newOffer( $amount, $currency, $interval, $name , null);\n\n\t\tif($offer)\n\t\t{\t\t\t\n\t\t\treturn Redirect::to('offers');\n\t\t}\n\n\t\treturn Redirect::back()->with( array('status' => 'danger' , 'message' => 'Problem with creation') ); \n\t}",
"public function store(Request $request)\n {\n $this->validate($request, [\n 'date' => 'required',\n 'customer_name' => 'required|max:100',\n 'item_id' => 'required',\n 'unit_price' => 'required|numeric',\n 'quantity' => 'required|integer|max:1000',\n 'total_amount' => 'required|numeric',\n 'discount' => 'required|numeric',\n 'final_amount' => 'required|numeric',\n ]);\n DB::beginTransaction();\n try {\n $input = $request->all();\n $input['date'] = get_english_date($request->date);\n Sale::create($input);\n $item = Item::where('id', $request->item_id)->first();\n $itemstock= $item->current_stock - $request->quantity;\n\n if ($itemstock >= 0) {\n $item->current_stock=$itemstock;\n $item->save();\n } else {\n\n Session::flash('type', \"danger\");\n Session::flash('message',\" Current Stock for this item is only \".$item->current_stock);\n\n return redirect()->back();\n }\n } catch (\\Exception $e) {\n DB::rollback();\n return back()->withError($e->getMessage())->withInput();\n }\n DB::commit();\n Session::flash('type', \"success\");\n Session::flash('message', \"New Sale has been Added Successfully\");\n return redirect('sale');\n }",
"public function store(Request $request)\n {\n $expense = new Expense();\n $expense->expense_type = $request->expense_type;\n $expense->amount = $request->amount;\n $expense->date = $request->date;\n $expense->employee_id = $request->employee_id;\n $expense->branch_id = $request->branch_id;\n\n $expense->save();\n return back();\n }",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}",
"public function store()\r\n\t{\r\n\t\t//\r\n\t}"
]
| [
"0.6399853",
"0.6262061",
"0.6253411",
"0.6226843",
"0.61633605",
"0.6159933",
"0.611923",
"0.61079866",
"0.60934085",
"0.60906106",
"0.609017",
"0.60856235",
"0.6065393",
"0.6031904",
"0.6009967",
"0.60065895",
"0.59836286",
"0.59788895",
"0.5972301",
"0.59716976",
"0.5967598",
"0.5965405",
"0.5947374",
"0.59334266",
"0.59233916",
"0.5922289",
"0.58753794",
"0.5875369",
"0.5875369",
"0.5875369"
]
| 0.74198216 | 0 |
Display the specified Earning. | public function show($id)
{
$earning = $this->earningRepository->findWithoutFail($id);
if (empty($earning)) {
Flash::error('Earning not found');
return redirect(route('earnings.index'));
}
return view('earnings.show')->with('earning', $earning);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function show( Expenses $expenses ) {\n //\n }",
"public function index(EarningDataTable $earningDataTable)\n {\n return $earningDataTable->render('earnings.index');\n }",
"public function show(Cryptocurrency $cryptocurrency)\n {\n \n }",
"public function show(Income $income)\n {\n //\n }",
"public function show(OtherIncome $otherIncome)\n {\n //\n }",
"public function show(IntentionToPay $intentionToPay)\n {\n //\n }",
"public function show(Salonrate $salonrate)\n {\n //\n }",
"public function show(){\n return view('finance_report.finance_report_profit');\n }",
"public function show(Expense $expense)\n {\n //\n }",
"public function show(Expense $expense)\n {\n //\n }",
"public function show(FlowExpenses $flowExpenses)\n {\n //\n }",
"public function show(finance $finance)\n {\n //\n }",
"public function profit() : void {\n\t\techo ($this->price - $this->cost);\n\t}",
"public function show(OfferedCourse $offeredCourse)\n {\n //\n }",
"public function show(Depense $depense)\n {\n //\n }",
"public function show(Salary $salary)\n {\n //\n }",
"public function edit($id)\n {\n $earning = $this->earningRepository->findWithoutFail($id);\n $market = $this->marketRepository->pluck('name','id');\n \n\n if (empty($earning)) {\n Flash::error(__('lang.not_found',['operator' => __('lang.earning')]));\n\n return redirect(route('earnings.index'));\n }\n $customFieldsValues = $earning->customFieldsValues()->with('customField')->get();\n $customFields = $this->customFieldRepository->findByField('custom_field_model', $this->earningRepository->model());\n $hasCustomField = in_array($this->earningRepository->model(),setting('custom_field_models',[]));\n if($hasCustomField) {\n $html = generateCustomField($customFields, $customFieldsValues);\n }\n\n return view('earnings.edit')->with('earning', $earning)->with(\"customFields\", isset($html) ? $html : false)->with(\"market\",$market);\n }",
"public function show(Sellthrough $sellthrough)\n {\n //\n }",
"public function show(Salary $salary)\n {\n\n }",
"function outputPrice($amount)\n {\n $hmtl = '<h1> The Amount for 5 item is = '.$amount.'</h1>';\n echo $hmtl;\n }",
"public function show(ExpenceHead $expenceHead)\n {\n\n }",
"public function show(FinancialYear $financialYear)\n {\n //\n }",
"public function show(ActeurEmploye $acteurEmploye)\n {\n //\n }",
"public function show(Currency $currency)\n {\n //\n }",
"public function show(Currency $currency)\n {\n //\n }",
"public function show(Currency $currency)\n {\n //\n }",
"public function show(ExpenceManagement $expenceManagement) {\n\t\t//\n\t}",
"public function show()\n {\n $expense = Expense::findOrFail($id);\n\n return view('expenses.show', compact('expense'));\n }",
"public function show(sale $sale)\n {\n //\n }",
"public function show(ColesterolTotal $colesterolTotal)\n {\n //\n }"
]
| [
"0.6121619",
"0.60635424",
"0.5949021",
"0.58430135",
"0.5824421",
"0.5789296",
"0.57729185",
"0.57630336",
"0.57344425",
"0.57344425",
"0.5467687",
"0.5462728",
"0.5363564",
"0.53547037",
"0.5348467",
"0.5345593",
"0.5342924",
"0.531809",
"0.5287625",
"0.5248695",
"0.52475023",
"0.524692",
"0.5239794",
"0.52268165",
"0.52268165",
"0.52268165",
"0.5224469",
"0.51844686",
"0.51803803",
"0.5180156"
]
| 0.62212527 | 0 |
Show the form for editing the specified Earning. | public function edit($id)
{
$earning = $this->earningRepository->findWithoutFail($id);
$market = $this->marketRepository->pluck('name','id');
if (empty($earning)) {
Flash::error(__('lang.not_found',['operator' => __('lang.earning')]));
return redirect(route('earnings.index'));
}
$customFieldsValues = $earning->customFieldsValues()->with('customField')->get();
$customFields = $this->customFieldRepository->findByField('custom_field_model', $this->earningRepository->model());
$hasCustomField = in_array($this->earningRepository->model(),setting('custom_field_models',[]));
if($hasCustomField) {
$html = generateCustomField($customFields, $customFieldsValues);
}
return view('earnings.edit')->with('earning', $earning)->with("customFields", isset($html) ? $html : false)->with("market",$market);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function edit()\n {\n return view('panel.order-management.payment.form-edit');\n }",
"public function edit( Expenses $expenses ) {\n //\n }",
"public function edit()\n {\n return view('escrow::edit');\n }",
"public function edit($id){\n\t\t$transaction = Expense::find($id); // getting the speific user to edit\n\t\treturn view('driver.expense.edit')->with([\n 'transaction' => $transaction\n\t\t]);\n }",
"public function edit(Expense $expense)\n {\n //\n }",
"public function edit(Expense $expense)\n {\n //\n }",
"public function edit($id)\n {\n $transaction = IncomeExpense::find($id);\n return view('pages.edit',compact('transaction'));\n }",
"public function edit()\n {\n return view(\"web_admin.books.edit\");\n }",
"public function edit(Income $income)\n {\n //\n }",
"public function edit()\n {\n return view('commonmodule::edit');\n }",
"public function edit($id)\n\t{\n\t\t\n\t\treturn View::make('admin.expense.edit')->with('data', Expense::find($id))->with('cashInHand', Expense::cashInHand());\n\t}",
"public function edit($id){\n $wallet = Wallet::find($id);\n \n //load form view\n return view('admin.wallets.edit', ['wallet' => $wallet]);\n }",
"public function edit()\n {\n return view('catalog::edit');\n }",
"public function edit()\n {\n return view('catalog::edit');\n }",
"public function edit()\n {\n return view('billing::edit');\n }",
"public function edit()\n {\n return view('billing::edit');\n }",
"public function edit($id)\n {\n //\n $this->shareMenu();\n $BasicSalary = EmployeeBasicSalary::find($id);\n return view('backend.HRIS.PIM.Employee.Salary.edit',compact('BasicSalary'));\n\n }",
"public function edit()\n\t{\n\t\treturn view('account.edit');\n\t}",
"public function edit() {\n $this->authorize(PermissionEnum::getInstance(PermissionEnum::EventBookingImmediate)->key, User::class);\n $events = auth()->user()->eventsToBook()->getModels();\n return view('events.my', ['events' => $events]);\n }",
"public function editAction()\n\t{\n\t\t$params = $this->data->getParams();\n\t\t$params = $this->valid->clearDataArr($params);\n\t\tif (isset($params['id']))\n\t\t{\n\t\t\t$this->employee->setFlag(true);\n\t\t}\n\t\tif (isset($_POST['submit']))\n\t\t{\n\t\t\t$action = $this->valid->clearDataArr($_POST);\n\t\t\t$this->employee->setDataArray($action);\n\t\t\theader('Location: ' . PATH . 'Employee/index/', true, 303);\n\t\t}\n\t\t$employee = $this->employee->setAction('edit');\n\t\t$this->view->addToReplace($employee);\n\t\t$this->listEmployee();\n\t\t$this->arrayToPrint();\n\t}",
"public function edit()\n {\n return view('policy.edit')->withPage(Policy::first());\n }",
"public function edit(OtherIncome $otherIncome)\n {\n //\n }",
"public function edit($id)\n {\n // get the nerd\n $income = $this->incomes->find($id);\n //print_r($guest);die;\n // show the edit form and pass the nerd\n return view('incomes.edit')\n ->with(['income' => $income]);\n }",
"public function edit()\n {\n return view('common::edit');\n }",
"public function edit()\r\n {\r\n return view('petro::edit');\r\n }",
"public function edit()\n {\n $id = $_GET['id'];\n $encargo = Encargo::where('id',$id)->first();\n\n return view('encargo.edit', compact('encargo'));\n }",
"public function editAction() {\n\t\t$id = $this->getRequest()->getParam('id');\n\t\t$model = Mage::getModel('offermanager/offermanager')->load($id);\n\n\t\tif ($model->getId() || $id == 0) {\n\t\t\t$data = Mage::getSingleton('adminhtml/session')->getFormData(true);\n\t\t\tif (!empty($data)) {\n\t\t\t\t$model->setData($data);\n\t\t\t}\n\t\t\tMage::register('offermanager_data', $model);\n\n\t\t\t$this->loadLayout();\n\t\t\t$this->_setActiveMenu('offermanager/items');\n\t\t\t$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Offer Manager'), Mage::helper('adminhtml')->__('Offer Manager'));\n\t\t\t$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Offer News'), Mage::helper('adminhtml')->__('Offer News'));\n\t\t\t$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);\n\t\t\t$this->_addContent($this->getLayout()->createBlock('offermanager/adminhtml_offermanager_edit'))\n\t\t\t\t->_addLeft($this->getLayout()->createBlock('offermanager/adminhtml_offermanager_edit_tabs'));\n\t\t\t$this->renderLayout();\n\t\t} else {\n\t\t\tMage::getSingleton('adminhtml/session')->addError(Mage::helper('offermanager')->__('Offer does not exist'));\n\t\t\t$this->_redirect('*/*/');\n\t\t}\n\t}",
"public function edit()\n {\n return view('dashboard::edit');\n }",
"public function edit(Buy $buy)\n {\n //\n }",
"public function edit($clave_empleado)\n {\n $empleado = Empleado::find($clave_empleado);\n return view('empleados.edit')->with('empleados',$empleado);\n }"
]
| [
"0.6925835",
"0.67987514",
"0.6758797",
"0.672671",
"0.6680212",
"0.6680212",
"0.66122127",
"0.66099596",
"0.658431",
"0.6579701",
"0.657552",
"0.65754014",
"0.6566142",
"0.6566142",
"0.6548121",
"0.6548121",
"0.64979124",
"0.64956236",
"0.64895827",
"0.64859474",
"0.6477402",
"0.646906",
"0.6450665",
"0.6449309",
"0.6448267",
"0.6447367",
"0.64336306",
"0.6430923",
"0.6410484",
"0.6407483"
]
| 0.7238321 | 0 |
Update the specified Earning in storage. | public function update($id, UpdateEarningRequest $request)
{
$earning = $this->earningRepository->findWithoutFail($id);
if (empty($earning)) {
Flash::error('Earning not found');
return redirect(route('earnings.index'));
}
$input = $request->all();
$customFields = $this->customFieldRepository->findByField('custom_field_model', $this->earningRepository->model());
try {
$earning = $this->earningRepository->update($input, $id);
foreach (getCustomFieldsValues($customFields, $request) as $value){
$earning->customFieldsValues()
->updateOrCreate(['custom_field_id'=>$value['custom_field_id']],$value);
}
} catch (ValidatorException $e) {
Flash::error($e->getMessage());
}
Flash::success(__('lang.updated_successfully',['operator' => __('lang.earning')]));
return redirect(route('earnings.index'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testUpdateExpense()\n {\n $attributes = array(\n 'amount' => 24344,\n 'merchant_id' => 1,\n 'category_id' => 1,\n 'created_at' => date('Y-m-d H:i:s')\n );\n\n $response = $this->call('PUT', 'v1/expenses/1', $attributes);\n $data = json_decode($response->getContent());\n\n $this->assertFalse($data->error);\n $this->assertEquals('Expense has been updated.', $data->message);\n }",
"public function update(Request $request, Expense $expense)\n { \n $this->validate($request, [\n 'amount' => 'numeric|required',\n 'date' => 'required|date_format:d/m/Y'\n ]);\n $account_id = $request->input('account');\n $amount = str_replace(',', '.', $request->input('amount'));\n\n $amount_old = $expense->amount;\n $account_id_old = $expense->account_id;\n $account_old = Account::find($account_id_old);\n\n //Rollback to old balance\n $old_balance = $account_old->balance + abs($amount_old);\n $account_old->balance = $old_balance;\n $account_old->save();\n\n $account = Account::find($account_id);\n\n if($account->balance >= $amount)\n { \n\n //Update Expense\n $expense->account_id = $account_id;\n $expense->category_id = $request->input('category');\n $expense->amount = $amount;\n $expense->date = Carbon::createFromFormat('d/m/Y', $request->input('date'));\n $expense->save();\n \n //Update the balance\n $new_balance = $account->balance - abs($amount);\n $account->balance = $new_balance;\n $account->save();\n\n return redirect('/operations')->with('success','<strong>'.$account->name.'</strong> balance is now: <strong>'.$account->balance.' '.$account->currency()->first()->sign.'</strong>');\n }\n else\n {\n //Undo the rollback\n $old_balance = $account_old->balance - abs($amount_old);\n $account_old->balance = $old_balance;\n $account_old->save();\n //\n return redirect()->route('expenses.edit', $expense->id)->with('error','You don’t have enough funds in this account. <strong>'.$account->name.'</strong> balance is: <strong>'.$account->balance.' '.$account->currency()->first()->sign.'</strong>')->withInput();\n }\n }",
"public function update(Request $request, Storage $storage)\n {\n $storage->product_id = $request->product_id;\n $storage->amount = $request->amount;\n\n $storage->save();\n\n return redirect()->route('storages.index');\n }",
"public function update(): void\n {\n $this->updateQuality();\n $this->updateSellIn();\n $this->expiresAfterSale();\n }",
"public function updated(Expense $expense)\n {\n if ($expense->status == 1 && $expense->wallet) {\n $wallet = $expense->wallet;\n $wallet->update([\n 'balance' => ($wallet->balance - $expense->amount)\n ]);\n }\n }",
"public function update(UpdateIncomeRequest $request, Income $income)\n {\n $this->incomeRepository->updateExpense($request->all(), $income->id);\n\n return $this->sendSuccess('Income update successfully');\n }",
"public function update(Request $request, Income $income)\n {\n //\n }",
"public function update( int $expenseId, array $parameters );",
"public function update(Request $request, Expense $expense)\n {\n //\n }",
"public function update(UpdateIncome $request, $id)\n {\n $request->saveIncome($id);\n }",
"public function update(Request $request, Sellthrough $sellthrough)\n {\n //\n }",
"public function update(Request $request, OtherIncome $otherIncome)\n {\n //\n }",
"public function update( Request $request, Expense $expense )\n {\n $request->validate( [\n 'details' => 'required',\n 'amount' => 'required|numeric',\n ] );\n\n $expense->details = $request->details;\n $expense->amount = $request->amount;\n $expense->save();\n }",
"public function update(Request $request)\n {\n //dd($request->all());\n //\n //TODO: Validation required\n $member_id = $request->id;\n $installment_id = $request->installment_id;\n //Finding instance of the installment to be updated\n $installmentInDb = Installment::where('id',$installment_id)->first();\n //Storing the previous amount of the installment DB instance before changing\n $previous_amount =$installmentInDb->amount ;\n\n $installmentInDb->amount = $request->amount;\n $installmentInDb->installment_date = $request->installment_date;\n\n if($request->has('late_fee') && $installmentInDb->late_fee===0){\n $installmentInDb->late_fee = 1;\n $installmentInDb->save();\n\n //Adding 50 tk from Reserve Fund because of Late Fee removal\n $fund = Fund::where('name','=','Reserve Fund')->first();\n $fund->balance += 50;\n $fund->save();\n }\n else if($installmentInDb->late_fee===1){\n $installmentInDb->late_fee = 0;\n $installmentInDb->save();\n\n //Deducting 50 tk from Reserve Fund because of Late Fee removal\n $fund = Fund::where('name','=','Reserve Fund')->first();\n $fund->balance -= 50;\n $fund->save();\n }\n else{\n $installmentInDb->save();\n }\n //Checking if installment amount is changed\n if($previous_amount !== $request->amount){\n //Since Amount is changed, the `member_accounts` table's balance and `funds`\n //table's balance need to be updated.\n\n $member_acc = MemberAccount::where('member_id', $member_id)->first();\n $fund = Fund::where('name','=','Saving Fund')->first();\n\n //Checking whether new instance of installment amount is greater than the\n // installment instance in the DB.\n\n if($request->amount >$previous_amount){\n //`member_accounts` table's balance is updated to the increase in\n // installment amount.\n $member_acc->balance += ($request->amount - $previous_amount);\n //`funds` table's balance is updated to the increase in\n // installment amount\n $fund->balance += ($request->amount - $previous_amount);\n }\n else{\n //`member_accounts` table's balance is updated to the decrease in\n // installment amount\n $member_acc->balance -= ($previous_amount - $request->amount );\n //`funds` table's balance is updated to the decrease in\n // installment amount\n $fund->balance -= ($previous_amount - $request->amount );\n }\n //Saving the `member_accounts` and `funds` instances.\n $member_acc->save();\n $fund->save();\n }\n\n return redirect('/admin/installments');\n }",
"public function update(IncomeRequest $request, Income $income)\n {\n try {\n if(!$income->update($request->validated())) {\n return response()->errorResponse(\"Update Failed\");\n }\n\n return (new IncomeResource($income))->additional([\n 'message' => 'Account record updated successfully',\n 'status' => 'success'\n ]);\n } catch (QueryException $e) {\n report($e);\n return response()->errorResponse(\"Update failed due to unknown error\");\n }\n }",
"public function update(ExpenseRequest $request, Expense $expense){\n\n\t\t$expense->update($request->all());\n\t\t$expense = Expense::latest()->first();\n\n\t\t\\Session::flash('flash_message', 'Expense ' . $expense->id . ' was updated.');\n\n\t\treturn redirect('expenses');\n\t}",
"public function update(ExpensePriceRequest $request, $id)\n {\n $euro_nis = $request['euro_nis'];\n $euro_usd = $request['euro_usd'];\n $usd_nis = $request['usd_nis'];\n\n $expense_price = ExpensePrice::find($id);\n\n if ($expense_price) {\n\n $expense_price->update([\n 'euro_usd' => $euro_usd,\n 'usd_nis' => $usd_nis,\n 'euro_nis' => $euro_nis,\n ]\n );\n\n $action = Action::create(['title' => 'تم تعديل سعر صرف', 'type' => Permission::findByName('list expensePrices')->title, 'link' => Permission::findByName('list expensePrices')->link]);\n $users = User::permission('expensePrices')->whereNotIn('id', [auth()->user()->id])->get();\n if ($users->first())\n Notification::send($users, new NotifyUsers($action));\n return redirect('admin/expense_prices')->with('success', 'تم تعديل سعر صرف بنجاح');\n\n\n } else {\n return redirect(\"/admin/expense_prices\")->with('error', 'الرابط الذي تحاول الوصول له غير صحيح');\n }\n }",
"public function update(Request $request, $id)\n {\n try {\n $sale = Sale::findOrFail($id);\n } catch (ModelNotFoundException $e) {\n\n return redirect('sale')->withError(\"Sale with ID '\" . $id . \"' not found.\");\n } catch (\\Exception $ex) {\n return redirect('sale')->withError(\"Something went wrong!! Please Contact to Service Provider\");\n }\n $this->validate($request, [\n 'date' => 'required',\n 'customer_name' => 'required|max:100',\n 'item_id' => 'required',\n 'unit_price' => 'required|numeric',\n 'quantity' => 'required|integer|max:1000',\n 'total_amount' => 'required|numeric',\n 'discount' => 'required|numeric',\n 'final_amount' => 'required|numeric',\n ]);\n DB::beginTransaction();\n try {\n $input = $request->all();\n $input['date'] = get_english_date($request->date);\n $sale->fill($input);\n\n $sale->save();\n $item = Item::where('id', $request->item_id)->first();\n $itemstock= $item->current_stock - $request->quantity;\n\n if ($itemstock >= 0) {\n $item->current_stock=$itemstock;\n $item->save();\n } else {\n\n Session::flash('type', \"danger\");\n Session::flash('message',\" Current Stock for this item is only \".$item->current_stock);\n\n return redirect()->back();\n }\n } catch (\\Exception $e) {\n DB::rollback();\n return back()->withError($e->getMessage())->withInput();\n }\n DB::commit();\n Session::flash('type', \"info\");\n Session::flash('message', \"Sale Record has been Updated Successfully\");\n return redirect('sale');\n }",
"public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'amountPaid' => 'required',\n 'status' => 'required'\n ]);\n\n $input = $request->all();\n\n $status = $request->input('status');\n\n $subscriptionId = Investment::findOrFail($id)->subscription->id;\n $earningMethod = Investment::findOrFail($id)->earningMethod;\n $userId = Investment::findOrFail($id)->user->id;\n\n $interest = Subscription::select($earningMethod)\n ->where('id', $subscriptionId)->first()->$earningMethod;\n\n switch ($earningMethod) {\n case 'weeklyEarnings':\n $date = date(\"Y-m-d h:i:s\", strtotime(\"+1 week\"));\n break;\n \n case 'monthlyEarnings':\n $date = date(\"Y-m-d h:i:s\", strtotime(\"+1 Month\"));\n break;\n \n default:\n break;\n }\n\n if ($status == 'Confirmed') {\n\n $balance = new Balance();\n\n $balance->status = 'Pending';\n $balance->balance = $request->input('amountPaid'); \n $balance->payout = $interest;\n $balance->user_id = $userId;\n $balance->investment_id = $id;\n $balance->due_date = $date;\n $balance->save();\n }\n\n $investment = Investment::findOrFail($id);\n\n $investment->update($input);\n\n return $investment; \n }",
"public function update() {\n $this->connection->update(\n \"ren_change_money\", array(\n \"`change`\" => $this->observer->change,\n \"`year`\" => $this->observer->year,\n \"`idmoney`\" => $this->observer->money->idmoney\n ), array(\"idchangemoney\" => $this->observer->idchangemoney), $this->user->iduser\n );\n }",
"public function update()\n\t{\n\t\t$id = Input::get('id');\n\t\t\n\t\t$validation = Validator::make(Input::all(),\n\t\t[\n\t\t\t'description'\t=>\t'required',\n\t\t\t'memo'\t\t\t=>\t'',\n\t\t\t'amount'\t\t=>\t'required|numeric',\n\t\t\t'quantity'\t\t=>\t'required|numeric'\n\t\t]);\n\t\t\n\t\t$errorMessages = new MessageBag;\n\t\t\n\t\tif($validation->fails()){\n\t\t\t$errorMessages->merge($validation->errors()->toArray());\n\t\t}\n\t\t\n\t\t$data = Input::all();\n\t\t\n\t\t$cashInHand = Expense::cashInHand();\n\t\t\n\t\t$ex = ($data['amount'] * $data['quantity']);\n\t\t\n\t\tif($ex > $cashInHand){\n\t\t\t$errorMessages->add('amount', 'You cannot make an expense exceeding cash in hand');\n\t\t}\n\t\t\n\t\tif(count($errorMessages) > 0){\n\t\t\treturn Redirect::route('getExpenses')\n\t\t\t\t\t->withInput()\n\t\t\t\t\t->withErrors($errorMessages)\n\t\t\t\t\t->with('modal','#myModal');\n\t\t} else {\n\t\t\t$expense = Expense::find($id);\n\t\t\t\n\t\t\t$expense->description = Input::get('description');\n\t\t\t$expense->memo = Input::get('memo');\n\t\t\t$expense->amount = Input::get('amount');\n\t\t\t$expense->quantity = Input::get('quantity');\n\t\t\t\n\t\t\tif($expense->save()){\n\t\t\t\treturn Redirect::route('getExpenses')->with('success', 'Edited successfully');\n\t\t\t} else {\n\t\t\t\treturn Redirect::route('getExpenses')->with('fail', 'An error ocurred while editing the expense');\n\t\t\t}\n\t\t}\n\t}",
"function update($id, Request $request)\n {\n $sell = Sell::where('id', $id)->first();\n\n // if data does not exist\n if (!$sell) {\n return response()->json(\n [\n \"message\" => \"Sell with id $id not found\"\n ],\n 404\n );\n }\n\n // set value to be update\n // give validation incase user does not give some data, so the old value will be use\n $sell->item_id = $request->item_id ? $request->item_id : $sell->item_id;\n $sell->discount = $request->discount ? $request->discount : $sell->discount;\n $sell->employee_id = $request->employee_id ? $request->employee_id : $sell->employee_id;\n\n // save updated product to db\n $sell->save();\n\n // send response\n return redirect('sells');\n }",
"public function update(Request $request)\n {\n $user = $request->user();\n \n $currentCompany = $user->currentCompany();\n\n $supplier = Supplier::findOrFail($request->supplier);\n $st1 ='';\n if ($request->hasFile('attachment')) {\n $limage = $request->attachment;\n $limage_new_name = time().$limage->getClientOriginalName();\n $st1= $limage->move('assets/images', $limage_new_name);\n }\n // dd($price);\n // Update the Expense\n $supplier->update([\n 'name' => $request->name,\n 'email' => $request->email,\n 'company' => $request->company,\n 'phone' =>$request->phone,\n 'company_id' => $currentCompany->id,\n 'display_name' => $request->display_name,\n 'website' => $request->website,\n 'address' => $request->address,\n 'state' => $request->state,\n 'city' => $request->city,\n 'country' => $request->country,\n 'pin_code' =>$request->pin_code,\n 'billing_rate' => $request->billing_rate,\n 'pan_number' => $request->pan_number,\n 'attachment' => $st1,\n 'tds_entity' => $request->tds_entity,\n 'tds_section' => $request->tds_section,\n 'notes' => $request->notes,\n 'balance' => $request->balance,\n 'balance_date' => $request->balance_date,\n 'account_number' =>$request->account_number,\n 'gst_type' => $request->gst_type,\n 'gstin' => $request->gstin,\n 'tax_reg_number' => $request->tax_reg_number,\n 'effective_date' => $request->effective_date,\n ]);\n\n session()->flash('alert-success', __('messages.product_updated'));\n return redirect()->route('suppliers', ['company_uid' => $currentCompany->uid]);\n }",
"public function update(Request $request, Expense $expense)\n {\n // $request['is_paid'] = true;\n $expense->update($request->all());\n return response()->json($expense);\n }",
"public function update(Request $request, $id)\n {\n //dd($request->qtd);\n $perfume = Perfume::where('id', $request->perfume)->get();\n $perfume_id = Perfume::where('id', $request->perfume)->value('id');\n //dd($perfume_id);\n $stock_id = Stock::where('name_fragrance', $perfume[0]->name_fragrance)->value('id');\n $stock_ml_fragrance = Stock::find($stock_id)->value('ml_fragrance');\n $stock_water = Stock::all()->sum('ml_water');\n $stock_alcohol = Stock::all()->sum('ml_alcohol');\n $result_fragrance = $stock_ml_fragrance/$perfume[0]->ml_fragrance;\n $result_water = $stock_water/$perfume[0]->ml_water;\n $result_alcohol = $stock_alcohol/$perfume[0]->ml_alcohol;\n\n $array = [floor($result_alcohol), floor($result_fragrance), floor($result_water)];\n sort($array);\n if($array[0] > 0) {\n $update_perfume = Perfume::find($perfume_id);\n //$update_perfume->amount_created = $array[0] + $update_perfume->amount_created;\n $update_perfume->amount_created = $request->qtd + $update_perfume->amount_created;\n $update_perfume->save();\n\n return Redirect::route('dashboard');\n }\n }",
"public function update(StoreStorage $request, Storage $storage)\n {\n $storage->fill($request->all())->save();\n $request->session()->flash('alert-success', 'Запись успешно обновлена!');\n return redirect()->route('storage.index');\n }",
"public function update($amount)\n {\n $currentBalance = auth()->user()->balance->amount;\n $newAmount = $currentBalance + $amount;\n auth()->user()->balance()->update(['amount' => $newAmount]);\n }",
"public function updateSellIn(): void\n {\n $this->getItem()->sell_in--;\n }",
"public function updateStock()\n {\n// foreach($this->detalle_compras as $detalle)\n// {\n// $producto= Producto::model()->findByPk($detalle->producto);\n// $producto->stock+=$detalle->cantidad;\n// $producto->save();\n// }\n }",
"public function update(Request $request, Product $product, Income $income)\n {\n if (!User::searchPermitOnArray([\"MP\", \"SMP\"])) return $this->errorResponse(\"No tienes permitido realizar esta acción.\", 401);\n \n $this->verifyProduct($product, $income);\n $income->fill($request->only([ 'income_from', 'show' ]));\n if ($request->has('income_from')) { $income->income_from = $request->income_from; }\n if ($request->has('show')) { $income->show = $request->show; }\n if ($income->isClean()) { return $this->errorResponse('Se debe especificar al menos un valor diferente para actualizar', 422); }\n $change_income = false;\n $change_show = false;\n if ($income->isDirty('income_from')) { $change_income = true; }\n if ($income->isDirty('show')) { $change_show = true; }\n if ($income->save()) {\n $user = JWTAuth::parseToken()->authenticate();\n if ($change_income) {\n $history_income = new HistoryIncome;\n $history_income->income_id = $income->id;\n $history_income->income = $income->income_from;\n $history_income->save();\n Log::logProduct($user->id, 7, $product->id, $product->product);\n }\n if ($change_show) {\n Log::logProduct($user->id, 11, $product->id, $product->product);\n }\n return $this->showOne($income); \n }\n return $this->errorResponse(\"No se ha podido crear el registro.\", 422);\n }"
]
| [
"0.643995",
"0.6280055",
"0.6273398",
"0.6218962",
"0.6121495",
"0.5905832",
"0.587177",
"0.58696425",
"0.57455915",
"0.5738059",
"0.5721994",
"0.5711737",
"0.5701953",
"0.57013226",
"0.5686605",
"0.5685217",
"0.568372",
"0.56664085",
"0.56417567",
"0.5632192",
"0.5630158",
"0.5628059",
"0.56257766",
"0.56236815",
"0.5600926",
"0.5596969",
"0.5592775",
"0.5586123",
"0.55478144",
"0.55327326"
]
| 0.65445226 | 0 |
Remove Media of Earning | public function removeMedia(Request $request)
{
$input = $request->all();
$earning = $this->earningRepository->findWithoutFail($input['id']);
try {
if($earning->hasMedia($input['collection'])){
$earning->getFirstMedia($input['collection'])->delete();
}
} catch (\Exception $e) {
Log::error($e->getMessage());
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $marketsPayout = $this->marketsPayoutRepository->findWithoutFail($input['id']);\n try {\n if ($marketsPayout->hasMedia($input['collection'])) {\n $marketsPayout->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"public function removeMediaObject($filename) {\n // TODO: make method private again\n // get media-object element\n $el = $this->getMediaObjectByFilename($filename);\n if(count($el) > 0) {\n $this->domDocument->documentElement->removeChild($el);\n } else {\n throw new Exception(\"Element with filename \" . $filename . \" not found\");\n }\n }",
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $currency = $this->currencyRepository->findWithoutFail($input['id']);\n try {\n if ($currency->hasMedia($input['collection'])) {\n $currency->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $marketReview = $this->marketReviewRepository->findWithoutFail($input['id']);\n try {\n if($marketReview->hasMedia($input['collection'])){\n $marketReview->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $encargo = $this->EncargoRepository->findWithoutFail($input['id']);\n try {\n if ($encargo->hasMedia($input['collection'])) {\n $encargo->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"function unPublishMediaById ( $id )\n {\n /// syndication will always return metadata for one content item\n /// if publishing a collection, we get collection item, which contains list of any sub-items also generated\n try\n {\n $result = $this->apiCall('delete',\"{$this->api['syndication_url']}/adminControls/media/delete/{$id}\", 'json', 'json');\n return $this->createResponse($result,'Delete','Id');\n } catch ( Exception $e ) {\n return $this->createResponse($e,'API Call');\n }\n }",
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $tax = $this->taxRepository->findWithoutFail($input['id']);\n try {\n if ($tax->hasMedia($input['collection'])) {\n $tax->getFirstMedia($input['collection'])->delete();\n }\n } catch (Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $food = $this->foodRepository->findWithoutFail($input['id']);\n try {\n if ($food->hasMedia($input['collection'])) {\n $food->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"public function remove_audio()\n {\n // Load all groups\n $groups = Group::loadMultiple();\n foreach ($groups as $group) {\n $group_type_id = $group->getGroupType()->id();\n if($group_type_id == \"program\") {\n echo \"Process program \" . $group->label() . PHP_EOL;\n\n $audio_contents = $group->getContent(null, [\"type\"=>\"program-group_media-audio\"]);\n foreach($audio_contents as $audio_content) {\n echo \"Delete group audio \" . $audio_content->label() . PHP_EOL;\n $audio_content->delete();\n }\n }\n else if($group_type_id == \"project\") {\n echo \"Process project \" . $group->label() . PHP_EOL;\n $audio_contents = $group->getContent(null, [\"type\"=>\"project-group_media-audio\"]);\n foreach($audio_contents as $audio_content) {\n echo \"Delete group audio \" . $audio_content->label() . PHP_EOL;\n $audio_content->delete();\n }\n }\n }\n }",
"public function EliminarMediosPagos()\n\t\t{\n\n\t\t\t$sql = \" select codmediopago from ventas where codmediopago = ? \";\n\t\t\t$stmt = $this->dbh->prepare($sql);\n\t\t\t$stmt->execute( array(base64_decode($_GET[\"codmediopago\"])) );\n\t\t\t$num = $stmt->rowCount();\n\t\t\tif($num == 0)\n\t\t\t{\n\n\t\t\t\t$sql = \" delete from mediospagos where codmediopago = ? \";\n\t\t\t\t$stmt = $this->dbh->prepare($sql);\n\t\t\t\t$stmt->bindParam(1,$codmediopago);\n\t\t\t\t$codmediopago = base64_decode($_GET[\"codmediopago\"]);\n\t\t\t\t$stmt->execute();\n\n\t\t\t\theader(\"Location: mediospagos?mesage=1\");\n\t\t\t\texit;\n\n\t\t\t}else {\n\n\t\t\t\theader(\"Location: mediospagos?mesage=2\");\n\t\t\t\texit;\n\t\t\t}\n\n\t\t}",
"public function removeMedia(Request $request)\n {\n if (env('APP_DEMO', false)) {\n Flash::warning('This is only demo app you can\\'t change this section ');\n } else {\n if (auth()->user()->can('medias.delete')) {\n $input = $request->all();\n $user = $this->userRepository->findWithoutFail($input['id']);\n try {\n if ($user->hasMedia($input['collection'])) {\n $user->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }\n }\n }",
"public function removeClaimed()\n\t{\n\t\t$items = CreditModel::whereRaw('value = claimed')->get();\n\n\t\tif ($items->count() > 0)\n\t\t{\n\t\t\tforeach ($items as $item)\n\t\t\t{\n\t\t\t\t$item->delete();\n\t\t\t}\n\t\t}\n\t}",
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $shop = $this->shopRepository->findWithoutFail($input['id']);\n try {\n if ($shop->hasMedia($input['collection'])) {\n $shop->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"public function removeMedia(Request $request)\n {\n $input = $request->all();\n $category = $this->contryRepository->findWithoutFail($input['id']);\n try {\n if ($category->hasMedia($input['collection'])) {\n $category->getFirstMedia($input['collection'])->delete();\n }\n } catch (\\Exception $e) {\n Log::error($e->getMessage());\n }\n }",
"public function removeCoverAction(){\r\n\t\t$chanel_id = $this->_getParam('chanel_id', '0');\r\n\t\tif ($chanel_id == 0)\r\n\t\t\treturn;\r\n\t\t$chanel = Engine_Api::_()->getItem('sesvideo_chanel', $chanel_id);\t\t\r\n\t\tif(!$chanel)\r\n\t\t\treturn;\r\n\t\tif(isset($chanel->cover_id) && $chanel->cover_id>0){\r\n\t\t\t$im = Engine_Api::_()->getItem('storage_file', $chanel->cover_id);\r\n\t\t\t$chanel->cover_id = 0;\r\n\t\t\t$chanel->save();\r\n\t\t\t$im->delete();\r\n\t\t}\r\n\t\techo \"true\";die;\r\n\t}",
"public function testRemoveMedium() {\n $id = Medium::where('slug','mediumwithdefaultslug')->firstOrFail()->id;\n $this->delete('/api/v1/medium/'.$id, ['HTTP_X-Requested-With' => 'XMLHttpRequest']);\n $this->assertDatabaseMissing('media', ['id' => $id]);\n }",
"public static function EliminarMedia($request,$response,$args){\n\n $retorno=new stdClass();\n $retorno->Mensaje=\"No se pudo borrar\";\n \n\n $param=$request->getParsedBody();\n $id=$param['id'];\n\n if(Media::Eliminar($id)){\n $retorno->Mensaje=\"Se borro la media con id: \".$id.\".\";\n return $response->withJson($retorno,200);\n }\n\n return $response->withJson($retorno,409);\n \n \n }",
"public function remove_image() {\n\t\t$this->join_name = \"images\";\n\t\t$this->use_layout=false;\n\t\t$this->page = new $this->model_class(Request::get('id'));\n\t\t$image = new WildfireFile($this->param(\"image\"));\n\t\t$this->page->images->unlink($image);\n\t}",
"public function stopMD5Sum($storage_name, $media_name){\n try {\n //$this->clients[$storage_name]->stopMD5Sum($media_name);\n $this->clients[$storage_name]->resource($this->media_type.'_md5_checker')->ids($media_name)->delete();\n }catch (Exception $exception){\n $this->parseException($exception);\n }\n }",
"function deleteProductMediasById($id) {\r\n //On supprime physiquement les medias avant de les retirer de la base\r\n $medias = getProductMediasById($id);\r\n foreach ($medias as $media) {\r\n unlink($media->mediaSource);\r\n }\r\n\r\n $dbc = connection();\r\n $table = 'medias';\r\n $dbc->quote($table);\r\n\r\n $req = \"DELETE FROM $table \"\r\n . \"WHERE id IN (\"\r\n . \"SELECT pm.id_medias \"\r\n . \"FROM products_has_medias \"\r\n . \"AS pm \"\r\n . \"WHERE pm.id_products = $id)\";\r\n\r\n $requPrep = $dbc->prepare($req); // on prépare notre requête\r\n $requPrep->execute();\r\n $data = $requPrep->fetchAll(PDO::FETCH_OBJ);\r\n $requPrep->closeCursor();\r\n}",
"private static function remove_meta_from_media( $media_ids ) {\n\t\tforeach ( (array) $media_ids as $media_id ) {\n\t\t\tif ( is_numeric( $media_id ) ) {\n\t\t\t\tdelete_post_meta( $media_id, '_frm_temporary' );\n\t\t\t}\n\t\t}\n\t}",
"public function remove_screen_reader_content()\n {\n }",
"public function excluirImagemGaleria(){ \n\t\t\n\t\t//deleta a imagem da pasta\n\t\tinclude_once(\"../funcoes/geral.php\");\n\t\t$sql = \"\n\t\t\tSELECT thumb\n\t\t\tFROM programa_imagem\n\t\t\"; \n\t\tif($this->idImagem)\n\t\t\t$sql .=\" WHERE id = '$this->idImagem'\";\n\n\t\t$this->sql = $sql;\n\t\t$this->qr = self::execSql($this->sql);\t\n\t\t$qtRegistros = $this->getQuantidadeData($sql); // retorna a quantidade de registro\t \n\t\tif($qtRegistros > 0){\n\t\t\twhile($lista = self::resultsAll($this->qr)){\n\n\t\t\t\tdeletaImagem($lista[\"thumb\"]);//deleto a imagem do arquivo\n\t\t\t\n\t\t\t}\n\t\t}\n\n\t}",
"public function denyMedia(\\App\\Models\\EstablishmentMedia $media) {\n try{\n if(checkModelId($media->getIdOriginalMedia())){\n $originalMedia = $media->mediaOriginal()->first();\n if(checkModel($originalMedia)){\n $originalMedia->setIdDraftMedia(0)->save();\n }\n }\n $media->setIdEstablishment(0);\n $media->delete();\n } catch (Exception $ex) {\n // TODO Display errors\n }\n // TODO Send notification\n return redirect('/admin');\n }",
"public function clearEmbargo();",
"public function remove() {\n //Check if there are thumbs and delete files and db\n foreach ($this->thumbs()->get() as $thumb) {\n $thumb->remove();\n } \n //Delete the attachable itself only if is not default\n if (strpos($this->url, '/defaults/') === false) {\n Storage::disk('public')->delete($this->getPath());\n }\n parent::delete(); //Remove db record\n }",
"function media_cleanup() { \r\n global $media;\r\n global $avatars;\r\n global $photoalbumsmedia;\r\n \r\n $query1 = \"SELECT `media_id` , `media_userid` FROM `$media`s;\";\r\n $sqlr1 = bcsql_query( $query1 );\r\n $mediaids = bcsql_fetch_array( $sqlr1 );\r\n $num_rows1 = bcsql_num_rows( $mediaids );\r\n for( $i = 0; $i<$num_rows1; $i++ ) {\r\n $thismedia = $mediaids[ $i ];\r\n $thismediaid = $thismedia[ \"media_id\" ];\r\n $mediaclass = New media( $thismediaid );\r\n $userid = $mediaclass->userid();\r\n $userfile = $uploaddir . $userid .\"/\". $thismediaid;\r\n if( !file_exists( $userfile ) ) {\r\n $sql = \"DELETE FROM `$media` WHERE `media_id` = '$thismediaid';\"; \r\n bcsql_query( $sql );\r\n $sql = \"DELETE FROM `$avatars` WHERE `avatar_mediaid` = '$thismediaid';\";\r\n bcsql_query( $sql );\r\n $sql = \"DELETE FROM `$photoalbumsmedia` WHERE `pamedia_mediaid` = '$thismediaid';\";\r\n bcsql_query( $sql );\r\n }\r\n }\r\n //the oposite thing remains to be done\r\n }",
"private function _unlink_media_image($image){\n\t\t\n \t\tif($image!=\"\" and file_exists(SLIDER_IMAGES_PATH.\"/\".$image)){\n\t\t\tunlink(SLIDER_IMAGES_PATH.\"/\".$image);\n\t\t\tunlink(SLIDER_IMAGES_PATH.\"/300/\".$image);\n\t\t}\n\t\treturn true ;\n\t}",
"public function deleteMedia() {\n\t\tif(isset($this->data['mdid'])) {\n\t\t\t$rs = mq(\"update \" . DB_TBL_MEDIA . \" set md_active='0' where mdid='\" . $this->data['mdid'] . \"'\");\n\t\t\t$_SESSION['_mtype'] = \"W\";\n\t\t\t$_SESSION['_msg'] = \"deletedmedia\";\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"abstract public function mass_remove();"
]
| [
"0.6412844",
"0.6399163",
"0.6293903",
"0.62825286",
"0.6129582",
"0.6126538",
"0.60621625",
"0.5987648",
"0.59782904",
"0.591198",
"0.5902574",
"0.58670604",
"0.58528346",
"0.5833893",
"0.575967",
"0.57546985",
"0.57435215",
"0.57315356",
"0.5672449",
"0.5672401",
"0.56418425",
"0.5624649",
"0.5622688",
"0.560806",
"0.55919254",
"0.5528192",
"0.55188173",
"0.5476454",
"0.54647255",
"0.54611623"
]
| 0.7015693 | 0 |
Wrapper for storage method, that creates directory for media my name | public function createMediaDir($media_name, $extending_name = ''){
if (!empty($extending_name)) {
$media_name .= ("_" . ((string)$extending_name));
}
foreach ($this->storages as $name => $storage){
try {
$this->clients[$name]->resource($this->media_type)->update(array('media_name' => $media_name));
}catch (Exception $exception){
$this->parseException($exception);
throw new MasterException($exception->getMessage(), $name);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function createDirectory() {}",
"public function createMedia();",
"public function createFolder(){\n $name = $_SESSION['token'];\n if(file_exists('PageStorage/'.$name)){\n while(file_exists('PageStorage/'.$name)){\n $name= random_int(1, 1999).$name;\n }\n }\n mkdir('PageStorage/'.$name, 0777, true);\n return $name;\n }",
"public function createFolderPath()\n {\n return \"uploads/\".date('Y').\"/\".date('m').\"/\";\n }",
"function create_folder($name)\n{\n $location = Path::get_repository_path() . 'lib/content_object/';\n Filesystem::create_dir($location . $name);\n}",
"public function createStorage();",
"function media_mkdir($action)\r\n{\r\n\tglobal $DIR_MEDIA, $member, $CONF, $manager;\r\n\tif ($action == _MEDIA_PHP_ACTION_MKDIR || $action =='mkdir' ) {\r\n\t\t$current = media_requestVar('mkdir_collection');\r\n\t\t$mkdirname = postVar('mkdirname');\r\n\t\tif (!($mkdirname && $current)) {\r\n\t\t\tmedia_select();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// Create member's directory if not exists.\r\n\t\tif (is_numeric($current) && $current==$member->getID() && !is_dir($DIR_MEDIA . '/' . $current)) {\r\n\t\t\t$oldumask = umask(0000);\r\n\t\t\tif (!@mkdir($DIR_MEDIA. '/' . $current, 0777)) {\r\n\t\t\t\treturn _ERROR_BADPERMISSIONS;\r\n\t\t\t}\r\n\t\t\tumask($oldumask);\r\n\t\t}\r\n\t\t// Check if valid directory.\r\n\t\t$path = $current . '/' . $mkdirname ;\r\n\t\t$path = str_replace('\\\\','/',$path); // Avoid using \"\\\" in Windows.\r\n\t\t$pathArray = explode('/', $path);\r\n\t\tif ($pathArray[0] !== $member->getID()) {\r\n\t\t\tmedia_doError(_MEDIA_PHP_39 . $pathArray[0] . ':' . $member->getID());\r\n\t\t}\r\n\t\tif (in_array('..', $pathArray)) {\r\n\t\t\tmedia_doError(_MEDIA_PHP_40);\r\n\t\t}\r\n\t\t// OK. Let's go.\r\n\t\tif (is_dir($DIR_MEDIA . '/' . $current)) {\r\n\t\t\t$res = @mkdir($DIR_MEDIA . '/' . $current . '/' . $mkdirname);\r\n\t\t\t$res .= @chmod($DIR_MEDIA . '/' . $current . '/' . $mkdirname , 0777);\r\n\t\t}\r\n\t\tif (!$res) {\r\n\t\t\tmedia_doError(_MEDIA_PHP_41 . $res );\r\n\t\t}\r\n\t\t// shows updated list afterwards\r\n\t\tmedia_select();\r\n\t} elseif($action == _MEDIA_PHP_ACTION_RMDIR ||\r\n\t\t\t $action == 'rmdir') {\r\n\t\t$rmdir_collection = media_postVar('rmdir_collection');\r\n\t\t$pathArray = explode('/', $rmdir_collection);\r\n\t\tif ($pathArray[0] !== $member->getID()) {\r\n\t\t\tmedia_doError(_MEDIA_PHP_39 . $pathArray[0] . ':' . $member->getID());\r\n\t\t}\r\n\t\tif (in_array('..', $pathArray)) {\r\n\t\t\tmedia_doError(_MEDIA_PHP_40);\r\n\t\t}\r\n\t\t$res = @media_rmdir($DIR_MEDIA,$rmdir_collection);\r\n\t\tif ($res) {\r\n\t\t\tmedia_select();\r\n\t\t} else {\r\n\t\t\tmedia_doError(_MEDIA_PHP_42);\r\n\t\t}\r\n\t} else {\r\n\t\t$current = media_requestVar('collection');\r\n\t\t$collections = MEDIADIRS::getPrivateCollectionList();\r\n\r\n\t\tmedia_head();\r\n\t\t?>\r\n\t\t<h1><?php echo htmlspecialchars(_MEDIA_MKDIR_TITLE); ?></h1>\r\n\r\n\t\t<p><?php echo htmlspecialchars(_MEDIA_MKDIR_MSG); ?></p>\r\n\r\n\t\t<form method=\"post\" action=\"media.php\">\r\n\t\t<div>\r\n\t \t <input type=\"hidden\" name=\"action\" value=\"<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_MKDIR); ?>\" />\r\n\t \t <?php $manager->addTicketHidden() ?>\r\n\t\t FolderName:\r\n\t\t <br />\r\n\t\t <input name=\"mkdirname\" type=\"text\" size=\"40\" />\r\n\t\t<?php\t\tif (sizeof($collections) > 0) {\r\n\t\t?>\r\n\t\t\t<br /><br /><label for=\"mkdir_collection\">Collection:</label>\r\n\t\t\t<br /><select name=\"mkdir_collection\" id=\"mkdir_collection\">\r\n\t\t\t\t<?php\r\n\t\t\t\t\t\tforeach ($collections as $dirname => $description) {\r\n\t\t\t\t\t\t\techo '<option value=\"',htmlspecialchars($dirname),'\"';\r\n\t\t\t\t\t\t\tif ($dirname == $current) {\r\n\t\t\t\t\t\t\t\techo ' selected=\"selected\"';\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\techo '>' . htmlspecialchars($description) . '</option>';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t?>\r\n\t\t\t</select>\r\n\t\t<?php\t\t} elseif (sizeof($collections) == 1) {\r\n\t\t\t\t\t\t$flipCollections = array_flip($collections);\r\n\t\t\t\t\t\t$collection = array_pop($flipCollections);\r\n\t\t?>\r\n\t\t \t<input name=\"collection\" type=\"hidden\" value=\"<?php echo htmlspecialchars($collection);?>\" />\r\n\t\t<?php\t\t} else {\r\n\t\t\t\t\t\tmedia_foot();\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}// if sizeof\r\n\t\t?>\r\n\t\t <br /><br />\r\n\t\t <input type=\"submit\" value=\"<?php echo htmlspecialchars(_MEDIA_MKDIR_BUTTON); ?>\" />\r\n\t\t</div>\r\n\t\t</form>\r\n\t\t<?php\t\tif (sizeof($collections) > 0) {?>\r\n\t\t\t<br /><br /><h1><?php echo htmlspecialchars(_MEDIA_RMDIR_TITLE); ?></h1>\r\n\r\n\t\t<p><?php echo htmlspecialchars(_MEDIA_RMDIR_MSG); ?></p>\r\n\r\n\t\t<form method=\"post\" action=\"media.php\">\r\n\t\t<div>\r\n\t \t <input type=\"hidden\" name=\"action\" value=\"<?php echo htmlspecialchars(_MEDIA_PHP_ACTION_RMDIR); ?>\" />\r\n\r\n\t<label for=\"rmdir_collection\">Collection:</label>\r\n\t\t\t<br /><select name=\"rmdir_collection\" id=\"rmdir_collection\">\r\n\t\t\t\t<?php\r\n\t\t\t\t\tforeach ($collections as $dirname => $description) {\r\n\t\t\t\t\t\tif (is_numeric($dirname)) continue;\r\n\t\t\t\t\t\techo '<option value=\"',htmlspecialchars($dirname),'\"';\r\n\t\t\t\t\t\tif ($dirname == $current) {\r\n\t\t\t\t\t\t\techo ' selected=\"selected\"';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\techo '>',htmlspecialchars($description),'</option>';\r\n\t\t\t\t\t}\r\n\t\t\t\t?>\r\n\t\t\t</select>\r\n\t\t<?php\t\t} else {\r\n\t\t\t\t\t\tmedia_foot();\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}// if sizeof\r\n\t\t?>\r\n\t\t <br /><br />\r\n\t\t <?php $manager->addTicketHidden() ?>\r\n\t\t <input type=\"submit\" value=\"<?php echo htmlspecialchars(_MEDIA_RMDIR_BUTTON); ?>\" />\r\n\t\t</div>\r\n\t\t</form>\r\n\t\t<p><a href=\"javascript:history.back()\"><?php echo htmlspecialchars(_BACK); ?></a></p>\r\n\t\t<?php\r\n\t\tmedia_foot();\r\n\t}\r\n}",
"private function createNewTempdir(){\n $tempdirname = '';\n do{\n $tempdirname = uniqid('temp_',true);\n }while(file_exists(FRONTEND_ABSDIRPATH.ARTICLEIMAGESPATH.$tempdirname));\n\n if(@mkdir(FRONTEND_ABSDIRPATH.ARTICLEIMAGESPATH.$tempdirname)){\n mkdir(FRONTEND_ABSDIRPATH.ARTICLEIMAGESPATH.$tempdirname.DIRECTORY_SEPARATOR.'gallery');\n }else{\n die(json_encode(array('state'=>'error','data'=> $this->text('e28').': '.FRONTEND_ABSDIRPATH.ARTICLEIMAGESPATH.'!')));\n }\n return $tempdirname;\n }",
"function _createCacheDirectory() {\n // Create cache directory if it doesnt exist\n if (!file_exists($this->thumbnail_dir)) {\n @mkdir($this->thumbnail_dir, 0777, true);\n } else {\n // Try to make the directory writable\n @chmod($this->thumbnail_dir, 0777);\n }\n }",
"public function storeMedia($input) {\n $dir = 'images';\n if ($input->hasFile('media')) {\n $image = $input->file('media');\n $name = time().'.'.$image->getClientOriginalExtension();\n $img = Image::make($image);\n // $img = Image::make(Request::file('media'));\n $img->orientate();\n $img->fit(400, 400);\n $img->save(public_path('/images/' . $name));\n\n // $destinationPath = $dir;\n // $image->move($destinationPath, $name);\n }\n $media = new Media;\n $media['path'] = $name;\n\n if (!$media->save()) {\n $errors = $media->getErrors();\n return redirect()->back()->with('errors', $errors)->withInput();\n }\n return $media->id;\n }",
"private function getMediaDirectory()\n {\n return $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);\n }",
"function uploads_dir() {\n\tglobal $root;\n\treturn $root.Media::instance()->path;\n}",
"public function getPath(): string\n {\n $storage = $this->path;\n\n // Verify the storage directory\n if (! is_dir($storage) && ! @mkdir($storage, 0775, true)) {\n throw FilesException::forDirFail($storage);\n }\n\n // Normalize the storage path\n $this->path = realpath($storage) ?: $storage;\n $this->path = rtrim($storage, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;\n\n // Check or create the thumbnails subdirectory\n $thumbnails = $storage . 'thumbnails';\n if (! is_dir($thumbnails) && ! @mkdir($thumbnails, 0775, true)) {\n throw FilesException::forDirFail($thumbnails); // @codeCoverageIgnore\n\t\t}\n\t\t\n\t\t// Normalize the path\n\t\t$small = $storage . 'small';\n\t\tif (! is_dir($small) && ! @mkdir($small, 0775, true)){\n\t\t\tthrow MediasException::forDirFail($small);\n\t\t}\n\n\t\t// Normalize the path\n\t\t$original = $storage . 'original';\n\t\tif (! is_dir($original) && ! @mkdir($original, 0775, true)){\n\t\t\tthrow MediasException::forDirFail($original);\n\t\t}\n\n\t\t// Normalize the path\n\t\t$medium = $storage . 'medium';\n\t\tif (! is_dir($medium) && ! @mkdir($medium, 0775, true)){\n\t\t\tthrow MediasException::forDirFail($medium);\n\t\t}\n\n\t\t// Normalize the path\n\t\t$large = $storage . 'large';\n\t\tif (! is_dir($large) && ! @mkdir($large, 0775, true)){\n\t\t\tthrow MediasException::forDirFail($large);\n\t\t}\n\n\t\t// Normalize the path\n\t\t$custom = $storage . 'custom';\n\t\tif (! is_dir($custom) && ! @mkdir($custom, 0775, true)){\n\t\t\tthrow MediasException::forDirFail($custom);\n\t\t}\n\n return $storage;\n\t}",
"public function storage_path();",
"protected function getStorageFile()\n\t{\n\t\t$this->createDirectory();\n\t\treturn $this->storagePath.$this->storageFileName;\n\t}",
"public function __construct() {\n\t\t@mkdir($this->storage, 0777, true);\n\t}",
"public function directory();",
"private function getMediaDirTmpDir(): string\n {\n return $this->directoryList->getPath(DirectoryList::MEDIA) . DIRECTORY_SEPARATOR . 'tmp';\n }",
"private function createFileDir()\n\t{\n\t\t$this->fileDir = IMAGES.'uploads'.DS.$this->model.DS.$this->modelId;\n\t\t$this->imgDir = 'uploads/'.$this->model.'/'.$this->modelId;\n\t}",
"public function getStoragePath(): string;",
"private function set_directory(){\n if(!is_dir($this->img_dir)) mkdir($this->img_dir);\n if(!is_dir($this->thumb_dir)) mkdir($this->thumb_dir);\n }",
"function generate_directory($id){\n $filename = \"intranet/usuarios/\" . $id . \"/uploads/\";\n if (!file_exists($filename)) {\n mkdir($filename, 0777, true);\n }\n }",
"public function makeFolder($name, $username= null){\n $disk = Storage::disk('gcs');\n $path = $username ? $name.'/'.$username : $name;\n return $disk->makeDirectory($path);\n }",
"public static function getMediaPath()\n {\n $mediaDir = Config::get('media.media_dir');\n $mediaFullPath = ROOT . self::getFilesPath() . $mediaDir;\n\n if(!file_exists($mediaFullPath))\n {\n if(!is_writable(ROOT . self::getFilesPath()) || !mkdir($mediaFullPath, Config::get('media.dir_chmod'), true))\n return false;\n }\n\n return $mediaDir;\n }",
"function CreatePhotoAlbumDirectory($album_id){\r\n\t\t$showamerica_user_id=$this->session->userdata('showamerica_user_id');\r\n\t\t$user_home_dir=sprintf(USER_UPLOAD_HOME_PATH,$showamerica_user_id);\r\n\t\tif(!is_dir($user_home_dir)){\r\n\t\t\t\t$old = umask(0); \r\n\t\t\t\tif(mkdir($user_home_dir,DIR_WRITE_MODE)){\t\t//Create the folder if not exist and give permission\r\n\t\t\t\t\tumask($old); \r\n\t\t\t\t}\r\n\t\t}\r\n\t\t//its album path created with user id\r\n\t\t$album_path=sprintf(USER_UPLOAD_PATH_ALBUMS,$showamerica_user_id);\r\n\t\tif(!is_dir($album_path)){\r\n\t\t\t\t$old = umask(0); \r\n\t\t\t\tif(mkdir($album_path,DIR_WRITE_MODE)){\t\t//Create the folder if not exist and give permission\r\n\t\t\t\t\tumask($old); \r\n\t\t\t\t}\r\n\t\t}\r\n\t\t\r\n//\t\tthats create album folder with user id\r\n\t\t$album_path=sprintf(USER_UPLOAD_PATH_ALBUMS.'/'.$album_id.'/',$showamerica_user_id);\r\n\t\tif(!is_dir($album_path)){\r\n\t\t\t\t$old = umask(0); \r\n\t\t\t\tif(mkdir($album_path,DIR_WRITE_MODE)){\t\t//Create the folder if not exist and give permission\r\n\t\t\t\t\tumask($old); \r\n\t\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\r\n\t\t$album_thumbnail_path=$album_path.'/thumbnails/';\r\n\t\tif(!is_dir($album_thumbnail_path)){\r\n\t\t\t\t$old = umask(0); \r\n\t\t\t\tif(mkdir($album_thumbnail_path,DIR_WRITE_MODE)){\t\t//Create the folder if not exist and give permission\r\n\t\t\t\t\tumask($old); \r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn $options=array('upload_dir'=>$album_path,'upload_url'=>base_url().$album_path,'accept_file_types' => '/^.*\\.(jpg|jpeg|png|gif)$/i',\r\n\t\t\t\t\t\t'image_versions'=>array(\r\n\t\t\t\t\t\t\t\t\t\t\t'thumbnail'=>array('upload_dir'=>$album_thumbnail_path,'upload_url'=>base_url().$album_thumbnail_path)) \t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t );\r\n\t}",
"public function testMakeDirectory()\n {\n $this->assertTrue(Storage::mkdir(self::$temp.DS.'created'));\n $this->assertTrue(is_dir(self::$temp.DS.'created'));\n }",
"public function create_dir() {\n\t\t$permission = 0777;\n\t\t$directory_path = ! defined( 'CODE_SNIPPET_DIR' )\n\t\t? ABSPATH . 'wp-code-snippet'\n\t\t: CODE_SNIPPET_DIR;\n\t\n\t\tif ( ! file_exists( $directory_path ) ) {\n\t\t\tmkdir( $directory_path );\n\t\t\t// @chmod( $directory_path, $permission );\n\t\t}\n\n\t\treturn $directory_path;\n\t}",
"private function uploadFolder()\n {\n return \"instagram/{$this->InstagramUserID}\";\n }",
"function getOrCreateUploadDirectory() {\r\n\t\t$structure = func_get_args();\r\n\t\t// Constructing the whole structure, starting at files/\r\n\t\t$fullPath = 'files/';\r\n\t\t$tmpUmask = umask(0); // Little trick to correctly set the chmod\r\n\t\tforeach($structure as $path) {\r\n\t\t\t// Don't allow for suspicious structure\r\n\t\t\tif ($path=='..') return false;\r\n\r\n\t\t\t// Creating directory if not existing\r\n\t\t\t$fullPath.=$path.'/';\r\n\t\t\tif (!file_exists(WWW_ROOT.$fullPath) && !mkdir(WWW_ROOT.$fullPath, 0777)) {\r\n\t\t\t\tumask($tmpUmask);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tumask($tmpUmask);\r\n\t\treturn $fullPath;\r\n\t}",
"function createAlbum($inputArr) {\n \n $ro = new BaseRO();\n $aname = $inputArr[\"name\"];\n\n $oldumask = umask(0); \n $ro->success = mkdir(\"Pics/$aname\", 0777);\n if (!($ro->success)) {\n $ro->retcode = 2;\n }\n umask($oldumask); \n\n return $ro;\n}"
]
| [
"0.65853244",
"0.6515474",
"0.6514153",
"0.64657354",
"0.6454985",
"0.6272955",
"0.6229999",
"0.6226839",
"0.6220598",
"0.6215045",
"0.6202179",
"0.61043835",
"0.60982805",
"0.6092638",
"0.6060618",
"0.6032633",
"0.6025112",
"0.5992848",
"0.59551376",
"0.59467536",
"0.59328866",
"0.5912507",
"0.5871469",
"0.58536613",
"0.5852235",
"0.5852209",
"0.58447",
"0.584467",
"0.5834573",
"0.58122945"
]
| 0.6823081 | 0 |
Get from database all active storages | protected function getAllActiveStorages(){
$storages = array();
$data = $this->db->from('storages')->where(array('status' => 1, 'for_simple_storage' => 1))->get()->all();
foreach ($data as $idx => $storage){
$storages[$storage['storage_name']] = $storage;
}
return $storages;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function getAllActiveStorages()\n {\n\n $storages = array();\n\n $data = ORM::for_table('storages')->where_any_is([\n ['status' => 1, 'for_records' => 1]\n /* ['stream_server_type' => NULL,'status' => 1, 'for_records' => 1],\n ['stream_server_type' => '','status' => 1, 'for_records' => 1]*/\n ])->find_many();\n\n\n foreach ($data as $idx => $storage) {\n $storages[$storage['storage_name']] = $storage;\n $storages[$storage['storage_name']]['load'] = $this->getStorageLoad($storage);\n }\n\n $storages = $this->sortByLoad($storages);\n\n return $storages;\n }",
"public function getAll()\n {\n return $this->storage;\n }",
"public function all(): array\n {\n return $this->storage;\n }",
"protected function fetchStorageRecords() {}",
"public function getFileStorages() {}",
"public function getItems(): array\n\t{\n\t\treturn $this->storage->all();\n\t}",
"public function getStorage();",
"public function getStorage();",
"public function getStorages()\n {\n $result = [];\n foreach ($this->_storages as $storageName => $storageData) {\n $result[$storageName] = $this->getStorage($storageName);\n }\n return $result;\n }",
"public function findAll()\n {\n return DatabaseBackup::where('status', 1)\n ->where('user_id', Auth::user()->id)\n ->orderBy('id','desc')\n ->get();\n }",
"function getStorage() ;",
"public function getStorage() {}",
"public function getStorage() {}",
"public function getStorage() {}",
"public function getAllFunc(){\n $result = $this->db->query('SELECT * FROM storage');\n while($row = $result->fetchArray()){\n echo $row['name'] . \" \" . $row['value'] . PHP_EOL;\n }\n }",
"abstract public function getStoragePids();",
"public static function getStorage() {}",
"private function getAllGoodStoragesForMediaFromCache(){\n \n $cache = array();\n \n foreach ($this->getAllCacheKeys() as $key){\n \n $storage_cache = $this->db->from('storage_cache')\n ->where(array(\n 'cache_key' => $key,\n 'status' => 1,\n 'changed>' => date(Mysql::DATETIME_FORMAT, time() - $this->cache_expire_h*3600)\n ))\n ->get()\n ->all();\n \n if(!empty($storage_cache)){\n $storage_cache = $storage_cache[0];\n $storage_data = unserialize($storage_cache['storage_data']);\n if (is_array($storage_data) && !empty($storage_data) && !empty($this->stb_storages[$storage_cache['storage_name']])){\n $cache[$storage_cache['storage_name']] = $storage_data;\n $cache[$storage_cache['storage_name']]['load'] = $this->getStorageLoad($this->storages[$storage_cache['storage_name']]);\n }\n }\n \n }\n return $cache;\n }",
"public function getALLStore();",
"function getStorage();",
"public static function getFiles()\n\t{\n\t\t$result = Array();\n\t\t$files = sfCore::$db->query(\"SELECT * FROM `swoosh_file_storage`\")->asObjects();\n\t\tforeach($files as $file){\n\t\t\t$sfFileStorageItem = sfCore::make('sfFileStorageItem');\n\t\t\t$sfFileStorageItem->loadFromObject($file);\n\t\t\t$result[] = $sfFileStorageItem;\n\t\t}\n\t\treturn $result;\n\t}",
"public function getAllFiles(){\n $user = auth()->user();\n $cloud = CloudFile::where('user_id', $user->id);\n $active = $cloud->where('active',true)->get();\n $trash = $cloud->where('active',true)->onlyTrashed()->get();\n\n return $this->respondWithSuccess('Files details',[\n 'active'=>$active,'trash'=>$trash]);\n }",
"private function getAllCacheKeys(){\n $keys = array();\n foreach ($this->storages as $name => $storage){\n $keys[] = $this->getCacheKey($name);\n }\n return $keys;\n }",
"public function listStorageAccounts()\n {\n \t$response = $this->_performRequest(self::OP_STORAGE_ACCOUNTS);\n\n \tif ($response->isSuccessful()) {\n\t\t\t$result = $this->_parseResponse($response);\n\n \t\tif (!$result->StorageService) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t if (count($result->StorageService) > 1) {\n \t\t $xmlServices = $result->StorageService;\n \t\t} else {\n \t\t $xmlServices = [$result->StorageService];\n \t\t}\n\n\t\t\t$services = [];\n\t\t\tif (!is_null($xmlServices)) {\n\t\t\t\tfor ($i = 0; $i < count($xmlServices); $i++) {\n\t\t\t\t\t$services[] = new Zend_Service_WindowsAzure_Management_StorageServiceInstance(\n\t\t\t\t\t (string)$xmlServices[$i]->Url,\n\t\t\t\t\t (string)$xmlServices[$i]->ServiceName\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $services;\n\t\t} else {\n\t\t\tthrow new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));\n\t\t}\n }",
"public function getAllUploads() {\n return Upload::all();\n }",
"public function getStorageSiterootPids() {}",
"public function get_all(){\n $cache_data_list=[];\n if($this->driver=='file'){\n foreach ($cache_list=$this->file->file_walk($this->path) as $value){\n $cache_data_list[]=$this->file->read_file($value);\n }\n }\n if($this->driver==\"redis\"){\n foreach ($this->redis->hGetAll($this->path) as $key=>$value){\n $cache_data_list[]=$value;\n }\n }\n return $cache_data_list;\n }",
"public function getStorage()\n {\n return $this->get(self::_STORAGE);\n }",
"public function getStorages($limit = 1000) {\n $storages = null;\n $rows = $this->getDatabaseConnection()->exec_SELECTgetRows(\n '*',\n 'sys_file_storage',\n 'deleted = 0',\n '',\n '',\n $limit,\n 'uid'\n );\n if (!empty($rows)) {\n $storages = [];\n foreach ($rows as $row) {\n $storages[$row['uid']] = $row;\n }\n }\n return $storages;\n }",
"protected function getStorageInfo() {\n\t\t$dirInfo = \\OC\\Files\\Filesystem::getFileInfo('/', false);\n\t\treturn \\OC_Helper::getStorageInfo('/', $dirInfo);\n\t}"
]
| [
"0.8027531",
"0.7727403",
"0.7441633",
"0.7193258",
"0.7138391",
"0.69295883",
"0.6898831",
"0.6898831",
"0.68332255",
"0.66737086",
"0.6664884",
"0.6661472",
"0.66614026",
"0.6661345",
"0.6588809",
"0.65485406",
"0.64941925",
"0.6446964",
"0.6399013",
"0.6375021",
"0.63674444",
"0.6294887",
"0.6265942",
"0.6234447",
"0.62141716",
"0.6193233",
"0.6166196",
"0.6097734",
"0.60909986",
"0.60618955"
]
| 0.8359823 | 0 |
Get all good for media by id interviewing all good storages | public function getAllGoodStoragesForMediaFromNet($media_id, $force_moderator = false){
$this->initMedia($media_id);
$good_storages = array();
if ($this->stb->isModerator() || $force_moderator){
$storages = $this->storages;
}else{
$storages = array_diff_assoc($this->storages, $this->moderator_storages);
}
foreach ($storages as $name => $storage){
$raw = $this->checkMediaDir($name, $this->media_name);
if (!$raw || count($raw['files']) > 1 && empty($raw['series'])){
continue;
}
if (count($raw['files']) > 0){
$raw['first_media'] = $raw['files'][0]['name'];
$this->saveSeries($raw['series']);
$raw['load'] = $this->getStorageLoad($storage);
$raw['for_moderator'] = $storage['for_moderator'];
$good_storages[$name] = $raw;
}
}
$this->checkMD5Sum($good_storages);
if (!$this->stb->isModerator()){
$this->setStorageCache($good_storages);
}
if (method_exists($this, 'setStatus')){
$status = intval($good_storages);
if ($status == 1 && !array_diff_assoc($good_storages, $this->moderator_storages)){
$status = 3;
}
$this->setStatus($status);
}
return $good_storages;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getMediaItem($id);",
"function getPhotosOfMedia($idMedia){\r\n\t\t$connectService = new ConnectionBDD();\r\n\t\t$connect = $connectService->connect();\r\n\r\n\t\t$result = mysql_query(\"select * from media_photos, media where FK_ID_MEDIA = ID_MEDIA and ID_MEDIA = \" . $idMedia);\r\n\t\t$tab = new Data();\r\n\t\tif(mysql_num_rows($result)==0){\r\n\t\t\t// on liste le repertoire\r\n\t\t\t$result = mysql_query(\"select * from media where ID_MEDIA = \" . $idMedia);\r\n\t\t\t$nb = mysql_num_rows($result);\r\n\t\t\tif($nb==0){\r\n\t\t\t\t$connectService->close();\r\n\t\t\t\treturn $tab;\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t$tab->addInfo(\"root\",$this->directory . mysql_result($result,0,\"DIR_MEDIA\"));\r\n\t\t\t\t$tab->addInfo(\"titre\",mysql_result($result,0,\"DESCRIPTION\"));\r\n\t\t\t\t$tab->addInfo(\"group\",mysql_result($result,0,\"FK_ID_GROUP\"));\r\n\t\t\t\t$connectService->close();\r\n\t\t\t\t$tab->addInfo(\"photos\",$this->getPhotosOfDir($tab->getInfo(\"root\")));\r\n if($idMedia == 617){\r\n $tab->addInfo(\"root\",\"http://chaines.cardans.s3-website-eu-west-1.amazonaws.com/PHOTOS/2012_11_24-FONTAINEBLEAU\");\r\n }\r\n\t\t\t\t$tab->addInfo(\"type\",\"scan\");\r\n\t\t\t\treturn $tab;\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"private function getAllGoodStoragesForMediaFromCache(){\n \n $cache = array();\n \n foreach ($this->getAllCacheKeys() as $key){\n \n $storage_cache = $this->db->from('storage_cache')\n ->where(array(\n 'cache_key' => $key,\n 'status' => 1,\n 'changed>' => date(Mysql::DATETIME_FORMAT, time() - $this->cache_expire_h*3600)\n ))\n ->get()\n ->all();\n \n if(!empty($storage_cache)){\n $storage_cache = $storage_cache[0];\n $storage_data = unserialize($storage_cache['storage_data']);\n if (is_array($storage_data) && !empty($storage_data) && !empty($this->stb_storages[$storage_cache['storage_name']])){\n $cache[$storage_cache['storage_name']] = $storage_data;\n $cache[$storage_cache['storage_name']]['load'] = $this->getStorageLoad($this->storages[$storage_cache['storage_name']]);\n }\n }\n \n }\n return $cache;\n }",
"function getMedia($mediaId)\n{\n\tglobal $db;\n if(is_array($mediaId))\n {\n // first check the array\n if(empty($mediaId))\n return false;\n\n $mediaIdArray = array();\n\n foreach($mediaId as $mediaIdEntry)\n {\n // numeric entries only\n if(is_numeric($mediaIdEntry))\n $mediaIdArray[] = $mediaIdEntry;\n }\n\n $where = \" media.id in (\".implode(', ',$mediaIdArray).\")\";\n }\n else\n {\n //single id\n $where = \" media.id = \".(0+$mediaId);\n }\n\n\n\n\t$query = \"\n\t\t SELECT\n media.*,\n media_type.content_type\n FROM\n\t\t `\".$GLOBALS['dataBaseToUse'].\"`.`media`\n LEFT JOIN `\".$GLOBALS['dataBaseToUse'].\"`.`media_type` ON media.id_media_type = media_type.id\n\t\t WHERE\n\t\t \".$where.\"\n AND media.deleted = 0\n\t \";\n\n\t$result = $db -> query($query);\n\n // initializing returndata\n $return = array();\n\n while($row = mysqli_fetch_assoc($result))\n {\n $return[$row['id']] = $row;\n }\n\n if(!empty($return))\n {\n //get context information for media entry\n\n $query = \"\n SELECT\n media_context.*\n FROM\n `\".$GLOBALS['dataBaseToUse'].\"`.`media_context`\n WHERE\n id_media in (\".implode(', ',array_keys($return)).\")\n AND id_media_cluster = 0\n AND deleted = 0\n \";\n\n $result = $db -> query($query);\n while($row = mysqli_fetch_assoc($result))\n {\n $return[$row['id_media']]['contextInformation'][$row['id_language']] = $row;\n }\n\t }\n\n\t return $return;\n}",
"public function findAllMediaUsed(): array\n {\n $allMediaUser = [];\n\n function buildMediaArrayEntries($mediaObject){\n\n $objectNamespace = get_class($mediaObject);\n $parsedNamespace=explode('\\\\',$objectNamespace);\n $type = strtolower( $parsedNamespace[ count( $parsedNamespace ) -1 ] );\n $media = $mediaObject->getMedia();\n $filename = $media->getId().'.'.$mediaObject->getExtension();\n $path = '/medias/quick/'.$type.'s/low/'.$filename;\n\n if(file_exists('C:/inetpub/wwwroot/infowaytemplate/public'.$path)){\n return [\n 'id'=> $media->getId(),\n 'type' => $type,\n 'name' => $media->getFilename(),\n 'path' => $path,\n 'elements' => [\n 'id' => $mediaObject->getId(),\n 'type' => $type,\n 'content' => $media->getId().'.'.$mediaObject->getExtension(),\n 'incrustOrder' => 0,\n ]\n ];\n }else return false;\n }\n $images = $this->getEntityManager()->getRepository(Image::class)->findAllTemplateImages();\n\n foreach($images as $image){\n $media = buildMediaArrayEntries($image);\n if( $media ) $allMediaUser[] = $media;\n }\n $videos = $this->getEntityManager()->getRepository(Video::class)->createQueryBuilder('v')->leftjoin('v.media','media')->where('media != :type')->setParameter('type','sync')->getQuery()->getResult();\n\n foreach($videos as $video){\n $media = buildMediaArrayEntries($video);\n if( $media ) $allMediaUser[] = $media;\n }\n\n\n\n // $allMediaUser = [];\n // $qb = $this->createQueryBuilder('m');\n // $qb->where('m.type != :mediatype')\n // ->setParameter('mediatype','sync');\n // $medias = $qb->getQuery()->getResult();\n //\n //\n // foreach ($medias as $media)\n // {\n // $medias = ['images'=>[], 'videos'=>{}]\n //\n // $image = $this->getEntityManager()->getRepository(Image::class)->findOneByMedia($media);\n //\n // if(!$image)\n // {\n // $video = $this->getEntityManager()->getRepository(Video::class)->findOneByMedia($media);\n //\n // //dd($video);\n // if($video)\n // $allMediaUser[] = [\n // 'id' => $media->getId(),\n // 'type' => 'video',\n // 'name' => $media->getFilename(),\n // 'elements' => [\n // [\n // 'id' => $video->getId(),\n // 'type' => 'video',\n // 'content' => $media->getId() . '.' . $video->getExtension(),\n // //'content' => \"67.png\",\n // 'incrustOrder' => 0\n // ]\n // ]\n // ];\n // //throw new NotFoundHttpException(sprintf(\"Error ! Media '%d' not found in Image and Video entities !\", $media->getId()));\n //\n // }\n // else\n // $allMediaUser[] = [\n // 'id' => $media->getId(),\n // 'type' => 'image',\n // 'name' => $media->getFilename(),\n // 'elements' => [\n // [\n // 'id' => $image->getId(),\n // 'type' => 'image',\n // 'content' => $media->getId() . '.' . $image->getExtension(),\n // //'content' => \"67.png\",\n // 'incrustOrder' => 0\n // ]\n // ]\n // ];\n //\n // }\n //\n\n return $allMediaUser;\n\n }",
"public function getMedia($aid) {\n\t\t$this->Media->recursive = -1;\n\t\treturn $this->Media->find('all', array('conditions' => array('Media.model' => 'album' , 'Media.model_id' => Sanitize::clean(intval($aid)))));\n\t}",
"function _getThumbnails($id)\n {\n global $serendipity;\n\n $file = serendipity_fetchImageFromDatabase($id);\n $name = $file['name'];\n\n $imagePath = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['realname'];\n $thumbnailBase = str_replace($file['extension'], '', $imagePath);\n $uploadDir = dirname($imagePath);\n\n return glob(\"$thumbnailBase*{$file['thumbnail_name']}.{$file['extension']}\");\n }",
"function get_by_key($key,$id){\n\t\t$data = array();\n\t\t$sql = \"SELECT * FROM dinamic_media WHERE media_key='\".$key.\"' AND media_keyid=\".$id;\n\t\t$data = $this->mysql->get_data($sql,'clean');\n\t\treturn $data;\n\t}",
"function getMediaRatingsById ( $id )\n {\n try\n {\n $result = $this->apiCall('get',\"{$this->api['syndication_url']}/resources/media/{$id}/ratings.json\");\n return $this->createResponse($result,'get Media Alternate Images','Id');\n } catch ( Exception $e ) {\n return $this->createResponse($e,'API Call');\n }\n }",
"function getMediaData($storyid){\r\n\r\n\t\t\t$result\t= array();\r\n\r\n\t\t\t$res \t= array();\r\n\r\n\t\t\t$ci \t= & get_instance();\r\n\r\n\t\t\t$ci->db->select('images, videos, audios, attachments, demovideos, demoaudios, demoattachments');\r\n\r\n\t\t\t$ci->db->where_in('story_id',$storyid);\r\n\r\n\t\t\t$query = $ci->db->get('buzz_media_master');\r\n\r\n\t\t\t$res \t= $query->result_array();\r\n\r\n\t\t\tif(count($res)>0){\r\n\r\n\t\t\t\t$result = $res[0];\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//echo $ci->db->last_query();exit;\r\n\r\n\t\t\treturn $result; \r\n\r\n\t\t}",
"function get_all($version_id) {\r\n $f3 = \\Base::instance();\r\n\r\n $files_db=new DB\\SQL\\Mapper($f3->get('DB'),'files');\r\n $files=$files_db->find(array('version_id=?',$version_id),array(\r\n 'order' => 'filesize DESC'\r\n ));\r\n\r\n $out = array();\r\n foreach($files as $file)\r\n {\r\n $out[] = array( // todo should this just call get() instead?\r\n \"file_id\"=>$file->file_id,\r\n \"version_id\"=>$version_id,\r\n \"quality\"=>$file->quality,\r\n \"complete\"=>$file->complete,\r\n \"hidden\"=>$file->hidden,\r\n \"is_master\"=>$file->is_master,\r\n \"path\"=>$file->path,\r\n \"full_path\"=>$f3->get('media_root').'/'.$file->path, // todo check full_path still exists, is sanitized\r\n \"filesize\"=>$file->filesize,\r\n \"filesize_h\"=>format_bytes($file->filesize,0)\r\n );\r\n }\r\n\r\n return $out;\r\n }",
"function getRelatedMediaById ( $id )\n {\n try\n {\n $result = $this->apiCall('get',\"{$this->api['syndication_url']}/resources/media/{$id}/relatedMedia.json\");\n return $this->createResponse($result,'get Media Alternate Images','Id');\n } catch ( Exception $e ) {\n return $this->createResponse($e,'API Call');\n }\n }",
"public function getMedia($id)\n {\n $token = $this->getAccessToken();\n $url = \"https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=$token&media_id=$id\";\n $result = $this->get($url, $file = true);\n\n $error = !is_array($result) ? json_decode($result) : ''; \n if(!empty($error->errcode)) return false;\n return $result;\n }",
"public function get_images_byID($id) {\n $sql = \"select * from advertisement_image where AdsID=? and StatusID <>3\";\n $data = $this->db->query($sql, array($id));\n return $data->result();\n }",
"function get_all_media() {\n\t\treturn $this->mediaFiles;\n\t}",
"public function get_all_img_byID($id) {\n $sql = \"select * from advertisement_image where AdsID=? and StatusID <>3\";\n $data = $this->db->query($sql, array($id));\n return $data->result();\n }",
"function buscarPorAmbos($id, $url) {\r\n $query = \"SELECT * FROM medios WHERE id_Medio LIKE \".$id.\" AND url LIKE '\".$url.\"';\";\r\n $database = new Database();\r\n $resultado = $database->getConn()->query($query);\r\n \r\n $arr = array();\r\n \r\n while ($row = $resultado->fetch(PDO::FETCH_ASSOC)) {\r\n $medio = new Medio();\r\n $medio->id=$row[\"id_Medio\"];\r\n $medio->url=$row[\"url\"];\r\n $medio->tipo=$row[\"id_Tipo\"];\r\n array_push($arr, $medio);\r\n }\r\n $paraDevolver = json_encode($arr);\r\n return $paraDevolver;\r\n\r\n }",
"public function id($id)\n\t{\n\t\treturn $this->media($id);\n\t}",
"function getMediaById ( $id )\n {\n try\n {\n $result = $this->apiCall('get',\"{$this->api['syndication_url']}/resources/media/{$id}.json\");\n return $this->createResponse($result,'get MetaData','Id');\n } catch ( Exception $e ) {\n return $this->createResponse($e,'API Call');\n }\n }",
"abstract public function getStoragePids();",
"public static function findMedia($id)\n {\n $fields = array('___kp_MediaId');\n $values = array($id);\n $medRecord = StudentModel::findRecordByField('Media_MED', $fields, $values, count($fields));\n return $medRecord[0]->getField('mediaFile_kqr');\n }",
"public static function get_all($user_id, $table)\n {\n $where = array(\"user_id\" => $user_id);\n $result = DatabaseService::get($table, $where, \"default\");\n if($result === false || $result === null) {\n APIService::response_fail(HttpFailCodes::http_response_fail()->get_media);\n }else{\n return Media::build_media_array($table, $result);\n }\n }",
"function getBandwidthMedia ($mediaUris) {\n foreach ($mediaUris as $key => $value) {\n // Ignore text and smil attachments.\n if (!in_array(substr($value, -4), array(\"smil\", \".txt\"))){\n // Pull media\n $ch=curl_init($value);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n curl_setopt($ch, CURLOPT_USERPWD, BANDWIDTH_API_TOKEN . \":\" . BANDWIDTH_API_SECRET);\n $data = curl_exec($ch);\n\n if (!$data) {\n error_log(\"Failed to download $value\");\n error_log(print_r(curl_error($ch),true));\n } \n \n curl_close($ch);\n\n $destination = substr(strrchr($value, '/'), 1);\n $file = fopen($destination, \"w+\");\n fputs($file, $data);\n fclose($file);\n\n $result[] = $destination;\n }\n }\n return $result;\n}",
"public function getMediaFolder($id){\n return MediaFolder::find($id);\n\t\t\n }",
"function getAllMedia() \n\t\t{\n\t\t\t\n\t\t\ttry{\n\n\t\t\t\t$query = $this->_db->prepare( \"SELECT * FROM media ORDER BY media_date DESC\" );\n\n\t\t\t\t$query->execute();\n\n\t\t\t\t$data = $query->fetchAll();\n\t\t\t\t\n\t\t\t\treturn $data;\n\n\t\t\t} catch ( PDOException $e ) {\n\n\t\t\t\techo $e->getMessage();\n\n\t\t\t}\n\t\t\t\n\t\t}",
"public function getUnMedia($id) {\n $pdoStat = PdoMedProjet::$conn->prepare('SELECT * FROM media WHERE media.id_media = :id');\n $pdoStat->bindParam(':id', $id, PDO::PARAM_INT);\n $pdoStat->execute();\n return $pdoStat->fetch();\n }",
"function getMediaByTagId ( $id )\n {\n try\n {\n $result = $this->apiCall('get',\"{$this->api['syndication_url']}/resources/tags/{$id}/media.json\");\n return $this->createResponse($result,'get MetaData','Tag Id');\n } catch ( Exception $e ) {\n return $this->createResponse($e,'API Call');\n }\n }",
"function buscarPorId($id) {\r\n $query = \"SELECT * FROM medios WHERE id_Medio LIKE \".$id.\";\";\r\n $database = new Database();\r\n $resultado = $database->getConn()->query($query);\r\n \r\n $arr = array();\r\n \r\n while ($row = $resultado->fetch(PDO::FETCH_ASSOC)) {\r\n $medio = new Medio();\r\n $medio->id=$row[\"id_Medio\"];\r\n $medio->url=$row[\"url\"];\r\n $medio->tipo=$row[\"id_Tipo\"];\r\n array_push($arr, $medio);\r\n }\r\n $paraDevolver = json_encode($arr);\r\n return $paraDevolver;\r\n }",
"function selectMedia($parameters)\n{\n\tglobal $db;\n // check the parameters and add to where clause\n $where = '';\n\n // id_project\n if(!empty($parameters['id_project']))\n {\n if(is_array($parameters['id_project']))\n {\n $createdByArray = array();\n foreach($parameters['id_project'] as $id_project)\n {\n if(is_numeric($id_project))\n $createdByArray[] = $id_project;\n }\n $where .= \" AND id_project in (\".implode(', ',$createdByArray).\") \";\n }\n else\n $where .= \" AND id_project = \".(0+$parameters['id_project']).\" \";\n }\n\n //updated since\n if(!empty($parameters['updatedSince']))\n {\n // has to be unix timestamp\n if(is_numeric($parameters['updatedSince']))\n $where .= \" AND ( created_at > '\".date('Y-m-d H:i:s',$parameters['updatedSince']).\"' or updated_at > '\".date('Y-m-d H:i:s',$parameters['updatedSince']).\"' )\";\n }\n\n //id media\n if(!empty($parameters['idMedia']))\n {\n if(is_array($parameters['idMedia']))\n {\n $mediaIdArray = array();\n\n foreach($parameters['idMedia'] as $mediaIdEntry)\n {\n // numeric entries only\n if(is_numeric($mediaIdEntry))\n $mediaIdArray[] = $mediaIdEntry;\n }\n\n $where .= \" AND media.id in (\".implode(', ',$mediaIdArray).\")\";\n }\n else\n {\n //single id\n $where .= \" AND media.id = \".(0+$parameters['idMedia']);\n }\n\n }\n\n // media type\n if(!empty($parameters['mediaType']))\n {\n $mediaType = addslashes($parameters['mediaType']);\n\n // check in DB for entries matching the mediatype\n $query = \"\n SELECT\n `id`\n FROM\n `\".$GLOBALS['dataBaseToUse'].\"`.`media_type`\n WHERE\n `deleted` = 0\n AND (`content_type` like '\".$mediaType.\"' or `file_ending` = '\".$mediaType.\"')\n \";\n\n $result = $db -> query($query);\n\n $mediaTypeIds = array();\n while($row = mysqli_fetch_assoc($result))\n {\n $mediaTypeIds[] = $row['id'];\n }\n\n // if we have results use id_media_type else try to find the given media_type as file ending\n if(!empty($mediaTypeIds))\n $where .= \" AND `media`.`id_media_type` in (\".implode(', ',$mediaTypeIds).\") \";\n elseif($mediaType != 'all')\n $where .= \" AND `media`.`file_ending` = '\".$mediaType.\"' \";\n\n\n\n }\n\n // find media by string\n if(!empty($parameters['searchAll']))\n {\n // there are two possibilities: find string in keyword, file_ending or in context-info\n // first media_context\n\n // check in DB for entries matching the mediatype\n $query = \"\n SELECT\n `id_media`\n FROM\n `\".$GLOBALS['dataBaseToUse'].\"`.`media_context`\n WHERE\n `deleted` = 0\n AND (`title` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `subtitle` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `description` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `copyright` like '%\".addslashes($parameters['searchAll']).\"%')\n \";\n\n\n $result = $db -> query($query);\n\n $mediaIdArray = array(0);\n while($row = mysqli_fetch_assoc($result))\n {\n $mediaIdArray[] = $row['id_media'];\n }\n\n $where .= \" AND (\n `media`.`id` in (\".implode(', ',$mediaIdArray).\")\n OR\n `keywords` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `file_ending` like '\".addslashes($parameters['searchAll']).\"')\";\n\n }\n\n // paging contains results per block as blocksize and number of block used for the query\n if(!empty($parameters['paging']))\n {\n // blocksize from setting or standard\n if(!empty($parameters['paging']['blocksize']))\n $blocksize = 0+$parameters['paging']['blocksize'];\n else\n $blocksize = 20;\n\n if(!empty($parameters['paging']['block']))\n $block = 0+$parameters['paging']['block'];\n else\n $block = 1;\n\n $parameters['limit'] = \" LIMIT \".(($block-1) * $blocksize).\", \".$blocksize.\" \";\n }\n\n if(!empty($parameters['order']))\n $where .= addslashes($parameters['order']);\n\n if(!empty($parameters['limit']))\n $where .= addslashes($parameters['limit']);\n\n // select media\n\n // get ids for media entries\n\t$query = \"\n\t\t SELECT\n SQL_CALC_FOUND_ROWS\n `media`.`id`\n FROM\n\t\t `\".$GLOBALS['dataBaseToUse'].\"`.`media`\n\n\t\t WHERE\n\t\t `media`.`deleted` = 0\n \".$where.\"\n\t \";\n\n\t$result = $db -> query($query);\n\n\n $return = array();\n\n // reports\n $return['parameters'] = $parameters;\n $return['numResults'] = '';\n\n while($row = mysqli_fetch_assoc($result))\n {\n $return['data'][$row['id']] = array();\n }\n\n // number of possible results\n $countResult = $db -> query(\"SELECT FOUND_ROWS()\");\n $countArray = $row = mysqli_fetch_assoc($countResult);\n $return['numResults'] = $countArray['FOUND_ROWS()'];\n\n // now get the values\n if(!empty($return['data']))\n {\n $mediaData = getMedia(array_keys($return['data']));\n #print_r($mediaData);\n foreach($mediaData as $idMedia => $row)\n $return['data'][$idMedia] = $row;\n }\n\n\n return $return;\n\n}",
"public function fetchMediaInformation()\n {\n $provider_tasks = $this->getProviderTasks();\n if (!empty($provider_tasks)) { //Skip all downloads if no provider task, no adjudication needed\n $journal_entry_photos = $this->getJournalEntryPhotos();\n foreach($provider_tasks as $ind => $task) { //Iterate through provider tasks (max 3)\n if($task['status'] == 'inProgress') { // if the provider task has NOT been completed yet we want to save journalEntryPhoto\n if(!isset($journal_entry_photos[$ind]['measurements'])) {\n $user = $this->patient_json['user']['uuid'];\n $this->getClient()->getEm()->emError(\"No journal entry photos present for provider task (SHOULD NEVER OCCUR) Check pattern. Patient UUID: $user \");\n continue;\n }\n\n foreach($journal_entry_photos[$ind]['measurements'] as $mind => $measurement) { //iterate over all measurements for a corresponding task containing a photo, we have the match via $ind\n if ($measurement['type'] == 'journalEntryPhoto') {\n $journal_entry_photos[$ind]['media'] = new Media($this->getClient(), $measurement['media']['title'], $measurement['media']['href']); //create new key to save media object\n } elseif ($measurement['surveyQuestionId'] == 'test_conf') {\n $journal_entry_photos[$ind]['confidence'] = $measurement['json'];\n } elseif($measurement['surveyQuestionId'] == 'results') {\n $journal_entry_photos[$ind]['results'] = $measurement['json'][0];\n }\n }\n }\n }\n //push updates to journal photos\n $this->setJournalEntryPhotos($journal_entry_photos);\n }\n }"
]
| [
"0.69463235",
"0.6834279",
"0.6812877",
"0.6749961",
"0.672545",
"0.6480329",
"0.64071333",
"0.6338827",
"0.62178814",
"0.61488926",
"0.6122283",
"0.6119345",
"0.6108753",
"0.60982984",
"0.6050053",
"0.6049237",
"0.6037974",
"0.6026036",
"0.59922504",
"0.59840405",
"0.59445363",
"0.59113497",
"0.58952177",
"0.5880124",
"0.58545",
"0.5841628",
"0.5839571",
"0.5816248",
"0.5780242",
"0.57731086"
]
| 0.684092 | 1 |
Start md5sum for media in all storages | public function startMD5SumInAllStorages($media_name){
foreach ($this->storages as $name => $storage){
try {
$this->startMD5Sum($name, $media_name);
}catch (Exception $exception){
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function checkMD5Sum($storages_from_net){\n $storages_from_cache = $this->getAllGoodStoragesForMediaFromCache();\n foreach ($storages_from_net as $name => $storage){\n if (array_key_exists($name, $storages_from_cache)){\n foreach ($storages_from_net[$name]['files'] as $net_file){\n foreach ($storages_from_cache[$name]['files'] as $cache_file){\n if (($cache_file['name'] == $net_file['name']) && ($cache_file['md5'] != $net_file['md5']) && !empty($net_file['md5']) && !empty($cache_file['md5'])){\n $this->addToLog('File '.$cache_file['name'].' in '.$this->media_name.' on '.$name.' changed '.$cache_file['md5'].' => '.$net_file['md5']);\n }\n }\n }\n }\n }\n }",
"public function startMD5Sum($storage_name, $media_name){\n try {\n //$this->clients[$storage_name]->startMD5Sum($media_name);\n $this->clients[$storage_name]->resource($this->media_type.'_md5_checker')->create(array('media_name' => $media_name));\n }catch (Exception $exception){\n $this->parseException($exception);\n throw new Exception($exception->getMessage());\n }\n }",
"public function hashFileMd5()\n {\n $this->hash_file_md5 = null;\n\n if ($this->exists === true) {\n\n } elseif ($this->is_file === true) {\n\n } else {\n return;\n }\n\n $this->hash_file_md5 = md5_file($this->temp);\n\n return;\n }",
"public function stopMD5Sum($storage_name, $media_name){\n try {\n //$this->clients[$storage_name]->stopMD5Sum($media_name);\n $this->clients[$storage_name]->resource($this->media_type.'_md5_checker')->ids($media_name)->delete();\n }catch (Exception $exception){\n $this->parseException($exception);\n }\n }",
"public function getMd5(): string;",
"public function getMd5Checksum()\r\n {\r\n return md5_file($this->filename);\r\n }",
"function compute_md5sum(&$data) {\n if (function_exists(\"hash_init\") && is_resource($data)) {\n $ctx = hash_init('md5');\n while (!feof($data)) {\n $buffer = fgets($data, 65536);\n hash_update($ctx, $buffer);\n }\n $md5 = hash_final($ctx, false);\n rewind($data);\n } elseif ((string) is_file($data)) {\n $md5 = md5_file($data);\n } else {\n $md5 = md5($data);\n }\n\n return $md5;\n}",
"public function addMd5checksums( $value){\n return $this->_add(1, $value);\n }",
"public function addMd5checksums( $value){\n return $this->_add(1, $value);\n }",
"public function update()\n {\n $this->storage->set(self::STORAGE_KEY, md5(time()));\n }",
"public function getT3xfilemd5() {}",
"public function hash()\n {\n return $this->adapter->md5File($this->path);\n }",
"function canMd5()\n {\n return false;\n }",
"public function get_file_md5() {\n\t\treturn md5_file( $this->file );\n\t}",
"public function hash() {\n\t\t$hash = parent::get('hash');\n\t\tif($hash) return $hash; \t\n\t\t$this->set('hash', md5($this->basename())); \n\t\treturn parent::get('hash'); \n\t}",
"public function hasMd5() {\n return $this->_has(4);\n }",
"public function getMd5checksumsList(){\n return $this->_get(1);\n }",
"public function getMd5checksumsList(){\n return $this->_get(1);\n }",
"public function hasMd5checksums(){\n return $this->_has(1);\n }",
"public function hasMd5checksums(){\n return $this->_has(1);\n }",
"public function benchMd5(array $params): void\n {\n hash('md5', $params['string']);\n }",
"public function hash()\n\t\t{\n\t\t\tif (!$this->hash) {\n\t\t\t\t$this->hash = md5($this->name.'-'.$this->size);\n\t\t\t}\n\n\t\t\treturn $this->hash;\n\t\t}",
"public function getMd5()\n {\n return md5($this->accountNumber.$this->apiKey.$this->submission->get());\n }",
"public function hasMd5() {\n return $this->_has(7);\n }",
"public function getHash()\n\t{\n\t\t// Create a string that should uniquely represent the media instance.\n\t\t// We'll base it on the table name, concatenated with a '.', followed by the\n\t\t// ID value.\n\t\t$string = $this->getTable().'.'.$this->getKey();\n\n\t\t// We will use the SHA1 algorithm, as it is less prone to collision attacks,\n\t\t// while still being quick enough for mass hashing.\n\t\treturn hash('sha1', $string);\n\t}",
"public function md5Url($url) {\r\n\t\t$md5edurl['url'] = md5($url);\r\n\r\n\t\t$md5search = $this->find('count', \r\n\t\t\tarray('conditions' => array('unique' => $md5edurl['url'])),\r\n\t\t\tarray('recursive' => -1)\r\n\t\t);\r\n\r\n\t\tif ($md5search > 0) {\r\n\t\t\t$md5edurl['exists'] = true;\r\n\t\t} else {\r\n\t\t\t$md5edurl['exists'] = false;\r\n\t\t}\r\n\r\n\t\treturn $md5edurl;\r\n\t}",
"public function hasMd5checksum(){\n return $this->_has(3);\n }",
"public function hasMd5checksum(){\n return $this->_has(3);\n }",
"private function hashing() {\n\t\t$data = md5($this->name.$this->date);\n\t\t$data = md5($data);\n\t\t$data = strrev($data);\n\t\t//$data = md5($data);\n\t\t$data = strtoupper($data);\n\t\t//$data = strrev($data);\n\n\t\t$datatemp = NULL;\n\t\tfor($i=0; $i<=strlen($data); $i++) {\n\t\t\t$arr = substr($data, $i, 1);\n\t\t\tif($i == '4' || $i == '8' || $i == '12' || $i == '16' || $i == '20' || $i == '24' || $i == '28' || $i == '32') {\n\t\t\t\t$datatemp .= substr($this->strfinger, ($i/4)-1, 1);\t\n\t\t\t}\n\t\t\t$datatemp .= \"/%\".$this->combine[$arr];\n\t\t}\n\n\t\t$this->resulthashcode = substr($datatemp, 1, strlen($datatemp)-6);\n\t\t$this->result = true;\n\t}",
"private function mediaUpdate() {\n\t\t$this->s3->request = array(\n\t\t\t'access_key' => \\Crypt::encrypt($this->access_key),\n\t\t\t'secret' => \\Crypt::encrypt($this->secret),\n\t\t\t'region' => \\Aws\\Common\\Enum\\Region::US_EAST_1,\n\t\t\t'bucket' => $this->bucket,\n\t\t\t'prefix' => $this->prefix,\n\t\t);\n\t\t$this->s3->testConnection();\n\t\tif ($this->s3->response['connected'] === true) {\n\t\t\t//Show how many records we imported.\n\t\t\t$this->s3->listObjects();\n\t\t\t//Tell us how many media items we found.\n\t\t\t$this->info(sprintf('Found %d media items in this bucket', $this->s3->count));\n\t\t\t//Update images.\n\t\t\t$this->update();\n\t\t}\n\t}"
]
| [
"0.70602465",
"0.7027451",
"0.59443223",
"0.5830169",
"0.57904106",
"0.5705218",
"0.56679475",
"0.56391025",
"0.56391025",
"0.5630535",
"0.56230825",
"0.56227905",
"0.5614253",
"0.56000555",
"0.55348986",
"0.5520208",
"0.55091137",
"0.55091137",
"0.5469415",
"0.5469415",
"0.535539",
"0.53368145",
"0.5315278",
"0.52928036",
"0.5289659",
"0.52558637",
"0.52393556",
"0.52393556",
"0.52326566",
"0.52165675"
]
| 0.80169255 | 0 |
wrapper for srorage method, that start md5sum for media | public function startMD5Sum($storage_name, $media_name){
try {
//$this->clients[$storage_name]->startMD5Sum($media_name);
$this->clients[$storage_name]->resource($this->media_type.'_md5_checker')->create(array('media_name' => $media_name));
}catch (Exception $exception){
$this->parseException($exception);
throw new Exception($exception->getMessage());
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getMd5(): string;",
"public function startMD5SumInAllStorages($media_name){\n foreach ($this->storages as $name => $storage){\n try {\n $this->startMD5Sum($name, $media_name);\n }catch (Exception $exception){\n \n }\n }\n }",
"public function hash() {\n\t\t$hash = parent::get('hash');\n\t\tif($hash) return $hash; \t\n\t\t$this->set('hash', md5($this->basename())); \n\t\treturn parent::get('hash'); \n\t}",
"public function getT3xfilemd5() {}",
"public function hash()\n {\n return $this->adapter->md5File($this->path);\n }",
"private function checkMD5Sum($storages_from_net){\n $storages_from_cache = $this->getAllGoodStoragesForMediaFromCache();\n foreach ($storages_from_net as $name => $storage){\n if (array_key_exists($name, $storages_from_cache)){\n foreach ($storages_from_net[$name]['files'] as $net_file){\n foreach ($storages_from_cache[$name]['files'] as $cache_file){\n if (($cache_file['name'] == $net_file['name']) && ($cache_file['md5'] != $net_file['md5']) && !empty($net_file['md5']) && !empty($cache_file['md5'])){\n $this->addToLog('File '.$cache_file['name'].' in '.$this->media_name.' on '.$name.' changed '.$cache_file['md5'].' => '.$net_file['md5']);\n }\n }\n }\n }\n }\n }",
"function compute_md5sum(&$data) {\n if (function_exists(\"hash_init\") && is_resource($data)) {\n $ctx = hash_init('md5');\n while (!feof($data)) {\n $buffer = fgets($data, 65536);\n hash_update($ctx, $buffer);\n }\n $md5 = hash_final($ctx, false);\n rewind($data);\n } elseif ((string) is_file($data)) {\n $md5 = md5_file($data);\n } else {\n $md5 = md5($data);\n }\n\n return $md5;\n}",
"public function get_file_md5() {\n\t\treturn md5_file( $this->file );\n\t}",
"public function hashFileMd5()\n {\n $this->hash_file_md5 = null;\n\n if ($this->exists === true) {\n\n } elseif ($this->is_file === true) {\n\n } else {\n return;\n }\n\n $this->hash_file_md5 = md5_file($this->temp);\n\n return;\n }",
"public function getHash()\n\t{\n\t\t// Create a string that should uniquely represent the media instance.\n\t\t// We'll base it on the table name, concatenated with a '.', followed by the\n\t\t// ID value.\n\t\t$string = $this->getTable().'.'.$this->getKey();\n\n\t\t// We will use the SHA1 algorithm, as it is less prone to collision attacks,\n\t\t// while still being quick enough for mass hashing.\n\t\treturn hash('sha1', $string);\n\t}",
"public function getMd5Checksum()\r\n {\r\n return md5_file($this->filename);\r\n }",
"public function getMd5()\n {\n return md5($this->accountNumber.$this->apiKey.$this->submission->get());\n }",
"function canMd5()\n {\n return false;\n }",
"private function hashing() {\n\t\t$data = md5($this->name.$this->date);\n\t\t$data = md5($data);\n\t\t$data = strrev($data);\n\t\t//$data = md5($data);\n\t\t$data = strtoupper($data);\n\t\t//$data = strrev($data);\n\n\t\t$datatemp = NULL;\n\t\tfor($i=0; $i<=strlen($data); $i++) {\n\t\t\t$arr = substr($data, $i, 1);\n\t\t\tif($i == '4' || $i == '8' || $i == '12' || $i == '16' || $i == '20' || $i == '24' || $i == '28' || $i == '32') {\n\t\t\t\t$datatemp .= substr($this->strfinger, ($i/4)-1, 1);\t\n\t\t\t}\n\t\t\t$datatemp .= \"/%\".$this->combine[$arr];\n\t\t}\n\n\t\t$this->resulthashcode = substr($datatemp, 1, strlen($datatemp)-6);\n\t\t$this->result = true;\n\t}",
"function apply_forum_driver_md5_variant($data, $key)\n{\n if (method_exists($GLOBALS['FORUM_DRIVER'], 'forum_md5')) {\n return $GLOBALS['FORUM_DRIVER']->forum_md5($data, $key);\n }\n return md5($data);\n}",
"function string2(){\n\n $string2 = \"Hola mundo\";\n $md5 = md5($string2);\n\n echo $md5;\n\n}",
"public function getMD5Sum($limit='')\n\t{\n if ($limit=='')\n {\n return md5_file($this->getFullPath());\n }\n else\n {\n if(strpos($limit, ':')!==false)\n {\n list($sum,$limit)=explode(':',$limit);\n }\n $info=$this->executeCommand(\n sprintf('limitedmd5sum \"%s\" %s', $this->getFullPath(), $limit),\n true);\n list($key, $value)=explode('=', $info);\n return $value;\n }\n\t}",
"public function hash()\n\t\t{\n\t\t\tif (!$this->hash) {\n\t\t\t\t$this->hash = md5($this->name.'-'.$this->size);\n\t\t\t}\n\n\t\t\treturn $this->hash;\n\t\t}",
"function criptografa($str)\r\n\t{\r\n\t\t$str = sha1( md5( sha1 ( md5 ( $str ) ) ) );\r\n\r\n\t\treturn $str; \t\t\r\n\t}",
"public function md5Url($url) {\r\n\t\t$md5edurl['url'] = md5($url);\r\n\r\n\t\t$md5search = $this->find('count', \r\n\t\t\tarray('conditions' => array('unique' => $md5edurl['url'])),\r\n\t\t\tarray('recursive' => -1)\r\n\t\t);\r\n\r\n\t\tif ($md5search > 0) {\r\n\t\t\t$md5edurl['exists'] = true;\r\n\t\t} else {\r\n\t\t\t$md5edurl['exists'] = false;\r\n\t\t}\r\n\r\n\t\treturn $md5edurl;\r\n\t}",
"public function stopMD5Sum($storage_name, $media_name){\n try {\n //$this->clients[$storage_name]->stopMD5Sum($media_name);\n $this->clients[$storage_name]->resource($this->media_type.'_md5_checker')->ids($media_name)->delete();\n }catch (Exception $exception){\n $this->parseException($exception);\n }\n }",
"public function hash() {\n if(isset($this->cache['hash'])) return $this->cache['hash'];\n\n // add a unique hash\n $checksum = sprintf('%u', crc32($this->uri()));\n return $this->cache['hash'] = base_convert($checksum, 10, 36);\n }",
"public static function md5() {\n return md5(uniqid(mt_rand(), true));\n }",
"function return_md5_check()\n\t{\n\t\tif ( $this->member['id'] )\n\t\t{\n\t\t\treturn md5( $this->member['email'].'&'.$this->member['member_login_key'].'&'.$this->member['joined'] );\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn md5(\"this is only here to prevent it breaking on guests\");\n\t\t}\n\t}",
"public function hash() {\r\n\t\t$cacheParams = explode(',',$this->cacheParams);\r\n\t\t$hash ='';\r\n\t\tforeach($cacheParams as $param) {\r\n\t\t\t$param = trim($param);\r\n\t\t\t$hash .= @$this->$param;\r\n\t\t}\r\n\t\treturn md5($hash);\r\n\t}",
"public function addMd5checksums( $value){\n return $this->_add(1, $value);\n }",
"public function addMd5checksums( $value){\n return $this->_add(1, $value);\n }",
"public function getFingerprint()\n\t{\n\t\t$names = array();\n\n\t\tforeach ($this->collection->all() as $asset)\n\t\t{\n\t\t\t$names[] = $asset->getLastModified();\n\n\t\t\tforeach ($asset->getFilters() as $filter => $options)\n\t\t\t{\n\t\t\t\t$names[] = $filter;\n\t\t\t}\n\t\t}\n\n\t\treturn md5(implode(PHP_EOL, $names));\n\t}",
"private function generateMD5Pass() {\n $plaintext = $this->generator->generateString(8, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^+');\n $hash = md5($plaintext);\n return $hash;\n }",
"function md5plus($string)\n{\n $CI = & get_instance();\n return '_' . md5($CI->session->encryption_key . $string);\n}"
]
| [
"0.66871345",
"0.6663877",
"0.63099277",
"0.6309422",
"0.6301563",
"0.6293727",
"0.6280587",
"0.6277492",
"0.61459434",
"0.6093021",
"0.59092385",
"0.58940774",
"0.58753633",
"0.587439",
"0.58446115",
"0.5807739",
"0.5795031",
"0.5668353",
"0.56611735",
"0.56527776",
"0.56448233",
"0.5597202",
"0.55846274",
"0.5582254",
"0.5567283",
"0.55648464",
"0.55648464",
"0.5559708",
"0.55588496",
"0.5553589"
]
| 0.67077154 | 0 |
Wrapper for srorage method, that abort md5sum for media | public function stopMD5Sum($storage_name, $media_name){
try {
//$this->clients[$storage_name]->stopMD5Sum($media_name);
$this->clients[$storage_name]->resource($this->media_type.'_md5_checker')->ids($media_name)->delete();
}catch (Exception $exception){
$this->parseException($exception);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function startMD5Sum($storage_name, $media_name){\n try {\n //$this->clients[$storage_name]->startMD5Sum($media_name);\n $this->clients[$storage_name]->resource($this->media_type.'_md5_checker')->create(array('media_name' => $media_name));\n }catch (Exception $exception){\n $this->parseException($exception);\n throw new Exception($exception->getMessage());\n }\n }",
"function canMd5()\n {\n return false;\n }",
"public function startMD5SumInAllStorages($media_name){\n foreach ($this->storages as $name => $storage){\n try {\n $this->startMD5Sum($name, $media_name);\n }catch (Exception $exception){\n \n }\n }\n }",
"private function checkMD5Sum($storages_from_net){\n $storages_from_cache = $this->getAllGoodStoragesForMediaFromCache();\n foreach ($storages_from_net as $name => $storage){\n if (array_key_exists($name, $storages_from_cache)){\n foreach ($storages_from_net[$name]['files'] as $net_file){\n foreach ($storages_from_cache[$name]['files'] as $cache_file){\n if (($cache_file['name'] == $net_file['name']) && ($cache_file['md5'] != $net_file['md5']) && !empty($net_file['md5']) && !empty($cache_file['md5'])){\n $this->addToLog('File '.$cache_file['name'].' in '.$this->media_name.' on '.$name.' changed '.$cache_file['md5'].' => '.$net_file['md5']);\n }\n }\n }\n }\n }\n }",
"public function getMd5(): string;",
"public function getT3xfilemd5() {}",
"public function hashFileMd5()\n {\n $this->hash_file_md5 = null;\n\n if ($this->exists === true) {\n\n } elseif ($this->is_file === true) {\n\n } else {\n return;\n }\n\n $this->hash_file_md5 = md5_file($this->temp);\n\n return;\n }",
"public function recover();",
"function return_md5_check()\n\t{\n\t\tif ( $this->member['id'] )\n\t\t{\n\t\t\treturn md5( $this->member['email'].'&'.$this->member['member_login_key'].'&'.$this->member['joined'] );\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn md5(\"this is only here to prevent it breaking on guests\");\n\t\t}\n\t}",
"function compute_md5sum(&$data) {\n if (function_exists(\"hash_init\") && is_resource($data)) {\n $ctx = hash_init('md5');\n while (!feof($data)) {\n $buffer = fgets($data, 65536);\n hash_update($ctx, $buffer);\n }\n $md5 = hash_final($ctx, false);\n rewind($data);\n } elseif ((string) is_file($data)) {\n $md5 = md5_file($data);\n } else {\n $md5 = md5($data);\n }\n\n return $md5;\n}",
"function wp_sm_get_secure_s3_url($hash, $as_attachment = false){\n $url = base64_decode($hash);\n \n if(strpos($url,'amazonaws.com') !== false){\n // This is an Amazon S3 URL\n \n //$clean_url=$url;\n $to_remove=\"/https?:\\/\\/s3.*?\\.amazonaws.com\\//\";\n $to_remove_normal_urls=array(\"/https?:\\/\\//\", \"/\\.s3\\.amazonaws\\.com/\");\n\n //quito subtring de la url\n $clean_url = preg_replace($to_remove, \"\", $url);\n //die(serialize($clean_url));\n $clean_url = preg_replace($to_remove_normal_urls, \"\", $clean_url); \n \n $accessKey = get_option('sm_s3_api_key');\n $secretKey = get_option('sm_s3_api_secret');\n\n $expiry_time = get_option('sm_s3_expiry_time') ? get_option('sm_s3_expiry_time') : '+2 days';\n\n $timestamp = strtotime($expiry_time);\n $strtosign = \"GET\\n\\n\\n$timestamp\\n/$clean_url\";\n \n if($as_attachment){\n $strtosign = $strtosign.\"?response-content-disposition=attachment\";\n }\n\n $signature = urlencode(base64_encode(hash_hmac(\"sha1\", utf8_encode($strtosign), $secretKey, true)));\n\n $destination_url = \"$url?AWSAccessKeyId=$accessKey&Expires=$timestamp&Signature=$signature\";\n \n if($as_attachment){\n $destination_url = $destination_url.\"&response-content-disposition=attachment\";\n }\n } else {\n // This is an internal or \"regular\" URL\n $destination_url = $url;\n }\n \n return $destination_url;\n}",
"function zm_imagedeletionscheck ($data) {\n }",
"function OnDeleteFile($md5){\n\tDeleteFileFromDatabase($md5);\n}",
"public function filecheck() {\r\n\t\treturn md5($this->get('file').$this->config->get('secret').date('Y-m-d'));\r\n\t}",
"public function test_purge() {\n\t\t$purgedFilesInt = Cdnmd5::purge('-1 day');\n\t\t// ensure THIS file exists as a valid hash\n\t\t$this->assertEqual($this->testfile_js_hash, Cdnmd5::makeHash($this->testfile_js));\n\t\t$purgedFilesInt = Cdnmd5::purge('-1 day');\n\t\t$this->assertEqual(0, $purgedFilesInt);\n\t\t// remove THIS file as a valid hash\n\t\t@unlink(Cdnmd5::getConfigFile($this->testfile_js));\n\t\t$purgedFilesInt = Cdnmd5::purge('+1 day');\n\t\t// NOTE: this may not work, if this file was modified and uploaded in\n\t\t// less than 1 sec... (hash/modified timstampes will differ)\n\t\t// also there are a few hours timezone discrepancies...\n\t\t#$this->assertEqual(1, $purgedFilesInt);\n\t\t$this->assertTrue($purgedFilesInt > 0 && $purgedFilesInt < 10);\n\t\t// TODO: idea for better test, upload some \"trash\" files and ensure those are purged\n\t}",
"function is_md5($str)\n{\n\t//return false;\n\treturn preg_match(\"/^[a-f0-9]{32}$/i\", $str);\n}",
"function _ddb_cover_upload_cleanup() {\n $data = _ddb_cover_upload_session('ddb_cover_upload_submitted');\n\n // Mark image as upload to prevent more uploads of the same data.\n _ddb_cover_upload_session('ddb_cover_upload_submitted', '');\n\n // Remove local copy of the image.\n file_unmanaged_delete($data['image_uri']);\n}",
"function SalvaImmagine($immagineBytes, $folder = \"images\")\n {\n if(empty($immagineBytes))\n return NULL;\n\n if(empty($folder) || strlen($folder) > 34) //nome file 30 + 34 path\n $folder = \"images\";\n \n $result = NULL;\n $closed = false;\n if(!empty($immagineBytes))\n {\n @mkdir($folder, 0664, true); // 0664 = lettura/scrittura proprietario&gruppo, lettura utenti\n $filename = GeneraUniqueFileName($folder, \"IMG\");\n $fp = fopen(\"./$folder/$filename\", \"wb\");\n if(fwrite($fp, $immagineBytes))\n {\n $closed = fclose($fp);\n $result = \"$folder/$filename\";\n $ext = GetFileExtension(\"./$folder/$filename\");\n if(IsImage($ext) && rename(\"./$folder/$filename\", \"./$folder/$filename$ext\"))\n {\n $result = \"$result$ext\";\n $thumbSave = SalvaThumb($folder,$filename, $ext);\n LogMessage(\"thumb salvata ($filename$ext): $thumbSave\",\"thumbs.log\");\n }\n else //il file non è un'immagine valida\n {\n if(!unlink(\"./$result\"))\n sendEmailAdmin(\"[PostApp] File non valido\",\"E' stato caricato un file che non è un'immagine ma non è stato possibile cancellarlo\\n<br>Nome file: $result\");\n $result = NULL;\n }\n }\n if(!$closed)\n fclose($fp);\n \n }\n return $result;\n }",
"function media_cleanup() { \r\n global $media;\r\n global $avatars;\r\n global $photoalbumsmedia;\r\n \r\n $query1 = \"SELECT `media_id` , `media_userid` FROM `$media`s;\";\r\n $sqlr1 = bcsql_query( $query1 );\r\n $mediaids = bcsql_fetch_array( $sqlr1 );\r\n $num_rows1 = bcsql_num_rows( $mediaids );\r\n for( $i = 0; $i<$num_rows1; $i++ ) {\r\n $thismedia = $mediaids[ $i ];\r\n $thismediaid = $thismedia[ \"media_id\" ];\r\n $mediaclass = New media( $thismediaid );\r\n $userid = $mediaclass->userid();\r\n $userfile = $uploaddir . $userid .\"/\". $thismediaid;\r\n if( !file_exists( $userfile ) ) {\r\n $sql = \"DELETE FROM `$media` WHERE `media_id` = '$thismediaid';\"; \r\n bcsql_query( $sql );\r\n $sql = \"DELETE FROM `$avatars` WHERE `avatar_mediaid` = '$thismediaid';\";\r\n bcsql_query( $sql );\r\n $sql = \"DELETE FROM `$photoalbumsmedia` WHERE `pamedia_mediaid` = '$thismediaid';\";\r\n bcsql_query( $sql );\r\n }\r\n }\r\n //the oposite thing remains to be done\r\n }",
"public function hash() {\n\t\t$hash = parent::get('hash');\n\t\tif($hash) return $hash; \t\n\t\t$this->set('hash', md5($this->basename())); \n\t\treturn parent::get('hash'); \n\t}",
"public function get_file_md5() {\n\t\treturn md5_file( $this->file );\n\t}",
"public function rebuildThumb()\r\n {\r\n switch ($this->storage)\r\n {\r\n \tcase \"s3\":\r\n \r\n \t $request = \\Web::instance()->request( $this->url );\r\n \t if (empty($request['body'])) {\r\n \t throw new \\Exception('Invalid Item URL');\r\n \t }\r\n \r\n \t $buffer = $request['body'];\r\n \r\n \t break;\r\n \r\n \tcase \"gridfs\":\r\n \r\n \t $db = $this->getDb();\r\n \t $gridfs = $db->getGridFS( $this->collectionNameGridFS() );\r\n \t $length = $this->{\"length\"};\r\n \t $chunkSize = $this->{\"chunkSize\"};\r\n \t $chunks = ceil( $length / $chunkSize );\r\n \t $collChunkName = $this->collectionNameGridFS() . \".chunks\";\r\n \t $collChunks = $this->getDb()->{$collChunkName};\r\n \t \t\r\n \t $buffer = null;\r\n \t for( $i=0; $i<$chunks; $i++ )\r\n \t {\r\n \t $chunk = $collChunks->findOne( array( \"files_id\" => $this->id, \"n\" => $i ) );\r\n \t $buffer .= (string) $chunk[\"data\"]->bin;\r\n \t }\r\n \r\n \t break;\r\n \r\n \tdefault:\r\n\r\n \t throw new \\Exception('Invalid Item Storage');\r\n \t \r\n \t break;\r\n }\r\n\r\n if ( $thumb_binary_data = $this->getThumb( $buffer )) {\r\n $thumb = new \\MongoBinData( $thumb_binary_data, 2 );\r\n }\r\n \r\n $app = \\Base::instance();\r\n $files_path = $app->get('TEMP') . \"assets_thumbs\";\r\n if (!file_exists($files_path)) {\r\n mkdir( $files_path, \\Base::MODE, true );\r\n }\r\n $file_path = $files_path . '/' . $this->slug;\r\n file_put_contents( $file_path, $thumb_binary_data );\r\n \r\n return $this->set( 'thumb', $thumb )->save();\r\n }",
"public function hash()\n {\n return $this->adapter->md5File($this->path);\n }",
"public function getMD5Sum($limit='')\n\t{\n if ($limit=='')\n {\n return md5_file($this->getFullPath());\n }\n else\n {\n if(strpos($limit, ':')!==false)\n {\n list($sum,$limit)=explode(':',$limit);\n }\n $info=$this->executeCommand(\n sprintf('limitedmd5sum \"%s\" %s', $this->getFullPath(), $limit),\n true);\n list($key, $value)=explode('=', $info);\n return $value;\n }\n\t}",
"public function checkContentHash() {}",
"function DeleteTempQRCode($fileName){\r\n\treturn unlink($fileName);\r\n}",
"public function purgeAll() {\n\t\tset_time_limit(300);\n\t\t$this->load->model(\"filehandlerbase\");\n\t\t$fileList = $this->filehandlerbase->findDeletedItems();\n\t\t$mfa = $this->input->post(\"mfa\");\n\t\t$serial = $this->input->post(\"arn\");\n\n\t\t/**\n\t\t * we need to cache this because MFA is only good once\n\t\t */\n\t\t$lastUsedToken = null;\n\t\tforeach($fileList as $fileEntry) {\n\t\t\t$fileHandler = $this->filehandler_router->getHandlerForObject($fileEntry->getFileObjectId());\n\t\t\tif(!$fileHandler) { \n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif(!$fileHandler->loadFromObject($fileEntry)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif(isset($lastUsedToken)) {\n\t\t\t\t$fileHandler->s3model->sessionToken = $lastUsedToken;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif(!$fileHandler->deleteSource($serial,$mfa)) {\n\t\t\t\t\t$this->logging->logError(\"purgeAll\",\"Could not delete asset with key\" . $fileEntry->getFileObjectId());\n\t\t\t\t}\n\t\t\t\t$lastUsedToken = $fileHandler->s3model->sessionToken;\n\t\t\t}\n\t\t\tcatch (Exception $e) {\n\t\t\t\techo $e;\n\t\t\t\techo \"Deletion fail\";\n\t\t\t}\n\n\t\t}\n\n\t\tinstance_redirect(\"/admin\");\n\t}",
"function clean_attachment_cache($id, $clean_terms = \\false)\n {\n }",
"public function getMd5Checksum()\r\n {\r\n return md5_file($this->filename);\r\n }",
"function deleteBandwidthMedia ($files) {\n foreach ($files as $index => $file) {\n unlink ($file);\n }\n}"
]
| [
"0.6274406",
"0.5870799",
"0.5543494",
"0.5490141",
"0.5361619",
"0.5342925",
"0.52969486",
"0.52897525",
"0.5222271",
"0.51444876",
"0.5139618",
"0.5113705",
"0.50911105",
"0.50809455",
"0.50241965",
"0.5023919",
"0.5008803",
"0.50062186",
"0.49984312",
"0.4977169",
"0.49583888",
"0.49517235",
"0.49216986",
"0.4910191",
"0.4896946",
"0.48788854",
"0.48384163",
"0.48378223",
"0.48310852",
"0.48081467"
]
| 0.6968032 | 0 |
Compare md5sum from net and from cache. If they don't equal add record to master log | private function checkMD5Sum($storages_from_net){
$storages_from_cache = $this->getAllGoodStoragesForMediaFromCache();
foreach ($storages_from_net as $name => $storage){
if (array_key_exists($name, $storages_from_cache)){
foreach ($storages_from_net[$name]['files'] as $net_file){
foreach ($storages_from_cache[$name]['files'] as $cache_file){
if (($cache_file['name'] == $net_file['name']) && ($cache_file['md5'] != $net_file['md5']) && !empty($net_file['md5']) && !empty($cache_file['md5'])){
$this->addToLog('File '.$cache_file['name'].' in '.$this->media_name.' on '.$name.' changed '.$cache_file['md5'].' => '.$net_file['md5']);
}
}
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function hasMd5checksums(){\n return $this->_has(1);\n }",
"public function hasMd5checksums(){\n return $this->_has(1);\n }",
"public function hasMd5checksum(){\n return $this->_has(3);\n }",
"public function hasMd5checksum(){\n return $this->_has(3);\n }",
"public function addMd5checksums( $value){\n return $this->_add(1, $value);\n }",
"public function addMd5checksums( $value){\n return $this->_add(1, $value);\n }",
"public function hash_check(){\n $this->read_hash_file();\n\n // read all files hashes\n $this->read_directory();\n\n // save updated md5 hashes\n $this->save_hash_file();\n \n // log changes\n if(!empty($this->md5_gen_old)){\n $this->save_log_file();\n\n // email changes\n if($this->email)\n $this->emailChanges(); \n }\n }",
"public function hasMd5() {\n return $this->_has(4);\n }",
"function return_md5_check()\n\t{\n\t\tif ( $this->member['id'] )\n\t\t{\n\t\t\treturn md5( $this->member['email'].'&'.$this->member['member_login_key'].'&'.$this->member['joined'] );\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn md5(\"this is only here to prevent it breaking on guests\");\n\t\t}\n\t}",
"function expired() {\r\n if(!file_exists($this->cachefile)) return true;\r\n # compare new m5d to existing cached md5\r\n elseif($this->hash !== $this->get_current_hash()) return true;\r\n else return false;\r\n }",
"public function hasMd5() {\n return $this->_has(7);\n }",
"public function validateUpdate()\n\t{\n\t\tBlocks::log('Validating MD5 for '.$this->_downloadFilePath, \\CLogger::LEVEL_INFO);\n\t\t$sourceMD5 = IOHelper::getFileName($this->_downloadFilePath, false);\n\n\t\t$localMD5 = IOHelper::getFileMD5($this->_downloadFilePath);\n\n\t\tif ($localMD5 === $sourceMD5)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}",
"public function hash() {\r\n\t\t$cacheParams = explode(',',$this->cacheParams);\r\n\t\t$hash ='';\r\n\t\tforeach($cacheParams as $param) {\r\n\t\t\t$param = trim($param);\r\n\t\t\t$hash .= @$this->$param;\r\n\t\t}\r\n\t\treturn md5($hash);\r\n\t}",
"private function hashing() {\n\t\t$data = md5($this->name.$this->date);\n\t\t$data = md5($data);\n\t\t$data = strrev($data);\n\t\t//$data = md5($data);\n\t\t$data = strtoupper($data);\n\t\t//$data = strrev($data);\n\n\t\t$datatemp = NULL;\n\t\tfor($i=0; $i<=strlen($data); $i++) {\n\t\t\t$arr = substr($data, $i, 1);\n\t\t\tif($i == '4' || $i == '8' || $i == '12' || $i == '16' || $i == '20' || $i == '24' || $i == '28' || $i == '32') {\n\t\t\t\t$datatemp .= substr($this->strfinger, ($i/4)-1, 1);\t\n\t\t\t}\n\t\t\t$datatemp .= \"/%\".$this->combine[$arr];\n\t\t}\n\n\t\t$this->resulthashcode = substr($datatemp, 1, strlen($datatemp)-6);\n\t\t$this->result = true;\n\t}",
"public function md5Url($url) {\r\n\t\t$md5edurl['url'] = md5($url);\r\n\r\n\t\t$md5search = $this->find('count', \r\n\t\t\tarray('conditions' => array('unique' => $md5edurl['url'])),\r\n\t\t\tarray('recursive' => -1)\r\n\t\t);\r\n\r\n\t\tif ($md5search > 0) {\r\n\t\t\t$md5edurl['exists'] = true;\r\n\t\t} else {\r\n\t\t\t$md5edurl['exists'] = false;\r\n\t\t}\r\n\r\n\t\treturn $md5edurl;\r\n\t}",
"public function getMd5Checksum()\r\n {\r\n return md5_file($this->filename);\r\n }",
"private function queryInCache($query){\n \t$md5 = (isset($query)) ? md5($query) : '';\n \t\n return (in_array($md5, $this->temp));\n }",
"public function hash() {\n\t\t$hash = parent::get('hash');\n\t\tif($hash) return $hash; \t\n\t\t$this->set('hash', md5($this->basename())); \n\t\treturn parent::get('hash'); \n\t}",
"function canMd5()\n {\n return false;\n }",
"public function makeCacheHash() {}",
"public function hashFileMd5()\n {\n $this->hash_file_md5 = null;\n\n if ($this->exists === true) {\n\n } elseif ($this->is_file === true) {\n\n } else {\n return;\n }\n\n $this->hash_file_md5 = md5_file($this->temp);\n\n return;\n }",
"protected function hashMemcache()\n\t{\n\t\treturn self::generateHash($this->getMode(), $this->getTrackKey(), $this->getApplicationID());\n\t}",
"function compute_md5sum(&$data) {\n if (function_exists(\"hash_init\") && is_resource($data)) {\n $ctx = hash_init('md5');\n while (!feof($data)) {\n $buffer = fgets($data, 65536);\n hash_update($ctx, $buffer);\n }\n $md5 = hash_final($ctx, false);\n rewind($data);\n } elseif ((string) is_file($data)) {\n $md5 = md5_file($data);\n } else {\n $md5 = md5($data);\n }\n\n return $md5;\n}",
"function compare_hostname_to_dnscache($hostname) {\n\tglobal $g;\n\tif (!is_dir(\"/var/db/dnscache\")) {\n\t\tmkdir(\"/var/db/dnscache\");\n\t}\n\t$hostname = trim($hostname);\n\tif (is_readable(\"/var/db/dnscache/{$hostname}\")) {\n\t\t$oldcontents = file_get_contents(\"/var/db/dnscache/{$hostname}\");\n\t} else {\n\t\t$oldcontents = \"\";\n\t}\n\tif ((is_fqdn($hostname)) && (!is_ipaddr($hostname))) {\n\t\t$contents = \"\";\n\t\t$domips = resolve_host_addresses($hostname, array(DNS_A), false);\n\t\tif (!empty($domips)) {\n\t\t\tforeach ($domips as $ip) {\n\t\t\t\t$contents .= \"$ip\\n\";\n\t\t\t}\n\t\t}\n\t}\n\n\tif (trim($oldcontents) != trim($contents)) {\n\t\tif (g_get('debug')) {\n\t\t\tlog_error(sprintf(gettext('DNSCACHE: Found old IP %1$s and new IP %2$s'), $oldcontents, $contents));\n\t\t}\n\t\treturn ($oldcontents);\n\t} else {\n\t\treturn false;\n\t}\n}",
"public function hash() {\n if(isset($this->cache['hash'])) return $this->cache['hash'];\n\n // add a unique hash\n $checksum = sprintf('%u', crc32($this->uri()));\n return $this->cache['hash'] = base_convert($checksum, 10, 36);\n }",
"public function getMd5(): string;",
"public function getMd5checksumsList(){\n return $this->_get(1);\n }",
"public function getMd5checksumsList(){\n return $this->_get(1);\n }",
"public function cacheCheck(){\n \n if(file_exists($this->cacheName)){\n\t \n $cTime = intval(filemtime($this->cacheName));\n \n if( $cTime + $this->cacheTime > time() ) {\n\t \n echo file_get_contents( $this->cacheName );\n \n ob_end_flush();\n \n exit;}\t\t\t\t\t\n \n \t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n return false;\n \n}",
"private function _checkCache()\r\n {\r\n // get a string representation of the object\r\n ob_start();\r\n var_dump(get_object_vars($this));\r\n $buffer = ob_get_clean();\r\n \r\n // build the hash for this object\r\n $hash = md5($buffer);\r\n \r\n // check if the cache file exists, if it does use it\r\n if (file_exists(\"{$this->_config['paths']['cache']}/{$hash}\")){\r\n die(file_get_contents(\"{$this->_config['paths']['cache']}/{$hash}\"));\r\n }\r\n }"
]
| [
"0.6024794",
"0.6024794",
"0.5949335",
"0.5949335",
"0.56270295",
"0.56270295",
"0.5558346",
"0.5549799",
"0.54782295",
"0.5470366",
"0.5437054",
"0.54202145",
"0.5387213",
"0.5381693",
"0.535362",
"0.5303952",
"0.5274792",
"0.5274285",
"0.5251015",
"0.5146725",
"0.51430297",
"0.5142882",
"0.5138224",
"0.5080571",
"0.50607085",
"0.504643",
"0.5040882",
"0.5040882",
"0.5034413",
"0.5003881"
]
| 0.71580076 | 0 |
Add record to master log | private function addToLog($txt){
$this->db->insert('master_log',
array(
'log_txt' => trim($txt),
'added' => 'NOW()'
));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function addLog($data);",
"function log_record_add($rec, $sort, $type, $record) {\n $pid = $type.':'.$rec.'.'.$sort;\n if (strlen($record) > 0) {\n lr_set($pid, $record);\n } else {\n lr_clear($pid);\n }\n}",
"public function addEntry(\\Yana\\Db\\Ddl\\Logs\\AbstractLog $log)\n {\n array_unshift($this->changes, $log);\n }",
"protected function log()\n {\n\n $this->worker\n ->setInstance($this->instance);\n // If instance can be called\n if($this->worker->ping()) {\n $infos = $this->worker->getInfos();\n $createdAt = new \\DateTime();\n\n $log = $this->logManager->createNew();\n $log->setMemory($infos['Memory']['used_memory']);\n $log->setCpu($infos['CPU']['used_cpu_sys']);\n $log->setNbClients(sizeof($this->worker->getClients()));\n $log->setCreatedAt($createdAt);\n // Add log\n $this->instance->addLog($log);\n }\n }",
"private function add_log($log) {\n $this->log .= \" \" . $log;\n }",
"public function store() {\n $logData = \"=========================================\\n\";\n $logData .= \"Date Time: \".$this->record_date.\"\\n\";\n $logData .= $this->title.\" (\".$this->type.\") \\n\";\n if(!empty($this->data)) {\n $logData .= var_export($this->data, true).\"\\n\";\n }\n \n file_put_contents($this->file, $logData, FILE_APPEND);\n \n }",
"public function pushRecord()\r\n {\r\n\r\n }",
"public function writeLog()\n {\n $redis = self::getClient();\n $redis ->lPush('admin_log',$this->data);\n }",
"public function addLog ( $keys, $received, $sent, $base_string, $notes, $user_id = null ) { }",
"function inbound_record_log( $title = '', $message = '', $rule_id = 0, $job_id = '', $type = null ) {\n\tglobal $inbound_automation_logs;\n\t$inbound_automation_logs->add( $title, $message, $rule_id, $job_id, $type );\n\n}",
"public function addLog($log_data)\n {\n // open the file\n $log_file = $this->openFile();\n\n // get current (last) line\n $log_file->seek($this->file_line);\n $this->file_line = $log_file->key() + 1;\n \n // write the log\n $time_of_day = gettimeofday(); \n $timestamp = date('Y-m-d H:i:s.',$time_of_day['sec']) . $time_of_day['usec'];\n \n $log_string = \"\\n\".$timestamp.'|'.implode('|', $log_data);\n $log_file->fwrite($log_string);\n \n // close the file\n $this->closeFile($log_file);\n }",
"function rec($log_item)\n\t{\n\t\t$this->items[] = $log_item;\n\t}",
"public function add($entry)\n {\n $this->log[] = $entry;\n while (\\count($this->log) > $this->size) {\n array_shift($this->log);\n }\n }",
"function add_log_entry(log_op_move $entry) {\n array_unshift($this->log_op_list, $entry);\n }",
"function WriteAuditTrailOnAdd(&$rs) {\n\t\tglobal $mst_vendor;\n\t\t$table = 'mst_vendor';\n\n\t\t// Get key value\n\t\t$key = \"\";\n\t\tif ($key <> \"\") $key .= EW_COMPOSITE_KEY_SEPARATOR;\n\t\t$key .= $rs['kode'];\n\n\t\t// Write Audit Trail\n\t\t$filePfx = \"log\";\n\t\t$curDate = date(\"Y/m/d\");\n\t\t$curTime = date(\"H:i:s\");\n\t\t$id = ew_ScriptName();\n\t $curUser = CurrentUserName();\n\t\t$action = \"A\";\n\t\t$oldvalue = \"\";\n\t\tforeach (array_keys($rs) as $fldname) {\n\t\t\tif ($mst_vendor->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore Blob Field\n\t\t\t\t$newvalue = ($mst_vendor->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) ? \"<MEMO>\" : $rs[$fldname]; // Memo Field\n\t\t\t\tew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $curUser, $action, $table, $fldname, $key, $oldvalue, $newvalue);\n\t\t\t}\n\t\t}\n\t}",
"function insert_log( $log_data = array() ) {\n\t\n\t\t/* Get Log From Rule ID */\t\t\n\t\t$logs_array = Inbound_Logging_Automation::get_logs( $log_data['rule_id'] );\n\t\t\n\t\t/* Push log to front of array */\n\t\t$logs_array[] = $log_data;\n\t\t\n\t\t/* Trim logs array to X entries */\n\t\tif ( count($logs_array) > self::$log_limit ) {\n\t\t\t$trim = count($logs_array) - self::$log_limit;\n\t\t\t$logs_array = array_slice($logs_array, $trim);\n\t\t}\n\t\t\n\t\t/* Update logs meta */\n\t\tupdate_post_meta( $log_data['rule_id'] , '_automation_logs' , json_encode($logs_array) );\n\n\t}",
"protected function _write($event)\n {\n $this->logs[] = $event;\n }",
"public function updateLog () {\n\t\t$this->log = json_encode($this->SYN_Log);\n\t\t$this->save();\n\t}",
"public function recordJournalingStart();",
"private function send_log() {\n MessageLogger::add_log($this->log);\n $this->log = \"\";\n }",
"function logrec($aid,$e,$msg,$src='') {\n\t// into the new record array[errors]\n\tglobal $logfile;\n\n\n\t$ts = date('H:i');\n\n\techo \"<p class='red'>$aid: $msg</p>\";\n\tfile_put_contents($logfile,\n\t\tsprintf(\"%6s %4s %1s %s\\n\",$ts,$aid,$e,$msg),FILE_APPEND);\n\tif (!empty($src)) {\n\t\tfile_put_contents($logfile,\n\t\tsprintf(\"%12s %s\\n\",'',$src),FILE_APPEND);\n\t}\n\treturn \"($e) $msg \". NL;\n}",
"function add2log($filename,$entry,$debug=true){\n $TimeStamp = date(\"Y-m-dTH:i:s+0000\");\n $entry .= \"\\n\";\n $FileHandle=fopen($filename, \"a\");\n\n if($FileHandle){\n fwrite($FileHandle, \"[ $TimeStamp ] \".$entry);\n fclose($FileHandle);\n\n //~ If debug is enable we also print some infos to the console\n if($debug){ echo($entry); }\n }\n}",
"function log_staff($log){\n \t\tif($this->db->insert('logs', $log)){\n \t\t\treturn true;\n \t\t}\n \t\telse{\n \t\t\treturn false;\n \t\t}\n \t}",
"public function setRecordLog() {\n \t$msg = '';\n \t$defaultFilterFields = array( 'id', 'modify_user_id' ,'modify_time', 'create_user_id', 'create_time','check_user_id','check_time');\n \t$addFilterFields = !empty($this->filterFields) ? $this->filterFields : array();\n \t$filterFields = array_merge($defaultFilterFields,$addFilterFields);\n \tforeach ( $this->getAttributes() as $key => $val ) {\n \t\tif ( ! $this->getIsNewRecord() && $val == $this->beforeSaveInfo[$key] ) {\n \t\t\tcontinue;\n \t\t}\n// \t\t$label = $this->getAttributeLabel($key);\n $label = get_class($this) . ':'.$key; //by shenll\n \t\tif (in_array($key, $filterFields)) {\n \t\t\tcontinue;\n \t\t}else {\n \t\t\tif ( $this->getIsNewRecord() ) {\n \t\t\t\t$msg .= MHelper::formatInsertFieldLog($label, $val);\n \t\t\t} else {\n \t\t\t\t$msg .= MHelper::formatUpdateFieldLog($label, $this->beforeSaveInfo[$key], $val);\n \t\t\t}\n \t\t}\n \t}\n //\treturn $msg;\n \t$this->addLogMsg($msg);\n }",
"public function log (string $msg) : void {\n\t\t$this->logs [] = $msg;\n\t}",
"public function add($data){\n\t\t$this->db->insert('projects_pledges_log', $data); \n\t}",
"public function logPush($userId) {\n\n $data = array(\n 'dl_agentid' => $userId,\n 'dl_access' => new Zend_Db_Expr('NOW()')\n );\n\n return $this->insert($data);\n }",
"private function _log()\n {\n try {\n // Connect\n $dbh = $this->_connectToDb();\n \n // Insert\n $stmt = $dbh->prepare(\"INSERT INTO log_table(`nick`, `said`, `when`, `channel`) VALUES (:nick, :message, NOW(), :channel)\");\n\n $stmt->bindParam(':nick', $this->_data->nick, PDO::PARAM_STR);\n $stmt->bindParam(':message', $this->_data->message, PDO::PARAM_STR);\n $stmt->bindParam(':channel', $this->_data->channel, PDO::PARAM_STR);\n \n if (!$stmt->execute())\n {\n $arr = $stmt->errorInfo();\n print_r($arr);\n }\n\n $dbh = null;\n \t\n }\n catch(PDOException $e)\n {\n echo $e->getMessage();\n }\n }",
"private static function addLog($msg) {\n\t\tself::$log[] = '\"'.formatTimestamp(time()).' - '.$msg.'\"';\n\t}",
"public function withLog($entry);"
]
| [
"0.68614817",
"0.643371",
"0.6424762",
"0.6384759",
"0.6374884",
"0.6346476",
"0.6284307",
"0.6274996",
"0.6227527",
"0.6208229",
"0.61634886",
"0.615516",
"0.60703665",
"0.60629696",
"0.6060186",
"0.6054145",
"0.59661376",
"0.5920654",
"0.59167325",
"0.5879794",
"0.5864858",
"0.5836933",
"0.58355916",
"0.5793393",
"0.578872",
"0.5776715",
"0.57706237",
"0.57211095",
"0.5705612",
"0.5703908"
]
| 0.6627233 | 1 |
Get good storages from cache | private function getAllGoodStoragesForMediaFromCache(){
$cache = array();
foreach ($this->getAllCacheKeys() as $key){
$storage_cache = $this->db->from('storage_cache')
->where(array(
'cache_key' => $key,
'status' => 1,
'changed>' => date(Mysql::DATETIME_FORMAT, time() - $this->cache_expire_h*3600)
))
->get()
->all();
if(!empty($storage_cache)){
$storage_cache = $storage_cache[0];
$storage_data = unserialize($storage_cache['storage_data']);
if (is_array($storage_data) && !empty($storage_data) && !empty($this->stb_storages[$storage_cache['storage_name']])){
$cache[$storage_cache['storage_name']] = $storage_data;
$cache[$storage_cache['storage_name']]['load'] = $this->getStorageLoad($this->storages[$storage_cache['storage_name']]);
}
}
}
return $cache;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getCache();",
"public static function getCache() {}",
"public function get_all(){\n $cache_data_list=[];\n if($this->driver=='file'){\n foreach ($cache_list=$this->file->file_walk($this->path) as $value){\n $cache_data_list[]=$this->file->read_file($value);\n }\n }\n if($this->driver==\"redis\"){\n foreach ($this->redis->hGetAll($this->path) as $key=>$value){\n $cache_data_list[]=$value;\n }\n }\n return $cache_data_list;\n }",
"private function getAllCacheKeys(){\n $keys = array();\n foreach ($this->storages as $name => $storage){\n $keys[] = $this->getCacheKey($name);\n }\n return $keys;\n }",
"function sed_diskcache_list()\n{\n\tglobal $cfg;\n\n\t$dir_a = array();\n\n\t$a = sed_diskcache_calc($cfg['cache_dir'], false);\n\tif ($a[0])\n\t{\n\t\t$dir_a[SED_DISKCACHE_ONLYFILES] = $a;\n\t}\n\n\t$pos = mb_strlen($cfg['cache_dir']) + 1;\n\tforeach (glob(\"{$cfg['cache_dir']}/*\", GLOB_ONLYDIR) as $dir)\n\t{\n\t\t$a = sed_diskcache_calc($dir);\n\t\tif ($a[0])\n\t\t{\n\t\t\t$dir_a[mb_substr($dir, $pos)] = $a;\n\t\t}\n\t}\n\n\treturn $dir_a;\n}",
"function getStorage() ;",
"static function cached_all(){\n return static::get_cache();\n }",
"public function getCache() {\n $db = \\Helper::getDB();\n $db->join('cached_assets c', 'dc.cacheId = c.id', 'LEFT');\n $db->where('dc.fileId', $db->escape($this->getId()));\n $results = $db->get('document_files_cache dc');\n\n return $results;\n }",
"public function getStorage();",
"public function getStorage();",
"public function getAll()\n {\n return $this->storage;\n }",
"protected function getMemoryCache() {}",
"public function getFileStorages() {}",
"public function getFromCache() {}",
"function Atv_getRepoKegiatanAll(): object\n{\n return Cache::remember('repo-kegiatan-all', (60 * 60 * 2/* 2 hours */), function () {\n return Kegiatan::all()->map->kegiatanResourceMap();\n });\n}",
"public static function getStorage() {}",
"protected function cache()\n {\n // Cache location items\n $this->locations->get(); // All\n $this->locations->menu(); // Menu\n $this->locations->mapItems(); // Map\n $this->locations->featured(); // Featured\n\n // Cache properties\n $this->properties->cacheAll(); // All\n $this->properties->specials();\n }",
"function getStorage();",
"public function list_cache()\n {\n $result = $this->_db->find('all');\n\n $return_list = array();\n $ttl_expiry = time() - $this->_cacheTTL;\n\n foreach ($result as $i => $cache_item) {\n $expired = false;\n $ttl = $cache_item[$this->_db->name]['created'];\n\n if ($ttl < $ttl_expiry) {\n $expired = true;\n }\n\n $return_list[] = array(\n 'item_name' => $cache_item[$this->_db->name]['request_hash'],\n 'contents' => $cache_item[$this->_db->name]['request_response'],\n 'location' => $cache_item[$this->_db->name]['request_hash'],\n 'ttl' => $ttl,\n 'expired' => $expired\n );\n }\n\n return $return_list;\n }",
"public function cacheGet() {\n }",
"public function getStorage() {}",
"public function getStorage() {}",
"public function getStorage() {}",
"private function get_caches () {\n $caches_slug = 'cache';\n return $this->get_option($caches_slug, array());\n }",
"public function getAll()\n\t{\n\t\tif (!class_exists('JCacheStorageHelper', false))\n\t\t{\n\t\t\tinclude_once JPATH_PLATFORM . '/joomla/cache/storage/helper.php';\n\t\t}\n\t\treturn;\n\t}",
"protected function getRuntimeCache() {}",
"public function getCacheAdapter();",
"public function caches()\n {\n return $this->request('get', '/api/teams/'.Helpers::config('team').'/caches');\n }",
"public function getStorages()\n {\n $result = [];\n foreach ($this->_storages as $storageName => $storageData) {\n $result[$storageName] = $this->getStorage($storageName);\n }\n return $result;\n }",
"public function getCacheTable() {}"
]
| [
"0.71438897",
"0.67686236",
"0.6657502",
"0.66507566",
"0.65918094",
"0.65321195",
"0.651402",
"0.6432794",
"0.6429284",
"0.6429284",
"0.6399728",
"0.63599944",
"0.6357598",
"0.6322012",
"0.63176256",
"0.6309113",
"0.6301071",
"0.6271082",
"0.6256069",
"0.6239949",
"0.6229115",
"0.6228411",
"0.6228199",
"0.61837465",
"0.61796635",
"0.61787903",
"0.61739385",
"0.61477804",
"0.60903335",
"0.6034581"
]
| 0.80611145 | 0 |
Return unique key for cache record by storage name, media type and media id | private function getCacheKey($storage_name){
return $storage_name.'_'.$this->media_type.'_'.$this->media_id;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function _get_media_key($id = '') {\n \n \tif ($id != '') {\n \t\treturn $this->_media_key.'-'.$id;\n \t} else {\n \t\treturn '';\n \t}\n\t}",
"private function getCacheId()\n\t{\n\t\treturn self::CACHE_ID_PREFIX . '_' . $this->exportId . '_' . $this->type;\n\t}",
"public function cacheKey(): string {\n return self::CACHE_PREFIX . $this->id\n . ($this->revisionId ? '_r' . $this->revisionId : '');\n }",
"public function getMediaId();",
"public function cacheKey() {\n $params = $this->getParameters();\n $ret = '';\n $this->make_cache_key($params, $ret);\n\n return md5($ret);\n }",
"protected static function getCacheIdentifier() {}",
"private function get_cache_id() {\n $handlername = get_class($this);\n if($this->id)\n $cache_id = '_cache_' . $handlername . '_' . $this->id;\n else \n $cache_id = '_cache_' . $handlername . '_all'; \n return $cache_id;\n\t}",
"public function getCacheKey(): string\n {\n $customerGroupId = 0;\n\n if ($this->hasCustomerGroupId()) {\n $customerGroupId = $this->getCustomerGroupId();\n }\n\n return sprintf('%d-%d-%d', $this->getWebsiteId(), $customerGroupId, $this->getStoreId());\n }",
"protected function getCacheKey() {\n $plugin_id = hash('sha256', $this->getPluginId());\n $uri = $this->config('uri');\n\n return $plugin_id . ':' . $uri;\n }",
"public function getStoragePrimaryKey();",
"private function cacheKey()\n {\n return sprintf('contact-permissons-%s', $this->client->patientContactId);\n }",
"public function getHash()\n\t{\n\t\t// Create a string that should uniquely represent the media instance.\n\t\t// We'll base it on the table name, concatenated with a '.', followed by the\n\t\t// ID value.\n\t\t$string = $this->getTable().'.'.$this->getKey();\n\n\t\t// We will use the SHA1 algorithm, as it is less prone to collision attacks,\n\t\t// while still being quick enough for mass hashing.\n\t\treturn hash('sha1', $string);\n\t}",
"function getCacheId() {\n return get_class($this).\"_\".$this->id;\n }",
"protected function GetCacheKey()\n\t{\n\t\treturn (isset($this->params['hashbase']) ? $this->params['hashbase'] : '') . '|' . (isset($this->params['hash']) ? $this->params['hash'] : '') . '|' . (isset($this->params['file']) ? sha1($this->params['file']) : '');\n\t}",
"protected function get_cache_id() {\n\t\treturn wponion_hash_string( $this->module() . '_' . $this->unique() );\n\t}",
"function cacheKey( $key )\n\t{\n\t\treturn $key.\"_\".MANUFACTURER_ID.getFirstSubDomain();\n\t}",
"protected function cacheKey() : string\n {\n return $this->cacheKey ?? $this->cacheKeyHash();\n }",
"protected function cacheKey()\n {\n return md5($this->gridField->Link());\n }",
"private function getCacheKey(): string\n {\n return $this->webserviceId.$this->cacheKey;\n }",
"public function generateCacheKey()\n {\n $key = [\n 'bucket' => $this->from,\n 'type' => $this->type,\n 'wheres' => $this->wheres,\n 'columns' => $this->columns,\n 'groups' => $this->groups,\n 'orders' => $this->orders,\n 'offset' => $this->offset,\n 'limit' => $this->limit,\n 'aggregate' => $this->aggregate,\n ];\n\n return md5(serialize(array_values($key)));\n }",
"public function cacheKey($type, $token='')\n {\n $type = strtolower($type);\n\n switch ($type) {\n case 'token':\n return $this->cacheToken . \":\" . $token;\n case 'refresh':\n return $this->cacheTokenRefresh . \":\" . $token;\n case 'initial':\n return $this->cacheTokenInitial . \":\" . $token;\n }\n }",
"public function getCacheKey()\n {\n return md5($this->formId . ':' . implode(',', $this->fieldIds));\n }",
"public function getCacheId()\n {\n return md5(serialize($this->params));\n }",
"public function cache_filename()\n {\n return $this->_name . '_' . $this->id() . '.' . $this->_type;\n }",
"final protected function getCacheKey($cacheId = array())\n\t{\n\t\tif(!is_array($cacheId))\n\t\t\t$cacheId = array((string) $cacheId);\n\n\t\t$cacheId['SITE_ID'] = SITE_ID;\n\t\t$cacheId['LANGUAGE_ID'] = LANGUAGE_ID;\n\t\t// if there are two or more caches with the same id, but with different cache_time, make them separate\n\t\t$cacheId['CACHE_TIME'] = intval($this->arResult['CACHE_TIME']);\n\n\t\tif(defined(\"SITE_TEMPLATE_ID\"))\n\t\t\t$cacheId['SITE_TEMPLATE_ID'] = SITE_TEMPLATE_ID;\n\n\t\treturn implode('|', $cacheId);\n\t}",
"public function getCacheId($type = 'fields') {\n return 'search_api:index-' . $this->machine_name . '--' . $type;\n }",
"public function getStorageUid();",
"private function getCacheKey($url) {\n\t\treturn 'amo_api_' . md5($url);\n\t}",
"public function getCacheKeyInfo();",
"protected function calculateKey($id)\n\t{\n\t return self::CACHE_KEY_PREFIX.$id;\n\t}"
]
| [
"0.69583285",
"0.65799886",
"0.650733",
"0.63962746",
"0.6250394",
"0.6239835",
"0.61638105",
"0.6152581",
"0.6120995",
"0.6115217",
"0.6091918",
"0.60773313",
"0.6067026",
"0.60350823",
"0.5983573",
"0.5941147",
"0.59332466",
"0.5907089",
"0.59000796",
"0.58794206",
"0.5877387",
"0.58727515",
"0.58377385",
"0.5827423",
"0.5825308",
"0.58206266",
"0.5794255",
"0.5793212",
"0.5786227",
"0.5783085"
]
| 0.7973746 | 0 |
Return all keys for cache records for media | private function getAllCacheKeys(){
$keys = array();
foreach ($this->storages as $name => $storage){
$keys[] = $this->getCacheKey($name);
}
return $keys;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAllKeys() {\n return $this->memcached->getAllKeys();\n }",
"private function getAllGoodStoragesForMediaFromCache(){\n \n $cache = array();\n \n foreach ($this->getAllCacheKeys() as $key){\n \n $storage_cache = $this->db->from('storage_cache')\n ->where(array(\n 'cache_key' => $key,\n 'status' => 1,\n 'changed>' => date(Mysql::DATETIME_FORMAT, time() - $this->cache_expire_h*3600)\n ))\n ->get()\n ->all();\n \n if(!empty($storage_cache)){\n $storage_cache = $storage_cache[0];\n $storage_data = unserialize($storage_cache['storage_data']);\n if (is_array($storage_data) && !empty($storage_data) && !empty($this->stb_storages[$storage_cache['storage_name']])){\n $cache[$storage_cache['storage_name']] = $storage_data;\n $cache[$storage_cache['storage_name']]['load'] = $this->getStorageLoad($this->storages[$storage_cache['storage_name']]);\n }\n }\n \n }\n return $cache;\n }",
"public function keys()\n {\n $keyPath = $this->getKeyPath();\n\n // find all the cached filenames among partitioned dirs within this group key\n // (e.g. '[GROUP PARTITION]/[GROUP]/[PARTITION]/[KEY]/cache')\n $iterator = new \\RecursiveIteratorIterator(new \\RecursiveDirectoryIterator($keyPath));\n\n $regIterator = new \\RegexIterator($iterator, '/\\/[\\d]+\\/[\\w\\d]+\\/' . self::FILENAME_CACHE .'$/i');\n $keys = array();\n\n foreach ($regIterator as $path) {\n // extract key from file path\n preg_match('/\\/(?<key>[\\w\\d]+)\\/' . self::FILENAME_CACHE . '/', $path->__toString(), $match);\n if (!array_key_exists('key', $match) || empty($match['key'])) {\n continue;\n }\n // decode the key\n $entry = base64_decode($match['key']);\n $keys[] = $entry;\n }\n asort($keys);\n\n return $keys;\n }",
"public function getAllKey();",
"function keys() {\n\t\treturn array_keys($this->_cache);\n\t}",
"public function getMetaForignKeys(){\n $stmt = $this->query(self::META_FKEYS_SQL);\n if ($stmt === false){\n return array();\n }\n\n $keys = array();\n foreach ($stmt as $row){\n $keys[$row[0] . '.' . $row[1]] = $row[2] . '.' . $row[3];\n }\n\n return $keys;\n }",
"public function getRecordKeys()\n\t{\n\t\t$arKeys = [];\n\t\t$arKey = [];\n\t\tif (Param(\"key_m\") !== NULL) {\n\t\t\t$arKeys = Param(\"key_m\");\n\t\t\t$cnt = count($arKeys);\n\t\t} else {\n\t\t\tif (Param(\"id\") !== NULL)\n\t\t\t\t$arKeys[] = Param(\"id\");\n\t\t\telseif (IsApi() && Key(0) !== NULL)\n\t\t\t\t$arKeys[] = Key(0);\n\t\t\telseif (IsApi() && Route(2) !== NULL)\n\t\t\t\t$arKeys[] = Route(2);\n\t\t\telse\n\t\t\t\t$arKeys = NULL; // Do not setup\n\n\t\t\t//return $arKeys; // Do not return yet, so the values will also be checked by the following code\n\t\t}\n\n\t\t// Check keys\n\t\t$ar = [];\n\t\tif (is_array($arKeys)) {\n\t\t\tforeach ($arKeys as $key) {\n\t\t\t\tif (!is_numeric($key))\n\t\t\t\t\tcontinue;\n\t\t\t\t$ar[] = $key;\n\t\t\t}\n\t\t}\n\t\treturn $ar;\n\t}",
"public function getKeys() {}",
"function get_by_key($key,$id){\n\t\t$data = array();\n\t\t$sql = \"SELECT * FROM dinamic_media WHERE media_key='\".$key.\"' AND media_keyid=\".$id;\n\t\t$data = $this->mysql->get_data($sql,'clean');\n\t\treturn $data;\n\t}",
"public function getCacheKeyInfo();",
"protected function getPreloadKeys() {\n\t\t$keys = array(\n\t\t\t'echo-notification-timestamp',\n\t\t\t'echo-notification-timestamp-' . EchoAttributeManager::MESSAGE,\n\t\t\t'echo-notification-timestamp-' . EchoAttributeManager::ALERT,\n\t\t\t'echo-notification-count',\n\t\t\t'echo-notification-count-' . EchoAttributeManager::MESSAGE,\n\t\t\t'echo-notification-count-' . EchoAttributeManager::ALERT,\n\t\t);\n\n\t\treturn array_filter( array_merge(\n\t\t\tarray_map( array( $this, 'getMemcKey' ), $keys ),\n\t\t\tarray_map( array( $this, 'getGlobalMemcKey' ), $keys )\n\t\t) );\n\t}",
"abstract public function getKeys();",
"public function fetchPublicKeys() {\n $data = json_decode(file_get_contents(self::CognitoIdentityKeyEndpoint), fasle);\n $publicKeys = array();\n foreach ($data[\"keys\"] as $keyEntry) {\n $publicKeys[$keyEntry['kid']] = $keyEntry;\n }\n\n //@todo Implement local cache\n return $publicKeys;\n }",
"public function getKeys();",
"public function getRecordKeys()\n\t{\n\t\t$arKeys = [];\n\t\t$arKey = [];\n\t\tif (Param(\"key_m\") !== NULL) {\n\t\t\t$arKeys = Param(\"key_m\");\n\t\t\t$cnt = count($arKeys);\n\t\t} else {\n\t\t\tif (Param(\"IncomeCode\") !== NULL)\n\t\t\t\t$arKeys[] = Param(\"IncomeCode\");\n\t\t\telseif (IsApi() && Key(0) !== NULL)\n\t\t\t\t$arKeys[] = Key(0);\n\t\t\telseif (IsApi() && Route(2) !== NULL)\n\t\t\t\t$arKeys[] = Route(2);\n\t\t\telse\n\t\t\t\t$arKeys = NULL; // Do not setup\n\n\t\t\t//return $arKeys; // Do not return yet, so the values will also be checked by the following code\n\t\t}\n\n\t\t// Check keys\n\t\t$ar = [];\n\t\tif (is_array($arKeys)) {\n\t\t\tforeach ($arKeys as $key) {\n\t\t\t\tif (!is_numeric($key))\n\t\t\t\t\tcontinue;\n\t\t\t\t$ar[] = $key;\n\t\t\t}\n\t\t}\n\t\treturn $ar;\n\t}",
"protected function _getAllCustomMetadataKeys() {}",
"public function list_cache()\n {\n $result = $this->_db->find('all');\n\n $return_list = array();\n $ttl_expiry = time() - $this->_cacheTTL;\n\n foreach ($result as $i => $cache_item) {\n $expired = false;\n $ttl = $cache_item[$this->_db->name]['created'];\n\n if ($ttl < $ttl_expiry) {\n $expired = true;\n }\n\n $return_list[] = array(\n 'item_name' => $cache_item[$this->_db->name]['request_hash'],\n 'contents' => $cache_item[$this->_db->name]['request_response'],\n 'location' => $cache_item[$this->_db->name]['request_hash'],\n 'ttl' => $ttl,\n 'expired' => $expired\n );\n }\n\n return $return_list;\n }",
"static function getKeys();",
"public function getKeys() {\n\t\treturn $this->getAllKeys();\n\t}",
"public function getAllItems(){\n\n\t\treturn $this->redis_client->keys(\"*\");\n\t}",
"public function keys();",
"public function keys();",
"public function keys();",
"public function keys();",
"public function keys();",
"public function keys();",
"public function get_all(){\n $cache_data_list=[];\n if($this->driver=='file'){\n foreach ($cache_list=$this->file->file_walk($this->path) as $value){\n $cache_data_list[]=$this->file->read_file($value);\n }\n }\n if($this->driver==\"redis\"){\n foreach ($this->redis->hGetAll($this->path) as $key=>$value){\n $cache_data_list[]=$value;\n }\n }\n return $cache_data_list;\n }",
"public function getAll() {\n\n\t\t\t// If desired clean up all expired cached objects\n\t\t\tif ($this->_autoDeleteExpired) {\n\t\t\t\t$this->deleteExpired();\n\t\t\t}\n\n\t\t\t$res = array();\n\t\t\t$filename = $this->_getFileName();\n\t\t\t$cachedData = $this->_loadCache($filename);\n\t\t\t// If cached data exists unserialize and return\n\t\t\tif ($cachedData) {\n\t\t\t\tforeach ($cachedData as $key => $value) {\n\t\t\t\t\t$res[$key] = unserialize($value['data']);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $res;\t\t\t\n\t\t}",
"public function getCache() {\n $db = \\Helper::getDB();\n $db->join('cached_assets c', 'dc.cacheId = c.id', 'LEFT');\n $db->where('dc.fileId', $db->escape($this->getId()));\n $results = $db->get('document_files_cache dc');\n\n return $results;\n }",
"function GetRecordKeys() {\n\t\tglobal $EW_COMPOSITE_KEY_SEPARATOR;\n\t\t$arKeys = array();\n\t\t$arKey = array();\n\t\tif (isset($_POST[\"key_m\"])) {\n\t\t\t$arKeys = ew_StripSlashes($_POST[\"key_m\"]);\n\t\t\t$cnt = count($arKeys);\n\t\t} elseif (isset($_GET[\"key_m\"])) {\n\t\t\t$arKeys = ew_StripSlashes($_GET[\"key_m\"]);\n\t\t\t$cnt = count($arKeys);\n\t\t} elseif (!empty($_GET) || !empty($_POST)) {\n\t\t\t$isPost = ew_IsHttpPost();\n\t\t\tif ($isPost && isset($_POST[\"IDXDAFTAR\"]))\n\t\t\t\t$arKeys[] = ew_StripSlashes($_POST[\"IDXDAFTAR\"]);\n\t\t\telseif (isset($_GET[\"IDXDAFTAR\"]))\n\t\t\t\t$arKeys[] = ew_StripSlashes($_GET[\"IDXDAFTAR\"]);\n\t\t\telse\n\t\t\t\t$arKeys = NULL; // Do not setup\n\n\t\t\t//return $arKeys; // Do not return yet, so the values will also be checked by the following code\n\t\t}\n\n\t\t// Check keys\n\t\t$ar = array();\n\t\tif (is_array($arKeys)) {\n\t\t\tforeach ($arKeys as $key) {\n\t\t\t\tif (!is_numeric($key))\n\t\t\t\t\tcontinue;\n\t\t\t\t$ar[] = $key;\n\t\t\t}\n\t\t}\n\t\treturn $ar;\n\t}"
]
| [
"0.70068485",
"0.68827116",
"0.66198653",
"0.64602005",
"0.6445283",
"0.63892466",
"0.6387084",
"0.6235416",
"0.6221007",
"0.6219997",
"0.6175087",
"0.61611813",
"0.61464274",
"0.6142853",
"0.61228675",
"0.61150765",
"0.61022097",
"0.6094038",
"0.604731",
"0.60423213",
"0.6006062",
"0.6006062",
"0.6006062",
"0.6006062",
"0.6006062",
"0.6006062",
"0.5962675",
"0.5936109",
"0.59289074",
"0.58892304"
]
| 0.7280174 | 0 |
wrapper for srorage method, that check media directory | protected function checkMediaDir($storage_name, $media_name){
try {
//return $this->clients[$storage_name]->checkDir($media_name, $this->media_type);
return $this->clients[$storage_name]->resource($this->media_type)->ids($media_name)->get();
}catch (Exception $exception){
$this->parseException($exception);
/*if ($exception instanceof RESTClientException){
$storage = new Storage(array('name' => $storage_name));
$storage->markAsFailed($exception->getMessage());
}*/
return false;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function getMediaDirectory()\n {\n return $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);\n }",
"public static function getMediaPath()\n {\n $mediaDir = Config::get('media.media_dir');\n $mediaFullPath = ROOT . self::getFilesPath() . $mediaDir;\n\n if(!file_exists($mediaFullPath))\n {\n if(!is_writable(ROOT . self::getFilesPath()) || !mkdir($mediaFullPath, Config::get('media.dir_chmod'), true))\n return false;\n }\n\n return $mediaDir;\n }",
"public static function media($path){\n \n if(is_file(DEL_PATH.$path) && $path != '')\n return true;\n else \n return false;\n \n }",
"public function accessMediasFolder()\n {\n return true;\n }",
"function invoke_image_uploaded($media_filename, $image_thumb = true)\n{\n\n $image_dir = __DIR__ . '/../../public/files/pictures/thumbs/small_'.$media_filename;\n\n $image_src = null;\n\n if (is_readable($image_dir)) {\n\n if ($image_thumb) {\n\n $image_src = app_url().DS.APP_IMAGE_THUMB.'small_'.rawurlencode(basename($media_filename));\n\n return $image_src;\n\n } else {\n\n $image_src = app_url().DS.APP_IMAGE.rawurlencode(basename($media_filename));\n\n return $image_src;\n\n }\n\n } else {\n\n return false;\n \n }\n \n}",
"private static function media()\n {\n $files = ['QR'];\n $folder = static::$root.'Media'.'/';\n\n self::call($files, $folder);\n }",
"protected function isDirectory() {}",
"public function media();",
"function media($file = null, $dir = null, $base = TRUE)\n{\n\t$CI =& get_instance();\n\t// check for base\n\t$base_url = '';\n\tif($base == TRUE)\n\t{\n\t\t$base_url = $CI->config->slash_item('base_url');\n\t}\n\t// return url\n\tif( $dir != null && $CI->config->slash_item('dir_'.$dir) != null)\n\t{\n\t\treturn $base_url.$CI->config->slash_item('dir_'.$dir).$file;\t\n\t}\n\telse\n\t{\n\t\treturn $base_url.$CI->config->slash_item('dir_media').$file;\t\n\t}\n}",
"function check_directory($directory)\n{\n if (!Storage::exists($directory)) {\n Storage::makeDirectory($directory);\n }\n\n return $directory;\n}",
"function uploads_dir() {\n\tglobal $root;\n\treturn $root.Media::instance()->path;\n}",
"public function get_media()\n {\n }",
"public function directory();",
"public function getMediaFolders(){\n return MediaFolder::all();\n\t\t\n }",
"function check_dir() \n\t{\n @chmod($this->path_to_assets,0777);\n $this->createDir(ABSPATH.\"wp-includes/\".$this->books_dir);\n $this->createDir(ABSPATH.\"wp-includes/\".$this->images_dir);\n\t\t /// echo $this->plugin_path.$this->images_dir.\" \\n\";\n\t\t //echo $this->path_to_assets.\" \\n\";\n }",
"function has_hq($vdetails,$is_file=false)\r\n{\r\n if(!$is_file)\r\n $file = get_hq_video_file($vdetails);\r\n else\r\n $file = $vdetails;\r\n\r\n if(getext($file)=='mp4')\r\n return $file;\r\n else\r\n return false;\r\n}",
"public function getDirectoryMonitor();",
"public function hasDirectory(): bool;",
"public function hasDirectory(): bool;",
"public function need_media()\n\t{\n\t\treturn $this->need_media;\n\t}",
"public abstract function getDirectory();",
"public function isFolder();",
"function rex_com_mediaaccess_ImageManager_checkPerm($filename, $ADDONSsic)\n{\n global $REX;\n \n if($filename)\n {\n ## get auth - isn't loaded yet\n $REX['ADDON']['community']['plugin_auth'] = $ADDONSsic['community']['plugin_auth'];\n require_once $REX[\"INCLUDE_PATH\"].\"/addons/community/plugins/auth/inc/auth.php\";\n \n $media = rex_com_mediaaccess::getMediaByFilename($filename);\n if(!$media->checkPerm())\n exit;\n }\n}",
"function dynamik_skins_folder_scan( $skin_check = false )\n{\n\tif( dynamik_dir_check( dynamik_get_skins_folder_path() ) )\n\t{\n\t\t$skin_folder_names = scandir( dynamik_get_skins_folder_path() );\n\t\tif( false != $skin_check )\n\t\t{\n\t\t\tif( in_array( $skin_check, $skin_folder_names ) )\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn;\n\t}\t\n}",
"private function hasThumbnailFolder($t_dir)\n {\n // d($t_dir['thumbnails']);\n if ($t_dir['thumbnails']->current()->getBaseName() === 'thumbnails') {\n d($t_dir->current());\n\n return $t_dir->current();\n //$this-> getAllThumb($t_dir->current());\n }\n }",
"private function check_directory()\n\t{\n\t\tif (!is_dir(Kohana::config($this->type.'.cache_folder')))\n\t\t\tmkdir(Kohana::config($this->type.'.cache_folder'));\n\t}",
"public function __construct($path_to_media, $persistent) {}",
"abstract function isdir($rempath = '.');",
"public function is_dir($file);",
"public function beforeSave()\n {\n $this->_mediaDirectory = $this->_filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);\n parent::beforeSave();\n\n return $this;\n }"
]
| [
"0.6680452",
"0.65520984",
"0.65335155",
"0.6170419",
"0.61345065",
"0.6114859",
"0.60657525",
"0.60637456",
"0.60212123",
"0.6006439",
"0.5967119",
"0.58150625",
"0.57586765",
"0.5675052",
"0.56699616",
"0.55670196",
"0.55596286",
"0.5530553",
"0.5530553",
"0.55140275",
"0.5490192",
"0.5480464",
"0.54772896",
"0.5460059",
"0.54535174",
"0.5442872",
"0.5438094",
"0.5431506",
"0.54285043",
"0.54067504"
]
| 0.7446418 | 0 |
Return media params from db | protected function getMediaParams($media_id){
$media_params = $this->db->from($this->db_table)
->where(array('id' => $media_id))
->get()
->first();
if (!empty($media_params)){
if (!empty($media_params['rtsp_url'])){
$this->rtsp_url = $media_params['rtsp_url'];
}
if (!empty($media_params['protocol'])){
$this->media_protocol = $media_params['protocol'];
}
}
return $media_params;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function selectMedia($parameters)\n{\n\tglobal $db;\n // check the parameters and add to where clause\n $where = '';\n\n // id_project\n if(!empty($parameters['id_project']))\n {\n if(is_array($parameters['id_project']))\n {\n $createdByArray = array();\n foreach($parameters['id_project'] as $id_project)\n {\n if(is_numeric($id_project))\n $createdByArray[] = $id_project;\n }\n $where .= \" AND id_project in (\".implode(', ',$createdByArray).\") \";\n }\n else\n $where .= \" AND id_project = \".(0+$parameters['id_project']).\" \";\n }\n\n //updated since\n if(!empty($parameters['updatedSince']))\n {\n // has to be unix timestamp\n if(is_numeric($parameters['updatedSince']))\n $where .= \" AND ( created_at > '\".date('Y-m-d H:i:s',$parameters['updatedSince']).\"' or updated_at > '\".date('Y-m-d H:i:s',$parameters['updatedSince']).\"' )\";\n }\n\n //id media\n if(!empty($parameters['idMedia']))\n {\n if(is_array($parameters['idMedia']))\n {\n $mediaIdArray = array();\n\n foreach($parameters['idMedia'] as $mediaIdEntry)\n {\n // numeric entries only\n if(is_numeric($mediaIdEntry))\n $mediaIdArray[] = $mediaIdEntry;\n }\n\n $where .= \" AND media.id in (\".implode(', ',$mediaIdArray).\")\";\n }\n else\n {\n //single id\n $where .= \" AND media.id = \".(0+$parameters['idMedia']);\n }\n\n }\n\n // media type\n if(!empty($parameters['mediaType']))\n {\n $mediaType = addslashes($parameters['mediaType']);\n\n // check in DB for entries matching the mediatype\n $query = \"\n SELECT\n `id`\n FROM\n `\".$GLOBALS['dataBaseToUse'].\"`.`media_type`\n WHERE\n `deleted` = 0\n AND (`content_type` like '\".$mediaType.\"' or `file_ending` = '\".$mediaType.\"')\n \";\n\n $result = $db -> query($query);\n\n $mediaTypeIds = array();\n while($row = mysqli_fetch_assoc($result))\n {\n $mediaTypeIds[] = $row['id'];\n }\n\n // if we have results use id_media_type else try to find the given media_type as file ending\n if(!empty($mediaTypeIds))\n $where .= \" AND `media`.`id_media_type` in (\".implode(', ',$mediaTypeIds).\") \";\n elseif($mediaType != 'all')\n $where .= \" AND `media`.`file_ending` = '\".$mediaType.\"' \";\n\n\n\n }\n\n // find media by string\n if(!empty($parameters['searchAll']))\n {\n // there are two possibilities: find string in keyword, file_ending or in context-info\n // first media_context\n\n // check in DB for entries matching the mediatype\n $query = \"\n SELECT\n `id_media`\n FROM\n `\".$GLOBALS['dataBaseToUse'].\"`.`media_context`\n WHERE\n `deleted` = 0\n AND (`title` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `subtitle` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `description` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `copyright` like '%\".addslashes($parameters['searchAll']).\"%')\n \";\n\n\n $result = $db -> query($query);\n\n $mediaIdArray = array(0);\n while($row = mysqli_fetch_assoc($result))\n {\n $mediaIdArray[] = $row['id_media'];\n }\n\n $where .= \" AND (\n `media`.`id` in (\".implode(', ',$mediaIdArray).\")\n OR\n `keywords` like '%\".addslashes($parameters['searchAll']).\"%'\n OR `file_ending` like '\".addslashes($parameters['searchAll']).\"')\";\n\n }\n\n // paging contains results per block as blocksize and number of block used for the query\n if(!empty($parameters['paging']))\n {\n // blocksize from setting or standard\n if(!empty($parameters['paging']['blocksize']))\n $blocksize = 0+$parameters['paging']['blocksize'];\n else\n $blocksize = 20;\n\n if(!empty($parameters['paging']['block']))\n $block = 0+$parameters['paging']['block'];\n else\n $block = 1;\n\n $parameters['limit'] = \" LIMIT \".(($block-1) * $blocksize).\", \".$blocksize.\" \";\n }\n\n if(!empty($parameters['order']))\n $where .= addslashes($parameters['order']);\n\n if(!empty($parameters['limit']))\n $where .= addslashes($parameters['limit']);\n\n // select media\n\n // get ids for media entries\n\t$query = \"\n\t\t SELECT\n SQL_CALC_FOUND_ROWS\n `media`.`id`\n FROM\n\t\t `\".$GLOBALS['dataBaseToUse'].\"`.`media`\n\n\t\t WHERE\n\t\t `media`.`deleted` = 0\n \".$where.\"\n\t \";\n\n\t$result = $db -> query($query);\n\n\n $return = array();\n\n // reports\n $return['parameters'] = $parameters;\n $return['numResults'] = '';\n\n while($row = mysqli_fetch_assoc($result))\n {\n $return['data'][$row['id']] = array();\n }\n\n // number of possible results\n $countResult = $db -> query(\"SELECT FOUND_ROWS()\");\n $countArray = $row = mysqli_fetch_assoc($countResult);\n $return['numResults'] = $countArray['FOUND_ROWS()'];\n\n // now get the values\n if(!empty($return['data']))\n {\n $mediaData = getMedia(array_keys($return['data']));\n #print_r($mediaData);\n foreach($mediaData as $idMedia => $row)\n $return['data'][$idMedia] = $row;\n }\n\n\n return $return;\n\n}",
"function getMedia($pObj){\n\n\t\tglobal $TSFE,$EXEC_TIME,$FE_USER;\n\t\t\n\t\tif(!strlen($pObj['media'])>0){\n\t\t\treturn $pObj;\n\t\t}\n\t\tif($FE_USER->user['uid']>0){\n\t\t\t//logged in\n\t\t\tif($FE_USER->user['usergroup']){\n\t\t\t//should be in usergroup but if not to prevent sql error\n\t\t\t\t$ug = $FE_USER->user['usergroup'] .',';\n\t\t\t}else{\n\t\t\t\t$ug='';\n\t\t\t}\n\t\t\t$fe_access = ' AND fe_group IN ('.$ug.'0,-2) AND fe_group !=-1';\n\t\t}else{\n\t\t\t//-1 hide at login, -2 show at login\n\t\t\t$fe_access =' AND fe_group IN (0,-1)';\n\t\t}\n\t\t\n\t\tif(strrpos($pObj['media'],'_')>0){\n\t\t\t//media sent in recs format...ie used as normal html page content..lets convert\n\t\t\t$ma = explode(',',$pObj['media']);\n\t\t\t$pObj['media'] = $this->getRecordId($ma[0]);\n\t\t\t\n\t\t\tforeach($ma as $k=>$v){\n\t\t\t\tif($k>0){\n\t\t\t\t\t$pObj['media'].= ','.$this->getRecordId($v);\t\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//return $pObj['media'];\n\t\t$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,tstamp,crdate,cruser_id,parent_id,deleted,active,sorting,hidden,starttime,endtime,fe_group,sys_language_uid,l18n_parent,media_type,title,category,index_type,file_mime_type,file_mime_subtype,file_type,file_type_version,file_name,file_path,file_size,file_mtime,file_inode,file_ctime,file_hash,file_status,file_orig_location,file_orig_loc_desc,file_creator,file_dl_name,file_usage,meta,ident,creator,keywords,description,alt_text,caption,abstract,search_content,language,pages,publisher,copyright,instructions,date_cr,date_mod,loc_desc,loc_country,loc_city,hres,vres,hpixels,vpixels,color_space,width,height,height_unit', 'tx_dam', 'NOT deleted AND NOT hidden AND (uid IN ('.$pObj['media'].') OR l18n_parent IN ('.$pObj['media'].')) AND starttime<='.$EXEC_TIME.' AND (endtime=0 OR endtime>'.$EXEC_TIME.') '.$fe_access,'','sorting');\n\n\n\t\t//sorting them according to the order in which they were listed, ie. not according to \"sorting\" field\n\n\t\t$tempRecs = array();\n\t\t$orderedRecs = array();\n\t\twhile ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))\t{\n\t\t\t//$row['pi_flexform'] = $data = t3lib_div::xml2array($row['pi_flexform']);\n\t\t\t//build lanugage key...like lES, or lSE...default is lDEF\n\t\t\t//$lKey = 'l'.$L;\n\t\t\t//$cid = $data['data']['sDEF'][$lKey]['tx_typoflash_component']['vDEF'];//component id\n\t\t\t/*if($cid){\n\t\t\t\t//filter out on language\n\t\t\t\t$row['component'] = $this->getComponent($cid);\n\t\t\t\t$row['path'] = 'uploads/tx_typoflash/';\n\t\t\t\t$row['conf'] = $data['data']['sDEF'][$lKey]['conf']['vDEF'];\n\t\t\t\t$row['target'] = $data['data']['sDEF'][$lKey]['target']['vDEF'];\n\t\t\t\t$row['language'] = $data['meta']['currentLangId'][0];//eg ES, SV\n\t\t\t\tif(!$extractLinkedRecords){\n\t\t\t\t\t$row['records'] = $data['data']['content_records'][$lKey];\n\t\t\t\t}else{\n\t\t\t\t\t$row['records'] = $this->getComponentRecords($data['data']['content_records'][$lKey],$lKey);\n\t\t\t\t}\n\t\t\t\t$row['component_data'] = unserialize($row['tx_typoflash_data']);\n\t\t\t\tunset($row['tx_typoflash_data']);\n\t\t\t\tunset($row['pi_flexform']);//uncomment if you don't want to send back all this\n\t\t\t}else{\n\t\t\t\t//don't send back those with wrong lanugage\n\t\t\t\tunset($row);\n\t\t\t}*/\n\n\t\t\t\n\t\t\tif($row['l18n_parent']>0){\n\t\t\t\tif($tempRecs[$row['l18n_parent']]['lang'] != null){\n\t\t\t\t\t//If we have already the original in our temp array we should append our overlay\n\t\t\t\t\t\n\t\t\t\t\t$tempRecs[$row['l18n_parent']]['lang'][$row['sys_language_uid']] = $row;\n\t\t\t\t}else{\n\t\t\t\t\t//else the loop hasnt reached the original yet so we shuld create it here\t\n\t\t\t\t\t$tempRecs[$row['l18n_parent']] = array('lang'=>array());\n\t\t\t\t\t$tempRecs[$row['l18n_parent']]['lang'][$row['sys_language_uid']] = $row;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t//only appending the original to the ordered list\n\t\t\t\t$orderedRecs[] = $tempRecs[$row['uid']] = array('lang'=>array(0=>$row,$row['sys_language_uid']=>$row));//we append row at both 0 and uid...most often they will be the same and thus overwrite eachother\n\t\t\t\t\n\t\t\t}\n\n\t\t}\n\n\t\t\n\t\tif($pObj['useSorting']){\n\t\t\tforeach ($orderedRecs as $k=>$v){\n\t\t\t\t//must reattach overlays to ordered list as it cant be done above\n\t\t\t\t$v[$k]['lang'] = $tempRecs[$v['uid']]['lang'];\n\t\t\t\n\t\t\t}\n\t\t\t$records = $orderedRecs;\n\t\t}else{\n\t\t\t$mRec = explode(',',$pObj['media']);\n\t\t\t$records = array();\t\n\t\t\tforeach ($mRec as $i=>$uid){\n\t\t\t\t$records[] = $tempRecs[$uid];\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\n\t\t//used in flash to know which of several components called...can be used instead of unique callback\n\t\t//$records['menuId'] = $pObj['menuId'];\n\n\t\t$err = mysql_error(); \n\n\n\t\tif($err==''){\n\t\t\tif($pObj['categoryRequest']){\n\t\t\t\t//asked for by getCategoryObject, no callback\n\t\t\t\treturn $records;\n\n\t\t\t}else{\n\t\t\t\treturn array('media'=>$records,'menuId'=>$pObj['menuId'],'callback'=>$pObj['callback']);\n\t\t\t}\n\t\t}else {\n\t\t\t$error = array('errortype'=>1,'errormsg'=>$err);\n\t\t\treturn $error;\n\t\t}\n\t\t/*\n\t\tNote that lES and lDEF refers to language requested.\n\n\t\t{data: {\n\t\tcontent_records: {lES: {orderBy: {vDEF: \"2\"}, \n\t\t\t pages: {vDEF: \"13\"}, \n\t\t\t recordLimit: {vDEF: \"5\"}, \n\t\t\t records: {vDEF: \"tt_content_31,tt_content_2\"}, \n\t\t\t tables: {vDEF: \"tt_news,tt_content\"}}}, \n\t\t sDEF: {lES: {\n\t\t\t conf: {vDEF: \"news=1&flop=true\"}, \n\t\t\t path: {vDEF: \"\"}, \n\t\t\t tx_typoflash_component: {vDEF: \"1\"}}}}, \n\t\t meta: {currentLangId: [\"ES\"]}}, \n\t\t*/\n\t\n\t}",
"public function media();",
"public function getMediaPath()\n {\n // should return an array\n $query = $this->query()\n ->join('media_handlers', 'media_handlers.model_id', '=', 'anggota.id')\n ->where('media_handlers.model_id', '=', $this->id)\n ->where('media_handlers.model_name', '=', $this->const_ModelName)\n ->where('media_handlers.deleted_at', '=', null)\n ->get();\n\n // return single object instead of an array\n if (count($query) != 0) {\n // Add new sub attribute about preview and\n $item = $query[0];\n $item->imageUrl = $this->getUrlPath($item->path);\n $item->thumbnail = $this->getThumbnailUrlPath($item->path);\n $item->preview = $this->getPreviewUrlPath($item->path);\n return $item;\n }\n\n return null;\n }",
"function getMedia($mediaId)\n{\n\tglobal $db;\n if(is_array($mediaId))\n {\n // first check the array\n if(empty($mediaId))\n return false;\n\n $mediaIdArray = array();\n\n foreach($mediaId as $mediaIdEntry)\n {\n // numeric entries only\n if(is_numeric($mediaIdEntry))\n $mediaIdArray[] = $mediaIdEntry;\n }\n\n $where = \" media.id in (\".implode(', ',$mediaIdArray).\")\";\n }\n else\n {\n //single id\n $where = \" media.id = \".(0+$mediaId);\n }\n\n\n\n\t$query = \"\n\t\t SELECT\n media.*,\n media_type.content_type\n FROM\n\t\t `\".$GLOBALS['dataBaseToUse'].\"`.`media`\n LEFT JOIN `\".$GLOBALS['dataBaseToUse'].\"`.`media_type` ON media.id_media_type = media_type.id\n\t\t WHERE\n\t\t \".$where.\"\n AND media.deleted = 0\n\t \";\n\n\t$result = $db -> query($query);\n\n // initializing returndata\n $return = array();\n\n while($row = mysqli_fetch_assoc($result))\n {\n $return[$row['id']] = $row;\n }\n\n if(!empty($return))\n {\n //get context information for media entry\n\n $query = \"\n SELECT\n media_context.*\n FROM\n `\".$GLOBALS['dataBaseToUse'].\"`.`media_context`\n WHERE\n id_media in (\".implode(', ',array_keys($return)).\")\n AND id_media_cluster = 0\n AND deleted = 0\n \";\n\n $result = $db -> query($query);\n while($row = mysqli_fetch_assoc($result))\n {\n $return[$row['id_media']]['contextInformation'][$row['id_language']] = $row;\n }\n\t }\n\n\t return $return;\n}",
"function getMediaData($storyid){\r\n\r\n\t\t\t$result\t= array();\r\n\r\n\t\t\t$res \t= array();\r\n\r\n\t\t\t$ci \t= & get_instance();\r\n\r\n\t\t\t$ci->db->select('images, videos, audios, attachments, demovideos, demoaudios, demoattachments');\r\n\r\n\t\t\t$ci->db->where_in('story_id',$storyid);\r\n\r\n\t\t\t$query = $ci->db->get('buzz_media_master');\r\n\r\n\t\t\t$res \t= $query->result_array();\r\n\r\n\t\t\tif(count($res)>0){\r\n\r\n\t\t\t\t$result = $res[0];\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//echo $ci->db->last_query();exit;\r\n\r\n\t\t\treturn $result; \r\n\r\n\t\t}",
"function getAllMedia() \n\t\t{\n\t\t\t\n\t\t\ttry{\n\n\t\t\t\t$query = $this->_db->prepare( \"SELECT * FROM media ORDER BY media_date DESC\" );\n\n\t\t\t\t$query->execute();\n\n\t\t\t\t$data = $query->fetchAll();\n\t\t\t\t\n\t\t\t\treturn $data;\n\n\t\t\t} catch ( PDOException $e ) {\n\n\t\t\t\techo $e->getMessage();\n\n\t\t\t}\n\t\t\t\n\t\t}",
"public function getCronMedia()\n { \n try\n { \n $supportedMimetypeList = Config::get('olapicmedia.supportedMimetypeList');\n $getDetails = Media::join('olapic_media_mappings','olapic_media_mappings.media_id','=','media.id')\n ->join('looks','looks.id', '=', 'media.model_id')\n ->where('olapic_media_mappings.status','=','new')\n ->where('olapic_media_mappings.type','=','upload')\n ->whereNull('media.manipulations')\n ->whereIn('media.mime_type', $supportedMimetypeList)\n ->select(\n 'olapic_media_mappings.id as mappingid',\n 'media.*',\n 'looks.id as folder_id',\n 'looks.user_id',\n 'looks.description',\n 'looks.products')\n ->get(); \n }catch (\\Exception $e) {\n $getDetails = array();\n Log::error($e->getMessage());\n }\n\n return $getDetails; \n }",
"public function get_media()\n {\n }",
"public function getDbMediaData($file)\n\t{\n\t\t$query = $this->_db->getQuery(true)\n\t\t\t->select('*')\n\t\t\t->from('#__flexicontent_mediadatas')\n\t\t\t->where('file_id = ' . (int) $file->id)\n\t\t\t;\n\t\treturn $this->_db->setQuery($query)->loadOBject();\n\t}",
"function get_mediaImages()\n\t\t{\n\t\t\t$query = $this -> db -> get('MediaSlider');\n\n\n\t\t\treturn $query->result();\n\t\t}",
"public function getMediaInfo( $media_type ,$objectId) ;",
"public function findMediaByType($type)\n{\n $sql = \"SELECT ID,\n media_filename,\n media_caption,\n media_type, \n media_target,\n media_user,\n media_access,\n media_status\n FROM tbl_media\n WHERE media_type = :media_type \n AND media_status = '1'\";\n\n $this->setSQL($sql);\n \n $mediaByType = $this->findRow([':media_type' => $type]);\n\n return (empty($mediaByType)) ?: $mediaByType;\n \n}",
"public function getMediaPath()\n {\n // should return an array of media handlers\n $query = $this->query()\n ->join('media_handlers', 'media_handlers.model_id', '=', 'upcoming_prokers.id')\n ->where('media_handlers.model_id', '=', $this->id)\n ->where('media_handlers.model_name', '=', $this->const_ModelName)\n ->where('media_handlers.deleted_at', '=', null)\n ->get();\n if (count($query) != 0) {\n // Add new sub attribute about preview and\n $item = $query[0];\n $item->imageUrl = $this->getUrlPath($item->path);\n $item->thumbnail = $this->getThumbnailUrlPath($item->path);\n $item->preview = $this->getPreviewUrlPath($item->path);\n return $item;\n }\n\n return null;\n }",
"public function getMediaUrl($mid) {\n $image_preset_tid = \\Drupal::request()->get('image_preset_tid');\n $output = [];\n $media = Media::load($mid);\n if (is_object($media)) {\n if ($media->hasField('field_media_image')) {\n $targetid = $media->field_media_image->target_id;\n $file = File::load($targetid);\n $output['url_mid'] = file_create_url($file->getFileUri());\n $output['media_preset'] = $this->getMediaPresetProperties($image_preset_tid);\n }\n } else {\n // if media id =\"default\"\n $output['media_preset'] = $this->getMediaPresetProperties($image_preset_tid);\n }\n return new JsonResponse($output);\n }",
"public function getMedia(): MediaList\n {\n return $this->media;\n }",
"public function findMediaBlog($mediaId)\n{\n\n $sql = \"SELECT ID, media_filename, media_caption, media_type, media_target, \n media_user, media_access, media_status \n FROM tbl_media\n WHERE ID = :ID \n AND media_target = 'blog'\n AND media_access = 'public'\n AND media_status = '1'\";\n \n $this->setSQL($sql);\n\n $item = $this->findRow([':ID' => (int)$mediaId]);\n\n return (empty($item)) ?: $item;\n\n}",
"function get_all_media() {\n\t\treturn $this->mediaFiles;\n\t}",
"public function getMedia()\n {\n return $this->media;\n }",
"public function getMedia()\n {\n return $this->hasOne(SocialMedias::className(), ['ID' => 'MediaID']);\n }",
"public static function media_update_parameters() {\n return new \\external_function_parameters(array(\n 'code' => new \\external_value(PARAM_ALPHANUM, 'Stream code', VALUE_REQUIRED, 0, NULL_NOT_ALLOWED),\n 'draftid' => new \\external_value(PARAM_INT, 'Draft files ID', VALUE_REQUIRED, 0, NULL_NOT_ALLOWED),\n ));\n }",
"public function getMediaId();",
"public function get_embed_params() {\n $settings = $this->get_settings_for_display();\n\n $params = [];\n\n if ( $settings['autoplay'] && ! $this->has_image_overlay() ) {\n $params['autoplay'] = '1';\n }\n\n $params_dictionary = [];\n\n\n foreach ( $params_dictionary as $key => $param_name ) {\n $setting_name = $param_name;\n\n if ( is_string( $key ) ) {\n $setting_name = $key;\n }\n\n $setting_value = $settings[ $setting_name ] ? '1' : '0';\n\n $params[ $param_name ] = $setting_value;\n }\n\n return $params;\n }",
"public function findMediaMetaValue($mediaId, $media_filename, $sanitize)\n{\n \n $idsanitized = $this->filteringId($sanitize, $mediaId, 'sql');\n\n $sql = \"SELECT ID, media_id, meta_key, meta_value FROM tbl_mediameta \n WHERE media_id = :media_id AND meta_key = :meta_key\";\n\n $this->setSQL($sql);\n\n $mediameta = $this->findRow([':media_id' => $idsanitized, ':meta_key' => $media_filename]);\n\n return (empty($mediameta)) ?: $mediameta;\n\n}",
"public function getMediaAttributes()\n {\n if (!$this->hasMediaAttributes()) {\n $mediaAttributes = array();\n foreach ($this->getAttributes() as $attribute) {\n if($attribute->getFrontend()->getInputType() == 'media_image') {\n $mediaAttributes[$attribute->getAttributeCode()] = $attribute;\n }\n }\n $this->setMediaAttributes($mediaAttributes);\n }\n return $this->getData('media_attributes');\n }",
"public function getMediaItem($id);",
"public function media()\n {\n return $this->morphToMany(Media::class, 'entity', 'entity_media')\n ->withPivot(['id', 'zone'])\n ->withTimestamps();\n }",
"public function getMediaConfig()\n {\n return Mage::getSingleton('catalog/product_media_config');\n }",
"function insertMedia(){\n\t\n\t\t $itemType = \"media\";\n\t\t $host = OpenContext_OCConfig::get_host_config();\n\t\t //$tableSize = $this->get_table_size($itemType);\n\t\t $tableSize = 209899;\n\t\t $fetchSize = 1000;\n\t\t $numFetches = round($tableSize / $fetchSize, 0)+1;\n\t\t \n\t\t $db = $this->db;\n\t\t $whereCondition = true;\n\t\t \n\t\t $i = 0;\n\t\t while($i < $numFetches){\n\t\t\t\t\n\t\t\t\t$startNum = $i * $fetchSize;\n\t\t\t\t\n\t\t\t\t$sql = \"SELECT resource.uuid as itemUUID, resource.created, resource.updated, projects.accession\n\t\t\t\tFROM resource\n\t\t\t\tJOIN projects ON resource.project_id = projects.project_id \n\t\t\t\tWHERE \".$whereCondition.\"\n\t\t\t\tLIMIT $startNum, $fetchSize\n\t\t\t\t\";\n\t\t\t\t\n\t\t\t\t$result = $db->fetchAll($sql, 2);\n\t\t\t\tforeach($result as $row){\n\t\t\t \n\t\t\t $itemUUID = $row[\"itemUUID\"];\n\t\t\t $created = $row[\"created\"];\n\t\t\t $updated = $row[\"updated\"];\n\t\t\t \n\t\t\t if($created == \"0000-00-00 00:00:00\"){\n\t\t\t\t\t$created = $row[\"accession\"];\n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t\t $itemURI = $host.\"/media/\".$itemUUID;\n\t\t\t $data = array(\"itemType\" => $itemType,\n\t\t\t\t\t\t \"itemUUID\" => $itemUUID,\n\t\t\t\t\t\t \"itemURI\" => $itemURI,\n\t\t\t\t\t\t \"NOIDcreated\" => 0,\n\t\t\t\t\t\t \"itemCreated\" => $created,\n\t\t\t\t\t\t \"itemUpdated\" => $updated\n\t\t\t\t\t\t );\n\t\t\t try{\n\t\t\t\t\t$db->insert(\"noid_bindings\", $data);\n\t\t\t }catch (Exception $e) {\n\t\t\t\t\t//skip\n\t\t\t\t\t//echo $e;\n\t\t\t }\n\t\t\t \n\t\t\t\t}//end loop thorugh items\n\t\t\t\t\n\t\t $i++;\n\t\t }//end loop through fetches\n\t\t \n\t\t return $i;\n }",
"function mediapress_get_media_object($post_id) {\n if (!$post_id){ return; }\n\n $minireel_id = get_post_meta($post_id, 'c6-minireel-id', true);\n $campaign_id = get_post_meta($post_id, 'c6-campaign-id', true);\n\n $campaign = get_query_var('campaign');\n $campaign = $campaign ? $campaign : $campaign_id;\n $container = get_query_var('container');\n $container = $container ? $container : 'minireel.tv';\n $type = get_query_var('type');\n $type = $type ? $type : 'full-np';\n $launch_urls = get_query_var('launchUrls');\n $play_urls = get_query_var('playUrls');\n $count_urls = get_query_var('countUrls');\n\n $query_string = '?experience=' . $minireel_id;\n $query_string .= $campaign ? '&campaign=' . $campaign : '';\n $query_string .= '&context=minireel.tv';\n $query_string .= '&container=' . $container;\n $query_string .= $launch_urls ? '&launchUrls=' . urlencode($launch_urls) : '';\n $query_string .= $play_urls ? '&playUrls=' . urlencode($play_urls) : '';\n $query_string .= $count_urls ? '&countUrls=' . urlencode($count_urls) : '';\n\n if ($minireel_id) {\n print '<iframe src=\"//platform.reelcontent.com/api/public/players/' . $type . $query_string . '\" width=\"100%\" height=\"100%\" frameborder=\"0\"></iframe>';\n }\n}"
]
| [
"0.6692739",
"0.65198565",
"0.6479409",
"0.64046305",
"0.6363278",
"0.63472265",
"0.62801605",
"0.62714225",
"0.6259335",
"0.6146153",
"0.6120395",
"0.6105055",
"0.61016554",
"0.606926",
"0.60284436",
"0.59939325",
"0.5991145",
"0.59644437",
"0.58860815",
"0.5846126",
"0.5819975",
"0.5817343",
"0.57950103",
"0.5748459",
"0.5736121",
"0.57088053",
"0.5702691",
"0.5666997",
"0.56653255",
"0.5652356"
]
| 0.6945192 | 0 |
Increment counter of storage deny | protected function incrementStorageDeny($storage_name){
$storage = $this->db->from('storage_deny')->where(array('name' => $storage_name))->get()->first();
if (empty($storage)){
$this->db->insert('storage_deny',
array(
'name' => $storage_name,
'counter' => 1,
'updated' => 'NOW()'
));
}else{
$this->db->update('storage_deny',
array(
'counter' => $storage['counter'] + 1,
'updated' => 'NOW()'
),
array('name' => $storage_name));
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function incrementStorageDeny($storage_name)\n {\n\n $storage = ORM::for_table('storage_deny')->where(['name' => $storage_name])->find_one();\n\n if (empty($storage)) {\n $storage_deny = ORM::for_table('storage_deny')->create();\n $storage_deny->name = $storage_name;\n $storage_deny->counter = 1;\n $storage_deny->set_expr('updated', 'NOW()');\n $storage_deny->save();\n } else {\n $storage->name = $storage_name;\n $storage->counter = $storage->counter + 1;\n $storage->set_expr('updated', 'NOW()');\n $storage->save();\n }\n }",
"public function allow()\n {\n ++$this->allowed;\n\n if (NODE_ACCESS_DENY !== $this->result) {\n $this->result = NODE_ACCESS_ALLOW;\n }\n }",
"function _setCounter()\n {\n\t\t$counter = $this->get( 'session.counter', 0 );\n\t\t++$counter;\n\n\t\t$this->set( 'session.counter', $counter );\n \treturn true;\n }",
"public function countAuthAttempts()\n {\n $previous = Mage::getSingleton('core/session')->getCCAttempts();\n\n if(!$previous)\n {\n $previous = 1;\n } else {\n $previous++;\n }\n\n Mage::getSingleton('core/session')->setCCAttempts($previous);\n }",
"public function increaseLoginCount()\n {\n $cache = \\System::getContainer()->get('contao.cache');\n\n if ($cache->contains('login-count')) {\n $count = intval($cache->fetch('login-count')) + 1;\n } else {\n $count = 1;\n }\n\n $cache->save('login-count', $count);\n }",
"function tdc_update_count($database, $filenode, $database_file){\n $count = (int)$filenode->downloadcount[0] + 1;\n $filenode->downloadcount[0] = (string)$count;\n if ($database->asXML($database_file) === false){\n throw new Exception('Cannot save values into \"'.$database_file.'\"',99);\n }\n}",
"public function incResponseCount()\n {\n $incResponse = (int) $this->attribute( 'response_count' );\n $incResponse++;\n $this->setAttribute( 'response_count', $incResponse );\n $this->store();\n }",
"protected function increment(){\n $count = $this->model->getClickCount();\n $count++;\n $this->model->setClickCount($count);\n $this->model->save(false);\n \n }",
"public function increase()\n {\n $reservedIds = [];\n if ($this->reserved !== null) {\n $reservedIds = explode(',', $this->reserved);\n }\n $this->next++;\n while (in_array($this->next, $reservedIds)) {\n $this->next++;\n }\n $this->save();\n }",
"public function increment() {\n\t\t$this->amount++;\n\t}",
"public static function reInstateQuotaExceeded()\n {\n //$noticeControl = Notices::getInstance();\n //$notice = $noticeControl->getNoticeByID(self::MSG_QUOTA_REACHED);\n Notices::removeNoticeByID(self::MSG_QUOTA_REACHED);\n //$notice->unDismiss();\n //$noticeControl->update();\n }",
"public function incrementStripeAttempts()\n {\n $this->stripe_attempts += 1;\n $this->save();\n }",
"public function incrementError() {\n\t\tapc_add($this->prefix.'error', 0);\n\t\tapc_inc($this->prefix.'error', 1);\n\t}",
"private function incrementFavoriteCount()\n {\n $counter = $this->favoriteCounter()->first();\n\n if ($counter) {\n $counter->count++;\n $counter->save();\n } else {\n $counter = new FavoriteCounter;\n $counter->count = 1;\n $this->favoriteCounter()->save($counter);\n }\n }",
"public function actionStoragesRating(): never\n\t{\n\t\t$this->redirectPermanent('PasswordsStorages:rating');\n\t}",
"public function count(): int\n {\n return count($this->storage);\n }",
"public function updateCount() {\n $sql = \"UPDATE goCount SET count = count + 1 WHERE 1\";\n\n if (self::$conn->query($sql) === FALSE) {\n echo \"Error updating count record: \" . self::$conn->error;\n }\n }",
"public function increment() {\r\n\t\t$_SESSION['count']++;\r\n\treturn $_SESSION['count'];\r\n\t}",
"private function incrementFavoriteCount()\n\t{\n\t\t$counter = $this->favoriteCounter()->first();\n\n\t\tif($counter) {\n\t\t\t$counter->count++;\n\t\t\t$counter->save();\n\t\t} else {\n\t\t\t$counter = new FavoriteCounter;\n\t\t\t$counter->count = 1;\n\t\t\t$this->favoriteCounter()->save($counter);\n\t\t}\n\t}",
"public function countStored(): int;",
"public function incrementPendingEntriesCount()\n\t{\n\t\t$this->setPendingEntriesCount($this->getPendingEntriesCount() + 1); \n\t\t$this->save();\n\t}",
"public function save_follow_count() {\n\t\t// Networks that do not have count data still need an integer.\n\t\tif ( empty( $this->follow_count) ) {\n\t\t\t$this->follow_count = 0;\n\t\t}\n\n\t\tSWFW_Utility::update_network_count( $this->key, $this->follow_count );\n\t}",
"public function incrementErrorCount();",
"public function increaseFailedAttemptsCount()\n {\n $this->failedAttemptsCount++;\n }",
"public function getDownloadcounter() {}",
"function phpTrafficA_add_access($table, $c, $datestring, $pageid, $how=0) {\n// Saving how we got to the page\nswitch($how) {\n\tcase 2:\n\t\t$sql = \"UPDATE `${table}_pages` SET se=se+1 WHERE id=$pageid;\";\n\t\tbreak;\n\tcase 3:\n\t\t$sql = \"UPDATE `${table}_pages` SET ref=ref+1 WHERE id=$pageid;\";\n\t\tbreak;\n\tcase 1:\n\t\t$sql = \"UPDATE `${table}_pages` SET internal=internal+1 WHERE id=$pageid;\";\n\t\tbreak;\n\tdefault:\n\t\t$sql = \"UPDATE `${table}_pages` SET other=other+1 WHERE id=$pageid;\";\n\t\tbreak;\n}\n$res = mysql_query($sql);\n// Updating count\n$sql = \"UPDATE `${table}_acces` SET count=count+1 WHERE label=$pageid AND date='$datestring'\";\n$res = mysql_query($sql);\nif (mysql_affected_rows() < 1) {\n// We failed in incrementing the counter: we need to add a new line\n\t$sql =\"INSERT INTO `${table}_acces` SET label=$pageid, date='$datestring', count='1'\";\n\t$res = mysql_query($sql);\n}\n// Updating count for the whole site\n$sql = \"UPDATE `${table}_acces` SET count=count+1 WHERE label=0 AND date='$datestring'\";\n$res = mysql_query($sql);\nif (mysql_affected_rows() < 1) {\n// We failed in incrementing the counter: we need to add a new line\n\t$sql =\"INSERT INTO `${table}_acces` SET label=0, date='$datestring', count='1'\";\n\t$res = mysql_query($sql);\n}\n// Get the total number of access\n$sql = \"SELECT (se+ref+other+internal+old) as count FROM ${table}_pages WHERE id=$pageid\";\n$res = mysql_query($sql);\n$count=mysql_fetch_array($res);\nreturn $count['count'];\n}",
"private function _countSubmit ()\r\n {\r\n if (! isset($_COOKIE[self::$_cookieCount])) {\r\n setcookie(self::$_cookieCount, 1, time() + 3600, \"/\");\r\n } else {\r\n setcookie(self::$_cookieCount, $_COOKIE[self::$_cookieCount] + 1, time() + 3600, \"/\");\r\n }\r\n }",
"public function increment()\n {\n $this->record->attempts++;\n\n return $this->record->attempts;\n }",
"function blightCountUp()\n{\n\t$db = blightDB();\n\t$sessid = GWF_Session::getSession()->getID();\n\t$query = \"UPDATE blight SET attemp=attemp+1 WHERE sessid=$sessid\";\n\treturn $db->queryWrite($query);\n}",
"protected function _handle_count_fail()\n\t{\n\t\t$count_max = mod('deposit_card')->setting('fail_count_max');\n\t\t$block_timeout = mod('deposit_card')->setting('fail_block_timeout') * 60;\n\n\t\tif (!$count_max) return;\n\n\t\t$count = model('ip')->action_count_change('deposit_card_fail', 1);\n\n\t\tif ($count >= $count_max) {\n\t\t\t$ip = t('input')->ip_address();\n\n\t\t\tmodel('ip_block')->set($ip, $block_timeout);\n\t\t\tmodel('ip')->action_count_set('deposit_card_fail', 0);\n\t\t}\n\t}"
]
| [
"0.7432636",
"0.5868138",
"0.57601625",
"0.57260424",
"0.5683227",
"0.56827813",
"0.5674294",
"0.5646331",
"0.562723",
"0.5605486",
"0.55840087",
"0.5573552",
"0.55135924",
"0.551107",
"0.5491218",
"0.5487842",
"0.5482708",
"0.54704833",
"0.54582673",
"0.5449167",
"0.54365295",
"0.54217476",
"0.5414937",
"0.5403453",
"0.5402193",
"0.5382112",
"0.5377496",
"0.53599703",
"0.53573394",
"0.5350351"
]
| 0.7834631 | 0 |
Get soap clients for all good storages | protected function getClients(){
$clients = array();
$user = User::getInstance();
$uid = $user->getId();
$mac = $user->getMac();
if ($mac){
RESTClient::$from = $mac;
}elseif ($uid){
RESTClient::$from = $uid;
}else{
RESTClient::$from = $this->stb->mac;
}
RESTClient::setAccessToken($this->createAccessToken());
foreach ($this->storages as $name => $storage){
$clients[$name] = new RESTClient('http://'.$storage['storage_ip'].'/stalker_portal/storage/rest.php?q=');
}
return $clients;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function get_registered_services() {\n\t\t$data = [];\n\t\t$res = self::$dbo->query( 'SELECT storage_service FROM snapshot_storage_credentials' );\n\t\twhile ( $row = $res->fetchArray() ) {\n\t\t\t$data[] = $row['storage_service'];\n\t\t}\n\n\t\treturn $data;\n\t}",
"public function Clients()\n\t{\n\t\t//\n\t\t// Connect object.\n\t\t//\n\t\tif( ! $this->isConnected() )\n\t\t\t$this->Connect();\n\n\t\t//\n\t\t// Init local storage.\n\t\t//\n\t\t$databases = [];\n\n\t\t//\n\t\t// Ask client for list.\n\t\t//\n\t\t$list = $this->Connection()->listDatabases();\n\t\tforeach( $list as $element )\n\t\t\t$databases[ $element->getName() ] = $element;\n\n\t\treturn $databases;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// ==>\n\n\t}",
"public static function all(){\n\t\t$bdd = new DBcnx();\n\t\t\treturn $bdd->allClient();\n\t}",
"public static function get_managed_solr_services() {\n\n\t\t$result = [];\n\n\t\t$result['elastic'] = [\n\t\t\tself::MANAGED_SOLR_SERVICE_SEARCH_ENGINE => WPSOLR_AbstractSearchClient::ENGINE_ELASTICSEARCH,\n\t\t\tself::MANAGED_SOLR_SERVICE_LABEL => 'Elasticsearch',\n\t\t\tself::MANAGED_SOLR_SERVICE_HOME_PAGE => 'http://www.gotosolr.com/en',\n\t\t\tself::MANAGED_SOLR_SERVICE_API_PATH => 'https://api.gotosolr.com/v1/partners/24b7729e-02dc-47d1-9c15-f1310098f93f',\n\t\t\tself::MANAGED_SOLR_SERVICE_CHANNEL_ORDER_URL => 'https://api.gotosolr.com/v1/providers/8c25d2d6-54ae-4ff6-a478-e2c03f1e08a4/accounts/24b7729e-02dc-47d1-9c15-f1310098f93f/addons/71bc4b32-be17-4012-b4e9-299d47d7f86d/order-solr-index/eafe62fb-1ee1-4a64-ac33-b2b7b045feb0',\n\t\t\tself::MANAGED_SOLR_SERVICE_CHANNEL_GOOGLE_RECAPTCHA_TOKEN_URL => 'https://api.gotosolr.com/v1/providers/8c25d2d6-54ae-4ff6-a478-e2c03f1e08a4/accounts/24b7729e-02dc-47d1-9c15-f1310098f93f/addons/71bc4b32-be17-4012-b4e9-299d47d7f86d/google-recaptcha-token',\n\t\t\tself::MANAGED_SOLR_SERVICE_ORDERS_URLS => [],\n\t\t];\n\n\t\t$result['gotosolr'] = [\n\t\t\tself::MANAGED_SOLR_SERVICE_SEARCH_ENGINE => WPSOLR_AbstractSearchClient::ENGINE_SOLR,\n\t\t\tself::MANAGED_SOLR_SERVICE_LABEL => 'Solr',\n\t\t\tself::MANAGED_SOLR_SERVICE_HOME_PAGE => 'http://www.gotosolr.com/en',\n\t\t\tself::MANAGED_SOLR_SERVICE_API_PATH => 'https://api.gotosolr.com/v1/partners/24b7729e-02dc-47d1-9c15-f1310098f93f',\n\t\t\tself::MANAGED_SOLR_SERVICE_CHANNEL_ORDER_URL => 'https://api.gotosolr.com/v1/providers/8c25d2d6-54ae-4ff6-a478-e2c03f1e08a4/accounts/24b7729e-02dc-47d1-9c15-f1310098f93f/addons/f8622320-5a3b-48cf-a331-f52459c46573/order-solr-index/8037888b-501a-4200-9fb0-b4266434b161',\n\t\t\tself::MANAGED_SOLR_SERVICE_CHANNEL_GOOGLE_RECAPTCHA_TOKEN_URL => 'https://api.gotosolr.com/v1/providers/8c25d2d6-54ae-4ff6-a478-e2c03f1e08a4/accounts/24b7729e-02dc-47d1-9c15-f1310098f93f/addons/f8622320-5a3b-48cf-a331-f52459c46573/google-recaptcha-token',\n\t\t\tself::MANAGED_SOLR_SERVICE_ORDERS_URLS => [\n\t\t\t\t[\n\t\t\t\t\tself::MANAGED_SOLR_SERVICE_ORDER_URL_BUTTON_LABEL => 'Extend the trial with a Monthly Plan',\n\t\t\t\t\tself::MANAGED_SOLR_SERVICE_ORDER_URL_TEXT => 'Monthly plan',\n\t\t\t\t\tself::MANAGED_SOLR_SERVICE_ORDER_URL_LINK => 'https://secure.avangate.com/order/checkout.php?PRODS=4653966&QTY=1&CART=1&CARD=1',\n\t\t\t\t],\n\t\t\t],\n\t\t];\n\n\t\t$result = apply_filters( WPSOLR_Events::WPSOLR_FILTER_ENV_MANAGED_SERVICES, $result );\n\n\t\treturn $result;\n\t}",
"public function getServices()\r\n {\r\n if (is_null($this->_services)) {\r\n if ($this->getConfig('auto')) {\r\n $this->_services = array();\r\n $config = Mage::app()->getConfig();\r\n foreach (array('cache', 'full_page_cache', 'fpc') as $cacheType) {\r\n $node = $config->getXpath('global/' . $cacheType . '[1]');\r\n if (isset($node[0]->backend) && in_array((string)$node[0]->backend, array(\r\n 'Cm_Cache_Backend_Redis',\r\n 'Mage_Cache_Backend_Redis'\r\n ))) {\r\n $this->_services[] = $this->_buildServiceArray(\r\n $this->__(str_replace('_', ' ', uc_words($cacheType))),\r\n $node[0]->backend_options->server,\r\n $node[0]->backend_options->port,\r\n $node[0]->backend_options->password,\r\n $node[0]->backend_options->database\r\n );\r\n }\r\n }\r\n // get session\r\n $node = $config->getXpath('global/redis_session');\r\n if ($node) {\r\n $this->_services[] = $this->_buildServiceArray(\r\n $this->__('Session'),\r\n $node[0]->host,\r\n $node[0]->port,\r\n $node[0]->password,\r\n $node[0]->db\r\n );\r\n }\r\n } else {\r\n $this->_services = unserialize($this->getConfig('manual'));\r\n }\r\n }\r\n return $this->_services;\r\n }",
"public function get_clients(){\n\t\treturn $this->clients;\n\t}",
"public function readClients() {\r\n //get authorisation from headers\r\n $headers = getallheaders();\r\n $auth = $headers[\"Authorization\"];\r\n\r\n //check authorization\r\n $role = $this->authenticate($auth);\r\n if ($role !== 'trader') {\r\n throw new RestException(401, \"Unauthorized\");\r\n }\r\n $traderId = $this->getTraderID($auth);\r\n $sql = \"SELECT * FROM client WHERE traderid = '{$traderId}'\";\r\n $clients = Client::find_by_sql($sql);\r\n if ($clients) {\r\n return $clients;\r\n } else {\r\n throw new RestEception(400, \"no clients found\");\r\n }\r\n }",
"public static function getListClientBySAP($_filter){\n\n\t\t$listclient = array();\n\t\ttry {\n\t\t\t/*codigo para consumor ws soap*/\n\t\t\t\t$client = new SoapClient(URLWS);\n\t\t\t\t$params = array('_filter' => $_filter);\n\t\t\t\t$result = $client->ListCustomer($params);\n\n\t\t\t\tfor($i=0; $i<count($result->ListCustomerResult->ClientResponse); $i++){\n\t\t\t\t\t $listclient[$i] = $result->ListCustomerResult->ClientResponse[$i]->CardCode.\"|\".htmlentities($result->ListCustomerResult->ClientResponse[$i]->CardName);\n\t\t\t\t}\n\n\t\t\t} catch (Exception $e) {\n\t\t\t\ttrigger_error($e->getMessage(), E_USER_WARNING);\n\t\t\t}\n\t\treturn $listclient;\n\t}",
"public function getServices(): array;",
"public function get_Clients() \n\t{\n\t\t$query = '';\n\t\t$result = '';\n\t\t$clients = array();\n\n\t\tswitch( $this->db_link->getDriver() )\n\t\t{\n\t\t\tcase 'sqlite':\n\t\t\tcase 'mysql':\n\t\t\tcase 'pgsql':\n\t\t\t\t$query = \"SELECT Client.ClientId, Client.Name FROM Client \";\n\t\t\t\tif( $this->bwcfg->get_Param( 'show_inactive_clients' ) )\n\t\t\t\t\t$query .= \"WHERE FileRetention > '0' AND JobRetention > '0' \"; \n\t\t\t\t$query .= \"ORDER BY Client.Name;\";\n\t\t\tbreak;\n\t\t}\n\n\t\t$result = $this->db_link->runQuery($query);\n\t\t\t\n\t\tforeach( $result->fetchAll() as $client )\n\t\t\t$clients[ $client['clientid'] ] = $client['name'];\n\t\t\t\t\n\t\treturn $clients;\t\t\n\t}",
"public function getServices();",
"protected function getInstalledServices() {}",
"public function listStorageAccounts()\n {\n \t$response = $this->_performRequest(self::OP_STORAGE_ACCOUNTS);\n\n \tif ($response->isSuccessful()) {\n\t\t\t$result = $this->_parseResponse($response);\n\n \t\tif (!$result->StorageService) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t if (count($result->StorageService) > 1) {\n \t\t $xmlServices = $result->StorageService;\n \t\t} else {\n \t\t $xmlServices = [$result->StorageService];\n \t\t}\n\n\t\t\t$services = [];\n\t\t\tif (!is_null($xmlServices)) {\n\t\t\t\tfor ($i = 0; $i < count($xmlServices); $i++) {\n\t\t\t\t\t$services[] = new Zend_Service_WindowsAzure_Management_StorageServiceInstance(\n\t\t\t\t\t (string)$xmlServices[$i]->Url,\n\t\t\t\t\t (string)$xmlServices[$i]->ServiceName\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $services;\n\t\t} else {\n\t\t\tthrow new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));\n\t\t}\n }",
"public function getALLStore();",
"static function getServiceList()\n {\n return session::get('ServerService');\n }",
"function Listar_Clientes()\n\t {\n\t\tlog_message('INFO','#TRAZA| CLIENTES | Listar_Clientes() >> ');\n\t\t$data['list'] = $this->Clientes->Listar_Clientes();\n return $data;\n\t }",
"public function clients() {\n\t\treturn $this->clients_model->getClients($this->compID);\n\t}",
"function getClient()\n {\n ini_set(\"soap.wsdl_cache_enabled\", \"0\");\n $client = new SoapClient(\"http://smeapps.mobitel.lk:8585/EnterpriseSMSV3/EnterpriseSMSWS?wsdl\");\n return $client;\n }",
"public function getAvailableServices();",
"public function get_services() {\n return $this->linkemperor_exec(null, null,\"/api/v2/customers/services.json\");\n }",
"public function get()\n {\n // 27 para medimas \n // 17 para ecoopsos \n $queryString = '{\"MaxResults\":0,\"MatchAll\":true,\"IPSIDs\":[],\"SiteID\":null,\"EPSID\":17,\"Regime\":null}';\n return $this->performRequest('GET', '/service/ContractService.svc/contract?', $queryString);\n }",
"public function listClients(){\n $mysql= $this->database->databaseConnect();\n $sql = 'SELECT * FROM client';\n $query = mysqli_query($mysql, $sql) or die(mysqli_connect_error());\n $this->database->databaseClose();\n\n while($row = mysqli_fetch_assoc($query)){\n $this->clients[] = $row;\n }\n\n return $this->clients;\n }",
"public static function _getSoapClient($parameters = array())\n\t{\n\t\t$endpoint = Transip_ApiSettings::$endpoint;\n\n\t\tif(self::$_soapClient === null)\n\t\t{\n\t\t\t$extensions = get_loaded_extensions();\n\t\t\t$errors = array();\n\t\t\tif(!class_exists('SoapClient') || !in_array('soap', $extensions))\n\t\t\t{\n\t\t\t\t$errors[] = 'The PHP SOAP extension doesn\\'t seem to be installed. You need to install the PHP SOAP extension. (See: http://www.php.net/manual/en/book.soap.php)';\n\t\t\t}\n\t\t\tif(!in_array('openssl', $extensions))\n\t\t\t{\n\t\t\t\t$errors[] = 'The PHP OpenSSL extension doesn\\'t seem to be installed. You need to install PHP with the OpenSSL extension. (See: http://www.php.net/manual/en/book.openssl.php)';\n\t\t\t}\n\t\t\tif(!empty($errors)) die('<p>' . implode(\"</p>\\n<p>\", $errors) . '</p>');\n\n\t\t\t$classMap = array(\n\t\t\t\t'DataCenterVisitor' => 'Transip_DataCenterVisitor',\n\t\t\t);\n\n\t\t\t$options = array(\n\t\t\t\t'classmap' => $classMap,\n\t\t\t\t'encoding' => 'utf-8', // lets support unicode\n\t\t\t\t'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // see http://bugs.php.net/bug.php?id=43338\n\t\t\t\t'trace' => false, // can be used for debugging\n\t\t\t);\n\n\t\t\t$wsdlUri = \"https://{$endpoint}/wsdl/?service=\" . self::SERVICE;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tself::$_soapClient = new SoapClient($wsdlUri, $options);\n\t\t\t}\n\t\t\tcatch(SoapFault $sf)\n\t\t\t{\n\t\t\t\tthrow new Exception(\"Unable to connect to endpoint '{$endpoint}'\");\n\t\t\t}\n\t\t\tself::$_soapClient->__setCookie('login', Transip_ApiSettings::$login);\n\t\t\tself::$_soapClient->__setCookie('mode', Transip_ApiSettings::$mode);\n\t\t}\n\n\t\t$timestamp = time();\n\t\t$nonce = uniqid('', true);\n\n\t\tself::$_soapClient->__setCookie('timestamp', $timestamp);\n\t\tself::$_soapClient->__setCookie('nonce', $nonce);\n\t\tself::$_soapClient->__setCookie('clientVersion', self::API_VERSION);\n\t\tself::$_soapClient->__setCookie('signature', self::_urlencode(self::_sign(array_merge($parameters, array(\n\t\t\t'__service' => self::SERVICE,\n\t\t\t'__hostname' => $endpoint,\n\t\t\t'__timestamp' => $timestamp,\n\t\t\t'__nonce' => $nonce\n\t\t)))));\n\n\t\treturn self::$_soapClient;\n\t}",
"function getStores()\n {\n require_once(dirname(__FILE__) . DS . '../filesystem/folder.php');\n $handlers = JFolder::files(dirname(__FILE__) . DS . 'storage', '.php');\n\n $names = array();\n foreach ($handlers as $handler) {\n $name = substr($handler, 0, strrpos($handler, '.'));\n $class = 'CacheStorage' . $name;\n\n if (!class_exists($class)) {\n require_once(dirname(__FILE__) . DS . 'storage' . DS . $name . '.php');\n }\n\n if (call_user_func_array(array(trim($class), 'test'), null)) {\n $names[] = $name;\n }\n }\n\n return $names;\n }",
"public function getFunctions(){\n // SET SOAPOPTIONS\n $this->setSoapOptions();\n \n //SET WSDLPATH\n $wsdlPath = $this->soapWebServiceWSDLPath;//'wsdl'.DIRECTORY_SEPARATOR.'WebServService.wsdl';\n \n //CREATE A NEW CLIENT\n $sClient = new SoapClient($wsdlPath,$this->soapOptions);\n \n //SET A NEW SOAP HEADER FOR INDICATING SOAP LOGIN ID\n $this->setSoapHeader();\n $sClient->__setSoapHeaders($this->soapHeader);\n \n //SOAP FUNCTION CALL\n return $sClient->__getFunctions();\n }",
"public function findServices(): array;",
"public function shareService ()\n {\n \n $list = $this->services->findAll();\n return $list;\n }",
"public function getRequestedServices();",
"public function getClients()\n {\n return $this->clients;\n }",
"public function getClients()\n {\n return $this->clients;\n }"
]
| [
"0.5908082",
"0.5831289",
"0.5743656",
"0.57367307",
"0.5713813",
"0.5685122",
"0.5637914",
"0.56315595",
"0.56086946",
"0.5602043",
"0.56010914",
"0.55201167",
"0.5519457",
"0.55044484",
"0.54493266",
"0.54434085",
"0.5440273",
"0.5437202",
"0.54326683",
"0.5416524",
"0.53947836",
"0.5389123",
"0.537271",
"0.53697234",
"0.5369345",
"0.5354806",
"0.5353618",
"0.5344364",
"0.5324718",
"0.5324718"
]
| 0.68235564 | 0 |
Sort array of good storages by load | protected function sortByLoad($storages){
if (!empty($storages)){
foreach ($storages as $name => $storage) {
$load[$name] = $storage['load'];
}
array_multisort($load, SORT_ASC, SORT_NUMERIC, $storages);
}
return $storages;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function sortByLoad($storages)\n {\n\n if (!empty($storages)) {\n\n foreach ($storages as $name => $storage) {\n $load[$name] = $storage['load'];\n }\n\n array_multisort($load, SORT_ASC, SORT_NUMERIC, $storages);\n }\n\n return $storages;\n }",
"function sortSizeAscending($thisFiles) {\n \tusort($thisFiles, \"cmpSA\");\n \treturn $thisFiles;\n }",
"public function asort() {}",
"public function sort();",
"private static function sort()\n\t{\n\t\t//Setup order of importantance\n\t\t$changefreqs = array(\n\t\t\t'hourly' => 5,\n\t\t\t'daily' => 4,\n\t\t\t'weekly' => 3,\n\t\t\t'monthly' => 2,\n\t\t\t'yearly' => 1,\n\t\t\t'never' => 0\n\t\t);\n\n\t\t//Setup invidual arrays to sort by\n\t\tforeach(static::$links as $index => $link)\n\t\t{\n\t\t\t$priority[$index] = $link->priority ? $link->priority : 0;\n\t\t\t$changefreq[$index] = $link->changefreq ? $changefreqs[$link->changefreq] : 0;\n\t\t\t$loc[$index] = $link->loc;\n\t\t}\n\n\t\tarray_multisort($priority, SORT_DESC, $changefreq, SORT_DESC, $loc, SORT_ASC, static::$links);\n\t}",
"function set_load_order()\n {\n $edges = [];\n\n foreach ($this->scripts as $script_id => $script_options) {\n if (isset($script_options['require'])) {\n\n // check if array\n if(is_array($script_options['require'])) {\n foreach ($script_options['require'] as $r_script_id)\n {\n $edges[] = [$r_script_id, $script_id];\n }\n } else {\n\n $edges[] = [$script_options['require'], $script_id];\n }\n\n\n }\n }\n $scripts = array_keys($this->scripts);\n $this->sorted_scripts = $this->topological_sort($scripts, $edges);\n\n $key_compare_func = function($a, $b) {\n $ia = array_search($a, $this->sorted_scripts);\n $ib = array_search($b, $this->sorted_scripts);\n\n if ($ia > $ib) {\n return TRUE;\n } else {\n return FALSE;\n }\n\n };\n\n uksort($this->scripts, $key_compare_func);\n }",
"protected function sortDataArray() {}",
"private function sortExtensions()\n {\n // Ensure extensions are loaded in order\n $this->sortedExtensions = array();\n foreach ($this->extensions as $extension) {\n $this->addExtensionToSorted($extension);\n }\n }",
"function sortSizeDescending($thisFiles) {\n \tusort($thisFiles, \"cmpSD\");\n \treturn $thisFiles;\n }",
"protected function externalSort() {\n\t\t$this->chunk();\n\n\t\t// To be confirmed/implemented\n\t\t// After file split put them back together in the right order\n\t\techo \"External sort TBC\\n\";\n\t}",
"private function sortFiles(&$array){\n if(isset($array['files'])) sort($array['files']);\n if(isset($array['images'])) sort($array['images']);\n }",
"public function sort(array $paths);",
"function sortTransits() {\n $sortedtransits = array();\n for( $aspect = 0; $aspect < count($this->m_transit); $aspect++ ) {\n $sortedtransits[substr($this->m_transit[$aspect],17,11)] = $this->m_transit[$aspect];\n }\n ksort($sortedtransits);\n\n unset($this->m_transit);\n $this->m_transit = array();\n reset($sortedtransits);\n while( list($key,$value) = each($sortedtransits) ) {\n array_push(\n $this->m_transit,\n $value\n );\n }\n }",
"public function test_sort_function(){\n $autoloaderName = '!!!autoloader.php';\n $data = [\n '123.php',\n '.example.php',\n 'example.php',\n 'autoexample.php',\n $autoloaderName\n ];\n sort($data);\n $first = array_values($data)[0];\n $this->assertEquals($autoloaderName,$first);\n }",
"protected function _sort_array($a, $b)\n\t{\t\n $result = 0;\n\t\t\t\t\n foreach($this->orderBy as $key => $value) {\n\t\t\n if($a[$key] == $b[$key]) {\n continue; \n }\n \n if($key == 'total_gallery' || $key == 'total_photo' || $key == 'total_file_size' || $key == 'remaining_quota' || $key == 'remaining_month_quota' || $key == 'total_space_quota')\n\t\t\t{\t\n $a[$key] = trim(preg_replace('/bytes|KB|MB|GB/', '', $a[$key]));\n $b[$key] = trim(preg_replace('/bytes|KB|MB|GB/', '', $b[$key]));\n \n $result = ((float)$a[$key] < (float)$b[$key])? -1 : 1;\n } else {\n $result = ($a[$key] < $b[$key])? -1 : 1;\n }\n if($value == 'desc') { \n $result = -$result; \n }\n break;\n }\n\t\t\n return $result;\n \n }",
"public function sort()\n {\n foreach (array_keys($this->betTypes) as $type) {\n ksort($this->betTypes[$type]);\n }\n }",
"function sortHardwareByEfficiency(array &$hardware) {\n uasort($hardware, function($a, $b) {\n /** @var Hardware $a */\n /** @var Hardware $b */\n\n $diff = $b->getEfficiency() - $a->getEfficiency();\n\n //usort needs an integer above, equal or higher than zero\n return (int)(1000 * $diff);\n });\n\n}",
"function sortByOrder($a, $b) {\r\n return $b['percent'] - $a['percent'];\r\n }",
"abstract public function prepareSort();",
"function database_benchmark_sort()\n {\n if( !function_exists('dbtimecmp') )\n {\n function dbtimecmp($a, $b)\n {\n //return ( $a['time']==$b['time'] ? 0 : ($a['time']<$b['time'] ? -1 : 1) );\n return ( (float)$a['time']==(float)$b['time'] ? 0 : ((float)$a['time']>(float)$b['time'] ? -1 : 1) );\n }\n }\n \n usort($this->log_data, 'dbtimecmp');\n \n return '';\n }",
"protected function getAllActiveStorages()\n {\n\n $storages = array();\n\n $data = ORM::for_table('storages')->where_any_is([\n ['status' => 1, 'for_records' => 1]\n /* ['stream_server_type' => NULL,'status' => 1, 'for_records' => 1],\n ['stream_server_type' => '','status' => 1, 'for_records' => 1]*/\n ])->find_many();\n\n\n foreach ($data as $idx => $storage) {\n $storages[$storage['storage_name']] = $storage;\n $storages[$storage['storage_name']]['load'] = $this->getStorageLoad($storage);\n }\n\n $storages = $this->sortByLoad($storages);\n\n return $storages;\n }",
"public function sort(array $nodes);",
"private function sort(): void\n {\n if (!$this->sorted) {\n uasort($this->items, function (AcceptHeaderItem $a, AcceptHeaderItem $b) {\n $qA = $a->getQuality();\n $qB = $b->getQuality();\n\n if ($qA === $qB) {\n return $a->getIndex() > $b->getIndex() ? 1 : -1;\n }\n\n return $qA > $qB ? -1 : 1;\n });\n\n $this->sorted = true;\n }\n }",
"function orderURIs($actArray){\n\t\t if(is_array($actArray)){\n\t\t\t\tif(count($actArray) > 0){\n\t\t\t\t\t $countURIs = array();\t\t\t\t\n\t\t\t\t\t foreach($actArray as $uriKey => $actItem){\n\t\t\t\t\t\t $actCount = $actItem[\"count\"];\n\t\t\t\t\t\t $countURIs[$uriKey] = $actCount;\n\t\t\t\t\t }\n\t\t\t\t\t arsort($countURIs); //reverse sort, highest to lowest\n\t\t\t\t\t $newArray = array();\n\t\t\t\t\t foreach($countURIs as $uriKey => $count){\n\t\t\t\t\t\t $newArray[$uriKey] = $actArray[$uriKey];\n\t\t\t\t\t }\n\t\t\t\t\t unset($actArray);\n\t\t\t\t\t $actArray = $newArray;\n\t\t\t\t}\n\t\t }\n\t\t return $actArray;\n\t }",
"private function sort(): void\n {\n if (!$this->dirtyIndex) {\n return;\n }\n\n $newIndex = [];\n $index = 0;\n\n foreach ($this->pages as $hash => $page) {\n $order = $page->getOrder();\n\n if (null === $order) {\n $newIndex[$hash] = $index;\n ++$index;\n } else {\n $newIndex[$hash] = $order;\n }\n }\n\n asort($newIndex);\n\n $this->index = $newIndex;\n $this->dirtyIndex = false;\n }",
"private function getAllGoodStoragesForMediaFromCache(){\n \n $cache = array();\n \n foreach ($this->getAllCacheKeys() as $key){\n \n $storage_cache = $this->db->from('storage_cache')\n ->where(array(\n 'cache_key' => $key,\n 'status' => 1,\n 'changed>' => date(Mysql::DATETIME_FORMAT, time() - $this->cache_expire_h*3600)\n ))\n ->get()\n ->all();\n \n if(!empty($storage_cache)){\n $storage_cache = $storage_cache[0];\n $storage_data = unserialize($storage_cache['storage_data']);\n if (is_array($storage_data) && !empty($storage_data) && !empty($this->stb_storages[$storage_cache['storage_name']])){\n $cache[$storage_cache['storage_name']] = $storage_data;\n $cache[$storage_cache['storage_name']]['load'] = $this->getStorageLoad($this->storages[$storage_cache['storage_name']]);\n }\n }\n \n }\n return $cache;\n }",
"public function sortArraysByKeyCheckIfSortingIsCorrectDataProvider() {}",
"private function getLoadData()\n {\n $load = sys_getloadavg();\n return array(\n 'last_one_minute' => $load[0],\n 'last_five_minutes' => $load[1],\n 'last_fifteen_minutes' => $load[2]\n );\n }",
"public function productsSortedByFastest()\n {\n $products = $this->p();\n usort($products, [$this, 'sortByFastest']);\n return $products;\n }",
"public function insertSort(&$array,$filename,$type=-1)\n {\n for($i=1;$i<count($array);$i++)\n {\n $temp=$array[$i];\n $j=$i;\n if($type==1)\n {\n while($j>0 && strtolower($array[$j-1][$filename])> strtolower($temp[$filename]))\n {\n $array[$j]=$array[$j-1];\n $j--;\n }\n }\n else if($type==-1)\n {\n while($j>0 && strtolower($array[$j-1][$filename])< strtolower($temp[$filename]))\n {\n $array[$j]=$array[$j-1];\n $j--;\n }\n }\n $array[$j]=$temp;\n }\n\n return $array;\n }"
]
| [
"0.7604362",
"0.60574186",
"0.5993651",
"0.59600836",
"0.58668846",
"0.57907444",
"0.57805246",
"0.5753326",
"0.57505834",
"0.5709011",
"0.56298965",
"0.56184846",
"0.55958384",
"0.54436785",
"0.54256976",
"0.5418195",
"0.54061866",
"0.5324763",
"0.5308795",
"0.5301813",
"0.52991647",
"0.5280026",
"0.52631336",
"0.52464855",
"0.5217336",
"0.5215098",
"0.5204996",
"0.5197032",
"0.5154809",
"0.50919294"
]
| 0.80397505 | 0 |
Parse exception, add exception message to output and to master log | protected function parseException($exception){
//trigger_error($exception->getMessage()."\n".$exception->getTraceAsString(), E_USER_ERROR);
echo $exception->getMessage()."\n".$exception->getTraceAsString();
$this->addToLog($exception->getMessage());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract protected function logException(\\Exception $ex);",
"private function logException()\n {\n switch ($this->classShortName) {\n case 'IndexException':\n case 'CreateException':\n case 'ReadException':\n case 'UpdateException':\n case 'DeleteException':\n Log::error($this->message);\n Log::error(print_r($this->getExceptionData(), true));\n break;\n default:\n Log::error($this->message);\n }\n }",
"public static function exception($exception){\n\t\t//CunddTools::pd($exception);\n\t\t$msg = $exception->getMessage();\n\t\t$output = \"<pre>$msg</pre>\";\n\t\techo $output;\n\t\t\n\t\t$output .= self::_printTrace($exception->getTrace());\n\t\t\n\t\tself::_logException($output);\n\t}",
"function exception_handler(Exception $exception)\n{\n\tglobal $config;\n\n\t$message = $exception->getMessage() . \" on line \" . $exception->getLine() . \" in file \" . $exception->getFile();\n\terror_log(date('r') . ' ' . $message . PHP_EOL, 3, $config['log']);\n}",
"public static function reportOtherExceptionAndExit($e){\nself::encodeAndOutputMessage(self::translate('System error.'));\n$msg=date(\"Y-m-d H:i:s T\");\n$msg.=':'.(string)$e.\"\\n\"; //Let the exception describe itself\nforeach(self::$details as $k=>$v)$msg.=\"$k=$v\\n\";\nLogger::log(self::$systemErrorLog,$msg);\nexit;\n}",
"function handle_error($exception) {\n try {\n print $this->encode(array(\n 'error' => $exception->getMessage(),\n 'message' => $exception->getMessage(), // Should be a i18n end user message\n 'data' => @$exception->data,\n 'status' => @$exception->status\n ));\n } catch(Exception $e) {\n echo 'Error: '.$e->getmessage();\n }\n }",
"function throwError($exceptionItem){\n\techo \"\n\t\n\t<p style='font-family:arial;color:red;font-size:20px;'> Error parsing : . $exceptionItem->error_message \n\t\n\t</p>\"; // catch this in the parse method and do $e->getMessage() to show it.\n\n\t//break; // try and break the current loop\n\n\n}",
"public static function exceptionHandler(\\Exception $exception)\n {\n if (null !== self::$logFile) {\n file_put_contents(\n self::$logFile,\n '[' . date(\\DateTime::RFC2822) . '] ' . $exception . PHP_EOL,\n FILE_APPEND\n );\n }\n\n throw $exception;\n }",
"function log_exception(Throwable $e) // for php => 7.0\n{\n $message = \"Line {$e->getLine()} in \" . basename($e->getFile()) . \", {$e->getMessage()} (\" . get_class($e) . \")\";\n append_message($message);\n exit();\n}",
"public function logEx($exception)\n\t{\n\t\tif ($this->config->get('emerchantpay_checkout_debug')) {\n\t\t\t$log = new Log('emerchantpay_checkout.log');\n\t\t\t$log->write($this->jTraceEx($exception));\n\t\t}\n\t}",
"public function handle_exceptions($exception)\n\t{\n\t\t\\Sentry\\captureLastError();\n\n\t\t$message = \"\\nError Type: \".get_class($exception).\"\\n\";\n\t\t$message .= \"Error Message: \".$exception->getMessage().\"\\n\";\n\t\t$message .= \"In File: \".$exception->getFile().\"\\n\";\n\t\t$message .= \"At Line: \".$exception->getLine().\"\\n\";\n\t\t$message .= \"Platform: \" . PHP_VERSION . \" (\" . PHP_OS . \")\\n\";\n\n\t\t$message .= \"\\nBACKTRACE\\n\";\n\t\t$message .= $exception->getTraceAsString();\n\t\t$message .= \"\\nEND\\n\";\n\n\t\t$this->_forward_error($message);\n\t}",
"public static function handleException($exception) {\n $file = $exception->getFile();\n $line = $exception->getLine();\n $errMessage = $exception->getMessage();\n $trace = $exception->getTraceAsString();\n $error = \"$file:$line $errMessage $trace\";\n $logger = Container::getService('Logger');\n $logger->excpt($error);\n self::sendError($errMessage);\n exit;\n }",
"public function setException(Exception $e)\r\n {\r\n \r\n $result = new Blerby_TestRunner_Result();\r\n \r\n $trace = $e->getTrace();\r\n \r\n if (isset($trace[0]['args'][0])) {\r\n $file = $trace[0]['args'][0];\r\n \r\n } else {\r\n $file = Blerby_TestRunner_Util::cleanPath($e->getFile()); \r\n }\r\n \r\n $result->set('status',Blerby_TestRunner_Status::ERROR);\r\n $result->set('file',Blerby_TestRunner_Util::cleanPath($file));\r\n $result->set(\"message\",$e->getMessage());\r\n \r\n preg_match(\"/on line ([0-9]+)/\",$result->get(\"message\"),$matches);\r\n \r\n if (isset($matches[1])) {\r\n \r\n $result->set('line',$matches[1]);\r\n } else {\r\n $result->set('line',\"???\");\r\n }\r\n \r\n $this->addResult($file,$result);\r\n }",
"abstract public function logException(string $log_level, \\Exception $exception);",
"private function formatException (\\Exception $exception)\n\t{\n\t\tif ($this->getProperty(self::PROPERTY_ALLOW_EXCEPTIONS))\n\t\t\treturn $this->formatError($exception->getCode(), $exception->getMessage());\n\t\telse\n\t\t\treturn $this->formatError(self::ERROR_INTERNAL_ERROR);\n\t}",
"protected function _handleException(Exception $exception)\n {\n $logMessage = Application\\Error::toString($exception);\n Application::getLog()->crit($logMessage);\n\n // Are we in cli mode?\n if ('cli' === strtolower(PHP_SAPI)) {\n $this->disableView();\n return;\n }\n\n // Is that a user readable exception?\n if ($exception instanceof Exception) {\n $this->view->message = $logMessage;\n return;\n }\n }",
"public function report(Exception $exception)\n {\n if (app()->runningInConsole()) {\n $input = new ArgvInput();\n $botMessage = [\n 'type' => '[command]',\n 'time' => date('Y-m-d H:i:s'),\n 'command' => (string)$input,\n 'code' => $exception->getCode(),\n 'message' => $exception->getMessage(),\n 'trace' => $exception->getTrace()[0],\n ];\n $botMessage = json_encode($botMessage, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);\n Log::error($botMessage);\n dispatch(new AlarmbotJob('technical', $botMessage));\n\n }\n parent::report($exception);\n }",
"private static function log(Exception $e)\r\n {\r\n $userAgent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : '';\r\n $referrer = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';\r\n $request = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : '';\r\n\r\n $message = vsprintf(\"\\n[%s] [%s %s] %s\\n\\nREFERRER: %s\\n\\nREQUEST: %s\\n\\n%s\", array(\r\n @gmdate('D M d H:i:s Y'),\r\n $_SERVER['REMOTE_ADDR'],\r\n $userAgent,\r\n $e->getMessage(),\r\n $referrer,\r\n $request,\r\n $e->getTraceAsString(),\r\n ));\r\n\r\n return @error_log($message, 3, SLIRConfig::$pathToErrorLog);\r\n }",
"function handleException( $exception ) {\n echo \"Sorry, a problem occurred. Please try later.\";\n error_log( $exception->getMessage() );\n}",
"public function setErrorFromException(\\Exception $exception)\n {\n $this->error = $exception->__toString();\n }",
"private static function handleException( $e )\n {\n if( DEBUG === true ) \n {\n echo $e->getMessage();\n }\n else\n {\n error_log( $e->getMessage() );\n }\n return;\n }",
"function myExceptionHandling($_exception, $_logfile)\n{\n if ($_SERVER['SERVER_NAME'] != \"localhost\")\n {\n //sumiere boodschap\n $_msg=\"Er heeft zich een fout voorgedaan, probeer opnieuw.<br>Als de fout blijft voorkomen neem dan contact op met de web-master.<br>Alvast onze verontschuldigingen\"; \n }\n else\n {\n //complete error message\n $_msg = \"<hr>\n <strong>Exception</strong><br><br>\n Foutmelding: \".$_exception->getMessage().\"<br><br>\n Bestand: \".$_exception->getFile().\"<br>\n Regel: \".$_exception->getLine().\"<br><hr>\";\n }\n \n// exception log\n $_error_log[1] = strftime(\"%d-%m-%Y %H:%M:%S\");\n $_error_log[2] = $_exception->getMessage();\n $_error_log[3] = $_exception->getFile();\n $_error_log[4] = $_exception->getLine();\n \n $_pointer = fopen(\"$_logfile\",\"ab\");\n fputcsv($_pointer, $_error_log);\n fclose($_pointer);\n \n// user-message \n return $_msg;\n \n}",
"public static function exceptionHandler($exception)\n {\n\n $traces = $exception->getTrace();\n\n $formatted_traces = array();\n\n foreach ($traces as $trace) {\n\n if (!isset($trace['file'])) {\n continue;\n }\n\n $trace['real_path'] = $trace['file'];\n $trace['file'] = substr($trace['file'], strlen($_ENV['W']['ROOT_PATH']));\n $trace['code'] = self::getCode($trace['file'], $trace['line'], $trace['function']);\n $formatted_traces[] = $trace;\n }\n\n $report = array(\n 'type' => 'exception',\n 'title' => get_class($exception),\n 'content' => $exception->getMessage(),\n 'file' => substr($exception->getFile(), strlen($_ENV['W']['ROOT_PATH'])),\n 'code' => self::getCode(\n substr($exception->getFile(), strlen($_ENV['W']['ROOT_PATH'])),\n $exception->getLine()\n ),\n 'real_path' => $exception->getFile(),\n 'line' => $exception->getLine(),\n 'trace' => $formatted_traces\n );\n\n self::addE2s($report);\n }",
"function raise(&$exception){\r\n\t\tif($msg = $exception->getMessage())\r\n\t\t\t$msg = \"with message \\\"$msg\\\"\";\r\n\t\techo 'Uncaught exception \"' . get_class($exception) . '\" ' . $msg . ' at [' . $exception->getFile() . ':' . $exception->getLine() . \"]\\n\";\r\n\t\texit($exception->getTraceAsString());\r\n\t}",
"public function exceptionHandler(Exception $exception)\n {\n $log = [\n \"message\" => $exception->getMessage(),\n \"code\" => $exception->getCode(),\n \"file\" => $exception->getFile(),\n \"line\" => $exception->getLine(),\n 'trace' => $exception->getTraceAsString(),\n 'type' => 'Exception'\n ];\n\n $this->_saveFile($log);\n }",
"protected function logException(Exception $ex) { $this->_traiat_errorLogger->logException($ex, TRUE); }",
"function logException ($ex) {\n\t\techo \"Should log: \".$ex->getMessage();\n\t}",
"private function processException(\\Throwable $e): void\n {\n LoggerHelper::logRawException($this->logger, $e);\n }",
"function _errorlog_catchUncaughtExceptions($exceptionObj) {\r\n //$logData = (array) $exceptionObj; // http://php.net/manual/en/class.exception.php\r\n $logData = array(\r\n 'logType' => 'exception',\r\n 'errno' => 'UNCAUGHT_EXCEPTION',\r\n 'errstr' => $exceptionObj->getMessage(), // method reference: http://php.net/manual/en/language.exceptions.extending.php\r\n 'errfile' => $exceptionObj->getFile(),\r\n 'errline' => $exceptionObj->getLine(),\r\n 'exceptionObj' => (array) $exceptionObj,\r\n 'backtrace' => _errorlog_getExceptionBacktraceText($exceptionObj),\r\n );\r\n $errorRecordNum = _errorlog_logErrorRecord($logData);\r\n \r\n // PHP will not continue or show any errors if we're catching exceptions, so show errors ourselves if it's enabled:\r\n if (ini_get('display_errors')) { // or check: $GLOBALS['SETTINGS']['advanced']['phpHideErrors']\r\n //$error = \"Fatal Error: Uncaught exception '\".get_class($exceptionObj).\"'\";\r\n //$error .= \" with message '\".$exceptionObj->getMessage().\"'\";\r\n //$error .= \" in \".$exceptionObj->getFile(). \" on line \" .$exceptionObj->getLine();\r\n $error = $exceptionObj->getMessage().\"\\n\";\r\n $error .= \"in \".$exceptionObj->getFile();\r\n $error .= \" on line \" .$exceptionObj->getLine(). \". \"; \r\n }\r\n else {\r\n $error = errorlog_messageWhenErrorsHidden($errorRecordNum);\r\n }\r\n print $error;\r\n \r\n // halt script execution after uncaught exceptions\r\n exit;\r\n}",
"function myExceptionHandler($exception) {\n\techo \"Triton: Uncaught exeption; <p>\" . $exception->getMessage() . \"<p><pre>\" . $exception->getTraceAsString(), \"</pre>\"; // punkt här emellan???\n}"
]
| [
"0.6466827",
"0.6245785",
"0.6231223",
"0.6214613",
"0.61629874",
"0.6152996",
"0.6149726",
"0.6124174",
"0.6019595",
"0.6014329",
"0.59938264",
"0.5901484",
"0.58407384",
"0.58404523",
"0.5839166",
"0.58276725",
"0.58028907",
"0.5793144",
"0.5783793",
"0.5768403",
"0.5760358",
"0.5757371",
"0.5754091",
"0.5741496",
"0.5708166",
"0.57001954",
"0.56929165",
"0.56928134",
"0.5685336",
"0.5651907"
]
| 0.75561965 | 0 |
Remove the message with the given receipt handle. | protected function removeSqsMessage($receiptHandle)
{
try {
$response = $this->sqs->deleteMessage([
'QueueUrl' => $this->queueUrl,
'ReceiptHandle' => $receiptHandle
]);
} catch (\Exception $e) {
$this->logError('Remove message from SQS', $e);
return false;
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function deleteMessage(string $receipt)\n {\n SqsClient::instance()->deleteMessage(\n [\n 'QueueUrl' => $this->getSqsUrl(),\n 'ReceiptHandle' => $receipt,\n ]\n );\n }",
"abstract public function deleteMessage($messageNo, $mailboxPath=null);",
"public function delete()\n {\n parent::delete();\n $receiptHandle = $this->job->getReceiptHandle();\n $this->mns->deleteMessage($receiptHandle);\n }",
"public function destroy(Receipt $receipt)\n {\n //\n }",
"public function removeNote($messageId) {\n return $this->_post(\n '/inbox/deletenote/',\n array(\n 'id' => $messageId\n )\n );\n\t}",
"function deleteReceipt()\n\t{\n\t\tglobal $db;\n\n\t\t$query = 'DELETE FROM '.receipt_table.' WHERE receipt_id = '.$this->receipt_id;\n\t\t$db->query($query);\n\t}",
"function messageReactionRemove(MessageReaction $reaction, User $user);",
"public function delete()\n {\n parent::delete();\n\n $this->sqs->deleteMessage([\n 'QueueUrl' => $this->queue, 'ReceiptHandle' => $this->job->getReceiptHandle(),\n ]);\n }",
"public function removeMessage($id = 1)\n {\n $this->_raw = '';\n }",
"function messageDelete(Message $message);",
"public function deleteMessage($messageId);",
"public function remove( int $invoiceId, int $messageId ) {\n\t\treturn $this->delete( '/invoices/' . rawurlencode( $invoiceId ) . '/payments/' . rawurlencode( $messageId ) );\n\t}",
"public static function removeMessage() {\n $con = pg_connect(\"host=\".CON_HOST.\" dbname=\".CON_DBNAME.\" user=\".CON_USER.\" password=\".CON_PASSWORD.\"\")\n or die (\"Could not connect to server.\");\n\n if($_REQUEST['id'] > 1) {\n $query = \"UPDATE message SET removed = true WHERE message_id = \". $_REQUEST['id'];\n }\n\n pg_query($con, $query) or die(\"Cannot execute the query.\");\n return true;\n }",
"public function remove(string $message_unique_id): int {\r\n\t\treturn $this->table(['messages'])->where(['unique_id'=>$message_unique_id])->delete();\r\n\t}",
"public function remove_message($message_id){\n\t\tglobal $con;\n\t\t$query=\"DELETE FROM referral_chat WHERE message_id=\\\"$message_id\\\"\n\t\t\t\tLIMIT 1\";\n\t\treturn $this->update($con,$query);\n\t}",
"public function deleteMessage(Zend_Queue_Message $message)\n {\n \treturn $this->_pheanstalk->delete($message->handle);\n }",
"function delete_message_from_queue($queue_url, $message_handle, $region, $queue_name)\n {\n $sqs_client = new Aws\\Sqs\\SqsClient([\n 'version' => 'latest',\n 'region' => \"$region\"\n ]);\n\n try\n {\n $sqs_client->deleteMessage([\n 'QueueUrl' => $queue_url,\n 'ReceiptHandle' => $message_handle\n ]);\n }\n catch(\\Aws\\Sqs\\Exception\\SqsException $sqs_exception)\n {\n echo \"Failed to delete message in queue: $queue_name, \" . $sqs_exception->getMessage() . \"\\n\";\n exit(1);\n }\n }",
"public function delete()\n {\n $this->sqs_client->DeleteMessage([\n 'QueueUrl' => 'https://sqs.us-east-1.amazonaws.com/947603853016/rs-video-harvester.fifo',\n 'ReceiptHandle' => $message['ReceiptHandle']\n ]);\n\n return TRUE;\n }",
"public function removeMessage(MessageRepositoryInterface $message): PodiumResponse;",
"public function remove ($messageId)\n\t{\n\t\t// On prépare notre requête SQL\n\t\t$query = 'DELETE FROM messages WHERE messageId = :messageId';\n\n\t\t// Tableau de binding\n\t\t$boundValues = [\n\t\t\t'messageId' => $messageId,\n\t\t];\n\n\t\t// Requête dans couche d'abstraction PDO\n\t\t$statement = $this->PDO->prepare($query);\n\n\t\t// On exécute notre requête SQL (en liant notre tableau de binding)\n\t\t$statement->execute($boundValues);\n\t}",
"function messageReactionRemoveAll(Message $message);",
"function remove_message($db, $id)\n{\n\t$sql = \"DELETE from messages where id = :id\";\n\t$st = $db->prepare($sql);\n\t$st->execute(array(':id'=>$id));\n\treturn;\n}",
"public function deleted(PurchaseReceipt $purchaseReceipt)\n {\n //\n }",
"public function action_Delete_Message()\n\t{\n\t\t// load item\n\t\t$item = ORM::factory('Ticket_Message', $this->request->param('id'));\n\n\t\tif ( ! $item->loaded())\n\t\t\t$this->not_found('Could not find ticket message to delete. Already deleted maybe?');\n\n\t\t$ticket_id = $item->ticket->id;\n\n\t\t$item->deleted_at = date('Y-m-d H:i:s');\n\t\t$item->save();\n\n\t\tHTTP::redirect('Ticket/Detail/'.$ticket_id);\n\t}",
"public function destroy(ReceiveSms $receiveSms)\n {\n //\n }",
"function qa_pm_delete($userid, $handle, $cookieid, $message, $box)\n{\n\trequire_once QA_INCLUDE_DIR . 'db/messages.php';\n\n\tqa_db_message_user_hide($message['messageid'], $box);\n\tqa_db_message_delete($message['messageid'], false);\n}",
"public function delete( $msgNum )\r\n {\r\n if ( $this->state != self::STATE_TRANSACTION )\r\n {\r\n throw new ezcMailTransportException( \"Can't call delete() on the POP3 transport when not successfully logged in.\" );\r\n }\r\n\r\n $this->connection->sendData( \"DELE {$msgNum}\" );\r\n $response = $this->connection->getLine();\r\n\r\n if ( !$this->isPositiveResponse( $response ) )\r\n {\r\n throw new ezcMailTransportException( \"The POP3 server could not delete the message: {$response}.\" );\r\n }\r\n }",
"public function delete_received_message() {\n\n $this->db->query(\"DELETE FROM message_recipient WHERE message_id = ?\", array(\n $this->id\n ));\n\n return ($this->db->error()) ? false : true;\n }",
"function messageDeleteRaw(TextChannelInterface $channel, string $messageID);",
"public function delete() {\n\t\t$message = $this->discussion->message(['id' => $this->request->id]);\n\n\t\tif ($this->discussion->pull_message($message)) {\n\t\t\treturn $this->render(['head' => true, 'status' => 204]);\n\t\t}\n\n\t\treturn $this->render(['head' => true, 'status' => 400]);\n\t}"
]
| [
"0.71499795",
"0.6463021",
"0.64213586",
"0.6218252",
"0.6212994",
"0.60864216",
"0.58671975",
"0.5855174",
"0.5837375",
"0.5796173",
"0.5780242",
"0.5713857",
"0.56987983",
"0.5652409",
"0.5634057",
"0.5590202",
"0.5544428",
"0.5538929",
"0.54915535",
"0.5446968",
"0.54451156",
"0.5442217",
"0.54314464",
"0.5388511",
"0.53800726",
"0.53579104",
"0.53501844",
"0.5339249",
"0.53275025",
"0.53155893"
]
| 0.64811784 | 1 |
Adds the member object to the user | public static function addMemberObject($member_id, $user_id): void
{
if(empty($member_id) || empty($user_id)) return;
update_field('member_object', $member_id, 'user_'.$user_id);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function guildMemberAdd(GuildMember $member);",
"public function addUser(){}",
"private function addUser()\n {\n $this->online->addUser($this->user, $this->place, $this->loginTime);\n }",
"public function addMember(){\n\t\t\t\n\t\t\t$this->load->view('addMember') ;\n\t\t}",
"public function add($obj) {\n\t\t\tif (!isset($obj[\"pop_user\"]) || empty($obj[\"pop_user\"])) {\n\t\t\t\t$this->output->add(\"status\", \"No username is set\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$auth = Auth::getInstance($this->db, $this->output);\n\n\t\t\tif (!$auth->hasDelegatedUser($obj[\"pop_user\"]) && ($auth->getUser() !== $obj[\"pop_user\"])) {\n\t\t\t\t$this->output->add(\"status\", \"Not allowed.\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$sql = \"INSERT INTO popd (pop_user) VALUES (:pop_user)\";\n\t\t\t$params = array(\n\t\t\t\t\":pop_user\" => $obj[\"pop_user\"]\n\t\t\t);\n\n\t\t\t$status = $this->db->insert($sql, [$params]);\n\n\t\t\tif (isset($status)) {\n\t\t\t\t$this->output->add(\"status\", \"ok\");\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"public function _friendadd() {\n\t\t$this->history = false;\n\n\t\t// for authenticated only\n\t\tif ($this->user && csrf::valid()) {\n\n\t\t\t// require valid user\n\t\t\t$this->member = new User_Model($username);\n\t\t\tif ($this->member->id) {\n\t\t\t\t$this->user->add_friend($this->member);\n\n\t\t\t\t// News feed event\n\t\t\t\tnewsfeeditem_user::friend($this->user, $this->member);\n\n\t\t\t}\n\t\t}\n\n\t\turl::back('members');\n\t}",
"public function addUser(){\n\t}",
"public function add_member($team_id,$user_id){\n if ($this->CreateTeamModel->add_member($team_id,$user_id)) {\n echo '<script>alert(\"Team Member has been added successfully!\");</script>';\n redirect(base_url().'team/view/'.$team_id);\n } else {\n echo '<script>alert(\"Team Member addition failed!\");</script>';\n redirect(base_url().'team/view/'.$team_id);\n }\n }",
"public function add_membership()\n {\n $this->modify_object('Booking_membership');\n }",
"protected function OP_addMember($es_id, $member_id, $full_name, $user_id, $color='', $imageUrl='')\n\t{\n\t\t$op = array(\n\t\t\t'optype' => 'AddMember',\n\t\t\t'memberid' => (string) $member_id,\n\t\t\t'timestamp' => self::getTimeStamp(),\n\t\t\t'setProperties' => array(\n\t\t\t\t'fullName' => $full_name,\n\t\t\t\t'color' => $color,\n\t\t\t\t'imageUrl' => $imageUrl,\n\t\t\t\t'uid' => $user_id,\n\t\t\t)\n\t\t);\n\t\t$this->OP_add2Db($op, $es_id);\n\t}",
"function addMember($member)\r\n {\r\n //set to empty image or interests\r\n $image = '';\r\n $interests = \"\";\r\n\r\n $phone = str_replace('-', '', $member->getPhone());\r\n $phone = '('.substr($phone, 0, 3).')'.substr($phone, 3, 3).'-'.substr($phone,6);\r\n\r\n //if the object is a member will loop over the array and set the interests\r\n if ($member instanceof PremiumMember) {\r\n $inDoorInterests = $member->getInDoorInterests();\r\n $outDoorInterests = $member->getOutDoorInterests();\r\n $premium = 1;\r\n\r\n $interests .= \"\";\r\n for ($i = 0; $i < count($inDoorInterests); $i++) {\r\n $interests .= $inDoorInterests[$i] . \", \";\r\n }\r\n //$interests .= \"\";\r\n for ($i = 0; $i < count($outDoorInterests); $i++) {\r\n $interests .= $outDoorInterests[$i] . \", \";\r\n }\r\n\r\n $interests = rtrim($interests,\", \");\r\n\r\n } else {\r\n $premium = 0;\r\n }\r\n\r\n //1. define the query\r\n $sql = \"INSERT INTO Members (fname, lname, age, gender, phone, email, state, seeking, bio, premium, image, interests) \r\n VALUES (:fname, :lname, :age, :gender, :phone, :email, :state, :seeking, :bio, :premium, :image, :interests)\";\r\n\r\n //2. prepare the statement\r\n $statement = $this->_dbh->prepare($sql);\r\n\r\n //3. bind parameters\r\n $statement->bindParam(':fname', $member->getFname(), PDO::PARAM_STR);\r\n $statement->bindParam(':lname', $member->getLname(), PDO::PARAM_STR);\r\n $statement->bindParam(':age', $member->getAge(), PDO::PARAM_STR);\r\n $statement->bindParam(':gender', $member->getGender(), PDO::PARAM_STR);\r\n $statement->bindParam(':phone', $phone, PDO::PARAM_STR);\r\n $statement->bindParam(':email', $member->getEmail(), PDO::PARAM_STR);\r\n $statement->bindParam(':state', $member->getState(), PDO::PARAM_STR);\r\n $statement->bindParam(':seeking', $member->getSeeking(), PDO::PARAM_STR);\r\n $statement->bindParam(':bio', $member->getBio(), PDO::PARAM_STR);\r\n $statement->bindParam(':premium', $premium, PDO::PARAM_STR);\r\n $statement->bindParam(':image', $image, PDO::PARAM_STR);\r\n $statement->bindParam(':interests', $interests, PDO::PARAM_STR);\r\n\r\n //4. execute the statement\r\n $success = $statement->execute();\r\n\r\n //5. return the result\r\n return $success;\r\n }",
"public function add_members() {\n // check if a user + group id exists in membership\n // update that if exists\n // else, add\n // redirect to group id\n\n if (!($this->input->post() || $this->session->has_userdata('curr_group_id'))) {\n $this->_redirect('dashboard/groups');\n exit();\n }\n\n $curr_group_id = $this->session->userdata('curr_group_id');\n \n if ($users = $this->input->post('users')) {\n $this->_add_users($users);\n }\n\n $this->_redirect('dashboard/groups/' . $curr_group_id);\n }",
"public function add($member_id) {\n\t\t$members = $member_id;\n\t\t$this->set(compact('members'));\n\t\t$users = CakeSession::read('Auth.User.id');\n\t\t$this->set(compact('users'));\n\t\t$this->loadModel('Admin');\n\t\t$admins = $this->Admin->find('all', array('conditions' => array('Admin.member_id' => $member_id, 'Admin.active' => true)));\n\t\t$this->set(compact('admins'));\n\t\t\n\t\tif ($this->request->is('post')) {\n\t\t\t$this->Interaction->create();\n\t\t\tif ($this->Interaction->save($this->request->data)) {\n\t\t\t\t$this->Session->setFlash(__('Interaction successfully added'));\n\t\t\t\treturn $this->redirect(array('controller' => 'members', 'action' => 'view', $member_id));\n\t\t\t}\n\t\t\t$this->Session->setFlash(__('Unable to add interaction'));\n\t\t}\n\t}",
"function add_user(MJKMH_User $user): void {\r\n\t\t$this->users[$user->id()] = $user;\r\n\t}",
"private function newMemberSetUp() {\n\t\t$this->infoAlert(\"Welcome! Looks like you're new here, We'll set you up with a default team. Have fun!\");\n\t\t$this->teams[0] = new TeamManagerTeam();\n\n\t\t$userData = $this->getUserData();\n\t\t$fname = $userData['fname'];\n\t\t$lname = $userData['lname'];\n\t\t$phone = $userData['phone'];\n\t\t$email = $userData['email'];\n\t\t$position = \"Manager\";\n\t\t$manager = new TeamManagerMember($fname, $lname, $phone, $email, $position);\n\n\t\t$manager = $this->teams[0]->addMember($manager);\n\n\t\tadd_user_meta( $this->user_id, $this->user_meta_key, $this->teams[0]->id );\n\t}",
"public function action_add()\r\n\t{\r\n\t\tif ( Request::current()->method() == Request::POST )\r\n\t\t{\r\n\t\t\treturn $this->_add();\r\n\t\t}\r\n\t\t\r\n\t\t$this->template->title = __('Add user');\r\n\t\t$this->breadcrumbs\r\n\t\t\t->add($this->template->title);\r\n\r\n\t\t// check if user have already enter something\r\n\t\t$data = Flash::get( 'post_data', array() );\r\n\r\n\t\t$user = new User( $data );\r\n\r\n\t\t$this->template->content = View::factory( 'user/edit', array(\r\n\t\t\t'action' => 'add',\r\n\t\t\t'user' => $user,\r\n\t\t\t'permissions' => Model_Permission::get_all()\r\n\t\t) );\r\n\t}",
"public function add() {\n\t\t$user = $this->User->read(null, $this->Auth->user('id'));\n\t\tif ($this->request->is('post')) {\n\t\t\t$this->User->create();\n\t\t\t$this->request->data['User']['password'] = AuthComponent::password($this->request->data['User']['password']);\n\t\t\tif ($this->User->save($this->request->data)) {\n\t\t\t\t$this->Session->setFlash(__('The user has been saved'));\n\t\t\t\t$this->redirect(array('action' => 'index'));\n\t\t\t} else {\n\t\t\t\t$this->Session->setFlash(__('The user could not be saved. Please, try again.'));\n\t\t\t}\n\t\t} else {\n\t\t\t$mintURL = $this->Configuration->findByName('Mint URL');\r\n\t\t\t$queryURL = $mintURL['Configuration']['value'];\r\n\t\t\t$lookupSupported = isset($queryURL) && \"\" <> $queryURL;\r\n\t\t\t$this->set('lookupSupported', $lookupSupported);\n\t\t\t$this->set('userType', $user['User']['type']);\n\t\t}\n\t}",
"function _add_user()\n {\n if (!$this->has_arg('PROJECTID'))\n $this->_error('No project id specified');\n if (!$this->has_arg('PERSONID'))\n $this->_error('No user specified');\n\n $proj = $this->db->pq(\"SELECT p.projectid FROM project p WHERE p.personid LIKE :1 AND p.projectid=:2\", array($this->user->personId, $this->arg('PROJECTID')));\n\n if (!sizeof($proj))\n $this->_error('No such project');\n $proj = $proj[0];\n\n $person = $this->db->pq(\"SELECT CONCAT(CONCAT(givenname, ' '), familyname) as fullname FROM person WHERE personid=:1\", array($this->arg('PERSONID')));\n if (!sizeof($person))\n $this->_error('No such person');\n $person = $person[0];\n\n $this->db->pq(\"INSERT INTO project_has_person (projectid, personid) VALUES (:1, :2)\", array($this->arg('PROJECTID'), $this->arg('PERSONID')));\n\n $this->_output(array('FULLNAME' => $person['FULLNAME']));\n }",
"public function add()\n\t{\n\t\t// TODO\n\t\t// if(user has permissions){}\n\t\t$this -> loadModel('User');\n\t\tif($this -> request -> is('post') && !$this -> User -> exists($this -> request -> data['SgaPerson']['user_id']))\n\t\t{\n\t\t\t$this -> Session -> setFlash(\"Please select a valid JacketPages user to add.\");\n\t\t\t$this -> redirect(array('action' => 'index',$id));\n\t\t}\n\t\t$this -> loadModel('User');\n\t\tif ($this -> request -> is('post'))\n\t\t{\n\t\t\t$this -> SgaPerson -> create();\n\t\t\tif ($this -> SgaPerson -> save($this -> data))\n\t\t\t{\n\t\t\t\t$user = $this -> User -> read(null, $this -> data['SgaPerson']['user_id']);\n\t\t\t\t$this -> User -> set('level', 'sga_user');\n\t\t\t\t$this -> User -> set('sga_id', $this -> SgaPerson -> getInsertID());\n\t\t\t\t$this -> User -> save();\n\t\t\t\t$this -> Session -> setFlash(__('The user has been added to SGA.', true));\n\t\t\t\t$this -> redirect(array('action' => 'index'));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this -> Session -> setFlash(__('Invalid user. User may already be assigned a role in SGA. Please try again.', true));\n\t\t\t}\n\t\t}\n\t}",
"public function store(AddMemberRequest $request)\n {\n if (!DrawTicket::areTicketsAvailable()) {\n return back()->with('error', \"No more tickets is available\");\n }\n $user = User::create($request->all());\n $user->tickets()->create([\n 'ticket_number' => $request->ticket_number\n ]);\n\n return back()->with('status', \"{$user->name} with ticket #{$user->tickets->first()->ticket_number} was added\");\n }",
"public function addMember()\n {\n if($this->username == NULL || $this->password == NULL || $this->email == NULL){\n return FALSE;\n }else{\n global $dbh;\n // to encription your password \n $encPassword = md5($this->password);\n $sql = $dbh->prepare(\"INSERT INTO memeber (username, password, email) VALUES('$this->username','$encPassword','$this->email')\");\n $sql->execute();\n // $sql !== FALSE\n if(FALSE !== $sql)\n RETURN TRUE;\n ELSE\n RETURN FALSE;\n }\n\n }",
"public function addMember($params = [])\n {\n if (isset($params['vars']) && (is_array($params['vars']) || is_object($params['vars'])) ) {\n $params['vars'] = json_encode($params['vars']);\n }\n\n $member = new Member();\n $member->setMember(\n $this->mailgun()->post(\n \"lists/{$this->address}/members\",\n $this->_parseParams($params)\n )->http_response_body->member\n );\n\n return $member;\n\n }",
"public function store()\n\t{\n\t\t$member = member::create([\n\t\t\t'pid' => Request::input('pid'),\n\t\t\t'username' => Request::input('username'),\n\t\t\t'password' => md5(Request::input('password')),\n\t\t\t'status' => Request::input('status'),\n\t\t\t]);\n\n\t\tmember_profiles::create([\n\t\t\t'uid' => $member->id,\n\t\t\t'nickname' => Request::input('nickname'),\n\t\t\t]);\n\t\tmember_credits::create([\n\t\t\t'uid' => $member->id,\n\t\t\t'credit' => Request::input('credit'),\n\t\t\t]);\n\t\tmember_percents::create([\n\t\t\t'uid' => $member->id,\n\t\t\t]);\n\t}",
"public function create(Member $user) {\n\t\t\treturn true;\n\t\t}",
"function admin_member() {\n\n\t\t}",
"function Register()\r\n\t{\r\n\t\tglobal $Site;\r\n\t\t//if all the details is valid save the user on data base\r\n\t\tif ($this->IsValid())\r\n\t\t{\r\n\t\t\t$MemberID = GetID(\"member\", \"MemberID\");//getting last MemberID +1 for adding one more user\r\n\t\t\t$DateAdded = date(\"Y-m-d H:i:s\");\r\n\t\t\t$DateUpdated = $DateAdded;\r\n\t\t\t$IsEnable = 1;\r\n\t\t\t$pass = base64_encode($this->Password);\r\n\t\t\t$SQL = \"insert into member (MemberID, ProfileType, FirstName, LastName, TelNo, Email, Password, IsActive, IsEnable, DateAdded, DateUpdated) values ($MemberID, 'user', '$this->FirstName', '$this->LastName', '$this->PhoneNumber', '$this->Email', '$pass', '1' , '$IsEnable', '$DateAdded', '$DateUpdated')\";\r\n\t\t\tGetRS($SQL);\r\n\t\t\t$_SESSION['SAWMemberID'] = $MemberID;//cookie- to not allow impersonation of another user PHP gives each customer ID\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\t\t\r\n\t}",
"public function create(Member $member)\n {\n\n }",
"public function add(string $list_id, string $member): object\n {\n $member_id = $this->getUserId($member);\n\n $path = \"lists/{$list_id}/members\";\n $data = [\n 'user_id' => $member_id\n ];\n\n return $this->post($this->credentials, $path, null, $data, false, true);\n }",
"function admin_add() {\n\n\t\tif (!empty($this->data)) {\n\n\t\t\t$this->User->create();\n\n\t\t\t/**\n\t\t\t * Save new user.\n\t\t\t */\n\t\t\tif ($this->User->save($this->data)) {\n\n\t\t\t\t/**\n\t\t\t\t * If the new user is saved, a success message is displayed.\n\t\t\t\t * Redirect to the index page.\n\t\t\t\t */\n\t\t\t\t$this->Session->setFlash(__d('core', 'The user has been saved.', true));\n\t\t\t\t$this->redirect(array('action' => 'index'));\n\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If the user is not saved, an error message is displayed.\n\t\t\t\t */\n\t\t\t\t$this->Session->setFlash(__d('core', 'The user has not been saved.', true), 'default', array('class' => 'error'));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Select all profiles (Administrator or Member).\n\t\t * @var array\n\t\t */\n\t\t$profiles = $this->User->Profile->find('list');\n\n\t\t/**\n\t\t * Select all offers enabled.\n\t\t * @var array\n\t\t */\n\t\t$offers = $this->User->Offer->find('list');\n\n\t\t/**\n\t\t * Put all profiles in \"profiles\" and offers in \"offers\".\n\t\t * $profiles and $offers will be available in the view.\n\t\t */\n\t\t$this->set(compact('profiles', 'offers'));\n\n\t}",
"public function add_member($mData)\r\n\t\t{\r\n\t\t\t$this->db->insert('members', $mData);\r\n\t\t}"
]
| [
"0.7065694",
"0.68117255",
"0.6786187",
"0.6769946",
"0.6669624",
"0.666707",
"0.6662622",
"0.6587026",
"0.65755725",
"0.6517608",
"0.65094155",
"0.6491399",
"0.6406797",
"0.6405117",
"0.6372694",
"0.6362884",
"0.6356296",
"0.63368255",
"0.6311734",
"0.6302656",
"0.62713367",
"0.6271228",
"0.6252155",
"0.62237",
"0.621484",
"0.61910576",
"0.6175216",
"0.6169871",
"0.61651844",
"0.61609656"
]
| 0.7438395 | 0 |
Is the user an owner or admin | public static function isOwner(): bool
{
if(in_array( 'owner', self::getUserRole()) || in_array('administrator', self::getUserRole())) return true;
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function isAdminOrOwner($user_id)\n\t{\n\t\t$user = User::model()->findByPk($user_id);\n\t\tif ($user !== null)\n\t\t{\n\t\t\treturn $user->isAdmin() ||\n\t\t\t($user->canCreateAdventure() && $user_id == $this->createdBy)\n\t\t\t;\n\t\t}\n\t\treturn false;\n\t}",
"protected function isAdminUser() {}",
"function checkAdminOwner() {\n //Ensure user is logged in\n if(Auth::guest()) {\n return false;\n }\n //Ensure that the user is an admin or an owner\n $roles = Auth::user()->roles;\n //Loop through roles and check for permission\n foreach($roles as $role) {\n if($role->name == \"admin\" || $role->name == \"owner\") {\n //Double check to make sure user is not banned\n if(checkSingleRole(\"banned\") == false)\n return true;\n else\n return false; //User is an admin but is banned\n }\n }\n //User is not an admin or an owner\n return false;\n}",
"private function isAdmin() {\n\t\tif (Auth::user()->user == 1) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\n\t}",
"function isAdmin() {\n return ($this->userType == 'admin');\n }",
"public function isOwner(): bool {\n $f3 = \\Base::instance();\n\n return $f3->get('CURRENT_USER') && !is_null($this->owner) && $f3->get('CURRENT_USER') === $this->owner->id;\n }",
"protected function isCurrentUserAdmin() {}",
"protected function isCurrentUserAdmin() {}",
"public function isOwner()\n {\n return (\\Auth::check() and \\Auth::user()->id == $this->id);\n }",
"function isAdmin(){\r\n\r\n\t\tif($this->user_type == 'Admin'){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}",
"function isAdmin(){\n $user = $this->loadUser(Yii::app()->user->id);\n return intval($user->role) == 1;\n }",
"function isAdmin(){\n $user = $this->loadUser(Yii::app()->user->id);\n return intval($user->role) == 1;\n }",
"public function isUserAdmin()\n\t{\n\t\treturn (Bn::getValue('user_type') == 'A');\n\t}",
"function is_user_admin()\n {\n }",
"public function isAdminOrOwner(User $user)\n {\n return $this->isOwner($user) || $this->isAdmin($user);\n }",
"function is_admin()\n {\n //is a user logged in?\n\n //if so, check admin status\n\n //returns true/false\n\n }",
"public function isAdmin()\n {\n return ($this->username === \"admin\");\n }",
"public function isUserOnAdminArea()\n\t{\n\t\treturn is_admin();\n\t}",
"function isAdmin(){\n\t\treturn ($this->userlevel == ADMIN_LEVEL || $this->username == ADMIN_NAME);\n\t}",
"public function is_admin(){\n\t\treturn $this->account_type == \"manager\";\n\t}",
"public function isAdmin()\n {\n return ($this->type === User::ADMIN_USER);\n }",
"public function isAdmin()\n {\n return $this->isSuperUser() || $this->isMemberOf('admin');\n }",
"protected function userIsAdmin ()\n {\n $tokenHeader = apache_request_headers();\n $token = $tokenHeader['token'];\n $datosUsers = JWT::decode($token, $this->key, $this->algorithm);\n\n if($datosUsers->nombre==\"admin\")\n {\n return true;\n }\n else\n {\n return false;\n } \n }",
"public function isAdmin(){\n $user = Auth::guard('web') -> user();\n if ($user -> state != 1) {\n return 0;\n }\n else {\n return 1;\n }\n }",
"function isAdmin() {\n if (\\Illuminate\\Support\\Facades\\Auth::user()->rol_id == 1) {\n return true;\n } else {\n return false;\n }\n }",
"public static function am_i_admin() \n {\n return ($_SESSION['_user'] == AV_DEFAULT_ADMIN || $_SESSION['_is_admin']);\n }",
"function isAdmin() {\n $user = $this->loadUser(Yii::app()->user->id);\n return intval($user->role) == 1;\n }",
"function iAmAdmin(){\n $adminIDs = Array( 1, 2 );\n \n return in_array( $_SESSION['userid'], $adminIDs );\n }",
"function canEdit() {\r\n\t\tif($this->owner->ID == Member::currentUserID())\r\n\t\t\treturn true;\r\n\r\n\t\t$member = Member::currentUser();\r\n\t\tif($member)\r\n\t\t\treturn $member->isAdmin();\r\n\r\n\t\treturn false;\r\n\t}",
"function userIsAreaAdmin() {\n\t\t// use Yawp::authUsername() instead of $this->username because\n\t\t// we need to know if the user is authenticated or not.\n\t\treturn $this->acl->areaAdmin(Yawp::authUsername(), $this->area);\n\t}"
]
| [
"0.78823483",
"0.7808002",
"0.76614654",
"0.7637357",
"0.76033586",
"0.7592924",
"0.7540745",
"0.75382096",
"0.7530428",
"0.7528442",
"0.7476891",
"0.7476891",
"0.74755514",
"0.747021",
"0.74566305",
"0.74562246",
"0.7425576",
"0.74055356",
"0.73839027",
"0.7383729",
"0.7365827",
"0.7350097",
"0.7348123",
"0.7338483",
"0.73165053",
"0.7307788",
"0.7301926",
"0.7295098",
"0.72926015",
"0.7283312"
]
| 0.8035895 | 0 |
Removes the provided user_id from it's member's employee list | public static function removeUserFromMember($user_id)
{
if(empty($user_id)) return false;
$member_id = get_field('member_object', 'user_'.$user_id);
if(empty($member_id)) return false;
$member_employees_list = get_field('users', $member_id);
foreach($member_employees_list as $key => $employee_id) {
if((int)$employee_id['user'] === (int)$user_id) unset($member_employees_list[$key]);
}
update_field('users', $member_employees_list, $member_id);
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function removeUser()\n\t{\n\t\tif(isset($this->primarySearchData[$this->ref_user]))\n\t\t{\n\t\t\tunset($this->primarySearchData[$this->ref_user]);\n\t\t}\n\t}",
"public function RemoveUser($id)\r\n {\r\n $this->customPDO->Remove('users', 'WHERE User_Id = ' . $id);\r\n }",
"public function removeMember($project_id, $user_id)\n {\n return $this->delete($this->getProjectPath($project_id, 'members/'.urldecode($user_id)));\n }",
"public static function removeMemberFromUser($user_id)\n\t{\n\t if(empty($user_id)) return false;\n\t update_field('member_object', '', 'user_'.$user_id);\n\t return true;\n\t}",
"public function remove($id) {\n $this->db->where('id_user', $id);\n $this->db->delete('user');\n }",
"public function remove($userid) {\n $sql =<<<SQL\nDELETE FROM $this->tableName\nWHERE userid=?\nSQL;\n $pdo = $this->pdo();\n $statement = $pdo->prepare($sql);\n $statement->execute(array($userid));\n }",
"public function delUser($user_id) {\n $db = $this->dbConnect();\n $req = $db->prepare('DELETE FROM `p5_users` WHERE USER_ID = ?');\n $req->execute(array($user_id));\n $req->closeCursor();\n }",
"public static function onDeleteUser($user_id)\n\t{\n\t\tif( !Member::delete_employee_member_pivot_row_by_employee_id($user_id) ) {\n\t\t\terror_log(\"[Dashboard\\User->onDeleteUser]: Unable to delete the row for employee_id: {$user_id}\");\n\t\t\treturn false;\n\t\t}\n\t\tif(!self::removeUserFromMember( $user_id)) {\n\t\t\terror_log(\"[Dashboard\\User->onDeleteUser]: Unable to remove the user from the member {$user_id}\");\n\t\t\treturn false;\n\t\t}\n\t\tif(!self::removeMemberFromUser( $user_id)) {\n\t\t\terror_log(\"[Dashboard\\User->onDeleteUser]: Unable to remove the member from the user {$user_id}\");\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}",
"public function removeLeader($user): void\n {\n $this->leaders()->detach($user);\n }",
"public function actionRemove_user($id) { // by anoop 15-11-18\n //redirect a user if not super admin\n if (!Yii::$app->CustomComponents->check_permission('assign_team')) {\n return $this->redirect(['site/index']);\n }\n\n if (!empty($id)) {\n // get User email\n $user_email = Yii::$app->db->createCommand(\"SELECT email FROM assist_users WHERE id = '$id' AND status = 1 \")->queryAll();\n $useremail = $user_email[0]['email'];\n\n Yii::$app->db->createCommand(\"UPDATE assist_user_meta SET meta_value = '' WHERE meta_key = 'team' AND uid = '$id' \")->execute();\n\n Yii::$app->session->setFlash('success', 'User with Email Address <u>' . $useremail . '</u> Successfully Removed.');\n return $this->redirect(['dv-users/assign_team']);\n //return $this->redirect(['view', 'id' => $user_id]);\n }\n }",
"function removeUser($id) {\n $this->db->delete('user', array('userID' => $id));\n }",
"public function disinviteUser($user_id)\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\t$affectedRows = $ilDB->manipulateF(\"DELETE FROM svy_inv_usr WHERE survey_fi = %s AND user_fi = %s\",\n\t\t\tarray('integer','integer'),\n\t\t\tarray($this->getSurveyId(), $user_id)\n\t\t);\n\t\tinclude_once './Services/User/classes/class.ilObjUser.php';\n\t\tilObjUser::_dropDesktopItem($user_id, $this->getRefId(), \"svy\");\n\t}",
"function user_remove($user_id)\n{\n if (!isset($user_id) || user_level(5))\n return false;\n\n return mysql_query(\"DELETE FROM `amsn_users` WHERE `id` = '\" . (int)$user_id . \"' LIMIT 1\");\n}",
"public function unemploy(){\n unset($this->staffId);\n unset($this->store);\n $connection = new Connection();\n $link = $connection->connect();\n $link->exec(\"DELETE FROM staff WHERE user_id = '$this->id'\");\n $connection = null;\n }",
"public function delete_user($user_id) {\r\n $this->conn->connect();\r\n if ($user_id != null) {\r\n $res = $this->conn->execute_query(\"\r\n UPDATE Shifts\r\n SET UserID=NULL\r\n WHERE UserID=?;\",\"d\",$user_id);\r\n $res = $this->conn->execute_query(\"\r\n DELETE FROM Requests\r\n WHERE UserID=?;\",\"d\",$user_id);\r\n $res = $this->conn->execute_query(\"\r\n DELETE FROM Users\r\n WHERE UserId=?;\",\"d\",$user_id);\r\n }\r\n }",
"public function delete_user($id)\n\t{\n\t\t$termination_date = date(\"Y-m-d H:i\");\n\t\t$dbres = $this->db->query(\"update user SET delete_status='1',termination_date='$termination_date' where id = $id \");\n\t\tredirect(site_url() . 'sys/get_employees?msg_del=success');\n\t}",
"public function unsetUser($user){\n if($user->type == 'client'){\n if(isset($this->tokenIdMap[$user->token])){\n $offset = array_search($user->id, $this->tokenIdMap[$user->token]);\n unset($this->tokenIdMap[$user->token][$offset]);\n }\n }else{\n $offset = array_search($user->id, $this->adminID);\n unset($this->adminID[$offset]);\n }\n \n }",
"public function destroy($user_id)\n\t{\n\t\t//\n\t}",
"public function delete($user_id) {\n # anime they have submitted.\n \n # Get all the anime this user has submitted.\n $user_anime = $this->anime_model->get_anime_from_user($user_id);\n \n foreach($user_anime as $anime) {\n # Make each anime inactive\n $this->anime_model->make_anime_inactive($anime['id']);\n }\n \n # Make the user's profile inactive\n $this->user_model->make_inactive($user_id);\n \n # Log the user out\n $this->logout();\n }",
"public function destroy(User $user_model,$id)\n {\n $idArray = array_filter(explode(',',$id),function($item){\n return is_numeric($item);\n });\n\n $user_model->destroy($idArray);\n return $this->success([],__('base.success'));\n }",
"public function removeUser($user): void\n {\n if ($user->current_team_id === $this->id) {\n $user->forceFill([\n 'current_team_id' => null,\n ])->save();\n }\n\n $this->users()->detach($user);\n }",
"function User_Remove($UserIDorUsername)\n\t{\n\t\t$UserID=$this->GetUserID($UserIDorUsername);\n\t\tj::SQL(\"DELETE FROM jfp_xuser WHERE ID=?\",$UserID);\n\t\tj::SQL(\"DELETE FROM jf_users WHERE ID=?\",$UserID);\n\t}",
"public function deleteUserById($user_id){\n $this->dao->deleteUserByid($user_id);\n }",
"public function removeTeamUser($user)\n {\n if ($user->current_team_id === $this->id) {\n $user->forceFill([\n 'current_team_id' => null,\n ])->save();\n }\n\n $this->users()->detach($user);\n }",
"public function deleteUser($id)\n\t{\n\n\t\t$this->collection->remove(['_id'=> new MongoId($id)]);\n\t}",
"function removeuserfromteam(){\n $this->auth(COMP_ADM_LEVEL);\n $key_id = $this->uri->segment(3);\n $team_id = $this->uri->segment(4);\n $contest_id = $this->uri->segment(5);\n $this->m_key->removeUserByKeyId($key_id);\n $this->teamedit($team_id);\n }",
"function delete_faculty_admin_by_user_id($id)\n {\n\t\t$this->db->where('user_id', $id);\n\t\t$this->db->delete('faculty_admins');\n }",
"public function remove_member($team_id,$user_id,$project_id)\n {\n if ($this->CreateTeamModel->remove_member($team_id,$user_id,$project_id)== 1) {\n\n echo '<script>alert(\"Team Member has been removed successfully!\");</script>';\n redirect(base_url().'team/view/'.$team_id);\n \n } else {\n echo '<script>alert(\"Team Member removal failed!\");</script>';\n redirect(base_url().'team/view/'.$team_id);\n }\n }",
"function user_remove_from_site( $userID ) {\r\n global $wpdb;\r\n\r\n $member_id = $this->get_members_by_wp_user_id( $userID );\r\n\r\n $wpdb->query( $wpdb->prepare( \"DELETE FROM {$this->tb_prefix}enewsletter_member_group WHERE member_id = %d\", $member_id ) );\r\n $wpdb->query( $wpdb->prepare( \"DELETE FROM {$this->tb_prefix}enewsletter_members WHERE member_id = %d\", $member_id ) );\r\n }",
"public function destroy($id)\n {\n $data = Abz_Employees::findOrFail($id);\n $info = $data;\n \n //reassign a new superior to deleted user's subordinates. Upon deleting this employee, find this employee subordinates (whose who has this deleted emplyee's ID as in their 'superior_id' column and assign them other superior with the same rank)\n\t\t$model = new Abz_Employees();\n\t\t$v = $model->reassignSuperior($info);\n \n //delete the image from folder '/images/employees/'\n\t\t//$product = Abz_Employees::where('id', $id)->first(); //found image \n\t\tif(file_exists(public_path('images/employees/' . $data->image))){\n\t\t \\Illuminate\\Support\\Facades\\File::delete('images/employees/' . $data->image);\n\t\t}\n \n\t\t$data->delete(); //delete the user\n\t\t\n\t\treturn response()->json(['result' => $v]);\n //return 204;\n }"
]
| [
"0.6595452",
"0.6529643",
"0.6477977",
"0.6458815",
"0.64081913",
"0.6395868",
"0.6394279",
"0.6388648",
"0.63867426",
"0.63861203",
"0.6354094",
"0.63097787",
"0.6295682",
"0.6292853",
"0.62740356",
"0.62539893",
"0.6253857",
"0.62427735",
"0.6209622",
"0.61980885",
"0.6192984",
"0.6173092",
"0.6159854",
"0.6146454",
"0.6125125",
"0.61034954",
"0.6100306",
"0.6074233",
"0.60720646",
"0.60698014"
]
| 0.7273711 | 0 |
Returns the optimal number of child processes. | protected function getOptimalNumberOfChildProcesses(): int
{
$coreNumber = 1;
$detectCommand = [
'linux' => 'cat /proc/cpuinfo | grep processor | wc -l',
];
$os = strtolower(trim(PHP_OS));
if (isset($detectCommand[$os])) {
$coreNumber = intval($this->execute($detectCommand[$os]));
}
return $coreNumber;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getMaxProcesses(): int\n {\n return $this->maxProcesses;\n }",
"public function getMaxJobsPerProcess(): int\n {\n return $this->maxJobsPerProcess;\n }",
"public function getMaxNbChilds()\n {\n return $this->getOption('max', 0);\n }",
"public function getMaxProcesses()\n {\n return $this->maxProcesses;\n }",
"public static function getNumberOfWorkers();",
"public function numberProcesses()\n {\n $proc_count = 0;\n $dh = opendir('/proc');\n while ($dir = readdir($dh)) {\n if (is_dir('/proc/' . $dir)) {\n if (preg_match('/^[0-9]+$/', $dir)) {\n $proc_count ++;\n }\n }\n }\n return $proc_count;\n }",
"public function getMinNbChilds()\n {\n return $this->getOption('min', 0);\n }",
"public function getMinProcesses(): int\n {\n return $this->minProcesses;\n }",
"public function getPoolSize()\n\t{\n\t\tif ($this->poolDir !== null)\n\t\t{\n\t\t\t$size=exec(\"cd \".$this->getPoolDir().\"; du | tail -n1\");\n\t\t\t$size/=1024;\n\t\t\treturn(sprintf(\"%.2f\",$size));\n\t\t}\n\t\telse\n\t\t\treturn(0);\n\t}",
"public function getMaxChildCountAttribute() : int\n {\n $counts = $this->allChild->pluck('max_child_count')->toArray();\n\n return count($counts) ? max($counts) + 1 : 0;\n }",
"public function getWorkerCount(): int;",
"public function getMaxChildrenPerFamily()\n {\n return $this->maxChildrenPerFamily;\n }",
"function numChildren($options = null) {\n\n#\t\tif (!isset($this->numChildren)) {\n\t\t\t$children = $this->children($options);\n\t\t\treturn sizeof($children);\n#\t\t\t$this->numChildren = sizeof($children);\n#\t\t}\n\n#\t\treturn $this->numChildren;\n\n\t}",
"#[Pure] public function get_children_number(): int\n {\n return $this -> children -> size();\n }",
"public function count(): int\n {\n return count($this->pool);\n }",
"public function maxIterations() {\n\t\treturn 1;\n\t}",
"public function getNumberChildren();",
"public function count(): int\n {\n return \\count($this->children);\n }",
"public function getNumberOfChildValveGroups()\n {\n return count($this->getChildValveGroups());\n }",
"public function getMaxNodeCount()\n {\n return $this->max_node_count;\n }",
"public function getIdleWorkerCount(): int;",
"public function numJobs()\n {\n $jobs = $this->jobs()->get();\n return(count($jobs));\n }",
"function cpu_count(): int\n{\n if (isWindows()) {\n return 1;\n }\n $count = 4;\n if (\\is_callable('shell_exec')) {\n if (\\strtolower(PHP_OS) === 'darwin') {\n $count = (int)\\shell_exec('sysctl -n machdep.cpu.core_count');\n } else {\n $count = (int)\\shell_exec('nproc');\n }\n }\n return $count > 0 ? $count : 4;\n}",
"public static function getNbCeremonie() : int {\n if (!isset(self::$_pdos_count)) {\n self::initPDOS_count();\n }\n self::$_pdos_count->execute();\n $resu = self::$_pdos_count->fetch();\n return $resu[0];\n }",
"public function getNumberOfConcurrency()\n {\n return $this->_numberOfConcurrency;\n }",
"public function size() : int\n {\n return $this->m * $this->n;\n }",
"public function getProcessedCount();",
"public function workerPids()\n\t{\n\t\t$pids = array();\n\t\tif (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {\n\t\t\texec('WMIC path win32_process get Processid,Commandline | findstr resque | findstr /V findstr', $cmdOutput);\n\t\t\tforeach ($cmdOutput as $line) {\n\t\t\t\t$line = preg_replace('/\\s+/m', ' ', $line);\n\t\t\t\tlist(,,$pids[]) = explode(' ', trim($line), 3);\n\t\t\t}\n\t\t} else {\n\t\t\texec('ps -A -o pid,args | grep [r]esque', $cmdOutput);\n\t\t\tforeach ($cmdOutput as $line) {\n\t\t\t\tlist($pids[],) = explode(' ', trim($line), 2);\n\t\t\t}\n\t\t}\n\t\treturn $pids;\n\t}",
"public function count() {\n\t\treturn count($this->children);\n\t}",
"public function getMaxInstanceRequestConcurrency()\n {\n return $this->max_instance_request_concurrency;\n }"
]
| [
"0.7293823",
"0.69329536",
"0.6896544",
"0.6786933",
"0.6650818",
"0.6600502",
"0.6574527",
"0.6500967",
"0.6379451",
"0.60853136",
"0.60155857",
"0.590684",
"0.5865589",
"0.57816553",
"0.57060087",
"0.56690073",
"0.56658745",
"0.5656545",
"0.5640194",
"0.5619115",
"0.56021917",
"0.55690587",
"0.54877317",
"0.5474988",
"0.546027",
"0.54488593",
"0.5426037",
"0.54127294",
"0.5406066",
"0.53607345"
]
| 0.84256446 | 0 |
Create an array with two lists listing what member a space uses. The first array element contains a list sorted to the spaces and the second is sorted to the members. | public static function get()
{
$sorted_to_space = array();
$sorted_to_member = array();
// create a list of what members a certain space supports
foreach (glob( CACHEDIR ."status/*.json") as $filename)
{
$json = json_decode(file_get_contents($filename), true);
$members = array();
self::space_filter_keys($json, $members);
$sorted_to_space[$json["space"]] = $members;
}
// Create a list of what space uses a certain member.
// Each element is an array containing spaces.
foreach ($sorted_to_space as $space => $members)
{
foreach($members as $member)
{
if(!isset($sorted_to_member[$member]))
$val = array();
else
$val = $sorted_to_member[$member];
array_push($val, $space);
$sorted_to_member[$member] = $val;
}
}
/*
foreach($sorted_to_space as $space => $keys)
$sorted_to_member = array_merge($sorted_to_member, $keys);
$sorted_to_member = array_unique($sorted_to_member);
sort($sorted_to_member);
*/
return array($sorted_to_space, $sorted_to_member);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function getAvaibleSpaces(){\n\t\t$spaces = array();\n\t\tfor ($i = 0;$i < count($this->gato[0]);++$i) {\n\t\t\tfor ($j = 0;$j < count($this->gato[0]);++$j) {\n\t\t\t\tif(strcmp($this->gato[$i][$j],'') == 0){\n\t\t\t\t\t//error_log(\"Free: \".$i.\",\".$j);\n\t\t\t\t\tarray_push($spaces, array($i,$j));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $spaces;\n\t}",
"public function compactList(){\n $output = array();\n $members = $this->members;\n foreach ($members as $value) {\n $member = array(\n 'id' => $value['id'],\n 'name' => $value['firstName'] . \" \" . $value['lastName'],\n 'num_boats' => count($value['boats'])\n );\n array_push($output, $member);\n }\n return $output;\n }",
"public function toArray()\n {\n return [0 => 'Top Left',\n 1 => 'Top Right',\n 2 => 'Bottom Left',\n 3 => 'Bottom Right'];\n }",
"function splitArray($word) {\r\n\tglobal $word,$upper,$lower;\r\n foreach($word as $key=>$value) {\r\n if(ctype_upper($key)) {\r\n $upper=array_merge($upper, array($key => $value));\r\n } else {\r\n $lower= array_merge($lower,array($key => $value));\r\n }\r\n \r\n }\r\n\r\n}",
"private function createArray()\n {\n $this->makeGroupBy()->makeSearch()->normalize();\n }",
"function sort_members($a, $b){\n\t\t\t\t\t\t\t\t return (strtolower($a->organization) < strtolower($b->organization)) ? -1 : 1;\n\t\t\t\t\t\t\t\t}",
"function sortCrossings() {\n $sortedtransits = array();\n for( $aspect = 0; $aspect < count($this->m_crossing); $aspect++ ) {\n $sortedtransits[substr($this->m_crossing[$aspect],17,11)] = $this->m_crossing[$aspect];\n }\n krsort($sortedtransits);\n //print_r($sortedtransits);\n\n unset($this->m_crossing);\n $this->m_crossing = array();\n for( $aspect = 0; $aspect < count($sortedtransits); $aspect++ ) {\n array_push(\n $this->m_crossing,\n array_pop( $sortedtransits )\n );\n }\n //print_r($this->m_crossing);\n }",
"public function toArray()\n {\n if (count($this->sorts) === 1) {\n $order = reset($this->sorts);\n $field = key($this->sorts);\n\n return [$this->prefix . '-' . SCT::toHyphen($field) => $order];\n }\n\n $sorts = [];\n $i = 1;\n\n foreach (array_slice($this->sorts, 0, 2) as $field => $order) {\n $sorts[$this->prefix . $i . '-' . SCT::toHyphen($field)] = $order;\n ++$i;\n }\n return $sorts;\n }",
"private function initialize_another_structure() {\n return array(\n array('#', '#', '#', '#', '#', '#', '#', '#'),\n array('#', '.', '.', '.', '.', '.', '.', '#'),\n array('#', '.', '#', '#', '#', '.', '.', '#'),\n array('#', '.', '.', '.', '#', '.', '#', '#'),\n array('#', '.', '#', '.', '.', '.', '.', '#'),\n array('#', '.', '.', '.', '.', '.', '.', '#'),\n array('#', '.', '#', '.', '#', '#', '.', '#'),\n array('#', 'X', '#', '.', '.', '.', '.', '#'),\n array('#', '#', '#', '#', '#', '#', '#', '#'),\n );\n }",
"public function verboseList(){\n $output = array();\n foreach ($this->members as $value) {\n }\n foreach ($this->members as $value) {\n $member = array(\n 'id' => $value['id'],\n 'firstName' => $value['firstName'],\n 'lastName' => $value['lastName'],\n 'birthNumber' => $value['birthNumber'],\n 'name' => $value['firstName'] . \" \" . $value['lastName'],\n 'boats' => $value['boats']\n );\n array_push($output, $member);\n }\n return $output;\n }",
"public function getHeaderSpace($args)\r\n {\r\n $space = array();\r\n foreach ($args as $value) {\r\n $item = $this->getOption($value, '');\r\n if ($item == \"\") {\r\n $item = 0;\r\n }\r\n array_push($space, $item);\r\n }\r\n\r\n return $space;\r\n }",
"function getArray($word) {\r\n $hangman = str_split($word);\r\n for( $i = 0; $i < strlen($word); $i++){\r\n $hangman[$i] = array($hangman[$i], false);\r\n }\r\n return $hangman;\r\n}",
"function splitonspace($data)\n{\n\t$u_data=preg_split(\"/ +/\",$data);\n\t$lname=array_pop($u_data);\n\n\t$fn=\"\";\n\tforeach ($u_data as $n => $v)\n\t{\n\t\t$fn=$v.\" \";\n\t}\n\n\t$dout=array(0=>$fn,1=>$lname);\n\treturn $dout;\n}",
"function uListSort($users) {\r\n\tif (!is_array($users)) $users = explode(\" \",$users);\r\n\t$owners = array();\r\n\t$owners_other = array(); // For '!' founders.\r\n\t$admins = array();\r\n\t$ops = array();\r\n\t$hops = array();\r\n\t$voices = array();\r\n\t$none = array();\r\n\t$x = 0;\r\n\twhile ($x != count($users)) {\r\n\t\t$n = $users[$x];\r\n\t\tif ($n[0] == \"~\") {\r\n\t\t\t// Owner.\r\n\t\t\t$owners[] = $n;\r\n\t\t}\r\n\t\telse if ($n[0] == \"!\") {\r\n\t\t\t// Owner v2\r\n\t\t\t$owners_other[] = $n;\r\n\t\t}\r\n\t\telse if ($n[0] == \"&\") {\r\n\t\t\t// Admin\r\n\t\t\t$admins[] = $n;\r\n\t\t}\r\n\t\telse if ($n[0] == \"@\") {\r\n\t\t\t// Op\r\n\t\t\t$ops[] = $n;\r\n\t\t}\r\n\t\telse if ($n[0] == \"%\") {\r\n\t\t\t// Halfop\r\n\t\t\t$hops[] = $n;\r\n\t\t}\r\n\t\telse if ($n[0] == \"+\") {\r\n\t\t\t// Voice\r\n\t\t\t$voices[] = $n;\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// None.\r\n\t\t\t$none[] = $n;\r\n\t\t}\r\n\t\t$x++;\r\n\t}\r\n\tnatcasesort($owners);\r\n\tnatcasesort($owners_other);\r\n\tnatcasesort($admins);\r\n\tnatcasesort($ops);\r\n\tnatcasesort($hops);\r\n\tnatcasesort($voices);\r\n\tnatcasesort($none);\r\n\t$ulist = array_merge($owners,$owners_other,$admins,$ops,$hops,$voices,$none);\r\n\t$ulist = array_values($ulist);\r\n\treturn $ulist;\r\n}",
"private function getGood(): array\n {\n return [\n CampType::FIELD_CAMP_TYPE => ucwords(TextSafe::shuffle(5) . ' ' . TextSafe::shuffle(5)),\n ];\n }",
"public static function groups() {\n\t\t$groups = array();\n\n\t\tforeach (Profiler::$_marks as $token => $mark) {\n\t\t\t// Sort the tokens by the group and name\n\t\t\t$groups[$mark['group']][$mark['name']][] = $token;\n\t\t}\n\n\t\treturn $groups;\n\t}",
"function __construct($girl, $boy)\n {\n $i = 0;\n while ($i < $girl) {\n $this->array[$i]['name'] = 'G'.$i;\n $this->array[$i]['gender'] = 'F';\n $i++;\n }\n\n while ($i-$girl < $boy) {\n $this->array[$i]['name'] = 'B'.($i-$girl);\n $this->array[$i]['gender'] = 'M';\n $i++;\n }\n\n //Sorting put all the boys at starting and girls at last\n usort($this->array, function ($a, $b) {\n return $a['gender'] < $b['gender'];\n });\n\n $i = 0;\n $j = count($this->array)-1;\n $k = 0; //count of resultant array\n while ($i <= $j) {\n if ($this->array[$i]['Gender'] === 'F' and $i !== $j) {\n echo \"girls are very much required arrangement can be possible\";\n break;\n }\n $this->result[$k] = $this->array[$j]['name'];\n $k++;\n $j--;\n if ($j < $i) {\n break;\n }\n $this->result[$k] = $this->array[$i]['name'];\n $k++;\n $i++;\n\n }\n\n if ($i > $j) {\n print_r($this->result);\n }\n }",
"private function sortMRA($part){\n if($part[2]){$retarr=array($part[1],$part[2],$part[0]);}\n if(!$part[2]){\n if($part[1]){$retarr=array($part[1],$part[0],$part[2]);}\n else{$retarr=array($part[0],$part[1],$part[2]);}\n } return $retarr;\n }",
"function split_cast_array(&$actor, $key)\n{\n $ary = explode('::', $actor);\n \n $actor = array(); \n $actor['name'] = $ary[0];\n $actor['id'] = $ary[2];\n $actor['roles'] = preg_split('[^</]', $ary[1]);\n}",
"function lists($p){\n return C(manys($p), Value(\"\"));\n }",
"function build_hostgroup_details($group_members) //make this return the totals array for hosts and services \n{\n\tglobal $NagiosData;\n\tglobal $NagiosUser; \n\t\n\t$hosts = $NagiosData->getProperty('hosts');\n\t\n//\t//add filter for user-level filtering \n//\tif(!$NagiosUser->is_admin()) {\n\t\t//print $type; \n//\t\t$hosts = user_filtering($hosts,'hosts'); \t\n//\t}\n\n\t$hostgroup_details = array();\n\tforeach($group_members as $member)\n\t{\n\t\tif($NagiosUser->is_authorized_for_host($member)) //user-level filtering \n\t\t\t$hostgroup_details[] = $hosts[$member];\n\t}\n\n\treturn $hostgroup_details;\n}",
"function _usort_by_first_member($a, $b)\n {\n }",
"function build_group_array($objectarray, $type)\n{\n\t$membersArray = array(); \n\t$index = $type.'group_name';\n\n\tforeach ($objectarray as $object)\n\t{\n\t\t$group = $object[$index];\n\t\tif (isset($object['members']))\n\t\t{\n\t\t\t$members = $object['members'];\n\t\t\t$lineitems = explode(',', trim($members));\n\t\t\t\n\t\t\t//array_walk($lineitems, create_function('$v', '$v = trim($v);')); //XXX BAD to use create_function \n\t\t\tarray_walk($lineitems, 'trim'); \n\t\t\t\n\t\t\t$group_members = NULL;\n\t\t\tif ($type == 'host' || $type == 'contact')\n\t\t\t{\n\t\t\t\t$group_members = $lineitems;\n\t\t\t}\n\t\t\telseif ($type == 'service')\n\t\t\t{\n\t\t\t\tfor ($i = 0; $i < count($lineitems); $i+=2)\n\t\t\t\t{\n\t\t\t\t\t$host = $lineitems[$i];\n\t\t\t\t\t$service = $lineitems[$i+1];\n\t\t\t\t\t$group_members[$host][] = $service; \n\t\t\t\t\t/* (\n\t\t\t\t\t\t'host_name' => $host,\n\t\t\t\t\t\t'service_description' => $service); */\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$membersArray[$group] = $group_members;\n\t\t}\n\t}\n\n\treturn $membersArray;\n}",
"function pagedVarieties( $pSp )\n {\n // m = number of items per group\n // g = number of groups\n\n $ra = array();\n\n $mThresh = 30; // preferred max number of items per group\n\n $n = $this->kfdb->Query1( \"SELECT count(*) FROM sl_pcv WHERE psp='$pSp'\" );\n\n $g = $n / $mThresh;\n if( $g < 1 ) $g = 1;\n if( $g > 26 ) $g = 26;\n $m = intval($n / $g);\n\n // So now we're dividing the list into $g groups of $m items.\n // Name each group by the letter that corresponds to its first item.\n $raTmp = array();\n for( $i = 0; $i < $g; ++$i ) { // offset is origin-0\n $cv = $this->kfdb->Query1( \"SELECT name FROM sl_pcv WHERE _status=0 AND psp='$pSp' ORDER BY 1 LIMIT \".($i*$m).\", 1\" );\n $raTmp[$i] = strtoupper( substr($cv,0,1) );\n }\n for( $i = 0; $i < $g; ++$i ) { // offset is origin-0\n if( $i < $g-1 ) {\n $ra[] = array( $i*$m, $m, $raTmp[$i], $raTmp[$i+1] );\n } else {\n $ra[] = array( $i*$m, $m, $raTmp[$i], 'Z' );\n }\n }\n\n return( $ra );\n }",
"function fillMembers() \n\t{\n\t\t//\tselect members list\t\t\n\t\t$trs = db_query(\"select , from `ugmembers` order by ,\",$this->conn);\n\t\twhile($tdata = db_fetch_numarray($trs))\n\t\t{\n\t\t\t$this->members[] = array($tdata[1],$tdata[0]);\n\t\t}\n\t}",
"public function getMemberList()\n {\n $memberList = '';\n foreach($this->Residents as $resident) {\n $memberList .= (string)$resident->get('Rooms') . ', ';\n //$memberList .= (string)$resident . ', ';\n }\n $memberList = substr($memberList, 0,-2);\n\n return $memberList;\n }",
"function getSortedItemsArray()\n\t{\n\t\t$med_items = $this->getItemsArray();\n\n\t\t// sort by order setting\n\t\tswitch($this->getOrder())\n\t\t{\n\t\t\tcase ilObjMediaCast::ORDER_TITLE:\n\t\t\t\t$med_items = ilUtil::sortArray($med_items, \"title\", \"asc\", false, true);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase ilObjMediaCast::ORDER_CREATION_DATE_ASC:\n\t\t\t\t$med_items = ilUtil::sortArray($med_items, \"creation_date\", \"asc\", false, true);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase ilObjMediaCast::ORDER_CREATION_DATE_DESC:\n\t\t\t\t$med_items = ilUtil::sortArray($med_items, \"creation_date\", \"desc\", false, true);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase ilObjMediaCast::ORDER_MANUAL:\n\t\t\t\t$order = array_flip($this->readOrder());\t\t\n\t\t\t\t$pos = sizeof($order);\n\t\t\t\tforeach(array_keys($med_items) as $idx)\n\t\t\t\t{\n\t\t\t\t\tif(array_key_exists($idx, $order))\n\t\t\t\t\t{\n\t\t\t\t\t\t$med_items[$idx][\"order\"] = ($order[$idx]+1)*10;\n\t\t\t\t\t}\n\t\t\t\t\t// item has no order yet\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$med_items[$idx][\"order\"] = (++$pos)*10;\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t\t\n\t\t\t\t$med_items = ilUtil::sortArray($med_items, \"order\", \"asc\", true, true);\n\t\t\t\tbreak;\t\t\t\n\t\t}\n\n\t\treturn $med_items;\n\t}",
"public function sort();",
"public function getSorting();",
"private function cardsMatrix(): array {\n\t\t\t\n\t\t\treturn ['big', 'horizontal', 'vertical', 'standard', 'standard', 'standard'];\n\t\t}"
]
| [
"0.5553113",
"0.5429868",
"0.5066935",
"0.5058148",
"0.5022067",
"0.49639058",
"0.4934307",
"0.49156615",
"0.48820686",
"0.4871873",
"0.48670793",
"0.48572224",
"0.4834188",
"0.48165998",
"0.48019856",
"0.47874624",
"0.47848696",
"0.477846",
"0.4768873",
"0.47682992",
"0.4740555",
"0.4711739",
"0.4708414",
"0.470413",
"0.46923733",
"0.468157",
"0.46703142",
"0.46554267",
"0.46229896",
"0.46209818"
]
| 0.59565073 | 0 |
Updates the cached json file with the filter keys. | public static function update()
{
$json = json_encode(self::get());
$json = Utils::json_pretty_print($json);
file_put_contents(CACHEDIR . "filter-keys/filter_keys.json", $json);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function updateCache();",
"public function rebuildCache()\r\n {\r\n $themes = $this->scanJsonFiles();\r\n // file_put_contents($this->cachePath, json_encode($themes, JSON_PRETTY_PRINT));\r\n\r\n $stub = file_get_contents(__DIR__ . '/stubs/cache.stub');\r\n $contents = str_replace('[CACHE]', var_export($themes, true), $stub);\r\n file_put_contents($this->cachePath, $contents);\r\n }",
"public function updateJson() {\r\n\t\t$this->prepareDb();\r\n\t\tif (!$this->getFileContent()) {\r\n\t\t\t$this->log(\"empty db\", 0);\r\n\t\t\treturn (false);\r\n\t\t}\r\n\t\t$this->_jsonFc = json_decode($this->_jsonFc, true);\r\n\t\tif (is_array($this->_jsonFc)) {\r\n\t\t\t$found = false;\r\n\t\t\tforeach ($this->_jsonFc as $key => $fc) {\r\n\t\t\t\tif (isset($fc[\"id\"]) && $fc[\"id\"] == $this->_jsonId) {\r\n\t\t\t\t\t$this->_jsonFc[$key][\"json\"] = $this->expJson();\r\n\t\t\t\t\t$found = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif ($found) {\r\n\t\t\t\tfile_put_contents($this->_path_db, json_encode($this->_jsonFc, JSON_PRETTY_PRINT));\r\n\t\t\t} else {\r\n\t\t\t\t$this->log(\"id not found in db\", 0);\r\n\t\t\t}\r\n\t\t}\r\n\t\t$this->clearDump();\r\n\t}",
"function update_cache($cache_url, $cache_data){\n\t\t$fh = fopen($cache_url, 'w')or die(\"Error opening output file\");\n\t\tfwrite($fh, json_encode($cache_data,JSON_UNESCAPED_UNICODE));\n\t\tfclose($fh);\n\t}",
"public function save()\n {\n $this->readCache();\n\n file_put_contents($this->filePath, json_encode($this->cacheContents));\n }",
"function updateCache() {\r\n return $this->_fHandler->updateCache();\r\n }",
"public function cacheAll()\n {\n $data = $this->resource->get()->wait();\n\n $this->client->pipeline(function ($pipe) use ($data) {\n foreach ( $data->result->result as $k => $v ) {\n $pipe->set($this->keyPrefix . $v->id, serialize($v));\n }\n });\n\n return;\n }",
"protected function prescan_keys() {\n $files = glob($this->glob_keys_pattern(), GLOB_MARK | GLOB_NOSORT);\n if (is_array($files)) {\n foreach ($files as $filename) {\n $this->keys[basename($filename)] = filemtime($filename);\n }\n }\n }",
"public function processJsonFiles(){\n $filesList = $this->getFileList();\n foreach ($filesList as $key => $file) {\n //do this at your will\n if( !preg_match('/.json/', $file['Key'] ) ){\n continue;\n }\n $fileContents = $this->getFile($file['Key']);\n $fileProcessed = $this->processFile($fileContents);\n $this->saveFile($file['Key'], $fileProcessed);\n }\n }",
"static function cacheWrite($name,$rows) {\n if (Caching::$compressJson) \n file_put_contents(Caching::getCachePath() . \"$name.json\",gzcompress(json_encode($rows)));\n else \n file_put_contents(Caching::getCachePath() . \"$name.json\",json_encode($rows));\n }",
"private function set_cached_file($file, $json)\n {\n $cache_file = dirname(__FILE__) . '/cache/' . $file;\n\n if ($json && is_writable(dirname($cache_file))) {\n $cache_static = fopen($cache_file, 'w');\n fwrite($cache_static, $json);\n fclose($cache_static);\n }\n }",
"public function cache() {\r\n\t\t$this->resource->cache();\r\n\t}",
"private function cacheJson()\n {\n if ($this->checkCache()) {//if true cache file\n\n $data = $this->getOauth();\n\n if ($data != '500') {\n if (is_array($data)) {\n $json_1 = json_decode($data[0], true);\n $json_2 = json_decode($data[1], true);\n $my_data = array_merge($json_1, $json_2);\n usort($my_data, array($this, 'dateSort'));\n $data = json_encode($my_data);\n }\n file_put_contents($this->cacheFile, $data);\n }\n }\n return file_get_contents($this->cacheFile);\n }",
"public function reCacheCustomFields() : void\n {\n foreach ($this->getAll() as $key => $value) {\n $this->setInRedis($key, $value);\n }\n }",
"function apc_cache_api_filter($api_actions) {\n\t$api_actions['flushcache'] = 'apc_cache_force_flush';\n\treturn $api_actions;\n}",
"protected static function loadFiltersData()\n {\n self::$filtersData = (array) $GLOBALS['TSFE']->fe_user->getKey('ses', 'filters');\n }",
"function update_category_cache()\n {\n }",
"function updateConfigCache() {\n\t$config_path = 'config';\n\t$cache_path = 'cache';\n\t\n\t$cache_file_name = 'config.php';\n\t\n\t$config_files = scandir($config_path);\n\t\n\t$output = [];\n\t\n\tforeach($config_files as $config_file) {\n\t\tif($config_file == '.' or $config_file == '..') {\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tif(is_file($config_path.'/'.$config_file)) {\t\n\t\t\t$config_file_name = explode('.', $config_file);\n\t\t\tif($config_file_name[count($config_file_name)-1] == 'json') {\n\t\t\t\t$config_file_namepart = '';\n\t\t\t\tforeach($config_file_name as $id => $namepart) {\n\t\t\t\t\tif($id != count($config_file_name)-1) {\n\t\t\t\t\t\tif($config_file_namepart != '') {\n\t\t\t\t\t\t\t$config_file_namepart .= '.'.$namepart;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t$config_file_namepart = $namepart;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$config_file_name = $config_file_namepart;\n\t\t\t\t\n\t\t\t\t$output[$config_file_name] = getConfig($config_file);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfile_put_contents($cache_path.'/'.$cache_file_name, sprintf('<?php return %s; ?>', var_export($output, true)));\n}",
"public function flushCache();",
"protected function saveToCache() {}",
"function generate_json_file() {\n // Open new file to write\n $json_file = new SplFileObject(\"../CCNiceAudioFiles.json\", \"w\");\n $json_file->fwrite(\"[\\n\");\n\n // Retrieve all non new entries from the database\n $result = $this->get_list_of_published_files();\n\n // For each file generate json entry to be used for presentation\n foreach( $result as $i ){\n\n unset($i['newfile']);\n unset($i['flaggedfile']);\n unset($i['flagcomment']);\n unset($i['md5_sign']);\n unset($i['publishedfile']);\n unset($i['translated']);\n unset($i['downloads']);\n unset($i['filepath']);\n\n $readable_size = $this->convert_file_size($i['size']);\n $i['size'] = $readable_size;\n\n $json_file->fwrite(json_encode($i) . \",\\n\");\n }\n\n $json_file->fseek(-2, SEEK_CUR);\n\n $json_file->fwrite(\"\\n]\");\n $json_file = null;\n\n return;\n }",
"private function flush(): void {\n file_put_contents(APP_ROOT . '/public/config/lang/dictionary.json',\n json_encode([\\Config::Dictionary => $this->dictionary]));\n }",
"public function saveToCacheForever();",
"abstract protected function cacheData();",
"private function flushFileCachedValues() {\n\n foreach ( $this->getSheetNames( true ) as $sheet ) {\n\n $this->setActiveSheet( $sheet, 'name' );\n $this->activeSheet->updateCalculations();\n $this->saveActiveSheetChanges();\n }\n\n }",
"public function twig_filter_fcache()\n\t{\n\t\treturn new \\Twig_SimpleFilter('fcache', function ($string)\n\t\t{\n\t\t\tif(file_exists($string))\n\t\t\t{\n\t\t\t\treturn $string.'?'.filemtime($string);\n\t\t\t}\n\t\t});\n\t}",
"private function readCache(): void{\n //stdClass é uma classe predefinido ou dinamica\n $this->cache = new stdClass();\n if(file_exists('cache.cache')){\n $this->cache = json_decode(file_get_contents('cache.cache'));\n }\n }",
"private static function _createCacheFile() {\r\n $paths = array();\r\n $paths['apps'] = File::getDirectoriesNames(ZEEYE_APPS_PATH);\r\n $paths['libs'] = File::getDirectoriesNames(ZEEYE_LIBS_PATH);\r\n File::write(ZEEYE_TMP_PATH . self::CACHE_FILE_PATH, '<?php ' . PHP_EOL . '$paths = ' . var_export($paths, true) . ';');\r\n self::$_hasCacheFile = true;\r\n }",
"public function cache() {\n if(!array_key_exists($this->steamId64, self::$steamIds)) {\n self::$steamIds[$this->steamId64] = $this;\n if(!empty($this->customUrl) &&\n !array_key_exists($this->customUrl, self::$steamIds)) {\n self::$steamIds[$this->customUrl] = $this;\n }\n }\n }",
"function update_all_keys($keys,$file){\n\t\t$this->delete_all_keys($file);\n\t\treturn $this->add_keys($keys,$file);\n\t}"
]
| [
"0.62747115",
"0.60221344",
"0.5651018",
"0.56190133",
"0.5565604",
"0.55066466",
"0.5442118",
"0.54121685",
"0.5400739",
"0.53041005",
"0.5294664",
"0.5185658",
"0.5176127",
"0.51697767",
"0.5165227",
"0.5159248",
"0.51579416",
"0.5132494",
"0.51185185",
"0.51001906",
"0.50796604",
"0.5062848",
"0.5052182",
"0.5045357",
"0.5032537",
"0.50259376",
"0.5022242",
"0.50132537",
"0.49693757",
"0.49639264"
]
| 0.87589294 | 0 |
Pass in event time data, and if it has weeklyDays set as an array, this'll create it. | public static function createWithWeeklyRepeatSettings( $data ){
// Does the EventTime have weekly day settings? Handle them
if( is_array($data->weeklyDays) && !empty($data->weeklyDays) ){
$eventTimeObj = self::create($data);
foreach($data->weeklyDays AS $weekdayValue){
self::adhocQuery(function(\PDO $connection) use ($eventTimeObj, $weekdayValue){
$statement = $connection->prepare("INSERT INTO SchedulizerEventTimeWeekdays (eventTimeID, repeatWeeklyDay) VALUES (:eventTimeID,:repeatWeeklyDay)");
$statement->bindValue(':eventTimeID', $eventTimeObj->getID());
$statement->bindValue(':repeatWeeklyDay', (int)$weekdayValue);
return $statement;
});
}
return $eventTimeObj;
}
// No weekly repeat settings, just create and return as normal
return self::create($data);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getWeeklyEventData($date) {\n //Check date format\n $format = \"m/d/Y\";\n $eventDate = date_create_from_format($format, $date);\n if(!$eventDate) {\n // createFromFormat returns false if the format is invalid or date is invalid\n echo \"Please enter a valid date in mm/dd/yyyy format. Cannot proceed due to invalid date error\";\n } else {\n $data;\n $data['nextDay']=\"View Next Week >>\";\n $data['hbdate'] = \"{ts '\".date_format($eventDate,\"Y-m-d\").\" 02:37:51'}\";\n return parent::convertByPOST(self::$weekEventUrl,$data,2);\n }\n }",
"function add_event_to_array($dates, $page_data, &$datePaths) {\n foreach ($page_data['dates'] as $date) {\n $start_date = (int)($date['start-date']) / 1000;\n $end_date = (int)($date['end-date']) / 1000;\n $specific_start = date(\"Y-m-d\", $start_date );\n $specific_end = date(\"Y-m-d\", $end_date );\n\n $page_data['time_string'] = $date['time-string'];\n $page_data['specific_start'] = $date['start-date'];\n $page_data['specific_end'] = $date['end-date'];\n $page_data['specific_all_day'] = $date['all-day'];\n $page_data['specific_need_time_zone'] = $date['outside-of-minnesota'];\n if($page_data['specific_need_time_zone'] == true) {\n $time_zone = $date['time-zone'];\n if ($time_zone == \"Hawaii-Aleutian Time\") {\n $page_data['specific_time_zone'] = \"HT\";\n } elseif ($time_zone == \"Alaska Time\") {\n $page_data['specific_time_zone'] = \"AT\";\n } elseif ($time_zone == \"Pacific Time\") {\n $page_data['specific_time_zone'] = \"PT\";\n } elseif ($time_zone == \"Mountain Time\") {\n $page_data['specific_time_zone'] = \"MT\";\n } elseif ($time_zone == \"Eastern Time\") {\n $page_data['specific_time_zone'] = \"ET\";\n } else {\n $page_data['specific_time_zone'] = \"CT\";\n }\n } else {\n $page_data['specific_time_zone'] = \"\";\n }\n\n if($specific_start == $specific_end){\n //Don't need a date range.\n $key = date(\"Y-m-d\", $start_date);\n add_page_to_day($dates[$key], $page_data, $datePaths[$key]);\n }\n // range of dates\n else{\n $page_data['specific_all_day'] = true;\n $start = date(\"Y-n-j\", $start_date);\n // Add 1 day to $end so that the DatePeriod includes the last day in 'end-date'\n $end = date(\"Y-n-j\", strtotime('+1 day', $end_date));\n // Create a date period for each of the dates this event-date spans.\n // This will put it on the calendar each day.\n $period = new DatePeriod(\n new DateTime($start),\n new DateInterval('P1D'),\n new DateTime($end)\n );\n // Add a listng to the array for each event / event date\n $foreach_start_time = microtime(true);\n foreach ($period as $inner_date) {\n $key = $inner_date->format('Y-m-d');\n add_page_to_day($dates[$key], $page_data, $datePaths[$key]);\n }\n\n }\n\n }\n return $dates;\n}",
"public static function createEvent(array $data)\n {\n $event = new \\echolibre\\google_wave\\Model\\Event;\n \n $event->type = $data['type'];\n $event->timestamp = $data['timestamp'];\n $event->modifiedBy = $data['modifiedBy'];\n $event->properties = new \\stdClass();\n \n if (isset($data['properties'])) {\n $event->properties = $data['properties'];\n }\n \n return $event;\n }",
"private function saveRepeatWeekly(){\n if( isset($this->settings['weekday_index']) && !empty($this->settings['weekday_index']) ){\n foreach( $this->settings['weekday_index'] AS $dayIndex ){\n Loader::db()->Execute(\"INSERT INTO SchedulizerEventRepeat (eventID, repeatWeekday) VALUES (?,?)\", array(\n $this->eventObj->getEventID(), $dayIndex\n ));\n }\n }\n }",
"private function createinstallevent()\n {\n $cat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/PostCalendar/Events');\n\n $eventArray = array(\n 'title' => $this->__('PostCalendar Installed'),\n 'hometext' => ':text:' . $this->__('On this date, the PostCalendar module was installed. Thank you for trying PostCalendar! This event can be safely deleted if you wish.'),\n 'alldayevent' => true,\n 'eventstatus' => PostCalendar_Entity_CalendarEvent::APPROVED,\n 'sharing' => PostCalendar_Entity_CalendarEvent::SHARING_GLOBAL,\n 'website' => 'https://github.com/craigh/PostCalendar/wiki',\n 'categories' => array(\n 'Main' => $cat['id']));\n\n try {\n $event = new PostCalendar_Entity_CalendarEvent();\n $event->setFromArray($eventArray);\n $this->entityManager->persist($event);\n $this->entityManager->flush();\n } catch (Exception $e) {\n return LogUtil::registerError($e->getMessage());\n }\n\n return true;\n }",
"public function week()\n\t{\n\t\t// -------------------------------------\n\t\t// Load 'em up\n\t\t// -------------------------------------\n\n\t\t$this->load_calendar_datetime();\n\t\t$this->load_calendar_parameters();\n\n\t\t// -------------------------------------\n\t\t// Prep the parameters\n\t\t// -------------------------------------\n\n\t\t$disable = array(\n\t\t\t'categories',\n\t\t\t'category_fields',\n\t\t\t'custom_fields',\n\t\t\t'member_data',\n\t\t\t'pagination',\n\t\t\t'trackbacks'\n\t\t);\n\n\t\t$params = array(\n\t\t\tarray(\n\t\t\t\t'name' => 'category',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'string',\n\t\t\t\t'multi' => TRUE\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'site_id',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'integer',\n\t\t\t\t'min_value' => 1,\n\t\t\t\t'multi' => TRUE,\n\t\t\t\t'default' => $this->data->get_site_id()\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'calendar_id',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'string',\n\t\t\t\t'multi' => TRUE\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'calendar_name',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'string',\n\t\t\t\t'multi' => TRUE\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'event_id',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'string',\n\t\t\t\t'multi' => TRUE\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'event_name',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'string',\n\t\t\t\t'multi' => TRUE\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'event_limit',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'integer'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'status',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'string',\n\t\t\t\t'multi' => TRUE,\n\t\t\t\t'default' => 'open'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'date_range_start',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'date'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'time_range_start',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'time',\n\t\t\t\t'default' => '0000'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'time_range_end',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'time',\n\t\t\t\t'default' => '2400'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'enable',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'string',\n\t\t\t\t'default' => '',\n\t\t\t\t'multi' => TRUE,\n\t\t\t\t'allowed_values' => $disable\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name' => 'first_day_of_week',\n\t\t\t\t'required' => FALSE,\n\t\t\t\t'type' => 'integer',\n\t\t\t\t'default' => $this->first_day_of_week\n\t\t\t)\n\t\t);\n\n\t\t//ee()->TMPL->log_item('Calendar: Processing parameters');\n\n\t\t$this->add_parameters($params);\n\n\t\t// -------------------------------------\n\t\t// Need to modify the starting date?\n\t\t// -------------------------------------\n\n\t\t$this->first_day_of_week = $this->P->value('first_day_of_week');\n\n\t\tif ($this->P->value('date_range_start') === FALSE)\n\t\t{\n\t\t\t$this->P->set('date_range_start', $this->CDT->datetime_array());\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->CDT->change_date(\n\t\t\t\t$this->P->value('date_range_start', 'year'),\n\t\t\t\t$this->P->value('date_range_start', 'month'),\n\t\t\t\t$this->P->value('date_range_start', 'day')\n\t\t\t);\n\t\t}\n\n\t\t$drs_dow = $this->P->value('date_range_start', 'day_of_week');\n\n\t\tif ($drs_dow != $this->first_day_of_week)\n\t\t{\n\t\t\tif ($drs_dow > $this->first_day_of_week)\n\t\t\t{\n\t\t\t\t$offset = ($drs_dow - $this->first_day_of_week);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$offset = (7 - ($this->first_day_of_week - $drs_dow));\n\t\t\t}\n\n\t\t\t$this->P->set('date_range_start', $this->CDT->add_day(-$offset));\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// Define parameters specific to this calendar view\n\t\t// -------------------------------------\n\n\t\t$this->CDT->change_ymd($this->P->value('date_range_start', 'ymd'));\n\t\t$this->P->set('date_range_end', $this->CDT->add_day(6));\n\t\t$this->P->set('pad_short_weeks', FALSE);\n\n\t\t// -------------------------------------\n\t\t// Define our tagdata\n\t\t// -------------------------------------\n\n\t\t$find = array(\n\t\t\t'EVENTS_PLACEHOLDER',\n\t\t\t'{/',\n\t\t\t'{',\n\t\t\t'}'\n\t\t);\n\n\t\t$replace = array(\n\t\t\tee()->TMPL->tagdata,\n\t\t\tLD.T_SLASH,\n\t\t\tLD,\n\t\t\tRD\n\t\t);\n\n\t\tee()->TMPL->tagdata = str_replace(\n\t\t\t$find,\n\t\t\t$replace,\n\t\t\t$this->view(\n\t\t\t\t'week.html',\n\t\t\t\tarray(),\n\t\t\t\tTRUE,\n\t\t\t\t$this->sc->addon_theme_path . 'templates/week.html'\n\t\t\t)\n\t\t);\n\n\t\t// -------------------------------------\n\t\t// Tell TMPL what we're up to\n\t\t// -------------------------------------\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'events'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['events'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_hour'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_hour'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_day'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_day'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_week'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_week'] = TRUE;\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// If you build it, they will know what's going on.\n\t\t// -------------------------------------\n\n\t\t$this->parent_method = __FUNCTION__;\n\n\t\treturn $this->build_calendar();\n\t}",
"function my_add_weekly( $schedules ) {\n // add a 'weekly' schedule to the existing set\n $schedules['3_hours'] = array(\n 'interval' => 10800,\n 'display' => __('Every 3 Hours - (Flipkart API call)')\n );\n return $schedules;\n }",
"function attendance_construct_sessions_data_for_add($formdata, mod_attendance_structure $att) {\n global $CFG;\n\n $sesstarttime = $formdata->sestime['starthour'] * HOURSECS + $formdata->sestime['startminute'] * MINSECS;\n $sesendtime = $formdata->sestime['endhour'] * HOURSECS + $formdata->sestime['endminute'] * MINSECS;\n $sessiondate = $formdata->sessiondate + $sesstarttime;\n $duration = $sesendtime - $sesstarttime;\n if (empty(get_config('attendance', 'enablewarnings'))) {\n $absenteereport = get_config('attendance', 'absenteereport_default');\n } else {\n $absenteereport = empty($formdata->absenteereport) ? 0 : 1;\n }\n\n $now = time();\n\n if (empty(get_config('attendance', 'studentscanmark'))) {\n $formdata->studentscanmark = 0;\n }\n\n if (empty(get_config('attendance', 'allowupdatestatus'))) {\n $formdata->allowupdatestatus = 0;\n }\n\n $calendarevent = 0;\n if (isset($formdata->calendarevent)) { // Calendar event should be created.\n $calendarevent = 1;\n }\n\n $sessions = array();\n if (isset($formdata->addmultiply)) {\n $startdate = $sessiondate;\n $enddate = $formdata->sessionenddate + DAYSECS; // Because enddate in 0:0am.\n\n if ($enddate < $startdate) {\n return null;\n }\n\n // Getting first day of week.\n $sdate = $startdate;\n $dinfo = usergetdate($sdate);\n if ($CFG->calendar_startwday === '0') { // Week start from sunday.\n $startweek = $startdate - $dinfo['wday'] * DAYSECS; // Call new variable.\n } else {\n $wday = $dinfo['wday'] === 0 ? 7 : $dinfo['wday'];\n $startweek = $startdate - ($wday - 1) * DAYSECS;\n }\n\n $wdaydesc = array(0 => 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');\n\n while ($sdate < $enddate) {\n if ($sdate < strtotime('+1 week', $startweek)) {\n $dinfo = usergetdate($sdate);\n if (isset($formdata->sdays) && array_key_exists($wdaydesc[$dinfo['wday']], $formdata->sdays)) {\n $sess = new stdClass();\n $sess->sessdate = make_timestamp($dinfo['year'], $dinfo['mon'], $dinfo['mday'],\n $formdata->sestime['starthour'], $formdata->sestime['startminute']);\n $sess->duration = $duration;\n $sess->descriptionitemid = $formdata->sdescription['itemid'];\n $sess->description = $formdata->sdescription['text'];\n $sess->descriptionformat = $formdata->sdescription['format'];\n $sess->calendarevent = $calendarevent;\n $sess->timemodified = $now;\n $sess->absenteereport = $absenteereport;\n $sess->studentpassword = '';\n $sess->includeqrcode = 0;\n $sess->rotateqrcode = 0;\n $sess->rotateqrcodesecret = '';\n $sess->automark = !empty($formdata->automark) ? $formdata->automark : 0;\n $sess->automarkcmid = !empty($formdata->automarkcmid) ? $formdata->automarkcmid : 0;\n $sess->automarkcompleted = 0;\n\n if (!empty($formdata->usedefaultsubnet)) {\n $sess->subnet = $att->subnet;\n } else {\n $sess->subnet = $formdata->subnet;\n }\n if (!empty($formdata->preventsharedip)) {\n $sess->preventsharedip = $formdata->preventsharedip;\n }\n if (!empty($formdata->preventsharediptime)) {\n $sess->preventsharediptime = $formdata->preventsharediptime;\n }\n\n if (isset($formdata->studentscanmark)) { // Students will be able to mark their own attendance.\n $sess->studentscanmark = 1;\n if (isset($formdata->allowupdatestatus)) {\n $sess->allowupdatestatus = $formdata->allowupdatestatus;\n } else {\n $sess->allowupdatestatus = 0;\n }\n if (isset($formdata->autoassignstatus)) {\n $sess->autoassignstatus = 1;\n }\n if (isset($formdata->studentsearlyopentime)) {\n $sess->studentsearlyopentime = $formdata->studentsearlyopentime;\n }\n\n if (!empty($formdata->randompassword)) {\n $sess->studentpassword = attendance_random_string();\n } else if (!empty($formdata->studentpassword)) {\n $sess->studentpassword = $formdata->studentpassword;\n }\n if (!empty($formdata->includeqrcode)) {\n $sess->includeqrcode = $formdata->includeqrcode;\n }\n if (!empty($formdata->rotateqrcode)) {\n $sess->rotateqrcode = $formdata->rotateqrcode;\n $sess->studentpassword = attendance_random_string();\n $sess->rotateqrcodesecret = attendance_random_string();\n }\n if (!empty($formdata->preventsharedip)) {\n $sess->preventsharedip = $formdata->preventsharedip;\n }\n if (!empty($formdata->preventsharediptime)) {\n $sess->preventsharediptime = $formdata->preventsharediptime;\n }\n } else {\n $sess->subnet = '';\n $sess->automark = 0;\n $sess->automarkcompleted = 0;\n $sess->preventsharedip = 0;\n $sess->preventsharediptime = '';\n }\n $sess->statusset = $formdata->statusset;\n\n attendance_fill_groupid($formdata, $sessions, $sess);\n }\n\n $sdate = strtotime(\"+1 day\", $sdate); // Set start to tomorrow.\n } else {\n $startweek = strtotime(\"+\".$formdata->period.' weeks', $startweek);\n $sdate = $startweek;\n }\n }\n } else {\n $sess = new stdClass();\n $sess->sessdate = $sessiondate;\n $sess->duration = $duration;\n $sess->descriptionitemid = $formdata->sdescription['itemid'];\n $sess->description = $formdata->sdescription['text'];\n $sess->descriptionformat = $formdata->sdescription['format'];\n $sess->calendarevent = $calendarevent;\n $sess->timemodified = $now;\n $sess->studentscanmark = 0;\n $sess->allowupdatestatus = 0;\n $sess->autoassignstatus = 0;\n $sess->subnet = '';\n $sess->studentpassword = '';\n $sess->automark = 0;\n $sess->automarkcompleted = 0;\n\n if (!empty($formdata->automarkcmid)) {\n $sess->automarkcmid = $formdata->automarkcmid;\n } else {\n $sess->automarkcmid = 0;\n }\n\n $sess->absenteereport = $absenteereport;\n $sess->includeqrcode = 0;\n $sess->rotateqrcode = 0;\n $sess->rotateqrcodesecret = '';\n\n if (!empty($formdata->usedefaultsubnet)) {\n $sess->subnet = $att->subnet;\n } else {\n $sess->subnet = $formdata->subnet;\n }\n\n if (!empty($formdata->automark)) {\n $sess->automark = $formdata->automark;\n }\n if (!empty($formdata->automark)) {\n $sess->automark = $formdata->automark;\n }\n if (!empty($formdata->preventsharedip)) {\n $sess->preventsharedip = $formdata->preventsharedip;\n }\n if (!empty($formdata->preventsharediptime)) {\n $sess->preventsharediptime = $formdata->preventsharediptime;\n }\n\n if (isset($formdata->studentscanmark) && !empty($formdata->studentscanmark)) {\n // Students will be able to mark their own attendance.\n $sess->studentscanmark = 1;\n if (!empty($formdata->allowupdatestatus)) {\n $sess->allowupdatestatus = $formdata->allowupdatestatus;\n } else {\n $sess->allowupdatestatus = 0;\n }\n if (isset($formdata->autoassignstatus) && !empty($formdata->autoassignstatus)) {\n $sess->autoassignstatus = 1;\n }\n if (!empty($formdata->randompassword)) {\n $sess->studentpassword = attendance_random_string();\n } else if (!empty($formdata->studentpassword)) {\n $sess->studentpassword = $formdata->studentpassword;\n }\n if (!empty($formdata->includeqrcode)) {\n $sess->includeqrcode = $formdata->includeqrcode;\n }\n if (!empty($formdata->rotateqrcode)) {\n $sess->rotateqrcode = $formdata->rotateqrcode;\n $sess->studentpassword = attendance_random_string();\n $sess->rotateqrcodesecret = attendance_random_string();\n }\n if (!empty($formdata->usedefaultsubnet)) {\n $sess->subnet = $att->subnet;\n } else {\n $sess->subnet = $formdata->subnet;\n }\n\n if (!empty($formdata->automark)) {\n $sess->automark = $formdata->automark;\n }\n if (!empty($formdata->preventsharedip)) {\n $sess->preventsharedip = $formdata->preventsharedip;\n }\n if (!empty($formdata->studentsearlyopentime)) {\n $sess->studentsearlyopentime = $formdata->studentsearlyopentime;\n }\n }\n $sess->statusset = $formdata->statusset;\n\n attendance_fill_groupid($formdata, $sessions, $sess);\n }\n\n return $sessions;\n}",
"function _saveWeekdays($id, $event) {\n $records = array();\n foreach ($event['recur_weekly_weekdays'] as $weekday) {\n $records[] = array('event_id' => $id, 'recur_weekly_weekday' => $weekday);\n }\n\n return $this->databaseInsertRecords($this->tableRecurrenceWeekdays, $records);\n }",
"public function createCalendarOfLessons($weeklyFrequency, $duration, $startDate, $calendarToSave = array(), &$data=null)\n\t{\n\t\t$duration = (int)$duration * 60 * 60;//Convert duration from hours to seconds\n\n\t\t$totalDaysForWeek = array();\n\t\t$calendarOfLessons = array();\n\t\t$holidays = $this->getHolidays();\n\t\t$lessons = 0;\n\t\t\n\t\t$totalDaysAndHoursForWeek = $this->getTotalDaysAndHoursForWeek($weeklyFrequency);\n\t\t\n\t\t\n\t\tif (!empty($calendarToSave))\n\t\t\t$calendarOfLessons = $calendarToSave;\n\t\t\t\n\t\t$data['hours_for_week'] = $totalDaysAndHoursForWeek['totalHoursForWeek'];\n\t\t$totalDaysForWeek = $totalDaysAndHoursForWeek['totalDaysForWeek'];\n\t\t$data['days_for_week'] = implode(',', array_keys($totalDaysAndHoursForWeek['totalDaysForWeek']));\n\t\t\n\t\t//Calculate start date and end date \n\t\t$begin = new DateTime($startDate);\n\t\t$end = new DateTime($startDate);\n\t\t\n\t\t$end->modify('+52 weeks');\n\t\t$interval = new DateInterval('P1D');\n\t\t$daterange = new DatePeriod($begin, $interval ,$end);\n\t\t\n\t\t//Add at the end 10 hours to have some days \"free\"\n\t\t$extendDuration = (10 * 60 * 60) + $duration;//Convert duration from hours to seconds\n\t\t\n\t\t//Make calendar\n\t\tforeach($daterange as $date)\n\t\t{\t\n\t\t\t$key = strtoupper($date->format(\"F\"));\n\t\t\t\n\t\t\tif ($extendDuration > 0)\n\t\t\t{\n\t\t\t\tif (!isset($calendarOfLessons[$key]))\n\t\t\t\t{\n\t\t\t\t\t$calendarOfLessons[$key]['year'] = $date->format(\"Y\");\n\t\t\t\t\t$calendarOfLessons[$key]['days'] = array();\n\t\t\t\t}\n\n\t\t\t\tif (isset($totalDaysForWeek['day_of_week_'.$date->format(\"w\")])) \n\t\t\t\t{\n\t\t\t\t\t$day = $date->format(\"d-m-Y\");\n\t\t\t\t\t$calendarOfLessons[$key]['days'][$day] = new stdClass();\n\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->name = $date->format(\"D\");\n\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->number = $date->format(\"d\");\n\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->holiday = 0;\n\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->holidaytitle = '';\n\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->duration = $totalDaysForWeek['day_of_week_'.$date->format(\"w\")];\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t//Check holidays\n\t\t\t\t\tif (isset($holidays[$key][$day]))\n\t\t\t\t\t{\n\t\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->holiday = 1;\n\t\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->holidaytitle = $holidays[$key][$day][\"title\"];\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif ($calendarOfLessons[$key]['days'][$day]->holiday === 0 && $duration > 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$calendarOfLessons[$key]['days'][$day]->checked = 1;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$duration -= $totalDaysForWeek['day_of_week_'.$date->format(\"w\")];\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$extendDuration -= $totalDaysForWeek['day_of_week_'.$date->format(\"w\")];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $calendarOfLessons;\n\t\t\n\t\t\t\t\t\t\t\n\t\t\n\t}",
"public function store(Request $request)\n {\n // 2019-09-17 dte format\n $day_arr = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];\n $day_clone = [];\n $day_avail = $request->input('days');\n $startTime = strtotime( $request->from_date );\n $endTime = strtotime( $request->to_date );\n // $day_for_testing = [];\n \n if ($day_avail) {\n for ($i=0; $i < count($day_avail); $i++) { \n array_push($day_clone, ($day_avail[$i]-1)); \n }\n // arr(2,3,4)\n }\n\n if ($day_clone) {\n if(!empty($request->event) && $day_avail && ($startTime <= $endTime)) { \n \n \n // Loop between timestamps, 24 hours at a time\n for ( $a = $startTime; $a <= $endTime; $a = $a + 86400 ) {\n for ($i=0; $i < count($day_clone); $i++) { \n $day_save = $day_arr[$day_clone[$i]] === date( 'D', $a );\n $check_if_exist = Calendar::where('date', '=', date( 'Y-m-d', $a ))->where('day_id', '=', $day_clone[$i]+1)->first();\n \n if ($check_if_exist) {\n $calendar = Calendar::find($check_if_exist->id); //to update\n $calendar->event = $request->event;\n $calendar->save();\n } \n if ($day_save && !$check_if_exist) {\n $calendar1 = new Calendar;\n $calendar1->day_id = $day_clone[$i]+1;\n $calendar1->event = $request->event;\n $calendar1->date = date( 'Y-m-d', $a );\n $calendar1->save();\n }\n }\n } \n // dd($day_for_testing);\n \n \n $notification = array(\n 'message' => 'Event successfully saved.',\n 'alert-type' => 'success'\n );\n } else {\n $notification = array(\n 'message' => 'Make sure to fill in all fields correctly.',\n 'alert-type' => 'warning'\n ); \n }\n \n } else {\n $notification = array(\n 'message' => 'Choose weekdays.',\n 'alert-type' => 'warning'\n );\n }\n\n // return redirect('/');\n return back()->withInput()->with($notification);\n }",
"function handleCalendar( $showID, $dates=null, $venueWPID=\"\", $mobile = false ) {\n $monthVal;\n if ( $dates == null ) {\n\n $showID = $_POST['data']['showID'];\n \n $monthVal = $_POST['data']['monthVal'];\n\n $venueWPID = $_POST['data']['venueVal'];\n \n $mobile = isset($_POST['data']['mobile'])? true : false;\n \n // grab \"week\" variable from $_POST, if set, use that to build start and end dates, else call \"getDates\"\n $week = $_POST['data']['week'];\n\n $today = new DateTime('today');\n // if there's no week value, and the selected month matches current month, choose current week\n if ( $week == \"\" && $today->format('n') - 1 == $monthVal ) {\n $start = new DateTime();\n $start->setISODate( $today->format('Y'), $today->format('W'), 0);\n $week = $start->format('Y-m-d');\n }\n\n //echo \"Week is $week\";\n if ( $week != '' ) {\n $trashDate = new DateTime( $week );\n $dates['start'] = new DateTime( $trashDate->format( 'Y-m-d' ) );\n $trashDate->modify( \"+6 days\" );\n $dates['end'] = new DateTime( $trashDate->format( 'Y-m-d' ) );\n } else if ( $week == '' ) {\n // check if current month matches selected month, select current week if so\n $today = new DateTime();\n if ( $today->format('n')-1 == $monthVal) {\n $week = $today->format('W');\n //printDat($week);\n }\n $dates = getDates( $week, $monthVal );\n }\n //var_dump($dates);\n //wp_die();\n }\n\n /*echo \"<pre>\";\n print_r($dates);\n echo \"</pre>\";*/\n\n // set previous and next week variables\n $prevWeek = new DateTime( $dates[\"start\"]->format(\"Y-m-d\") );\n $prevWeek->modify( \"-1 week\" );\n $nextWeek = new DateTime( $dates[\"start\"]->format(\"Y-m-d\") );\n $nextWeek->modify( \"+1 week\" );\n \n $fullEvents = getShowEvents( $showID, $venueWPID, $dates['start']->format( \"Y-m-d\" ), $dates['end']->format( \"Y-m-d\" ) );\n\n if($mobile){\n return array(\n 'events' => $fullEvents,\n 'week' => $nextWeek\n );\n }\n /*echo \"<pre>\";\n print_r($fullEvents);\n echo \"</pre>\";*/\n\n // for each event, create a new array containing their ID, day of the week and time; push that into events array\n $events;\n foreach( $fullEvents as $event ) {\n $daDate = new DateTime( $event->time );\n $toInsert = array (\n \"id\" => $event->id,\n \"hour\" => $daDate->format( 'G' ),\n \"minute\"=> $daDate->format( 'i' ),\n \"day\" => $daDate->format( 'w' )\n );\n $events[] = $toInsert;\n }\n\n\n // new DateTime to hold current start date...will be used to iterate over and populate the day headers without messing with the dates array\n $currWeek = new DateTime( $dates['start']->format(\"Y-m-d\") );\n \n //start building out the HTML that will display the calendar\n $html = \"<div class='cal-nav'><a id='prev-week-btn'><input type='hidden' id='prev-week' value='\" . $prevWeek->format('Y-m-d') . \"' /><img src='\" . get_template_directory_uri() . \"/library/assets/icons/dotted-arrow.png' /></a>\";\n $html .= \"<span id='date-range'>\" . $dates['start']->format('M j') . \" - \" . $dates['end']->format( 'M j' ) . \"</span>\";\n $html .= \"<a id='next-week-btn'><input type='hidden' id='next-week' value='\" . $nextWeek->format('Y-m-d') . \"' /><img src='\" . get_template_directory_uri() . \"/library/assets/icons/dotted-arrow.png' /></a></div>\";\n $html .= \"<table id='events-calendar'><tr class='days-heading'>\";\n\n // while loop to create the day of the week headers (complete month/day indications)\n $cntr = 0;\n while( $cntr < 7 ) {\n $html .= \"<td>\" . $currWeek->format( 'D n/j' ) . \"</td>\";\n $currWeek->modify( '+1 day' );\n $cntr++;\n }\n $html .= \"</tr>\"; // finish off the day headings row\n\n // another loop, this one to populate in events on each day\n $cntr = 0;\n $html .= \"<tr>\";\n if ( isset( $events ) ) {\n while( $cntr < 7 ) {\n $html .= \"<td>\";\n\n // cycle through events array, grabbing any for current day (based on \"day\" value)\n foreach( $events as $event ) {\n\n $url = home_url( '/' ) . \"tickets/?eventID=\" . $event['id'];\n if( $event['day'] == $cntr ) {\n // build time variable, including converting from 24 hour to 12 hour time\n if ( $event['hour'] > 12 ) {\n $time = $event['hour']-12 . \":\" . $event['minute'] . \" PM\";\n } else {\n $time = $event['hour'] . \":\" . $event['minute'] . \" AM\";\n }\n \n $html .= \"<a href='\" . $url . \"' class='show-time' id='\" . $event['id'] . \"' >\" . $time . \"</a>\";\n }\n }\n $html .= \"</td>\";\n $cntr++;\n }\n } else {\n $html .= \"<td colspan='7'>No events for this week</td>\";\n }\n $html .= \"</tr>\";\n\n $html .= \"<tr><td colspan='7' style='height: 50px'> </td></tr>\";\n\n $html .= \"</table>\";\n\n\n echo $html;\n\n if( $_POST ) {\n wp_die();\n }\n}",
"public function dataProvider_for_createCalendarEvent()\n {\n return [\n 'not_recurring' => [\n [\n 'title' => str_random(16),\n 'start_datetime' => Carbon::parse('2017-08-25 10:00:00'),\n 'end_datetime' => Carbon::parse('2017-08-25 12:00:00'),\n 'description' => str_random(32),\n 'is_recurring' => false,\n 'is_public' => true,\n ],\n ],\n 'recurring' => [\n [\n 'title' => str_random(16),\n 'start_datetime' => Carbon::parse('2017-08-25 10:00:00'),\n 'end_datetime' => Carbon::parse('2017-08-25 12:00:00'),\n 'description' => str_random(32),\n 'is_recurring' => true,\n 'frequence_number_of_recurring' => 1,\n 'frequence_type_of_recurring' => RecurringFrequenceType::WEEK,\n 'is_public' => true,\n ],\n ],\n ];\n }",
"protected function create(array $data)\n {\n $user = Auth::user();\n $article = new Article($data);\n $article->userID = $user->userID;\n $article->ctgID = $data['category'];\n $article->updated_at = Carbon::now();\n $article->save();\n\n if (array_key_exists('image', $data)) {\n $path = $data['image']->store('articles/'.$article->artID, 'images');\n $article->image = $path;\n $article->save();\n }\n \n $event = new Event($data);\n if ($data['place'] !== 'none') {\n $event->placeID = $data['place'];\n }\n $event->artID = $article->artID;\n $event->save();\n \n return $event;\n }",
"function getDailyEventData($date) {\n //Check date format\n $format = \"m/d/Y\";\n $eventDate = date_create_from_format($format, $date);\n if(!$eventDate) {\n // createFromFormat returns false if the format is invalid or date is invalid\n echo \"Please enter a valid date in mm/dd/yyyy format. Cannot proceed due to invalid date error\";\n } else {\n $data;\n $data['SelectedDate'] = $date;\n $data['surfSelect']=0;\n $data['sChange']=\"Get Date\";\n return parent::convertByPOST(self::$dailyEventUrl,$data,3);\n }\n }",
"function get_event_days(){\r\n\t\t$event_days = array();\r\n\r\n\t\tforeach($this->merged_feed_data as $item){\r\n\t\t\t$start_date = $item->get_start_date();\r\n\r\n\t\t\t//Round start date to nearest day\r\n\t\t\t$start_date = mktime(0, 0, 0, date('m', $start_date), date('d', $start_date) , date('Y', $start_date));\r\n\r\n\t\t\tif(!isset($event_days[$start_date])){\r\n\t\t\t\t//Create new array in $event_days for this date (only dates with events will go into array, so, for \r\n\t\t\t\t//example $event_days[26] will exist if 26th of month has events, but won't if it has no events)\r\n\t\t\t\t//(Now uses unix timestamp rather than day number, but same concept applies).\r\n\t\t\t\t$event_days[$start_date] = array();\r\n\t\t\t}\r\n\r\n\t\t\t//Push event into array just created (may be another event for this date later in feed)\r\n\t\t\tarray_push($event_days[$start_date], $item);\r\n\t\t}\r\n\r\n\t\treturn $event_days;\r\n\t}",
"public function createAdvent($data, $user)\n {\n DB::beginTransaction();\n\n try {\n if(!$data['start_at']) throw new \\Exception ('A start time is required.');\n if(!$data['end_at']) throw new \\Exception ('An end time is required.');\n\n $advent = AdventCalendar::create(Arr::only($data, ['name', 'display_name', 'summary', 'start_at', 'end_at']));\n\n return $this->commitReturn($advent);\n } catch(\\Exception $e) {\n $this->setError('error', $e->getMessage());\n }\n return $this->rollbackReturn(false);\n }",
"function calendar_scrub(array $item) {\n $cal_type = \"google\";\n $cal_id = isset($item['id']) ? $item['id'] : \"n/a\";\n $cal_url = isset($item['htmlLink']) ? $item['htmlLink'] : \"n/a\";\n\n $g_start = isset($item['start']['dateTime'])\n ? $item['start']['dateTime']\n : (isset($item['start']['date'])\n ? $item['start']['date'] \n // . \"T00:00:00\"\n // . date(\"P\", strtotime($item['start']['date']))\n : \"00-00-00T00:00:00-00:00\");\n\n $g_end = isset($item['end']['dateTime'])\n ? $item['end']['dateTime']\n : (isset($item['end']['date'])\n ? $item['end']['date'] \n // . \"T00:00:00\"\n // . date(\"P\", strtotime($item['end']['date']))\n : \"00-00-00T00:00:00-00:00\");\n\n /**\n * is this an all day event? (open + close are dates, not dateTimes)\n */\n\n $all_day = isset($item['start']['date']) && isset($item['end']['date'])\n ? true : false;\n\n /**\n * descriptors\n */\n\n $title = isset($item['summary']) ? $item['summary'] : \"\";\n $info = isset($item['description']) ? $item['description'] : \"\"; \n \n /**\n * formatted date + times\n * (all-day events are nulled )\n */\n\n $day = date(DAY_FORMAT, strtotime($g_start));\n $f_start = !$all_day ? date(HOUR_FORMAT, strtotime($g_start)) : null;\n $f_end = !$all_day ? date(HOUR_FORMAT, strtotime($g_end)) : null;\n\n if ( !$all_day ) {\n\n /**\n * some odds 'n ends for finals week\n */\n\n // we'll never open at midnight, so we'll treat this as the beginning\n // of the end of 24-hours\n if ( preg_match(\"/00:00:00/\", $g_start)) {\n $display_time = \"Close at \" . $f_end;\n }\n\n // 11:59 is a little too specific for our closing hour and will begin\n // our finals week\n elseif ( preg_match(\"/23:59:00/\", $g_end) ) {\n $display_time = $f_start . \" - \" . \"Begin 24 Hours\";\n } \n\n // normally, we'll display time as \"9:00 am - 5:00 pm\"\n else {\n $display_time = $f_start . \" - \" . $f_end;\n }\n } \n\n /**\n * if we're dealing with all-day events, null out the formatted start + end\n * and use the title (eg. \"Closed\") for the display time\n */\n\n else {\n $display_time = $title;\n $f_start = $f_end = null;\n }\n\n $out = array(\n \"title\" => $title,\n \"info\" => $info,\n \"day\" => $day,\n \"all_day\" => $all_day,\n \"dateTime\" => array(\n \"start\" => $g_start,\n \"end\" => $g_end,\n ),\n \"formatted\" => array(\n \"start\" => $f_start,\n \"end\" => $f_end\n ),\n \"display\" => $display_time\n );\n\n // only display calendar meta info if we want to\n if (defined('DISPLAY_CALENDAR_META') && DISPLAY_CALENDAR_META === true) {\n $out['calendar'] = array(\n \"type\" => $cal_type,\n \"id\" => $cal_id,\n \"url\" => $cal_url\n );\n }\n\n return $out;\n}",
"function attendance_create_calendar_event(&$session) {\n global $DB;\n\n // We don't want to create multiple calendar events for 1 session.\n if ($session->caleventid) {\n return $session->caleventid;\n }\n if (empty(get_config('attendance', 'enablecalendar')) || $session->calendarevent === 0) {\n // Calendar events are not used, or event not required for this session.\n return true;\n }\n\n $attendance = $DB->get_record('attendance', array('id' => $session->attendanceid));\n\n $caleventdata = new stdClass();\n $caleventdata->name = $attendance->name;\n $caleventdata->courseid = $attendance->course;\n $caleventdata->groupid = $session->groupid;\n $caleventdata->instance = $session->attendanceid;\n $caleventdata->timestart = $session->sessdate;\n $caleventdata->timeduration = $session->duration;\n $caleventdata->description = $session->description;\n $caleventdata->format = $session->descriptionformat;\n $caleventdata->eventtype = 'attendance';\n $caleventdata->timemodified = time();\n $caleventdata->modulename = 'attendance';\n\n if (!empty($session->groupid)) {\n $caleventdata->name .= \" (\". get_string('group', 'group') .\" \". groups_get_group_name($session->groupid) .\")\";\n }\n\n $calevent = new stdClass();\n if ($calevent = calendar_event::create($caleventdata, false)) {\n $session->caleventid = $calevent->id;\n $DB->set_field('attendance_sessions', 'caleventid', $session->caleventid, array('id' => $session->id));\n return true;\n } else {\n return false;\n }\n}",
"private function addWeekly($ItemData, $DataStartDate, $DataStopDate, $start_day) {\r\n\t\r\n\t\t$stop_day = (($DataStartDate->compareTime($DataStopDate) > 0) ? (($start_day + 1) % 7) : $start_day );\t\r\n\t\t\r\n\t\t$DateLooper = new SC_DateTime(1, $this->Month->getMonthOfYear(), $this->Month->getYear());\r\n\t\r\n\t\t// loop until stop day of week is reached\t\t\r\n\t\twhile ($DateLooper->getDayOfWeek() != $stop_day) $DateLooper->addDay(1);\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t// check if cross day\t\r\n\t\tif($start_day != $stop_day) {\r\n\t\t\r\n\t\t\t$LastDayOfMonth = new SC_DateTime($this->Month->getDaysInMonth(), $this->Month->getMonthOfYear(), $this->Month->getYear());\r\n\t\t\t\r\n\t\t\t// move date looper to the start day\r\n\t\t\t$DateLooper->removeDay(1);\r\n\t\t\r\n\t\t\twhile ($DateLooper->compareDate($DataStopDate) < 0 && $DateLooper->compareDate($LastDayOfMonth) <= 0) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t$DatePointer = new SC_DateTime($DateLooper->getDay(), $DateLooper->getMonth(), $DateLooper->getYear());\r\n\t\t\t\t\r\n\t\t\t\t// save the stop day\r\n\t\t\t\t$DatePointer->addDay(1);\r\n\t\t\t\t\r\n\t\t\t\tif($DatePointer->compareDate($DataStartDate) > 0) {\r\n\t\t\t\t\r\n\t\t\t\t\t$Item = Utilities::createItem($ItemData, $DateLooper, $this->timezone, 1);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif($DatePointer->getMonth() == $this->Month->getMonthOfYear())\t$this->Schedules[$DatePointer->getDay() - 1]->addItem($Item);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif($DateLooper->getMonth() == $this->Month->getMonthOfYear())\t$this->Schedules[$DateLooper->getDay() - 1]->addItem($Item);\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$DateLooper->addWeek(1);\r\n\t\t\t\t\r\n\t\t\t}\t// end while\r\n\t\t\t\t\t\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\r\n\t\t\twhile ($DateLooper->compareDate($DataStopDate) <= 0 && ($DateLooper->getMonth() == $this->Month->getMonthOfYear())) {\r\n\t\t\t\t\r\n\t\t\t\t$Item = Utilities::createItem($ItemData, $DateLooper, $this->timezone);\r\n\t\t\t\t\r\n\t\t\t\tif($DateLooper->compareDate($DataStartDate) >= 0) {\r\n\t\t\t\t\t// Check if time has been specified\t\r\n\t\t\t\t\tif($ItemData->getTimeSpec()) {\r\n\t\t\t\t\t\t$this->Schedules[$DateLooper->getDay() - 1]->addItem($Item);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$this->Schedules[$DateLooper->getDay() - 1]->addNoTimeItem($Item);\r\n\t\t\t\t\t} \r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t$DateLooper->addWeek(1);\r\n\t\t\t\t\r\n\t\t\t}\t// end while\r\n\t\t\r\n\t\t}// end if \r\n\t\t\r\n\t}",
"private static function get_events() {\n\t\treturn array(\n\t\t\t'formidable_send_usage' => 'weekly',\n\t\t);\n\t}",
"public function add_week($arr_task_id = '')\n\t {\n\t \techo '<pre>';\n\t \tif($arr_task_id == '' || $arr_task_id == array()){\n\t \t\treturn false;\n\t \t}else{\n\t\t \t//task info\n\t\t\t$where['task_id'] = $arr_task_id;\n\t\t\t//$where['task_id'] = 1424;//test,frequency based on week, 3 times per week\n\t\t\t//$where['task_id'] = 1607;//test,frequency based on week, 3 times per week, Collin\n\t\t\t//$where['task_id'] = 1423;//test,frequency based on week, 2 times per week\n\t\t\t//$where['task_id'] = 1609;//test,frequency based on week, 1 time per 2 weeks\n\t\t\t//$where['task_id'] = 1610;//test,frequency based on month, 2 times per 3 months\n\t\t\t//$where['task_id'] = 1797;//test\n\n\t\t\t$task_res = $this->task_model->lists($this->task_lists_fields, $where, $like, $json = true, $orderby, $page, $pagesize);\n\n\t\t\t$total_cycle = 0;\n\t\t\t//assign year and week to schedule\n\t\t\tforeach($task_res['result'] as $res){\n\n\t\t\t\t//var_dump($res->cycle/(52*$res->year), $res->cycle/(54*$res->year), $res->year);\n\n\t\t\t\t//frequency based on month or week, if it's week then 99.999999% is debris, cycles per year inclues: 26, 52, 104, 156,,, 27, 54, 108, 162\n\t\t\t\tif(is_int($res->cycle/(52*$res->year)) || is_int($res->cycle/(54*$res->year)) || $res->cycle/(52*$res->year) == 0.5 || $res->cycle/(54*$res->year) == 0.5){//by week\n\t\t\t\t\t\n\t\t\t\t\t$ini_dayyyyyyy = date('w', strtotime($res->bdate));\n\t\t\t\t\t$ini_date = date('N',strtotime($res->bdate)) == 1 ? $res->bdate : date('Y-m-d',strtotime('+ '.(8-$ini_dayyyyyyy).' days', strtotime($res->bdate)));//set initial date to next Monday. Cities don't allow debirs work on Sunday\n\t\t\t\t\t\n\n\n\t\t\t\t\t$frequencyPerWeek = $res->cycle/(52*$res->year) ? $res->cycle/(52*$res->year) : $res->cycle/(54*$res->year) ; \n\t\t\t\t\t$addMaxDate = $frequencyPerWeek == 0.5 ? 13 : 6;//calculate maxdate, when one time per 2 weeks, the period will be 2 weeks; otherwise it's 1 week\n\n\n\t\t\t\t\tfor( $i=1; $i <= $res->cycle ; $i++){\n\t\t\t\t\t\t/*if($ini_month <= 12){\n\t\t\t\t\t\t\t$modi_year = $ini_year;\n\t\t\t\t\t\t\t$modi_week = $ini_week;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$modi_year = $ini_year = $ini_year + 1;\n\t\t\t\t\t\t\t$modi_week = $ini_week = $ini_week - 12;\n\t\t\t\t\t\t}*/\n\n\t\t\t\t\t\t$mindate = $ini_date;\n\t\t\t\t\t\t$maxdate = date('Y-m-d', strtotime(\"+ \".$addMaxDate.\" days\", strtotime($mindate)));\n\n\t\t\t\t\t\tswitch ($frequencyPerWeek) {//cycle per week\n\t\t\t\t\t\t\tcase 3 :\n\n\t\t\t\t\t\t\t\tif($i % 3 == 1){\n\t\t\t\t\t\t\t\t\t$work_weekday = $ini_date;\n\t\t\t\t\t\t\t\t}elseif($i % 3 == 2){\n\t\t\t\t\t\t\t\t\t$work_weekday = date('Y-m-d', strtotime('+ 2 days', strtotime($ini_date)));\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$work_weekday = date('Y-m-d', strtotime('+ 4 days', strtotime($ini_date)));\n\n\t\t\t\t\t\t\t\t\t$ini_date = date('Y-m-d', strtotime('+ 7 days', strtotime($ini_date)));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tif($i == 1 ) $ini_date = date('Y-m-d', strtotime('+ 1 days', strtotime($ini_date)));//starts on Tuesday\n\n\t\t\t\t\t\t\t\tif($i % 2 == 1){\n\t\t\t\t\t\t\t\t\t$work_weekday = $ini_date;\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$work_weekday = date('Y-m-d', strtotime('+ 2 days', strtotime($ini_date)));\n\n\t\t\t\t\t\t\t\t\t$ini_date = date('Y-m-d', strtotime('+ 7 days', strtotime($ini_date)));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t$work_weekday = $ini_date;\n\n\t\t\t\t\t\t\t\t$ini_date = date('Y-m-d', strtotime('+ 7 days', strtotime($ini_date)));\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 0.5:\n\t\t\t\t\t\t\t\t$work_weekday = $ini_date;\n\n\t\t\t\t\t\t\t\t$ini_date = date('Y-m-d', strtotime('+ 14 days', strtotime($ini_date)));\n\t\t\t\t\t\t\t\tbreak;\n\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t$this->redirect(BASE_URL().'task/add_csv','ask IT (week mod)'.$res->cycle);exit;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$insert_data['mindate'] = $mindate;\n\t\t\t\t\t\t$insert_data['maxdate'] = $maxdate;\n\t\t\t\t\t\t$insert_data['schedule_year'] = date('Y', strtotime($work_weekday));\n\t\t\t\t\t\t$insert_data['schedule_month'] = date('n', strtotime($work_weekday));\n\t\t\t\t\t\t$insert_data['schedule_week'] = date('N', strtotime($work_weekday)) != 7 ? ltrim(date('W', strtotime($work_weekday)), '0') : ltrim(date('W', strtotime($work_weekday)), '0') + 1;//week starts from Sunday\n\t\t\t\t\t\t$insert_data['schedule_date'] = $work_weekday;\n\t\t\t\t\t\t$insert_data['task_id'] = $res->task_id;\n\t\t\t\t\t\t$insert_data['addtime'] = date('Y-m-d H:i:s');\n\n\t\t\t\t\t\t//$insert_data['ini_month'] = $ini_month;//test\n\t\t\t\t\t\t//$insert_data['cycle'] = $res->cycle;//test\n\t\t\t\t\t\t//$insert_data['total_year'] = $res->year;//test\n\t\t\t\t\t\t//$insert_data['total_month'] = $res->month;//test\n\n\t\t\t\t\t\t$insert_week[] = $insert_data;\t\t\n\t\t\t\t\t}\n\n\t\t\t\t}else{//by month\n\n\t\t\t\t\t$ini_year = date('Y',strtotime($res->bdate));\n\t\t\t\t\t$ini_month = date('n',strtotime($res->bdate));\n\n\t\t\t\t\t//only for harris county\n\t\t\t\t\tif($res->contract_id == 11 && $res->cycle == 18){\n\t\t\t\t\t\t$ini_year = 2017;\n\t\t\t\t\t\t$ini_month = 3;\n\t\t\t\t\t}\n\n\t\t\t\t\t//settttttttingggggggggg\n\t\t\t\t\t$settle_to_next_week_1 = 4;//Thursday\n\t\t\t\t\t$settle_to_next_week_14 = $settle_to_next_week_1 - 1;//one day before $settle_to_next_week_1\n\n\t\t\t\t\t//var_dump($ini_year,$ini_month);//testing\n\t\t\t\t\tfor( $i=1; $i <= $res->cycle ; $i++){\n\t\t\t\t\t\tif($ini_month <= 12){\n\t\t\t\t\t\t\t$modi_year = $ini_year;\n\t\t\t\t\t\t\t$modi_month = $ini_month;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$modi_year = $ini_year = $ini_year + 1;\n\t\t\t\t\t\t\t$modi_month = $ini_month = $ini_month - 12;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\n\t\t\t\t\t\tswitch ($res->cycle/$res->month) {//cycle per month\n\n\t\t\t\t\t\t\t//case 12://cycle per year\n\t\t\t\t\t\t\tcase 1://cycle per month\n\n\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-01';\n\n\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_1;\n\n\t\t\t\t\t\t\t\t//one month period\n\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime($work_weekday));\n\n\t\t\t\t\t\t\t\t$ini_month ++;\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//case 18://cycle per year\n\t\t\t\t\t\t\tcase 1.5://cycle per month\n\t\t\t\t\t\t\t\tif($i % 3 == 1){\n\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-01';\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_1;\n\n\t\t\t\t\t\t\t\t\t//two months period\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime('+ 1 month', strtotime($work_weekday)));\n\n\t\t\t\t\t\t\t\t}elseif($i % 3 == 2){\n\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-14';\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_14;\n\n\t\t\t\t\t\t\t\t\t//two months period\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime('+ 1 month', strtotime($work_weekday)));\n\n\t\t\t\t\t\t\t\t\t$ini_month ++;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}else{\n\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-01';\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_1;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//two months period\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime('- 1 month', strtotime($work_weekday)));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime($work_weekday));\n\n\t\t\t\t\t\t\t\t\t$ini_month ++;\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t//case 24://cycle per year\n\t\t\t\t\t\t\tcase 2://cycle per month\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif($i % 2 == 1){\n\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-01';\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_1;\n\n\t\t\t\t\t\t\t\t\t//first 2 weeks of the month\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-d', strtotime('+ 14 days', strtotime($work_weekday)));\n\n\t\t\t\t\t\t\t\t}else{\n\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-14';\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_14;\n\n\t\t\t\t\t\t\t\t\t//last 2 weeks of the month\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-d', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime($work_weekday));\n\n\t\t\t\t\t\t\t\t\t$ini_month ++;\n\n\t\t\t\t\t\t\t\t}\t\n\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault://months per cycle: 2,3,4,6,\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t//$ini_month += 12 * $res->year / $res->cycle ;//per year\n\t\t\t\t\t\t\t\t$month_per_cycle = $res->month / $res->cycle ;//month per cycle\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif($res->contract_id == 85 && $res->cycle == 18){//only for harris county\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-01';//1st week\n\t\t\t\t\t\t\t\t\t//if(date(\"N\", strtotime($work_weekday)) >= $settle_to_next_week_1) $work_weekday = date('Y-m-d', strtotime('+1 week',strtotime($work_weekday)));\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_1;\n\n\t\t\t\t\t\t\t\t\t$ini_month += 1 ;\n\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t//break;\n\t\t\t\t\t\t\t\t}elseif(is_int($month_per_cycle)){\n\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-14' ;\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_14;\n\n\t\t\t\t\t\t\t\t\t$ini_month += $month_per_cycle ;\n\n\t\t\t\t\t\t\t\t\t//months period\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime(\"+ \".($month_per_cycle - 1).\" months\", strtotime($work_weekday)));\n\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}elseif($month_per_cycle = 1.5){//twice per 3 months\n\n\t\t\t\t\t\t\t\t\t$work_weekday = $modi_year.'-'.$modi_month.'-01' ;\n\n\t\t\t\t\t\t\t\t\t$settle_to_next_week = $settle_to_next_week_1;\n\n\t\t\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-01', strtotime($work_weekday));\n\t\t\t\t\t\t\t\t\t$insert_data['maxdate'] = date('Y-m-t', strtotime(\"+ 1 months\", strtotime($work_weekday)));\n\n\t\t\t\t\t\t\t\t\tif($i % 2 == 1){\n\t\t\t\t\t\t\t\t\t\t$ini_month += 1 ;\n\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t$ini_month += 2 ;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$this->redirect(BASE_URL().'task/add_csv','ask IT (month mod)'.$res->cycle);exit;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t$dayyyy = date('w', strtotime($work_weekday));\n\t\t\t\t\t\tif($res->task_id == 446)var_dump($work_weekday);\n\t\t\t\t\t\t//when schedule is after $settle_to_next_week, set up to next Sunday\n\t\t\t\t\t\tif(date(\"w\", strtotime($work_weekday)) >= $settle_to_next_week) $work_weekday = date('Y-m-d', strtotime('+ '.(7 - $dayyyy).' days',strtotime($work_weekday)));\n\n\t\t\t\t\t\t//when date is 14, set up to previous Sunday\n\t\t\t\t\t\tif(date(\"d\", strtotime($work_weekday)) == 14) {\n\t\t\t\t\t\t\t$work_weekday = date('Y-m-d', strtotime('- '.$dayyyy.' days',strtotime($work_weekday)));\n\t\t\t\t\t\t\t$insert_data['mindate'] = date('Y-m-d', strtotime($work_weekday));\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\n\t\t\t\t\t\t$insert_data['schedule_year'] = $modi_year;\n\t\t\t\t\t\t$insert_data['schedule_month'] = $modi_month;\n\t\t\t\t\t\t$insert_data['schedule_week'] = date('N', strtotime($work_weekday)) != 7 ? ltrim(date('W', strtotime($work_weekday)), '0') : ltrim(date('W', strtotime($work_weekday)), '0') + 1;//week starts from Sunday\n\t\t\t\t\t\t$insert_data['schedule_date'] = $work_weekday;\n\t\t\t\t\t\t$insert_data['task_id'] = $res->task_id;\n\t\t\t\t\t\t$insert_data['unit_price'] = $res->unit_price;\n\t\t\t\t\t\t$insert_data['addtime'] = date('Y-m-d H:i:s');\n\n\t\t\t\t\t\t$insert_data['ini_month'] = $ini_month;//test\n\t\t\t\t\t\t$insert_data['cycle'] = $res->cycle;//test\n\t\t\t\t\t\t$insert_data['total_year'] = $res->year;//test\n\t\t\t\t\t\t$insert_data['total_month'] = $res->month;//test\n\n\t\t\t\t\t\t$insert_week[] = $insert_data;\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//echo $res->task_id; echo \" \"; echo $total_cycle += $res->cycle; echo '<br>'; \n\t\t\t\tunset($modi_year);\n\t\t\t\tunset($modi_month);\n\t\t\t\tunset($date_week3);\n\t\t\t\tunset($insert_data);\n\t\t\t}\n\t\t\t//echo \"<pre>\";\n\t\t\t//var_dump($insert_week);exit;\n\n\t\t\t//insert into schedule, and update task ifweek\n\t\t\t$insert_res = $this->schedule_model->add_batch($insert_week);\n\n\t\t\tif($insert_res){\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t \t}\n\t \t\n\t }",
"public function weeklyOn($day, $time = '0:0')\n {\n $this->dailyAt($time);\n\n return $this->spliceIntoPosition(5, $day);\n }",
"function _entry_api_ui_event_save_weekscheme(&$event, $values) {\n\n $weekscheme = NULL;\n // Construct the weekscheme.\n if (!$values['period_or_permanent']['all_day']) {\n\n $weekscheme = new CultureFeed_Cdb_Data_Calendar_Weekscheme();\n foreach ($values['period_or_permanent']['opening_times'] as $day => $opening_times) {\n\n $opening_info = new CultureFeed_Cdb_Data_Calendar_SchemeDay($day);\n $open_type = CultureFeed_Cdb_Data_Calendar_SchemeDay::SCHEMEDAY_OPEN_TYPE_CLOSED;\n foreach ($opening_times as $opening_time) {\n if (!empty($opening_time['open_from']) && !empty($opening_time['open_till'])) {\n $open_type = CultureFeed_Cdb_Data_Calendar_SchemeDay::SCHEMEDAY_OPEN_TYPE_OPEN;\n $opening_info->addOpeningTime(new CultureFeed_Cdb_Data_Calendar_OpeningTime($opening_time['open_from'], $opening_time['open_till']));\n }\n }\n\n $opening_info->setOpenType($open_type);\n $weekscheme->setDay($day, $opening_info);\n\n }\n\n }\n\n if ($values['when'] == 'period') {\n $calendar = new CultureFeed_Cdb_Data_Calendar_PeriodList();\n $period = new CultureFeed_Cdb_Data_Calendar_Period($values['period_or_permanent']['start_date'], $values['period_or_permanent']['end_date']);\n if ($weekscheme) {\n $period->setWeekScheme($weekscheme);\n }\n $calendar->add($period);\n }\n else {\n $calendar = new CultureFeed_Cdb_Data_Calendar_Permanent();\n if ($weekscheme) {\n $calendar->setWeekScheme($weekscheme);\n }\n }\n\n $event->setCalendar($calendar);\n\n}",
"public function getDayEvents($date){\n\t\t$object = $this->events_ob;\n\t\t$event = new $object();\n\t\t$events = array();\n\t\t\n\t\t# Get Non-Reoccurring events\n\t\t$query = \"WHERE `start_date` = '\".$date.\"' AND `repeating` = '0' AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Reoccurring events\n\t\t# Get Events that Reoccur on a daily basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'daily' AND `repeat_every` <> 0 AND MOD(TIMESTAMPDIFF(DAY, `start_date`, '\".$date.\"'), `repeat_every`) = 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Events that Reoccur on a weekly basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'weekly' AND `repeat_wednesday` = '1' AND `repeat_every` <> 0 AND MOD(TIMESTAMPDIFF(WEEK, `start_date`, '\".$date.\"'), `repeat_every`) = 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Events that Reoccur on a monthly basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'monthly' AND ((`repeat_by` = 'day_of_month' AND DAY(`start_date`) = '16') OR (`repeat_by` = 'day_of_week' AND DAYOFWEEK(`start_date`) = '4' AND MOD((TIMESTAMPDIFF(WEEK, '2017-08-01', '\".$date.\"')+1), `repeat_every`) = 0)) AND `repeat_every` <> 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\t# Get Events that Reoccur on a yearly basis\n\t\t$query = \"WHERE `repeating` = '1' AND `start_date` <= '\".$date.\"' AND (`repeat_end` >= '\".$date.\"' OR `repeat_end` = '0000-00-00') AND `repeat_type` = 'yearly' AND DAY(`start_date`) = '16' AND MONTH(`start_date`) = '8' AND `repeat_every` <> 0 AND MOD(TIMESTAMPDIFF(YEAR, `start_date`, '\".$date.\"'), `repeat_every`) = 0 AND `active` = '1'\";\n\t\t$events = array_merge($events, $event->fetchQuery($query));\n\t\t\n\t\treturn $events;\n\t}",
"private function build()\n\t{\n\t\t$locations = locations::getLocations();\n\t\t$currDate = date('Y/m/d');\n\n\t\t$nextDate = strtotime($currDate) + (86400*count(self::$schedule));\n\n\t\twhile (count(self::$schedule) < 7) {\n\n\t\t\t$day = new stdClass();\n\n\t\t\t$day->date = date('Y/m/d',$nextDate);\n\t\t\t$day->location = $locations[rand(0, max(0, (count($locations)-1)))];\n\n\t\t\tself::$schedule[] = $day;\n\n\t\t\t$nextDate += 86400;\n\n\t\t}\n\n\t\t$this->storeSchedule();\n\t}",
"public function store(Request $request)\n {\n Event::truncate();\n $begin = new DateTime(date('Y-m-d', strtotime($request->dateFrom)));\n $end = new DateTime(date('Y-m-d', strtotime($request->dateTo)));\n $days = [\n 'Monday'=>Constant::MONDAY,\n 'Tuesday'=>Constant::TUESDAY,\n 'Wednesday'=>Constant::WEDNESDAY,\n 'Thursday'=>Constant::THURSDAY,\n 'Friday'=>Constant::FRIDAY,\n 'Saturday'=>Constant::SATURDAY,\n 'Sunday'=>Constant::SUNDAY\n ];\n\n try{\n for($i = $begin; $i <= $end; $i->modify('+1 day')){\n $currentDay = $i->format(\"l\");\n $currentDate = $i->format(\"Y-m-d\");\n if(in_array($days[$currentDay], $request->dayOptions)){\n $event = new Event();\n $event->title = $request->eventTitle;\n $event->date = date('Y-m-d', strtotime($currentDate));\n $event->save();\n }\n }\n return response()->json(['success' => 'success'], 200);\n }catch(Exception $e) {\n return response()->json(['error' => 'invalid'], 401);\n return $e->getMessage();\n }\n }",
"private function makeDayEventListArray()\n\t{\n\t\t$outevents = array();\n\t\t$n = 0;\n\t\tforeach($this->eventItems as $item) {\n\t\t\tif($item['date'] == $this->curYear.'-'.$this->curMonth.'-'.$this->dayOfMonth) {\t\t\n\t\t\t\t$outevents[$n]['category'] = $item['cat'];\n\t\t\t\t\n\t\t\t\tif($item['stdurl']) {\n\t\t\t\t\t$outevents[$n]['url'] = $item['url'].'?id='.$item['id'];\n\t\t\t\t} else {\n\t\t\t\t\t$outevents[$n]['url'] = $item['url'];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$outevents[$n]['summary'] = $item['text'];\n\t\t\t\t$outevents[$n]['description'] = $item['desc'];\n\t\t\t\t$outevents[$n]['categorycolor'] = (strlen($item['catcolor']) > 0 ? str_replace('#','',$item['catcolor']) : '#eeeeee');\n\t\t\t}\n\t\t\t$n++;\n\t\t}\n\t\t\n\t\tif(count($outevents)) {\n\t\t\treturn $outevents;\n\t\t}\n\t\treturn false;\n\t}",
"static function prePopulateFromPastWeeks($startDate, $dayHeaders) {\n global $user;\n global $i18n;\n\n // First, determine past week start and end dates.\n $objDate = new DateAndTime(DB_DATEFORMAT, $startDate);\n $objDate->decDay(7);\n $pastWeekStartDate = $objDate->toString(DB_DATEFORMAT);\n $objDate->incDay(6);\n $pastWeekEndDate = $objDate->toString(DB_DATEFORMAT);\n unset($objDate);\n\n // Obtain past week(s) records.\n $records = ttWeekViewHelper::getRecordsForInterval($pastWeekStartDate, $pastWeekEndDate);\n // Handle potential situation of no records by re-trying for up to 4 more previous weeks (after a long vacation, etc.).\n if (!$records) {\n for ($i = 0; $i < 4; $i++) {\n $objDate = new DateAndTime(DB_DATEFORMAT, $pastWeekStartDate);\n $objDate->decDay(7);\n $pastWeekStartDate = $objDate->toString(DB_DATEFORMAT);\n $objDate->incDay(6);\n $pastWeekEndDate = $objDate->toString(DB_DATEFORMAT);\n unset($objDate);\n\n $records = ttWeekViewHelper::getRecordsForInterval($pastWeekStartDate, $pastWeekEndDate);\n // Break out of the loop if we found something.\n if ($records) break;\n }\n }\n\n // Construct the first row for a brand new entry.\n $dataArray[] = array('row_id' => null,'label' => $i18n->get('form.week.new_entry').':'); // Insert row.\n // Insert empty cells with proper control ids.\n for ($i = 0; $i < 7; $i++) {\n $control_id = '0_'. $dayHeaders[$i];\n $dataArray[0][$dayHeaders[$i]] = array('control_id' => $control_id, 'tt_log_id' => null,'duration' => null);\n }\n $includeNotes = $user->isOptionEnabled('week_notes');\n if ($includeNotes) {\n // Construct the second row for daily comments for a brand new entry.\n $dataArray[] = array('row_id' => null,'label' => $i18n->get('label.notes').':'); // Insert row.\n // Insert empty cells with proper control ids.\n for ($i = 0; $i < 7; $i++) {\n $control_id = '1_'. $dayHeaders[$i];\n $dataArray[1][$dayHeaders[$i]] = array('control_id' => $control_id, 'tt_log_id' => null,'note' => null);\n }\n }\n\n // Iterate through records and build an \"empty\" $dataArray.\n foreach ($records as $record) {\n // Create row id with 0 suffix. In prepopulated view, we only need one row for similar records.\n $row_id = ttWeekViewHelper::makeRowIdentifier($record).'_0';\n // Find row.\n $pos = ttWeekViewHelper::findRow($row_id, $dataArray);\n if ($pos < 0) {\n // Insert row for durations.\n $dataArray[] = array('row_id' => $row_id,'label' => ttWeekViewHelper::makeRowLabel($record));\n $pos = ttWeekViewHelper::findRow($row_id, $dataArray);\n // Insert empty cells with proper control ids.\n for ($i = 0; $i < 7; $i++) {\n $control_id = $pos.'_'. $dayHeaders[$i];\n $dataArray[$pos][$dayHeaders[$i]] = array('control_id' => $control_id, 'tt_log_id' => null,'duration' => null);\n }\n // Insert row for comments.\n if ($includeNotes) {\n $dataArray[] = array('row_id' => $row_id.'_notes','label' => $i18n->get('label.notes').':');\n $pos++;\n // Insert empty cells with proper control ids.\n for ($i = 0; $i < 7; $i++) {\n $control_id = $pos.'_'. $dayHeaders[$i];\n $dataArray[$pos][$dayHeaders[$i]] = array('control_id' => $control_id, 'tt_log_id' => null,'note' => null);\n }\n $pos--;\n }\n }\n }\n\n return $dataArray;\n }",
"public function store()\n {\n if (Sentry::check()) {\n // Find active user and set default variables to null\n $schools = null;\n $user = Sentry::getUser();\n\n // Permission checks\n if ($user->hasAnyAccess(['school', 'event'])) {\n\n $endDate = new DateTime();\n // Check if endDate isn't blank\n if (Input::get('end-date') == '') {\n $endDate = null;\n }\n\n $validator = Validator::make(\n [\n 'group' => Input::get('group'),\n 'description' => Input::get('description'),\n 'start-date' => Input::get('start-date'),\n 'end-date' => $endDate,\n 'start-time' => Input::get('start-time'),\n 'end-time' => Input::get('end-time'),\n 'title' => Input::get('title'),\n 'day' => Input::get('day')\n ],\n [\n 'group' => 'required',\n 'description' => 'required',\n 'start-date' => 'date',\n 'end-date' => 'date',\n 'start-time' => 'required|date_format:H:i',\n 'end-time' => 'required|date_format:H:i',\n 'title' => 'required'\n ]\n );\n\n // If validation fails, return to the create form with errors.\n if ($validator->fails()) {\n return Redirect::route('event.create')->withInput()->withErrors($validator);\n } else {\n $title = e(Input::get('title'));\n $description = e(Input::get('description'));\n $location = e(Input::get('location'));\n $group_id = Input::get('group');\n $start_date = e(Input::get('start-date'));\n $end_date = e(Input::get('end-date'));\n $start_time = e(Input::get('start-time'));\n $end_time = e(Input::get('end-time'));\n\n // TODO: Handle All day events, or decide to remove it alltogether\n // If the event isn't the whole day, determine the end date/time\n //$event->allday = false;\n\n // Recurring events handling\n if (Input::get('repeat')) {\n\n $dateArray = explode(',', e(Input::get('repeat-dates')));\n // Check if there are any dates selected, return error if not\n if(count($dateArray) == 0) {\n\n $validator->getMessageBag()->add(\n 'end',\n Lang::get('validation.countmin', ['attribute ' => 'Jaarkalender ', 'min' => '1'])\n );\n\n // Redirect back with inputs and validator instance\n return Redirect::back()->withErrors($validator)->withInput();\n\n } else {\n // Loop through dates to validate them\n foreach($dateArray as $da) {\n // If date is invalid, return error\n if (!self::validateDate($da)) {\n\n $validator->getMessageBag()->add(\n 'end',\n Lang::get('validation.date_format', ['attribute ' => 'Jaarkalender '])\n );\n // Redirect back with inputs and validator instance\n return Redirect::back()->withErrors($validator)->withInput();\n }\n }\n // If all dates are validated and correct, create parent appointment and children\n $parent = new AppParent();\n $parent->title = $title;\n $parent->description = $description;\n $parent->location = $location;\n $parent->group_id = $group_id;\n $parent->save();\n\n foreach($dateArray as $da) {\n $event = new Appointment();\n $event->title = $title;\n $event->description = $description;\n $event->location = $location;\n $event->group_id = $group_id;\n $event->start_date = new DateTime($da . ' ' . $start_time);\n $event->end_date = new DateTime($da . ' ' . $end_time);\n $event->parent_id = $parent->id;\n $event->save();\n }\n }\n return Redirect::route('calendar.index');\n } else {\n\n if(!$start_date) {\n $validator->getMessageBag()->add(\n 'end',\n Lang::get('validation.required', ['attribute ' => 'start-date '])\n );\n\n return Redirect::back()->withErrors($validator)->withInput();\n } else {\n $sd = new DateTime($start_date . ' ' . $start_time);\n\n if($end_date == '') {\n $end_date = $start_date;\n }\n $ed = new DateTime($end_date . ' ' . $end_time);\n\n // Check if end date is before start date, if so, return with error\n if($sd >= $ed) {\n\n $validator->getMessageBag()->add(\n 'end',\n Lang::get('validation.after', ['attribute ' => 'end-date ', 'date' => Input::get('start-date')])\n );\n\n // Redirect back with inputs and validator instance\n return Redirect::back()->withErrors($validator)->withInput();\n\n } else {\n $event = new Appointment();\n $event->title = $title;\n $event->description = $description;\n $event->location = $location;\n $event->group_id = $group_id;\n $event->start_date = $sd;\n $event->end_date = $ed;\n $event->save();\n return Redirect::route('calendar.index');\n }\n }\n }\n }\n } else {\n // If no permissions, redirect the user to the calendar index page\n return Redirect::route('calendar.index');\n }\n } else {\n return Redirect::route('landing');\n }\n }"
]
| [
"0.63646454",
"0.61078703",
"0.60518736",
"0.59931827",
"0.5979353",
"0.5807703",
"0.57028735",
"0.56562424",
"0.5647197",
"0.5615875",
"0.5581959",
"0.55524",
"0.5538791",
"0.55185485",
"0.5464966",
"0.54249775",
"0.54189676",
"0.54146564",
"0.54095715",
"0.5395399",
"0.53804594",
"0.5379566",
"0.53752124",
"0.53715116",
"0.5354847",
"0.5350703",
"0.53404015",
"0.53331757",
"0.53127754",
"0.52974975"
]
| 0.7551199 | 0 |
Fetch Methods Get an instance by ID, AND join weeklyDays as concat'd column (2,5,7) | public static function getByID( $id ){
return self::fetchOneBy(function(\PDO $connection, $tableName) use ($id){
$statement = $connection->prepare("SELECT tblEt.*, tblEtw.weeklyDays FROM {$tableName} tblEt
LEFT JOIN (
SELECT _wd.eventTimeID, GROUP_CONCAT(repeatWeeklyDay SEPARATOR ',') AS weeklyDays FROM
SchedulizerEventTimeWeekdays _wd GROUP BY _wd.eventTimeID
) AS tblEtw ON tblEtw.eventTimeID = tblEt.id
WHERE tblEt.id=:id");
$statement->bindValue(':id', $id);
return $statement;
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayWeekEn(){\n $displayWeekEnQuery = $this->db->prepare(\n 'SELECT \n `dateStart`\n , `dateEnd`\n , `id_ap29f_dateRace` AS `raceId`\n FROM \n `ap29f_race`\n INNER JOIN \n `ap29f_dateRace` ON `ap29f_race`.`id_ap29f_dateRace` = `ap29f_dateRace`.`id`\n WHERE \n `id_ap29f_dateRace` = :id'\n );\n //data retourne un tableau d'objet\n $displayWeekEnQuery->bindValue(':id', $this->id, PDO::PARAM_STR);\n $displayWeekEnQuery->execute();\n return $displayWeekEnQuery->fetch(PDO::FETCH_OBJ);\n }",
"public function readByDay()\n {\n $query = \"select Student.ID, Student.name, Student.last_name, Class.class_name from Student\n inner join Booking on Booking.student_ID = Student.ID\n inner join Booking_Day on Booking_Day.booking_ID = Booking.ID\n inner join Class on Class.ID = Student.class_ID\n where Booking_Day.date = ?\n group by Student.ID\n union\n select Student.ID, Student.name, Student.last_name, Class.class_name from Student\n inner join Booking on Booking.student_ID = Student.ID\n inner join Booking_Extra on Booking_Extra.booking_ID = Booking.ID\n inner join Class on Class.ID = Student.class_ID\n where ? between Booking_Extra.start_date and Booking_Extra.end_date\n and Booking_Extra.\" . $this->dow . \" is not null\n group by Student.ID\";\n\n $stmt = $this->conn->prepare($query);\n // bind data\n $stmt->bindParam(1, $this->date);\n $stmt->bindParam(2, $this->date);\n //$stmt->bindParam(3, $this->dow);\n\n $stmt->execute();\n\n return $stmt;\n }",
"public function getDatesForPlan($saveDataPlan) {\n $userId = Auth::user()->id;\n $selectWeeks = \\DB::table('diet_plans')\n ->select(\"users.id as user_id\", \"diet_plans.id as diet_plan_id\", \"diet_plans.weeks\", \"diet_plans.diet_plan_type_id\")\n ->leftJoin('users', 'users.id', '=', 'diet_plans.user_id')\n ->leftJoin('diet_plan_type', 'diet_plan_type.id', '=', 'diet_plans.diet_plan_type_id')\n ->where('user_id', $userId)\n ->where('diet_plans.id', $saveDataPlan->id)\n// $saveDataPlan->id\n ->whereIn('diet_plans.diet_plan_type_id', [1, 2])\n ->get()->toArray();\n\n $output = [];\n $outputDays = [];\n foreach ($selectWeeks as $week) {\n for ($i = 1; $i <= $week->weeks; $i++) {\n for ($j = 1; $j <= 7; $j++) {\n\n $food[\"week_no_$i\"][\"day_$j\"] = \\DB::table('diet_days')\n ->select(\"diet_meals.NDB_No_id\", \"ABBREV.Shrt_Desc\", \"ABBREV.Energ_Kcal\", \"diet_meals.meal_time_id\", \"diet_days.date\")\n ->leftJoin('diet_weeks_plan', 'diet_days.diet_weeks_plan_id', '=', 'diet_weeks_plan.id')\n ->where('diet_weeks_plan.diet_plan_id', '=', $week->diet_plan_id)\n ->where('diet_weeks_plan.week_no', '=', $i)\n ->where('diet_days.day_no', '=', $j)\n ->leftJoin(DB::raw(\"(SELECT diet_meals.NDB_No_id, diet_meals.diet_day_id, diet_meals.meal_time_id FROM diet_meals) as diet_meals\"), function($join) {\n $join->on(\"diet_meals.diet_day_id\", \"=\", \"diet_days.id\");\n })\n ->leftJoin(DB::raw(\"(SELECT ABBREV.Shrt_Desc,ABBREV.Energ_Kcal,ABBREV.NDB_No FROM ABBREV) as ABBREV\"), function($join) {\n $join->on(\"diet_meals.NDB_No_id\", \"=\", \"ABBREV.NDB_No\");\n })\n ->get()->toArray();\n $output = $food;\n }\n }\n }\n\n\n\n\n $weeks = [];\n $breakFast = [];\n $lunchDay1 = [];\n foreach ($output as $weekNo => $daysArray) {\n foreach ($daysArray as $dayNo => $foodArray) {\n\n foreach ($foodArray as $foods) {\n if ($foods->meal_time_id == 1) {\n\n\n $weeks[$foods->date][\"breakfast\"][$foods->Shrt_Desc] = $foods->Energ_Kcal;\n } elseif ($foods->meal_time_id == 2) {\n $weeks[$foods->date][\"lunch\"][$foods->Shrt_Desc] = $foods->Energ_Kcal;\n// $weeks[$foods->date][\"lunch\"][] = $foods->Shrt_Desc . \" calories \" . $foods->Energ_Kcal;\n } elseif ($foods->meal_time_id == 3) {\n $weeks[$foods->date][\"dinner\"][$foods->Shrt_Desc] = $foods->Energ_Kcal;\n\n// $weeks[$foods->date][\"dinner\"][] = $foods->Shrt_Desc . \" calories \" . $foods->Energ_Kcal;\n } elseif ($foods->meal_time_id == 4) {\n $weeks[$foods->date][\"firstSnack\"][$foods->Shrt_Desc] = $foods->Energ_Kcal;\n\n// $weeks[$foods->date][\"firstSnack\"][] = $foods->Shrt_Desc . \" calories \" . $foods->Energ_Kcal;\n } elseif ($foods->meal_time_id == 5) {\n $weeks[$foods->date][\"secondSnack\"][$foods->Shrt_Desc] = $foods->Energ_Kcal;\n\n// $weeks[$foods->date][\"secondSnack\"][] = $foods->Shrt_Desc . \" calories \" . $foods->Energ_Kcal;\n } else {\n die('feature');\n }\n }\n }\n }\n $object = json_encode($weeks);\n\n return $object;\n }",
"public function getUpcoming($days);",
"private static function printWeeks($startDate, $endDate, $formNum, $id)\r\n {\r\n $newDate = self::splitDates($startDate,$endDate);//retrive array of monday dates\r\n $divs =\"\";\r\n $numDates = count($newDate);\r\n if($numDates===0){//no future mondays meaning end date and start date only range of values\r\n $futuredate= new DateTime($startDate);\r\n $startDate= $futuredate->format(\"Y-m-d\");\r\n $displayStart = $futuredate->format(\"M d,Y\");//format date for route get hive\r\n $futuredate= new DateTime($endDate);\r\n $displayEnd= $futuredate->format(\"M d,Y\");\r\n $divs = \"<li class='list-group-item'><a href='viewform?form=\".$formNum. \"&weekStart=\".$startDate.\"&weekEnd=\".\r\n $futuredate->format(\"Y-m-d\").\"&id=\".$id.\"'>\". $displayStart.\r\n \" - \". $displayEnd.\"</a></li>\" . $divs;\r\n } else{//multiple weeks\r\n\r\n //display start day to saturday\r\n $futuredate= new DateTime($startDate);\r\n $startDate = new DateTime($startDate);\r\n $startDate= $startDate->format(\"Y-m-d\");\r\n if($futuredate->format('N')!=1)// if start date does not fall on a monday create first div\r\n {\r\n $displayStart = $futuredate->format(\"M d,Y\");//format date for route get hive\r\n $futuredate= $futuredate->modify('next sunday');\r\n $displayEnd= $futuredate->format(\"M d,Y\");\r\n $divs = \"<li class='list-group-item'><a href='viewform?form=\".$formNum. \"&weekStart=\".$startDate.\"&weekEnd=\".\r\n $futuredate->format(\"Y-m-d\").\"&id=\".$id.\"'>\". $displayStart.\r\n \" - \". $displayEnd.\"</a></li>\" . $divs;\r\n }\r\n //display all but last week\r\n for($i=0; $i<count($newDate)-1; $i++)\r\n {\r\n $futuredate = new DateTime($newDate[$i]);//convert date time object to be converted to next saturday\r\n $displayStart = $futuredate->format(\"M d,Y\");//format date for route get hive\r\n $futuredate->modify('next sunday');//grab saturday of the weeks monday date provided\r\n $futuredate->format(\"Y-m-d\");//format for route get hive\r\n\r\n $displayEnd =$futuredate->format(\"M d,Y\");//format for html example (October 31, 2018)\r\n //put together href utilizing all the information provided\r\n $divs = \"<li class='list-group-item'><a href='viewform?form=\".$formNum. \"&weekStart=\".$newDate[$i].\"&weekEnd=\".\r\n $futuredate->format(\"Y-m-d\").\"&id=\".$id.\"'>\". $displayStart.\r\n \" - \". $displayEnd.\"</a></li>\" . $divs;\r\n }\r\n\r\n //print last week making end date forms end date\r\n $futuredate = new DateTime($newDate[count($newDate)-1]);//convert date time object to be converted to next saturday\r\n $displayStart = $futuredate->format(\"M d,Y\");//format date for route get hive\r\n $futuredate= new DateTime($endDate);//grab saturday of the weeks monday date provided\r\n\r\n $futuredate->format(\"Y-m-d\");//format for route get hive\r\n\r\n $displayEnd =$futuredate->format(\"M d,Y\");//format for html example (October 31, 2018)\r\n //put together href utilizing all the information provided\r\n $divs = \"<li class='list-group-item'><a href='viewform?form=\".$formNum. \"&weekStart=\".$newDate[count($newDate)-1].\"&weekEnd=\".\r\n $futuredate->format(\"Y-m-d\").\"&id=\".$id.\"'>\". $displayStart.\r\n \" - \". $displayEnd.\"</a></li>\" . $divs;\r\n\r\n }\r\n return $divs;\r\n }",
"public function changeWeek(Request $request,$next_date){\n\n $start_date=Carbon::parse($next_date)->addDay(1);\n $date = Carbon::parse($next_date)->addDay(1);\n\n \n $end_date=Carbon::parse($start_date)->addDay(7);\n $this_week= $week_number = $end_date->weekOfYear;\n \n $period = CarbonPeriod::create($start_date, $end_date);\n \n\n $dates=[];\n foreach ($period as $date){\n $dates[] = $date->format('Y-m-d');\n \n }\n \n if (ApiBaseMethod::checkUrl($request->fullUrl())) {\n $user_id = $id;\n } else {\n $user = Auth::user();\n\n if ($user) {\n $user_id = $user->id;\n } else {\n $user_id = $request->user_id;\n }\n }\n\n $student_detail = SmStudent::where('user_id', $user_id)->first();\n //return $student_detail;\n $class_id = $student_detail->class_id;\n $section_id = $student_detail->section_id;\n\n $sm_weekends = SmWeekend::orderBy('order', 'ASC')->where('active_status', 1)->where('school_id',Auth::user()->school_id)->get();\n\n $class_times = SmClassTime::where('type', 'class')->where('academic_id', getAcademicId())->where('school_id',Auth::user()->school_id)->get();\n\n if (ApiBaseMethod::checkUrl($request->fullUrl())) {\n $data = [];\n $data['student_detail'] = $student_detail->toArray();\n $weekenD = SmWeekend::all();\n foreach ($weekenD as $row) {\n $data[$row->name] = DB::table('sm_class_routine_updates')\n ->select('sm_class_times.period', 'sm_class_times.start_time', 'sm_class_times.end_time', 'sm_subjects.subject_name', 'sm_class_rooms.room_no')\n ->join('sm_classes', 'sm_classes.id', '=', 'sm_class_routine_updates.class_id')\n ->join('sm_sections', 'sm_sections.id', '=', 'sm_class_routine_updates.section_id')\n ->join('sm_class_times', 'sm_class_times.id', '=', 'sm_class_routine_updates.class_period_id')\n ->join('sm_subjects', 'sm_subjects.id', '=', 'sm_class_routine_updates.subject_id')\n ->join('sm_class_rooms', 'sm_class_rooms.id', '=', 'sm_class_routine_updates.room_id')\n\n ->where([\n ['sm_class_routine_updates.class_id', $class_id], ['sm_class_routine_updates.section_id', $section_id], ['sm_class_routine_updates.day', $row->id],\n ])->where('sm_class_routine_updates.academic_id', getAcademicId())->where('sm_classesschool_id',Auth::user()->school_id)->get();\n }\n\n return ApiBaseMethod::sendResponse($data, null);\n }\n\n return view('lesson::student.student_lesson_plan', compact('dates','this_week','class_times', 'class_id', 'section_id', 'sm_weekends'));\n \n }",
"function list_day_work($date)\n{\n Database::getInstance()->getConnection()->real_escape_string($date);\n // Scoate id_urile din zilele lucrate dupa data\n $row = [];\n $query = \"SELECT wd.id, angajati.surname, angajati.name, loc_activitate.locatie, wd.comment FROM cozagro_db.work_days wd\n INNER JOIN cozagro_db.angajati angajati ON wd.id_angajat=angajati.id \n INNER JOIN cozagro_db.loc_activitate loc_activitate ON wd.id_loc_activitate=loc_activitate.id \n WHERE DATE_FORMAT(submission_date, '%d - %c - %Y') = '$date' AND wd.deleted='0'\n ORDER BY angajati.surname ASC \";\n $result = Database::getInstance()->getConnection()->query($query);\n if (!$result) {\n die(\"Errore la extragere pentru zilele de lucru in function.php\" . Database::getInstance()->getConnection()->error);\n };\n\n $i = 0;\n while ($dates = $result->fetch_assoc()) {\n\n $row[$i] = [\"id_work_days\" => $dates['id'],\n \"nume\" => $dates['surname'] . \" \" . $dates['name'],\n \"loc_activitate\" => $dates['locatie'],\n \"comment\" => $dates['comment']];\n\n //Identifica numele angajatului dupa ID\n\n $i++;\n }\n $result->free_result();\n return $row;\n}",
"function mkWeekDays(){\n\tif ($this->startOnSun){\n\t\t$out=\"<tr>\";\n\t\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNumTitle.\"\\\">\".$this->weekNumTitle.\"</td>\";\n\t\tfor ($x=0;$x<=6;$x++) $out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName($x).\"</td>\";\n\t\t$out.=\"</tr>\\n\";\n\t}\n\telse{\n\t\t$out=\"<tr>\";\n\t\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNumTitle.\"\\\">\".$this->weekNumTitle.\"</td>\";\n\t\tfor ($x=1;$x<=6;$x++) $out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName($x).\"</td>\";\n\t\t$out.=\"<td class=\\\"\".$this->cssWeekDay.\"\\\">\".$this->getDayName(0).\"</td>\";\n\t\t$out.=\"</tr>\\n\";\n\t\t$this->firstday=$this->firstday-1;\n\t\tif ($this->firstday<0) $this->firstday=6;\n\t}\nreturn $out;\n}",
"public function getDataWeek()\n {\n return $this->model()->where('created_at', '>=', Carbon::now()->startOfWeek())->get();\n }",
"public function changeWeek($next_date)\n{\n try {\n $start_date=Carbon::parse($next_date)->addDay(1);\n $date = Carbon::parse($next_date)->addDay(1);\n\n\n $end_date=Carbon::parse($start_date)->addDay(7);\n $this_week= $week_number = $end_date->weekOfYear;\n\n $period = CarbonPeriod::create($start_date, $end_date);\n\n\n $dates=[];\n foreach ($period as $date){\n $dates[] = $date->format('Y-m-d');\n\n }\n\n $login_id = Auth::user()->id;\n $teachers = SmStaff::where('active_status', 1)->where('user_id',$login_id)->where('role_id', 4)->where('school_id', Auth::user()->school_id)->first();\n\n $user = Auth::user();\n $class_times = SmClassTime::where('academic_id', getAcademicId())->where('school_id', Auth::user()->school_id)->orderBy('period', 'ASC')->get();\n $teacher_id =$teachers->id;\n $sm_weekends = SmWeekend::where('school_id', Auth::user()->school_id)->orderBy('order', 'ASC')->where('active_status', 1)->get();\n\n $data = [];\n $data['message'] = 'operation Successful';\n return ApiBaseMethod::sendResponse($data, null);\n\n } catch (Exception $e) {\n return ApiBaseMethod::sendError('operation Failed');\n }\n\n}",
"function getExercisesByDayId($day_id, $columns = array()) {\n $columns = maybeDefaultColumns($columns);\n\n // Get database access\n $db = getDb();\n\n // Prepare statement\n $columns = implode(', ', $columns);\n $qry = 'SELECT ' . $columns . ' FROM exercise INNER JOIN day_exercise USING (exercise_id) WHERE day_id = :id ORDER BY display_order';\n $stmt = $db->prepare($qry);\n $stmt->bindValue(':id', $day_id, PDO::PARAM_INT);\n $stmt->execute();\n\n // Return the rows\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\n return $rows;\n }",
"protected function queryAllTrainingDays()\n {\n $queryBuilder = $this->db->createQueryBuilder();\n\n return $queryBuilder->select('*')\n ->from('Training_day', 'td')\n ->innerJoin('td','User', 'u','td.User_ID = u.User_ID')\n ->orderBy('u.User_ID', 'ASC');\n }",
"function get_weekday_stats(){\n if(!DashboardCommon::is_su()) return null;\n \n $sat = strtotime(\"last saturday\");\n $sat = date('w', $sat) == date('w') ? $sat + 7 * 86400 : $sat;\n $fri = strtotime(date(\"Y-m-d\", $sat) . \" +6 days\");\n $from = date(\"Y-m-d\", $sat);//for current week only\n $to = date(\"Y-m-d\", $fri);//for current week only\n $sql = \"SELECT DAYNAME(atr.call_start) as dayname,count(*) as total \n FROM week_days wd \n LEFT JOIN ( SELECT * FROM calls WHERE call_start >= '\" . $this->from . \"' AND call_start <= '\" . $this->to . \"') atr\n ON wd.week_day_num = DAYOFWEEK(atr.call_start)\n GROUP BY\n DAYOFWEEK(atr.call_start)\";\n\n $this_week_rec = DashboardCommon::db()->Execute($sql);\n $saturday = $sunday = $monday = $tuesday = $wednesday = 0;\n $thursday = $friday = 0;\n// $data = array();\n// while (!$this_week_rec->EOF) {\n// $k = $this_week_rec->fields['dayname'];\n// $data[$k]= $this_week_rec->fields['total'];\n// $this_week_rec->MoveNext();\n// }\n// \n// return array_keys($data, max($data));\n\n while (!$this_week_rec->EOF) {\n $daynames = $this_week_rec->fields['dayname'];\n $totalcalls = $this_week_rec->fields['total'];\n if ($daynames == 'Saturday') {\n $saturday = $this_week_rec->fields['total'];\n }\n if ($daynames == 'Sunday') {\n $sunday = $this_week_rec->fields['total'];\n }\n if ($daynames == 'Monday') {\n $monday = $this_week_rec->fields['total'];\n }\n if ($daynames == 'Tuesday') {\n $tuesday = $this_week_rec->fields['total'];\n }\n if ($daynames == 'Wednesday') {\n $wednesday = $this_week_rec->fields['total'];\n }\n if ($daynames == 'Thursday') {\n $thursday = $this_week_rec->fields['total'];\n }\n if ($daynames == 'Friday') {\n $friday = $this_week_rec->fields['total'];\n }\n\n $this_week_rec->MoveNext();\n }\n\n $arr = array('Saturday' => $saturday,\n 'Sunday' => $sunday,\n 'Monday' => $monday,\n 'Tuesday' => $tuesday,\n 'Wednesday' => $wednesday,\n 'Thursday' => $thursday,\n 'Friday' => $friday\n );\n $max_day = array_keys($arr, max($arr));\n \n $avg_calltime_sql = \"SELECT sum(duration) as total_call_time, count(*) as total_records, \n sum(duration) / count(*) as avg_time\n FROM \n (\n SELECT call_end-call_start as duration\n FROM calls\n WHERE call_start >= '\".$this->from.\"' AND call_start <= '\".$this->to.\"'\n ) as dt\";\n $avg_calltime_res = DashboardCommon::db()->Execute($avg_calltime_sql);\n \n \n return array('weekday'=>$max_day[0],'avg_call_time'=>$avg_calltime_res->fields['avg_time']);\n \n }",
"public function run()\n {\n DB::table('week_days')->insert([\n [\n 'number' => 2,\n 'description' => 'Monday',\n 'short' => 'mon', \n 'days_to_end' => 6, \n ],\n [\n 'number' => 3,\n 'description' => 'Tuesday',\n 'short' => 'tue', \n 'days_to_end' => 5, \n ],\n [\n 'number' => 4,\n 'description' => 'Wednesday',\n 'short' => 'wed', \n 'days_to_end' => 4, \n ],\n [\n 'number' => 5,\n 'description' => 'Thursday',\n 'short' => 'thu', \n 'days_to_end' => 3, \n ],\n [\n 'number' => 6,\n 'description' => 'Friday',\n 'short' => 'fri', \n 'days_to_end' => 2, \n ],\n [\n 'number' => 7,\n 'description' => 'Saturday',\n 'short' => 'sat', \n 'days_to_end' => 1, \n ],\n [\n 'number' => 8,\n 'description' => 'Sunday',\n 'short' => 'sun', \n 'days_to_end' => 0, \n ], \n ]); \n }",
"public function getFightNotifcations(){\n //It ignores the distinction lowercase & uppercase.\n $sql = \"SELECT Notifications.date_created, \n Notifications.notification_id,\n p.breedname,\n f1.fight_description,\n Trainers.trainer_name \n FROM FightEvents AS f\n INNER JOIN (Notifications)\n ON (f.notification_id = Notifications.notification_id)\n INNER JOIN (Trainers)\n ON (Trainers.trainer_id = Notifications.trainer_id)\n INNER JOIN (Pokemon AS p)\n ON (p.pokemon_id = f.pokemon_id)\n INNER JOIN (Fights AS f1)\n ON (f.fight_id = f1.fight_id);\";\n\n\n $query = new Query(); // ADDED\n\n\n $query->setSql($sql); // ADDED\n\n $res_container = $query->handleQuery(); // ADDED\n\n return $res_container; \n }",
"public function getDayOfTheWeek();",
"function QueryByGivenDay( $dayDate )\n\t{\n\t\n\t\t//Staff = Query\n\t\t$this->staff = \"\";\t\t\n\t\t$CI =& get_instance(); \t\t\t\t\n\t\t$writeQuery = \"SELECT DISTINCT s.CurrentOwnerEmployeeID, e.Firstname, e.Lastname FROM `Shifts` s JOIN `Employees` e ON s.CurrentOwnerEmployeeID = e.employeeID WHERE `date` = '\".$dayDate.\"' ;\"\t;\t\t\t\t\n\t\t$query = $CI->db->query($writeQuery);\n\t\t$staff = $query->result_array(); \n\t\t\t\t\n\t\tforeach( $staff as $Key => $employee)\n\t\t{\n\t\t\t$thisEmployeeID = $employee[\"CurrentOwnerEmployeeID\"];\t\t\t\n\t\t\t$QueryForShift = \"SELECT s.startTime, s.endTime, s.Position, s.ShiftID FROM `Shifts` s JOIN `Employees` e ON s.CurrentOwnerEmployeeID = e.employeeID WHERE `date` = '\".$dayDate.\"' AND `CurrentOwnerEmployeeID` = '\".$thisEmployeeID.\"' \";\t\t\t\n\t\t\t$query = $CI->db->query($QueryForShift);\t\t\t\n\t\t\t$SHIFTS = $query->result_array(); \n\t\t\t\t\t\t\t\t\n\t\t\tforeach( $SHIFTS as $Shiftkey => $shift\t)\n\t\t\t{\n\t\t\t\t$ST = $shift[\"startTime\"];\n\t\t\t\t$ET = $shift[\"endTime\"];\t\t\t\t\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t\tdetermine duration and attach it to shifts.\n\t\t\t\t\ttimes are in hh:mm:ss format\n\t\t\t\t\tduration will be in 1 to 48 halfhours. \n\t\t\t\t\tdetermine the duration given the start and end times.\n\t\t\t\t*/\t\t\t\t\t\n\t\t\t\t\t$starthour = substr($ST, 0, 2);\n\t\t\t\t\t$starthour = $starthour;\n\t\t\t\t\t$halfhour = substr($ST, 3, 1);\n\t\t\t\t\tif ( $halfhour == 3 )\n\t\t\t\t\t{\n\t\t\t\t\t\t$halfhour = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$halfhour = 0;\n\t\t\t\t\t}\n\t\t\t\t\t$ST = ( $starthour * 2 ) + $halfhour;\n\t\t\t\t\t\n\t\t\t\t\t$endhour = substr($ET, 0, 2);\n\t\t\t\t\t$endhour = (int)$endhour;\n\t\t\t\t\t$endhalf = substr($ET, 3, 1);\n\t\t\t\t\tif ( $endhalf == 3)\n\t\t\t\t\t{\n\t\t\t\t\t\t$endhalf = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$endhalf = 0;\n\t\t\t\t\t}\n\t\t\t\t\t$ET = ( $endhour * 2 ) + $endhalf;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t$duration = $ET - $ST;\t\t\t\t\n\t\t\t\t$SHIFTS[$Shiftkey][\"duration\"] = $duration;\n\t\t\t\t\n\t\t\t\t$pos = \"\";\n\t\t\t\t$position = (int)$shift[\"Position\"];\n\t\t\t\t\n\t\t\t\tswitch ($position)\n\t\t\t\t{\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t$pos = \"Lifeguard\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\t$pos = \"Instructor\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\t$pos = \"Headguard\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\t$pos = \"Supervisor\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault: \n\t\t\t\t\t\t$pos = \"ERROR\".$position;\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t$SHIFTS[$Shiftkey][\"Position\"] = $pos;\t\t\n\t\t\t\t$SHIFTS[$Shiftkey][\"ShiftID\"] = $shift[\"ShiftID\"];\t\t\t\t\n\t\t\t}\t\t\t\n\t\t\t//Place shifts in employee array\n\t\t\t$staff[$Key][\"Shifts\"] = $SHIFTS;\n\t\t\t$staff[$Key][\"TheDate\"] = $dayDate;\n\t\t\t$staff[$Key][\"EmployeeID\"] = $thisEmployeeID;\t\t\t\n\t\t}\t\t\n\t\treturn json_encode( $staff );\n\t}",
"function get_rec_due_date_within_week_page($cDate,$lWeek){\n $query = \"\n SELECT\n view_recommandation_due_date.mgo_file_ref,\n view_recommandation_due_date.dos_file_ref,\n view_recommandation_due_date.vote_id,\n view_recommandation_due_date.vote_head,\n view_recommandation_due_date.vote_name,\n view_recommandation_due_date.item_id,\n view_recommandation_due_date.item_code,\n view_recommandation_due_date.item_name,\n view_recommandation_due_date.quantity,\n view_recommandation_due_date.unit_type_id,\n view_recommandation_due_date.unit_name,\n view_recommandation_due_date.tndr_open_date,\n view_recommandation_due_date.ho_date,\n view_recommandation_due_date.date_of_doc_ho,\n view_recommandation_due_date.tec_due_date,\n view_recommandation_due_date.received_tec_date,\n view_recommandation_due_date.forward_tec_date,\n view_recommandation_due_date.recomma_due_date\n FROM\n view_recommandation_due_date\n WHERE recomma_due_date BETWEEN '$cDate' AND '$lWeek'\n \";\n $query_result = $this->mDbm->setData($query);\n return $query_result;\n }",
"function getAllPastPupilMethodInforChild($method_id){\n $link = getConnection();\n\n $sql = \"SELECT TIMESTAMPDIFF(year,student_school.registered_date,student_school.leaving_date) AS num_of_years_studied ,COUNT(non_acadamic.non_acadamic_id) AS count_non_acadamic,acadamic.ordinary_level,acadamic.advanced_level,past_pupil_method.confirm FROM past_pupil_method,acadamic,non_acadamic,student_school,student,achievement WHERE student.student_id=past_pupil_method.student_id AND student_school.student_id=student.student_id AND achievement.student_id=student_school.student_id AND acadamic.achievement_id=achievement.achievement_id AND non_acadamic.achievement_id=achievement.achievement_id AND past_pupil_method.method_id='\" . $method_id . \"'\";\n $resultset = mysqli_query($link, $sql);\n mysqli_close($link);\n return $resultset;\n}",
"private function getWeekDays()\n {\n $time = date('Y-m-d', strtotime($this->year . '-' . $this->month . '-' . $this->day));\n if ($this->view == 'week') {\n $sunday = strtotime('last sunday', strtotime($time . ' +1day'));\n $day = date('j', $sunday);\n $startingDay = date('N', $sunday);\n $cnt = 6;\n }\n if ($this->view == 'day') {\n $day = $this->day;\n $cnt = 0;\n }\n\n $this->week_days = array();\n $mlen = $this->daysMonth[intval($this->month) - 1];\n if ($this->month == 2 && ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0)))) {\n $mlen = $mlen + 1;\n }\n $h = \"<tr class='\" . $this->labelsClass . \"'>\";\n $h .= \"<td> </td>\";\n for ($j = 0; $j <= $cnt; $j++) {\n $cs = $cnt == 0 ? 3 : 1;\n $h .= \"<td colspan='$cs'>\";\n if ($this->view == 'day') {\n $getDayNumber = date('w', strtotime($time));\n } else {\n $getDayNumber = $j;\n }\n if ($day <= $mlen) {\n } else {\n $day = 1;\n }\n $h .= $this->dayLabels[$getDayNumber] . ' ';\n $h .= intval($day);\n $this->week_days[] = $day;\n $day++;\n $h .= \"</td>\";\n }\n\n $h .= \"</tr>\";\n return $h;\n }",
"function get_delivery_date_withing_week_page($cDate,$lWeek){\n $query = \"\n SELECT\n view_delivery_dates.mgo_file_ref,\n view_delivery_dates.dos_file_ref,\n view_delivery_dates.vote_id,\n view_delivery_dates.vote_head,\n view_delivery_dates.vote_name,\n view_delivery_dates.item_id,\n view_delivery_dates.item_code,\n view_delivery_dates.item_name,\n view_delivery_dates.quantity,\n view_delivery_dates.unit_type_id,\n view_delivery_dates.unit_name,\n view_delivery_dates.tndr_open_date,\n view_delivery_dates.ho_date,\n view_delivery_dates.date_of_doc_ho,\n view_delivery_dates.tec_due_date,\n view_delivery_dates.received_tec_date,\n view_delivery_dates.forward_tec_date,\n view_delivery_dates.recomma_due_date,\n view_delivery_dates.rece_rec_date,\n view_delivery_dates.fwd_tb_date,\n view_delivery_dates.tb_approval_date,\n view_delivery_dates.appd_sup_id,\n view_delivery_dates.supplier_ref,\n view_delivery_dates.supplier_name,\n view_delivery_dates.appd_sup_remarks,\n view_delivery_dates.delivery_date\n FROM\n view_delivery_dates\n WHERE view_delivery_dates.delivery_date BETWEEN '$cDate' AND '$lWeek'\n \";\n $query_result = $this->mDbm->setData($query);\n return $query_result;\n }",
"function oneWeekFollowup($id, $allPatients, \n $sameSite, $days = null) {\n\n $query = $this->getAccessiblePatientsQuery($id, $allPatients, \n\t $sameSite);\n $patients = $this->query($query[0] . $query[1] . ' AND PatientExtension.wtp_status IS NULL AND Patient.eligible_flag <> 0');\n\n $GMT = new DateTimeZone('GMT');\n\n $windowClose = new DateTime('now', $GMT);\n $windowClose->sub(\n new DateInterval('P'. $days .'D'));\n\n $sixDays = new DateInterval('P6D');\n // note that we want to look 14 days after the appt, but since DateTime->add acts on the object, we only need to add 8 more days here.\n $eightDays = new DateInterval('P8D');\n\n //$this->log(__CLASS__ . '.' . __FUNCTION__ . '(), found patients ' . print_r($patients, true), LOG_DEBUG);\n\n // retrieve appts and add to data model\n foreach ($patients as $key => &$patient){\n\n $appt = $this->Appointment->find('first', array(\n 'conditions' => array(\n 'Appointment.patient_id' => $patient['Patient']['id'],\n 'Appointment.datetime < \"' . $windowClose->format(MYSQL_DATETIME_FORMAT) . '\"'\n ),\n 'order' => 'Appointment.datetime DESC',\n 'limit' => '1',\n 'recursive' => -1));\n if ($appt) {\n $timezone = new DateTimeZone(\n parent::getTimeZone($patient['Patient']['id']));\n\n $apptDateTime = new DateTime(\n $appt['Appointment']['datetime'], $GMT);\n\n $apptDateTime->setTimeZone($timezone);\n\n $apptDateTime->add($sixDays);\n $patient['Patient']['window_open'] = $apptDateTime->format('m/d/Y'); \n $apptDateTime->add($eightDays);\n $patient['Patient']['window_close'] = $apptDateTime->format('m/d/Y'); \n $patient['Patient']['appt_dt'] = $appt['Appointment']['datetime'];\n// $this->log(__CLASS__ . '.' . __FUNCTION__ . '(), found past appt for patient id ' . $patient['Patient']['id'], LOG_DEBUG);\n// $this->log(__CLASS__ . '.' . __FUNCTION__ . '(), found upcoming appt for patient id ' . $patient['Patient']['id'] . ': ' . print_r($appt, true), LOG_DEBUG);\n }\n else unset($patients[$key]);\n }\n return $this->afterFind($patients);\n }",
"private function getAssistantUserWeekly($id, $desde, $dateReal)\n\t{\n\t\t\n\t\t$shippings = $this->getPayrollModel()->detailShippingsPayrollByIdUser($id, $desde, $dateReal);\n\t\t//echo \"<pre>\"; print_r($shippings);\n\t\tforeach ($shippings as $row){\n\t\t\tif (!isset($infoShippins[$row['date_shipping']])){\n\t\t\t\tif ($row['type_destination'] == 2){\n\t\t\t\t$infoShippins[$row['date_shipping']] = array(\n\t\t\t\t\t\t'id_shipping' => $row['id_shipping'],\n\t\t\t\t\t\t'date_assistance' => $row['date_shipping'],\n\t\t\t\t\t\t'type_destination' => $row['type_destination'],\n\t\t\t\t\t\t'direct_route' => $row['direct_route'],\n\t\t\t\t\t\t//'name_destination' => $row['name_destination'],\n\t\t\t\t\t\t//'description_destination' => $row['description_destination'],\n\t\t\t\t\t\t'id_user' => $row['id_user'],\n\t\t\t\t);\n\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//echo \"<pre>\"; print_r($infoShippins);\n\t\t$assistanceDays = $this->getPayrollModel()->getAssistantUserWeekly($id, $desde, $dateReal);\n\t\t//echo \"<pre>\"; print_r($assistanceDays);\n\t\t\n\t\t/*foreach ($assistanceDays as $row){\n\t\t\tforeach ($infoShippins as $row2){\n\t\t\t\tif ($row['date_assistance'] == $row2['date_assistance']){\n\t\t\t\t\t//unset($row['date_assistance']);\n\t\t\t\t\t$a[] = array(\n\t\t\t\t\t\t'date_assistance' => $row['date_assistance']\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}*/\n\t\t//echo \"<pre>\"; print_r(array_diff_assoc($infoShippins, $assistanceDays)); \n\t\t//exit;\n\t\t//echo \"<pre>\"; print_r($combinarArreglo);\n\t\t//$arreUnico = $this->arrayUnico($combinarArreglo, \"date_assistance\");\n\t\t//echo \"<pre>\"; print_r($arreUnico); \n\t\t//exit;\n\t\t\n\t\treturn $assistanceDays;\n\t}",
"function get_lessons(){\n\n $sql = \"SELECT * FROM lessons \n\t\tLEFT JOIN submit_deadline ON lessons.id = submit_deadline.lessons_id ORDER BY submit_deadline.due_date ASC\";\n $query = $this->db->query($sql);\n\n return $query;\n\t}",
"public function getOverview($days);",
"function getForWeeksAndDiv($delivery_week, $division_id) {\n return $this->newQuery()->where('division_id', '=', $division_id)\n ->where('delivery_week', 'IN', $delivery_week)\n ->groupBy('division_id,variant_value')\n ->where('delivery_year', '=', date('Y'))\n ->get('variant_value,json_object_agg(delivery_week,delivery_quantity) as byweek,\n\t\t\t\tjson_object_agg(delivery_week,vehicles_delivered_quantity) as byweek_delivered,\n\t\t\t\tsum(delivery_quantity) as delivery_quantity,\n\t\t\t\tsum(delivery_quantity-vehicles_delivered_quantity) as to_deliver_cnt');\n }",
"public function getOnboardUserSteps()\n {\n return $this->select([\n \\DB::raw('DATE_ADD(created_at, INTERVAL(2-DAYOFWEEK(created_at)) DAY) \n AS week_start, \n CONCAT(YEAR(created_at), \"/\", WEEK(created_at)) AS week_name, \n SUM(CASE WHEN onboarding_perentage <= 100 THEN 1 ELSE 0 END) AS Step1, \n SUM(CASE WHEN onboarding_perentage > 0 AND onboarding_perentage <= 100 \n THEN 1 ELSE 0 END) Step2, \n SUM(CASE WHEN onboarding_perentage > 20 AND onboarding_perentage <= 100 \n THEN 1 ELSE 0 END) Step3, \n SUM(CASE WHEN onboarding_perentage > 40 AND onboarding_perentage <= 100 \n THEN 1 ELSE 0 END) Step4, \n SUM(CASE WHEN onboarding_perentage > 50 AND onboarding_perentage <= 100 \n THEN 1 ELSE 0 END) Step5, \n SUM(CASE WHEN onboarding_perentage > 70 AND onboarding_perentage <= 100 \n THEN 1 ELSE 0 END) Step6, \n SUM(CASE WHEN onboarding_perentage > 90 AND onboarding_perentage <= 100 \n THEN 1 ELSE 0 END) Step7, \n SUM(CASE WHEN onboarding_perentage = 100 \n THEN 1 ELSE 0 END) Step8'),\n ])\n ->groupBy('week_name')\n ->orderBy(\\DB::raw('YEAR(created_at)'),'ASC')\n ->orderBy(\\DB::raw('WEEK(created_at)'),'ASC')\n ->get();\n }",
"function getDaysByProgramId($program_id, $columns = array()) {\n $columns = maybeDefaultColumns($columns);\n\n // Get database access\n $db = getDb();\n\n // Prepare statement\n $columns = implode(', ', $columns);\n $qry = 'SELECT ' . $columns . ' FROM day WHERE program_id = :id ORDER BY display_order';\n $stmt = $db->prepare($qry);\n $stmt->bindValue(':id', $program_id, PDO::PARAM_INT);\n $stmt->execute();\n\n // Return the rows\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\n return $rows;\n }",
"function getSportsDays($params = array()){\r\n $seasonID = trim($this->seasonInfo['id']);\r\n if(!$seasonID) {\r\n $this->errorMessage[] = 'SeasonID is not specified';\r\n return array();\r\n }\r\n $leagueID = trim($this->seasonInfo['league_id']);\r\n if(!$leagueID) {\r\n $this->errorMessage[] = 'leagueID is not specified';\r\n return array();\r\n }\r\n if(!is_array($params)) $params = array();\r\n // $this->dbInstance()->queryParams['fields'] = '*';\r\n $this->dbInstance()->queryParams['table'] = 'league_season_sportsday';\r\n\r\n\r\n if(isset($params['scheduledAfter']) && intval($params['scheduledAfter'])){\r\n $scheduledAfter = \"&& (SELECT COUNT(`id`) FROM `league_season_sportsday_game` WHERE `sportsday_id` = `league_season_sportsday`.`id` && `datetime` > \".intval($params['scheduledAfter']).\")\";\r\n }\r\n if(isset($params['scheduledBefore']) && intval($params['scheduledBefore'])){\r\n $scheduledBefore = \"&& (SELECT COUNT(`id`) FROM `league_season_sportsday_game` WHERE `sportsday_id` = `league_season_sportsday`.`id` && `datetime` < \".intval($params['scheduledBefore']).\")\";\r\n }\r\n $this->dbInstance()->queryParams['where'] = \"\r\n `league_id` = :leagueID && \r\n `season_id` = :seasonID \" . \r\n $scheduledAfter . \r\n $scheduledBefore;\r\n\r\n $this->dbInstance()->queryParams['params'] = array(\r\n 'leagueID' => $leagueID,\r\n 'seasonID' => $seasonID\r\n );\r\n \r\n $this->dbInstance()->queryParams['order'] = $this->dbInstance()->calcORDERcondition($params, 'sort', 'DESC');\r\n \r\n // $offset = ($page - 1) * $limit;\r\n $this->dbInstance()->queryParams['limit'] = $this->dbInstance()->calcLIMITcondition($params);\r\n $result = $this->dbInstance()->select();\r\n\r\n if(isset($params['extend'])){\r\n if(!is_array($params['extend'])) $params['extend'] = array($params['extend']);\r\n if(in_array('games', $params['extend'])){\r\n foreach ($result as $key => $value) {\r\n $result[$key]['games'] = $this->getSportsDayGames(\r\n $result[$key]['id'], \r\n array(\r\n 'scheduledAfter'=>$params['scheduledAfter'],\r\n 'scheduledBefore'=>$params['scheduledBefore']\r\n )\r\n );\r\n }\r\n }\r\n }\r\n\r\n return $result;\r\n }",
"public function run()\n {\n DB::table('sick_days')->insert([\n 'staff_id' => '3',\n 'sick_hours' => '4',\n 'description' => 'Puked',\n 'sick_from' => '2017-02-24',\n 'sick_to' => '2017-02-24',\n 'deducted' => '1',\n 'created_at' => '2017-02-23',\n 'updated_at' => '2017-02-23',\n ]);\n \n DB::table('sick_days')->insert([\n 'staff_id' => '4',\n 'sick_hours' => '8',\n 'description' => 'Had the shits',\n 'sick_from' => '2017-02-22',\n 'sick_to' => '2017-02-22',\n 'deducted' => '0',\n 'created_at' => '2017-02-23',\n 'updated_at' => '2017-02-23',\n ]);\n \n DB::table('sick_days')->insert([\n 'staff_id' => '5',\n 'sick_hours' => '16',\n 'description' => 'Bad cold',\n 'sick_from' => '2017-02-22',\n 'sick_to' => '2017-02-23',\n 'deducted' => '0',\n 'created_at' => '2017-02-23',\n 'updated_at' => '2017-02-23',\n ]);\n \n DB::table('sick_days')->insert([\n 'staff_id' => '6',\n 'sick_hours' => '2',\n 'description' => 'Went home early poorly',\n 'sick_from' => '2017-02-23',\n 'sick_to' => '2017-02-23',\n 'deducted' => '1',\n 'created_at' => '2017-02-23',\n 'updated_at' => '2017-02-23',\n ]);\n \n DB::table('sick_days')->insert([\n 'staff_id' => '4',\n 'sick_hours' => '32',\n 'description' => 'Aids',\n 'sick_from' => '2017-02-20',\n 'sick_to' => '2017-02-23',\n 'deducted' => '1',\n 'created_at' => '2017-02-23',\n 'updated_at' => '2017-02-23',\n ]);\n \n DB::table('sick_days')->insert([\n 'staff_id' => '5',\n 'sick_hours' => '4',\n 'description' => 'Fainted on the shop floor',\n 'sick_from' => '2017-02-24',\n 'sick_to' => '2017-02-24',\n 'deducted' => '0',\n 'created_at' => '2017-02-23',\n 'updated_at' => '2017-02-23',\n ]);\n \n DB::table('sick_days')->insert([\n 'staff_id' => '6',\n 'sick_hours' => '16',\n 'description' => 'Pink eye',\n 'sick_from' => '2017-02-25',\n 'sick_to' => '2017-02-26',\n 'deducted' => '0',\n 'created_at' => '2017-02-23',\n 'updated_at' => '2017-02-23',\n ]);\n }"
]
| [
"0.5398016",
"0.51518804",
"0.51193",
"0.51106805",
"0.5083604",
"0.50532645",
"0.5014818",
"0.4999596",
"0.49919367",
"0.49727476",
"0.4922723",
"0.48806688",
"0.48762652",
"0.48626813",
"0.4861328",
"0.48139325",
"0.4806842",
"0.47906253",
"0.47711036",
"0.47431085",
"0.47422165",
"0.47398847",
"0.47386065",
"0.4737025",
"0.47302368",
"0.47140586",
"0.46889964",
"0.4686201",
"0.46845663",
"0.4679613"
]
| 0.56650126 | 0 |
/ The index displays various showroom views based on the url and routes as necessary This is for nonajax requests. _ajax handles ajax routing. expects parent showroom table object define the params position format: 0: category navigation main view 0 = off full flat url formats: categories: mysite.com/page_name/cat_id/category/nsubcat/n2subcat items: mysite.com/page_name/item_id/itemurlname | public function _index($showroom, $sub_tool=FALSE)
{
$url_array = uri::url_array();
list($page_name, $first_node, $item) = $url_array;
$page_name = $this->get_page_name($page_name, 'showroom', $showroom->id);
# parse the params.
$params = explode('|',$showroom->params);
$primary = new View("public_showroom/display/wrapper");
# what is the url asking for?
if('get' == $url_array['0'] OR (empty($first_node)))
{
# if empty, display default category
$primary->items = (empty($showroom->home_cat))
? '(Home Category not set)'
: self::items_category($page_name, $showroom, (int) $showroom->home_cat);
}
elseif(is_numeric($first_node))
{
if('0' == substr($first_node, 0, 1))
$primary->item = self::item($page_name, $first_node, $item);
else
$primary->items = self::items_category($page_name, $showroom, $first_node);
}
else
Event::run('system.404');
# determine the category to highlight.
$first_node = (empty($first_node))
? $showroom->home_cat
: $first_node;
# how do we show the category list on every showroom page?
$category_list = '';
if(!empty($params[0]))
{
if('flat' == $params[0])
{
# showing only root categories.
$root_cats = ORM::factory('showroom_cat')
->where(array(
'fk_site' => $this->site_id,
'showroom_id' => $showroom->id,
'local_parent' => $showroom->root_id,
))
->orderby(array('lft' => 'asc'))
->find_all();
$category_list = Tree::display_flat_tree('showroom', $root_cats, $page_name, $first_node);
}
else
$category_list = Tree::display_tree('showroom', $showroom->showroom_cats, $page_name, $first_node);
}
$primary->categories = $category_list;
# add custom javascript;
$primary->global_readyJS(self::javascripts($showroom));
# admin js hack.
if($this->client->can_edit($this->site_id))
$primary->global_readyJS('
$("#click_hook").click(function(){
$().add_toolkit_items("showroom");
});
');
return $this->wrap_tool($primary, 'showroom', $showroom);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function indexShowSet()\n {\n $navid = I('get.nav') ? I('get.nav') : 0;\n $pid = M('admin_nav')->where('id=' . $navid)->find()['pid'];\n $navpname = M('admin_nav')->where('id=' . $pid)->find()['name'];\n $navname = M('admin_nav')->where('id=' . $navid)->find()['name'];\n $re = M('category')->where('navid=' . $navid)->select();\n $arr = array();\n foreach ($re as $k => $v) {\n $arr[] = $v['id'];\n }\n $where['cateid'] = array('in', $arr);\n $where['status'] = 1;\n $data = M('ziliao')->where($where)->order('order_number')->select();\n $assign = array(\n 'data' => $data,\n 'navname' => $navname,\n 'navpname' => $navpname,\n );\n // var_dump($data);die;\n $this->assign($assign);\n $this->display();\n\n }",
"public function index () {\n\t\tif(isset($_GET['msg'])) { $this->data['msg'] = htmlentities($_GET['msg']); }\n\n\t\t$include_views = array('banner','sidebar-left','lineup','sidebar-right');\n\t\t$data_view = 'grid';\n\t\t$path = '';\n\n\t\t// Grab an unknown number of arguments\n\t\t$args = func_get_args();\n\n\t // Home page featured line-up TODO: needs refactoring, create private function.\n\t if(count($args) == 0){\n\t $homeNode = $this->nav->get_home_node();\n\t\t\t$collection = $this->videos->get_lineups(url_title($homeNode->name),$homeNode->lineupids);\n\n\t\t\t$this->data['path'] = $path;\t\t\t\n\t\t\t$this->data['tags'] = $homeNode->tags;\t\t\t\n\n\t\t\tif($homeNode->cobrandId != \"\") $this->data['cobrand_id'] = $homeNode->cobrandId;\n\t\t\tif($homeNode->adSnip != \"\") $this->data['ad_snip'] = base64_decode($homeNode->adSnip);\n\t\t\t\n\t\t\tif($homeNode->brandingBg != \"\") $this->data['branding_bg'] = $homeNode->brandingBg;\n\t\t\tif($homeNode->brandingBgLink != \"\") $this->data['branding_bg_link'] = $homeNode->brandingBgLink;\n\t\t\tif($homeNode->brandingBgColor != \"\") $this->data['branding_bg_color'] = $homeNode->brandingBgColor;\n\t\t\t\n\t\t\tif($homeNode->customHtmlBanner != \"\") $this->data['custom_html_banner'] = base64_decode($homeNode->customHtmlBanner);\n\t\t\tif($homeNode->customHtmlContent1 != \"\") $this->data['custom_html_content_1'] = base64_decode($homeNode->customHtmlContent1);\n\t\t\tif($homeNode->customHtmlContent2 != \"\") $this->data['custom_html_content_2'] = base64_decode($homeNode->customHtmlContent2);\n\t\t\tif($homeNode->customHtmlContent3 != \"\") $this->data['custom_html_content_3'] = base64_decode($homeNode->customHtmlContent3);\n\t\t\tif($homeNode->customHtmlContent4 != \"\") $this->data['custom_html_content_4'] = base64_decode($homeNode->customHtmlContent4);\n\t\t\t\n\t\t\t$this->data['show_count'] = $homeNode->counts == \"1\" ? true : false;\n\t\t\t$this->data['show_newest'] = $homeNode->newText == \"1\" ? true : false;\n\t\t\t// Check if specific slider url is set for top level nav, if so, override value set in lang file\n\t\t\tif(isset($homeNode->imageSlider)) {\n\t\t\t\tif(strlen($homeNode->imageSlider) > 0) { $this->data['image_slider'] = $homeNode->imageSlider; }\n\t\t\t}\n\t\t\t\n\t\t\t// Check the power-vertical for a custom player ID, else load player id from lang file\n\t\t\tif(isset($homeNode->playerID)) {\n\t\t\t\tif(strlen($homeNode->playerID) > 0) {\n\t\t\t\t\t$this->config->set_item('bc-player-id',$homeNode->playerID);\n\t\t\t\t} else {\n\t\t\t\t\t$this->config->set_item('bc-player-id',lang('bc-player-id'));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check the power-vertical for a custom player Key, else load player id from lang file\n\t\t\tif(isset($homeNode->playerKey)) {\n\t\t\t\tif(strlen($homeNode->playerKey) > 0) {\n\t\t\t\t\t$this->config->set_item('bc-player-key',$homeNode->playerKey);\n\t\t\t\t} else {\n\t\t\t\t\t$this->config->set_item('bc-player-key',lang('bc-player-key'));\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tforeach ($collection as $lineup) {\n\t\t\t\tforeach ($lineup->videos as $video) {\n\t\t\t\t $lineupCategoryUri = $this->nav->get_category_uri_for_lineup_playlist($lineup->id);\n\t\t\t\t if($lineupCategoryUri != null)\n\t\t\t\t {\n\t\t\t\t $video->uri = str_replace('/watch/','/' . $lineupCategoryUri . 'watch/', $video->uri);\n\t\t\t\t }\n\t\t\t\t else\n\t\t\t\t {\n\t\t\t\t $video->uri = str_replace('/watch/','/' . url_title($homeNode->name) . '/watch/', $video->uri);\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t}\n $this->data['lineups'] = $collection;\n\t }\n\n\t\t//This is only executed when a category in the nav bar is selected and it is used to generate the Featured Lineups.\n if (count($args) == 1) {\n $playlist_ids = $this->nav->get_playlist_id_by_category($args[0]);\n\t\t\tif($playlist_ids != null) {\n\t $topLevelLineups = $this->videos->get_lineups($args[0],$playlist_ids);\n \t\t\tforeach ($topLevelLineups as $lineup) {\n \t\t\t\tforeach ($lineup->videos as $video) {\n \t\t\t\t $lineupCategoryUri = $this->nav->get_category_uri_for_lineup_playlist($lineup->id);\n \t\t\t\t if($lineupCategoryUri != null)\n \t\t\t\t {\n \t\t\t\t $video->uri = str_replace('/' . $args[0] . '/watch/','/' . $lineupCategoryUri . 'watch/', $video->uri);\n \t\t\t\t }\n \t\t\t\t}\n \t\t\t}\n\t $this->data['lineups'] = $topLevelLineups;\n\t\t\t\t$data_view = 'lineup';\n\t\t\t}\n }\n\n\t\t// Retrieves Featured Providers configurantion from the language specific config file.\n\t\t$this->data['featuredproviders'] = lang('featured_providers');\n\n\t\t// Default to all videos if we don't have a valid subview\n\t\tif (count($args)) {\n\n\t\t\t// Always grab first top-node settings\n\t\t\t$top_node = call_user_func_array(array($this->nav, 'seek'), array($args[0]));\n\n\t\t\t// Take any number of arguments for varying path depth and call the nav seek method\n\t\t\t$node = call_user_func_array(array($this->nav, 'seek'), $args);\n\n\t\t\t// Build path based on active section\t\t\n\t\t\tforeach($args as $seg) {\n\t\t\t\tif(strlen($path) > 0) $path .= '/';\n\t\t\t\t$path .= $seg;\n\t\t\t}\n\t\t\t$this->data['path'] = $path;\t\t\t\n\t\t\t$this->data['tags'] = $node->tags;\t\t\t\n\n\t\t\t// Set cobrandid in order of lang file > top node > current node\n\t\t\tif($top_node->cobrandId != \"\") $this->data['cobrand_id'] = $top_node->cobrandId;\n\t\t\tif($node->cobrandId != \"\") $this->data['cobrand_id'] = $node->cobrandId;\n\n\t\t\t// Set ad-snip in order of lang file > top node > current node\n\t\t\tif($top_node->adSnip != \"\") $this->data['ad_snip'] = base64_decode($top_node->adSnip);\n\t\t\tif($node->adSnip != \"\") $this->data['ad_snip'] = base64_decode($node->adSnip);\n\t\t\t\n\t\t\tif($top_node->brandingBg != \"\") $this->data['branding_bg'] = $top_node->brandingBg;\n\t\t\tif($node->brandingBg != \"\") $this->data['branding_bg'] = $node->brandingBg;\n\t\t\tif($top_node->brandingBgLink != \"\") $this->data['branding_bg_link'] = $top_node->brandingBgLink;\n\t\t\tif($node->brandingBgLink != \"\") $this->data['branding_bg_link'] = $node->brandingBgLink;\n\t\t\tif($top_node->brandingBgColor != \"\") $this->data['branding_bg_color'] = $top_node->brandingBgColor;\n\t\t\tif($node->brandingBgColor != \"\") $this->data['branding_bg_color'] = $node->brandingBgColor;\n\t\t\t\n\t\t\tif($top_node->customHtmlBanner != \"\") $this->data['custom_html_banner'] = base64_decode($top_node->customHtmlBanner);\n\t\t\tif($node->customHtmlBanner != \"\") $this->data['custom_html_banner'] = base64_decode($node->customHtmlBanner);\n\t\t\tif($top_node->customHtmlContent1 != \"\") $this->data['custom_html_content_1'] = base64_decode($top_node->customHtmlContent1);\n\t\t\tif($node->customHtmlContent1 != \"\") $this->data['custom_html_content_1'] = base64_decode($node->customHtmlContent1);\n\t\t\tif($top_node->customHtmlContent2 != \"\") $this->data['custom_html_content_2'] = base64_decode($top_node->customHtmlContent2);\n\t\t\tif($node->customHtmlContent2 != \"\") $this->data['custom_html_content_2'] = base64_decode($node->customHtmlContent2);\n\t\t\tif($top_node->customHtmlContent3 != \"\") $this->data['custom_html_content_3'] = base64_decode($top_node->customHtmlContent3);\n\t\t\tif($node->customHtmlContent3 != \"\") $this->data['custom_html_content_3'] = base64_decode($node->customHtmlContent3);\n\t\t\tif($top_node->customHtmlContent4 != \"\") $this->data['custom_html_content_4'] = base64_decode($top_node->customHtmlContent4);\n\t\t\tif($node->customHtmlContent4 != \"\") $this->data['custom_html_content_4'] = base64_decode($node->customHtmlContent4);\n\t\t\t\n\t\t\t// Set show count and show newest setting from top-node\n\t\t\t$this->data['show_count'] = $top_node->counts == \"1\" ? true : false;\n\t\t\t$this->data['show_newest'] = $top_node->newText == \"1\" ? true : false;\n\n\t\t\t// Set show count and show newest setting from top-node\n\t\t\tif($node->counts != \"\") {\n\t\t\t\tif($node->counts == \"0\")\n\t\t\t\t\t$this->data['show_count'] = false;\n\t\t\t\telse if($node->counts == \"1\")\n\t\t\t\t\t$this->data['show_count'] = true;\n\t\t\t}\n\t\t\tif($node->newText != \"\") {\n\t\t\t\tif($node->newText == \"0\")\n\t\t\t\t\t$this->data['show_newest'] = false;\n\t\t\t\telse if($node->newText == \"1\")\n\t\t\t\t\t$this->data['show_newest'] = true;\n\t\t\t}\n\n\t\t\t// Always pull the top power vertical and get the list of providers from that vertical\n\t\t\tif(isset($top_node->providers)) {\n\t\t\t\t$this->data['providers_list'] = explode(',',$top_node->providers);\n\t\t\t}\n\n\t\t\t// Check if specific slider url is set for top level nav, if so, override value set in lang file\n\t\t\tif(isset($top_node->imageSlider)) {\n\t\t\t\tif(strlen($top_node->imageSlider) > 0) { $this->data['image_slider'] = $top_node->imageSlider; }\n\t\t\t}\n\n\t\t\t// Check the power-vertical for a custom player ID, else load player id from lang file\n\t\t\tif(isset($top_node->playerID)) {\n\t\t\t\tif(strlen($top_node->playerID) > 0) {\n\t\t\t\t\t$this->config->set_item('bc-player-id',$top_node->playerID);\n\t\t\t\t} else {\n\t\t\t\t\t$this->config->set_item('bc-player-id',lang('bc-player-id'));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check the power-vertical for a custom player Key, else load player id from lang file\n\t\t\tif(isset($top_node->playerKey)) {\n\t\t\t\tif(strlen($top_node->playerKey) > 0) {\n\t\t\t\t\t$this->config->set_item('bc-player-key',$top_node->playerKey);\n\t\t\t\t} else {\n\t\t\t\t\t$this->config->set_item('bc-player-key',lang('bc-player-key'));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check and set playerID and playerKey for 2nd and 3rd level categories if they exist\n\t\t\tif(isset($node->playerID)) {\n\t\t\t\tif(strlen($node->playerID) > 0) {\n\t\t\t\t\t$this->config->set_item('bc-player-id',$node->playerID);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(isset($node->playerKey)) {\n\t\t\t\tif(strlen($node->playerKey) > 0) {\n\t\t\t\t\t$this->config->set_item('bc-player-key',$node->playerKey);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Take user to generic 404 page of uri is not valid\n if($node == null) {\n \t redirect($this->data['base_url'] . '?msg=' . lang('error-404'), 'refresh');\n \t}\n\n\t\t\t// Grid title left of sorting/filters\n\t\t\t$this->data['grid_title'] = ($node->name);\n\n\t\t\t// Passing this along to videos model for usage there\n\t\t\t$this->videos->set('nav_node', $node);\n\n\t\t\t// Override sort by with default for category if sort by doesn't exist in URL\n\t\t\tif(isset($_GET['sort'])) {\n\t\t\t\t$this->config->set_item('sort',$_GET['sort']);\n\t\t\t\t$this->data['sort_display'] = $this->nav->get_sort_display();\n\t\t\t} else if (isset($node->defaultSort)) {\n\t\t\t\tif(strlen($node->defaultSort) > 0) {\n\t\t\t\t\t$this->config->set_item('sort',$node->defaultSort);\n\t\t\t\t\t$this->data['sort_display'] = $this->nav->get_sort_display();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set some default orders based on sort type\n\t\t\tif($this->config->item('sort') == \"name\") { $this->config->set_item('order', 'asc'); }\n\t\t\tif($this->config->item('sort') == \"date\") { $this->config->set_item('order', 'desc'); }\n\n\t\t\t// Override sort order with default for category only if explicit sort not defined\n\t\t\tif($node->defaultOrder != null && !isset($_GET['sort'])) {\n\t\t\t\t$this->config->set_item('order',$node->defaultOrder);\n\t\t\t}\n\n\t\t\t// This will store the tag set that we want to ask the API for\n\t\t\t$query = explode(',', $node->tags);\n\t\t\tarray_walk($query, array($this, 'map_tags'));\n\t\t\t$collection = $this->videos->search_by_tags($query);\n\t\t\t$this->data['videos'] = $collection->videos;\n\t\t\t$this->data['total_count'] = $collection->total_count;\n\n\t\t\t// Load recent videos\n\t\t\t$recent_query = explode(',', $top_node->tags);\n\t\t\tarray_walk($recent_query, array($this, 'map_tags'));\n\t\t\t$recent_collection = $this->videos->search_by_tags($recent_query);\n\t\t\t$this->data['recent_videos'] = $recent_collection->videos; \n\t\t\t$this->data['recent_total_count'] = $recent_collection->total_count;\n\n\t\t\t// Load popular videos\n\t\t\t$collection = $this->videos->get_popular_videos($query);\n\t\t\t$this->data['popular_videos'] = $collection->videos;\n\n\t\t\t// Append to the page title\n\t\t\t$this->data['title'] .= lang('title-separator') . $node->name;\n\n\t\t\t$include_views = array('banner','sidebar-left',$data_view,'sidebar-right');\n\n\t\t\t// If looking at 2nd or 3rd level of navigation, auto display first video\n\t\t\tif (count($args) > 1) \n\t\t\t{\t\t\t\t\n\t\t\t\t// Get the specific video's details\n\t\t\t\t$this->data['video'] = $collection->videos[0];\n\t\t\t\t\n\t\t\t\t$this->data['rating'] = null;\n\t\t\t\t$this->data['related-videos'] = null;\n\t\t\t\tif($this->data['video'] != null) \n\t\t\t\t{\n\t\t\t\t\t// Get comments for video\n\t\t\t\t\t$this->data['comments'] = $this->comments->get($this->data['video']->id, 0, $this->config->item('comment-size'));\n\t\t\t\t\tif($this->data['comments'] != null) $this->data['comments_cnt'] = sizeof($this->data['comments']);\n\t\t\t\t\t// Get rating value\n\t\t\t\t\t$this->data['rating'] = $this->ratings->get($this->data['video']->id);\n\t\t\t\t\t// Get related videos\n\t\t\t\t\t$collection = $this->videos->get_related_videos($this->data['video']->id);\n\t\t\t\t\t$this->data['related_videos'] = $collection->videos;\n\t\t\t\t\t// set scroll pagination for related videos\n\t\t\t\t\t$this->data['scroll_links_related'] = $this->nav->get_scroll_bullets(sizeof($this->data['related_videos']), 'related videos');\n\t\t\t\t}\n\t\t\t\t$include_views = array('video-details','sidebar-left',$data_view,'sidebar-right');\n\t\t\t}\t\t\t\n\n\t\t} else {\n\n\t\t\t// get all videos\n\t\t\t$collection = $this->videos->get_all();\n\t\t\t$this->data['videos'] = $collection->videos;\n\t\t\t$this->data['total_count'] = $collection->total_count;\n\t\t\t$this->data['recent_videos'] = $collection->videos; \n\n\t\t\t// Load popular videos\n\t\t\t$collection = $this->videos->get_all_popular();\n\t\t\t$this->data['popular_videos'] = $collection->videos;\n\n\t\t}\n\n\t\t// set scroll pagination for up next, substract one because the current video is not display in \"up next\"\n\t\t$this->data['scroll_links_upnext'] = $this->nav->get_scroll_bullets(sizeof($this->data['videos'])-1, 'up next');\n\n\t\t// set scroll pagination for popular videos\n\t\t$this->data['scroll_links_popular'] = $this->nav->get_scroll_bullets(sizeof($this->data['popular_videos']), 'popular videos');\n\n\t\t// set scroll pagination for recent videos\n\t\t$this->data['scroll_links_recent'] = $this->nav->get_scroll_bullets(sizeof($this->data['videos']), 'recent videos');\n\n\t\t// build pagination\n\t\t$this->pagination->set($this->config->item('page')-1, $this->config->item('sort'), $this->config->item('filter'), '', $this->data['total_count'], $this->data['base_url'] . $this->uri->uri_string());\n\t\t$pagination_data = '<div class=\"bar bc_pagination\">';\n\t\t$pagination_data .= str_replace('#/','',$this->pagination->create_links());\n\t\t$pagination_data .= $this->nav->get_pagination_summary($this->config->item('page'), $this->data['total_count']);\n\t\t$pagination_data .= '</div>';\n\t\t$this->data['pagination'] = $pagination_data;\n\n\t\t// Use the first video as the featured video (this will change depending on how featured content is handled)\n\t\tif(count($args) > 0) {\n\t\t\t$this->data['video'] = isset($this->data['videos'][0]) ? $this->data['videos'][0] : null;\n\n\t\t\tif($this->data['video'] != null) \n\t\t\t{\n\t\t\t\t$this->data['active_video_id'] = $this->data['video']->id;\n\t\t\t\t// Get comments for video\n\t\t\t\t$this->data['comments'] = $this->comments->get($this->data['video']->id, 0, $this->config->item('comment-size'));\n\t\t\t\tif($this->data['comments'] != null) $this->data['comments_cnt'] = sizeof($this->data['comments']);\n\t\t\t\t// Get rating value\n\t\t\t\t$this->data['rating'] = $this->ratings->get($this->data['video']->id); \n\t\t\t}\n\t\t}\n\n\t\t// Don't want to include views if we're reusing code\n\t\tif (!$this->skip) {\n\n\t\t\t// Get the breadcrumbs created during the index lookup\n\t\t\t$this->data['breadcrumbs'] = $this->nav->make_breadcrumbs();\n\n\t\t\t// Set breadcrumb display\n\t\t\t$this->data['breadcrumb_display'] = $this->nav->breadcrumbs_display_text($this->data['breadcrumbs']);\n\n\t\t\t$this->loadViews($include_views, $this->data);\n\n\t\t}\n\n\t}",
"public function index() {\n\n\n $uri = $this->uri->segment(1);\n \n $all_data = $this->Seatmodel->load_all_data();\n \n $this->data = array();\n $this->data['uri'] = $uri;\n $this->data['all_data'] = $all_data;\n\n \n $this->middle = 'seats/admin/list';\n $this->admin_layout();\n }",
"public function indexAction() {\n\t\t// TODO Auto-generated IndexController::indexAction() default action\n\t\t//Zend_Debug::dump($this->_request->getParams(), 'request params');\n\t\t$ajaxParams = array('parentCat' => 'ajaxedDefault', 'childCat' => 'ajaxedDefault', 'page' => 0);\n\t\t$defaults = array('parentCat' => 'default', 'childCat' => 'default', 'page' => 0);\n\t\tif($this->menu == null) {\n\t\t throw new Zend_Controller_Action_Exception('Under Construction', 503);\n\t\t}\n\n\t\tswitch($this->isAjax()) {\n\t\t\tcase true :\n\n\t\t\t\t$parentSelect = $this->menu->select()->where('parentId = ?', 0);\n\t\t\t\t$parents = $this->menu->findDependentRowset('Menu_Model_Category', 'MenuCats', $parentSelect);\n\t\t\t\tif(count($parents)) {\n\t\t\t\t $defaults['parentCat'] = $parents[0]->name;\n\t\t\t\t}\n $selectedParent = $this->cats->fetchCatByName($this->_request->parentCat, false, false);\n\t\t\t\t$childSelect = $this->menu->select()->where('parentId = ?', $selectedParent->id);\n\t\t\t\t$children = $this->menu->findDependentRowset('Menu_Model_Category', 'MenuCats', $childSelect);\n\t\t\t\tif(count($children)) {\n\t\t\t\t $defaults['childCat'] = $children[0]->name;\n\t\t\t\t}\n\t\t\t\t$this->view->urlOptions = $this->_request->getParams();\n\t\t\t\t$data = $this->cats->fetchCatByName($this->_request->childCat, true, true, 2, $this->_request->page);\n\t\t\t\t$ajaxParams = $this->_request->getParams();\n\t\t\t\tbreak;\n\n\t\t\tcase false :\n\n\t\t\t\t$parentSelect = $this->menu->select()->where('parentId = ?', 0);\n\t\t\t\t$parents = $this->menu->findDependentRowset('Menu_Model_Category', 'MenuCats', $parentSelect);\n\t\t\t\t$selectedParent = $this->cats->fetchCatByName(($this->_request->parentCat === 'none') ? $parents[0]->name : $this->_request->parentCat, false, false);\n\n\t\t\t\t$childSelect = $this->menu->select()->where('parentId = ?', $selectedParent->id);\n\t\t\t\t$children = $this->menu->findDependentRowset('Menu_Model_Category', 'MenuCats', $childSelect);\n\n\t\t\t\t$this->view->urlOptions = array_intersect_key(\n\t\t\t\t $this->_request->getParams(),\n\t\t\t\t array(\n\t\t\t\t 'parentCat' => ($this->_request->parentCat === 'none') ? $parents[0]->name : $this->_request->parentCat,\n\t\t\t\t 'childCat' => ($this->_request->childCat === 'none') ? $children[0]->name : $this->_request->childCat\n\t\t\t\t )\n\t\t\t\t );\n\t\t\t\t$data = $this->cats->fetchCatByName( ($this->_request->childCat === 'none') ? $children[0]->name : $this->_request->childCat, true, true, 2, $this->_request->page);\n\n\t\t\t\tbreak;\n\t\t}\n\n\n\n\t\t//$this->view->urlOptions = array_merge($this->_request->getParams(), $defaults, $ajaxParams);\n\t\t$mContainer = new Zend_Navigation();\n\n\n\t\t$index = count($parents);\n\t\tfor ($i = 0; $i < $index; $i++) {\n\t\t\t$pages[] = array(\n\t\t\t\t\t 'label' => strtoupper($parents[$i]->name),\n\t\t\t\t\t 'route' => 'menu_index',\n\t\t \t 'action' => 'index',\n\t\t\t\t\t 'controller' => 'index',\n\t\t\t\t\t 'module' => 'menu',\n\t\t\t\t\t //'active' => $i === 0 ? true : false,\n\t\t\t\t\t 'params' => array(\n\t\t\t\t\t 'parentCat' => $parents[$i]->name,\n\t\t\t\t\t 'childCat' => 'none',\n\t\t\t\t\t 'format' => 'html',\n\t\t\t\t\t 'page' => 1\n\t\t\t\t\t )\n\t\t );\n\t\t}\n\n\t\t$mContainer->addPages($pages);\n\t\t$this->view->parentNavContainer = $mContainer;\n\n\t\t$this->view->parents = $parents;\n\t\t$this->view->children = $children;\n\t\t$this->view->data = $data;\n\t}",
"public function index()\n\t{\n\t\t$vdata['roomtypes']=array();\n\n\t\t$tbl=$this->session->userdata('prefix').'roomtypes';\n\t\t// get the db tables list\n\t\t$tableList=getTables(); // define in custom helper\n\t\t// check if the tbl exist in db \n\t\tif(in_array($tbl, $tableList)){ \n\t\t\t$vdata['roomtypes']=$this->Common_model->select_fields($tbl, '*', FALSE, 'room_type');\n\t\t}\n\t\t$tbl=$this->session->userdata('prefix').'location';\n\t\tif(in_array($tbl, $tableList)){\n\t\t\t$vdata['locations']=$this->Common_model->select($tbl);\n\t\t} \n\t\t$this->show_front('roomtype/roomtypes', $vdata);\n\t}",
"function index()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\t$data['area'] = !empty($data['a'])? $data['a']: 'procurement_plans';\n\t\t$this->native_session->delete('__view');\n\t\t\n\t\t$data['list'] = $this->get_list_to_show($data['area']);\n\t\t$data['folder'] = $this->get_section_folder($data['area']);\n\t\t$this->load->view('tenders/home', $data);\n\t}",
"function _show_index($handler_id, &$data)\n {\n midcom_show_style('events-header');\n midcom_show_style('index-header');\n midcom_show_style('trips-header');\n foreach ($this->_trips as $trip) {\n if (! $this->_request_data['datamanager']->autoset_storage($trip))\n {\n debug_push_class(__CLASS__, __FUNCTION__);\n debug_add(\"The datamanager for trip {$trip->id} could not be initialized, skipping it.\");\n debug_print_r('Object was:', $trip);\n debug_pop();\n continue;\n }\n $this->_request_data['view_trip'] = $data['datamanager']->get_content_html();\n $this->_request_data['trip'] = $trip;\n midcom_show_style('trips-item');\n }\n midcom_show_style('trips-footer');\n midcom_show_style('meetings-header');\n foreach ($this->_meetings as $meeting) {\n if (! $this->_request_data['datamanager']->autoset_storage($meeting))\n {\n debug_push_class(__CLASS__, __FUNCTION__);\n debug_add(\"The datamanager for meeting {$meeting->id} could not be initialized, skipping it.\");\n debug_print_r('Object was:', $trip);\n debug_pop();\n continue;\n }\n $this->_request_data['view_meeting'] = $data['datamanager']->get_content_html();\n $this->_request_data['meeting'] = $meeting;\n midcom_show_style('meetings-item');\n }\n midcom_show_style('meetings-footer');\n midcom_show_style('index-footer');\n midcom_show_style('events-footer');\n }",
"function Index($f3,$params) {\n $db_show = new DB\\SQL\\Mapper($f3->get('DB'), 'shows');\n // virtual fields for some additional metadata\n $db_show->episode_count = 'SELECT count(*) FROM episodes WHERE episodes.show_id = shows.show_id';\n $db_show->category_name = 'SELECT category_name FROM categories WHERE categories.category_id = shows.category_id';\n $db_show->category_group = 'SELECT category_group FROM categories WHERE categories.category_id = shows.category_id';\n\n // get data for display from the database\n $f3->set('shows', $db_show->find(\n array('active IS TRUE'), // filter\n array('order' => 'title') // sorting\n ));\n\n $this->RenderPage('show/index.htm', 'Shows', 'Show Directory');\n }",
"public function load_admin_page() {\n\t \t\n\t\t// determine the action from either the GET parameter (for sub-menu entries, and the main admin menu entry)\n\t\t$action = ( ! empty( $_GET['action'] ) ) ? $_GET['action'] : 'list'; // default action is list\n\t\t\n\t\tif ( $this->is_top_level_page ) {\n\t\t\t// or for sub-menu entry of an admin menu \"IggoGrid\" entry, get it from the \"page\" GET parameter\n\t\t\tif ( 'iggogrid' !== $_GET['page'] ) {\n\t\t\t\t\n\t\t\t\t// actions that are top-level entries, but don't have an action GET parameter (action is after last _ in string)\n\t\t\t\t$action = substr( $_GET['page'], 9 ); // $_GET['page'] has the format 'iggogrid_{$action}'\n\t\t\t}\n\t\t} else {\n\t\t\t// do this here in the else-part, instead of adding another if ( ! $this->is_top_level_page ) check\n\t\t\t$this->init_i18n_support(); // done here, as for sub menu admin pages this is the first time translated strings are needed\n\t\t\t$this->init_view_actions(); // for top-level menu entries, this has been done above, just like init_i18n_support()\n\t\t}\n\t\t\n\t\t// check if action is a supported action, and whether the user is allowed to access this screen\n\t\tif ( ! isset( $this->view_actions[ $action ] ) || ! current_user_can( $this->view_actions[ $action ]['required_cap'] ) ) {\n\t\t\twp_die( __( 'You do not have sufficient permissions to access this page.', 'default' ) );\n\t\t}\n\t\t\n\t\t// changes current screen ID and pagenow variable in JS, to enable automatic meta box JS handling\n\t\tset_current_screen( \"iggogrid_{$action}\" );\n\n\t\t// pre-define some table data\n\t\t$data = array(\n\t\t\t'view_actions' => $this->view_actions,\n\t\t\t'message' => ( ! empty( $_GET['message'] ) ) ? $_GET['message'] : false,\n\t\t);\n\t\t\n\t\t// depending on action, load more necessary data for the corresponding view\n\t\tswitch ( $action ) {\n\t\t\tcase 'list':\n\t\t\t\t$data['table_id'] = ( ! empty( $_GET['table_id'] ) ) ? $_GET['table_id'] : false;\n\t\t\t\t$data['table_ids'] = IggoGrid::$model_table->load_all( true ); // Prime the post meta cache for cached loading of last_editor\n\t\t\t\t$data['messages']['first_visit'] = IggoGrid::$model_options->get( 'message_first_visit' );\n\t\t\t\tif ( current_user_can( 'iggogrid_import_tables_wptr' ) ) {\n\t\t\t\t\t$data['messages']['wp_table_reloaded_warning'] = is_plugin_active( 'wp-table-reloaded/wp-table-reloaded.php' ); // check if WP-Table Reloaded is activated\n\t\t\t\t} else {\n\t\t\t\t\t$data['messages']['wp_table_reloaded_warning'] = false;\n\t\t\t\t}\n\t\t\t\t$data['messages']['show_plugin_update'] = IggoGrid::$model_options->get( 'message_plugin_update' );\n\t\t\t\t$data['messages']['plugin_update_message'] = IggoGrid::$model_options->get( 'message_plugin_update_content' );\n\t\t\t\t$data['messages']['donation_message'] = $this->maybe_show_donation_message();\n\t\t\t\t$data['table_count'] = count( $data['table_ids'] );\n\t\t\t\tbreak;\n\t\t\tcase 'about':\n\t\t\t\t$data['plugin_languages'] = $this->get_plugin_languages();\n\t\t\t\t$data['first_activation'] = IggoGrid::$model_options->get( 'first_activation' );\n// \t\t\t\t$exporter = IggoGrid::load_class( 'IggoGrid_Export', 'class-export.php', 'classes' );\n// \t\t\t\t$data['zip_support_available'] = $exporter->zip_support_available;\n\t\t\t\tbreak;\n\t\t\tcase 'options':\n\t\t\t\t// Maybe try saving \"Custom CSS\" to a file:\n\t\t\t\t// (called here, as the credentials form posts to this handler again, due to how request_filesystem_credentials() works)\n\t\t\t\tif ( isset( $_GET['item'] ) && 'save_custom_css' == $_GET['item'] ) {\n\t\t\t\t\tIggoGrid::check_nonce( 'options', $_GET['item'] ); // nonce check here, as we don't have an explicit handler, and even viewing the screen needs to be checked\n\t\t\t\t\t$action = 'options_custom_css'; // to load a different view\n\t\t\t\t\t// try saving \"Custom CSS\" to a file, otherwise this gets the HTML for the credentials form\n\t\t\t\t\t$iggogrid_css = IggoGrid::load_class( 'IggoGrid_CSS', 'class-css.php', 'classes' );\n\t\t\t\t\t$result = $iggogrid_css->save_custom_css_to_file_plugin_options( IggoGrid::$model_options->get( 'custom_css' ), IggoGrid::$model_options->get( 'custom_css_minified' ) );\n\t\t\t\t\tif ( is_string( $result ) ) {\n\t\t\t\t\t\t$data['credentials_form'] = $result; // this will only be called if the save function doesn't do a redirect\n\t\t\t\t\t} elseif ( true === $result ) {\n\t\t\t\t\t\t// at this point, saving was successful, so enable usage of CSS in files again,\n\t\t\t\t\t\t// and also increase the \"Custom CSS\" version number (for cache busting)\n\t\t\t\t\t\tIggoGrid::$model_options->update( array(\n\t\t\t\t\t\t\t'use_custom_css_file' => true,\n\t\t\t\t\t\t\t'custom_css_version' => IggoGrid::$model_options->get( 'custom_css_version' ) + 1,\n\t\t\t\t\t\t) );\n\t\t\t\t\t\tIggoGrid::redirect( array( 'action' => 'options', 'message' => 'success_save' ) );\n\t\t\t\t\t} else { // leaves only $result = false\n\t\t\t\t\t\tIggoGrid::redirect( array( 'action' => 'options', 'message' => 'success_save_error_custom_css' ) );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$data['frontend_options']['use_custom_css'] = IggoGrid::$model_options->get( 'use_custom_css' );\n\t\t\t\t$data['frontend_options']['custom_css'] = IggoGrid::$model_options->get( 'custom_css' );\n\t\t\t\t$data['user_options']['parent_page'] = $this->parent_page;\n\t\t\t\t$data['user_options']['plugin_language'] = IggoGrid::$model_options->get( 'plugin_language' );\n\t\t\t\t$data['user_options']['plugin_languages'] = $this->get_plugin_languages();\n\t\t\t\tbreak;\n\t\t\tcase 'edit':\n\t\t\t\tif ( ! empty( $_GET['table_id'] ) ) {\n\t\t\t\t\t$data['table'] = IggoGrid::$model_table->load( $_GET['table_id'], true, true ); // Load table, with table data, options, and visibility settings\n// \t\t\t\t\tprint_r($data['table']);die;\n\t\t\t\t\tif ( is_wp_error( $data['table'] ) ) {\n\t\t\t\t\t\tIggoGrid::redirect( array( 'action' => 'list', 'message' => 'error_load_table' ) );\n\t\t\t\t\t}\n\t\t\t\t\tif ( ! current_user_can( 'iggogrid_edit_table', $_GET['table_id'] ) ) {\n\t\t\t\t\t\twp_die( __( 'You do not have sufficient permissions to access this page.', 'default' ) );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tIggoGrid::redirect( array( 'action' => 'list', 'message' => 'error_no_table' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t/**\n\t\t * Filter the data that is passed to the current IggoGrid View.\n\t\t *\n\t\t * @since 1.0.0\n\t\t *\n\t\t * @param array $data Data for the view.\n\t\t * @param string $action The current action for the view.\n\t\t */\n\t\t$data = apply_filters( 'iggogrid_view_data', $data, $action );\n\t\t\n\t\t// prepare and initialize the view\n\t\t$this->view = IggoGrid::load_view( $action, $data );\n\t}",
"public function index() {\n\n $data = array();\n\n if (!$this->input->get()) {\n $q = $this->session->userdata($this->base . \"_query_array\");\n if ($q) {\n $query_array = $q;\n } else {\n $query_array = array();\n }\n } else {\n $query_array = decode_array($this->input->get());\n $this->session->set_userdata($this->base . \"_query_array\", $query_array);\n }\n\n $data = $this->model->load_table_data($query_array);\n $partials = array();\n\n if (isset($data[\"message\"])) {\n $partials[\"message\"] = $data[\"message\"];\n }\n\n $partials[\"content\"][\"search\"] = $this->load->view(\"index/_search\", $data, true);\n $partials[\"content\"][\"pagination\"] = $this->load->view(\"index/_pagination\", $data, true);\n $partials[\"content\"][\"table\"] = $this->load->view(\"index/_table\", $data, true);\n\n if ($this->input->is_ajax_request()) {\n header(\"Cache-Control: no-store, no-cache, must-revalidate\");\n echo json_encode($partials);\n return;\n } else {\n $partials[\"content\"][\"header\"] = $this->load->view(\"index/_header\", $data, true);\n $partials[\"content\"][\"controls\"] = $this->load->view(\"index/_controls\", $data, true);\n $this->load->view(\"index\", $partials);\n }\n }",
"public function showIndex()\n\t{\n\n\t\t//var_dump(Parser::GetRazdely());\n\n\t\t//var_dump(Parser::getCarPost('prodam-mikroavtobus-26483298'));\n\n\t\t//var_dump(Parser::getPosts('realty/sell_flats', 5));\n\n\t\t//var_dump(Parser::getPosts('auto/sale', 5, 5));\n\n\t\tvar_dump(Parser::getPosts('free', 4, 1, 10));\n\t}",
"public function index()\t{\n\t\t\n //$this->data['banner'] = $this->model_theme_rooms->gethomebanner();\n\t\t\n\t\t\n\t\t//$data['homepageslider_arr'] = $this->model_theme_rooms->gethomebanner();\n\t\t\n\t\t//$data['theme_rooms_background'] = $this->model_theme_rooms->getsectionbackground('1');\n\t\t//$data['calltoaction_background'] = $this->model_theme_rooms->getsectionbackground('2');\n\t\t//$data['recentblogs_background'] = $this->model_theme_rooms->getsectionbackground('3');\n\t\t//$data['contact_background'] = $this->model_theme_rooms->getsectionbackground('4');\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t$this->data['recent_blogs_arr'] = $this->model_theme_rooms->getRecentblogs('3');\n\t\t\n\t\t$this->data['theme_rooms_arr'] = $this->model_theme_rooms->getThemerooms();\n\t\t\n\t\t$this->data['themebanner_arr'] = $this->model_theme_rooms->getThemebanner();\n\t\t\n\t\t//$data['contact_arr'] = $this->model_theme_rooms->getContact();\n\t\t\n\t\t$this->load->view('theme_rooms',$this->data);\n\t\t\n\t}",
"function viewRecursive($selectCol, $tablename, $page, $iscatURL, $statusAction, $urlstring = \"\") {\n $utl = SINGLETON_MODEL::getInstance(\"UTILITIES\");\n $html = SINGLETON_MODEL::getInstance(\"HTML\");\n $js = SINGLETON_MODEL::getInstance(\"JAVASCRIPT\");\n $col = array();\n foreach ($selectCol as $key => $value) {\n if (strstr($key, \"password\") == \"\" && strstr(strtolower($key), \"rewrite\") == \"\")\n $col[$key] = $value;\n }\n $ObjectDataType = $this->getMetaData($tablename);\n $arrayDataType = $ObjectDataType[1];\n $arrayDataLength = $ObjectDataType[2];\n echo \"<div id='panelView' class='panelView'>\";\n echo \"<table id='mainTable' cellpadding='1' cellspacing='1'>\n\n\n\n\n\n\n\n <tr class='titleBottom'>\";\n $i = 1;\n if (is_array($col))\n foreach ($col as $key => $value) {\n if ($i == 1) {\n echo \"<td class='itemCenter'><input type='checkbox' name='chkall' id='chkall' value='1' onclick='docheck(this.checked,0);'></td>\";\n }\n else {\n if ($arrayDataType[$key] == \"int\")\n echo \"<td class='itemCenter'>$value</td>\";\n elseif ($arrayDataType[$key] == \"real\")\n echo \"<td class='itemCenter'>$value</td>\";\n elseif (strstr(strtolower($key), \"picture\") != \"\")\n echo \"<td class='itemCenter'>$value</td>\";\n else\n echo \"<td class='itemText'>$value</td>\";\n }\n ++$i;\n }\n echo \"</tr>\";\n $i = 0;\n if ($iscatURL > 0)\n $grid = $this->recursives($tablename, \"parentid asc\", $iscatURL, $col);\n else\n $grid = $this->recursives($tablename, \"parentid asc\", 0, $col);\n if (is_array($grid))\n foreach ($grid as $k => $rowview) {\n $k = array_keys($col);\n $id = $rowview[$k[0]];\n $class_css = ($i % 2 == 0) ? \"cell2\" : \"cell1\";\n echo \"<tr class='$class_css'>\";\n $j = 1;\n if (is_array($col))\n foreach ($col as $key => $value) {\n if ($j == 1)\n echo \"<td class='itemCenter'>\" . $html->checkbox(\"chk\", \"$id\", \"\", array(\"onclick\" => \"docheckone();\")) . \"</td>\";\n else {\n if (strstr(strtolower($key), \"price\") != \"\")\n echo \"<td class='itemRight'><a id='itemText' href='$page?edit=\" . $id . \"&$urlstring'>\" . $utl->format($rowview[$key]) . CURRENCY . \" </a></td>\";\n elseif (strstr(strtolower($key), \"vat\") != \"\" || strstr(strtolower($key), \"percent\") != \"\")\n echo \"<td class='itemCenter'><a id='itemText' href='$page?edit=\" . $id . \"&$urlstring'>\" . $utl->format($rowview[$key]) . VAT . \" </a></td>\";\n elseif (strstr(strtolower($key), \"picture\") != \"\") {\n if (strstr(strtolower($key), \".swf\") != \"\")\n $img = $js->flashWrite(\"../\" . $rowview[$key], 50, 20, \"flashid\", \"#ffffff\", \"\", \"transparent\");\n else\n $img = \"<img onerror=\\\"$(this).hide()\\\" src='image.php/image.jpg?image=\" . $rowview[$key] . \"&height=15&cropratio=3:1' border='0'>\";\n echo \"<td class='itemCenter'><a id='itemText' href='$page?edit=\" . $id . \"&$urlstring'>\" . $img . \"</a></td>\";\n }\n elseif (strstr(strtolower($key), \"date\") != \"\")\n echo \"<td class='itemCenter'><a id='itemText' href='$page?edit=\" . $id . \"&$urlstring'>\" . date(\"d-m-Y\", (int) $rowview[$key]) . \"</a></td>\";\n elseif ($arrayDataType[$key] == \"int\" && $arrayDataLength[$key] <= 4)\n echo \"<td class='itemCenter'><a id='itemText' href='$page?edit=\" . $id . \"&$urlstring'>\" . strtr($rowview[$key], $statusAction) . \"</a></td>\";\n elseif ($arrayDataType[$key] == \"int\" || $arrayDataType[$key] == \"real\")\n echo \"<td class='itemCenter'><a id='itemText' href='$page?edit=\" . $id . \"&$urlstring'>\" . $rowview[$key] . \"</a></td>\";\n else\n echo \"<td class='itemText'><a id='itemText' href='$page?edit=\" . $id . \"&$urlstring'>\" . $utl->takeShortText($rowview[$key], 5) . ((strstr($key, \"percent\") != \"\") ? \"%\" : \"\") . \"</a></td>\";\n }\n ++$j;\n }\n echo \"</tr>\";\n ++$i;\n }\n echo \"</table>\";\n echo \"</div>\";\n }",
"public function sitemapindex()\n {\n /**\n * Page URLs\n */\n if (!empty($this->viewData->page_urls)) :\n foreach (array_unique($this->viewData->page_urls) as $key => $value) :\n $this->sitemapmodel->add($value, NULL, 'always', 1);\n endforeach;\n endif;\n /**\n * News Categories\n */\n $news_categories = $this->general_model->get_all(\"news_categories\", null, \"rank ASC\", [\"isActive\" => 1]);\n if (!empty($news_categories)) :\n foreach ($news_categories as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $news_categories[$key]->$k = json_decode($v);\n else :\n $news_categories[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($news_categories as $k => $v) :\n if (!empty($v->seo_url->{$this->viewData->lang})) :\n $this->sitemapmodel->add(base_url($this->viewData->languageJSON[\"routes\"][\"haberler\"] . \"/{$v->seo_url->{$this->viewData->lang}}\"), NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n /**\n * News\n */\n $news = $this->general_model->get_all(\"news\", null, \"id DESC\", ['isActive' => 1], [], [], []);\n if (!empty($news)) :\n foreach ($news as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $news[$key]->$k = json_decode($v);\n else :\n $news[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($news as $k => $v) :\n if (!empty($v->seo_url->{$this->viewData->lang})) :\n $this->sitemapmodel->add(base_url($this->viewData->languageJSON[\"routes\"][\"haberler\"] . \"/\" . $this->viewData->languageJSON[\"routes\"][\"haber\"] . \"/{$v->seo_url->{$this->viewData->lang}}\"), NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n /**\n * Product Categories\n */\n $product_categories = $this->general_model->get_all(\"product_categories\", null, \"rank ASC\", [\"isActive\" => 1]);\n if (!empty($product_categories)) :\n foreach ($product_categories as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $product_categories[$key]->$k = json_decode($v);\n else :\n $product_categories[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($product_categories as $k => $v) :\n if (!empty($v->seo_url->{$this->viewData->lang})) :\n $this->sitemapmodel->add(base_url($this->viewData->languageJSON[\"routes\"][\"urunler\"] . \"/{$v->seo_url->{$this->viewData->lang}}\"), NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n /**\n * Products\n */\n $products = $this->general_model->get_all(\"products\", null, \"id DESC\", ['isActive' => 1], [], [], []);\n if (!empty($products)) :\n foreach ($products as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $products[$key]->$k = json_decode($v);\n else :\n $products[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($products as $k => $v) :\n if (!empty($v->url->{$this->viewData->lang})) :\n $this->sitemapmodel->add(base_url($this->viewData->languageJSON[\"routes\"][\"urunler\"] . \"/\" . $this->viewData->languageJSON[\"routes\"][\"urun\"] . \"/{$v->url->{$this->viewData->lang}}\"), NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n /**\n * Slides\n */\n $slides = $this->general_model->get_all(\"slides\", null, \"rank ASC\", [\"isActive\" => 1]);\n if (!empty($slides)) :\n foreach ($slides as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $slides[$key]->$k = json_decode($v);\n else :\n $slides[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($slides as $k => $v) :\n if (!empty($v->button_url->{$this->viewData->lang})) :\n $this->sitemapmodel->add($v->button_url->{$this->viewData->lang}, NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n /**\n * Ads\n */\n $ads = $this->general_model->get_all(\"ads\", null, \"rank ASC\", [\"isActive\" => 1]);\n if (!empty($ads)) :\n foreach ($ads as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $ads[$key]->$k = json_decode($v);\n else :\n $ads[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($ads as $k => $v) :\n if (!empty($v->url->{$this->viewData->lang})) :\n $this->sitemapmodel->add($v->url->{$this->viewData->lang}, NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n /**\n * Services\n */\n $services = $this->general_model->get_all(\"services\", null, \"rank ASC\", [\"isActive\" => 1], [], [], []);\n if (!empty($services)) :\n foreach ($services as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $services[$key]->$k = json_decode($v);\n else :\n $services[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($services as $k => $v) :\n if (!empty($v->url->{$this->viewData->lang})) :\n $this->sitemapmodel->add(base_url($this->viewData->languageJSON[\"routes\"][\"hizmetlerimiz\"] . \"/\" . $this->viewData->languageJSON[\"routes\"][\"hizmet\"] . \"/{$v->url->{$this->viewData->lang}}\"), NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n /**\n * Galleries\n */\n $galleries = $this->general_model->get_all(\"galleries\", null, \"rank ASC\", [\"isActive\" => 1, \"isCover\" => 0], [], [], []);\n if (!empty($galleries)) :\n foreach ($galleries as $key => $data) :\n foreach ($data as $k => $v) :\n if (isJson($v)) :\n $galleries[$key]->$k = json_decode($v);\n else :\n $galleries[$key]->$k = $v;\n endif;\n endforeach;\n endforeach;\n foreach ($galleries as $k => $v) :\n if (!empty($v->url->{$this->viewData->lang})) :\n $this->sitemapmodel->add(base_url($this->viewData->languageJSON[\"routes\"][\"galeriler\"] . \"/\" . $this->viewData->languageJSON[\"routes\"][\"galeri\"] . \"/{$v->url->{$this->viewData->lang}}\"), NULL, 'always', 1);\n endif;\n endforeach;\n endif;\n $this->sitemapmodel->output('sitemapindex');\n }",
"function index() {\n\t\t$this->show_list();\n\t}",
"public function indexAction() {\n\t\t// loads index view\n\t\t// handle errors\n\t\tif (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == \"XMLHttpRequest\") {\n\t\t $this->view->setTemplate('ajax');\n\t\t}\n\t\tif(!empty($_SESSION['error'])) {\n\t\t $this->view->error = $_SESSION['error'];\n unset($_SESSION['error']);\n }\n\t}",
"public function pageAction(){\n $this->_request->setParam('table', 'Page'); \n \t$this->view->gridIndexRoute = Rhema_Constant::ROUTE_GRID_INDEX ; \t \n \t$this->_helper->displayGrid(); \t \n }",
"public function index() {\n $result['cartrimResult'] = $this->cartrim->findAll();\n $result['carResult'] = $this->cars->findAll($flag=1);\n $result['page'] = 'cartrim';\n $result['page_number'] = (isset($_GET['page']) && $_GET['page']) ? $_GET['page'] : 0;\n if (RequestFacade::ajax()) {\n return view('admin.cartrim_table', $result);\n }\n return view('admin.cartrim', $result);\n }",
"public function showRoomsList(){\r\n\t\t$hotel_id = $this->session->userdata['hotel_id'];\r\n\t\t$data['fields']=$this->RoomsModel->getListData($hotel_id);\r\n\r\n\t\t$this->load->view(\"header\");\r\n\t\t$this->load->view(\"rooms/rooms_list\",$data);\r\n\t\t$this->load->view(\"footer\");\r\n\r\n\t}",
"function index()\n {\n\n /* --------------URI SEGMENTS---------------\n * [segment example]\n * /admin/files/2/view/*.*\n * (2)->controller\n * (3)->project_id\n * (4)->router\n ** -----------------------------------------*/\n\n //profiling\n $this->data['controller_profiling'][] = __function__;\n\n //login check\n $this->__commonAdmin_LoggedInCheck();\n\n //get project id\n $this->project_id = $this->uri->segment(3);\n\n //set project_id for global use in template\n $this->data['vars']['project_id'] = $this->project_id;\n\n //check if project exists & set some basic data\n $this->__commonAll_ProjectBasics($this->project_id);\n\n //get the action from url\n $action = $this->uri->segment(4);\n\n //route the request\n switch ($action) {\n\n case 'view':\n $this->__viewNotes();\n break;\n\n case 'edit':\n $this->__editNotes();\n break;\n\n case 'update':\n $this->__updateNotes();\n break;\n\n default:\n $this->__viewNotes();\n break;\n }\n\n //css - active tab\n $this->data['vars']['css_active_tab_mynotes'] = 'side-menu-main-active';\n\n //load view\n $this->__flmView('admin/main');\n\n }",
"function index()\n {\n\n //profiling\n $this->data['controller_profiling'][] = __function__;\n\n //login check\n $this->__commonClient_LoggedInCheck();\n\n //uri - action segment\n $action = $this->uri->segment(3);\n\n //default page titles\n $this->data['vars']['main_title'] = '';\n $this->data['vars']['main_title_icon'] = '';\n\n $this->data['vars']['sub_title'] = $this->data['lang']['lang_users'];\n $this->data['vars']['sub_title_icon'] = '<i class=\"icon-group\"></i>';\n\n //re-route to correct method\n switch ($action) {\n\n case 'view':\n $this->__clientUsers();\n break;\n\n case 'add-user':\n $this->__addUser();\n break;\n\n case 'edit-modal':\n $this->__editUserModal();\n break;\n\n default:\n $this->__clientUsers();\n\n }\n\n //load view\n $this->__flmView('admin/main');\n\n }",
"public function index()\n\t{\n parent::show();\n\t\t//\n\t}",
"public function indexAction(){\n \t/*$request = $this->getRequest();\n\t\t$items \t= $this->getCached()->getLayoutItems();\n\n \t$this->view->layoutItems = $items['html'];\n\n \tif($request->isXmlHttpRequest()){\n \t\t$output = $this->view->render('design/index.phtml');\n \t\t$this->_utility->setAjaxData($output);\n \t}*/\n\n \t//$grid = new Admin_Service_Grid('Admin_Model_Page');\n \t//$script = $grid->display();\n }",
"public function index()\n {\n $this->list_view();\n }",
"public function index()\n {\n $this->list_view();\n }",
"public function index()\n {\n $this->list_view();\n }",
"public function index()\n {\n // get all the roomFeatures\n $roomTypes = RoomType::all();\n //$roomTypes = new RoomType();\n //$roomTypes = $roomTypes->paginate(Config::get('syntara::config.item-perge-page'));\n // ajax request : reload only content container\n if(Request::ajax())\n {\n $html = View::make('roomtypes.list-roomtypes')->with('roomtypes', $roomTypes)->render();\n\n return Response::json(array('html' => $html, 'redirectUrl' => URL::route('newRoomPrice')));\n }\n \n $this->layout = View::make('roomtypes.index-roomtype')->with('roomtypes', $roomTypes);\n $this->layout->title = trans('syntara::rooms.features.list');\n $this->layout->breadcrumb = Config::get('syntara::breadcrumbs.roomtypes');\n }",
"public function index()\n {\n \n $news=News::leftjoin('newstype','news.news_id','=','newstype.n_id')->paginate(2);\n //dd($news);\n //ajax分页\n if (request()->ajax()) {\n return view('news.ajaxpage',['news'=>$news]);\n }\n return view('news.index',['news'=>$news]);\n }",
"public function indexAction()\n {\n $appraisalInitModel = new Default_Model_Appraisalmanager();\t\n $call = $this->_getParam('call');\n if($call == 'ajaxcall')\n $this->_helper->layout->disableLayout();\n\t\t\n $view = Zend_Layout::getMvcInstance()->getView();\t\t\n $objname = $this->_getParam('objname');\n $refresh = $this->_getParam('refresh');\n $dashboardcall = $this->_getParam('dashboardcall');\n\t\t\n $data = array();\n $searchQuery = '';\n $searchArray = array();\n $tablecontent='';\n\t\t\n if($refresh == 'refresh')\n {\n if($dashboardcall == 'Yes')\n $perPage = DASHBOARD_PERPAGE;\n\t\t\telse\t\n\t\t\t\t$perPage = PERPAGE;\n\t\t\t$sort = 'DESC';$by = 'ai.modifieddate';$pageNo = 1;$searchData = '';$searchQuery = '';$searchArray='';\n }\n else \n {\n $sort = ($this->_getParam('sort') !='')? $this->_getParam('sort'):'DESC';\n $by = ($this->_getParam('by')!='')? $this->_getParam('by'):'ai.modifieddate';\n if($dashboardcall == 'Yes')\n $perPage = $this->_getParam('per_page',DASHBOARD_PERPAGE);\n else \n $perPage = $this->_getParam('per_page',PERPAGE);\n $pageNo = $this->_getParam('page', 1);\n /** search from grid - START **/\n $searchData = $this->_getParam('searchData');\t\n $searchData = rtrim($searchData,',');\n /** search from grid - END **/\n }\n\n $dataTmp = $appraisalInitModel->getGrid($sort, $by, $perPage, $pageNo, $searchData,$call,$dashboardcall);\t\t \t\t\n\n array_push($data,$dataTmp);\n $this->view->dataArray = $data;\n $this->view->call = $call ;\n $this->view->messages = $this->_helper->flashMessenger->getMessages();\n $this->render('commongrid/index', null, true);\n }",
"function index()\r\n\t{\r\n\t\t$this->load->model('admin/Interviews_Model');\r\n\t\t$this->load->model('admin/Trailors_Model');\r\n\t\t$trailors_data=$this->Trailors_Model->get_trailor_fulldetails($id=\"\",$limit=20,$order='desc');\r\n\t\t$interview_data1=$this->Interviews_Model->get_interview_fulldetails($id=\"\",$limit=20,$order='desc');\r\n\t\t//get breaking news\r\n\t\t$this->load->model('admin/Filmnews_Model');\r\n\t\t$breaking_news=$this->Filmnews_Model->get_breaking_news();\r\n\t\t//wallpaper categeoreis for jumpto menu\r\n\t\t$this->load->helper('common_functions');\r\n\t\t$table=array('0' =>'wallpaper_categeory',\r\n\t\t '1' =>'gallery_categeory');\r\n\t\t$jumpto = jumpto($table);\r\n\t\t$data = array('title'\t=>\t'Maa Screen',\r\n\t\t\t\t\t 'jquery' => FALSE, \t\r\n\t\t 'jumpto'=> $jumpto\r\n\t\t);\r\n\t\t$this->load->view('review_view',$data);\r\n\t}"
]
| [
"0.5846144",
"0.5768744",
"0.57163024",
"0.5677874",
"0.5632444",
"0.563179",
"0.5627742",
"0.56003547",
"0.55779153",
"0.5572481",
"0.5572465",
"0.5538353",
"0.5519627",
"0.5491929",
"0.5490459",
"0.5484553",
"0.54782385",
"0.5467655",
"0.5464991",
"0.54649395",
"0.5463428",
"0.54616296",
"0.5459243",
"0.5458293",
"0.5458293",
"0.5458293",
"0.54544514",
"0.5453533",
"0.54527295",
"0.5452026"
]
| 0.7159128 | 0 |
/ $post_json = DB::table('posts as p')>leftjoin('users as u','u.id','p.user_id') >leftjoin('profiles as pr','pr.user_id','p.user_id') >select('p.id as post_id','u.image','u.name','u.gender','u.created_at','p.created_at','p.user_id','p.content','pr.city','pr.country','pr.about') >orderBy('p.created_at','DESC')>take(4) >get(); return $post_json | public function posts()
{;
return post::with('user','like','comment')->orderBy('created_at','DESC')->take(4)->get();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getAllPostWithUserId(){\n $query = Post::orderBy('id','desc')->with('user')->paginate(5);\n return $query;\n }",
"public function getAllpost(){\n return $slug=post::with('likes')->where('status',1)->orderBy('created_at','DESC')->paginate(4);\n\n }",
"public function getPostProfile()\n {\n $posts = PostResource::collection(Personne::find(auth()->id())->post()\n ->whereIn('id', PostProfil::pluck('post_id')->all())\n ->orderByDesc('created_at')\n ->paginate(10));\n\n return $posts;\n }",
"public function index()\n {\n return Post::with('category:id,name,slug', 'user:id,name,email')\n ->select([\n 'id', 'title', 'slug', 'content', 'image', 'category_id', 'user_id'\n ])\n ->paginate(); // json_encode(Post::all());\n }",
"public function index()\n {\n //\n $post=Post::with('FromUser')\n ->where('posts.user_id',Auth::user()->id)\n ->with(['LikesBy.FromUser','FromCity'])\n ->withCount(['HavePostLikes','HavePostComments'])\n ->withCount(\n ['HavePostLikes as me_like'=>function($query){\n $query->where('user_id',Auth::user()->id);\n }\n ])\n ->orderBy('id','DESC')\n ->paginate(env('API_PAGINATE'));\n\n $custom = collect(\n [\n 'code' =>(int)env('API_CODE_SUCCESS'),\n 'message'=>'success get data my post',\n ]\n );\n $post = $custom->merge($post);\n\n return $post;\n\n }",
"function json_data() {\n $id = $_POST['id'];\n $user = \\App\\Http\\Models\\Profiles::select('profiles.id as user_id', 'profiles.name', 'profiles.email', 'profiles.phone as phone', 'profiles_addresses.address as street', 'profiles_addresses.postal_code', 'profiles_addresses.city', 'profiles_addresses.province', 'profiles_addresses.notes as notes', \"profiles.restaurant_id as restaurant_id\")->where('profiles.id', \\Session::get('session_id'))->LeftJoin('profiles_addresses', 'profiles.id', '=', 'profiles_addresses.user_id')->first();\n $user->token = csrf_token();\n /*\n $user->restaurant_slug = \"\";\n if($user->restaurant_id){\n $user->restaurant_slug = select_field(\"restaurants\", \"id\", $user->restaurant_id, \"slug\");\n }\n //$user = \\DB::table('profiles')->select('profiles.name', 'profiles.phone', 'profiles.email', 'profiles_addresses.street as street', 'profiles_addresses.postal_code', 'profiles_addresses.city', 'profiles_addresses.province')->where('profiles.id', \\Session::get('session_id'))->LeftJoin('profiles_addresses', 'profiles.id', '=', 'profiles_addresses.user_id')->first();\n */\n return json_encode($user);\n }",
"public function index()\n {\n // $posts = postModel::with('user')->paginate(4);\n // return response()->json(['posts' => $posts,'pagination' => (string)$posts->links()], 200);\n }",
"public function myPosts(){\n\t\tself::noView();\n\t\t/*$getPostsDetails = array('noPosts' => $this->request->data);\n\t\t$final_json = json_encode($getPostsDetails);\n\t\treturn $final_json;*/\n\t\theader(\"Content-Type:application/json\");\n\t\t$this->request->data = json_decode(file_get_contents('php://input'), true);\n\t\t$post_user_id = $this->request->data;\n\t\t$user_id = $post_user_id['id'];\n\t\t$pagination = $post_user_id['pagination'];\t\n\t\t\n\t\t\n\t\t$page_no = (isset($post_user_id['pagination']) && $post_user_id['pagination'] > 1) ? ($post_user_id['pagination']-1) : \"0\";\n\t\t$from_limit = $page_no * 5;\n\t\t$getPostsDetails = $this->User->query(\"SELECT (SELECT count(id) FROM mnst_user_posts WHERE create_by = $user_id AND status = 1) as counts, upst.id, upst.post_name, upst.url_name, upst.post_image, upst.description, upst.created_at, upst.post_url, upst.phone_national_code, upst.mobile_num, upst.catagory_id,upst.sub_catagory_id,mct.id,mct.category_name,msct.id,msct.subcategory_name,upstd.price FROM mnst_user_posts AS upst INNER JOIN mnst_category AS mct ON mct.id = upst.catagory_id INNER JOIN mnst_subcategory AS msct ON msct.id = upst.sub_catagory_id LEFT JOIN mnst_user_post_details as upstd ON upstd.post_id = upst.id WHERE upst.create_by = $user_id AND upst.status = 1 ORDER BY upst.id DESC LIMIT $from_limit,5\");\n\t\t$finalArray = array();\n\t\t$i = 0;\n\t\tforeach ($getPostsDetails as $getValue) {\n\t\t\t$finalArray[$i]['i'] = $i;\n\t\t\t$finalArray[$i]['id'] = $getValue['upst']['id'];\n\t\t\t$finalArray[$i]['post_name'] = $getValue['upst']['post_name'];\n\t\t\t$finalArray[$i]['url_name'] = $getValue['upst']['url_name'];\n\t\t\t$finalArray[$i]['post_image'] = explode(\",\", $getValue['upst']['post_image']);\n\t\t\t//$finalArray[$i]['post_url'] = $getValue['upst']['post_url'];\n\t\t\t$finalArray[$i]['description'] = $getValue['upst']['description'];\n\t\t\t$finalArray[$i]['created_at'] = date(\"m-d-Y\", strtotime($getValue['upst']['created_at']));\t\t\t\n\t\t\t\n\t\t\t$finalArray[$i]['counts'] = $getValue[0]['counts'];\n\t\t\t$finalArray[$i]['category_name'] = $getValue['mct']['category_name'];\n\t\t\t$finalArray[$i]['subcategory_name'] = $getValue['msct']['subcategory_name'];\n\t\t\t$finalArray[$i]['post_url'] = $getValue['upst']['post_url']; \n\t\t\t$finalArray[$i]['price'] = $getValue['upstd']['price'];\n\t\t\t\n\t\t\t$i++;\n\t\t}\n\t\t\n\t\tif(count($finalArray) > 0 && $finalArray[0]['post_name'] != ''){\n\t\t\t$final_json = json_encode($finalArray);\n\t\t}else{\n\t\t\t\n\t\t\t$finalArray[0]['noPosts'] = '0';\n\t\t\t$finalArray = array('noPosts' => $finalArray);\n\t\t\t$final_json = json_encode($finalArray);\n\t\t}\n\t\treturn $final_json;\n\t}",
"public static function profileData($id) {\n return DB::table('users AS u')\n ->leftJoin('follows AS f1', 'u.id', '=', 'f1.user_id')\n ->leftJoin('follows AS f2', 'u.id', '=', 'f2.follow_id')\n ->leftJoin('posts AS p', 'u.id', '=', 'p.user_id')\n ->where('u.id', $id)\n ->selectRaw('u.id, u.fullname, u.username, u.email, u.city, u.country, u.profile_image, u.dateofbirth, u.gender,\n COUNT(DISTINCT(f1.id)) AS following, COUNT(DISTINCT(f2.id)) AS followers, \n COUNT(DISTINCT(p.id)) AS count_posts'\n )\n ->first();\n }",
"public function posts() {\n // LARAVEL IS AUTOMATICALLY LOOKING FOR COUNTRY ID\n return $this->hasManyThrough('App\\Post', 'App\\User');\n }",
"public function getUserAllPosts(){\n\t\tself::noView();\n\t\t/*$getPostsDetails = array('noPosts' => 0);\n\t\t$final_json = json_encode($getPostsDetails);\n\t\treturn $final_json;*/\n\t\theader(\"Content-Type:application/json\");\n\t\t$this->request->data = json_decode(file_get_contents('php://input'), true);\n\t\t$user_name = $this->request->data['username'];\n\t\t$pagination = $this->request->data['pagination'];\n\t\t$user_id = $this->User->query(\"SELECT id FROM mnst_users WHERE username = '$user_name'\");\n\t\t$user_id = $user_id[0]['mnst_users']['id'];\n\t\t$page_no = (isset($pagination) && $pagination > 1) ? ($pagination-1) : \"0\";\n\t\t$from_limit = $page_no * 5;\n\t\t\n\t\t$userPosts = $this->User->query(\"SELECT (SELECT count(id) FROM mnst_user_posts WHERE create_by='$user_id' AND status = 1) as counts, upst.id,upst.create_by,upst.post_name,upst.url_name,upst.post_image,upst.post_url,upst.catagory_id,upst.sub_catagory_id,upst.post_email,upst.mobile_num,upst.address,upst.description,upst.created_at,usr.firstname,usr.lastname,usr.id as user_id, usr.username,usr.user_image, usr.phone,usr.email,usr.created_at, ct.category_name,sct.subcategory_name, upstd.price FROM mnst_user_posts as upst INNER JOIN mnst_users as usr ON usr.id = upst.create_by LEFT JOIN mnst_category as ct ON ct.id = upst.catagory_id LEFT JOIN mnst_subcategory as sct ON sct.id = upst.sub_catagory_id LEFT JOIN mnst_user_post_details as upstd ON upstd.post_id = upst.id WHERE upst.create_by = $user_id AND upst.status = 1 ORDER BY upst.id DESC LIMIT $from_limit,5\");\n\t\t$finalArray = array();\n\t\t$i = 0;\n\t\tforeach ($userPosts as $key => $value) {\n\t\t\t$finalArray[$i]['mnst_user_posts']['counts'] = $value[0]['counts'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['user_id'] = $value['usr']['user_id'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['create_by'] = $value['usr']['username'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['firstname'] = $value['usr']['firstname'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['lastname'] = $value['usr']['lastname'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['user_image'] = $value['usr']['user_image'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['user_email'] = $value['usr']['email'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['user_phone'] = $value['usr']['phone'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['created_at'] = date('d M Y',strtotime($value['usr']['created_at']));\n\t\t\t$finalArray[$i]['mnst_user_posts']['post_name'] = $value['upst']['post_name'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['url_name'] = $value['upst']['url_name'];\n\t\t\t$post_images = explode(\",\", $value['upst']['post_image']);\n\t\t\t\t\t\tforeach ($post_images as $key => $imgValue) {\n\t\t\t\t\t\t\t$finalArray[$i]['mnst_user_posts']['post_images'][$key] = \"../../uploads/post_image/\".$imgValue;\n\t\t\t\t\t\t}\n\t\t\t$finalArray[$i]['mnst_user_posts']['post_url'] = $value['upst']['post_url'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['post_email'] = $value['upst']['post_email'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['mobile_num'] = $value['upst']['mobile_num'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['description'] = $value['upst']['description'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['posted_at'] = date('d M Y',strtotime($value['upst']['created_at']));\n\t\t\t$finalArray[$i]['mnst_user_posts']['category_name'] = $value['ct']['category_name'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['subcategory_name'] = $value['sct']['subcategory_name'];\n\t\t\t$finalArray[$i]['mnst_user_posts']['price'] = $value['upstd']['price'];\n\t\t$i++;\n\t\t}\n \n\tif(count($finalArray) > 0 && $finalArray[0]['mnst_user_posts']['post_name'] != ''){\n\t\t\t$final_json = json_encode($finalArray);\n\t\t}else{\n\t\t\t$getUserDetails = $this->User->query(\"SELECT id, username FROM mnst_users WHERE id = $user_id\");\n\t\t\t$finalArray[0]['username'] = $getUserDetails[0]['mnst_users']['username'];\n\t\t\t$finalArray[0]['noPosts'] = '0';\n\t\t\t$finalArray = array('noPosts' => $finalArray);\n\t\t\t$final_json = json_encode($finalArray);\n\t\t}\n\t\treturn $final_json;\n\t}",
"public function posts()\n {\n return $this\n ->hasMany('App\\Post', 'artist')\n ->selectRaw('*, name as author')\n ->join('users', 'users.id', '=', 'posts.author')\n ->orderBy('posts.created_at', 'desc');\n }",
"public function index()\n {\n // $data = User::with(['posts','comments'])\n // ->where('id',\\Auth::user()->id)\n // ->first();\n // return $data->posts;\n return Post::with('posteable')->get();\n }",
"public function index()\n {\n //\n $posts = Post::latest()->with('user')->paginate(1);\n foreach($posts as $post){\n $post->setAttribute('added_at',$post->created_at->diffForHumans());\n $post->setAttribute('comments_count',$post->comments->count());\n }\n return response()->json($posts);\n }",
"private function getPosts(){\n $posts = DB::connection('mysql')->select('\n SELECT e.title, eu.titleURL, e.teaser, Date_Format(e.publishAt, \"%b %e, %Y\") AS publishDate,\n c.name AS categoryName, cu.name AS categoryURL,\n count(distinct(ed.id)) AS discussionCount,\n fsp.squareURL AS imageURL, fsp.title AS imageTitle,\n group_concat(DISTINCT concat(\"<a href=\\'/category/\", cu.name ,\"\\'>\", c.name, \"</a>\")) AS categoryNames\n FROM entries e\n INNER JOIN entryurls eu ON eu.entryId = e.id AND eu.isActive = 1 AND eu.deletedAt IS NULL\n LEFT JOIN entrycategories ec ON ec.entryId = e.id AND ec.deletedAt IS NULL\n LEFT JOIN categories c ON c.id = ec.categoryId\n LEFT JOIN categoryurls cu ON cu.categoryId = c.id AND cu.isActive = 1 AND cu.deletedAt iS NULL\n LEFT JOIN entrydiscussions ed ON ed.entryId = e.id AND ed.deletedAt IS NULL\n LEFT JOIN entryflickrsets efs ON efs.entryId = e.id AND efs.deletedAt IS NULL\n LEFT JOIN flickrsets fs ON fs.id = efs.flickrSetId AND fs.deletedAt IS NULL\n LEFT JOIN flickrcollections fc ON fc.id = fs.flickrCollectionid AND fc.deletedAt IS NULL\n LEFT JOIN flickrsetphotos fsp ON fsp.flickrSetId = fs.id AND fsp.deletedAt IS NULL\n WHERE e.deletedAt IS NULL\n GROUP BY e.id\n ORDER BY e.publishAt desc\n LIMIT 10');\n\n return $posts;\n }",
"public function anyData()\n {\n $post = \\DB::table(\"posts\")\n ->select(\"posts.*\",\n \\DB::raw(\"(SELECT users.name FROM users\n WHERE users.id = posts.user_id\n GROUP BY users.id,users.name) as postuser\"),\n \\DB::raw(\"(SELECT count(comments.post_id) FROM comments\n WHERE comments.post_id = posts.id\n GROUP BY comments.post_id) as numcomments\"),\n \\DB::raw(\"(SELECT count(likes.post_id) FROM likes\n WHERE likes.post_id = posts.id\n GROUP BY likes.post_id) as numlikes\"))->get();\n \n return Datatables::of($post)\n ->editColumn('numcomments',function($post){\n return empty($post->numcomments)?\"0\":$post->numcomments; \n })\n ->editColumn('numlikes',function($post){\n return empty($post->numlikes)?\"0\":$post->numlikes; \n })\n ->editColumn('content',function($post){\n return strlen(strip_tags($post->content)) > 100 ?substr(strip_tags($post->content),0,100).\"...\":strip_tags($post->content);\n })\n ->addColumn('action', function($post){\n return \"<a href='post/\".$post->id.\"/edit' class='btn btn-xs btn-primary'>Edit</a> <a href='javascript:void(0);' onclick='deletePost(\".$post->id.\");' class='btn btn-xs btn-danger'>Hapus</a>\";\n })\n ->rawColumns(['action'])->make(true);\n \n }",
"public function posts()\n {\n \treturn $this->hasMany(Post::class);\n \t//Con esto podemos acceder a todos los posts de un usuario\n \t//$posts = User::find(1)->comments()->where()->first()\n \t//Para acceder al usuario de un post debemos definir la relacion inversa\n }",
"public function show($user)\n {\n //\n // $posts = Post::where('user_id', $user->id)\n // ->orderBy('created_at', 'desc')\n // ->take(10)\n // ->get();\n // $items = array();\n // foreach($posts as $post){\n // $user = User::find($post->user_id);\n // $photos = json_decode($post->photos, true);\n // $location = false;\n // $post_location = Post::find( $post->id )->location;\n\n // if($post_location){\n // $location_model = Location::find( $post_location->id );\n // $location_data = json_decode($location_model->data);\n // $location['name'] = $location_data->name;\n // $location['country'] = $location_model->country;\n // $location['city'] = $location_model->country;\n // }\n\n // $items[] = array(\n // 'post_id' => $post->id,\n // 'photos' => $post->photos,\n // 'user_id' => $user->id,\n // 'username' => $user->username,\n // 'caption' => preg_replace('/(?<!\\S)#([0-9a-zA-Z]+)/', '<a href=\"/tag/$1\">#$1</a>', $post->caption),\n // 'date' => $post->created_at,\n // 'location' => collect($location)\n // );\n // }\n return view('user.profile',['user'=>$user]);\n }",
"public function fetchPostById($id){\n$sql=\"SELECT posts.id,posts.title,posts.postedBy,posts.created_at,posts.postBody,users.firstName FROM `posts`,users where posts.id= $id AND posts.postedBy =users.id ;\";\n$result = $this->db->conn->query($sql);\n$row=$result->fetch_assoc();\nreturn $row;\n\n}",
"public function posts() {\n return $this->hasMany('App\\Post','user_id', 'id');\n }",
"public function getAllDataPost(){\n \t// DB::table('posts')->get();\n \t$data = Post::all();\n \t$data = ($data) ? $data->toArray() : [];\n \treturn $data;\n }",
"public function getApiPosts(Request $request)\n { \n $friends = Friend::getFriendsApi();\n $friends[] = 1;//JWTAuth::parseToken()->toUser()->id;\n //dd($friends);\n $limit = 5;//$request->input('limit');\n $offset = 0;//$request->input('offset');\n $posts = Post::with('user')->whereIn('user_id',$friends)->limit(3)->offset($offset)->orderBy('id','desc')->get();\n return $posts;\n }",
"public function index()\n { $feedbacks=DB::table('Feedback')->join('users', 'users.id', '=', 'feedback.user_id')\n ->orderby(\"feedback.created_at\",\"desc\")->get();\n\n //$feedbacks=DB::table('Feedback')->select('content')->orderby(\"created_at\",\"desc\")->get();\n \n return response()->json($feedbacks);\n\n }",
"function getPosts(object $pdo): array\n{\n $statement = $pdo->prepare('SELECT posts.id, posts.image, users.profilepicture, users.id\n as user_id, users.username, posts.description, posts.created_at, posts.updated_at\n FROM posts\n INNER JOIN users ON posts.user_id = users.id\n ORDER BY created_at DESC');\n $statement->execute();\n $allPosts = $statement->fetchAll(PDO::FETCH_ASSOC);\n return $allPosts;\n}",
"public function getUsers(){\n $users = DB::table('users')\n ->select(['users.created_at','users.email','users.id','users.name','users.tele','villes.nomVille'])\n ->join('villes', 'villes.idVille', '=', 'users.ville_idVille')\n ->orderBy('id', 'asc')\n ->get();\n\n\n\n\n\n\n return Response()->json(['users'=>$users]);\n }",
"public function getPosts()\r\n\t{\r\n\t\t$query=$this->db->select('registertable3.*,division_tab.division_name,district_tab.district_name,upozila_tab.upozila_name')\r\n\t\t\t\t->from('registertable3')\r\n\t\t\t\t->join('division_tab','division_tab.id = registertable3.division','left')\r\n\t\t\t\t->join('district_tab','district_tab.id = registertable3.district','left')\r\n\t\t\t\t->join('upozila_tab','upozila_tab.id = registertable3.upozila','left')\r\n\t\t\t\t->get();\r\n\r\n\t\tif($query->num_rows() >0){\r\n\t\t\treturn $query->result();\r\n\t\t} \r\n\t}",
"public function beranda4()\n {\n $post_user = Post::with('get_post_user','get_comment_post')->orderByDesc('updated_at')->limit(20)->get();\n //$likes_user_post_all = Likes::with('get_like_user','get_like_post')->orderByDesc('updated_at')->get(); \n // $likes_user_post_l = Likes::with('get_like_user','get_like_post')->orderByDesc('updated_at')->limit(15)->get();\n //$comment_post_t = DB::table('comment')->get();\n \n //$post_detail = Post::with('get_post_user','get_comment_post')->get();\n //$post= DB::table('post')->get();\n //$post_comment = Post::with('get_comment_post')->get();\n \n // $comment_post = Comment::with('get_comment_user')->get();\n //$message = Message::with('get_message_user1','get_message_user2')->where('message_user1', Auth::user()->id)->orWhere('message_user2', Auth::user()->id)->orderByDesc('updated_at')->get();\n //$message_user = Message::with('get_message_user1','get_message_user2')->where('message_user1', Auth::user()->id)->orWhere('message_user2', Auth::user()->id)->orderByDesc('updated_at')->first();\n \n //$message_chat_user_all = Message_Chat::with('get_message_chat_user')->get();\n //$message_chat_user_all_order = Message_Chat::with('get_message_chat_user')->orderByDesc('updated_at')->first();\n \n \n $grup_list = Grup_Public_User::with('get_grup','get_grup_public_post')->where('user_id',Auth::user()->id)->orderByDesc('updated_at')->get();\n $grup_public_post_all = Grup_Public_Post::with('get_grup_public_post_user')->get();\n //$grup_public_post = Grup_Public_Post::with('get_grup_public_post_user')->orderByDesc('updated_at')->get();\n //$post_user_grup = Grup_Public_Post::with('get_grup_post','get_grup_public_post_user')->get();\n //$post_detail_grup = Grup_Public_Post::with('get_grup_public_post_user','get_grup_public_post')->get();\n //$comment_post_grup = Grup_Public_Comment::with('get_grup_public_comment_user','get_grup_public_comment_post')->get();\n //$likes_user_post_all_grup = Grup_public_Like::with('get_grup_public_like_user','get_grup_public_like_post')->orderByDesc('updated_at')->get();\n //$likes_user_post_l_grup = Grup_public_Like::with('get_grup_public_like_user','get_grup_public_like_post')->orderByDesc('updated_at')->limit(15)->get();\n \n \n //$data['followed_user'] = $followed_user;\n $data['post_user'] = $post_user;\n //$data['likes_user_post_all'] = $likes_user_post_all;\n //$data['likes_user_post_l'] = $likes_user_post_l;\n //$data['comment_post_t'] = $comment_post_t;\n //$data['post'] = $post;\n \n //$data['post_comment'] = $post_comment;\n //$data['post_detail'] = $post_detail;\n //$data['comment_post'] = $comment_post;\n //$data['message'] = $message;\n //$data['message_user'] = $message_user;\n //$data['message_chat_user_all'] = $message_chat_user_all;\n //$data['message_chat_user_all_order'] = $message_chat_user_all_order;\n $data['grup_list'] = $grup_list;\n $data['grup_public_post_all'] = $grup_public_post_all;\n //$data['grup_public_post'] = $grup_public_post;\n //$data['grup_public_post_all'] = $grup_public_post_all;\n //$data['post_user_grup'] = $post_user_grup;\n //$data['post_detail_grup'] = $post_detail_grup;\n //$data['comment_post_grup'] = $comment_post_grup;\n //$data['likes_user_post_all_grup'] = $likes_user_post_all_grup;\n //$data['likes_user_post_l_grup'] = $likes_user_post_l_grup;\n \n return view('beranda4', $data);\n }",
"public function view($id){\n // dd($id);\n $data = DB::table('posts')\n ->join('employees','posts.employee_id','employees.id')\n ->where('posts.id',$id)\n ->select('posts.*','employees.name')\n ->first();\n // return response()->json();\n // return response()->json($data);\n return view('post.view',['post'=>$data]);\n }",
"public function posts()\n\t{\n\t\t// drugi argument stupac u bazi preko kojeg radimo relaciju\n\t\treturn $this->hasMany(static::$postModel, 'user_id');\n\t}",
"public function posts(){\n // Will go the posts table and get all posts that have the user ud in a column named `user_id`\n // This will also work: `$this->hasMany('App\\Post', 'user_id');`\n return $this->hasMany('App\\Post');\n }"
]
| [
"0.6928336",
"0.66911304",
"0.6641407",
"0.66079164",
"0.6559444",
"0.64841306",
"0.64818805",
"0.64552283",
"0.64498407",
"0.6407084",
"0.63904256",
"0.6336262",
"0.6325509",
"0.63253176",
"0.62544334",
"0.62468064",
"0.62280965",
"0.6221604",
"0.6193254",
"0.618953",
"0.6171725",
"0.6167931",
"0.6159422",
"0.61576813",
"0.61451703",
"0.6136081",
"0.61254585",
"0.6089265",
"0.6083071",
"0.60630625"
]
| 0.7565152 | 0 |
Check if entity class exist in Domain\Factory | public function testEntityClassExist()
{
$this->assertInstanceOf(TreeFactory::class, new TreeFactory());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function hasEntityClass(): bool\n {\n return $this->hasDataItem('entity');\n }",
"protected function isEntity($class)\n {\n return Nishchay::getEntityCollection()->isExist($class);\n }",
"public function hasEntity($name);",
"public function createEntity() {\r\n\t\t$entity = $this->getAnnotation('entity');\r\n\t\tif($entity) {\r\n\t\t\treturn new $entity;\r\n\t\t}\r\n\t\treturn false;\r\n\t}",
"public function testClassExists()\n {\n $this->assertTrue(class_exists('App\\Infrastructure\\DoctrineProducts'));\n }",
"abstract protected function getEntityClass();",
"function isPartOfFactoryDefault() ;",
"abstract protected function assertEntityClass();",
"public function supports(string $entityClass): bool;",
"public function generateSourceEntityClass(): bool\n {\n $folder = $this->getGeneratedEntitiesFolder();\n $repositoryFolder = $this->getGeneratedRepositoriesFolder();\n $file = $this->getSourceClassPath();\n $repositoryFile = $this->getRepositoryClassPath();\n $fileSystem = new Filesystem();\n\n if (!$fileSystem->exists($folder)) {\n $fileSystem->mkdir($folder, 0775);\n }\n if (!$fileSystem->exists($repositoryFolder)) {\n $fileSystem->mkdir($repositoryFolder, 0775);\n }\n\n if (!$fileSystem->exists($file)) {\n $classGenerator = $this->entityGeneratorFactory->createWithCustomRepository($this->nodeType);\n $repositoryGenerator = $this->entityGeneratorFactory->createCustomRepository($this->nodeType);\n $content = $classGenerator->getClassContent();\n $repositoryContent = $repositoryGenerator->getClassContent();\n\n if (false === @file_put_contents($file, $content)) {\n throw new IOException(\"Impossible to write entity class file (\" . $file . \").\", 1);\n }\n if (false === @file_put_contents($repositoryFile, $repositoryContent)) {\n throw new IOException(\"Impossible to write entity class file (\" . $repositoryFile . \").\", 1);\n }\n /*\n * Force Zend OPcache to reset file\n */\n if (function_exists('opcache_invalidate')) {\n opcache_invalidate($file, true);\n opcache_invalidate($repositoryFile, true);\n }\n if (function_exists('apcu_clear_cache')) {\n apcu_clear_cache();\n }\n\n \\clearstatcache(true, $file);\n \\clearstatcache(true, $repositoryFile);\n\n return true;\n }\n return false;\n }",
"public function getEntityClass();",
"public function hasRepository($className);",
"public function exists($entity): bool;",
"public function testFactory()\n {\n $entity = $this->account->getServiceManager()->get(\"EntityFactory\")->create(\"notification\");\n $this->assertInstanceOf(\"\\\\Netric\\\\Entity\\\\ObjType\\\\NotificationEntity\", $entity);\n }",
"public function assertUserFactoryExists()\n {\n $user = '';\n\n try {\n $user = factory(User::class)->create();\n } catch (Exception $e) {\n $msg = 'User factory does not exist.';\n echo $msg.\"\\n\";\n }\n\n $this->assertTrue(is_object($user));\n }",
"public function hasRepository(string $className): bool;",
"public function hasEntityType() {\n return $this->_has(6);\n }",
"protected function _checkRecordInstance()\n {\n if (!$this->_entity)\n {\n $this->_entity = new $this->entityName();\n return false;\n }\n else\n return true; \n }",
"function exists(string $class_name): bool\n{\n /** @var bool */\n return class_exists($class_name, true);\n}",
"public function testNotFoundEntityFactoryException(): void\n {\n $this->expectException(InvalidArgumentException::class);\n\n $entityFactoryManager = $this->getEntityFactoryManager([\n 'Tests\\EoneoPay\\Externals\\ORM\\Stubs\\Factories\\\\' => 'Tests\\EoneoPay\\Externals\\ORM\\Stubs'\n ]);\n\n $entityFactoryManager->create(EntityCustomRepository::class);\n }",
"public function hasEntityType() {\n return $this->_has(5);\n }",
"public function testReturnEntityClass()\n {\n $this->assertInstanceOf(Tree::class, TreeFactory::createFromArray($this->request));\n }",
"private static function discoverEntity()\n {\n Structure::indexEntity(static::class);\n }",
"public function testIsVendorClassReturnsFalseIfClassOfObjectIsNotLocatedInVendorDirectory()\n {\n $this->assertFalse(VendorResources::isVendorClass(new ContactType()));\n }",
"public function isInstantiable() {\n\t\treturn !is_null($this->domain->class);\n\t}",
"public function getUserEntityClass();",
"abstract protected function createEntityInstance();",
"public function isCreated($className);",
"static function classGateKeeper($entity, $class) {\n $class = \"SociaLabs\\\\\" . $class;\n if (!is_a($entity, $class, true)) {\n new SystemMessage(\"Class Gatekeeper Exception\", \"danger\");\n forward(\"home\");\n }\n return true;\n }",
"private function isEntitySupported(ClassMetadata $classMetadata)\n {\n return $this->getClassAnalyzer()->hasTrait($classMetadata->reflClass, 'Kairos\\ZohoInvoiceConnectorBundle\\Model\\Invoice\\InvoiceConnector', $this->isRecursive);\n }"
]
| [
"0.6855368",
"0.6752972",
"0.6505902",
"0.6486293",
"0.6439892",
"0.6329484",
"0.6170979",
"0.61544245",
"0.6154387",
"0.610311",
"0.6046536",
"0.5993165",
"0.59035146",
"0.59028155",
"0.58715194",
"0.5840061",
"0.5828841",
"0.58055365",
"0.57630295",
"0.5747926",
"0.5738553",
"0.5711179",
"0.57083195",
"0.5689966",
"0.5684406",
"0.5684005",
"0.56458956",
"0.5616707",
"0.5593499",
"0.5591075"
]
| 0.78773755 | 0 |
Check if methods exists in Domain\Factory | public function testMethodsExist()
{
$object = new TreeFactory();
$this->assertTrue(method_exists($object, 'createFromArray'));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function methodHasFactory(string $method)\n {\n return ! is_null($this->getMethodFactory($method));\n }",
"public function hasInjectMethods() {}",
"public function hasMethods($class);",
"public function test_ClassResolver_hasMethod_methodsMeta() {\n $this->assertTrue(method_exists($this->obj, 'methodsMeta'));\n }",
"public function hasMethod($method);",
"function test_create_method_exists() {\n $wpNonce = new \\Fazleelahhee\\Inpsyde\\WPNonce();\n $this->assertTrue(\n method_exists($wpNonce, 'create'),\n 'Class does not have method create'\n );\n }",
"public function isMethods() {}",
"function isPartOfFactoryDefault() ;",
"public function testMethodExists()\n {\n $this->assertTrue(method_exists($this->subscriber, 'addMedia'));\n $this->assertTrue(method_exists($this->subscriber, 'generateAlternatives'));\n }",
"public function test_ClassResolver_hasMethod_build() {\n $this->assertTrue(method_exists($this->obj, 'build'));\n }",
"public function testProxyMethods()\n {\n $factory = OpenExchangeRatesFactory::create(['key' => '']);\n $this->assertTrue(is_callable([$factory, 'is']), 'Factory::is');\n $this->assertTrue(is_callable([$factory, 'base']), 'Factory::base');\n $this->assertTrue(is_callable([$factory, 'newRates']), 'Factory::newRates');\n $this->assertTrue(is_callable([$factory, 'getRates']), 'Factory::getRates');\n $this->assertTrue(is_callable([$factory, 'getRate']), 'Factory::getRate');\n $this->assertTrue(is_callable([$factory, 'getBase']), 'Factory::getBase');\n $this->assertTrue(is_callable([$factory, 'convert']), 'Factory::convert');\n }",
"function mdl_has_constructor_method(array $methods)\n{\n foreach ($methods as $value) {\n if (!is_array($value)) {\n continue;\n }\n if (isset($value['name']) && (strtolower(strval($value['name'])) === '__construct')) {\n return true;\n }\n }\n return false;\n}",
"public function test_ClassResolver_hasMethod___construct() {\n $this->assertTrue(method_exists($this->obj, '__construct'));\n }",
"public function dummyMethodToEnsureInstanceExists()\n {\n // intentionally empty\n }",
"public function checkAPI()\n {\n // The constants are defined.\n $this->_define('T_NAMESPACE');\n $this->_define('T_NS_SEPARATOR');\n $this->_define('E_USER_DEPRECATED', E_USER_WARNING);\n\n /*\n * Every static public method with an @implement annotation defines\n * a function.\n */\n $reflectionObject = new ReflectionObject($this);\n $methods = $reflectionObject->getMethods(\n ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC\n );\n foreach ($methods as $method) {\n // The method comment is parsed for the @implement annotation\n $isAnnotated = preg_match(\n '/\\s*\\*\\s*@implement\\s+(\\S+)/',\n $method->getDocComment(),\n $matches\n );\n if (! $isAnnotated) {\n continue;\n\n }\n\n $function = $matches[1];\n\n // A function might already exist.\n if (function_exists($function)) {\n continue;\n\n }\n\n // The parameters are build.\n $parametersArray = array();\n for ($i = 0; $i < $method->getNumberOfParameters(); $i++) {\n $parametersArray[] = '$parameter' . $i;\n\n }\n $parameters = implode(', ', $parametersArray);\n\n // The function is defined.\n $apiClass = get_class($this);\n $definition = \"function $function($parameters)\n {\n \\$parameters = func_get_args();\n return call_user_func_array(\n array('$apiClass', '{$method->getName()}'),\n \\$parameters\n );\n }\n \";\n eval($definition);\n\n }\n }",
"public function hasPublicMethod(string $class, string $method);",
"public function hasMethods() {\n return $this->_has(12);\n }",
"public function hasDefiner();",
"public function hasFactory($name)\n {\n return array_key_exists($name, $this->factories);\n }",
"public function isMethod($method);",
"public function isMethod($method);",
"protected function exists() {}",
"public function testHasMethod() {\n\t\t$Article = new Article();\n\t\t$Article->Behaviors = $this->getMock('BehaviorCollection');\n\n\t\t$Article->Behaviors->expects($this->at(0))\n\t\t\t->method('hasMethod')\n\t\t\t->will($this->returnValue(true));\n\n\t\t$Article->Behaviors->expects($this->at(1))\n\t\t\t->method('hasMethod')\n\t\t\t->will($this->returnValue(false));\n\n\t\t$this->assertTrue($Article->hasMethod('find'));\n\n\t\t$this->assertTrue($Article->hasMethod('pass'));\n\t\t$this->assertFalse($Article->hasMethod('fail'));\n\t}",
"public function test_ClassResolver_hasMethod_propertiesMeta() {\n $this->assertTrue(method_exists($this->obj, 'propertiesMeta'));\n }",
"#[Pure]\nfunction http_request_method_exists($method) {}",
"public function testHasMethod() {\n $this->assertTrue(Inflector::hasMethod('slug'));\n $this->assertFalse(Inflector::hasMethod('slugify'));\n\n Inflector::macro('slugify', function() {});\n\n $this->assertTrue(Inflector::hasMethod('slug'));\n $this->assertTrue(Inflector::hasMethod('slugify'));\n }",
"function test_get_url_method_exists() {\n $wpNonce = new \\Fazleelahhee\\Inpsyde\\WPNonce();\n $this->assertTrue(\n method_exists($wpNonce, 'getUrl'),\n 'Class does not have method createUrl'\n );\n }",
"public function exists() {}",
"private function is_special_case_static($method_name)\n\t{\n\t\tif($method_name=='create')\n\t\t\treturn true;\n\t\treturn false;\n\t}",
"public function test_ClassResolver_hasMethod_classMeta() {\n $this->assertTrue(method_exists($this->obj, 'classMeta'));\n }"
]
| [
"0.7153884",
"0.6720488",
"0.6634469",
"0.65491194",
"0.6512563",
"0.6499929",
"0.6474813",
"0.64525896",
"0.64386725",
"0.6346927",
"0.6336662",
"0.62816525",
"0.625594",
"0.6141736",
"0.61033845",
"0.6086477",
"0.6062697",
"0.6058823",
"0.60260713",
"0.6007413",
"0.6007413",
"0.5973764",
"0.5958675",
"0.5943166",
"0.58898133",
"0.58760864",
"0.5865071",
"0.5851266",
"0.5847733",
"0.5840895"
]
| 0.6971061 | 1 |
Check the return of entity get methods | public function testReturnOfEntityGetMethods()
{
$entity = TreeFactory::createFromArray($this->request);
$this->assertEquals($this->request['id'], $entity->getId());
$this->assertEquals($this->request['age'], $entity->getAge());
$this->assertEquals($this->request['type'], $entity->getType());
$this->assertInstanceOf(Bear::class, $entity->getBear());
$this->assertInstanceOf(Carbon::class, $entity->getCreatedAt());
$this->assertEquals($this->request['created_at'], $entity->getCreatedAt()->toDateTimeString());
$this->assertInstanceOf(Carbon::class, $entity->getUpdatedAt());
$this->assertEquals($this->request['updated_at'], $entity->getUpdatedAt()->toDateTimeString());
$this->assertInstanceOf(Carbon::class, $entity->getDeletedAt());
$this->assertEquals($this->request['deleted_at'], $entity->getDeletedAt()->toDateTimeString());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function actionsForGetMethod()\n {\n if (isset($this->id)) { /* If the variable id exists, it request to the model for the specific element */\n $data = $this->api->get($this->id);\n } else { /* If it does not exist, request all the elements */\n $data = $this->api->get();\n }\n\n /* It eliminates the last element of the array $ data, since usually, it usually brings two elements,\n one with the information, and another NULL which is not needed */\n array_pop($data);\n\n if (count($data) == 0) {\n /* If the variable id exists but the array of $ data does not produce a result,\n it means that the element does not exist */\n if (isset($this->id)) {\n $this->print_json(404, \"Not Found\", null);\n } else {\n /* But if the variable id exists and does not bring $ data, since we do not look for a specific\n element, it means that the entity has no elements to show */\n $this->print_json(204, \"Not Content\", null);\n }\n } else {\n $this->print_json(200, \"OK\", $data); /* Print the requested information */\n }\n }",
"public function isGet();",
"public function is_get() {\n return $this->method == 'get';\n }",
"public function test__GetGet()\n\t{\n\t\t$this->assertThat(\n\t\t\t$this->object->objects->get,\n\t\t\t$this->isInstanceOf('JAmazons3OperationsObjectsGet')\n\t\t);\n\t}",
"public function isGet(): bool {}",
"public function testMagicMethodGet() {\n\n\t\t$error = self::$context->connection->hatseflatse;\n\n\t}",
"public function willGenerateGet(): bool;",
"public function isGet(): bool \r\n {\r\n return $this -> method() === 'GET' ? true : false;\r\n }",
"public static function isGet(): bool {\r\n return static :: isMethod('get');\r\n }",
"public function isGet()\n\t{\n\t\treturn $this->httpMethod() == self::MethodGet;\n\t}",
"public function isGet() :bool\n {\n return $this->getMethod() === 'GET';\n }",
"public function isGet()\n {\n return $this->getMethod() === self::METHOD_GET;\n }",
"public function isGet(): bool\n {\n return $this->getMethod() === self::METHOD_GET;\n }",
"public function isGet() {\n return $this->method == 'GET';\n }",
"public function isGet()\n {\n return $this->getRequestMethod() === 'GET';\n }",
"public function isGet()\n {\n return $this->method === self::METHOD_GET;\n }",
"public function isGet() {\n return $this->method == self::METHOD_GET;\n }",
"public function getIsGet()\n {\n return $this->getMethod() === 'GET';\n }",
"public function getIsGet()\n {\n return $this->getMethod() === 'GET';\n }",
"public function isGet()\n {\n return $this->getMethod() === 'GET';\n }",
"public function isGet()\n {\n return $this->getMethod() === 'GET';\n }",
"public function isGet()\n {\n return $this->getMethod() == 'GET';\n }",
"public function isGet()\n {\n return $this->isMethod('GET');\n }",
"public function isGet()\n {\n return $this->isMethod('GET');\n }",
"public static function isGet(){\n return self::isRequestMethod('GET');\n }",
"public function isGet(): bool\n {\n return $this->method === self::GET;\n }",
"abstract protected function getEntity();",
"public function testGetters()\n {\n $this->entity->fromArray($this->testData);\n\n foreach ($this->expectedGetters as $method => $expectedResult) {\n //var_dump($this->testData, $expectedResult, $this->entity->$method());\n if (is_array($expectedResult)) {\n $this->assertArraysAreSimilar($expectedResult, $this->entity->$method(), $method);\n } elseif (is_object($expectedResult)) {\n $actualObject = var_export($this->entity->$method(), true);\n $expectedObject = var_export($expectedResult, true);\n $this->assertSame($expectedObject, $actualObject, $method);\n } else {\n $this->assertSame($expectedResult, $this->entity->$method(), $method);\n }\n }\n }",
"public function testImproperApiMethod()\n {\n $this->testedDao->fetchImproperDataName();\n }",
"public function isMethodGet(): bool\n {\n return $this->isMethod(self::HTTP_GET);\n }"
]
| [
"0.6865153",
"0.6835807",
"0.6709554",
"0.6688856",
"0.6628475",
"0.6619118",
"0.6436584",
"0.64169824",
"0.6315417",
"0.62930727",
"0.6282245",
"0.627606",
"0.6259087",
"0.62590396",
"0.62285894",
"0.6220688",
"0.6216046",
"0.6192731",
"0.6192731",
"0.61875826",
"0.61875826",
"0.61875594",
"0.613235",
"0.613235",
"0.6111217",
"0.6090541",
"0.6017842",
"0.6002497",
"0.5970247",
"0.59680086"
]
| 0.7188854 | 0 |
Menampilkan seluruh halaman website beserta head dan layoutnya Merupakan method utama yang berhubungan langsung dengan view jika $file diisi dengan nama folder dan nama file akan otomatis ditacari lokasi folder dan viewnya berdasarkan root = system/view $var harus berbentuk array, key dari var nanti akan menjadi variabel yang akan dieksekusi pada file view | protected function view($var_and_file = array("content"=>"index.php"),$var = array()){
foreach($var_and_file as $variabel => $file){
if(is_object($file)||is_array($file)||strpos($file,".php")==0)
$$variabel = $file;
else
$$variabel = $this->viewPartial($file,$var);
}
include_once("system/view/component/$this->layout");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function index(){\n\n\t\t//memanggil file view\n\t\t$this->load->view('variabelview', $data);//file view\n\t\t//deklarasi data\n\t\t$data = ['variabel1' => 'Data variabel ke-1', 'variabel2' => 'Data variabel ke-2'];\n\t}",
"public function View($file,$data)\n {\n $path = '../view/'. $file . '.php';\n //dd($path);\n if (file_exists($path)){\n ob_start();\n require_once $path;\n $content = ob_get_clean();\n require_once '../view/layout/main.php';\n } else{\n echo \"404 NOT FOUND\";\n }\n }",
"protected function viewPartial($file = \"index.php\",$var = array()){\n $cekFile = explode(\"/\",$file);\n $length = sizeof($cekFile);\n if($length>1){\n $file = $cekFile[$length-1];\n $cekFile[$length-1] = \"\";\n $folder = implode(\"/\",$cekFile);\n }else{\n $folder = $this->controller;\n }\n return $this->renderFile(\"view/$folder/$file\",$var);\n }",
"public function view($page = 'home') {\n if(!file_exists(APPPATH.'views/pages/'.$page.'.php')){\n \n \n // codeIG funcion para mostrar errores\n show_404();\n }\n\n//un arrar con las varibles que se le pasa a la vista\n //para la primer lettra Mayuscula\n $data['title'] = ucfirst($page);\n//se carga de /view->carpet\n $this->load->view('templates/header');\n//carga de la carpeta pages . cualqueira qwue empieze por page y \n//que este en el array $data\n $this->load->view('pages/'.$page, $data);\n $this->load->view('templates/footer');\n \n \n }",
"public function index()\n {\n $this->load->helper('file'); \n $file_arr = get_filenames(\"uploads\"); \n\t\tsort($file_arr);\t\n $this->data_to_view[\"file_arr\"]=$file_arr;\n \n $hb_params=[\n \"bg_img_num\"=>4,\n \"bg_style_num\"=>1,\n \"heading\"=>\"Aflaai\",\n \"sub_heading\"=>\"Dokumente beskikbaar om afgelaai te word\",\n ]; \n $this->data_to_header['header_bottom']=$this->set_header_bottom($hb_params);\n $this->data_to_header['page_title'] = \"Dokumente Aflaai\";\n $this->data_to_header['meta_description'] = \"Bladsy waar dokumente afgelaai kan word\"; \n \n \n $this->load->view($this->header_url, $this->data_to_header);\n $this->load->view('aflaai', $this->data_to_view);\n $this->load->view('templates/enroll',[\"bg_color\"=>2]);\n $this->load->view($this->footer_url, $this->data_to_footer);\n }",
"public function load_view($view=false, $data = array(), $data_includes = array(), $folder = 'dashboard', $ext = '.html'){\n $ext = ($ext!='.html')? '' : $ext; \n // Header\n $base_url = base_url();\n $parse['base_url'] = $base_url;\n $parse['APPTITLE'] = utf8_decode($this->vars->cfg['site_title']);\n $parse['URLPATH'] = URLPATH;\n $parse['TEMPLATEPATH'] = $base_url.'assets/template/';\n $parse['IMG_PATH'] = $base_url.'assets/img/';\n $parse['anio'] = date('Y');\n\n $includes_header =(isset($data_includes['header']))?$data_includes['header']:$data_includes;\n $includes_footer =(isset($data_includes['footer']))?$data_includes['footer']:false;\n\n // INCLUDES HEADER Y WIDGETS\n // SE CARGAN EL CORE Y LOS PLUGINS DEL SISTEMA ADEMAS DE LOS JS Y CSS EXTRAS\n $dataheader['includes_header'] = $this->load_view_unique($folder.'/includes-header', $parse, true, $includes_header);\n $dataheader['includes_widgets'] = $this->load_view_unique($folder.'/includes-widgets' , $parse, true);\n //FIN HEADER Y WIDGETS\n\n //CONSTRUCCION DEL MENU\n $menu = $this->user_menu($this->session->userdata('user_menu'));\n $parse['MENU_DESKTOP'] = $menu['MENU_DESKTOP'];\n $parse['MENU_MOBILE'] = $menu['MENU_MOBILE'];\n $parse['MENU_MOBILE_SUBMENUS'] = $menu['MENU_MOBILE_SUBMENUS'];\n // debug($parse['MENU_MOBILE_SUBMENUS']);\n $parse['nombre_completo'] = $this->session->userdata('nombre_completo');\n $parse['reset_password'] = ($this->session->userdata('externo'))?'<li><a href=\"'.$base_url.'reset\"> Reset Password </a></li>':'';\n // Estructura de la pagina\n $dataheader['page_header'] = $this->load_view_unique($folder.'/page-header', $parse, true);\n // $dataheader['page_content'] = $this->load_view_unique($folder.'/page-content', $parse, true);\n $dataheader['page_footer'] = $this->load_view_unique($folder.'/page-footer',$parse, true); \n //SE CARGA EL CONTENIDO DE LA PAGINA\n if($view){\n $dataContent['content'] = $this->load_view_unique($view, $data, true);\n $dataContent['title'] = $data['titulo'];\n $dataContent['subtitle'] = isset($data['subtitulo'])? $data['subtitulo'] : '';\n $dataheader['page_content'] = $this->load_view_unique($folder.'/page-content', $dataContent, true);\n // $dataheader['page_content'] = $this->load_view_unique($view, $data, true);\n }else{\n $dataheader['page_content'] = false;\n }\n // FOOTER\n $dataheader['includes_footer'] = $this->load_view_unique($folder.'/includes-footer', $parse, true, $includes_footer);\n // Output\n $this->parser->parse($folder.'/dashboard'.$ext , $dataheader);\n }",
"public function view($views = '', Array $var = null)\n\t{\n\t\t// mengarah pada folder apps/views/ namaviews.php\n\t\t$view = str_replace(\".\",\"/\", $views);\n\t\ttry {\n\t\t\tif (!file_exists(_ROOT_VIEW . $view . '.php')) {\n\t\t\t\tthrow new Exception(\"View \". $view .\" Not Found. Check Controllernya Bro\");\n\t\t\t}\n\n\t\t\t# comment this jika tidak ingin menggunakan twig engine\n\t\t\t// $loader = new \\Twig\\Loader\\FilesystemLoader(_ROOT_VIEW);\n // $twig = new \\Twig\\Environment($loader, ['debug' => true]);\n\n // echo $twig->render($view . '.php' , $data);\n\n\t\t\t# convert array assoc to object\n\t\t\t$object = json_decode(json_encode($var));\n\n\t\t\t#extract key object to variabel\n\t\t\textract((array) $object);\n\n\t\t\t# uncomment this jika tidak ingin menggunakan twig engine\n\n\t\t\trequire_once _ROOT_VIEW . $view . '.php'; //update template engine menggunakan twig\n\t\t\texit;\n\t\t} catch (Exception $exception) {\n\t\t\t$my_error = new Error_Handling;\n\t\t\t$my_error->showerror_message($exception->getMessage() , $exception->getFile() , $exception->getLine() , $exception->getTraceAsString());\n\t\t\texit;\n\t\t}\n\t}",
"public function view($view, $data=[]){\n // verificamos que el archivo de la vista exista dentro de la carpeta vistas\n if(file_exists('../app/views/'. $view. '.php')){\n //requerimos la vista\n require_once '../app/views/'. $view. '.php';\n }else{\n // si la vista no existe\n die('La vista no existe');\n }\n }",
"public function file(){\n $multilevel = menuadmin::get_data();\n $index = menuadmin::where('part','file')->first();\n $aktif_menu = menuadmin::aktif_menu($index['id']);\n return view('backend.att.file', compact('multilevel','aktif_menu'));\n }",
"function page_settings($view_file, $view_data, $data_name = 'result', $page_title = NULL, $model = NULL)\n {\n\tif ($data_name == NULL) {\n\t $data = $view_data;\n\t} else {\n\t $data[$data_name] = $view_data;\n\t}\n\t$data['view_file'] = $view_file;\n\t$data['page_title'] = $page_title;\n\tif ($model != NULL) {\n\t $data['module'] = $model;\n\t}\n\treturn $data;\n }",
"function view($fileName, $data=null) {\n if(is_array($data)) {\n extract($data);\n }\n require_once('html/' . $fileName);\n }",
"public static function load($view){\n\n\t\tif(!isset($_GET['view'])){\n\n\t\t\tif(Core::$root==\"\"){\n\t\t\t\t// echo '<pre>'; print_r(\"no hay var get\"); echo '</pre>';\n\n\t\t\t\t\tinclude \"core/app/view/\".$view.\"-view.php\";\n\t\t\t}\n\n\t\t}else{\n\n\t\t\tif(View::isValid()){\n\t\t\t\t$url =\"\";\n\t\t\t\tif($_GET[\"view\"] != \"inicio\"){\n\n\t\t\t\t\t// echo '<pre>'; print_r(\"vista completa\"); echo '</pre>';\n\t\t\t\t\t\n\t\t\t\t\t$url = \"core/app/view/\".$_GET['view'].\"-view.php\";\n\n\t\t\t\t}else{\n\n\t\t\t\t\techo '<pre>'; print_r(\"modelo completa\"); echo '</pre>';\n\n\t\t\t\t\tModule::loadLayout();\n\t\t\t\t}\n\n\t\t\t\tinclude $url;\t\t\t\t\n\t\t\t}else{\n\n\t\t\t\tView::Error(\"<b>404 NOT FOUND</b> View <b>\".$_GET['view'].\"</b> folder !! - <a href='http://evilnapsis.com/legobox/help/' target='_blank'>Help</a>\");\n\t\t\t}\n\t\t}\n\t}",
"public function render($view, array $parametri = null) {\n $file = str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) .\n 'views/' . $this->_cartella . '/' . $view . '.php';\n if (file_exists($file)) :\n if (isset($parametri)) :\n foreach ($parametri as $key => $value) :\n ${$key} = $value;\n endforeach;\n endif;\n if (strlen($this->layout) > 0) :\n $layout = str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) .\n 'views/layouts/' . $this->layout . '.php';\n if (file_exists($layout)) :\n $contenutoPagina = $file;\n require $layout;\n else :\n die(\"Il layout '$layout' non esiste :-(\");\n endif;\n else :\n require $file;\n endif;\n else :\n die(\"La view '$view' non esiste :-(\");\n endif;\n }",
"public function show($file, array $data = array()){\n \n //incluant le chemin vers nos vues\n $engine = new \\League\\Plates\\Engine(self::PATH_VIEWS);\n\n //charge nos extensions (nos fonctions personnalisées)\n $engine->loadExtension(new \\W\\View\\Plates\\PlatesExtensions());\n\n $app = getApp();\n\n // Rend certaines données disponibles à tous les vues\n // accessible avec $w_user & $w_current_route dans les fichiers de vue\n $engine->addData(\n [\n 'w_user' => $this->getUser(),\n 'w_current_route' => $app->getCurrentRoute(),\n 'w_site_name' => $app->getConfig('site_name'),\n ]\n );\n\n // Je peux ajouter des variables qui seront disponible dans tout les fichier view\n // $this->tabVariableView = [\n // \"var1\" => date(\"Y\"),\n // ];\n \n // $this->setVar(\"var1\", date('Y'));\n\n //$engine->addData($this->tabVariableView);\n\n // On peut ajouter des fonctions supplementaire dans la partie view\n // $engine->registerFunction('afficherDate', function(){\n // echo date(\"Y\");\n // });\n\n $engine->registerFunction('afficherVarGlob', function($nomVar){\n if (isset($GLOBALS[\"$nomVar\"])){echo $GLOBALS[\"$nomVar\"];};\n });\n\n\n // Retire l'éventuelle extension .php\n $file = str_replace('.php', '', $file);\n\n // Affiche le template\n echo $engine->render($file, $data);\n die();\n }",
"function page_settings( $view_file, $view_data, $data_name = 'result', $page_title = '', $module = '' )\n {\n\t$data[ $data_name ] = $view_data;\n\t$data[ 'view_file' ] = $view_file;\n\t$data[ 'page_title' ] = $page_title;\n\tif ( $module != '' ) {\n\t $data[ 'module' ] = $module;\n\t}\n\treturn $data;\n }",
"public function view_file() {\n\t\t$currentPath = implode('/', $this->passedArgs);\n\t\t$fullPath = $this->path . $currentPath;\n\t\t$previousPath = implode('/', array_slice($this->passedArgs, 0, count($this->passedArgs) -1));\n\t\t$upOneFolder = implode('/', array_slice($this->passedArgs, 0, count($this->passedArgs) -2));\n\n\t\tif (!file_exists($fullPath)) {\n\t\t\t$this->_notFound(__('No file exists with that name', true));\n\t\t}\n\t\ttry {\n\t\t\t$docs = $this->ApiFile->loadFile($fullPath);\n\t\t} catch(Exception $e) {\n\t\t\t$this->_notFound($e->getMessage());\n\t\t}\n\t\t$classIndex = ClassRegistry::init('ApiGenerator.ApiClass')->getClassIndex();\n\t\tlist($dirs, $files) = $this->ApiFile->read($this->path . $previousPath);\n\n\t\tif (!empty($docs)) {\n\t\t\t$this->set('showSidebar', true);\n\t\t\t$this->set('sidebarElement', 'sidebar/file_sidebar');\n\t\t\t$this->set(compact('currentPath', 'previousPath', 'upOneFolder', 'docs', 'dirs', 'files', 'classIndex'));\n\t\t} else {\n\t\t\t$this->set('previousPath', $previousPath);\n\t\t\t$this->render('no_class');\n\t\t}\n\t}",
"public function plantilla(){\n //el include se utiliza para invocar el archivo que tiene el codigo html\n include \"View/template.php\";\n }",
"public function index() {\n\t$data = ['variabel1' => 'CodeIgniter','variabel2'=>'3.x'];\n\n\t// mengirim data ke view\n\t$this->load->view('variabelview', $data);\n\n\t}",
"public function view($view,$data=[]){\n\n if(file_exists('../app/views/'.$view.'.php')){\nrequire_once '../app/views/'.$view.'.php';\n\n }\n else{\n die('view does not exists!');\n }\n }",
"function method_layout($request)\n{\n global $_PREFS,$_STORAGE;\n \n $log = LoggerManager::getLogger('swim.method.layout');\n checkSecurity($request, false, true);\n \n $path = $_PREFS->getPref('storage.site.templates').'/'.$request->getPath();\n $path = findDisplayableFile($path);\n if ($path != null)\n {\n $type = determineContentType($path);\n $cachetime = filemtime($path);\n if (isTemplateFile($path))\n {\n $smarty = createSmarty($request, $type);\n $log->debug('Starting display.');\n $result = $smarty->fetch($path);\n if (!RequestCache::isCacheDefined())\n RequestCache::setCacheInfo(max($cachetime, $_STORAGE->singleQuery('SELECT MAX(published) FROM VariantVersion;')));\n setContentType($type);\n print($result);\n $log->debug('Display complete.');\n }\n else\n {\n setContentType($type);\n RequestCache::setCacheInfo($cachetime);\n include($path);\n }\n }\n else\n displayNotFound($request);\n}",
"public function render(string $path,$variables=[]){\n //['var1'=>2]\n // qu'il y'a réellement après transformation une variables\n //$var1 =2;\n \n extract($variables);\n \n\n ob_start();\n require('vues/template/'.$path.'.html.php');\n $pageContent = ob_get_clean();\n\n require('vues/template/layout.html.php');\n \n }",
"public function view($page = 'home')\n {\n if (!file_exists(APPPATH . 'views/pages/' . $page . '.php')) {\n show_404();\n }\n //title qui est injecté dans views/pages\n $data['title'] = ucfirst($page);\n //on les load\n //$this->load->view('templates/header', $data);\n $this->load->view('pages/' . $page, $data);\n //$this->load->view('templates/footer', $data);\n }",
"public function view($halaman, $data = null)\n {\n $sidebar = '';\n $levelAkses = $this->CI->session->userdata('level_akses');\n\n if($levelAkses == 'ADMIN'){\n $sidebar=$this->CI->menu->sidebar();\n }elseif($levelAkses == 'AGEN'){\n $sidebar=$this->CI->menu->Agen();\n }elseif($levelAkses == 'MANAGER'){\n $sidebar=$this->CI->menu->Agen();\n }else{\n redirect(base_url('Login/Logout'));\n }\n\n $menu['menu'] = $sidebar;\n\n\n $this->CI->load->view('PARTIAL/head');\n $this->CI->load->view('PARTIAL/menu_mobile',$menu);\n $this->CI->load->view('PARTIAL/menu_desktop',$menu);\n $this->CI->load->view('PARTIAL/header_desktop');\n $this->CI->load->view(\"DALAM/$halaman\",$data);\n $this->CI->load->view('PARTIAL/footer');\n }",
"function pemeriksaanLangsung()\n\t{\n\t\t$this->load->view('static/header');\n\t\t$this->load->view('static/navbar');\n\t\t$this->load->view('dokter/tambah_antrian');\n\t\t$this->load->view('static/footer');\n\t}",
"public function plantilla(){\n # se usa este include para incluir la vista que contiene el codigo html\n include \"view/template.php\";\n\n }",
"public function setLayout($file);",
"public function show($view_name, $variables=[]){\n $contents = $this->engine->parse($this->view_loader->load($view_name),\n $variables\n );\n echo $contents;\n //$path = BASEPATH . '/views/' . $view_name;\n //$file = file_get_contents($path);\n //$file = $this->engine->parse($this->view_loader->load($view_name),\n // $variables\n // );\n //file_put_contents($path, $file);\n //dd($variables);\n //include BASEPATH . '/views/' . $view_name;\n }",
"function view( $view ){\n\tinclude getApplicationSystemPath() . \"/public/view/\" . $view;\t\n}",
"function loadView($file, $params = array()) {\n \n if(!empty($params)) {\n extract($params);\n } \n \n include realpath(dirname(__FILE__)).'/../view/'.$file.'.php';\n}",
"private static function view()\n {\n $files = ['View'];\n $folder = static::$root.'MVC/View'.'/';\n\n self::call($files, $folder);\n\n $files = ['Template', 'Views'];\n $folder = static::$root.'MVC/View/Libs'.'/';\n\n self::call($files, $folder);\n\n $files = ['ViewNotFoundException'];\n $folder = static::$root.'MVC/View/Exceptions'.'/';\n\n self::call($files, $folder);\n }"
]
| [
"0.65311396",
"0.6444334",
"0.64245856",
"0.6382996",
"0.62439847",
"0.6234691",
"0.6196402",
"0.6172213",
"0.61573786",
"0.6133989",
"0.6130989",
"0.6085823",
"0.6025679",
"0.6016848",
"0.6016804",
"0.5999175",
"0.5988121",
"0.5977091",
"0.5955593",
"0.5945905",
"0.5938514",
"0.592744",
"0.59009415",
"0.5894568",
"0.58907574",
"0.5880051",
"0.5878058",
"0.587737",
"0.58723515",
"0.585133"
]
| 0.71688986 | 0 |
pada key find return berupa array dengan name, operator dan value | protected function finder($parameter = "PARAM_1"){
$search = array('find','order');
$return = array('find'=>'','order'=>'');
if(empty(RO::$LP[$parameter])){
return $return;
}else{
$arr = explode("*",RO::$LP[$parameter]);
foreach($arr as $ar){
$data = explode("=",$ar);
if(sizeof($data)==2 && in_array($data[0],$search)){
$return[RO::$DB->inputFilter($data[0])]=RO::$DB->inputFilter($data[1]);
}
}
}
if(!empty($return['find'])){
$find = array();
$data = explode(",",urldecode($return['find']));
foreach($data as $data){
switch(preg_replace("/[A-Za-z0-9 ]/", '', $data)){
case ":":
$data = str_replace(":",":=:",$data);
break;
case "!:":
$data = str_replace("!:",":!=:",$data);
break;
case ">":
$data = str_replace(">",":>:",$data);
break;
case "<":
$data = str_replace("<",":<:",$data);
break;
}
//echo $data;
$data_r = explode(":",$data);
if(sizeof($data_r)==3){
if(!empty($find))$find.=" and";
$find[] = array("name"=>$data_r[0],"operator"=>$data_r[1],"value"=>$data_r[2]);
}
}
$return['find'] = $find;
}
return $return;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getOperatorKey();",
"function get_operator1()\n \t{\n\t\t$sql=$this->db2->query(\"select travel_id,operator_title from registered_operators \");\n $data=array(); \n foreach ($sql->result() as $rows)\n {\n \t$data[$rows->travel_id]=$rows->operator_title;\n }\n\t\treturn $data;\n }",
"public function getOperatorValue();",
"public function getOperators();",
"public static function alm_filters_return_key_operators(){\n\t \treturn self::$alm_filters_key_operators;\n \t}",
"function searchFieldArray($option_name,$value_name) {\n\n\t\tglobal $t;\n\n\t\tfor ($i=0; $i<count($option_name); $i++) {\n\n\t\t\t$output .= \"<tr bgcolor=$t->tableColor>\n\t\t\t\t\t\t<td>\".$value_name[$i].\"</td>\n\t\t\t\t\t\t<td><input type=\\\"text\\\" name=\\\"query[]\\\"><input type=\\\"hidden\\\" name=\\\"field[]\\\" value=\\\"\".$option_name[$i].\"\\\"></td>\n\t\t\t\t\t\t</tr>\";\n\t\t}\n\t\treturn $output;\n\t}",
"abstract public function get_operator();",
"abstract function getOperator() : string ;",
"public function getOperator();",
"public function getOperator();",
"function getOperators($strName,$arrRule) {\n\t\tglobal $LANG;\n $arrOptions = array(\n 'eq' => 'equal',\n 'ne' => 'notEqual',\n 'ss' => 'contains',\n 'ns' => 'notContains',\n 'gt' => 'greater',\n 'ge' => 'greaterEqual',\n 'lt' => 'less',\n 'le' => 'lessEqual',\n 'set' => 'set',\n 'notset' => 'notSet'\n );\n $arrCurQuestion = $this->arrPrevQuestions[stripslashes($arrRule['field'])];\n if (in_array($arrCurQuestion['question_type'],array(1,3,10,14,23))) {\n $arrOperators = $arrCurQuestion['options_required']?array('eq','ne','ss','ns'):array('eq','ne','ss','ns','set','notset');\n } elseif (in_array($arrCurQuestion['question_type'],array(2,4,5))) {\n $arrOperators = $arrCurQuestion['options_required']?array('eq','ne'):array('eq','ne','set','notset');\n } elseif (in_array($arrCurQuestion['question_type'],array(7,15))) {\n $arrOperators = $arrCurQuestion['options_required']?array('ss','ns'):array('ss','ns','set','notset');\n } elseif (in_array($arrCurQuestion['question_type'],array(11,12,13))) {\n $arrOperators = $arrCurQuestion['options_required']?array('eq','ne','gt','ge','lt','le'):array('eq','ne','gt','ge','lt','le','set','notset');\n }\n if (!$this->blnLocalization) {\n \t$arrOutput[] = '<select name =\"'.$strName.'[operator]\" onChange=\"submit();\")>';\n\t\t\tforeach($arrOperators as $strKey) {\n\t\t\t\t$arrOutput[] = '<option value=\"'.$strKey.'\" '.($arrRule['operator']==$strKey?'selected=\"selected\"':'').'>'.$LANG->getLL('conditions_'.$arrOptions[$strKey]).'</option>';\n\t\t\t}\n\t $arrOutput[] = '</select>';\n\t\t} else {\n\t\t\tforeach($arrOperators as $strKey) {\n\t\t\t\tif ($arrRule['operator']==$strKey) {\n\t\t\t\t\t$arrOutput[] = '<input type=\"hidden\" name=\"'.$strName.'[operator]\" value=\"'.$strKey.'\" />';\n\t\t\t\t\t$arrOutput[] = $LANG->getLL('conditions_'.$arrOptions[$strKey]).'<br />';\n\t\t\t\t}\n\t\t\t}\n }\n $arrOutput[] = ($arrRule['operator']=='set'||$arrRule['operator']=='notset')?'':implode(chr(10),$this->getAnswers($strName,$arrRule));\n\t\treturn $arrOutput;\n\t}",
"public function getOperatorData($operator = null)\n {\n static $data = [];\n $locale = Yii::$app->language;\n if(! isset($data[$locale]) ) {\n $data[$locale] = [\n \"and\" => [\n 'translation' => Yii::t('app', \"{leftOperand} and {rightOperand}\"),\n 'type' => self::TYPE_BOOLEAN\n ],\n \"or\" => [\n 'translation' => Yii::t('app', \"{leftOperand} or {rightOperand}\"),\n 'type' => self::TYPE_BOOLEAN\n ],\n \"<>\" => [\n 'translation' => Yii::t('app', \"{field} is not {value}\"),\n 'type' => self::TYPE_COMPARATOR\n ],\n \"=\" => [\n 'translation' => Yii::t('app', \"{field} is {value}\"),\n 'type' => self::TYPE_COMPARATOR\n ],\n \"contains\" => [\n 'translation' => Yii::t('app', \"{field} contains {value}\"),\n 'type' => self::TYPE_COMPARATOR\n ],\n \"notcontains\" => [\n 'translation' => Yii::t('app', \"{field} does not contain {value}\"),\n 'type' => self::TYPE_COMPARATOR\n ],\n \"startswith\" => [\n 'translation' => Yii::t('app', \"{field} starts with {value}\"),\n 'type' => self::TYPE_COMPARATOR\n ],\n \">\" => [\n 'translation' => Yii::t('app', \"{field} is greater than {value}\"),\n 'type' => self::TYPE_COMPARATOR\n ],\n// \">=\" => [\n// 'translation' => Yii::t('app', \"{field} is greater than or equal to {value}\"),\n// 'type' => self::TYPE_COMPARATOR\n// ],\n \"<\" => [\n 'translation' => Yii::t('app', \"{field} is smaller than {value}\"),\n 'type' => self::TYPE_COMPARATOR\n ],\n// \"<=\" => [\n// 'translation' => Yii::t('app', \"{field} is smaller than or equal to {value}\"),\n// 'type' => self::TYPE_COMPARATOR\n// ],\n// \"between\" => [\n// 'translation' => Yii::t('app', \"{field} is between {value}\"),\n// 'type' => self::TYPE_COMPARATOR\n// ],\n// \"sortby\" => [\n// 'translation' => Yii::t('app', \"sort by {value}\"),\n// 'type' => self::TYPE_COMPARATOR\n// ],\n// \"empty\" => [\n// 'translation' => Yii::t('app', \"{field} is empty\"),\n// 'type' => self::TYPE_COMPARATOR\n// ],\n// \"notempty\" => [\n// 'translation' => Yii::t('app', \"{field} is not empty\"),\n// 'type' => self::TYPE_COMPARATOR\n// ]\n ];\n }\n return $operator ? $data[$locale][$operator] : $data[$locale];\n }",
"public function __get($name_function){//this nameok\n foreach ($this->check_array() as $key => $value):\n if($this->check_val===$key)://check val==key were is the key??\n return preg_match( $value,$this->name);\n endif;\n endforeach;\n \n}",
"public function operators();",
"public function getOperator(): string;",
"public function getOperator(): string;",
"function get_dropdown_array($value){\n $result = array();\n $array_keys_values = $this->db->query('select Kode, '.$value.' from karyawan order by Kode asc');\n $result[0]=\"-- Pilih Urutan Kode --\";\n foreach ($array_keys_values->result() as $row)\n {\n $result[$row->Kode]= $row->$value;\n }\n return $result;\n }",
"public function in_array_r($array, $field, $find){\n\t\t$tmp = array();\n\t foreach($array as $item){\n\t if($item[$field] == $find){ \n\t $tmp = $item['prov_name'];\n\t // echo \"array ->\".$item['prov_name'].\"<br />\";\n\t\t }\n\t }\n\t return $tmp;\n\t}",
"public function getOperators()\n {\n return array();\n }",
"public function getOperators()\n {\n return array();\n }",
"public function find(): array;",
"protected abstract function getOperator();",
"function MyMod_Data_Fields_Sql_Where($data,$value)\n {\n $where=array();\n if (!empty($this->SqlWhere[ $data ]))\n {\n $where[ $data ]=$this->SqlWhere[ $data ];\n }\n return $where;\n }",
"public function operators() {\n $operators = [\n 'in' => [\n 'title' => $this->t('Is one of'),\n 'short' => $this->t('in'),\n 'short_single' => $this->t('='),\n 'method' => 'opSimple',\n 'values' => 1,\n ],\n 'not in' => [\n 'title' => $this->t('Is not one of'),\n 'short' => $this->t('not in'),\n 'short_single' => $this->t('<>'),\n 'method' => 'opSimple',\n 'values' => 1,\n ],\n ];\n // if the definition allows for the empty operator, add it.\n if (!empty($this->definition['allow empty'])) {\n $operators += [\n 'empty' => [\n 'title' => $this->t('Is empty (NULL)'),\n 'method' => 'opEmpty',\n 'short' => $this->t('empty'),\n 'values' => 0,\n ],\n 'not empty' => [\n 'title' => $this->t('Is not empty (NOT NULL)'),\n 'method' => 'opEmpty',\n 'short' => $this->t('not empty'),\n 'values' => 0,\n ],\n ];\n }\n\n return $operators;\n }",
"public function array_load_with_operator($table_name,$identifier,$value,$operator) {\n\t\t$array = array();\n\t\t$result = mysqli_query($this->link, \"SELECT * FROM \".$this->db_prefix.$table_name.\" WHERE \".$identifier.$operator.\"'\".$value.\"'\");\n\t\tif ($result) {\n\t\t\twhile($row = mysqli_fetch_assoc($result)) {\n\t\t\t\t$array[] = $row;\n\t\t\t}\n\t\t}\n\t\treturn $array;\n\t}",
"function foreachResult($result,$field,$print){\n $data = array();\n foreach($result->result() as $a){\n for($b = 0; $b<count($field);$b++){ /*untuk ngeloop semua variable yang dinginkan*/\n $string = $field[$b];\n $data[$print[$b]] = $a->$string; /* $data[0][\"nama_mahasiswa\"] = \"joni\"; $data[0][\"jurusan_mahasiswa\"] = \"sistem informasi */\n }\n }\n return $data;\n }",
"function perolehan_medali($arr){\n // Kode kamu di sini\n}",
"function get_label($arr, $action, $param1, $param2){\n\t\tif(is_array($arr)){\n\t\t\tforeach($arr as $row){\n\t\t\t\tif ($row->action == $action and\n\t\t\t\t\t$row->param1 == $param1 and\n\t\t\t\t\t$row->param2 == $param2)\n\t\t\t\t\treturn $row->label;\n\t\t\t}\n\t\t}\n\t\treturn $action.\": \".$param1.\" \".$param2;\n\t}",
"function enArray($valor,$array){\n\tforeach(array_keys($array) as $n){\n\t\tif(siExiste($n,$valor) && !$ok){\n\t\t\t$ok = true;\n\t\t\t$find = $n;\n\t\t\tbreak;\n\t\t}else{$find = false;}\t\n\t}\n\treturn $find;\n}",
"public function getSearchArray();"
]
| [
"0.57539314",
"0.5573134",
"0.54574764",
"0.54483974",
"0.54365456",
"0.54159504",
"0.5404738",
"0.5349896",
"0.53194726",
"0.53194726",
"0.53107303",
"0.52781165",
"0.5263611",
"0.52386516",
"0.52033454",
"0.52033454",
"0.51769423",
"0.5166998",
"0.5166187",
"0.5166187",
"0.5154204",
"0.51514655",
"0.51507735",
"0.5120087",
"0.51179624",
"0.5110817",
"0.5089526",
"0.5085864",
"0.50798327",
"0.50480163"
]
| 0.56456256 | 1 |
Get index analysis list. | public function getIndexAnalysis()
{
foreach ($this->items as $item) {
if ('index' == $item->getName()) {
return $item;
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getIndexList() {\n return self::$indexes;\n }",
"public function indexes()\r\n {\r\n return $this->indexes;\r\n }",
"public function getIndexing(): array {\n\t\treturn $this->_indexing;\n\t}",
"function &getIndexes(){\n\t\treturn array();\n\t}",
"public function listIndexes() : array\n {\n // see here:\n // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html\n\n $url = $this->getHostUrlString() . '/_stats';\n $request = new \\GuzzleHttp\\Psr7\\Request('GET', $url);\n $response = $this->sendWithCredentials($request);\n\n $httpcode = $response->getStatusCode();\n $result = (string)$response->getBody();\n if ($httpcode < 200 || $httpcode > 299)\n throw new \\Flexio\\Base\\Exception(\\Flexio\\Base\\Error::READ_FAILED);\n\n $result = json_decode($result, true);\n\n $indexes = [];\n\n if (isset($result['indices']))\n {\n $indices = $result['indices'];\n foreach ($indices as $index_name => $index_info)\n {\n // only show indices that aren't hidden\n //if (substr($index_name, 0, 1) === '.')\n // continue;\n\n // TODO: include other information from the stats\n $indexes[] = array('name' => $index_name,\n 'path' => '/' . $index_name,\n 'size' => null,\n 'modified' => null,\n 'hash' => '', // TODO: available?\n 'type' => 'FILE');\n }\n }\n\n return $indexes;\n }",
"public function getIndexes()\n {\n\treturn $this->indexes;\n }",
"public function getIndexes()\n\t{\n $result = $this->fetchingData(array(\n 'query' => \"SHOW INDEX FROM `$this->table`\"\n ));\n\n return $result;\n\t}",
"protected function getIndexAliasList() {\n if (self::$indexAliases === null) {\n self::$indexAliases = array();\n \n $config = wcmConfig::getAssocInstance();\n $indexes = $config['wcm']['search']['indexes']['index'];\n if ($indexes) {\n if (!is_array($indexes))\n $indexes = array($indexes);\n \n foreach ($indexes as $index) {\n // Index names are case-insensitive\n $name = strtolower($index['name']);\n \n $aliases = $index['aliases']['alias'];\n if ($aliases) {\n if (!is_array($aliases))\n $aliases = array($aliases);\n \n foreach ($aliases as $alias) {\n // Alias names are case-insensitive\n self::$indexAliases[strtolower($alias)] = $name;\n }\n }\n }\n }\n }\n \n return self::$indexAliases;\n }",
"public function getIndexes()\n {\n return $this->indexes;\n }",
"public function index() {\n return $this->handleNotFound(function () {\n $list = [];\n\n foreach ($this->researchService->findAll($this->userId) as $research) {\n $list[] = $this->service->findAll($this->userId, $research->getResearchIndex());\n }\n\n return $list;\n });\n }",
"public function getIndex()\n {\n return $this->get(self::_INDEX);\n }",
"public function getIndex()\n\t{\n\n\t\tself::addArgument('courses', Course::actives());\n\n\t\treturn self::make('index');\n\n\t}",
"public function getAllIndexes()\n {\n return $this->indexes;\n }",
"public function getIndex();",
"public function getIndex();",
"public function getIndex();",
"public function getIndex() {\n \treturn $this->index;\n }",
"public function getIndex()\n {\n return $this->index;\n }",
"public function getIndex()\n {\n return $this->index;\n }",
"public function getIndex()\n {\n return $this->index;\n }",
"public function getIndex()\n {\n return $this->index;\n }",
"function index_all(){\n\t\t$this->_clear_tmp(0);\n\t\t$this->del_results();\n\t\treturn $this->index(0,true);\n\t}",
"public function getIndex() {\n return $this->index;\n }",
"public function getIndex() {\n return $this->index;\n }",
"public function getIndex() {\n return $this->index;\n }",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}",
"public function getIndex() {}"
]
| [
"0.7082457",
"0.67375916",
"0.6698405",
"0.6595022",
"0.652941",
"0.6514945",
"0.6447243",
"0.64356303",
"0.637934",
"0.6332764",
"0.63231957",
"0.62936634",
"0.62140125",
"0.61970156",
"0.61970156",
"0.61970156",
"0.61759204",
"0.61656284",
"0.61656284",
"0.61656284",
"0.61656284",
"0.61553985",
"0.6155162",
"0.6155162",
"0.6155162",
"0.6138888",
"0.6138888",
"0.61387104",
"0.6138701",
"0.6138701"
]
| 0.68862194 | 1 |
This is a small library for maintaining flash messages in PHP. It provides an easy way, for sending data back to the views, from the controller, by adding a "flash(type,message)" function. The flash message will only remain there for one request! Internally, the flash message is removed, once you open a new URI. In order for the flash functionality for work properly, remember to initialize sessions on all pages AND call the unsetFlash() function on ALL pages as well. Sets a message in the given type, within 1 REQUEST. After one request, the message is removed. $type, the type to set. E.g. notice, error etc. $message, the message to set | function flash($type, $message) {
// creates the flash holder, if not defined yet
if(!isset($_SESSION['flash'])) {
$_SESSION['flash'] = array();
$_SESSION['flash']['uri'] = $_SERVER['REQUEST_URI'];
}
// sets the message
$_SESSION['flash'][$type] .= $message;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setFlash($type, $message)\n{\n $_SESSION['message'] = [$type, $message];\n}",
"function setFlash($message, $type = 'success') {\n $this->session->set_flashdata($type, $message);\n }",
"function flash_message($type, $message) {\n $_SESSION['message'] = array('type' => $type, 'message' => $message);\n if (isset($_SESSION['message'])) {\n\t\tprint_r( $_SESSION['message']);\n\t}\n}",
"public static function flash($type, $message = null) {\n if(func_num_args() == 1) {\n $message = $type;\n $type = null;\n }\n $msg = new stdClass;\n $msg->message = $message;\n $msg->type = $type;\n self::addMessage($msg);\n }",
"public function flashMessage($message, $type = 'info')\n\t{\n\t\t$flash = parent::flashMessage($message, $type);\n\t\t$flash->count = NULL;\n\t\t$flash->parameters = [];\n\t\treturn $flash;\n\t}",
"public function setFlash($_type, $_message) {\n return $this->_container->get('session')->getFlashBag()->add($_type, $_message);\n }",
"public function setFlash($_type, $_message) {\n return $this->_container->get('session')->getFlashBag()->add($_type, $_message);\n }",
"public function setFlash($_type, $_message) {\n return $this->_container->get('session')->getFlashBag()->add($_type, $_message);\n }",
"public function setFlash($_type, $_message) {\n return $this->_container->get('session')->getFlashBag()->add($_type, $_message);\n }",
"public function setFlash($_type, $_message) {\n return $this->_container->get('session')->getFlashBag()->add($_type, $_message);\n }",
"function get_flash($type)\n{\n $ci = &get_instance();\n $message = $ci->session->flashdata($type);\n\n if ($message) {\n return htmlentities($message);\n }\n\n return '';\n}",
"function tflash($message, $type = 'info', $id = null, $visibility = null, $removed_ids = null) {\n switch ($type) {\n case 'info':\n $type = TFLASH::INFO;\n break;\n case 'success':\n $type = TFLASH::SUCCESS;\n break;\n case 'error':\n $type = TFLASH::ERROR;\n break;\n default:\n trigger_error('Invalid TFLASH message type \"'. $type .'\" (allowed: info, success, error)', E_USER_WARNING);\n $type = 'info';\n }\n\n TFLASH::add($message, $type, $id, $visibility, $removed_ids);\n}",
"function flash( $name = '', $message = '', $class = 'success fadeout-message', $url = '' )\n{\n if( !empty( $name ) )\n {\n //No message, create it\n if( !empty( $message ) && empty( $_SESSION[$name] ) )\n {\n if( !empty( $_SESSION[$name] ) )\n {\n unset( $_SESSION[$name] );\n }\n if( !empty( $_SESSION[$name.'_class'] ) )\n {\n unset( $_SESSION[$name.'_class'] );\n }\n \n $_SESSION[$name] = $message;\n $_SESSION[$name.'_class'] = $class;\n }\n //Message exists, display it\n elseif( !empty( $_SESSION[$name] ) && empty( $message ) )\n {\n $class = !empty( $_SESSION[$name.'_class'] ) ? $_SESSION[$name.'_class'] : 'success';\n echo '<div class=\"'.$class.'\" id=\"msg-flash\">'.$_SESSION[$name].'</div>';\n unset($_SESSION[$name]);\n unset($_SESSION[$name.'_class']);\n }\n }\n\tif( !empty( $url ) || $url != '' )\n {\n\t\theader('Location: '.$url);\n\t\texit();\n\t}\n}",
"function flash_redirect($message = '', $url = '/', $type = FLASH_MESSAGE)\r\n\t{\r\n\t if ($message != '') \r\n\t {\r\n $this->CI->session->set_flashdata('message', $message);\r\n $this->CI->session->set_flashdata('type', $type);\r\n }\r\n \r\n redirect($url);\r\n\t}",
"public function message($message, $type='info')\n {\n $this->session->flash('flashi.message', $message);\n $this->session->flash('flashi.type', $type);\n }",
"protected function _flash($message, $type = Coda_Helper_Flash::SUCCESS)\n {\n $this->_helper->flash($message, $type);\n }",
"public function flash($type, $message)\n {\n Yii::$app->getSession()->setFlash($type=='error'?'danger':$type, $message);\n }",
"public function flash( $msg, $type = 'info', $params = null ) {\n\t\tklein_start_session();\n\t\tif ( is_array( $type ) ) {\n\t\t\t$params = $type;\n\t\t\t$type = 'info';\n\t\t}\n\t\tif ( ! isset( $_SESSION['__flashes'] ) ) {\n\t\t\t$_SESSION['__flashes'] = array( $type => array() );\n\t\t} elseif ( ! isset( $_SESSION['__flashes'][ $type ] ) ) {\n\t\t\t$_SESSION['__flashes'][ $type ] = array();\n\t\t}\n\t\t$_SESSION['__flashes'][ $type ][] = $this->markdown( $msg, $params );\n\t}",
"public function flash_create($text, $type){\n $_SESSION[\"flash\"]= array(\"text\"=>$text, \"type\"=>$type);\n }",
"public function setFlash($message = NULL, $type = self::FLASH_NOTICE)\n {\n $_SESSION[self::$flash_name] = array($type, $message);\n return true;\n }",
"public function flash($msg, $type = 'info', $params = null)\r\n {\r\n $this->startSession();\r\n if (is_array($type)) {\r\n $params = $type;\r\n $type = 'info';\r\n }\r\n if (!isset($_SESSION['__flashes'])) {\r\n $_SESSION['__flashes'] = array($type => array());\r\n } elseif (!isset($_SESSION['__flashes'][$type])) {\r\n $_SESSION['__flashes'][$type] = array();\r\n }\r\n $_SESSION['__flashes'][$type][] = $this->markdown($msg, $params);\r\n }",
"function flash( $name = '', $message = '', $class = 'success fadeout-message' )\n{\n if( !empty( $name ) )\n {\n //No message, create it\n if( !empty( $message ) && empty( $_SESSION[$name] ) )\n {\n if( !empty( $_SESSION[$name] ) )\n {\n unset( $_SESSION[$name] );\n }\n if( !empty( $_SESSION[$name.'_class'] ) )\n {\n unset( $_SESSION[$name.'_class'] );\n }\n \n $_SESSION[$name] = $message;\n $_SESSION[$name.'_class'] = $class;\n }\n //Message exists, display it\n elseif( !empty( $_SESSION[$name] ) && empty( $message ) )\n {\n $class = !empty( $_SESSION[$name.'_class'] ) ? $_SESSION[$name.'_class'] : 'success';\n echo '<div class=\"'.$class.'\" id=\"msg-flash\">'.$_SESSION[$name].'</div>';\n unset($_SESSION[$name]);\n unset($_SESSION[$name.'_class']);\n }\n }\n}",
"public function flash(string $type, string $message, string $contentType = 'text/plain'): void;",
"function flash($message = null, $type = null)\n {\n $flashMessage = app(\\FlashMessages\\FlashMessageContract::class);\n\n if (!is_null($message)) {\n return $flashMessage->flashMessage($message, $type);\n }\n\n return $flashMessage;\n }",
"function flash($message = null, $level = 'info')\n{\n $session = app('session');\n if (!is_null($message)) {\n $session->flash('flash_notification.message', $message);\n $session->flash('flash_notification.level', $level);\n }\n}",
"function flash($name = '', $message = '', $class = 'uk-alert-success')\n{\n //We can only do something if the name isn't empty\n if (!empty($name)) {\n //No message, create it\n if (!empty($message) && empty($_SESSION[$name])) {\n if (!empty($_SESSION[$name])) {\n unset($_SESSION[$name]);\n }\n if (!empty($_SESSION[$name . '_class'])) {\n unset($_SESSION[$name . '_class']);\n }\n\n $_SESSION[$name] = $message;\n $_SESSION[$name . '_class'] = $class;\n }\n //Message exists, display it\n elseif (!empty($_SESSION[$name]) && empty($message)) {\n $class = !empty($_SESSION[$name . '_class']) ? $_SESSION[$name . '_class'] : 'uk-alert-success';\n echo '<div class=\"' . $class . '\" uk-alert> <a class=\"uk-alert-close\" uk-close></a> <p>' . $_SESSION[$name] . '</p></div>';\n unset($_SESSION[$name]);\n unset($_SESSION[$name . '_class']);\n }\n }\n}",
"function flash($name = '', $message = '', $class = 'alert alert-success')\n{\n // Check that a name is passed in \n // We are storimg the session $name as the KEY\n if (!empty($name)) {\n if (!empty($message) && empty($_SESSION[$name])) {\n if (!empty($_SESSION[$name])) {\n unset($_SESSION[$name]);\n }\n\n if (!empty($_SESSION[$name . '_class'])) {\n unset($_SESSION[$name . '_class']);\n }\n\n // And we are storing the $message as the VALUE\n $_SESSION[$name] = $message;\n\n // setting the class inside of the session variable\n $_SESSION[$name . '_class'] = $class;\n } elseif (empty($message) && !empty($_SESSION[$name])) {\n $class = !empty($_SESSION[$name . '_class']) ? $_SESSION[$name . '_class'] : '';\n // display it here, the div with the class\n echo '<div class=\"' . $class . '\" id=\"msg-flash\">' . $_SESSION[$name] . '</div>';\n // unsetting it\n unset($_SESSION[$name]);\n unset($_SESSION[$name . '_class']);\n }\n }\n}",
"protected function addFlashMessages() {}",
"function flash($message, $level = 'info')\n{\n session()->put('flash_message', $message);\n session()->put('flash_message_level', $level);\n}",
"public function addFlashMsg( $flashType, $message )\n {\n $messageBag = \\Session::get( $flashType, new MessageBag() );\n $messageBag->add( 'default', $message );\n \\Session::flash( $flashType, $messageBag );\n }"
]
| [
"0.78854036",
"0.7882677",
"0.7731601",
"0.766042",
"0.74942124",
"0.74906397",
"0.74906397",
"0.74906397",
"0.74906397",
"0.74906397",
"0.74600935",
"0.74553406",
"0.74356425",
"0.74069107",
"0.73409",
"0.7314372",
"0.72829664",
"0.7235838",
"0.7215568",
"0.7212875",
"0.71854794",
"0.7096901",
"0.70881087",
"0.7075071",
"0.7050214",
"0.70288426",
"0.7008435",
"0.6990106",
"0.6970509",
"0.6957209"
]
| 0.8470573 | 0 |
Set the adapter instance that this ResultSet uses to access data Overrides method declared in \MphpFlickrBase\Result\ResultInterface and defined in \MphpFlickrBase\Result\AbstractResult | public function setAdapter(ResultSetAdapterInterface $adapter)
{
$this->adapter = $adapter;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setAdapter(\\MphpFlickrBase\\Adapter\\Interfaces\\Result\\ResultAdapterInterface $adapter)\n {\n $this->adapter = $adapter;\n return $this;\n }",
"public function setAdapter(AdapterInterface $adapter);",
"public function setAdapter(\\MphpFlickrBase\\Adapter\\Interfaces\\Result\\ResultAdapterInterface $adapter)\n {\n if ($adapter instanceof \\MphpFlickrPhotosGetInfo\\Adapter\\Interfaces\\Result\\TagResultAdapterInterface) {\n return parent::setAdapter($adapter);\n }\n throw new \\MphpFlickrBase\\Exception\\InvalidAdapterException('Invalid adapter supplied');\n }",
"public function setAdapterMethod($adapter);",
"public function setConnection(AdapterInterface $adapter);",
"function setResultSet(/* SQL ResultSet */$rs){\n\t\t$this->main_rs = $rs;\n\t}",
"public function setAdapter(AdapterInterface $adapter)\r\n {\r\n\r\n }",
"public function setAdapter(AdapterInterface $adapter)\n {\n $this->adapter = $adapter;\n return $this;\n }",
"abstract protected function getAdapter();",
"abstract protected function getAdapter();",
"public function setAdapter(AdapterInterface $adapter): self\n {\n $this->adapter = $adapter;\n\n return $this;\n }",
"public function getAdapter();",
"public function getAdapter();",
"public function setAdapter(Adapter\\AbstractAdapter $adapter)\n {\n $this->adapter = $adapter;\n return $this;\n }",
"public function setAdapter(AdapterInterface $adapter)\n {\n $this->adapter = $adapter;\n\n return $this;\n }",
"public function getAdapter()\r\n {\r\n }",
"public function setAdapter(\\Phig\\AdapterInterface $adapter)\n\t{\n\t\t$this->adapter = $adapter;\n\t}",
"function setResults ($result) {\n\t\t$this->_results = $result;\n\t}",
"abstract protected function setresults();",
"public function setAdapter(Adapter $adapter) : void\n {\n $this->adapter = $adapter;\n }",
"public function getAdapter() : Adapter\n {\n return $this->adapter;\n }",
"public function setAdapter($adapter_name)\n {\n $adapterClass = \"\\Zrashwani\\NewsScrapper\\Adapters\\\\\".$adapter_name.\"Adapter\";\n if (class_exists($adapterClass)) {\n $this->adapter = new $adapterClass();\n } else {\n $this->adapter = null;\n }\n\n return $this;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }",
"public function getAdapter()\n {\n return $this->adapter;\n }"
]
| [
"0.74992037",
"0.6896711",
"0.6705414",
"0.66106063",
"0.6476103",
"0.6335383",
"0.62929004",
"0.62388504",
"0.6216327",
"0.6216327",
"0.6167215",
"0.6154692",
"0.6154692",
"0.6147213",
"0.6092458",
"0.60634893",
"0.59717923",
"0.5956674",
"0.5951984",
"0.5929317",
"0.59112334",
"0.58884406",
"0.58365434",
"0.58365434",
"0.58365434",
"0.58365434",
"0.58365434",
"0.58365434",
"0.58365434",
"0.58365434"
]
| 0.7515713 | 0 |
Get Person Entity from PersonDTO | public function getPerson(PersonDTO $personDTO)
{
$person = new Person();
$personID = $personDTO->getPersonId();
$password = $personDTO->getPassword();
// var_dump($personID); exit;
if (isset($personID)) {
$person->setId($personDTO->getPersonId());
$person->setActivationToken($personDTO->getActivationToken());
} else {
$activationToken = mt_rand();
$person->setActivationToken($activationToken);
}
$person->setFirstName($personDTO->getFirstName());
$person->setLastName($personDTO->getLastName());
$person->setTitle($personDTO->getTitle());
$person->setDateOfBirth($personDTO->getDateOfBirth());
$person->setExternalId($personDTO->getExternalId());
$person->setUsername($personDTO->getUsername());
$person->setOrganization($this->organizationRepository->findOneById($personDTO->getOrganization()));
// password set is not required
/*
* if (isset($password)) { $encryptPassword = sha1($password); $person->setPassword($encryptPassword); }
*/
$person->setConfidentialityStmtAcceptDate($personDTO->getConfidentialityStmtAcceptDate());
return $person;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getPerson() {\n return $this->getPersoner()->getSingle();\n }",
"public function getPerson()\n {\n return $this->hasOne(Person::className(), ['id' => 'person_id']);\n }",
"public function dtoToEntity($dto)\n {\n return null;\n }",
"public function person()\n {\n return $this->belongsTo(PersonProxy::modelClass());\n }",
"public function person()\n {\n return $this->belongsTo(PersonProxy::modelClass());\n }",
"public function asDomainEntity()\n {\n return $this->app['company.repository']->find($this->getUID());\n }",
"public function getPersonInfo()\n {\n return new Model\\PersonInfo(\n $this->properties['first_name']->value,\n $this->properties['last_name']->value,\n $this->properties['ssno']->value,\n $this->properties['sex']->value,\n $this->properties['date_of_birth']->value\n );\n }",
"public function find(DTO $dto): ?Model;",
"public function getDto()\n {\n return $this->dto;\n }",
"public function getPerson() {\n return $this->person;\n }",
"public function getPerson() {\n return $this->person;\n }",
"public function findOneEntity()\n {\n $company = $this->em->getRepository('APICoreBundle:Company')->findOneBy([\n 'title' => 'Test Company'\n ]);\n\n if ($company instanceof Company) {\n return $company;\n }\n\n return $this->createEntity();\n }",
"public function getPersonById(int $id): ?Person;",
"public function person () {\n\t\treturn $this->belongsTo(\n\t\t\t'App\\Models\\Person',\n\t\t\t'person_id',\n\t\t\t'person_id'\n\t\t);\n\t}",
"function lookForPerson($person){\n return $this->lookForBOCPerson($person);\n }",
"protected function person()\n {\n try {\n return Person::findOrFail($this->authorizationServer->getResourceOwnerId());\n } catch (ModelNotFoundException $e) {\n throw new PersonNotFoundException;\n }\n }",
"public function recoverPersonUsingCity(Person $person)\n {\n }",
"public function getEntity(): Entity {\n return $this->entity;\n }",
"public function create()\n {\n return new PersonData($this);\n }",
"public function getEntity() {\n return $this->entity;\n }",
"public function getEntity( )\n {\n\n return $this->entity;\n\n }",
"public function show(Person $person)\n {\n $person->species = $person->species()->get();\n $person->planet = $person->planet()->get();\n return response()->json($person);\n }",
"public function getEntity();",
"public function getEntity();",
"public function getEntity();",
"public function getEntity(): object\n {\n $entity = $this->entityManager->getRepository($this->className)->find($this->id);\n if (!$entity) {\n throw new Error('Entity not found for class `' . $this->className . '` and ID `' . $this->id . '`.');\n }\n\n return $entity;\n }",
"public function getEntity()\r\n {\r\n return $this->entity;\r\n }",
"public function getEntity()\n {\n return $this->entity;\n }",
"public function getEntity()\n {\n return $this->entity;\n }",
"public function getEntity()\n {\n return $this->entity;\n }"
]
| [
"0.6408758",
"0.6219274",
"0.5955051",
"0.58665764",
"0.58665764",
"0.58074355",
"0.57732236",
"0.56907105",
"0.5658066",
"0.56308985",
"0.56308985",
"0.5564797",
"0.54990107",
"0.540793",
"0.53897965",
"0.5385895",
"0.5373694",
"0.5362722",
"0.53540456",
"0.52909344",
"0.52429914",
"0.52228415",
"0.521283",
"0.521283",
"0.521283",
"0.52085",
"0.5205295",
"0.52010643",
"0.52010643",
"0.52010643"
]
| 0.666771 | 0 |
Get ContactInfo entity PersonDTO | public function getContactInfo(PersonDTO $personDTO)
{
$contactInfo = new ContactInfo();
$contactInfo->setAddress1($personDTO->getAddress1());
$contactInfo->setAddress2($personDTO->getAddress2());
$contactInfo->setAlternateEmail($personDTO->getAlternateEmail());
$contactInfo->setAlternateMobile($personDTO->getAlternateMobile());
$contactInfo->setAlternateMobileProvider($personDTO->getAlternateMobileProvider());
$contactInfo->setCity($personDTO->getCity());
$contactInfo->setCountry($personDTO->getCountry());
$contactInfo->setHomePhone($personDTO->getHomePhone());
$contactInfo->setOfficePhone($personDTO->getOfficePhone());
$contactInfo->setPrimaryEmail($personDTO->getPrimaryEmail());
$contactInfo->setPrimaryMobile($personDTO->getPrimaryMobile());
$contactInfo->setPrimaryMobileProvider($personDTO->getPrimaryMobileProvider());
$contactInfo->setState($personDTO->getState());
$contactInfo->setZip($personDTO->getZip());
return $contactInfo;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getContactInfo()\n {\n $phoneNumbers = [];\n if (isset($this->properties['contact_mobile_phone'])) {\n $phoneNumbers[] = $this->properties['contact_mobile_phone']->value;\n }\n if (isset($this->properties['contact_home_phone'])) {\n $phoneNumbers[] = $this->properties['contact_home_phone']->value;\n }\n $emailAddresses = [];\n if (isset($this->properties['email'])) {\n $emailAddresses[] = $this->properties['email']->value;\n }\n if (isset($this->properties['contact_alt_email'])) {\n $emailAddresses[] = $this->properties['contact_alt_email']->value;\n }\n return new Model\\ContactInfo(\n $phoneNumbers,\n $emailAddresses\n );\n }",
"public function getPersonInfo()\n {\n return new Model\\PersonInfo(\n $this->properties['first_name']->value,\n $this->properties['last_name']->value,\n $this->properties['ssno']->value,\n $this->properties['sex']->value,\n $this->properties['date_of_birth']->value\n );\n }",
"public function getContactInfo() {\n return $this->contactInfo;\n }",
"protected function createFactoryContactPerson()\n {\n return factory(ContactPerson::class)->create();\n }",
"public function getContact()\n {\n return dd(22222);\n }",
"public function mapToModel($contact);",
"public function getContact()\n {\n return $this->contact;\n }",
"public function getContact(){\n return $this->getParameter('contact');\n }",
"public function getPeopleContactDetails($personId = \"\"){\n if($personId == \"\"){\n return false;\n }\n\n $response = $this->http->get($this->pitchbook_api_url.\"/people/\".$personId.\"/contactinfo\", [], [\n 'type' => 'json',\n 'headers' => ['authorization' => \"PB-Token \".$this->pitchbook_api_key]\n ]); \n return $response;\n }",
"public function getPerson(PersonDTO $personDTO)\n {\n $person = new Person();\n \n $personID = $personDTO->getPersonId();\n $password = $personDTO->getPassword();\n // var_dump($personID); exit;\n if (isset($personID)) {\n $person->setId($personDTO->getPersonId());\n $person->setActivationToken($personDTO->getActivationToken());\n } else {\n $activationToken = mt_rand();\n $person->setActivationToken($activationToken);\n }\n \n $person->setFirstName($personDTO->getFirstName());\n $person->setLastName($personDTO->getLastName());\n $person->setTitle($personDTO->getTitle());\n $person->setDateOfBirth($personDTO->getDateOfBirth());\n $person->setExternalId($personDTO->getExternalId());\n $person->setUsername($personDTO->getUsername());\n $person->setOrganization($this->organizationRepository->findOneById($personDTO->getOrganization()));\n // password set is not required\n /*\n * if (isset($password)) { $encryptPassword = sha1($password); $person->setPassword($encryptPassword); }\n */\n \n $person->setConfidentialityStmtAcceptDate($personDTO->getConfidentialityStmtAcceptDate());\n \n return $person;\n }",
"public function getContact()\n {\n return $this->contact;\n }",
"public function getContact()\n {\n return $this->contact;\n }",
"public function getContact()\n {\n return $this->contact;\n }",
"protected function buildContactObject()\n {\n return new Contact();\n }",
"function InfGetContactDetails($inf_contact_id) {\n $object_type = \"Contact\";\n $class_name = \"Infusionsoft_\" . $object_type;\n $object = new $class_name();\n $objects = Infusionsoft_DataService::query(new $class_name(), array('Id' => $inf_contact_id));\n\n $contact_array = array();\n foreach ($objects as $i => $object) {\n $contact_array[$i] = $object->toArray();\n }\n\treturn $contact_array[0];\n}",
"public function getContactDetailAttribute()\n {\n return $this->contact()->first();\n }",
"function getContact()\n\t{\n\t\treturn $this->Info['Contact'];\n\t}",
"public function returnContact(){\n return $this->contact->getContact(); //Chama a função getContact do objeto contact\n }",
"public function getContactInfo()\n {\n return array_filter([\n 'email' => $this->getEmail(),\n 'phoneNumber' => $this->getPhoneNumber(),\n ]);\n }",
"public function getPerson() {\n return $this->getPersoner()->getSingle();\n }",
"public function getContactDataFields();",
"public function getInfosContact() {\n $listeInfos = $this->getInfos(\"contact\");\n return $listeInfos;\n }",
"public function getReadableContact()\n {\n return Extra::getBeautifulPhone($this->contact);\n }",
"public function getDto()\n {\n return $this->dto;\n }",
"public function getContact()\n {\n return isset($this->contact) ? $this->contact : null;\n }",
"public function getPerson()\n {\n return $this->hasOne(Person::className(), ['id' => 'person_id']);\n }",
"public function contact(){\n return $this->hasOne(Contact::class,'id','contact_id');\n }",
"public function getContacts(): stdClass {\n\n\t\treturn $this->greenApi->request( 'GET',\n\t\t\t'{{host}}/waInstance{{idInstance}}/GetContacts/{{apiTokenInstance}}' );\n\t}",
"public function getFormFields($contact, &$extra_info=array())\n {\n // we need the Tag's as a simple array!\n $tags = array();\n foreach ($contact['tag'] as $tag) {\n $tags[] = $tag['tag_name'];\n }\n\n // create array for the birthday years\n $years = array();\n for ($i = date('Y'); $i > (date('Y')-100); $i--) {\n $years[] = $i;\n }\n $birthday_array = array(\n 'label' => 'Birthday',\n 'format' => 'ddMMyyyy',\n 'years' => $years,\n 'empty_value' => '',\n 'required' => false,\n 'data' => (!empty($contact['person'][0]['person_birthday']) && ($contact['person'][0]['person_birthday'] != '0000-00-00')) ? new \\DateTime($contact['person'][0]['person_birthday']) : null\n );\n\n // get the communication types and values\n $email = $this->ContactControl->getDefaultCommunicationRecord();\n $phone = $this->ContactControl->getDefaultCommunicationRecord();\n $fax = $this->ContactControl->getDefaultCommunicationRecord();\n $cell = $this->ContactControl->getDefaultCommunicationRecord();\n\n foreach ($contact['communication'] as $communication) {\n switch ($communication['communication_type']) {\n case 'EMAIL' :\n $email = $communication;\n break;\n case 'PHONE' :\n $phone = $communication;\n break;\n case 'FAX':\n $fax = $communication;\n break;\n case 'CELL':\n $cell = $communication;\n break;\n }\n }\n\n // private (default) address\n $address_private = $this->ContactControl->getDefaultAddressRecord();\n\n foreach ($contact['address'] as $address) {\n switch ($address['address_type']) {\n case 'PRIVATE': // no longer in use!\n case 'PRIMARY':\n $address_private = $address;\n break;\n }\n }\n\n $access_type = $this->app['contact']->getAccessType($contact['contact']['contact_id']);\n $access_type = $this->app['translator']->trans($access_type);\n\n $form = $this->app['form.factory']->createBuilder('form')\n // contact - hidden fields\n ->add(\"contact_type\", 'hidden', array(\n 'data' => $contact['contact']['contact_type']\n ))\n ->add('contact_id', 'hidden', array(\n 'data' => $contact['contact']['contact_id']\n ))\n ->add('contact_name', 'text', array(\n 'required' => false,\n 'data' => $contact['contact']['contact_name']\n ))\n ->add('contact_login', 'text', array(\n 'required' => !self::$config['email']['required'],\n 'data' => $contact['contact']['contact_login']\n ))\n // contact visible form fields\n ->add('contact_status', 'choice', array(\n 'choices' => array(\n 'ACTIVE' => $this->app['translator']->trans('Active'),\n 'LOCKED' => $this->app['translator']->trans('Locked'),\n 'PENDING' => $this->app['translator']->trans('Pending'),\n 'DELETED' => $this->app['translator']->trans('Deleted')),\n 'empty_value' => false,\n 'expanded' => false,\n 'multiple' => false,\n 'required' => false,\n 'data' => $contact['contact']['contact_status']\n ))\n\n // category - visible form fields\n ->add('category', 'choice', array(\n 'choices' => $this->ContactControl->getCategoryArrayForTwig(),\n 'empty_value' => '- please select -',\n 'expanded' => false,\n 'multiple' => false,\n 'required' => false,\n 'data' => isset($contact['category'][0]['category_type_name']) ? $contact['category'][0]['category_type_name'] : ''\n ))\n\n ->add('category_access', 'text', array(\n 'data' => $access_type,\n 'required' => false,\n 'read_only' => true\n ))\n\n ->add('tag', 'choice', array(\n 'choices' => $this->ContactControl->getTagArrayForTwig(),\n 'expanded' => true,\n 'multiple' => true,\n 'required' => false,\n 'label' => 'Tags',\n 'data' => $tags\n ))\n\n // person - hidden fields\n ->add('person_id', 'hidden', array(\n 'data' => $contact['person'][0]['person_id']\n ))\n\n // person - visible form fields\n ->add('person_gender', 'choice', array(\n 'required' => false,\n 'choices' => array('MALE' => 'Male', 'FEMALE' => 'Female'),\n 'expanded' => true,\n 'data' => $contact['person'][0]['person_gender']\n ))\n ->add('person_title', 'choice', array(\n 'choices' => $this->ContactControl->getTitleArrayForTwig(),\n 'empty_value' => '- please select -',\n 'expanded' => false,\n 'multiple' => false,\n 'required' => false,\n 'data' => $contact['person'][0]['person_title']\n ))\n ->add('person_first_name', 'text', array(\n 'required' => false,\n 'data' => $contact['person'][0]['person_first_name']\n ))\n ->add('person_last_name', 'text', array(\n 'required' => false,\n 'data' => $contact['person'][0]['person_last_name']\n ))\n //->add('person_birthday', 'date', $birthday_array)\n ->add('person_birthday', 'text', array(\n 'required' => false,\n 'data' => (!empty($contact['person'][0]['person_birthday']) && ($contact['person'][0]['person_birthday'] != '0000-00-00')) ? date($this->app['translator']->trans('DATE_FORMAT'), strtotime($contact['person'][0]['person_birthday'])) : '',\n ))\n\n // communication\n ->add('email_id', 'hidden', array(\n 'data' => $email['communication_id']\n ))\n ->add('email', 'email', array(\n 'required' => self::$config['email']['required'],\n 'data' => $email['communication_value']\n ))\n ->add('phone_id', 'hidden', array(\n 'data' => $phone['communication_id']\n ))\n ->add('phone', 'text', array(\n 'required' => false,\n 'data' => $phone['communication_value']\n ))\n ->add('cell_id', 'hidden', array(\n 'data' => $cell['communication_id']\n ))\n ->add('cell', 'text', array(\n 'required' => false,\n 'data' => $cell['communication_value']\n ))\n ->add('fax_id', 'hidden', array(\n 'data' => $fax['communication_id']\n ))\n ->add('fax', 'text', array(\n 'required' => false,\n 'data' => $fax['communication_value']\n ))\n\n // private address\n ->add('address_id', 'hidden', array(\n 'data' => $address_private['address_id']\n ))\n ->add('address_street', 'text', array(\n 'required' => false,\n 'data' => $address_private['address_street']\n ))\n ->add('address_zip', 'text', array(\n 'required' => false,\n 'data' => $address_private['address_zip']\n ))\n ->add('address_city', 'text', array(\n 'required' => false,\n 'data' => $address_private['address_city']\n ))\n ->add('address_area', 'text', array(\n 'required' => false,\n 'data' => $address_private['address_area']\n ))\n ->add('address_state', 'text', array(\n 'required' => false,\n 'data' => $address_private['address_state']\n ))\n ->add('address_country', 'choice', array(\n 'choices' => $this->ContactControl->getCountryArrayForTwig(),\n 'empty_value' => '- please select -',\n 'expanded' => false,\n 'multiple' => false,\n 'required' => false,\n 'data' => $address_private['address_country_code'],\n 'preferred_choices' => self::$config['countries']['preferred']\n ))\n\n ->add('note_id', 'hidden', array(\n 'data' => isset($contact['note'][0]['note_id']) ? $contact['note'][0]['note_id'] : -1\n ))\n ->add('note', 'textarea', array(\n 'required' => false,\n 'data' => isset($contact['note'][0]['note_content']) ? $contact['note'][0]['note_content'] : ''\n ));\n\n // adding the extra fields\n if (isset($contact['extra_fields'])) {\n foreach ($contact['extra_fields'] as $field) {\n $name= 'extra_'.strtolower($field['extra_type_name']);\n switch ($field['extra_type_type']) {\n // determine the form type for the extra field\n case 'TEXT':\n $form_type = 'textarea';\n break;\n case 'HTML':\n $form_type = 'textarea';\n break;\n default:\n $form_type = 'text';\n break;\n }\n\n // add the form field for the extra field\n $form->add($name, $form_type, array(\n 'attr' => array('class' => $name),\n 'data' => $field['extra_value'],\n 'label' => $this->app['utils']->humanize($field['extra_type_name']),\n 'required' => false\n ));\n\n // extra info for the Twig handling\n $extra_info[] = array(\n 'name' => $name,\n 'field' => $field\n );\n }\n }\n return $form;\n }",
"public function getContact(){\n return $this->db->get('contact')->result();\n }"
]
| [
"0.69601005",
"0.6941246",
"0.641348",
"0.6212721",
"0.58988595",
"0.58918095",
"0.58488595",
"0.58258945",
"0.5764656",
"0.57631993",
"0.5751586",
"0.5751586",
"0.5751586",
"0.57353634",
"0.5692605",
"0.5684736",
"0.567657",
"0.5610377",
"0.55615425",
"0.55495363",
"0.5489655",
"0.5455769",
"0.5448913",
"0.5360792",
"0.5337143",
"0.53241444",
"0.52861273",
"0.5284224",
"0.52737266",
"0.52527493"
]
| 0.6996762 | 0 |
Flag to regenerate maps on next loop | public function regenerateMaps(): static
{
$this->generateMaps = true;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function recreateMapsIfTriggered()\n {\n if ($this->isRecreationTriggered) {\n $this->recreateMaps();\n }\n }",
"public function generateMap()\n {\n $map = array();\n $database = $this->binding->getDatabase()->getData();\n\n foreach ($database->classes as $class) {\n $map[$class->name] = $class->clusters;\n }\n\n $this->map = $map;\n $this->cache->save($this->getCacheKey(), $map);\n }",
"public function recreateMaps()\n {\n $maps = $this->getRedirectsMapsByType();\n\n $this->recreateMapFile($maps, static::STATUS_CODE_301_MOVED_PERMANENTLY);\n $this->recreateMapFile($maps, static::STATUS_CODE_302_FOUND);\n\n // apache doesn't need reload\n if ($this->serverType === 'nginx') {\n $this->reloadNginxConfigs();\n }\n }",
"public function fill()\n {\n // Load the serialized map.\n // If there is none or it isn't current we will generate it anew.\n if (!$this->load()) {\n $this->generate();\n }\n\n // Still here? Sounds good\n return true;\n }",
"private function generateMaps(): void\n {\n $this->socketMap = $this->streamMap = [\n self::RESOURCE => [\n self::READ => [],\n self::WRITE => []\n ],\n self::HANDLER => [\n self::READ => [],\n self::WRITE => []\n ]\n ];\n\n $socketCount = $streamCount = 0;\n\n\n\n // Sockets\n foreach ($this->sockets as $id => $binding) {\n /** @var resource|Socket $socket */\n $socket = $binding->getIoResource();\n $resourceId = $this->identifySocket($socket);\n\n if ($binding->isStreamBased()) {\n /** @var resource $socket */\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n } else {\n $this->socketMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->socketMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $socketCount++;\n }\n }\n\n\n // Streams\n foreach ($this->streams as $id => $binding) {\n /** @var resource $stream */\n $stream = $binding->getIoResource();\n $resourceId = (int)$stream;\n\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $stream;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n }\n\n\n // Signals\n $this->signalMap = [];\n\n foreach ($this->signals as $id => $binding) {\n foreach (array_keys($binding->signals) as $number) {\n $this->signalMap[$number][$id] = $binding;\n }\n }\n\n // Cleanup\n if (!$socketCount) {\n $this->socketMap = null;\n }\n\n if (!$streamCount) {\n $this->streamMap = null;\n }\n\n $this->generateMaps = false;\n }",
"public function generateMap()\n {\n try\n {\n // Select all published articles and pages.\n // Lessons and other new stuff to be added upon needed.\n $pgs = ORM::factory( 'Page' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n\n $articles = ORM::factory( 'Article' )\n ->where( 'status', '>', 0 )\n ->find_all()->as_array();\n \n // Place found URLs into the container array.\n $pages = [];\n foreach ( array_merge( $pgs, $articles ) as $value )\n array_push ( $pages, $value->make_full_url () );\n \n // Select whatever is already in the map...\n $urls = [];\n foreach ( $this->map->children() as $node )\n $urls[] = ( string )$node->loc;\n\n // Delete redundant links\n foreach ( array_diff( $urls, $pages ) as $url )\n $this->removeEntry( $url, FALSE, TRUE );\n\n // Add missing links.\n foreach ( array_diff( $pages, $urls ) as $uri )\n $this->addEntry ( $uri, NULL, FALSE, TRUE );\n\n // Save result into the file.\n return $this->save();\n }\n catch ( Exception $e )\n {\n Kohana::$log->add( LOG_ERR, $e->getMessage() );\n return FALSE;\n }\n }",
"abstract protected function buildMap();",
"function newMap($map) {\n\n\t\t// log if not a restart\n\t\t$this->server->gamestate = Server::RACE;\n\t\tif ($this->restarting == 0)\n\t\t\t$this->console_text('Begin Map');\n\n\t\t// refresh game info\n\t\t$this->client->query('GetCurrentGameInfo', 1);\n\t\t$gameinfo = $this->client->getResponse();\n\t\t$this->server->gameinfo = new Gameinfo($gameinfo);\n\n\t\t// check for restarting map\n\t\t$this->changingmode = false;\n\t\tif ($this->restarting > 0) {\n\t\t\t// check type of restart and signal an instant one\n\t\t\tif ($this->restarting == 2) {\n\t\t\t\t$this->restarting = 0;\n\t\t\t} else { // == 1\n\t\t\t\t$this->restarting = 0;\n\t\t\t\t// throw postfix 'restart map' event\n\t\t\t\t$this->releaseEvent('onRestartMap2', $map);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// refresh server name & options\n\t\t$this->getServerOptions();\n\n\t\t// reset record list\n\t\t$this->server->records->clear();\n\t\t// reset player votings\n\t\t//$this->server->players->resetVotings();\n\n\t\t// create new map object\n\t\t$map_item = new Map($map);\n\n\t\t// in Rounds/Team/Cup mode if multilap map, get forced laps\n\t\tif ($map_item->laprace &&\n\t\t ($this->server->gameinfo->mode == Gameinfo::RNDS ||\n\t\t $this->server->gameinfo->mode == Gameinfo::TEAM ||\n\t\t $this->server->gameinfo->mode == Gameinfo::CUP)) {\n\t\t\t$map_item->forcedlaps = $this->server->gameinfo->forcedlaps;\n\t\t}\n\n\t\t// obtain map's GBX data, MX info & records\n\t\t$map_item->gbx = new GBXChallMapFetcher(true);\n\t\ttry\n\t\t{\n\t\t\t$map_item->gbx->processFile($this->server->mapdir . $map_item->filename);\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\ttrigger_error($e->getMessage(), E_USER_WARNING);\n\t\t}\n\t\t$map_item->mx = findMXdata($map_item->uid, true);\n\n\t\t// throw main 'begin map' event\n\t\t$this->releaseEvent('onBeginMap', $map_item);\n\n\t\t// log console message\n\t\t$this->console('map changed [{1}] >> [{2}]',\n\t\t stripColors($this->server->map->name, false),\n\t\t stripColors($map_item->name, false));\n\n\t\t// check for relay server\n\t\tif (!$this->server->isrelay) {\n\t\t\t// check if record exists on new map\n\t\t\t$cur_record = $this->server->records->getRecord(0);\n\t\t\tif ($cur_record !== false && $cur_record->score > 0) {\n\t\t\t\t$score = ($this->server->gameinfo->mode == Gameinfo::STNT ?\n\t\t\t\t str_pad($cur_record->score, 5, ' ', STR_PAD_LEFT) :\n\t\t\t\t formatTime($cur_record->score));\n\n\t\t\t\t// log console message of current record\n\t\t\t\t$this->console('current record on {1} is {2} and held by {3}',\n\t\t\t\t stripColors($map_item->name, false),\n\t\t\t\t trim($score),\n\t\t\t\t stripColors($cur_record->player->nickname, false));\n\n\t\t\t\t// replace parameters\n\t\t\t\t$message = formatText($this->getChatMessage('RECORD_CURRENT'),\n\t\t\t\t stripColors($map_item->name),\n\t\t\t\t trim($score),\n\t\t\t\t stripColors($cur_record->player->nickname));\n\t\t\t} else {\n\t\t\t\tif ($this->server->gameinfo->mode == Gameinfo::STNT)\n\t\t\t\t\t$score = ' ---';\n\t\t\t\telse\n\t\t\t\t\t$score = ' --.--';\n\n\t\t\t\t// log console message of no record\n\t\t\t\t$this->console('currently no record on {1}',\n\t\t\t\t stripColors($map_item->name, false));\n\n\t\t\t\t// replace parameters\n\t\t\t\t$message = formatText($this->getChatMessage('RECORD_NONE'),\n\t\t\t\t stripColors($map_item->name));\n\t\t\t}\n\t\t\tif (function_exists('setRecordsPanel'))\n\t\t\t\tsetRecordsPanel('local', $score);\n\n\t\t\t// if no maprecs, show the original record message to all players\n\t\t\tif (($this->settings['show_recs_before'] & 1) == 1) {\n\t\t\t\tif (($this->settings['show_recs_before'] & 4) == 4 && function_exists('send_window_message'))\n\t\t\t\t\tsend_window_message($this, $message, false);\n\t\t\t\telse\n\t\t\t\t\t$this->client->query('ChatSendServerMessage', $this->formatColors($message));\n\t\t\t}\n\t\t}\n\n\t\t// update the field which contains current map\n\t\t$this->server->map = $map_item;\n\n\t\t// throw postfix 'begin map' event (various)\n\t\t$this->releaseEvent('onBeginMap2', $map_item);\n\n\t\t// show top-8 & records of all online players before map\n\t\tif (($this->settings['show_recs_before'] & 2) == 2 && function_exists('show_maprecs')) {\n\t\t\tshow_maprecs($this, false, 1, $this->settings['show_recs_before']); // from chat.records2.php\n\t\t}\n\t}",
"function mkd_re_enable_maps_in_admin() {\n return true;\n }",
"protected function regenerateKeyCache()\n {\n if(is_array($this->__data))\n {\n $i=0;\n $this->__keycache = array();\n $this->__keycacheindex = array();\n foreach($this->__data as $key => $value)\n {\n $this->__keycache[$key] = $i;\n $this->__keycacheindex[$i] = $key;\n $i++;\n }\n }\n else\n {\n $this->__keycache = null;\n $this->__keycacheindex = null;\n }\n\n $this->__keycacheinvalid = false;\n }",
"public function generateMap() {\n\t\tfor($y = 0; $y < static::MAP_Y; $y++) {\n\t\t\tfor($x = 0; $x < static::MAP_X; $x++) {\n\t\t\t\t$this->map[$y][$x] = 0;\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}",
"abstract protected function _regenerate();",
"public function hasMaps(){\n return $this->_has(15);\n }",
"protected function _createCidToGidMap() {}",
"public function generateInternalCache()\n\t{\n\t\t// Purge\n\t\t$this->purgeInternalCache();\n\n\t\t// Rebuild\n\t\t$this->generateConfigCache();\n\t\t$this->generateDcaCache();\n\t\t$this->generateLanguageCache();\n\t\t$this->generateDcaExtracts();\n\t}",
"private function flush_maps()\r\n {\r\n $fp = fopen(Mapprovider::MAP_STORAGE, \"w\");\r\n fwrite($fp, serialize($this->maps));\r\n fclose($fp);\r\n }",
"public static function clear()\n {\n self::$map = array();\n }",
"function __construct() {\r\n\t\tfor($x=1; $x <= $this->map['width']; $x++):\r\n\t\t\tfor($y=1; $y <= $this->map['height']; $y++):\r\n\t\t\t\t$this->map['tiles'][$x][$y]['init'] = true;\r\n\t\t\tendfor;\r\n\t\tendfor;\t\t\r\n\t}",
"function generate_map_file(){\n\t\t$map = ms_newMapObj($this->default_map_file);\n\t\t$n_layers = count($this->viewable_layers);\n\t\t// go through and create new \n\t\t// layer objects for those layers\n\t\t// that have their display property set\n\t\t// to true, adding them to the\n\t\t// map object\n\t\tfor($i = 0; $i < $n_layers; $i++){\n\t\t\tif($this->viewable_layers[$i]->display == \"true\"){\n\t\t\t\t$layer = ms_newLayerObj($map);\n\t\t\t\t$layer->set(\"name\", $this->viewable_layers[$i]->layer_name);\n\t\t\t\t$layer->set(\"status\", MS_OFF);\n\t\t\t\t$layer->set(\"template\", \"nepas.html\");\n\t\t\t\t$this->set_ms_layer_type($layer, $this->viewable_layers[$i]);\n\t\t\t\t$layer->set(\"connectiontype\", MS_POSTGIS);\n\t\t\t\t$layer->set(\"connection\", $this->dbconn->mapserver_conn_str);\n\t\t\t\t$this->set_ms_data_string($layer, $this->viewable_layers[$i]);\n\t\t\t\t$layer->setProjection($this->viewable_layers[$i]->layer_proj);\n\t\t\t\t// added to allow getfeatureinfo requests on\n\t\t\t\t// this layer via WMS\n\t\t\t\t$layer->setMetaData(\"WMS_INCLUDE_ITEMS\", \"all\");\n\t\t\t\t// generate a CLASSITEM directive \n\t\t\t\tif($this->viewable_layers[$i]->layer_ms_classitem != \"\")\n\t\t\t\t\t$layer->set(\"classitem\", $this->viewable_layers[$i]->layer_ms_classitem);\n\n\t\t\t\t// generate classes that this\n\t\t\t\t// layer contains\n\t\t\t\t$n_classes = count($this->viewable_layers[$i]->layer_classes);\n\t\t\t\tfor($j = 0; $j < $n_classes; $j++){\n\t\t\t\t\t$ms_class_obj = ms_newClassObj($layer);\n\t\t\t\t\t$ms_class_obj->set(\"name\", $this->viewable_layers[$i]->layer_classes[$j]->name);\n\t\t\t\t\t$ms_class_obj->setExpression($this->viewable_layers[$i]->layer_classes[$j]->expression);\n\t\t\t\t\tforeach($this->viewable_layers[$i]->layer_classes[$j]->styles as $style){\n\t\t\t\t\t\t$ms_style_obj = ms_newStyleObj($ms_class_obj);\n\t\t\t\t\t\t$ms_style_obj->color->setRGB($style->color_r,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->color_g,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->color_b);\n\t\t\t\t\t\t// set bg color\n\t\t\t\t\t\t$ms_style_obj->backgroundcolor->setRGB($style->bgcolor_r,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->bgcolor_g,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->bgcolor_b);\n\t\t\t\t\t\t// set outline color\n\t\t\t\t\t\t$ms_style_obj->outlinecolor->setRGB($style->outlinecolor_r,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->outlinecolor_g,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$style->outlinecolor_b);\n\t\t\t\t\t\tif($style->symbol_name != \"\"){\n\t\t\t\t\t\t\t$ms_style_obj->set(\"symbolname\", $style->symbol_name);\n\t\t\t\t\t\t\t// check for valid size\n\t\t\t\t\t\t\tif($style->symbol_size != \"\")\n\t\t\t\t\t\t\t\t$ms_style_obj->set(\"size\", $style->symbol_size);\n\t\t\t\t\t\t\t// check for valid angle\n\t\t\t\t\t\t\tif($style->angle != \"\")\n\t\t\t\t\t\t\t\t$ms_style_obj->set(\"angle\", $style->angle);\n\t\t\t\t\t\t\t// check for valid width\n\t\t\t\t\t\t\tif($style->width != \"\")\n\t\t\t\t\t\t\t\t$ms_style_obj->set(\"width\", $style->width);\n\t\t\t\t\t\t}\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}\n\t\t\n\t\tif($map->save($this->output_mapfile) == MS_FAILURE){\n\t\t\techo \"mapfile could not be saved\";\n\t\t\treturn NULL;\n\t\t}\n\t\t\n\t\treturn $this->output_mapfile;\t\n\t}",
"public function run()\n {\n for ($i = 1; $i < 20; $i++) {\n $map = \\App\\Models\\Map::create([\n 'name' => 'Map_' . $i,\n 'description' => 'Description_' . $i,\n ]);\n\n for ($k = 1; $k < 5; $k++) {\n $layer = $map->layers()->create([\n 'name' => 'Layer_' . $k,\n ]);\n\n for ($t = 1; $t < 5; $t++) {\n $feature = $layer->features()->create([\n 'name' => 'Name_' . $t,\n 'full_name' => 'Full_name_' . $t,\n 'sidc' => 'SFGPU------E***',\n 'command' => 'FTS',\n 'type' => 1,\n ]);\n\n $feature->coordinates()->create([\n 'lat' => '50.4' . rand(1000, 5555),\n 'lng' => '30.5' . rand(1000, 5555),\n ]);\n\n $feature->coordinates()->create([\n 'lat' => '50.4' . rand(5555, 9999),\n 'lng' => '30.5' . rand(5555, 9999),\n ]);\n }\n }\n }\n }",
"public function handleBeginMap() {\n\t\t$this->resetScores();\n\t}",
"public function triggerRecreation($recreateMap = true)\n {\n $this->isRecreationTriggered = $recreateMap;\n }",
"function runningPlay() {\n\t\t// request information about the new map\n\t\t// ... and callback to function newMap()\n\t}",
"function mpfy_duplicate_location_map_meta($post_id) {\n\t$location = new Mpfy_Map_Location($post_id);\n\t$maps = $location->get_maps();\n\n\tdelete_post_meta($post_id, '_map_location_map_id');\n\tforeach ($maps as $map_id) {\n\t\tadd_post_meta($post_id, '_map_location_map_id', $map_id);\n\t}\n}",
"public function testIfMapBagContainsMaps()\n {\n $factory = new FileSystemMapFactory();\n $result = $factory->create($this->data);\n\n $this->assertContainsOnlyInstancesOf('\\SyncFS\\Map\\FileSystemMap', $result);\n }",
"function init_map_groupes(): array\r\n{\r\n $col_depart = 0;\r\n $line_depart = 0;\r\n $num_groupe = 0;\r\n\r\n while ($line_depart !== 9) {\r\n while ($col_depart !== 9) {\r\n for ($y = $line_depart; $y < $line_depart + 3; $y++) {\r\n for ($x = $col_depart; $x < $col_depart + 3; $x++) {\r\n $map[$y][$x] = $num_groupe;\r\n }\r\n }\r\n $col_depart = $col_depart + 3;\r\n $num_groupe++;\r\n }\r\n $col_depart = 0;\r\n $line_depart = $line_depart + 3;\r\n }\r\n\r\n return $map;\r\n}",
"public function hasMapid(){\n return $this->_has(4);\n }",
"public function hasLastmapid(){\n return $this->_has(28);\n }",
"public function regenerate();",
"protected function flushBuiltKeys()\n {\n $this->builtKeys = [];\n }"
]
| [
"0.65725386",
"0.6491732",
"0.62168646",
"0.61658907",
"0.6146166",
"0.596341",
"0.590093",
"0.57501745",
"0.5729325",
"0.5686258",
"0.56847584",
"0.56345874",
"0.55685616",
"0.5566696",
"0.555549",
"0.5534402",
"0.547176",
"0.5454803",
"0.5421473",
"0.5355901",
"0.52955496",
"0.52873826",
"0.5263608",
"0.5247417",
"0.5154737",
"0.51157933",
"0.51042587",
"0.51020604",
"0.5096222",
"0.5091941"
]
| 0.684735 | 0 |
Add new socket to maps | protected function registerSocketBinding(SocketBinding $binding): void
{
$this->regenerateMaps();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function on_user_add(&$user) {\r\n\t\t$this->socket_array[(int)$user->socket] = $user;\r\n\t}",
"public function addRelaySocket($socket)\n\t{\n\t\t$stream = new MioStream($socket, \"relay-socket\".intval($socket));\n\t\t$this->_relays[] = $stream;\n\n\t\t$this->_console(\"adding a socket for relaying\");\n\n\t\t$this->_selector->register(\n\t\t\t$stream,\n\t\t\tMioSelectionKey::OP_WRITE,\n\t\t\tnew Timber_Connection()\n\t\t\t);\n\t}",
"private function generateMaps(): void\n {\n $this->socketMap = $this->streamMap = [\n self::RESOURCE => [\n self::READ => [],\n self::WRITE => []\n ],\n self::HANDLER => [\n self::READ => [],\n self::WRITE => []\n ]\n ];\n\n $socketCount = $streamCount = 0;\n\n\n\n // Sockets\n foreach ($this->sockets as $id => $binding) {\n /** @var resource|Socket $socket */\n $socket = $binding->getIoResource();\n $resourceId = $this->identifySocket($socket);\n\n if ($binding->isStreamBased()) {\n /** @var resource $socket */\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n } else {\n $this->socketMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->socketMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $socketCount++;\n }\n }\n\n\n // Streams\n foreach ($this->streams as $id => $binding) {\n /** @var resource $stream */\n $stream = $binding->getIoResource();\n $resourceId = (int)$stream;\n\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $stream;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n }\n\n\n // Signals\n $this->signalMap = [];\n\n foreach ($this->signals as $id => $binding) {\n foreach (array_keys($binding->signals) as $number) {\n $this->signalMap[$number][$id] = $binding;\n }\n }\n\n // Cleanup\n if (!$socketCount) {\n $this->socketMap = null;\n }\n\n if (!$streamCount) {\n $this->streamMap = null;\n }\n\n $this->generateMaps = false;\n }",
"public function addServer($host, $port, $weight = 0) {}",
"public function createSocket()\n {\n //Create TCP/IP sream socket\n $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);\n //reuseable port\n socket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 1);\n\n //bind socket to specified host\n socket_bind($this->socket, 0, $this->port);\n\n //listen to port\n socket_listen($this->socket);\n\n //create & add listning socket to the list\n $this->clients[0] = [\n $this->socket\n ];\n }",
"protected function socketPerform() {}",
"public function add($sName, $mServers) {\n if(!is_array($mServers)) {\n $mServers = [$mServers];\n }\n\n $this->m_aNetworkInfo [$sName] = ['Servers' => []];\n\n foreach($mServers as $sServerInfo) {\n if(strpos($sServerInfo, ':') === false) {\n $sServerInfo .= ':6667';\n } // Default port\n\n list ($sAddress, $nPort) = explode(':', $sServerInfo);\n $this->m_aNetworkInfo [$sName] ['Servers'] [] = [\n 'IP' => gethostbyname($sAddress),\n 'Port' => $nPort,\n 'Count' => 0\n ];\n }\n\n $this->m_aNetworkInfo [$sName] ['Count'] = 0;\n }",
"function socket_bind($socket, $address, $port = false)\n{\n}",
"public function checkNewConnections()\n {\n $this->changed = [];\n foreach ($this->clients as $socket) {\n $this->changed = array_merge($this->changed, $socket);\n }\n\n //returns the socket resources in $changed array\n socket_select($this->changed, $this->null, $this->null, 0, 10);\n //check for new socket \n if (in_array($this->socket, $this->changed)) {\n $socket_new = socket_accept($this->socket); //accpet new socket\n $this->clients['unknown'][] = $socket_new; //add socket to client array\n\n $header = socket_read($socket_new, 1024); //read data sent by the socket\n $this->perform_handshaking($header, $socket_new, $this->host, $this->port); //perform websocket handshake\n\n socket_getpeername($socket_new, $ip); //get ip address of connected socket\n $response = $this->mask(\n json_encode([\n 'type' => 'system',\n 'message' => $ip . ' connected'\n ])\n ); //prepare json data\n $this->sendMessage($response, $socket_new); //notify about new connection\n\n $found_socket = array_search($this->socket, $this->changed);\n unset($this->changed[$found_socket]);\n }\n }",
"protected function connect($socket) \n\t{\n\t\t$user = new $this->userClass(uniqid('u'), $socket);\n\n\t\t$this->users[$user->id] = $user;\n\t\t$this->sockets[$user->id] = $socket;\n\n\t\t$this->connecting($user);\n\t}",
"protected function _generateSocket() {\n\t}",
"public function enableSocketEvents()\n\t{\n foreach ($this->socketEvents as $ev)\n\t\t{\n event_base_set($ev, Daemon::$process->eventBase);\n event_add($ev, $this->config->ev_timeout->value); // With specified timeout\n }\n }",
"function setServerSocket($socket)\n {\n $this->serverSocket = $socket;\n }",
"function newMap($map) {\n\n\t\t// log if not a restart\n\t\t$this->server->gamestate = Server::RACE;\n\t\tif ($this->restarting == 0)\n\t\t\t$this->console_text('Begin Map');\n\n\t\t// refresh game info\n\t\t$this->client->query('GetCurrentGameInfo', 1);\n\t\t$gameinfo = $this->client->getResponse();\n\t\t$this->server->gameinfo = new Gameinfo($gameinfo);\n\n\t\t// check for restarting map\n\t\t$this->changingmode = false;\n\t\tif ($this->restarting > 0) {\n\t\t\t// check type of restart and signal an instant one\n\t\t\tif ($this->restarting == 2) {\n\t\t\t\t$this->restarting = 0;\n\t\t\t} else { // == 1\n\t\t\t\t$this->restarting = 0;\n\t\t\t\t// throw postfix 'restart map' event\n\t\t\t\t$this->releaseEvent('onRestartMap2', $map);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// refresh server name & options\n\t\t$this->getServerOptions();\n\n\t\t// reset record list\n\t\t$this->server->records->clear();\n\t\t// reset player votings\n\t\t//$this->server->players->resetVotings();\n\n\t\t// create new map object\n\t\t$map_item = new Map($map);\n\n\t\t// in Rounds/Team/Cup mode if multilap map, get forced laps\n\t\tif ($map_item->laprace &&\n\t\t ($this->server->gameinfo->mode == Gameinfo::RNDS ||\n\t\t $this->server->gameinfo->mode == Gameinfo::TEAM ||\n\t\t $this->server->gameinfo->mode == Gameinfo::CUP)) {\n\t\t\t$map_item->forcedlaps = $this->server->gameinfo->forcedlaps;\n\t\t}\n\n\t\t// obtain map's GBX data, MX info & records\n\t\t$map_item->gbx = new GBXChallMapFetcher(true);\n\t\ttry\n\t\t{\n\t\t\t$map_item->gbx->processFile($this->server->mapdir . $map_item->filename);\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\ttrigger_error($e->getMessage(), E_USER_WARNING);\n\t\t}\n\t\t$map_item->mx = findMXdata($map_item->uid, true);\n\n\t\t// throw main 'begin map' event\n\t\t$this->releaseEvent('onBeginMap', $map_item);\n\n\t\t// log console message\n\t\t$this->console('map changed [{1}] >> [{2}]',\n\t\t stripColors($this->server->map->name, false),\n\t\t stripColors($map_item->name, false));\n\n\t\t// check for relay server\n\t\tif (!$this->server->isrelay) {\n\t\t\t// check if record exists on new map\n\t\t\t$cur_record = $this->server->records->getRecord(0);\n\t\t\tif ($cur_record !== false && $cur_record->score > 0) {\n\t\t\t\t$score = ($this->server->gameinfo->mode == Gameinfo::STNT ?\n\t\t\t\t str_pad($cur_record->score, 5, ' ', STR_PAD_LEFT) :\n\t\t\t\t formatTime($cur_record->score));\n\n\t\t\t\t// log console message of current record\n\t\t\t\t$this->console('current record on {1} is {2} and held by {3}',\n\t\t\t\t stripColors($map_item->name, false),\n\t\t\t\t trim($score),\n\t\t\t\t stripColors($cur_record->player->nickname, false));\n\n\t\t\t\t// replace parameters\n\t\t\t\t$message = formatText($this->getChatMessage('RECORD_CURRENT'),\n\t\t\t\t stripColors($map_item->name),\n\t\t\t\t trim($score),\n\t\t\t\t stripColors($cur_record->player->nickname));\n\t\t\t} else {\n\t\t\t\tif ($this->server->gameinfo->mode == Gameinfo::STNT)\n\t\t\t\t\t$score = ' ---';\n\t\t\t\telse\n\t\t\t\t\t$score = ' --.--';\n\n\t\t\t\t// log console message of no record\n\t\t\t\t$this->console('currently no record on {1}',\n\t\t\t\t stripColors($map_item->name, false));\n\n\t\t\t\t// replace parameters\n\t\t\t\t$message = formatText($this->getChatMessage('RECORD_NONE'),\n\t\t\t\t stripColors($map_item->name));\n\t\t\t}\n\t\t\tif (function_exists('setRecordsPanel'))\n\t\t\t\tsetRecordsPanel('local', $score);\n\n\t\t\t// if no maprecs, show the original record message to all players\n\t\t\tif (($this->settings['show_recs_before'] & 1) == 1) {\n\t\t\t\tif (($this->settings['show_recs_before'] & 4) == 4 && function_exists('send_window_message'))\n\t\t\t\t\tsend_window_message($this, $message, false);\n\t\t\t\telse\n\t\t\t\t\t$this->client->query('ChatSendServerMessage', $this->formatColors($message));\n\t\t\t}\n\t\t}\n\n\t\t// update the field which contains current map\n\t\t$this->server->map = $map_item;\n\n\t\t// throw postfix 'begin map' event (various)\n\t\t$this->releaseEvent('onBeginMap2', $map_item);\n\n\t\t// show top-8 & records of all online players before map\n\t\tif (($this->settings['show_recs_before'] & 2) == 2 && function_exists('show_maprecs')) {\n\t\t\tshow_maprecs($this, false, 1, $this->settings['show_recs_before']); // from chat.records2.php\n\t\t}\n\t}",
"protected function getConfiguredSocket() {}",
"public function setSocket($socket)\n {\n $this->_socket = $socket;\n }",
"public function addUserConnected(Request $request){\n $socket = Socket::query()->find($request->get('user_id'));\n if(is_null($socket)){\n $socket = new Socket();\n $socket->user_id = $request->get('user_id');\n $socket->socket = $request->get('socket');\n $socket->save();\n return Response::raw(201, $socket);\n }else if(!is_null($socket)){\n $socket->socket = $request->get('socket');\n $socket->update(['user_id' => $request->get('user_id'), 'socket' => $request->get('socket')]);\n return Response::raw(200, $socket);\n }else{\n return Response::raw(200, []);\n }\n }",
"private function connect(): Imap\n {\n return new Imap(\n $this->config['host'],\n $this->config['port'],\n $this->config['ssl']\n );\n }",
"protected function handleNew($newsock)\n\t{\n\t\tsocket_write($newsock, \"no noobs, but ill make an exception :)\\n\".\n\t\t\"There are \".(count($this->clients) - 1).\" client(s) connected to the server\\n\");\n\n\t\tsocket_getpeername($newsock, $ip);\n\t\techo \"New client connected: {$ip}\\n\";\n\t}",
"protected abstract function newSocket($addr, $port);",
"public function add()\n\t{\n\t\tEvent::add('ushahidi_filter.map_base_layers', array($this, '_add_layer'));\n\t\tif (Router::$controller != 'settings')\n\t\t{\n\t\t\tEvent::add('ushahidi_filter.map_layers_js', array($this, '_add_map_layers_js'));\n\t\t}\n\t}",
"public function testDestiny2InsertSocketPlug()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }",
"protected function onConnect($socket) {\n $client = new Client($socket, Cluster::$mainLoop);\n $worker = false;\n // find any available client\n foreach($this->workers as $w) {\n if (!$w->pipe) {\n $worker = $w;\n break;\n }\n }\n // forward the message\n if ($worker && $worker->pipe($client)) return;\n // no available worker, server is unavailable\n $client->end(Cluster::$busy);\n }",
"public function addSingleMapping($src, $dst) {}",
"protected function socketSelect() {}",
"public function setSocket(HttpSocket $socket) {\n\t\t$this->_socket = $socket;\n\t}",
"function setClientSocket($socket)\n {\n $this->clientSocket = $socket;\n }",
"function handle_connect(&$server,&$client,$input)\r\n{\r\n SocketServer::socket_write_smart($client->socket,\"String? \",\"\");\r\n}",
"function addServers(Array $servers) {\n\t\t\n\t\t/* go through each server */\n\t\tforeach ($servers as $server) {\n\t\t\t\n\t\t\t/* skip if address is missing */\n\t\t\tif (!isset($server[0])) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\t/* add this server */\n\t\t\t$this->addServer($server[0], isset($server[1]) ? $server[1] : self::DEFAULT_PORT_SERVER, isset($server[2]) ? $server[2] : self::DEFAULT_VERSION);\n\t\t}\n\t}",
"function addServer($host, $port, $weight=0) {\n return $this->memcached->addServer($host, $port, $weight);\n }"
]
| [
"0.56301206",
"0.5474381",
"0.5381993",
"0.53248066",
"0.5315589",
"0.5226129",
"0.5223958",
"0.5168032",
"0.5147654",
"0.5131959",
"0.50743675",
"0.50708497",
"0.50660497",
"0.50467855",
"0.50356376",
"0.50255525",
"0.49692535",
"0.4965885",
"0.48674676",
"0.48378146",
"0.48350662",
"0.47841847",
"0.4705688",
"0.46596998",
"0.4656356",
"0.46529028",
"0.46342912",
"0.4624346",
"0.46116748",
"0.45855445"
]
| 0.5581079 | 1 |
Stop listening for signals | protected function stopSignalHandlers(): void
{
if (!$this->hasPcntl) {
return;
}
foreach (array_keys($this->signalMap ?? []) as $number) {
pcntl_signal((int)$number, \SIG_IGN);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function stopListeningForEvents()\n\t\t{\n\n\t\t\t// Initialize the crontab manager if this has not been done before\n\t\t\tif(is_null($this->CronManager)) $this->CronManager = new ssh2_crontab_manager();\n\n\t\t\t// Stop cronjob to call $this-->captureSongHistory()\n\t\t\t$this->CronManager->remove_cronjob(\"checkTimeEventExecutionNeeds\");\n\n\t\t\t// Write status to the config\n\t\t\t$this->data['config']['mod_time__checkTimeEventExecutionNeedsCron'] = \"disabled\";\n\t\t\t$this->writeConfFile($this->data['config'], true);\n\n\t\t}",
"public function delSignal(): bool {}",
"public function unregister()\n {\n $previousHandlers = $this->previousHandlers;\n\n foreach ($previousHandlers as $signal => $handler) {\n if (is_null($handler)) {\n pcntl_signal($signal, SIG_DFL);\n\n unset($previousHandlers[$signal]);\n }\n }\n\n $this->setHandlers($previousHandlers);\n }",
"function signal_handler($signal) {\n\tglobal $DBH, $wa, $tracking_numbers;\n switch($signal) {\n case SIGTERM:\n case SIGKILL:\n case SIGINT:\n \t// Kill any event listeners\n\t foreach ($tracking_numbers as $number) {\n\t\t\t\t$wa->sendPresenceUnsubscription($number);\n\t\t\t}\n \t// Update tracker session\n\t\t\t$end_tracker_session = $DBH->prepare('UPDATE tracker_history SET \"end\" = NOW() WHERE \"end\" IS NULL;');\n\t\t\t$end_tracker_session->execute();\n\t\t\t// End any running record where an user is online\n\t\t\t$end_user_session = $DBH->prepare('UPDATE status_history\n\t\t\t\t\t\t\t\t\t\t\t\tSET \"end\" = NOW() WHERE \"end\" IS NULL AND \"status\" = true;');\n\t\t\t$end_user_session->execute();\n\t\t\t$wa -> disconnect();\n echo '[exit] Shutting down tracker'.\"\\n\";\n exit;\n }\n}",
"public function __destruct() {\n\t\tif($this->_listeningenabled)\n\t\t\t$this->unlisten();\n\t}",
"protected function listenForSignals()\n {\n pcntl_async_signals(true);\n\n pcntl_signal(SIGTERM, function () {\n $this->shouldQuit = true;\n });\n\n pcntl_signal(SIGUSR2, function () {\n $this->paused = true;\n });\n\n pcntl_signal(SIGCONT, function () {\n $this->paused = false;\n });\n }",
"public function stop() {}",
"protected function _unsubscribeFromEngineEvents()\n {\n $events = array(\n Streamwide_Engine_Events_Event::SDP,\n Streamwide_Engine_Events_Event::CHILD,\n Streamwide_Engine_Events_Event::OKMOVED,\n Streamwide_Engine_Events_Event::MOVED,\n Streamwide_Engine_Events_Event::FAILMOVED\n );\n \n $controller = $this->getController();\n foreach ( $events as $event ) {\n $controller->removeEventListener( $event, array( 'callback' => array( $this, 'onSignalReceived' ) ) );\n }\n }",
"protected function _stop_listening(){\r\n\t\t\trestore_error_handler();\r\n\t\t\trestore_exception_handler();\r\n\t\t\terror_reporting();\r\n\t\t\tini_set('display_errors', true);\r\n\t\t}",
"public function stop();",
"public function stop();",
"public function stop();",
"public function stop();",
"public function stop();",
"public function stop();",
"public function stop();",
"public function stop();",
"public function onStop();",
"protected function _trapSignals() {\n\t\t$self = $this;\n\n\t\t$handler = function($number) use ($self) {\n\t\t\tswitch ($number) {\n\t\t\t\tcase SIGQUIT:\n\t\t\t\t\t$self->_disconnect('Quitting.');\n\t\t\t\t\texit(0);\n\t\t\t\tdefault:\n\t\t\t\tcase SIGTERM:\n\t\t\t\t\t$self->_disconnect('Terminated.');\n\t\t\t\t\texit(1);\n\t\t\t}\n\t\t};\n\t\tpcntl_signal(SIGQUIT, $handler);\n\t\tpcntl_signal(SIGTERM, $handler);\n\t}",
"public function unsubscribe(): void;",
"abstract public function stop();",
"public function unSubscribe()\n {\n }",
"public function stop()\n {\n $this->mark('__stop');\n }",
"public function stop(): void;",
"public function stop(): void;",
"public function stop(): void;",
"public function stop(): void;",
"public function stop(): void;",
"public function stop(): EventInterface;",
"public function stop() {\n\t\t$this->invoke(\"stop\");\n\t}"
]
| [
"0.6820771",
"0.6741401",
"0.66165894",
"0.65198225",
"0.64366806",
"0.63450277",
"0.625342",
"0.6190189",
"0.6142415",
"0.61235464",
"0.61235464",
"0.61235464",
"0.61235464",
"0.61235464",
"0.61235464",
"0.61235464",
"0.61235464",
"0.6068847",
"0.60241693",
"0.59591633",
"0.5943536",
"0.5936908",
"0.5848344",
"0.581452",
"0.581452",
"0.581452",
"0.581452",
"0.581452",
"0.5780698",
"0.57702357"
]
| 0.70644444 | 0 |
Add new signal to maps | protected function registerSignalBinding(SignalBinding $binding): void
{
$this->regenerateMaps();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function add_signal($signal = null, $vars = null, $event = null) \n {\n $this->_signals = [$signal, $vars, $event];\n }",
"public function add()\n\t{\n\t\tEvent::add('ushahidi_filter.map_base_layers', array($this, '_add_layer'));\n\t\tif (Router::$controller != 'settings')\n\t\t{\n\t\t\tEvent::add('ushahidi_filter.map_layers_js', array($this, '_add_map_layers_js'));\n\t\t}\n\t}",
"public static function connectSignal( $signal1, $signal2 )\n\t{\n\t\tif( is_array( $signal ) )\n\t\t{\n\t\t\t$emitent = $signal[0];\n\t\t\t$signal = $signal[1];\n\t\t\t\n\t\t\tif( is_object( $emitent ) )\n\t\t\t{\n\t\t\t\t$emitent = get_class( $emitent );\n\t\t\t}\n\t\t\t\n\t\t\t$signal = $emitent . '_' . $signal;\n\t\t}\n\t\t\n\t\t$GLOBALS['_RPC_']['signals'][$signal][] = array( 'type' => 'signal', 'slot' => $slot );\n\t}",
"private function generateMaps(): void\n {\n $this->socketMap = $this->streamMap = [\n self::RESOURCE => [\n self::READ => [],\n self::WRITE => []\n ],\n self::HANDLER => [\n self::READ => [],\n self::WRITE => []\n ]\n ];\n\n $socketCount = $streamCount = 0;\n\n\n\n // Sockets\n foreach ($this->sockets as $id => $binding) {\n /** @var resource|Socket $socket */\n $socket = $binding->getIoResource();\n $resourceId = $this->identifySocket($socket);\n\n if ($binding->isStreamBased()) {\n /** @var resource $socket */\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n } else {\n $this->socketMap[self::RESOURCE][$binding->ioMode][$resourceId] = $socket;\n $this->socketMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $socketCount++;\n }\n }\n\n\n // Streams\n foreach ($this->streams as $id => $binding) {\n /** @var resource $stream */\n $stream = $binding->getIoResource();\n $resourceId = (int)$stream;\n\n $this->streamMap[self::RESOURCE][$binding->ioMode][$resourceId] = $stream;\n $this->streamMap[self::HANDLER][$binding->ioMode][$resourceId][$id] = $binding;\n $streamCount++;\n }\n\n\n // Signals\n $this->signalMap = [];\n\n foreach ($this->signals as $id => $binding) {\n foreach (array_keys($binding->signals) as $number) {\n $this->signalMap[$number][$id] = $binding;\n }\n }\n\n // Cleanup\n if (!$socketCount) {\n $this->socketMap = null;\n }\n\n if (!$streamCount) {\n $this->streamMap = null;\n }\n\n $this->generateMaps = false;\n }",
"public function register_action_map($map)\n {\n if (is_array($map)) {\n foreach ($map as $idx => $val) {\n $this->action_map[$idx] = $val;\n }\n }\n }",
"function registerAt($step, $method, $args, $action) {\n $args = $this->replaceWildcards($args);\n $method = strtolower($method);\n if (! isset($this->at[$method])) {\n $this->at[$method] = array();\n }\n if (! isset($this->at[$method][$step])) {\n $this->at[$method][$step] = new SimpleSignatureMap();\n }\n $this->at[$method][$step]->add($args, $action);\n }",
"protected function startSignalHandlers(): void\n {\n if (!$this->hasPcntl) {\n return;\n }\n\n foreach ($this->signalMap ?? [] as $number => $set) {\n pcntl_signal($number, function ($number) use ($set) {\n foreach ($set as $binding) {\n /** @var Binding $binding */\n $binding->trigger($number);\n }\n });\n }\n }",
"private function add($key, array $value)\n {\n $method = $value['on'];\n unset($value['on']);\n $this->routes[] = [$method, $key, $value];\n }",
"public function set_signal($signal)\n {\n $this->_signal = $signal;\n }",
"public function addSingleMapping($src, $dst) {}",
"function si_custom_elements_icon_map( $icon_map ) {\n\t\t$icon_map['si_custom_elements'] = EXTENSION_URL . '/assets/svg/icons.svg';\n\t\treturn $icon_map;\n\t}",
"function set_signal_history($flag)\n{\n return XPSPL::instance()->set_signal_history($flag);\n}",
"function addPoint($x, $y, $name)\n {\n $this->_mapPoints[$name] = array('X' => $x, 'Y' => $y);\n }",
"public static function addPath($path) {\n if (!isset(self::$lookup_path)) {\n self::register();\n }\n self::$lookup_path[] = $path;\n }",
"public static function connect( $signal, $slot )\n\t{\n\t\tif( is_array( $signal ) )\n\t\t{\n\t\t\t$emitent = $signal[0];\n\t\t\t$signal = $signal[1];\n\t\t\t\n\t\t\tif( is_object( $emitent ) )\n\t\t\t{\n\t\t\t\t$emitent = get_class( $emitent );\n\t\t\t}\n\t\t\t\n\t\t\t$signal = $emitent . '_' . $signal;\n\t\t}\n\t\t\n\t\t$GLOBALS['_RPC_']['signals'][$signal][] = array( 'type' => 'callback', 'slot' => $slot );\n\t}",
"public static function registerMap($map)\n {\n $maps = (array) $map;\n array_walk($maps, function (&$name) {\n $name = 'js/' . $name . '.js';\n });\n static::$_mapJsFiles = array_unique(array_merge(static::$_mapJsFiles, $maps));\n if (static::$_mapJsFiles) {\n MapAsset::register(Yii::$app->getView())->js = static::$_mapJsFiles;\n }\n }",
"private function addMapArguments($key, $value)\n\t{\n\t\t$this->_mapArguments[$key] = $value;\n\t}",
"function register($method, $args, $action) {\n $args = $this->replaceWildcards($args);\n $method = strtolower($method);\n if (! isset($this->always[$method])) {\n $this->always[$method] = new SimpleSignatureMap();\n }\n $this->always[$method]->add($args, $action);\n }",
"public function addAnalogPinObserver(Device\\PinObserver $observer)\n {/*{{{*/\n $this->_analogPinObservers[] = $observer;\n }",
"public function postEventadd();",
"public function AddEventHandler(&$array, $evt, $code)\n {\n if(isset($array[$evt]))\n $array[$evt] .= ';' . $code;\n else\n $array[$evt] = $code;\n }",
"public function initMap()\n\t{\n\t\t$params =array();\n\t\t$this->add_VcMap($params);\n\t}",
"protected function registerMorphs()\n {\n Models::updateMorphMap();\n }",
"public function onSlotsAdd()\n\t{\n\t\t$this->onTaskAdd();\n\t}",
"function add()\n\t{\n\t\t$this->_updatedata();\n\t}",
"public static function onImopenlineCreate(\\Bitrix\\Main\\Event $event)\n\t{\n\t\t$parameters = $event->getParameters();\n\n\t\tself::addInfoConnectors($parameters['line']);\n\t}",
"public function addMapping($key, $value)\n {\n $this->mappings[] = array($key, $value);\n }",
"private function addElementToMapping($old_itemtype, $old_id, $new_itemtype, $new_id) {\n\n if (!array_key_exists($old_itemtype, $this->elements_mapping)) {\n $this->elements_mapping[$old_itemtype] = [];\n }\n $this->elements_mapping[$old_itemtype][$old_id] = [\n 'itemtype' => $new_itemtype,\n 'id' => $new_id,\n ];\n }",
"protected function _dictionary_add($s_value)\r\n {\r\n if(!isset($this->a_dictionary[$s_value]))\r\n $this->a_dictionary[$s_value] = true;\r\n }",
"public function register($signal, $callback)\n {\n $this->previousHandlers[$signal] ??= $this->initializeSignal($signal);\n\n with($this->getHandlers(), function ($handlers) use ($signal) {\n $handlers[$signal] ??= $this->initializeSignal($signal);\n\n $this->setHandlers($handlers);\n });\n\n $this->registry->register($signal, $callback);\n\n with($this->getHandlers(), function ($handlers) use ($signal) {\n $lastHandlerInserted = array_pop($handlers[$signal]);\n\n array_unshift($handlers[$signal], $lastHandlerInserted);\n\n $this->setHandlers($handlers);\n });\n }"
]
| [
"0.59762275",
"0.50630933",
"0.4979573",
"0.47983396",
"0.47602886",
"0.47363737",
"0.4637524",
"0.45879948",
"0.4571055",
"0.4504217",
"0.44586402",
"0.44570687",
"0.44215956",
"0.4399054",
"0.43934956",
"0.43809003",
"0.4346109",
"0.4343745",
"0.43411762",
"0.43329048",
"0.43328986",
"0.43307424",
"0.43295002",
"0.43257123",
"0.43148965",
"0.4312268",
"0.42879894",
"0.42874208",
"0.4284148",
"0.42702416"
]
| 0.51515526 | 1 |
Text rotated around its origin | function RotatedText($x,$y,$txt,$angle)
{
$this->Rotate($angle,$x,$y);
$this->Text($x,$y,$txt);
$this->Rotate(0);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function RotatedText($x, $y, $txt, $angle)\n{\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n}",
"function RotatedText($x, $y, $txt, $angle){\r $this->Rotate($angle,$x,$y);\r $this->Text($x,$y,$txt);\r $this->Rotate(0);\r }",
"function RotatedText($x, $y, $txt, $angle)\r\r\n{\r\r\n\t$this->Rotate($angle,$x,$y);\r\r\n\t$this->Text($x,$y,$txt);\r\r\n\t$this->Rotate(0);\r\r\n}",
"function RotatedText($x, $y, $txt, $angle)\n{\n\t$this->Rotate($angle,$x,$y);\n\t$this->Text($x,$y,$txt);\n\t$this->Rotate(0);\n}",
"function RotatedText($x, $y, $txt, $angle) {\n\t $this->Rotate($angle,$x,$y);\n\t $this->Text($x,$y,$txt);\n\t $this->Rotate(0);\n\t}",
"function RotatedText($x,$y,$txt,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Text($x,$y,$txt);\n\t\t$this->Rotate(0);\n\t}",
"function RotatedText($x,$y,$txt,$angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Text($x,$y,$txt);\n\t\t$this->Rotate(0);\n\t}",
"function RotatedText($x,$y,$txt,$angle)\n\t{\n\t $this->Rotate($angle,$x,$y);\n\t $this->Text($x,$y,$txt);\n\t $this->Rotate(0);\n\t}",
"function RotatedText($x,$y,$txt,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n }",
"function RotatedText($x,$y,$txt,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n }",
"function RotatedText($x,$y,$txt,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n }",
"function RotatedText($x,$y,$txt,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n }",
"function RotatedText($x,$y,$txt,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n }",
"function RotatedText($x,$y,$txt,$angle)\n {\n $this->Rotate($angle,$x,$y);\n $this->Text($x,$y,$txt);\n $this->Rotate(0);\n }",
"function RotatedText($x, $y, $txt, $angle) {\n\t\t$this->Rotate($angle,$x,$y);\n\t\t$this->Text($x,$y,$txt);\n\t\t$this->Rotate(0);\n\t}",
"function RotatedText($x, $y, $txt, $angle) {\n $this->Rotate($angle, $x, $y);\n $this->Text($x, $y, $txt);\n $this->Rotate(0);\n }",
"function RotatedText($x, $y, $txt, $angle) {\n $this->Rotate($angle, $x, $y);\n $this->Text($x, $y, $txt);\n $this->Rotate(0);\n }",
"function RotatedText($x, $y, $txt, $angle)\n {\n $this->Rotate($angle, $x, $y);\n $this->Text($x, $y, $txt);\n $this->Rotate(0);\n }",
"public function RotatedText($x, $y, $txt, $angle) {\r\n $this->Rotate($angle, $x, $y);\r\n $this->Text($x, $y, $txt);\r\n $this->Rotate(0);\r\n }",
"private function _text2img($text, $length) {\r\n\t\t$width = $height = $offset_x = $offset_y = 0;\r\n\t\t\r\n\t\t// Sets modifiers of horizontal offset between chars and height,\r\n\t\t// because rotated chars require a larger image, because the offset of rotation is not the center of the char.\r\n\t\t$modifier = 4;\r\n\t\t$height_modifier = $width_modifier = 0;\r\n\t\tif ($this->useRandomRotation) {\r\n\t\t\t$modifier = 10;\r\n\t\t\t$height_modifier = $modifier;\r\n\t\t\t$width_modifier = $length * 3;\r\n\t\t}\r\n\t\t\t\t\r\n\t\t// Rotation is always 0, because we first create an image and rotate it afterwards. That's much easier, then creating a rotated one.\r\n\t\t// Get the font height.\r\n\t\t$bounds = ImageTTFBBox($this->_size, 0, $this->_font, \"W\");\r\n\t\t$font_height = abs($bounds[7] - $bounds[1]);\r\n\t\t\r\n\t\t// Determine bounding box. Again, rotation is always 0.\r\n\t\t$bounds = ImageTTFBBox($this->_size, 0, $this->_font, $text);\r\n\t\t$width = abs($bounds[4] - $bounds[6]);\r\n\t\t$height = abs($bounds[7] - $bounds[1]);\r\n\t\t$offset_y = $font_height;\r\n\t\t$offset_x = 0;\r\n\t\t\r\n\t\t\r\n\t\t// Adjust padding if random rotation is used.\r\n\t\t($this->useRandomRotation) ? $this->_padding = $this->_size * 1.1 : null;\r\n\t\t\r\n\t\t// Create image resource.\r\n\t\t$this->_resource = imagecreate($width + ($this->_padding* 2) + 1 + $width_modifier, $height + ($this->_padding) + 1 - $height_modifier);\r\n\t\t\r\n\t\t// Set image colors. The order is important. Background first, then foreground. Otherwise you'll get strange results.\r\n\t\t$background = imagecolorallocate($this->_resource, $this->_bg_color['R'], $this->_bg_color['G'], $this->_bg_color['B']);\r\n\t\t$foreground = imagecolorallocate($this->_resource, $this->_fg_color['R'], $this->_fg_color['G'], $this->_fg_color['B']);\r\n\t\t\r\n\t\t$this->_setTransparency($background);\r\n\r\n\t\t// Enable interlacing\r\n\t\timageinterlace($this->_resource, true);\r\n\r\n\t\t// Add some blots.\r\n\t\t($this->addBlots) ? $this->_addBlots() : null;\r\n\t\t\r\n\t\t// Add some arcs.\r\n\t\t($this->addArcs) ? $this->_addArcs() : null;\r\n\t\t\r\n\t\t// Add some lines.\r\n\t\t($this->addLines) ? $this->_addLines() : null;\r\n\t\t\r\n\t\t// Add some noise.\r\n\t\t($this->addNoise) ? $this->_addNoise() : null;\r\n\t\t\r\n\r\n\t\t// Default rotation angle to 0 (e.g. assume no rotation).\r\n\t\t$rotate = 0;\r\n\t\tforeach (str_split($text) as $ch) {\r\n\t\t\t($this->useRandomColors) ? $foreground = $this->_setRandomColor() : null;\r\n\t\t\t\r\n\t\t\tif ($this->useRandomRotation) {\r\n\t\t\t\t// Get random rotation angle for each char.\r\n\t\t\t\t$rotate = $this->_getRandomAngle();\r\n\t\t\t\t\r\n\t\t\t\t// Adjust vertical offset when rotating in relation to angle.\r\n\t\t\t\t$offset_y = abs($rotate / ($rotate - 100));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Add char to image\r\n\t\t\timagettftext($this->_resource, $this->_size, $rotate, $offset_x + $this->_padding, $offset_y + $this->_padding, $foreground, $this->_font, $ch);\r\n\t\t\t\r\n\t\t\t// Increase horizontal offset, so the next char won't overwrite the previous one.\r\n\t\t\t$offset_x += round($this->_size - ($this->_size/ $modifier));\r\n\t\t}\r\n\t\t\r\n\t\t// Init PHP's output buffer ...\r\n\t\tob_start();\r\n\t\t\r\n\t\t// ... and finally rotate the generated image\r\n\t\tif ($this->_angle != 0) {\r\n\t\t\t$this->_resource= imagerotate($this->_resource, $this->_angle, $background);\r\n\t\t\t($this->useTransparency) ? $this->_setTransparency($background) : null;\r\n\t\t}\r\n\t\t\r\n\t\t// Write image to output buffer ...\r\n\t\timagepng($this->_resource);\r\n\t\t// ... and destroy the image resource afterwards.\r\n\t\timagedestroy($this->_resource);\r\n\t\t\r\n\t\t// Fetch the binary represantation of the image in the output buffer.\r\n\t\t$contents = ob_get_clean();\r\n\r\n\t\t// Generate HTML image tag using inline base64 encoded image data and return the result.\r\n\t\treturn '<img src=\"data:image/png;base64,' . base64_encode($contents) . '\"/>';\r\n\t}",
"public function rotate()\n {\n // not possible in php?\n }",
"function write_translation() {\r\n $this->final_image = cloneImg($this->get_cleaned_image());\r\n foreach ($this->text_blocks as $block) {\r\n $black = imagecolorallocate($this->final_image, 0, 0, 0);\r\n $red = imagecolorallocate($this->final_image, 255, 0, 0);\r\n $green = imagecolorallocate($this->final_image, 0, 255, 0);\r\n $yellow = imagecolorallocate($this->final_image, 255, 255, 0);\r\n \r\n $translation_width=$block->translation_width;\r\n $translation_height=$block->translation_height;\r\n\r\n $block_height=round(distance($block->x4,$block->y4,$block->x1,$block->y1));\r\n $block_width=round(distance($block->x1,$block->y1,$block->x2,$block->y2));\r\n\r\n $Ix=$block->x1+($block_width-$translation_width)/2;\r\n $Iy=$block->y1+$block->translation_top_offset+($block_height-$translation_height)/2 ;\r\n $tmpx=$Ix;\r\n $tmpy=$Iy;\r\n\r\n if ($block->text_angle !=0) {\r\n $insert=rotate($Ix,$Iy, $block->x1,$block->y1,0- $block->text_angle);\r\n $Ix = $insert[0];\r\n $Iy = $insert[1];\r\n }\r\n\r\n imagettftext (\r\n $this->final_image,\r\n $block->font_size,\r\n $block->text_angle,\r\n $Ix,\r\n $Iy,\r\n $black,\r\n $block->font,\r\n $block->formatted_text );\r\n }\r\n\r\n \r\n $this->final_image_path=\"uploads/\".microtime().\".jpg\";\r\n imagewrite($this->final_image,$this->final_image_path,$quality=100);\r\n }",
"function imagettftextSp($image, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0){\n if ($spacing == 0) { imagettftext($image, $size, $angle, $x, $y, $color, $font, $text); }else{\n \t$temp_x = $x;\n \tfor ($i = 0; $i < strlen($text); $i++){\n \t\t$bbox = imagettftext($image, $size, $angle, $temp_x, $y, $color, $font, $text[$i]);\n \t\t$temp_x += $spacing + ($bbox[2] - $bbox[0]);\n \t}\n\t}\n}",
"protected function _drawText()\n {\n $x = $this->_width*0.05;\n $y = $this->_height*0.96;\n\n $text_color=ImageColorAllocate($this->_image, 0x00, 0x00, 0x00);\n\n $fontsize = $this->scale*7;\n $kerning = $fontsize*1;\n\n for($i=0;$i<strlen($this->number);$i++)\n {\n imagettftext($this->_image, $fontsize, 0, $x, $y, $text_color, $this->font, $this->number[$i]);\n if($i==0 || $i==6)\n $x += $kerning*0.5;\n $x += $kerning;\n }\n }",
"public function rotateBy($rotation) {}",
"private function getTextBoundingBox($size, $angle, $font, $text)\n {\n // This does it properly by getting the bounding box for horizontal text then rotating it\n\n if (!file_exists($font)) {\n $this->error(\"Could not find font '$font'\");\n }\n\n $box = imagettfbbox($size, 0, $font, $text);\n\n $s = sin(-$angle * 3.1415926 / 180);\n $c = cos(-$angle * 3.1415926 / 180);\n\n return array\n (\n $c * $box[0] - $s * $box[1],\n $s * $box[0] + $c * $box[1],\n $c * $box[2] - $s * $box[3],\n $s * $box[2] + $c * $box[3],\n $c * $box[4] - $s * $box[5],\n $s * $box[4] + $c * $box[5],\n $c * $box[6] - $s * $box[7],\n $s * $box[6] + $c * $box[7],\n );\n }",
"function un_rot($message) {\n $output = \"\";\n $messageTextArray = str_split($message);\n \n // ROT -1\n foreach($messageTextArray as $asciiChar) {\n\t$asciiAsInt = ord($asciiChar);\n\t$convretedAsciiAsInt = $asciiAsInt -1;\n\t$convertedAsciiChar = chr($convretedAsciiAsInt);\n\t$output .= $convertedAsciiChar;\n }\n \n // Return the clear text\n return $output;\n}",
"private function getTextBoundingBox($size, $angle, $font, $text)\n {\n // This does it properly by getting the bounding box for horizontal text then rotating it\n\n if (!file_exists($font)) {\n $this->error(\"Could not find font: '$font'\");\n }\n\n $box = imagettfbbox($size, 0, $font, $text);\n\n $s = sin(-$angle * 3.1415926 / 180);\n $c = cos(-$angle * 3.1415926 / 180);\n\n return array\n (\n $c * $box[0] - $s * $box[1],\n $s * $box[0] + $c * $box[1],\n $c * $box[2] - $s * $box[3],\n $s * $box[2] + $c * $box[3],\n $c * $box[4] - $s * $box[5],\n $s * $box[4] + $c * $box[5],\n $c * $box[6] - $s * $box[7],\n $s * $box[6] + $c * $box[7],\n );\n }",
"public function getRotation() {}",
"public function getRotation() {}"
]
| [
"0.8031866",
"0.7969082",
"0.7833703",
"0.76676804",
"0.7578914",
"0.75633496",
"0.75633496",
"0.7559466",
"0.74850345",
"0.74850345",
"0.74850345",
"0.74850345",
"0.74850345",
"0.74850345",
"0.7457438",
"0.73299927",
"0.73299927",
"0.7271759",
"0.66924244",
"0.5987366",
"0.56377065",
"0.55702704",
"0.55589616",
"0.5552679",
"0.5544472",
"0.5468621",
"0.5460449",
"0.5459072",
"0.5448896",
"0.54484814"
]
| 0.80718625 | 1 |
Helper method to Hyphenize a token that is in pure form (no dashes). | public static function hyphenize($token, $tokenType)
{
if ($tokenType == self::TYPE_BASE36) {
$quartet1 = substr($token, 0, 4);
$quartet2 = substr($token, 4, 4);
$quartet3 = substr($token, 8, 4);
return sprintf('%s-%s-%s', $quartet1, $quartet2, $quartet3);
} else if ($tokenType == self::TYPE_BASE10) {
$quartet1 = substr($token, 0, 4);
$quartet2 = substr($token, 4, 4);
$quartet3 = substr($token, 8, 4);
$quartet4 = substr($token, 12, 4);
return sprintf('%s-%s-%s-%s', $quartet1, $quartet2, $quartet3, $quartet4);
} else { // if ($tokenType == self::TYPE_UUID) {
$timeLow = substr($token, 0, 8);
$timeMid = substr($token, 8, 4);
$timeHi = substr($token, 12, 4);
$clkSeqLow = substr($token, 16, 4);
$node = substr($token, 20, 12);
return sprintf('%s-%s-%s-%s-%s', $timeLow, $timeMid, $timeHi, $clkSeqLow, $node);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function dasherize()\n {\n return $this->delimit('-');\n }",
"function formatTextHyphen(String $text) {\n return strtr($text, \" \", \"-\");\n }",
"public function hyphenate($title)\n {\n $title = strtolower(str_replace(array(\"%20\", \" \"), '-', $title));\n $title = preg_replace('/[^a-z\\-]/i','',$title);\n return $title;\n }",
"public static function toHyphen($term)\n {\n return static::camelCaseTransform(static::toCamelCase($term), '-');\n }",
"function remove_nonalphanum( $data ) {\n\t$text = trim( $data, ' ' );\n\t$text = str_replace( ' ', '-', $text );\n\t$text = preg_replace( '/[^A-Za-z0-9-]/', '', $text );\n\treturn strtolower( $text );\n}",
"function slugify2($text){\r\n\r\n $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);\r\n\r\n\r\n\r\n // transliterate\r\n\r\n $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\r\n\r\n\r\n\r\n // remove unwanted characters\r\n\r\n $text = preg_replace('~[^-\\w]+~', '', $text);\r\n\r\n\r\n\r\n // trim\r\n\r\n $text = trim($text, '-');\r\n\r\n\r\n\r\n // remove duplicated - symbols\r\n\r\n $text = preg_replace('~-+~', '-', $text);\r\n\r\n\r\n\r\n // lowercase\r\n\r\n $text = strtolower($text);\r\n\r\n\r\n\r\n if (empty($text)) {\r\n\r\n return 'n-a';\r\n\r\n }\r\n\r\n\r\n\r\n return $text;\r\n\r\n}",
"public static function toHyphenated($string) {\n return static::toSeparated($string, '-');\n }",
"function camelToHyphens($value)\n {\n return strtolower(preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1-', $value));\n }",
"function as_slug_this($content) {\n\t\treturn preg_replace(\"/-$/\",\"\",preg_replace('/[^a-z0-9]+/i', \"-\", strtolower($content)));\n\t}",
"private function process_alphanumhyphen($value)\n {\n return ! preg_match('/[^a-zA-Z0-9-]/', $value);\n }",
"function simpleWhite_id_safe($string) { //change mytheme to your theme name\n if (is_numeric($string{0})) {\n // If the first character is numeric, add 'n' in front\n $string = 'n'. $string;\n }\n return strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', $string));\n}",
"function slug($value){\n//the pre_quote function is just used to quote regular expressions so that it doesn't get mixed up and result in an error\n //remove all characters not in the list(that what this means when we include \"empty string\")\n $value = preg_replace('![^'.preg_quote('_').'\\pL\\pN\\s]+!u','',mb_strtolower($value));\n\n //replace underscore with a dash\n $value = preg_replace('!['.preg_quote('_').'\\s]+!u','-',$value);\n\n //remove whitespace with the trim function\n //'-' was added as an argument so that the trim function does not remove it too\n\n return trim($value, '-');\n\n}",
"public static function toDashSeparated($input)\r\n {\r\n \t// Convert spaces and underscores to dashes.\r\n \t$input = preg_replace('#[ \\-_]+#', '-', $input);\r\n \r\n \treturn $input;\r\n }",
"public function clean(string $input): string\n {\n $input = trim($input);\n $input = str_replace('-', '', $input);\n\n return preg_replace('/[^A-Za-z0-9\\-]/', '', $input);\n }",
"static public function dasherize($str)\n\t{\n\t\t$str = lcfirst($str);\n\t\treturn strtolower(preg_replace('/([A-Z]+)/', '-$1', $str));\n\t}",
"public function hasHyphen(): bool\n\t{\n\t\treturn preg_match('/-/', $this->getValue());\n\t}",
"public function removeSpecialChars()\n {\n $this->input = preg_replace(\"/[^A-Za-z0-9\\-]/\", \" \", $this->input);\n return $this;\n }",
"public static function turn_dash_to_space( $url ) {\n return str_replace( \"-\", \" \", $url );\n }",
"function slugify($text)\r\n{\r\n $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);\r\n\r\n // transliterate\r\n $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\r\n\r\n // remove unwanted characters\r\n $text = preg_replace('~[^-\\w]+~', '', $text);\r\n\r\n // trim\r\n $text = trim($text, '-');\r\n\r\n // remove duplicate -\r\n $text = preg_replace('~-+~', '-', $text);\r\n\r\n // lowercase\r\n $text = strtolower($text);\r\n\r\n if (empty($text)) {\r\n return 'n-a';\r\n }\r\n\r\n return $text;\r\n}",
"function slugify($text){\n\t$text = preg_replace('~[^\\pL\\d]+~u', '-', $text);\n\n\t// transliterate\n\t$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\n\n\t// remove unwanted characters\n\t$text = preg_replace('~[^-\\w]+~', '', $text);\n\n\t// trim\n\t$text = trim($text, '-');\n\n\t// remove duplicate -\n\t$text = preg_replace('~-+~', '-', $text);\n\n\t// lowercase\n\t$text = strtolower($text);\n\n\tif (empty($text)) {\n\t\treturn 'n-a';\n\t}\n\n\treturn $text;\n}",
"function slug($text){\r\n $text = preg_replace('~[^pLd]+~u', '-', $text);\r\n\r\n // trim\r\n $text = trim($text, '-');\r\n\r\n // transliterate\r\n $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\r\n\r\n // lowercase\r\n $text = strtolower($text);\r\n\r\n // remove unwanted characters\r\n $text = preg_replace('~[^-w]+~', '', $text);\r\n\r\n if (empty($text))\r\n {\r\n return 'n-a';\r\n }\r\n\r\n return $text;\r\n}",
"function slug($z) {\n $z = strtolower(trim($z));\n $z = preg_replace('/[^a-z0-9 \\'-]+/', '', $z);\n return $z;\n }",
"function slugify($text)\r\n{\r\n // replace non letter or digits by -\r\n $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);\r\n\r\n // transliterate\r\n $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\r\n\r\n // remove unwanted characters\r\n $text = preg_replace('~[^-\\w]+~', '', $text);\r\n\r\n // trim\r\n $text = trim($text, '-');\r\n\r\n // remove duplicate -\r\n $text = preg_replace('~-+~', '-', $text);\r\n\r\n // lowercase\r\n $text = strtolower($text);\r\n\r\n if (empty($text)) {\r\n return 'n-a';\r\n }\r\n\r\n return $text;\r\n}",
"function make_slug($str, $delim = '-') {\n strtolower($str);\n $str = preg_replace(\"/[^A-Za-z0-9 ]/\", \" \", $str); // invalid chars, make into spaces\n $str = preg_replace(\"/\\-/\", \" \", $str); // hyphen to space ...for now\n $str = preg_replace(\"/\\s\\s+/\", \" \", $str); // convert multiple spaces into one\n $str = substr($str, 0, 20); // max length 10\n $str = trim($str); // trim\n $str = preg_replace(\"/\\s/\", $delim, $str); // add delimiter\n $str = strtolower($str); // make lower\n return $str;\n }",
"function slugify($text, $ws = '-')\n{\n\treturn GHelper::cleanString($text, $ws);\n}",
"function mMINUS(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$MINUS;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:653:3: ( '-' ) \n // Tokenizer11.g:654:3: '-' \n {\n $this->matchChar(45); \n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }",
"public static function CleanUpSpecialChars($string, $allowUnder = false){\n \t$regExpression = \"`\\W`i\";\n \tif($allowUnder) $regExpression = \"`[^a-zA-Z0-9-]`i\";\n \n \t$string = preg_replace( array($regExpression, \"`[-]+`\",) , \"-\", $string);\n \treturn trim($string, '-');\n }",
"function slugify($text)\n{\n $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);\n\n // transliterate\n $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\n\n // remove unwanted characters\n $text = preg_replace('~[^-\\w]+~', '', $text);\n\n // trim\n $text = trim($text, '-');\n\n // remove duplicate -\n $text = preg_replace('~-+~', '-', $text);\n\n // lowercase\n $text = strtolower($text);\n\n if (empty($text)) {\n return 'n-a';\n }\n\n return $text;\n}",
"function slugify($text)\n{\n $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);\n\n // transliterate\n $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\n\n // remove unwanted characters\n $text = preg_replace('~[^-\\w]+~', '', $text);\n\n // trim\n $text = trim($text, '-');\n\n // remove duplicate -\n $text = preg_replace('~-+~', '-', $text);\n\n // lowercase\n $text = strtolower($text);\n\n if (empty($text)) {\n return 'n-a';\n }\n\n return $text;\n}",
"static public function slugify($text){\r\n $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);\r\n // transliterate\r\n //$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\r\n // remove unwanted characters\r\n $text = preg_replace('~[^-\\w]+~', '', $text);\r\n // trim\r\n $text = trim($text, '-');\r\n // remove duplicate -\r\n $text = preg_replace('~-+~', '-', $text);\r\n // lowercase\r\n $text = strtolower($text);\r\n if (empty($text)) {\r\n return 'n-a';\r\n }\r\n return $text;\r\n }"
]
| [
"0.63162416",
"0.6172978",
"0.5956843",
"0.5945991",
"0.57270133",
"0.56873494",
"0.5606129",
"0.5603272",
"0.55927235",
"0.557529",
"0.55733716",
"0.55593497",
"0.5538788",
"0.5487473",
"0.5449831",
"0.5412059",
"0.54065096",
"0.5389538",
"0.53704596",
"0.5361027",
"0.53436923",
"0.53391504",
"0.53292596",
"0.53281677",
"0.53214496",
"0.5321071",
"0.5306864",
"0.53056866",
"0.52999216",
"0.5291469"
]
| 0.6453905 | 0 |
Test the webhook payload getter for post resources. | public function test_get_payload_for_posts() {
$posts = array(
'course' => 'course',
'section' => 'section',
'lesson' => 'lesson',
// 'membership' => 'llms_membership',
// 'order' => 'llms_order',
// 'access_plan' => 'llms_access_plan',
// 'transaction' => 'llms_transaction',
);
foreach ( $posts as $post => $post_type ) {
$post_id = $this->factory->post->create( array( 'post_type' => $post_type ) );
// Created.
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld/200',
'topic' => $post . '.created',
'status' => 'active',
'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),
) );
$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id, null, false ) ) );
$this->assertEquals( $post_id, $payload['id'] );
$this->assertArrayHasKey( 'title', $payload );
// Updated.
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld/200',
'topic' => $post . '.updated',
'status' => 'active',
'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),
) );
$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id, null ) ) );
$this->assertEquals( $post_id, $payload['id'] );
$this->assertArrayHasKey( 'title', $payload );
// Deleted.
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld/200',
'topic' => $post . '.deleted',
'status' => 'active',
'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),
) );
$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id ) ) );
$this->assertEquals( array( 'id' => $post_id ), $payload );
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function test_is_valid_post_action() {\n\n\t\t$post_types = array(\n\t\t\t'course' => false,\n\t\t\t'section' => false,\n\t\t\t'lesson' => false,\n\t\t\t'llms_membership' => false,\n\t\t\t'llms_access_plan' => false,\n\t\t\t'llms_order' => false,\n\t\t\t'llms_transaction' => false,\n\t\t\t'post' => false,\n\t\t\t'page' => false,\n\t\t);\n\n\t\t$tests = array(\n\t\t\t'course.deleted' => array_merge( $post_types, array( 'course' => true ) ),\n\t\t\t'section.deleted' => array_merge( $post_types, array( 'section' => true ) ),\n\t\t\t'lesson.deleted' => array_merge( $post_types, array( 'lesson' => true ) ),\n\t\t\t'membership.deleted' => array_merge( $post_types, array( 'llms_membership' => true ) ),\n\t\t\t'access_plan.deleted' => array_merge( $post_types, array( 'llms_access_plan' => true ) ),\n\t\t\t'order.deleted' => array_merge( $post_types, array( 'llms_order' => true ) ),\n\t\t\t'transaction.deleted' => array_merge( $post_types, array( 'llms_transaction' => true ) ),\n\t\t);\n\n\t\tforeach ( $tests as $topic => $post_types ) {\n\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://fake.tld',\n\t\t\t\t'topic' => $topic,\n\t\t\t) );\n\n\t\t\tforeach ( $post_types as $type => $expect ) {\n\n\t\t\t\t$post_id = $this->factory->post->create( array( 'post_type' => $type ) );\n\t\t\t\t$this->assertEquals( $expect, LLMS_Unit_Test_Util::call_method( $webhook, 'is_valid_post_action', array( $post_id ) ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}",
"public function test__GetPost()\n\t{\n\t\t$this->assertThat(\n\t\t\t$this->object->objects->post,\n\t\t\t$this->isInstanceOf('JAmazons3OperationsObjectsPost')\n\t\t);\n\t}",
"public function testPostWebhooks()\n {\n }",
"public function testPostDeserialize(): void\n {\n $functionName = 'serialize_Tests_Liip_Serializer_Fixtures_PostDeserialize_2';\n self::generateSerializers(self::$metadataBuilder, PostDeserialize::class, [$functionName]);\n\n $model = new PostDeserialize();\n $model->apiString = 'apiString';\n\n $expected = [\n 'api_string' => 'apiString',\n ];\n $data = $functionName($model);\n\n self::assertSame($expected, $data);\n self::assertNull($model->postCalled);\n }",
"public function test_store_post()\n {\n $topic = Topic::factory()->create();\n $resp =\n $this->actingAs($this->user)\n ->withHeaders([\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json',\n ])\n ->postJson(\n '/api/topics/' . $topic->id . '/posts',\n [\n \"body\" => \"testsqx test\",\n ]\n );\n $resp->assertStatus(201);\n }",
"public function testPostCreate()\n {\n $this->json('POST', '/api/post_create', ['title' => 'test1', 'description' => 'description1', 'login' => 'user1'])\n ->assertJson([\n 'post_id' => true\n ]);\n }",
"public function testPostRequestShouldTriggerPostAction()\n\t{\n\t\t$this->request->setMethod('POST');\n\t\t$this->dispatch('/api/event');\n\t\t\n\t\t$this->assertModule('api');\n\t\t$this->assertController('event');\n\t\t$this->assertAction('post');\n\t}",
"public function testGetAllPost()\n {\n $this->visit('/post');\n $this->seeHeader('content-type', 'application/json');\n $this->seeStatusCode(200);\n \n }",
"public function postTesting() {}",
"private function postResource($request, $resourceForm, $post)\n {\n if ($request->isMethod('POST')) {\n if ($resourceForm->handleRequest($request)->isValid()) {\n $em = $this->getOEM();\n $em->getConnection()->beginTransaction();\n\n $postDate = new \\DateTime();\n $postContent = $post->getContent();\n // Purify HTML Content (remove scripts, onclick, etc.)\n $config = \\HTMLPurifier_Config::createDefault();\n $purifier = new \\HTMLPurifier($config);\n // $config->set('HTML.TargetBlank', true);\n $config->set('Attr.AllowedFrameTargets', array('_blank'));\n $config->set('HTML.SafeIframe', true);\n $config->set('URI.SafeIframeRegexp', '%^(http:|https:)?//(www.youtube.com/embed/|player.vimeo.com/video/|www.flickr.com/services/oembed|www.hulu.com/embed|www.google.com/maps/embed|www.dailymotion.com/embed|w.soundcloud.com/player|www.slideshare.net|prezi.com|webtv.ac-versailles.fr|scolawebtv.crdp-versailles.fr|www.audio-lingua.eu|www.xmind.net)%');\n $config->set('Cache.SerializerPermissions', 0775);\n $config->set('Cache.SerializerPath', $this->get('kernel')->getCacheDir().'/htmlpurifier');\n $cleanPostContent = $purifier->purify($postContent);\n\n // User\n $user = $this->getUser();\n\n // Post\n $post\n ->setContent($cleanPostContent)\n ->setAuthor($user)\n ->setCommentStatus(true)\n ->setResource(true)\n ->setBroadcast(false)\n ->setGlobal(false)\n ->setImportant(false)\n ->setCreateDate($postDate)\n ->setUpdateDate($postDate)\n ->setStatus($resourceForm->get('submit_draft')->isClicked() ? Post::STATUS_DRAFTING : Post::STATUS_PUBLISHED)\n ;\n\n // Version\n $postVersion = $this->createObject('post_version');\n $postVersion\n ->setAuthor($user)\n ->setStatus($resourceForm->get('submit_draft')->isClicked() ? PostVersion::STATUS_DRAFTING : PostVersion::STATUS_PUBLISHED)\n ->setName($post->getName())\n ->setContent($cleanPostContent)\n ->setCreateDate($postDate)\n ->setUpdateDate($postDate)\n ;\n\n // Group\n $group = false;\n $type = $resourceForm->get('where')->getData();\n\n switch ($type) {\n case Post::TYPE_WALL:\n $post\n ->setType(Post::TYPE_WALL)\n ->setTargetUser($user)\n ->setPublishedGroup(null)\n ->setPublishedBlog(null)\n ->setPublishedEditor(null)\n ;\n break;\n\n case Post::TYPE_EDITOR:\n if (null !== $editor = $user->getEditor()) {\n $editor->addPost($post);\n $post\n ->setType(Post::TYPE_BLOG)\n ->setPublishedGroup(null)\n ->setPublishedBlog(null)\n ->setPublishedEditor($editor)\n ;\n } else {\n return $this->redirect($this->generateUrl('publish_publications'));\n }\n break;\n\n case Post::TYPE_BLOG:\n if (null !== $blog = $user->getBlog()) {\n $blog->addPost($post);\n $post\n ->setType(Post::TYPE_BLOG)\n ->setPublishedGroup(null)\n ->setPublishedBlog($blog)\n ->setPublishedEditor(null)\n ;\n } else {\n return $this->redirect($this->generateUrl('publish_publications'));\n }\n break;\n\n case Post::TYPE_GROUP:\n if (null !== $group = $post->getPublishedGroup()) {\n $post\n ->setType(Post::TYPE_GROUP)\n ->setPublishedBlog(null)\n ->setPublishedEditor(null)\n ;\n $group->addPost($post);\n $this->persist($group);\n\n $this->get('rpe.logs')->create($user, Log::TYPE_POST_RESOURCE, $user, $group);\n\n break;\n }\n // No else\n\n default:\n return $this->redirect($this->generateUrl('publish_publications'));\n }\n\n // Medias\n foreach ($post->getMedias() as $media) {\n $media\n ->setUser($user)\n ->addPost($post)\n ->setType(RpeMedia::TYPE_POST)\n ->setDate($postDate)\n // ->setDescription($post->getName())\n ;\n\n $user->addMedia($media);\n $media->addPostVersion($postVersion);\n // $postVersion->addMedia($media);\n };\n\n // Medias added from Library\n $libraryMedias = array_unique($resourceForm->get('library_medias')->getData());\n $userLibraryMedias = $user->getMediasFromIDs($libraryMedias);\n foreach ($userLibraryMedias as $media) {\n $media\n ->addPost($post)\n ->addPostVersion($postVersion)\n ;\n };\n\n // Add post to User\n $user->addPost($post);\n $postVersion->setPost($post);\n\n // Coverfile\n $coverfile = $resourceForm->get('file')->getData();\n $color = $this->get('tool.avatar')->getPaletteColorFromText($resourceForm->get('name')->getData(), false);\n if (!($coverfile instanceof Media)) {\n $post->setFile($this->get('tool.avatar')->getMaskedImage('books', $color));\n }\n // Persist & Flush\n $this->persist($post, $user, $postVersion)->flush();\n\n // check media quota\n $user_quota = $user->getDiskQuota();\n foreach ($post->getMedias() as $media) {\n $check_media = $this->checkMediaSize($media, $user_quota);\n if ($check_media === false) {\n $em->getConnection()->rollback();\n return false;\n } else {\n $user_quota += $check_media;\n }\n }\n $this->setUserMeta($user, User::META_MEDIA_DISK_QUOTA, $user_quota);\n $em->getConnection()->commit();\n\n if (false === $resourceForm->get('submit_draft')->isClicked()) {\n if ($group) {\n $this->get('rpe.notifications')->wait(Notification::TYPE_RESOURCE, $user, $post);\n }\n $this->get('rpe.notifications')->wait(Notification::TYPE_COAUTHOR, $user, $post);\n }\n return $this->redirect($this->generateUrl('publication', array('id' => $post->getId())));\n\n } else {\n throw new \\RuntimeException('Form is not valid...');\n }\n\n }\n\n return false;\n }",
"protected function restBlogsPostPostRequest()\n {\n\n $resourcePath = '/rest/blogs/post';\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 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }",
"public function post($post);",
"public function testGetAutomatchUrlsUsingPOST()\n {\n }",
"public function testDeleteOnPost() {\n\t\t$Action = $this->_actionSuccess();\n\t\t$this->setReflectionClassInstance($Action);\n\t\t$this->callProtectedMethod('_post', array(1), $Action);\n\t}",
"public function postAction()\n {\n $manager = new \\Art4\\JsonApiClient\\Utils\\Manager();\n $manager->setConfig('optional_item_id', true);\n // @todo handle validation errors\n $document = $manager->parse($this->request->getRawBody());\n $resource = $this->resource->getModel();\n\n // basic attributes\n foreach ($document->get('data')->get('attributes')->asArray(true) as $key => $value) {\n $resource->{$key} = $value;\n }\n\n // @todo handle saving errors\n $resource->save();\n\n return $this->renderSerialized($resource);\n }",
"public function testGetUrlsUsingPOST()\n {\n }",
"public function testGetPostByTags()\n {\n $this->call('Get', '/post/tags/phpunit,test');\n $this->seeHeader('content-type', 'application/json');\n $this->seeStatusCode(200);\n }",
"function post($payload)\n {\n $this->requestDecorator->setPayload($payload);\n $result = $this->client->post($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this->requestDecorator->makeHeaders());\n $this->refresh();\n return $result;\n }",
"public function testWorkflowsPost()\n {\n }",
"public function testGetPostdata()\n {\n\t \tprint \"testGetPostdata()\\n\";\n\n\t \t// TODO: Impl\n\n\t \t$this->fail();\n }",
"public function getPost ();",
"public function postTest() {}",
"public function isPost();",
"public function testGetSinglePost() {\n $i = new Instagram();\n $result = $i->getPost('B9qmWk7BDzI');\n $this->assertNotEmpty($result->images);\n $this->assertEquals('2263790439947844808', $result->postId);\n $this->assertEquals([], $i->getErrors());\n }",
"public function testPayload() {\n $payload = array(\n \"this\" => \"is\",\n \"the\" => \"payload\",\n );\n $response = new Response();\n $response->setPayload($payload);\n $this->assertEquals($payload, $response->payload());\n }",
"public function testPostEmpty()\n {\n $this->assertArrayEmpty($this->get_reflection_property_value('post'));\n }",
"public function test_post() {\n\n }",
"public function testGetParameterFromPost(): void\n {\n // setup\n $_POST['post-parameter'] = 'post value';\n\n $requestParams = $this->getRequestParamsMock();\n\n // test body\n /** @var string $param */\n $param = $requestParams->getParam('post-parameter');\n\n // assertions\n $this->assertEquals('post value', $param, 'Value from $_POST must be fetched but it was not');\n }",
"public function testShouldReturnAllPosts(){\n $this->get(\"/api/v1/post\", []);\n $this->seeStatusCode(200);\n $this->seeJsonStructure([\n 'data' => ['*' =>\n [\n 'id_post',\n 'username',\n 'tanggal',\n 'caption'\n ]\n ]\n ]);\n }",
"public function testGetProductsUsingPOST()\n {\n }"
]
| [
"0.6775112",
"0.6717223",
"0.64597887",
"0.6414354",
"0.5948832",
"0.57707626",
"0.5765653",
"0.5738807",
"0.57341164",
"0.5733815",
"0.5726662",
"0.57045835",
"0.5690671",
"0.5605016",
"0.5582922",
"0.5582311",
"0.55726343",
"0.556818",
"0.556052",
"0.5555739",
"0.5541805",
"0.55209684",
"0.55070806",
"0.5505027",
"0.55012816",
"0.5486392",
"0.54695535",
"0.5468179",
"0.5466613",
"0.5461671"
]
| 0.73993117 | 0 |
test get_payload() for enrollment resources. | public function test_get_payload_for_enrollments() {
$user = $this->factory->student->create();
$course = $this->factory->course->create();
llms_enroll_student( $user, $course );
// Created.
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld/200',
'topic' => 'enrollment.created',
'status' => 'active',
'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),
) );
$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $user, $course ) ) );
$this->assertEquals( $user, $payload['student_id'] );
$this->assertEquals( $course, $payload['post_id'] );
// Updated.
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld/200',
'topic' => 'enrollment.updated',
'status' => 'active',
'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),
) );
$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $user, $course ) ) );
$this->assertEquals( $user, $payload['student_id'] );
$this->assertEquals( $course, $payload['post_id'] );
// Deleted.
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld/200',
'topic' => 'enrollment.deleted',
'status' => 'active',
'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),
) );
$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $user, $course ) ) );
$this->assertEquals( $user, $payload['student_id'] );
$this->assertEquals( $course, $payload['post_id'] );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function get_payload();",
"public function testListEnrollmentRequests()\n {\n }",
"public function testGetEnrollmentRequest()\n {\n }",
"public function test_get_payload_for_users() {\n\n\t\t$roles = array( 'student', 'instructor' );\n\n\t\tforeach ( $roles as $role ) {\n\n\t\t\t$user_id = $this->factory->user->create( array( 'role' => $role ) );\n\n\t\t\t// Created.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $role . '.created',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $user_id ) ) );\n\t\t\t$this->assertEquals( $user_id, $payload['id'] );\n\t\t\t$this->assertArrayHasKey( 'name', $payload );\n\n\t\t\t// Updated.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $role . '.updated',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $user_id ) ) );\n\t\t\t$this->assertEquals( $user_id, $payload['id'] );\n\t\t\t$this->assertArrayHasKey( 'name', $payload );\n\n\t\t\t// Deleted.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $role . '.deleted',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $user_id ) ) );\n\t\t\t$this->assertEquals( array( 'id' => $user_id ), $payload );\n\n\t\t}\n\n\t}",
"public function testRequestEnrollment()\n {\n }",
"function testReGetResource() { \n \t$uuid = $this->temp_uuid;\n\n $data = $this->ceenRU->CEERNResourceCall('/resource'.'/'.$uuid.'.php', 'GET', NULL, FALSE, 'resource_resource.retrieve');\n $this->assertTrue(isset($data['title']));\n }",
"public function test_get_payload_for_posts() {\n\n\t\t$posts = array(\n\t\t\t'course' => 'course',\n\t\t\t'section' => 'section',\n\t\t\t'lesson' => 'lesson',\n\t\t\t// 'membership' => 'llms_membership',\n\t\t\t// 'order' => 'llms_order',\n\t\t\t// 'access_plan' => 'llms_access_plan',\n\t\t\t// 'transaction' => 'llms_transaction',\n\t\t);\n\t\tforeach ( $posts as $post => $post_type ) {\n\n\t\t\t$post_id = $this->factory->post->create( array( 'post_type' => $post_type ) );\n\n\t\t\t// Created.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $post . '.created',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id, null, false ) ) );\n\t\t\t$this->assertEquals( $post_id, $payload['id'] );\n\t\t\t$this->assertArrayHasKey( 'title', $payload );\n\n\t\t\t// Updated.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $post . '.updated',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id, null ) ) );\n\t\t\t$this->assertEquals( $post_id, $payload['id'] );\n\t\t\t$this->assertArrayHasKey( 'title', $payload );\n\n\t\t\t// Deleted.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $post . '.deleted',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id ) ) );\n\t\t\t$this->assertEquals( array( 'id' => $post_id ), $payload );\n\n\t\t}\n\n\t}",
"function getPayload();",
"public function get_payload_request();",
"public function testPayload() {\n $payload = array(\n \"this\" => \"is\",\n \"the\" => \"payload\",\n );\n $response = new Response();\n $response->setPayload($payload);\n $this->assertEquals($payload, $response->payload());\n }",
"public function testThatGetEnrollmentsRequestIsFormattedProperly()\n {\n $api = new MockManagementApi( [ new Response( 200, self::$headers ) ] );\n\n $api->call()->users()->getEnrollments( '__test_user_id__' );\n\n $this->assertEquals( 'GET', $api->getHistoryMethod() );\n $this->assertEquals(\n 'https://api.test.local/api/v2/users/__test_user_id__/enrollments',\n $api->getHistoryUrl()\n );\n\n $headers = $api->getHistoryHeaders();\n $this->assertEquals( 'Bearer __api_token__', $headers['Authorization'][0] );\n $this->assertEquals( self::$expectedTelemetry, $headers['Auth0-Client'][0] );\n }",
"public function test_get_payload_for_progress() {\n\n\t\t$user = $this->factory->student->create();\n\t\t$course = $this->factory->course->create();\n\n\t\tllms_enroll_student( $user, $course );\n\n\t\t// Updated.\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t'topic' => 'progress.updated',\n\t\t\t'status' => 'active',\n\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t) );\n\n\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $user, $course ) ) );\n\t\t$this->assertEquals( $user, $payload['student_id'] );\n\t\t$this->assertEquals( $course, $payload['post_id'] );\n\n\t}",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public static function mutate_and_get_payload()\n {\n }",
"public function getLicense($payload)\n {\n $action = $payload['action'];\n $get_license = $payload['dataPacket'];\n\n\n $requestController = new requestValidationController();\n $checkValidation = $requestController->validateStoreUuid($payload);\n\n if( $checkValidation['response']) {\n $store = Stores::where('uuid', $get_license['license_key'])->first();\n\n file_put_contents('license.json', $store->uuid, true);\n $response = array_merge(Helper::constantResponse($action, 200, ''), ['dataPacket' => ['store_id'=>$store->technify_store_id,'license_key' => $store->uuid]]);\n } else {\n $response = Helper::ifValidationFalse($action, $checkValidation);\n }\n\n return $response;\n }",
"function testPropertyResourcesGetKeys() {\n\t\t// initialize the factory\n\t\t$factory = new TechDivision_Resources_PropertyResourcesFactory();\n\t\t// load the resources\n\t\t$propertyResources = $factory->getResources(\n\t\t new TechDivision_Lang_String(\"TestResources\"),\n\t\t new TechDivision_Lang_String(\"resources/data/testresources\")\n\t\t);\n\t\t// iterate over the keys and check the values\n\t\tforeach ($propertyResources->getKeys() as $key) {\n\t\t\t// check the correct values to load\n\t\t\t$this->assertEquals(\"test.key\", $key);\n\t\t}\n\t\t// release the resources\n\t\t$factory->release();\n\t}",
"public function testRollActionGet()\n {\n $this->app->session->set(\"dice-game\", new DiceGame(2, 2));\n $res = $this->controller->RollActionGet();\n $this->assertInstanceOf(ResponseUtility::class, $res);\n //$this->assertStringEndsWith(\"active\", $res);\n }",
"public function testWebinarRegistrantGet()\n {\n }",
"public function testGetAccountScheduledPaymentsUsingGET()\n {\n }"
]
| [
"0.61848366",
"0.61655015",
"0.59712195",
"0.5848086",
"0.58197737",
"0.5783996",
"0.5695787",
"0.56252515",
"0.5579024",
"0.5502772",
"0.54568917",
"0.5454252",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.54428804",
"0.5366113",
"0.5347522",
"0.5340256",
"0.5277448",
"0.52517086"
]
| 0.764388 | 0 |
Test enqueue for an action with a single hook. | public function test_enqueue_single_hook() {
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld',
'topic' => 'course.created',
) );
$this->assertFalse( has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );
$webhook->enqueue();
$this->assertEquals( 10, has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function test_enqueue_custom_action() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld',\n\t\t\t'topic' => 'action.mock_hook',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'mock_hook', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'mock_hook', array( $webhook, 'process_hook' ) ) );\n\n\t}",
"public function test_enqueue_multi_hooks() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld',\n\t\t\t'topic' => 'enrollment.created',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$this->assertFalse( has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$this->assertEquals( 10, has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\n\t}",
"function test_init_action_added() {\n\t\t$this->assertSame( 10, has_action( 'init', 'rest_api_init' ) );\n\t}",
"public function test_get_actions() {\n $hook = rand_str();\n\n yourls_add_action( $hook, 'some_function' );\n yourls_add_action( $hook, 'some_other_function', 1337 );\n\n $actions = yourls_get_actions( $hook );\n $this->assertTrue(isset($actions[10]['some_function']));\n $this->assertTrue(isset($actions[1337]['some_other_function']));\n\n $this->assertSame( [], yourls_get_actions( rand_str() ) );\n }",
"public static function enqueue();",
"function enqueue_action($action_name, $func_name, $priority = 0, $num_para = 0){\n if(empty($action_name) || empty($func_name)) return false;\n global $_lms_action_arr;\n $_lms_action_arr[$action_name][$priority] = array(\n 'name' => $func_name, 'num_para' => $num_para,\n );\n ksort($_lms_action_arr[$action_name]);\n}",
"public function test_has_action_return_values() {\n $hook = rand_str();\n\n yourls_add_action( $hook, 'some_function' );\n yourls_add_action( $hook, 'some_other_function', 1337 );\n\n $this->assertTrue( yourls_has_action( $hook ) );\n $this->assertSame( 10, yourls_has_action( $hook, 'some_function' ) );\n $this->assertSame( 1337, yourls_has_action( $hook, 'some_other_function' ) );\n $this->assertFalse( yourls_has_action( $hook, 'nope_not_this_function' ) );\n }",
"private function should_enqueue( $hook ) {\n\t\tif ( is_network_admin() && Helper::is_plugin_active_for_network() ) {\n\t\t\treturn 'toplevel_page_rank-math' === $hook;\n\t\t}\n\n\t\treturn 'rank-math_page_rank-math-status' === $hook;\n\t}",
"function enqueue ($entry) {\n\n}",
"public function testEnqueueQueueJobs()\n {\n $queueJobTest1 = new TestQueueJob('price', 'ShopwarePriceImport');\n $queueJobTest2 = new TestQueueJob('product', 'ShopwareProductExport');\n\n $result = $this->queue->enqueue($queueJobTest1);\n $this->assertTrue($result);\n\n $result = $this->queue->enqueue($queueJobTest2);\n $this->assertTrue($result);\n\n $this->assertCount(2, $this->queueStorage->queue);\n }",
"public function checkActions() {\n if (isset($this->request_json->action)) {\n\n if (is_array($this->request_json->action)) {\n $this->request_json->action = array_pop($this->request_json->action);\n }\n $vars = array('data' => (array) $this->request_json);\n $this->hook('action_' . $this->request_json->action, $vars);\n exit;\n }\n }",
"function has_action($hook_name, $callback = \\false)\n {\n }",
"public function enqueue() {\n\t}",
"function perform_action($action_name, ...$args){\n global $_lms_action_arr;\n if(!empty($_lms_action_arr[$action_name])){\n $func_names = $_lms_action_arr[$action_name];\n print_r($func_names);\n foreach($func_names as $func){\n if(!empty($func)){\n //Handles the bug when a hook is not properly dequeued.\n call_user_func_array($func['name'], $args);\n }\n\n }\n }\n\n}",
"function enqueue(){\n\t\t}",
"public function test_add_several_actions_default_priority() {\n $hook = rand_str();\n\n $times = mt_rand( 5, 15 );\n for ( $i = 1; $i <= $times; $i++ ) {\n yourls_add_action( $hook, rand_str() );\n }\n\n $this->assertTrue( yourls_has_action( $hook ) );\n global $yourls_filters;\n $this->assertSame( $times, count( $yourls_filters[ $hook ][10] ) );\n }",
"public function test_onHook_ok() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => json_encode(array(\n\t\t\t\t\t\t'revision' => \"r126299\",\n\t\t\t\t\t\t'author' => 'ph',\n\t\t\t\t\t\t'log' => 'commit message',\n\t\t\t\t\t), true),\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertTrue($ret['ok']);\n\n\t\t\t$expected = array(array(\n\t\t\t\t'channel' => '#test',\n\t\t\t\t'message' => array('text' => 'r126299: ph - commit message', 'mrkdwn' => false)\n\t\t\t));\n\t\t\t$this->assertEquals($expected, $this->instance->posted_messages);\n\t\t}",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function test_add_action_within_class_array() {\n $hook = rand_str();\n $this->assertFalse( yourls_has_action( $hook ) );\n yourls_add_action( $hook, array( 'Change_One_Global', 'change_it' ) );\n $this->assertTrue( yourls_has_action( $hook ) );\n\n return $hook;\n\t}",
"function doing_action($hook_name = \\null)\n {\n }",
"function add_action($hook_name, $callback, $priority = 10, $accepted_args = 1)\n {\n }",
"public function test_do_action_1_params() {\n $hook = rand_str();\n yourls_add_action( $hook, array( $this, 'accept_multiple_params' ) );\n\n $this->expectOutputString( \"array (0 => 'hello',)\" );\n yourls_do_action( $hook, 'hello' );\n }",
"public function testPostWebhooks()\n {\n }",
"public function test_add_action_within_class_instance() {\n $hook = rand_str();\n $this->assertFalse( yourls_has_action( $hook ) );\n yourls_add_action( $hook, array( $this, 'change_one_global' ) );\n $this->assertTrue( yourls_has_action( $hook ) );\n\n return $hook;\n\t}",
"public function testAddActionAdds()\n {\n // another time perhaps\n }"
]
| [
"0.7913185",
"0.69036895",
"0.58308876",
"0.5804853",
"0.5781383",
"0.5699493",
"0.5627467",
"0.5621423",
"0.55851346",
"0.55618197",
"0.5535435",
"0.5531496",
"0.5525354",
"0.55148923",
"0.5461684",
"0.5444214",
"0.5423945",
"0.53890985",
"0.53890985",
"0.53890985",
"0.53890985",
"0.53890985",
"0.53890985",
"0.53439844",
"0.5296618",
"0.52723557",
"0.5252722",
"0.52525544",
"0.52434194",
"0.5234124"
]
| 0.7682996 | 1 |
Test enqueue for an action with a multiple hooks. | public function test_enqueue_multi_hooks() {
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld',
'topic' => 'enrollment.created',
) );
$this->assertFalse( has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );
$this->assertFalse( has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );
$webhook->enqueue();
$this->assertEquals( 10, has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );
$this->assertEquals( 10, has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function test_enqueue_custom_action() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld',\n\t\t\t'topic' => 'action.mock_hook',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'mock_hook', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'mock_hook', array( $webhook, 'process_hook' ) ) );\n\n\t}",
"public function test_enqueue_single_hook() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld',\n\t\t\t'topic' => 'course.created',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );\n\n\t}",
"function perform_action($action_name, ...$args){\n global $_lms_action_arr;\n if(!empty($_lms_action_arr[$action_name])){\n $func_names = $_lms_action_arr[$action_name];\n print_r($func_names);\n foreach($func_names as $func){\n if(!empty($func)){\n //Handles the bug when a hook is not properly dequeued.\n call_user_func_array($func['name'], $args);\n }\n\n }\n }\n\n}",
"public function test_add_several_actions_default_priority() {\n $hook = rand_str();\n\n $times = mt_rand( 5, 15 );\n for ( $i = 1; $i <= $times; $i++ ) {\n yourls_add_action( $hook, rand_str() );\n }\n\n $this->assertTrue( yourls_has_action( $hook ) );\n global $yourls_filters;\n $this->assertSame( $times, count( $yourls_filters[ $hook ][10] ) );\n }",
"public function test_get_actions() {\n $hook = rand_str();\n\n yourls_add_action( $hook, 'some_function' );\n yourls_add_action( $hook, 'some_other_function', 1337 );\n\n $actions = yourls_get_actions( $hook );\n $this->assertTrue(isset($actions[10]['some_function']));\n $this->assertTrue(isset($actions[1337]['some_other_function']));\n\n $this->assertSame( [], yourls_get_actions( rand_str() ) );\n }",
"public function testEnqueueQueueJobs()\n {\n $queueJobTest1 = new TestQueueJob('price', 'ShopwarePriceImport');\n $queueJobTest2 = new TestQueueJob('product', 'ShopwareProductExport');\n\n $result = $this->queue->enqueue($queueJobTest1);\n $this->assertTrue($result);\n\n $result = $this->queue->enqueue($queueJobTest2);\n $this->assertTrue($result);\n\n $this->assertCount(2, $this->queueStorage->queue);\n }",
"function enqueue_action($action_name, $func_name, $priority = 0, $num_para = 0){\n if(empty($action_name) || empty($func_name)) return false;\n global $_lms_action_arr;\n $_lms_action_arr[$action_name][$priority] = array(\n 'name' => $func_name, 'num_para' => $num_para,\n );\n ksort($_lms_action_arr[$action_name]);\n}",
"public function test_do_action_1_params() {\n $hook = rand_str();\n yourls_add_action( $hook, array( $this, 'accept_multiple_params' ) );\n\n $this->expectOutputString( \"array (0 => 'hello',)\" );\n yourls_do_action( $hook, 'hello' );\n }",
"public function checkActions() {\n if (isset($this->request_json->action)) {\n\n if (is_array($this->request_json->action)) {\n $this->request_json->action = array_pop($this->request_json->action);\n }\n $vars = array('data' => (array) $this->request_json);\n $this->hook('action_' . $this->request_json->action, $vars);\n exit;\n }\n }",
"public function test_do_action_2_params() {\n $hook = rand_str();\n yourls_add_action( $hook, array( $this, 'accept_multiple_params' ) );\n\n $this->expectOutputString( \"array (0 => 'hello',1 => 'world',)\" );\n yourls_do_action( $hook, 'hello', 'world' );\n }",
"public function test_add_several_actions_random_priorities() {\n $hook = rand_str();\n\n $times = mt_rand( 5, 15 );\n for ( $i = 1; $i <= $times; $i++ ) {\n yourls_add_action( $hook, rand_str(), mt_rand( 1, 10 ) );\n }\n\n $this->assertTrue( yourls_has_action( $hook ) );\n\n global $yourls_filters;\n $total = 0;\n foreach( $yourls_filters[ $hook ] as $prio => $action ) {\n $total += count( $yourls_filters[ $hook ][ $prio ] );\n }\n\n $this->assertSame( $times, $total );\n }",
"public function test_has_action_return_values() {\n $hook = rand_str();\n\n yourls_add_action( $hook, 'some_function' );\n yourls_add_action( $hook, 'some_other_function', 1337 );\n\n $this->assertTrue( yourls_has_action( $hook ) );\n $this->assertSame( 10, yourls_has_action( $hook, 'some_function' ) );\n $this->assertSame( 1337, yourls_has_action( $hook, 'some_other_function' ) );\n $this->assertFalse( yourls_has_action( $hook, 'nope_not_this_function' ) );\n }",
"public static function enqueue();",
"public function test_add_action_within_class_array() {\n $hook = rand_str();\n $this->assertFalse( yourls_has_action( $hook ) );\n yourls_add_action( $hook, array( 'Change_One_Global', 'change_it' ) );\n $this->assertTrue( yourls_has_action( $hook ) );\n\n return $hook;\n\t}",
"public function test_do_action_no_params() {\n $hook = rand_str();\n yourls_add_action( $hook, array( $this, 'accept_multiple_params' ) );\n\n $this->expectOutputString( \"array (0 => '',)\" );\n yourls_do_action( $hook );\n }",
"public function test_add_action_class_and_array() {\n $hook = rand_str();\n\n $this->assertFalse( yourls_has_action( $hook ) );\n\n yourls_add_action( $hook, array( 'Class', 'Method' ) );\n $this->assertSame( 10, yourls_has_action( $hook, array( 'Class', 'Method' ) ) );\n $this->assertSame( 10, yourls_has_action( $hook, 'Class::Method' ) );\n\t}",
"function test_init_action_added() {\n\t\t$this->assertSame( 10, has_action( 'init', 'rest_api_init' ) );\n\t}",
"public function test_remove_all_actions() {\n $hook = rand_str();\n\n $times = mt_rand( 5, 15 );\n for ( $i = 1; $i <= $times; $i++ ) {\n yourls_add_action( $hook, rand_str() );\n }\n\n $this->assertTrue( yourls_has_action( $hook ) );\n yourls_remove_all_actions( $hook );\n $this->assertFalse( yourls_has_action( $hook ) );\n }",
"function enqueue(){\n\t\t}",
"public function hooks()\n {\n foreach ($this->getActions() as $key => $action) {\n switch (true) {\n case $action instanceof HooksAdminInterface:\n if (is_admin()) {\n $action->hooks();\n }\n break;\n case $action instanceof HooksFrontInterface:\n if (!is_admin()) {\n $action->hooks();\n }\n break;\n case $action instanceof HooksInterface:\n $action->hooks();\n break;\n }\n }\n }",
"public function setup_actions() {}",
"public function enqueue() {\n\t}",
"public function testAddActionAdds()\n {\n // another time perhaps\n }",
"public function testPostWebhooks()\n {\n }",
"public function test_all_batches() {\n\t\t$this->register_successful_batch( 'my-batch' );\n\t\t$batches = locomotive_get_all_batches();\n\n\t\t$this->assertNotNull( $batches['my-batch']['last_run'] );\n\t\t$this->assertNotNull( $batches['my-batch']['status'] );\n\n\t\t$post_batch = new Posts();\n\t\t$post_batch->register( array(\n\t\t\t'name' => 'Hey there',\n\t\t\t'type' => 'post',\n\t\t\t'callback' => __NAMESPACE__ . '\\\\my_callback_function',\n\t\t\t'args' => array(\n\t\t\t\t'posts_per_page' => 10,\n\t\t\t\t'post_type' => 'post',\n\t\t\t),\n\t\t) );\n\n\t\t$post_batch->run( 1 );\n\t\t$batches = locomotive_get_all_batches();\n\n\t\t$this->assertTrue( ( 'no results found' === $batches['hey-there']['status'] ) );\n\t}",
"public function test_onHook_ok() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => json_encode(array(\n\t\t\t\t\t\t'revision' => \"r126299\",\n\t\t\t\t\t\t'author' => 'ph',\n\t\t\t\t\t\t'log' => 'commit message',\n\t\t\t\t\t), true),\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertTrue($ret['ok']);\n\n\t\t\t$expected = array(array(\n\t\t\t\t'channel' => '#test',\n\t\t\t\t'message' => array('text' => 'r126299: ph - commit message', 'mrkdwn' => false)\n\t\t\t));\n\t\t\t$this->assertEquals($expected, $this->instance->posted_messages);\n\t\t}",
"public function testRollbarLoggerSendBatched(): void\n {\n Rollbar::init([\n 'access_token' => $this->getTestAccessToken(),\n 'environment' => 'testing-php',\n 'verbose_logger' => $this->verboseLogger,\n 'batched' => true,\n ]);\n Rollbar::log(LogLevel::INFO, \"Testing PHP Notifier\");\n $this->assertVerboseLogContains('Added payload to the queue \\(running in `batched` mode\\)\\.', LogLevel::DEBUG);\n }",
"function enqueue ($entry) {\n\n}",
"public function testCreatingAnAction()\n {\n // Create a campaign that the action will belong to.\n $campaign = factory(Campaign::class)->create();\n $actionName = $this->faker->sentence;\n\n // Create an action;\n $this->actingAsAdmin()->postJson('actions', [\n 'name' => $actionName,\n 'campaign_id' => $campaign->id,\n 'post_type' => 'photo',\n 'action_type' => 'make-something',\n 'time_commitment' => '0.5-1.0',\n 'reportback' => true,\n 'civic_action' => false,\n 'scholarship_entry' => true,\n 'volunteer_credit' => false,\n 'anonymous' => false,\n 'noun' => 'things',\n 'verb' => 'done',\n ]);\n\n // Make sure the action is persisted.\n $this->assertDatabaseHas('actions', [\n 'name' => $actionName,\n 'campaign_id' => $campaign->id,\n ]);\n\n // Try to create a second action with the same name, post type, and campaign id to make sure it doesn't duplicate.\n $this->actingAsAdmin()->postJson('actions', [\n 'name' => $actionName,\n 'campaign_id' => $campaign->id,\n 'post_type' => 'photo',\n 'reportback' => true,\n 'civic_action' => false,\n 'scholarship_entry' => true,\n 'volunteer_credit' => false,\n 'anonymous' => false,\n 'noun' => 'things',\n 'verb' => 'done',\n ]);\n\n $response = $this->getJson('api/v3/actions');\n $decodedResponse = $response->decodeResponseJson();\n\n $this->assertEquals(1, $decodedResponse['meta']['pagination']['count']);\n }",
"public function register_actions() {\n\t\t}"
]
| [
"0.7505051",
"0.71797514",
"0.61014974",
"0.6066115",
"0.6040701",
"0.60273206",
"0.58165514",
"0.58097744",
"0.57961696",
"0.5761374",
"0.57340115",
"0.56489944",
"0.55245835",
"0.5478411",
"0.5464653",
"0.5464211",
"0.5458214",
"0.5437563",
"0.5381659",
"0.53643095",
"0.53542715",
"0.53424186",
"0.5340735",
"0.53181386",
"0.53133357",
"0.52285975",
"0.5222344",
"0.5217634",
"0.51605105",
"0.5159551"
]
| 0.7768156 | 0 |
Test enqueue for a custom action | public function test_enqueue_custom_action() {
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld',
'topic' => 'action.mock_hook',
) );
$this->assertFalse( has_action( 'mock_hook', array( $webhook, 'process_hook' ) ) );
$webhook->enqueue();
$this->assertEquals( 10, has_action( 'mock_hook', array( $webhook, 'process_hook' ) ) );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function test_enqueue_single_hook() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld',\n\t\t\t'topic' => 'course.created',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );\n\n\t}",
"public function enqueue() {\n\t}",
"public static function enqueue();",
"public function test_enqueue_multi_hooks() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld',\n\t\t\t'topic' => 'enrollment.created',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$this->assertFalse( has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$this->assertEquals( 10, has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\n\t}",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"public function enqueue()\n {\n }",
"function enqueue(){\n\t\t}",
"function enqueue_action($action_name, $func_name, $priority = 0, $num_para = 0){\n if(empty($action_name) || empty($func_name)) return false;\n global $_lms_action_arr;\n $_lms_action_arr[$action_name][$priority] = array(\n 'name' => $func_name, 'num_para' => $num_para,\n );\n ksort($_lms_action_arr[$action_name]);\n}",
"public function testGetOrderAction(): void\n {\n $this->assertTrue(method_exists($this->stack, 'getOrderAction'));\n }",
"function test_init_action_added() {\n\t\t$this->assertSame( 10, has_action( 'init', 'rest_api_init' ) );\n\t}",
"public function test_getQueue() {\n\n }",
"public function testGetActionMethodForCustomAction()\n {\n $application = new BasicTestApplication(FilePath::parse('/var/www/'));\n $request = new BasicTestRequest(Url::parse('http://www.domain.com/'), new Method('GET'));\n $response = new BasicTestResponse();\n $controller = new BasicTestController();\n $controller->processRequest($application, $request, $response, 'int', []);\n\n self::assertSame('intAction', $controller->getActionMethod()->getName());\n }",
"public function testEnqueueQueueJobs()\n {\n $queueJobTest1 = new TestQueueJob('price', 'ShopwarePriceImport');\n $queueJobTest2 = new TestQueueJob('product', 'ShopwareProductExport');\n\n $result = $this->queue->enqueue($queueJobTest1);\n $this->assertTrue($result);\n\n $result = $this->queue->enqueue($queueJobTest2);\n $this->assertTrue($result);\n\n $this->assertCount(2, $this->queueStorage->queue);\n }",
"public function testCreatingAnAction()\n {\n // Create a campaign that the action will belong to.\n $campaign = factory(Campaign::class)->create();\n $actionName = $this->faker->sentence;\n\n // Create an action;\n $this->actingAsAdmin()->postJson('actions', [\n 'name' => $actionName,\n 'campaign_id' => $campaign->id,\n 'post_type' => 'photo',\n 'action_type' => 'make-something',\n 'time_commitment' => '0.5-1.0',\n 'reportback' => true,\n 'civic_action' => false,\n 'scholarship_entry' => true,\n 'volunteer_credit' => false,\n 'anonymous' => false,\n 'noun' => 'things',\n 'verb' => 'done',\n ]);\n\n // Make sure the action is persisted.\n $this->assertDatabaseHas('actions', [\n 'name' => $actionName,\n 'campaign_id' => $campaign->id,\n ]);\n\n // Try to create a second action with the same name, post type, and campaign id to make sure it doesn't duplicate.\n $this->actingAsAdmin()->postJson('actions', [\n 'name' => $actionName,\n 'campaign_id' => $campaign->id,\n 'post_type' => 'photo',\n 'reportback' => true,\n 'civic_action' => false,\n 'scholarship_entry' => true,\n 'volunteer_credit' => false,\n 'anonymous' => false,\n 'noun' => 'things',\n 'verb' => 'done',\n ]);\n\n $response = $this->getJson('api/v3/actions');\n $decodedResponse = $response->decodeResponseJson();\n\n $this->assertEquals(1, $decodedResponse['meta']['pagination']['count']);\n }",
"public function testExecuteTaskAction()\n {\n }",
"function enqueue ($entry) {\n\n}",
"public function testAction()\n {\n }",
"public function test_updateQueue() {\n\n }",
"public function testAddActionAdds()\n {\n // another time perhaps\n }",
"public function register_actions() {\n\t\t}",
"public function testLogStandardActionUsingPOST()\n {\n\n }",
"public function setup_actions() {}",
"public function test_createQueue() {\n\n }",
"public function testEnqueue()\n {\n $topicName = 'topic.name';\n $exchangeName = 'exchangeName';\n $envelopeBody = 'envelopeBody';\n $envelopeProperties = ['property_key_1' => 'property_value_1'];\n $topicData = [\n \\Magento\\Framework\\Communication\\ConfigInterface::TOPIC_IS_SYNCHRONOUS => false\n ];\n $this->communicationConfig->expects($this->once())\n ->method('getTopic')->with($topicName)->willReturn($topicData);\n $channel = $this->getMockBuilder(\\AMQPChannel::class)\n ->setMethods(['batch_basic_publish', 'publish_batch'])\n ->disableOriginalConstructor()->getMock();\n $this->amqpConfig->expects($this->once())->method('getChannel')->willReturn($channel);\n $publisher = $this\n ->getMockBuilder(\\Magento\\Framework\\MessageQueue\\Publisher\\Config\\PublisherConfigItemInterface::class)\n ->disableOriginalConstructor()->getMock();\n $this->publisherConfig->expects($this->once())\n ->method('getPublisher')->with($topicName)->willReturn($publisher);\n $connection = $this\n ->getMockBuilder(\\Magento\\Framework\\MessageQueue\\Publisher\\Config\\PublisherConnectionInterface::class)\n ->disableOriginalConstructor()->getMock();\n $publisher->expects($this->once())->method('getConnection')->with()->willReturn($connection);\n $connection->expects($this->once())->method('getExchange')->with()->willReturn($exchangeName);\n $envelope = $this\n ->getMockBuilder(\\Magento\\Framework\\MessageQueue\\EnvelopeInterface::class)\n ->disableOriginalConstructor()->getMock();\n $envelope->expects($this->once())->method('getBody')->willReturn($envelopeBody);\n $envelope->expects($this->once())->method('getProperties')->willReturn($envelopeProperties);\n $channel->expects($this->once())->method('batch_basic_publish')\n ->with($this->isInstanceOf(\\PhpAmqpLib\\Message\\AMQPMessage::class), $exchangeName, $topicName);\n $channel->expects($this->once())->method('publish_batch');\n $this->assertNull($this->bulkExchange->enqueue($topicName, [$envelope]));\n }",
"public function testEnqueueWithSynchronousTopic()\n {\n $topicName = 'topic.name';\n $response = 'responseBody';\n $topicData = [\n \\Magento\\Framework\\Communication\\ConfigInterface::TOPIC_IS_SYNCHRONOUS => true\n ];\n $this->communicationConfig->expects($this->once())\n ->method('getTopic')->with($topicName)->willReturn($topicData);\n $envelope = $this\n ->getMockBuilder(\\Magento\\Framework\\MessageQueue\\EnvelopeInterface::class)\n ->disableOriginalConstructor()->getMock();\n $this->exchange->expects($this->once())->method('enqueue')->with($topicName, $envelope)->willReturn($response);\n $this->assertEquals([$response], $this->bulkExchange->enqueue($topicName, [$envelope]));\n }",
"public function testEnqueue0()\n{\n\n $actual = $this->wP_Customize_Code_Editor_Control->enqueue();\n $expected = null; // TODO: Expected value here\n $this->assertEquals($expected, $actual);\n}"
]
| [
"0.66528314",
"0.6331517",
"0.6298585",
"0.62358356",
"0.61810213",
"0.61810213",
"0.61810213",
"0.61810213",
"0.61810213",
"0.61810213",
"0.6005237",
"0.599989",
"0.591363",
"0.5874427",
"0.5870555",
"0.58654994",
"0.58612555",
"0.585683",
"0.5845598",
"0.5786123",
"0.57845855",
"0.57674223",
"0.5749516",
"0.57233727",
"0.57010674",
"0.5698566",
"0.56747",
"0.5670588",
"0.56265163",
"0.56099975"
]
| 0.8123564 | 0 |
Test the get_edit_link() method. | public function test_get_edit_link() {
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld',
'topic' => 'course.created',
) );
$this->assertEquals(
admin_url( 'admin.php?page=llms-settings&tab=rest-api§ion=webhooks&edit-webhook=' . $webhook->get( 'id' ) ),
$webhook->get_edit_link()
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_link_to_edit($link)\n {\n }",
"public function testEditGet() {\n\t\tRolesControllerTest::login($this);\n\n\t\t$this->testAction(\n\t\t\t'/rss_readers/rss_readers/edit/181',\n\t\t\tarray(\n\t\t\t\t'method' => 'get',\n\t\t\t\t'return' => 'contents'\n\t\t\t)\n\t\t);\n\t\t$this->assertTextEquals('edit', $this->controller->view);\n\n\t\tAuthGeneralControllerTest::logout($this);\n\t}",
"function get_default_link_to_edit()\n {\n }",
"public function edit_link() {\n\t\tif ( $this->can_edit() ) {\n\t\t\treturn get_edit_post_link($this->ID);\n\t\t}\n\t}",
"public function testEditGet() {\n\t\tRolesControllerTest::login($this);\n\n\t\t$this->testAction(\n\t\t\t'/topics/topic_frame_settings/edit/191',\n\t\t\tarray(\n\t\t\t\t'method' => 'get',\n\t\t\t\t'return' => 'contents'\n\t\t\t)\n\t\t);\n\n\t\t$this->assertTextEquals('edit', $this->controller->view);\n\n\t\tAuthGeneralControllerTest::logout($this);\n\t}",
"public function getEditLink()\n {\n return $this->get('EditLink');\n }",
"public function getEditLink()\n {\n return $this->get('EditLink');\n }",
"public function getEditLink()\n {\n return $this->get('EditLink');\n }",
"public function get_edit_url() {\n\t\treturn $this->edit_link();\n\t}",
"function editingLink() {\n\t$editlink = get_edit_post_link();\n\tif (current_user_can('administrator')) {\n\t\t\tprint '<a href=\"' . $editlink .'\" class=\"edit\"><i class=\"icon-circle-arrow-right\"></i></a>';\n\t}\n\telseif (current_user_can('editor')) {\n\t\t\tprint '<a href=\"' . $editlink .'\" class=\"edit\"><i class=\"icon-circle-arrow-right\"></i></a>';\n\t}\n}",
"public function getEditUrl() { }",
"public function testBlockEditAction()\n {\n $view = $this->getTestBlockViewEditObject();\n $view->controller->runAction('edit');\n $url = $view->action('get_control');\n\n $this->assertEquals('http://www.dummyco.com/path/to/server/index.php/ccm/system/block/action/edit/50/Second%20Column/1184/get_control', (string)$url);\n\n $url = $view->controller->getActionURL('get_control', 4, 5, 6);\n\n $this->assertEquals('http://www.dummyco.com/path/to/server/index.php/ccm/system/block/action/edit/50/Second%20Column/1184/get_control/4/5/6', (string)$url);\n }",
"function get_edit_bookmark_link($link = 0)\n {\n }",
"function get_edit_post_link($post = 0, $context = 'display')\n {\n }",
"public function getEditLink()\n {\n if(empty($this->id)){\n return $this->getCreateLink();\n }\n\n $params = array(\n 'id' => $this->id,\n );\n $link = Globals::getRouter()->assemble($params, $this->_editRoute, true);\n return $link;\n }",
"public function testUrlEditUsers()\n {\n $user = User::find(2);\n $this->browse(function (Browser $browser) use ($user) {\n $browser->loginAs($this->user)\n ->visit('/admin/users')\n ->click('.button-edit')\n ->assertSee('Update users')\n ->assertPathIs('/admin/users/'.$user->id.'/edit');\n });\n }",
"public function editUrl() {}",
"public function edit(Slink $slink)\n {\n //\n }",
"function fusion_should_add_fe_edit_link() {\n\tif ( 0 === fusion_library()->get_page_id() || false === fusion_library()->get_page_id() || '0-archive' === fusion_library()->get_page_id() || is_preview_only() ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}",
"function XXLINK_edit($action, $lid = '')\n{\n global $_CONF, $_GROUPS, $_TABLES, $_USER, $_LI_CONF,\n $LANG_LINKS_ADMIN, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;\n\n USES_lib_admin();\n\n $retval = '';\n $editFlag = false;\n\n switch ($action) {\n case 'edit':\n $blocktitle = $LANG_LINKS_ADMIN[1]; // Link Editor\n $saveoption = $LANG_ADMIN['save']; // Save\n break;\n case 'moderate':\n $blocktitle = $LANG_LINKS_ADMIN[65]; // Moderate Link\n $saveoption = $LANG_ADMIN['moderate']; // Save & Approve\n break;\n }\n\n $link_templates = new Template($_CONF['path'] . 'plugins/links/templates/admin/');\n $link_templates->set_file('editor','linkeditor.thtml');\n\n $link_templates->set_var('lang_pagetitle', $LANG_LINKS_ADMIN[28]);\n $link_templates->set_var('lang_link_list', $LANG_LINKS_ADMIN[53]);\n $link_templates->set_var('lang_new_link', $LANG_LINKS_ADMIN[51]);\n $link_templates->set_var('lang_validate_links', $LANG_LINKS_ADMIN[26]);\n $link_templates->set_var('lang_list_categories', $LANG_LINKS_ADMIN[50]);\n $link_templates->set_var('lang_new_category', $LANG_LINKS_ADMIN[52]);\n $link_templates->set_var('lang_admin_home', $LANG_ADMIN['admin_home']);\n $link_templates->set_var('instructions', $LANG_LINKS_ADMIN[29]);\n\n if ($action <> 'moderate' AND !empty($lid)) {\n $result = DB_query(\"SELECT * FROM {$_TABLES['links']} WHERE lid ='$lid'\");\n if (DB_numRows($result) !== 1) {\n $msg = COM_startBlock ($LANG_LINKS_ADMIN[24], '',\n COM_getBlockTemplate ('_msg_block', 'header'));\n $msg .= $LANG_LINKS_ADMIN[25];\n $msg .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));\n return $msg;\n }\n $A = DB_fetchArray($result);\n $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);\n if ($access == 0 OR $access == 2) {\n $retval .= COM_startBlock($LANG_LINKS_ADMIN[16], '',\n COM_getBlockTemplate ('_msg_block', 'header'));\n $retval .= $LANG_LINKS_ADMIN[17];\n $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));\n COM_accessLog(\"User {$_USER['username']} tried to illegally submit or edit link $lid.\");\n return $retval;\n }\n $editFlag = true;\n } else {\n if ($action == 'moderate') {\n $result = DB_query (\"SELECT * FROM {$_TABLES['linksubmission']} WHERE lid = '$lid'\");\n $A = DB_fetchArray($result);\n } else {\n $A['lid'] = COM_makesid();\n $A['cid'] = '';\n $A['url'] = '';\n $A['description'] = '';\n $A['title']= '';\n $A['owner_id'] = $_USER['uid'];\n }\n $A['hits'] = 0;\n if (isset ($_GROUPS['Links Admin'])) {\n $A['group_id'] = $_GROUPS['Links Admin'];\n } else {\n $A['group_id'] = SEC_getFeatureGroup ('links.edit');\n }\n SEC_setDefaultPermissions ($A, $_LI_CONF['default_permissions']);\n $access = 3;\n }\n $retval .= COM_startBlock ($blocktitle, '',\n COM_getBlockTemplate ('_admin_block', 'header'));\n\n if ( $editFlag ) {\n $lang_create_or_edit = $LANG_ADMIN['edit'];\n } else {\n $lang_create_or_edit = $LANG_LINKS_ADMIN[51];\n }\n $menu_arr = array(\n array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php',\n 'text' => $LANG_LINKS_ADMIN[53]),\n array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php?edit=x',\n 'text' => $lang_create_or_edit,'active'=>true),\n array('url' => $_CONF['site_admin_url'] . '/plugins/links/category.php',\n 'text' => $LANG_LINKS_ADMIN[50]),\n array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php?validate=enabled',\n 'text' => $LANG_LINKS_ADMIN[26]),\n array('url' => $_CONF['site_admin_url'],\n 'text' => $LANG_ADMIN['admin_home'])\n );\n\n\n\n $retval .= ADMIN_createMenu($menu_arr, $LANG_LINKS_ADMIN[66], plugin_geticon_links());\n\n $link_templates->set_var('link_id', $A['lid']);\n if (!empty($lid) && SEC_hasRights('links.edit')) {\n $delbutton = '<input type=\"submit\" value=\"' . $LANG_ADMIN['delete']\n . '\" name=\"delete\"%s>';\n $jsconfirm = ' onclick=\"return confirm(\\'' . $MESSAGE[76] . '\\');\"';\n $link_templates->set_var ('delete_option',\n sprintf ($delbutton, $jsconfirm));\n $link_templates->set_var ('delete_option_no_confirmation',\n sprintf ($delbutton, ''));\n $link_templates->set_var ('delete_confirm_msg',$MESSAGE[76]);\n if ($action == 'moderate') {\n $link_templates->set_var('submission_option',\n '<input type=\"hidden\" name=\"type\" value=\"submission\">');\n }\n }\n $link_templates->set_var('lang_linktitle', $LANG_LINKS_ADMIN[3]);\n $link_templates->set_var('link_title',\n htmlspecialchars ($A['title']));\n $link_templates->set_var('lang_linkid', $LANG_LINKS_ADMIN[2]);\n $link_templates->set_var('lang_linkurl', $LANG_LINKS_ADMIN[4]);\n $link_templates->set_var('max_url_length', 255);\n $link_templates->set_var('link_url', $A['url']);\n $link_templates->set_var('lang_includehttp', $LANG_LINKS_ADMIN[6]);\n $link_templates->set_var('lang_category', $LANG_LINKS_ADMIN[5]);\n $othercategory = links_select_box (3,$A['cid']);\n $link_templates->set_var('category_options', $othercategory);\n $link_templates->set_var('lang_ifotherspecify', $LANG_LINKS_ADMIN[20]);\n $link_templates->set_var('category', $othercategory);\n $link_templates->set_var('lang_linkhits', $LANG_LINKS_ADMIN[8]);\n $link_templates->set_var('link_hits', $A['hits']);\n $link_templates->set_var('lang_linkdescription', $LANG_LINKS_ADMIN[9]);\n $link_templates->set_var('link_description', $A['description']);\n $link_templates->set_var('lang_save', $saveoption);\n $link_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);\n\n // user access info\n $link_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);\n $link_templates->set_var('lang_owner', $LANG_ACCESS['owner']);\n $ownername = COM_getDisplayName ($A['owner_id']);\n $link_templates->set_var('owner_username', DB_getItem($_TABLES['users'],\n 'username', \"uid = {$A['owner_id']}\"));\n $link_templates->set_var('owner_name', $ownername);\n $link_templates->set_var('owner', $ownername);\n $link_templates->set_var('link_ownerid', $A['owner_id']);\n $link_templates->set_var('lang_group', $LANG_ACCESS['group']);\n $link_templates->set_var('group_dropdown',\n SEC_getGroupDropdown ($A['group_id'], $access));\n $link_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);\n $link_templates->set_var('lang_permissionskey', $LANG_ACCESS['permissionskey']);\n $link_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']));\n $link_templates->set_var('lang_lockmsg', $LANG_ACCESS['permmsg']);\n $link_templates->set_var('gltoken_name', CSRF_TOKEN);\n $link_templates->set_var('gltoken', SEC_createToken());\n $link_templates->parse('output', 'editor');\n $retval .= $link_templates->finish($link_templates->get_var('output'));\n\n $retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));\n\n return $retval;\n}",
"public function testAccessAdminEditPage()\n {\n $user = factory(User::class)->create();\n $project = factory(Project::class)->create();\n $response = $this->actingAs($user)\n ->get(route('admin.project.edit', [$project]));\n\n $response->assertSuccessful();\n\n }",
"protected function get_url_this_edit(){ return $this->input ['edit_url'] ;}",
"public function testEditTypeBtn()\n {\n $this->browse(function (Browser $browser) {\n $href = route('type.edit', 3);\n $browser->loginAs(User::find(1))\n ->visit('/tipo')\n ->waitForText('Tipos')\n ->click(\"a[href='$href']\")\n ->waitForText('Modificar Tipo')\n ->assertPathIs('/tipo/3/editar');\n });\n }",
"public function setEditLink($link = NULL){\n\t\tif($link) $this->args['edit_link'] = $link;\n\t}",
"public function testEdit()\n {\n $this->visit('/admin/school/1/edit')\n ->submitForm($this->saveButtonText, $this->school)\n ->seePageIs('/admin/school')\n ;\n\n $this->seeInDatabase('schools', $this->school);\n }",
"public function get_edit_link() {\n return get_edit_post_link( $this->get_id() );\n }",
"public function testEdit()\n\t{\n\t\t$client = static::createClient(array(), array(\n\t\t 'PHP_AUTH_USER' => 'jr',\n\t\t 'PHP_AUTH_PW' => 'jr',\n\t\t));\n\t\t$client->followRedirects();\n\n\t\t// On clique sur le lien entreprise de test\n\t\t$crawler = $client->request('GET', '/clients');\n\t\t$link = $crawler->filter('.bloc__title a:contains(\"Entreprise de test\")')->first()->link();\n\t\t$crawler = $client->click($link);\n\t\t//On vérifie qu'on est bien sur la bonne page\n\t\t$this->assertEquals(1, $crawler->filter('h1:contains(\"Entreprise de test\")')->count());\n\n\t\t// On clique sur le bouton modifier\n\t\t$link = $crawler->filter('.btn--edit')->first()->link();\n\t\t$crawler = $client->click($link);\n\t\t//On vérifie qu'on est bien sur la bonne page\n\t\t$this->assertEquals(1, $crawler->filter('.breadcrumb:contains(\"Modifier\")')->count()); \n\n\t\t// On modifie le métier\n\t\t$form = $crawler->selectButton('Enregistrer')->form();\n\t\t$form['flyd_dashboardbundle_client[job]'] \t= 'Job de test modifié ' . rand(1,4);\n\t\t$crawler = $client->submit($form);\t\n\n\n\t\t//On vérifie que ça a marché\n\t\t$this->assertEquals(1, $crawler->filter('html:contains(\"Client bien enregistré.\")')->count());\n\n\t}",
"function get_edit_user_link($user_id = \\null)\n {\n }",
"public function testSeeEditPostTest()\n {\n $post = \\App\\Post::firstOrFail();\n $response = $this->actingAs(\\App\\User::firstOrFail())->get('/posts/'.$post->slug.'/edit');\n\n $response->assertStatus(200);\n $response->assertSeeText(config('app.name'));\n }",
"function testEditAction() {\n $authorInfoController = new AuthorinfoControllerForTest($this->request,$this->response);\n // guest not allowed to create/edit user object\n $this->test_user->role = \"guest\";\n $this->setUpGet(array('etd' => 'etd:1'));\n $this->assertFalse($authorInfoController->editAction()); // no pid = create new record\n // edit (still guest - not allowed)\n $this->setUpGet(array('pid' => 'bogus:1', 'etd' => 'etd:1'));\n $this->assertFalse($authorInfoController->editAction()); // edit existing record\n\n // allow to create new record \n $this->test_user->role = \"student with submission\";\n $this->resetGet();\n $this->setUpGet(array('etd' => 'etd:1'));\n $authorInfoController->editAction(); // no pid = create new record\n $view = $authorInfoController->view;\n $this->assertTrue(isset($view->title));\n $this->assertIsA($view->authorInfo, \"authorInfo\");\n // user should be a new, blank object\n $this->assertEqual(\"\", $view->authorInfo->label);\n $this->assertEqual(\"\", $view->authorInfo->pid);\n\n // allow to edit record\n $this->test_user->role = \"author\";\n $this->setUpGet(array('pid' => 'bogus:1', 'etd' => 'etd:1'));\n $authorInfoController->editAction(); // edit existing record\n $view = $authorInfoController->view;\n // pre-existing record\n $this->assertEqual(\"testuser:1\", $view->authorInfo->pid);\n }"
]
| [
"0.81177634",
"0.71823436",
"0.71409065",
"0.70466703",
"0.68440634",
"0.6823274",
"0.6823274",
"0.6822226",
"0.6757767",
"0.6703",
"0.6695805",
"0.6651942",
"0.6637052",
"0.6568327",
"0.6547046",
"0.6539987",
"0.6516833",
"0.6510105",
"0.6481844",
"0.648163",
"0.6447669",
"0.6423409",
"0.64213246",
"0.6391676",
"0.6383569",
"0.63821036",
"0.6369099",
"0.6345629",
"0.6301043",
"0.62694305"
]
| 0.77075785 | 1 |
Test the get_delete_link() method. | public function test_get_delete_link() {
$webhook = LLMS_REST_API()->webhooks()->create( array(
'delivery_url' => 'https://mock.tld',
'topic' => 'course.created',
) );
$link = $webhook->get_delete_link();
$this->assertEquals( 0, strpos( admin_url( 'admin.php?page=llms-settings&tab=rest-api§ion=webhooks&revoke-webhook=' . $webhook->get( 'id' ) ), $webhook->get_delete_link() ) );
parse_str( wp_parse_url( $link, PHP_URL_QUERY ), $parts );
$this->assertTrue( array_key_exists( 'delete-webhook-nonce', $parts ) );
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function testDeleteSharedLink()\n {\n }",
"public function testDeleteUrlUsingDELETE()\n {\n }",
"public function deleteTest()\n {\n $this->assertEquals(true, $this->object->delete(1));\n }",
"function wp_delete_link($link_id)\n {\n }",
"public function testDelete()\n\t{\n\t\t// Remove the following lines when you implement this test.\n\t\t$this->markTestIncomplete(\n\t\t\t'This test has not been implemented yet.'\n\t\t);\n\t}",
"public function testDeleteOnDelete() {\n\t\t$Action = $this->_actionSuccess();\n\t\t$this->setReflectionClassInstance($Action);\n\t\t$this->callProtectedMethod('_delete', array(1), $Action);\n\t}",
"public function testDelete()\n {\n }",
"function getDeleteLink() { return $this->_deletelink; }",
"public function testDelete()\n\t{\n\t\t$client = static::createClient(array(), array(\n\t\t 'PHP_AUTH_USER' => 'jr',\n\t\t 'PHP_AUTH_PW' => 'jr',\n\t\t));\n\t\t$client->followRedirects();\n\n\t\t// On clique sur le lien entreprise de test\n\t\t$crawler = $client->request('GET', '/clients');\n\t\t$link = $crawler->filter('.bloc__title a:contains(\"Entreprise de test\")')->first()->link();\n\t\t$crawler = $client->click($link);\n\t\t//On vérifie qu'on est bien sur la bonne page\n\t\t$this->assertGreaterThan(0, $crawler->filter('h1:contains(\"Entreprise de test\")')->count());\n\n\t\t// On clique sur le bouton modifier\n\t\t$link = $crawler->filter('.btn--delete')->first()->link();\n\t\t$crawler = $client->click($link);\n\t\t//On vérifie qu'on est bien sur la bonne page\n\t\t$this->assertEquals(1, $crawler->filter('.breadcrumb:contains(\"Supprimer\")')->count()); \n\n\t\t// On modifie le métier\n\t\t$form = $crawler->selectButton('Supprimer')->form();\n\t\t$crawler = $client->submit($form);\t\n\n\t\t//On vérifie que ça a marché\n\t\t$this->assertEquals(1, $crawler->filter('html:contains(\"Le client a bien été supprimé.\")')->count());\n\n\t}",
"public function testDelete()\n {\n $dataLoader = $this->getDataLoader();\n $data = $dataLoader->getOne();\n $this->deleteTest($data['user']);\n }",
"public function test_delete_item() {}",
"public function test_delete_item() {}",
"public function testDeleteBrandUsingDELETE()\n {\n }",
"public function testDeletedEntity() {\n $settings = Settings::getAll();\n // Set up the fixtures.\n $settings['file_link_test_middleware'] = [\n 'http://file_link.drupal/latentcy-test-file.txt' => [\n 'status' => 200,\n 'headers' => ['Content-Type' => 'text/plain', 'Content-Length' => 27],\n ],\n ];\n new Settings($settings);\n\n /** @var \\Drupal\\entity_test\\Entity\\EntityTest $entity */\n $entity = EntityTest::create(['name' => 'Foo', 'type' => 'article']);\n\n $entity->get('deferred_url')->set(0, ['uri' => 'http://file_link.drupal/latentcy-test-file.txt']);\n\n $entity->save();\n\n static::assertEquals(1, file_link_test_entity_save_counter($entity));\n\n static::assertEquals(NULL, $entity->get('deferred_url')->get(0)->getFormat());\n static::assertEquals(0, $entity->get('deferred_url')->get(0)->getSize());\n\n static::assertEquals(0, HttpMiddleware::getRequestCount('http://file_link.drupal/latentcy-test-file.txt'));\n\n $entity->delete();\n\n $this->container->get('cron')->run();\n\n static::assertEquals(0, HttpMiddleware::getRequestCount('http://file_link.drupal/latentcy-test-file.txt'));\n }",
"public function testDelete()\n {\n // test data\n $this->fixture->query('INSERT INTO <http://example.com/> {\n <http://s> <http://p1> \"baz\" .\n <http://s> <http://xmlns.com/foaf/0.1/name> \"label1\" .\n }');\n\n $res = $this->fixture->query('SELECT * WHERE {?s ?p ?o.}');\n $this->assertEquals(2, \\count($res['result']['rows']));\n\n // remove graph\n $this->fixture->delete(false, 'http://example.com/');\n\n $res = $this->fixture->query('SELECT * WHERE {?s ?p ?o.}');\n $this->assertEquals(0, \\count($res['result']['rows']));\n }",
"public function testDeleteTaskInstanceIdentityLinks()\n {\n }",
"public function testQuarantineDeleteById()\n {\n\n }",
"public function testDeleteProductUsingDELETE()\n {\n }",
"public function clickDeleteLink()\n {\n $I = $this;\n $I->amOnPage(HomePage::$deleteLink);\n }",
"public function testDeleteAction()\n {\n $res = $this->controller->deleteAction();\n $this->assertContains(\"Delete\", $res->getBody());\n }",
"public function test__GetDelete()\n\t{\n\t\t$this->assertThat(\n\t\t\t$this->object->objects->delete,\n\t\t\t$this->isInstanceOf('JAmazons3OperationsObjectsDelete')\n\t\t);\n\t}",
"public function testDeleteCategoryUsingDELETE()\n {\n }",
"public function delLink() {\n\t \t$section = $_GET['section'];\n\t\t$id = $_GET['id'];\n \tswitch ($section):\n\t\t\tcase ('showcase'):\n\t\t $title = $_GET['showcase'];\n\t\t if ($this->_ci->db->delete('showcase_relatedlinks', array('id' => $id))):\n\t\t \treturn TRUE;\n\t\t else:\n\t\t \treturn FALSE;\n\t\t endif;\n\t\t break;\n\t\t\tcase ('blog'):\n\t\t\t\t$title = $_GET['blog'];\n\t\t\t\tif ($this->_ci->db->delete('blog_relatedlinks', array('id' => $id))):\n\t\t \treturn TRUE;\n\t\t else:\n\t\t \treturn FALSE;\n\t\t endif;\n\t\t break;\n\t\tendswitch;\n }",
"public function testDeleteMetadata3UsingDELETE()\n {\n }",
"public function testDelete()\n {\n $model = $this->makeFactory();\n $model->save();\n\n $this->json('DELETE', static::ROUTE . '/' . $model->id, [], [\n 'Authorization' => 'Token ' . self::getToken()\n ])\n ->seeStatusCode(JsonResponse::HTTP_NO_CONTENT);\n }",
"public function testDeleted()\n {\n // Make a tag, then request it's deletion\n $tag = $this->resources->tag();\n $result = $this->writedown->getService('api')->tag()->delete($tag->id);\n\n // Attempt to grab the tag from the database\n $databaseResult = $this->writedown->getService('entityManager')\n ->getRepository('ByRobots\\WriteDown\\Database\\Entities\\Tag')\n ->findOneBy(['id' => $tag->id]);\n\n $this->assertTrue($result['success']);\n $this->assertNull($databaseResult);\n }",
"public function testDownvotLinkWithoutLinkID()\n {\n $users_cnt = DB::table('users')->count();\n $downvoted_cnt = DB::table('downvoted_links')->count();\n $user = User::storeUser([\n 'username' => 'Lily',\n 'email' => '[email protected]',\n 'password' => '123456789',\n ]);\n $this->assertEquals(DB::table('users')->count(), $users_cnt + 1);\n $token = auth()->login($user);\n $headers = [$token];\n\n $this->json('POST', 'api/v1/auth/downvoteLink', [], $headers)\n ->assertStatus(403)\n ->assertJson([\n 'success' => 'false',\n 'error' => 'link_id is required'\n ]);\n $this->assertEquals(DB::table('downvoted_links')->count(), $downvoted_cnt);\n $user->delete();\n $this->assertEquals(DB::table('users')->count(), $users_cnt);\n }",
"function get_delete_post_link($post = 0, $deprecated = '', $force_delete = \\false)\n {\n }",
"public function testDeleteMetadata2UsingDELETE()\n {\n }",
"#[@test]\n public function deleteCallsDestructor() {\n $hash= $this->destroyable->hashCode();\n delete($this->destroyable);\n $this->assertNull($this->destroyable);\n $this->assertEquals(1, $this->destroyed[$hash]);\n }"
]
| [
"0.76816106",
"0.7617397",
"0.7116122",
"0.69334507",
"0.6909612",
"0.6861607",
"0.6855701",
"0.68469334",
"0.68462247",
"0.68030876",
"0.67462856",
"0.67462856",
"0.6721592",
"0.67164534",
"0.66753227",
"0.6645198",
"0.6633994",
"0.6598091",
"0.659382",
"0.6565229",
"0.6549816",
"0.65061814",
"0.64994603",
"0.64928937",
"0.6487495",
"0.6484456",
"0.64811265",
"0.64733964",
"0.6473355",
"0.64698124"
]
| 0.8050503 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.