query
stringlengths
9
43.3k
document
stringlengths
17
1.17M
metadata
dict
negatives
sequencelengths
0
30
negative_scores
sequencelengths
0
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
/ time_blocks_to_datetime : returns a DateTime object representing a time of day $time_in_blocks: number of EVENT_BLOCKS since 0:00 AM/midnight $date: an optional DateTime object. If not provided, an arbitrary default date is used.
function time_blocks_to_datetime ($time_in_blocks, $date="NULL") { if ($date == "NULL") { $date = new DateTime("1/1/2000"); } $time_in_minutes = $time_in_blocks * EVENT_BLOCK; $hour = floor($time_in_minutes / 60); $minutes = $time_in_minutes % 60; $date -> setTime($hour, $minutes); // $t = $date->format("h:i A"); // echo "blocks: $time_in_blocks time_in_mintes: $time_in_minutes minutes: $minutes hour: $hour time: $t <br>"; return $date; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function blocktime_to_string($time_in_blocks, $format=\"h:i A\")\n{\n $time = time_blocks_to_datetime($time_in_blocks);\n return $time -> format($format);\n}", "function write_time_block($time_in_blocks, $format = \"h:i A\")\n{\n write_centering_table(blocktime_to_string($time_in_blocks, $format)); \n}", "private function make_timeblocks() {\n\n $startTime = new \\DateTime($this->daySchedule['start_time']);\n $endTime = new \\DateTime($this->daySchedule['end_time']);\n $interval = new \\DateInterval('PT' . $this->periodInterval . 'M');\n $breaksArray = $this->breaksArray;\n $chairScheduleArray = $this->dayScheduleArray;\n $intervalLines = $this->calc_interval($this->periodInterval, $this->intervalLines);\n $arrayCount = count($intervalLines);\n //$chairID = '';\n\n $startWhile = clone $startTime;\n $countLoop = 0;\n\n while ($startWhile <= $endTime) {\n\n $interval = new \\DateInterval('PT' . $intervalLines[$countLoop] . 'M');\n\n\n $timeblockColl = collect(array('time' => $startWhile->format('H:i'),\n 'break' => NULL,\n 'scheduled' => NULL,\n 'text' => NULL,\n 'appointment' => NULL));\n\n if ($this->inside_break_time($startWhile->format('H:i:s'), $breaksArray)) {\n\n $timeblockColl['break'] = 'break';\n\n }\n\n if (!empty($chairID = $this->inside_schedule_time($startWhile->format('H:i:s'), $chairScheduleArray))) {\n\n $chairDescription = DB::select('SELECT `description` FROM `chair` WHERE `id` = \"' . $chairID .'\"');\n $chairDescription = $chairDescription[0]->description;\n $timeblockColl['scheduled'] = 'Ingeroosterd: ' . $chairDescription;\n\n //Check for appointment for this chair, time and date\n if ($appointm = $this->get_appointment($startWhile->format('H:i:s'), $chairID)) {\n\n $appointm = $appointm->toArray();\n // vd($appointm[0]);\n $timeblockColl['appointment'] = $appointm;\n\n //change interval to appointment duration to skip blocks related to the appointment\n $interval = new \\DateInterval('PT' . $appointm[0]->duration . 'M');\n\n }\n }\n\n\n $startWhile->add($interval);\n\n if ($countLoop == $arrayCount - 1) {\n $countLoop = 0;\n } else {\n $countLoop++;\n }\n\n $this->timeBlocksArray[] = $timeblockColl;\n }\n\n }", "public function save_dates(block_base $block, array $dates) {\n global $DB;\n\n // Set the dates in block's config and update the config field in DB.\n foreach ($this->get_settings($block) as $name => $setting) {\n $block->config->$name = $dates[$name];\n }\n\n $DB->set_field('block_instances', 'configdata', base64_encode(serialize($block->config)),\n array('id' => $block->instance->id));\n\n }", "public static function parseBlock($block){\n\n $blocks = array();\n if (isset(conf::$vars['coscms_main'][$block],conf::$vars['coscms_main']['module'][$block])){\n $blocks = array_merge(conf::$vars['coscms_main'][$block], conf::$vars['coscms_main']['module'][$block]);\n } else if (isset(conf::$vars['coscms_main'][$block])) {\n $blocks = conf::$vars['coscms_main'][$block];\n } else if (isset(conf::$vars['coscms_main']['module'][$block])){\n $blocks = conf::$vars['coscms_main']['module'][$block];\n } else {\n return $blocks;\n }\n\n $ret_blocks = array();\n foreach ($blocks as $val) {\n \n // numeric is custom block added to database\n if (is_numeric($val)) {\n moduleloader::includeModule('blocks');\n $row = blocks::getOne($val); \n $row['content_block'] = moduleloader::getFilteredContent(\n conf::getModuleIni('blocks_filters'), $row['content_block']\n );\n $row['title'] = htmlspecialchars($row['title']);\n $content = view::get('blocks', 'block_html', $row);\n $ret_blocks[] = $content;\n continue;\n }\n \n if ($val == 'module_menu'){\n $ret_blocks[] = self::getMainMenu();\n continue; \n }\n $func = explode('/', $val);\n $num = count($func) -1;\n $func = explode ('.', $func[$num]);\n $func = 'block_' . $func[0];\n $path_to_function = conf::pathModules() . \"/$val\";\n include_once $path_to_function;\n ob_start();\n $ret = $func();\n if ($ret) {\n $ret_blocks[] = $ret; \n } else {\n $ret_blocks[] = ob_get_contents();\n ob_end_clean();\n }\n }\n return $ret_blocks;\n }", "function tBlockConverter($timeString) {\n\t$TimeValue = 0;\n\tif ($timeString == \"8:00\") {\n\t\t$TimeValue = 16;\n\t} elseif ($timeString == \"8:30\") {\n\t\t$TimeValue = 17;\n\t} elseif ($timeString == \"9:00\") {\n\t\t$TimeValue = 18;\n\t} elseif ($timeString == \"9:30\") {\n\t\t$TimeValue = 19;\n\t} elseif ($timeString == \"10:00\") {\n\t\t$TimeValue = 20;\n\t} elseif ($timeString == \"10:30\") {\n\t\t$TimeValue = 21;\n\t} elseif ($timeString == \"11:00\") {\n\t\t$TimeValue = 22;\n\t} elseif ($timeString == \"11:30\") {\n\t\t$TimeValue = 23;\n\t} elseif ($timeString == \"12:00\") {\n\t\t$TimeValue = 24;\n\t} elseif ($timeString == \"12:30\") {\n\t\t$TimeValue = 25;\n\t} elseif ($timeString == \"13:00\") {\n\t\t$TimeValue = 26;\n\t} elseif ($timeString == \"13:30\") {\n\t\t$TimeValue = 27;\n\t} elseif ($timeString == \"14:00\") {\n\t\t$TimeValue = 28;\n\t} elseif ($timeString == \"14:30\") {\n\t\t$TimeValue = 29;\n\t} elseif ($timeString == \"15:00\") {\n\t\t$TimeValue = 30;\n\t} elseif ($timeString == \"15:30\") {\n\t\t$TimeValue = 31;\n\t} elseif ($timeString == \"16:00\") {\n\t\t$TimeValue = 32;\n\t} elseif ($timeString == \"16:30\") {\n\t\t$TimeValue = 33;\n\t} elseif ($timeString == \"17:00\") {\n\t\t$TimeValue = 34;\n\t} elseif ($timeString == \"17:30\") {\n\t\t$TimeValue = 35;\n\t}\n\treturn $TimeValue;\n}", "public function blockTemporarily(DateTimeImmutable $blockDateTime): void;", "public static function make($blockname, $course) {\n global $CFG;\n // Check if static array already has an object for this mod extractor class.\n if (isset(self::$blockdateextractor[$blockname])) {\n self::$blockdateextractor[$blockname];\n }\n\n // First, see if the plugin has implemented support within itself. This will be\n // a class in the plugins classes folder that can be loaded using auto-loading.\n $classname = 'block_' . $blockname . '_report_editdates_integration';\n if (class_exists($classname)) {\n self::$blockdateextractor[$blockname] = new $classname($course);\n return self::$blockdateextractor[$blockname];\n }\n\n // Create the new object of this mods date exractor file.\n $filename = $CFG->dirroot . '/report/editdates/blocks/' . $blockname . 'dates.php';\n if (file_exists($filename)) {\n include_once($filename);\n $classname = 'report_editdates_block_'.$blockname.'_date_extractor';\n if (class_exists($classname)) {\n self::$blockdateextractor[$blockname] = new $classname($course);\n return self::$blockdateextractor[$blockname];\n }\n }\n\n self::$blockdateextractor[$blockname] = null;\n return self::$blockdateextractor[$blockname];\n }", "function data_datetime() {\n\t\treturn array(\n\t\t\tarray(\n\t\t\t\t'2015-01-02',\n\t\t\t\t'2015-01-02 00:00:00',\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'2015-01-02 13:23:11',\n\t\t\t\t'2015-01-02 13:23:11',\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t\\strtotime('2015-01-02 13:23:11'),\n\t\t\t\t'2015-01-02 13:23:11',\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'20150102',\n\t\t\t\t'2015-01-02 00:00:00',\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t20150102,\n\t\t\t\t'2015-01-02 00:00:00',\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'Not Time',\n\t\t\t\t'0000-00-00 00:00:00',\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'0000-00-00 12:30:30',\n\t\t\t\t'0000-00-00 00:00:00',\n\t\t\t),\n\t\t\tarray(\n\t\t\t\tarray(20150102),\n\t\t\t\tarray('2015-01-02 00:00:00'),\n\t\t\t),\n\t\t);\n\t}", "function &build_block_date()\n{\n\t$this->_init_option_block();\n\t$article_arr =& $this->collect_permit_date();\n\t$i = 0;\n\t$arr = array();\n\tforeach ( $article_arr as $article )\n\t{\n\t\t$arr[$i] = $this->_make_block_line( $i, $article );\n\t\t$i ++;\n\t}\n\treturn $arr;\n}", "public function index(Request $request, TimeBlock $timeBlock)\n {\n $paginate = $request->paginate ?? config('timerizable.api.time_blocks_paginate', 0);\n // $intervals = $timeBlock->time_intervals()->paginate(10);\n if(is_numeric($paginate) && $paginate > 1) {\n $intervals = $timeBlock->time_intervals()->paginate(intval($paginate));\n } else {\n $intervals = ['data' => $timeBlock->time_intervals];\n }\n return response()->json($intervals);\n }", "public function toDateTime($time) { }", "public function getNewsOfBlock( $blockId ){\n\t\t\n\t\t$blocks = new stdClass();\n\n\t\t/*$sql = 'SELECT bn.id AS bnid, b.name, bn.noticia_id AS noticiaId, n.encabezado, n.sintesis, n.id_seccion, n.autor, n.id_tipo_fuente, n.id_tipo_autor, f.nombre AS fuente, f.id_fuente, bn.tema_id AS temaId, t.nombre AS tema, n.id_tendencia_monitorista AS tendencia_id FROM bloques_noticias bn INNER JOIN bloques b ON bn.bloque_id = b.id INNER JOIN noticia n ON bn.noticia_id = n.id_noticia INNER JOIN fuente f ON n.id_fuente = f.id_fuente INNER JOIN tema t ON bn.tema_id = t.id_tema WHERE bn.bloque_id = :blockId AND (bn.enviado IS NULL OR bn.enviado like \"0\");\n\t\t';*/\n\n\t\t$sql = 'SELECT bn.id AS bnid, b.name, bn.noticia_id AS noticiaId, n.encabezado, n.sintesis, n.id_seccion, n.autor, n.id_tipo_fuente, n.id_tipo_autor, f.nombre AS fuente, f.id_fuente, bn.tema_id AS temaId, t.nombre AS tema, n.id_tendencia_monitorista AS tendencia_id FROM bloques_noticias bn INNER JOIN bloques b ON bn.bloque_id = b.id INNER JOIN noticia n ON bn.noticia_id = n.id_noticia INNER JOIN fuente f ON n.id_fuente = f.id_fuente INNER JOIN tema t ON bn.tema_id = t.id_tema WHERE bn.bloque_id = :blockId ; ';\n\n\t\t$query = $this->pdo->prepare( $sql );\n\t\t$query->bindParam(':blockId', $blockId, \\PDO::PARAM_INT);\n\t\t\n\t\tif($query->execute()){\n\t\t\t$blocks->exito = true;\n\t\t\t$blocks->rows = ( $query->rowCount() > 0 ) ? $query->fetchAll( \\PDO::FETCH_ASSOC) : 'No se encontraron noticias para este bloque';\n\t\t\t$blocks->error = 0;\n\t\t}else{\n\t\t\t$blocks->exito = false;\n\t\t\t$blocks->error = $query->errorInfo();\n\t\t}\n\t\treturn $blocks;\n\t}", "public function actionBlockDays()\n {\n return $this->renderTemplate('craft-delivery-date/timeslots');\n }", "public function FiletimeToDatetime($time)\n {\n // Filetime: Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).\n return Carbon::createFromDate(1601, 1, 1)->addSeconds($time / 10000000);\n }", "public function getEventsOnDay(\\DateTime $dateTime);", "protected function toDateTime($date)\n {\n return PointInTime::guessFrom($date);\n }", "abstract public function validate_dates(block_base $block, array $dates);", "function get_schedule_html($blocks){\r\n\t\t$nav = $content = '';\r\n\r\n\t\t$speakers = $this->get_speakers_array();\r\n\r\n\t\t//ksort($blocks);\r\n\r\n\t\t$block_count = 1;\r\n\t\tfor($v=1; $v<=100; $v++){\r\n\r\n\t\t\t$day_ = 'd'.$v;\r\n\t\t\tif( empty($blocks[$day_])) continue;\r\n\r\n\t\t\t$block = $blocks[$day_];\r\n\r\n\t\t\t\r\n\t\t\t// if the block only have date values left which is 1 item\r\n\t\t\tif(count($block)==1) continue;\r\n\r\n\t\t\t$day = substr($day_, 1);\r\n\r\n\t\t\t// nav\r\n\t\t\t\t$nav .= \"<li class='\".( $block_count==1?'show':'').\"' data-day='{$day}' title='\".$block[0].\"'>Day \".$day.\"</li>\";\r\n\t\t\t\t\t\t\r\n\t\t\t$content.= \"<ul class='evosch_oneday_schedule \".($block_count==1?'show':'').\" evosch_date_{$day}'>\";\r\n\r\n\t\t\tforeach($block as $key=>$data){\r\n\t\t\t\tif($key==0) continue;\r\n\t\t\t\t$content.= \"<li id='{$key}' data-day='{$day_}'>\";\r\n\t\t\t\t$content.= \"<p><b>(\".$data['evo_sch_stime'].'-'.$data['evo_sch_etime'].') '.$data['evo_sch_title'].\"</b> <i>\".__('Edit','eventon').\"</i><em>\".__('Delete','eventon').\"</em></p>\";\r\n\t\t\t\t$content.= \"<p class='evosch_desc'>\".$data['evo_sch_desc'].\"</p>\";\r\n\r\n\t\t\t\tif( !empty($data['evo_sch_spk'])){\r\n\t\t\t\t\t$spkContent = implode(', ', $data['evo_sch_spk']);\r\n\t\t\t\t\t$content.= \"<p class='evosch_spks'>\".__('Speakers:','eventon').' '.$spkContent.\"</p>\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$content.= \"</li>\";\r\n\t\t\t}\t\r\n\t\t\t$content.= \"</ul>\";\r\n\t\t\t$block_count++;\t\r\n\t\t}\r\n\r\n\t\treturn \"<ul class='evosch_nav'>\".$nav.\"</ul>\". $content;\t\t\t\t\t\r\n\t}", "public function getBlocks();", "function less5hours($dateTime, $format = 'Y-m-d H:i:s') {\n $eventDateTimeConvert = date($format, strtotime($dateTime));\n return $eventDateTimeConvert;\n\n $this->controller->loadModel('User');\n $userTimezone = $this->controller->Session->read('Auth.User.time_zone');\n\n if ($userTimezone == \"\")\n return date($format, strtotime('-5 hours', strtotime(str_replace('T', ' ', $dateTime))));\n\n $utcDateTime = strtotime(str_replace('T', ' ', $dateTime));\n $diffUtc = str_replace(\"GMT\", \"\", $userTimezone);\n $diffUtc = str_replace(\":\", \" hours \", $diffUtc);\n $diffUtc .= \" minutes\";\n $eventTime4User = strtotime($diffUtc, $utcDateTime);\n $eventDateTimeConvert = date($format, $eventTime4User);\n return $eventDateTimeConvert;\n }", "function _legacy_blocks_get_default() {\n global $CFG;\n\n $this->init_full();\n\n if($this->id == SITEID) {\n // Is it the site?\n if (!empty($CFG->defaultblocks_site)) {\n $blocknames = $CFG->defaultblocks_site;\n }\n /// Failsafe - in case nothing was defined.\n else {\n $blocknames = 'site_main_menu,admin_tree:course_summary,calendar_month';\n }\n }\n // It's a normal course, so do it according to the course format\n else {\n $pageformat = $this->course->format;\n if (!empty($CFG->{'defaultblocks_'. $pageformat})) {\n $blocknames = $CFG->{'defaultblocks_'. $pageformat};\n }\n else {\n $format_config = $CFG->dirroot.'/course/format/'.$pageformat.'/config.php';\n if (@is_file($format_config) && is_readable($format_config)) {\n require($format_config);\n }\n if (!empty($format['defaultblocks'])) {\n $blocknames = $format['defaultblocks'];\n }\n else if (!empty($CFG->defaultblocks)){\n $blocknames = $CFG->defaultblocks;\n }\n /// Failsafe - in case nothing was defined.\n else {\n $blocknames = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';\n }\n }\n }\n\n return $blocknames;\n }", "public function block_calendar()\n {\n $clinic_id = $this->session->userdata('clinic_id');\n $split = explode(\"-\", $this->input->post(\"daterange\"));\n $spl1 = explode(\"/\", $split[0]);\n $spl2 = explode(\"/\", $split[1]);\n $start = $spl1[2].\"-\".$spl1[1].\"-\".$spl1[0];\n $end = $spl2[2].\"-\".$spl2[1].\"-\".$spl2[0];\n $dates = $start.\" \".$end;\n \n // $results[] = getDatesFromRange(trim($spli[0]), trim($spli[1]));\n // $myArray = array_map(\"unserialize\", array_unique(array_map(\"serialize\", $results)));\n // $block_dates = array_flatten($myArray);\n //$block_dates = implode(\",\",$main_arr);\n\n $user_id = $this->session->has_userdata('user_id');\n // if (count($block_dates) > 0) {\n // $i = 0;\n // foreach ($block_dates as $key => $value) {\n // $i++;\n // }\n\n // }\n extract($_POST);\n $dates = explode(\" - \", $daterange);\n $from = date(\"Y-m-d H:i:s\", strtotime($dates[0]));\n $to = date(\"Y-m-d H:i:s\", strtotime($dates[1]));\n\n $data['doctor_id'] = $this->input->post(\"block_doctor\");\n $data['from_date'] = $from;\n $data['to_date'] = $to;\n $data['remark'] = $this->input->post(\"remark\");\n $data['clinic_id'] = $clinic_id;\n $data['dates'] = $this->input->post(\"daterange\");\n $data['status'] = 1;\n $data['created_by'] = $user_id;\n $data['modified_by'] = $user_id;\n $data['created_date_time'] = date('Y-m-d H:i:s');\n $data['modified_date_time'] = date('Y-m-d H:i:s');\n $this->Generic_model->insertData('calendar_blocking', $data);\n redirect(\"calendar_view\");\n }", "function _get_blocks($page, $block_type) {\n\n $this->load->model('block_model');\n $page_blocks_name = $block_type . 's';\n\n // get all available block_type blocks in db\n $available_blocks = $this->block_model->get($block_type);\n $this->data[$page_blocks_name] = $available_blocks;\n \n // get blocks for this page\n $page_blocks = $page->_get_page_blocks($page_blocks_name, true);\n\n // if this page already has block associated with it, use them. otherwise, use all available in db\n if ($page_blocks) {\n // check saved sideblocks against available, new blocks may have been added\n // go through page list to obtain order and checked items\n $new_block_order = array();\n foreach ($page_blocks as $block_name => $block) {\n // if this page has this block set, use it\n if (isset($available_blocks[$block_name])) {\n $block[2] = 1;\n $new_block_order[$block_name] = $block;\n unset($available_blocks[$block_name]);\n }\n }\n\n // append any remaining available_blocks (those not set for the current page)\n $this->data[$page_blocks_name] = array_merge($new_block_order, $available_blocks);\n }\n }", "public static function fromDateTime($datetime) { }", "static function getTimestampTimeUnits($time) {\n\n $out = [];\n\n $time = round(abs($time));\n $out['second'] = 0;\n $out['minute'] = 0;\n $out['hour'] = 0;\n $out['day'] = 0;\n\n $out['second'] = $time%MINUTE_TIMESTAMP;\n $time -= $out['second'];\n\n if ($time > 0) {\n $out['minute'] = ($time%HOUR_TIMESTAMP)/MINUTE_TIMESTAMP;\n $time -= $out['minute']*MINUTE_TIMESTAMP;\n\n if ($time > 0) {\n $out['hour'] = ($time%DAY_TIMESTAMP)/HOUR_TIMESTAMP;\n $time -= $out['hour']*HOUR_TIMESTAMP;\n\n if ($time > 0) {\n $out['day'] = $time/DAY_TIMESTAMP;\n }\n }\n }\n return $out;\n }", "function getDatesFromRange($date_time_from, $date_time_to, $duration, $blocked_slots)\n{\n $tmp_raw = [];\n $start = Carbon\\Carbon::parse($date_time_from);\n $end = Carbon\\Carbon::parse($date_time_to);\n $diff = $end->diffInMinutes($start); //dd($diff/$duration);\n $tmp = Carbon\\Carbon::parse($start);\n //init\n $Hi_format_init = $start->format('H:i');\n $tmp_raw[''] = 'available';\n $tmp_raw[$Hi_format_init] = in_array($Hi_format_init, $blocked_slots)?'not_available':'available';\n for($i = 0; $i < ($diff/$duration); $i++){\n $tmp_next = $tmp->addMinutes($duration);\n $Hi_format = $tmp_next->format('H:i');\n //$tmp_raw[] = $tmp_next->format('H:i');\n $tmp_raw[$Hi_format] = in_array($Hi_format, $blocked_slots)?'not_available':'available';\n }\n return $tmp_raw;\n}", "function getTimeSlices($timestamp = FALSE)\n{\n global $TIMESTEP;\n\n if($timestamp)\n {\n $tstart = strtotime(TIMESTART, $timestamp);\n $tend = strtotime(TIMEEND, $timestamp); \n }\n else\n {\n $tstart = strtotime(TIMESTART);\n $tend = strtotime(TIMEEND); \n }\n \n $timeSlices = array();\n for($i = $tstart ; $i < $tend; )\n {\n $start = $i;\n $end = addTime($i, $TIMESTEP);\n $timeSlices[] = array( \"start\" => $start, \"end\" => $end );\n $i = $end;\n }\n return $timeSlices;\n}", "private function getTimeFromDateTime($dateTime)\n {\n return (new DateTime($dateTime))->format(self::TIME_FORMAT);\n }", "public function getBlockRecord($block = 'latest'): array\n {\n $block = (is_null($block) ? $this->defaultBlock : $block);\n\n if ($block === false) {\n throw new ChiaException('No block identifier provided');\n }\n\n if ($block == 'latest') {\n return $this->getCurrentBlock();\n }\n\n if (is_string($block) && strlen($block) == 66) {\n return $this->getBlockRecordByHash($block);\n }\n\n return $this->getBlockRecordByHeight($block);\n }" ]
[ "0.5771219", "0.5407463", "0.5058301", "0.48398983", "0.47216064", "0.46953455", "0.46508226", "0.4634358", "0.45400062", "0.44622037", "0.44556963", "0.442431", "0.43889377", "0.43844944", "0.42795366", "0.42713335", "0.4268018", "0.42679715", "0.42585668", "0.42400503", "0.42316243", "0.42229298", "0.42098615", "0.4208578", "0.41973975", "0.41915786", "0.41890138", "0.41744262", "0.41592783", "0.41261944" ]
0.76986784
0
/ blocktime_to_string : returns a string representing this time as a string $time_in_blocks: the number of EVENT_BLOCKS since midnight (00:00 AM) $format: an optional format string. See PHP datetime man page for options. default format renders time of 27 as "1:30 PM"
function blocktime_to_string($time_in_blocks, $format="h:i A") { $time = time_blocks_to_datetime($time_in_blocks); return $time -> format($format); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function write_time_block($time_in_blocks, $format = \"h:i A\")\n{\n write_centering_table(blocktime_to_string($time_in_blocks, $format)); \n}", "function time_blocks_to_datetime ($time_in_blocks, $date=\"NULL\")\n{\n if ($date == \"NULL\") {\n $date = new DateTime(\"1/1/2000\");\n }\n $time_in_minutes = $time_in_blocks * EVENT_BLOCK;\n $hour = floor($time_in_minutes / 60);\n $minutes = $time_in_minutes % 60;\n $date -> setTime($hour, $minutes);\n// $t = $date->format(\"h:i A\");\n// echo \"blocks: $time_in_blocks time_in_mintes: $time_in_minutes minutes: $minutes hour: $hour time: $t <br>\";\n return $date;\n}", "function tBlockConverter($timeString) {\n\t$TimeValue = 0;\n\tif ($timeString == \"8:00\") {\n\t\t$TimeValue = 16;\n\t} elseif ($timeString == \"8:30\") {\n\t\t$TimeValue = 17;\n\t} elseif ($timeString == \"9:00\") {\n\t\t$TimeValue = 18;\n\t} elseif ($timeString == \"9:30\") {\n\t\t$TimeValue = 19;\n\t} elseif ($timeString == \"10:00\") {\n\t\t$TimeValue = 20;\n\t} elseif ($timeString == \"10:30\") {\n\t\t$TimeValue = 21;\n\t} elseif ($timeString == \"11:00\") {\n\t\t$TimeValue = 22;\n\t} elseif ($timeString == \"11:30\") {\n\t\t$TimeValue = 23;\n\t} elseif ($timeString == \"12:00\") {\n\t\t$TimeValue = 24;\n\t} elseif ($timeString == \"12:30\") {\n\t\t$TimeValue = 25;\n\t} elseif ($timeString == \"13:00\") {\n\t\t$TimeValue = 26;\n\t} elseif ($timeString == \"13:30\") {\n\t\t$TimeValue = 27;\n\t} elseif ($timeString == \"14:00\") {\n\t\t$TimeValue = 28;\n\t} elseif ($timeString == \"14:30\") {\n\t\t$TimeValue = 29;\n\t} elseif ($timeString == \"15:00\") {\n\t\t$TimeValue = 30;\n\t} elseif ($timeString == \"15:30\") {\n\t\t$TimeValue = 31;\n\t} elseif ($timeString == \"16:00\") {\n\t\t$TimeValue = 32;\n\t} elseif ($timeString == \"16:30\") {\n\t\t$TimeValue = 33;\n\t} elseif ($timeString == \"17:00\") {\n\t\t$TimeValue = 34;\n\t} elseif ($timeString == \"17:30\") {\n\t\t$TimeValue = 35;\n\t}\n\treturn $TimeValue;\n}", "public function toTimeString();", "protected function blocks_toString(&$blocks)\n\t{\n\t\t$str = '';\n\t\tforeach ($blocks as $name => $block)\n\t\t{\n\t\t\tif (is_string($name) && !is_numeric($name))\n\t\t\t{\n\t\t\t\t$str .= \"<!-- BEGIN: $name -->\\n\" . $block->__toString() . \"<!-- END: $name -->\\n\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$str .= $block->__toString();\n\t\t\t}\n\t\t}\n\t\treturn $str;\n\t}", "public static function timeToString($time)\n {\n $return = '';\n if($time < 0)\n {\n $return .= '- ';\n $time = -$time;\n }\n if ($time >= 3600)\n {\n $hours = floor($time / 3600);\n $minutes = round(bcmod($time, 3600) / 60);\n }\n else\n {\n $hours = 0;\n $minutes = round($time / 60);\n }\n \n if (strlen($minutes) == 1)\n {\n $minutes = '0' . $minutes;\n }\n \n $return .= $hours . ':' . $minutes;\n \n return $return;\n }", "public function clockIn(): string\n {\n return (new \\DateTime())->format($this->getClockFormat());\n }", "public function toString($format = 'Shh:mm:ss')\n {\n // Define o tempo a ser usado\n $time = $this->time;\n\n // Verifica o sinal\n if ($this->time < 0) {\n $format = str_replace('S', '-', $format);\n $time = -$time;\n } else {\n $format = str_replace('S', '', $format);\n }\n\n // Calcula os tempos\n $s = $time % 60;\n $m = (($time - $s) / 60) % 60;\n $h = ($time - 60 * $m - $s) / (60 * 60);\n\n // Imprime o formato escolhido\n $format = str_replace(\n ['ss', 's', 'mm', 'm', 'hh', 'h'],\n [\n str_pad($s, 2, '0', STR_PAD_LEFT),\n $s,\n str_pad($m, 2, '0', STR_PAD_LEFT),\n $m,\n str_pad($h, 2, '0', STR_PAD_LEFT),\n $h\n ],\n $format\n );\n\n // Retorna a hora formatada\n return $format;\n }", "function get_time_string($time) {\n\t\t$hour = floor($time / 100);\n\t\t$minute = $time % 100;\n\t\t$text = '';\n\t\tif($hour == 0)\n\t\t\t$text .= ($hour + 12);\n\t\telse if($hour > 0 && $hour <= 12)\n\t\t\t$text .= $hour;\n\t\telse\n\t\t\t$text .= ($hour - 12);\n\t\tif($minute > 0) {\n\t\t\tif($minute < 10)\n\t\t\t\t$text .= ':0' . $minute;\n\t\t\telse\n\t\t\t\t$text .= ':' . $minute;\n\t\t}\n\t\tif($hour < 12 || $hour == 24)\n\t\t\t$text .= ' am';\n\t\telse\n\t\t\t$text .= ' pm';\n\t\treturn $text;\n\t}", "public static function timeFormat($time)\n {\n return \\Carbon\\Carbon::createFromFormat('H:i', $time)->format('H:i');\n }", "public function formatTime(): string\n {\n return $this->format('H:i:s');\n }", "public static function formatTime($time_in_minutes)\n {\n $time_in_minutes = round($time_in_minutes);\n\n // Negative Werte gesondert behandeln\n if ($time_in_minutes >= 0) {\n $hours = floor($time_in_minutes / 60);\n $minutes = $time_in_minutes - $hours * 60;\n } else {\n $hours = ceil($time_in_minutes / 60);\n $minutes = $time_in_minutes - $hours * 60;\n }\n\n // Minuszeichen bei den Minuten wegschneiden\n $minutes = ltrim($minutes, '-');\n if (strlen($minutes) <= 1) {\n $minutes = \"0\" . $minutes;\n }\n return ($hours . \":\" . $minutes);\n }", "function timehtml($time, $fmt = '%H:%M')\n{\n $d = strtotime($time);\n $dstr = strftime($fmt, $d);\n return htmlspecialchars($dstr, ENT_QUOTES);\n}", "public static function format_time($time) {\n\n // Call the main Moodle date-conversion function, with a standard e-mail timestamp.\n // TODO: Abstract me to somewhere else?\n return userdate($time, '%A, %d %B %Y, %I:%M %P');\n\n }", "function time2string($timeline) {\n $periods = Configure::read('ELAPSED_TIME_FORMAT');\n\t$ret = '';\n foreach($periods AS $name => $seconds){\n $num = floor($timeline / $seconds);\n $timeline -= ($num * $seconds);\n\t\tif($name == 'day')\n\t\t\t$ret .= $num .' '. $name .(($num > 1) ? 's' : '') . ', ';\n\t\telse\n\t\t\t$ret .= $num .' '. $name .(($num > 1) ? 's' : '') . ' ';\n }\n return trim($ret);\n}", "function timestr($timestamp) {\n global $t;\n $time = strftime(\"%A, %e. %B %Y, %H:%M:%S %Z\", $timestamp);\n return $time;\n}", "public function formatTime($time)\n {\n return sprintf('%02d:%02d:%02d', ($time / 3600), ($time / 60 % 60), ($time % 60));\n }", "function get_formatted_time($end_bargaining)\n{\n \n $current_time = time(); // unix timestamp\n \n $difference = floor(($end_bargaining - $current_time));\n \n $hours = floor($difference / 3600); // remaining hours\n $minutes = floor(($difference - ($hours * 3600)) / 60); // remaining minutes\n \n $remained_time = $hours . \":\" . $minutes;\n \n return $remained_time;\n}", "protected static function timeString()\n {\n $time = microtime(1) * 10000000 + static::INTERVAL;\n\n // Convert to a string representation\n $time = sprintf(\"%F\", $time);\n\n // Strip decimals\n preg_match(\"/^\\d+/\", $time, $time);\n\n // And now to a 64-bit binary representation\n $time = base_convert($time[0], 10, 16);\n $time = pack(\"H*\", str_pad($time, 16, \"0\", STR_PAD_LEFT));\n\n return $time;\n }", "public function toReadable(int $time, string $dateFormat = 'Y-m-d H:i:s') : string\n {\n return $this->returnDatetime($dateFormat, $time);\n }", "public function __toString()\n {\n return $this->helper->formatTime($this->time);\n }", "public function toTimeString()\n {\n return $this->format('H:i:s');\n }", "public function toTimeString(): Str\n {\n return $this->toFormatInternal('H:i:s');\n }", "private function formatTime($time)\n {\n $time_str = strval($time);\n $time_frac = floatVal($time_str);\n $time_flat = floor($time_frac);\n\n $time_milli = '';\n\n if (strpos($time_str, '.') > 0) {\n $time_milli = '.' . explode('.', $time_str)[1];\n }\n\n $hours = floor($time_flat / 3600);\n return $hours . gmdate(':i:s', $time_flat) . $time_milli;\n }", "public function c_24_hour_format($time)\n\t{\n\t return date(\"H:i:s\", strtotime($time));\n\t}", "public function time(string $format = ''): string\n\t{\n\t\t$format = $format ?: (string) get_option('time_format');\n\t\t$time = mysql2date($format, $this->comment->comment_date);\n\n\t\treturn Hook::apply('get_comment_time', $time, $format, false, true, $this->comment);\n\t}", "function formatTime($timestamp, $format = false) {\n\tglobal $config;\n\t\n\t$format = (!$format) ? $config['timeFormat'] : $format;\n\t$value = substr($config['timeOffset'], 1);\n\t\n\tswitch (substr($config['timeOffset'], 0, 1)) {\n\t\tcase '+':\n\t\t\t$timestamp += $value; \n\t\t\tbreak;\n\t\tcase '-':\n\t\t\t$timestamp -= $value;\n\t\t\tbreak;\n\t}\n//\tdie($format);\n\treturn strftime($format, $timestamp);\n}", "function datetime_to_string($datetime)\n{\n\treturn $datetime->format('Y-m-d H:i:s');\n}", "public function text($block = 'MAIN')\n\t{\n\t\t$path = isset($this->index[$block]) ? $this->index[$block] : null;\n\n if (empty($path)) {\n // throw new Exception(\"Block $block is not found in \" . $this->filename);\n return '';\n }\n\n $blk = $this->blocks[array_shift($path)];\n foreach ($path as $node) {\n if (is_object($blk)) {\n $blk =& $blk->blocks[$node];\n } else {\n $blk =& $blk[$node];\n }\n }\n \n return $blk->text($this);\n\t}", "function outputCodeblocks($schedule) {\r\n\t//echo ('<!--date_default_timezone_set: ' . date_default_timezone_get() . '-->');\r\n\t$timeslots = get_option(\"tw_timeslot_list\");\r\n\t$codeblocks = get_option(\"tw_codeblock_list\");\r\n\t$schedules = get_option(\"tw_schedule_list\");\r\n\t$exceptions = get_option(\"tw_exception_list\");\r\n\t$current_time = current_time(\"mysql\");\r\n\t$at_least_one = false;\r\n\t$retval = \"\";\r\n\tforeach ($timeslots as $timeslot_id => $timeslot)\r\n\t{\r\n\t\tif($timeslot->schedule_id == $schedule && inTimeslot($timeslot, $current_time, $exceptions[$timeslot_id])){\r\n\t\t\t$retval.= $codeblocks[$timeslot->codeblock_id]->block_code;\r\n\t\t\t$at_least_one = true;\r\n\t\t}\r\n\t}\r\n\tif(!$at_least_one && isset($schedules[$schedule]) && $schedules[$schedule]->default_codeblock != null)\r\n\t{\r\n\t\t$retval = $codeblocks[$schedules[$schedule]->default_codeblock]->block_code;\r\n\t}\r\n\treturn $retval;\r\n}" ]
[ "0.73134357", "0.60801023", "0.5638917", "0.56271416", "0.5555821", "0.532631", "0.5254989", "0.5236755", "0.5232371", "0.5182218", "0.5116608", "0.51149213", "0.50753826", "0.5027161", "0.49766234", "0.4972201", "0.49490508", "0.4937353", "0.49317127", "0.49195236", "0.48483738", "0.48476166", "0.48436213", "0.48351145", "0.483217", "0.48290703", "0.47373778", "0.4736792", "0.47029233", "0.4699941" ]
0.86679494
0
/ write_time_block : write a database time to the page as a formatted string $time_in_blocks: time, represented as number of EVENT_BLOCKS since midnight $format: an optional format string. See PHP datetime man page for options.
function write_time_block($time_in_blocks, $format = "h:i A") { write_centering_table(blocktime_to_string($time_in_blocks, $format)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function blocktime_to_string($time_in_blocks, $format=\"h:i A\")\n{\n $time = time_blocks_to_datetime($time_in_blocks);\n return $time -> format($format);\n}", "function time_blocks_to_datetime ($time_in_blocks, $date=\"NULL\")\n{\n if ($date == \"NULL\") {\n $date = new DateTime(\"1/1/2000\");\n }\n $time_in_minutes = $time_in_blocks * EVENT_BLOCK;\n $hour = floor($time_in_minutes / 60);\n $minutes = $time_in_minutes % 60;\n $date -> setTime($hour, $minutes);\n// $t = $date->format(\"h:i A\");\n// echo \"blocks: $time_in_blocks time_in_mintes: $time_in_minutes minutes: $minutes hour: $hour time: $t <br>\";\n return $date;\n}", "private function write_time($time, $type)\n\t{\n\t\tif ( empty($time) || !is_numeric($time) || empty($type))\n\t\t\treturn FALSE;\n\t\t\t\n\t\t$file = MODPATH.'/dbmanager/backup-db/automatic.txt';\n\t\t\n\t\t$fp = fopen($file, \"r\");\n\t\t$line = '';\n\t\t$content = '';\n\t\twhile (!feof($fp))\n\t\t{\n\t\t\t$line = fgets($fp, 4096);\n\t\t\t$content .= $line;\n\t\t}\n\t\tfclose($fp);\n\t\t\n\t\tswitch($type)\n\t\t{\n\t\t\tcase 'backup':\n\t\t\t\t$new_content = preg_replace('/NEXT_BACKUP_TIME=(.*)/','NEXT_BACKUP_TIME='.$time, $content);\n\t\t\t\tbreak;\n\t\t\tcase 'optimize':\n\t\t\t\t$new_content = preg_replace('/NEXT_BACKUP_TIME=(.*)/','NEXT_BACKUP_TIME='.$time, $content);\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t$fp = fopen($file, \"w\");\n\t\tfwrite($fp, $new_content);\n\t\tfclose($fp);\n\t\t\n/*\n!! DON'T DELETE OR REMOVE THIS FILE !!\n\t\t\nNEXT_BACKUP_TIME=N/A\n\t\t\nNEXT_OPTIMIZE_TIME=N/A\n*/\n\t\treturn TRUE;\n\t}", "public function write($file, $blocks) {\n\t\tif ( empty($blocks) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tob_start();\n\n\t\techo \"<article class='file'>\";\n\n\t\techo \"<h1>$file</h1>\\n\\n\";\n\n\t\tforeach ( (array) $blocks as $block ) {\n\t\t\t$hash = substr(md5($block->signature), 0, 5);\n\n\t\t\tif ( $block->type == 'class' ) {\n\t\t\t\techo \"<h2 id='class-$hash'><a href='#class-$hash'>#</a> Class: <code>$block->signature</code></h2>\\n\\n\";\n\n\t\t\t\techo \"<p>$block->description</p>\";\n\t\t\t}\n\n\t\t\tif ( $block->type == 'function' ) {\n\t\t\t\techo \"<section class='function' id='function-$hash'>\";\n\n\t\t\t\techo \"<h3><a href='#function-$hash'>#</a> Function: <code>$block->signature</code></h3>\\n\\n\";\n\n\t\t\t\tif ( !empty($block->description) ) {\n\t\t\t\t\techo \"<p>$block->description</p>\\n\\n\";\n\t\t\t\t}\n\n\t\t\t\tif ( count($block->arguments) ) {\n\t\t\t\t\techo \"<p class='args'>Accepts \" . count($block->arguments) . \" argument\" . ( count($block->arguments) != 1 ? \"s\" : \"\" ) . \":</p>\\n\\n\";\n\n\t\t\t\t\tforeach ( (array) $block->arguments as $argument ) {\n\t\t\t\t\t\tif ( empty($argument->variable) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\techo \"<dt><code>$argument->variable</code>\";\n\n\t\t\t\t\t\tif ( $argument->optional ) {\n\t\t\t\t\t\t\techo \"<span class='optional'>\";\n\t\t\t\t\t\t\tif ( !empty($argument->default) ) {\n\t\t\t\t\t\t\t\techo \" (Optional, default $argument->default)\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\techo \" (Optional)\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\techo \"</span>\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\techo \"</dt>\\n\";\n\n\t\t\t\t\t\techo \"<dd>\" . ucfirst($argument->description) . \"</dd>\\n\\n\";\n\t\t\t\t\t}\n\n\t\t\t\t\techo \"\\n\";\n\t\t\t\t} else {\n\t\t\t\t\techo \"<p class='args noargs'>Accepts no arguments.</p>\\n\\n\";\n\t\t\t\t}\n\n\t\t\t\tif ( !empty($block->returns) ) {\n\n\t\t\t\t\techo \"<p class='returns'>$block->returns</p>\\n\\n\";\n\t\t\t\t}\n\n\t\t\t\techo '</section>';\n\t\t\t}\n\t\t}\n\n\t\techo \"</article>\";\n\n\t\t$html = ob_get_clean();\n\t\tfile_put_contents($this->file, $html, FILE_APPEND);\n\t}", "public function write($file, $blocks) {\n\t\techo \"$file\\n\\n\";\n\n\t\tforeach ( (array) $blocks as $block ) {\n\t\t\tif ( $block->type == 'class' ) {\n\t\t\t\techo \"##\\n\\n\";\n\n\t\t\t\techo \"Class: \";\n\t\t\t\t$this->colour_echo($block->signature, 'yellow');\n\t\t\t\techo \"\\n\\n\";\n\t\t\t}\n\n\t\t\tif ( $block->type == 'function' ) {\n\t\t\t\techo \"\\tFunction: \";\n\t\t\t\t$this->colour_echo(\"$block->signature\\n\\n\", 'yellow');\n\n\t\t\t\tif ( !empty($block->description) ) {\n\t\t\t\t\t$block->description = wordwrap($block->description, $this->width - 8);\n\t\t\t\t\t$block->description = str_replace(\"\\n\", \"\\n\\t\\t\", $block->description);\n\n\t\t\t\t\techo \"\\t\\t$block->description\\n\\n\";\n\t\t\t\t}\n\n\t\t\t\tif ( count($block->arguments) ) {\n\t\t\t\t\techo \"\\t\\tAccepts \" . count($block->arguments) . \" arguments:\\n\\n\";\n\n\t\t\t\t\tforeach ( (array) $block->arguments as $argument ) {\n\t\t\t\t\t\tif ( empty($argument->variable) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\techo \"\\t\\t* \";\n\t\t\t\t\t\t$this->colour_echo($argument->variable, 'yellow');\n\n\t\t\t\t\t\tif ( $argument->optional ) {\n\t\t\t\t\t\t\tif ( !empty($argument->default) ) {\n\t\t\t\t\t\t\t\techo \" (Optional, default \";\n\t\t\t\t\t\t\t\t$this->colour_echo($argument->default, 'yellow');\n\t\t\t\t\t\t\t\techo \")\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\techo \" (Optional)\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\techo \"\\n\";\n\n\t\t\t\t\t\t$argument->description = wordwrap($argument->description, $this->width - 16);\n\t\t\t\t\t\t$argument->description = str_replace(\"\\n\", \"\\n\\t\\t\\t\", $argument->description);\n\n\t\t\t\t\t\techo \"\\t\\t\\t\" . ucfirst($argument->description) . \"\\n\\n\";\n\t\t\t\t\t}\n\n\t\t\t\t\techo \"\\n\";\n\t\t\t\t} else {\n\t\t\t\t\techo \"\\t\\tAccepts no arguments.\\n\\n\";\n\t\t\t\t}\n\n\t\t\t\tif ( !empty($block->returns) ) {\n\t\t\t\t\t$block->returns = wordwrap($block->returns, $this->width - 8);\n\t\t\t\t\t$block->returns = str_replace(\"\\n\", \"\\n\\t\\t\", $block->returns);\n\n\t\t\t\t\techo \"\\t\\t$block->returns\\n\\n\";\n\t\t\t\t}\n\n\t\t\t\techo \"\\t\\t--\\n\\n\";\n\t\t\t}\n\t\t}\n\t}", "public function writeQTime($timestamp)\n {\n if ($timestamp instanceof \\DateTime) {\n $msec = $timestamp->format('H') * 3600000 +\n $timestamp->format('i') * 60000 +\n $timestamp->format('s') * 1000 +\n (int)($timestamp->format('0.u') * 1000);\n } else {\n $msec = round(($timestamp - strtotime('midnight', (int)$timestamp)) * 1000);\n }\n\n $this->writeUInt($msec);\n }", "function addBlock($inode, $content)\n {\n\t$seq = $this->getSingleValue(\"SELECT COUNT(*) FROM \".$this->datablocksTable.\" WHERE inode = '\".$inode.\"'\");\n\n\t$query = \"INSERT INTO \".$this->datablocksTable.\" SET data = '\".addslashes($content).\"', inode = '\".$inode.\"', seq = '\".$seq.\"'\";\n\t$affected =& $this->dbLink->exec($query);\n\tif (PEAR::isError($affected)) { die($affected->getMessage()); }\t\n\n\t$query = \"UPDATE \".$this->datablocksTable.\" SET datalength = OCTET_LENGTH(data) WHERE inode = '\".$inode.\"' AND seq = '\".$seq.\"'\";\n\t$affected =& $this->dbLink->exec($query);\n\tif (PEAR::isError($affected)) { die($affected->getMessage()); }\t\n\n\t$size = $this->getSingleValue(\"SELECT SUM(datalength) FROM \".$this->datablocksTable.\" WHERE inode = '\".$inode.\"'\");\n\n\t$query = \"UPDATE \".$this->inodesTable.\" SET size = '\".$size.\"' WHERE inode = '\".$inode.\"'\";\n\t$affected =& $this->dbLink->exec($query);\n\tif (PEAR::isError($affected)) { die($affected->getMessage()); }\t\n }", "public function store(TimeIntervalRequest $request, TimeBlock $timeBlock)\n {\n $timeInterval = new TimeInterval();\n $timeInterval->fill($request->all());\n $timeBlock->time_intervals()->save($timeInterval);\n return response()->json($timeInterval, 201);\n }", "function savePrintTime($params){\r\n\t\t\r\n\t\tif( isset( $params['printTime'] ) ){\r\n\t\t\tini_set('date.timezone','Asia/Shanghai');\r\n\t\t\t$printTime = date('Y-m-d H:i:s');\r\n\t\t\t$params['printTime'] =$printTime ;\r\n\t\t}else if( isset( $params['inPrintTime'] ) ){\r\n\t\t\t//ini_set('date.timezone','Asia/Shanghai');\r\n\t\t\t//$printTime = date('Y-m-d H:i:s');\r\n\t\t\t//$params['inPrintTime'] =$printTime ;\r\n\t\t}\r\n\t\t\r\n\t\t$this->exeSql(\"update sc_purchase_product set id= '{@#purchaseProductId#}'{@, print_time = '#printTime#'}{@, in_print_time = '#inPrintTime#'} where id = '{@#purchaseProductId#}' \", \r\n\t\t\t\t$params ) ;\r\n\t}", "public function render_block( $block ) {\n\t\t\t$fields = get_fields();\n\n\t\t\t// Prepare parameters for template\n\t\t\t$params = array(\n\t\t\t\t'elements' => $fields['testimonial-elements'],\n\t\t\t);\n\n\t\t\t// Output template\n\t\t\t\\Timber::render( $this->template_file, $params );\n\t\t}", "public function save_dates(block_base $block, array $dates) {\n global $DB;\n\n // Set the dates in block's config and update the config field in DB.\n foreach ($this->get_settings($block) as $name => $setting) {\n $block->config->$name = $dates[$name];\n }\n\n $DB->set_field('block_instances', 'configdata', base64_encode(serialize($block->config)),\n array('id' => $block->instance->id));\n\n }", "private static function write($log_type, $message, $format = true, $time = false)\n\t{\n\t\t$config = Config::getInstance();\n\n\t\tif ($config->pickles['logging'] === true)\n\t\t{\n\t\t\t$log_path = LOG_PATH . date('Y/m/d/', ($time == false ? time() : $time));\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (!file_exists($log_path))\n\t\t\t\t{\n\t\t\t\t\tmkdir($log_path, 0755, true);\n\t\t\t\t}\n\n\t\t\t\t$log_file = $log_path . $log_type . '.log';\n\n\t\t\t\t$message .= \"\\n\";\n\n\t\t\t\tif ($format == true)\n\t\t\t\t{\n\t\t\t\t\t$backtrace = debug_backtrace();\n\t\t\t\t\trsort($backtrace);\n\t\t\t\t\t$frame = $backtrace[strpos($backtrace[0]['file'], 'index.php') === false ? 0 : 1];\n\n\t\t\t\t\treturn file_put_contents($log_file, date('H:i:s') . ' ' . str_replace(getcwd(), '', $frame['file']) . ':' . $frame['line'] . ' ' . $message, FILE_APPEND);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn file_put_contents($log_file, $message, FILE_APPEND);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ErrorException $exception)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "function smarty_block_timeperiod($params, $content, &$smarty, &$repeat)\n{\n if (!defined('SMARTY_TIMEPERIOD_NOW')) {\n // Allow override of current time for testing.\n if (!empty($_REQUEST['use_time'])) {\n define('SMARTY_TIMEPERIOD_NOW', strtotime($_REQUEST['use_time']));\n define('SMARTY_TIMEPERIOD_DEBUG', true);\n $smarty->trigger_error('Using test time for ' . __FUNCTION__ . ': ' . date('m/d/Y H:i:s', SMARTY_TIMEPERIOD_NOW), E_USER_NOTICE);\n } else {\n define('SMARTY_TIMEPERIOD_NOW', time());\n define('SMARTY_TIMEPERIOD_DEBUG', false);\n }\n }\n \n $start_time = false;\n $end_time = false;\n $now = SMARTY_TIMEPERIOD_NOW;\n $display = false;\n $comment = false;\n \n if (!isset($params['start']) && !isset($params['end'])) {\n $smarty->trigger_error(\"At least one parameter of 'start' or 'end' must be provided\");\n return;\n }\n \n // Make timestamps from parameters\n if (isset($params['start'])) {\n $start_time = strtotime($params['start']);\n if (!$start_time) {\n $smarty->trigger_error(\"Invalid value passed for parameter 'start': {$params['start']}\");\n return;\n }\n }\n if (isset($params['end'])) {\n $end_time = strtotime($params['end']);\n if (!$end_time) {\n $smarty->trigger_error(\"Invalid value passed for parameter 'end': {$params['end']}\");\n return;\n }\n }\n // Validate the timestamps\n if ($start_time && $end_time && $start_time > $end_time) {\n $smarty->trigger_error(\"'start' value may not exceed 'end' value\");\n return;\n }\n\n // Display content\n if (($start_time && $end_time) && ($now >= $start_time && $now <= $end_time)) {\n $display = 'a';\n } else if ($start_time && !$end_time && $now >= $start_time) {\n $display = 'b';\n } else if ($end_time && !$start_time && $now <= $end_time) {\n $display = 'c';\n \n } else if (SMARTY_TIMEPERIOD_DEBUG) {\n if ($start_time && $now < $start_time) {\n return '<!-- Content will be displayed in ' . smarty_block_timeperiod_diff($now, $start_time) . '. -->'; \n } else if ($end_time && $now > $end_time) {\n return '<!-- Content stopped displaying ' . smarty_block_timeperiod_diff($now, $end_time) . ' ago. -->'; \n }\n }\n \n if ($display) {\n return $content;\n } else {\n // Prevent calling of this function for end block tag if timestamps\n // are not satisfied.\n $repeat = false;\n }\n}", "public function out($block = 'MAIN')\n\t{\n\t\tif (self::$debug_mode && self::$debug_output)\n\t\t{\n\t\t\t// Print debug stuff for current file\n\t\t\t$file = basename($this->filename);\n\t\t\techo \"<h1>$file</h1>\";\n\t\t\tforeach (self::$debug_data[$file] as $block => $tags) {\n\t\t\t\t$block_name = $file . ' / ' . str_replace('.', ' / ', $block);\n\t\t\t\techo \"<h2>$block_name</h2>\";\n\t\t\t\techo \"<ul>\";\n\t\t\t\tforeach ($tags as $key => $val)\n\t\t\t\t{\n\t\t\t\t\tif (is_array($val))\n\t\t\t\t\t{\n\t\t\t\t\t\t// One level of nesting is supported\n\t\t\t\t\t\tforeach ($val as $key2 => $val2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo self::debugVar($key . '.' . $key2, $val2);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\techo self::debugVar($key, $val);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\techo \"</ul>\";\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo $this->text($block);\n\t\t}\n\t\treturn $this;\n\t}", "private function processMessages($messages, $block_time)\n {\n // Inserts Before Updates\n usort($messages, function ($message1, $message2) {\n return $message1['command'] <=> $message2['command'];\n });\n\n foreach($messages as $message)\n {\n // Get Bindings\n $bindings = $this->getBindings($message, $block_time);\n\n // Save Message\n if(\\App\\Message::firstOrCreateMessage($message, $bindings))\n {\n if($message['command'] === 'insert')\n {\n $this->createModel($message, $bindings);\n }\n elseif($message['command'] === 'update')\n {\n $this->updateModel($message, $bindings);\n }\n elseif($message['command'] === 'reorg')\n {\n $this->handleReorg($message, $bindings);\n }\n }\n }\n }", "public static function format($format, $time) {\n\t\t// Is this a unix timestamp or a MySQL datetime?\n\t\tif (strpos($time, ':') !== false) {\n\t\t\t// Seems to be a MySQL datetime\n\t\t\t// Convert to a unix timestamp\n\t\t\t$time = Core_Date::datetimeToTimestamp($time);\n\t\t}\n\n\t\t// And return\n\t\treturn date($format, $time);\n\t}", "function make_sidebar($side)\n{\n global $xoopsUser;\n $xoopsblock = new XoopsBlock();\n if ('left' == $side) {\n $side = XOOPS_SIDEBLOCK_LEFT;\n } elseif ('right' == $side) {\n $side = XOOPS_SIDEBLOCK_RIGHT;\n } else {\n $side = XOOPS_SIDEBLOCK_BOTH;\n }\n if (is_object($xoopsUser)) {\n $block_arr =& $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, $side, XOOPS_BLOCK_VISIBLE);\n } else {\n $block_arr =& $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, $side, XOOPS_BLOCK_VISIBLE);\n }\n\n if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {\n include_once XOOPS_ROOT_PATH.'/class/template.php';\n $xoopsTpl = new XoopsTpl();\n } else {\n $xoopsTpl =& $GLOBALS['xoopsTpl'];\n }\n $xoopsLogger =& XoopsLogger::instance();\n foreach ($block_arr as $iValue) {\n $bcachetime = (int)$iValue->getVar('bcachetime');\n if (empty($bcachetime)) {\n $xoopsTpl->xoops_setCaching(0);\n } else {\n $xoopsTpl->xoops_setCaching(2);\n $xoopsTpl->xoops_setCacheTime($bcachetime);\n }\n $btpl = $iValue->getVar('template');\n if ('' !== $btpl) {\n if (empty($bcachetime) || !$xoopsTpl->is_cached('db:'.$btpl)) {\n $xoopsLogger->addBlock($iValue->getVar('name'));\n $bresult =& $iValue->buildBlock();\n if (!$bresult) {\n continue;\n }\n $xoopsTpl->assign_by_ref('block', $bresult);\n $bcontent =& $xoopsTpl->fetch('db:'.$btpl);\n $xoopsTpl->clear_assign('block');\n } else {\n $xoopsLogger->addBlock($iValue->getVar('name'), true, $bcachetime);\n $bcontent =& $xoopsTpl->fetch('db:'.$btpl);\n }\n } else {\n $bid = $iValue->getVar('bid');\n if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_'.$bid)) {\n $xoopsLogger->addBlock($iValue->getVar('name'));\n $bresult =& $iValue->buildBlock();\n if (!$bresult) {\n continue;\n }\n $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);\n $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_'.$bid);\n $xoopsTpl->clear_assign('block');\n } else {\n $xoopsLogger->addBlock($iValue->getVar('name'), true, $bcachetime);\n $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_'.$bid);\n }\n }\n switch ($iValue->getVar('side')) {\n case XOOPS_SIDEBLOCK_LEFT:\n themesidebox($iValue->getVar('title'), $bcontent);\n break;\n case XOOPS_SIDEBLOCK_RIGHT:\n if (function_exists('themesidebox_right')) {\n themesidebox_right($iValue->getVar('title'), $bcontent);\n } else {\n themesidebox($iValue->getVar('title'), $bcontent);\n }\n break;\n }\n unset($bcontent);\n }\n}", "public function setPageBlock($pageId, $blockInfo)\n {\n global $My_Sql;\n global $My_Kernel;\n // var_dump(__LINE__, $pageId, $blockInfo);\n\n $My_Block = $My_Kernel->getClass('block', $this->_db);\n // add new blocks into page\n if(isset($blockInfo['block'], $blockInfo['position'])) {\n /*\n * First, check if the block with the position is already existing in this page.\n * if exists, and page is excluded to show by this block, remove data from excluding pages;\n * if the block only excludes this page, reset block show type in every page.\n */\n $blocks = $My_Block->getPageBlocks($pageId);\n // var_dump(__LINE__, $blocks);\n foreach($blocks as $block) {\n $positionKey = array_search($block['position_id'], $blockInfo['position']);\n $blockKey = array_search($block['block_id'], $blockInfo['block']);\n $isExcludePage = MY_EXCLUDE_PAGE==$block['show_in_type'];\n if($blockKey===$positionKey && false!==$blockKey && $isExcludePage) {\n $pages = $My_Block->getExcludePageByBlockId($block['block_id']);\n // var_dump(__LINE__, $pages);\n $pagesCount = count($pages);\n foreach($pages as $page) {\n if($page['page_id']==$pageId) {\n $My_Block->removeBlockPage($page['using_page_id']);\n $pagesCount--;\n }\n }\n /* the existing block only excludes this page,\n * reset the block is shown in every page\n */\n if($pagesCount==0){\n $My_Block->setUsingBlock($block['using_block_id'], array('showInType'=> MY_ALL_PAGE));\n unset($blockInfo['block'][$blockKey]);\n unset($blockInfo['position'][$blockKey]);\n }\n }\n }\n /*\n * add new using block\n */\n // var_dump(__LINE__, $blockInfo['block']);\n foreach($blockInfo['block'] as $key=>$blockId) {\n if(!isset($blockInfo['position'][$key])) {\n continue;\n }\n $blockName = isset($blockInfo['name'][$key]) ? $blockInfo['name'][$key] : '';\n $visibleBlock = array('position_id' => $blockInfo['position'][$key],\n 'block_id' => $blockId,\n 'page_id' => $pageId,\n 'block_name' => $blockName,\n 'show_in_type'=> MY_INCLUDE_PAGE\n );\n // var_dump(__LINE__, $visibleBlock);\n $usingBlockId = $My_Block->addVisibleBlock($visibleBlock);;\n // var_dump(__LINE__, $usingBlockId);\n }\n }\n\n if (isset($blockInfo['remove'])) {\n $blocks = $My_Block->getUsingBlockByIds($blockInfo['remove']);\n // var_dump(__LINE__, $blocks);\n $_tmpBlocks = array();\n foreach($blocks as $block) {\n $_tmpBlocks[$block['using_block_id']] = $block;\n }\n // var_dump(__LINE__, $blockInfo['remove']);\n foreach($blockInfo['remove'] as $key=>$usingBlockId) {\n if(isset($_tmpBlocks[$usingBlockId])) {\n switch($_tmpBlocks[$usingBlockId]['show_in_type']) {\n case MY_ALL_PAGE:\n $My_Block->setUsingBlock($block['using_block_id'], array('showInType', MY_EXCLUDE_PAGE));\n case MY_EXCLUDE_PAGE:// add this page into exclude page list\n $My_Block->addBlockPage($usingBlockId, $pageId);\n break;\n\n case MY_INCLUDE_PAGE: // check if page id in the include page list, if yes, remove it\n if(!empty($blockInfo['removePage'][$key])) {\n $My_Block->removeBlockPage($blockInfo['removePage'][$key]);\n }\n if(count($My_Block->getIncludePageByUsingBlockId($usingBlockId))==0){\n $My_Block->removeUsingBlock($usingBlockId);\n }\n break;\n\n default:\n break;\n }\n }\n }\n }\n }", "function sqlBlockVar($iatId, $block) {\n if (!(is_int($block) && is_int($iatId)))\n return \"ARG_ERROR\";\n $correctTrials = sqlCorrectTrials($iatId, $block);\n $adjustedTrials = sqlAdjustedTrials($iatId, $block);\n return \"(SELECT Var_samp(response_time) FROM ($correctTrials UNION ALL $adjustedTrials) AS all_adjusted_trials)\";\n}", "public function blockTemporarily(DateTimeImmutable $blockDateTime): void;", "function write_hour ($tHour)\n{\n $hour_start = strftime ('%H:%M', $tHour);\n $hour_end = strftime ('%H:%M', $tHour + (60 * 60));\n $txt = $hour_start . '<BR>--<BR>' . $hour_end;\n write_cell ('TH', $txt);\n}", "private function swami_register_blocktype($block_name, $option = array())\n {\n /**\n * Registra il blocco in Gutenberg\n */\n register_block_type(\n \"swami-gutenbeg-block/$block_name\",\n array_merge(\n array(\n \"editor_script\" => \"swami_block_script_editor\",\n // 'script'\n 'style' => \"swami_block_style\",\n // 'editor_style'\n ),\n $option\n )\n );\n }", "public function register_block() {\r\n\r\n\t\twp_register_style(\r\n\t\t\t'sbi-blocks-styles',\r\n\t\t\ttrailingslashit( SBI_PLUGIN_URL ) . 'css/sb-blocks.css',\r\n\t\t\tarray( 'wp-edit-blocks' ),\r\n\t\t\tSBIVER\r\n\t\t);\r\n\r\n\t\t$attributes = array(\r\n\t\t\t'shortcodeSettings' => array(\r\n\t\t\t\t'type' => 'string',\r\n\t\t\t),\r\n\t\t\t'noNewChanges' => array(\r\n\t\t\t\t'type' => 'boolean',\r\n\t\t\t)\r\n\t\t);\r\n\r\n\t\tregister_block_type(\r\n\t\t\t'sbi/sbi-feed-block',\r\n\t\t\tarray(\r\n\t\t\t\t'attributes' => $attributes,\r\n\t\t\t\t'render_callback' => array( $this, 'get_feed_html' ),\r\n\t\t\t)\r\n\t\t);\r\n\t}", "public static function setTimeFormat($format) {\n $this->timeFormat = $format;\n }", "private static function delete($blockID = NULL) {\r\n\t\tif (is_null($blockID))\r\n\t\t\t$blockID = $_SESSION['resourceID'];\r\n\t\tif (!isset($blockID))\r\n\t\t\treturn self::jsonError('Cannot delete weekly time block: missing blockID');\r\n\t\tif (!is_numeric($blockID))\r\n\t\t\treturn self::jsonError('Cannot delete weekly time block: blockID is not a valid number');\r\n\r\n\t\t$success = WeeklyTimeBlocksDB::delete($blockID);\r\n\t\tif (!$success)\r\n\t\t\treturn self::jsonError('An error occurred while attempting to delete weekly time block');\r\n\r\n\t\treturn self::jsonResponse(true);\r\n\t}", "public function output_times($timebegin) {\n global $PAGE;\n\n $link = clone($PAGE->url);\n\n // The current range of time we're looking at.\n $rangebegin = local_mediaserver_time_round($timebegin);\n $range = range($rangebegin, $rangebegin + (HOURSECS * 3), HOURSECS);\n\n // Loop through each hour, starting from beginning of day.\n $hourbegin = local_mediaserver_time_round($rangebegin, true);\n for ($hour = 0; $hour < 24; $hour++, $hourbegin += HOURSECS) {\n $link->param('t', $hourbegin);\n\n $hourlabel = local_mediaserver_local_time($hourbegin, '%H');\n $class = (in_array($hourbegin, $range) ? 'hour-selected' : '');\n\n $list[] = html_writer::link($link, $hourlabel, array('class' => $class));\n }\n\n return html_writer::alist($list, array('class' => 'small-text guide-row guide-time'));\n }", "public function scheduler_meta_data( $output, $block, $global ) {\n\n\t\t\t$scheduler_enabled = ! empty( $block['visibility']['scheduler']['enable'] ) ? true : false;\n\t\t\t$clock = '';\n\t\t\t$separator = $global ? ' &nbsp;–&nbsp; ' : ' &nbsp;&middot&nbsp; ';\n\n\t\t\tif ( $scheduler_enabled ) {\n\n\t\t\t\t$current_time = current_time( 'timestamp' );\n\t\t\t\t$begin \t\t = strtotime( esc_attr( $block['visibility']['scheduler']['begin'] ) );\n\t\t\t\t$end \t \t = strtotime( esc_attr( $block['visibility']['scheduler']['end'] ) );\n\n\t\t\t\t$begin_text = empty( $block['visibility']['scheduler']['begin'] ) ? 'Now' : $block['visibility']['scheduler']['begin'];\n\t\t\t\t$end_text = empty( $block['visibility']['scheduler']['end'] ) ? 'Never' : $block['visibility']['scheduler']['end'];\n\n\t\t\t\tif ( ( '' != $begin && $begin > $current_time ) || ( '' != $end && $end < $current_time ) ) {\n\t\t\t\t\t// The block should NOT currently being shown\n\t\t\t\t\t$clock = $separator . '<span class=\"dashicons dashicons-clock\" style=\"color:#a00;cursor:help\" title=\"Begin: ' . $begin_text . ' End: ' . $end_text . '\"></span>';\n\t\t\t\t} else {\n\t\t\t\t\t$clock = $separator . '<span class=\"dashicons dashicons-clock\" style=\"cursor:help\" title=\"Begin: ' . $begin_text . ' End: ' . $end_text . '\"></span>';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$output = $output . $clock;\n\n\t\t\treturn $output;\n\t\t}", "public function time(string $format = ''): string\n\t{\n\t\t$format = $format ?: (string) get_option('time_format');\n\t\t$time = mysql2date($format, $this->comment->comment_date);\n\n\t\treturn Hook::apply('get_comment_time', $time, $format, false, true, $this->comment);\n\t}", "public function addBlock($block_name, $template_class, &$config, $id='') {\n if (!$template_class) $template_class = 'FrxTable';\n $block_name = str_replace('.', '/', $block_name);\n if ($id) {\n $path = \"body//*[@id='$id']\";\n $nodes = $this->simplexml->xpath($path);\n if ($nodes) {\n $pnode = dom_import_simplexml($nodes[0]);\n $node = $this->dom->createElement('div');\n $pnode->appendChild($node);\n }\n else {\n drupal_set_message(t('Could not find %s in report', array('%s' => $id)), 'error');\n return;\n }\n }\n else {\n $nodes = $this->dom->getElementsByTagName('body');\n $pnode = $nodes->item(0);\n $node = $this->dom->createElement('div');\n $pnode->appendChild($node);\n }\n $this->frxReport->setReport($this->dom, $this->xpq, $this->edit);\n $config['block'] = $block_name;\n $b = Frx::BlockEditor($block_name, $this->frxReport->block_edit_mode);\n $data= $b->data($this->parms);\n $this->addParameters($b->tokens());\n $c = Frx::Template($template_class);\n if ($c) {\n $c->initReportNode($node, $this->frxReport);\n $c->generate($data, $config);\n }\n else {\n drupal_set_message(t('Could not find template %s', array('%s' => $template_class)), 'error');\n }\n return $this;\n }", "public function update_Schd_Time($table='',$time='',$where='',$column=''){\n\t\t\n\t\tif($time==\"maxtime\")\n\t\t\t$subquery=\"time2=(select max(\".$column.\") from \".$table.\")\";\n\t\telse\n\t\t\t$subquery=\"time1=time2\";\n\t\t\t\t\n\t\t$query_String=\"update gpi_schedule_timestamp set \".$subquery.\" where tablename='\".$where.\"' \";\n\t\t\n\t\t$ret=self::_Exe_Query($table,\"updatescheduletime|| $time -> $table\",$query_String);\t\n\t\t\n\t}" ]
[ "0.62990195", "0.5592257", "0.5164952", "0.5116467", "0.50165117", "0.49616307", "0.47833773", "0.47689486", "0.47068554", "0.46805257", "0.45800886", "0.45644298", "0.45479497", "0.45098174", "0.44964343", "0.44834307", "0.44727498", "0.44720381", "0.4469507", "0.44551378", "0.4447155", "0.4441217", "0.44340295", "0.44291368", "0.44251764", "0.4397182", "0.43881938", "0.4372561", "0.4351783", "0.43447992" ]
0.8051019
0
/ write_cell Helper function to write a table cell with an optional attribute
function write_cell ($type, $text, $attribute='') { printf (" <%s %s>%s</%s>\n", $type, $attribute, $text, $type); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Htmls_Table_Cell($cell,$options=array(),$tdtag=\"TD\")\n {\n if (is_array($cell) && isset($cell[ \"Text\" ]))\n {\n if (!empty($cell[ \"Options\" ]))\n {\n foreach ($cell[ \"Options\" ] as $key => $value)\n {\n $options[ $key ]=$value;\n }\n }\n\n if (!empty($cell[ \"Class\" ]))\n {\n $this->Html_CSS_Add($cell[ \"Class\" ],$options);\n }\n\n $cell=$cell[ \"Text\" ];\n }\n\n return $this->Htmls_Tag($tdtag,$cell,$options);\n }", "protected function generateCell() {\n return \"\";\n }", "function SetCellAttribute($row, $col, $attribute, $value) {\n $this->table[$row][$col][$attribute] = $value;\n }", "function cellToCell(){\n return \t'</td><td>';\n\n}", "function areaWriteHTMLCell($pdf,$area,$text,$border=0, $ln=0, $fill=false, $reseth=true, $align='', $autopad=false)\n{\n// $pdf->setCellMargins(0,0,0,0);\n\n return($pdf->writeHTMLCell(\n\t\t $area[\"w\"],$area[\"h\"],$area[\"x\"],$area[\"y\"],\n\t\t $text,\n\t\t $border, $ln, $fill, $reseth, $align, $autopad));\n}", "public function outputCell($value = null)\n {\n return $this->outputInput($value);\n }", "function writeCell($conn,$table,$date,$period) {\n // checks if available\n $name = checkAvailable($conn,$table,$date,$period);\n // if something is returned, then it is booked\n if ($name) {\n echo \"<td class='booked'><b>\".$name.\"</b></td>\";\n } else {\n // check if the date is in the past\n if (checkIfInThePast($date)) {\n //if in the past, write a cell\n echo \"<td class='past'></td>\";\n } else {\n // checks if user is read only or not\n if(!readOnly($conn)) {\n if(canBookVehicles($conn)) {\n // else write a form containing a button to POST\n echo \"<form method='POST' action=''>\";\n echo \"<td class='available'><button type='submit' id='selectstartdate' name='book'\";\n //echo \"onclick=\\\"return confirm('\" . writeDialog(\"Minibus YHJ\",$date,$period) . \"');\\\"\";\n echo \"value='\".$date.\",\".$period.\"'>Select</button></td>\";\n echo \"</form>\";\n } else {\n // if can't book vehicles, does not write book button\n echo \"<td class='available'></td>\";\n }\n } else {\n // if read-only, does not write book button\n echo \"<td class='available'></td>\";\n } // else\n } // else\n } // else\n }", "function SetCellAttributes($row, $col, $array) {\n if (is_array($array)) {\n foreach ($array as $attribute => $value) {\n $this->table[$row][$col][$attribute] = $value;\n }\n }\n }", "function format_table_cell($val,$data,&$align,&$comment,&$class) {\n\t$dval = array_key_exists($val,$data) ? str_replace(\"\\r\",\"\",$data[$val]) : \"\";\n\tif ((!empty($dval)) and (preg_match(\"/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/\", $dval, $regs))) {\n\t\t$output = date(\"d M Y\",strtotime($dval)); /* DD Mmm YYYY */\n\t\t$comment = substr($dval,11,10);\n\t} else if ((!empty($dval)) and (preg_match(\"/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{3})Z/\", $dval, $regs))) {\n\t\t$output = sprintf(\"%s/%s %s:%s\",$regs[3],$regs[2],$regs[4],$regs[5],$regs[6]);\n\t} else if ((!empty($dval)) and (preg_match(\"/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/\", $dval, $regs))) {\n\t if (date(\"Y-m-d\") == substr($dval,0,10)) {\n\t\t// Date Field (Today)\n \t\t$output = substr($dval,11,10);\n\t } else {\n\t\t// Date Field (Not Today)\n\t\tswitch ($val) {\n\t\t\tcase \"EventTime\":\n\t\t\tcase \"Updated\":\n\t\t\tcase \"allocated\":\n\t\t\tcase \"AcctStartTime\":\n\t\t\t\t$output = sprintf(\"%s/%s %s:%s\",$regs[3],$regs[2],$regs[4],$regs[5],$regs[6]);\n\t\t\t\tbreak;\n\t\t\tcase \"released\":\n\t\t\tcase \"AcctStopTime\":\n\t\t\t\t$output = substr($dval,11,5);\n\t\t\t\tbreak;\n \t\t\tdefault: \n\t\t\t\t// $output = substr($dval,0,10); /* YYYY-MM-DD */\n\t\t\t\t$output = date(\"d M Y\",strtotime($dval)); /* DD Mmm YYYY */\n\t\t\t\t$comment = substr($dval,11,10);\n\t\t}\n\t }\n\t $this->total[$val]=0;\n\t} else if ((!empty($dval)) and (preg_match(\"/([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}/\",$dval, $regs))) {\n\t\t// IPv4 Address\n\t\t$align=\"center\";\n\t\t$output = $dval;\n\t} else if ((isset($dval)) and ($dval<>\".\") and ($dval<>\",\") and (preg_match(\"/(^[$|-]*[0-9|,|.]+$)/\",$dval, $regs))) {\n\t\t// Numeric Field\n\t\tif (!isset($this->total[$val])) $this->total[$val]=0;\n\t\t$number = str_replace(\",\",\"\",str_replace(\"$\",\"\",$dval));\n\t\t$this->total[$val] += $number;\n\t\tswitch ($val) {\n\t\t\tcase \"AcctSessionTime\":\n\t\t\t\t$align = \"right\";\n\t\t\t\t$output=TimeStr($dval);\n\t\t\t\tbreak;\n\t\t\tcase \"AcctOutputOctets\":\n\t\t\tcase \"AcctInputOctets\":\n\t\t\t\t$output=ByteStr($dval);\n\t\t\t\tbreak;\n \t\t\tdefault: \n\t\t\t\t$align=\"right\";\n\t\t\t\tif (array_key_exists($val,$this->format)) {\n\t\t\t\t\tif ($fmat=$this->format[$val]) $output = money_fmat($fmat,$number);\n\t\t\t\t\telse $output=$dval;\n\t\t\t\t} else {\t\n\t\t\t\t\tif (strpos($number,\".\")) $output = number_format($number,2);\n\t\t\t\t\telse switch($val) {\n\t\t\t\t\t\tcase \"MerchantID\":\n\t\t\t\t\t\tcase \"Mobile\":\n\t\t\t\t\t\tcase \"WorkPhone\":\n\t\t\t\t\t\tcase \"HomePhone\":\n\t\t\t\t\t\tcase \"Fax\":\n\t\t\t\t\t\tcase \"PostCode\":\t// don't format these columns\n\t\t\t\t\t\t\t$output=$dval;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$output = number_format(floatval($number));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$vval = \" $val\";\n\t\t\t\tif (strpos($vval,\"time\") or strpos($vval,\"date\")) $comment = @date(\"Y-m-d H:i:s\",$number);\n\t\t}\n\t} else { \n\t\t// Normal Field\n\t\t$output = $dval;\n\t}\n\n\t$output = str_replace(\"(TEST TRANSACTION ONLY)\",\"<b>(TEST)</b>\",$output);\n\n\treturn $output;\n }", "function printCell_universal($pdfObj,$doc,$x,$y,$width=0,$height=0,$text=\"\",$params_additional=null,$multi_cell=null,$font_color=null) {\r\n\r\n\tif($params_additional and is_array($params_additional)) {\r\n\r\n\t\tif(isset($params_additional[\"pdfObj\"])) unset($params_additional[\"pdfObj\"]);\r\n\t\tif(isset($params_additional[\"doc\"])) unset($params_additional[\"doc\"]);\r\n\t\tif(isset($params_additional[\"x\"])) unset($params_additional[\"x\"]);\r\n\t\tif(isset($params_additional[\"y\"])) unset($params_additional[\"y\"]);\r\n\r\n\t\textract($params_additional);\r\n\r\n\t}\r\n\t\r\n\tif($x==\"current\") $x=$pdfObj->GetX();\r\n\tif($y==\"current\") $y=$pdfObj->GetY();\r\n\tif(!isset($multi_cell) or $multi_cell===null) $multi_cell=false;\r\n\tif(!isset($font_style)) $font_style=\"\";\r\n\tif(!isset($font_size)) $font_size=$doc[\"config\"][\"font_size\"];\r\n\tif(!isset($ln)) $ln=0;\r\n\tif(!isset($align)) $align=\"L\";\r\n\tif(!isset($stretch)) $stretch=0;\r\n\t$height_max=( (!empty($height_max) and $height_max>$height) ? $height_max : 0 );\r\n\tif(!isset($font_color) or $font_color===null) $font_color=array(0,0,0); // rgb format\r\n\t\r\n\tif(!empty($text_uppercase)) $text=mb_strtoupper($text,\"UTF-8\");\r\n\tif(!empty($text_lowercase)) $text=mb_strtolower($text,\"UTF-8\");\r\n\tif(!empty($text_ucfirst)) $text=ucfirst($text);\r\n\tif(!empty($text_ucwords)) $text=ucwords($text);\r\n\r\n\t$pdfObj->setXY($x,$y);\r\n\t$pdfObj->setFont($doc[\"config\"][\"font\"],$font_style,$font_size);\r\n\t$pdfObj->SetTextColor($font_color[0],$font_color[1],$font_color[2]);\r\n\r\n\tif($width==\"auto\") $width=$pdfObj->GetStringWidth($text)+2; // \"+2\" is cuz it seems cells have an \"internal\" 2 padding left\r\n\r\n\tif(!$multi_cell)\r\n\t$pdfObj->Cell($width,$height,$text,$doc[\"config\"][\"cell_border\"],$ln,$align,$doc[\"config\"][\"cell_fill\"],\"\",$stretch);\r\n\telse\r\n\t$pdfObj->MultiCell($width,$height,$text,$doc[\"config\"][\"cell_border\"],$align,$doc[\"config\"][\"cell_fill\"],$ln,null,null,true,$stretch,false,false,$height_max);\r\n\r\n\t// restore defaults\r\n\r\n\t$pdfObj->SetTextColor($doc[\"config\"][\"secondary_color\"][0],$doc[\"config\"][\"secondary_color\"][1],$doc[\"config\"][\"secondary_color\"][2]);\r\n\t$pdfObj->setFont($doc[\"config\"][\"font\"],$font_style,$doc[\"config\"][\"font_size\"]);\r\n\r\n}", "function render_cell($column, $item)\r\n {\r\n if ($name = $column->get_name())\r\n {\r\n switch ($name)\r\n {\r\n case Item :: PROPERTY_ID :\r\n return $item->get_id();\r\n case Item :: PROPERTY_NAME :\r\n return $item->get_name();\r\n case Item :: PROPERTY_DESCRIPTION :\r\n $description = strip_tags($item->get_description());\r\n if (strlen($description) > 175)\r\n {\r\n $description = mb_substr($description, 0, 170) . '&hellip;';\r\n }\r\n return '<div style=\"word-wrap: break-word; max-width: 250px;\" >' . $description . '</div>';\r\n case Item :: PROPERTY_RESPONSIBLE :\r\n //$user = UserDataManager :: get_instance()->retrieve_user($item->get_responsible());\r\n //return $user->get_fullname();\r\n return $item->get_responsible();\r\n case Item :: PROPERTY_CREDITS :\r\n return $item->get_credits() . ' ' . Translation :: get('PerHour');\r\n }\r\n }\r\n\r\n $title = $column->get_title();\r\n if ($title == '')\r\n {\r\n $img = Theme :: get_common_image_path() . 'treemenu_types/document.png';\r\n return '<img src=\"' . $img . '\"alt=\"' . Utilities :: get_classname_from_object($item, true) . '\" />';\r\n }\r\n\r\n return '&nbsp;';\r\n }", "private function writeCellMerge(XMLWriter $objWriter, Cell $cell): void\n {\n if (!$cell->isMergeRangeValueCell()) {\n return;\n }\n\n $mergeRange = Coordinate::splitRange((string) $cell->getMergeRange());\n [$startCell, $endCell] = $mergeRange[0];\n $start = Coordinate::coordinateFromString($startCell);\n $end = Coordinate::coordinateFromString($endCell);\n $columnSpan = Coordinate::columnIndexFromString($end[0]) - Coordinate::columnIndexFromString($start[0]) + 1;\n $rowSpan = ((int) $end[1]) - ((int) $start[1]) + 1;\n\n $objWriter->writeAttribute('table:number-columns-spanned', (string) $columnSpan);\n $objWriter->writeAttribute('table:number-rows-spanned', (string) $rowSpan);\n }", "private function writeCells(XMLWriter $objWriter, RowCellIterator $cells): void\n {\n $numberColsRepeated = self::NUMBER_COLS_REPEATED_MAX;\n $prevColumn = -1;\n foreach ($cells as $cell) {\n /** @var \\PhpOffice\\PhpSpreadsheet\\Cell\\Cell $cell */\n $column = Coordinate::columnIndexFromString($cell->getColumn()) - 1;\n\n $this->writeCellSpan($objWriter, $column, $prevColumn);\n $objWriter->startElement('table:table-cell');\n $this->writeCellMerge($objWriter, $cell);\n\n // Style XF\n $style = $cell->getXfIndex();\n if ($style !== null) {\n $objWriter->writeAttribute('table:style-name', Style::CELL_STYLE_PREFIX . $style);\n }\n\n switch ($cell->getDataType()) {\n case DataType::TYPE_BOOL:\n $objWriter->writeAttribute('office:value-type', 'boolean');\n $objWriter->writeAttribute('office:value', $cell->getValue());\n $objWriter->writeElement('text:p', $cell->getValue());\n\n break;\n case DataType::TYPE_ERROR:\n $objWriter->writeAttribute('table:formula', 'of:=#NULL!');\n $objWriter->writeAttribute('office:value-type', 'string');\n $objWriter->writeAttribute('office:string-value', '');\n $objWriter->writeElement('text:p', '#NULL!');\n\n break;\n case DataType::TYPE_FORMULA:\n $formulaValue = $cell->getValue();\n if ($this->getParentWriter()->getPreCalculateFormulas()) {\n try {\n $formulaValue = $cell->getCalculatedValue();\n } catch (Exception $e) {\n // don't do anything\n }\n }\n $objWriter->writeAttribute('table:formula', $this->formulaConvertor->convertFormula($cell->getValue()));\n if (is_numeric($formulaValue)) {\n $objWriter->writeAttribute('office:value-type', 'float');\n } else {\n $objWriter->writeAttribute('office:value-type', 'string');\n }\n $objWriter->writeAttribute('office:value', $formulaValue);\n $objWriter->writeElement('text:p', $formulaValue);\n\n break;\n case DataType::TYPE_NUMERIC:\n $objWriter->writeAttribute('office:value-type', 'float');\n $objWriter->writeAttribute('office:value', $cell->getValue());\n $objWriter->writeElement('text:p', $cell->getValue());\n\n break;\n case DataType::TYPE_INLINE:\n // break intentionally omitted\n case DataType::TYPE_STRING:\n $objWriter->writeAttribute('office:value-type', 'string');\n $url = $cell->getHyperlink()->getUrl();\n if (empty($url)) {\n $objWriter->writeElement('text:p', $cell->getValue());\n } else {\n $objWriter->startElement('text:p');\n $objWriter->startElement('text:a');\n $sheets = 'sheet://';\n $lensheets = strlen($sheets);\n if (substr($url, 0, $lensheets) === $sheets) {\n $url = '#' . substr($url, $lensheets);\n }\n $objWriter->writeAttribute('xlink:href', $url);\n $objWriter->writeAttribute('xlink:type', 'simple');\n $objWriter->text($cell->getValue());\n $objWriter->endElement(); // text:a\n $objWriter->endElement(); // text:p\n }\n\n break;\n }\n Comment::write($objWriter, $cell);\n $objWriter->endElement();\n $prevColumn = $column;\n }\n\n $numberColsRepeated = $numberColsRepeated - $prevColumn - 1;\n if ($numberColsRepeated > 0) {\n if ($numberColsRepeated > 1) {\n $objWriter->startElement('table:table-cell');\n $objWriter->writeAttribute('table:number-columns-repeated', (string) $numberColsRepeated);\n $objWriter->endElement();\n } else {\n $objWriter->writeElement('table:table-cell');\n }\n }\n }", "function render_cell($column, $webconference)\r\n {\r\n switch ($column->get_name())\r\n {\r\n case Webconference :: PROPERTY_ID :\r\n return $webconference->get_id();\r\n case Webconference :: PROPERTY_CONFNAME :\r\n return $webconference->get_confname();\r\n case Webconference :: PROPERTY_DESCRIPTION :\r\n return $webconference->get_description();\r\n case Webconference :: PROPERTY_DURATION :\r\n return $webconference->get_duration();\r\n default :\r\n return '&nbsp;';\r\n }\r\n }", "public function outputCell($value = null)\n {\n return Cuztom::view('fields/cell/'.$this->view, [\n 'tabs' => $this,\n 'value' => $value,\n ]);\n }", "function add_column($cell_element=NULL)\r\n {\r\n if (is_object($cell_element))\r\n {\r\n if (($cell_element->get_elementtype() != HAW_PLAINTEXT) &&\r\n ($cell_element->get_elementtype() != HAW_IMAGE) &&\r\n ($cell_element->get_elementtype() != HAW_LINK))\r\n die(\"invalid argument in add_column()\");\r\n }\r\n elseif (is_array($cell_element))\r\n {\r\n foreach ($cell_element as $an_element)\r\n {\r\n if (($an_element->get_elementtype() != HAW_PLAINTEXT) &&\r\n ($an_element->get_elementtype() != HAW_IMAGE) &&\r\n ($an_element->get_elementtype() != HAW_LINK))\r\n die(\"invalid argument in add_column() array\");\r\n }\r\n }\r\n\r\n $this->column[$this->number_of_columns] = $cell_element;\r\n $this->number_of_columns++;\r\n }", "private static function closeCell() {\n echo \"</td>\";\n }", "function table_checkbox_cell($row, $row_key, $data, $class=\"\") \n {\n if ($this->check)\n {\n printf(\" <td%s nowrap><input type=\\\"checkbox\\\" name=\\\"%s[%s]\\\" value=\\\"%s\\\"></td>\\n\",\n $class?\" class=$class\":\"\",\n $this->check,\n $row,\n empty($data[$this->check])?$row_key:$data[$this->check]);\n }\n }", "public function cell($value) {\n return $this->setProperty('cell', $value);\n }", "function write_td($data, $class){\n\t\t\t$formatted = \"<td class=\" . $class . \">\" . $data .\"</td>\";\n\t\t\treturn $formatted;\n\t\t}", "public function writeDataBody()\n {\n\n $rowStyle1 = $this->styleObj->getRowStyle(1);\n $rowStyle2 = $this->styleObj->getRowStyle(2);\n $styleListBorders = $this->styleObj->getAllBorders();\n\n $listStructure = [];\n\n if (is_object($this->data) && $this->data->structure)\n $listStructure = $this->data->structure;\n else\n $listStructure = $this->structure;\n\n //Add Data\n foreach ($this->data as $rowIdx => $rowData) {\n\n //here comes the data\n $this->resetX();\n\n foreach ($listStructure as $cellKey => $cellStruct) {\n\n if (isset($cellStruct[$cellKey][self::TYPE]))\n $type = $cellStruct[$cellKey][self::TYPE];\n else\n $type = 'text';\n\n $cPos = ($this->posX.$this->posY);\n\n if (\"text\" === $type) {\n $this->setCellValueExplicit($cPos, $rowData[$cellKey], PHPExcel_Cell_DataType::TYPE_STRING);\n } elseif ($type === \"numeric\") {\n $this->SetCellValue($cPos, $rowData[$cellKey]);\n $this->getStyle($cPos)->getNumberFormat()->setFormatCode('#,##0.00');\n } elseif ($type === \"date\") {\n $this->SetCellValue($cPos, $rowData[$cellKey]);\n $this->getStyle($cPos)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);\n } elseif ($type === \"time\") {\n $this->SetCellValue($cPos, $rowData[$cellKey]);\n $this->getStyle($cPos)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);\n } elseif ($type === \"timestamp\") {\n $this->SetCellValue($cPos, $rowData[$cellKey]);\n $this->getStyle($cPos)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TIMESTAMP);\n } elseif ($type === \"money\") {\n $this->SetCellValue($cPos, $rowData[$cellKey]);\n $this->getStyle($cPos)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);\n } else {\n $this->SetCellValue($cPos, $rowData[$cellKey]);\n }\n\n if (isset($cellStruct[self::ACTION_URL])) {\n if (isset($rowData[self::ACTION_URL]) && '' !== trim( $rowData[self::ACTION_URL]))\n $this->getCell($cPos)->getHyperlink()->setUrl($rowData[self::ACTION_URL]);\n\n }\n\n $this->posX++;\n }\n\n if (($rowIdx % 2) === 1) {\n $style = $rowStyle1;\n } else {\n $style = $rowStyle2;\n }\n\n $this->getStyle(\"A{$this->posY}:{$cPos}\")->applyFromArray($style);\n\n $this->posY++;\n\n }//end foreach\n\n $this->decX();\n\n $this->getStyle(\"A1:\".$this->posX.($this->posY-1))->applyFromArray($styleListBorders);\n\n }", "function table_cell($row, $col, $key, $val, $class=\"\", $align=\"\", $comment=\"\", $index) \n {\n global $debug;\n\tif ($debug) echo \"table_cell($val)\";\n global $PHP_SELF, $DOCUMENT_ROOT;\n $title=\"\";\n $shown = false;\n if (array_key_exists($key,$this->orig_fields)) $key = $this->orig_fields[$key];\n if (isset($this->total[$key])) $title=number_format($this->total[$key]);\n if ($comment) $title = $comment;\n $this->table_cell_open($class, $align, $title, $key, $index);\n if (!empty($this->edit)) {\n/*\n\tif ($this->form->form_data->elements[$key][\"ob\"]->multiple) $val = explode(\",\",$val);\n*/\n\t$this->form->form_data->elements[$key][\"ob\"]->value=$val;\n\t$this->form->form_data->elements[$key][\"ob\"]->action=\"ipe\";\n\t\n\t$this->form->form_data->elements[$key][\"ob\"]->extrahtml = \" \".str_replace('$index',\"$index\",$this->form->form_data->elements[$key][\"ob\"]->extrahtml);\n\n \tif (isset($this->extra_html[$key])) $this->form->form_data->elements[$key][\"ob\"]->extrahtml = \" \".$this->extra_html[$key];\n\n\tif (isset($this->form->form_data->elements[$key][\"ob\"]->rows)) {\n\t\t$this->form->form_data->elements[$key][\"ob\"]->rows = substr_count($val,\"\\n\")+1;\n\t}\n\tif ($this->form->form_data->elements[$key][\"ob\"]->multiple) {\n\t\tforeach ($this->form->form_data->elements[$key][\"ob\"]->options as $option) {\n\t\t\t$this->form->form_data->show_element($key,$option);\n\t\t\techo \" $option<br>\\n\";\n\t\t}\n\t} else $this->form->form_data->show_element($key,$val);\n } else {\n if (strlen($val)>$this->limit+5) {$val = substr($val,0,$this->limit).\" ...\";}\n\tif ((isset($this->map_links)) and ($this->verify_array($this->map_links)) and array_key_exists($key,$this->map_links) and ($target = $this->map_links[$key])) {\n printf(\"<a href=\\\"%s%s\\\">%s</a>\",$target,$val,htmlspecialchars($val,ENT_COMPAT,\"UTF-8\"));\n } else {\n\t\tif ($this->trust_the_data) \n\t\t\techo $val;\n\t\telse\n\t\t\techo htmlspecialchars($val,ENT_COMPAT,\"UTF-8\");\n\t}\n }\n $this->table_cell_close($class);\n }", "function addCell(&$child,$x,$y,$span, $xfill = GTK_SHRINK) {\n $this->table->attach( $child,\n $x,$x+$span, \n $y,$y+1,\n $xfill, // xdir\n GTK_SHRINK // ydir\n );\n }", "public function &flush(){\n\t\tif ($this->type == self::TYPE_BYCOL){\n\t\t\t$this->_finishLastRow();\n\t\t\t$this->buffer = '<table'.((!empty($this->tableAttr))?\" $this->tableAttr\":'').'>'.$this->buffer.'</table>';\n\t\t\tif (empty($this->cells)){\n\t\t\t\tif (!is_null($this->onEmptyInsert)){\n\t\t\t\t\t$this->buffer = '<table'.((!empty($this->tableAttr))?\" $this->tableAttr\":'').'>'\n\t\t\t\t\t\t.$this->onEmptyInsert.'</table>';\n\t\t\t\t}else{\n\t\t\t\t\t$this->buffer = '';\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$this->buffer = '<table'.((!empty($this->tableAttr))?\" $this->tableAttr\":'').'>';\n\t\t\tif (empty($this->cells)){\n\t\t\t\tif (!is_null($this->onEmptyInsert)){\n\t\t\t\t\t$this->buffer .= $this->onEmptyInsert;\n\t\t\t\t}else{\n\t\t\t\t\t$this->buffer = '';\n\t\t\t\t\treturn '';\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->_finishLastRow();\n\t\t\t$total = count($this->cells);\n\t\t\t$colSize =& $this->colSize;\n\t\t\t//finish line\n\t\t\t$remainder = ($total>$colSize)?$colSize-$total%$colSize:$colSize-$total;\n\t\t\tfor($i=0;$i<$remainder;$i++){\n\t\t\t\t$this->addCell();\n\t\t\t}\n\t\t\t$total += $remainder;\n\t\t\t$cells =& $this->cells;\n\t\t\t$eachLength = $total/$colSize;\n\t\t\tfor($key=0;$key<$eachLength;$key++){\n\t\t\t\t$this->row++;\n\t\t\t\t$attr = null;\n\t\t\t\t$this->_insureRowAttribute($attr);\n\t\t\t\t$this->buffer .= \"<tr$attr>\";\n\t\t\t\tfor($this->col=0;$this->col<$colSize;$this->col++){\n\t\t\t\t\t$attr = $cells[$key+($eachLength*$this->col)][1];\n\t\t\t\t\t$this->_insureColAttributes($attr);\n\t\t\t\t\t$this->buffer .= '<td'.(!empty($attr[$this->col])?\" {$attr[$this->col]}\":'').'>'\n\t\t\t\t\t\t.$cells[$key+($eachLength*$this->col)][0].'</td>';\n\t\t\t\t}\n\t\t\t\t$this->buffer .= '</tr>';\n\t\t\t}\n\t\t\t$this->buffer .= '</table>';\n\t\t\tunset($this->cells);\n\t\t}\n\t\treturn $this->buffer;\n\t}", "function writeActionRow($pdf, $data, $index, $y) {\n $y -= 1;\n if(!empty($data['action_' . $index])) {\n $pdf -> SetXY(A4_LEFT, $y);\n $pdf -> Write(0, $data['action_' . $index]);\n } else\n return;\n if(!empty($data['begin_time_' . $index])) {\n $pdf -> SetXY(A4_RIGHT, $y);\n $pdf -> Write(0, formatDate($data['begin_time_' . $index]));\n }\n if(!empty($data['end_time_' . $index])) {\n $pdf -> SetXY(A4_RIGHT_2, $y);\n $pdf -> Write(0, formatDate($data['end_time_' . $index]));\n }\n if(!empty($data['hours_' . $index])) {\n $pdf -> SetXY(A4_RIGHT_3, $y);\n $pdf -> Write(0, formatDecimal($data['hours_' . $index]));\n }\n}", "protected function makeCells($params, $icon, $alt) {\n\t\t$title = $GLOBALS['LANG']->getLL($alt, true);\n\t\treturn '<a href=\"#\" title=\"' . $title . '\" onclick=\"' .\n\t\t\t\thtmlspecialchars('return jumpToUrl(\\'' . $GLOBALS['SOBE']->doc->issueCommand($params) .'\\');') . '\">' .\n\t\t\t\t\t'<img '. t3lib_iconWorks::skinImg($this->doc->backPath,\n\t\t\t\t\tt3lib_extMgm::extRelPath('t3blog') . 'icons/' . $icon,' width=\"18\" height=\"16\"') .\n\t\t\t\t\t' alt=\"' . $title . '\" /></a>';\n\t}", "public function addCell($value) {\n return $this->add('cells', func_get_args());\n }", "public function tableCell(string $content, array $options = []): string\n {\n return $this->formatTemplate('tablecell', [\n 'attrs' => $this->templater()->formatAttributes($options),\n 'content' => $content,\n ]);\n }", "abstract protected function _writeRow(array $row);", "function renderCell($data, $config, $row)\n {\n for ($i= 0; $i<$config['count']; $i++) {\n $attr= $config[$i];\n $value= \"\";\n if (is_array($config[$attr])) {\n $value= $config[$attr][0];\n } else {\n $value= $config[$attr];\n }\n $data= preg_replace(\"/%\\{$attr\\}/\", $value, $data);\n }\n\n // Watch out for filters and prepare to execute them\n $data= $this->processElementFilter($data, $config, $row);\n\n // Replace all non replaced %{...} instances because they\n // are non resolved attributes or filters\n $data= preg_replace('/%{[^}]+}/', '&nbsp;', $data);\n\n return $data;\n}" ]
[ "0.6289911", "0.6141318", "0.5830667", "0.58240306", "0.56845194", "0.5655423", "0.56103224", "0.5609792", "0.5594727", "0.55609214", "0.5422898", "0.5411336", "0.54082274", "0.54063916", "0.5398404", "0.537464", "0.53634197", "0.5298139", "0.52191913", "0.52158123", "0.5214826", "0.5207231", "0.5194755", "0.51865077", "0.518431", "0.51663685", "0.51505226", "0.51486224", "0.51349443", "0.51298267" ]
0.74788487
0
Generate the image variables
function genimage() { $im = imagecreatetruecolor($this->pObj->stageWidth,$this->pObj->stageHeight); $white = imagecolorallocate ($im,0xff,0xff,0xff); $black = imagecolorallocate($im,0x00,0x00,0x00); $gray_lite = imagecolorallocate ($im,0xee,0xee,0xee); $gray_dark = imagecolorallocate ($im,0x7f,0x7f,0x7f); // Fill in the background of the image imagefilledrectangle($im, 0, 0, $this->pObj->stageWidth+100, $this->pObj->stageHeight+100, $white); foreach ($this->pObj->delaunay as $key => $arr) { foreach ($arr as $ikey => $iarr) { list($x1,$y1,$x2,$y2) = $iarr; imageline($im,$x1+5,$y1+5,$x2+5,$y2+5,$gray_dark); } } ob_start(); imagepng($im); $imagevariable = ob_get_contents(); ob_clean(); // write to file $filename = $this->path."tri_". rand(0,1000).".png"; $fp = fopen($filename, "w"); fwrite($fp, $imagevariable); if(!$fp) { $this->errwrite(); } fclose($fp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function generateMainImage();", "private function generatePhoto() {\n\t}", "function govcmstheme_bootstrap_preprocess_image(&$variables) {\n foreach (array('width', 'height') as $key) {\n unset($variables[$key]);\n }\n}", "function modelindarkdress()\n {\n $file = BASE_DIR.'/tmp/model2.jpg';\n\n $image = new ImageAnalize($file);\n $image->areaDistribution();\n\n println(\"image bits (from dark color to light colors top/bottom. non saturated/saturated tints left 32 / right 32)\");\n println($image->bits);\n println($image->freeareas);\n $mainColors = $image->mainColor();\n $this->printBox($mainColors[0]);\n $this->printBox($mainColors[1]);\n println($image->hist3x64,1,TERM_VIOLET);\n\n print \"<img src='/tmp/32-ANALIZE-model2.jpg' width='64' height='64'>\";\n print \"<img src='/tmp/32-BW-model2.png' width='64' height='64'>\";\n }", "function __construct() {\n\t\n\t\t$this->width = 600;\n\t\t$this->height = 300;\n\t\t$this->marginPercent = 10;\n\t\t$this->valMaxX = 5;\n\t\t$this->valMaxY = 7;\n\t\t$this->resolutionX = 1;\n\t\t$this->resolutionY = 1;\n\t\t$this->showGraduation = true;\n\n\n\t\t$this->image = @ImageCreate ($this->width, $this->height);\n\t\t$this->bgColor = ImageColorAllocate ($this->image, 255, 255, 255);\n\t\t$this->gridColor = ImageColorAllocate ($this->image, 0, 0, 0);\n\t\n\t\n\t\t// to proto\n\t\t$this->marginSizeX = ($this->marginPercent / 100) * $this->width;\n\t\t$this->marginSizeY = ($this->marginPercent / 100) * $this->height;\n\t\n\t\t// to method\n\t\t$this->imageColorsArray = array(\n\t\t\t0 => ImageColorAllocate ($this->image, 255, 0, 0) ,\n\t\t\t1 => ImageColorAllocate ($this->image, 255, 217, 13) , // yellow\n\t\t\t2 => ImageColorAllocate ($this->image, 0, 255, 0) \n\t\t);\n\t\n\t}", "public function images();", "public function images();", "function gen_imgrsource($imgf, $page, $svuri, $baseuri){\r\n\treturn array(\r\n\t\t\"@type\" => \"oa:Annotation\",\r\n\t\t\"motivation\" => \"sc:painting\",\r\n\t\t\"resource\" => array(\r\n\t\t\t\"@id\" => $baseuri.SERVICE_SCRIPT.\"/$imgf\",\r\n\t\t\t//content resources MAY have width/height, but not required\r\n\t\t\t\"service\" => array(\r\n\t\t\t\t\"@context\" => \"http://iiif.io/api/image/2/context.json\",\r\n\t\t\t\t\"@id\" => $svuri.\"/\".$imgf,\r\n\t\t\t\t\"profile\" => \"http://iiif.io/api/image/2/level1.json\"\r\n\t\t\t)\r\n\t\t),\r\n\t\t\"on\" => $baseuri.\"canvas/p\".$page\r\n\t);\r\n}", "public function getImageGamma () {}", "public function make_image() {\n $this->imagecreatetruecolortrans();\n\n // Get all the layers in this design and theme\n $this->_get_layer_data();\n\n // Process the layers\n $this->_make_layers();\n }", "function boom_preprocess_image(&$variables) {\n unset($variables['width'], $variables['height'], $variables['attributes']['width'], $variables['attributes']['height']);\n}", "public function pixelDefinition();", "function KT_image() {\n\t\t$this->arrCommands = array(\n\t\t\t\t\t\t\t\t\"C:\\\\PROGRA~1\\\\IMAGEM~1\\\\\",\n\t\t\t\t\t\t\t\t'/usr/bin/X11/',\n\t\t\t\t\t\t\t\t'/usr/X11R6/bin/'\n\t\t\t\t\t\t\t );\n\t\t$this->orderLib = array('imagemagick','gd');\n\t\t$this->getVersionGd();\n\t}", "private function init_img() {\n\t\t$this->img_in = imagecreatefromPNG($this->url);\n\t\t$this->img_out = ImageCreateTrueColor(imagesx($this->img_in), imagesy($this->img_in));\n\t}", "public function flopImage () {}", "public function getVariables();", "private function generarVariables() {\n JD('Controlador', $this->_nombreControlador);\n JD('Vista', $this->vista);\n JD('Metodo', $this->_metodo);\n JD('Modulo', $this->_modulo);\n }", "protected function generateGrids() \n\t{\n\t\tforeach ($this->horiz_grid_lines as $line) {\n\t\t\timageline($this->image, $line['x1'], $line['y1'], $line['x2'], $line['y2'] , $line['color']);\n\t\t}\n\t\tforeach ($this->vert_grid_lines as $line) {\n\t\t\timageline($this->image, $line['x1'], $line['y1'], $line['x2'], $line['y2'] , $line['color']);\n\t\t}\n\t\tforeach ($this->horiz_grid_values as $value) {\n\t\t\timagestring($this->image, $value['size'], $value['x'], $value['y'], $value['value'], $value['color']);\n\t\t}\n\t\t//not implemented in the base library, but used in extensions\n\t\tforeach ($this->vert_grid_values as $value) {\n\t\t\timagestring($this->image, $value['size'], $value['x'], $value['y'], $value['value'], $value['color']);\n\t\t}\n\t}", "function stacks_preprocess_image(&$variables) {\n unset($variables['width'], $variables['height'], $variables['attributes']['width'], $variables['attributes']['height']);\n}", "public function flopImage() {\n\t}", "public function getImageGamma() {\n\t}", "private function generateImage() {\n\t\t\n\t\tif ($this->type == 'preview') {\n\t\t\t// Set ration & calculate proportional dimensions for a small image\n\t\t\t$this->ratio = round((($this->preHeight*100)/$this->height)/100, 3);\n\t\t\t$this->width = round($this->width * $this->ratio);\n\t\t\t$this->roundPad = round($this->roundPad * $this->ratio);\n\t\t\t$this->height = $this->preHeight;\n\t\t\t\n\t\t}\n\n\t\tif (!$this->image = @imagecreatetruecolor($this->width + $this->roundPad * 2, $this->height + $this->roundPad * 2)) {\n\t\t\texit('GD unavailable. Check your PHP installation');\n\t\t}\n\t\t$innerImg = imagecreatetruecolor($this->width, $this->height);\n\t\t$white = imagecolorallocate($this->image, 250, 250, 250);\n\t\t$rp_col = imagecolorallocate($innerImg, 240, 243, 245);\n\t\t$con_col = imagecolorallocate($this->image, 136, 140, 140);\n\t\timagefilledrectangle($this->image, 1, 1, (($this->width + $this->roundPad * 2) - 2), (($this->height + $this->roundPad * 2) - 2), $rp_col);\n\t\timagefilledrectangle($innerImg, 1, 1, $this->width-2, $this->height-2, $white);\n\t\timagecopymerge($this->image, $innerImg, $this->roundPad, $this->roundPad, 0, 0, $this->width, $this->height, 100);\n\t\timageline($this->image, 0, 0, $this->roundPad, $this->roundPad, $con_col);\n\t\timageline($this->image, $this->width + $this->roundPad * 2, 0, $this->width + $this->roundPad - 2, $this->roundPad, $con_col);\n\t\timageline($this->image, $this->width + $this->roundPad * 2, $this->height + $this->roundPad * 2, $this->width + $this->roundPad - 2, $this->height + $this->roundPad - 2, $con_col);\n\t\timageline($this->image, 0, $this->height + $this->roundPad * 2, $this->roundPad, $this->height + $this->roundPad - 2, $con_col);\n\t}", "public function getImageGravity () {}", "public function getImageMatte () {}", "public function getImageInterpolateMethod () {}", "function vscGenerateImage() {\n\n\t$code=rand(1000,9999);\n\t$_SESSION[\"code\"]=$code;\n\t$im = imagecreatetruecolor(100, 24);\n\t$bg = imagecolorallocate($im, 22, 86, 165); //background color blue\n\t$fg = imagecolorallocate($im, 255, 255, 255);//text color white\n\timagefill($im, 0, 0, $bg);\n\tfor ($i=0;$i<strlen(\"$code\");$i++)\n\t\timagestring($im, 5, 5+rand(-3,3)+$i*15, 5+rand(0,5)-3, substr(\"$code\",$i,1), $fg);\n\t$file=time().\".png\";\n\tdebug(\"vscGenerateImage {$GLOBALS[\"SYS\"][\"DOCROOT\"]}/../Pool/Tmp/$file {$GLOBALS[\"SYS\"][\"ROOT\"]}/Pool/Tmp/$file\",\"red\");\n\timagepng($im,\"{$GLOBALS[\"SYS\"][\"DOCROOT\"]}/../Pool/Tmp/$file\");\n\treturn \"{$GLOBALS[\"SYS\"][\"ROOT\"]}/Pool/Tmp/$file\";\n}", "public function getImageIterations() {\n\t}", "public function getImageGravity() {\n\t}", "public function getImageColorspace () {}", "public function getImageIterations () {}" ]
[ "0.61255985", "0.5648373", "0.56152666", "0.5611251", "0.5609579", "0.55933434", "0.55933434", "0.55896044", "0.55860883", "0.556982", "0.549194", "0.54696155", "0.54557306", "0.54390085", "0.54294837", "0.54158425", "0.5393826", "0.5374967", "0.5367908", "0.5359889", "0.5353794", "0.5321447", "0.5317579", "0.5246956", "0.5214714", "0.52101284", "0.5208579", "0.5205458", "0.52017385", "0.518278" ]
0.63735735
0
LEFT_SIDE = true, RIGHT_SIDE = false, 2 = COLINEAR checks whether px py is to the left or right of the directed vector x1 y1 x2 y2
function side($x1,$y1,$x2,$y2,$px,$py) { //echo("<br> x1 ".$x1." y1 ".$y1." x2 ".$x2." y2 ".$y2." px ".$px." py ".$py); $dx1 = $x2 - $x1; $dy1 = $y2 - $y1; $dx2 = $px - $x1; $dy2 = $py - $y1; //echo("<br> dx dy dx1 ".$dx1." dy1 ".$dy1." dx2 ".$dx2." dy2 ".$dy2); $o = ($dx1*$dy2)-($dy1*$dx2); //echo("<br> o ".$o); if ($o > 0.0){ //echo(" xxx 0"); return(0);} if ($o < 0.0) { //echo ("yyy 1"); return(1);} //echo("zero zero"); return(-1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isHorizontal()\n {\n return (bool) ($this->getPointA()->getOrdinate() == $this->getPointB()->getOrdinate());\n }", "public function isVertical()\n {\n return (bool) ($this->getPointA()->getAbscissa() == $this->getPointB()->getAbscissa());\n }", "public function getRightSide();", "public function getLeftSide();", "function isInside($x, $y, $r)\r\n{\r\n\treturn $x * $x + $y * $y <= $r * $r;\r\n}", "function direction();", "function createNewEdges($edges,$x,$y,$key,$ntri) {\n//print_r($edges);\n foreach ($edges as $ekey => $earr)\n {\n list($vi,$vj,$vk)=array($edges[$ekey][0],$edges[$ekey][1],$key);\n //echo(\"<br><BR><BR>XXXXXX\");\n //echo($vi.\" \".$vj.\" \".$vk.\" \");\n //print_r($x);\n //print_r($y);\n //echo(\"<br>XXXXXX<br><BR>\");\n\n if ($this->side($x[$vi],$y[$vi],$x[$vj],$y[$vj],$x[$vk],$y[$vk])==0)\n {\n array_push($this->v,array($vi,$vj,$vk));\n\n } elseif($this->side($x[$vk],$y[$vj],$x[$vj],$y[$vi],$x[$vi],$y[$vk])==0)\n {\n array_push($this->v,array($vk,$vj,$vi));\n\n } elseif($this->side($x[$vk],$y[$vi],$x[$vi],$y[$vj],$x[$vj],$y[$vk])==0)\n {\n array_push($this->v,array($vk,$vi,$vj));\n\n } elseif($this->side($x[$vj],$y[$vi],$x[$vi],$y[$vk],$x[$vk],$y[$vj])==0)\n {\n array_push($this->v, array($vj,$vi,$vk));\n\n } elseif($this->side($x[$vj],$y[$vk],$x[$vk],$y[$vi],$x[$vi],$y[$vj])==0)\n {\n array_push($this->v, array($vj,$vk,$vi));\n\n } elseif($this->side($x[$vi],$y[$vk],$x[$vk],$y[$vj],$x[$vj],$y[$vi])==0)\n {\n array_push($this->v, array($vi,$vk,$vj));\n\n } elseif($this->side($x[$vk],$y[$vk],$x[$vj],$y[$vj],$x[$vj],$y[$vi])==0)\n {\n array_push($this->v, array($vk,$vj,$vi));\n\n } elseif($this->side($x[$vj],$y[$vj],$x[$vk],$y[$vk],$x[$vi],$y[$vi])==0)\n {\n array_push($this->v, array($vj,$vk,$vi));\n }\n else\n {\n array_push($this->v,array($vi,$vj,$vk));\n }\n $this->complete[$ntri++]=0;\n }\n //return array($v,$complete);\n}", "public function is2D()\n {\n return (bool) ($this->_space_type & Maths::CARTESIAN_2D);\n }", "private function drawDirectionBorders($wid, $hei, $pos_x, $pos_y) {\n\t\t//echo $pos_x,' - ', $pos_y, ' - ', $wid,' - ', $hei;exit;\n\t\timagerectangle($this->paneIm, $pos_x, $pos_y, $wid, $hei, $this->paneColors['black']);\n\t}", "function isOrthogonal($edge)\n\t{\n\t\tif (isset($edge->style[mxConstants::$STYLE_ORTHOGONAL]))\n\t\t{\n\t\t\treturn mxUtils::getValue($edge->style, mxConstants::$STYLE_ORTHOGONAL);\n\t\t}\n\n\t\t$edgeStyle = $this->view->getEdgeStyle($edge, null, null, null);\n\n\t\treturn $edgeStyle === mxEdgeStyle::$ElbowConnector ||\n\t\t\t$edgeStyle === mxEdgeStyle::$SideToSide ||\n\t\t\t$edgeStyle === mxEdgeStyle::$TopToBottom ||\n\t\t\t$edgeStyle === mxEdgeStyle::$EntityRelation;\n\t}", "public function testOSR_IsVertical0()\n {\n $actual = OSR_IsVertical(static::$srs4326);\n $this->assertFalse(\n $actual,\n \"Result of OSR_IsVertical should be FALSE for EPSG:4326\"\n );\n }", "function direction($fx, $fy, $tx, $ty) {\n\t if ( $fx < $tx ) { return self::$E; }\n\t if ( $fx > $tx ) { return self::$W; }\n\t if ( $fy < $ty ) { return self::$S; }\n\t if ( $fy > $ty ) { return self::$N; }\n\t}", "function getLowerRightCorner(): Point\n {\n return new Point(1, 0);\n }", "function defineSides($relationshipElement) {\r\n\t\t\r\n\t\t$first = $relationshipElement['Relationship']['firstTrait'];\r\n\t\t\r\n\t\t$second = $relationshipElement['Relationship']['secondTrait'];\r\n\t\t\r\n\t\tif (($first <= 6) && ($second <=6)) {\r\n\t\t\t\r\n\t\t\t$elementSides = 'lftlft';\r\n\t\t\t\r\n\t\t}else if(($first <= 6) && ($second > 6)){\r\n\t\t\t\r\n\t\t\t$elementSides = 'lftrgt';\r\n\t\t\t\r\n\t\t}else if(($first > 6) && ($second > 6)){\r\n\t\t\t\r\n\t\t\t$elementSides = 'rgtrgt';\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\treturn $elementSides;\r\n\t\r\n\t}", "public function rectangle ($x1, $y1, $x2, $y2) {}", "public function oneLeftTwoRight()\n {\n list($width, $height, $largeHeight) = $this->getHeightSize();\n\n $width = ceil($width);\n $height = ceil($height);\n $largeHeight = ceil($largeHeight);\n\n\n $one = $this->images->get(0);\n $this->canvas->insert($one->fit($width, $largeHeight), 'left');\n\n $two = $this->images->get(1);\n $this->canvas->insert($two->fit($width, $height), 'top-right');\n\n $three = $this->images->get(2);\n $this->canvas->insert($three->fit($width, $height), 'bottom-right');\n }", "public function test_get_first_on_diagonal_between_reverse(): void\n {\n $board = GameBoard::createByBoard([\n ['', '', '', '', '', '', '', ''],\n ['', '', '', 'q', '', '', 'q', ''],\n ['', '', 'Q', '', '', '', '', ''],\n ['', '', '', '', '', '', '', ''],\n ['q', '', '', '', '', '', '', 'Q'],\n ['', '', 'q', '', '', '', '', ''],\n ['', 'Q', '', '', '', 'Q', '', ''],\n ['', '', '', '', 'q', '', '', ''],\n ]);\n\n $res = json_encode($board->getFirstOnAntiDiagonal(startPos: ['x' => 7, 'y' => 0], endPos: ['x' => 4, 'y' => 3]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":6,\"y\":1}');\n\n $res = json_encode($board->getFirstOnAntiDiagonal(startPos: ['x' => 3, 'y' => 1], endPos: ['x' => 1, 'y' => 3]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":2,\"y\":2}');\n\n $res = json_encode($board->getFirstOnAntiDiagonal(startPos: ['x' => 6, 'y' => 5], endPos: ['x' => 4, 'y' => 7]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":6,\"y\":5}');\n\n $res = json_encode($board->getFirstOnAntiDiagonal(startPos: ['x' => 4, 'y' => 7], endPos: ['x' => 4, 'y' => 7]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":4,\"y\":7}');\n }", "public function isVector() {\n\t\tif( $this->getRows() == 1 ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn $this->getCols() == 1;\n\t}", "public function test_get_first_on_diagonal_between(): void\n {\n $board = GameBoard::createByBoard([\n ['', '', '', '', '', '', '', ''],\n ['', '', '', 'q', '', '', 'q', ''],\n ['', '', 'Q', '', '', '', '', ''],\n ['', '', '', '', '', '', '', ''],\n ['q', '', '', '', '', '', '', 'Q'],\n ['', '', 'q', '', '', '', '', ''],\n ['', 'Q', '', '', '', 'Q', '', ''],\n ['', '', '', '', 'q', '', '', ''],\n ]);\n\n $res = json_encode($board->getFirstOnAntiDiagonal(startPos: ['x' => 4, 'y' => 3]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":5,\"y\":2}');\n\n $res = json_encode($board->getFirstOnAntiDiagonal(3, startPos: ['x' => 1, 'y' => 3], endPos: ['x' => 3, 'y' => 1]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":1,\"y\":3}');\n\n $res = json_encode($board->getFirstOnAntiDiagonal(-4, startPos: ['x' => 7, 'y' => 4]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":7,\"y\":4}');\n\n $res = json_encode($board->getFirstOnAntiDiagonal(-4, endPos: ['x' => 5, 'y' => 6]));\n $this->assertJsonStringEqualsJsonString($res, '{\"x\":4,\"y\":7}');\n }", "function createCircle($vi,$vj,$vk,$x,$y,$z,$key,$vkey) {\n\n // check for colinearity\n\t\t$edges = array();\n\t\t$c = array();\n\n\t\tif ((($x[$vi] == $x[$vj]) && ($x[$vi] == $x[$vk])) or (($y[$vi] == $y[$vj]) && ($y[$vj] == $y[$vk]))) {\n\t\t\techo(\"7777777777777n colinear\");\n\t\t\treturn array($c,$edges);\n\t\t}\n\t\telse {\n $c=$this->CircumCircle($x[$vi],$y[$vi],$x[$vj],$y[$vj],$x[$vk],$y[$vk]);\n //echo(\"complete \".$c->x.\" \".$c->r.\" \".$x[$key]);\n\n\n\t\t// crude filter to check if the point is inside the circle\n\t\t// if the centre of hte circle plus the radius are smaller than the x value then\n\t\t// the point is outside the circle\n\t\t// mark complete for this vertex as 1\n\t if ($c->x + $c->r < $x[$key]) {\n\t //echo(\"complete \".$vkey.\" 1\");\n\t $this->complete[$vkey]=1;}\n\t else {\n\t //echo(\"not complete $vkey\");\n\t }\n\n\t\t// if the circle is not a tiny circle, and the current point is inside this circle\n\t\t//echo(\"<br>inside\");\n\t\t//print_r($c);\n\t\t//echo($x[$key].\" \".$y[$key]);\n\t\t//echo(\"inside is \".$this->inside($c, $x[$key],$y[$key]).\"<br>\");\n\t\t//print_r($x);\n\t\t//print_r($y);\n\t\t//echo($vi.\" \".$vj.\" \".$vk);\n\t\t//echo(\"<br> aaaa\");\n\t\t// if the circle is of a significant size and the point in question is inside the circle\n\t\t// then check which side of the directed vector the new point is\n if ($c->r > EPSILON && $this->inside($c, $x[$key],$y[$key]))\n {\n // the side function checks whether the point is to the left or right of the directed vector\n // 0 means it is on the left side\n if ($this->side($x[$vi],$y[$vi],$x[$vj],$y[$vj],$x[$vk],$y[$vk])==0)\n {\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n\n } elseif($this->side($x[$vk],$y[$vj],$x[$vj],$y[$vi],$x[$vi],$y[$vk])==0)\n {\n $edges[]=array($vk,$vj);\n $edges[]=array($vj,$vi);\n $edges[]=array($vi,$vk);\n\n } elseif($this->side($x[$vk],$y[$vi],$x[$vi],$y[$vj],$x[$vj],$y[$vk])==0)\n {\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n\n } elseif($this->side($x[$vj],$y[$vi],$x[$vi],$y[$vk],$x[$vk],$y[$vj])==0)\n {\n $edges[]=array($vj,$vi);\n $edges[]=array($vi,$vk);\n $edges[]=array($vk,$vj);\n\n } elseif($this->side($x[$vj],$y[$vk],$x[$vk],$y[$vi],$x[$vi],$y[$vj])==0)\n {\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n\n } elseif($this->side($x[$vi],$y[$vk],$x[$vk],$y[$vj],$x[$vj],$y[$vi])==0)\n {\n $edges[]=array($vi,$vk);\n $edges[]=array($vk,$vj);\n $edges[]=array($vj,$vi);\n\n } elseif($this->side($x[$vk],$y[$vk],$x[$vi],$y[$vi],$x[$vj],$y[$vj])==0)\n {\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n\n } elseif($this->side($x[$vj],$y[$vj],$x[$vk],$y[$vk],$x[$vi],$y[$vi])==0)\n {\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n }\n else\n {\n \t\t//echo(\"<br>QQQQQQQQ no side!\");\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n }\n\t\t\t\t// unset destroys the specified variables\n unset($this->v[$vkey]);\n unset($this->complete[$vkey]);\n } else {\n \t//echo(\"<br>epsilon problem <br>\");\n }\n\treturn array($c,$edges);\n\t}\n}", "public function twoLeftOneRight()\n {\n list($width, $height, $largeHeight) = $this->getHeightSize();\n\n $width = ceil($width);\n $height = ceil($height);\n $largeHeight = ceil($largeHeight);\n\n $one = $this->images->get(0);\n $this->canvas->insert($one->fit($width, $height), 'top-left');\n\n $two = $this->images->get(1);\n $this->canvas->insert($two->fit($width, $largeHeight), 'right');\n\n $three = $this->images->get(2);\n $this->canvas->insert($three->fit($width, $height), 'bottom-left');\n }", "public function isLedgeNode(): bool;", "function getSide(){\r\n return $this->side;\r\n }", "public final function side()\n {\n if (!$this->isRoot())\n {\n if ($this->parent()->ls() === $this) return self::LEFT;\n if ($this->parent()->rs() === $this) return self::RIGHT;\n }\n\n return 0;\n }", "public function getEnablePointToPointAlternates()\n\t{\n\t\treturn $this->enablePointToPointAlternates;\n\t}", "public function opposite() {\n $x = $this->_mag_x * -1;\n $y = $this->_mag_y * -1;\n $z = $this->_mag_z * -1;\n $res = new Vertex ( array ( 'x' => $x, 'y' => $y, 'z' => $z, 'w' => 0.0));\n return (new Vector( array ('dest' => $res)));\n }", "public function test_get_all_on_diagonal_between_reverse(): void\n {\n $board = GameBoard::createByBoard([\n ['', '', '', '', '', '', '', ''],\n ['', '', '', 'q', '', '', 'q', ''],\n ['', '', 'Q', '', '', '', '', ''],\n ['', '', '', '', '', '', '', ''],\n ['q', '', '', '', '', '', '', 'Q'],\n ['', '', 'q', '', '', '', '', ''],\n ['', 'Q', '', '', '', 'Q', '', ''],\n ['', '', '', '', 'q', '', '', ''],\n ]);\n\n $res = json_encode($board->getAllOnAntiDiagonal(startPos: ['x' => 7, 'y' => 0], endPos: ['x' => 4, 'y' => 3]));\n $this->assertJsonStringEqualsJsonString($res, '[{\"x\":6,\"y\":1},{\"x\":5,\"y\":2}]');\n\n $res = json_encode($board->getAllOnAntiDiagonal(startPos: ['x' => 3, 'y' => 1], endPos: ['x' => 1, 'y' => 3]));\n $this->assertJsonStringEqualsJsonString($res, '[{\"x\":2,\"y\":2},{\"x\":1,\"y\":3}]');\n\n $res = json_encode($board->getAllOnAntiDiagonal(startPos: ['x' => 6, 'y' => 5], endPos: ['x' => 4, 'y' => 7]));\n $this->assertJsonStringEqualsJsonString($res, '[{\"x\":6,\"y\":5},{\"x\":4,\"y\":7}]');\n\n $res = json_encode($board->getAllOnAntiDiagonal(startPos: ['x' => 4, 'y' => 7], endPos: ['x' => 4, 'y' => 7]));\n $this->assertJsonStringEqualsJsonString($res, '[{\"x\":4,\"y\":7}]');\n }", "public function isPositionInside()\n\t{\n\t\treturn ($this->getCfg('general/position') == 'inside');\n\t}", "public function pathLineToVerticalRelative ($y) {}", "public function testOSR_IsVertical1()\n {\n $hRef = OSR_NewSpatialReference();\n $wktFile = test_data_path(\"osr\", \"epsg5867.wkt\");\n $eErr = OSR_SetFromUserInput($hRef, $wktFile);\n $this->assertSame(OGRERR_NONE, $eErr, \"Could not load \" . $wktFile);\n $actual = OSR_IsVertical($hRef);\n $this->assertTrue(\n $actual,\n \"Result of OSR_IsVertical should be TRUE for EPSG:5867\"\n );\n }" ]
[ "0.607623", "0.6010518", "0.55853266", "0.54226947", "0.5214086", "0.5173975", "0.50859594", "0.5037353", "0.50211865", "0.49725246", "0.49054337", "0.49038202", "0.4899984", "0.48884186", "0.48438764", "0.4838186", "0.48324874", "0.48253322", "0.4805243", "0.47779185", "0.47715434", "0.47607443", "0.47575566", "0.4748334", "0.4744421", "0.4715826", "0.4715016", "0.4693765", "0.46867752", "0.46529657" ]
0.66539335
0
calculate the circum circle of the triangle for a delaunay, no other node in the triangulation should be inside this circumcircle except for the three nodes of the triangle itself
function CircumCircle($x1,$y1,$x2,$y2,$x3,$y3) { //list($x1,$y1)=array(1,3); //list($x2,$y2)=array(6,5); //list($x3,$y3)=array(4,7); $absy1y2 = abs($y1-$y2); $absy2y3 = abs($y2-$y3); //echo("x2 b ".$x2."<br>"); //echo("x1 b ".$x1."<br>"); //echo("x3 b ".$x3."<br>"); //echo("y2 b ".$y2."<br>"); //echo("y1 b ".$y1."<br>"); //echo("y3 b ".$y3."<br>"); if ($absy1y2 < EPSILON) { $m2 = - ($x3-$x2) / ($y3-$y2); $mx2 = ($x2 + $x3) / 2.0; $my2 = ($y2 + $y3) / 2.0; $xc = ($x2 + $x1) / 2.0; $yc = $m2 * ($xc - $mx2) + $my2; } else if ($absy2y3 < EPSILON) { $m1 = - ($x2-$x1) / ($y2-$y1); $mx1 = ($x1 + $x2) / 2.0; $my1 = ($y1 + $y2) / 2.0; $xc = ($x3 + $x2) / 2.0; $yc = $m1 * ($xc - $mx1) + $my1; } else { //echo("x2 ".$x2."<br>"); //echo("x1 ".$x1."<br>"); //echo("x3 ".$x3."<br>"); //echo("y2 ".$y2."<br>"); //echo("y1 ".$y1."<br>"); //echo("y3 ".$y3."<br>"); $m1 = - ($x2-$x1) / ($y2-$y1); $m2 = - ($x3-$x2) / ($y3-$y2); $mx1 = ($x1 + $x2) / 2.0; $mx2 = ($x2 + $x3) / 2.0; $my1 = ($y1 + $y2) / 2.0; $my2 = ($y2 + $y3) / 2.0; //echo("m1 ".$m1."<br>"); //echo("m2 ".$m2."<br>"); $xc = ($m1 * $mx1 - $m2 * $mx2 + $my2 - $my1) / ($m1 - $m2); if ($absy1y2 > $absy2y3) { $yc = $m1 * ($xc - $mx1) + $my1; } else { $yc = $m2 * ($xc - $mx2) + $my2; } } $dx = $x2 - $xc; $dy = $y2 - $yc; $rsqr = $dx*$dx + $dy*$dy; $r = sqrt($rsqr); $colinear = false; /* Check for coincident points */ if($absy1y2 < EPSILON && $absy2y3 < EPSILON) { // think this is wrong - if both y1-y2 and y2 - y3 are very small, then this is colinear // nb the colinear variable from the circle doesnt seem to be used! // $colinear=false; $colinear=true; } else { $colinear=false; } //echo("<br>colinear ".$colinear."<br>"); return new Circle($xc, $yc, $r, $rsqr, $colinear); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCircumference(){}", "public function getCircumference()\n {\n return 2 * pi() * $this->radius;\n }", "function circle_circumference_1 ($diameter) {\n\treturn (22/7) * $diameter;\n}", "private function calculateTriangleArea(): void\n\t\t{\n\t\t\tif($this->isItTriangle($this->vertex)) {\n\t\t\t\t$absoluteValue = ($this->vertex['vertexTwo']['x2']-$this->vertex['vertexOne']['x1'])*($this->vertex['vertexThree']['y3']-$this->vertex['vertexOne']['y1'])-($this->vertex['vertexTwo']['y2']-$this->vertex['vertexOne']['y1'])*($this->vertex['vertexThree']['x3']-$this->vertex['vertexOne']['x1']);\n\n\t\t\t\t$absoluteValue < 0 ? $absoluteValue = -$absoluteValue : null;\n\t\t\t\t$triangleArea = $absoluteValue/2;\n\t\t\t\t$this->showMessage(\"Pole wynosi $triangleArea\");\n\t\t\t} else {\n\t\t\t\t$this->showMessage('Podane współrzędne nie tworzą trójkąta');\n\t\t\t}\n\t\t}", "public function getCircumference()\n {\n return 2 * $this->width + 2 * $this->height;\n }", "function greatcircle_point_distance($pair,$third){\n //Convert to cartesian coordinates for the vector math\n $cfirst = polcar(array($pair[0],$pair[1]));\n $clast = polcar(array($pair[2],$pair[3]));\n $cthird =polcar($third);\n\n //Project 'third' onto the great circle arc joining 'pair' along the\n //vector that is normal to the chord between 'pair'\n $crossFirstLast = crossProduct($cfirst,$clast);\n $vectorNorm = vectorL2Norm($crossFirstLast);\n $normal = vectorDevidedByValue($crossFirstLast,$vectorNorm);\n $dot_product_of_normal_ctird = array_sum(array_map(function($a,$b) { return $a*$b; }, $normal, $cthird));\n $intersect = array1RemoveArray2($cthird,valueTimesArray($normal,$dot_product_of_normal_ctird));\n $intersect_norm = vectorL2Norm($intersect);\n $RdividedByIntersectNorm = Re/$intersect_norm;\n $intersect = valueTimesArray($intersect,$RdividedByIntersectNorm);\n\n //Great circle distance from 'third' to its projection\n $d =dist( $third,carpol($intersect));\n\n //If the projection of 'third' is not between the shorter arc\n //connecting 'pair', we instead want the gc distance from 'third'\n //to the nearest of the two.\n $d0 = array_sum(array_map(function($a,$b) { return $a*$b; }, $intersect, $cfirst));\n $d1 = array_sum(array_map(function($a,$b) { return $a*$b; }, $intersect, $clast));\n $c = array_sum(array_map(function($a,$b) { return $a*$b; }, crossProduct($intersect,$cfirst), crossProduct($intersect,$clast)));\n\n if ($c < 0 and (($d0 >= 0 and $d1 >= 0) or ($d0 < 0 and $d1 < 0))){\n\n return $d;\n }\n else{\n return min(dist($third, array($pair[0],$pair[1])), dist($third, array($pair[2],$pair[3])));\n }\n}", "public function radius() : float;", "static function xyz($a,$b,$ds,$o='',$ob=''){\nif(!$ob){$a=deg2rad($a); $b=deg2rad($b);}\n$x=(sin($a)*cos($b)); $y=(sin($a)); $z=cos($a);//works for calc distances\n//$x=(sin($a)*cos($b)); $y=(sin($a)*sin($b)); $z=cos($a);//uh?\n//$x=(sin($a)*sin($b)); $y=(sin($b)*cos($a)); $z=cos($a);//bab/#U6XMUF#9\n//$x=sin($a); $y=cos($b); $z=sin($a-$b);//dav\n//$x=0-sin($a)*cos($b); $y=sin($b); $z=cos($a);//star3d\n//$x=0-sin($a)*sin($b); $y=sin($b)*cos($a); $z=cos($a);//test\nif($o){$x=round($x,2); $y=round($y,2); $z=round($z,2);}\nreturn [$x*$ds,$y*$ds,$z*$ds];}", "function createCircle($vi,$vj,$vk,$x,$y,$z,$key,$vkey) {\n\n // check for colinearity\n\t\t$edges = array();\n\t\t$c = array();\n\n\t\tif ((($x[$vi] == $x[$vj]) && ($x[$vi] == $x[$vk])) or (($y[$vi] == $y[$vj]) && ($y[$vj] == $y[$vk]))) {\n\t\t\techo(\"7777777777777n colinear\");\n\t\t\treturn array($c,$edges);\n\t\t}\n\t\telse {\n $c=$this->CircumCircle($x[$vi],$y[$vi],$x[$vj],$y[$vj],$x[$vk],$y[$vk]);\n //echo(\"complete \".$c->x.\" \".$c->r.\" \".$x[$key]);\n\n\n\t\t// crude filter to check if the point is inside the circle\n\t\t// if the centre of hte circle plus the radius are smaller than the x value then\n\t\t// the point is outside the circle\n\t\t// mark complete for this vertex as 1\n\t if ($c->x + $c->r < $x[$key]) {\n\t //echo(\"complete \".$vkey.\" 1\");\n\t $this->complete[$vkey]=1;}\n\t else {\n\t //echo(\"not complete $vkey\");\n\t }\n\n\t\t// if the circle is not a tiny circle, and the current point is inside this circle\n\t\t//echo(\"<br>inside\");\n\t\t//print_r($c);\n\t\t//echo($x[$key].\" \".$y[$key]);\n\t\t//echo(\"inside is \".$this->inside($c, $x[$key],$y[$key]).\"<br>\");\n\t\t//print_r($x);\n\t\t//print_r($y);\n\t\t//echo($vi.\" \".$vj.\" \".$vk);\n\t\t//echo(\"<br> aaaa\");\n\t\t// if the circle is of a significant size and the point in question is inside the circle\n\t\t// then check which side of the directed vector the new point is\n if ($c->r > EPSILON && $this->inside($c, $x[$key],$y[$key]))\n {\n // the side function checks whether the point is to the left or right of the directed vector\n // 0 means it is on the left side\n if ($this->side($x[$vi],$y[$vi],$x[$vj],$y[$vj],$x[$vk],$y[$vk])==0)\n {\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n\n } elseif($this->side($x[$vk],$y[$vj],$x[$vj],$y[$vi],$x[$vi],$y[$vk])==0)\n {\n $edges[]=array($vk,$vj);\n $edges[]=array($vj,$vi);\n $edges[]=array($vi,$vk);\n\n } elseif($this->side($x[$vk],$y[$vi],$x[$vi],$y[$vj],$x[$vj],$y[$vk])==0)\n {\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n\n } elseif($this->side($x[$vj],$y[$vi],$x[$vi],$y[$vk],$x[$vk],$y[$vj])==0)\n {\n $edges[]=array($vj,$vi);\n $edges[]=array($vi,$vk);\n $edges[]=array($vk,$vj);\n\n } elseif($this->side($x[$vj],$y[$vk],$x[$vk],$y[$vi],$x[$vi],$y[$vj])==0)\n {\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n\n } elseif($this->side($x[$vi],$y[$vk],$x[$vk],$y[$vj],$x[$vj],$y[$vi])==0)\n {\n $edges[]=array($vi,$vk);\n $edges[]=array($vk,$vj);\n $edges[]=array($vj,$vi);\n\n } elseif($this->side($x[$vk],$y[$vk],$x[$vi],$y[$vi],$x[$vj],$y[$vj])==0)\n {\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n\n } elseif($this->side($x[$vj],$y[$vj],$x[$vk],$y[$vk],$x[$vi],$y[$vi])==0)\n {\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n $edges[]=array($vi,$vj);\n }\n else\n {\n \t\t//echo(\"<br>QQQQQQQQ no side!\");\n $edges[]=array($vi,$vj);\n $edges[]=array($vj,$vk);\n $edges[]=array($vk,$vi);\n }\n\t\t\t\t// unset destroys the specified variables\n unset($this->v[$vkey]);\n unset($this->complete[$vkey]);\n } else {\n \t//echo(\"<br>epsilon problem <br>\");\n }\n\treturn array($c,$edges);\n\t}\n}", "function CalcArcLength2() \n\t{\n\n\t\tglobal $N_inc;\n\t\t$inc = 1/$N_inc;\n\t\t$sum = 0;\n\t\t$t = 0;\n\t\t \n\t\tdo {\n\t\t\t$sum = $sum + (dArc_spherical($t) + dArc_spherical($t+1))/2;\n\t\t\t$t = $t + 1;\n\t\t} while ($t < $N_inc);\n\t\t\n\t\treturn $sum;\n\t}", "public function radius(): int;", "final public function perimeter(): float\n {\n return 4 * $this->length;\n }", "function Cosine($angle)\n{\n $cosine = cos(deg2rad($angle));\n return $cosine; \n}", "function Tangent($angle)\n{\n $tangent = tan(deg2rad($angle));\n return $tangent; \n}", "function triangle($max)\n{\n return $max * ($max + 1) / 2.0;\n}", "static public function cosJiriSlovak($uhel) {\n return cos($uhel);\n}", "public function testTrianglePerimeter()\n {\n $this->assertEquals($this->getShape()->getPerimeter(), 30);\n }", "function calculateAngle($hypotenuse)\n{\n\t$hypotenuse = defineCoords($hypotenuse);\n\t$adjacentLeg = $hypotenuse['maxX'] - $hypotenuse['minX'];\n\t$oppositeLeg = $hypotenuse['maxY'] - $hypotenuse['minY'];\n\treturn $angle = atan($adjacentLeg/$oppositeLeg);\n}", "function deg2rad ($number) {}", "public function calcArea()\n {\n return $this -> radius * $this -> radius * pi();\n }", "static function missing_length($r){//adj/opp/hyp \n$a=self::missing_angle($r);\nif(!$r[0])$r[0]=$r[2]*self::cosinus($a);\nif(!$r[1])$r[1]=$r[2]*self::sinus($a);\nif(!$r[2])$r[2]=$r[0]/self::cosinus($a);\nreturn $r;}", "static public function regular ($center, $sides, $radius, $bearingOffset = 0) {\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:28: lines 28-46\n\t\tif ($bearingOffset === null) {\n\t\t\t$bearingOffset = 0;\n\t\t}\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:29: characters 3-42\n\t\t$lat = ($center->arr[1] ?? null) * 0.0174532925199444439;\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:30: characters 3-44\n\t\t$long = ($center->arr[0] ?? null) * 0.0174532925199444439;\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:31: characters 3-30\n\t\t$sinLat = sin($lat);\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:32: characters 3-30\n\t\t$cosLat = cos($lat);\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:33: characters 3-36\n\t\t$sinRadius = sin($radius);\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:34: characters 3-36\n\t\t$cosRadius = cos($radius);\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:35: characters 3-30\n\t\t$bearingOffset *= 0.0174532925199444439;\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:37: lines 37-43\n\t\t$_g = new \\Array_hx();\n\t\t$_g1 = 0;\n\t\twhile ($_g1 < $sides) {\n\t\t\t$n = $_g1++;\n\t\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:38: characters 4-64\n\t\t\t$bearing = 6.28318530718 / $sides * $n + $bearingOffset;\n\t\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:39: lines 39-42\n\t\t\t$latitude = asin($sinLat * $cosRadius + $cosLat * $sinRadius * cos($bearing)) * 57.2957795130785499;\n\t\t\t$this1 = \\Array_hx::wrap([\n\t\t\t\t($long + atan2(sin($bearing) * $sinRadius * $cosLat, $cosRadius - $sinLat * $sinLat)) * 57.2957795130785499,\n\t\t\t\t$latitude,\n\t\t\t]);\n\t\t\t$_g->arr[$_g->length] = $this1;\n\t\t\t++$_g->length;\n\n\t\t}\n\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:44: characters 3-25\n\t\t$_g->arr[$_g->length] = ($_g->arr[0] ?? null);\n\t\t++$_g->length;\n\n\t\t#/Users/ut/haxe/haxe_libraries/geojson/0.9.7/haxelib/src/geojson/Polygon.hx:45: characters 10-31\n\t\t$this2 = new HxAnon([\n\t\t\t\"type\" => \"Polygon\",\n\t\t\t\"coordinates\" => \\Array_hx::wrap([$_g]),\n\t\t]);\n\t\treturn $this2;\n\t}", "private static function getRadiusOfEarth($phi) {\r\n $cphi = cos($phi);\r\n $sphi = sin($phi);\r\n $acphi = SpatialManager::$a * $cphi;\r\n $bsphi = SpatialManager::$b * $sphi;\r\n $aacphi = SpatialManager::$a * $acphi;\r\n $bbsphi = SpatialManager::$b * $bsphi;\r\n \r\n $num = $aacphi * $aacphi + $bbsphi * $bbsphi;\r\n $den = $acphi * $acphi + $bsphi * $bsphi;\r\n $frac = $num / $den;\r\n return sqrt($frac);\r\n }", "function GetNumCirc() {\n // Never return less than 1 circles\n $num = ceil($this->iMax / $this->iDelta);\n return max(1,$num) ;\n }", "function carpol($xyz){\n\n $R = vectorL2Norm($xyz);\n\n $lat = asin((array_sum(array_map(function($a,$b) { return $a*$b; }, array(0,0,1), $xyz)))/$R);\n\n $xy = $xyz;\n $xy[2]=0;\n $xy_norm = vectorL2Norm($xy);\n\n $xy=vectorDevidedByValue($xy,$xy_norm);\n $lon = atan2($xy[1], $xy[0]);\n\n $pol[0] = $lat;\n $pol[1] = $lon;\n\n return $pol;\n}", "public function getPerimeter():float ;", "public function getJunctionDepth()\n\t{\n\t\t$previousDifference = null;\n\t\t$previousGridPoint = null;\n\t\tforeach ($this->gridPoints as $i => $gridPoint)\n\t\t{\n\t\t\tif ($gridPoint->getMaterial() == 'SiO2') continue;\n\t\t\tif (is_null($previousGridPoint)) $previousGridPoint = $gridPoint;\n\t\t\t$difference = $previousGridPoint->getAcceptorConc() - $gridPoint->getDonorConc();\n\t\t\t\n\t\t\tif (!is_null($previousDifference))\n\t\t\t{\n\t\t\t\t//check to see if the signs are opposite\n\t\t\t\tif (\n\t\t\t\t\t($previousDifference > 0 && $difference < 0) \n\t\t\t\t\t|| ($previousDifference < 0 && $difference > 0)\n\t\t\t\t) {\n\t\t\t\t\t$x1 = $this->dx * ($i - 1);\n\t\t\t\t\t$x2 = $this->dx * ($i);\n\n\t\t\t\t\t//find intersection point!\n\t\t\t\t\t$p2 = $gridPoint->getAcceptorConc();\n\t\t\t\t\t$p1 = $previousGridPoint->getAcceptorConc();\n\t\t\t\t\t$n2 = $gridPoint->getDonorConc();\n\t\t\t\t\t$n1 = $previousGridPoint->getDonorConc();\n\n\t\t\t\t\t$mn = ($n1-$n2)/($x1-$x2);\n\t\t\t\t\t$mp = ($p1-$p2)/($x1-$x2);\n\n\t\t\t\t\t$bp = $p1 - $mp * $x1;\n\t\t\t\t\t$bn = $n1 - $mn * $x1;\n\n\t\t\t\t\t$xj = ($bp - $bn)/($mn - $mp);\n\t\t\t\t\treturn $xj ;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$previousDifference = $difference;\n\t\t\t$previousGridPoint = $gridPoint;\n\t\t}\n\t\treturn 'unknown';\n\t}", "function countgracepoint($n*$n)\r\n{\r\n $count = 0;\r\n for ($y = 1; $y * $y < $n*$n; $y++) {\r\n\r\n $x = (int)sqrt($n*$n - $y * $y);\r\n if ($y * $y + $x * $x == $n*$n) {\r\n\r\n $count++;\r\n\r\n }\r\n\r\n }\r\n $count *= 4;\r\n $y = (int)sqrt($n*$n);\r\n if ($y * $y == $n*$n) $count += 4;\r\n return $count;\r\n\r\n\r\n}", "function triangulo ($base,$altura) {\n\n return (($base*$altura)/2);\n\n}", "function dist($p0, $p1){\n\n $a = pow(sin(($p1[0] - $p0[0])/2),2) + cos($p0[0]) * cos($p1[0]) * pow(sin(($p1[1] - $p0[1])/2),2);\n $c = 2 * atan2(sqrt($a), sqrt(1-$a));\n $di = Re * $c;\n\n return $di;\n}" ]
[ "0.61142445", "0.5798018", "0.5797776", "0.5346758", "0.5278227", "0.5150358", "0.5055233", "0.49795994", "0.49588397", "0.49326807", "0.49275604", "0.48028192", "0.47407898", "0.46778494", "0.4672848", "0.46659958", "0.46513718", "0.46123502", "0.46069273", "0.4592069", "0.45766446", "0.45733365", "0.45583433", "0.45425004", "0.45358968", "0.45325753", "0.45264775", "0.44727045", "0.44688842", "0.44634026" ]
0.6138312
0
Assign the specified slot to the command for clustering distribution.
public function setSlot($slot);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setSlot($slot): void\n {\n $this->slot = $slot;\n }", "protected function move(NodeConnectionInterface $connection, $slot)\n {\n $this->pool[(string) $connection] = $connection;\n $this->slots[(int) $slot] = $connection;\n }", "protected function set_slot(\\bookking_slot $slot) {\n $this->add_record_snapshot('bookking_slots', $slot->data);\n $this->add_record_snapshot('bookking', $slot->get_bookking()->data);\n $this->slot = $slot;\n $this->data['objecttable'] = 'bookking_slots';\n }", "public function assignSlot($slotName, Slot $slot) {\n $this->slots[$slotName] = & $slot;\n }", "protected function fillslot ($slot_name, $slot_value) {\n\t\t$this->_config['slots'][$slot_name] = $slot_value;\n\t}", "public function store(Request $request,Slot $slot)\n { \n $slot->position_id = $request->position;\n $slot->save();\n $slot->nominees()->attach($request->nominees);\n\n return redirect(route('admin.slots.index'))->withSuccess(\n __('Slot successfully created.')\n );\n }", "public function getSlot(CommandInterface $command);", "public function setNewDigressOutSlots($val) {\n $this->_new_digress_out_slots = $val;\n }", "public function setCommand(string $command);", "public function useClusterSlots($value)\n {\n $this->useClusterSlots = (bool) $value;\n }", "public function slot($name)\n {\n $this->slot = $name;\n\n return $this;\n }", "public function reserveSlot()\n {\n app(LockerManager::class)->lockSlot($this);\n\n return $this->slot;\n }", "public function update(Request $request,Slot $slot)\n {\n $slot->position_id = $request->position;\n $slot->save();\n $slot->nominees()->sync($request->nominees);\n\n return redirect(route('admin.slots.index'))->withSuccess(\n __('Slot successfully updated.')\n );\n }", "public function setScreenSlot($newScreenSlot) {\n\t\t$newScreenSlot = filter_var($newScreenSlot, FILTER_VALIDATE_INT);\n\t\tif ($newScreenSlot === false) {\n\t\t\tthrow(new UnexpectedValueException(\"screen slot is not a valid integer\"));\n\t\t}\n\t\tif ($newScreenSlot <= 0) {\n\t\t\tthrow(new RangeException(\"screen slot is not positive\"));\n\t\t}\n\t\t$this->screenSlot = intval($newScreenSlot);\n\t}", "public function setCmd($cmd) { }", "public function setCommand($command);", "public function setCommand($command);", "public function setSlotNumber($slotNumber) {\r\n $this->slotNumber = $slotNumber;\r\n }", "protected function slot ($slot_name) {\n\t\tif (isset ($this->_config['slots'][$slot_name])) {\n\t\t\techo $this->_config['slots'][$slot_name];\n\t\t}\n\t}", "function setCommand($value) {\n $this->command = $value;\n }", "public function setCommand(Command $command);", "public function assignCommand(string $commandName): void\n {\n $this->assignedCommand = $commandName;\n }", "public function refreshSlot()\n {\n }", "function slot($name, $value = null)\n{\n $context = sfContext::getInstance();\n $response = $context->getResponse();\n\n $slot_names = sfConfig::get('symfony.view.slot_names', array());\n if (in_array($name, $slot_names))\n {\n throw new sfCacheException(sprintf('A slot named \"%s\" is already started.', $name));\n }\n\n if (sfConfig::get('sf_logging_enabled'))\n {\n $context->getEventDispatcher()->notify(new sfEvent(null, 'application.log', array(sprintf('Set slot \"%s\"', $name))));\n }\n\n if (null !== $value)\n {\n $response->setSlot($name, $value);\n\n return;\n }\n\n $slot_names[] = $name;\n\n $response->setSlot($name, '');\n sfConfig::set('symfony.view.slot_names', $slot_names);\n\n ob_start();\n ob_implicit_flush(0);\n}", "public function indexPut($indexName, $key, $rid)\n {\n $commandClass = $this->getCommandClass('index.put');\n $this->command = new $commandClass($indexName, $key, $rid);\n\n return $this->command;\n }", "public function set($name, $content)\n {\n $this->slots[$name] = $content;\n }", "public function setShopSlot($slotNum)\n\t{\n\t\t$this->setMethod('shop');\n\t\t$this->setProperty('slot', $slotNum);\n\t\treturn $this;\n\t}", "function drush_permissions_set() {\n $args = func_get_args();\n print var_dump($args);\n $perm = $args[0];\n $role = $args[1];\n if ($role && $perm && is_numeric($role)){\n db_query('DELETE FROM {permission} WHERE rid = %d', $role);\n db_query(\"INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')\", $role, $permissions);\n }\n\n print sprintf(\"Set rid %s permissions to '%s'\", $role, $permissions);\n}", "protected function guessNode($slot)\n {\n if (!isset($this->slotsMap)) {\n $this->buildSlotsMap();\n }\n\n if (isset($this->slotsMap[$slot])) {\n return $this->slotsMap[$slot];\n }\n\n $count = count($this->pool);\n $index = min((int) ($slot / (int) (16384 / $count)), $count - 1);\n $nodes = array_keys($this->pool);\n\n return $nodes[$index];\n }", "function setCommand($command) {\n\t\t$this->command = \"\" . $command;\n\t}" ]
[ "0.6107885", "0.5531484", "0.54427004", "0.5158125", "0.5088773", "0.5039693", "0.48277327", "0.47961658", "0.47207785", "0.47167155", "0.46407175", "0.45684367", "0.45352876", "0.4526404", "0.4519083", "0.45182768", "0.45182768", "0.45072398", "0.449165", "0.4467694", "0.44521138", "0.4416568", "0.4393391", "0.437355", "0.4355355", "0.43391103", "0.43275112", "0.43245742", "0.4318799", "0.42917427" ]
0.6236826
1
Sets the raw arguments for the command without processing them.
public function setRawArguments(array $arguments);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function rawCommand($command, ...$arguments) {}", "function clear_arguments( )\n\t{\n\t\t// don't clear query or db as we may use them later\n\t\t$this->line = false;\n\t\t$this->file_name = false;\n\t\t$this->error = false;\n\t\t$this->pass_query = false;\n\t}", "public function setCommandLineValues($args)\n {\n if (empty($this->values)) {\n $this->values = $this->getDefaults();\n }\n \n $this->_cliArgs = $args;\n $numArgs = count($args);\n \n for ($i = 0; $i < $numArgs; $i++) {\n $arg = trim($this->_cliArgs[$i]);\n if ($arg === '') {\n continue;\n }\n \n if ($arg{0} === '-') {\n if ($arg === '-' || $arg === '--') {\n // Empty argument, ignore it.\n continue;\n }\n \n if ($arg{1} === '-') {\n $this->processLongArgument(substr($arg, 2), $i);\n } else {\n $switches = str_split($arg);\n foreach ($switches as $switch) {\n if ($switch === '-') {\n continue;\n }\n $this->processShortArgument($switch, $i);\n }\n }\n } else {\n $this->processUnknownArgument($arg, $i);\n }\n }\n }", "public function setArguments($arguments) { }", "public function testSetArguments()\n\t{\n\t\t$this->object->setArguments(array('anything'));\n\t}", "private function setArgs(){\n\t\t\tif(isset($_GET)){\n\t\t\t\t$this->args = $_GET;\n\t\t\t} else if(isset($_POST)){\n\t\t\t\t$this->args = $_POST;\n\t\t\t} else if(isset($_PUT)){\n\t\t\t\t$this->args = $_PUT;\n\t\t\t} else {\n\t\t\t\t$this->args = Array();\n\t\t\t}\n\t\t}", "public function setArgs(&$args) {\n $this->args = $args;\n }", "function change_arguments( $args ) {\n //$args['dev_mode'] = true;\n\n return $args;\n }", "public function defArgCommand()\n {\n $this->output->dump($this->input->getArgs(), $this->input->getOpts(), $this->input->getBoolOpt('y'));\n }", "protected function setCliArguments() {\n\t\t$_SERVER['argv'] = array(\n\t\t\t$_SERVER['argv'][0],\n\t\t\t'tx_igldapssoauth_scheduler_synchroniseusers',\n\t\t\t'0',\n\t\t\t'-ss',\n\t\t\t'--sleepTime',\n\t\t\t$this->sleepTime,\n\t\t\t'--sleepAfterFinish',\n\t\t\t$this->sleepAfterFinish,\n\t\t\t'--countInARun',\n\t\t\t$this->countInARun\n\t\t);\n\t}", "public function setOptions(array $arguments): void\n {\n // Default Laravel console options we don't need.\n unset($arguments[\"help\"]);\n unset($arguments[\"quiet\"]);\n unset($arguments[\"verbose\"]);\n unset($arguments[\"version\"]);\n unset($arguments[\"ansi\"]);\n unset($arguments[\"no-ansi\"]);\n unset($arguments[\"no-interaction\"]);\n unset($arguments[\"env\"]);\n\n $this->options = $arguments;\n }", "public function setArguments(array $arguments);", "public function setArguments(array $arguments);", "public function setArguments(array $arguments);", "protected function handle_arguments() {\n\t}", "protected function preProcessArguments($arguments)\n {\n // Do nothing\n return $arguments;\n }", "public function initializeArguments()\n {\n $this->registerArgument('value', 'string', 'Value to be checked for changes.', false);\n $this->registerArgument('key', 'string', 'A key for which to check, whether the value has changed.', false);\n }", "public function setArgs($args = [])\n {\n $this->args = array_merge($this->args, $args);\n }", "public function setRoute() {\n\t\t// Collect all the arguments and lightly sanitize them\n\t\tforeach ($_POST as $k => $v) {\n\t\t\tif (!empty($v)) {\n\t\t\t\t$this->argv[$k] = htmlspecialchars($v);\n\t\t\t}\n\t\t}\n\t}", "protected function setArgs(array $args): void\n {\n $this->args = $this->setDefaultArgs($args);\n }", "public function __construct() {\n\t\t$args = func_get_args();\n\t\tif (1 == func_num_args() && is_string($args[0])) {\n\t\t\t$this->cmdArgs[] = $args[0];\n\t\t} else if (1 == func_num_args() && is_array($args[0])) {\n\t\t\t$this->cmdArgs = $args[0];\n\t\t} else if (2 == func_num_args() && is_string($args[0])) {\n\t\t\t$this->cmdArgs[] = $args[0];\n\t\t\tif (is_array($args[1]))\n\t\t\t\t$this->cmdArgs = array_merge($this->cmdArgs, $args[1]);\n\t\t\telse\n\t\t\t\t$this->cmdArgs[] = $args[1];\n\t\t} else {\n\t\t\t$this->cmdArgs = $args;\n\t\t}\n\t}", "public function set_arguments( array $args ): self {\n\t\t$this->arguments = $args;\n\t\treturn $this;\n\t}", "public function setArgs($args) {\n\t\t\t$this->args = (is_array($args))?$args:array($args);\n\t\t}", "public function setArguments($arguments = []): void\n {\n $this->arguments = $arguments;\n }", "public static function setDefaultArgs(array $args): void;", "function setArguments($value) {\n $this->arguments = $value;\n }", "function __construct($args) {\n $this->args = array();\n $this->extra = array();\n\n $source = &$this->args;\n for ($i=0; $i<sizeof($args); $i++) {\n // Any args that come after -- are considered extra args\n if ($args[$i] == '--') {\n $source = &$this->extra;\n continue;\n }\n $source[] = $args[$i];\n }\n }", "public function testArgumentsRewriting(): void\n {\n $isOverwritten = $this->command->getThird()->isIndicated();\n\n self::assertTrue($isOverwritten);\n }", "public function initializeArguments()\n {\n $this->registerArgument('keys', 'string', 'Additional keys separated using \"key1.key2.key3\" dot-notation.', true);\n $this->registerArgument('extKey', 'string', 'Extension Key provided as its package original name with the underscore.');\n }", "final public function setArguments(array $arguments = []): self\n {\n $this->_arguments = $arguments;\n\n return $this;\n }" ]
[ "0.6441888", "0.64033717", "0.59288824", "0.58433473", "0.5818252", "0.5787189", "0.5760199", "0.57427555", "0.5741845", "0.57117957", "0.5703795", "0.5673803", "0.5673803", "0.5673803", "0.5659278", "0.56492805", "0.5631588", "0.5629247", "0.5605015", "0.5586069", "0.55842775", "0.55818325", "0.55604374", "0.5537642", "0.55279887", "0.5515698", "0.54856604", "0.547303", "0.54704916", "0.54469806" ]
0.74091846
1
count record by title
function count_record_by_title($keywords,$lg) { $this->db->from('tblevent'); $this->db->like('Title', $keywords); $this->db->where(array('tblevent.Status'=>1,'lang'=>$lg)); $query = $this->db->count_all_results(); return $query; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function count_article_by_title($title = '') {\n\n $sintax = \"SELECT id FROM \" . $this->table . \" WHERE title = '$title'\";\n\n $query = $this->db->query($sintax);\n\n $result = $query->num_rows();\n\n return $result;\n\n }", "function load_all_title_call_count($title_call) {\r\n $this->db->select('id');\r\n $this->db->where('title_call', $title_call);\r\n $query = $this->db->get('structure_website_tree');\r\n $record = $query->row_array();\r\n // get count from structure_website_relations\r\n $this->db->where('id_tree', $record['id']);\r\n $this->db->from('structure_website_relations');\r\n return $this->db->count_all_results();\r\n }", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "abstract public function count(Record $record): int;", "public function findCountByTitle($albumTitle) {\n $queryText = 'SELECT COUNT(a) FROM \\Album\\Entity\\Album a WHERE \n a._title LIKE :title ';\n $query = $this->_em->createQuery($queryText); \n $query->setParameter(\"title\", \"{$albumTitle}\");\n $count = $query->getSingleScalarResult();\n return $count;\n }", "public function getCount();", "public function getCount();", "public function getCount();", "public function getCount();", "public function getCount();", "public function getCount();", "public function countBook(){\n\t\t\t\t\t $this->db->setTablename($this->tablename);\n return $this->db->getRows(array(\"return_type\"=>\"count\"));\n\t\t\t\t\t }", "public function countsTitle(SearchRequestor $objRequestor) : array {\n $objUri = new Uri();\n $strPath = self::ENDPOINT . '/counts/titles';\n return $this->execute($objRequestor, $objUri, $strPath);\n }", "public function getRecordCount();", "function countNews(){\n return $this->db->count_all($this->table);\n }", "function drlam_title_count($title)\n{\n\tif(strlen($title)<65)\n\t{\n\t\techo '<div class=\"alert alert-danger\">Count of Characters in Title = '.strlen($title).' < 65 !</div>';\n\t}\n\telseif(strlen($title)>71)\n\t{\n\t\techo '<div class=\"alert alert-danger\">Count of Characters in Title ='.strlen($title).' > 71 !</div>';\n\t}\n\telse\n\t{\n\t\techo '<div class=\"alert alert-success\">Count of Characters in Title Passed : 65 <= '.strlen($title).' <=71</div>';\n\t}\n\n}", "abstract public function countRecord(/** @scrutinizer ignore-unused */ ARecord $record): int;", "abstract public function get_Count();", "static public function search_count($score='',$post_title='',$post_type='',$keyword='',$post_date=''\r\n\t\t\t\t\t\t\t\t\t\t,$not_condition=0) {\r\n\t\t \tglobal $wpdb;\r\n\t\t\t$table = $wpdb->posts;\r\n\t\t \t\t\t\t\t\t\t\r\n\t\t\t// Initialize query\r\n\t\t\t$query = \"select count($table.ID)\";\r\n\t\t\t\r\n\t\t\t// Add common query\r\n\t\t\t$query_common_data = self::get_common_query($score,$post_title,$post_type,$keyword,$post_date,$not_condition); \r\n\t\t\t$query .= $query_common_data[0];\r\n\t\t\t\r\n\t\t\t// Prepare and Execute query\r\n\t\t\t$query = $wpdb->prepare($query,$query_common_data[1]);\r\n\t\t\t$total_rows = $wpdb->get_var($query);\r\n\t\t\t\r\n\t\t\treturn $total_rows;\r\n\t\t}", "public function count() {}", "public function count() {}" ]
[ "0.7542142", "0.6470246", "0.6402861", "0.6402861", "0.6402861", "0.6402861", "0.6402861", "0.6402861", "0.6402861", "0.6402861", "0.6402861", "0.6402861", "0.6394638", "0.6387522", "0.60606205", "0.60606205", "0.60606205", "0.60606205", "0.60606205", "0.60606205", "0.6057357", "0.6015428", "0.6001507", "0.59887314", "0.59849024", "0.59510607", "0.5940816", "0.59262073", "0.5923835", "0.5923835" ]
0.70667267
1
count record by keyword
function count_record_by_keywords($keywords,$lg) { $this->db->from('tblevent'); $this->db->like('Keywords', $keywords); $this->db->where(array('tblevent.Status'=>1,'lang'=>$lg)); $query = $this->db->count_all_results(); return $query; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function countFindData(string $keyword = ''): int\n {\n return $this->builder()\n ->select('id, name, description')\n ->groupStart()\n ->like('name', $keyword)\n ->orLike('description', $keyword)\n ->groupEnd()\n ->countAllResults();\n }", "function count_record_by_title($keywords,$lg)\n {\n $this->db->from('tblevent');\n $this->db->like('Title', $keywords);\n $this->db->where(array('tblevent.Status'=>1,'lang'=>$lg));\n $query = $this->db->count_all_results();\n return $query;\n }", "function search_total_rows($keyword = NULL) {\n $this->db->like('id_gejala', $keyword);\n $this->db->or_like('nama_gejala', $keyword);\n $this->db->from($this->table);\n return $this->db->count_all_results();\n }", "function count_record($searchkey = FALSE) {\n //$noofrecord = $this->db->count_all( 'tbl_deals' );\n\n if ($searchkey)\n $this->db->like('username', $searchkey);\n\n $this->db->from('employee');\n\n $noofrecord = $this->db->count_all_results();\n\n return $noofrecord;\n }", "public function record_count() \r\n\t{ \r\n\t\tif($this->search) \r\n\t\t{ \r\n\t\t\t$this->db->like('name',$this->search);\r\n\t\t\t$this->db->or_like('username',$this->search);\r\n\t\t\t$this->db->or_like('email',$this->search);\r\n\t\t}\r\n\r\n\t\treturn $this->db->count_all_results($this->table);\r\n\t}", "public function getPageListCountByKeyword($keyword)\n {\n \t$sMode = ' IN BOOLEAN MODE';\n $strParam = '+'.$keyword;\n if (strpos($keyword, ' ') === false) {\n $sMode = '';\n $strParam = $keyword;\n }\n\t\t$sql = \"SELECT COUNT(*) FROM site_page WHERE MATCH(title,body) AGAINST(?$sMode) \";\n $stmt = $this->_rdb->prepare($sql);\n $stmt->execute(array($strParam));\n\t\treturn $stmt->fetchColumn(0);\n }", "public function countQuery();", "function posts_search_count($search)\n\t{\n\t\t$this->db->select('*');\t\t\n\t\t$this->db->from(DB_PREFIX.'events');\n\t\t$this->db->like('ico_events.event_name',$search);\n\t\t$this->db->or_like('ico_events.event_link',$search);\n\t\t\n\t\t$query = $this->db->get();\n\t\treturn $query->num_rows();\n\t\t \n\t}", "public function getTotalCount($keyword) {\n\t\t$ret = 0;\n\t\t$session = $this->getSession();\n\t\t$user = $session->getUser();\n\t\tforeach ($user->getCourses() as $course) {\n\t\t\tif ($course->keywordEquals($keyword)) {\n\t\t\t\t$ret = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $ret;\n\t}", "public function findTotalMatches($keyword)\n {\n return 56;\n }", "public function countAllData($keywords = false){\n $optKeywords = $keywords != false ? \" AND CONCAT(IF(isnull(t1.title),' ',CONCAT(LOWER(t1.title),' '))) LIKE '%$keywords%'\" : \"\";\n\n\t\t$sql = \"SELECT COUNT(t1.id) AS total\n\t\t\t\tFROM homepages t1\n\t\t\t\tWHERE 1 = 1\n\t\t\t\t\".$optKeywords;\n\t\treturn $this->_db->select($sql);\n\t}", "public function countEntries($searchResult);", "abstract public function count(Record $record): int;", "static function countSearchData($name){\n\n $name = str_replace(\" \", \"%\", $name);$name=strtolower($name);\n $results = \\DB::select(\"\n SELECT count(*) as coun \n FROM \" . self::$productTableName . \" \n WHERE LOWER(TITULO) like '%\" . $name .\"%' \n \"); \n \n return $results[0]->coun;\n }", "abstract public function count($where = array());", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public function count();", "public static function countSearchData($search){\n $count = Websites::find()\n ->where(['like', 'keywords', '%' . $search . '%', false])\n ->orWhere(['like', 'title', '%' . $search . '%', false])\n ->orWhere(['like', 'url', '%' . $search . '%', false])\n ->count();\n\n return $count;\n }", "private static function _count($search) {\n return dbConnection()\n ->query(static::_generateQuery($search, \"COUNT(*) AS cnt\"))\n ->fetch_object()\n ->cnt;\n }", "public function getNumberOfMatchedResults($keywords, $lang = null, Doctrine_Query $query = null)\n {\n $query = $this->getQuery($query);\n $query = $this->getStandardSearchComponentInQuery($keywords, $lang, $query);\n $query->select('count(DISTINCT i.model) AS count');\n $r = $query->fetchArray();\n return count($r);\n }", "public function getQueryCount();", "public function getQueryCount();" ]
[ "0.7278782", "0.706659", "0.6892589", "0.66973245", "0.656592", "0.65585566", "0.6491219", "0.6397533", "0.63938355", "0.6383231", "0.6364916", "0.6351368", "0.6340709", "0.631884", "0.6308507", "0.6277642", "0.6277642", "0.6277642", "0.6277642", "0.6277642", "0.6277642", "0.6277642", "0.6277642", "0.6277642", "0.6277642", "0.6274751", "0.6272605", "0.62666786", "0.62661207", "0.62661207" ]
0.73416454
0
Delete list client records
public function deleteList() { $db = Db::connect(); $sql = "DELETE FROM clients"; $query = $db->prepare($sql); $query->execute(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteAllClient()\n {\n //supprimer tous les clients ayant le fournisseur X\n $db = Database::getInstance();\n /**Supprimer les clients **/\n $db->query(\"DELETE FROM Client WHERE fkidSupplier = ? \", array($this->_id));\n }", "function delete_client($data)\r\n{\r\n}", "function processClientDelete($params)\n {\n $this->delVirtualClient($params);\n\n exec(SCRIPTSPATH . \"/clientManageClientDest.sh \" . CLIENTHOSTFILE . \" del \" . $params[\"clientId\"]);\n\n exec(SCRIPTSPATH . \"/clientManageKey.sh delClient 0 \" . $params[\"clientId\"]);\n\n // remove the client data using the remote BluePortailLang\n if(!file_get_contents($this->callRemoteFunc($params[\"server\"], \"processClientDeleteData\", $params)))\n\t{\n\t syslog(LOG_ERR, \"BluePortailAdmin:processClientInsert cannot call processClientDeleteData\");\n\t} \n\n return array( array( $params[\"clientId\"] ) );\n }", "public function delete_list($params) {\n\t\t$request_url = \"{$this->url}&api_action=campaign_delete_list&api_output={$this->output}&{$params}\";\n\t\t$response = parent::curl($request_url);\n\t\treturn $response;\n\t}", "function deleteclientes(){\n $result = $this->M_Mysql->deleteclientes();\n $msg['success'] = false;\n $msg['type'] = 'add';\n if ($result) {\n $msg['success'] = true;\n }\n echo json_encode($msg);\n }", "public function clientDeleting($data){\n //Se obtiene el ID del cliente que se desea eliminar\n $this->db->select('client_id');\n $this->db->from('client');\n $this->db->where('client_name', $data['client_name']);\n $result = $this->db->get();\n $client_id = $result->row();\n \n //Se borra el cliente\n $this->db->where('client_id', $client_id->client_id);\n $this->db->delete('client', $data);\n \n //Y todos los productos que tenia ofrecidos\n $queryDeleteProduct =\"DELETE FROM product_client WHERE client_id = '\".$client_id->client_id.\"';\";\n $this->db->query($queryDeleteProduct);\n }", "public function deleteItems($delList){\n \ttry {\n \t\t$arrDelete = explode(',', $delList);\n \t\tforeach ($arrDelete as $key=>$value) {\n \t\t\t$where = array('md5(client_id) = ?' => $this->_CommonController->decodeKey($value));\n \t\t\t$this->delete($where);\n \t\t}\n \t} catch (Exception $e) {\n \t\t// pass possible exceptions to log file\n \t$this->_CommonController->writeLog($e->getMessage());\n \t}\n }", "function clientDelete()\r\n { \r\n \t$clientID= $this->input->post('id');//print_r($clientID);die;\r\n \t if(isset($clientID)&&!empty($clientID))\r\n \t { \r\n \t\t$clientID=$this->data['clientID']=$this->ClientModel->get(array('clientID'=>$clientID));\r\n \t\t$delete=$this->data['delete']=$this->ClientModel->delete(array('clientID'=>$this->input->post('id')));\r\n $client=$clientID[0]->clientID; \r\n $this->clientGetValue($client); \t\t\r\n \t }\r\n }", "public function deleteClientFromDB()\n {\n $this->model->deleteClientFromDB();\n header('location: index.php?controller=client');\n }", "public function deleteList(){\n $listId = Input::get('lid');\n $list = CardList::find($listId);\n foreach($list->cards as $card){\n $card->delete();\n }\n $response['success'] = $list->delete();\n return Response::json($response);\n }", "protected function deletelist() : \\mobilecms\\rest\\Response\n {\n $response = $this->getDefaultResponse();\n\n $this->checkConfiguration();\n\n // $pathId = $this->getParam('id');\n\n\n if ($this->requestObject->match(self::getUri() . '/cmsapi/deletelist/{type}')) {\n if ($this->requestObject->method === 'POST') {\n // save a record and update the index. eg : /mobilecmsapi/v1/content/calendar\n\n\n // step 1 : update Record\n\n\n $putResponse = $this->getService()->deleteRecords(\n $this->getParam('type'),\n json_decode($this->getRequestBody())\n );\n $myobjectJson = $putResponse->getResult();\n unset($putResponse);\n // step 2 : publish to index\n unset($myobjectJson);\n $response = $this->getService()->rebuildIndex($this->getParam('type'), self::ID);\n }\n }\n\n\n return $response;\n }", "public function runDelete()\r\n\t{\r\n\t\t$dbh = $this->dbh;\r\n\r\n\t\tforeach ($this->ids as $cid)\r\n\t\t{\r\n\t\t\t$cust = CAntObject::factory($dbh, \"customer\", $cid, $this->user);\r\n\t\t\t$cust->remove();\r\n\t\t}\r\n\t}", "public function testDeleteList()\n\t{\n\t\t$this->markTestIncomplete();\n\t}", "public function actionDeleteList()\n {\n $ids = Yii::$app->request->post('ids');\n $success = false;\n\n if (!empty($ids)) {\n foreach ($ids as $id) {\n $model = $this->findModel($id);\n $success = $model->delete();\n }\n }\n\n Yii::$app->response->format = Response::FORMAT_JSON;\n return [\n 'success' => $success,\n ];\n }", "public function deleteClienteAll(){\r\n foreach ($this->_chkdel as $value) {\r\n $query = \"call sp_perAnularCliente(:flag, :idPersona);\";\r\n $parms = array(\r\n 'flag'=>1,\r\n ':idPersona' => Aes::de($value)\r\n );\r\n $this->execute($query,$parms);\r\n }\r\n $data = array('result'=>1);\r\n return $data;\r\n }", "public function action_delete()\n\t{\n\t\t$client = Model::factory('Client');\n\t\t$id = $this->request->param('id');\n\t\t\n\t\tif(!$client->exists($id)) {\n\t\t\tthrow HTTP_Exception::factory(404, 'File not found!');\n\t\t}\n\t\t\n\t\t$data = $client->load($id, array('name'));\n\t\t$rs = $client->delete($id);\n\t\t\n\t\tif($rs) {\n\t\t\tLasku::flash(\"Client {$data['name']} is deleted.\");\n\t\t\t$this->redirect($this->request->referrer());\n\t\t}\n\t\telse {\n\t\t\tLasku::flash(\"Error when deleting {$data['nanem']}.\", Lasku::FLASH_ERROR);\n\t\t\t$this->redirect($this->request->referrer());\n\t\t}\n\t}", "function processClientDeleteData($params)\n {\n exec(SCRIPTSPATH . \"/clientDelete.sh \" . $params[\"clientId\"]);\n return array( $params );\n }", "public function delete() {\n //TODO: preguntar si desea eliminar tambien los contactos de la lista\n $this->load->auto('marketing/list');\n if (($this->request->server['REQUEST_METHOD'] == 'POST')) {\n foreach ($this->request->post['selected'] as $id) {\n $this->modelList->delete($id);\n }\n } else {\n $this->modelList->delete($_GET['id']);\n }\n }", "public function delete()\n {\n $customers_to_delete = $this->input->post('ids');\n\n if ($this->Customer->delete_list($customers_to_delete)) {\n echo json_encode(['success' => true, 'message' => $this->lang->line('customers_successful_deleted').' '.\n count($customers_to_delete).' '.$this->lang->line('customers_one_or_multiple'), ]);\n } else {\n echo json_encode(['success' => false, 'message' => $this->lang->line('customers_cannot_be_deleted')]);\n }\n }", "function deleteStudentList()\n {\n $GLOBALS['DB']->exec(\"DELETE FROM courses_students WHERE course_id = {$this->id};\");\n }", "public function deleted(Lists $lists)\n {\n //\n }", "public function deleteRecords($data){\n\t \tif (count($data)) \t{\n\t \t\t$keysArr = array();\n\t \t\t$keysArr = array_keys($data);\n\t \t\tforeach ($keysArr as $markerID){\n\t \t\t\tCuepointRecord::finder()->deleteByPk($markerID);\n\t \t\t}\n\t \t}\n\t }", "public function clientDestroy($client)\n {\n $delete = User::where('id','=', $client)->delete();\n\t\t$delete_all_orders = Order::where('costumer', '=', $client)->delete();\n return Redirect::back()->with('error', \"Клиент удален, как и все его заказы!\")->withInput();\n }", "public function deleteSelection($list)\n {\n }", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();" ]
[ "0.7072249", "0.68309194", "0.68091786", "0.6741057", "0.6696001", "0.6679431", "0.66718876", "0.6662281", "0.66585785", "0.66437685", "0.6642669", "0.6601887", "0.6449959", "0.6427722", "0.63917416", "0.6383678", "0.6358464", "0.6348427", "0.63423693", "0.63404286", "0.6330202", "0.63122845", "0.6309744", "0.6299281", "0.6291683", "0.6291683", "0.6291683", "0.6291683", "0.6291683", "0.6291683" ]
0.8129846
0
/ qsCategoryList List of question category
public function qsCategoryList() { $data['pageTitle'] = __('Category List'); $data['menu'] = 'category'; $data['categories'] = Category::orderBy('serial', 'ASC')->whereNull('parent_id')->get(); return view('admin.category.list', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getCategoryList()\n\t{\n\t\t$query = self::query();\n\t\treturn $query;\n\t}", "public function listCategory()\n {\n return Category::all();\n }", "function get_questions_category( $category, $noparent=false ) {\n\n global $QUIZ_QTYPES;\n\n // questions will be added to an array\n $qresults = array();\n\n // build sql bit for $noparent\n $npsql = '';\n if ($noparent) {\n $npsql = \" and parent='0' \";\n }\n\n // get the list of questions for the category\n if ($questions = get_records_select(\"quiz_questions\",\"category={$category->id} $npsql\", \"qtype, name ASC\")) {\n\n // iterate through questions, getting stuff we need\n foreach($questions as $question) {\n $questiontype = $QUIZ_QTYPES[$question->qtype];\n $questiontype->get_question_options( $question );\n $qresults[] = $question;\n }\n }\n\n return $qresults;\n}", "public function question_categories()\n {\n return $this->hasMany(QuestionCategory::class);\n }", "public function getCategoryList()\n {\n ProductCategory::all()->lists('categoryName', 'id');\n }", "public function getCategoryList(){\n \n $options = array(\n 'order' => array(\n 'Category.name' => 'asc'\n )\n );\n \n return $this->find('list',$options);\n \n \n }", "public function index()\n {\n return questionaireCategory::all();\n }", "public static function getFaqCategories()\n\t{\n\t\treturn array('0'=>'General', '1'=>'Student', '2'=>'Tutor');\n\t}", "public function categoryQuestionList($cat_id)\n {\n $data['pageTitle'] = __('Category Question List');\n $data['catName'] = Category::where('id', $cat_id)->first()->name;\n $data['menu'] = 'category';\n $data['items'] = Question::orderBy('id', 'DESC')->where('category_id', $cat_id)->get();\n\n return view('admin.question.cat-qs-list', $data);\n }", "public static function getAllCategory(){\n \treturn self::orderby('wordingCategory')\n \t\t\t\t->get(['wordingCategory']);\n }", "public function getCategories();", "public function getCategories();", "public function getCategories();", "public function getCategories();", "public function categoryList() {\n $categories = self::$cache->get_value('forums_categories');\n if ($categories === false) {\n self::$db->prepared_query(\"\n SELECT fc.ID,\n fc.Name\n FROM forums_categories fc\n ORDER BY fc.Sort,\n fc.Name\n \");\n $categories = self::$db->to_pair('ID', 'Name');\n self::$cache->cache_value('forums_categories', $categories, 0);\n }\n return $categories;\n }", "public function getAllCategories()\r\n\t{\r\n\t\t$sql = \"select id, questions, catName\".$this->lang.\" as catName \r\n\t\t\t\tfrom categories\r\n\t\t\t\torder by (case when (catNameAz like '%Digər%') then 'яяяяяя' else catName end)\";\r\n\t\treturn $this->db->rawQuery($sql);\r\n\t}", "public function getAllCategories();", "public function getCategories()\n {\n return Category::all();\n }", "private function getCategoriesChoices()\n {\n $ret = [];\n\n foreach (NoteEntity::$categories as $categoryId => $cagtegoryTrqnslationKey) {\n $ret['form.category.entries.' . $cagtegoryTrqnslationKey] = $categoryId;\n }\n\n return $ret;\n }", "public function actionIndex()\n {\n $searchModel = new QuestionsCategoriesSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public static function getListFilterCategory() {\n $rs = Yii::app()->cache->get('ext_getListFilterCategory');\n if ($rs === false) {\n $sql = 'SELECT `id`, `name`, `parentId` FROM `tbl_category` WHERE `isHidden` = 0 AND `isPrice` = 1 ORDER BY `order` DESC, `name` ASC';\n $command = Yii::app()->db->createCommand($sql);\n $rs = $command->queryAll();\n Yii::app()->cache->set('ext_getListFilterCategory', $rs, 600);\n }\n $listCategory = array('0' => ' __ Chọn danh mục __ ');\n if (is_array($rs)) {\n foreach ($rs as $key => $value) {\n if ($value['parentId'] == 0) {\n $listCategory[$value['id']] = '_ ' . $value['name'];\n foreach ($rs as $key2 => $value2) {\n if ($value2['parentId'] == $value['id']) {\n $listCategory[$value2['id']] = '- - - - - ' . $value2['name'];\n }\n }\n }\n }\n }\n return $listCategory;\n }", "public function findAllQuestions($category)\n {\n return $this->getEntityManager()\n ->createQuery(\n 'SELECT p FROM AdminMaintenanceBundle:Questions p\n WHERE p.c = :c_id\n ORDER BY p.id ASC' \n )->setParameter('c_id', $category)\n ->getResult(); \n }", "public static function getCategoriesList()\n {\n SpotifyPagination::setHasPagination(true);\n return [\n 'requestType' => 'GET',\n 'uri' => self::GET_CATEGORIES_LIST,\n ];\n }", "public function getCategoryList()\n {\n\t\t$countries = $this->_dbCategory::orderBy('category_text', 'asc')->get();\n\n\t\treturn $countries;\n }", "function quizumba_the_category_list() {\n\n\tif ( ! quizumba_categorized_blog() )\n\t\treturn;\n\n\t/* translators: used between list items, there is a space after the comma */\n\t$category_list = get_the_category_list( __( ', ', 'quizumba' ) );\n\n\tif ( $category_list ) : ?>\n\t\t<div class=\"cat-links icon-folder\">\n\t\t\t<?php echo $category_list; ?>\n\t\t</div>\n\t<?php\n\tendif; // if $category_list\n\n}", "function &getCategories()\r\n {\r\n $ret = array();\r\n // Create an instance of the xhelpFaqCategoryHandler\r\n $hFaqCategory =& xhelpGetHandler('faqCategory');\r\n\r\n // Get all the categories for the application\r\n $hSmartCategory =& smartsection_gethandler('category');\r\n $categories =& $hSmartCategory->getCategories(0,0,-1);\r\n\r\n //Convert the module specific category to the\r\n //xhelpFaqCategory object for standarization\r\n foreach ($categories as $category)\r\n {\r\n $faqcat = $hFaqCategory->create();\r\n $faqcat->setVar('id', $category->getVar('categoryid'));\r\n $faqcat->setVar('parent', $category->getVar('parentid'));\r\n $faqcat->setVar('name', $category->getVar('name'));\r\n $ret[] = $faqcat;\r\n }\r\n unset ($categories);\r\n ksort($ret);\r\n return $ret;\r\n }", "function getCategorysQuery(Query $q = null) {\n\t\treturn $this->getForeignObjectsQuery('category', 'userId','id', $q);\n\t}", "private function getAllCategories()\n {\n return Category::find()->all();\n }", "public function categories()\n {\n return CategoryResource::collection(Category::all(), 200);\n }", "public function getCategories(Question $question)\n {\n $categories = $question->getCategory()->getValues();\n\n $data = array();\n\n foreach ($categories as $category) {\n $data[] = $category->getTitle();\n }\n\n return $data;\n }" ]
[ "0.6942162", "0.6846046", "0.67835104", "0.6781155", "0.6727145", "0.6690323", "0.6665876", "0.6595126", "0.6505413", "0.6473175", "0.64638895", "0.64638895", "0.64638895", "0.64638895", "0.64324135", "0.63822764", "0.6367353", "0.63636994", "0.63512266", "0.6320896", "0.6316432", "0.6315797", "0.6294314", "0.6279828", "0.6270077", "0.6258037", "0.6235709", "0.6235389", "0.6230973", "0.6228865" ]
0.72550404
0
/ qsCategoryCreate Question category create page
public function qsCategoryCreate() { $data['pageTitle'] = __('Add Category'); $data['menu'] = 'category'; $data['parentCategories'] = Category::whereNull('parent_id')->get(); return view('admin.category.add', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionCreate()\n {\n $model = new QuestCategory();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'Question_ID' => $model->Question_ID, 'Category_ID' => $model->Category_ID]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new QuestionsCategories();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['index']);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function create()\n {\n return view('admin.questionCategories.create');\n }", "public function createCategory();", "public function NewCategoryAction() {\r\n $this->loadLayout();\r\n $this->_setActiveMenu('crmticket');\r\n $this->getLayout()->getBlock('head')->setTitle($this->__('New category'));\r\n $this->renderLayout();\r\n }", "public function action_create() {\n $repo = new Repository_ProductCategory();\n $parents = $repo->getAll();\n \n $view = View::factory('product/category')->set('parents', $parents);\n $this->template->title = __('Create Product Category');\n $this->template->content = $view;\n }", "public function create()\n {\n return view('backend.pages.category.create-category');\n \n }", "public function create()\n {\n return view('posts::category_create')\n ;\n }", "public function actionCreate()\n {\n $model = new FaqCategory();\n\n $models = [new Faq()];\n\n $dform = new SDFormWidget([\n 'model' => $model,\n 'models' => $models,\n 'modelsAttributes' => ['category_id' => $model->id],\n 'modelClass' => Faq::class,\n 'sortAttribute' => 'sort',\n 'deleteOldModels' => true,\n ]);\n\n if($dform->save() ){\n return $this->redirect('index');\n }\n\n return $this->render('create', [\n 'model' => $model,\n 'models' => $models,\n ]);\n }", "public function create() {\n return view('admin.faqcategorys.create');\n }", "public function create()\n {\n\n\n $category_faqs=Category_faq::all();\n\n return view('admin.admin-faq.questions.question',compact('category_faqs'));\n }", "public function create()\n {\n return view('faq_categories.create');\n }", "public function create() {\n global $category;\n\n if ( isset( $_POST[ 'mm_category' ] ) ) {\n if ( !wp_verify_nonce( $_POST[ 'mm_nonce' ], 'add_category' ) ) die( __( \"Security check\", MM_TEXTDOMAIN ) );\n $category = new Goods_Types_Model();\n $category->set_fields( $_POST[ 'mm_category' ] );\n if ( $category->validate() ) {\n $category->save();\n $this->set_message( __( 'Category saved', MM_TEXTDOMAIN ) );\n wp_redirect( 'admin.php?page='.$this->categories_page );\n exit;\n }\n else {\n $this->set_message( __( 'Error saving category', MM_TEXTDOMAIN ) );\n }\n }\n }", "public function show_create_category_page() {\n global $category;\n\n if ( $category == null ) {\n $category = new Goods_Types_Model();\n }\n\n //we need all categories for building parent categories list\n $categories = Goods_Types_Model::get_all_categories();\n\n $this->render( MM_DIR . '/views/category_create_page.php'\n , array(\n 'page_name' => $this->categories_page,\n 'category' => $category,\n 'categories' => $categories,\n )\n );\n }", "public function create()\n {\n return view('admin.pages.category.create');\n\n }", "public function create()\n {\n\n $categories = FaqCategory::all()->pluck('category', 'id')->prepend(trans('global.pleaseSelect'), '');\n\n return view('admin.faqQuestions.create', compact('categories'));\n }", "public function create()\n {\n return view('pabcontacts.categories.category_create');\n }", "public function create(){\n \treturn view('admin.category.create');\n }", "public function create()\n {\n Session::put('admin_page', 'pcategory');\n return view('backend.shop.product-categories.create');\n }", "public function create()\n {\n $last_record = Question::orderBy('sort', 'desc')->first();\n $sort = $last_record->sort + 1;\n $questions = Question::all();\n $categories = QuestionCategory::all();\n return view('backend.admin.features.questions.create',compact('sort','categories','questions'));\n }", "public function AddCategoryAction() {\r\n\r\n $html = $this->getLayout()->createBlock('CrmTicket/Admin_Category_New')->setTemplate('CrmTicket/Category/New.phtml')->toHtml();\r\n\r\n $this->getResponse()->setBody($html);\r\n }", "public function create()\n {\n \n $htmlOption = $this->getCategory($parent_id = '');\n return view('admin.modules.category.create',compact('htmlOption'));\n }", "public function create()\n {\n $macros = Macrocategory::all();\n\n $params = [\n 'form_name' => 'form_create_category',\n 'macros' => $macros\n ];\n return view('cms.category.create',$params);\n }", "public function create()\n {\n\t\t$js = [Module::asset(\"terms:js/post.js\")];\n\t\tView::share('js_script', $js);\n return view('terms::backend.create',array(\"title\" => \"Create Category\"))->with(array(\"options_values\" => $this->options_values));\n }", "public function create(){\n return view('admin.category.create');\n }", "public function create()\n {\n //\n return view('admin.category.create');\n }", "public function create()\n {\n //\n return view('admin.category.create');\n }", "public function create()\n {\n return view(\"dashboard/categories/create_category\");\n }", "public function create()\n {\n return view('backend.admin.Blog.category.create');\n }", "public function create()\n {\n //\n return view('categories.create_category');\n }" ]
[ "0.76156765", "0.75345874", "0.7463991", "0.7021674", "0.7005245", "0.699707", "0.6934419", "0.691021", "0.6882465", "0.6846546", "0.6823869", "0.67878574", "0.67859596", "0.67580116", "0.67371464", "0.67368084", "0.6732081", "0.67266774", "0.67070335", "0.67062306", "0.66992795", "0.6693734", "0.6680977", "0.66736215", "0.66640085", "0.66547936", "0.66547936", "0.66456133", "0.66424567", "0.66422564" ]
0.76716536
0
/ qsSubCategoryCreate Question sub category create page
public function qsSubCategoryCreate($id) { try { $id = decrypt($id); } catch (\Exception $e) { return redirect()->back(); } $category = Category::findOrFail($id); if (isset($category)) { $data['pageTitle'] = __('Add Sub Category Of ').$category->name; $data['menu'] = 'category'; $data['parentCategories'] = Category::whereNull('parent_id')->get(); $data['parentId'] = $category; return view('admin.category.add', $data); } else { return redirect()->back(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function qsCategoryCreate()\n {\n $data['pageTitle'] = __('Add Category');\n $data['menu'] = 'category';\n $data['parentCategories'] = Category::whereNull('parent_id')->get();\n\n return view('admin.category.add', $data);\n }", "public function create()\n {\n $categories=Category::all();\n return view('backend.admin.categories.subCategory.create',compact('categories'));\n }", "public function createCategoryOrSubCategory(){\r\r\n\t\t$message = \"fail\";\r\r\n\t\t$table = \"category\";\r\r\n\t\t$data = array();\r\r\n\t\t$returned = false;\r\r\n\t\t$level = \"categoryList\";\r\r\n\t\t\r\r\n\t\tif($_POST['data']['category'] != \"\") $table = \"subcategory\";\r\r\n\t\t\t\r\r\n\t\t//check if category or sub category with same name already exist\r\r\n\t\tif($this->create_and_edit_model->nameExist($_POST['data']['name'], \"name\", $table) == 0){\r\r\n\t\t\t$titleId = $this->create_and_edit_model->getId($_POST['data']['title'], \"title\");\r\r\n\t\t\tif($_POST['data']['category'] == \"\") $data['titleId'] = $titleId; \r\r\n\t\t\t\r\r\n\t\t\t$isRangedFlag = checkTitleIsRanged($_POST['data']['title']);\r\r\n\t\t\tif($isRangedFlag == 1) $data['condition'] = $_POST['data']['isRanged'];\r\r\n\t\t\telse if($isRangedFlag == false) $message = \"fail\";\r\r\n\t\t\t\r\r\n\t\t\t//check whether creating new category or sub category condition matches create sub catgeory\r\r\n\t\t\tif($_POST['data']['category'] != \"\"){\r\r\n\t\t\t\t$categoryId = $this->create_and_edit_model->getId($_POST['data']['category'], \"category\");\r\r\n\t\t\t\t$data['categoryId'] = $categoryId;\r\r\n\t\t\t\t$level = \"sub-categoryList\";\r\r\n\t\t\t}\r\r\n\t\t\t\t\r\r\n\t\t\t$data['name'] = removeSpecialChar($_POST['data']['name']);\r\r\n\t\t\t$data['status'] = ($_POST['data']['isEnabled'] == \"1\")?true:false;\r\r\n\t\t\t\r\r\n\t\t\tdate_default_timezone_set('America/New_York');\r\r\n\t\t\t$data['creationDate'] = date(\"Y-m-d\");\r\r\n\t\t\t\r\r\n\t\t\t$returned = $this->create_and_edit_model->saveCategoryOrSubCategory($data, $table);\r\r\n\t\t\tif($returned != false) $message = \"success\";\r\r\n\t\t\t\r\r\n\t\t}else $message = \"exist\";\r\r\n\t\t\r\r\n\t\techo json_encode(array(\"msg\" => $message, \"id\" => $returned, \r\r\n\t\t\t\t\"level\" => $level, \"actingOn\" => ucwords($table) ));\r\r\n\t}", "public function create()\n\t{\n\t\treturn View::make('subcategories.create');\n\t}", "public function actionCreate()\n {\n $model = new Subcategory();\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n Yii::$app->session->setFlash('success', 'Subcategory Created');\n return $this->redirect('/subcategory/');\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function create()\n {\n $categories = DB::table('categories')->lists('name', 'id');\n return view('admin/SubCategory/create', ['title_for_layout' => 'Add Sub Category', 'categories' => $categories]);\n }", "public function create()\n {\n $categories = Category::get();\n return view('admin.sub_category.create',compact('categories'));\n }", "public function subcategoryAdd(){\n return view('admin.category.add_subcategory',[\n 'categories' => Category::all()\n ]);\n }", "public function AddSubCategory()\r\n\t{\r\n\t\t$data['cat_list']=$this->get_all_categories();\r\n\t\t$data['script']=\"SubCategory/add_subcatScript\";\r\n\t\t$data['vw']=\"SubCategory/Add_SubCategory\";\r\n\t\t$this->load->view('vDetails',$data);\r\n\t}", "public function create()\n {\n $parent = Category::all();\n\n return view(\"admin.category.subcategory.create\",compact(\"parent\"));\n }", "public function admin_add_sub_category($parent_id=null) {\n\t\tif(!empty($this->request->data)){ //pr($this->request->data);die;\n\t\t\t$saveData['parent_id'] = $this->request->data['Category']['parent_id'];\n\t\t\t$saveData['name'] = ucwords(trim($this->request->data['Category']['name']));\n\t\t\t$saveData['alias_name'] = $this->Fp->parseParameter($saveData['name']);\n\t\t\t$saveData['status'] = $this->request->data['Category']['status'];\n\t\t\tif($this->Category->save($saveData)){\n\t\t\t\t//update the counter of parent category\n\t\t\t\t$this->Fp->incrementField('Category', 'count', '+', $saveData['parent_id']);\n\t\t\t\t$this->Session->setFlash(__('Sub-Category Added Successfully!!', true), 'message', array('class'=>'message-green'));\n\t\t\t\t$this->redirect('/admin/categories/sub_categories_manage/'.$saveData['parent_id'].'/');\n\t\t\t}else{\n\t\t\t\t$this->Session->setFlash(__('Please Try Later!!', true), 'message', array('class'=>'message-red'));\n\t\t\t\t$this->redirect('/admin/categories/manage/');\n\t\t\t}\n\t\t}\n\n\t\tif($parent_id != '')\n\t\t\t$this->request->data['Category']['parent_id'] = $parent_id;\n\t}", "public function create()\n {\n $categories = Category::orderBy('id','desc')->get();\n return view('backend.subCategory.create',compact('categories'));\n }", "function functionAddCategorySubcategory($postedArray){\n\t\tglobal $db;\n\t\textract($postedArray);\n\t\t$category_name\t= (isset($category_name))?trim(addslashes($category_name)):'';\n\t $parent_id\t = (isset($parent_id))?trim($parent_id):'0';\n\t $description = (isset($description))?trim(addslashes($description)):'';\n\t\t$is_active\t = (isset($is_active))?trim($is_active):'0';\n\t\t$sql\t= \"insert into `category` SET `category_name`='\".mysql_real_escape_string($category_name).\"', `description`='\".mysql_real_escape_string($description).\"', `parent_id`='\".$parent_id.\"', `is_active`='\".$is_active.\"', `date`='\".CURRENT_DATE.\"' \";\n\t\treturn $insertResult = $db->insert($sql, $db->conn);\n\t}", "function todosCreateSubCats($cat_pid,$subcats){\n $td_class = EO_CLASS_SUBCAT;\n $ret = todosLinkRecs($cat_pid,$td_class,$subcats,'','directory');\n return($ret);\n}", "public function create()\n {\n\n $categories = Category::all();\n\n return view('admin.subcategories.add')->with('cats', $categories);\n }", "public function subCategoryAction()\n {\n\n $id = $this->_getParam('id');\n $categoryTable = Engine_Api::_ ()->getDbTable ( 'categories', 'company' );\n $categorySelect = $categoryTable->select ()->where ( 'parent_id = ?', $id);\n $category = $categoryTable->fetchAll ( $categorySelect );\n $this->view->parent_id = $id;\n $this->view->categories = $category;\n }", "public function create()\n {\n return view('admin.categories.sub.create')\n ->with('online_user_count',Helper::getOnlineUsersCount())\n ->with('global_categories',GlobalCategory::orderBy('title','asc')->where('active',1)->get());\n }", "public function create()\n {\n $categories = Category::all();\n $brands = Brand::all();\n return view($this->_mainpages . 'subsubcategories.create', compact('categories', 'brands'));\n }", "public function createSubCategoryDropDown(){\r\r\n\t\t$currentSubCategory = $_POST['currentValue'];\r\r\n\t\t$category = $_POST['category'];\r\r\n\t\t\t\r\r\n\t\t//getting category id of category name\r\r\n\t\t$categoryId = $this->create_and_edit_model->getCategoryId($category);\r\r\n\t\t\r\r\n\t\t$SubcategoryList = $this->create_and_edit_model->getSubCategoryList($categoryId);\r\r\n\t\t\r\r\n\t\t$dropdownElement = \"<select id='sub-category' required='required'><option value='none'> No Sub Category </option>\";\r\r\n\t\t\r\r\n\t\tfor($i=0; $i<count($SubcategoryList); $i++){\r\r\n\t\t\t$dropdownElement .= \"<option value='\".$SubcategoryList[$i].\"' \"; \r\r\n\t\t\t\r\r\n\t\t\tif($currentSubCategory == $SubcategoryList[$i])\r\r\n\t\t\t\t$dropdownElement .= \" selected='selected' \";\r\r\n\t\t\t\r\r\n\t\t\t//if there is no subcategory to replace\r\r\n\t\t\tif($currentSubCategory == \"\" && $i==1)\r\r\n\t\t\t\t$dropdownElement .= \" selected='selected' \";\r\r\n\t\t\t\t\r\r\n\t\t\t$dropdownElement .= \">\".$SubcategoryList[$i].\"</option>\";\r\r\n\t\t}\r\r\n\t\t\r\r\n\t\t$dropdownElement .= \"</select>\";\r\r\n\t\t\r\r\n\t\t$dataArray = array(\"dataString\" => $dropdownElement);\r\r\n\t\techo json_encode($dataArray);\r\r\n\t}", "public function create()\n {\n $cats = DB::select(\"SELECT id,category_name FROM categories\");\n return \\View::make(\"Pos/NewSubCategory\",[\"cats\"=>$cats]);\n }", "public function create()\n {\n //\n $subCategory = SubCategory::get();\n return view('forms.createPost', ['subCategory' => $subCategory]);\n }", "public function create() {\n $categories = DB::table('categories')->orderBy('name')->pluck('name', 'id')->toArray();\n return view('sub_categories.create',compact('categories'));\n }", "public function create() {\n $data= CategoryModel::where('status',1)->get();\n return view('admin.pages.subcategory.add_subcategory')->with('data',$data);\n }", "public function store(CreateSubCategoryRequest $request)\n {\n $input = $request->all();\n $input['merchant_id'] = auth()->guard('merchant')->id();\n $input['code'] = $this->generateRandomCode();\n\n $input['status'] =1;\n\n /** @var SubCategory $subCategory */\n $subCategory = SubCategory::create($input);\n\n\n return redirect(route('subCategories.index'))->with('success_msg', trans('merchantDashbaord.added_successfully'));\n }", "public function create()\n {\n $categories=Category::where('parent',0)->get()->map(function($query){\n $query->sub=$this->getChildCategories($query->id);\n return $query;\n\n });\n return view('admin.category.create',compact('categories'));\n }", "public function action_create() {\n $repo = new Repository_ProductCategory();\n $parents = $repo->getAll();\n \n $view = View::factory('product/category')->set('parents', $parents);\n $this->template->title = __('Create Product Category');\n $this->template->content = $view;\n }", "function cfcpt_cat_table($parent_cat) {\n\t\tglobal $cfcpt_post_types, $page_vars;\n\t\t\n\t\t// grab the special categories\n\t\t$cats = get_categories(array(\n\t\t\t\t\t'child_of' => $parent_cat->cat_ID,\n\t\t\t\t\t'parent' => $parent_cat->cat_ID,\n\t\t\t\t\t'hide_empty' => false\n\t\t\t\t));\n\t\t// prep\n\t\textract($page_vars);\n\t\t$urlbase = trailingslashit(get_bloginfo('wpurl')).'wp-admin/';\n\t\t$categories_admin = admin_url('edit-tags.php?taxonomy=category');\n\t\t\n\t\tif(current_user_can('manage_categories')) {\n\t\t\techo '\n\t\t\t\t<br />\n\t\t\t\t<h3>'.$parent_cat->name.'</h3>\n\t\t\t\t<p><a id=\"new-cat-toggle\" href=\"#\">&raquo; '.$new_category_link.'</a></p>\n\t\t\t\t<form method=\"post\" action=\"\" id=\"new-special-cat\" style=\"display: none\">\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<label for=\"new_special_cat_name\">'.$new_category_name_label.'</label><br />\n\t\t\t\t\t\t\t<input name=\"cat_name\" id=\"new_special_cat_name\" size=\"50\" value=\"\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<label for=\"new_special_cat_desc\">'.$new_category_description_label.'</label><br />\n\t\t\t\t\t\t\t<textarea name=\"category_description\" id=\"new_special_cat_desc\" rows=\"5\" cols=\"50\"></textarea>\n\t\t\t\t\t\t</div> \n\t\t\t\t\t\t<input type=\"hidden\" name=\"category_parent\" value=\"'.$parent_cat->cat_ID.'\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"cfcpt_action\" value=\"new-cat\" />\n\t\t\t\t\t\t<p class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"Save New\" /> | <a id=\"cancel-new-special-cat\" href=\"#\">Cancel</a>\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t\t';\n\t\t}\n\t\techo '\n\t\t\t\t<table class=\"widefat post fixed cfcpt\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr class=\"thead\">\n\t\t\t\t\t\t\t<th>'.$category_table_header.'</th>';\n\t\tforeach($cfcpt_post_types as $type => $name) {\n\t\t\techo '\n\t\t\t\t\t\t\t<th class=\"col-'.$type.'\">'.$name.'</th>';\n\t\t}\n\t\techo '\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t';\n\t\tif(count($cats)) {\n\t\t\t$i = 0;\n\t\t\tforeach($cats as $cat) {\n\t\t\t\t// output row\n\t\t\t\techo '\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td id=\"cat-'.$cat->term_id.'\"><b><a href=\"'.\n\t\t\t\t\t\t\t\t$categories_admin.'&action=edit&tag_ID='.$cat->cat_ID.'\">'.$cat->name.'</a></b></td>\n\t\t\t\t\t\t\t\t';\t\n\t\t\t\t// link to each custom post\t\t\t\t\t\n\t\t\t\tforeach($cfcpt_post_types as $type => $name) {\n\t\t\t\t\techo '<td>';\n\t\t\t\t\t$post = get_posts(array(\n\t\t\t\t\t\t\t\t'cat' => $cat->cat_ID,\n\t\t\t\t\t\t\t\t'post_type' => $type,\n\t\t\t\t\t\t\t\t'limit' => -1,\n\t\t\t\t\t\t\t\t'post_status' => 'publish,draft'\n\t\t\t\t\t\t\t));\t\n\t\t\t\t\tif(!is_null($post[0])) {\n\t\t\t\t\t\techo '\n\t\t\t\t\t\t\t\t<a href=\"'.$urlbase.'post.php?action=edit&post='.$post[0]->ID.'\">'.$post[0]->post_title.'</a>\n\t\t\t\t\t\t \t\t<span style=\"font-size: .8em\">('.$post[0]->post_status.')</span>\n\t\t\t\t\t\t\t';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\techo '\n\t\t\t\t\t\t\t\t<b class=\"no-post-type\">post removed?</b> <a href=\"'.\n\t\t\t\t\t\t\t\t$urlbase.'edit.php?page=cf-custom-posts&create='.$type.'&create_in='.$cat->term_id.'\">Create Post</a>\n\t\t\t\t\t\t\t';\n\t\t\t\t\t}\n\t\t\t\t\techo '</td>'; // add &nbsp; in case post is empty the cell still gets layout\n\t\t\t\t}\n\t\t\t\techo '\n\t\t\t\t\t\t\t</tr>';\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\techo '\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=\"'.(count($cfcpt_post_types)+1).'\">\n\t\t\t\t\t\t\t\tThere are currently no special categories set up. <a href=\"'.$categories_admin.'\">Click here</a> to add special categories.\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t';\n\t\t}\n\t\techo '\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t';\t\t\n\t}", "public function ajaxCreateNewSubCategory()\n {\n if (Request::ajax()) {\n $valid = Validator::make(Input::all(), [\n 'nameCat' => 'required|max:120',\n ]);\n $subCategory = SubCategory::where('category_id', Input::get('categotyid'))->where('name', Input::get('nameCat'))->first();\n if (!$subCategory instanceof SubCategory) {\n if ($valid->fails()) {\n $data = ['error' => 1, 'message' => $valid->errors()];\n } else {\n $category = new SubCategory;\n $category->name = Input::get('nameCat');\n $category->category_id = Input::get('categotyid');\n $category->slug = CreateSlug::ruSlug(Input::get('nameCat'));\n $category->save();\n $data = ['error' => 0, 'category' => $category->category_id];\n }\n } else {\n $data = ['error' => 1, 'message' => ['err' => [0 => 'Подраздел уже существует!']]];\n }\n return json_encode($data);\n }\n }", "public function store(SubCategoryRequest $request, Category $category)\n {\n\n $main_category = Category::find($request->get('category_name'));\n\n $parent_id = $request->get('category_name');\n\n $category->url = 'category/' . strtolower(str_slug($request->get('category_name')));\n $category->slug = str_slug($request->get('sub_category_name'));\n // create Images\n if ($request->file('sub_category_image')) {\n $category_image = Category::createImage($request, 'sub_category_image');\n $request->merge(['sub_category_image' => $category_image]);\n $category->sub_category_image = $request->get('sub_category_image');\n }\n\n $category->parent_id = $request->get('category_name');\n //$category->category_name = $main_category->category_name;\n $category->category_name = $request->get('sub_category_name');\n $category->sub_category_name = $request->get('sub_category_name');\n $category->category_image = $main_category->category_image;\n $category->level = $main_category->level+1;\n $category->description = $request->get('description');\n $category->commission = $request->get('commission');\n\n $category->save();\n\n return Redirect::to(route('sub-category'))\n ->with('flash_alert_notice', 'New Sub category successfully created.');\n }", "public function showAddNewSubCategoryForm(Request $request): Response\n {\n $parentCode = $request->getQuery()['parentCode'];\n\n $categoryDTO = CategoryService::getCategoryByCode($parentCode);\n\n $response = new HTMLResponse();\n\n if ($categoryDTO) {\n\n $response->setContent(ViewRenderer::render('views/snippets/admin/categories/NewSubCategoryView',\n ['title' => $categoryDTO->getTitle(), 'id' => $categoryDTO->getId()]));\n\n return $response;\n }\n\n $response->setContent('Error loading sub-category form');\n\n return $response;\n }" ]
[ "0.6725685", "0.6668791", "0.6649013", "0.654512", "0.6543819", "0.6523231", "0.65227216", "0.6494036", "0.6477014", "0.64740896", "0.6444525", "0.6441632", "0.63989216", "0.6391706", "0.62944627", "0.6266692", "0.6264204", "0.61957896", "0.61849296", "0.6163663", "0.6094958", "0.6091985", "0.6087791", "0.6082146", "0.6078502", "0.60784817", "0.60716075", "0.6059636", "0.6040278", "0.60379183" ]
0.6842815
0
/ qsCategoryActivate Activate the question category
public function qsCategoryActivate($id) { $affected_row = Category::where('id', $id) ->update(['status' => STATUS_ACTIVE]); if (!empty($affected_row)) { return redirect()->back()->with('success', 'Activated successfully.'); } return redirect()->back()->with('dismiss', 'Operation failed !'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function activate() {\n\t\t\t$this->init();\n\t\t\t$args = array(\n\t\t\t\t'taxonomy' => $this->taxonomy,\n\t\t\t\t'hide_empty' => false,\n\t\t\t\t'fields' => 'count'\n\t\t\t);\n\t\t\t$terms = get_terms($args);\n\t\t\tif ($terms == count($this->terms)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// insert terms\n\t\t\tforeach ($this->terms as $term) {\n\t\t\t\tif (!term_exists($term, $this->taxonomy)) {\n\t\t\t\t\twp_insert_term($term, $this->taxonomy);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public function activate_points_category($points_category_id)\r\n\t{\r\n\t\t$data = array(\r\n\t\t\t\t'points_category_status' => 1\r\n\t\t\t);\r\n\t\t$this->db->where('points_category_id', $points_category_id);\r\n\t\t\r\n\t\tif($this->db->update('points_category', $data))\r\n\t\t{\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t}", "public static function activate() {\r\n\t\t\t// Add filter to pre_comment_approved.\r\n\t\t\t// add_filter( 'pre_comment_approved', array( self::$instance, 'filter_pre_comment_approved' ));\r\n\t\t}", "public function activateCategory(Category $category)\n {\n $category->active = 1;\n $category->save();\n\n return back()->with('success', 'Category Activated Successfully');\n }", "public function activate()\r\n\t{\r\n\t\t$this->active = true;\r\n\t}", "public function active_category ($category_id) {\n\n DB::table('categories')\n ->where('category_id',$category_id)\n ->update(['publication_status' =>1]);\n Session::put('message','category activated');\n return Redirect::to('/all-category');\n \n }", "public function activate() {\n /**\n * This hook is fired when RML gets activated.\n * \n \t * @hook RML/Activate\n \t */\n \tdo_action('RML/Activate');\n }", "function set_category_active ($category_id) {\n\t$category_id = (int)$category_id;\n\tmysql_query(\"UPDATE `mock_exam_category` SET `status` = 1 WHERE `category_id` = '$category_id'\");\n}", "public function questionActivate($id) {\n $affected_row = Question::where('id', $id)\n ->update(['status' => STATUS_ACTIVE]);\n\n if (!empty($affected_row)) {\n return redirect()->back()->with('success', 'Activated successfully.');\n }\n return redirect()->back()->with('dismiss', 'Operation failed !');\n }", "private static function single_activate() {\n\n\t\tglobal $mspdb;\n\t\t$mspdb->create_tables();\n\n\t\t// add masterslider custom caps\n\t\tself::assign_custom_caps();\n\t\tdo_action( 'masterslider_activated', get_current_blog_id() );\n\t}", "function GetLanguageFeedbackActivateAction()\n {\n return \"LanguageFeedbackActivate\";\n }", "public function activate_extension()\n\t{\n\t\t// Setup custom settings in this array.\n\t\t$this->settings = array();\n\t\t\n\t\t$data = array(\n\t\t\t'class'\t\t=> __CLASS__,\n\t\t\t'method'\t=> 'publish_form_channel_preferences',\n\t\t\t'hook'\t\t=> 'publish_form_channel_preferences',\n\t\t\t'settings'\t=> serialize($this->settings),\n\t\t\t'version'\t=> $this->version,\n\t\t\t'enabled'\t=> 'y'\n\t\t);\n\n\t\t$this->EE->db->insert('extensions', $data);\t\t\t\n\t\t\n\t}", "public function activate(ICollector $model)\n { \n dd(Exception::METHOD_NOT_IMPLEMENTED, __METHOD__); \n \n // if(!isset($storageCategory->id)) throw new Exception(Exception::ENTITY_NOT_FOUND . ' | act: ' . $this->method . ' | id:' . $id);\n\n // if($storageCategory->active != 1) \n // {\n // $storageCategory->active = 1;\n\n // $storageCategory->save();\n\n // $this->messages[] = 'Storage category ' . $storageCategory->id . ' has been activated successfully.'; \n\n // $this->affected[] = $storageCategory; \n // }\n // else \n // {\n // $this->messages[] = 'Storage category ' . $storageCategory->id . ' is already active.'; \n // }\n }", "public function activate(){\n\n $menu = MenuItem::getByName('utility.main');\n\n if(!$menu)\n $menu = MenuItem::add(array(\n 'plugin' => 'utility',\n 'name' => 'main',\n 'labelKey' => $this->_plugin . '.main-menu-title',\n 'icon' => 'legal',\n 'active' => 1\n )); \n\n MenuItem::add(array(\n 'plugin' => $this->_plugin,\n 'name' => 'agenda',\n 'labelKey' => $this->_plugin . '.agenda-menu-title',\n 'action' => 'h-agenda-index',\n 'parentId' => $menu->id,\n 'icon' => 'calendar',\n 'active' => 1\n ));\n }", "protected function activate()\n {\n }", "public function activate()\r\n {\r\n if (!$this->beforeActivate())\r\n {\r\n return false;\r\n }\r\n $this->isActive = true;\r\n if (!$this->save())\r\n {\r\n return false;\r\n }\r\n $this->afterActivate();\r\n }", "function gk_speakers_activate() {\n\t$arr = array(\n\t\t\"name\" => \"gavern_speakers\",\n\t\t\"cpt_name\" => \"Speakers\",\n\t\t\"name_singular\" => \"Speaker\",\n\t\t\"add_new\" => \"Add New Speaker\", \n\t\t\"speakers_tax\" => \"category\",\n\t\t\"speakers_slug\" => \"speaker\", \n\t\t\"speakers_position\" => 5, \n\t\t\"speakers_comments\" => \"Enabled\", \n\t\t\"category_full\" => \"Enabled\"\n\t);\n\n\tupdate_option('speakers_options', $arr);\n\tgk_speakers_create_post_type();\n\tflush_rewrite_rules();\n}", "public function activate()\n {\n if ($this->menu->config->activeElement == 'item') {\n $this->setToActive();\n } else {\n if ($this->link) {\n $this->link->activate();\n }\n }\n\n // If parent activation is enabled:\n if ($this->menu->config->activateParents) {\n // Moving up through the parent nodes, activating them as well.\n if ($this->parent) {\n $this->parent->activate();\n }\n }\n }", "function activated() {\n\t\tparent::activated();\n\t\t$this->resynch_relevant_containers();\n\t}", "public function activate() {\n\t\tif (!current_user_can('activate_plugins')) { return; }\n\t\t$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';\n\t\tcheck_admin_referer('activate-plugin_' . $plugin);\n\n\t\t// Check if Admin already has capability and if not add it\n\t\t$role = get_role('administrator');\n\t\tif (!$role || isset($role->capabilities['accept_revisions'])) { return; }\n\t\t$role->add_cap('accept_revisions');\n\t}", "function cancelDeleteCategory() \n\t{\n\t\t$this->ctrl->redirect($this, \"editQuestion\");\n\t}", "public function show(QuestionCategory $questionCategory)\n {\n //\n }", "public function inputCategory()\n {\n if ($this->categories->count() == 1) {\n $category_id = $this->categories->first()->id;\n $this->processCategoryQuestions($category_id); \n\n return $this->survey();\n }\n\n $question = BotManQuestion::create(trans('survey.input.category'))\n ->fallback(trans('survey.category.error'))\n ->callbackId('survey.input.cateogry')\n ;\n\n $this->categories->each(function ($category) use ($question) {\n $question->addButton(Button::create(ucfirst($category->title))->value($category->id));\n });\n\n return $this->ask($question, function (BotManAnswer $answer) {\n $category_id = $answer->getValue();\n $this->processCategoryQuestions($category_id); \n\n //sometimes you want to skip the location\n //to try out from the web\n //edit from .env SURVEY_LOCATION=FALSE\n if (! config('chatbot.survey.location'))\n return $this->survey();\n\n return $this->inputLocation();\n });\n }", "function activate() {\n\n if( $this->meets_requirements() ) {\n\n }\n\n }", "public function activate() {\n\t\t\t\n\t\t}", "function tmf_theme_activate(){\n\t$uploads = wp_get_upload_dir();\n\tif (!is_dir($uploads['basedir'].'/companyinfo/')) {\n\t mkdir($uploads['basedir'].'/companyinfo/', 0777, true);\n\t}\n\n\t//create Stock Recommendation category for use if it doesnt exist\n\twp_insert_term('Stock Recommendation', 'category', array(\n\t\t 'category_description'\t=> 'Only assigned to articles that are stock recommendations.',\n\t\t 'slug'\t\t\t\t\t=> 'stock-recommendation'\n\t\t)\n\t);\n}", "static function PreActivate($q) {\r\n\t\tglobal $wp_query;\r\n\r\n\t\tif (!is_array($wp_query->query) || !is_array($q->query) || isset($wp_query->query[\"suppress_filters\"]) || isset($q->query[\"suppress_filters\"])) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (isset($wp_query->query[\"idx-action\"])) {\r\n\t\t\tif (!isset($q->query[\"idx-action\"])) {\r\n\t\t\t\t$wp_query->query[\"idx-action-swap\"] = $wp_query->query[\"idx-action\"];\r\n\t\t\t\tunset($wp_query->query[\"idx-action\"]);\r\n\t\t\t} else {\r\n\t\t\t\t$q->query_vars[\"ignore_sticky_posts\"] = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function activar($idcategoria)\n\t{\n\t\t$sql=\"UPDATE categoria SET condicion='1' WHERE idcategoria='$idcategoria'\";\n\t\treturn ejecutarConsulta($sql);\n\t}", "public function test_get_question_options_includes_category_object_single_question() {\n list($category, $course, $quiz, $qcat, $questions) = $this->setup_quiz_and_questions('category');\n $question = array_shift($questions);\n\n get_question_options($question);\n\n $this->assertEquals($qcat, $question->categoryobject);\n }", "abstract public function activate();" ]
[ "0.570217", "0.5598031", "0.55470806", "0.54607147", "0.54053855", "0.5379931", "0.53707486", "0.5340792", "0.52548987", "0.52507883", "0.5224015", "0.5208554", "0.51750785", "0.5164836", "0.51472545", "0.5143663", "0.5136069", "0.51304126", "0.50923824", "0.50831455", "0.50723046", "0.5072155", "0.5062171", "0.5051214", "0.503486", "0.50259805", "0.5016399", "0.50142187", "0.5003873", "0.49938142" ]
0.57112306
0
Creates a new instance which will no longer contain the given object.
public function without($objectOrFixture): self { $clone = clone $this; unset($clone->objects[$objectOrFixture->getId()], $clone->array[$objectOrFixture->getId()]); return $clone; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "final public function withoutIdentity(): self\n {\n $this->objectIdentity = false;\n\n return $this;\n }", "function remove($object) {\n if ($object && $this->contains($object)) {\n $index = $this->indexOfObject($object);\n if ($index != PCollection::CollectionIndexNotFound) {\n unset($this->map[$index]);\n }\n }\n return $this;\n }", "protected function unload() {\n $this->existingData = [];\n $this->objects = [];\n $this->key = null;\n return $this;\n }", "private function ResetObject()\n {\n foreach ($this as $key => $value)\n unset($this->$key);\n\n $this->__construct();\n }", "public function resetUnderlyingObject()\n {\n $this->_cached = null;\n }", "public function detach($object) {\n\t\t$this->offsetUnset($this->hash($object));\n\t}", "public function __destruct()\n {\n $vars = get_object_vars($this);\n if (is_array($vars)) {\n foreach ($vars as $key => $val) {\n $this->$key = null;\n }\n }\n }", "public function __clone()\n {\n foreach ((array) get_object_vars($this) as $k => $v) {\n $this->$k = null;\n }\n }", "public function discard()\n {\n $this->changes = Collection::make();\n\n return $this;\n }", "public function clear()\n {\n $this->objects = [];\n\n return $this;\n }", "public function destroy() {\n\t\t$this->destroyIfNecessary();\n\t\treturn $this;\n\t}", "public function __clone()\n {\n $this->setId(null);\n }", "public function detach($object): void;", "private function removeInstance()\r\n\t\t{\r\n\t\t\tif( $this->intId )\r\n\t\t\t{\r\n\t\t\t\tif( isset( self::$arrInstances[ get_class( $this ) ] ) )\r\n\t\t\t\t{\r\n\t\t\t\t\tif( isset( self::$arrInstances[ get_class( $this ) ][ $this->intId ] ) )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tunset( self::$arrInstances[ get_class( $this ) ][ $this->intId ] );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}", "public function notUseInContainer()\r\n {\r\n $this->_notUseInContainer = true;\r\n return $this;\r\n }", "function __destruct(){\n\t\tunset($this);\n\t}", "public function __destruct() {\n unset($this->attrObjects, $this->attrs, $this->locked, $this->required);\n }", "public function unsetReferenceId(): self\n {\n $this->instance->unsetReferenceId();\n return $this;\n }", "public function __clone()\n {\n $this->id = null;\n }", "public function __destruct() {\n\t\tunset ( $this );\n\t}", "public function remove(Object $o) {\n \n }", "public static function unsetInstance()\n\t{\n\t\tself::$_registry = null;\n\t}", "public function __deconstruct() {\n\t\n\t}", "public function __deconstruct() {\n\t\n\t}", "static function removeFromPool($object) {\n\t\t$pk = is_object($object) ? implode('-', $object->getPrimaryKeyValues()) : $object;\n\n\t\tif (array_key_exists($pk, Fact::$_instancePool)) {\n\t\t\tunset(Fact::$_instancePool[$pk]);\n\t\t\t--Fact::$_instancePoolCount;\n\t\t}\n\t}", "public static function getCleanInstance(): self\n\t{\n\t\treturn new static();\n\t}", "public function __clone() {\n\n if ($this->getId()) {\n $this->setId(null);\n }\n }", "function __clone()\n {\n $this->id = null;\n }", "public static function fresh()\n {\n $instance = new self();\n return $instance;\n }", "public static function fresh()\n {\n $instance = new self();\n return $instance;\n }" ]
[ "0.6241252", "0.6168325", "0.60729486", "0.5924517", "0.57544315", "0.57475525", "0.5720169", "0.56942034", "0.56456244", "0.5619432", "0.5552768", "0.5486167", "0.54435486", "0.5436697", "0.542916", "0.5425149", "0.54095227", "0.5404237", "0.53760636", "0.537516", "0.53740835", "0.53569764", "0.5346376", "0.5346376", "0.53440917", "0.5334061", "0.5310998", "0.52993506", "0.52974683", "0.52974683" ]
0.69071543
0
Creates a new instance with the new objects. If objects with the same reference already exists, they will be overridden by the new ones.
public function mergeWith(self $objects): self { $clone = clone $this; foreach ($objects->objects as $reference => $object) { $clone->objects[$reference] = $object; $clone->array[$reference] = $object->getInstance(); } return $clone; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function __clone() {\n $this->object1 = clone $this->object1;\n }", "function __clone()\n {\n $this->object1 = clone $this->object1;\n }", "public function __clone()\r\n {\r\n $this->object1 = clone $this->object1;\r\n }", "public function __clone()\n\t{\n\t\tforeach( $this->products as $key => $value ) {\n\t\t\t$this->products[$key] = $value;\n\t\t}\n\n\t\tforeach( $this->addresses as $key => $value ) {\n\t\t\t$this->addresses[$key] = $value;\n\t\t}\n\n\t\tforeach( $this->services as $key => $value ) {\n\t\t\t$this->services[$key] = $value;\n\t\t}\n\n\t\tforeach( $this->coupons as $key => $value ) {\n\t\t\t$this->coupons[$key] = $value;\n\t\t}\n\t}", "public function createNewObjects()\n {\n foreach ($this->new as $item) {\n // Create new object via factory\n $object = $this->factory->create($this->aggregator);\n\n // Populate new object from item description\n $this->bindContent($item, $object, $this->map);\n\n // Validate and retrieve errors if validation fail\n if ($errors = $this->validate($object)) {\n $this->errors->add(array('item' => $item['number'], 'errors' => $errors));\n } else {\n $this->result->add($object);\n }\n // Clean internal \"new\" collection for memory free\n $this->new->removeElement($item);\n }\n }", "public function __clone() {\r\n\t\t$vars = get_object_vars($this);\r\n\t\tforeach ($vars as $key => $value) {\r\n\t\t\tif (is_object($value)) {\r\n\t\t\t\t$this->$key = clone $value;\r\n\t\t\t} else {\r\n\t\t\t\t$this->$key = $value;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function __clone() {\n\t\t$vars = get_object_vars($this);\n\t\tforeach ($vars as $key => $value) {\n\t\t\tif (is_object($value)) {\n\t\t\t\t$this->$key = clone $value;\n\t\t\t} else {\n\t\t\t\t$this->$key = $value;\n\t\t\t}\n\t\t}\n\t}", "public function __clone() {\n\t\t$vars = get_object_vars($this);\n\t\tforeach ($vars as $key => $value) {\n\t\t\tif (is_object($value)) {\n\t\t\t\t$this->$key = clone $value;\n\t\t\t} else {\n\t\t\t\t$this->$key = $value;\n\t\t\t}\n\t\t}\n\t}", "public function __clone()\n {\n $vars = get_object_vars($this);\n foreach ($vars as $key => $value) {\n if (is_object($value)) {\n $this->$key = clone $value;\n } else {\n $this->$key = $value;\n }\n }\n }", "public function __clone()\n {\n $vars = get_object_vars($this);\n foreach ($vars as $key => $value) {\n if (is_object($value)) {\n $this->$key = clone $value;\n } else {\n $this->$key = $value;\n }\n }\n }", "public function __factoryClone()\n\t{\n\t\tif (isset($args)) $this->args += $args;\n\t}", "function _clone()\n {\n\t\t$class = get_class($this);\n\t\t$new_obj = new $class($this->_controller, false);\n\t\t$vars = get_object_vars ($this);\n\t\tforeach($vars as $var=>$value)\n\t\t\t$new_obj->$var = $value;\n\t\treturn $new_obj;\n }", "public function __clone()\r\n\t{\r\n\t\t$this->_loaded = FALSE;\r\n\t}", "public function __clone() {\n $this->attrObjects = Arrays::copy($this->attrObjects);\n $this->attrs = Arrays::copy($this->attrs);\n $this->locked = Arrays::copy($this->locked);\n $this->required = Arrays::copy($this->required);\n }", "private function __clone(){}", "private function __clone(){}", "private function __clone(){}", "private function __clone(){}", "private function __clone(){}", "public function __clone()\n {\n // it will point to same object.\n }", "public function __clone()\n {\n foreach ($this->properties as $name => $value) {\n if ($value instanceof self) {\n $this->properties[$name] = clone $value;\n }\n }\n }", "public function __clone() {\n $this->oValues = clone $this->oValues;\n }", "function makeClone()\n {\n $this->id = 0;\n }", "function __clone() {\n\t\t$this->fixCopy();\n\t}", "public function __clone()\n {\n $vars = get_object_vars($this);\n foreach ($vars as $key => $value) {\n $newValue = is_object($value) ? (clone $value) : $value;\n if (is_array($value)) {\n $newValue = [];\n foreach ($value as $key2 => $value2) {\n $newValue[$key2] = is_object($value2) ? (clone $value2) : $value2;\n }\n }\n $this->$key = $newValue;\n }\n }", "protected function __clone(){}", "protected function __clone(){}", "protected function __clone(){}", "public function __clone()\n {\n $this->metadata = clone $this->metadata;\n $this->data = clone $this->data;\n $this->internalCache = clone $this->internalCache;\n $this->embeddedData = clone $this->embeddedData;\n $this->links = clone $this->links;\n }", "public function replicate()\n {\n $attributes = array_except($this->attributes, array($this->getKeyName()));\n with($instance = new static())->setRawAttributes($attributes);\n return $instance->setRelations($this->relations);\n }" ]
[ "0.61855596", "0.6074705", "0.6038871", "0.5953158", "0.5835879", "0.5804835", "0.5739979", "0.5739979", "0.5713863", "0.5713863", "0.5685558", "0.5676871", "0.56350845", "0.5598228", "0.55944914", "0.55944914", "0.55944914", "0.55944914", "0.55944914", "0.55913967", "0.55905104", "0.5580538", "0.55790406", "0.5559448", "0.55397284", "0.5513811", "0.5513811", "0.5513811", "0.551348", "0.5503923" ]
0.6606129
0
Export products missing associated simple products report to CSV format
public function exportMissingassociatedCsvAction() { $fileName = 'products_missingassociated_simple.csv'; $content = $this->getLayout()->createBlock('ash_reports/adminhtml_report_product_missing_associated_grid') ->setSaveParametersInSession(true) ->getCsv(); $this->_prepareDownloadResponse($fileName, $content); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function exportCsv(){\n $data = array(\n array(\"Viande\", \"Morceau\", \"label\", \"Colisage\", \"Qté\")\n );\n foreach ($this->cumulated_products as $product){\n $row = array(\n $product['category'],\n $product['product_name'],\n $product['label_name'],\n $product['description_short'],\n $product['quantity']\n );\n $data[] = $row;\n }\n //Tools::testVar($data);\n //download\n Tools::downloadCsv($data);\n }", "public function export(){\n $products = $this->Paginator->paginate($this->Products->find());\n\n $this->autoRender = false;\n $this->layout = false;\n $fileName = \"bookreport_\".date(\"d-m-y:h:s\").\".xls\";\n\n $headerRow = array(\"ID\", \"Title\", \"Type\", \"Description\", \"Price\", \"Rating\");\n $data = array();\n foreach ($products as $product) {\n array_push($data, array($product->id, $product->description, $product->title, $product->price, $product->rating));\n }\n //debug($data);\n ini_set('max_execution_time', 1600); //increase max_execution_time to 10 min if data set is very large\n $fileContent = implode(\"\\t \", $headerRow).\"\\n\";\n foreach($data as $result) {\n $fileContent .= implode(\"\\t \", $result).\"\\n\";\n }\n header('Content-type: application/ms-excel'); /// you can set csv format\n header('Content-Disposition: attachment; filename='.$fileName);\n echo $fileContent;\n }", "public function exportCsvEmptyAction()\n {\n $path = Mage::getBaseDir('export');\n $fileName = $path . DS . 'Kronosav' . '.csv';\n\n $file = fopen($fileName, 'w');\n\n /** @var Mage_Core_Model_Mysql4_Collection_Abstract $products */\n $products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('name');\n\n //make header\n $data = array(\n 'id',\n 'name',\n 'sku',\n 'discount_percentage',\n );\n fputcsv($file, $data);\n\n $i = 1;\n /** @var Mage_Catalog_Model_Product $product */\n foreach ($products as $product) {\n $data = array(\n $i++,\n $product->getName(),\n $product->getSku(),\n 0, //discount percentage\n );\n\n fputcsv($file, $data);\n }\n\n fclose($file);\n\n $this->_prepareDownloadResponse('scrappagescheme.csv',\n array(\n 'type' => 'filename',\n 'value' => $fileName,\n 'rm' => true,\n )\n );\n }", "protected function _generateFile(){\r\n\t\tif(!is_dir($this->getExportDirectory())){\r\n\t\t\tmkdir($this->getExportDirectory());\r\n\t\t}\r\n\t\t$fp = fopen($this->getCsvFilePath(), 'w');\r\n\t\tforeach ($this->_productData as $data) {\r\n\t\t\t$this->fputcsv($fp, $data);\r\n\t\t}\r\n\t\tfclose($fp);\r\n\t}", "public function exportMissingattributeCsvAction()\n {\n $fileName = 'products_missingattribute.csv';\n $content = $this->getLayout()->createBlock('ash_reports/adminhtml_report_product_missing_superAttribute_grid')\n ->setSaveParametersInSession(true)\n ->getCsv();\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "private function export_details(){\n $id_lang = (int)Context::getContext()->language->id;\n $start = 0;\n $limit = 100000;\n $order_by = 'id_product';\n $order_way = 'DESC';\n $id_category = false;\n $only_active = true;\n $context = null;\n\n $file = 'productdetails.csv';\n \n $f=fopen('uploads_products/'.$file, 'w');\n \n $all_products = Product::getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category,\n $only_active, $context);\n\n fwrite($f, \"Id_product;Nom;reference;description;descriptioncourte;caractéristique,caracatéristqiue_value,imageurl \\r\\n\");\n $data[0]=array(\"Id_product\",\"Nom\",\"reference\",\"description\",\"descriptioncourte\",\"caractéristique\",\"caracatéristqiue_value\",\"imageurl\");\n foreach($all_products as $product){\n \n $productObj = new Product((int)$product['id_product'] ,$id_lang , 1 );\n \n /** get all features*/\n\n $features = $productObj->getFeatures();\n \n foreach ($features as $feature){\n $feature_name = Feature::getFeature($id_lang, $feature[\"id_feature\"]);\n $featurevalues = FeatureValue::getFeatureValuesWithLang($id_lang,$feature[\"id_feature\"] , false); \n }\n \n /** get all images */\n $imgs = $productObj->getImages(Context::getContext()->language->id , null);\n $img = $productObj->getCover($product['id_product']);\n $link = new Link();\n //var_dump($productObj->name);die;\n $img_url = $link->getImageLink(isset($productObj->link_rewrite) ? $productObj->link_rewrite : $productObj->name , (int)$img['id_image']);\n \n $image_list = $img_url ;\n\n foreach($imgs as $image){\n $img_url2 = $link->getImageLink(isset($productObj->link_rewrite) ? $productObj->link_rewrite : $productObj->name, (int)$image['id_image']);\n if($img_url !== $img_url2 ){\n $image_list .=\",\".$img_url2 ;\n }\n }\n \n $id_produit = $productObj->id;\n $name = $productObj->name ;\n $reference = $productObj->reference ;\n $description_short = $productObj->description_short;\n $description = $productObj->description ; \n \n $feature_ch = '';\n foreach($featurevalues as $featurevalue){\n $feature_ch .='-'.$featurevalue[\"value\"].';';\n }\n \n $data[$productObj->id] = \n array($id_produit,$name,$reference,$description,$description_short,$feature_name[\"name\"],$feature_ch,$image_list);\n \n } \n \n $fp = fopen(dirname(__FILE__).'/uploads_products/'.$file, 'w');\n \n foreach ($data as $fields) {\n if(is_array($fields)){\n fputcsv($fp, $fields);\n }\n }\n fclose($fp);\n $filesize = filesize(dirname(__FILE__).'/uploads_products/'.$file);\n\n header('Content-Type: text/csv; charset=utf-8');\n header('Cache-Control: no-store, no-cache');\n header('Content-Disposition: attachment; filename=\"'.$file.'\"');\n header('Content-Length: '.$filesize);\n readfile(dirname(__FILE__).'/uploads_products/'.$file);\n }", "public function exportreport()\n {\n\n $start_date = $this->input->post('start_date');\n $end_date = $this->input->post('end_date');\n $supplier_id = $this->input->post('supplier_id');\n\n $file_name = 'PO Report From:' . $start_date . 'To: ' . $end_date . '.csv';\n header(\"Content-Description: File Transfer\");\n header(\"Content-Disposition: attachment; filename=$file_name\");\n header(\"Content-Type: application/csv;\");\n\n // file creation \n $file = fopen('php://output', 'w');\n\n $header = [\n 'Description',\n 'Qty',\n 'Unit',\n 'Cost',\n 'Total Cost',\n 'Date Needed',\n 'Purpose',\n 'Date Filed',\n 'Supplier',\n 'Category',\n 'Terms'\n ];\n\n fputcsv($file, $header);\n\n // get data\n $po_data = $this->POModel->fetch_generated_po_data($start_date, $end_date, $supplier_id);\n $total_amount = 0;\n $total_items = 0;\n\n foreach ($po_data as $row) {\n $po_items_data = $this->POModel->fetch_generated_po_items_data($row->po_id);\n\n foreach ($po_items_data as $row1) {\n $requisition_items_data = $this->POModel->fetch_requisition_items_data($row1->requisition_item_id);\n\n foreach ($requisition_items_data as $row2) {\n\n $sub_array = array();\n $total_cost = $row2->unit_cost * $row2->qty;\n $total_amount = $total_amount + $total_cost;\n $total_items = $total_items + 1;\n\n $sub_array[] = $row2->description;\n $sub_array[] = $row2->qty;\n $sub_array[] = $row2->unit;\n $sub_array[] = $row2->unit_cost;\n $sub_array[] = $total_cost;\n $sub_array[] = date_format(date_create($row2->date_needed), 'F d, Y');\n $sub_array[] = $row2->purpose;\n $sub_array[] = date_format(date_create($row->date_filed), 'F d, Y');\n $sub_array[] = $row->name;\n $sub_array[] = $row->vendor_category;\n\n if ($row->terms_and_condition == \"00\") {\n $terms = 'COD/Cash';\n } elseif ($row->terms_and_condition == \"01\") {\n $terms = 'Dated';\n } elseif ($row->terms_and_condition == \"02\") {\n $terms = '7 Days';\n } elseif ($row->terms_and_condition == \"03\") {\n $terms = '15 Days';\n } elseif ($row->terms_and_condition == \"04\") {\n $terms = '30 Days';\n } elseif ($row->terms_and_condition == \"05\") {\n $terms = '45 Days';\n } elseif ($row->terms_and_condition == \"06\") {\n $terms = '60 Days';\n } elseif ($row->terms_and_condition == \"07\") {\n $terms = '90 Days';\n } elseif ($row->terms_and_condition == \"08\") {\n $terms = '21 Days';\n }\n $sub_array[] = $terms;\n\n fputcsv($file, $sub_array);\n }\n }\n }\n $array_next_row[] = \"\";\n fputcsv($file, $array_next_row);\n\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"Total Row Items:\";\n $array_total_items[] = $total_items;\n\n fputcsv($file, $array_total_items);\n\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"Total Amount:\";\n $array_total_amount[] = $total_amount;\n\n fputcsv($file, $array_total_amount);\n\n fclose($file);\n exit;\n }", "public function writeProductToCsv(){\n $output = fopen('productsferreteria.csv', 'w');\n $vectorProductosLabel = array(\n \"ID\",\n \"Active\",\n \"Name\",\n \"Categories\",\n \"Price\",\n \"Tax\",\n \"Wholesale price\",\n \"OnSale\",\n \"Discount\",\n \"DiscountPercent\",\n \"DiscountFrom\",\n \"DiscountTo\",\n \"Reference\",\n \"SupplierReference\",\n \"Supplier\",\n \"Manufacturer\",\n \"Ean13\",\n \"Upc\",\n \"Ecotax\",\n \"Width\",\n \"Height\",\n \"Depth\",\n \"Weight\",\n \"Quantity\",\n \"MinimalQuantity\",\n \"Visibility\",\n \"AdditionalShippingCost\",\n \"Unity\",\n \"UnityPrice\",\n \"ShortDescription\",\n \"Description\",\n \"Tags\",\n \"Metatitle\",\n \"MetaKeywords\",\n \"MetaDescription\",\n \"UrlRewritten\",\n \"TextStock\",\n \"TextBackorder\",\n \"Avaiable\",\n \"ProductAvaiableDate\",\n \"ProductCreationDate\",\n \"ShowPrice\",\n \"ImageUrls\",\n \"DeleteExistingImages\",\n \"Feature\",\n \"AvaiableOnline\",\n \"Condition\",\n \"Customizable\",\n \"Uploadable\",\n \"TextFields\",\n \"OutStock\",\n \"IdNameShop\",\n \"AdvancedStockManagement\",\n \"DependsOnStock\",\n \"Warehouse\"\n );\n $vectorProductos = array();\n array_push($vectorProductos,$vectorProductosLabel);\n $contadorIdCat = 0;\n $contadorProductos = 0;\n $contadorProductosCategorias = 0;\n foreach($this->productoNombre as $producto){\n echo \"<br><br>\";\n echo \"----------- PRODUCTO ---------<BR>\";\n if ($this->vectorNProductosIdCat[$contadorIdCat] == $contadorProductosCategorias){\n $contadorProductosCategorias = 0;\n $contadorIdCat++;\n }\n $parent = $this->vectorIdCat[$contadorIdCat];\n\n echo \"Nombre producto: \".$producto.\"<br>\";\n echo \"Categoria Parent: \".$parent.\"<br>\";\n echo \"Referencia: \".$this->productoReferencia[$contadorProductos].\"<br>\";\n echo \"Precio: \".$this->productoPrecio[$contadorProductos].\"<br>\";\n echo \"Precio Antiguo: \".$this->productoPrecioAntiguo[$contadorProductos].\"<br>\";\n echo \"Marca: \".$this->productoFabricante[$contadorProductos].\"<br>\";\n echo \"Url: \".$this->productoUrl[$contadorProductos].\"<br>\";\n echo \"DescCorta: \".$this->productoDescCorta[$contadorProductos].\"<br><br>\";\n echo \"fotos<br>\";\n $fotoString = \"\";\n foreach($this->productoUrlFotos[$contadorProductos][\"hijos\"] as $foto){\n echo \"foto url: \".$foto.\"<br>\";\n $fotoString.= $foto. \",\";\n }\n $fotoString = substr($fotoString,0,strlen($fotoString)-1);\n echo \"<br>\";\n echo \"Foto String: \".$fotoString.\"<br>\";\n echo \"Descripcion larga: \".$this->productoDescLarga[$contadorProductos].\"<br>\";\n echo \"<br>\";\n foreach($this->caracteristicasDefault as $caracteristica){\n echo \"caracteristica default: \".$caracteristica.\"<br>\";\n }\n echo \"<br>\";\n echo \"caracteristica: \".$this->caracteristicas[$contadorProductos].\"<br>\";\n echo \"<br><br>\";\n\n $contadorTemp = $contadorProductos + 1;\n $vectorValores = array(\n $contadorTemp,\n 1,\n rtrim(ltrim($producto)),\n $parent,\n rtrim(ltrim($this->productoPrecio[$contadorProductos])),\n \"31\",\n rtrim(ltrim($this->productoPrecio[$contadorProductos])),\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n rtrim(ltrim($this->productoReferencia[$contadorProductos])),\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"50\",\n \"1\",\n \"both\",\n \"1\",\n \"\",\n \"\",\n rtrim(ltrim($this->productoDescCorta[$contadorProductos])),\n rtrim(ltrim($this->productoDescLarga[$contadorProductos])),\n rtrim(ltrim($producto)),\n rtrim(ltrim($producto)),\n rtrim(ltrim($producto)),\n rtrim(ltrim($producto)),\n \"\",\n \"\",\n \"\",\n \"1\",\n \"\",\n \"\",\n \"1\",\n \"$fotoString\",\n \"\",\n rtrim(ltrim($this->caracteristicas[$contadorProductos])),\n 1,\n \"new\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\"\n );\n //echo \"caracteristicas: \".$this->caracteristicas[$contadorProductos].\"<br>\";\n array_push($vectorProductos,$vectorValores);\n $contadorProductosCategorias++;\n $contadorProductos++;\n //echo \"--------- Fin de Producto ---------<br><br><br>\";\n }\n foreach ($vectorProductos as $campo) {\n fputcsv($output, $campo,';');\n }\n fclose($output);\n //var_dump($this->vectorIdCat);\n //var_dump($this->categoriasNameUrl);\n /*\n var_dump($this->productoNombre);\n var_dump($this->productoReferencia);\n var_dump($this->productoPrecio);\n var_dump($this->productoUrl);\n var_dump($this->productoUrlFotos);\n var_dump($this->productoFabricante);\n var_dump($this->productoDescCorta);\n var_dump($this->productoDescLarga);\n var_dump($this->caracteristicas);\n */\n /*\n foreach($this->caracteristicasDefault as $caracteristica){\n echo \"Caracteristica: \".$caracteristica.\"<br>\";\n }\n */\n }", "public function export (){\n $type = I('type',1,'intval');\n // 工厂内\n if($type == 1){\n $product_list = M('product')->where(['is_where'=>1])->select();\n $header = [\"箱子属性\",\"箱子编号\",\"入库时间\"];\n $data = [];\n foreach($product_list as $product){\n $data[] = [$product['cate_name'],$product['name'],date(\"Y-m-d H:i\", $product['update_time'])];\n }\n return $this->exportCsv($header, $data,date(\"Y-m-d-\").\"工厂内\");\n }\n\n if($type == 2){\n $product_list = M('product')->where(['is_where'=>2])->order(\"cate_name, client_id\")->select();\n $header = [\"箱子属性\",\"箱子编号\",\"客户代码\",\"出库时间\"];\n $data = [];\n foreach($product_list as $product){\n $data[] = [$product['cate_name'], $product['name'],$product['client_name'],date(\"Y-m-d H:i\", $product['update_time'])];\n }\n return $this->exportCsv($header, $data,date(\"Y-m-d-\").\"工厂外\");\n }\n }", "public function exportProductCsvAction()\n {\n $fileName = 'tag_product.csv';\n $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_grid')\n ->getCsvFile();\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "public function export()\n {\n set_time_limit(0);\n\n /** @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */\n $validAttrCodes = $this->_getExportAttrCodes();\n $writer = $this->getWriter();\n $defaultStoreId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;\n\n $memoryLimit = trim(ini_get('memory_limit'));\n $lastMemoryLimitLetter = strtolower($memoryLimit[strlen($memoryLimit)-1]);\n switch($lastMemoryLimitLetter) {\n case 'g':\n $memoryLimit *= 1024;\n case 'm':\n $memoryLimit *= 1024;\n case 'k':\n $memoryLimit *= 1024;\n break;\n default:\n // minimum memory required by Magento\n $memoryLimit = 250000000;\n }\n\n // Tested one product to have up to such size\n $memoryPerProduct = 100000;\n // Decrease memory limit to have supply\n $memoryUsagePercent = 0.8;\n // Minimum Products limit\n $minProductsLimit = 500;\n\n $limitProducts = intval(($memoryLimit * $memoryUsagePercent - memory_get_usage(true)) / $memoryPerProduct);\n if ($limitProducts < $minProductsLimit) {\n $limitProducts = $minProductsLimit;\n }\n $offsetProducts = 0;\n\n while (true) {\n ++$offsetProducts;\n\n $dataRows = array();\n $rowMultiselects = array();\n\n // prepare multi-store values and system columns values\n foreach ($this->_storeIdToCode as $storeId => &$storeCode) { // go through all stores\n $collection = $this->_prepareEntityCollection(Mage::getResourceModel('catalog/product_collection'));\n $collection\n ->setStoreId($storeId)\n ->setPage($offsetProducts, $limitProducts);\n if ($collection->getCurPage() < $offsetProducts) {\n break;\n }\n $collection->load();\n\n if ($collection->count() == 0) {\n break;\n }\n\n foreach ($collection as $itemId => $item) { // go through all products\n $rowIsEmpty = true; // row is empty by default\n\n foreach ($validAttrCodes as &$attrCode) { // go through all valid attribute codes\n $attrValue = $item->getData($attrCode);\n\n if (!empty($this->_attributeValues[$attrCode])) {\n if ($this->_attributeTypes[$attrCode] == 'multiselect') {\n $attrValue = explode(',', $attrValue);\n $attrValue = array_intersect_key(\n $this->_attributeValues[$attrCode],\n array_flip($attrValue)\n );\n $rowMultiselects[$itemId][$attrCode] = $attrValue;\n } else if (isset($this->_attributeValues[$attrCode][$attrValue])) {\n $attrValue = $this->_attributeValues[$attrCode][$attrValue];\n } else {\n $attrValue = null;\n }\n }\n // do not save value same as default or not existent\n if ($storeId != $defaultStoreId\n && isset($dataRows[$itemId][$defaultStoreId][$attrCode])\n && $dataRows[$itemId][$defaultStoreId][$attrCode] == $attrValue\n ) {\n $attrValue = null;\n }\n if (is_scalar($attrValue)) {\n $dataRows[$itemId][$storeId][$attrCode] = $attrValue;\n $rowIsEmpty = false; // mark row as not empty\n }\n }\n if ($rowIsEmpty) { // remove empty rows\n unset($dataRows[$itemId][$storeId]);\n }\n\n $item = null;\n }\n $collection->clear();\n }\n\n if ($collection->getCurPage() < $offsetProducts) {\n break;\n }\n\n if ($offsetProducts == 1) {\n // create export file\n $headerCols = array(\n 'name' => 'title',\n 'short_description' => 'description',\n 'sku' => 'id',\n 'manufacturer' => 'brand'\n );\n $writer->setHeaderCols($headerCols);\n }\n\n foreach ($dataRows as $productId => &$productData) {\n foreach ($productData as &$dataRow) {\n if (!empty($rowMultiselects[$productId])) {\n foreach ($rowMultiselects[$productId] as $attrKey => $attrVal) {\n if (!empty($rowMultiselects[$productId][$attrKey])) {\n $dataRow[$attrKey] = array_shift($rowMultiselects[$productId][$attrKey]);\n }\n }\n }\n\n $dataRow = $this->_trimDataRow($dataRow);\n $dataRow = $this->_fillEmptyRow($dataRow);\n $writer->writeRow($dataRow);\n }\n }\n }\n\n return $writer->getContents();\n }", "public function exportProductsCsvAction()\n {\n if (!$category = $this->_initCategory(true,true)) {\n return;\n }\n\n $fileName = 'products_by_category('.$category->getName().').csv';\n $grid = $this->getLayout()->createBlock('adminhtml/catalog_category_tab_product');\n\n $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());\n\n }", "public function exportProductDetailCsvAction()\n {\n $fileName = 'tag_product_detail.csv';\n $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_detail_grid')\n ->getCsvFile();\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "public function exportMissingOccurCsv(){\n\t\tif($sqlFrag = $this->getSqlFrag()){\n\t\t\t$fileName = 'Missing_'.$this->getExportFileName();\n\t\n\t\t\t$fieldArr = $this->getOccurrenceFieldArr();\n\t\t\t$localitySecurityFields = $this->getLocalitySecurityArr();\n\t\t\t\n\t\t\t$exportSql = 'SELECT '.implode(',',$fieldArr).', o.localitysecurity, o.collid '.\n\t\t\t\t$this->getMissingTaxaBaseSql($sqlFrag);\n\t\t\t//echo $exportSql;\n\t\t\t$this->exportCsv($fileName,$exportSql,$localitySecurityFields);\n\t\t}\n\t}", "public function exportProductsExcelAction()\n {\n if (!$category = $this->_initCategory(true,true)) {\n return;\n }\n $fileName = 'products_by_category('.$category->getName().').csv';\n $grid = $this->getLayout()->createBlock('adminhtml/catalog_category_tab_product');\n $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));\n }", "public function Product_CSVAction()\n {\n Mage::log(\"Entry Knolseed_Engage_Adminhtml_EngageController::Product_CSVAction()\",null,'knolseed.log'); \n\n $product_csv_time = Mage::getStoreConfig('engage_options/product/cron_time');\n $path = Mage::getBaseDir(); # if you want to add new folder for csv files just add name of folder in dir with single quote.\n\n $product_enable_flag = Mage::getStoreConfig('engage_options/product/status');\n\n if($product_enable_flag == 1){\n $productvalues = Mage::getModel('engage/productvalues')->toOptionArray();\n\n $new_pro_array = array();\n\n foreach ($productvalues AS $key => $value) {\n $new_pro_array[] = $value['value'];\n }\n\n $productvaluescount = count($new_pro_array);\n\n //$product_Attr_str = implode(\",\",$new_pro_array);\n $product_Attr_str = implode(\",\",array_map('trim',$new_pro_array));\n\n $fp = fopen($path.\"/Product_Attributes_\".date(\"m-d-y-g-i-a\").\".csv\", 'x+') or die(Mage::log(\"file opening error!!\"));\n\n $headers = \"Sku,\".str_replace(\"sku,\",'',$product_Attr_str).\"\\n\";\n fwrite($fp,$headers);\n\n $from = date('Y-m-d H:i:s', mktime(date(\"H\"), date(\"i\"), date(\"s\"), date(\"m\"), date(\"d\")-1, date(\"Y\")) ) ; //date('Y-m-d', strtotime(\"-2 day\")); \n $to = date('Y-m-d H:i:s');\n\n $collection = Mage::getModel('catalog/product')->getCollection();\n $collection->addAttributeToFilter('updated_at', array('gt' =>$from));\n $collection->addAttributeToFilter('updated_at', array('lt' => $to));\n $attribute_values = \"\";\n foreach ($collection as $products) //loop for getting products\n { \n $product = Mage::getModel('catalog/product')->load($products->getId()); \n $attributes = $product->getAttributes();\n \n $attribute_values .= '\"'.$product->getSku().'\",';\n for($i=0;$i<$productvaluescount;$i++)\n {\n $attributeName = $new_pro_array[$i];\n if ($attributeName!='sku'){\n $attributeValue = null; \n if(array_key_exists($attributeName , $attributes)){\n $attributesobj = $attributes[\"{$attributeName}\"];\n $attributeValue = $attributesobj->getFrontend()->getValue($product);\n }\n $string=str_replace('\"','\\\"',$attributeValue);\n $attribute_values .= '\"'.$string.'\",';\n }\n \n }\n $attribute_values .= \"\\n\";\n }\n fwrite($fp,$attribute_values);\n fclose($fp); \n\n $filepath = $path.\"/Product_Attributes_\".date(\"m-d-y-g-i-a\").\".csv\";\n $this->getResponse ()\n ->setHttpResponseCode ( 200 )\n ->setHeader ( 'Pragma', 'public', true )\n ->setHeader ( 'Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true )\n ->setHeader ( 'Content-type', 'application/force-download' )\n ->setHeader ( 'Content-Length', filesize($filepath) )\n ->setHeader ('Content-Disposition', '' . '; filename=' . basename($filepath) );\n $this->getResponse ()->clearBody ();\n $this->getResponse ()->sendHeaders ();\n readfile ( $filepath );\n\n }else{\n $url = Mage::helper(\"adminhtml\")->getUrl(\"adminhtml/system_config/edit/section/engage_options/\");\n header(\"Location: \".$url);\n }\n\n }", "public function exportCsvCurrentAction()\n {\n $path = Mage::getBaseDir('export');\n $fileName = $path . DS . 'Kronosav' . '.csv';\n\n $file = fopen($fileName, 'w');\n\n /** @var Mage_Core_Model_Mysql4_Collection_Abstract $products */\n $products = Mage::getModel('scrappagescheme/scrap')->getCollection();\n\n //make header\n $data = array(\n 'id',\n 'name',\n 'sku',\n 'discount_percentage',\n );\n fputcsv($file, $data);\n\n $i = 1;\n /** @var Mage_Catalog_Model_Product $product */\n foreach ($products as $product) {\n $data = array(\n $i++,\n $product->getName(),\n $product->getSku(),\n $product->getData('percentage'), //discount percentage\n );\n\n fputcsv($file, $data);\n }\n\n fclose($file);\n\n $this->_prepareDownloadResponse('scrappagescheme.csv',\n array(\n 'type' => 'filename',\n 'value' => $fileName,\n 'rm' => true,\n )\n );\n }", "public function exportDetailedAction(){\n $fileName = 'facturas-detalladas-' . gmdate('Y_m_d-H_i_s') . '.csv';\n $grid = $this->getLayout()->createBlock('adminhtml/sales_invoice_grid');\n $this->_prepareDownloadResponse($fileName, $grid->getDetailedFile());\n }", "private function _outputReportToCsv($results, $startStrSmall, $endStrSmall) {\n\t\t$this->set('_delimiter', $this->request->data['ReportByOrder']['delimeter']); // \",\" => by default \";\" => for french excel\n\n\t\tif (empty($results)) {\n\t\t\t$this->Session->setFlash(__(\"No orders found for your query\"), 'flash_danger');\n\t\t} else {\n\t\t\tConfigure::write('debug', 0); // debuggin messages prevents the the downloading of the file. I don't have time to debug that plugin \n\t\t\t$this->response->download(\"rapport_$startStrSmall\" . \"_\" . \"$endStrSmall.csv\");\n\t\t\t$this->CsvView->quickExport($results);\n\t\t}\n\t}", "public function exportCsv(){\n $user = $this->_ap_right_check();\n if(!$user){\n return;\n }\n $query = $this->{$this->main_model}->find(); \n $this->CommonQuery->build_ap_query($query,$user); //AP QUERY is sort of different in a way\n \n $q_r = $query->all();\n\n //Headings\n $heading_line = array();\n if(isset($this->request->query['columns'])){\n $columns = json_decode($this->request->query['columns']);\n foreach($columns as $c){\n array_push($heading_line,$c->name);\n }\n }\n \n $data = [\n $heading_line\n ];\n \n foreach($q_r as $i){\n\n $columns = array();\n $csv_line = array();\n if(isset($this->request->query['columns'])){\n $columns = json_decode($this->request->query['columns']);\n foreach($columns as $c){\n $column_name = $c->name;\n if($column_name == 'notes'){\n $notes = '';\n foreach($i->user_notes as $un){\n if(!$this->Aa->test_for_private_parent($un->note,$user)){\n $notes = $notes.'['.$un->note->note.']'; \n }\n }\n array_push($csv_line,$notes);\n }elseif($column_name =='owner'){\n $owner_id = $i->parent_id;\n $owner_tree = $this->Users->find_parents($owner_id);\n array_push($csv_line,$owner_tree); \n }else{\n array_push($csv_line,$i->{$column_name}); \n }\n }\n array_push($data,$csv_line);\n }\n }\n \n $_serialize = 'data';\n $this->setResponse($this->getResponse()->withDownload('export.csv'));\n $this->viewBuilder()->setClassName('CsvView.Csv');\n $this->set(compact('data', '_serialize')); \n }", "public function purchaseexport() {\n // FIX: Need to fix the implementation for reduce the memory consumption\n set_time_limit(0);\n ini_set('memory_limit', '512M');\n //getting the entity manager object.\n $em = $this->container->get('doctrine')->getManager();\n\n //get data to be exported\n $purchase_data = array();\n //get purchase records to be export\n $purchase_data = $em->getRepository('ExportManagementBundle:Purchase')\n ->getPurchaseTransaction();\n\n //check if we have some records for export\n // if (count($purchase_data)) {\n //exporting the data.\n $result = $this->exportPurchasecsv($purchase_data);\n // }\n if (!empty($result)) {\n $data = array('code' => 101, 'message' => 'SUCCESS', 'data' => array('link' => $result));\n } else {\n $data = array('code' => 100, 'message' => 'NO_DATA', 'data' => array());\n }\n echo json_encode($data);\n exit;\n }", "public function bulk_csv_export($items) {\n\t\t$translator = Shineisp_Registry::getInstance ()->Zend_Translate;\n\t\t\n\t\t// Get the records from the order table\n\t\t$orders = self::get_invoices($items, \"invoice_id, number as number, order_id as order, DATE_FORMAT(invoice_date, '\".Settings::getMySQLDateFormat('dateformat').\"') as date, \n\t\tc.company as company, CONCAT(c.firstname, ' ', c.lastname) as fullname, o.total as total, o.vat as VAT, o.grandtotal as grandtotal,\", 'number, invoice_date');\n\n\t\tif(!empty($orders[0])){\n\n\t\t\t$tmpname = Shineisp_Commons_Utilities::GenerateRandomString();\n\t\t\t@mkdir ( PUBLIC_PATH . \"/tmp/\");\n\n\t\t\t// Create the file and open it\n\t\t\t$fp = fopen(PUBLIC_PATH . \"/tmp/\" . $tmpname . '.csv', 'w+');\n\n\t\t\t// Add the headers\n\t\t\t$headers = array_keys($orders[0]);\n\t\t\tif(!empty($headers)){\n\t\t\t\tarray_shift($headers);\n\t\t\t\tforeach ($headers as $item) {\n\t\t\t\t\t$newHeaders[] = $translator->translate(ucfirst($item));\n\t\t\t\t}\n\t\t\t\tfputcsv($fp, $newHeaders);\n\t\t\t}\n\t\t\t\n\t\t\t// For each record in the recordset\n\t\t\tforeach ($orders as $item){\n\t\t\t\tarray_shift($item);\n\t\t\t\tfputcsv($fp, $item);\n\t\t\t}\n\n\t\t\t// Close the file\n\t\t\tfclose($fp);\n\t\t\t\n\t\t\t// Return the link\n\t\t\tdie(json_encode(array('url' => \"/tmp/\" . $tmpname . \".csv\")));\n\t\t}\n\t\treturn false;\t\n\t}", "public function generate(){\r\n\t\t$this->Product->bindName($this->Product, 1, false);\r\n\t\t$this->Product->bindMeta($this->Product, 1, false);\r\n\t\t$this->Product->bindDescription($this->Product, 1, false);\r\n\t\t$this->Product->bindPrice(1, false);\r\n\t\t\r\n\t\t$this->Category->bindName($this->Category, 1, false);\r\n\t\t$this->Category->unbindModel(array('hasAndBelongsToMany' => array('Product')), false);\r\n\t\t\r\n\t\t$records = $this->Product->find('all', array('conditions' => array(\r\n\t\t\t'Product.active' => 1,\r\n\t\t)));\r\n\r\n\t\t$fh = fopen($this->filePath, 'w');\r\n\r\n\t\t// Output the header row\r\n\t\tfwrite($fh, 'HDR|' . $this->merchantId . '|' . $this->companyName . '|' . date('Y-m-d/H:i:s') . PHP_EOL);\r\n\r\n\t\tforeach($records as $record){\r\n\t\t\t// Primary & Secondary category\r\n\t\t\t$primaryCatId = null;\r\n\t\t\tforeach($record['ProductCategory'] as $cat){\r\n\t\t\t\tif($cat['primary']){\r\n\t\t\t\t\t$primaryCatId = $cat['category_id'];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$primaryCategoryName = '';\r\n\t\t\t$secondaryCategoryName = '';\r\n\t\t\tif(!empty($primaryCatId)){\r\n\t\t\t\t$primaryCategory = $this->Category->find('first', array(\r\n\t\t\t\t\t'conditions' => array('Category.id' => $primaryCatId),\r\n\t\t\t\t));\r\n\r\n\t\t\t\t$secondaryCategory = $this->Category->getparentnode($primaryCategory['Category']['id']);\r\n\r\n\t\t\t\t$primaryCategoryName = $primaryCategory['CategoryName']['name'];\r\n\r\n\t\t\t\tif(!empty($secondaryCategory)){\r\n\t\t\t\t\t$secondaryCategory = $this->Category->find('first', array(\r\n\t\t\t\t\t\t'conditions' => array('Category.id' => $secondaryCategory['Category']['id']),\r\n\t\t\t\t\t));\r\n\r\n\t\t\t\t\t$secondaryCategoryName = $secondaryCategory['CategoryName']['name'];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Product Image\r\n\t\t\t$productImageUrl = '';\r\n\t\t\tif(!empty($record['ProductImage'][0]['large_web_path'])){\r\n\t\t\t\t$productImageUrl = $this->baseUrl . substr($record['ProductImage'][0]['large_web_path'], 1);\r\n\t\t\t}\r\n\r\n\t\t\t// Pricing\r\n\t\t\tif($record['ProductPrice']['on_special']){\r\n\t\t\t\t$price = $record['ProductPrice']['base_price'];\r\n\t\t\t\t$specialPrice = $record['ProductPrice']['active_price'];\r\n\t\t\t} else {\r\n\t\t\t\t$price = $record['ProductPrice']['active_price'];\r\n\t\t\t\t$specialPrice = null;\r\n\t\t\t}\r\n\r\n\t\t\t$fields = array(\r\n\t\t\t\t'product_id' => $record['Product']['id'],\r\n\t\t\t\t'product_name' => $record['ProductName']['name'],\r\n\t\t\t\t'sku' => $record['Product']['sku'],\r\n\t\t\t\t'primary_category' => (!empty($primaryCategoryName) ? $primaryCategoryName : ''),\r\n\t\t\t\t'secondary_category' => (!empty($secondaryCategoryName) ? $secondaryCategoryName : ''),\r\n\t\t\t\t'product_url' => $this->baseUrl . $record['ProductMeta']['url'],\r\n\t\t\t\t'image_url' => $productImageUrl,\r\n\t\t\t\t'buy_url' => null,\r\n\t\t\t\t'short_product_description' => $record['ProductDescription']['short_description'],\r\n\t\t\t\t'long_product_description' => $record['ProductDescription']['long_description'],\r\n\t\t\t\t'discount' => null,\r\n\t\t\t\t'discount_type' => null,\r\n\t\t\t\t'sale_price' => $specialPrice,\r\n\t\t\t\t'retail_price' => $price,\r\n\t\t\t\t'begin_date' => null,\r\n\t\t\t\t'end_date' => null,\r\n\t\t\t\t'brand' => null,\r\n\t\t\t\t'shipping' => null,\r\n\t\t\t\t'is_deleted' => 'N',\r\n\t\t\t\t'keywords' => null,\r\n\t\t\t\t'is_all' => 'Y',\r\n\t\t\t\t'manufacturer_part_no' => null,\r\n\t\t\t\t'manufacturer_name' => null,\r\n\t\t\t\t'shipping_info' => null,\r\n\t\t\t\t'availability' => null,\r\n\t\t\t\t'universal_product_code' => null,\r\n\t\t\t\t'class_id' => null,\r\n\t\t\t\t'is_product_link' => 'Y',\r\n\t\t\t\t'is_storefront' => 'Y',\r\n\t\t\t\t'is_merchandiser' => 'Y',\r\n\t\t\t\t'currency' => 'GBP',\r\n\t\t\t\t'M1' => null\r\n\t\t\t);\r\n\r\n\t\t\tfwrite($fh, implode('|', $fields) . PHP_EOL);\r\n\t\t}\r\n\r\n\t\t$num_rows = count($records);\r\n\r\n\t\tfwrite($fh, 'TRL|' . $num_rows);\r\n\r\n\t\tfclose($fh);\r\n\r\n\t\t$this->out('Created products file: ' . $this->filePath);\r\n\t}", "public function export(Request $request)\n {\n $category_id = $request->input('category_id', 0);\n $procurement_type = $request->input('procurement_type', null);\n $mrp_type = $request->input('mrp_type', null);\n $stock_control = $request->input('stock_control', -1);\n $min_stock = $request->input('min_stock', 0);\n\n $products = $this->indexQueryRaw( $request )->get();\n\n // Lets get dirty!!\n\n // Initialize the array which will be passed into the Excel generator.\n $data = [];\n\n $ribbon1 = $category_id > 0 ? optional(Category::find($category_id))->name : 'todos';\n $ribbon2 = $procurement_type == '' ? 'todos' : $procurement_type;\n $ribbon3 = $mrp_type == '' ? 'todos' : $mrp_type;\n $ribbon4 = $stock_control < 0 ? 'todos' : ($stock_control == 1 ? 'Sí' : 'No');\n\n // Sheet Header Report Data\n $data[] = [Context::getContext()->company->name_fiscal];\n $data[] = ['Productos sin Stock :: ', '', '', '', '', '', '', '', '', date('d M Y H:i:s')];\n $data[] = ['Categorías: '.$ribbon1];\n $data[] = ['Aprovisionamiento: '.$ribbon2];\n $data[] = ['Planificación: '.$ribbon3];\n $data[] = ['Control de Stock: '.$ribbon4];\n $data[] = ['Stock Mínimo: '.$min_stock];\n\n $data[] = [''];\n\n\n // Define the Excel spreadsheet headers\n/*\n l('Reference'), l('Product Name'), l('Main Supplier'), l('Procurement type'), l('MRP type'), l('Stock Control'),\n\n l('Stock'), l('Allocated'), l('On Order'), l('Available'), \n l('Re-Order Point'), l('Maximum stock'), l('Suggested Quantity'), l('Measure Unit'),\n\n ];\n*/\n $header_names = [\n\n l('Reference'), l('Product Name'), l('Main Supplier'), l('Procurement type'), l('MRP type'), l('Stock Control'),\n\n l('Stock'), \n l('Re-Order Point'), l('Maximum stock'), l('Measure Unit'),\n\n ];\n\n $data[] = $header_names;\n\n foreach ($products as $product) \n {\n $supplier_label = '';\n if ( $product->procurement_type == 'purchase' && $product->mainsupplier )\n $supplier_label = '['.$product->mainsupplier->id .'] '.$product->mainsupplier->name_fiscal;\n\n $row = [];\n $row[] = (string) $product->reference;\n $row[] = $product->name;\n $row[] = $supplier_label;\n $row[] = $product->procurement_type;\n $row[] = $product->mrp_type;\n $row[] = (string) $product->stock_control;\n\n $row[] = $product->quantity_onhand *1.0;\n// $row[] = (float) $product->quantity_allocated;\n// $row[] = $product->quantity_onorder *1.0;\n// $row[] = $product->quantity_available *1.0;\n\n $row[] = $product->reorder_point * 1.0;\n $row[] = $product->maximum_stock * 1.0;\n// $row[] = (float) $product->quantity_reorder_suggested;\n $row[] = $product->measureunit->sign;\n \n $data[] = $row;\n\n }\n\n\n $styles = [\n 'A2:A2' => ['font' => ['bold' => true]],\n 'A9:N9' => ['font' => ['bold' => true]],\n ];\n\n $columnFormats = [\n 'A' => NumberFormat::FORMAT_TEXT,\n// 'E' => NumberFormat::FORMAT_DATE_DDMMYYYY,\n 'C' => NumberFormat::FORMAT_NUMBER,\n 'D' => NumberFormat::FORMAT_NUMBER_00,\n 'E' => NumberFormat::FORMAT_NUMBER_00,\n 'F' => NumberFormat::FORMAT_NUMBER_00,\n 'G' => NumberFormat::FORMAT_NUMBER_00,\n ];\n\n $merges = ['A1:B1', 'A2:B2'];\n\n $sheetTitle = 'Productos sin Stock';\n\n $export = new ArrayExport($data, $styles, $sheetTitle, $columnFormats, $merges);\n\n $sheetFileName = $sheetTitle;\n\n // Generate and return the spreadsheet\n return Excel::download($export, $sheetFileName.'.xlsx');\n\n }", "public function exportproductsAction()\n {\n $_EXPORT_TYPE = \"prodfeed\";\n \n $config = Mage::getModel('dataexport/config');\n \n if( ! $config->getIsEnabled()) {\n Mage::throwException($this->__('Data Export Module Disabled!'));\n }\n try {\n $exporter = Mage::getModel('dataexport/exporter');\n /* @var $exporter Advertise_Dataexport_Model_Exporter */\n\n // Set export type for uploaded filename\n $exporter->setExportType($_EXPORT_TYPE);\n \n /**\n * Add Products Export\n */\n $exportAdapter = Mage::getModel('dataexport/exporter_product');\n $exporter->addExporter($exportAdapter);\n\n /**\n * Do it!\n */\n $totalItems = $exporter->export();\n\n $message = $this->__('Your product data has been submitted successfully.');\n Mage::getSingleton('adminhtml/session')->addSuccess($message);\n Mage::getSingleton('adminhtml/session')->addSuccess(\"{$totalItems} products successfully exported.\");\n } \n catch (Exception $e) {\n Mage::getSingleton('adminhtml/session')->addError($e->getMessage());\n }\n \n $this->_redirect('*/*');\n }", "public function export(){\n\n // Create filter from contacts selected\n if(App::request()->getParams('contacts')) {\n $filter = new DBExample(array(\n 'userId' => App::session()->getUser()->id,\n 'id' => array(\n '$in' => explode(',', App::request()->getParams('contacts'))\n )\n ));\n }\n else {\n $filter = new DBExample(array(\n 'userId' => App::session()->getUser()->id,\n ));\n }\n\n // Get contacts from db\n $listContacts = HContact::getListByExample($filter, 'id', array(), array('firstName' => DB::SORT_ASC));\n\n // Create temporary file\n $tempFileName = 'contacts_' . uniqid() . '.csv';\n $file = fopen( Plugin::get('h-connect')->getPublicUserfilesDir() . $tempFileName, \"w\");\n\n $questions = HContactQuestion::getAll();\n $dataTitle = array(\n 'lastName', \n 'firstName', \n 'job', \n 'company',\n 'phoneNumber',\n 'cellNumber',\n 'personalNumber',\n 'email',\n 'address',\n 'city',\n 'postcode',\n 'country'\n );\n\n foreach ($questions as $key => $q) {\n if($q->type == 'file'){\n unset($questions[$key]);\n }\n else{\n $dataTitle[] = $q->name; \n } \n }\n\n // Write title in first line\n fputcsv($file, $dataTitle, ',');\n\n // For each contacts add data on one line\n foreach ($listContacts as $contact){\n $data = array(\n $contact->lastName, \n $contact->firstName, \n $contact->job, \n $contact->company,\n $contact->phoneNumber,\n $contact->cellNumber,\n $contact->personalNumber,\n $contact->email,\n $contact->address,\n $contact->city,\n $contact->postcode,\n $contact->country\n );\n\n foreach ($questions as $q) {\n $data[] = HContactValue::getValueByName($q->name, $contact->id);\n }\n\n fputcsv($file, $data, ',');\n }\n\n // Close file\n fclose($file);\n\n // Read data\n $data = file_get_contents(Plugin::get('h-connect')->getPublicUserfilesDir() . $tempFileName);\n\n // Remove remporaray file\n shell_exec('rm ' . Plugin::get('h-connect')->getPublicUserfilesDir() . $tempFileName);\n\n // Create response\n $response = App::response();\n $response->setContentType('text');\n $response->header('Content-Disposition', 'attachment; filename=\"contacts.csv\"');\n\n return $data;\n }", "function csv_export() {\t\t\n\t\t$db = & JFactory::getDBO();\n\t\tif (!EventBookingHelper::canExportRegistrants()) {\n\t\t\tJFactory::getApplication()->redirect('index.php', JText::_('EB_NOT_ALLOWED_TO_EXPORT'));\n\t\t}\t\t\t\t\n\t\tif (version_compare(JVERSION, '1.6.0', 'ge')) {\n\t\t\t$param = null ;\n\t\t} else {\n\t\t\t$param = 0 ;\n\t\t}\n\t\t$taxEnabled = $config->enable_tax && ($config->tax_rate > 0) ;\n\t\t$eventId = JRequest::getInt('event_id') ;\n\t\t$where = array() ;\n\t\t$where[] = '(a.published = 1 OR (a.payment_method=\"os_offline\" AND a.published != 2))' ;\n\t\tif ($eventId)\n\t\t\t$where[] = ' a.event_id='.$eventId ;\n\t\tif (isset($config->include_group_billing_in_csv_export) && !$config->include_group_billing_in_csv_export)\n\t\t\t$where[] = ' a.is_group_billing = 0 ' ;\n\t\tif ($config->show_coupon_code_in_registrant_list) {\n\t\t\t$sql = 'SELECT a.*, b.event_date, b.title AS event_title, c.code AS coupon_code FROM #__eb_registrants AS a INNER JOIN #__eb_events AS b ON a.event_id = b.id LEFT JOIN #__eb_coupons AS c ON a.coupon_id=c.id WHERE '.implode(' AND ', $where).' ORDER BY a.id ';\n\t\t} else {\n\t\t\t$sql = 'SELECT a.*, b.event_date, b.title AS event_title FROM #__eb_registrants AS a INNER JOIN #__eb_events AS b ON a.event_id = b.id WHERE '.implode(' AND ', $where).' ORDER BY a.id ';\n\t\t}\n\t\t$db->setQuery($sql) ;\n\t\t$rows = $db->loadObjectList();\n\t\tif (count($rows) == 0) {\n\t\t\tJFactory::getApplication()->redirect('index.php', JText::_('EB_NO_REGISTRANTS_TO_EXPORT'));\n\t\t}\n\t\tif ($eventId)\n\t\t\t$sql = 'SELECT id, title FROM #__eb_fields WHERE published=1 AND (event_id = -1 OR id IN (SELECT field_id FROM #__eb_field_events WHERE event_id='.$eventId.')) ORDER BY ordering';\n\t\telse\n\t\t\t$sql = 'SELECT id, title FROM #__eb_fields WHERE published=1 ORDER BY ordering';\n\t\t$db->setQuery($sql) ;\n\t\t$rowFields = $db->loadObjectList() ;\n\t\t//Get the custom fields value and store them into an array\n\t\n\t\t$sql = 'SELECT id FROM #__eb_registrants AS a WHERE '.implode(' AND ', $where) ;\n\t\t$db->setQuery($sql) ;\n\t\t$registrantIds = array(0) ;\n\t\t$registrantIds = array_merge($registrantIds, $db->loadResultArray()) ;\n\t\t$sql = 'SELECT registrant_id, field_id, field_value FROM #__eb_field_values WHERE registrant_id IN ('.implode(',', $registrantIds).')';\n\t\t$db->setQuery($sql) ;\n\t\t$rowFieldValues = $db->loadObjectList();\n\t\t$fieldValues = array() ;\n\t\tfor ($i = 0 , $n = count($rowFieldValues) ; $i < $n ; $i++) {\n\t\t\t$rowFieldValue = $rowFieldValues[$i] ;\n\t\t\t$fieldValues[$rowFieldValue->registrant_id][$rowFieldValue->field_id] = $rowFieldValue->field_value ;\n\t\t}\n\t\t//Get name of groups\n\t\t$groupNames = array() ;\n\t\t$sql = 'SELECT id, first_name, last_name FROM #__eb_registrants AS a WHERE is_group_billing = 1'. (COUNT($where) ? ' AND '.implode(' AND ', $where) : '');\n\t\t$db->setQuery($sql);\n\t\t$rowGroups = $db->loadObjectList() ;\n\t\tif (count($rowGroups)) {\n\t\t\tforeach ($rowGroups as $rowGroup) {\n\t\t\t\t$groupNames[$rowGroup->id] = $rowGroup->first_name . ' '.$rowGroup->last_name ;\n\t\t\t}\n\t\t}\n\t\tif(count($rows)){\n\t\t\t$results_arr=array();\n\t\t\t$csv_output = JText::_('EB_EVENT');\n\t\t\tif ($config->show_event_date) {\n\t\t\t\t$csv_output .= \",\". JText::_('EB_EVENT_DATE') ;\n\t\t\t}\n\t\t\t$csv_output .= \", \". JText::_('EB_FIRST_NAME') ;\n\t\t\tif ($config->s_lastname)\n\t\t\t\t$csv_output .= \", \". JText::_('EB_LAST_NAME');\n\t\t\tif ($config->s_organization)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ORGANIZATION');\n\t\t\tif ($config->s_address)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ADDRESS');\n\t\t\tif ($config->s_address2)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ADDRESS2');\n\t\t\tif ($config->s_city)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_CITY');\n\t\t\tif ($config->s_state)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_STATE');\n\t\t\tif ($config->s_zip)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ZIP');\n\t\t\tif ($config->s_country)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_COUNTRY');\n\t\t\tif ($config->s_phone)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_PHONE');\n\t\t\tif ($config->s_fax)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_FAX');\n\t\t\t$csv_output .= ', '. JText::_('EB_EMAIL');\n\t\t\t$csv_output .= ', '. JText::_('EB_NB_REGISTRANTS');\n\t\t\t$csv_output .= ', '. JText::_('EB_AMOUNT');\n\t\t\tif ($taxEnabled) {\n\t\t\t\t$csv_output .= ', '. JText::_('EB_TAX');\n\t\t\t}\n\t\t\tif ($config->activate_deposit_feature) {\n\t\t\t\t$csv_output .= ', '. JText::_('EB_DEPOSIT_AMOUNT');\n\t\t\t\t$csv_output .= ', '. JText::_('EB_DUE_AMOUNT');\n\t\t\t}\n\t\t\tif ($config->show_coupon_code_in_registrant_list) {\n\t\t\t\t$csv_output .= ','. JText::_('EB_COUPON');\n\t\t\t}\n\t\t\t$csv_output .= ','. JText::_('EB_REGISTRATION_DATE');\n\t\t\t$csv_output .= ','. JText::_('EB_TRANSACTION_ID');\n\t\t\t$csv_output .= ', '. JText::_('EB_PAYMENT_STATUS');\n\t\t\tif (count($rowFields)) {\n\t\t\t\tforeach ($rowFields as $rowField)\n\t\t\t\t\t$csv_output .= ', '.$rowField->title ;\n\t\t\t}\n\t\t\tif ($config->s_comment)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_COMMENT');\n\t\t\tforeach($rows as $r) {\n\t\t\t\t$results_arr=array();\n\t\t\t\t$results_arr[]=$r->event_title ;\n\t\t\t\tif ($config->show_event_date) {\n\t\t\t\t\t$results_arr[] = JHTML::_('date', $r->event_date, $config->date_format, $param) ;\n\t\t\t\t}\n\t\t\t\tif ($r->is_group_billing)\n\t\t\t\t\t$results_arr[]=$r->first_name.' '.JText::_('EB_GROUP_BILLING');\n\t\t\t\telseif ($r->group_id > 0)\n\t\t\t\t$results_arr[]=$r->first_name.' '.JText::_('EB_GROUP').$groupNames[$r->group_id] ;\n\t\t\t\telse\n\t\t\t\t\t$results_arr[]=$r->first_name ;\n\t\t\t\tif ($config->s_lastname)\n\t\t\t\t\t$results_arr[]=$r->last_name ;\n\t\t\t\tif ($config->s_organization)\n\t\t\t\t\t$results_arr[]=$r->organization;\n\t\t\t\tif ($config->s_address)\n\t\t\t\t\t$results_arr[]=$r->address;\n\t\t\t\tif ($config->s_address2)\n\t\t\t\t\t$results_arr[]=$r->address2;\n\t\t\t\tif ($config->s_city)\n\t\t\t\t\t$results_arr[]=$r->city;\n\t\t\t\tif ($config->s_state)\n\t\t\t\t\t$results_arr[]=$r->state;\n\t\t\t\tif ($config->s_zip)\n\t\t\t\t\t$results_arr[]=$r->zip;\n\t\t\t\tif ($config->s_country)\n\t\t\t\t\t$results_arr[]=$r->country;\n\t\t\t\tif ($config->s_phone)\n\t\t\t\t\t$results_arr[]=$r->phone;\n\t\t\t\tif ($config->s_fax)\n\t\t\t\t\t$results_arr[]=$r->fax;\n\t\t\t\t$results_arr[]=$r->email;\n\t\t\t\t$results_arr[] = $r->number_registrants ;\n\t\t\t\t$results_arr[]= number_format($r->amount, 2);\n\t\t\t\tif ($taxEnabled)\n\t\t\t\t\t$results_arr[]= number_format($r->tax_amount, 2);\n\t\t\t\tif ($config->activate_deposit_feature) {\n\t\t\t\t\tif ($r->deposit_amount > 0) {\n\t\t\t\t\t\t$results_arr[]= number_format($r->deposit_amount, 2);\n\t\t\t\t\t\t$results_arr[]= number_format($r->amount - $r->deposit_amount, 2);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$results_arr[]= '';\n\t\t\t\t\t\t$results_arr[]= '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\tif ($config->show_coupon_code_in_registrant_list) {\n\t\t\t\t\t$results_arr[]= $r->coupon_code ;\n\t\t\t\t}\n\t\n\t\t\t\t$results_arr[]= JHTML::_('date', $r->register_date, $config->date_format, $param);\n\t\t\t\t$results_arr[]= $r->transaction_id ;\n\t\t\t\tif ($r->published) {\n\t\t\t\t\t$results_arr[]= 'Paid' ;\n\t\t\t\t} else {\n\t\t\t\t\t$results_arr[]= 'Not Paid' ;\n\t\t\t\t}\n\t\t\t\tif (count($rowFields))\n\t\t\t\t\tforeach ($rowFields as $rowField) {\n\t\t\t\t\t$results_arr[] = @$fieldValues[$r->id][$rowField->id] ;\n\t\t\t\t}\n\t\t\t\tif ($config->s_comment)\n\t\t\t\t\t$results_arr[]= $r->comment;\n\t\t\t\t$csv_output .= \"\\n\\\"\".implode (\"\\\",\\\"\", $results_arr).\"\\\"\";\n\t\t\t}\n\t\t\t$csv_output .= \"\\n\";\n\t\t\tif (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {\n\t\t\t\t$UserBrowser = \"Opera\";\n\t\t\t}\n\t\t\telseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {\n\t\t\t\t$UserBrowser = \"IE\";\n\t\t\t} else {\n\t\t\t\t$UserBrowser = '';\n\t\t\t}\n\t\t\t$mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream';\n\t\t\t$filename = \"registrants_list\";\n\t\t\t@ob_end_clean();\n\t\t\tob_start();\n\t\t\theader('Content-Type: ' . $mime_type);\n\t\t\theader('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n\t\t\tif ($UserBrowser == 'IE') {\n\t\t\t\theader('Content-Disposition: attachment; filename=\"' . $filename . '.csv\"');\n\t\t\t\theader('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n\t\t\t\theader('Pragma: public');\n\t\t\t}\n\t\t\telse {\n\t\t\t\theader('Content-Disposition: attachment; filename=\"' . $filename . '.csv\"');\n\t\t\t\theader('Pragma: no-cache');\n\t\t\t}\n\t\t\tprint $csv_output;\n\t\t\texit();\n\t\t}\n\t}", "public function exportProductExcelAction()\n {\n $fileName = 'tag_product.xml';\n $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_grid')\n ->getExcelFile($fileName);\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "public function actionExport() {\n $sql = 'SELECT s.solexa_sample_id, s.barcode, s.sample_source_type, s.sample_source_id, ' .\n ' ss.lookup_value as sample_type, ' .\n ' s.sample_desc, ' .\n ' a.lookup_value as app_type, ' .\n ' s.sub_date, s.owner, s.nd_conc, s.comments, s.sample_name, ' .\n ' s.rin_number, s.dummy,' .\n ' e.lookup_value as exp_design ' .\n ' ,t.lookup_value as tissue_type' .\n ' , st.lookup_value as status ' .\n ' FROM sample_db.solexa_sample s, sample_db.sample_type ss, sample_db.app_type a ' .\n ', sample_db.exp_design e ' .\n ', sample_db.tissue_type t ' .\n ', sample_db.sample_status st ' .\n ' WHERE s.sample_type = ss.lookup_id ' .\n ' AND s.app_type = a.lookup_id ' .\n ' AND s.exp_design = e.lookup_id ' .\n ' AND s.tissue_type = t.lookup_id ' .\n ' AND s.sample_status = st.lookup_id ';\n '';\n\n $rows = SolexaSample::model()->findAllBySql($sql);\n\n $cols = array('solexa_sample_id' => array('number'),\n 'barcode' => array('string'),\n 'sample_source_type' => array('string'),\n 'sample_source_id' => array('string'),\n 'sample_type' => array('string'),\n 'sample_desc' => array('string'),\n 'app_type' => array('string'),\n 'sub_date' => array('date'),\n 'owner' => array('string'),\n 'nd_conc' => array('number'),\n 'comments' => array('string'),\n 'sample_name' => array('string'),\n 'exp_design' => array('string'),\n 'rin_number' => array('number'),\n 'dummy' => array('string'),\n // 'tissue_type' => array('string'),\n // 'status' => array('string'),\n );\n CsvExport::export($rows, $cols,\n // SolexaSample::model()->findAll(), // a CActiveRecord array OR any CModel array\n true, // boolPrintRows\n 'sample_db-' . date('d-m-Y') . \".csv\"\n );\n }", "public function shouldExportByProductId()\n {\n $logs = factory(ProductionLog::class, 2)->create([\n 'product_id' => $product = factory(Product::class)->create(),\n ]);\n\n $export = new ProductionLogsExport(['product_id' => $product->id]);\n\n $this->assertCount($logs->count(), $export->query()->get());\n $this->assertEqualsCanonicalizing($logs->pluck('id'), $export->query()->pluck('id'));\n }" ]
[ "0.6924606", "0.6923808", "0.6788006", "0.6750012", "0.6690942", "0.6687957", "0.6595155", "0.65778035", "0.655853", "0.6486706", "0.6430279", "0.63694805", "0.63594204", "0.6287305", "0.62657404", "0.620466", "0.6103106", "0.60624343", "0.6054716", "0.60042244", "0.5965356", "0.59652466", "0.595092", "0.59385633", "0.5937034", "0.5885189", "0.5842285", "0.58376676", "0.58351505", "0.58070034" ]
0.7375902
0
Export misconfigured configurable products report to CSV format (super attributes not actually part of the product's attribute set)
public function exportMissingattributeCsvAction() { $fileName = 'products_missingattribute.csv'; $content = $this->getLayout()->createBlock('ash_reports/adminhtml_report_product_missing_superAttribute_grid') ->setSaveParametersInSession(true) ->getCsv(); $this->_prepareDownloadResponse($fileName, $content); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function Product_CSVAction()\n {\n Mage::log(\"Entry Knolseed_Engage_Adminhtml_EngageController::Product_CSVAction()\",null,'knolseed.log'); \n\n $product_csv_time = Mage::getStoreConfig('engage_options/product/cron_time');\n $path = Mage::getBaseDir(); # if you want to add new folder for csv files just add name of folder in dir with single quote.\n\n $product_enable_flag = Mage::getStoreConfig('engage_options/product/status');\n\n if($product_enable_flag == 1){\n $productvalues = Mage::getModel('engage/productvalues')->toOptionArray();\n\n $new_pro_array = array();\n\n foreach ($productvalues AS $key => $value) {\n $new_pro_array[] = $value['value'];\n }\n\n $productvaluescount = count($new_pro_array);\n\n //$product_Attr_str = implode(\",\",$new_pro_array);\n $product_Attr_str = implode(\",\",array_map('trim',$new_pro_array));\n\n $fp = fopen($path.\"/Product_Attributes_\".date(\"m-d-y-g-i-a\").\".csv\", 'x+') or die(Mage::log(\"file opening error!!\"));\n\n $headers = \"Sku,\".str_replace(\"sku,\",'',$product_Attr_str).\"\\n\";\n fwrite($fp,$headers);\n\n $from = date('Y-m-d H:i:s', mktime(date(\"H\"), date(\"i\"), date(\"s\"), date(\"m\"), date(\"d\")-1, date(\"Y\")) ) ; //date('Y-m-d', strtotime(\"-2 day\")); \n $to = date('Y-m-d H:i:s');\n\n $collection = Mage::getModel('catalog/product')->getCollection();\n $collection->addAttributeToFilter('updated_at', array('gt' =>$from));\n $collection->addAttributeToFilter('updated_at', array('lt' => $to));\n $attribute_values = \"\";\n foreach ($collection as $products) //loop for getting products\n { \n $product = Mage::getModel('catalog/product')->load($products->getId()); \n $attributes = $product->getAttributes();\n \n $attribute_values .= '\"'.$product->getSku().'\",';\n for($i=0;$i<$productvaluescount;$i++)\n {\n $attributeName = $new_pro_array[$i];\n if ($attributeName!='sku'){\n $attributeValue = null; \n if(array_key_exists($attributeName , $attributes)){\n $attributesobj = $attributes[\"{$attributeName}\"];\n $attributeValue = $attributesobj->getFrontend()->getValue($product);\n }\n $string=str_replace('\"','\\\"',$attributeValue);\n $attribute_values .= '\"'.$string.'\",';\n }\n \n }\n $attribute_values .= \"\\n\";\n }\n fwrite($fp,$attribute_values);\n fclose($fp); \n\n $filepath = $path.\"/Product_Attributes_\".date(\"m-d-y-g-i-a\").\".csv\";\n $this->getResponse ()\n ->setHttpResponseCode ( 200 )\n ->setHeader ( 'Pragma', 'public', true )\n ->setHeader ( 'Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true )\n ->setHeader ( 'Content-type', 'application/force-download' )\n ->setHeader ( 'Content-Length', filesize($filepath) )\n ->setHeader ('Content-Disposition', '' . '; filename=' . basename($filepath) );\n $this->getResponse ()->clearBody ();\n $this->getResponse ()->sendHeaders ();\n readfile ( $filepath );\n\n }else{\n $url = Mage::helper(\"adminhtml\")->getUrl(\"adminhtml/system_config/edit/section/engage_options/\");\n header(\"Location: \".$url);\n }\n\n }", "public function exportMissingassociatedCsvAction()\n {\n $fileName = 'products_missingassociated_simple.csv';\n $content = $this->getLayout()->createBlock('ash_reports/adminhtml_report_product_missing_associated_grid')\n ->setSaveParametersInSession(true)\n ->getCsv();\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "public function export()\n {\n set_time_limit(0);\n\n /** @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */\n $validAttrCodes = $this->_getExportAttrCodes();\n $writer = $this->getWriter();\n $defaultStoreId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;\n\n $memoryLimit = trim(ini_get('memory_limit'));\n $lastMemoryLimitLetter = strtolower($memoryLimit[strlen($memoryLimit)-1]);\n switch($lastMemoryLimitLetter) {\n case 'g':\n $memoryLimit *= 1024;\n case 'm':\n $memoryLimit *= 1024;\n case 'k':\n $memoryLimit *= 1024;\n break;\n default:\n // minimum memory required by Magento\n $memoryLimit = 250000000;\n }\n\n // Tested one product to have up to such size\n $memoryPerProduct = 100000;\n // Decrease memory limit to have supply\n $memoryUsagePercent = 0.8;\n // Minimum Products limit\n $minProductsLimit = 500;\n\n $limitProducts = intval(($memoryLimit * $memoryUsagePercent - memory_get_usage(true)) / $memoryPerProduct);\n if ($limitProducts < $minProductsLimit) {\n $limitProducts = $minProductsLimit;\n }\n $offsetProducts = 0;\n\n while (true) {\n ++$offsetProducts;\n\n $dataRows = array();\n $rowMultiselects = array();\n\n // prepare multi-store values and system columns values\n foreach ($this->_storeIdToCode as $storeId => &$storeCode) { // go through all stores\n $collection = $this->_prepareEntityCollection(Mage::getResourceModel('catalog/product_collection'));\n $collection\n ->setStoreId($storeId)\n ->setPage($offsetProducts, $limitProducts);\n if ($collection->getCurPage() < $offsetProducts) {\n break;\n }\n $collection->load();\n\n if ($collection->count() == 0) {\n break;\n }\n\n foreach ($collection as $itemId => $item) { // go through all products\n $rowIsEmpty = true; // row is empty by default\n\n foreach ($validAttrCodes as &$attrCode) { // go through all valid attribute codes\n $attrValue = $item->getData($attrCode);\n\n if (!empty($this->_attributeValues[$attrCode])) {\n if ($this->_attributeTypes[$attrCode] == 'multiselect') {\n $attrValue = explode(',', $attrValue);\n $attrValue = array_intersect_key(\n $this->_attributeValues[$attrCode],\n array_flip($attrValue)\n );\n $rowMultiselects[$itemId][$attrCode] = $attrValue;\n } else if (isset($this->_attributeValues[$attrCode][$attrValue])) {\n $attrValue = $this->_attributeValues[$attrCode][$attrValue];\n } else {\n $attrValue = null;\n }\n }\n // do not save value same as default or not existent\n if ($storeId != $defaultStoreId\n && isset($dataRows[$itemId][$defaultStoreId][$attrCode])\n && $dataRows[$itemId][$defaultStoreId][$attrCode] == $attrValue\n ) {\n $attrValue = null;\n }\n if (is_scalar($attrValue)) {\n $dataRows[$itemId][$storeId][$attrCode] = $attrValue;\n $rowIsEmpty = false; // mark row as not empty\n }\n }\n if ($rowIsEmpty) { // remove empty rows\n unset($dataRows[$itemId][$storeId]);\n }\n\n $item = null;\n }\n $collection->clear();\n }\n\n if ($collection->getCurPage() < $offsetProducts) {\n break;\n }\n\n if ($offsetProducts == 1) {\n // create export file\n $headerCols = array(\n 'name' => 'title',\n 'short_description' => 'description',\n 'sku' => 'id',\n 'manufacturer' => 'brand'\n );\n $writer->setHeaderCols($headerCols);\n }\n\n foreach ($dataRows as $productId => &$productData) {\n foreach ($productData as &$dataRow) {\n if (!empty($rowMultiselects[$productId])) {\n foreach ($rowMultiselects[$productId] as $attrKey => $attrVal) {\n if (!empty($rowMultiselects[$productId][$attrKey])) {\n $dataRow[$attrKey] = array_shift($rowMultiselects[$productId][$attrKey]);\n }\n }\n }\n\n $dataRow = $this->_trimDataRow($dataRow);\n $dataRow = $this->_fillEmptyRow($dataRow);\n $writer->writeRow($dataRow);\n }\n }\n }\n\n return $writer->getContents();\n }", "public function exportCsv(){\n $data = array(\n array(\"Viande\", \"Morceau\", \"label\", \"Colisage\", \"Qté\")\n );\n foreach ($this->cumulated_products as $product){\n $row = array(\n $product['category'],\n $product['product_name'],\n $product['label_name'],\n $product['description_short'],\n $product['quantity']\n );\n $data[] = $row;\n }\n //Tools::testVar($data);\n //download\n Tools::downloadCsv($data);\n }", "protected function _generateFile(){\r\n\t\tif(!is_dir($this->getExportDirectory())){\r\n\t\t\tmkdir($this->getExportDirectory());\r\n\t\t}\r\n\t\t$fp = fopen($this->getCsvFilePath(), 'w');\r\n\t\tforeach ($this->_productData as $data) {\r\n\t\t\t$this->fputcsv($fp, $data);\r\n\t\t}\r\n\t\tfclose($fp);\r\n\t}", "public function exportProductCsvAction()\n {\n $fileName = 'tag_product.csv';\n $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_grid')\n ->getCsvFile();\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "public function Customer_CSVAction()\n {\n Mage::log(\"Entry Knolseed_Engage_Adminhtml_EngageController::Customer_CSVAction()\",null,'knolseed.log'); \n\n ob_start();\n\n $customer_csv_time = Mage::getStoreConfig('engage_options/customer/cron_time');\n\n $path = Mage::getBaseDir(); # if you want to add new folder for csv files just add name of folder in dir with single quote.\n $customer_enable_flag = Mage::getStoreConfig('engage_options/customer/status');\n if($customer_enable_flag == 1){\n $customervalues = Mage::getModel('engage/customervalues')->toOptionArray();\n\n $new_cust_array = array();\n\n foreach ($customervalues AS $key => $value) {\n $new_cust_array[] = $value['value'];\n }\n\n $customervaluescount = count($new_cust_array);\n\n $fp = fopen($path.\"/Customer_Attributes_\".date(\"m-d-y-g-i-a\").\".csv\", 'x+') or die(Mage::log(\"file opening error!!\"));\n\n $headers = \"\";\n $headers = \" Customer Id ,\".implode(\",\", array_map('trim',$new_cust_array)).\"\\n\";\n fwrite($fp,$headers);\n $model = Mage::getModel('customer/customer'); //getting product model\n $collection = $model->getCollection(); //products collection\n $attribute_values = \"\";\n\n foreach ($collection as $customers) //loop for getting products\n { \n $customer = Mage::getModel('customer/customer')->load($customers->getId()); \n $attributes = $customer->getAttributes();\n \n $attribute_values .= '\"'.$customer->getId().'\",';\n \n foreach( $new_cust_array as $key => $vals )\n { \n $attributeValue = $customer->getData( $vals ) ;\n \n if( $vals == \"default_billing\" || $vals == \"default_shipping\" ) {\n \n $address = Mage::getModel('customer/address')->load($attributeValue);\n $htmlAddress = $address->format('html');\n $string = (string)$htmlAddress;\n $string = ereg_replace(\"[ \\t\\n\\r]+\", \"\", $string);\n $string= str_replace(array('<br/>', ',', '<br />'), ' ', $string);\n $attribute_values .='\"'.str_replace('\"','\\\"',$string).'\",';\n\n } else {\n\n $string = ereg_replace(\"[ \\t\\n\\r]+\", \"\", $attributeValue);\n\n $string=str_replace('\"','\\\"',$string);\n $attribute_values .= '\"'.str_replace(array('<br/>', ',', '<br />'), ' ', $string).'\",';\n }\n \n }\n $attribute_values .= \"\\n\";\n }\n \n fwrite($fp,$attribute_values);\n fclose($fp); \n\n $filepath = $path.\"/Customer_Attributes_\".date(\"m-d-y-g-i-a\").\".csv\";\n $this->getResponse ()\n ->setHttpResponseCode ( 200 )\n ->setHeader ( 'Pragma', 'public', true )\n ->setHeader ( 'Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true )\n ->setHeader ( 'Content-type', 'application/force-download' )\n ->setHeader ( 'Content-Length', filesize($filepath) )\n ->setHeader ('Content-Disposition', '' . '; filename=' . basename($filepath) );\n $this->getResponse ()->clearBody ();\n $this->getResponse ()->sendHeaders ();\n readfile ( $filepath );\n #unlink($filepath);\n }else{\n $url = Mage::helper(\"adminhtml\")->getUrl(\"adminhtml/system_config/edit/section/engage_options/\");\n header(\"Location: \".$url);\n ob_end_flush();\n } \n\n }", "public function exportProductDetailCsvAction()\n {\n $fileName = 'tag_product_detail.csv';\n $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_detail_grid')\n ->getCsvFile();\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "public function exportCsvCurrentAction()\n {\n $path = Mage::getBaseDir('export');\n $fileName = $path . DS . 'Kronosav' . '.csv';\n\n $file = fopen($fileName, 'w');\n\n /** @var Mage_Core_Model_Mysql4_Collection_Abstract $products */\n $products = Mage::getModel('scrappagescheme/scrap')->getCollection();\n\n //make header\n $data = array(\n 'id',\n 'name',\n 'sku',\n 'discount_percentage',\n );\n fputcsv($file, $data);\n\n $i = 1;\n /** @var Mage_Catalog_Model_Product $product */\n foreach ($products as $product) {\n $data = array(\n $i++,\n $product->getName(),\n $product->getSku(),\n $product->getData('percentage'), //discount percentage\n );\n\n fputcsv($file, $data);\n }\n\n fclose($file);\n\n $this->_prepareDownloadResponse('scrappagescheme.csv',\n array(\n 'type' => 'filename',\n 'value' => $fileName,\n 'rm' => true,\n )\n );\n }", "public function writeProductToCsv(){\n $output = fopen('productsferreteria.csv', 'w');\n $vectorProductosLabel = array(\n \"ID\",\n \"Active\",\n \"Name\",\n \"Categories\",\n \"Price\",\n \"Tax\",\n \"Wholesale price\",\n \"OnSale\",\n \"Discount\",\n \"DiscountPercent\",\n \"DiscountFrom\",\n \"DiscountTo\",\n \"Reference\",\n \"SupplierReference\",\n \"Supplier\",\n \"Manufacturer\",\n \"Ean13\",\n \"Upc\",\n \"Ecotax\",\n \"Width\",\n \"Height\",\n \"Depth\",\n \"Weight\",\n \"Quantity\",\n \"MinimalQuantity\",\n \"Visibility\",\n \"AdditionalShippingCost\",\n \"Unity\",\n \"UnityPrice\",\n \"ShortDescription\",\n \"Description\",\n \"Tags\",\n \"Metatitle\",\n \"MetaKeywords\",\n \"MetaDescription\",\n \"UrlRewritten\",\n \"TextStock\",\n \"TextBackorder\",\n \"Avaiable\",\n \"ProductAvaiableDate\",\n \"ProductCreationDate\",\n \"ShowPrice\",\n \"ImageUrls\",\n \"DeleteExistingImages\",\n \"Feature\",\n \"AvaiableOnline\",\n \"Condition\",\n \"Customizable\",\n \"Uploadable\",\n \"TextFields\",\n \"OutStock\",\n \"IdNameShop\",\n \"AdvancedStockManagement\",\n \"DependsOnStock\",\n \"Warehouse\"\n );\n $vectorProductos = array();\n array_push($vectorProductos,$vectorProductosLabel);\n $contadorIdCat = 0;\n $contadorProductos = 0;\n $contadorProductosCategorias = 0;\n foreach($this->productoNombre as $producto){\n echo \"<br><br>\";\n echo \"----------- PRODUCTO ---------<BR>\";\n if ($this->vectorNProductosIdCat[$contadorIdCat] == $contadorProductosCategorias){\n $contadorProductosCategorias = 0;\n $contadorIdCat++;\n }\n $parent = $this->vectorIdCat[$contadorIdCat];\n\n echo \"Nombre producto: \".$producto.\"<br>\";\n echo \"Categoria Parent: \".$parent.\"<br>\";\n echo \"Referencia: \".$this->productoReferencia[$contadorProductos].\"<br>\";\n echo \"Precio: \".$this->productoPrecio[$contadorProductos].\"<br>\";\n echo \"Precio Antiguo: \".$this->productoPrecioAntiguo[$contadorProductos].\"<br>\";\n echo \"Marca: \".$this->productoFabricante[$contadorProductos].\"<br>\";\n echo \"Url: \".$this->productoUrl[$contadorProductos].\"<br>\";\n echo \"DescCorta: \".$this->productoDescCorta[$contadorProductos].\"<br><br>\";\n echo \"fotos<br>\";\n $fotoString = \"\";\n foreach($this->productoUrlFotos[$contadorProductos][\"hijos\"] as $foto){\n echo \"foto url: \".$foto.\"<br>\";\n $fotoString.= $foto. \",\";\n }\n $fotoString = substr($fotoString,0,strlen($fotoString)-1);\n echo \"<br>\";\n echo \"Foto String: \".$fotoString.\"<br>\";\n echo \"Descripcion larga: \".$this->productoDescLarga[$contadorProductos].\"<br>\";\n echo \"<br>\";\n foreach($this->caracteristicasDefault as $caracteristica){\n echo \"caracteristica default: \".$caracteristica.\"<br>\";\n }\n echo \"<br>\";\n echo \"caracteristica: \".$this->caracteristicas[$contadorProductos].\"<br>\";\n echo \"<br><br>\";\n\n $contadorTemp = $contadorProductos + 1;\n $vectorValores = array(\n $contadorTemp,\n 1,\n rtrim(ltrim($producto)),\n $parent,\n rtrim(ltrim($this->productoPrecio[$contadorProductos])),\n \"31\",\n rtrim(ltrim($this->productoPrecio[$contadorProductos])),\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n rtrim(ltrim($this->productoReferencia[$contadorProductos])),\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"\",\n \"50\",\n \"1\",\n \"both\",\n \"1\",\n \"\",\n \"\",\n rtrim(ltrim($this->productoDescCorta[$contadorProductos])),\n rtrim(ltrim($this->productoDescLarga[$contadorProductos])),\n rtrim(ltrim($producto)),\n rtrim(ltrim($producto)),\n rtrim(ltrim($producto)),\n rtrim(ltrim($producto)),\n \"\",\n \"\",\n \"\",\n \"1\",\n \"\",\n \"\",\n \"1\",\n \"$fotoString\",\n \"\",\n rtrim(ltrim($this->caracteristicas[$contadorProductos])),\n 1,\n \"new\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\",\n \"0\"\n );\n //echo \"caracteristicas: \".$this->caracteristicas[$contadorProductos].\"<br>\";\n array_push($vectorProductos,$vectorValores);\n $contadorProductosCategorias++;\n $contadorProductos++;\n //echo \"--------- Fin de Producto ---------<br><br><br>\";\n }\n foreach ($vectorProductos as $campo) {\n fputcsv($output, $campo,';');\n }\n fclose($output);\n //var_dump($this->vectorIdCat);\n //var_dump($this->categoriasNameUrl);\n /*\n var_dump($this->productoNombre);\n var_dump($this->productoReferencia);\n var_dump($this->productoPrecio);\n var_dump($this->productoUrl);\n var_dump($this->productoUrlFotos);\n var_dump($this->productoFabricante);\n var_dump($this->productoDescCorta);\n var_dump($this->productoDescLarga);\n var_dump($this->caracteristicas);\n */\n /*\n foreach($this->caracteristicasDefault as $caracteristica){\n echo \"Caracteristica: \".$caracteristica.\"<br>\";\n }\n */\n }", "private function export_details(){\n $id_lang = (int)Context::getContext()->language->id;\n $start = 0;\n $limit = 100000;\n $order_by = 'id_product';\n $order_way = 'DESC';\n $id_category = false;\n $only_active = true;\n $context = null;\n\n $file = 'productdetails.csv';\n \n $f=fopen('uploads_products/'.$file, 'w');\n \n $all_products = Product::getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category,\n $only_active, $context);\n\n fwrite($f, \"Id_product;Nom;reference;description;descriptioncourte;caractéristique,caracatéristqiue_value,imageurl \\r\\n\");\n $data[0]=array(\"Id_product\",\"Nom\",\"reference\",\"description\",\"descriptioncourte\",\"caractéristique\",\"caracatéristqiue_value\",\"imageurl\");\n foreach($all_products as $product){\n \n $productObj = new Product((int)$product['id_product'] ,$id_lang , 1 );\n \n /** get all features*/\n\n $features = $productObj->getFeatures();\n \n foreach ($features as $feature){\n $feature_name = Feature::getFeature($id_lang, $feature[\"id_feature\"]);\n $featurevalues = FeatureValue::getFeatureValuesWithLang($id_lang,$feature[\"id_feature\"] , false); \n }\n \n /** get all images */\n $imgs = $productObj->getImages(Context::getContext()->language->id , null);\n $img = $productObj->getCover($product['id_product']);\n $link = new Link();\n //var_dump($productObj->name);die;\n $img_url = $link->getImageLink(isset($productObj->link_rewrite) ? $productObj->link_rewrite : $productObj->name , (int)$img['id_image']);\n \n $image_list = $img_url ;\n\n foreach($imgs as $image){\n $img_url2 = $link->getImageLink(isset($productObj->link_rewrite) ? $productObj->link_rewrite : $productObj->name, (int)$image['id_image']);\n if($img_url !== $img_url2 ){\n $image_list .=\",\".$img_url2 ;\n }\n }\n \n $id_produit = $productObj->id;\n $name = $productObj->name ;\n $reference = $productObj->reference ;\n $description_short = $productObj->description_short;\n $description = $productObj->description ; \n \n $feature_ch = '';\n foreach($featurevalues as $featurevalue){\n $feature_ch .='-'.$featurevalue[\"value\"].';';\n }\n \n $data[$productObj->id] = \n array($id_produit,$name,$reference,$description,$description_short,$feature_name[\"name\"],$feature_ch,$image_list);\n \n } \n \n $fp = fopen(dirname(__FILE__).'/uploads_products/'.$file, 'w');\n \n foreach ($data as $fields) {\n if(is_array($fields)){\n fputcsv($fp, $fields);\n }\n }\n fclose($fp);\n $filesize = filesize(dirname(__FILE__).'/uploads_products/'.$file);\n\n header('Content-Type: text/csv; charset=utf-8');\n header('Cache-Control: no-store, no-cache');\n header('Content-Disposition: attachment; filename=\"'.$file.'\"');\n header('Content-Length: '.$filesize);\n readfile(dirname(__FILE__).'/uploads_products/'.$file);\n }", "public function exportCsvEmptyAction()\n {\n $path = Mage::getBaseDir('export');\n $fileName = $path . DS . 'Kronosav' . '.csv';\n\n $file = fopen($fileName, 'w');\n\n /** @var Mage_Core_Model_Mysql4_Collection_Abstract $products */\n $products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('name');\n\n //make header\n $data = array(\n 'id',\n 'name',\n 'sku',\n 'discount_percentage',\n );\n fputcsv($file, $data);\n\n $i = 1;\n /** @var Mage_Catalog_Model_Product $product */\n foreach ($products as $product) {\n $data = array(\n $i++,\n $product->getName(),\n $product->getSku(),\n 0, //discount percentage\n );\n\n fputcsv($file, $data);\n }\n\n fclose($file);\n\n $this->_prepareDownloadResponse('scrappagescheme.csv',\n array(\n 'type' => 'filename',\n 'value' => $fileName,\n 'rm' => true,\n )\n );\n }", "public function export (){\n $type = I('type',1,'intval');\n // 工厂内\n if($type == 1){\n $product_list = M('product')->where(['is_where'=>1])->select();\n $header = [\"箱子属性\",\"箱子编号\",\"入库时间\"];\n $data = [];\n foreach($product_list as $product){\n $data[] = [$product['cate_name'],$product['name'],date(\"Y-m-d H:i\", $product['update_time'])];\n }\n return $this->exportCsv($header, $data,date(\"Y-m-d-\").\"工厂内\");\n }\n\n if($type == 2){\n $product_list = M('product')->where(['is_where'=>2])->order(\"cate_name, client_id\")->select();\n $header = [\"箱子属性\",\"箱子编号\",\"客户代码\",\"出库时间\"];\n $data = [];\n foreach($product_list as $product){\n $data[] = [$product['cate_name'], $product['name'],$product['client_name'],date(\"Y-m-d H:i\", $product['update_time'])];\n }\n return $this->exportCsv($header, $data,date(\"Y-m-d-\").\"工厂外\");\n }\n }", "public function exportProductsCsvAction()\n {\n if (!$category = $this->_initCategory(true,true)) {\n return;\n }\n\n $fileName = 'products_by_category('.$category->getName().').csv';\n $grid = $this->getLayout()->createBlock('adminhtml/catalog_category_tab_product');\n\n $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());\n\n }", "public function export(){\n $products = $this->Paginator->paginate($this->Products->find());\n\n $this->autoRender = false;\n $this->layout = false;\n $fileName = \"bookreport_\".date(\"d-m-y:h:s\").\".xls\";\n\n $headerRow = array(\"ID\", \"Title\", \"Type\", \"Description\", \"Price\", \"Rating\");\n $data = array();\n foreach ($products as $product) {\n array_push($data, array($product->id, $product->description, $product->title, $product->price, $product->rating));\n }\n //debug($data);\n ini_set('max_execution_time', 1600); //increase max_execution_time to 10 min if data set is very large\n $fileContent = implode(\"\\t \", $headerRow).\"\\n\";\n foreach($data as $result) {\n $fileContent .= implode(\"\\t \", $result).\"\\n\";\n }\n header('Content-type: application/ms-excel'); /// you can set csv format\n header('Content-Disposition: attachment; filename='.$fileName);\n echo $fileContent;\n }", "public function exportProductsExcelAction()\n {\n if (!$category = $this->_initCategory(true,true)) {\n return;\n }\n $fileName = 'products_by_category('.$category->getName().').csv';\n $grid = $this->getLayout()->createBlock('adminhtml/catalog_category_tab_product');\n $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));\n }", "function csv_export() {\t\t\n\t\t$db = & JFactory::getDBO();\n\t\tif (!EventBookingHelper::canExportRegistrants()) {\n\t\t\tJFactory::getApplication()->redirect('index.php', JText::_('EB_NOT_ALLOWED_TO_EXPORT'));\n\t\t}\t\t\t\t\n\t\tif (version_compare(JVERSION, '1.6.0', 'ge')) {\n\t\t\t$param = null ;\n\t\t} else {\n\t\t\t$param = 0 ;\n\t\t}\n\t\t$taxEnabled = $config->enable_tax && ($config->tax_rate > 0) ;\n\t\t$eventId = JRequest::getInt('event_id') ;\n\t\t$where = array() ;\n\t\t$where[] = '(a.published = 1 OR (a.payment_method=\"os_offline\" AND a.published != 2))' ;\n\t\tif ($eventId)\n\t\t\t$where[] = ' a.event_id='.$eventId ;\n\t\tif (isset($config->include_group_billing_in_csv_export) && !$config->include_group_billing_in_csv_export)\n\t\t\t$where[] = ' a.is_group_billing = 0 ' ;\n\t\tif ($config->show_coupon_code_in_registrant_list) {\n\t\t\t$sql = 'SELECT a.*, b.event_date, b.title AS event_title, c.code AS coupon_code FROM #__eb_registrants AS a INNER JOIN #__eb_events AS b ON a.event_id = b.id LEFT JOIN #__eb_coupons AS c ON a.coupon_id=c.id WHERE '.implode(' AND ', $where).' ORDER BY a.id ';\n\t\t} else {\n\t\t\t$sql = 'SELECT a.*, b.event_date, b.title AS event_title FROM #__eb_registrants AS a INNER JOIN #__eb_events AS b ON a.event_id = b.id WHERE '.implode(' AND ', $where).' ORDER BY a.id ';\n\t\t}\n\t\t$db->setQuery($sql) ;\n\t\t$rows = $db->loadObjectList();\n\t\tif (count($rows) == 0) {\n\t\t\tJFactory::getApplication()->redirect('index.php', JText::_('EB_NO_REGISTRANTS_TO_EXPORT'));\n\t\t}\n\t\tif ($eventId)\n\t\t\t$sql = 'SELECT id, title FROM #__eb_fields WHERE published=1 AND (event_id = -1 OR id IN (SELECT field_id FROM #__eb_field_events WHERE event_id='.$eventId.')) ORDER BY ordering';\n\t\telse\n\t\t\t$sql = 'SELECT id, title FROM #__eb_fields WHERE published=1 ORDER BY ordering';\n\t\t$db->setQuery($sql) ;\n\t\t$rowFields = $db->loadObjectList() ;\n\t\t//Get the custom fields value and store them into an array\n\t\n\t\t$sql = 'SELECT id FROM #__eb_registrants AS a WHERE '.implode(' AND ', $where) ;\n\t\t$db->setQuery($sql) ;\n\t\t$registrantIds = array(0) ;\n\t\t$registrantIds = array_merge($registrantIds, $db->loadResultArray()) ;\n\t\t$sql = 'SELECT registrant_id, field_id, field_value FROM #__eb_field_values WHERE registrant_id IN ('.implode(',', $registrantIds).')';\n\t\t$db->setQuery($sql) ;\n\t\t$rowFieldValues = $db->loadObjectList();\n\t\t$fieldValues = array() ;\n\t\tfor ($i = 0 , $n = count($rowFieldValues) ; $i < $n ; $i++) {\n\t\t\t$rowFieldValue = $rowFieldValues[$i] ;\n\t\t\t$fieldValues[$rowFieldValue->registrant_id][$rowFieldValue->field_id] = $rowFieldValue->field_value ;\n\t\t}\n\t\t//Get name of groups\n\t\t$groupNames = array() ;\n\t\t$sql = 'SELECT id, first_name, last_name FROM #__eb_registrants AS a WHERE is_group_billing = 1'. (COUNT($where) ? ' AND '.implode(' AND ', $where) : '');\n\t\t$db->setQuery($sql);\n\t\t$rowGroups = $db->loadObjectList() ;\n\t\tif (count($rowGroups)) {\n\t\t\tforeach ($rowGroups as $rowGroup) {\n\t\t\t\t$groupNames[$rowGroup->id] = $rowGroup->first_name . ' '.$rowGroup->last_name ;\n\t\t\t}\n\t\t}\n\t\tif(count($rows)){\n\t\t\t$results_arr=array();\n\t\t\t$csv_output = JText::_('EB_EVENT');\n\t\t\tif ($config->show_event_date) {\n\t\t\t\t$csv_output .= \",\". JText::_('EB_EVENT_DATE') ;\n\t\t\t}\n\t\t\t$csv_output .= \", \". JText::_('EB_FIRST_NAME') ;\n\t\t\tif ($config->s_lastname)\n\t\t\t\t$csv_output .= \", \". JText::_('EB_LAST_NAME');\n\t\t\tif ($config->s_organization)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ORGANIZATION');\n\t\t\tif ($config->s_address)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ADDRESS');\n\t\t\tif ($config->s_address2)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ADDRESS2');\n\t\t\tif ($config->s_city)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_CITY');\n\t\t\tif ($config->s_state)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_STATE');\n\t\t\tif ($config->s_zip)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_ZIP');\n\t\t\tif ($config->s_country)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_COUNTRY');\n\t\t\tif ($config->s_phone)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_PHONE');\n\t\t\tif ($config->s_fax)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_FAX');\n\t\t\t$csv_output .= ', '. JText::_('EB_EMAIL');\n\t\t\t$csv_output .= ', '. JText::_('EB_NB_REGISTRANTS');\n\t\t\t$csv_output .= ', '. JText::_('EB_AMOUNT');\n\t\t\tif ($taxEnabled) {\n\t\t\t\t$csv_output .= ', '. JText::_('EB_TAX');\n\t\t\t}\n\t\t\tif ($config->activate_deposit_feature) {\n\t\t\t\t$csv_output .= ', '. JText::_('EB_DEPOSIT_AMOUNT');\n\t\t\t\t$csv_output .= ', '. JText::_('EB_DUE_AMOUNT');\n\t\t\t}\n\t\t\tif ($config->show_coupon_code_in_registrant_list) {\n\t\t\t\t$csv_output .= ','. JText::_('EB_COUPON');\n\t\t\t}\n\t\t\t$csv_output .= ','. JText::_('EB_REGISTRATION_DATE');\n\t\t\t$csv_output .= ','. JText::_('EB_TRANSACTION_ID');\n\t\t\t$csv_output .= ', '. JText::_('EB_PAYMENT_STATUS');\n\t\t\tif (count($rowFields)) {\n\t\t\t\tforeach ($rowFields as $rowField)\n\t\t\t\t\t$csv_output .= ', '.$rowField->title ;\n\t\t\t}\n\t\t\tif ($config->s_comment)\n\t\t\t\t$csv_output .= ', '. JText::_('EB_COMMENT');\n\t\t\tforeach($rows as $r) {\n\t\t\t\t$results_arr=array();\n\t\t\t\t$results_arr[]=$r->event_title ;\n\t\t\t\tif ($config->show_event_date) {\n\t\t\t\t\t$results_arr[] = JHTML::_('date', $r->event_date, $config->date_format, $param) ;\n\t\t\t\t}\n\t\t\t\tif ($r->is_group_billing)\n\t\t\t\t\t$results_arr[]=$r->first_name.' '.JText::_('EB_GROUP_BILLING');\n\t\t\t\telseif ($r->group_id > 0)\n\t\t\t\t$results_arr[]=$r->first_name.' '.JText::_('EB_GROUP').$groupNames[$r->group_id] ;\n\t\t\t\telse\n\t\t\t\t\t$results_arr[]=$r->first_name ;\n\t\t\t\tif ($config->s_lastname)\n\t\t\t\t\t$results_arr[]=$r->last_name ;\n\t\t\t\tif ($config->s_organization)\n\t\t\t\t\t$results_arr[]=$r->organization;\n\t\t\t\tif ($config->s_address)\n\t\t\t\t\t$results_arr[]=$r->address;\n\t\t\t\tif ($config->s_address2)\n\t\t\t\t\t$results_arr[]=$r->address2;\n\t\t\t\tif ($config->s_city)\n\t\t\t\t\t$results_arr[]=$r->city;\n\t\t\t\tif ($config->s_state)\n\t\t\t\t\t$results_arr[]=$r->state;\n\t\t\t\tif ($config->s_zip)\n\t\t\t\t\t$results_arr[]=$r->zip;\n\t\t\t\tif ($config->s_country)\n\t\t\t\t\t$results_arr[]=$r->country;\n\t\t\t\tif ($config->s_phone)\n\t\t\t\t\t$results_arr[]=$r->phone;\n\t\t\t\tif ($config->s_fax)\n\t\t\t\t\t$results_arr[]=$r->fax;\n\t\t\t\t$results_arr[]=$r->email;\n\t\t\t\t$results_arr[] = $r->number_registrants ;\n\t\t\t\t$results_arr[]= number_format($r->amount, 2);\n\t\t\t\tif ($taxEnabled)\n\t\t\t\t\t$results_arr[]= number_format($r->tax_amount, 2);\n\t\t\t\tif ($config->activate_deposit_feature) {\n\t\t\t\t\tif ($r->deposit_amount > 0) {\n\t\t\t\t\t\t$results_arr[]= number_format($r->deposit_amount, 2);\n\t\t\t\t\t\t$results_arr[]= number_format($r->amount - $r->deposit_amount, 2);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$results_arr[]= '';\n\t\t\t\t\t\t$results_arr[]= '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\tif ($config->show_coupon_code_in_registrant_list) {\n\t\t\t\t\t$results_arr[]= $r->coupon_code ;\n\t\t\t\t}\n\t\n\t\t\t\t$results_arr[]= JHTML::_('date', $r->register_date, $config->date_format, $param);\n\t\t\t\t$results_arr[]= $r->transaction_id ;\n\t\t\t\tif ($r->published) {\n\t\t\t\t\t$results_arr[]= 'Paid' ;\n\t\t\t\t} else {\n\t\t\t\t\t$results_arr[]= 'Not Paid' ;\n\t\t\t\t}\n\t\t\t\tif (count($rowFields))\n\t\t\t\t\tforeach ($rowFields as $rowField) {\n\t\t\t\t\t$results_arr[] = @$fieldValues[$r->id][$rowField->id] ;\n\t\t\t\t}\n\t\t\t\tif ($config->s_comment)\n\t\t\t\t\t$results_arr[]= $r->comment;\n\t\t\t\t$csv_output .= \"\\n\\\"\".implode (\"\\\",\\\"\", $results_arr).\"\\\"\";\n\t\t\t}\n\t\t\t$csv_output .= \"\\n\";\n\t\t\tif (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {\n\t\t\t\t$UserBrowser = \"Opera\";\n\t\t\t}\n\t\t\telseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {\n\t\t\t\t$UserBrowser = \"IE\";\n\t\t\t} else {\n\t\t\t\t$UserBrowser = '';\n\t\t\t}\n\t\t\t$mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream';\n\t\t\t$filename = \"registrants_list\";\n\t\t\t@ob_end_clean();\n\t\t\tob_start();\n\t\t\theader('Content-Type: ' . $mime_type);\n\t\t\theader('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n\t\t\tif ($UserBrowser == 'IE') {\n\t\t\t\theader('Content-Disposition: attachment; filename=\"' . $filename . '.csv\"');\n\t\t\t\theader('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n\t\t\t\theader('Pragma: public');\n\t\t\t}\n\t\t\telse {\n\t\t\t\theader('Content-Disposition: attachment; filename=\"' . $filename . '.csv\"');\n\t\t\t\theader('Pragma: no-cache');\n\t\t\t}\n\t\t\tprint $csv_output;\n\t\t\texit();\n\t\t}\n\t}", "public function exportDetailedAction(){\n $fileName = 'facturas-detalladas-' . gmdate('Y_m_d-H_i_s') . '.csv';\n $grid = $this->getLayout()->createBlock('adminhtml/sales_invoice_grid');\n $this->_prepareDownloadResponse($fileName, $grid->getDetailedFile());\n }", "public function getCsvFile($isProductSetupMode = false)\n {\t\n \t$io = new Varien_Io_File();\n \t$path = Mage::getBaseDir('var') . DS . 'export' . DS;\n \t$name = md5(microtime());\n \t$file = $path . DS . $name;\n \n \t$io->setAllowCreateFolders(true);\n \t$io->open(array('path' => $path));\n \t$io->streamOpen($file, 'w+');\n \t$io->streamLock(true);\n \t($isProductSetupMode) ? $io->streamWriteCsv(array('magento_sku','vendor_sku')) : $io->streamWriteCsv(array('vendor_sku','qty','cost'));\n \t\t$io->streamUnlock();\n \t$io->streamClose();\n \treturn array(\n \t\t\t'type' => 'filename',\n \t\t\t'value' => $file,\n \t\t\t'rm' => true // can delete file after use\n \t);\n }", "public function exportAction()\n\t{\n\t\t// start the model to find available options\n\t\t$model = new $this->_primaryModel;\n\t\t\n\t\t// fetch items\n\t\t$items = $model->fetchNotTrashed()->toArray();\n\t\t\t\t\t\t\n\t\t// fetch field names\n\t\t$fields = $model->info(Zend_Db_Table_Abstract::COLS);\n\t\t\t\t\n\t\t// construct filename\n\t\t$filename = str_replace(\"Default_Model_\", \"\", $this->_primaryModel);\n\t\t$filename .= date(\"_Y-m-d_H-i\");\n\t\t$filename .= \".csv\";\n\t\t\n\t\t// create file\n\t\t$file = APPLICATION_PATH . '/data/exports/'.$filename;\n\t\t$fp = fopen($file, 'w');\n\t\tchmod($file, 0755);\n\t\t\t\t\n\t\t// add field names to start of file\n\t\tfputcsv($fp, $fields);\t\t\n\t\t\n\t\t// loop through results\n\t\tforeach ($items as $key => $values) {\n\t\t\tfputcsv($fp, $values);\n\t\t}\n\n\t\t\n\t\t// Both layout and view renderer should be disabled\n Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true);\n\n\t\t// no need for the layout\n\t\t$this->_helper->layout->disableLayout();\n\t\t$this->_response\n\t\t\t->setHeader('Content-Type', 'text/plain; charset=utf-8')\n\t\t\t->setHeader(\"Expires\",\" Mon, 26 Jul 1997 05:00:00 GMT\")\n\t\t\t->setHeader(\"Last-Modified\", gmdate(\"D,d M YH:i:s\") . \" GMT\")\n\t\t\t->setHeader(\"Cache-Control\",\"no-cache, must-revalidate\")\n\t\t\t->setHeader(\"Pragma\",\"no-cache\")\n\t\t\t->setHeader(\"Content-type\",\"text/plain\")\n\t\t\t->setHeader(\"Content-Disposition\",\"attachment; filename=\\\"\" . $filename . \"\\\"\" )\n\t\t\t->setHeader(\"Content-Description\",\"PHP/INTERBASE Generated Data\");\n\t readfile($file);\n\t}", "public function exportCsv(){\n $user = $this->_ap_right_check();\n if(!$user){\n return;\n }\n $query = $this->{$this->main_model}->find(); \n $this->CommonQuery->build_ap_query($query,$user); //AP QUERY is sort of different in a way\n \n $q_r = $query->all();\n\n //Headings\n $heading_line = array();\n if(isset($this->request->query['columns'])){\n $columns = json_decode($this->request->query['columns']);\n foreach($columns as $c){\n array_push($heading_line,$c->name);\n }\n }\n \n $data = [\n $heading_line\n ];\n \n foreach($q_r as $i){\n\n $columns = array();\n $csv_line = array();\n if(isset($this->request->query['columns'])){\n $columns = json_decode($this->request->query['columns']);\n foreach($columns as $c){\n $column_name = $c->name;\n if($column_name == 'notes'){\n $notes = '';\n foreach($i->user_notes as $un){\n if(!$this->Aa->test_for_private_parent($un->note,$user)){\n $notes = $notes.'['.$un->note->note.']'; \n }\n }\n array_push($csv_line,$notes);\n }elseif($column_name =='owner'){\n $owner_id = $i->parent_id;\n $owner_tree = $this->Users->find_parents($owner_id);\n array_push($csv_line,$owner_tree); \n }else{\n array_push($csv_line,$i->{$column_name}); \n }\n }\n array_push($data,$csv_line);\n }\n }\n \n $_serialize = 'data';\n $this->setResponse($this->getResponse()->withDownload('export.csv'));\n $this->viewBuilder()->setClassName('CsvView.Csv');\n $this->set(compact('data', '_serialize')); \n }", "function export_system_records_csv() {\n\t$sql = \"SELECT * from system_records_tbl\";\n\t$result = runQuery($sql);\n\t\n\t# open file\n\t$export_file = \"downloads/system_records_export.csv\";\n\t$handler = fopen($export_file, 'w');\n\t\n\tfwrite($handler, \"system_records_id,system_records_name,system_records_description,system_records_disabled\\n\");\n\tforeach($result as $line) {\n\t\tfwrite($handler,\"$line[system_records_id],$line[system_records_name],$line[system_records_descripion],$line[system_records_disabled]\\n\");\n\t}\n\t\n\tfclose($handler);\n\n}", "public function generate(){\r\n\t\t$this->Product->bindName($this->Product, 1, false);\r\n\t\t$this->Product->bindMeta($this->Product, 1, false);\r\n\t\t$this->Product->bindDescription($this->Product, 1, false);\r\n\t\t$this->Product->bindPrice(1, false);\r\n\t\t\r\n\t\t$this->Category->bindName($this->Category, 1, false);\r\n\t\t$this->Category->unbindModel(array('hasAndBelongsToMany' => array('Product')), false);\r\n\t\t\r\n\t\t$records = $this->Product->find('all', array('conditions' => array(\r\n\t\t\t'Product.active' => 1,\r\n\t\t)));\r\n\r\n\t\t$fh = fopen($this->filePath, 'w');\r\n\r\n\t\t// Output the header row\r\n\t\tfwrite($fh, 'HDR|' . $this->merchantId . '|' . $this->companyName . '|' . date('Y-m-d/H:i:s') . PHP_EOL);\r\n\r\n\t\tforeach($records as $record){\r\n\t\t\t// Primary & Secondary category\r\n\t\t\t$primaryCatId = null;\r\n\t\t\tforeach($record['ProductCategory'] as $cat){\r\n\t\t\t\tif($cat['primary']){\r\n\t\t\t\t\t$primaryCatId = $cat['category_id'];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$primaryCategoryName = '';\r\n\t\t\t$secondaryCategoryName = '';\r\n\t\t\tif(!empty($primaryCatId)){\r\n\t\t\t\t$primaryCategory = $this->Category->find('first', array(\r\n\t\t\t\t\t'conditions' => array('Category.id' => $primaryCatId),\r\n\t\t\t\t));\r\n\r\n\t\t\t\t$secondaryCategory = $this->Category->getparentnode($primaryCategory['Category']['id']);\r\n\r\n\t\t\t\t$primaryCategoryName = $primaryCategory['CategoryName']['name'];\r\n\r\n\t\t\t\tif(!empty($secondaryCategory)){\r\n\t\t\t\t\t$secondaryCategory = $this->Category->find('first', array(\r\n\t\t\t\t\t\t'conditions' => array('Category.id' => $secondaryCategory['Category']['id']),\r\n\t\t\t\t\t));\r\n\r\n\t\t\t\t\t$secondaryCategoryName = $secondaryCategory['CategoryName']['name'];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Product Image\r\n\t\t\t$productImageUrl = '';\r\n\t\t\tif(!empty($record['ProductImage'][0]['large_web_path'])){\r\n\t\t\t\t$productImageUrl = $this->baseUrl . substr($record['ProductImage'][0]['large_web_path'], 1);\r\n\t\t\t}\r\n\r\n\t\t\t// Pricing\r\n\t\t\tif($record['ProductPrice']['on_special']){\r\n\t\t\t\t$price = $record['ProductPrice']['base_price'];\r\n\t\t\t\t$specialPrice = $record['ProductPrice']['active_price'];\r\n\t\t\t} else {\r\n\t\t\t\t$price = $record['ProductPrice']['active_price'];\r\n\t\t\t\t$specialPrice = null;\r\n\t\t\t}\r\n\r\n\t\t\t$fields = array(\r\n\t\t\t\t'product_id' => $record['Product']['id'],\r\n\t\t\t\t'product_name' => $record['ProductName']['name'],\r\n\t\t\t\t'sku' => $record['Product']['sku'],\r\n\t\t\t\t'primary_category' => (!empty($primaryCategoryName) ? $primaryCategoryName : ''),\r\n\t\t\t\t'secondary_category' => (!empty($secondaryCategoryName) ? $secondaryCategoryName : ''),\r\n\t\t\t\t'product_url' => $this->baseUrl . $record['ProductMeta']['url'],\r\n\t\t\t\t'image_url' => $productImageUrl,\r\n\t\t\t\t'buy_url' => null,\r\n\t\t\t\t'short_product_description' => $record['ProductDescription']['short_description'],\r\n\t\t\t\t'long_product_description' => $record['ProductDescription']['long_description'],\r\n\t\t\t\t'discount' => null,\r\n\t\t\t\t'discount_type' => null,\r\n\t\t\t\t'sale_price' => $specialPrice,\r\n\t\t\t\t'retail_price' => $price,\r\n\t\t\t\t'begin_date' => null,\r\n\t\t\t\t'end_date' => null,\r\n\t\t\t\t'brand' => null,\r\n\t\t\t\t'shipping' => null,\r\n\t\t\t\t'is_deleted' => 'N',\r\n\t\t\t\t'keywords' => null,\r\n\t\t\t\t'is_all' => 'Y',\r\n\t\t\t\t'manufacturer_part_no' => null,\r\n\t\t\t\t'manufacturer_name' => null,\r\n\t\t\t\t'shipping_info' => null,\r\n\t\t\t\t'availability' => null,\r\n\t\t\t\t'universal_product_code' => null,\r\n\t\t\t\t'class_id' => null,\r\n\t\t\t\t'is_product_link' => 'Y',\r\n\t\t\t\t'is_storefront' => 'Y',\r\n\t\t\t\t'is_merchandiser' => 'Y',\r\n\t\t\t\t'currency' => 'GBP',\r\n\t\t\t\t'M1' => null\r\n\t\t\t);\r\n\r\n\t\t\tfwrite($fh, implode('|', $fields) . PHP_EOL);\r\n\t\t}\r\n\r\n\t\t$num_rows = count($records);\r\n\r\n\t\tfwrite($fh, 'TRL|' . $num_rows);\r\n\r\n\t\tfclose($fh);\r\n\r\n\t\t$this->out('Created products file: ' . $this->filePath);\r\n\t}", "public function exportCsvAction() \n {\n $fileName = 'appreport.csv';\n $content = $this->getLayout()\n ->createBlock('simiconnector/adminhtml_appreport_grid')\n ->getCsv();\n $this->_prepareDownloadResponse($fileName, $content);\n }", "public function exportreport()\n {\n\n $start_date = $this->input->post('start_date');\n $end_date = $this->input->post('end_date');\n $supplier_id = $this->input->post('supplier_id');\n\n $file_name = 'PO Report From:' . $start_date . 'To: ' . $end_date . '.csv';\n header(\"Content-Description: File Transfer\");\n header(\"Content-Disposition: attachment; filename=$file_name\");\n header(\"Content-Type: application/csv;\");\n\n // file creation \n $file = fopen('php://output', 'w');\n\n $header = [\n 'Description',\n 'Qty',\n 'Unit',\n 'Cost',\n 'Total Cost',\n 'Date Needed',\n 'Purpose',\n 'Date Filed',\n 'Supplier',\n 'Category',\n 'Terms'\n ];\n\n fputcsv($file, $header);\n\n // get data\n $po_data = $this->POModel->fetch_generated_po_data($start_date, $end_date, $supplier_id);\n $total_amount = 0;\n $total_items = 0;\n\n foreach ($po_data as $row) {\n $po_items_data = $this->POModel->fetch_generated_po_items_data($row->po_id);\n\n foreach ($po_items_data as $row1) {\n $requisition_items_data = $this->POModel->fetch_requisition_items_data($row1->requisition_item_id);\n\n foreach ($requisition_items_data as $row2) {\n\n $sub_array = array();\n $total_cost = $row2->unit_cost * $row2->qty;\n $total_amount = $total_amount + $total_cost;\n $total_items = $total_items + 1;\n\n $sub_array[] = $row2->description;\n $sub_array[] = $row2->qty;\n $sub_array[] = $row2->unit;\n $sub_array[] = $row2->unit_cost;\n $sub_array[] = $total_cost;\n $sub_array[] = date_format(date_create($row2->date_needed), 'F d, Y');\n $sub_array[] = $row2->purpose;\n $sub_array[] = date_format(date_create($row->date_filed), 'F d, Y');\n $sub_array[] = $row->name;\n $sub_array[] = $row->vendor_category;\n\n if ($row->terms_and_condition == \"00\") {\n $terms = 'COD/Cash';\n } elseif ($row->terms_and_condition == \"01\") {\n $terms = 'Dated';\n } elseif ($row->terms_and_condition == \"02\") {\n $terms = '7 Days';\n } elseif ($row->terms_and_condition == \"03\") {\n $terms = '15 Days';\n } elseif ($row->terms_and_condition == \"04\") {\n $terms = '30 Days';\n } elseif ($row->terms_and_condition == \"05\") {\n $terms = '45 Days';\n } elseif ($row->terms_and_condition == \"06\") {\n $terms = '60 Days';\n } elseif ($row->terms_and_condition == \"07\") {\n $terms = '90 Days';\n } elseif ($row->terms_and_condition == \"08\") {\n $terms = '21 Days';\n }\n $sub_array[] = $terms;\n\n fputcsv($file, $sub_array);\n }\n }\n }\n $array_next_row[] = \"\";\n fputcsv($file, $array_next_row);\n\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"\";\n $array_total_items[] = \"Total Row Items:\";\n $array_total_items[] = $total_items;\n\n fputcsv($file, $array_total_items);\n\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"\";\n $array_total_amount[] = \"Total Amount:\";\n $array_total_amount[] = $total_amount;\n\n fputcsv($file, $array_total_amount);\n\n fclose($file);\n exit;\n }", "function export(){\n\t $options = array(\n\t 'conditions' => $this->getIgnoreConditions()\n\t );\n\t return parent::export($options);\n\t}", "public function exportProductExcelAction()\n {\n $fileName = 'tag_product.xml';\n $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_grid')\n ->getExcelFile($fileName);\n\n $this->_prepareDownloadResponse($fileName, $content);\n }", "function generate($report_mode,$row) {\n\n\tglobal $ORDER_STATUS, $PAYMENT_TYPES, $PAYMENT_STATUS, $ERROR_MESSAGE;\n\n\tLOG_MSG('INFO',\"generate(): START report_mode=[$report_mode], rows=[\".print_r($row,true).\"]\");\n\tswitch ($report_mode) {\n\t\tcase 'HTML':\n\t\t\t\tinclude($row['filename']);\n\t\t\tbreak;\n\t\tcase 'CSV':\n\t\t\t\theader(\"Content-type: application/csv\");\n\t\t\t\theader(\"Content-Disposition: attachment; filename=\".$_SESSION['admin']['shop']['domain'].'_'.$row['report_name'].'_'.date(\"Y-m-d-h-i-s\").'.csv');\n\t\t\t\theader(\"Pragma: no-cache\");\n\t\t\t\theader(\"Expires: 0\");\n\t\t\t\t$nrows=$row[0]['NROWS'];\n\t\t\t\tunset($row[0]['NROWS']);\n\t\t\t\tunset($row[0]['STATUS']);\n\t\t\t\tif ( isset($row[0]['IS_SEARCH']) ) unset($row[0]['IS_SEARCH']);\n\t\t\t\tfor ( $i=0;$i<$nrows;$i++ ) { \n\t\t\t\t\tif ( isset($row[$i]['payment_type']) ) $row[$i]['payment_type']=$PAYMENT_TYPES[$row[$i]['payment_type']]; \n\t\t\t\t\tif ( $row['report_name'] == 'Order_Report' ) {\n\t\t\t\t\t\tunset($row[$i]['order_by']);\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( $row['report_name'] == 'Stock_Report' ) {\n $row[$i]['product']=encode_csv_field($row[$i]['product']);\n }\n\t\t\t\t\t// This loop will print headers\n\t\t\t\t\tif ( $i == 0 ) {\n\t\t\t\t\t\tforeach ( $row[0] AS $key => $value ) {\n\t\t\t\t\t\t\tif ( !$_SESSION['admin']['shop']['is_multistore'] && $key == 'supplier_name' ) continue;\n\t\t\t\t\t\t\tif ($row['report_name'] == 'Bluedart_Report' ) echo \"$key,\";\n\t\t\t\t\t\t\telse echo make_clean_str($key).',';\n\t\t\t\t\t\t}\n\t\t\t\t\t\techo \"\\r\\n\";\n\t\t\t\t\t}\n\n\t\t\t\t\t// This will print the values\n\t\t\t\t\tif ( !$_SESSION['admin']['shop']['is_multistore'] ) unset($row[$i]['supplier_name']);\n\t\t\t\t\t//$row[$i]=encode_csv_field($row[$i]);\n\t\t\t\t\techo implode(',',$row[$i]).\"\\r\\n\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\tcase 'PDF':\n\t\t\t\trequire_once(\"lib/dompdf/dompdf_config.inc.php\");\n\t\t\t\tob_start();\n\t\t\t\tinclude($row['filename']);\n\t\t\t\t$html=ob_get_contents();\t\t// Set mail content\n\t\t\t\tob_get_clean();\n\t\t\t\t$dompdf = new DOMPDF();\n\t\t\t\t$dompdf->load_html($html);\n\t\t\t\tif ( strlen($html) > 80000 ) {\n\t\t\t\t\techo \"Report is too large to generate PDF. Please download CSV instead\";\n\t\t\t\t\tLOG_MSG('INFO',\"Maximum memory reached. String Length=[\".strlen($html).\"bytes]\");\n\t\t\t\t\texit;\t\t\t\n\t\t\t\t}\n\t\t\t\t// For blue dart report,the table width is too large to fit into an A4-portrait\n\t\t\t\tif ( $row['report_name'] == 'Bluedart_Report' ) { \n\t\t\t\t\t$dompdf->set_paper('a3', 'landscape');\n\t\t\t\t}\n\t\t\t\t$dompdf->render();\n\t\t\t\t$dompdf->stream($row['report_name'].'.pdf');\n\t\t\t\tbreak;\n\t\tcase 'EMAIL':\n\t\t\t\t// Get args from POST\n\t\t\t\t$from=get_arg($_GET,\"from\");\n\t\t\t\t$to=get_arg($_GET,\"to\");\n\t\t\t\t$subject=get_arg($_GET,\"subject\");\n\t\t\t\t$content_type=get_arg($_GET,'content_type');\n\t\t\t\t$message=get_arg($_GET,'message');\n\n\t\t\t\t// Validate parameters\n\t\t\t\tif (\n\t\t\t\t\t!validate(\"To address\",$to,5,100,\"EMAIL\") ||\n\t\t\t\t\t!validate(\"From address\",$from,5,100,\"EMAIL\") ||\n\t\t\t\t\t!validate(\"Subject\",$subject,1,100,\"varchar\") ||\n\t\t\t\t\t!validate(\"Message\",$message,0,200,\"varchar\") ){\n\t\t\t\t\tLOG_MSG('ERROR',\"generate(): VALIDATE ARGS FAILED! \".print_r($_POST,true));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// Validate parameters\n\t\t\t\tif ( $content_type != 'pdf_attachment' && $content_type != 'plain_text' ) {\n\t\t\t\t\tadd_msg('ERROR','Invalid Mail mode');\n\t\t\t\t\tLOG_MSG('ERROR',\"generate(): VALIDATE ARGS FAILED! Invalid Mail mode\".print_r($_POST,true));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tLOG_MSG('INFO',\"generate(): Validated args\");\n\n\t\t\t\t// Required for attachment\n\t\t\t\t$attachments_arr=array();\n\t\t\t\tif ( $content_type == 'pdf_attachment' ) {\n\t\t\t\t\trequire_once(\"lib/dompdf/dompdf_config.inc.php\");\n\t\t\t\t\tob_start();\n\t\t\t\t\tinclude($row['filename']);\n\t\t\t\t\t$html=ob_get_contents();\t\t// Set mail content\n\t\t\t\t\tob_get_clean();\n\t\t\t\t\t$dompdf = new DOMPDF();\n\t\t\t\t\t$dompdf->load_html($html);\n\t\t\t\t\tLOG_MSG('INFO',\"Maximum memory reached. String Length=[\".strlen($html).\"bytes]\");\n\t\t\t\t\t// Due to the memory allocation error, send as html mail as a work around instead of attaching PDF\n\t\t\t\t\tif ( strlen($html) > 80000 ) {\n\t\t\t\t\t\tLOG_MSG('INFO',\"Sending HTML mail instead of attachment as Maximum memoty reached. String Length=[\".strlen($html).\"bytes]\");\n\t\t\t\t\t\t$message.=\"<br/> $html\";\t\t// Set mail content\n\t\t\t\t\t\t$plain_message=''; \t\t\t\t// the contents are already in $message\n\t\t\t\t\t} else {\n\t\t\t\t\t// For blue dart report,the table width is too large to fit into an A4-portrait\n\t\t\t\t\tif ( $row['report_name'] == 'Bluedart_Report' ) { \n\t\t\t\t\t\t$dompdf->set_paper('a3', 'landscape');\n\t\t\t\t\t}\n\t\t\t\t\t$dompdf->render();\n\t\t\t\t\t$attachments_arr[0]['filename']=$row['report_name'].'.pdf';\n\t\t\t\t\t$attachments_arr[0]['data']=$dompdf->output();\n\t\t\t\t\t$plain_message=$html;\t\t\t// this will contain the attachment contents\n\t\t\t\t\t}\n\t\t\t\t} else {\n\n\t\t\t\t//Store in buffer and load to mail message\t\n\t\t\t\tob_start();\n\t\t\t\tinclude($row['filename']);\n\t\t\t\t\t$message.='<br/>'.ob_get_contents();\t\t// Set mail content\n\t\t\t\tob_get_clean();\n\t\t\t\t$plain_message=''; \t\t\t\t// the contents are already in $message\n\t\t\t\t}\n\t\t\t\tsend_email($to,$from,'','',$subject,$message,$attachments_arr,$plain_message); // Send Mail\n\t\t\t\tbreak;\n\t}\n\tLOG_MSG('INFO',\"generate(): END\");\n\treturn true;\n}", "public function exportCsv() {\n\t\t$fileName = $this->user->info->ID_ACCOUNT . \"_InventorySalvager\" . date( 'Y-m-d' ) . \".csv\";\n\t\t$this->load->helper( 'download' );\n\t\tif ( ! file_exists( \"Downloads\" ) ) {\n\t\t\tmkdir( \"Downloads\" );\n\t\t}\n\t\terror_reporting( 0 );\n\t\t$fp = fopen( \"Downloads/\" . $fileName, \"w\" );\n\t\tif ( isset( $this->user->info->admin ) && ! empty( $this->user->info->admin ) ) {\n\t\t\t$head = array(\n\t\t\t\t\"User Name\",\n\t\t\t\t\"Product Name\",\n\t\t\t\t\"Reimbursement ID\",\n\t\t\t\t\"FNSKU\",\n\t\t\t\t\"Transaction Item Id\",\n\t\t\t\t\"Field\",\n\t\t\t\t\"Status\",\n\t\t\t\t\"Case Id\",\n\t\t\t\t\"Quantity Damage/Loss\",\n\t\t\t\t\"Case Reimbursed\"\n\t\t\t);\n\t\t\tfputcsv( $fp, $head );\n\t\t\t$write_info = array();\n\t\t\t$userDetails = $this->user_model->getAllUsers();\n\t\t\tforeach ( $userDetails as $key => $user ) {\n\t\t\t\t$inventoryDetails[ $key ] = $this->inventory_salvager_model->getInventoryCaseByAccountId( $user['ID_ACCOUNT'] );\n\t\t\t\t$result = $this->groupSortFNSKUArray( $inventoryDetails[ $key ] );\n\t\t\t\tforeach ( $result as $index => $case ) {\n\t\t\t\t\t$write_info['username'] = $user['username'];\n\t\t\t\t\t$write_info['productname'] = $case['productname'];\n\t\t\t\t\t$write_info['reimburse_id'] = $case['reimburse_id'];\n\t\t\t\t\t$write_info['fnsku'] = $case['fnsku'];\n\t\t\t\t\t$write_info['transaction_item_id'] = $case['transaction_item_id'];\n\t\t\t\t\t$write_info['date'] = date( 'Y/m/d', strtotime( $case['date'] ) );\n\t\t\t\t\t$write_info['status'] = ( ( $case['status'] == 1 ) ? 'Pending' : ( ( $case['status'] == 2 ) ? 'Success' : '' ) );\n\t\t\t\t\t$write_info['caseId'] = $case['caseId'];\n\t\t\t\t\t$write_info['quantity'] = $case['quantity'];\n\t\t\t\t\t$write_info['amount_total'] = ( ! empty( $caseDetials['amount_total'] ) ) ? \"$\" . $caseDetials['amount_total'] : '';\n\t\t\t\t\tfputcsv( $fp, $write_info );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t$days = 0;\n\t\t\t$result = $this->inventory_salvager_model->getInventoryCaseByAccountId( $this->user->info->ID_ACCOUNT );\n\t\t\t$invenDetails = $this->groupSortFNSKUArray( $result );\n\t\t\t$head = array(\n\t\t\t\t\"Product Name\",\n\t\t\t\t\"Reimbursement ID\",\n\t\t\t\t\"FNSKU\",\n\t\t\t\t\"Transaction Item Id\",\n\t\t\t\t\"Field\",\n\t\t\t\t\"Status\",\n\t\t\t\t\"Case Id\",\n\t\t\t\t\"Quantity Damage/Loss\",\n\t\t\t\t\"Case Reimbursed\"\n\t\t\t);\n\t\t\tfputcsv( $fp, $head );\n\t\t\t$write_info = array();\n\t\t\tforeach ( $invenDetails as $key => $case ) {\n\t\t\t\t$write_info['productname'] = $case['productname'];\n\t\t\t\t$write_info['reimburse_id'] = $case['reimburse_id'];\n\t\t\t\t$write_info['fnsku'] = $case['fnsku'];\n\t\t\t\t$write_info['transaction_item_id'] = $case['transaction_item_id'];\n\t\t\t\t$write_info['date'] = date( 'Y/m/d', strtotime( $case['date'] ) );\n\t\t\t\t$write_info['status'] = ( ( $case['status'] == 1 ) ? 'Pending' : ( ( $case['status'] == 2 ) ? 'Success' : '' ) );\n\t\t\t\t$write_info['caseId'] = $case['caseId'];\n\t\t\t\t$write_info['quantity'] = $case['quantity'];\n\t\t\t\t$write_info['amount_total'] = ( ! empty( $caseDetials['amount_total'] ) ) ? \"$\" . $caseDetials['amount_total'] : '';\n\t\t\t\tfputcsv( $fp, $write_info );\n\t\t\t}\n\t\t}\n\t\tfclose( $fp );\n\t\techo $url = base_url() . 'Downloads/' . $fileName;\n\t\texit;\n\t}", "public function wooga_print_csv() {\n\t\t\tif ( ! current_user_can( 'manage_options' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tglobal $wpdb;\n\n\t\t\t$gift_aid = 'gift_aid';\n\t\t\t$first_name = '_billing_first_name';\n\t\t\t$last_name = '_billing_last_name';\n\t\t\t$house = '_billing_address_1';\n\t\t\t$post_code = '_billing_postcode';\n\t\t\t$date = '_giftaid_donation_date';\n\t\t\t$amount = '_order_total';\n\n\t\t\t$wooga_claims = $wpdb->get_results( $wpdb->prepare(\n\t\t\t\t\"\n\t\t SELECT first_name.meta_value as first_name, last_name.meta_value as last_name, \n\t\t\t\t\t house.meta_value as house, post_code.meta_value as post_code,\n\t\t\t\t\t amount.meta_value as amount, date.meta_value as date\n\t\t FROM $wpdb->postmeta gift_aid\n\t\t INNER JOIN $wpdb->postmeta first_name \n\t\t on first_name.post_id = gift_aid.post_id\n\t\t and first_name.meta_key = %s\n\t\t INNER JOIN $wpdb->postmeta last_name \n\t\t on last_name.post_id = gift_aid.post_id\n\t\t and last_name.meta_key = %s\n\t\t INNER JOIN $wpdb->postmeta house \n\t\t on house.post_id = gift_aid.post_id\n\t\t and house.meta_key = %s\n\t\t INNER JOIN $wpdb->postmeta post_code\n\t\t on post_code.post_id = gift_aid.post_id\n\t\t and post_code.meta_key = %s\n\t\t INNER JOIN $wpdb->postmeta date\n\t\t on date.post_id = gift_aid.post_id\n\t\t and date.meta_key = %s\n\t\t INNER JOIN $wpdb->postmeta amount\n\t\t on amount.post_id = gift_aid.post_id\n\t\t and amount.meta_key = %s\n\t\t WHERE gift_aid.meta_key = %s\n\t\t and gift_aid.meta_value = 1\n\t\t ORDER BY date.meta_value\n\t\t \",\n\t\t\t\t$first_name,\n\t\t\t\t$last_name,\n\t\t\t\t$house,\n\t\t\t\t$post_code,\n\t\t\t\t$date,\n\t\t\t\t$amount,\n\t\t\t\t$gift_aid\n\t\t\t) );\n\n\t\t\t$wooga_export = array();\n\n\t\t\tforeach ( $wooga_claims as $data ) {\n\n\t\t\t\t$data = array(\n\t\t\t\t\t__( 'Title', 'wooga' ) => '',\n\t\t\t\t\t__( 'First Name', 'wooga' ) => $data->first_name,\n\t\t\t\t\t__( 'Last Name', 'wooga' ) => $data->last_name,\n\t\t\t\t\t__( 'House name or number', 'wooga' ) => $data->house,\n\t\t\t\t\t__( 'Postcode', 'wooga' ) => $data->post_code,\n\t\t\t\t\t__( 'Aggregated donations', 'wooga' ) => '',\n\t\t\t\t\t__( 'Sponsored event (yes/blank)', 'wooga' ) => '',\n\t\t\t\t\t__( 'Donation date (DD/MM/YY)', 'wooga' ) => date( 'd/m/y',strtotime( $data->date ) ),\n\t\t\t\t\t__( 'Donation Amount', 'wooga' ) => $data->amount,\n\t\t\t\t);\n\n\t\t\t\t$wooga_export[] = $data;\n\t\t\t}\n\n\t\t\theader( 'Content-Type: application/csv' );\n\t\t\theader( 'Content-Disposition: attachment; filename=gift-aid.csv' );\n\t\t\theader( 'Pragma: no-cache' );\n\n\t\t\tif ( count( $wooga_export ) > 0 ) {\n\t\t\t\techo esc_attr( $this->csv_formatted_line( array_keys( $wooga_export[0] ) ) );\n\t\t\t\tforeach ( $wooga_export as $data ) {\n\t\t\t\t\techo esc_attr( $this->csv_formatted_line( $data ) );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\techo esc_attr__( 'There are no claims to export', 'wooga' );\n\t\t\t}\n\n\t\t\t//$wpdb->update( $wpdb->postmeta, array( 'meta_value' => 'claimed' ), array( 'meta_key' => 'gift_aid', 'meta_value' => 1 ) );\n\n\t\t\texit();\n\n\t\t}" ]
[ "0.69915617", "0.652435", "0.6442812", "0.6416326", "0.62920046", "0.6263551", "0.61903125", "0.61715674", "0.61544544", "0.6143952", "0.6113155", "0.6106433", "0.6074384", "0.6052549", "0.5971925", "0.5826783", "0.56924385", "0.5616758", "0.55648005", "0.55580294", "0.5544615", "0.5523481", "0.55052346", "0.5505174", "0.5467942", "0.5432625", "0.54217327", "0.5405125", "0.53874713", "0.53818804" ]
0.7007721
0
Examples cl_image_tag("israel.png", array("width"=>100, "height"=>100, "alt"=>"hello") W/H are not sent to cloudinary cl_image_tag("israel.png", array("width"=>100, "height"=>100, "alt"=>"hello", "crop"=>"fit") W/H are sent to cloudinary
function cl_image_tag($source, $options = array()) { $source = cloudinary_url_internal($source, $options); if (isset($options["html_width"])) $options["width"] = Cloudinary::option_consume($options, "html_width"); if (isset($options["html_height"])) $options["height"] = Cloudinary::option_consume($options, "html_height"); $client_hints = Cloudinary::option_consume($options, "client_hints", Cloudinary::config_get("client_hints")); $responsive = Cloudinary::option_consume($options, "responsive"); $hidpi = Cloudinary::option_consume($options, "hidpi"); if (($responsive || $hidpi) && !$client_hints) { $options["data-src"] = $source; $classes = array($responsive ? "cld-responsive" : "cld-hidpi"); $current_class = Cloudinary::option_consume($options, "class"); if ($current_class) array_unshift($classes, $current_class); $options["class"] = implode(" ", $classes); $source = Cloudinary::option_consume($options, "responsive_placeholder", Cloudinary::config_get("responsive_placeholder")); if ($source == "blank") { $source = Cloudinary::BLANK; } } $html = "<img "; if ($source) $html .= "src='$source' "; $html .= Cloudinary::html_attrs($options) . "/>"; return $html; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function image_tag()\n{\n\tstatic $_defaults = array(\n\t\t'src' => ''\n\t\t, 'alt' => ''\n\t\t, 'border' => 0\n\t\t, 'allowed' => array('Common','alt','height','width','longdesc'\n\t\t\t,'src','usemap','ismap','name','align','border','hspace','vspace'\n\t\t)\n\t);\n\tstatic $_simple = array('src');\n\t$p = func_get_args();\n\t$p = parse_arguments($p, $_simple, $_defaults);\n\tif (empty($p['alt']))\n\t\t$p['alt'] = $p['src'];\n\t$attlist = get_attlist($p);\n\t$output = \"<img $attlist />\";\n\n\treturn $output;\n}", "function auxin_the_resized_image( $img_url = \"\", $width = null , $height = null, $crop = null , $quality = 100, $attr = '', $upscale = false ) {\n echo auxin_get_the_resized_image( $img_url , $width , $height , $crop , $quality, $attr, $upscale );\n}", "function thumbnail_tag($source, $width, $height, $options = array())\n{\n\t$img_src = thumbnail_path($source, $width, $height, false);\n\treturn image_tag($img_src, $options);\n}", "function post_img($file, $alt, $style, $type, $attributes = '')\n{\n $src = AG_PATH_POSTS_COVER . $file;\n if ($type == 'thumbnails') {\n $src = AG_PATH_POSTS_THUMB . $file;\n }\n\n if ($attributes) {\n $attributes = 'layer-src=\"' . $src . '\"';\n }\n\n $img = '<img class=\"' . $style . '\" ' . $attributes . ' src=\"' . $src . '\" alt=\"' . $alt . '\">';\n\n return $img;\n}", "function sc_sg_post_image($attr=array()){\n\textract(shortcode_atts(array(\n\t\t'size' => ''\n\t), $attr));\n\n\treturn sg_get_post_thumbnail($size); \n}", "public function tag($attr = array()) {\n if ($this->options['inline-size'] && !$this->options['srcset-only']) { //if srcset-only, then no inline-size possible\n return html::img($this->thumbs['1x']->result->url(), array_merge(array(\n 'alt' => isset($this->options['alt']) ? $this->options['alt'] : $this->sourcePath->name(),\n 'width' => $this->thumbs['1x']->result->width(),\n 'height' => $this->thumbs['1x']->result->height(),\n 'class' => isset($this->options['class']) ? $this->options['class'] : null,\n 'srcset' => $this->srcset_string(),\n ), $attr));\n\n }else if($this->options['srcset-only']){\n return $this->srcset_string();\n\n }else{\n return html::img($this->thumbs['1x']->result->url(), array_merge(array(\n 'alt' => isset($this->options['alt']) ? $this->options['alt'] : $this->sourcePath->name(),\n 'class' => isset($this->options['class']) ? $this->options['class'] : null,\n 'srcset' => $this->srcset_string(),\n ), $attr));\n }\n\n\n }", "protected function onConfigureImg(TagConfig $tag)\n\t{\n\t\t$tag->attributePreprocessors->add('img', '/^(?<width>\\\\d+),(?<height>\\\\d+)$/');\n\t\t$this->addImgDimension($tag, 'height');\n\t\t$this->addImgDimension($tag, 'width');\n\t}", "function img_tag($src='',$alt='',$class='')\n{\n echo '<img src=\"'.IMGPATH.$src.'\" alt=\"'.$alt.'\" title=\"'.$alt.'\" class=\"img-responsive '.$class.'\" />';\n}", "function author_image_tag($authorID, $tags = '', $display = true) {\n $path = author_image_path($authorID, false, 'absolute');\n $width = author_image_dimensions($path, 'width');\n $height = author_image_dimensions($path, 'height');\n $tag = '<img src=\"' . author_image_path($authorID, false, 'url') . '\" width=\"' . $width . '\" height=\"' . $height . '\" '. $tags . ' ' . ' id=\"authorpic\" />';\n if ($display) { echo $tag; } else { return $tag; }\n}", "function put_tag($name, $cname, $img = null) {\n\t\t\t$r = $this->db->prepare(\"SELECT cat_id FROM tag_category WHERE cat_name=:cat\");\n\t\t\t$r->bindValue(\":cat\",$cname); $r->execute();\n\t\t\t$ret = $r->fetchColumn(); $r = null;\n\t\t\t\n\t\t\t\tif(!is_null($img))\n\t\t\t\tself::capture_thumbnail_gd($img,$png);\n\t\t\t\telse\n\t\t\t\t$png = null;\n\t\t\t\t$r = $this->db->prepare(\"INSERT INTO tag (tag_word, tag_thm_data, cat_id) VALUES (:word, :img, :cat)\");\n\t\t\t\t$r->bindValue(\":cat\",$ret); $r->bindValue(\":word\",$name); $r->bindValue(\":img\",$png);$r->execute(); $r = null;\n\t\t\t\treturn true;\n\t}", "function imagePicProduct($codeField,$nameSize) {\n\n\t// acf\n\t$image = get_field($codeField);\n\n\t// vars\n\t$url = $image['url'];\n\t$alt = $image['alt'];\n\n\t// thumbnail\n\t$size = $nameSize;\n\t$thumb = $image['sizes'][ $size ];\n\t$width = $image['sizes'][ $size . '-width' ];\n\t$height = $image['sizes'][ $size . '-height' ];\n\n\techo '<div class=\"js-slide my-2\">';\n\t echo '<img class=\"img-fluid u-slick--pagination-active-border__item\" src=\"'. $thumb .'\" alt=\"'. $alt .'\" width =\"'. $width .'\" height = \"'. $height .'\"/>';\n\techo '</div>';\n\n}", "function display_image(lt_form $fo,$bin,$height = 400, $width = 500){\n\t$fo->img(\"data:image/jpeg;base64,$bin\",\"\",\"\",$height,$width);\n}", "function fkimage_info($attr, $content=null) {\r\n $url = $attr['url'];\r\n $width = isset($attr['width']) ? $attr['width'] : 500;\r\n $i = ss_image_info($url, null, $width);\r\n $img = \"<div class=\\\"ss_flickr\\\">\";\r\n if ($content != null)\r\n $img .= \"<p class=\\\"desc\\\" style=\\\"width:\" . $width . \"px;\\\">\" . $content . \"</p>\";\r\n $img .= $i;\r\n $img .= \"<div class=\\\"clear\\\"></div>\";\r\n $img .= \"</div>\";\r\n return $img;\r\n}", "function fkimage_detail($attr, $content=null) {\r\n $url = $attr['url'];\r\n $width = isset($attr['width']) ? $attr['width'] : 500;\r\n $i = ss_image_link($url, null, $width);\r\n $img = \"<div class=\\\"ss_flickr\\\">\";\r\n $img .= $i;\r\n if ($content != null)\r\n $img .= \"<p style=\\\"width:\" . $width . \"px;\\\">\" . $content . \"</p>\";\r\n $img .= \"</div>\";\r\n return $img;\r\n}", "public function getImageCompose () {}", "public function image(string $url, ?string $alt = null, array $attributes = [], ?bool $secure = null): HtmlString;", "public function image($img);", "function image_shortcode($atts, $content = null)\n{\n extract(shortcode_atts(array('src' => '', 'width' => '', 'height' => ''), $atts));\n return '<img class=\"alignnone size-large\" src=\"' . $src . '\" alt=\"\" width=\"' . $width . '\" height=\"' . $height . '\" />';\n}", "protected function getResizedImageTag($conf) {\n $tag = $this->cObj->IMAGE($conf);\n return $tag;\n }", "public function enhanceImage () {}", "function image($files, $name=false, $path=\"\", $height=false, $width=false){\r\n $image = new Image($files);\r\n // Config\r\n if ($name) {\r\n $image->setName($name);\r\n }\r\n $image->setSize(0, SETTINGS['post_max_size']);\r\n $image->setDimension(10000,10000);\r\n $image->setMime(array('jpeg', 'gif', 'png', 'jpg'));\r\n $image->setLocation('media/' . $path);\r\n //Upload\r\n if($image){\r\n $upload = $image->upload();\r\n if($upload){\r\n // Crop\r\n if ($height || $width) {\r\n if ($height == false) {\r\n $height = $image->getHeight();\r\n }\r\n if ($width == false) {\r\n $width = $image->getWidth();\r\n }\r\n\r\n $image = new ImageResize($upload->getFullPath());\r\n $image->crop($width, $height);\r\n $image->save($upload->getFullPath());\r\n\r\n }\r\n return array(true,$upload->getName().'.'.$upload->getMime());\r\n }else{\r\n echo \"string1\";\r\n app('msg')->error($image->getError());\r\n return array(false, $image->getError());\r\n }\r\n }else{\r\n echo \"string1\";\r\n return array(false, \"No Image Found!\");\r\n }\r\n}", "function flickr_img($attr, $content=null) {\r\n $url = $attr['url'];\r\n $width = isset($attr['width']) ? $attr['width'] : 500;\r\n $i = ss_image_link($url, null, $width);\r\n $img = \"<div class=\\\"ss_flickr\\\">\";\r\n $img .= $i;\r\n if ($content != null)\r\n $img .= \"<p style=\\\"width:\" . $width . \"px;\\\">\" . $content . \"</p>\";\r\n $img .= \"</div>\";\r\n return $img;\r\n}", "public function photo ($options = array()) {\n $options = array_merge(array('width' => 600, 'height' => 400,\n 'overflow' => 'hidden'), $options);\n\n if ($this->img['width'] > $this->img['height']) {\n if ($options['overflow'] == 'hidden')\n $options['canvas-height'] = $options['height'];\n\n unset($options['height']);\n }\n\n elseif ($this->img['width'] < $this->img['height']) {\n $options = array_merge($options, array('width' => $options['height'],\n 'height' => $options['width']));\n\n if ($options['overflow'] == 'hidden')\n $options['canvas-width'] = $options['width'];\n\n unset($options['width']);\n }\n\n $this->resize($options);\n }", "function clemo_image($img, $alt, $v = '') {\n\n if (isset($img['url']) && !empty($img)) {\n $i = $img['url'];\n $v = \"<img src=\" . $i . \" alt=\" . $alt . \" />\";\n }\n\n return $v;\n}", "function img($data){\n extract($data);\n if(!isset($noview)) $noview = '';\n if(!isset($edit)) {$edit = false;}\n if(!isset($cols)) $cols = 6;\n if(!isset($required)) $required = \"\";\n if(!isset($name)) $name = \"image\";\n if(!isset($imgFrame)) $imgFrame = true;\n\n if(!isset($transAttr)) $transAttr = false;\n if(!isset($transval)) $transval = '';\n\n if($transAttr)\n $transval = trans('validation.attributes.'.$name);\n else\n $transval = ($transval) ? $transval : trans('main.'.$trans);\n\n\n if($imgFrame){\n return imgFrame($data);\n }\n\n // $value = getvalue($name, $edit, $childe);\n $value = getvalue($name, $edit);\n $upload = ($edit)? '-upload':'';\n $src = getSrc($edit, $name, $childe);\n $create = ($edit)? \"\": 'create';\n\n $html = '\n <div class=\"col-md-'.$cols.'\">\n <div class=\"form-group '.$create.' uploadbtnDiv\">\n <label for=\"'.$name.'\">'.$transval.'\n <img id=\"thumb\" class=\"thumb-sm'.$upload.'\" src=\"'.$src.'\" alt=\"\" accept=\"image/x-png, image/gif, image/jpeg\">\n </label>\n <input '.$required.' type=\"file\" accept=\"image/x-png, image/gif, image/jpeg\"\n name=\"'.$name.'\" id=\"'.$name.'\" class=\"'.$name.' showupload uploadbtn\">\n <p class=\"inputNotes\">'.trans('main.AllowedImageExtensions').' (jpg, png, gif) </p>\n ';\n\n $html .=getErrors($errors, $name, $noview).'\n </div>\n </div>\n ';\n\n return $html;\n}", "private function tagImage() {\n if ( !PlonkSession::exists(\"admin\") ) {\n header(\"Status: 401 Unauthorized\");\n return array(\"debug\" => 'You have no permission to perform this action.');\n }\n $data = PlonkFilter::getGetValue('data', null, null, true);\n if ($data != null) {\n $data = json_decode($data, false);\n if (!empty($data) && count($data) > 0 && PlonkFilter::isNumeric($data[0])) {\n $id = $data[0];\n $tagNames = array_splice($data, 1);\n //Escape everything properly\n $tmp = array();\n $tagIDs = null;\n //Attempt to create new Tags bij Inserting them (already existing ones will be ignored)\n foreach ($tagNames as $tag) {\n $tag = $this->db->escapeString($tag);\n $tmp[] = $tag;\n $this->db->exec(\"insert or ignore into Tags (name) values('$tag')\");\n }\n $tagNames = $tmp;\n //Fetch the Tag ID's of the Tags we are interested in\n $tagIDs = $this->db->query('select tagid from Tags where name in (\\'' . implode('\\',\\'', $tagNames) . '\\');');\n $tags = array();\n //Delete all old Image-Tag associations of our Image\n $this->db->exec(\"delete from TaggedImages where image = '$id'\");\n //Add our new Image-Tag associations\n while ($tag=$tagIDs->fetchArray(SQLITE3_ASSOC)) {\n $tag = $tag[\"tagid\"];\n $tags[] = $tag;\n $this->db->exec(\"insert into TaggedImages (tag,image) values('$tag','$id')\");\n }\n header(\"Status: 200 OK\");\n return array(\"tags\" => implode(',', $tags));\n } else {\n header(\"Status: 406 Not Acceptable\");\n return array(\"debug\" => 'Empty or malformed \"data\" parameter. First value must be an image ID followed by Tag names, example: [432,\"Scenery\",\"Video Games\"]');\n }\n } else {\n header(\"Status: 400 Bad Request\");\n return array(\"debug\" => 'Missing \"data\" parameter.');\n }\n }", "public function setImageUnits ($units) {}", "public function _vc_single_image_retina_param() {\n\t\tvc_add_param( 'vc_single_image', [\n\t\t\t'type' => 'checkbox',\n\t\t\t'heading' => 'Retina image',\n\t\t\t'param_name' => 'retina_image',\n\t\t\t'description' => 'Enabling this option will reduce the size of image for 50%, example if image is 500x500 it will be 250x250.',\n\t\t\t'value' => [\n\t\t\t\t'Yes' => 'yes',\n\t\t\t],\n\t\t] );\n\t}", "protected function renderImg() {\n $originalProcessingConfiguration = $this->defaultProcessConfiguration;\n $originalProcessingConfiguration['width'] = isset($this->settings['sourceCollection']['default']['width']) ? $this->settings['sourceCollection']['default']['width'] : 600;\n\n if ($this->additionalConfig['image_format']) {\n $originalProcessingConfiguration['height'] = round(intval($originalProcessingConfiguration['width']) / $this->additionalConfig['image_format']);\n }\n\n $processedFile = $this->imageFile->process(\n ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $originalProcessingConfiguration\n );\n $src = $processedFile->getPublicUrl();\n $this->tagBuilder->reset();\n $this->tagBuilder->setTagName('img');\n $this->tagBuilder->addAttribute('src', $src);\n $this->tagBuilder->addAttribute('alt', $this->altText);\n $this->tagBuilder->addAttribute('width', $processedFile->getProperty('width'));\n $this->tagBuilder->addAttribute('height', $processedFile->getProperty('height'));\n\n if ($this->imageFile->getProperty('title')) {\n $this->tagBuilder->addAttribute('title', $this->imageFile->getProperty('title'));\n }\n if ($this->settings['cssClasses']['img']) {\n $this->tagBuilder->addAttribute('class', $this->settings['cssClasses']['img']);\n }\n\n if (!empty($this->srcset)) {\n $this->tagBuilder->addAttribute('srcset', implode(', ', $this->srcset));\n $this->tagBuilder->addAttribute('sizes', $this->formatSizes());\n }\n\n // add additionalAttributes\n if (is_array($this->additionalAttributes)) {\n foreach ($this->additionalAttributes as $key => $value) {\n $this->tagBuilder->addAttribute($key, $value);\n }\n }\n\n return $this->tagBuilder->render();\n }", "abstract public function image($id, $image = null);" ]
[ "0.64001316", "0.61808807", "0.5815206", "0.58009875", "0.57926613", "0.57901627", "0.57857966", "0.57626754", "0.57500815", "0.5728196", "0.5688407", "0.568721", "0.5677257", "0.5670461", "0.5658755", "0.5655145", "0.56511307", "0.56224626", "0.5586393", "0.5550634", "0.5548245", "0.5520897", "0.5503245", "0.5498219", "0.5482765", "0.547784", "0.5476055", "0.5472389", "0.5455191", "0.54422885" ]
0.6881585
0
Returns an HTML img tag with the thumbnail for the given video +source+ and +options+
function cl_video_thumbnail_tag($source, $options = array()) { return cl_image_tag($source, array_merge(default_poster_options(),$options)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl_video_thumbnail_path($source, $options = array()) {\n $options = array_merge(default_poster_options(), $options);\n return cloudinary_url_internal($source, $options);\n }", "function cl_video_tag($source, $options = array()) {\n $source = preg_replace('/\\.(' . implode('|', default_source_types()) . ')$/', '', $source);\n\n $source_types = Cloudinary::option_consume($options, 'source_types', array());\n $source_transformation = Cloudinary::option_consume($options, 'source_transformation', array());\n $fallback = Cloudinary::option_consume($options, 'fallback_content', '');\n\n if (empty($source_types)) {\n $source_types = default_source_types();\n }\n $video_options = $options;\n\n if (array_key_exists('poster', $video_options)) {\n if (is_array($video_options['poster'])) {\n if (array_key_exists('public_id', $video_options['poster'])) {\n $video_options['poster'] = cloudinary_url_internal($video_options['poster']['public_id'], $video_options['poster']);\n } else {\n $video_options['poster'] = cl_video_thumbnail_path($source, $video_options['poster']);\n }\n }\n } else {\n $video_options['poster'] = cl_video_thumbnail_path($source, $options);\n }\n \n if (empty($video_options['poster'])) unset($video_options['poster']);\n\n\n $html = '<video ';\n\n if (!array_key_exists('resource_type', $video_options)) $video_options['resource_type'] = 'video';\n $multi_source = is_array($source_types);\n if (!$multi_source){\n $source .= '.' . $source_types;\n }\n $src = cloudinary_url_internal($source, $video_options);\n if (!$multi_source) $video_options['src'] = $src;\n if (isset($video_options[\"html_width\"])) $video_options['width'] = Cloudinary::option_consume($video_options, 'html_width');\n if (isset($video_options['html_height'])) $video_options['height'] = Cloudinary::option_consume($video_options, 'html_height');\n $html .= Cloudinary::html_attrs($video_options ) . '>';\n\n if ($multi_source) {\n \n foreach($source_types as $source_type) {\n $transformation = Cloudinary::option_consume($source_transformation, $source_type, array());\n $transformation = array_merge($options, $transformation);\n $src = cl_video_path($source . '.' . $source_type, $transformation);\n $video_type = (($source_type == 'ogv') ? 'ogg' : $source_type);\n $mime_type = \"video/$video_type\";\n $html .= '<source '. Cloudinary::html_attrs(array('src' => $src, 'type' => $mime_type)) . '>';\n }\n\n }\n\n $html .= $fallback;\n $html .= '</video>';\n return $html;\n }", "public function getThumbnailImage($options = array())\n {\n return image_tag($this->getThumbnailUrl(), $options);\n }", "function thumbnail_tag($source, $width, $height, $options = array())\n{\n\t$img_src = thumbnail_path($source, $width, $height, false);\n\treturn image_tag($img_src, $options);\n}", "function dailymotionComGetThumbnail($option)\r\n\t{\r\n\t\t$thumbnail = \"http://www.dailymotion.com/thumbnail/160x120/video/\".$option;\r\n\t\t$thumbnail = trim(strip_tags($thumbnail));\r\n\t\treturn $thumbnail;\r\n\t}", "function urlToThumbnail($video) {\n\n // Stripping down to URL\n preg_match('/src=\"(.+?)\"/', $video, $matches_url );\n $src = $matches_url[1];\n\n // Attempting to get Youtube\n preg_match('/embed(.*?)?feature/', $src, $matches_id );\n if ($matches_id != NULL) {\n $id = $matches_id[1];\n $id = str_replace( str_split( '?/' ), '', $id );\n\n $MaxResURL = 'https://img.youtube.com/vi/' . $id . '/maxresdefault.jpg';\n\n $curl = curl_init();\n curl_setopt_array($curl, array( \n CURLOPT_URL => $MaxResURL,\n CURLOPT_HEADER => true,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_NOBODY => true));\n\n $response = explode(\"\\n\", curl_exec($curl));\n curl_close($curl);\n\n //var_dump($response); \n\n //If maxres image exists do something with it.\n if (strpos($response[0], '200') !== false) { \n return $MaxResURL;\n } else {\n // print 'Some Other IMG';\n return 'https://img.youtube.com/vi/' . $id . '/hqdefault.jpg';\n }\n } else {\n // Attempting to get Vimeo\n preg_match('/video(.*?)?app_id/', $src, $matches_id );\n\n $id = $matches_id[1];\n $id = str_replace( str_split( '?/' ), '', $id );\n\n $hash = unserialize(file_get_contents(\"https://vimeo.com/api/v2/video/$id.php\"));\n\n return $hash[0]['thumbnail_large'];\n }\n\n }", "function set_video_image_source($file_names_images, $file_names_images_deduped, $fileurl) {\n $image = get_image($file_names_images, $file_names_images_deduped, $fileurl);\n $video_source_image = \"<img src=\\\"$image\\\" style=\\\"width:100%; height:100%;\\\" alt=\\\"No video playback capabilities\\\">\\n\";\n return $video_source_image;\n}", "function hwdsb_vp_filter_thumbnail_html( $retval, $post_id, $post_thumbnail_id, $size, $attr ) {\n\t$meta = get_post_meta( $post_id );\n\n\tif ( empty( $meta['vp_video_source'] ) ) {\n\t\treturn $retval;\n\t}\n\n\t// Should fallback to a generic thumbnail here.\n\tif ( empty( $meta['vp_video_vimeo_picture_id'][0] ) || ! function_exists( 'vp_get_video_thumbnail' ) ) {\n\t\treturn $retval;\n\t}\n\n\t// Duration\n\t$duration = '';\n\tif ( true === function_exists( 'hwdsb_get_the_duration' ) ) {\n\t\t$duration = hwdsb_get_the_duration( $post_id );\n\t}\n\n\t// Set up thumb args.\n\tif ( 'gazette-featured-content-thumbnail' === $size ) {\n\t\t$width = 960;\n\t\t$height = 541;\n\t\t$class = 'attachment-gazette-featured-content-thumbnail size-gazette-featured-content-thumbnail wp-post-image';\n\t} else {\n\t\t$width = 295;\n\t\t$height = 166;\n\t\t$class = '';\n\t}\n\n\t$thumbnail = vp_get_video_thumbnail( $post_id, [\n\t\t'width' => $width,\n\t\t'height' => $height,\n\t\t'class' => $class\n\t] );\n\n\t//print_r( $GLOBALS['_wp_additional_image_sizes'][$size] );\n\n\treturn $thumbnail . \"<span class=\\\"duration\\\">{$duration}</span>\";\n}", "function cl_image_tag($source, $options = array()) {\n $source = cloudinary_url_internal($source, $options);\n if (isset($options[\"html_width\"])) $options[\"width\"] = Cloudinary::option_consume($options, \"html_width\");\n if (isset($options[\"html_height\"])) $options[\"height\"] = Cloudinary::option_consume($options, \"html_height\");\n\n $client_hints = Cloudinary::option_consume($options, \"client_hints\", Cloudinary::config_get(\"client_hints\"));\n $responsive = Cloudinary::option_consume($options, \"responsive\");\n $hidpi = Cloudinary::option_consume($options, \"hidpi\");\n if (($responsive || $hidpi) && !$client_hints) {\n $options[\"data-src\"] = $source;\n $classes = array($responsive ? \"cld-responsive\" : \"cld-hidpi\");\n $current_class = Cloudinary::option_consume($options, \"class\");\n if ($current_class) array_unshift($classes, $current_class);\n $options[\"class\"] = implode(\" \", $classes);\n $source = Cloudinary::option_consume($options, \"responsive_placeholder\", Cloudinary::config_get(\"responsive_placeholder\"));\n if ($source == \"blank\") {\n $source = Cloudinary::BLANK;\n }\n }\n $html = \"<img \";\n if ($source) $html .= \"src='$source' \";\n $html .= Cloudinary::html_attrs($options) . \"/>\";\n return $html;\n }", "public function render($source_path, $filename, $options = array(), $img_options = array())\n {\n // Set the width and height if provided\n $this->width = isset($options['width']) ? intval($options['width']) : $this->config['default_width'];\n $this->height = isset($options['height']) ? intval($options['height']) : $this->config['default_height'];\n\n // Prepare the source path\n if (empty($source_path)) {\n $source_path = $this->source;\n }\n $source_path = $this->prepareSourcePath($source_path);\n \n $thumbs_path = $this->destination;\n if (empty($thumbs_path)) {\n $thumbs_path = $source_path;\n }\n\n // Grab the extension\n if (is_null($filename) || empty($filename)) {\n return $this->defaultImage($options, $img_options);\n }\n\n // Check the file exists\n if (!file_exists($source_path . $filename) || !is_file($source_path . $filename)) {\n return $this->defaultImage($options, $img_options);\n }\n\n // Automatic widths/heights\n list($width, $height) = getimagesize($source_path . $filename);\n $ratio = $width / $height;\n if ($this->width == 'auto') {\n $this->width = floor($this->height * $ratio);\n } elseif ($this->height == 'auto') {\n $this->height = floor($this->width / $ratio);\n }\n $thumbnail_ratio = $this->width / $this->height;\n\n // Create thumbnail if unavailable\n if (!is_file($thumbs_path . $this->width . 'x' . $this->height . DS . $filename)) {\n // Check widths/heights against original (don't create thumbnail if unnecessary)\n if ($width == $this->width && $height == $this->height) {\n $img_options['src'] = $this->preparePathForUrl($source_path) . DS . $filename;\n\n return $this->Html->tag('img', null, $img_options);\n }\n\n // Create new canvas (using configurable background)\n $canvas = imagecreatetruecolor($this->width, $this->height);\n imagealphablending($canvas, true);\n imagefill($canvas, 0, 0, call_user_func_array('imagecolorallocatealpha', array_merge(array($canvas), $this->config['default_background'], array(0))));\n\n // Get path info\n $pathinfo = pathinfo($source_path . $filename);\n\n // Open the file correctly\n if (strtolower($pathinfo['extension']) == 'jpg' || strtolower($pathinfo['extension']) == 'jpeg') {\n $image = imagecreatefromjpeg($source_path . $filename);\n } elseif (strtolower($pathinfo['extension']) == 'png') {\n $image = imagecreatefrompng($source_path . $filename);\n } elseif (strtolower($pathinfo['extension']) == 'gif') {\n $image = imagecreatefromgif($source_path . $filename);\n } else {\n // What are we dealing with? Use the default\n return $this->defaultImage($options, $img_options);\n }\n\n // Make the image smaller, taking into account the ratio (option to preserve or use correct ratio)\n if ((isset($options['preserve_ratio']) && !$options['preserve_ratio']) || $ratio == $thumbnail_ratio) {\n imagecopyresampled($canvas, $image, 0, 0, 0, 0, $this->width, $this->height, $width, $height);\n } else {\n // Check for larger image\n if ($this->width > $width || $this->height > $height) {\n imagecopyresampled($canvas, $image, (($this->width) - $width) / 2, (($this->height) - $height) / 2, 0, 0, $width, $height, $width, $height);\n } elseif ($thumbnail_ratio != $ratio) {\n // Larger ratio means its higher, shorter means its wider\n if ($thumbnail_ratio < $ratio) {\n // Shorten by height\n $correct_height = $this->width / $ratio;\n imagecopyresampled($canvas, $image, 0, floor(($this->height - $correct_height) / 2), 0, 0, $this->width, $correct_height, $width, $height);\n } else {\n // Shorten by width\n $correct_width = $this->height * $ratio;\n imagecopyresampled($canvas, $image, floor(($this->width - $correct_width) / 2), 0, 0, 0, $correct_width, $this->height, $width, $height);\n }\n }\n }\n\n // Handle directories\n if (!is_dir($thumbs_path . $this->width . 'x' . $this->height)) {\n mkdir($thumbs_path . $this->width . 'x' . $this->height, 0777, true);\n }\n \n if (isset($pathinfo['dirname']) && $pathinfo['dirname']) {\n if (!is_dir($thumbs_path . $this->width . 'x' . $this->height . DS . $pathinfo['dirname'])) {\n mkdir($thumbs_path . $this->width . 'x' . $this->height . DS . $pathinfo['dirname'], 0777, true);\n }\n }\n\n // Handle the extensions again\n if ($this->config['jpeg_only'] || strtolower($pathinfo['extension']) == 'jpg' || strtolower($pathinfo['extension']) == 'jpeg') {\n imagejpeg($canvas, $thumbs_path . $this->width . 'x' . $this->height . '/' . $filename, 100);\n } elseif (strtolower($pathinfo['extension']) == 'png') {\n imagepng($canvas, $thumbs_path . $this->width . 'x' . $this->height . '/' . $filename);\n } elseif (strtolower($pathinfo['extension']) == 'gif') {\n imagegif($canvas, $thumbs_path . $this->width . 'x' . $this->height . '/' . $filename);\n }\n }\n\n // Formulate a URL and return\n $img_options['src'] = $this->preparePathForUrl($thumbs_path) . $this->width . 'x' . $this->height . DS . $filename;\n\n return $this->Html->tag('img', null, $img_options);\n }", "function video_setthumbnail($sessionid=null,$videoid=null,$timepoint=null,$file=null) {\n \n if (isset($file) && substr($file,0,1) != '@') {\n $file = '@' . $file;\n }\n \n $thumbnail = $this->sendRequest('viddler.videos.setThumbnail',array('sessionid'=>$sessionid,'video_id'=>$videoid,'timepoint'=>1,'file'=>$file,),'post');\n \n if ($thumbnail['error']) {\n return $thumbnail['error']['description'];\n } else {\n return $thumbnail['thumbnail'];\n }\n\n }", "public function doThumb($options) {\n $img = './assets/images/uploads/'.$options['source_image'];\n \n // If the thumbnail already exists, we just read it\n // No need to use the GD library again\n\n if( !is_file('./assets/images/uploads/thumbs/'.$options['source_image']) ) {\n $config['source_image'] = './assets/images/uploads/'.$options['source_image'];\n $config['new_image'] = './assets/images/uploads/thumbs/'.$options['source_image'];\n $config['image_library'] = 'gd2';\n $config['width'] = $options['width'];\n $config['height'] = $options['height']; \n $config['create_thumb'] = TRUE;\n $config['maintain_ratio'] = TRUE;\n \n $this->image_lib->initialize($config);\n $this->image_lib->resize();\n }\n }", "function getimage($videoid){\n$gv_xml_image_string = @file_get_contents(\"http://video.google.com/videofeed?docid=\".$videoid);\n$gv_xml_image_start = explode('<media:thumbnail url=\"',$gv_xml_image_string,2);\n$gv_xml_image_end = explode('\"',$gv_xml_image_start[1],2);\n$gv_image = addslashes($gv_xml_image_end[0]);\nreturn $gv_image;\n}", "function getThumbnail( $size = 'medium', $atts = [] ) {\n $atts = wp_merge_args( $atts, static::$default_thumbnail_atts );\n \treturn sprintf( \n \t\t'<img src=\"%s\" alt=\"\" class=\"%s\" />', \n \t\t$this->getVideoThumbnail(), $atts['class']\n \t);\n }", "function theme_gs_helper_field_video($vars) {\n $output = '';\n\n if (!empty($vars['image_file'])) {\n $items['movie'] = (array) $vars['video_file'];\n \n $items['poster'] = (array) $vars['image_file'];\n \n $video_vars = array(\n 'items' => $items,\n 'attributes' => array(\n 'width' => 600,\n // 'height' => 300,\n ),\n 'player_id' => 'file-' . $vars['video_file']['fid'],\n );\n \n $output = '<div class=\"video-content\">' . theme('videojs', $video_vars) . '</div>';\n }\n \n return $output;\n}", "function cl_video_path($source, $options = array()) {\n $options = array_merge( array('resource_type' => 'video'), $options);\n return cloudinary_url_internal($source, $options);\n }", "public function getThumbnail();", "function get_vimeo_video_image($video_id=0){\n\t\t$url = \"https://vimeo.com/api/v2/video/$video_id.php\";\t#Making the URL\n\t\t$contents = @file_get_contents($url);\n\t\t$thumb = @unserialize(trim($contents));\n\t\tif($thumb[0][thumbnail_large]){\n\t\t\t$data=array('image_path'=>$thumb[0][thumbnail_large],'title'=>$thumb[0][title]);\n\t\t}else{\n\t\t\t$data=array('error'=>'Video not found');\n\t\t}\n\t\techo json_encode($data);\n\t}", "function gmp_video( $height='', $width='', $inlineCSS=true, $imagesize='video' ){\n echo gmp_get_video( $height, $width, $inlineCSS=true, $imagesize='video' );\n}", "function get_video_image($data){\n\t $image = \"\";\n\t\t$preh = 0;\n\t\t$premax = 600;\n\t\tforeach($data['image'] as $pk => $pv){\n\t\t\tif(!isset($pv['with_padding'])){\n\t\t\t\tif($pv['height'] >= $preh && $pv['height'] <= $premax){\n\t\t\t\t\t$image = $pv['url']; $preh = $pv['height']; }\n\t\t\t}\n\t\t}\n\t\treturn $image;\n\t}", "function thumbvideo($tabvideo)\n{\n //VIMEO\n $pos = strpos($tabvideo, \"vimeo.com\");\n if ($pos !== false) {\n //No hay forma de obtener la imagen\n return \"images/icono-videos.png\";\n }\n \n //YOUTUBE\n $pos = strpos($tabvideo, \"youtube.com\");\n if ($pos !== false) {\n //<iframe width=\"480\" height=\"360\" src=\"http://www.youtube.com/embed/zKsQafgEwyE\" frameborder=\"0\" allowfullscreen></iframe>\n $array1 = explode(\"youtube.com/embed/\", $tabvideo);\n //el array me quedaria con 2 posiciones en una \"<iframe width=\"480\" height=\"360\" src=\"http://www.youtube.com/embed/\" y en otra zKsQafgEwyE\" frameborder=\"0\" allowfullscreen></iframe>\n if(count($array1)==2)\n {\n $array2 = explode('\"', $array1[1]);\n if(count($array2)>0)\n return \"http://img.youtube.com/vi/\".$array2[0].\"/1.jpg\";\n else\n return \"images/icono-videos.png\";\n }\n else\n return \"images/icono-videos.png\";\n }\n \n \n \n return \"images/icono-videos.png\";\n}", "function youtube_thumb($vid){\n $public_path = file_create_url('public://youtube/' .$vid. '.jpg');\n return $public_path;\n}", "function si_get_video_image($url){\r\n\tif(preg_match('/youtube/', $url)) {\t\t\t\r\n\t\tif(preg_match('/[\\\\?\\\\&]v=([^\\\\?\\\\&]+)/', $url, $matches)) {\r\n\t\t\treturn \"http://img.youtube.com/vi/\".$matches[1].\"/default.jpg\"; \r\n\t\t}\r\n\t}\r\n\telseif(preg_match('/vimeo/', $url)) {\t\t\t\r\n\t\tif(preg_match('~^http://(?:www\\.)?vimeo\\.com/(?:clip:)?(\\d+)~', $url, $matches))\t{\r\n\t\t\t\t$id = $matches[1];\t\r\n\t\t\t\tif (!function_exists('curl_init')) die('CURL is not installed!');\r\n\t\t\t\t$url = \"http://vimeo.com/api/v2/video/\".$id.\".php\";\r\n\t\t\t\t$ch = curl_init();\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_URL, $url);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_HEADER, 0);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_TIMEOUT, 10);\r\n\t\t\t\t$output = unserialize(curl_exec($ch));\r\n\t\t\t\t$output = $output[0][\"thumbnail_medium\"]; \r\n\t\t\t\tcurl_close($ch);\r\n\t\t\t\treturn $output;\r\n\t\t}\r\n\t}\t\t\r\n}", "public static function getVideoGalleryImage($previewId){\n if($previewId > 0){\n $image = AttachmentModel::find($previewId);\n if($image && file_exists($image->path)){\n return URL($image->path);\n }\n }\n return URL('images/no_image_thumb.png');\n }", "public function imageSrc($result, $options = []) {\n\t\t$result = $this->_getResult($result);\n\t\t$options = $this->thumbOptions($result, $options);\n\t\t$src = $this->Image->src($result, $options);\n\t\t\n\t\t// Looks for preceding plugin\n\t\t$urlParts = explode('/', $src);\n\t\tlist($plugin, $urlParts[0]) = pluginSplit($urlParts[0]);\n\t\t$src = implode('/', $urlParts);\n\t\tif (!empty($src) && $src[0] != '/' && strpos($src, '://') === false) {\n\t\t\t$srcBase = Url::base();\n\t\t\tif (!empty($plugin)) {\n\t\t\t\t$srcBase .= '/' . Inflector::underscore($plugin);\n\t\t\t}\n\t\t\t$src = $srcBase . '/img/' . $src;\n\t\t}\n\t\treturn $src;\n\t}", "function getThumbImage($route, $thumbRoute){ // ver pq se ejecuta antes de instanciarla esta puta function\n\n/*\n $ffmpeg = FFMpeg\\FFMpeg::create();\n $video = $ffmpeg->open($route);\n $frame = $video->frame(FFMpeg\\Coordinate\\TimeCode::fromSeconds(1));\n $imageName = $frame->save($thumbRoute.uniqid().'jpg');\n*/\n\n $movie = new ffmpeg_movie($route,false);\n $videoDuration = $movie->getDuration();\n $frameCount = $movie->getFrameCount();\n $frameRate = $movie->getFrameRate();\n $videoTitle = $movie->getTitle();\n $author = $movie->getAuthor() ;\n $copyright = $movie->getCopyright();\n $frameHeight = $movie->getFrameHeight();\n $frameWidth = $movie->getFrameWidth();\n\n $capPos = ceil($frameCount/4);\n\n if($frameWidth>120)\n {\n $cropWidth = ceil(($frameWidth-120)/2);\n }\n else\n {\n $cropWidth =0;\n }\n if($frameHeight>90)\n {\n $cropHeight = ceil(($frameHeight-90)/2);\n }\n else\n {\n $cropHeight = 0;\n }\n if($cropWidth%2!=0)\n {\n $cropWidth = $cropWidth-1;\n }\n if($cropHeight%2!=0)\n {\n $cropHeight = $cropHeight-1;\n }\n\n $frameObject = $movie->getFrame($capPos);\n\n\n if($frameObject)\n {\n $imageName = $thumbRoute;\n $tmbPath = $imageName;\n $frameObject->resize(480,270,0,0,0,0); //120 x90\n imagejpeg($frameObject->toGDImage(),$tmbPath);\n }\n else\n {\n $imageName=\"\";\n }\n \n return $imageName;\n }", "function podcast_pro_podcast_image() {\n\n\t// Display the promo image if we're not live.\n\tif ( ! podcast_pro_is_show_live() ) {\n\t\tpodcast_pro_the_promo_image();\n\t\treturn;\n\t}\n\n\t// Get the video thumbnail.\n\t$video_id = esc_attr( genesis_get_custom_field( 'youtube_id' ) );\n\t$video_thumbnail = '<img src=\"http://img.youtube.com/vi/' . $video_id . '/0.jpg\" />';\n\n\t// Output the featured image.\n\tprintf( '<a href=\"%s\" class=\"featured-image\" title=\"%s\">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $video_thumbnail );\n}", "public function prepareThumbnailMedia(array $details) {\n if (!$details['thumbnailUrl']) {\n return NULL;\n }\n\n // Fetch the thumbnail from source.\n try {\n $response = $this->httpClient->request('GET', $details['thumbnailUrl'], [\n 'headers' => [\n 'accept' => 'image/jpeg;q=0.9,image/png;q=0.1',\n ],\n ]);\n }\n catch (TransferException $e) {\n return NULL;\n }\n\n $destination = $this->getImageFieldDestination();\n\n // Decide on the file extension.\n $content_type_header = $response->getHeader('Content-Type');\n $content_type = is_array($content_type_header) ? $content_type_header[0] : $content_type_header;\n $extension = 'jpg';\n if ($content_type == 'image/png') {\n $extension = 'png';\n }\n\n // Store file locally.\n if (!$this->fileSystem->prepareDirectory($destination, FileSystemInterface::CREATE_DIRECTORY)) {\n return NULL;\n }\n $filename = $this->buildFilename($details);\n $file = file_save_data($response->getBody()->getContents(), \"{$destination}/{$filename}.{$extension}\");\n\n // Create media entity.\n $media = $this->entityTypeManager->getStorage('media')->create([\n 'bundle' => 'image',\n 'status' => 1,\n 'uid' => 1,\n 'name' => $details['videoName'],\n 'field_media_in_library' => 1,\n 'field_media_image' => [\n 'target_id' => $file->id(),\n 'alt' => $details['videoName'],\n 'title' => $details['videoName'],\n ],\n ]);\n $media->save();\n\n return $media;\n }", "function video_cck_vimeo_thumbnail($field, $item, $formatter, $node, $width, $height) {\n $vimeo_id = (substr($item['value'], -1, 1)=='/') ? substr($item['value'], 0, -1) : $item['value'];\n $vimeo_signature = variable_get('video_cck_vimeo_api_secret', '') .'api_key'. variable_get('video_cck_vimeo_api_key', '') .'method'.'vimeo.videos.getThumbnailUrl'.'size'. variable_get('video_cck_vimeo_thumb_size', '160') .'video_id'. $vimeo_id;\n $vimeo_apicall = 'http://www.vimeo.com/api/rest?'.'api_key='. variable_get('video_cck_vimeo_api_key', '') .'&method='.'vimeo.videos.getThumbnailUrl'.'&size='. variable_get('video_cck_vimeo_thumb_size', '160') .'&video_id='. $vimeo_id .'&api_sig='. md5($vimeo_signature);\n $api_file = file_get_contents($vimeo_apicall);\n $data = array();\n preg_match(\"#<thumbnail .*>(.*)</thumbnail>#i\", $api_file, $data);\n return $data[1];\n}", "function source_video($options)\n{\n\techo \"background: none; overflow: hidden;\";\n}" ]
[ "0.72282773", "0.7017293", "0.70024765", "0.6924936", "0.6587639", "0.6523918", "0.6374377", "0.62792945", "0.62129873", "0.6106631", "0.6056158", "0.596723", "0.5951018", "0.59207624", "0.5912976", "0.5840851", "0.57990956", "0.57063365", "0.5696586", "0.5675916", "0.5670329", "0.56464285", "0.56424785", "0.56011057", "0.55830073", "0.5576446", "0.55671567", "0.5554548", "0.55467546", "0.5502435" ]
0.82062954
0
Returns a url for the thumbnail for the given video +source+ and +options+
function cl_video_thumbnail_path($source, $options = array()) { $options = array_merge(default_poster_options(), $options); return cloudinary_url_internal($source, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl_video_thumbnail_tag($source, $options = array()) {\n return cl_image_tag($source, array_merge(default_poster_options(),$options));\n }", "function cl_video_path($source, $options = array()) {\n $options = array_merge( array('resource_type' => 'video'), $options);\n return cloudinary_url_internal($source, $options);\n }", "function urlToThumbnail($video) {\n\n // Stripping down to URL\n preg_match('/src=\"(.+?)\"/', $video, $matches_url );\n $src = $matches_url[1];\n\n // Attempting to get Youtube\n preg_match('/embed(.*?)?feature/', $src, $matches_id );\n if ($matches_id != NULL) {\n $id = $matches_id[1];\n $id = str_replace( str_split( '?/' ), '', $id );\n\n $MaxResURL = 'https://img.youtube.com/vi/' . $id . '/maxresdefault.jpg';\n\n $curl = curl_init();\n curl_setopt_array($curl, array( \n CURLOPT_URL => $MaxResURL,\n CURLOPT_HEADER => true,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_NOBODY => true));\n\n $response = explode(\"\\n\", curl_exec($curl));\n curl_close($curl);\n\n //var_dump($response); \n\n //If maxres image exists do something with it.\n if (strpos($response[0], '200') !== false) { \n return $MaxResURL;\n } else {\n // print 'Some Other IMG';\n return 'https://img.youtube.com/vi/' . $id . '/hqdefault.jpg';\n }\n } else {\n // Attempting to get Vimeo\n preg_match('/video(.*?)?app_id/', $src, $matches_id );\n\n $id = $matches_id[1];\n $id = str_replace( str_split( '?/' ), '', $id );\n\n $hash = unserialize(file_get_contents(\"https://vimeo.com/api/v2/video/$id.php\"));\n\n return $hash[0]['thumbnail_large'];\n }\n\n }", "function cl_video_tag($source, $options = array()) {\n $source = preg_replace('/\\.(' . implode('|', default_source_types()) . ')$/', '', $source);\n\n $source_types = Cloudinary::option_consume($options, 'source_types', array());\n $source_transformation = Cloudinary::option_consume($options, 'source_transformation', array());\n $fallback = Cloudinary::option_consume($options, 'fallback_content', '');\n\n if (empty($source_types)) {\n $source_types = default_source_types();\n }\n $video_options = $options;\n\n if (array_key_exists('poster', $video_options)) {\n if (is_array($video_options['poster'])) {\n if (array_key_exists('public_id', $video_options['poster'])) {\n $video_options['poster'] = cloudinary_url_internal($video_options['poster']['public_id'], $video_options['poster']);\n } else {\n $video_options['poster'] = cl_video_thumbnail_path($source, $video_options['poster']);\n }\n }\n } else {\n $video_options['poster'] = cl_video_thumbnail_path($source, $options);\n }\n \n if (empty($video_options['poster'])) unset($video_options['poster']);\n\n\n $html = '<video ';\n\n if (!array_key_exists('resource_type', $video_options)) $video_options['resource_type'] = 'video';\n $multi_source = is_array($source_types);\n if (!$multi_source){\n $source .= '.' . $source_types;\n }\n $src = cloudinary_url_internal($source, $video_options);\n if (!$multi_source) $video_options['src'] = $src;\n if (isset($video_options[\"html_width\"])) $video_options['width'] = Cloudinary::option_consume($video_options, 'html_width');\n if (isset($video_options['html_height'])) $video_options['height'] = Cloudinary::option_consume($video_options, 'html_height');\n $html .= Cloudinary::html_attrs($video_options ) . '>';\n\n if ($multi_source) {\n \n foreach($source_types as $source_type) {\n $transformation = Cloudinary::option_consume($source_transformation, $source_type, array());\n $transformation = array_merge($options, $transformation);\n $src = cl_video_path($source . '.' . $source_type, $transformation);\n $video_type = (($source_type == 'ogv') ? 'ogg' : $source_type);\n $mime_type = \"video/$video_type\";\n $html .= '<source '. Cloudinary::html_attrs(array('src' => $src, 'type' => $mime_type)) . '>';\n }\n\n }\n\n $html .= $fallback;\n $html .= '</video>';\n return $html;\n }", "function dailymotionComGetThumbnail($option)\r\n\t{\r\n\t\t$thumbnail = \"http://www.dailymotion.com/thumbnail/160x120/video/\".$option;\r\n\t\t$thumbnail = trim(strip_tags($thumbnail));\r\n\t\treturn $thumbnail;\r\n\t}", "function youtube_thumb($vid){\n $public_path = file_create_url('public://youtube/' .$vid. '.jpg');\n return $public_path;\n}", "function video_setthumbnail($sessionid=null,$videoid=null,$timepoint=null,$file=null) {\n \n if (isset($file) && substr($file,0,1) != '@') {\n $file = '@' . $file;\n }\n \n $thumbnail = $this->sendRequest('viddler.videos.setThumbnail',array('sessionid'=>$sessionid,'video_id'=>$videoid,'timepoint'=>1,'file'=>$file,),'post');\n \n if ($thumbnail['error']) {\n return $thumbnail['error']['description'];\n } else {\n return $thumbnail['thumbnail'];\n }\n\n }", "public function getThumbnailImage($options = array())\n {\n return image_tag($this->getThumbnailUrl(), $options);\n }", "function set_video_image_source($file_names_images, $file_names_images_deduped, $fileurl) {\n $image = get_image($file_names_images, $file_names_images_deduped, $fileurl);\n $video_source_image = \"<img src=\\\"$image\\\" style=\\\"width:100%; height:100%;\\\" alt=\\\"No video playback capabilities\\\">\\n\";\n return $video_source_image;\n}", "function thumbnail_tag($source, $width, $height, $options = array())\n{\n\t$img_src = thumbnail_path($source, $width, $height, false);\n\treturn image_tag($img_src, $options);\n}", "public function getThumbUrl();", "public static function getThumbUrl($source, $width = null, $height = null, $type = '')\n\t{\n if (method_exists('VtHelper', 'getThumbUrl'))\n {\n return VtHelper::getThumbUrl($source, $width, $height, $type);\n }\n\n\t\tswitch ($type)\n\t\t{\n\t\t\tcase 'app':\n\t\t\t\t$defaultImage = sfConfig::get('app_app_image_default');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$defaultImage = sfConfig::get('app_image_default');\n\t\t}\n\n\t\tif ($width == null && $height == null)\n\t\treturn (file_exists(sfConfig::get('sf_web_dir') . $source)) ? $source : $defaultImage;\n\t\tif (empty($source)) {\n\t\t\treturn $defaultImage;\n\t\t}\n\n\t\t$mediasDir = sfConfig::get('sf_web_dir');\n\n\t\t$fullPath = $mediasDir . $source;\n\t\t$pos = strrpos($source, '/');\n\t\tif ($pos !== false) {\n\t\t\t$filename = substr($source, $pos + 1);\n\n\t\t\t$app = sfContext::getInstance()->getConfiguration()->getApplication();\n\t\t\tswitch ($app)\n\t\t\t{\n\t\t\t\tcase 'front': \n\t\t\t\t\t$dir = '/cache' . '/f_' . substr($source, 1, $pos);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'frontend': \n\t\t\t\t\t$dir = '/cache' . '/f_' . substr($source, 1, $pos);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'mobile': \n\t\t\t\t\t$dir = '/cache' . '/m_' . substr($source, 1, $pos);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'admin': \n\t\t\t\t\t$dir = '/cache' . '/a_' . substr($source, 1, $pos);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\n\t\t} else {\n\t\t\treturn $defaultImage;\n\t\t\t#return false;\n\t\t}\n\n\t\t$pos = strrpos($filename, '.');\n\t\tif ($pos !== false) {\n\t\t\t$basename = substr($filename, 0, $pos);\n\t\t\t$extension = substr($filename, $pos + 1);\n\t\t} else {\n\t\t\treturn $defaultImage;\n\t\t\t#return false;\n\t\t}\n\n\t\tif ($width == null) {\n\t\t\t$thumbName = $basename . '_auto_' . $height . '.' . $extension;\n\t\t} else if ($height == null) {\n\t\t\t$thumbName = $basename . '_' . $width . '_auto.' . $extension;\n\t\t} else {\n\t\t\t$thumbName = $basename . '_' . $width . '_' . $height . '.' . $extension;\n\t\t}\n\n\t\t$fullThumbPath = $mediasDir . $dir . $thumbName;\n\n\t\t# Neu thumbnail da ton tai roi thi khong can generate\n\t\tif (file_exists($fullThumbPath)) {\n\t\t\treturn $dir . $thumbName;\n\t\t}\n\n\t\t# Neu thumbnail chua ton tai thi su dung plugin de tao ra\n\t\t$scale = ($width != null && $height != null) ? false : true;\n\t\t$thumbnail = new sfThumbnail($width, $height, $scale, true, 100);\n\t\tif (!is_file($fullPath)) {\n\t\t\treturn $defaultImage;\n\t\t}\n\t\t$thumbnail->loadFile($fullPath);\n\n\t\tif (!is_dir($mediasDir . $dir)) mkdir($mediasDir . $dir, 0777, true);\n\t\t$thumbnail->save($fullThumbPath, 'image/jpeg');\n\t\treturn (file_exists(sfConfig::get('sf_web_dir') . $dir . $thumbName)) ? $dir . $thumbName : $defaultImage;\n\n\t}", "function getThumbImage($route, $thumbRoute){ // ver pq se ejecuta antes de instanciarla esta puta function\n\n/*\n $ffmpeg = FFMpeg\\FFMpeg::create();\n $video = $ffmpeg->open($route);\n $frame = $video->frame(FFMpeg\\Coordinate\\TimeCode::fromSeconds(1));\n $imageName = $frame->save($thumbRoute.uniqid().'jpg');\n*/\n\n $movie = new ffmpeg_movie($route,false);\n $videoDuration = $movie->getDuration();\n $frameCount = $movie->getFrameCount();\n $frameRate = $movie->getFrameRate();\n $videoTitle = $movie->getTitle();\n $author = $movie->getAuthor() ;\n $copyright = $movie->getCopyright();\n $frameHeight = $movie->getFrameHeight();\n $frameWidth = $movie->getFrameWidth();\n\n $capPos = ceil($frameCount/4);\n\n if($frameWidth>120)\n {\n $cropWidth = ceil(($frameWidth-120)/2);\n }\n else\n {\n $cropWidth =0;\n }\n if($frameHeight>90)\n {\n $cropHeight = ceil(($frameHeight-90)/2);\n }\n else\n {\n $cropHeight = 0;\n }\n if($cropWidth%2!=0)\n {\n $cropWidth = $cropWidth-1;\n }\n if($cropHeight%2!=0)\n {\n $cropHeight = $cropHeight-1;\n }\n\n $frameObject = $movie->getFrame($capPos);\n\n\n if($frameObject)\n {\n $imageName = $thumbRoute;\n $tmbPath = $imageName;\n $frameObject->resize(480,270,0,0,0,0); //120 x90\n imagejpeg($frameObject->toGDImage(),$tmbPath);\n }\n else\n {\n $imageName=\"\";\n }\n \n return $imageName;\n }", "public function doThumb($options) {\n $img = './assets/images/uploads/'.$options['source_image'];\n \n // If the thumbnail already exists, we just read it\n // No need to use the GD library again\n\n if( !is_file('./assets/images/uploads/thumbs/'.$options['source_image']) ) {\n $config['source_image'] = './assets/images/uploads/'.$options['source_image'];\n $config['new_image'] = './assets/images/uploads/thumbs/'.$options['source_image'];\n $config['image_library'] = 'gd2';\n $config['width'] = $options['width'];\n $config['height'] = $options['height']; \n $config['create_thumb'] = TRUE;\n $config['maintain_ratio'] = TRUE;\n \n $this->image_lib->initialize($config);\n $this->image_lib->resize();\n }\n }", "function getThumbnailUrl($path, $fileName)\n{\n // assuming this is an image file or video file\n // generate a compressed smaller version of the file\n // here and return the status\n $sourceFile = $path . '/' . $fileName;\n $targetFile = $path . '/thumbs/' . $fileName;\n //\n // generateThumbnail: method to generate thumbnail (not included)\n // using $sourceFile and $targetFile\n //\n if (generateThumbnail($sourceFile, $targetFile) === true) {\n return 'http://localhost/uploads/thumbs/' . $fileName;\n } else {\n return 'http://localhost/uploads/' . $fileName; // return the original file\n }\n}", "public function getPreviewUrl(){\n\t\tif ($videoId = $this->getVideoId()){\n\t\t\treturn 'http://i4'.rand(7, 8).'.vbox7.com/p/'.$videoId.'5.jpg'; // large\n\t\t} \n\t\treturn false;\n\t}", "function si_get_video_image($url){\r\n\tif(preg_match('/youtube/', $url)) {\t\t\t\r\n\t\tif(preg_match('/[\\\\?\\\\&]v=([^\\\\?\\\\&]+)/', $url, $matches)) {\r\n\t\t\treturn \"http://img.youtube.com/vi/\".$matches[1].\"/default.jpg\"; \r\n\t\t}\r\n\t}\r\n\telseif(preg_match('/vimeo/', $url)) {\t\t\t\r\n\t\tif(preg_match('~^http://(?:www\\.)?vimeo\\.com/(?:clip:)?(\\d+)~', $url, $matches))\t{\r\n\t\t\t\t$id = $matches[1];\t\r\n\t\t\t\tif (!function_exists('curl_init')) die('CURL is not installed!');\r\n\t\t\t\t$url = \"http://vimeo.com/api/v2/video/\".$id.\".php\";\r\n\t\t\t\t$ch = curl_init();\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_URL, $url);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_HEADER, 0);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_TIMEOUT, 10);\r\n\t\t\t\t$output = unserialize(curl_exec($ch));\r\n\t\t\t\t$output = $output[0][\"thumbnail_medium\"]; \r\n\t\t\t\tcurl_close($ch);\r\n\t\t\t\treturn $output;\r\n\t\t}\r\n\t}\t\t\r\n}", "public function getImageUrl()\n {\n // return a default image placeholder if your source avatar is not found\n $avatar = isset($this->video_image) ? 'img-learning/'.$this->video_image : '';\n return Yii::$app->params['uploadUrl'] . $avatar;\n }", "function getimage($videoid){\n$gv_xml_image_string = @file_get_contents(\"http://video.google.com/videofeed?docid=\".$videoid);\n$gv_xml_image_start = explode('<media:thumbnail url=\"',$gv_xml_image_string,2);\n$gv_xml_image_end = explode('\"',$gv_xml_image_start[1],2);\n$gv_image = addslashes($gv_xml_image_end[0]);\nreturn $gv_image;\n}", "public function getVideoThumbnail($field)\n {\n $ret = '';\n if (isset($field['0']['#title']['#uri']))\n $ret = $field['0']['#title']['#uri'];\n return $ret;\n }", "public function getThumbnail();", "function thumbnail_path($path = '', $returnAsUrl = false)\n {\n if ($returnAsUrl)\n return asset('data/videos/thumbnails' . ($path ? '/' . $path : $path));\n return public_path('data/videos/thumbnails' . ($path ? '/' . $path : $path));\n }", "function today_get_thumbnail_url( $post, $thumbnail_size='medium', $use_fallback=true ) {\n\tif ( is_numeric( $post ) ) {\n\t\t$post = get_post( $post );\n\t}\n\tif ( ! $post instanceof WP_Post ) return null;\n\n\t$thumbnail_url = '';\n\t$header_media_type = get_field( 'header_media_type', $post );\n\n\tswitch ( $header_media_type ) {\n\t\tcase 'video':\n\t\t\t// Get a thumbnail ID without a fallback.\n\t\t\t// Try to use a video poster as a fallback if possible\n\t\t\t$thumbnail_id = today_get_thumbnail_id( $post, false );\n\n\t\t\tif ( $thumbnail_id ) {\n\t\t\t\t$thumbnail_url = ucfwp_get_attachment_src_by_size( $thumbnail_id, $thumbnail_size );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Get video url (prevent ACF oEmbed processing)\n\t\t\t\t$video_url = get_field( 'post_header_video_url', $post, false );\n\t\t\t\t$video_thumbnail_w = intval( get_option( \"{$thumbnail_size}_size_w\" ) );\n\t\t\t\t$video_thumbnail_h = intval( get_option( \"{$thumbnail_size}_size_h\" ) );\n\t\t\t\t$video_thumbnail_url = today_get_oembed_thumbnail( $video_url, $video_thumbnail_w, $video_thumbnail_h );\n\n\t\t\t\tif ( $video_thumbnail_url ) {\n\t\t\t\t\t$thumbnail_url = $video_thumbnail_url;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we still don't have anything at this point,\n\t\t\t// go grab the UCF Post List plugin's fallback image\n\t\t\tif ( ! $thumbnail_url ) {\n\t\t\t\t// Use the UCF Post List Shortcode plugin's\n\t\t\t\t// fallback thumbnail, if one is available\n\t\t\t\tif ( method_exists( 'UCF_Post_List_Config', 'get_option_or_default' ) ) {\n\t\t\t\t\t$thumbnail_id = UCF_Post_List_Config::get_option_or_default( 'ucf_post_list_fallback_image' );\n\t\t\t\t\t$thumbnail_id = is_numeric( $thumbnail_id ) ? intval( $thumbnail_id ) : null;\n\n\t\t\t\t\tif ( $thumbnail_id ) {\n\t\t\t\t\t\t$thumbnail_url = ucfwp_get_attachment_src_by_size( $thumbnail_id, $thumbnail_size );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbreak;\n\t\tcase 'image':\n\t\t\t$thumbnail_id = today_get_thumbnail_id( $post, $use_fallback );\n\n\t\t\tif ( $thumbnail_id ) {\n\t\t\t\t$thumbnail_url = ucfwp_get_attachment_src_by_size( $thumbnail_id, $thumbnail_size );\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\t// Use a fallback if the user requested a thumbnail, but\n\t// one isn't available for the post\n\tif ( ! $thumbnail_url && $use_fallback ) {\n\t\t$thumbnail_url = TODAY_THEME_IMG_URL . '/default-thumb.jpg';\n\t}\n\n\treturn $thumbnail_url;\n}", "public function getCustomThumbnailAttribute()\n {\n $customThumbnail = false;\n\n $lastCustomThumbnail = VideoRelevantThumbnail::where('key', $this->video_id)\n\t\t\t\t\t\t ->orderBy('id', 'DESC')->first();\n\n if (!empty($lastCustomThumbnail) && $this->thumbnail != $this->default_thumbnail) {\n\n if (isset($this->thumbnail) && isset($lastCustomThumbnail->url)) {\n if ($this->thumbnail != $lastCustomThumbnail->url) {\n // We have a custom thumbnail set on the video\n $imageObject = Image::getImageByUrl($this->thumbnail);\n if ($imageObject) {\n return $imageObject->url;\n }\n } else {\n return $lastCustomThumbnail->url;\n }\n }\n }\n\n return $customThumbnail;\n }", "function thumbvideo($tabvideo)\n{\n //VIMEO\n $pos = strpos($tabvideo, \"vimeo.com\");\n if ($pos !== false) {\n //No hay forma de obtener la imagen\n return \"images/icono-videos.png\";\n }\n \n //YOUTUBE\n $pos = strpos($tabvideo, \"youtube.com\");\n if ($pos !== false) {\n //<iframe width=\"480\" height=\"360\" src=\"http://www.youtube.com/embed/zKsQafgEwyE\" frameborder=\"0\" allowfullscreen></iframe>\n $array1 = explode(\"youtube.com/embed/\", $tabvideo);\n //el array me quedaria con 2 posiciones en una \"<iframe width=\"480\" height=\"360\" src=\"http://www.youtube.com/embed/\" y en otra zKsQafgEwyE\" frameborder=\"0\" allowfullscreen></iframe>\n if(count($array1)==2)\n {\n $array2 = explode('\"', $array1[1]);\n if(count($array2)>0)\n return \"http://img.youtube.com/vi/\".$array2[0].\"/1.jpg\";\n else\n return \"images/icono-videos.png\";\n }\n else\n return \"images/icono-videos.png\";\n }\n \n \n \n return \"images/icono-videos.png\";\n}", "public function getVideoUrl() {\n\t\treturn $this->video_url ?: $this->channel->getVideoUrl($this);\n\t}", "public function _createThumbnail($source)\n {\n if (self::TYPE_IMAGE != $this->_helper->getStorageType() || !$this->mediaWriteDirectory->isFile(\n $source\n ) || !$this->mediaWriteDirectory->isReadable(\n $source\n )\n ) {\n return false;\n }\n $thumbnailDir = $this->_helper->getThumbnailDirectory($source);\n $thumbnailPath = $thumbnailDir . '/' . pathinfo($source, PATHINFO_BASENAME);\n try {\n $this->mediaWriteDirectory->isExist($thumbnailDir);\n $image = $this->_imageFactory->create();\n $image->open($this->mediaWriteDirectory->getAbsolutePath($source));\n $image->keepAspectRatio(true);\n $image->resize(self::THUMBNAIL_WIDTH, self::THUMBNAIL_HEIGHT);\n $image->save($this->mediaWriteDirectory->getAbsolutePath($thumbnailPath));\n } catch (\\Magento\\Framework\\Exception\\FileSystemException $e) {\n $this->_objectManager->get(\\Psr\\Log\\LoggerInterface::class)->critical($e);\n return false;\n }\n\n if ($this->mediaWriteDirectory->isFile($thumbnailPath)) {\n return $thumbnailPath;\n }\n return false;\n }", "private function add_video_thumbnail_url($publication, &$video) {\n\n // Try to find a thumbnail url based on configuration.\n $thumbnailflavor = self::get_option('opencast_thumbnailflavor');\n if (!empty($thumbnailflavor)) {\n foreach ($publication->attachments as $attachment) {\n if ($attachment->flavor === $thumbnailflavor) {\n $video->thumbnail = $attachment->url;\n return true;\n }\n }\n }\n\n // Try fallback.\n $thumbnailflavorfallback = self::get_option('opencast_thumbnailflavorfallback');\n if (!empty($thumbnailflavor)) {\n foreach ($publication->attachments as $attachment) {\n if ($attachment->flavor === $thumbnailflavorfallback) {\n $video->thumbnail = $attachment->url;\n return true;\n }\n }\n }\n\n // Automatically try to find the best preview image:\n // presentation/search+preview > presenter/search+preview > any other preview\n foreach ($publication->attachments as $attachment) {\n if (!empty($attachment->url) && strpos($attachment->flavor, '+preview') > 0) {\n if (empty($video->url) || strpos($attachment->flavor, '/search+preview') > 0) {\n $video->thumbnail = $attachment->url;\n if ($attachment->flavor === 'presentation/search+preview') {\n return true;\n }\n }\n }\n }\n return false;\n }", "function getThumbnail( $size = 'medium', $atts = [] ) {\n $atts = wp_merge_args( $atts, static::$default_thumbnail_atts );\n \treturn sprintf( \n \t\t'<img src=\"%s\" alt=\"\" class=\"%s\" />', \n \t\t$this->getVideoThumbnail(), $atts['class']\n \t);\n }", "function thumbnail_path($source, $width, $height, $absolute = false)\n{\n\t$thumbnails_dir = sfConfig::get('app_sfThumbnail_thumbnails_dir', 'uploads/thumbnails');\n\t\n\t$width = intval($width);\n\t$height = intval($height);\n\t\n\tif (substr($source, 0, 1) == '/') {\n\t\t$realpath = sfConfig::get('sf_web_dir') . $source;\n\t} else {\n\t\t$realpath = sfConfig::get('sf_web_dir') . '/images/' . $source;\n\t}\n\t\n\t$real_dir = dirname($realpath);\n\t$thumb_dir = '/' . $thumbnails_dir . substr($real_dir, strlen(sfConfig::get('sf_web_dir')));\n\t$thumb_name = preg_replace('/^(.*?)(\\..+)?$/', '$1_' . $width . 'x' . $height . '$2', basename($source));\n\t\n\t$img_from = $realpath;\n\t$thumb = $thumb_dir . '/' . $thumb_name;\n\t$img_to = sfConfig::get('sf_web_dir') . $thumb;\n\t\n\tif (!is_dir(dirname($img_to))) {\n\t\tif (!mkdir(dirname($img_to), 0777, true)) {\n\t\t\tthrow new Exception('Cannot create directory for thumbnail : ' . $img_to);\n\t\t}\n\t}\n\t\n\tif (!is_file($img_to) || filemtime($img_from) > filemtime($img_to)) {\n\t\t$thumbnail = new sfThumbnail($width, $height);\n\t\t$thumbnail->loadFile($img_from);\n\t\t$thumbnail->save($img_to);\n\t}\n\t\n\treturn image_path($thumb, $absolute);\n}" ]
[ "0.7709361", "0.71366054", "0.6876384", "0.67219573", "0.6583498", "0.63707983", "0.6274681", "0.6195743", "0.6154637", "0.6028501", "0.5932204", "0.5927381", "0.5923731", "0.5875238", "0.5860753", "0.58262503", "0.5811683", "0.5782278", "0.57742125", "0.5766459", "0.57586515", "0.5697278", "0.5694121", "0.56881714", "0.5673155", "0.56513673", "0.56466746", "0.56375384", "0.5623582", "0.5609356" ]
0.81279355
0
Creates an HTML video tag for the provided +source+ ==== Options source_types Specify which source type the tag should include. defaults to webm, mp4 and ogv. source_transformation specific transformations to use for a specific source type. poster override default thumbnail: url: provide an ad hoc url options: with specific poster transformations and/or Cloudinary +:public_id+ ==== Examples cl_video_tag("mymovie.mp4") cl_video_tag("mymovie.mp4", array('source_types' => 'webm')) cl_video_tag("mymovie.ogv", array('poster' => "myspecialplaceholder.jpg")) cl_video_tag("mymovie.webm", array('source_types' => array('webm', 'mp4'), 'poster' => array('effect' => 'sepia')))
function cl_video_tag($source, $options = array()) { $source = preg_replace('/\.(' . implode('|', default_source_types()) . ')$/', '', $source); $source_types = Cloudinary::option_consume($options, 'source_types', array()); $source_transformation = Cloudinary::option_consume($options, 'source_transformation', array()); $fallback = Cloudinary::option_consume($options, 'fallback_content', ''); if (empty($source_types)) { $source_types = default_source_types(); } $video_options = $options; if (array_key_exists('poster', $video_options)) { if (is_array($video_options['poster'])) { if (array_key_exists('public_id', $video_options['poster'])) { $video_options['poster'] = cloudinary_url_internal($video_options['poster']['public_id'], $video_options['poster']); } else { $video_options['poster'] = cl_video_thumbnail_path($source, $video_options['poster']); } } } else { $video_options['poster'] = cl_video_thumbnail_path($source, $options); } if (empty($video_options['poster'])) unset($video_options['poster']); $html = '<video '; if (!array_key_exists('resource_type', $video_options)) $video_options['resource_type'] = 'video'; $multi_source = is_array($source_types); if (!$multi_source){ $source .= '.' . $source_types; } $src = cloudinary_url_internal($source, $video_options); if (!$multi_source) $video_options['src'] = $src; if (isset($video_options["html_width"])) $video_options['width'] = Cloudinary::option_consume($video_options, 'html_width'); if (isset($video_options['html_height'])) $video_options['height'] = Cloudinary::option_consume($video_options, 'html_height'); $html .= Cloudinary::html_attrs($video_options ) . '>'; if ($multi_source) { foreach($source_types as $source_type) { $transformation = Cloudinary::option_consume($source_transformation, $source_type, array()); $transformation = array_merge($options, $transformation); $src = cl_video_path($source . '.' . $source_type, $transformation); $video_type = (($source_type == 'ogv') ? 'ogg' : $source_type); $mime_type = "video/$video_type"; $html .= '<source '. Cloudinary::html_attrs(array('src' => $src, 'type' => $mime_type)) . '>'; } } $html .= $fallback; $html .= '</video>'; return $html; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl_video_thumbnail_tag($source, $options = array()) {\n return cl_image_tag($source, array_merge(default_poster_options(),$options));\n }", "public function video($source)\n {\n $this->value->setValue(ClassUtils::verifyInstance($source, SourceValue::class));\n\n return $this;\n }", "public function callback( $atts, $content = null ) {\n\n // Create attributes array by sanitizing provided values\n extract( $this->get_sanitized_attributes( $atts ) );\n\n switch ( $source ) {\n\n case 'embed':\n return wp_oembed_get( $embed );\n break;\n\n case 'hosted':\n $sources_html = '';\n if ( ! empty( $webm ) ) {\n $sources_html .= '<source src=\"'.$webm.'\" type=\"video/webm\" />';\n }\n if ( ! empty( $ogg ) ) {\n $sources_html .= '<source src=\"'.$ogg.'\" type=\"video/ogg\" />';\n }\n if ( ! empty( $mp4 ) ) {\n $sources_html .= '<source src=\"'.$mp4.'\" type=\"video/mp4\" />';\n }\n\n // This means we have at least one `valid` source\n if ( $sources_html ) {\n $auto = cv_make_bool( $auto ) ? ' autoplay' : '';\n $audio = ! cv_make_bool( $audio ) ? ' muted' : '';\n $loop = cv_make_bool( $loop ) ? ' loop' : '';\n $controls = cv_make_bool( $controls ) ? ' controls' : '';\n return '<video'.$auto.$audio.$loop.$controls.'>'.$sources_html.'</video>';\n }\n break;\n\n }\n\n }", "function cl_video_path($source, $options = array()) {\n $options = array_merge( array('resource_type' => 'video'), $options);\n return cloudinary_url_internal($source, $options);\n }", "function set_video_tag_attributes($video_tag_attributes, $w, $h, $poster_image_file = null) {\n $video_tag_open = \"<video $poster_image_file$video_tag_attributes width=\\\"$w\\\" height=\\\"$h\\\">\\n\";\n return $video_tag_open;\n}", "function set_video_tag_sources($filenames, $filesdeduped, $fileurl, $video_sources) {\n $file_names = count($filenames);\n $unique_file_names = count($filesdeduped);\n if($unique_file_names > 1){\n // echo 'more than 1 video';\n $i = $fileurl - 1;\n $t = ($file_names / $unique_file_names) + $i;\n } else {\n $t = $file_names;\n $i = 0;\n }\n $sources = '';\n asort($filenames);\n for ($i; $i < $t; $i++) {\n $file = $filenames[$i];\n $stem = $video_sources[$i]['filename_stem'];\n $codec = $video_sources[$i]['codec'];\n $media = $video_sources[$i]['media'];\n //echo $media;\n $ext = pathinfo($file, PATHINFO_EXTENSION);\n $filename = pathinfo($file, PATHINFO_FILENAME);\n if(strstr($filename,$stem) == $stem) {\n if(!empty($media)) {\n $sources .= \"\\t<source src=\\\"$file\\\" type='video/$ext; codecs=\\\"$codec\\\"' media=\\\"$media\\\">\\n\";\n } else {\n $sources .= \"\\t<source src=\\\"$file\\\" type='video/$ext; codecs=\\\"$codec\\\"'>\\n\";\n }\n }\n }\n return $sources;\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 = 'https://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 = 'https://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 = 'https://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\tif ($this->light_mode) {\n\t\t\treturn $this->lightLinkBlock('video', $content, $type . ' video', '', $previewthumb);\n\t\t}\n\t\treturn $this->video_preview($params, $previewthumb);\n\t}", "function hewa_player_print_source_tag( $source, $type ) {\n\n $source_e = esc_attr( $source );\n $type_e = esc_attr( $type );\n echo \"<source src='$source_e' type='$type_e'>\";\n}", "function theme_gs_helper_field_video($vars) {\n $output = '';\n\n if (!empty($vars['image_file'])) {\n $items['movie'] = (array) $vars['video_file'];\n \n $items['poster'] = (array) $vars['image_file'];\n \n $video_vars = array(\n 'items' => $items,\n 'attributes' => array(\n 'width' => 600,\n // 'height' => 300,\n ),\n 'player_id' => 'file-' . $vars['video_file']['fid'],\n );\n \n $output = '<div class=\"video-content\">' . theme('videojs', $video_vars) . '</div>';\n }\n \n return $output;\n}", "public function __tostring()\n\t\t{\n\t\t//\tSet tag attr\n\t\t\t$a = '';\n\t\t\tforeach ((array)$this->attr as $attr => $value)\n\t\t\t{\n\t\t\t\t$a .= ' '.$attr;\n\t\t\t\tif ($value != null) $a .= '=\"'.$value.'\"';\n\t\t\t}\n\t\t//\tReturn\n\t\t\treturn '\n\t\t\t<video'.$a.'>\n\t\t\t\t<source src=\"'.$this->get_url(true).'\" type=\"video/mp4\">\n\t\t\t\t<source src=\"'.$this->get_url(true).'\" type=\"video/ogg\">\n\t\t\t\tYour browser does not support the html5 video tag.\n\t\t\t</video>';\n\t\t}", "public static function video( $params )\n\t{\n\t}", "function cl_video_thumbnail_path($source, $options = array()) {\n $options = array_merge(default_poster_options(), $options);\n return cloudinary_url_internal($source, $options);\n }", "function new_video() {\n\t\tif($_SERVER['REQUEST_METHOD'] == 'POST') {\n\n\t\t\t$name_parts = explode('.', basename($_FILES['source']['name']));\n\t\t\t$filename = uniqid().'.'.array_pop($name_parts);\n\n\t\t\t$upload = wp_upload_bits($filename, null, file_get_contents($_FILES[\"source\"][\"tmp_name\"]));\n\t\t\tprint_r($upload);\n\t\t\tif(!$upload['error']) {\n\t\t\t\t$video = new Video();\n\t\t\t\t$video->name = $_POST['name'];\n\t\t\t\t$video->description = $_POST['description'];\n\t\t\t\t$video->category_id = $_POST['category_id'];\n\t\t\t\t$video->width = $_POST['width'];\n\t\t\t\t$video->height = $_POST['height'];\n\t\t\t\t$video->tag_list = $_POST['tag_list'];\n\t\t\t\t$video->show_video_watermark = isset($_POST['show_video_watermark']);\n\t\t\t\t$video->use_age_gate = isset($_POST['use_age_gate']);\n\t\t\t\t$video->auto_start = isset($_POST['autostart']);\n\t\t\t\t\n\n\t\t\t\t$video->source_url = $upload['url'];\n\n\t\t\t\ttry{\n\t\t\t\t\t$new_video = $this->playwire->uploadVideo($video);\n\t\t\t\t\theader('Location: ?page=playwire-list');\n\t\t\t\t\texit();\n\t\t\t\t} catch(PlaywireException $exception) {\n\t\t\t\t\techo \"Had an exception: \" . $exception->getMessage();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\n\t\t} else {\n\t\t\t$defaults = $this->playwire->getVideoDefaults();\n\t\t\t$categories = $this->playwire->getVideoCategories();\n\n\t\t\tinclude 'add.tpl.php';\n\t\t}\n\t}", "function vsw_show_video_class($id,$source,$width,$height,$autoplay){\n\n $vsw_id = $id;\n\t\t$vsw_width = $width;\n\t\t$vsw_height = $height;\n \n\t\t//convert string of source to lowercase\n $source = strtolower($source);\n\n //should have used all lowercase in previous functions\n\t\t//now have to switch it.\n\t\tswitch ($source) {\n\t\t\n\t\tcase null:\n\t\t$vsw_source = null;\n\t\tbreak;\n\t\t\n\t\tcase youtube:\n\t\t$vsw_source = YouTube;\n\t\tbreak;\n\t\t\n\t\tcase vimeo:\n\t\t$vsw_source = Vimeo;\n break;\n\t\t\n\t\tcase myspace:\n\t\t$vsw_source = MySpace;\n break;\n\t\t\n\t\tcase veoh:\n\t\t$vsw_source = Veoh;\n break;\n\t\t\n\t case bliptv:\n\t\t$vsw_source = Blip;\n break;\n\t\t\n\t case wordpress:\n\t\t$vsw_source = WordPress;\n break;\n\t\t\n\t\tcase viddler:\n\t\t$vsw_source = Viddler;\n break;\n\t\t\n\t\tcase dailymotion:\n\t\t$vsw_source = DailyMotion;\n break;\n\t\t\t\t\n\t\t\n\t\tcase revver:\n\t\t$vsw_source = Revver;\n\t\tbreak;\n\t\t\n\t\tcase metacafe:\n\t\t$vsw_source = Metacafe;\n\t\tbreak;\n\t\t\n\t\tcase tudou:\n\t\t$vsw_source = Tudou;\n\t\tbreak;\n\t\t\n\t\tcase youku:\n\t\t$vsw_source = Youku;\n\t\tbreak;\n\t\t\n\t\tcase cn6:\n\t\t$vsw_source = cn6;\n\t\tbreak;\n\t\t\n\t\tcase google:\n\t\t$vsw_source = Google;\n\t\tbreak;\n\t\t\n\t\tcase tangle:\n\t\t$vsw_source = Tangle;\n\t\tbreak; \n\t\t\n\t\t}\n\t\t\n\t\t//string to lowercase\n\t\t$autoplay = strtolower($autoplay);\n\t\t\n\t\t//switch autoplay yes or no to 1 or 0\n\t\tswitch ($autoplay) {\n\t\t\n\t\tcase null:\n\t\t$vsw_autoplay = 0;\n\t\tbreak;\n\t\t\n\t\tcase no:\n\t\t$vsw_autoplay = 0;\n\t\tbreak;\n\t\t\n\t\tcase yes:\n\t\t$vsw_autoplay = 1;\n\t\tbreak;\n\t\t\n\t\t}\n\t\t\t\n\t\n$vsw_code = VSWShowVideo($vsw_source,$vsw_id,$vsw_autoplay,$vsw_width,$vsw_height,'false','true');\n\nreturn $vsw_code;\n\n}", "public function createVideo(array $data);", "private function tagSource($source)\n {\n //$source = isset($attribs['tagSource']) ? $attribs['tagSource'] : array();\n\n if (is_array($source)) {\n $out = json_encode($source);\n } else if (($source[0] == '/') || (substr($source, 7) == 'http://')) {\n $source .= (substr($source, -1) != '/') ? '/' : '';\n $out = \"'{$source}'\";\n } else {\n //$out = '\"' . str_replace($source, '\"', '\\\"') . '\"';\n $out = $source;\n }\n\n return $out;\n }", "function thumbnail_tag($source, $width, $height, $options = array())\n{\n\t$img_src = thumbnail_path($source, $width, $height, false);\n\treturn image_tag($img_src, $options);\n}", "public static function mp4_template ( $poster , $video ) {\n\n return '<div class=\"plyrplayer\"><video poster=\"' . $poster . '\" class=\"mp4-player\"><source src=\"'.$video.'\" type=\"video/mp4\" /></video></div>';\n\n }", "function hwdsb_vp_the_video() {\n\t$meta = get_post_meta( get_the_ID() );\n\n\tif ( empty( $meta['vp_video_source'] ) ) {\n\t\treturn;\n\t}\n\n\t$source = $meta['vp_video_source'][0];\n\t$content = '';\n\n\tswitch( $source ) {\n\t\tcase 'local' :\n\t\tcase 'vimeo' :\n\t\t\tif ( true === function_exists( 'mexp_vimeo_get_shortcode_tag' ) ) {\n\t\t\t\t$autoplay = ! empty( $_GET['playlist'] ) ? ' autoplay=\"1\"' : '';\n\t\t\t\t$content = '[' . mexp_vimeo_get_shortcode_tag() . ' height=\"360\" id=\"' . $meta['vp_video_id'][0] . '\"' . $autoplay . ']';\n\t\t\t\t$media = do_shortcode( $content );\n\n\t\t\t// Old way.\n\t\t\t} else {\n\t\t\t\t$content = '[video src=\"https://vimeo.com/' . $meta['vp_video_id'][0] . '\"]';\n\n\t\t\t\t$content = apply_filters( 'the_content', $content );\n\t\t\t\t$media = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );\n\t\t\t\tif ( ! empty( $media ) ) {\n\t\t\t\t\t$media = $media[0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\tif ( ! empty( $media ) ) {\n\t\tprintf( '<div class=\"post-media jetpack-video-wrapper\">%s</div>', $media );\n?>\n\n<script>\n/*! fluidvids.js v2.4.1 | (c) 2014 @toddmotto | License: MIT | https://github.com/toddmotto/fluidvids */\n!function(e,t){\"function\"==typeof define&&define.amd?define(t):\"object\"==typeof exports?module.exports=t:e.fluidvids=t()}(this,function(){\"use strict\";function e(e){return new RegExp(\"^(https?:)?//(?:\"+d.players.join(\"|\")+\").*$\",\"i\").test(e)}function t(e,t){return parseInt(e,10)/parseInt(t,10)*100+\"%\"}function i(i){if((e(i.src)||e(i.data))&&!i.getAttribute(\"data-fluidvids\")){var n=document.createElement(\"div\");i.parentNode.insertBefore(n,i),i.className+=(i.className?\" \":\"\")+\"fluidvids-item\",i.setAttribute(\"data-fluidvids\",\"loaded\"),n.className+=\"fluidvids\",n.style.paddingTop=t(i.height,i.width),n.appendChild(i)}}function n(){var e=document.createElement(\"div\");e.innerHTML=\"<p>x</p><style>\"+o+\"</style>\",r.appendChild(e.childNodes[1])}var d={selector:[\"iframe\",\"object\"],players:[\"www.youtube.com\",\"player.vimeo.com\"]},o=[\".fluidvids {\",\"width: 100%; max-width: 100%; position: relative;\",\"}\",\".fluidvids-item {\",\"position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;\",\"}\"].join(\"\"),r=document.head||document.getElementsByTagName(\"head\")[0];return d.render=function(){for(var e=document.querySelectorAll(d.selector.join()),t=e.length;t--;)i(e[t])},d.init=function(e){for(var t in e)d[t]=e[t];d.render(),n()},d});\n\n// init\nfluidvids.init({\n\tselector: ['iframe'],\n\tplayers: ['.'] // remove default youtube / vimeo restriction.\n});\n</script>\n\n<?php\n\t}\n}", "function source_video_body($options)\n{\n\t$urls = array();\n\tif(array_key_exists(\"url\", $options))\n\t{\n\t\t$urls = array( $options[\"url\"] );\n\t}\n\telseif(array_key_exists(\"urls\", $options))\n\t{\n\t\t$urls = $options[\"urls\"];\n\t}\n\telse\n\t{\n\t\treturn;\n\t}\n\t\n\t$url = $urls[rand(0, count($urls) - 1)];\n\t\n\t// Output filter CSS.\n\tif(array_key_exists(\"filters\", $options) && count($options[\"filters\"]) > 0)\n\t{\n\t\techo \"<style type='text/css'> #background_video {\";\n\t\t\n\t\tforeach($options[\"filters\"] as $filter)\n\t\t{\n\t\t\techo \"filter: \" . $filter . \";\\n\";\n\t\t\techo \"-webkit-filter: \" . $filter . \";\\n\";\n\t\t}\n\t\t\n\t\techo \"} </style>\";\n\t}\n\t\n\t// Check if it's a YouTube URL. \n\t$matches = array();\n\t// If it matches, it is.\n\tif(preg_match(\"/(youtu\\.be\\/|youtube\\.com\\/(watch\\?(.*&)?v=|(embed|v)\\/))([^\\?&\\\"'>]+)/\", $url, $matches))\n\t{\n\t\t$id = $matches[5];\n?>\n\t<div id=\"background_video\"></div>\n\t<script type=\"text/javascript\">\n\t<?php /* Load the YouTube IFrame API */ ?>\n\tvar ytReadyCallbacks = ytReadyCallbacks || [];\n\t(function() {\n\t\tvar player;\n\t\tfunction onYouTubeIframeAPIReady() \n\t\t{\n\t\t\tplayer = new YT.Player('background_video', {\n\t\t\t\theight: '504',\n\t\t\t\twidth: '896',\n\t\t\t\tplayerVars: { 'autoplay': 1, 'controls': 0, 'modestbranding': 1, 'showinfo': 0 },\n\t\t\t\tvideoId: '<?php echo htmlentities($id); ?>',\n\t\t\t\tevents: {\n\t\t\t\t\t'onReady': onPlayerReady,\n\t\t\t\t\t'onStateChange': function(e){\n\t\t\t\t\t\tif (e.data === YT.PlayerState.ENDED) {\n\t\t\t\t\t\t\tplayer.playVideo(); \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\tfunction onPlayerReady(e)\n\t\t{\n\t\t\tplayer.setLoop(true);\n\t\t\tplayer.setSize(window.innerWidth, window.innerHeight);\n\t\t\tplayer.setVolume(0);\n\t\t\tplayer.playVideo();\n\t\t}\n\t\t\n\t\t$(window).on('resize', function() {\n\t\t\tplayer.setSize(window.innerWidth, window.innerHeight);\n\t\t});\n\n\t\tytReadyCallbacks.push(onYouTubeIframeAPIReady);\n\t})();\n\t</script>\n<?php\n\t}\n\telse \n\t{\n\t\t// Output video HTML.\n\t\techo \"<video src='$url' autoplay loop muted preload id='background_video'></video>\";\n\t}\n}", "public static function video(Fileresource $fileresource) {\n return new Video($fileresource, FFMpegDriver::create($fileresource), FFProbeDriver::create($fileresource));\n }", "function vsw_show_video($atts, $content = null) {\n\textract(shortcode_atts(array(\n\t \"id\" => ' ',\n\t\t\"source\" => ' ',\n\t\t\"width\" => ' ',\n\t\t\"height\" => ' ',\n\t\t\"autoplay\" => ' ',\n\t), $atts));\n\t\nreturn vsw_show_video_class($id,$source,$width,$height,$autoplay);\n}", "function set_video_image_source($file_names_images, $file_names_images_deduped, $fileurl) {\n $image = get_image($file_names_images, $file_names_images_deduped, $fileurl);\n $video_source_image = \"<img src=\\\"$image\\\" style=\\\"width:100%; height:100%;\\\" alt=\\\"No video playback capabilities\\\">\\n\";\n return $video_source_image;\n}", "function gmp_get_video( $height='', $width='', $inlineCSS=true, $imagesize='video' ){\n \n $video = '';\n \n if( genesis_get_custom_field('_gmp_video_uri') ){\n $video = gmp_video_from_uri( genesis_get_custom_field('_gmp_video_uri'), $height, $width );\n \n $video = '<div class=\"gmp-fit-video\">'. gmp_format_video( $video ) .'</div>';\n }\n elseif( genesis_get_custom_field('_gmp_video_embed') ){\n $video = '<div class=\"gmp-fit-video\">'. gmp_format_video( htmlspecialchars_decode( genesis_get_custom_field('_gmp_video_embed') ) ) . '</div>';\n }\n elseif( genesis_get_custom_field('_gmp_video_file') ){\n $video = gmp_video_from_file( genesis_get_custom_field('_gmp_video_file'), $height, $width, $inlineCSS, $imagesize );\n }\n \n return $video;\n}", "function VSWShowVideo($videosource,$videoid,$autoplaysetting,$videowidth,$videoheight,$admin,$shortcode){\n\n//admin = true to show in widget admin\n//admin = false to show in blog sidebar\n\n $v_autoplay2 = $autoplaysetting;\n $v_id2 = $videoid;\n\t\t$v_source = $videosource;\t\t\n $v_width2 = $videowidth;\n $v_height2 = $videoheight;\n \n \t$source = $v_source;\n \n\t\t//test for source and assign codes accordingly\t\n\t\tswitch ($source) {\n\t\t\n\t\tcase null:\n\t\t$value = null;\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n\t\tbreak;\t\t\n\t\t\n case YouTube:\n $value = \"http://www.youtube.com/v/$v_id2&autoplay=$v_autoplay2&loop=0&rel=0\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n break;\n\t\t\n\t\tcase Vimeo:\n\t\t$value = \"http://vimeo.com/moogaloop.swf?clip_id=$v_id2&amp;server=vimeo.com&amp;loop=0&amp;fullscreen=1&amp;autoplay=$v_autoplay2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n break;\n\t\t\n\t\tcase MySpace:\n\t\t$value = \"http://mediaservices.myspace.com/services/media/embed.aspx/m=$v_id2,t=1,mt=video,ap=$v_autoplay2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n break;\n\t\t\n\t\tcase Veoh:\n\t\t$value = \"http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.20.1002&\";\n\t\t$value.= \"permalinkId=$v_id2&player=videodetailsembedded&id=anonymous&videoAutoPlay=$v_autoplay2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n break;\n\t\t\n\t case Blip:\n\t\t$value = \"http://blip.tv/play/$v_id2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n break;\n\t\t\n\t case WordPress:\n\t\t$value = \"http://v.wordpress.com/$v_id2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n break;\n\t\t\n\t\tcase Viddler:\n\t\t$value = \"http://www.viddler.com/player/$v_id2\";\n\t\tif($v_autoplay2=='1'){\n\t\t$flashvar = \"<param name=\\\"flashvars\\\" value=\\\"autoplay=t\\\" />\\n\";\n\t\t$flashvar2 = 'flashvars=\"autoplay=t\" ';\n\t\t}\n break;\n\t\t\n\t\tcase DailyMotion:\n\t\t$value = \"http://www.dailymotion.com/swf/$v_id2&autoStart=$v_autoplay2&related=0\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n break;\n\t\t\t\t\n\t\t\n\t\tcase Revver:\n\t\t$value = \"http://flash.revver.com/player/1.0/player.swf?mediaId=$v_id2&autoStart=$v_autoplay2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n\t\tbreak;\n\t\t\n\t\tcase Metacafe:\n\t\t$id = split('/',$v_id2);\n\t\t$value = \"http://www.metacafe.com/fplayer/$id[0]/$id[1].swf\";\n\t\tif($v_autoplay2=='1'){\n\t\t$flashvar = null;\n\t\t$flashvar2 = 'flashVars=\"playerVars=showStats=no|autoPlay=yes|\"';\n\t\t}\n\t\tbreak;\n\t\t\n\t\tcase Tudou:\n\t\t$value = \"$v_id2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n\t\tbreak;\n\t\t\n\t\tcase Youku:\n\t\t$value = \"$v_id2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n\t\tbreak;\n\t\t\n\t\tcase cn6:\n\t\t$value = \"$v_id2\";\n\t\t$flashvar = null;\n\t\t$flashvar2 = null;\n\t\tbreak;\n\t\t\n\t\tcase Google:\n\t\t$value = \"http://video.google.com/googleplayer.swf?docid=$v_id2&hl=en&fs=true\";\n\t\tif($v_autoplay2=='1'){\n\t\t$flashvar = null;\n\t\t$flashvar2 = 'FlashVars=\"autoPlay=true&playerMode=embedded\"';\n\t\t}\n\t\tbreak;\n\t\t\n\t\tcase Tangle:\n\t\t$value = \"http://www.tangle.com/flash/swf/flvplayer.swf\";\n\t\tif($v_autoplay2=='1'){\n\t\t$flashvar = null;\n\t\t$flashvar2 = \"FlashVars=\\\"viewkey=$v_id2&autoplay=$v_autoplay2\\\"\";\n\t\t}else{\n\t\t$flashvar = null;\n\t\t$flashvar2 = \"FlashVars=\\\"viewkey=$v_id2\\\"\";\n\t\t}\n\t\tbreak;\n\t\n\t\t}\n\t\t\n\t\tif($shortcode==\"true\"){\n\t\t//added in version 2.3\n\t\t//return instead of echo video on blog using shortcode\n\t\t$vsw_code = \"\\n<object width=\\\"$v_width2\\\" height=\\\"$v_height2\\\">\\n\";\n\t\t$vsw_code .= $flashvar;\n\t\t$vsw_code .= \"<param name=\\\"allowfullscreen\\\" value=\\\"true\\\" />\\n\";\n\t\t$vsw_code .= \"<param name=\\\"allowscriptaccess\\\" value=\\\"always\\\" />\\n\";\n\t\t$vsw_code .= \"<param name=\\\"movie\\\" value=\\\"$value\\\" />\\n\";\n\t\t$vsw_code .= \"<param name=\\\"wmode\\\" value=\\\"transparent\\\">\\n\";\n\t\t$vsw_code .= \"<embed src=\\\"$value\\\" type=\\\"application/x-shockwave-flash\\\" wmode=\\\"transparent\\\" \";\n\t\t$vsw_code .= \"allowfullscreen=\\\"true\\\" allowscriptaccess=\\\"always\\\" \";\n\t\t$vsw_code .= $flashvar2;\n\t\t$vsw_code .= \"width=\\\"$v_width2\\\" height=\\\"$v_height2\\\">\\n\";\n\t\t$vsw_code .= \"</embed>\\n\";\n\t\t$vsw_code .= \"</object>\\n\\n\";\n\t\treturn $vsw_code;\n\t\t}\n\t\telseif($admin==\"true\"){\n\t\t// echo video in admin\n echo \"\\n<object width=\\\"212\\\" height=\\\"172\\\">\\n\";\n\t\techo $flashvar;\n\t\techo \"<param name=\\\"allowfullscreen\\\" value=\\\"true\\\" />\\n\";\n\t\techo \"<param name=\\\"allowscriptaccess\\\" value=\\\"always\\\" />\\n\";\n\t\techo \"<param name=\\\"movie\\\" value=\\\"$value\\\" />\\n\";\n\t\techo \"<param name=\\\"wmode\\\" value=\\\"transparent\\\">\\n\";\n\t\techo \"<embed src=\\\"$value\\\" type=\\\"application/x-shockwave-flash\\\" wmode=\\\"transparent\\\" \";\n\t\techo \"allowfullscreen=\\\"true\\\" allowscriptaccess=\\\"always\\\" \";\n\t\techo $flashvar2;\n\t\techo \"width=\\\"212\\\" height=\\\"172\\\">\\n\";\n\t\techo \"</embed>\\n\";\n\t\techo \"</object>\\n\\n\";\n\n }else{\n\t\t\n\t\t// echo video on blog\n\t\techo \"\\n<div class=\\\"video-widget-wrap\\\">\\n\";\n\t\techo \"\\n<object width=\\\"$v_width2\\\" height=\\\"$v_height2\\\">\\n\";\n\t\techo $flashvar;\n\t\techo \"<param name=\\\"allowfullscreen\\\" value=\\\"true\\\" />\\n\";\n\t\techo \"<param name=\\\"allowscriptaccess\\\" value=\\\"always\\\" />\\n\";\n\t\techo \"<param name=\\\"movie\\\" value=\\\"$value\\\" />\\n\";\n\t\techo \"<param name=\\\"wmode\\\" value=\\\"transparent\\\">\\n\";\n\t\techo \"<embed src=\\\"$value\\\" type=\\\"application/x-shockwave-flash\\\" wmode=\\\"transparent\\\" \";\n\t\techo \"allowfullscreen=\\\"true\\\" allowscriptaccess=\\\"always\\\" \";\n\t\techo $flashvar2;\n\t\techo \"width=\\\"$v_width2\\\" height=\\\"$v_height2\\\">\\n\";\n\t\techo \"</embed>\\n\";\n\t\techo \"</object>\\n\\n\";\n\t\techo \"\\n</div>\\n\";\n\t\t}\n\n\n}", "function source_video($options)\n{\n\techo \"background: none; overflow: hidden;\";\n}", "public static function make($source)\n {\n return new self($source);\n }", "public function media($type = '', $src = '', $attributes = [])\n {\n if(!in_array($type, ['audio', 'video'])) {\n return '';\n }\n\n $html = '';\n $sources = '';\n\n if(is_string($src)) {\n $attributes['src'] = $src;\n } elseif(is_array($src)) {\n while(list($k, $source) = each($src)) {\n $sources .= $this->source($source);\n }\n } \n $html = '<'.$type.$this->attributes($attributes).'>'.$sources;\n $html .= 'Your browser does not support the '.$type.' element.</'.$type.'>';\n\n return $html; \n }", "final public static function video($name = null, $title = null)\n {\n return static::create($name, $title)->videoOnly();\n }", "protected function buildHtml4Instance(&$matches)\n {\n\t $filename \t= strip_tags($matches[2]);\n\n\t $width\t= $this->params->get( 'width' );\n\t $height\t= $this->params->get( 'height' );\n\t $center\t= $this->params->get( 'center' );\n\t $mp4fallback = $this->params->get('mp4fallback');\n\n\t\t\n\t $video = '<video id=\"video' . rand(0, 100) . '\" class=\"video-js vjs-default-skin\" controls preload=\"auto\" width=\"320\" height=\"240\" data-setup=\\'{\"techOrder\":[\"Hlsjs\", \"html5\"]}\\' >' .\n\t '<source src=\"' . $filename . '\" type=\"application/vnd.apple.mpegurl\">';\n\t \n\t if($mp4fallback) {\n\t $parts = explode('/', $filename);\n\t array_pop($parts);\n\t $mp4_filename = implode('/', $parts);\n\t $mp4_filename = str_replace(\"movie\",\"mp4\", $mp4_filename);\n\t $video = $video . \n\t '<source src=\"' . $mp4_filename . '\" type=\"video/mp4\">';\n\t }\n\t \n\t $video = $video . '</video>';\n \n\t return $video;\n }" ]
[ "0.684409", "0.66508085", "0.5901045", "0.58605695", "0.5853712", "0.5697264", "0.5601095", "0.5535683", "0.5457275", "0.54291", "0.5369135", "0.5329163", "0.5310026", "0.52950627", "0.5277424", "0.51966053", "0.517326", "0.51434726", "0.5136081", "0.51257944", "0.50535595", "0.5046464", "0.50081307", "0.4989989", "0.4982752", "0.49571764", "0.4921669", "0.487792", "0.48542708", "0.48452204" ]
0.8204523
0
Normaliza um array para usar em um foreach, se for simles, coloca um [0]
public static function arrayNormalize(&$array){ if(is_array($array)){ if(!array_key_exists(0, $array)){ $array = array(0=>$array); return $array; } else{ return $array; } } else{ return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function _normalizeArray($value);", "abstract protected function _normalizeArray($value);", "abstract protected function _normalizeArray($value);", "function transponse($array){\r\n array_unshift($array, null);\r\n return call_user_func_array('array_map', $array);\r\n}", "public function getOnlyListingId($Multiarray)\n{\n $final = array();\n\n foreach ($Multiarray as $array) {\n # code...\n foreach ($array as $arr) {\n # code...\n array_push($final, $arr[0]);\n }\n\n }\n return $final;\n}", "public static function flat($data){\n\t\t$result = NULL;\n\t\tif(count($data) == 0){\n\t\t\treturn $data;\n\t\t}\n\t\telse if(count($data) == 1){\n\t\t\treturn $data[0];\n\t\t}\n\t\telse{\n\t\t\t$result = [];\n\t\t\tfor($i = 0; $i < count($data); $i++){\n\t\t\t\t$result = array_merge($result, $data[$i]);\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}", "public function callNormalizeArray(array $array): array\n {\n return $this->normalizeArray($array);\n }", "function array_undot(array $array): array\n{\n $result = [];\n\n foreach ($array as $key => $value) {\n Arr::set($result, $key, $value);\n }\n\n return $result;\n}", "function arrTopretty(array $array) : array{\n $result = array();\n foreach($array[0] as $val){\n $result[] .= $val;\n }\n return $result;\n}", "function __flatten($array) {\n\t\t$data = array();\n\t\tforeach ($array as $a) {\n\t\t\tif (is_array($a)) {\n\t\t\t\t$data = am($data, $this->__flatten($a));\n\t\t\t} else {\n\t\t\t\t$data = array_values($array);\n\t\t\t}\n\t\t}\n\t\treturn $data;\n\t}", "function flatten_array( &$item ) {\n\t// Basically, it matches up the numeric array keys to the blog ids\n\n\t$item = $item[0];\n\n}", "function multi_to_single($array){\r\n\tforeach($array as $key){\r\n\t\tif(is_array($key)){\r\n\t\t\t$array1 = multi_to_single($key);\r\n\t\t\tforeach($array1 as $k){\r\n\t\t\t\t$new_array[]=$k;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse{\r\n\t\t\t$new_array[]=$key;\r\n\t\t}\r\n\t}\r\n\treturn $new_array;\r\n}", "function kore_array_override($arr) {\r\n $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr));\r\n $result = iterator_to_array($it);\r\n\r\n return $result;\r\n}", "private function normalize($array, $first=null){\n $result = array();\n // print_r($array);\n if(is_array($array)){\n foreach($array as $object=>$value){\n if($first == null){\n $first = $value;\n if($first == 0){\n $first=1;\n }\n }\n $newval = $value / $first;\n if($newval <= 0){\n $newval = 0;\n }\n $result[$object] = $newval;\n }\n }\n \n return $result;\n }", "abstract public function convertArray();", "function array_reset_index($array)\n {\n $array = $array instanceof Collection\n ? $array->toArray()\n : $array;\n\n foreach ($array as $key => $val) {\n if (is_array($val)) {\n $array[$key] = array_reset_index($val);\n }\n }\n\n if (isset($key) && is_numeric($key)) {\n return array_values($array);\n }\n\n return $array;\n }", "function array_unshape($convertables = null) {\n if (!$convertables instanceOf ArrayAccess && !is_array($convertables)) {\n return $convertables;\n }\n \n if ($convertables instanceOf ArrayAccess) {\n $convertables = $convertables->toArray();\n }\n\n foreach ($convertables as $key => $value) {\n $dto[$key] = array_unshape($value);\n }\n return $dto ?? [];\n }", "public function data_first() {\n\t\t\t$data = array(\n\t\t\t\tarray(array(array(1)), array(1)),\n\t\t\t\tarray(array(array(1, 2)), array(1)),\n\t\t\t\tarray(array(array(1, 2, 3)), array(1)),\n\t\t\t);\n\t\t\treturn $data;\n\t\t}", "function array_flatten($array)\r\n{\r\n\twhile (is_array($array) && (count($array) > 0)) {\r\n\t//($v = array_shift($array)) !== null) {\r\n\t\t$v = array_shift($array);\r\n\t\tif (is_array($v)) {\r\n\t\t\t$array = array_merge($v, $array);\r\n\t\t} else {\r\n\t\t\t$tmp[] = $v;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn $tmp;\r\n}", "function ArrayNormalize($array) {\n $result = [];\n foreach ($array as $key => $items) {\n foreach ($items as $arr => $value) {\n $result[$value] = $key;\n }\n }\n return $result;\n}", "public static function normalize($array)\n {\n // $array = static::transformEntriesToTrue($array);\n $array = static::dot($array);\n $array = static::collect($array);\n\n return $array;\n }", "abstract protected function _toArray();", "function convertMultiToSingle($multiArray, &$singleArray, $path='')\r\n{\r\n foreach ($multiArray as $key => $value)\r\n {\r\n //if the value is not another array\r\n if (!is_array($value))\r\n {\r\n //add it to the single dimensional array\r\n $singleArray[] = $path . '/' . $key . '/' . $value . '<br/>';\r\n }\r\n else convertMultiToSingle($value, $singleArray, $path . '/' . $key);\r\n }\r\n}", "function temp_array ($array){\n $array_of_addresses_raw = array_filter($array, !empty($array));\n }", "function darVuelta(&$array){\r\n $aux=array();\r\n for($i=0, $j=count($array)-1; $i<count($array); $i++, $j--){\r\n $aux[$j]=$array[$i];\r\n }\r\n for($k=0;$k<count($array);$k++){\r\n $array[$k]=$aux[$k];\r\n }\r\n unset($aux);\r\n }", "function acfe_unarray($val){\n \n if(is_array($val)){\n return reset($val);\n }\n \n return $val;\n}", "function reset (array &$array) {}", "function farray( $array )\n{\n\treturn riake( 0 , $array , false );\n}", "private function _updateArrays()\r\n\t\t{\r\n\t\t\t\t$intend = array(\"code\" => $this->_code);\r\n\t\t\t\t$groupingList = School::classCache()->getGroupingList();\r\n\t\t\t\t$this->_info = getFromArray($groupingList, $intend);\r\n\t\t\t\t$this->_info = $this->_info[0];\r\n\t\t}", "public function getFlat(){\n\t\treturn Tools::arrayFlatten($this->get());\n\t}" ]
[ "0.6240032", "0.6240032", "0.6240032", "0.602253", "0.59401655", "0.5938812", "0.5862113", "0.5826389", "0.58051056", "0.57958794", "0.57944876", "0.5787957", "0.57873046", "0.57689047", "0.57467777", "0.5746489", "0.5714788", "0.56904215", "0.5674459", "0.5638027", "0.56376475", "0.5589317", "0.5542748", "0.5538996", "0.5531186", "0.55192834", "0.55126804", "0.5502874", "0.5499156", "0.54777193" ]
0.63841593
0
Expected submit_label, reset_label, value for reset_label optional
public function testFailsValidationMissingParamSubmitLabel() { $result = $this->tool->validateAuto( array( 'reset_label' => 'label' ), $this->site_id, $this->form_id ); $this->assertFalse($result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testFailsValidationMissingParamResetLabel()\n {\n $result = $this->tool->validateAuto(\n array(\n 'submit_label' => 'label'\n ),\n $this->site_id,\n $this->form_id\n );\n\n $this->assertFalse($result);\n }", "public function testPassesValidationResetLabelEmpty()\n {\n $result = $this->tool->validateAuto(\n array(\n 'submit_label' => 'Label 1',\n 'reset_label' => null\n ),\n $this->site_id,\n $this->form_id\n );\n\n $this->assertTrue($result);\n }", "public function testFailsValidationSubmitLabelEmpty()\n {\n $result = $this->tool->validateAuto(\n array(\n 'submit_label' => '',\n 'reset_label' => 'label'\n ),\n $this->site_id,\n $this->form_id\n );\n\n $this->assertFalse($result);\n }", "public function testFailsValidationSubmitLabelNull()\n {\n $result = $this->tool->validateAuto(\n array(\n 'submit_label' => null,\n 'reset_label' => ''\n ),\n $this->site_id,\n $this->form_id\n );\n\n $this->assertFalse($result);\n }", "function getForm_label_submit(){\n\t\treturn $this->getValueforCommonKey(PayItEasy_Payment_Helper_PayItEasyCore::FORM_LABEL_SUBMIT);\n\t}", "function setSubmitLabel($value)\n {\n $this->submit_label = $value;\n }", "public function testFailsValidationSubmitLabelObject()\n {\n try {\n $this->tool->validateAuto(\n array(\n 'submit_label' => new stdClass(),\n 'reset_label' => null\n ),\n $this->site_id,\n $this->form_id\n );\n $this->assertTrue(false); // Fail\n } catch (\\Exception $e) {\n $this->assertFalse(false);\n }\n }", "private function setFormLabel()\n\t{\n\t\treturn isset($this->field['form_label']) ? $this->field['form_label'] : $this->field['label'];\n\t}", "public function testFailsValidationSubmitLabelArray()\n {\n try {\n $this->tool->validateAuto(\n array(\n 'submit_label' => array(),\n 'reset_label' => null\n ),\n $this->site_id,\n $this->form_id\n );\n $this->assertTrue(false); // Fail\n } catch (\\Exception $e) {\n $this->assertFalse(false);\n }\n }", "private function setLabel()\n\t{\n\t\treturn isset($this->field['label']) ? $this->field['label'] : 'no label';\n\t}", "public function getSubmitLabel(): string\r\n {\r\n return 'find palindromes';\r\n }", "public function submit (string $label, ?string $class = null);", "public function testPassesValidationSubmitLabelInteger()\n {\n $result = $this->tool->validateAuto(\n array(\n 'submit_label' => 31415,\n 'reset_label' => null\n ),\n $this->site_id,\n $this->form_id\n );\n\n $this->assertTrue($result);\n }", "protected function getSubmitButtonLabel()\n {\n return $this->isRegisterMode() ? 'Create account' : 'Update';\n }", "protected function default_submit()\n\t{\n\t\treturn array(\n\t\t\t'type' => 'string',\n\t\t\t'add_default_validators' => false,\n\t\t\t'render_as' => 'submit',\n\t\t);\n\t}", "public function testPassesValidationParamsSet()\n {\n $result = $this->tool->validateAuto(\n array(\n 'submit_label' => 'Label 1',\n 'reset_label' => 'Label 2'\n ),\n $this->site_id,\n $this->form_id\n );\n\n $this->assertTrue($result);\n }", "public function testSetLabelNull()\n {\n $this->personResearchGroup->setLabel(null);\n $this->assertNull(\n $this->personResearchGroup->getLabel()\n );\n }", "private function setAttributeDefaults() {\n if ($this->data['attrs']['label_input'] === '{default_label}') {\n $this->data['attrs']['label_input'] = $this->fieldMetaData->label !== 'NamedIDLabel' ? $this->fieldMetaData->label : $this->fieldName;\n }\n if ($this->data['attrs']['hint'] && $this->data['attrs']['hide_hint']) {\n $this->data['attrs']['hint'] = '';\n }\n }", "public function setLabel( $label );", "public function testFormReset()\n\t{\n\t\t$form1 = Form::reset('foo');\n\t\t$form2 = Form::reset('foo', array('class' => 'span2'));\n\n\t\t$this->assertEquals('<input type=\"reset\" value=\"foo\">', $form1);\n\t\t$this->assertEquals('<input class=\"span2\" type=\"reset\" value=\"foo\">', $form2);\n\t}", "function getForm_label_cancel(){\n\t\treturn $this->getValueforCommonKey(PayItEasy_Payment_Helper_PayItEasyCore::FORM_LABEL_CANCEL);\n\t}", "protected function getSubmitButtonLabel() {\n\t\treturn $GLOBALS['LANG']->getLL('confirmMailForm_sendButton');\n\t}", "public function get_submit() {\n\t\t?>\n\t\t<p class=\"submit\">\n\t\t\t<input type=\"submit\" name=\"submit\" id=\"submit\" class=\"button button-primary\"\n\t\t\t value=\"<?php echo __( 'Save Changes', 'amphtml' ); ?>\">\n\t\t\t<?php if ( 'colors' == $this->get_current_section() ): ?>\n\t\t\t\t<input type=\"submit\" name=\"reset\" id=\"reset\" class=\"button\"\n\t\t\t\t value=\"<?php echo __( 'Default theme settings', 'amphtml' ); ?>\" style=\"margin-left: 10px;\">\n\t\t\t<?php endif; ?>\n\t\t</p>\n\t\t<?php\n\t}", "public function testFormLabel()\n\t{\n\t\t$form1 = Form::label('foo', 'Foobar');\n\t\t$form2 = Form::label('foo', 'Foobar', array('class' => 'control-label'));\n\n\t\t$this->assertEquals('<label for=\"foo\">Foobar</label>', $form1);\n\t\t$this->assertEquals('<label for=\"foo\" class=\"control-label\">Foobar</label>', $form2);\n\t}", "public function label($new_value = null)\n {\n }", "public function get_labelChoice() {\n \n return $this->labelChoice;\n \n }", "public function set_default_values() {\n\t\t\t$label_string = 'By submitting this form, I agree to the <a href=\"#terms-modal\" class=\"modal-launch\" title=\"Terms &amp; Conditions\">terms &amp; conditions.</a>';\n\t\t\t?>\n\t\t\tcase 'gdpr':\n\t\t\t\tfield.label = <?php echo wp_json_encode( esc_html( 'GDPR Checkbox' ) ); ?>;\n\t\t\t\tfield.inputs = [\n\t\t\t\t\tnew Input( field.id + '.1', <?php echo wp_json_encode( esc_html( 'GDPR Checkbox' ) ); ?> ),\n\t\t\t\t\tnew Input( field.id + '.2', <?php echo wp_json_encode( esc_html( 'Text' ) ); ?> ),\n\t\t\t\t\tnew Input( field.id + '.3', <?php echo wp_json_encode( esc_html( 'Description' ) ); ?> )\n\t\t\t\t];\n\t\t\t\t// Hide the description from select columns.\n\t\t\t\tfield.inputs[1].isHidden = true;\n\t\t\t\tfield.inputs[2].isHidden = true;\n\t\t\t\tfield.checkboxLabel = <?php echo wp_json_encode( wp_kses_post( $label_string ) ); ?>;\n\t\t\t\tfield.descriptionPlaceholder = <?php echo wp_json_encode( esc_html( 'Enter consent agreement text here. The Consent Field will store this agreement text with the form entry in order to track what the user has consented to.' ) ); ?>;\n\t\t\t\tif ( ! field.inputType )\n\t\t\t\t\tfield.inputType = 'gdpr';\n\t\t\t\t// Add choices so we have a dropdown in the conditional logic.\n\t\t\t\tif ( ! field.choices )\n\t\t\t\t\tfield.choices = new Array(new Choice(<?php echo wp_json_encode( esc_html__( 'Checked', 'gravityforms' ) ); ?>, '1'));\n\t\t\t\tbreak;\n\t\t\t<?php\n\t\t}", "function input_submit($element_name, $label) {\r\n print '<input type=\"submit\" name=\"' . $element_name .'\"id=\"'.$element_name.'\" value=\"';\r\n print htmlentities($label, ENT_NOQUOTES, 'UTF-8') .'\"/>';\r\n}", "public function reset (string $label, ?string $class = null);", "function input_submit($element_name, $label) {\r\n print '<input type=\"submit\" name=\"' . $element_name .'\"id=\"'.$element_name.'\" value=\"';\r\n print htmlentities($label) .'\"/>';\r\n}" ]
[ "0.76306605", "0.7292906", "0.7060995", "0.7005006", "0.6820847", "0.6720895", "0.65915596", "0.64536464", "0.6391183", "0.6290392", "0.6290219", "0.61849946", "0.6183001", "0.60959446", "0.5883988", "0.58292973", "0.577882", "0.5776556", "0.57612", "0.5752291", "0.5731112", "0.57144535", "0.5697527", "0.5660713", "0.5660703", "0.56088424", "0.56070256", "0.55999887", "0.55846375", "0.5581375" ]
0.7458605
1
Get pilots through starship passenger number
public function get_pilots(Request $request) { $pilots = []; $starships = []; $passengers_no = $request->passengers; $option = $request->opt; $sort = $request->sort; $starships_to_examine = $this->get_all_starships(); switch ($option){ case 1: foreach ($starships_to_examine as $starship) { //go through every starship if ((int)$starship->passengers > $passengers_no) { //compare foreach ($starship->pilots as $pilot) { if (in_array($pilot, $pilots)) { break; } else { array_push($pilots, $this->get_data_via_url($pilot)->original->name); } } array_push($starships, [ "name" => $starship->name, "passengers" => $starship->passengers, "pilots" => $pilots ]); $pilots = []; } } break; case 2: foreach ($starships_to_examine as $starship) { //go through every starship if ((int)$starship->passengers < $passengers_no) { //compare current starship number of passengers with value foreach ($starship->pilots as $pilot) { if (in_array($pilot, $pilots)) { break; } else { array_push($pilots, $this->get_data_via_url($pilot)->original->name); } } array_push($starships, [ "name" => $starship->name, "passengers" => $starship->passengers, "pilots" => $pilots ]); $pilots = []; } } break; case 3: foreach ($starships_to_examine as $starship) { //odam niz sekoj starship if ((int)$starship->passengers == $passengers_no) { //sporedi current starship number of passengers so value foreach ($starship->pilots as $pilot) { if (in_array($pilot, $pilots)) { break; } else { array_push($pilots, $this->get_data_via_url($pilot)->original->name); } } array_push($starships, [ "name" => $starship->name, "passengers" => $starship->passengers, "pilots" => $pilots ]); $pilots = []; } } break; } //sort switch ($sort) { case "passengers": for ($i = 0; $i < sizeof($starships) - 1; $i++) { for ($j = $i + 1; $j < sizeof($starships); $j++) { if ($starships[$i]['passengers'] > $starships[$j]['passengers']) { $temp = $starships[$i]; $starships[$i] = $starships[$j]; $starships[$j] = $temp; } } } break; default: for ($i = 0; $i < sizeof($starships) - 1; $i++) for ($j = $i + 1; $j < sizeof($starships); $j++) { if ($starships[$i]['name'] > $starships[$j]['name']) { $temp = $starships[$i]; $starships[$i] = $starships[$j]; $starships[$j] = $temp; } } break; } return response()->json($starships); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_player_ships() {\n return $this->game_data['player'];\n }", "public function get_all_starships()\n {\n $headers['Accept'] = 'application/json';\n $headers['Content-Type'] = 'application/json';\n\n $page = 1;\n $starships_list = [];\n $client = new Client();\n get_starships:\n $requestGuzzle = new \\GuzzleHttp\\Psr7\\Request('get', $this->url . 'starships?page=' . $page);\n $response = $client->send($requestGuzzle, [\"headers\" => $headers]);\n $body = json_decode($response->getBody()->getContents());\n array_push($starships_list, ...$body->results);\n\n if ($body->next) {\n $page++;\n goto get_starships;\n }\n\n return $starships_list;\n }", "public function getAllShips() {\n\t\t$act = \"get_all_ships\";\n\n\t\treturn $this->dbSelect(\n\t\t\t$act,\n\t\t\t'id, name, serial_number, image_url',\n\t\t\t'ships'\n\t\t);\n\t}", "public function getAllPornstars();", "public function getCurrentPlayerShips(Game $game): array\n {\n return $this->getPlayerShips($game, $game->getCurrentPlayer());\n }", "public function getPilotId()\n {\n return $this->pilot_id;\n }", "protected function find_perks() {\n\t\t$pods = pods( 'partner', array(\n\t\t\t\t'limit' => -1,\n\t\t\t\t'cache_mode' => 'cache',\n\t\t\t\t'expires' => HOUR_IN_SECONDS\n\t\t\t)\n\t\t);\n\n\t\t$perks = array();\n\n\t\tif ( is_object( $pods ) && 0 < $pods->total() ) {\n\t\t\twhile( $pods->fetch() ) {\n\t\t\t\t$name = $pods->display( 'post_title' );\n\t\t\t\t$perk = $pods->display( 'perk' );\n\t\t\t\t$label = sprintf( '%1s : %2s', $name, $perk );\n\n\t\t\t\t$gold_perk = $pods->display( 'gold_bonus' );\n\n\t\t\t\tif ( ! empty( $perk ) ) {\n\t\t\t\t\t$perks[] = array(\n\t\t\t\t\t\t'value' => sanitize_title_with_dashes( $name ),\n\t\t\t\t\t\t'label' => esc_html( $label )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( 'fop_gold' === $this->level && ! empty( $gold_perk ) ) {\n\t\t\t\t\t$label = sprintf( 'GOLD LEVEL PERK! %1s : %2s', $name, $perk );\n\t\t\t\t\t$perks[] = array(\n\t\t\t\t\t\t'value' => sanitize_title_with_dashes( $name ),\n\t\t\t\t\t\t'label' => esc_html( $label )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn $perks;\n\n\t}", "public function getPlayerShips(Game $game, Player $player): array\n {\n return $this->findBy(['game' => $game, 'player' => $player]); \n }", "public function get_prayer_requests()\n {\n // Returns a list of all people and their payer requests\n $stmt = $this -> connection -> prepare(\"SELECT first_name, last_name, prayer_request FROM members\");\n $stmt -> execute();\n return $stmt -> fetchAll();\n }", "public function getPilots($limit = 0) {\n $planet_data = [];\n $pids = [];\n $collection_v = $this->collection('vehicles');\n $collection_p = $this->collection('planets');\n $collection_sp = $this->collection('species');\n $vehicles = $collection_v->find(['pilots' => ['$not' => ['$size' => 0]]])->toArray();\n\n foreach ($vehicles as $vehicle) {\n $pids = array_merge($pids, (array) $vehicle['pilots']);\n }\n\n $planets = $collection_p->aggregate([\n [\n '$lookup' => [\n 'from' => 'people',\n 'localField' => 'id',\n 'foreignField' => 'homeworld',\n 'as' => 'pilots',\n ]\n ],\n [\n '$match' => [\n 'pilots.id' => ['$in' => array_values(array_unique($pids))]\n ]\n ],\n [\n '$lookup' => [\n 'from' => 'species',\n 'localField' => 'id',\n 'foreignField' => 'homeworld',\n 'as' => 'species',\n ]\n ],\n ])->toArray();\n\n foreach ($planets as $planet) {\n $id = $planet['id'];\n $planet_data[$id] = [\n 'name' => $planet['name'],\n 'count' => count($planet['pilots']),\n 'pilots' => [],\n ];\n foreach ($planet['pilots'] as $pilot) {\n // Noticed some inconsistency in DB. Some people doesn't have relation to species.\n // Tried to use relationship like people -> planet -> species, but same result.\n $species = $collection_sp->aggregate([\n ['$unwind' => '$people'],\n ['$match' => ['people' => $pilot['id']]]\n ])->toArray();\n\n $planet_data[$id]['pilots'][] = [\n 'name' => $pilot['name'],\n 'species' => $species[0]['name']\n ];\n }\n }\n\n return $this->limit($planet_data, $limit);\n }", "function getWinners() {\n global $players, $winners;\n \n $winnersPoints = getWinnersPoint();\n for ($i = 0; $i < 4; $i++) {\n if ($players[$i] == $winnersPoints) {\n array_push($winners, $i + 1);\n }\n }\n }", "function getStarships($page,$search){\n $return=array();\n $returnresult=array();\n $offset=0;\n if($search!=null){\n $searchQuery='WHERE (StarshipName LIKE \"%'.$search.'%\" or StarshipModel LIKE \"%'.$search.'%\")';\n $urlQuery='&search='.$search;\n }else{\n $searchQuery='';\n $urlQuery='';\n } \n if (is_numeric($page)){\n $offset=getOffset($page);\n $results=loadQueryArray('SELECT StarshipID FROM Starships '.$searchQuery.' ORDER BY StarshipID ASC LIMIT 10 OFFSET '.$offset);\n if($results!=null){\n foreach($results as $result){\n $returnresult[] = searchStarshipByID($result['StarshipID'],false);\n }\n }else{\n $return['detail']=MSG_NOT_FOUND;\n return(json_encode($return));\n }\n }else{\n $return['detail']=MSG_NOT_FOUND;\n return(json_encode($return));\n }\n $return['count']=loadQueryArray('SELECT COUNT(*) as StarshipsCount FROM Starships '.$searchQuery)[0]['StarshipsCount'];\n if($offset+10<$return['count']){\n $return['next']=LOCAL_URL.'/starships/?page='.($page+1).$urlQuery;\n }else{\n $return['next']=null;\n }\n if($page-1>0){\n $return['previous']=LOCAL_URL.'/starships/?page='.($page-1).$urlQuery;\n }else{\n $return['previous']=null;\n }\n $return['results']=$returnresult;\n return(json_encode($return));\n}", "public function getPairings() {\n $sql = \"SELECT\tevents_paarungen.*\n FROM events_paarungen\n\t\t\t\tWHERE event_ID=\".$this->eventID.\"\n AND gameday = \".$this->gameday;\n if($this->event['art'] == 2) {\n $sql .= \" ORDER BY events_paarungen.event_group ASC, events_paarungen.gamenumber ASC\";\n }\n $result = WCF::getDB()->sendQuery($sql);\n while ($row = WCF::getDB()->fetchArray($result)) {\n $row['username_1'] = self::getUserOnlineMarking($row['userID1']);\n $row['username_2'] = self::getUserOnlineMarking($row['userID2']);\n\n if($this->event['art'] == 2) {\n $sql2 = \"SELECT id, teamname\n FROM events_team\n WHERE id=\".$row['teamID1'].\" OR id=\".$row['teamID2'];\n $result2 = WCF::getDB()->sendQuery($sql2);\n while ($row2 = WCF::getDB()->fetchArray($result2)) {\n if ($row2['id'] == $row['teamID1']) {\n $row['teamname1'] = $row2['teamname'];\n }\n elseif ($row2['id'] == $row['teamID2']) {\n $row['teamname2'] = $row2['teamname'];\n }\n }\n if(!isset($row['teamname1'])) $row['teamname1'] = 'Freilos';\n if(!isset($row['teamname2'])) $row['teamname2'] = 'Freilos';\n\n if(!isset($row['matches_1'])) {\n $row['matches_1'] = 0;\n }\n\t\t\t\tif(!isset($row['matches_2'])) {\n\t\t\t\t $row['matches_2'] = 0;\n }\n\n \t\t\tif($row['scoreID_1'] > $row['scoreID_2']) {\n $row['matches_1'] += 1;\n $row['matches_2'] += 0;\n }\n elseif($row['scoreID_1'] < $row['scoreID_2']) {\n $row['matches_1'] += 0;\n $row['matches_2'] += 1;\n }\n else {\n $row['matches_1'] += 0;\n $row['matches_2'] += 0;\n \t\t\t}\n }\n $this->pairings[] = $row;\n }\n\n if($this->event['art'] == 2) {\n $this->removeDoubles();\n }\n }", "public function get_slots()\n {\n return $this->db->select('a.*, b.room_no AS cinema, c.title')\n ->order_by('c.title')\n ->join('tbl_room b', 'a.room_id = b.id', 'left')\n ->join('tbl_movies c', 'a.movie_id = c.id', 'left')\n ->get('tbl_showing a')\n ->result_array();\n }", "public function get_ships()\n\t{\n\t\t// Within the same php script, ships will only change if\n\t\t// the script itself changes them, so only let this object\n\t\t// retrieve its ships once.\n\t\t\n\t\tif ( is_array($this->ships) )\n\t\t{\n\t\t\t// The ships have already been retrieved or set manually.\n\t\t}\n\t\telse\n\t\t{\n\t\t\tload_class('Fleet_Ship');\n\t\t\t$this->ships = Fleet_Ship::get_ships_in_fleet($this->id);\n\t\t\treturn $this->ships;\n\t\t}\n\t}", "public function fetchAllShipsData();", "public function getPLmatches()\n\t{\n\t\t// Recupera as página com as tabelas\n\t\t$pageContents = $this->getPageContents('https://www.gazetaesportiva.com/campeonatos/paulista/');\n\n\t\t// Inicia um documento DOM\n\t\t$doc = new DOMDocument();\n\t\t$doc->loadHTML($pageContents);\n\n\t\t// Pega o conteudo HTML do documento\n\t\t$xpath = new DOMXPath($doc);\n\n\t\t// Guarda o código fonte das rodadas\n\t\t$rounds = array();\n\n\t\t// Guarda os dados das partidas\n\t\t$matches = array();\n\n\t\t// Loop for (1 a 12)\n\t\tfor ($a=1; $a <= 12; $a++) {\n\t\t\t// Separa as rodadas\n\t\t\t$rounds[$a] = $xpath->query(\"//div[contains(@class,'rodadas_grupo__numero_rodada_{$a}')]\");\n\t\t}\n\n\t\t// Loop for (1 a 12)\n\t\tfor ($c=1; $c <= 12; $c++) {\n\t\t\t// Loop for (0 a 8)\n\t\t\tfor ($i=0; $i < 8; $i++) {\n\t\t\t\t// Pega a data e o lugar da partida\n\t\t\t\t$matchDatePlace = $rounds[$c]->item(0);\n\t\t\t\t$matchDatePlace = $matchDatePlace->getElementsByTagName('li')->item($i);\n\t\t\t\t$matchDatePlace = $matchDatePlace->getElementsByTagName('span')->item(0)->nodeValue;\n\n\t\t\t\t// Separa a data do local\n\t\t\t\t$matchDatePlace = explode(\"•\", $matchDatePlace);\n\t\t\t\t$matchDate = $matchDatePlace[0];\n\t\t\t\t$matchPlace = $matchDatePlace[1];\n\n\t\t\t\t// Pega o nome do primeiro time\n\t\t\t\t$teams[0]['name'] = $rounds[$c]->item(0)->getElementsByTagName('li')->item($i)->getElementsByTagName('span')->item(3)->nodeValue;\n\n\t\t\t\t// Pega o placar do primeiro time\n\t\t\t\t$teams[0]['score'] = $rounds[$c]->item(0);\n\t\t\t\t$teams[0]['score'] = $teams[0]['score']->getElementsByTagName('li')->item($i);\n\t\t\t\t$teams[0]['score'] = $teams[0]['score']->getElementsByTagName('span')->item(5)->nodeValue;\n\n\t\t\t\t// Pega o nome do segundo time\n\t\t\t\t$teams[1]['name'] = $rounds[$c]->item(0);\n\t\t\t\t$teams[1]['name'] = $teams[1]['name']->getElementsByTagName('li')->item($i);\n\t\t\t\t$teams[1]['name'] = $teams[1]['name']->getElementsByTagName('span')->item(7);\n\t\t\t\t$teams[1]['name'] = $teams[1]['name']->getElementsByTagName('a')->item(2)->nodeValue;\n\t\t\t\t\n\t\t\t\t// Pega o placar do segundo time\n\t\t\t\t$teams[1]['score'] = $rounds[$c]->item(0);\n\t\t\t\t$teams[1]['score'] = $teams[1]['score']->getElementsByTagName('li')->item($i);\n\t\t\t\t$teams[1]['score'] = $teams[1]['score']->getElementsByTagName('span')->item(6)->nodeValue;\n\n\t\t\t\t// Adiciona a partida ao array de dados\n\t\t\t\t$matches[$c][$i] = array(\n\t\t\t\t\tstr_replace(\"\\n\", '', $teams[0]['name']) => str_replace(\"\\n\", '',$teams[0]['score']),\n\t\t\t\t\tstr_replace(\"\\n\", '', $teams[1]['name']) => str_replace(\"\\n\", '',$teams[1]['score']),\n\t\t\t\t\t'date' => str_replace(\"\\n\", '',$matchDate),\n\t\t\t\t\t'place' => substr(str_replace(\"\\n\", '', $matchPlace), 1)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Retorna o array com as partidas\n\t\treturn $matches;\n\t}", "public function all(int $pageNumber = 1){\n $statusCode = '200';\n $starships = [];\n while($statusCode == 200){\n $response = $this->client->get('starships/?page='.$pageNumber);\n $statusCode = $response->getStatusCode();\n $body = $response->getBody();\n $results = json_decode($body);\n if(isset($results->results)){\n $starships = array_merge($starships , $results->results);\n }\n $pageNumber++;\n }\n return $starships;\n }", "public function getFreeSpots() {\n\t\t$jsonResponse = array();\n\t\tif ( isset($_POST['lat']) && isset($_POST['lng']) ) {\n\t\t\t$result = $this->model->getFreeSpotsFromDB($_POST['lat'], $_POST['lng']);\n\t\t\tforeach ($result as $row) {\n\t\t\t\t$row['level'] = Session::getUserLevel();\n\t\t\t\t$jsonResponse[$row['fs_metaInfo']][] = $row;\n\t\t\t}\n\t\t\techo json_encode($jsonResponse);\n\t\t}else {\n\t\t\tself::sendAPIerror(406, 'Incorrect parameters. You must supply latitude and longtitude from which you want to take the spots');\n\t\t}\n\t}", "public function availableTrips()\n {\n \treturn view('trips.availableTrips');\n }", "public function assignedPassengers(){\n\t\treturn $this->hasManyThrough(Passenger::class, Driver::class);\n\t}", "public function getSlotAndSpot(): Collection\n {\n $projects = Project::all();\n foreach ($projects as $project) {\n $workers = $project->workers;\n\n if (count($workers) > 0) {\n $allProjects = [\n 'project' => $project->name,\n 'room' => $project->room,\n 'position' => 0,\n 'workers' => $workers->pluck('name')->toArray(),\n 'conflict' => []\n ];\n $this->allProjects[] = $allProjects;\n }\n \n }\n $this->findConflicts($this->allProjects);\n $this->findSlot($this->allProjects);\n return Collection::make($this->sortedProjects)->sortBy('position');\n }", "function PlanEddingtonNumber($rides, $planEDN)\n{\n usort($rides, array(\"Activity\", \"CompareDistances\"));\n \n $missingRides = $planEDN; //max pokud nemam jeste nic \n $pocetJizd = sizeof ($rides); \n //echo \"pocet jizd = \" . $pocetJizd . \"<br>\";\n \n \n //hledam pocet jizd pro planovane EDN\n for ($i = 0; $i< $pocetJizd; $i++)\n { \n $stejnychAdelsich = $pocetJizd - $i; \n \n // echo \"ride# \" . ($i+1) . \" (\". $stejnychAdelsich . \") \" . $rides[$i]->distance . \" km/miles (plan=\".$planEDN.\")<br>\";\n //hledam prvni jizdu, ktera je stejna nebo delsi nez plan\n if ($rides[$i]->distance >= $planEDN) \n {\n //muzu tu byt jen jednou! \n $missingRides = $planEDN - $stejnychAdelsich ;\n // echo \"I AM IN <br>\";\n // echo \"missing rides =\".$missingRides.\" (\" . $planEDN . \"-\" . $stejnychAdelsich .\") <br>\";\n break;\n }\n }\n \n //dulezite kdyz pouziji mensi/stejny plan nez edn\n if ($missingRides < 0)\n $missingRides = 0;\n \n return $missingRides;\n }", "function pull_sports() {\n global $CFG, $USER;\n $context = get_context_instance(CONTEXT_SYSTEM);\n\n if (has_capability('block/student_gradeviewer:sportsadmin', $context)) {\n $sports = get_records('block_courseprefs_sports');\n } else {\n $sql = \"SELECT spo.* FROM {$CFG->prefix}block_courseprefs_sports spo,\n {$CFG->prefix}block_student_sports spm\n WHERE spm.usersid = {$USER->id}\n AND spm.path = spo.id\";\n $sports = get_records_sql($sql);\n }\n\n if(!$sports) {\n $sports = array();\n }\n\n return array_map('flatten_sport', $sports);\n}", "public function getSlotsByType();", "public function getParkingGarages(){\n global $con;\n $statement = $con->prepare(\"SELECT * FROM `parking_garage`\");\n $statement->execute();\n return $statement->fetchAll(PDO::FETCH_ASSOC);\n\n }", "public function getParcelShops()\n {\n $coordinates = Mage::Helper('dpd')->getGoogleMapsCenter();\n\n $parcelshops = Mage::getSingleton('dpd/webservice')->getParcelShops(\n $coordinates['longitude'],\n $coordinates['latitude'],\n $coordinates['country']\n );\n\n return $parcelshops;\n }", "public function shipper(){\n\t\treturn parent::shipper();\n\t}", "public function getSeatsNum();", "function getPlants(){\n\t\t\tif($stmt = $this->con->prepare(\"SELECT itemID, Price, itemName, lowNum FROM PLANT\")){\n\t\t\t$stmt->execute();\n\t\t\t$stmt->bind_result($id, $price, $name, $lowNum);\n\t\t\t\n\t\t\t$items = array(); \n\t\t\t\n\t\t\twhile($stmt->fetch()){\n\t\t\t\t$item = array();\n\t\t\t\t$item['id'] = $id; \n\t\t\t\t$item['name'] = $name; \n\t\t\t\t$item['price'] = $price; \n\t\t\t\t$item['lowNum'] = $lowNum;\n\t\t\t\t\n\t\t\t\tarray_push($items, $item); \n\t\t\t}\n\t\t\t$count = 0;\n\n\t\t\twhile($count < sizeof($items)){\n\n\t\t\t\t$id = $items[$count]['id'];\n\t\t\t\t$items[$count]['tags'] = $this->getPlantTags($id);\n\t\t\t\t$items[$count]['othernames'] = $this->getOtherNames($id);\n\t\t\t\t$items[$count]['AmountAvailable'] = $this->getAmountItems($item['id']);\n\t\t\t\t$count++;\n\n\t\t\t}\n\t\t\t\n\n\t\t\t\n\t\t\treturn $items; \n\t\t}\n\t}" ]
[ "0.5497326", "0.5378838", "0.52318597", "0.5202418", "0.51700157", "0.51176083", "0.5039938", "0.50275594", "0.5014438", "0.49714836", "0.48985857", "0.4891621", "0.4889708", "0.4884716", "0.48640916", "0.48515713", "0.4838338", "0.48263207", "0.48128802", "0.48084944", "0.48002622", "0.47944662", "0.47837245", "0.47825098", "0.47694063", "0.47591457", "0.47553188", "0.47534847", "0.47333097", "0.47269547" ]
0.69366425
0
get a list of all starships
public function get_all_starships() { $headers['Accept'] = 'application/json'; $headers['Content-Type'] = 'application/json'; $page = 1; $starships_list = []; $client = new Client(); get_starships: $requestGuzzle = new \GuzzleHttp\Psr7\Request('get', $this->url . 'starships?page=' . $page); $response = $client->send($requestGuzzle, ["headers" => $headers]); $body = json_decode($response->getBody()->getContents()); array_push($starships_list, ...$body->results); if ($body->next) { $page++; goto get_starships; } return $starships_list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAllShips() {\n\t\t$act = \"get_all_ships\";\n\n\t\treturn $this->dbSelect(\n\t\t\t$act,\n\t\t\t'id, name, serial_number, image_url',\n\t\t\t'ships'\n\t\t);\n\t}", "public function all(int $pageNumber = 1){\n $statusCode = '200';\n $starships = [];\n while($statusCode == 200){\n $response = $this->client->get('starships/?page='.$pageNumber);\n $statusCode = $response->getStatusCode();\n $body = $response->getBody();\n $results = json_decode($body);\n if(isset($results->results)){\n $starships = array_merge($starships , $results->results);\n }\n $pageNumber++;\n }\n return $starships;\n }", "public function getShips()\n {\n $shipsFromDatabase = $this->shipStorage->fetchAllShipsData();\n\n $ships = array();\n\n foreach ($shipsFromDatabase as $ship)\n {\n $ships[] = $this->getShipFromData($ship);\n }\n\n return $ships;\n\n }", "public function get_ships()\n\t{\n\t\t// Within the same php script, ships will only change if\n\t\t// the script itself changes them, so only let this object\n\t\t// retrieve its ships once.\n\t\t\n\t\tif ( is_array($this->ships) )\n\t\t{\n\t\t\t// The ships have already been retrieved or set manually.\n\t\t}\n\t\telse\n\t\t{\n\t\t\tload_class('Fleet_Ship');\n\t\t\t$this->ships = Fleet_Ship::get_ships_in_fleet($this->id);\n\t\t\treturn $this->ships;\n\t\t}\n\t}", "public function getAllPornstars();", "public function getStars()\r\n {\r\n return $this->get(self::_STARS);\r\n }", "public function getIterator()\n {\n return new \\ArrayIterator($this->ships);\n }", "public function Stars()\n {\n return $this->getHasMany( new Star() );\n }", "public function fetchAllShipsData();", "public function get_ship_names() {\n $ship_names = array();\n foreach ($this->AVAILABLE_SHIPS as $value) {\n $ship_names[] = $value['name'];\n }\n\n return $ship_names;\n }", "public function get_player_ships() {\n return $this->game_data['player'];\n }", "function getStarships($page,$search){\n $return=array();\n $returnresult=array();\n $offset=0;\n if($search!=null){\n $searchQuery='WHERE (StarshipName LIKE \"%'.$search.'%\" or StarshipModel LIKE \"%'.$search.'%\")';\n $urlQuery='&search='.$search;\n }else{\n $searchQuery='';\n $urlQuery='';\n } \n if (is_numeric($page)){\n $offset=getOffset($page);\n $results=loadQueryArray('SELECT StarshipID FROM Starships '.$searchQuery.' ORDER BY StarshipID ASC LIMIT 10 OFFSET '.$offset);\n if($results!=null){\n foreach($results as $result){\n $returnresult[] = searchStarshipByID($result['StarshipID'],false);\n }\n }else{\n $return['detail']=MSG_NOT_FOUND;\n return(json_encode($return));\n }\n }else{\n $return['detail']=MSG_NOT_FOUND;\n return(json_encode($return));\n }\n $return['count']=loadQueryArray('SELECT COUNT(*) as StarshipsCount FROM Starships '.$searchQuery)[0]['StarshipsCount'];\n if($offset+10<$return['count']){\n $return['next']=LOCAL_URL.'/starships/?page='.($page+1).$urlQuery;\n }else{\n $return['next']=null;\n }\n if($page-1>0){\n $return['previous']=LOCAL_URL.'/starships/?page='.($page-1).$urlQuery;\n }else{\n $return['previous']=null;\n }\n $return['results']=$returnresult;\n return(json_encode($return));\n}", "function searchStarshipByID($starshipID,$encode=true){\n $statement=prepareQuery('SELECT * FROM Starships WHERE StarshipID= :StarshipID');\n $array=array('StarshipID'=>$starshipID);\n $statement->execute($array);\n $result=$statement->fetch();\n $return=array();\n if ($result!=null){\n $return['id']=$result['StarshipID'];\n $return['name']=$result['StarshipName'];\n $return['model']=$result['StarshipModel'];\n $return['manufacturer']=$result['StarshipManufacturer'];\n $return['cost_in_credits']=$result['StarshipCost'];\n $return['length']=$result['StarshipLength'];\n $return['max_atmosphering_speed']=$result['StarshipMAS'];\n $return['crew']=$result['StarshipCrew'];\n $return['passengers']=$result['StarshipPassengers'];\n $return['cargo_capacity']=$result['StarshipCargoCapacity'];\n $return['consumables']=$result['StarshipConsumables'];\n $return['hyperdrive_rating']=$result['StarshipHRating'];\n $return['MGLT']=$result['StarshipMGLT'];\n $return['starship_class']=$result['StarshipClass'];\n $return['pilots'][]=MSG_NOT_YET_DEVELOPED;\n $filmsOfStarship=getFilmsOfStarship($result['StarshipID']);\n foreach($filmsOfStarship as $film){\n $return['films'][]=$film['FilmURL'];\n }\n $return['created']=$result['StarshipCreated'];\n $return['edited']=$result['StarshipEdited'];\n $return['url']=$result['StarshipURL'];\n $return['amount']=$result['StarshipAmount'];\n }else{\n $return['detail']=MSG_NOT_FOUND;\n }\n \n return($encode?json_encode($return):$return);\n}", "public function index()\n {\n return [\n 'starmap' => [\n 'star_count' => Star::count(),\n 'started_at' => Star::first()->created_at->toDateTimeString(),\n 'planet' => [\n 'free_count' => Planet::whereNull('user_id')->count(),\n 'occupied_count' => Planet::whereNotNull('user_id')->count(),\n 'starter_count' => Planet::starter()->count(),\n ],\n ],\n ];\n }", "public function getStars()\n {\n return $this->stars;\n }", "public function get_pilots(Request $request)\n {\n $pilots = [];\n $starships = [];\n $passengers_no = $request->passengers;\n $option = $request->opt;\n $sort = $request->sort;\n $starships_to_examine = $this->get_all_starships();\n\n switch ($option){\n case 1:\n foreach ($starships_to_examine as $starship) { //go through every starship\n if ((int)$starship->passengers > $passengers_no) { //compare\n\n foreach ($starship->pilots as $pilot) {\n if (in_array($pilot, $pilots)) {\n break;\n } else {\n array_push($pilots, $this->get_data_via_url($pilot)->original->name);\n }\n\n }\n array_push($starships, [\n \"name\" => $starship->name,\n \"passengers\" => $starship->passengers,\n \"pilots\" => $pilots\n ]);\n $pilots = [];\n }\n }\n break;\n case 2:\n foreach ($starships_to_examine as $starship) { //go through every starship\n if ((int)$starship->passengers < $passengers_no) { //compare current starship number of passengers with value\n\n foreach ($starship->pilots as $pilot) {\n if (in_array($pilot, $pilots)) {\n break;\n } else {\n array_push($pilots, $this->get_data_via_url($pilot)->original->name);\n }\n\n }\n array_push($starships, [\n \"name\" => $starship->name,\n \"passengers\" => $starship->passengers,\n \"pilots\" => $pilots\n ]);\n $pilots = [];\n }\n }\n break;\n case 3:\n foreach ($starships_to_examine as $starship) { //odam niz sekoj starship\n if ((int)$starship->passengers == $passengers_no) { //sporedi current starship number of passengers so value\n\n foreach ($starship->pilots as $pilot) {\n if (in_array($pilot, $pilots)) {\n break;\n } else {\n array_push($pilots, $this->get_data_via_url($pilot)->original->name);\n }\n\n }\n array_push($starships, [\n \"name\" => $starship->name,\n \"passengers\" => $starship->passengers,\n \"pilots\" => $pilots\n ]);\n $pilots = [];\n }\n }\n break;\n }\n\n \n //sort\n switch ($sort) {\n\n case \"passengers\":\n for ($i = 0; $i < sizeof($starships) - 1; $i++) {\n for ($j = $i + 1; $j < sizeof($starships); $j++) {\n if ($starships[$i]['passengers'] > $starships[$j]['passengers']) {\n $temp = $starships[$i];\n $starships[$i] = $starships[$j];\n $starships[$j] = $temp;\n }\n }\n }\n break;\n default:\n for ($i = 0; $i < sizeof($starships) - 1; $i++)\n for ($j = $i + 1; $j < sizeof($starships); $j++) {\n if ($starships[$i]['name'] > $starships[$j]['name']) {\n $temp = $starships[$i];\n $starships[$i] = $starships[$j];\n $starships[$j] = $temp;\n }\n }\n break;\n }\n\n\n\n return response()->json($starships);\n\n }", "public static function allShops(): self\n {\n return new static(null, null, false);\n }", "public function allFriends() {\n return $this->myFriends->merge($this->friendOf);\n }", "public static function all(){\n $db = Zend_Registry::get('dbAdapter');\n $result = $db->query('select id from salespersons')->fetchAll();\n $salespersons = new SplObjectStorage();\n foreach($result as $r){\n if ( intval($r['id']) == 0 ){\n continue;\n }\n $person = new Yourdelivery_Model_Salesperson($r['id']);\n $salespersons->attach($person);\n }\n return $salespersons;\n }", "public function get_avaliable_ship_array() {\n return $this->AVAILABLE_SHIPS;\n }", "public function gates() {\n\t\treturn $this->_get_related( __FUNCTION__, '\\PSU\\TeacherCert\\Student\\Gates', array( 'v_student_gates.student_gate_system_id' => $this->id ) );\n\t}", "public function star()\n {\n return $this->state(function (array $attributes) {\n return [\n 'disappear_at' => null,\n 'type' => 'star'\n ];\n });\n }", "public function getShipToLocations()\n {\n return $this->shipToLocations;\n }", "public function getStars() \n\t{\n\t\treturn $this->getData('/<div\\s+class=\"star-rating size-large count-(.*)\">/', \"stars\");\n\t}", "public function getUsers()\n {\n return $this->hasMany(User::className(), ['id' => 'user_id'])->viaTable('{{%user_friendship}}', ['friend_user_id' => 'id']);\n }", "public function selectALLShippers()\n {\n $query=\"SELECT shipper ,COUNT(shipper) as proveedores, SUM(contenedores_ingresados) AS TOTAL FROM packing_list GROUP BY shipper HAVING COUNT(*)\";\n $selectall=$this->db->query($query);\n $ListPaquetes=$selectall->fetch_all(MYSQLI_ASSOC);\n return $ListPaquetes;\n }", "public function getSomeFunkyStars(Foomo\\Services\\Mock\\FunkyStar $star)\n\t{\n\t\treturn $this->callServer(self::VERSION, 'getSomeFunkyStars', array($star));\n\t}", "public function getByIsStarred($IsStarred)\n {\n $result = $this->getList(array('IsStarred' => $IsStarred));\n return $result;\n }", "function pull_sports() {\n global $CFG, $USER;\n $context = get_context_instance(CONTEXT_SYSTEM);\n\n if (has_capability('block/student_gradeviewer:sportsadmin', $context)) {\n $sports = get_records('block_courseprefs_sports');\n } else {\n $sql = \"SELECT spo.* FROM {$CFG->prefix}block_courseprefs_sports spo,\n {$CFG->prefix}block_student_sports spm\n WHERE spm.usersid = {$USER->id}\n AND spm.path = spo.id\";\n $sports = get_records_sql($sql);\n }\n\n if(!$sports) {\n $sports = array();\n }\n\n return array_map('flatten_sport', $sports);\n}", "public function getStations()\n\t{\n\t\t$this->update();\n\n\t\treturn Station::all();\n\t}" ]
[ "0.73919314", "0.7060517", "0.68770194", "0.676972", "0.66765594", "0.6345128", "0.62356025", "0.622921", "0.60152924", "0.5908972", "0.58678234", "0.5815901", "0.5557939", "0.5533684", "0.55196834", "0.5381445", "0.53353965", "0.5322467", "0.5294534", "0.52768624", "0.5244066", "0.5238082", "0.5232603", "0.5230174", "0.5203379", "0.52016264", "0.5194075", "0.51734066", "0.5173388", "0.5172759" ]
0.82704335
0
[oneTableStructure description] Checks for name, label, type Checks if type is one of: text, date, long_text, select, combo_select, multi_select, boolean, slider Checks if select, combo_select, multi_select have a dictionary Checks if check is one or more of: int, email, no_dupl, not_empty, range, regex Checks if check is has check regex and has pattern Checks if get_values_from_tb point to valid data
private function oneTableStructure($t, $path2cfg, $echo = false){ u::echo("Checking configuration for {$t}", $echo); $t = preg_replace('/([a-z]+)__/', '', $t); if ($t === 'files' || $t === 'geodata'){ return; } $table_array = u::getJson("{$path2cfg}/{$t}.json"); foreach ($table_array as $e) { // Checks for name, label, type foreach (['name', 'label', 'type'] as $k) { if (!$e[$k]){ throw new \Exception("Missing required index {$k} for {$path2cfg}/{$t}.json"); } } // Checks if type is one of: text, date, long_text, select, combo_select, multi_select, boolean, slider if (!in_array($e['type'], ['text', 'date', 'long_text', 'select', 'combo_select', 'multi_select', 'boolean', 'slider'])){ throw new \Exception("Invalid type {$e['type']} for {$t}.{$e['name']}"); } // Checks if select, combo_select, multi_select have a dictionary if ( in_array($e['type'], ['select', 'combo_select', 'multi_select']) && ( !@$e['vocabulary_set'] && !@$e['get_values_from_tb'] && !@$e['id_from_tb'] ) ){ if ($e['multi_select'] && !$e['vocabulary_set']) throw new \Exception("Type {$e['type']} of {$t}.{$e['name']} is missing a dictionary"); } // Checks if check is one or more of: int, email, no_dupl, not_empty, range, regex if (@$e['check']){ if (!is_array($e['check'])) { throw new \Exception("Some check is active on {$t}.{$e['name']} but is is not an array"); } foreach ($e['check'] as $c) { if (!in_array($c, ['int', 'email', 'no_dupl', 'not_empty', 'range', 'regex'])){ throw new \Exception("Invalid check type {$c} on {$t}.{$e['name']}"); } } // Checks if check is has check regex and has pattern if (in_array('regex', $e['check']) && !@$e['pattern']){ throw new \Exception("Field {$t}.{$e['name']} has a regex check rule, but no pattern is defined"); } } // Checks if get_values_from_tb point to valid data if (@$e['get_values_from_tb']) { $p = explode(':', $e['get_values_from_tb']); $p[0] = preg_replace('/([a-z]+)__/', '', $p[0]); if (!u::fileExists("{$path2cfg}/{$p[0]}.json")){ throw new \Exception("Missing configuration file {$path2cfg}/{$p[0]}.json for table mentioned in {$t}.{$e['name']} get_values_from_tb value"); } if (!self::tbHasfld($path2cfg, $p[0], $p[1])){ throw new \Exception("Table {$p[0]} does not have a field {$p[1]} as mentioned in {$t}.{$e['name']} get_values_from_tb value"); } } } u::echo(" Configuration for {$t}: OK", $echo); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testTableStructure()\n {\n $model = $this->getNewModel();\n $describeInfoList = App::getInstance()\n ->getDb()\n ->execute(\n sprintf(\n 'DESCRIBE %s',\n $model->getTableName()\n )\n )\n ->fetchAll();\n $fields = $model->get();\n foreach ($describeInfoList as $describeInfo) {\n $this->assertTrue(\n array_key_exists($describeInfo['Field'], $fields),\n sprintf(\n 'Unable to find property [%s] for model [%s]',\n $describeInfo['Field'],\n get_class($model)\n )\n );\n }\n\n $modelInfoList = $model->getFieldsInfo();\n foreach ($modelInfoList as $modelField => $modelInfo) {\n $describeKey = null;\n foreach ($describeInfoList as $key => $describeInfo) {\n if ($modelField === $describeInfo['Field']) {\n $describeKey = $key;\n break;\n }\n }\n\n $this->assertNotNull(\n $describeKey,\n sprintf(\n 'Unable to find field [%s] from table [%s]',\n $modelField,\n $model->getTableName()\n )\n );\n\n $describeRow = $describeInfoList[$describeKey];\n\n $hasKey = array_key_exists(\n AbstractModel::FIELD_ALLOW_NULL,\n $modelInfo\n );\n\n if ($hasKey === true) {\n $this->assertSame(\n 'YES',\n $describeRow['Null'],\n sprintf(\n 'The value of column [%s] from table [%s] can be NULL',\n $modelField,\n $model->getTableName()\n )\n );\n }\n\n if ($hasKey === false) {\n $this->assertSame(\n 'NO',\n $describeRow['Null'],\n sprintf(\n 'The value of column [%s] from ' .\n 'table [%s] can not be NULL',\n $modelField,\n $model->getTableName()\n )\n );\n }\n\n $this->_checkDbFieldTypes($describeRow, $modelInfo, $model);\n $this->_checkDbForeignKeys($modelField, $modelInfo, $model);\n }\n }", "private function readSchema() {\n\t\t$sSchemaFile = '../config/schema.json';\n\t\tif (file_exists($sSchemaFile)) {\n\t\t\t$this->tables = json_decode(file_get_contents($sSchemaFile), TRUE);\n\t\t}\n\t\t$this->tables['generic'] = array(\n\t\t\t'text' => array(\n\t\t\t\t'filter' => '/<*?[^<>]*?>/', // Since didn't make negative=true, will filter but won't give error\n\t\t\t\t'description' => 'no html entities',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'textarea',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'html' => array(\n\t\t\t\t'filter' => '/<script*?[^<>]*?>/',\n\t\t\t\t'negative' => false,\n\t\t\t\t'description' => 'no scripting allowed',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'textarea',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'integer' => array(\n\t\t\t\t'filter' => '/[^\\d]/',\n\t\t\t\t'description' => 'integers only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 100,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'boolean' => array(\n\t\t\t\t'filter' => '/([01])/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => '0 or 1 only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 1,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'money' => array(\n\t\t\t\t'filter' => '/^([\\-]{0,1})[0-9]+(\\.[0-9]{0,2})?$/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'decimal numbers only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'decimal' => array(\n\t\t\t\t'filter' => '/^([\\-]{0,1})[0-9]+(\\.[0-9])?$/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'decimal numbers only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'alphanumeric' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9]/',\n\t\t\t\t'description' => 'letters and numbers only',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'extended' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9_\\-\\.]/',\n\t\t\t\t'description' => 'letters, numbers, and _-. only',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'alpha' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z]/',\n\t\t\t\t'description' => 'letters only',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'date' => array(\n\t\t\t\t'filter' => '/([0-9]{4}\\/(0[1-9]|1[012])\\/(0[1-9]|[12][0-9]|3[01]))/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'YYYY/MM/DD',\n\t\t\t\t'min_length' => 10,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Date',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'name' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9\\s_\\-\\.\\,\\!]/',\n\t\t\t\t'description' => 'letters, numbers, whitespace, and _-.,! only',\n\t\t\t\t'min_length' => 2,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Title',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'email' => array(\n\t\t\t\t'filter' => '/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,25}){0,1}$/', // Allows emails to be blank as long as min_length is overridden\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => '[email protected]',\n\t\t\t\t'min_length' => 8,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Email address',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'telephone' => array(\n\t\t\t\t'filter' => '/[^0-9]/',\n\t\t\t\t'description' => 'phone number, numbers only, no dashes or spaces',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 20,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Telephone number',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'ip' => array(\n\t\t\t\t'filter' => '/(\\d{1,3}\\.){3}\\d{1,3}/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'xxx.xxx.xxx.xxx',\n\t\t\t\t'min_length' => 7,\n\t\t\t\t'max_length' => 15,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'IP address',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'mac' => array(\n\t\t\t\t'filter' => '/([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'xx:xx:xx:xx:xx',\n\t\t\t\t'min_length' => 17,\n\t\t\t\t'max_length' => 17,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'MAC address',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'filename' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9_:\\?\\=\\&\\@\\[\\]\\.\\-\\ ]/i',\n\t\t\t\t'description' => 'valid filename, e.g. SomeFile_12345.images.zip',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 500,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Filename',\n\t\t\t\t\t'type' => 'file',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'url' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9_:\\?\\=\\&\\@\\[\\]\\/\\.\\-\\ ]/i',\n\t\t\t\t'description' => 'valid url, e.g. http://www.example.com/page.html',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 500,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'URL',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'utime' => array(\n\t\t\t\t'filter' => '/[^\\d]/',\n\t\t\t\t'description' => 'integer unix timestamp',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Unix timestamp',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'counter' => array(\n\t\t\t\t'filter' => '/[^\\d]/',\n\t\t\t\t'description' => 'integer',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'hex' => array(\n\t\t\t\t'filter' => '/[^a-f0-9]/',\n\t\t\t\t'description' => 'hexadecimal string',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'timezone' => array(\n\t\t\t\t'filter' => '/([a-zA-Z0-9]*)\\/([a-zA-Z0-9\\_]*)/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'timezone identifier',\n\t\t\t\t'min_length' => 10,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Timezone',\n\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t'America/New_York' => 'EDT (Eastern/New York)',\n\t\t\t\t\t\t'America/Chicago' => 'CDT (Central/Chicago)',\n\t\t\t\t\t\t'America/Boise'\t => 'MDT (Mountain/Boise)',\n\t\t\t\t\t\t'America/Phoenix' => 'MST (Arizona/Pheonix)',\n\t\t\t\t\t\t'America/Los_Angeles' => 'PDT (Pacific/Los Angeles)',\n\t\t\t\t\t\t'America/Juneau' => 'AKDT (Alaska/Juneau)',\n\t\t\t\t\t\t'Pacific/Honolulu' => 'HST (Hawaii/Honolulu)',\n\t\t\t\t\t\t'Pacific/Guam' => 'ChST (Chamorro/Guam)',\n\t\t\t\t\t\t'Pacific/Samoa' => 'SST (Swedish Summer/Samoa)',\n\t\t\t\t\t\t'Pacific/Wake' => 'WAKT (Wake Time/Wake)',\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t\t'tag' => array(\n\t\t\t\t'filter' => '/[^0-9a-f]/',\n\t\t\t\t'description' => 'ID',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 30,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Tags',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'color' => array(\n\t\t\t\t'filter' => '/([0-9a-f]{3}){1,2}/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'rgb hex color',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 6,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'RGB color',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t}", "function getFieldSpec_original ()\n // set and return the original specifications for this database table\n // (before being possibly amended at runtime)\n // based on Tony's\n {\n $fieldspec['fieldname'] = array('keyword' => 'value');\n\n // example specifications are as follows:\n $fieldspec['field1'] = array('type' => 'string');\n $fieldspec['field2'] = array('type' => 'date');\n $fieldspec['field3'] = array('type' => 'time');\n $fieldspec['field4'] = array('type' => 'datetime');\n $fieldspec['field5'] = array('type' => 'enum');\n $fieldspec['field6'] = array('type' => 'boolean',\n 'true' => 'Y|T|1',\n 'false' => 'N|F|0');\n $fieldspec['field7'] = array('type' => 'int1|tinyint|int2|smallint|int3|mediumint|int4|integer|int8|bigint|int');\n $fieldspec['field5'] = array('type' => 'numeric|decimal',\n 'precision' => 10,\n 'scale' => 2); // optional, default is 0\n // the following settings are optional for all fields:\n // 'size' => 12 - sets size of HTML control\n // 'required' = 'y' - will cause an empty field to be rejected\n // 'pkey' => 'y' - indicates a primary key field\n // 'noedit' => 'y' - make the field non-editable\n // 'nodisplay' => 'y' - do not display the field\n\n // the following settings are optional for string fields:\n // 'uppercase' => 'y' - will upshift a text field\n // 'lowercase' => 'y' - will downshift a text field\n // 'password' => 'y' - sets HTML type to 'password'\n // 'hash' => 'md5|sha1|custom' - defines type of encryption (optional)\n // 'subtype' => 'filename' - must be a valid filename\n\n // the following settings are optional for numeric fields:\n // 'unsigned' => 'y' - will reject negative values\n // 'minvalue' => 10 - defines a minimum acceptable value\n // 'maxvalue' => 99 - defines a maximum acceptable value\n // 'zerofill' => 'y' - causes leading spaces to be replaced with zeroes\n\n // the following settings are optional for date fields:\n // 'infinityisnull' => 'y' - shows blank to the user, but sets database value to '9999-12-31'\n\n // the following will specify which HTML control to use (default is 'text'):\n // 'control' => 'dropdown' - will create a dropdown list\n // 'control' => 'radiogroup' - will create a radiogroup\n // 'optionlist' => '<listname>' - required for dropdowns and radiogroups\n // 'align' => 'h|v' - alignment for radiogroups: horizotal or vertical (default is horizontal)\n // 'control' => 'multiline' - creates a multiline text box\n // 'cols' => 50 - defines number of columns for a multiline text box\n // 'rows' => 5 - defines number of rows for a multiline text box\n // 'control' => 'popup' - a picklist from another screen, not a dropdown\n // 'foreignfield' => '<name>' - field to be displayed from foreign table\n // 'popupname' => '<name>' - name of screen to call\n // 'control' => 'filepicker' - a picklist of file names\n // 'filepicker' => '<name>' - name of screen to call\n // 'image' => 'y' - identifies this field as an image\n // 'imagewidth' => 16 - image width\n // 'imageheight' => 16 - image height\n\n // primary key details (a single array of filed names\n $primary_key = array('fieldname1');\n\n // unique/candidate key details (optional)\n // each unique key may contain one or more fields\n $unique_keys[] = array('fieldname1', 'fieldname2');\n\n // array of optional child relationships (where this table is the parent)\n // 'type' indicates tyhe type of delete constraint (where 'cascade' is the same as 'delete')\n $child_relations[] = array('child' => 'tablename',\n 'type' => 'nullify/cascade/delete/restricted',\n 'fields' => array('parent_id' => 'child_id'));\n\n // array of optional parent relationships (where this table is the child)\n $parent_relations[] = array('parent' => 'tablename',\n 'parent_field' => 'fieldname',\n 'fields' => array('child_id' => 'parent_id'));\n\n // copy into member variables\n $this->primary_key = $primary_key;\n $this->unique_keys = $unique_keys;\n $this->child_relations = $child_relations;\n $this->parent_relations = $parent_relations;\n\n return $fieldspec;\n\n }", "public function inspectTable()\n\t{\n\t\tif (defined('static::TABLENAME'))\n\t\t{\n\t\t\t$this->tabledefinition = array_map(function ($value)\n\t\t\t{\n\t\t\t\t$return = array();\n\n\t\t\t\t$return['type'] = $value;\n\n\t\t\t\tif (preg_match('/(set|enum)\\((.*)\\)/', $value, $matches))\n\t\t\t\t{\n\t\t\t\t\t$return['option'] = array_map(function ($value)\n\t\t\t\t\t{\n\t\t\t\t\t\t// return ucwords( trim($value, \"'\") );\n\t\t\t\t\t\treturn trim($value, \"'\");\n\t\t\t\t\t}, explode(',', $matches[2]));\n\t\t\t\t}\n\n\t\t\t\t$return['length'] = $matches[2];\n\n\t\t\t\treturn $return;\n\t\t\t}, \\R::inspect(static::TABLENAME));\n\t\t}\n\t}", "public function checkmarkTableGenericValidate($info)\n {\n $selected = $this->config[\"selected_evals\"];\n if ($selected == \"\") {\n $this->valid = false;\n $this->errors[\"selected_evals\"][] = \"Please select one or more evals.\";\n }\n }", "public function is_valid()\n\t{\n\t\t$return_state = true;\n\n\t\t// If any of the madatory values are null return false.\n\t\t// While there check_data($data) on them.\n\n\t\tif (!$this->_values[$this->_datatype]['mandatory'])\n\t\t{\n\t\t\techo 'No valid entries in vbfields.php for this type<br />Datatype: ' . $this->_datatype;\n\t\t\texit;\n\t\t}\n\n\t\tforeach (($this->_values[$this->_datatype]['mandatory']) AS $key => $value)\n\t\t{\n\t\t\t// Guest user hack\n\t\t\tif ($key == 'userid' OR $key == 'bloguserid' AND $value == 0)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (empty($value) AND $value !=0 OR $value == '!##NULL##!' OR strlen($value) == '0')\n\t\t\t{\n\t\t\t\t$this->_failedon = $key;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ($this->_values[$this->_datatype]['dictionary'][$key] == 'return true;')\n\t\t\t{\n\t\t\t\t$return_state = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// TODO: Can't lambda because of appaling memory usage and PHP not cleaning, going to have to local function it\n\t\t\t\t// Create a lambda function with the dictionary contents of the dB to check the data\n\t\t\t\t$check_data = create_function('$data', $this->_values[$this->_datatype]['dictionary'][$key]);\n\n\t\t\t\tif (!$check_data($value))\n\t\t\t\t{\n\t\t\t\t\t$this->_failedon = $key;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check all the nonmandatory ones as well, is there are any - subscriptionlog\n\t\tif (is_array($this->_values[$this->_datatype]['nonmandatory']))\n\t\t{\n\t\t\tforeach (($this->_values[$this->_datatype]['nonmandatory']) AS $key => $value)\n\t\t\t{\n\t\t\t\t// TODO: Either ALL the database fields need a default or vBfields needs to be able to read a default list\n\t\t\t\tif ($value == '!##NULL##!')\n\t\t\t\t{\n\t\t\t\t\t$this->_values[$this->_datatype]['nonmandatory'][$key] = ''; // Empty it for the SQL so the database will default to the field default\n\t\t\t\t}\n\n\t\t\t\tif ($this->_values[$this->_datatype]['dictionary'][$key] == 'return true;')\n\t\t\t\t{\n\t\t\t\t\t$return_state = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// TODO: Can't lambda because of appaling memory usage and PHP not cleaning, going to have to local function it\n\t\t\t\t\t// Create a lambda function with the dictionary contents of the dB to check the data\n\t\t\t\t\t$check_data = create_function('$data', $this->_values[$this->_datatype]['dictionary'][$key]);\n\n\t\t\t\t\tif (!$check_data($value))\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->_failedon = $key;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $return_state;\n\t}", "function getMetaData($tableName,$type='') {\n\t\t\t\ttry {\n\t\t\t\t\t\t$result=$this->doSQL(\"show full fields from \".$tableName);\n\t\t\t\t\t\t$flag=false;\n\t\t\t\t\t\t$i=1;\n\t\t\t\t\t\twhile($field=$this->nextObject($result,0))\n\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t$fname=$field->Field;\n\t\t\t\t\t\t\t$fFullType=$field->Type;\n\t\t\t\t\t\t\t$fFullType=str_replace(\"unsigned\",'',$fFullType);\n\t\t\t\t\t\t\t$fFullType=str_replace(\"zerofill\",'',$fFullType);\n\t\t\t\t\t\t\t$fType=preg_replace(\"/[^a-z]/i\",'',$fFullType);\n\t\t\t\t\t\t\t$fType=strtolower($fType);\n\t\t\t\t\t\t\tif(strstr($fType,\"int\")!='') $fType=\"int\";\n\t\t\t\t\t\t\telseif($fType==\"double\"||$fType==\"float\"||$fType==\"decimal\")$fType=\"real\";\n\t\t\t\t\t\t\telseif($fType==\"varchar\")$fType=\"string\";\n\t\t\t\t\t\t\telseif($fType==\"text\")$fType=\"blob\";\n\t\t\t\t\t\t\t$fLength=preg_replace(\"/[^0-9]/\",'',$fFullType);\n\t\t\t\t\t\t\tif(strtolower($fname)!=\"id\") {\n\t\t\t\t\t\t\t\t\t$array1[]=$fname;\n\t\t\t\t\t\t\t\t\t$array2[$fname]=$fType;\n\t\t\t\t\t\t\t\t\t$array3[$fname]=$fLength;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$arrayComment[$fname]=$field->Comment;\n\t\t\t\t\t\t\tif(($field->Key)==\"PRI\"&&!$flag) {\n\t\t\t\t\t\t\t\t\t$array4[\"pk\"]=$fname;\n\t\t\t\t\t\t\t\t\t$flag=true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t++$i;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$array4[\"table\"]=$tableName;\n\t\t\t\t\t\t$array []=$array1;\t\t\t\t\t//column name\n\t\t\t\t\t\t$array []=$array2; \t\t\t\t\t//data type\n\t\t\t\t\t\t$array []=$array3; \t\t\t//length field\n\t\t\t\t\t\t$array []=$array4; \t\t\t\t//extension(primary key, tablename)\n\t\t\t\t\t\t$array[\"Comment\"]=$arrayComment; \t//get comment of field\n unset($array1);unset($array2);unset($array3);unset($array4);\n unset($flag);\n unset($result);\n unset($field);\n unset($fname);\n unset($fType);\n unset($fFullType);\n\t\t\t\t\t\treturn $array;\n\t\t\t\t}catch (Exception $ex) {\n\t\t\t\t}\n\t\t\t}", "private function _getFieldsDefinitionFromData($data) {\r\n $fields_list = array();\r\n\r\n // certains champs ne sont pas présents dans la nomenclature (faute du LEI) :\r\n $criteres = array_filter((array)$data['Nomenclature'][0]['Criteres']) + (array)$data['Criteres'];\r\n unset($data['Nomenclature']);\r\n\r\n $prestataire = array_filter((array)$data['Prestataire'][0]);\r\n unset($data['Prestataire']);\r\n\r\n // si les horaires existent, on n'en a pas besoin pour le moment\r\n unset($data['Horaires']);\r\n\r\n //----- les champs \"root\" : ils n'ont pas de label et ne sont pas typés.\r\n // ils ont une valeur, que l'on utilisera que pour l'affichage\r\n foreach($data as $field => $value) {\r\n\r\n if(is_array($value)) {continue;}\r\n\r\n $fields_list[$field] = array(\r\n 'label' => $field,\r\n 'type' => 'textfield',\r\n 'values' => !empty($value) ? array($value) : array(),\r\n 'prevent_sorting' => true,\r\n );\r\n }\r\n\r\n //----- les infos prestataires\r\n if(!empty($prestataire)) {\r\n $fields_list['presta'] = array(\r\n 'label' => \"Prestataire\",\r\n 'type' => 'group',\r\n 'prevent_sorting' => true,\r\n );\r\n\r\n foreach($prestataire as $field => $value) {\r\n\r\n $fields_list[$field . '__presta'] = array(\r\n 'label' => $field,\r\n 'type' => 'textfield', // à l'instar des champs root : pas de label, et pas de type, et juste une value informative\r\n 'group' => 'presta',\r\n 'values' => !empty($value) ? array($value) : array(),\r\n );\r\n }\r\n }\r\n\r\n //----- les critères\r\n\r\n $lei_types_mapping = array(\r\n '1' => 'integer',\r\n '2' => 'textfield',\r\n '3' => 'date',\r\n '4' => 'image', // chemin (url)\r\n '5' => 'decimal', // à l'origine, c'est un type monétaire\r\n '6' => 'file', // url\r\n );\r\n\r\n foreach($criteres as $index => $critere) {\r\n\r\n $type = !empty($lei_types_mapping[$critere['CRITERE_TYPEVAL']]) ? $lei_types_mapping[$critere['CRITERE_TYPEVAL']] : 'textfield';\r\n\r\n switch($critere['CRITERE_QUALITATIF']) {\r\n\r\n case 0: // valeur unique : qualitatif (ex : descriptif)\r\n\r\n $fields_list[(string)$critere['CRITERE']] = array(\r\n 'label' => $critere['CRITERE_NOM'],\r\n 'type' => $type,\r\n );\r\n\r\n if(array_key_exists($critere['CRITERE'], $data['Criteres'])) {\r\n $fields_list[(string)$critere['CRITERE']]['values'] = array($data['Criteres'][$critere['CRITERE']]['Modalites'][0]['VALEUR']);\r\n }\r\n\r\n break;\r\n\r\n case 1: // checkbox (on/off) ou select/radio : modalité unique (ex : animaux acceptés, ou classement hôtels)\r\n\r\n if(count($critere['Modalites']) == 1) { // checkbox (on/off)\r\n\r\n $modalite = array_keys($critere['Modalites']);\r\n\r\n $fields_list[(string)$critere['CRITERE']] = array(\r\n 'label' => $critere['CRITERE_NOM'],\r\n 'type' => 'onoff',\r\n 'values' => array(\r\n $critere['CRITERE_NOM'], // seulement affiché à titre informatif\r\n ),\r\n );\r\n\r\n } else { // select/radio\r\n\r\n $fields_list[(string)$critere['CRITERE']] = array(\r\n 'label' => $critere['CRITERE_NOM'],\r\n 'type' => 'select',\r\n );\r\n\r\n foreach($critere['Modalites'] as $modalite) {\r\n $fields_list[(string)$critere['CRITERE']]['values'][$modalite['MODALITE']] = $modalite['MODALITE_NOM'];\r\n }\r\n }\r\n\r\n break;\r\n\r\n case -1: // checkboxes : modalité multiple (ex : équipements)\r\n\r\n $fields_list[(string)$critere['CRITERE']] = array(\r\n 'label' => $critere['CRITERE_NOM'],\r\n 'type' => 'checkboxes',\r\n );\r\n\r\n foreach($critere['Modalites'] as $modalite) {\r\n $fields_list[(string)$critere['CRITERE']]['values'][$modalite['MODALITE']] = $modalite['MODALITE_NOM'];\r\n }\r\n\r\n break;\r\n\r\n case 2: // groupe de plusieurs champs : modalité valuée : plusieurs entrées utilisateur (ex : groupe de tarifs, de photos)\r\n\r\n $fields_list[(string)$critere['CRITERE']] = array(\r\n 'label' => $critere['CRITERE_NOM'],\r\n 'type' => 'group',\r\n );\r\n\r\n foreach($critere['Modalites'] as $modalite) {\r\n\r\n $fields_list[(string)$modalite['MODALITE'] . '__' . $critere['CRITERE']] = array(\r\n 'label' => $modalite['MODALITE_NOM'],\r\n 'type' => $type,\r\n 'group' => (string)$critere['CRITERE'],\r\n );\r\n\r\n if(array_key_exists($critere['CRITERE'], $data['Criteres'])\r\n && array_key_exists($modalite['MODALITE'], $data['Criteres'][$critere['CRITERE']]['Modalites'])) {\r\n $fields_list[(string)$modalite['MODALITE'] . '__' . $critere['CRITERE']]['values'] = array(\r\n $data['Criteres'][$critere['CRITERE']]['Modalites'][$modalite['MODALITE']]['VALEUR'],\r\n );\r\n }\r\n }\r\n\r\n break;\r\n }\r\n }\r\n\r\n return $fields_list;\r\n }", "public function chk_dat()\n {\n echo \"title = \" . $this->dat[\"title\"] . \"\\n\\n\";\n echo \"name = \" . $this->dat[\"name\"] . \"\\n\\n\";\n echo \"era = \" . $this->dat[\"era\"] . \"\\n\\n\";\n echo \"rows = \" . $this->dat[\"rows\"] . \"\\n\\n\";\n\n echo $this->dat[\"field\"][\"n\"] . \", \" .\n $this->dat[\"field\"][\"m\"] . \", \" .\n $this->dat[\"field\"][\"mmdd\"] . \", \" .\n $this->dat[\"field\"][\"memo\"] . \", \" .\n $this->dat[\"field\"][\"item\"] . \", \" .\n $this->dat[\"field\"][\"other\"] . \", \" . \n $this->dat[\"field\"][\"amount0\"] . \", \" .\n $this->dat[\"field\"][\"amount1\"] . \", \" .\n $this->dat[\"field\"][\"remain\"] . \", \" .\n $this->dat[\"field\"][\"name\"] . \"\\n\\n\";\n\n $cnt = $this->dat[\"rows\"];\n for ($i = 0; $i < $cnt; $i++) {\n echo $this->dat[\"data\"][$i][\"n\"] . \", \" .\n $this->dat[\"data\"][$i][\"m\"] . \", \" .\n $this->dat[\"data\"][$i][\"mmdd\"] . \", \" .\n $this->dat[\"data\"][$i][\"memo\"] . \", \" .\n $this->dat[\"data\"][$i][\"item\"] . \", \" .\n $this->dat[\"data\"][$i][\"other\"] . \", \" .\n $this->dat[\"data\"][$i][\"amount0\"] . \", \" .\n $this->dat[\"data\"][$i][\"amount1\"] . \", \" .\n $this->dat[\"data\"][$i][\"remain\"] . \", \" .\n $this->dat[\"data\"][$i][\"name\"] . \"\\n\\n\";\n }\n }", "function get_field_types($table) {\r\n\tglobal $db;\r\n\r\n\r\n\t$fields_meta = explode(\"\\r\\n\", current($db->query(\"SELECT TABLE_SOURCE FROM INFORMATION_SCHEMA_TABLES WHERE TABLE_NAME = '$table'\")->fetch(PDO::FETCH_ASSOC)));\r\n\tunset($fields_meta[0]);\r\n\r\n\tforeach ($fields_meta as $fm) {\r\n\t\tif (stripos($fm, 'not null') === false) {\r\n\t\t\t$null = \"_null\";\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$null = \"\";\r\n\t\t}\r\n\r\n\t\tpreg_match(\"/\\[(.*)\\]\\s(\\w*)/\", $fm, $matches);\r\n\t\t$fields_type[$matches[1]] = strtolower($matches[2] . $null);\r\n\t}\r\n\t$fields_type[\"id\"] = \"read-only\";\r\n\r\n\r\n\r\n\r\n\t$query = $db->query(\"SELECT TABLE_NAME FROM INFORMATION_SCHEMA_TABLES\");\r\n\twhile ($res = $query->fetch(PDO::FETCH_ASSOC)) {\r\n\t\tif (in_array($res[\"TABLE_NAME\"] . \"_id\", array_keys($fields_type))) {\r\n\r\n\t\t\tif (stripos($fields_type[$res[\"TABLE_NAME\"] . \"_id\"], \"_null\") === false) {\r\n\r\n\t\t\t\t$fields_type[$res[\"TABLE_NAME\"] . \"_id\"] = \"drop-down\";\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$fields_type[$res[\"TABLE_NAME\"] . \"_id\"] = \"drop-down_null\";\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\r\n\treturn $fields_type;\r\n}", "function selectFieldStructure($table_name )\n\t\t\t{\n\t\t\t\n\t\t\t\t$q=mysql_query('SHOW COLUMNS FROM '. $table_name );\n\t\t\t\t$num=mysql_num_rows($q);\n\t\t\t\t$this->counter=$num;\n\t\t\t\tif($num>0)\n\t\t\t\t{\n\t\t\t\t\t$columnsName=array('field','null');\n\t\t\t\t\tfor($z=0;$z<$num;$z++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor($i=0;$i<2;$i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->{$columnsName[$i]}[$z]=mysql_result($q,$z,$columnsName[$i]);\n\t\t\t\t\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}", "public function handleFormField_typeCheck($field, array $config, $template='') {\r\n\t\t// Hook to handle form field\r\n\t\tif (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['handleFormField_typeCheck'])) {\r\n\t\t\tforeach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['handleFormField_typeCheck'] as $class) {\r\n\t\t\t\t$procObj = & t3lib_div::getUserObj($class);\r\n\t\t\t\tif ($content = $procObj->handleFormField_typeCheck($this->pi_base, $this->table, $field, $this->fieldLabels, $this->recordId, $this->conf, $this))\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (!$content) {\r\n\t\t\tif ($config['cols'] && $config['cols']>1) {\r\n\t\t\t\ttx_icstcafeadmin_debug::notice('handleFormField_typeCheck with cols is not implemented.');\r\n\t\t\t\t$content = '<div>\r\n\t\t\t\t\t<p>' . $this->fieldLabels[$field] . ': handle associates with this fiels is not implemented</p>\r\n\t\t\t\t\t<input type=\"hidden\" name=\"' . $this->prefixId . '[' . $field . ']\" value=\"' . $this->row[$field] . '\"/>\r\n\t\t\t\t\t</div>';\r\n\t\t\t\t/* TODO : implements form field with tca field on type check and sevrals cols\r\n\t\t\t\t$template = $this->cObj->getSubpart($this->templateCode, '###TEMPLATE_FORM_CHECK###');\r\n\t\t\t\t\tMakes loop to fill ###CHECK_ITEMS### markers like\r\n\t\t\t\t\t\tfor ($col=0; $cols<$config['cols']; $cols++) {\r\n\t\t\t\t\t\t\t$locMarkers['CHECK_ITEMS'] .= handleFormField_typeCheck_item($field, $config, $cols);\r\n\t\t\t\t\t\t\t.....\r\n\t\t\t\t\t\t}\r\n\t\t\t\t*/\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif ($config['items']) {\r\n\t\t\t\t\t$template = $template? $template: $this->cObj->getSubpart($this->templateCode, '###TEMPLATE_FORM_CHECKBOXES###');\r\n\t\t\t\t\t$subTemplate = $this->cObj->getSubpart($template, '###ALT_SUBPART_FORM_'.strtoupper($field).'_CHECK_ITEM###');\r\n\t\t\t\t\t$selItems = $this->initItemArray($config);\r\n\t\t\t\t\tfor ($c = 0; $c < count($selItems); $c++) {\r\n\t\t\t\t\t\t$p = $selItems[$c];\r\n\t\t\t\t\t\t$itemContent .= $this->handleFormField_typeCheck_item($field, $config, $c, $subTemplate, $GLOBALS['TSFE']->sL($p[label]));\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$locMarkers = array(\r\n\t\t\t\t\t\t'PREFIXID' => $this->prefixId,\r\n\t\t\t\t\t\t'ITEMFORMEL_CHECK_LABEL' => $this->fieldLabels[$field],\r\n\t\t\t\t\t\t'CHECK_ITEMS' => $itemContent,\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$template = $this->cObj->substituteSubpart($template, '###ALT_SUBPART_FORM_'.strtoupper($field).'_CHECK_ITEM###', $itemContent);\r\n\t\t\t\t\t$content = $this->cObj->substituteMarkerArray($template, $locMarkers, '###|###');\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t$template = $template? $template: $this->cObj->getSubpart($this->templateCode, '###TEMPLATE_FORM_CHECK###');\r\n\t\t\t\t\t$subTemplate = $this->cObj->getSubpart($template, '###ALT_SUBPART_FORM'.strtoupper($field).'_CHECK_ITEM###');\r\n\t\t\t\t\t$itemContent = $this->handleFormField_typeCheck_item($field, $config, null, $subTemplate);\r\n\t\t\t\t\t$locMarkers = array(\r\n\t\t\t\t\t\t'PREFIXID' => $this->prefixId,\r\n\t\t\t\t\t\t'CHECK_ITEMS' => $itemContent,\r\n\t\t\t\t\t);\r\n\t\t\t\t\t$template = $this->cObj->substituteSubpart($template, '###ALT_SUBPART_FORM'.strtoupper($field).'_CHECK_ITEM###', $itemContent);\r\n\t\t\t\t\t$content = $this->cObj->substituteMarkerArray($template, $locMarkers, '###|###');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $content;\r\n\t}", "function testTextDataType() {\n $data = array(\n 'id' => 1,\n 'textfield' => 'test',\n );\n $this->insertValues($data);\n $this->selectAndCheck($data);\n }", "function Set_Table_Type($type_arr){\r\n\r\n\tif (isset($type_arr['TB_COLUMNS'])) $this->tb_columns = $type_arr['TB_COLUMNS'];\r\n\tif (!isset($type_arr['L_MARGIN'])) $type_arr['L_MARGIN']=0;//default values\r\n\r\n\t$this->tb_table_type = $type_arr;\r\n\r\n}", "function ColTablaInputText($TxtName,$TxtType,$TxtValue,$TxtLabel,$TxtPlaceh,$TxtColor,$TxtEvento,$TxtFuncion,$TxtAncho,$TxtAlto,$ReadOnly,$Required){\r\n\t\tprint('<td>');\r\n\t\t\r\n\t\t$this->CrearInputText($TxtName,$TxtType,$TxtLabel,$TxtValue,$TxtPlaceh,$TxtColor,$TxtEvento,$TxtFuncion,$TxtAncho,$TxtAlto,$ReadOnly,$Required);\r\n\t\t\r\n\t\tprint('</td>');\r\n \r\n\t\t\r\n\t}", "public function table_fields();", "public function prepareFieldsFromTable()\n {\n foreach ($this->columns as $column) {\n $type = $column->getType()->getName();\n\n switch ($type) {\n case 'integer':\n $field = $this->generateIntFieldInput($column, 'integer');\n break;\n case 'smallint':\n $field = $this->generateIntFieldInput($column, 'smallInteger');\n break;\n case 'bigint':\n $field = $this->generateIntFieldInput($column, 'bigInteger');\n break;\n case 'boolean':\n $name = title_case(str_replace('_', ' ', $column->getName()));\n $field = $this->generateField($column, 'boolean', 'checkbox,1');\n break;\n case 'datetime':\n $field = $this->generateField($column, 'datetime', 'date');\n break;\n case 'datetimetz':\n $field = $this->generateField($column, 'dateTimeTz', 'date');\n break;\n case 'date':\n $field = $this->generateField($column, 'date', 'date');\n break;\n case 'time':\n $field = $this->generateField($column, 'time', 'text');\n break;\n case 'decimal':\n $field = $this->generateNumberInput($column, 'decimal');\n break;\n case 'float':\n $field = $this->generateNumberInput($column, 'float');\n break;\n case 'string':\n $field = $this->generateField($column, 'string', 'text');\n break;\n case 'text':\n $field = $this->generateField($column, 'text', 'textarea');\n break;\n default:\n $field = $this->generateField($column, 'string', 'text');\n break;\n }\n\n if (strtolower($field->name) == 'password') {\n $field->htmlType = 'password';\n } elseif (strtolower($field->name) == 'email') {\n $field->htmlType = 'email';\n } elseif (in_array($field->name, $this->timestamps)) {\n $field->isSearchable = false;\n $field->isFillable = false;\n $field->inForm = false;\n $field->inIndex = false;\n }\n\n $this->fields[] = $field;\n }\n }", "public function test_field_logic_for_fields_with_text_box() {\n\t\tforeach ( self::fields_with_text_box() as $field_key ) {\n\t\t\tself::check_single_field_with_text_box( $field_key );\n\t\t}\n\t}", "public function chk_dat()\n {\n echo \"title = \" . $this->dat[\"title\"] . \"\\n\\n\";\n echo \"name = \" . $this->dat[\"name\"] . \"\\n\\n\";\n echo \"era = \" . $this->dat[\"era\"] . \"\\n\\n\";\n echo \"bymd = \" . $this->dat[\"bymd\"] . \"\\n\\n\";\n echo \"ty = \" . $this->dat[\"ty\"] . \"\\n\\n\";\n echo \"bps = \" . $this->dat[\"bps\"] . \"\\n\\n\";\n echo \"eps = \" . $this->dat[\"eps\"] . \"\\n\\n\";\n echo \"bgs = \" . $this->dat[\"bgs\"] . \"\\n\\n\";\n echo \"egs = \" . $this->dat[\"egs\"] . \"\\n\\n\";\n echo \"pcost = \" . $this->dat[\"pcost\"] . \"\\n\\n\";\n echo \"rows = \" . $this->dat[\"rows\"] . \"\\n\\n\";\n\n echo $this->dat[\"field\"][\"n\"] . \", \" .\n $this->dat[\"field\"][\"m\"] . \", \" .\n $this->dat[\"field\"][\"mm\"] . \", \" .\n $this->dat[\"field\"][\"account_cd\"] . \", \" .\n $this->dat[\"field\"][\"name\"] . \", \" .\n $this->dat[\"field\"][\"remain\"] . \", \" .\n $this->dat[\"field\"][\"division\"] . \"\\n\\n\";\n\n $cnt = $this->dat[\"rows\"];\n for ($i = 0; $i < $cnt; $i++) {\n echo $this->dat[\"data\"][$i][\"n\"] . \", \" .\n $this->dat[\"data\"][$i][\"m\"] . \", \" .\n $this->dat[\"data\"][$i][\"mm\"] . \", \" .\n $this->dat[\"data\"][$i][\"account_cd\"] . \", \" .\n $this->dat[\"data\"][$i][\"name\"] . \", \" .\n $this->dat[\"data\"][$i][\"remain\"] . \", \" .\n $this->dat[\"data\"][$i][\"division\"] . \"\\n\\n\";\n }\n }", "function getTableStructure($table);", "function selectStructure($table_Name='')\n\t\t\t{\n\t\t\t\n\t\t\t\t$q=mysql_query('SHOW COLUMNS FROM '. $table_Name );\n\t\t\t\t//return 'SHOW COLUMNS FROM '. $table_Name;\n\t\t\t\t$num=mysql_num_rows($q);\n\t\t\t\t$this->counterRecord=$num;\n\t\t\t\tif($num>0)\n\t\t\t\t{\n\t\t\t\t\t$columnsName=array('field');\n\t\t\t\t\tfor($z=0;$z<$num;$z++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor($i=0;$i<1;$i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$this->{$columnsName[$i]}[$z]=mysql_result($q,$z,$columnsName[$i]);\n\t\t\t\t\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}", "function v0_check_db($instruction, $class, $full_xml_array, $gen_vd_id, $gen_cc_id, $gen_pub_date, $current_time, &$warnings, &$errors, &$l_errors) {\n\t// Local variables\n\t$parameters=$instruction['value'];\n\t$l_parameters=count($parameters);\n\t\n\t// Get first parameter (table)\n\tif ($parameters[0]['tag']!=\"TABLE\") {\n\t\t// Error\n\t\t$errors[$l_errors]=array();\n\t\t$errors[$l_errors]['code']=1440;\n\t\t$errors[$l_errors]['message']=\"The 1st element of a 'check' instruction was not 'table'\";\n\t\t$l_errors++;\n\t\treturn FALSE;\n\t}\n\t$select_table=$parameters[0]['value'][0];\n\t\n\t$select_where_field_name=array();\n\t$select_where_field_value=array();\n\t// Loop on fields and values\n\tfor ($i=1; $i<$l_parameters; $i+=2) {\n\t\t// Local variables\n\t\t$field=$parameters[$i];\n\t\tif ($field['tag']!=\"FIELD\") {\n\t\t\t// Error\n\t\t\t$errors[$l_errors]=array();\n\t\t\t$errors[$l_errors]['code']=1441;\n\t\t\t$errors[$l_errors]['message']=\"The (2n)-th element of a 'check' instruction was not 'field'\";\n\t\t\t$l_errors++;\n\t\t\treturn FALSE;\n\t\t}\n\t\t$value=$parameters[$i+1];\n\t\tif ($value['tag']!=\"VALUE\") {\n\t\t\t// Error\n\t\t\t$errors[$l_errors]=array();\n\t\t\t$errors[$l_errors]['code']=1442;\n\t\t\t$errors[$l_errors]['message']=\"The (2n+1)-th element of a 'check' instruction was not 'value'\";\n\t\t\t$l_errors++;\n\t\t\treturn FALSE;\n\t\t}\n\t\t$parameter_name=$value['value'][0];\n\t\t\n\t\t// Depending on the first character of the parameter name, we have to call different functions\n\t\tswitch (substr($parameter_name, 0, 1)) {\n\t\t\tcase '!':\n\t\t\t\t// General element\n\t\t\t\tif (!v0_ul_get_general($parameter_name, $gen_vd_id, $gen_cc_id, $gen_pub_date, $current_time, NULL, NULL, $parameter_value, $errors, $l_errors)) {\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '=':\n\t\t\t\t// Current or parent -- not uploaded yet, so skip\n\t\t\t\treturn TRUE;\n\t\t\tcase '*':\n\t\t\t\t// Local element\n\t\t\t\tif (!v0_ul_get_element($parameter_name, $class, $parameter_value, $errors, $l_errors)) {\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '/':\n\t\t\t\t// Attribute\n\t\t\t\tif (!v0_ul_get_attribute($parameter_name, $class, $parameter_value, $errors, $l_errors)) {\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '#':\n\t\t\t\t// Function result\n\t\t\t\tif (!v0_ul_get_result($parameter_name, $class, $full_xml_array, $parameter_value, $errors, $l_errors)) {\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t// Static value\n\t\t\t\t$parameter_value=$parameter_name;\n\t\t}\n\t\t\n\t\t// If a NULL value was returned\n\t\tif ($parameter_value==NULL) {\n\t\t\t// Error\n\t\t\t$errors[$l_errors]=array();\n\t\t\t$errors[$l_errors]['code']=1443;\n\t\t\t$errors[$l_errors]['message']=\"A necessary element for a 'check' instruction was not found\";\n\t\t\t$l_errors++;\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t// Store in arrays\n\t\t$select_where_field_name[($i-1)/2]=$field['value'][0];\n\t\t$select_where_field_value[($i-1)/2]=$parameter_value;\n\t}\n\t\n\t// Database functions\n\trequire_once(\"php/funcs/db_funcs.php\");\n\t\n\t// Query database\n\t$select_field_name=array();\n\t$select_field_value=array();\n\t$select_field_name[0]=$select_table.\"_id\";\n\t$local_error=\"\";\n\tif (!db_select($select_table, $select_field_name, $select_where_field_name, $select_where_field_value, $select_field_value, $local_error)) {\n\t\tswitch ($local_error) {\n\t\t\tcase \"Error in the parameters given\":\n\t\t\t\t$errors[$l_errors]=array();\n\t\t\t\t$errors[$l_errors]['code']=1024;\n\t\t\t\t$errors[$l_errors]['message']=$local_error.\" to db_select()\";\n\t\t\t\t$l_errors++;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$errors[$l_errors]=array();\n\t\t\t\t$errors[$l_errors]['code']=4009;\n\t\t\t\t$errors[$l_errors]['message']=$local_error;\n\t\t\t\t$l_errors++;\n\t\t}\n\t\treturn FALSE;\n\t}\n\t$l_select_field_value=count($select_field_value);\n\tif ($l_select_field_value>1) {\n\t\t// Only 0 or 1 result should be found\n\t\t$errors[$l_errors]=array();\n\t\t$errors[$l_errors]['code']=1111;\n\t\t$errors[$l_errors]['message']=\"Multiple rows in the \".$select_table.\" table were found with \";\n\t\t// Loop on fields\n\t\t$l_fields=count($select_where_field_name);\n\t\tfor ($i=0; $i<$l_fields; $i++) {\n\t\t\t// Local variables\n\t\t\t$field_name=$select_where_field_name[$i];\n\t\t\t$field_value=$select_where_field_value[$i];\n\t\t\tif ($i==0) {\n\t\t\t\t$errors[$l_errors]['message'].=$field_name.\"='\".$field_value.\"'\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$errors[$l_errors]['message'].=\", \".$field_name.\"='\".$field_value.\"'\";\n\t\t}\n\t\t$l_errors++;\n\t}\n\t// Get result\n\tif (isset($select_field_value[0][0])) {\n\t\t$warning_msg=$class['tag'].\" data (\";\n\t\t$l_fields=count($select_where_field_name);\n\t\tfor ($i=0; $i<$l_fields; $i++) {\n\t\t\t// Local variables\n\t\t\t$field_name=$select_where_field_name[$i];\n\t\t\t$field_value=$select_where_field_value[$i];\n\t\t\tif ($i==0) {\n\t\t\t\t$warning_msg.=$field_name.\"='\".$field_value.\"'\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$warning_msg.=\", \".$field_name.\"='\".$field_value.\"'\";\n\t\t}\n\t\t$warning_msg.=\")\";\n\t\tarray_push($warnings, $warning_msg);\n\t}\n\t\n\treturn TRUE;\n}", "public function parseSingleField($type, $data, Array $fieldDesc, Billrun_Parser &$parser);", "function tep_fss_get_html_code($name, $type, $questions_id) {\n $fields_val_count = tep_db_fetch_array(tep_db_query(\"SELECT count(*) as count FROM \" . TABLE_FSS_VALUES_FIELDS . \" fvf, \" . TABLE_FSS_FIELDS_TO_VALUES . \" ff2v WHERE fvf.fields_id = ff2v.fields_id AND ff2v.values_type_name = '\" . $type . \"' AND fvf.fields_validation = '1'\"));\n $fields_query = tep_db_query(\"SELECT fvf.fields_name, fvf.fields_default_value, fvf.fields_remarks, fvf.fields_validation, fvf.fields_type, fvf.fields_value, ff2v.values_type_id FROM \" . TABLE_FSS_VALUES_FIELDS . \" fvf, \" . TABLE_FSS_FIELDS_TO_VALUES . \" ff2v WHERE fvf.fields_id = ff2v.fields_id AND ff2v.values_type_name = '\" . $type . \"' ORDER BY ff2v.sort_order\");\n $str = '<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\"><tbody>' . \"\\n\";\n $flag = true;\n $row = 0;\n while ($fields = tep_db_fetch_array($fields_query)) {\n $fields_id = tep_fss_get_fields_id($fields['values_type_id']);\n $fields_value = tep_fss_get_fields_value($questions_id, $fields_id);\n $fields_type = tep_fss_get_fields_type($fields_id);\n $row++;\n if ($fields_type == 'checkbox' && $fields_value != '') {\n $checked = true;\n } else {\n $checked = false;\n }\n if ($fields_value == '') {\n $fields_value = $fields['fields_value'];\n }\n if ($fields['fields_validation'] == '0') {\n $str .= ' <tr>' . \"\\n\";\n $str .= ' <td class=\"' . ($row == 1 ? 'fss_left_header' : 'fss_left') . '\" valign=\"top\"><b>' . $fields['fields_name'] . '</b></td>' . \"\\n\";\n switch ($fields['fields_type']) {\n case 'input':\n $str .= ' <td class=\"' . ($row == 1 ? 'fss_header' : 'fss') . '\">' . tep_draw_input_field('field_' . $fields['values_type_id'], $fields_value, 'id=\"field_' . $fields['values_type_id'] . '\"') . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n case 'dropdownmenu': \n $str .= ' <td class=\"' . ($row == 1 ? 'fss_header' : 'fss') . '\">' . tep_fss_get_dropdownmenu_code('field_' . $fields['values_type_id'], $fields['fields_value'], $fields_value) . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n case 'textarea':\n $str .= ' <td class=\"' . ($row == 1 ? 'fss_header' : 'fss') . '\">' . tep_draw_textarea_field('field_' . $fields['values_type_id'], '', '24', '3', $fields_value, 'id=\"field_' . $fields['values_type_id'] . '\"') . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n case 'checkbox':\n $str .= ' <td class=\"' . ($row == 1 ? 'fss_header' : 'fss') . '\">' . tep_draw_checkbox_field('field_' . $fields['values_type_id'], $fields_value, $checked, '', 'id=\"field_' . $fields['values_type_id'] . '\"') . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n case 'radiobutton':\n $str .= ' <td class=\"' . ($row == 1 ? 'fss_header' : 'fss') . '\">' . tep_fss_get_radiobutton_code('field_' . $fields['values_type_id'], $fields['fields_value'], $fields_value) . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n case 'dropdownmenudynamic':\n $str .= ' <td class=\"' . ($row == 1 ? 'fss_header' : 'fss') . '\" valign=\"middle\">' . tep_fss_get_dropdownmenudynamic_code('field_' . $fields['values_type_id'], $fields_value, $fields['fields_default_value']) . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n }\n $str .= ' </tr>' . \"\\n\";\n } else {\n if ($flag) {\n $str .= ' <tr>' . \"\\n\";\n $str .= ' <td rowspan=\"' . $fields_val_count['count'] . '\" class=\"fss_left\" valign=\"top\"><b>Validation</b></td>' . \"\\n\";\n $flag = false;\n } else {\n $str .= ' <tr>' . \"\\n\";\n }\n switch ($fields['fields_type']) {\n case 'input':\n $str .= ' <td class=\"fss\">' . $fields['fields_name'] . '&nbsp;' . tep_draw_input_field('field_' . $fields['values_type_id'], $fields_value, 'id=\"field_' . $fields['values_type_id'] . '\"') . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n case 'checkbox':\n $str .= ' <td class=\"fss\">' . $fields['fields_name'] . '&nbsp;' . tep_draw_checkbox_field('field_' . $fields['values_type_id'], $fields_value, $checked, '', 'id=\"field_' . $fields['values_type_id'] . '\"') . '&nbsp;' . $fields['fields_remarks'] . '</td>' . \"\\n\";\n break;\n }\n $str .= ' </tr>' . \"\\n\";\n }\n }\n $str .= '</tbody></table>' . \"\\n\";\n return $str;\n }", "function table_add_field($dbh,$form_id,$element_id,$type,$option_id=0){\n\t\t$comment_desc['text'] \t\t= 'Single Line Text';\n\t\t$comment_desc['phone'] \t\t= 'Phone';\n\t\t$comment_desc['simple_phone'] = 'Phone';\n\t\t$comment_desc['url'] \t\t= 'Web Site';\n\t\t$comment_desc['email'] \t\t= 'Email';\n\t\t$comment_desc['file'] \t\t= 'File Upload';\n\t\t$comment_desc['textarea'] \t= 'Paragraph Text';\n\t\t$comment_desc['radio'] \t\t= 'Multiple Choice';\n\t\t$comment_desc['select'] \t= 'Drop Down';\n\t\t$comment_desc['time'] \t\t= 'Time';\n\t\t$comment_desc['date'] \t\t= 'Date';\n\t\t$comment_desc['europe_date'] = 'Europe Date';\n\t\t$comment_desc['money'] \t\t = 'Price';\n\t\t$comment_desc['number'] \t = 'Number';\n\t\t$comment_desc['simple_name'] = 'Normal Name';\n\t\t$comment_desc['simple_name_wmiddle'] = 'Normal Name with Middle';\n\t\t$comment_desc['name'] \t\t \t\t = 'Extended Name';\n\t\t$comment_desc['name_wmiddle'] \t\t = 'Extended Name with Middle';\n\t\t$comment_desc['address'] \t = 'Address';\n\t\t$comment_desc['checkbox'] \t = 'Checkbox';\n\t\t$comment_desc['signature'] \t = 'Signature';\n\t\t\n\t\t$comment = @$comment_desc[$type];\n\t\t\t\n\t\tif(('text' == $type) || ('phone' == $type) || ('simple_phone' == $type) || ('url' == $type) || ('email' == $type) || ('file' == $type)){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}` text NULL COMMENT '{$comment}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('textarea' == $type || 'signature' == $type){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}` mediumtext NULL COMMENT '{$comment}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif (('radio' == $type) || ('select' == $type)){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}` smallint(4) unsigned NOT NULL DEFAULT '0' COMMENT '{$comment}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('time' == $type){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}` time NULL COMMENT '{$comment}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif (('date' == $type) || ('europe_date' == $type)){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}` date NULL COMMENT '{$comment}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('money' == $type){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}` decimal(62,2) NULL COMMENT '{$comment}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('number' == $type){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}` double NULL COMMENT '{$comment}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('simple_name' == $type){\n\t\t\t//add two field, first and last name\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}_1` text NULL COMMENT '{$comment} - First', ADD COLUMN `element_{$element_id}_2` text NULL COMMENT '{$comment} - Last';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('simple_name_wmiddle' == $type){\n\t\t\t//add three fields, first, middle and last name\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}_1` text NULL COMMENT '{$comment} - First', ADD COLUMN `element_{$element_id}_2` text NULL COMMENT '{$comment} - Middle', ADD COLUMN `element_{$element_id}_3` text NULL COMMENT '{$comment} - Last';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('name' == $type){\n\t\t\t//add four field, title, first, last, suffix \n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}_1` text NULL COMMENT '{$comment} - Title', ADD COLUMN `element_{$element_id}_2` text NULL COMMENT '{$comment} - First', ADD COLUMN `element_{$element_id}_3` text NULL COMMENT '{$comment} - Last', ADD COLUMN `element_{$element_id}_4` text NULL COMMENT '{$comment} - Suffix';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('name_wmiddle' == $type){\n\t\t\t//add five fields, title, first, middle, last, suffix \n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}_1` text NULL COMMENT '{$comment} - Title', ADD COLUMN `element_{$element_id}_2` text NULL COMMENT '{$comment} - First', ADD COLUMN `element_{$element_id}_3` text NULL COMMENT '{$comment} - Middle', ADD COLUMN `element_{$element_id}_4` text NULL COMMENT '{$comment} - Last', ADD COLUMN `element_{$element_id}_5` text NULL COMMENT '{$comment} - Suffix';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('address' == $type){\n\t\t\t//add six field\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}_1` text NULL COMMENT '{$comment} - Street', ADD COLUMN `element_{$element_id}_2` text NULL COMMENT '{$comment} - Line 2', ADD COLUMN `element_{$element_id}_3` text NULL COMMENT '{$comment} - City', ADD COLUMN `element_{$element_id}_4` text NULL COMMENT '{$comment} - State/Province/Region', ADD COLUMN `element_{$element_id}_5` text NULL COMMENT '{$comment} - Zip/Postal Code', ADD COLUMN `element_{$element_id}_6` text NULL COMMENT '{$comment} - Country';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}elseif ('checkbox' == $type){\n\t\t\t$query = \"ALTER TABLE `\".MF_TABLE_PREFIX.\"form_{$form_id}` ADD COLUMN `element_{$element_id}_{$option_id}` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '{$comment} - {$option_id}';\";\n\t\t\tmf_do_query($query,array(),$dbh);\n\t\t}\n\t\t\t\n\t}", "function search_data($Value,$type){\r\n\r\n\t//jika nilai $Value=*, maka program akan mengambil seluruh nilai field yg ada di tabel,jika tidak, isikan sesuai dengan field yg akan dicari dlm tabel, isikan $type dengan selectAll untuk memilih semua data atau isikan dengan notAll untuk memilih sesuai dengan identifier,\r\n\t//if $value=*, program will take all value from the table, if not, fill the $Value with the field that will be taken from the table, fill $type with selectAll to select all data from table or notAll to select the data according to the $identifier\r\n\t\r\n\t\tif($type==\"selectAll\"){\r\n\t\t\treturn mysqli_query($this->conn,\"select \".$Value.\" from \".$this->table);\t\r\n\t\t}\r\n\t\telse if($type==\"notAll\"){\r\n\t\t\t$value_e=explode(\"+#+\",$this->Value);\r\n\t\t\treturn mysqli_query($this->conn,\"select \".$Value.\" from \".$this->table.\" where \".$this->identifier.\"='\".$value_e[0].\"'\");\t\r\n\t\t}\r\n\t}", "public function get_fields( $specific_field = \"\" )\r\n {\r\n $fields = array(\r\n \r\n 'order_id' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_id',\r\n 'label' => 'id #',\r\n 'type' => 'text',\r\n 'type_dt' => 'text',\r\n 'attributes' => array(),\r\n 'dt_attributes' => array(\"width\"=>\"5%\"),\r\n 'js_rules' => '',\r\n 'rules' => 'trim'\r\n ),\r\n\r\n 'order_user_id' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_user_id',\r\n 'label' => 'User ID',\r\n 'type' => 'dropdown',\r\n 'type_dt' => 'text',\r\n 'attributes' => array('additional'=>'disabled=\"disabled\"'),\r\n 'dt_attributes' => array(\"width\"=>\"5%\"),\r\n 'js_rules' => '',\r\n 'rules' => 'trim'\r\n ),\r\n\r\n 'order_payment_type' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_payment_type',\r\n 'label' => 'Payment Type',\r\n 'type' => 'hidden',\r\n 'type_dt' => 'text',\r\n 'attributes' => array(),\r\n 'dt_attributes' => array(\"width\"=>\"5%\"),\r\n 'js_rules' => '',\r\n 'rules' => 'trim'\r\n ),\r\n\r\n\r\n // 'order_is_sandbox' => array(\r\n // 'table' => $this->_table,\r\n // 'name' => 'order_is_sandbox',\r\n // 'label' => 'Status?',\r\n // 'type' => 'hidden',\r\n // 'type_dt' => 'dropdown',\r\n // 'type_filter_dt' => 'dropdown',\r\n // 'list_data_key' => \"order_is_sandbox\" ,\r\n // 'list_data' => array(),\r\n // 'default' => '1',\r\n // 'attributes' => array(),\r\n // 'dt_attributes' => array(\"width\"=>\"7%\"),\r\n // 'rules' => 'trim'\r\n // ),\r\n \r\n \r\n // 'order_agreed_terms_status' => array(\r\n // 'table' => $this->_table,\r\n // 'name' => 'order_agreed_terms_status',\r\n // 'label' => 'Agreed terms status?',\r\n // 'type' => 'switch',\r\n // 'type_dt' => 'dropdown',\r\n // 'type_filter_dt' => 'dropdown',\r\n // 'list_data_key' => \"order_agreed_terms_status\" ,\r\n // 'list_data' => array(),\r\n // 'attributes' => array(),\r\n // 'dt_attributes' => array(\"width\"=>\"7%\"),\r\n // 'rules' => 'trim'\r\n // ),\r\n\r\n 'order_payment_status' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_payment_status',\r\n 'label' => 'Payment Status',\r\n 'type' => 'dropdown',\r\n 'list_data' => array(\r\n 0 => \"<span class=\\\"label label-danger\\\">Not Attempt</span>\" , \r\n 1 => \"<span class=\\\"label label-success\\\">Payment approved</span>\" ,\r\n 2 => \"<span class=\\\"label label-danger\\\">Declined</span>\" ,\r\n 3 => \"<span class=\\\"label label-danger\\\">Error</span>\" ,\r\n 4 => \"<span class=\\\"label label-danger\\\">Held for Review</span>\" ,\r\n 11=> \"<span class=\\\"label label-danger\\\">Fruad Cause</span>\",\r\n ) ,\r\n 'attributes' => array(),\r\n // 'js_rules' => 'required',\r\n // 'rules' => 'required',\r\n ),\r\n\r\n // 'order_delivery_status' => array(\r\n // 'table' => $this->_table,\r\n // 'name' => 'order_delivery_status',\r\n // 'label' => 'Delivery Status',\r\n // 'type' => 'hidden',\r\n // 'list_data' => array(\r\n // 0 => \"<span class=\\\"label label-primary\\\">In Process</span>\" ,\r\n // 1 => \"<span class=\\\"label label-success\\\">New order</span>\" ,\r\n // 2 => \"<span class=\\\"label label-info\\\">Shipped</span>\" ,\r\n // 3 => \"<span class=\\\"label label-warning\\\">On Hold</span>\" ,\r\n // 4 => \"<span class=\\\"label label-danger\\\">Denied</span>\" ,\r\n // 5 => \"<span class=\\\"label label-danger\\\">Reject</span>\" ,\r\n // ) ,\r\n // 'attributes' => array(),\r\n // 'js_rules' => '',\r\n // 'rules' => 'trim'\r\n // ),\r\n\r\n\r\n 'order_shipping_type' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_type',\r\n 'label' => 'Shipping type',\r\n 'type' => 'dropdown',\r\n 'list_data' => array(),\r\n // 'list_data' => array(\r\n // 0 => \"<span class=\\\"label label-success\\\">Standard Shipping </span>\" ,\r\n // 1 => \"<span class=\\\"label label-success\\\">Express Shipping</span>\"\r\n // ) ,\r\n 'attributes' => array(),\r\n 'type_filter_dt' => 'dropdown',\r\n 'js_rules' => '',\r\n 'rules' => 'trim'\r\n ),\r\n\r\n 'order_shipping_content' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_content',\r\n 'label' => 'Shipping Content',\r\n 'type' => 'hidden',\r\n 'type_dt' => 'text',\r\n 'attributes' => array(),\r\n 'dt_attributes' => array(\"width\"=>\"5%\"),\r\n 'js_rules' => '',\r\n 'rules' => 'trim'\r\n ),\r\n\r\n // 'order_shipping_type' => array(\r\n // 'table' => $this->_table,\r\n // 'name' => 'order_shipping_type',\r\n // 'label' => 'Shipping type',\r\n // 'type' => 'hidden',\r\n // 'list_data' => array(\r\n // 0 => \"<span class=\\\"label label-success\\\">No Shipping Charges</span>\" ,\r\n // 1 => \"<span class=\\\"label label-success\\\">Free</span>\" ,\r\n // 2 => \"<span class=\\\"label label-success\\\">Pick in store</span>\" ,\r\n // 3 => \"<span class=\\\"label label-success\\\">Cash on Delivery</span>\" ,\r\n // 4 => \"<span class=\\\"label label-success\\\">DHL charges</span>\" ,\r\n // ) ,\r\n // 'attributes' => array(),\r\n // 'js_rules' => '',\r\n // 'rules' => 'trim'\r\n // ),\r\n\r\n // 'order_promotion_email' => array(\r\n // 'table' => $this->_table,\r\n // 'name' => 'order_promotion_email',\r\n // 'label' => 'Promotion Email',\r\n // 'type' => 'hidden',\r\n // 'list_data' => array(\r\n // 0 => \"<span class=\\\"label label-success\\\">No</span>\" ,\r\n // 1 => \"<span class=\\\"label label-success\\\">Yes</span>\" ,\r\n // ) ,\r\n // 'attributes' => array(),\r\n // 'js_rules' => '',\r\n // 'rules' => 'trim'\r\n // ),\r\n\r\n 'order_promotion_newsletter' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_promotion_newsletter',\r\n 'label' => 'Monthly Newsletter',\r\n 'type' => 'hidden',\r\n 'list_data' => array(\r\n 0 => \"<span class=\\\"label label-success\\\">No</span>\" ,\r\n 1 => \"<span class=\\\"label label-success\\\">Yes</span>\" ,\r\n ) ,\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim'\r\n ),\r\n\r\n // 'order_is_tc' => array(\r\n // 'table' => $this->_table,\r\n // 'name' => 'order_is_tc',\r\n // 'label' => 'Accept Terms of Service and Privacy Policy',\r\n // 'type' => 'dropdown',\r\n // 'list_data' => array(\r\n // 0 => \"<span class=\\\"label label-success\\\">No</span>\" ,\r\n // 1 => \"<span class=\\\"label label-success\\\">Yes</span>\" ,\r\n // ) ,\r\n // 'attributes' => array(),\r\n // 'js_rules' => 'required',\r\n // 'rules' => 'required',\r\n // ),\r\n\r\n 'order_is_tc' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_is_tc',\r\n 'label' => 'Payment Link Generated',\r\n 'type' => 'dropdown',\r\n // 'list_data' => array(\r\n // 0 => \"<span class=\\\"label label-success\\\">No</span>\" ,\r\n // 1 => \"<span class=\\\"label label-success\\\">Yes</span>\" ,\r\n // ) ,\r\n 'attributes' => array(),\r\n // 'js_rules' => 'required',\r\n // 'rules' => 'required',\r\n ),\r\n\r\n 'order_shipping_amount' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_amount',\r\n 'label' => 'Shipping charges',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_discount_amount' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_discount_amount',\r\n 'label' => 'Discount Amount',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_discount_content' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_discount_content',\r\n 'label' => 'Discount Content',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'product_price' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'product_price',\r\n 'label' => 'Product Price',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'invoice_price' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'invoice_price',\r\n 'label' => 'Invoice Amount',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_fname' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_fname',\r\n 'label' => 'First Name', //'Billing<br />First Name',\r\n 'type' => 'text',\r\n 'attributes' => array(),\r\n 'js_rules' => 'required',\r\n 'rules' => 'required|trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_lname' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_lname',\r\n 'label' => 'Last Name',//'Billing<br />Last Name',\r\n 'type' => 'text',\r\n 'attributes' => array(),\r\n 'js_rules' => 'required',\r\n 'rules' => 'required|trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_phone' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_phone',\r\n 'label' => ' Billing Phone Number', //'Billing<br />Phone',\r\n 'type' => 'text',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'required|trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_email' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_email',\r\n 'label' => 'Email',//'Billing<br />Email',\r\n 'type' => 'text',\r\n 'attributes' => array(),\r\n 'js_rules' => 'required',\r\n 'rules' => 'required|valid_email|strtolower|trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_address' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_address',\r\n 'label' => 'Billing Address # 1',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'required|trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_address2' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_address2',\r\n 'label' => 'Billing Address # 2',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_city' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_city',\r\n 'label' => 'Billing city',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'required|trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_state' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_state',\r\n 'label' => 'Billing State',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_country' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_country',\r\n 'label' => 'Billing Country',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'required|trim|htmlentities'\r\n ),\r\n\r\n 'order_billing_zip_code' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_billing_zip_code',\r\n 'label' => 'Billing postal/zip code',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'required|trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_fname' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_fname',\r\n 'label' => 'Shipping Frist Name',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_lname' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_lname',\r\n 'label' => 'Shipping Last Name',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_phone' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_phone',\r\n 'label' => 'Shipping Phone',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_email' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_email',\r\n 'label' => 'Shipping Email',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'valid_email|strtolower|trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_address' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_address',\r\n 'label' => 'Shipping Address # 1',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_address2' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_address2',\r\n 'label' => 'Shipping Address # 2',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_city' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_city',\r\n 'label' => 'Shipping city',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_state' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_state',\r\n 'label' => 'Shipping State',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_country' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_country',\r\n 'label' => 'Shipping Country',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_zip_code' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_zip_code',\r\n 'label' => 'Shipping postal/zip code',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_shipping_order_description' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_shipping_order_description',\r\n 'label' => 'order Note',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n\r\n 'order_paypal_mc_gross' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_mc_gross',\r\n 'label' => 'Paypal gross',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_paypal_date' => array( //payment\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_date',\r\n 'label' => 'Payment Date',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_paypal_payment_status' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_payment_status',\r\n 'label' => 'Paypal Status',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_paypal_pending_reason' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_pending_reason',\r\n 'label' => 'Paypal Pending reason',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_paypal_ReasonCode' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_ReasonCode',\r\n 'label' => 'Paypal reason code',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_paypal_verify_sign' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_verify_sign',\r\n 'label' => 'Paypal verify sign',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_payment_txn_id' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_payment_txn_id',\r\n 'label' => 'Paypal txn id',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n \r\n\r\n 'order_transaction_message' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_transaction_message',\r\n 'label' => 'Paypal txn id',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n\r\n 'order_paypal_payer_email' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_payer_email',\r\n 'label' => 'Paypal Payer email id',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_paypal_ipn_track_id' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_paypal_ipn_track_id',\r\n 'label' => 'Paypal <br/>Invoice ID',//'Paypal Payer IPN id',\r\n 'type' => 'hidden',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_payment_post' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_payment_post',\r\n 'label' => 'Paypal payment post',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n\r\n\r\n\r\n\r\n 'order_accesstoken' => array( //For amazon\r\n 'table' => $this->_table,\r\n 'name' => 'order_accesstoken',\r\n 'label' => 'Access token',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n // order amount breakup\r\n\r\n 'order_downpayment' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_downpayment',\r\n 'label' => 'Payment 1',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n\r\n 'order_downpayment_date' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_downpayment_date',\r\n 'label' => 'Downpayment Payment ',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n 'order_remaining_payment' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_remaining_payment',\r\n 'label' => 'Payment 2',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n 'order_partialpayment_date' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_partialpayment_date',\r\n 'label' => 'Partial Payment Date ',\r\n 'type' => 'none',\r\n 'attributes' => array(),\r\n 'js_rules' => '',\r\n 'rules' => 'trim|htmlentities'\r\n ),\r\n\r\n\r\n // 'order_status' => array(\r\n // 'table' => $this->_table,\r\n // 'name' => 'order_status',\r\n // 'label' => 'Order status?',\r\n // 'type' => 'switch',\r\n // 'type_dt' => 'dropdown',\r\n // 'type_filter_dt' => 'dropdown',\r\n // 'list_data_key' => \"order_status\" ,\r\n // 'list_data' => array(),\r\n // 'default' => '1',\r\n // 'attributes' => array(),\r\n // 'dt_attributes' => array(\"width\"=>\"7%\"),\r\n // 'rules' => 'trim'\r\n // ),\r\n\r\n\r\n 'order_admin_note' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_admin_note',\r\n 'label' => 'Admin Note',\r\n 'type' => 'text',\r\n // 'type_dt' => 'dropdown',\r\n // 'type_filter_dt' => 'dropdown',\r\n // 'list_data_key' => \"order_status\" ,\r\n // 'list_data' => array(),\r\n // 'default' => '1',\r\n 'attributes' => array(),\r\n 'dt_attributes' => array(\"width\"=>\"7%\"),\r\n 'rules' => 'trim'\r\n ),\r\n\r\n\r\n\r\n 'order_identity' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_identity',\r\n 'label' => 'Order Identity',\r\n 'type' => 'text',\r\n // 'type_dt' => 'dropdown',\r\n // 'type_filter_dt' => 'dropdown',\r\n // 'list_data_key' => \"order_status\" ,\r\n // 'list_data' => array(),\r\n // 'default' => '1',\r\n 'attributes' => array(),\r\n 'dt_attributes' => array(\"width\"=>\"7%\"),\r\n 'rules' => 'trim'\r\n ),\r\n\r\n 'order_status' => array(\r\n 'table' => $this->_table,\r\n 'name' => 'order_status',\r\n 'label' => 'Order Activity',\r\n 'type' => 'dropdown',\r\n 'list_data' => array(\r\n 0 => \"New Order\",\r\n 3 => \"New Order(without payment)\",\r\n 1 => \"Shipped\",\r\n ) ,\r\n 'attributes' => array(),\r\n // 'js_rules' => 'required',\r\n // 'rules' => 'required',\r\n ),\r\n\r\n \r\n );\r\n \r\n if($specific_field)\r\n return $fields[ $specific_field ];\r\n else\r\n return $fields;\r\n }", "function makeFields() {\n\t\t$table_fields = '';\n\t\t$entry = '';\n\t\t$pwFieldName = '';\n\t\t$dateFieldName = '';\n\t\t$theUpfieldName = '';\n\t\t$upFieldName = array();\n\t\t$formFieldValue = array();\n\t\t$selectedValues = array();\n\t\t$postvar = array();\n\t\t$form_array = $this->inputArray;\n\t\twhile ($formArray = each($form_array)) {\n\t\t\t$fieldset = $formArray['key'];\n\t\t\twhile ($formConf = each($form_array[$fieldset])) {\n\t\t\t\t$label = $formConf['key'];\n\t\t\t\twhile ($config = each($form_array[$fieldset][$label])) {\n\t\t\t\t\t$thetype = $config['key'];\n\t\t\t\t\t$thevalue = $config['value'];\n\t\t\t\t\t$i = 0;\n\t\t\t\t\twhile ($type = each($form_array[$fieldset][$label][$thetype])) { // 4th while\n\t\t\t\t\t\t$nameFields = $type['key'];\n\t\t\t\t\t\t$formFields = $type['value'];\n\t\t\t\t\t\t$inputKey = $this->array_key_check($form_array[$fieldset][$label], 'input');\n\t\t\t\t\t\t$selectKey = $this->array_key_check($form_array[$fieldset][$label], 'select');\n\t\t\t\t\t\t$textareKey = $this->array_key_check($form_array[$fieldset][$label], 'textarea');\n\t\t\t\t\t\t$typeKey = $this->array_key_check($form_array[$fieldset][$label][$thetype], 'type');\n\t\t\t\t\t\t$nameKey = $this->array_key_check($form_array[$fieldset][$label][$thetype], 'name');\n\t\t\t\t\t\t// avoid 'undefined indexes' errors\n\t\t\t\t\t\tif (!$_POST) $checkPostVar = FALSE;\n\t\t\t\t\t\telse $checkPostVar = TRUE;\t\n\t\t\t\t\t\tif (!$_FILES) $checkFilesVar = FALSE;\n\t\t\t\t\t\telse $checkFilesVar = TRUE;\t\t\t\t\t\n\t\t\t\t\t\tif ($inputKey) { // <input ...\tkey 'submit' replace by variable\n\t\t\t\t\t\t\tif ($typeKey) { // <input type ...\n\t\t\t\t\t\t\t\tif ($formFields === 'submit') { // <input type=\"submit\" ...\n\t\t\t\t\t\t\t\t\t// create no db table field for submit buttons within fieldsets\n\t\t\t\t\t\t\t\t\t$table_fields .= '';\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} elseif ($formFields === 'password') { // <input type=\"password\" ...\n\t\t\t\t\t\t\t\t\t// get name of password field\n\t\t\t\t\t\t\t\t\t$pwFieldName = $form_array[$fieldset][$label][$thetype]['name'];\n\t\t\t\t\t\t\t\t} elseif ($formFields === 'date' OR $formFields === 'time' OR $formFields === 'datetime' OR $formFields === 'datetime-local') { // <input type=\"date/datetaime/...\" ...\n\t\t\t\t\t\t\t\t\t// get name of date field\n\t\t\t\t\t\t\t\t\t$dateFieldName = $form_array[$fieldset][$label][$thetype]['name'];\n\t\t\t\t\t\t\t\t} elseif ($formFields === 'file') { // <input type=\"file\" ...\n\t\t\t\t\t\t\t\t\t// get names of upload fields\n\t\t\t\t\t\t\t\t\t$theUpfieldName = $form_array[$fieldset][$label][$thetype]['name'];\n\t\t\t\t\t\t\t\t\t$upFieldName[$theUpfieldName] = $theUpfieldName;\n\t\t\t\t\t\t\t\t\t//echo \"<pre>\". print_r($upFieldName) .\"</pre>\";\n\t\t\t\t\t\t\t\t} elseif ($nameFields === 'name') { // <input type=\"text/radio/checkbox/number/range/date/time\" ... else?\n\t\t\t\t\t\t\t\t\t// get values from name fields only\n\t\t\t\t\t\t\t\t\tif ($form_array[$fieldset][$label][$thetype]['name'] === $pwFieldName){\n\t\t\t\t\t\t\t\t\t\t//echo \"<br>\".$formFields.\"<br>\";\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\t$formFieldValue[$pwFieldName] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t\t$passwd = addslashes(htmlspecialchars($_POST[$formFields])); //$_POST[$pwFieldName];\n\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = crypt($passwd,$this->salt);\n\t\t\t\t\t\t\t\t\t} elseif ($form_array[$fieldset][$label][$thetype]['name'] === $dateFieldName) {\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\t\t\t$formFieldValue[$dateFieldName] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t\t\t$dateTime = addslashes(htmlspecialchars($_POST[$formFields])); //$_POST[$datetFieldName];\n\t\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = strtotime($dateTime);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} elseif ($form_array[$fieldset][$label][$thetype]['name'] === $theUpfieldName) {\n\t\t\t\t\t\t\t\t\t\t//echo \"<br>\".$formFields.\"<br>\";\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\tif ($checkFilesVar) {\n\t\t\t\t\t\t\t\t\t\t\t$formFieldValue[$theUpfieldName] = $_FILES[$theUpfieldName]['name'];\n\t\t\t\t\t\t\t\t\t\t\t//if ($this->array_key_check($_POST, $formFields)) {\n\t\t\t\t\t\t\t\t\t\t\t$file = $_FILES[$theUpfieldName]['name'];\n\t\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = addslashes(htmlspecialchars($file));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \"; // create db table field\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\t\t$formFieldValue[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\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} elseif ($nameFields === '@#db') {\n\t\t\t\t\t\t\t\t\t$table_fields .= \" $formFields,\"; // needed to create db table only\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t$table_fields .= ''; // all other fields \\neq 'name' of <input type=\"text/radio/chechbox\" ... else?\n\t\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} elseif ($typeKey === 'file') { // needed or not? !$typeKey === 'file'\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} else { // <input .... without any type declaration\n\t\t\t\t\t\t\t\t// do nothing\n\t\t\t\t\t\t\t\t$table_fields .= '';\n\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} elseif ($textareKey) { // <select ... OR <textarea ...\n\t\t\t\t\t\t\tif ($nameFields === 'name') {\n\t\t\t\t\t\t\t\t// get values from name fields only\n\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \"; // create db table field\n\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\t$formFieldValue[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t$postvar[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} elseif ($nameFields === '@#db') {\n\t\t\t\t\t\t\t\t$table_fields .= \" $formFields,\"; // needed to create db table only\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t$table_fields .= ''; // all other fields \\neq 'name' of <input type=\"text/radio/chechbox\" ... else?\n\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} elseif ($selectKey) {\n\t\t\t\t\t\t\t$selectedVal = '';\n\t\t\t\t\t\t\tif ($nameFields === 'name') {\n\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \";\n\t\t\t\t\t\t\t\t// need to get the selected values from form fields like 'select' with optgroup\n\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\tif (is_array($_POST[$formFields])) { // i.e 'name' is an array\n\t\t\t\t\t\t\t\t\t\tforeach ($_POST[$formFields] as $key => $value) {\n\t\t\t\t\t\t\t\t\t\t\t$selectedVal .= addslashes(htmlspecialchars($value)).\"| \";\n\t\t\t\t\t\t\t\t\t\t\t$_POST[$formFields][$key] = addslashes(htmlspecialchars($value));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t$selectedVal = $this->truncateReturn($selectedVal, 2);\n\t\t\t\t\t\t\t\t\t\t$selectedValues[$formFields][] = $selectedVal;\n\t\t\t\t\t\t\t\t\t} else {\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$selectedVal = addslashes(htmlspecialchars($formFields));\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\t$formFieldValue[$formFields] = $_POST[$formFields];\n\t\t\t\t\t\t\t\t\t$postvar[$formFields] = $selectedVal;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} elseif ($nameFields === '@#db') {\n\t\t\t\t\t\t\t\t$table_fields .= \" $formFields,\"; // needed to create db table only\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t$table_fields .= ''; // all other fields \\neq 'name' of <input type=\"text/radio/chechbox\" ... else?\n\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} // end 4th while\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$tableInfo = array();\n\t\t$tableInfo[0] = $table_fields; // create table fields with type property\n\t\t$tableInfo[1] = $entry; // for queries of table like INSERT ... Values ($entry\n\t\t$tableInfo[2] = $formFieldValue; // to be put into value field of the form itself\n\t\t$tableInfo[3] = $selectedValues; // holds all selected values from 'checkbox' or 'select' fields, key is the name\n\t\t$tableInfo[4] = $postvar; // entire $_POST array where keys are the form field's names\n\t\t$tableInfo[5] = $upFieldName; // upload fields\n\t\treturn $tableInfo;\n\t}", "public function testTableWithBlankValue()\n {\n $this->expectException(InvalidArgumentException::class);\n $this->createField()->setTable('');\n }", "public function testTable()\n {\n $obj = $this->createField();\n\n /** 1. Default Value */\n $this->assertNull($obj->table());\n\n /** 2. Mutated Value */\n $that = $obj->setTable('foobar');\n $this->assertInternalType('string', $obj->table());\n $this->assertEquals('foobar', $obj->table());\n\n /** 3. Chainable */\n $this->assertSame($obj, $that);\n\n /** 4. Accepts NULL */\n $obj->setTable(null);\n $this->assertNull($obj->table());\n }" ]
[ "0.6000241", "0.5960706", "0.5770938", "0.57290626", "0.562005", "0.5595333", "0.5591002", "0.5517082", "0.55120194", "0.5502003", "0.54947037", "0.54066527", "0.54051274", "0.53738546", "0.53401953", "0.5328165", "0.5320347", "0.531765", "0.531721", "0.5301924", "0.5295414", "0.5293092", "0.5265803", "0.52407354", "0.52375644", "0.52305347", "0.52024823", "0.5197042", "0.51936597", "0.5191143" ]
0.6128674
0
Validates structure and consistency of each element of tables.json Checks for name, label in all tables Checks for order, id_field, preview in non plugin tables If preview is set, it must be an array If preview is set, they must be valid fields Plugin tables must exist Links: other_tb must exist Links: my must be valid fields Links: other must be valid fields
private static function tablesStructure($t, $path2cfg, $echo = false){ // name if(!$t['name']){ throw new \Exception("Required key `name` in tables.json is missing"); } u::echo("Checking {$t['name']}", $echo); $stripped_table = \preg_replace('/([a-z]+)__/', '', $t['name']); // label if(!$t['label']){ throw new \Exception("Required key `label` in tables.json ({$t['name']}) is missing"); } // order (non plugin tables) if(!@$t['is_plugin'] && !$t['order']){ throw new \Exception("Required key `order` in tables.json ({$t['name']}) is missing"); } // plugin tables finishes here! if(@$t['is_plugin']){ u::echo(" Plugin table {$t['name']}: OK", $echo); return true; } // id_field (non plugin tables) if(!$t['id_field']){ throw new \Exception("Required key `id_field` in tables.json ({$t['name']}) is missing"); } // If preview is set, it must be an array if( !$t['preview'] || !is_array($t['preview']) ){ throw new \Exception("Required key `preview` in tables.json ({$t['name']}) is missing"); } // If preview is set, they must be valid fields foreach ($t['preview'] as $p) { if (!self::tbHasfld($path2cfg, $stripped_table, $p)){ throw new \Exception("Preview field {$p} of table {$t['name']} reported in tables.json was not found in fields list in {$stripped_table}.json"); } } // Plugin tables must exist if (@$t['plugin']){ if (!is_array($t['plugin'])){ throw new \Exception("Plugin tablelist of table {$t['name']} reported in tables.json is not a valid list"); } foreach ($t['plugin'] as $p) { $clean_p = \preg_replace('/([a-z]+)__/', '', $p); if(!u::fileExists("{$path2cfg}/{$clean_p}.json")){ throw new \Exception("Missing configuration file {$path2cfg}/{$clean_p}.json required in tables.json"); } } } // foreach link if (@$t['link']){ if (!is_array($t['link'])){ throw new \Exception("Error in link formatting for table {$t['name']} in tables.json"); } foreach ($t['link'] as $l) { // other_tb must exist if (!$l['other_tb']){ throw new \Exception("Missing index other_tb for link in table {$t['name']} in tables.json"); } if (!$l['fld'] || !is_array($l['fld'])){ throw new \Exception("Missing or not valid index fld for link in table {$t['name']} in tables.json"); } $ltb = preg_replace('/([a-z]+)__/', '', $l['other_tb']); if(!u::fileExists("{$path2cfg}/{$ltb}.json")){ throw new \Exception("Missing configuration file {$path2cfg}/{$ltb}.json required in tables.json"); } // foreach fld foreach ($l['fld'] as $fld) { // my must exist, if(!self::tbHasfld($path2cfg, $stripped_table, $fld['my'])){ throw new \Exception("Table {$stripped_table} does not have a field named {$fld['my']} as stated in links in tables.json"); } // other must exist if(!self::tbHasfld($path2cfg, $ltb, $fld['other'])){ throw new \Exception("Table {$ltb} does not have a field named {$fld['other']} as stated in links in tables.json"); } } } } // backlinks must be valid if (@$t['backlinks']){ if (!is_array($t['backlinks'])){ throw new \Exception("Backlinks are not well formatted for table {$t['name']} in tables.json"); } foreach ($t['backlinks'] as $bl) { $p = explode(':', $bl); if(!u::fileExists($path2cfg. '/' . preg_replace('/([a-z]+)__/', '', $p[0]) . '.json' )){ throw new \Exception("Missing configuration file for table {$p[0]} reported in backlinks of table {$t['name']} in tables.config"); } if(!u::fileExists($path2cfg. '/' . preg_replace('/([a-z]+)__/', '', $p[1]) . '.json' )){ throw new \Exception("Missing configuration file for table {$p[1]} reported in backlinks of table {$t['name']} in tables.config"); } if (!self::tbHasfld( $path2cfg, preg_replace('/([a-z]+)__/', '', $p[1]), $p[2]) ) { throw new \Exception("table {$p[1]} does not have a field named {$p[2]} as reported in backlinks of table {$t['name']} in tables.config"); } } } u::echo(" Table {$t['name']}: OK", $echo); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function readSchema() {\n\t\t$sSchemaFile = '../config/schema.json';\n\t\tif (file_exists($sSchemaFile)) {\n\t\t\t$this->tables = json_decode(file_get_contents($sSchemaFile), TRUE);\n\t\t}\n\t\t$this->tables['generic'] = array(\n\t\t\t'text' => array(\n\t\t\t\t'filter' => '/<*?[^<>]*?>/', // Since didn't make negative=true, will filter but won't give error\n\t\t\t\t'description' => 'no html entities',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'textarea',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'html' => array(\n\t\t\t\t'filter' => '/<script*?[^<>]*?>/',\n\t\t\t\t'negative' => false,\n\t\t\t\t'description' => 'no scripting allowed',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'textarea',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'integer' => array(\n\t\t\t\t'filter' => '/[^\\d]/',\n\t\t\t\t'description' => 'integers only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 100,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'boolean' => array(\n\t\t\t\t'filter' => '/([01])/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => '0 or 1 only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 1,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'checkbox',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'money' => array(\n\t\t\t\t'filter' => '/^([\\-]{0,1})[0-9]+(\\.[0-9]{0,2})?$/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'decimal numbers only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'decimal' => array(\n\t\t\t\t'filter' => '/^([\\-]{0,1})[0-9]+(\\.[0-9])?$/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'decimal numbers only',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'alphanumeric' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9]/',\n\t\t\t\t'description' => 'letters and numbers only',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'extended' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9_\\-\\.]/',\n\t\t\t\t'description' => 'letters, numbers, and _-. only',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'alpha' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z]/',\n\t\t\t\t'description' => 'letters only',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10000,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'date' => array(\n\t\t\t\t'filter' => '/([0-9]{4}\\/(0[1-9]|1[012])\\/(0[1-9]|[12][0-9]|3[01]))/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'YYYY/MM/DD',\n\t\t\t\t'min_length' => 10,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Date',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'name' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9\\s_\\-\\.\\,\\!]/',\n\t\t\t\t'description' => 'letters, numbers, whitespace, and _-.,! only',\n\t\t\t\t'min_length' => 2,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Title',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'email' => array(\n\t\t\t\t'filter' => '/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,25}){0,1}$/', // Allows emails to be blank as long as min_length is overridden\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => '[email protected]',\n\t\t\t\t'min_length' => 8,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Email address',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'telephone' => array(\n\t\t\t\t'filter' => '/[^0-9]/',\n\t\t\t\t'description' => 'phone number, numbers only, no dashes or spaces',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 20,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Telephone number',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'ip' => array(\n\t\t\t\t'filter' => '/(\\d{1,3}\\.){3}\\d{1,3}/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'xxx.xxx.xxx.xxx',\n\t\t\t\t'min_length' => 7,\n\t\t\t\t'max_length' => 15,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'IP address',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'mac' => array(\n\t\t\t\t'filter' => '/([0-9a-fA-F]{2}[:]){5}([0-9a-fA-F]{2})/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'xx:xx:xx:xx:xx',\n\t\t\t\t'min_length' => 17,\n\t\t\t\t'max_length' => 17,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'MAC address',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'filename' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9_:\\?\\=\\&\\@\\[\\]\\.\\-\\ ]/i',\n\t\t\t\t'description' => 'valid filename, e.g. SomeFile_12345.images.zip',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 500,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Filename',\n\t\t\t\t\t'type' => 'file',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'url' => array(\n\t\t\t\t'filter' => '/[^a-zA-Z0-9_:\\?\\=\\&\\@\\[\\]\\/\\.\\-\\ ]/i',\n\t\t\t\t'description' => 'valid url, e.g. http://www.example.com/page.html',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 500,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'URL',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'utime' => array(\n\t\t\t\t'filter' => '/[^\\d]/',\n\t\t\t\t'description' => 'integer unix timestamp',\n\t\t\t\t'min_length' => 1,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Unix timestamp',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'counter' => array(\n\t\t\t\t'filter' => '/[^\\d]/',\n\t\t\t\t'description' => 'integer',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 10,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'hex' => array(\n\t\t\t\t'filter' => '/[^a-f0-9]/',\n\t\t\t\t'description' => 'hexadecimal string',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'timezone' => array(\n\t\t\t\t'filter' => '/([a-zA-Z0-9]*)\\/([a-zA-Z0-9\\_]*)/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'timezone identifier',\n\t\t\t\t'min_length' => 10,\n\t\t\t\t'max_length' => 50,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Timezone',\n\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t'America/New_York' => 'EDT (Eastern/New York)',\n\t\t\t\t\t\t'America/Chicago' => 'CDT (Central/Chicago)',\n\t\t\t\t\t\t'America/Boise'\t => 'MDT (Mountain/Boise)',\n\t\t\t\t\t\t'America/Phoenix' => 'MST (Arizona/Pheonix)',\n\t\t\t\t\t\t'America/Los_Angeles' => 'PDT (Pacific/Los Angeles)',\n\t\t\t\t\t\t'America/Juneau' => 'AKDT (Alaska/Juneau)',\n\t\t\t\t\t\t'Pacific/Honolulu' => 'HST (Hawaii/Honolulu)',\n\t\t\t\t\t\t'Pacific/Guam' => 'ChST (Chamorro/Guam)',\n\t\t\t\t\t\t'Pacific/Samoa' => 'SST (Swedish Summer/Samoa)',\n\t\t\t\t\t\t'Pacific/Wake' => 'WAKT (Wake Time/Wake)',\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t\t'tag' => array(\n\t\t\t\t'filter' => '/[^0-9a-f]/',\n\t\t\t\t'description' => 'ID',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 30,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'Tags',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t\t'color' => array(\n\t\t\t\t'filter' => '/([0-9a-f]{3}){1,2}/',\n\t\t\t\t'negative' => true,\n\t\t\t\t'description' => 'rgb hex color',\n\t\t\t\t'min_length' => 0,\n\t\t\t\t'max_length' => 6,\n\t\t\t\t'input' => array(\n\t\t\t\t\t'label' => 'RGB color',\n\t\t\t\t\t'type' => 'text',\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t}", "function db_models_validate() {\r\n global $tables;\r\n foreach($tables as $tablename=>$table) {\r\n ln(\"table:\".$tablename);\r\n ln_inc(); \r\n foreach($table[\"fields\"] as $field) {\r\n //ln($field);\r\n //ln(\"running query\");\r\n $res = db_query(\"SELECT $field FROM $tablename LIMIT 1\");\r\n }\r\n ln_dec(); \r\n }\r\n}", "private function validateTables(FormStateInterface $form_state) {\n $tablesMergedRows = [];\n $tablesFirstNLastNotBlank = [];\n $filteredTables = [];\n $values = $form_state->getValues()['tables_container'];\n\n foreach ($values as $table_key => $table) {\n $tablesMergedRows[$table_key] = [];\n for ($blankRow = count($table['table_year']); (count(array_flip($table['table_year'][$blankRow])) === 1\n && end($table['table_year'][$blankRow]) === \"\") && $blankRow > 0; $blankRow--) {\n unset($table['table_year'][$blankRow]);\n }\n\n if (empty($table['table_year'])) {\n return FALSE;\n }\n\n foreach ($table['table_year'] as $row) {\n $tablesMergedRows[$table_key] = array_merge($tablesMergedRows[$table_key], array_values($row));\n }\n\n $filteredTables[$table_key] = array_filter($tablesMergedRows[$table_key], function ($item) {\n return $item !== \"\";\n });\n\n }\n\n foreach ($tablesMergedRows as $table_key => $table) {\n $arr_length = count($table);\n\n for ($firstNotBlank = 0; $firstNotBlank < $arr_length && $table[$firstNotBlank] === \"\"; $firstNotBlank++);\n for ($lastNotBlank = $arr_length - 1; $lastNotBlank >= 0 && $table[$lastNotBlank] === \"\"; $lastNotBlank--);\n\n $tablesFirstNLastNotBlank[$table_key]['first'] = $firstNotBlank == $arr_length ? NULL : $firstNotBlank;\n $tablesFirstNLastNotBlank[$table_key]['last'] = $lastNotBlank == -1 ? NULL : $lastNotBlank;\n\n if ((array_key_last($filteredTables[$table_key]) - array_key_first($filteredTables[$table_key]) + 1) != count($filteredTables[$table_key])) {\n return FALSE;\n }\n\n if ((count($tablesMergedRows[1]) != count($tablesMergedRows[$table_key]))\n || ($tablesFirstNLastNotBlank[1]['first'] != $tablesFirstNLastNotBlank[$table_key]['first'])\n || ($tablesFirstNLastNotBlank[1]['last'] != $tablesFirstNLastNotBlank[$table_key]['last'])) {\n return FALSE;\n }\n }\n return TRUE;\n }", "public function testTableStructure()\n {\n $model = $this->getNewModel();\n $describeInfoList = App::getInstance()\n ->getDb()\n ->execute(\n sprintf(\n 'DESCRIBE %s',\n $model->getTableName()\n )\n )\n ->fetchAll();\n $fields = $model->get();\n foreach ($describeInfoList as $describeInfo) {\n $this->assertTrue(\n array_key_exists($describeInfo['Field'], $fields),\n sprintf(\n 'Unable to find property [%s] for model [%s]',\n $describeInfo['Field'],\n get_class($model)\n )\n );\n }\n\n $modelInfoList = $model->getFieldsInfo();\n foreach ($modelInfoList as $modelField => $modelInfo) {\n $describeKey = null;\n foreach ($describeInfoList as $key => $describeInfo) {\n if ($modelField === $describeInfo['Field']) {\n $describeKey = $key;\n break;\n }\n }\n\n $this->assertNotNull(\n $describeKey,\n sprintf(\n 'Unable to find field [%s] from table [%s]',\n $modelField,\n $model->getTableName()\n )\n );\n\n $describeRow = $describeInfoList[$describeKey];\n\n $hasKey = array_key_exists(\n AbstractModel::FIELD_ALLOW_NULL,\n $modelInfo\n );\n\n if ($hasKey === true) {\n $this->assertSame(\n 'YES',\n $describeRow['Null'],\n sprintf(\n 'The value of column [%s] from table [%s] can be NULL',\n $modelField,\n $model->getTableName()\n )\n );\n }\n\n if ($hasKey === false) {\n $this->assertSame(\n 'NO',\n $describeRow['Null'],\n sprintf(\n 'The value of column [%s] from ' .\n 'table [%s] can not be NULL',\n $modelField,\n $model->getTableName()\n )\n );\n }\n\n $this->_checkDbFieldTypes($describeRow, $modelInfo, $model);\n $this->_checkDbForeignKeys($modelField, $modelInfo, $model);\n }\n }", "public function installTables()\n {\n $db = db_init();\n $log = start_install_log(\"installTables\");\n\n if (DBtype === \"psql\")\n $tablefile = \"tables_p.json\";\n else\n $tablefile = \"tables.json\";\n\n if (! $tables_json = file_get_contents($this->src_path . $tablefile))\n return false;\n\n $tables_obj = json_decode($tables_json);\n\n foreach ($tables_obj->tables as $table) {\n // var_dump($table);\n $name = key($table);\n\n if (is_array($table->primary_key))\n $pk = $table->primary_key ? \", PRIMARY KEY (\" . implode(\",\", $table->primary_key) . \")\" : null;\n else\n $pk = $table->primary_key ? \", PRIMARY KEY (\" . $table->primary_key . \")\" : null;\n\n if (is_array($table->unique_key))\n $uk = $table->unique_key ? \", UNIQUE (\" . implode(\",\", $table->unique_key) . \")\" : null;\n else\n $uk = $table->unique_key ? \", UNIQUE (\" . $table->unique_key . \")\" : null;\n\n $tbl_qry = \"CREATE TABLE IF NOT EXISTS \" . key($table) . \" (\";\n foreach ($table->$name as $field) {\n // var_dump($field);\n $default = $field->default ? \"DEFAULT $field->default\" : NULL;\n $null = $field->null ? NULL : \"NOT NULL\";\n $autoinc = $field->autoinc ? \"AUTO_INCREMENT\" : NULL;\n // make types PSQL compatible!!\n $field_def[] = \"$field->name $field->type $null $default $autoinc\";\n }\n $tbl_qry .= implode(\",\", $field_def);\n $tbl_qry .= \" $pk $uk);\";\n\n echo '<div class=\"install_message';\n if ($db->query($tbl_qry)) {\n echo ' success\">Installiere ' . $name;\n } else {\n echo ' fail\">';\n echo \"<p>Data base error! Could not install table $name.</p><p>\" . $db->error . \"</p></div>\";\n $log->write(\"Data base error: \" . $db->error, LOG_ERROR);\n return false;\n }\n echo \"</div>\";\n\n unset($field_def);\n // fill table with default values\n if ($prefill = $table->prefill) {\n $number_of_fills = 1;\n foreach ($prefill as $pf) {\n $f[] = $pf->field;\n if (is_array($pf->value)) {\n $number_of_fills = count($pf->value);\n for ($i = 0; $i < $number_of_fills; $i ++) {\n $v[$i][] = $pf->value[$i];\n }\n } else\n $v[] = $pf->value;\n }\n if ($number_of_fills > 1) {\n for ($i = 0; $i < $number_of_fills; $i ++)\n $prefill_qry[] = \"INSERT INTO $name (\" . implode(\",\", $f) . \") VALUES (\" . implode(\",\", $v[$i]) . \");\";\n } else\n $prefill_qry[] = \"INSERT INTO $name (\" . implode(\",\", $f) . \") VALUES (\" . implode(\",\", $v) . \");\";\n\n echo '<div class=\"install_message';\n for ($p = 0; $p < $number_of_fills; $p ++) {\n if (! $db->query($prefill_qry[$p])) {\n echo ' fail\">';\n echo \"<p>Data base error! Could not insert default values into table $name.</p></div>\";\n $log->write(\"Data base error: \" . $db->error, LOG_ERROR);\n return false;\n }\n }\n echo ' success\">Default values inserted.</div>';\n\n unset($f, $v, $prefill_qry);\n }\n }\n $log->write(\"Tables of $this->module installed\", LOG_INFO);\n return true;\n }", "private function oneTableStructure($t, $path2cfg, $echo = false){\n u::echo(\"Checking configuration for {$t}\", $echo);\n\n $t = preg_replace('/([a-z]+)__/', '', $t);\n if ($t === 'files' || $t === 'geodata'){\n return;\n }\n $table_array = u::getJson(\"{$path2cfg}/{$t}.json\");\n\n foreach ($table_array as $e) {\n\n // Checks for name, label, type\n foreach (['name', 'label', 'type'] as $k) {\n if (!$e[$k]){\n throw new \\Exception(\"Missing required index {$k} for {$path2cfg}/{$t}.json\");\n }\n }\n\n // Checks if type is one of: text, date, long_text, select, combo_select, multi_select, boolean, slider\n if (!in_array($e['type'], ['text', 'date', 'long_text', 'select', 'combo_select', 'multi_select', 'boolean', 'slider'])){\n throw new \\Exception(\"Invalid type {$e['type']} for {$t}.{$e['name']}\");\n }\n\n // Checks if select, combo_select, multi_select have a dictionary\n if (\n in_array($e['type'], ['select', 'combo_select', 'multi_select'])\n &&\n (\n !@$e['vocabulary_set'] &&\n !@$e['get_values_from_tb'] &&\n !@$e['id_from_tb']\n )\n ){\n if ($e['multi_select'] && !$e['vocabulary_set'])\n throw new \\Exception(\"Type {$e['type']} of {$t}.{$e['name']} is missing a dictionary\");\n }\n\n // Checks if check is one or more of: int, email, no_dupl, not_empty, range, regex\n if (@$e['check']){\n if (!is_array($e['check'])) {\n throw new \\Exception(\"Some check is active on {$t}.{$e['name']} but is is not an array\");\n }\n foreach ($e['check'] as $c) {\n if (!in_array($c, ['int', 'email', 'no_dupl', 'not_empty', 'range', 'regex'])){\n throw new \\Exception(\"Invalid check type {$c} on {$t}.{$e['name']}\");\n }\n }\n\n // Checks if check is has check regex and has pattern\n if (in_array('regex', $e['check']) && !@$e['pattern']){\n throw new \\Exception(\"Field {$t}.{$e['name']} has a regex check rule, but no pattern is defined\");\n }\n }\n\n // Checks if get_values_from_tb point to valid data\n if (@$e['get_values_from_tb']) {\n $p = explode(':', $e['get_values_from_tb']);\n $p[0] = preg_replace('/([a-z]+)__/', '', $p[0]);\n if (!u::fileExists(\"{$path2cfg}/{$p[0]}.json\")){\n throw new \\Exception(\"Missing configuration file {$path2cfg}/{$p[0]}.json for table mentioned in {$t}.{$e['name']} get_values_from_tb value\");\n }\n\n if (!self::tbHasfld($path2cfg, $p[0], $p[1])){\n throw new \\Exception(\"Table {$p[0]} does not have a field {$p[1]} as mentioned in {$t}.{$e['name']} get_values_from_tb value\");\n }\n }\n }\n\n u::echo(\" Configuration for {$t}: OK\", $echo);\n\n }", "private function createDocumentFieldsTables()\n {\n // Text types\n $this->createDocumentFieldsTable(Types::TEXT, 'text');\n $this->createDocumentFieldsTable(Types::KEYWORD, 'text');\n\n // Numeric types\n $this->createDocumentFieldsTable(TYPES::FLOAT, 'float');\n $this->createDocumentFieldsTable(TYPES::INTEGER, 'bigint');\n\n // Date types\n $this->createDocumentFieldsTable(Types::DATE, 'datetime');\n\n // Boolean types\n $this->createDocumentFieldsTable(Types::BOOLEAN, 'boolean');\n\n // Binary types\n $this->createDocumentFieldsTable(Types::BINARY, 'blob');\n }", "function getTableDefinitions($tables = array())\n {\n if (!count($tables)) {\n $tables = $this->_reader->db->manager->listTables();\n if (PEAR::isError($tables)) {\n return $tables;\n }\n }\n\n $database_definition = array(\n 'name' => '',\n 'create' => false,\n 'overwrite' => false,\n 'charset' => '',\n 'description' => '',\n 'comments' => '',\n 'tables' => array(),\n 'sequences' => array(),\n );\n\n foreach ($tables as $table_name) {\n $fields = $this->_reader->db->manager->listTableFields($table_name);\n if (PEAR::isError($fields)) {\n return $fields;\n }\n\n $database_definition['tables'][$table_name] = array(\n 'was' => '',\n 'description' => '',\n 'comments' => '',\n 'fields' => array(),\n 'indexes' => array(),\n 'constraints' => array(),\n 'initialization' => array()\n );\n\n $table_definition =& $database_definition['tables'][$table_name];\n foreach ($fields as $field_name) {\n $definition = $this->_reader->db->reverse->getTableFieldDefinition($table_name, $field_name);\n if (PEAR::isError($definition)) {\n return $definition;\n }\n\n if (!empty($definition[0]['autoincrement'])) {\n $definition[0]['default'] = '0';\n }\n $table_definition['fields'][$field_name] = $definition[0];\n $field_choices = count($definition);\n if ($field_choices > 1) {\n $warning = \"There are $field_choices type choices in the table $table_name field $field_name (#1 is the default): \";\n $field_choice_cnt = 1;\n $table_definition['fields'][$field_name]['choices'] = array();\n foreach ($definition as $field_choice) {\n $table_definition['fields'][$field_name]['choices'][] = $field_choice;\n $warning.= 'choice #'.($field_choice_cnt).': '.serialize($field_choice);\n $field_choice_cnt++;\n }\n $this->_reader->warnings[] = $warning;\n }\n }\n\n $keys = array();\n $indexes = $this->_reader->db->manager->listTableIndexes($table_name);\n if (PEAR::isError($indexes)) {\n return $indexes;\n }\n\n if (is_array($indexes)) {\n foreach ($indexes as $index_name) {\n $this->_reader->db->expectError(MDB2_ERROR_NOT_FOUND);\n $definition = $this->_reader->db->reverse->getTableIndexDefinition($table_name, $index_name);\n $this->_reader->db->popExpect();\n if (PEAR::isError($definition)) {\n if (PEAR::isError($definition, MDB2_ERROR_NOT_FOUND)) {\n continue;\n }\n return $definition;\n }\n\n $keys[$index_name] = $definition;\n }\n }\n\n $constraints = $this->_reader->db->manager->listTableConstraints($table_name);\n if (PEAR::isError($constraints)) {\n return $constraints;\n }\n\n if (is_array($constraints)) {\n foreach ($constraints as $constraint_name) {\n $this->_reader->db->expectError(MDB2_ERROR_NOT_FOUND);\n $definition = $this->_reader->db->reverse->getTableConstraintDefinition($table_name, $constraint_name);\n $this->_reader->db->popExpect();\n if (PEAR::isError($definition)) {\n if (PEAR::isError($definition, MDB2_ERROR_NOT_FOUND)) {\n continue;\n }\n return $definition;\n }\n\n $keys[$constraint_name] = $definition;\n }\n }\n\n foreach ($keys as $key_name => $definition) {\n if (array_key_exists('foreign', $definition) && $definition['foreign']) {\n foreach ($definition['fields'] as $field_name => $field) {\n $definition['fields'][$field_name] = '';\n }\n\n foreach ($definition['references']['fields'] as $field_name => $field) {\n $definition['references']['fields'][$field_name] = '';\n }\n\n $table_definition['constraints'][$key_name] = $definition;\n } else {\n foreach ($definition['fields'] as $field_name => $field) {\n $definition['fields'][$field_name] = $field;\n }\n\n $table_definition['indexes'][$key_name] = $definition;\n }\n }\n }\n\n return $database_definition;\n }", "function getValidTables(){\n $db = DB::getInstance();\n $query = $db->query(\"SHOW TABLES\")->results();\n $tables = [];\n foreach($query as $t){\n foreach($t as $q){\n $tables[] = $q;\n }\n }\n foreach($tables as $k=>$v){\n if(substr($v,-5)=='_form'){\n unset($tables[$k]);\n }\n }\n //check if there's already a form.\n //if yes, unset it\n $query = $db->query(\"SELECT form FROM us_forms\")->results();\n foreach($query as $k=>$v){\n foreach($tables as $key=>$value){\n if($v->form == $value){\n unset($tables[$key]);\n }\n }\n }\n return $tables;\n }", "function chado_validate_custom_table_schema($schema_array) {\n\n if (is_array($schema_array) and !array_key_exists('table', $schema_array)) {\n return \"The schema array must have key named 'table'\";\n }\n \n if (preg_match('/[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/', $schema_array['table'])) {\n return \"Postgres will automatically change the table name to lower-case. To prevent unwanted side-effects, please rename the table with all lower-case characters.\";\n }\n\n // Check index length.\n if (array_key_exists('indexes', $schema_array)) {\n foreach ($schema_array['indexes'] as $index_name => $details) {\n if (strlen($schema_array['table'] . '_' . $index_name) > 60) {\n return \"One ore more index names appear to be too long. For example: '\" . $schema_array['table'] . '_' . $index_name .\n \".' Index names are created by concatenating the table name with the index name provided \" .\n \"in the 'indexes' array of the schema. Please alter any indexes that when combined with the table name are \" .\n \"longer than 60 characters.\";\n }\n }\n }\n}", "private function checkForRelations($tables)\n {\n // get Model table name and table details from tables list\n $modelTableName = $this->tableName;\n $modelTable = $tables[$modelTableName];\n unset($tables[$modelTableName]);\n\n $this->relations = [];\n\n // detects many to one rules for model table\n $manyToOneRelations = $this->detectManyToOne($tables, $modelTable);\n\n if (count($manyToOneRelations) > 0) {\n $this->relations = array_merge($this->relations, $manyToOneRelations);\n }\n\n foreach ($tables as $tableName => $table) {\n $foreignKeys = $table->foreignKeys;\n $primary = $table->primaryKey;\n\n // if foreign key count is 2 then check if many to many relationship is there\n if (count($foreignKeys) == 2) {\n $manyToManyRelation = $this->isManyToMany($tables, $tableName, $modelTable, $modelTableName);\n if ($manyToManyRelation) {\n $this->relations[] = $manyToManyRelation;\n continue;\n }\n }\n\n // iterate each foreign key and check for relationship\n foreach ($foreignKeys as $foreignKey) {\n // check if foreign key is on the model table for which we are using generator command\n if ($foreignKey->foreignTable == $modelTableName) {\n\n // detect if one to one relationship is there\n $isOneToOne = $this->isOneToOne($primary, $foreignKey, $modelTable->primaryKey);\n if ($isOneToOne) {\n $modelName = model_name_from_table_name($tableName);\n $this->relations[] = GeneratorFieldRelation::parseRelation('1t1,'.$modelName);\n continue;\n }\n\n // detect if one to many relationship is there\n $isOneToMany = $this->isOneToMany($primary, $foreignKey, $modelTable->primaryKey);\n if ($isOneToMany) {\n $modelName = model_name_from_table_name($tableName);\n $this->relations[] = GeneratorFieldRelation::parseRelation('1tm,'.$modelName);\n continue;\n }\n }\n }\n }\n }", "abstract protected function validateTableObject($tableObject);", "public function table($table, $content) {\n\n if (!Type::hasType('double')) {\n Type::addType('double', FloatType::class);\n }\n \n if (!Schema::hasColumn($content->table->tablename, 'id')) {\n $table->bigIncrements('id');\n }\n if (!Schema::hasColumn($content->table->tablename, 'uuid')) {\n $table->uuid('uuid');\n }\n if (!Schema::hasColumn($content->table->tablename, 'slug')) {\n $table->string('slug')->nullable();\n }\n try {\n if ($content->table->is_authenticatable) {\n if (!Schema::hasColumn($content->table->tablename, 'email_verified_at')) {\n $table->timestamp('email_verified_at')->nullable();\n }\n if (!Schema::hasColumn($content->table->tablename, 'password')) {\n $table->string('password');\n }\n if (!Schema::hasColumn($content->table->tablename, 'remember_token')) {\n $table->rememberToken();\n }\n }\n } catch (\\Throwable $th) {\n $outputStyle = new OutputFormatterStyle('white', 'red', ['bold', 'blink']);\n $output = new ConsoleOutput();\n $output->getFormatter()->setStyle('error', $outputStyle);\n $output->writeln('<error>' . $content->table->tablename . ' is_authenticatable undefined</>');\n }\n try {\n if ($content->table->order_index) {\n if (!Schema::hasColumn($content->table->tablename, 'order_index')) {\n $table->bigInteger('order_index')->default(0);\n }\n }\n } catch (\\Throwable $th) {\n //throw $th;\n }\n foreach ($content->inputs as $inputKey => $input) {\n // saltar inputs que no son campos realmente\n $col = [];\n if($input->type == 'card-header') {\n continue;\n }\n if($input->type == 'subForm') {\n $subFolderPath = __crudFolder() . '/' . $input->tabledata . '.json';\n $subFolder = json_decode(file_get_contents($subFolderPath));\n if ( $subFolder->table->order_index != 1 ) {\n $subFolder->table->order_index = 1;\n }\n // search for subform inputs\n $i = array_filter($subFolder->inputs, function($item) use ($input) {\n return $item->columnname == $input->tablekeycolumn;\n });\n if (count($i) == 0) {\n $subFolder->inputs[] = [\n \"columnname\" => $input->tablekeycolumn,\n \"type\" => \"bigInteger\",\n \"label\" => new \\stdClass(),\n \"unique\" => 0,\n \"precision\" => 0,\n \"scale\" => 0,\n \"default\" => \"\",\n \"nullable\" => 1,\n \"validate\" => 0,\n \"max\" => \"\",\n \"min\" => \"\",\n \"tabledata\" => \"\",\n \"tablekeycolumn\" => \"\",\n \"tabletextcolumn\" => \"\",\n \"settable\" => \"3\",\n \"listable\" => 0,\n \"translatable\" => 0\n ];\n }\n file_put_contents($subFolderPath, json_encode($subFolder, JSON_PRETTY_PRINT));\n }\n $change = false;\n if (Schema::hasColumn($content->table->tablename, $input->columnname)) {\n $change = true;\n }\n if($input->type == 'text') {\n if ( @$input->translatable == 1 ) {\n $col[] = $table->json($input->columnname);\n } else {\n $col[] = $table->string($input->columnname);\n }\n }\n if($input->type == 'color') {\n $col[] = $table->string($input->columnname);\n }\n if($input->type == 'email') {\n $col[] = $table->string($input->columnname);\n }\n if($input->type == 'textarea') {\n if ( @$input->translatable == 1 ) {\n $col[] = $table->json($input->columnname);\n } else {\n $col[] = $table->longText($input->columnname);\n }\n }\n if($input->type == 'wysiwyg') {\n if ( @$input->translatable == 1 ) {\n $col[] = $table->json($input->columnname);\n } else {\n $col[] = $table->longText($input->columnname);\n }\n }\n if($input->type == 'number') {\n $col[] = $table->double($input->columnname);\n }\n if($input->type == 'decimal') {\n $col[] = $table->decimal($input->columnname, $input->precision, $input->scale);\n }\n if($input->type == 'money') {\n $col[] = $table->double($input->columnname);\n }\n if($input->type == 'checkbox') {\n $pivot_name = $content->table->tablename.'_'.$input->tabledata.'_'.$input->columnname;\n $cols = [\n $content->table->tablename.'_id',\n $input->tabledata.'_id'\n ];\n if (Schema::hasTable($pivot_name)) {\n Schema::table($pivot_name, function (Blueprint $table) use ($content, $input, $cols, $pivot_name) {\n foreach ($cols as $col) {\n if ( !Schema::hasColumn($pivot_name, $col) ) {\n $table->bigInteger($col);\n }\n }\n });\n } else {\n Schema::create($pivot_name, function (Blueprint $table) use ($content, $input, $cols) {\n foreach ($cols as $col) {\n $table->bigInteger($col);\n }\n });\n }\n }\n if($input->type == 'date') {\n $col[] = $table->date($input->columnname);\n }\n if($input->type == 'bigInteger') {\n $col[] = $table->bigInteger($input->columnname);\n }\n if($input->type == 'datetime') {\n $col[] = $table->dateTime($input->columnname);\n }\n if($input->type == 'true_or_false') {\n $col[] = $table->boolean($input->columnname);\n }\n if($input->type == 'select') {\n $col[] = $table->unsignedBigInteger($input->columnname);\n }\n if($input->type == 'select_string') {\n $col[] = $table->string($input->columnname);\n }\n if($input->type == 'multimedia_file') {\n if (Schema::hasColumn($content->table->tablename, $input->columnname)) {\n $change = false;\n } \n if (Schema::hasColumn($content->table->tablename, $input->columnname . '_id')) {\n $change = true;\n }\n $col[] = $table->unsignedBigInteger($input->columnname . '_id');\n }\n if($input->type == 'gallery') {\n $col[] = $table->unsignedBigInteger($input->columnname);\n }\n if($input->type == 'map-select-lat-lng') {\n // deber ser\n // $col[] = $table->point($input->columnname);\n // mientras\n if (Schema::hasColumn($content->table->tablename, $input->columnname . '_lat') || Schema::hasColumn($content->table->tablename, $input->columnname . '_lng')) {\n $change = true;\n }\n $col[] = $table->string($input->columnname . '_lat');\n $col[] = $table->string($input->columnname . '_lng');\n }\n\n foreach ($col as $key => $colItem) {\n $sm = Schema::getConnection()->getDoctrineSchemaManager();\n $doctrineTable = $sm->listTableDetails($content->table->tablename);\n $indexName = $content->table->tablename.'_'.$input->columnname.'_unique';\n if($input->unique == 1) {\n if ( !$doctrineTable->hasIndex($indexName) ) {\n $colItem->unique();\n }\n } else {\n if ( $doctrineTable->hasIndex($indexName) ) {\n $table->dropUnique($indexName);\n }\n }\n if($input->nullable == 1) {\n $colItem->nullable(true);\n } else {\n $colItem->nullable(false);\n }\n if($input->default != '') {\n $colItem->default($input->default);\n }\n if ($change) {\n $colItem->change();\n }\n }\n }\n if (!Schema::hasColumn($content->table->tablename, 'created_at')) {\n $table->timestamps();\n }\n if (!Schema::hasColumn($content->table->tablename, 'deleted_at')) {\n $table->softDeletes();\n }\n }", "public function valid_table_avaiable($str) {\n $this->form_validation->set_message('valid_table_avaiable','The %s is not valid.');\n $tables = $this->db->list_tables();\n\n return in_array($str, $tables);\n }", "private function existingTables() {\n\n\t\tif(empty($this->error)) :\n\n\t\t\t$this->insertSQL();\n\t\t\t$this->writeFile();\n\t\t\t$this->checkInstall();\n\n\t\tendif;\n\n\t}", "function db_source_upload_check_fields($db_id, $fields_input, $fields_db = NULL)\n {\n if (empty($fields_db)) {\n $fields_db = $this->db_fields_fetch_core($db_id)['flat_by_name'];\n }\n $return = array();\n foreach ($fields_input as $field_input) {\n if (empty($fields_db[$field_input])) {\n $return['failed'][] = $field_input;\n } else {\n $return['passed'][$fields_db[$field_input]['field_id']] = $fields_db[$field_input];\n }\n }\n return $return;\n }", "function clients_declarer_tables_objets_sql($tables){\n\n\t$tables['spip_auteurs']['field']['name'] = \"text DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['prenom'] = \"text DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['societe'] = \"text DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['adresse_1'] = \"text DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['adresse_2'] = \"text DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['adresse_bp'] = \"tinytext DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['adresse_cp'] = \"tinytext DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['adresse_ville'] = \"tinytext DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['adresse_pays'] = \"tinytext DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['tel_fixe'] = \"tinytext DEFAULT '' NOT NULL\";\n\t$tables['spip_auteurs']['field']['tel_mobile'] = \"tinytext DEFAULT '' NOT NULL\";\n\n\t$tables['spip_auteurs']['field']['dolibarr_socid'] = \"tinytext DEFAULT '' NOT NULL\";\n\n\t$tables['spip_auteurs']['champs_editables'][] = 'name';\n\t$tables['spip_auteurs']['champs_editables'][] = 'prenom';\n\t$tables['spip_auteurs']['champs_editables'][] = 'societe';\n\t$tables['spip_auteurs']['champs_editables'][] = 'adresse_1';\n\t$tables['spip_auteurs']['champs_editables'][] = 'adresse_2';\n\t$tables['spip_auteurs']['champs_editables'][] = 'adresse_bp';\n\t$tables['spip_auteurs']['champs_editables'][] = 'adresse_cp';\n\t$tables['spip_auteurs']['champs_editables'][] = 'adresse_ville';\n\t$tables['spip_auteurs']['champs_editables'][] = 'adresse_pays';\n\t$tables['spip_auteurs']['champs_editables'][] = 'tel_fixe';\n\t$tables['spip_auteurs']['champs_editables'][] = 'tel_mobile';\n\n\treturn $tables;\n}", "function get_fields($tab) {\n $fields = [\n 'Algemeen' => [\n 'Back-to-top' => [\n 'name' => 'backtotop',\n 'input' => 'checkbox'\n ],\n ],\n\n 'Typografie' => [\n 'Fonts' => [\n 'name' => 'fonts',\n 'input' => 'textarea',\n 'placeholder' => 'https://fonts.googleapis.com/css?family=Roboto&display=swap'\n ],\n ],\n\n 'Klantgegevens' => [\n 'Bedrijfsnaam' => [\n 'name' => 'bedrijfsnaam',\n 'input' => 'text'\n ],\n 'Adres' => [\n 'name' => 'adres',\n 'input' => 'text'\n ],\n 'Postcode' => [\n 'name' => 'postcode',\n 'input' => 'text'\n ],\n 'Woonplaats' => [\n 'name' => 'woonplaats',\n 'input' => 'text'\n ],\n 'Telefoon' => [\n 'name' => 'telefoon',\n 'input' => 'text'\n ],\n 'E-mail' => [\n 'name' => 'email',\n 'input' => 'text'\n ],\n ],\n\n 'Openingstijden' => [\n 'Maandag' => [\n 'name' => 'maandag',\n 'input' => 'text'\n ],\n 'Dinsdag' => [\n 'name' => 'dinsdag',\n 'input' => 'text'\n ],\n 'Woensdag' => [\n 'name' => 'woensdag',\n 'input' => 'text'\n ],\n 'Donderdag' => [\n 'name' => 'donderdag',\n 'input' => 'text'\n ],\n 'Vrijdag' => [\n 'name' => 'vrijdag',\n 'input' => 'text'\n ],\n 'Zaterdag' => [\n 'name' => 'zaterdag',\n 'input' => 'text'\n ],\n 'Zondag' => [\n 'name' => 'zondag',\n 'input' => 'text'\n ],\n\n ],\n\n 'Header opties' => [\n 'Fixed' => [\n 'name' => 'headerfixed',\n 'input' => 'checkbox'\n ],\n\n 'Full width' => [\n 'name' => 'headerfullwidth',\n 'input' => 'checkbox'\n ],\n\n 'Mobiele bottom bar' => [\n 'name' => 'headermobilebottombar',\n 'input' => 'checkbox'\n ],\n\n 'Global header' => [\n 'name' => 'headerglobal',\n 'input' => 'text'\n ],\n ],\n\n 'Footer opties' => [\n 'Full width' => [\n 'name' => 'footerfullwidth',\n 'input' => 'checkbox'\n ],\n ],\n\n 'Footer widgets' => [\n 'Blok 1' => [\n 'name' => 'footerblok1',\n 'input' => 'select',\n 'value' => [\n 'flex' => 'col',\n '1/1' => 'et_pb_column_4_4',\n '1/2' => 'et_pb_column_1_2',\n '1/3' => 'et_pb_column_1_3',\n '2/3' => 'et_pb_column_2_3',\n '1/4' => 'et_pb_column_1_4',\n '3/4' => 'et_pb_column_3_4',\n '1/5' => 'et_pb_column_1_5',\n '2/5' => 'et_pb_column_2_5',\n '3/5' => 'et_pb_column_3_5',\n '4/5' => 'et_pb_column_4_5',\n '1/6' => 'et_pb_column_1_6',\n '5/6' => 'et_pb_column_5_6',\n 'Uit' => 'off'\n ]\n ],\n\n 'Blok 2' => [\n 'name' => 'footerblok2',\n 'input' => 'select',\n 'value' => [\n 'flex' => 'col',\n '1/1' => 'et_pb_column_4_4',\n '1/2' => 'et_pb_column_1_2',\n '1/3' => 'et_pb_column_1_3',\n '2/3' => 'et_pb_column_2_3',\n '1/4' => 'et_pb_column_1_4',\n '3/4' => 'et_pb_column_3_4',\n '1/5' => 'et_pb_column_1_5',\n '2/5' => 'et_pb_column_2_5',\n '3/5' => 'et_pb_column_3_5',\n '4/5' => 'et_pb_column_4_5',\n '1/6' => 'et_pb_column_1_6',\n '5/6' => 'et_pb_column_5_6',\n 'Uit' => 'off'\n ]\n ],\n\n 'Blok 3' => [\n 'name' => 'footerblok3',\n 'input' => 'select',\n 'value' => [\n 'flex' => 'col',\n '1/1' => 'et_pb_column_4_4',\n '1/2' => 'et_pb_column_1_2',\n '1/3' => 'et_pb_column_1_3',\n '2/3' => 'et_pb_column_2_3',\n '1/4' => 'et_pb_column_1_4',\n '3/4' => 'et_pb_column_3_4',\n '1/5' => 'et_pb_column_1_5',\n '2/5' => 'et_pb_column_2_5',\n '3/5' => 'et_pb_column_3_5',\n '4/5' => 'et_pb_column_4_5',\n '1/6' => 'et_pb_column_1_6',\n '5/6' => 'et_pb_column_5_6',\n 'Uit' => 'off'\n ]\n ],\n\n 'Blok 4' => [\n 'name' => 'footerblok4',\n 'input' => 'select',\n 'value' => [\n 'flex' => 'col',\n '1/1' => 'et_pb_column_4_4',\n '1/2' => 'et_pb_column_1_2',\n '1/3' => 'et_pb_column_1_3',\n '2/3' => 'et_pb_column_2_3',\n '1/4' => 'et_pb_column_1_4',\n '3/4' => 'et_pb_column_3_4',\n '1/5' => 'et_pb_column_1_5',\n '2/5' => 'et_pb_column_2_5',\n '3/5' => 'et_pb_column_3_5',\n '4/5' => 'et_pb_column_4_5',\n '1/6' => 'et_pb_column_1_6',\n '5/6' => 'et_pb_column_5_6',\n 'Uit' => 'off'\n ]\n ],\n\n 'Blok 5' => [\n 'name' => 'footerblok5',\n 'input' => 'select',\n 'value' => [\n 'flex' => 'col',\n '1/1' => 'et_pb_column_4_4',\n '1/2' => 'et_pb_column_1_2',\n '1/3' => 'et_pb_column_1_3',\n '2/3' => 'et_pb_column_2_3',\n '1/4' => 'et_pb_column_1_4',\n '3/4' => 'et_pb_column_3_4',\n '1/5' => 'et_pb_column_1_5',\n '2/5' => 'et_pb_column_2_5',\n '3/5' => 'et_pb_column_3_5',\n '4/5' => 'et_pb_column_4_5',\n '1/6' => 'et_pb_column_1_6',\n '5/6' => 'et_pb_column_5_6',\n 'Uit' => 'off'\n ]\n ],\n ],\n\n 'Analytics' => [\n 'Header' => [\n 'name' => 'headerhtml',\n 'input' => 'textarea',\n 'placeholder' => ''\n ],\n\n 'Body' => [\n 'name' => 'bodyhtml',\n 'input' => 'textarea',\n 'placeholder' => ''\n ],\n\n 'Footer' => [\n 'name' => 'footerhtml',\n 'input' => 'textarea',\n 'placeholder' => ''\n ],\n ],\n ];\n\n echo '<div class=\"grizzly-plugin-content-block\"><h2>' . $tab . '</h2><table class=\"form-table\">';\n \n if(!get_option('grizzly_fields')) {\n foreach($fields[$tab] as $key => $value) {\n echo '<tr><th><label for=\"' . $value['name'] . '\">' . $key . '</label></th>';\n echo '<td><input type=\"' . $value['input'] . '\" name=\"' . $value['name'] . '\"></td></tr>';\n }\n } else {\n $grizzly_fields = get_option('grizzly_fields');\n $json = json_decode($grizzly_fields);\n \n foreach($fields[$tab] as $key => $value) {\n $name = $value['name'];\n\n echo '<tr><th><label for=\"' . $value['name'] . '\">' . $key . '</label></th>';\n \n // IF INPUT IS TEXT\n if($value['input'] == 'text') {\n echo '<td><input type=\"' . $value['input'] . '\" name=\"' . $value['name'] . '\" value=\"';\n \n if(!empty($json->$name)){ \n echo $json->$name;\n }\n\n echo '\">';\n }\n\n // IF INPUT IS CHECKBOX\n elseif($value['input'] == 'checkbox') {\n echo '<td><input value=\"1\" type=\"' . $value['input'] . '\" name=\"' . $value['name'] . '\"';\n \n if(!empty($json->$name)){ \n if($json->$name){ \n echo 'checked';\n }\n }\n\n echo '>';\n }\n\n // IF INPUT IS TEXTAREA\n elseif($value['input'] == 'textarea') {\n echo '<td><textarea name=\"' . $value['name'] . '\" placeholder=\"' . $value['placeholder'] . '\">';\n \n if(!empty($json->$name)){ \n echo $json->$name;\n }\n\n echo '</textarea>';\n }\n\n // IF INPUT IS SELECT\n elseif($value['input'] == 'select') {\n echo '<td><select name=\"' . $value['name'] . '\">';\n \n foreach($value['value'] as $title => $value) {\n echo '<option value=\"' . $value . '\"';\n\n if(!empty($json->$name)){ \n if($json->$name == $value) {\n echo 'selected';\n }\n }\n\n echo '>' . $title . '</option>';\n }\n echo '</select>';\n }\n \n echo '</td></tr>';\n } \n }\n \n echo '</table></div>';\n }", "public function rules()\n {\n return [\n 'table_ids' => ['required', 'array'],\n ];\n }", "function checkRequired ()\t{\n\t\t$rc = '';\n\t\t$tablesObj = GeneralUtility::makeInstance('tx_ttproducts_tables');\n\t\tif (ExtensionManagementUtility::isLoaded('static_info_tables_banks_de')) {\n\t\t\t$bankObj = $tablesObj->get('static_banks_de');\n\t\t}\n\n\t\tforeach ($this->fieldArray as $k => $field)\t{\n\t\t\tif (!$this->acArray[$field])\t{\n\t\t\t\t$rc = $field;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ($field == 'bic' && is_object($bankObj) /* && ExtensionManagementUtility::isLoaded('static_info_tables_banks_de')*/)\t{\n\t\t\t\t$where_clause = 'sort_code=' . intval(implode('',GeneralUtility::trimExplode(' ',$this->acArray[$field]))) . ' AND level=1';\n\t\t\t\t$bankRow = $bankObj->get('',0,false,$where_clause);\n\t\t\t\tif (!$bankRow)\t{\n\t\t\t\t\t$rc = $field;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $rc;\n\t}", "public function test_fields()\n {\n $list=array(\n 'dbcsv'=>\"tests/dbtest1.csv\",\n 'dbini'=>\"tests/dbtest1.ini\"\n );\n foreach($list as $type => $arg)\n {\n $db=$type($arg);\n\n $fields=array(\n 'key'=> array('type'=>\"hidden\",'desc'=>\"key value\"),\n 'fname'=> array('type'=>\"text\",'desc'=>\"First Name\"),\n 'lname'=> array('type'=>\"text\",'desc'=>\"Last Name\")\n );\n\n // set the fields\n\n $db->SetFields($fields);\n\n // get the field list back\n $fieldlist=$db->Fields();\n\n // did it get translated correctly?\n $this->assertCount(3,$fieldlist);\n $this->assertArrayHasKey(0,$fieldlist);\n $this->assertEquals('key',$fieldlist[0]);\n $this->assertArrayHasKey(1,$fieldlist);\n $this->assertEquals('fname',$fieldlist[1]);\n $this->assertArrayHasKey(2,$fieldlist);\n $this->assertEquals('lname',$fieldlist[2]);\n\n sleep(4);\n if (file_exists($arg))\n unlink($arg);\n }\n }", "public function rules()\n {\n $rules = [\n 'name' => 'required|string|max:20',\n 'display_name' => 'required|string|max:30',\n 'element' => 'sometimes|string|max:20',\n 'type' => 'sometimes|string|max:20',\n 'is_show' => 'required|integer',\n 'is_import' => 'required|integer',\n 'collect' => 'sometimes|nullable|array',\n 'belong' => 'required|integer',\n 'sort' => 'sometimes|nullable|integer'\n ];\n if ($this->method() === 'POST') {\n $rules['table_id'] = 'required|integer|exists:tables,id';\n return $rules;\n } else {\n return $rules;\n }\n }", "function test_users( $meta_boxes ) {\n if ( !class_exists( 'MB_Custom_Table_API' ) ) {\n // return early\n return $meta_boxes;\n }\n\n $meta_boxes[] = array(\n 'title' => 'Test User Table Data',\n 'id' => 'test-user-meta-box',\n 'post_types' => 'agent',\n 'context' => 'normal', // normal / advanced / side / form_top / after_title / after_editor / before_permalink\n 'priority' => 'high', // high / low\n 'storage_type' => 'custom_table', // Important\n 'table' => 'toolbox_test_users', // Your custom table name\n 'fields' => array(\n array(\n 'name' => 'Name',\n 'label_description' => 'Label Description',\n 'id' => 'name',\n 'desc' => 'Description',\n 'type' => 'text',\n\n // Cloneable (i.e. have multiple value)?\n 'clone' => false,\n\n // Placeholder\n 'placeholder' => '',\n\n // Input size\n 'size' => 30,\n\n ),\n array(\n 'name' => 'Address',\n 'label_description' => 'Label Description',\n 'id' => 'address',\n 'desc' => 'Address',\n 'type' => 'text',\n // Cloneable (i.e. have multiple value)?\n 'clone' => false,\n\n // Placeholder\n 'placeholder' => '',\n\n // Input size\n 'size' => 30,\n ),\n array(\n 'name' => 'Zip',\n 'id' => 'zip',\n 'type' => 'text',\n // Cloneable (i.e. have multiple value)?\n 'clone' => false,\n\n // Placeholder\n 'placeholder' => '',\n\n // Input size\n 'size' => 30,\n\n ),\n array(\n 'name' => 'City',\n 'id' => 'city',\n 'type' => 'text',\n\n // Cloneable (i.e. have multiple value)?\n 'clone' => false,\n\n // Placeholder\n 'placeholder' => '',\n\n // Input size\n 'size' => 30,\n\n ),\n array(\n 'name' => 'Email',\n 'id' => 'email',\n 'type' => 'text',\n\n // Cloneable (i.e. have multiple value)?\n 'clone' => false,\n\n // Placeholder\n 'placeholder' => '',\n\n // Input size\n 'size' => 30,\n\n ),\n array(\n 'name' => 'Data table',\n 'id' => 'datatable',\n 'type' => 'text',\n\n // Cloneable (i.e. have multiple value)?\n 'clone' => false,\n\n // Placeholder\n 'placeholder' => '',\n\n // Input size\n 'size' => 30,\n\n )\n\n\n )\n );\n\n return $meta_boxes;\n}", "function ValidateFields($data) {\n foreach ($data as $item) {\n if (!HasField($item)) {\n return false;\n }\n }\n return true;\n }", "private function getTables($keys)\n\t{\n\t\t$all = $own = $src = $tgt = [];\n\n\t\t$ownKey = \"`{$this->schema}`.`{$this->table}`\";\n\t\t$all[$ownKey] = ['schema' => $this->schema,\n\t\t 'table' => $this->table,\n\t\t 'type' => ['own' => 'own']];\n\n\t\t$own[$ownKey] =& $all[$ownKey];\n\n\t\tforeach ($keys as $k)\n\t\t{\n\t\t\t// Fully qualified name and entry skeleton structure\n\t\t\t$fqn1 = \"`{$k['sch1']}`.`{$k['tbl1']}`\";\n\t\t\t$fqn2 = \"`{$k['sch2']}`.`{$k['tbl2']}`\";\n\n\t\t\t$t1 = ['schema' => $k['sch1'], 'table' => $k['tbl1'], 'type' => []];\n\t\t\t$t2 = ['schema' => $k['sch2'], 'table' => $k['tbl2'], 'type' => []];\n\n\t\t\t$k['tbl1'] && !isset($all[$fqn1]) && ($all[$fqn1] = $t1);\n\t\t\t$k['tbl2'] && !isset($all[$fqn2]) && ($all[$fqn2] = $t2);\n\n\t\t\t// Add the corresponding type to each table (src or tgt)\n\t\t\tif ($k['tbl1'] && ($k['type'] == 'tgt'))\n\t\t\t{\n\t\t\t\t$src[$fqn1] =& $all[$fqn1];\n\t\t\t\t$tgt[$fqn1]['type']['tgt'] = 'tgt';\n\n\t\t\t\t// Flag main table as tgt as well\n\t\t\t\t$tgt[$ownKey] =& $all[$ownKey];\n\t\t\t\t$all[$ownKey]['type']['tgt'] = 'tgt';\n\t\t\t}\n\t\t\telseif ($k['tbl2'] && ($k['type'] == 'src'))\n\t\t\t{\n\t\t\t\t$tgt[$fqn2] =& $all[$fqn2];\n\t\t\t\t$tgt[$fqn2]['type']['src'] = 'src';\n\n\t\t\t\t// Flag main table as src as well\n\t\t\t\t$src[$ownKey] =& $all[$ownKey];\n\t\t\t\t$all[$ownKey]['type']['src'] = 'src';\n\t\t\t}\n\t\t}\n\n\t\t$ordinals = array_flip(array_keys($all));\n\n\t\t$tables = compact('all', 'own', 'src', 'tgt', 'ordinals');\n\n\t\treturn $tables;\n\t}", "function makeFields() {\n\t\t$table_fields = '';\n\t\t$entry = '';\n\t\t$pwFieldName = '';\n\t\t$dateFieldName = '';\n\t\t$theUpfieldName = '';\n\t\t$upFieldName = array();\n\t\t$formFieldValue = array();\n\t\t$selectedValues = array();\n\t\t$postvar = array();\n\t\t$form_array = $this->inputArray;\n\t\twhile ($formArray = each($form_array)) {\n\t\t\t$fieldset = $formArray['key'];\n\t\t\twhile ($formConf = each($form_array[$fieldset])) {\n\t\t\t\t$label = $formConf['key'];\n\t\t\t\twhile ($config = each($form_array[$fieldset][$label])) {\n\t\t\t\t\t$thetype = $config['key'];\n\t\t\t\t\t$thevalue = $config['value'];\n\t\t\t\t\t$i = 0;\n\t\t\t\t\twhile ($type = each($form_array[$fieldset][$label][$thetype])) { // 4th while\n\t\t\t\t\t\t$nameFields = $type['key'];\n\t\t\t\t\t\t$formFields = $type['value'];\n\t\t\t\t\t\t$inputKey = $this->array_key_check($form_array[$fieldset][$label], 'input');\n\t\t\t\t\t\t$selectKey = $this->array_key_check($form_array[$fieldset][$label], 'select');\n\t\t\t\t\t\t$textareKey = $this->array_key_check($form_array[$fieldset][$label], 'textarea');\n\t\t\t\t\t\t$typeKey = $this->array_key_check($form_array[$fieldset][$label][$thetype], 'type');\n\t\t\t\t\t\t$nameKey = $this->array_key_check($form_array[$fieldset][$label][$thetype], 'name');\n\t\t\t\t\t\t// avoid 'undefined indexes' errors\n\t\t\t\t\t\tif (!$_POST) $checkPostVar = FALSE;\n\t\t\t\t\t\telse $checkPostVar = TRUE;\t\n\t\t\t\t\t\tif (!$_FILES) $checkFilesVar = FALSE;\n\t\t\t\t\t\telse $checkFilesVar = TRUE;\t\t\t\t\t\n\t\t\t\t\t\tif ($inputKey) { // <input ...\tkey 'submit' replace by variable\n\t\t\t\t\t\t\tif ($typeKey) { // <input type ...\n\t\t\t\t\t\t\t\tif ($formFields === 'submit') { // <input type=\"submit\" ...\n\t\t\t\t\t\t\t\t\t// create no db table field for submit buttons within fieldsets\n\t\t\t\t\t\t\t\t\t$table_fields .= '';\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t} elseif ($formFields === 'password') { // <input type=\"password\" ...\n\t\t\t\t\t\t\t\t\t// get name of password field\n\t\t\t\t\t\t\t\t\t$pwFieldName = $form_array[$fieldset][$label][$thetype]['name'];\n\t\t\t\t\t\t\t\t} elseif ($formFields === 'date' OR $formFields === 'time' OR $formFields === 'datetime' OR $formFields === 'datetime-local') { // <input type=\"date/datetaime/...\" ...\n\t\t\t\t\t\t\t\t\t// get name of date field\n\t\t\t\t\t\t\t\t\t$dateFieldName = $form_array[$fieldset][$label][$thetype]['name'];\n\t\t\t\t\t\t\t\t} elseif ($formFields === 'file') { // <input type=\"file\" ...\n\t\t\t\t\t\t\t\t\t// get names of upload fields\n\t\t\t\t\t\t\t\t\t$theUpfieldName = $form_array[$fieldset][$label][$thetype]['name'];\n\t\t\t\t\t\t\t\t\t$upFieldName[$theUpfieldName] = $theUpfieldName;\n\t\t\t\t\t\t\t\t\t//echo \"<pre>\". print_r($upFieldName) .\"</pre>\";\n\t\t\t\t\t\t\t\t} elseif ($nameFields === 'name') { // <input type=\"text/radio/checkbox/number/range/date/time\" ... else?\n\t\t\t\t\t\t\t\t\t// get values from name fields only\n\t\t\t\t\t\t\t\t\tif ($form_array[$fieldset][$label][$thetype]['name'] === $pwFieldName){\n\t\t\t\t\t\t\t\t\t\t//echo \"<br>\".$formFields.\"<br>\";\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\t$formFieldValue[$pwFieldName] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t\t$passwd = addslashes(htmlspecialchars($_POST[$formFields])); //$_POST[$pwFieldName];\n\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = crypt($passwd,$this->salt);\n\t\t\t\t\t\t\t\t\t} elseif ($form_array[$fieldset][$label][$thetype]['name'] === $dateFieldName) {\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\t\t\t$formFieldValue[$dateFieldName] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t\t\t$dateTime = addslashes(htmlspecialchars($_POST[$formFields])); //$_POST[$datetFieldName];\n\t\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = strtotime($dateTime);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} elseif ($form_array[$fieldset][$label][$thetype]['name'] === $theUpfieldName) {\n\t\t\t\t\t\t\t\t\t\t//echo \"<br>\".$formFields.\"<br>\";\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\tif ($checkFilesVar) {\n\t\t\t\t\t\t\t\t\t\t\t$formFieldValue[$theUpfieldName] = $_FILES[$theUpfieldName]['name'];\n\t\t\t\t\t\t\t\t\t\t\t//if ($this->array_key_check($_POST, $formFields)) {\n\t\t\t\t\t\t\t\t\t\t\t$file = $_FILES[$theUpfieldName]['name'];\n\t\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = addslashes(htmlspecialchars($file));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \"; // create db table field\n\t\t\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\t\t$formFieldValue[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t\t$postvar[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\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} elseif ($nameFields === '@#db') {\n\t\t\t\t\t\t\t\t\t$table_fields .= \" $formFields,\"; // needed to create db table only\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t$table_fields .= ''; // all other fields \\neq 'name' of <input type=\"text/radio/chechbox\" ... else?\n\t\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} elseif ($typeKey === 'file') { // needed or not? !$typeKey === 'file'\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} else { // <input .... without any type declaration\n\t\t\t\t\t\t\t\t// do nothing\n\t\t\t\t\t\t\t\t$table_fields .= '';\n\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} elseif ($textareKey) { // <select ... OR <textarea ...\n\t\t\t\t\t\t\tif ($nameFields === 'name') {\n\t\t\t\t\t\t\t\t// get values from name fields only\n\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \"; // create db table field\n\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \"; // create db table entry\n\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\t$formFieldValue[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t\t$postvar[$formFields] = addslashes(htmlspecialchars($_POST[$formFields]));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} elseif ($nameFields === '@#db') {\n\t\t\t\t\t\t\t\t$table_fields .= \" $formFields,\"; // needed to create db table only\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t$table_fields .= ''; // all other fields \\neq 'name' of <input type=\"text/radio/chechbox\" ... else?\n\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} elseif ($selectKey) {\n\t\t\t\t\t\t\t$selectedVal = '';\n\t\t\t\t\t\t\tif ($nameFields === 'name') {\n\t\t\t\t\t\t\t\t$table_fields .= \" `$formFields` \";\n\t\t\t\t\t\t\t\t$entry .= \" `$formFields`, \";\n\t\t\t\t\t\t\t\t// need to get the selected values from form fields like 'select' with optgroup\n\t\t\t\t\t\t\t\tif ($checkPostVar) {\n\t\t\t\t\t\t\t\t\tif (is_array($_POST[$formFields])) { // i.e 'name' is an array\n\t\t\t\t\t\t\t\t\t\tforeach ($_POST[$formFields] as $key => $value) {\n\t\t\t\t\t\t\t\t\t\t\t$selectedVal .= addslashes(htmlspecialchars($value)).\"| \";\n\t\t\t\t\t\t\t\t\t\t\t$_POST[$formFields][$key] = addslashes(htmlspecialchars($value));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t$selectedVal = $this->truncateReturn($selectedVal, 2);\n\t\t\t\t\t\t\t\t\t\t$selectedValues[$formFields][] = $selectedVal;\n\t\t\t\t\t\t\t\t\t} else {\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$selectedVal = addslashes(htmlspecialchars($formFields));\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\t$formFieldValue[$formFields] = $_POST[$formFields];\n\t\t\t\t\t\t\t\t\t$postvar[$formFields] = $selectedVal;\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} elseif ($nameFields === '@#db') {\n\t\t\t\t\t\t\t\t$table_fields .= \" $formFields,\"; // needed to create db table only\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t$table_fields .= ''; // all other fields \\neq 'name' of <input type=\"text/radio/chechbox\" ... else?\n\t\t\t\t\t\t\t\t$entry .= '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} // end 4th while\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$tableInfo = array();\n\t\t$tableInfo[0] = $table_fields; // create table fields with type property\n\t\t$tableInfo[1] = $entry; // for queries of table like INSERT ... Values ($entry\n\t\t$tableInfo[2] = $formFieldValue; // to be put into value field of the form itself\n\t\t$tableInfo[3] = $selectedValues; // holds all selected values from 'checkbox' or 'select' fields, key is the name\n\t\t$tableInfo[4] = $postvar; // entire $_POST array where keys are the form field's names\n\t\t$tableInfo[5] = $upFieldName; // upload fields\n\t\treturn $tableInfo;\n\t}", "public function prepareFieldsFromTable()\n {\n foreach ($this->columns as $column) {\n $type = $column->getType()->getName();\n\n switch ($type) {\n case 'integer':\n $field = $this->generateIntFieldInput($column, 'integer');\n break;\n case 'smallint':\n $field = $this->generateIntFieldInput($column, 'smallInteger');\n break;\n case 'bigint':\n $field = $this->generateIntFieldInput($column, 'bigInteger');\n break;\n case 'boolean':\n $name = title_case(str_replace('_', ' ', $column->getName()));\n $field = $this->generateField($column, 'boolean', 'checkbox,1');\n break;\n case 'datetime':\n $field = $this->generateField($column, 'datetime', 'date');\n break;\n case 'datetimetz':\n $field = $this->generateField($column, 'dateTimeTz', 'date');\n break;\n case 'date':\n $field = $this->generateField($column, 'date', 'date');\n break;\n case 'time':\n $field = $this->generateField($column, 'time', 'text');\n break;\n case 'decimal':\n $field = $this->generateNumberInput($column, 'decimal');\n break;\n case 'float':\n $field = $this->generateNumberInput($column, 'float');\n break;\n case 'string':\n $field = $this->generateField($column, 'string', 'text');\n break;\n case 'text':\n $field = $this->generateField($column, 'text', 'textarea');\n break;\n default:\n $field = $this->generateField($column, 'string', 'text');\n break;\n }\n\n if (strtolower($field->name) == 'password') {\n $field->htmlType = 'password';\n } elseif (strtolower($field->name) == 'email') {\n $field->htmlType = 'email';\n } elseif (in_array($field->name, $this->timestamps)) {\n $field->isSearchable = false;\n $field->isFillable = false;\n $field->inForm = false;\n $field->inIndex = false;\n }\n\n $this->fields[] = $field;\n }\n }", "function define_tables($models, $requirements) {\n\t\t//loop through all the enabled models\n\t\tforeach ($models as $model) {\n\t\t\t//if this model has required tables\n\t\t\tif (!empty($requirements[$model])) {\n\t\t\t\t//loop though the tables that are required\n\t\t\t\t//each model will return an array that looks like this array(\"dump_cpgcustomer\" => \"cpgCustomer\")\n\t\t\t\t//\"cpgCustomer\" is the source table that exists on the data source\n\t\t\t\t//\"dump_cpgcustomer\" is the extract table where we put data extracted from the source\n\t\t\t\tforeach ($requirements[$model] as $required_extract_table => $required_source_table) {\n\t\t\t\t\t//make sure the requried table (the key) is valid\n\t\t\t\t\tif (empty($required_extract_table) || !is_string($required_extract_table)) {\n\t\t\t\t\t\tthrow new Exception(\"required extract table '{$required_extract_table}' does not appear to be valid for model {$model}.\");\n\t\t\t\t\t}\n\t\t\t\t\t//make sure the requried table (the key) has the placeholder for the extract_id\n\t\t\t\t\tif (strpos($required_extract_table, \"%{extract_id}\") === FALSE) {\n\t\t\t\t\t\tthrow new Exception(\"required extract table '{$required_extract_table}' does not have a valid extract id placeholder for model {$model}.\");\n\t\t\t\t\t}\n\t\t\t\t\t//make sure the requried source table (the value) is valid\n\t\t\t\t\tif (empty($required_source_table) || !is_string($required_source_table)) {\n\t\t\t\t\t\tthrow new Exception(\"required source table '{$required_source_table}' does not appear to be valid for model {$model}.\");\n\t\t\t\t\t}\n\n\t\t\t\t\t//create an array of tables\n\t\t\t\t\t//there may be duplicates, but we'll take care of that later\n\t\t\t\t\t$extract_tables[] = $required_extract_table;\n\t\t\t\t\t$source_tables[] = $required_source_table;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//clean up any duplicate tables\n\t\t$extract_tables = array_unique($extract_tables);\n\t\t$source_tables = array_unique($source_tables);\n\n\t\t//return both arrays\n\t\treturn array($extract_tables, $source_tables);\n\t}", "protected function setUp()\n {\n // V1\n $dom = new Vci_Dom_Document();\n $dom->loadHTML($this->tableV1);\n $table = $dom->query('//table');\n $table = $table->item(0);\n $this->objectV1 = new Vci_Dom_Table($table);\n\n // V2\n $dom = new Vci_Dom_Document();\n $dom->loadHTML($this->tableV2);\n $table = $dom->query('//table');\n $table = $table->item(0);\n $this->objectV2 = new Vci_Dom_Table($table);\n\n // V3\n $dom = new Vci_Dom_Document();\n $dom->loadHTML($this->tableV3);\n $table = $dom->query('//table');\n $table = $table->item(0);\n $this->objectV3 = new Vci_Dom_Table($table);\n\n // V4\n $dom = new Vci_Dom_Document();\n $dom->loadHTML($this->tableV4);\n $table = $dom->query('//table');\n $table = $table->item(0);\n $this->objectV4 = new Vci_Dom_Table($table);\n\n // V5\n $dom = new Vci_Dom_Document();\n $dom->loadHTML($this->tableV5);\n $table = $dom->query('//table');\n $table = $table->item(0);\n $this->objectV5 = new Vci_Dom_Table($table);\n\n // V6\n $dom = new Vci_Dom_Document();\n $dom->loadHTML($this->tableV6);\n $table = $dom->query('//table');\n $table = $table->item(0);\n $this->objectV6 = new Vci_Dom_Table($table);\n\n // V7\n $dom = new Vci_Dom_Document();\n $dom->loadHTML($this->tableV7);\n $table = $dom->query('//table');\n $table = $table->item(0);\n $this->objectV7 = new Vci_Dom_Table($table);\n\n // set up the tablesData array\n $this->tablesData = array(\n array(\n 'object' => $this->objectV1\n ,'headers' => $this->headersV1\n ,'name' => 'V1'\n ),\n array(\n 'object' => $this->objectV2\n ,'headers' => $this->headersV2\n ,'name' => 'V2'\n ),\n array(\n 'object' => $this->objectV3\n ,'headers' => $this->headersV3\n ,'name' => 'V3'\n ),\n array(\n 'object' => $this->objectV4\n ,'headers' => $this->headersV4\n ,'name' => 'V4'\n ),\n array(\n 'object' => $this->objectV5\n ,'headers' => $this->headersV5\n ,'name' => 'V5'\n ),\n array(\n 'object' => $this->objectV6\n ,'headers' => $this->headersV6\n ,'name' => 'V6'\n ),\n array(\n 'object' => $this->objectV7\n ,'headers' => $this->headersV7\n ,'name' => 'V7'\n ),\n );\n }", "function __checkSchema($obj) {\n\t\textract($this->settings[$obj->alias]);\n\t\tif (!$obj->hasField($date_start)) {\n\t\t\ttrigger_error(__(\"Malformed shadow table. $obj->table is missing the `$date_start` column.\"));\n\t\t}\n\t\tif (!$obj->hasField($date_end)) {\n\t\t\ttrigger_error(__(\"Malformed shadow table. $obj->table is missing the `$date_end` column.\"));\n\t\t}\n\t\tif (!$obj->hasField($version_id)) {\n\t\t\ttrigger_error(__(\"Malformed shadow table. $obj->table is missing the `$version_id` column.\"));\n\t\t}\n\t}" ]
[ "0.65249866", "0.60868937", "0.6048604", "0.5835193", "0.5791775", "0.5789899", "0.560969", "0.5574088", "0.55164117", "0.55154186", "0.54815954", "0.54377353", "0.5435608", "0.53789014", "0.5339945", "0.533868", "0.5328063", "0.52627206", "0.52324784", "0.52220356", "0.5213952", "0.52129525", "0.52014834", "0.51890916", "0.51853806", "0.51542985", "0.50865114", "0.5080816", "0.5080217", "0.5066052" ]
0.6659976
0
Checks if app_data.json structure is valid
static function appData($path2cfg, $echo = false){ u::echo('Checking app_data', $echo); $d = u::getJson("{$path2cfg}/app_data.json"); foreach ([ 'lang', 'name', 'definition' ] as $must) { if(!$d[$must]){ throw new \Exception("The required index `{$must}` of `{$path2cfg}/app_data.json` is missing", 1); } } u::echo(' app_data: OK', $echo); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function isValidJSON($data) {\n json_decode($data);\n if (json_last_error() != 0) {\n return false;\n }\n return true;\n }", "protected function checkData() {\n if (!$this->data) {\n throw new MissingData();\n }\n $decodedData = json_decode($this->data->raw_value, 1);\n if (!is_array($decodedData)) {\n throw new InvalidData();\n }\n if (empty($decodedData)) {\n throw new EmptyData();\n }\n }", "protected function validateJson($data)\n {\n if ($data !== \"\") {\n return (json_last_error() === JSON_ERROR_NONE);\n }\n }", "protected static function validateJsonData($json)\n {\n return is_object($json) && isset($json->hmac, $json->cipher, $json->iv) && mb_strlen($json->iv, '8bit') === static::length();\n }", "private function _validateFileData($_data) {\n\t\t$isValid = false;\n\t\tif (is_array($_data)) {\n\t\t\t$intersect = array_intersect(self::$_requiredKeys, array_keys($_data));\n\t\t\t$isValid = (count($intersect) == count(self::$_requiredKeys));\n\n\t\t\tif ($isValid) {\n\t\t\t\t$isValid = ($_data['error'] == 0);\n\t\t\t}\n\t\t}\n\t\treturn $isValid;\n\t}", "public function valid_data_passes_its_sanitation()\n {\n ['data' => $data, 'rules' => $rules] = (new Json())(file_get_contents(__DIR__ . '/Fixtures/valid_data.json'));\n\n $result = $this->sanitizer->sanitize($data, 'array', $rules);\n\n self::assertArrayHasKey($this->sanitizer::SANITIZED_DATA_KEY, $result);\n self::assertEquals($data, $result[$this->sanitizer::SANITIZED_DATA_KEY]);\n }", "protected static function validateJsonFileMatches(WireData $data, array $json) {\n\t\tif ($json['custid'] != $data->custID) {\n\t\t\treturn false;\n\t\t}\n\t\tif (array_key_exists('shipid', $json) && $json['shipid'] != $data->shiptoID) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "protected function isValidData(): bool\n {\n return true;\n }", "protected function isValidData(): bool\n {\n return true;\n }", "protected function validateData(): bool {\n\t\treturn $this->validateArrayElement($this->getRequestData(), $this->getLocationKey());\n\t}", "public function isValid($data)\n {\n $errors = array();\n\n if(empty($data['name']))\n $errors[] = 'Name can\\'t be empty.';\n\n if(empty($data['method']))\n $errors[] = 'Method can\\'t be empty.';\n\n if(empty($data['url']))\n $errors[] = 'URL can\\'t be empty.';\n\n if(empty($data['content_type']))\n $errors[] = 'Content type can\\'t be empty.';\n\n if(empty($data['bundle']))\n $errors[] = 'Bundle can\\'t be empty.';\n\n return $errors;\n }", "protected static function validateJsonFileMatches(WireData $data, array $json) {\n\t\treturn $json['itemid'] == $data->itemID && $json['custid'] == $data->custID;\n\t}", "public function validateJSONFiles($file) {\n try {\n if (file_exists($file)) {\n return true;\n exit(1);\n }\n } catch(Exception $e) {\n return $flag;\n exit(1);\n }\n }", "private function validate()\n {\n // Now\n if (!is_array($this->fileContents[\"now\"])) {\n $this->fileContents[\"now\"] = array();\n }\n if (!is_array($this->fileContents[\"now\"][\"users\"])) {\n $this->fileContents[\"now\"][\"users\"] = array();\n }\n\n // Daily\n if (!is_array($this->fileContents[\"daily\"])) {\n $this->fileContents[\"daily\"] = array();\n }\n if (!is_int($this->fileContents[\"daily\"][\"day\"])) {\n $this->fileContents[\"daily\"][\"day\"] = intval(date(\"d\"));\n }\n if (!is_array($this->fileContents[\"daily\"][\"users\"])) {\n $this->fileContents[\"daily\"][\"users\"] = array();\n }\n\n // Total\n if (!is_array($this->fileContents[\"total\"])) {\n $this->fileContents[\"total\"] = array();\n }\n if (!is_int($this->fileContents[\"total\"][\"count\"])) {\n $this->fileContents[\"total\"][\"count\"] = 0;\n }\n }", "public function testPostMalformedApp()\n {\n $testApp = new \\stdClass;\n $testApp->name = new \\stdClass;\n $testApp->name->en = 'new Test App';\n $testApp->showInMenu = true;\n\n // malform it ;-)\n $input = str_replace(\":\", \";\", json_encode($testApp));\n\n $client = static::createRestClient();\n\n // make sure this is sent as 'raw' input (not json_encoded again)\n $client->post('/core/app/', $input, [], [], [], false);\n\n $response = $client->getResponse();\n\n // Check that error message contains detailed reason\n json_decode($input);\n $lastJsonError = json_last_error_msg();\n\n $this->assertStringContainsString(\n $lastJsonError,\n $client->getResults()->message\n );\n\n $this->assertEquals(400, $response->getStatusCode());\n }", "function valid_input_data($data) {\n if (is_array($data) || is_object($data)) {\n // Form data can contain a number of nested arrays.\n foreach ($data as $key => $value) {\n if (!valid_input_data($key) || !valid_input_data($value)) {\n return FALSE;\n }\n }\n }\n else if (isset($data)) {\n // Detect dangerous input data.\n\n // Decode all normal character entities.\n $data = decode_entities($data, array('<', '&', '\"'));\n\n // Check strings:\n $match = preg_match('/\\Wjavascript\\s*:/i', $data);\n $match += preg_match('/\\Wexpression\\s*\\(/i', $data);\n $match += preg_match('/\\Walert\\s*\\(/i', $data);\n\n // Check attributes:\n $match += preg_match(\"/\\W(dynsrc|datasrc|data|lowsrc|on[a-z]+)\\s*=[^>]+?>/i\", $data);\n\n // Check tags:\n $match += preg_match(\"/<\\s*(applet|script|object|style|embed|form|blink|meta|html|frame|iframe|layer|ilayer|head|frameset|xml)/i\", $data);\n\n if ($match) {\n watchdog('security', t('Terminated request because of suspicious input data: %data.', array('%data' => theme('placeholder', $data))));\n return FALSE;\n }\n }\n\n return TRUE;\n}", "private function check_file()\n {\n\n // Checks if DIR exists, if not create\n if (! is_dir($this->dir)) {\n mkdir($this->dir, 0700);\n }\n // Checks if JSON file exists, if not create\n if (! file_exists($this->file)) {\n touch($this->file);\n // $this->commit();\n }\n\n if ($this->load == 'partial') {\n $this->fp = fopen($this->file, 'r+');\n if (! $this->fp) {\n throw new \\Exception('Unable to open json file');\n }\n\n $size = $this->check_fp_size();\n if ($size) {\n $content = get_json_chunk($this->fp);\n\n // We could not get the first chunk of JSON. Lets try to load everything then\n if (! $content) {\n $content = fread($this->fp, $size);\n } else {\n // We got the first chunk, we still need to put it into an array\n $content = sprintf('[%s]', $content);\n }\n\n $content = json_decode($content, true);\n } else {\n // Empty file. File was just created\n $content = [];\n }\n } else {\n // Read content of JSON file\n $content = file_get_contents($this->file);\n $content = json_decode($content, true);\n }\n\n // Check if its arrays of jSON\n if (! is_array($content) && is_object($content)) {\n throw new \\Exception('An array of json is required: Json data enclosed with []');\n }\n // An invalid jSON file\n if (! is_array($content) && ! is_object($content)) {\n throw new \\Exception('json is invalid');\n }\n $this->content = $content;\n return true;\n }", "function checkRandomApp($randomApp) {\n global $file;\n\n if ( ! $file[$randomApp]['Displayable'] ) return false;\n if ( ! $file[$randomApp]['Compatible'] ) return false;\n if ( $file[$randomApp]['Blacklist'] ) return false;\n if ( $file[$randomApp]['ModeratorComment'] ) return false;\n if ( $file[$randomApp]['Deprecated'] ) return false;\n return true;\n}", "function check_decoded_json($data_array) {\n if($data_array == null)\n launch_error(\"JSON arrived to server is not correct.\");\n}", "public function valid(array $data): bool\n {\n if (!array_key_exists('id', $data) || null === $data['id'] || '' === $data['id']) {\n $this->errors[] = 'Id is required';\n }\n elseif (!is_int($data['id']) || 0 === $data['id']) {\n $this->errors[] = 'Id should be type of integer greater then zero';\n }\n \n if (!array_key_exists('name', $data) || null === $data['name'] || '' === $data['name']) {\n $this->errors[] = 'Name is required';\n }\n if (!is_string($data['name'])) {\n $this->errors[] = 'Name should be type of string';\n }\n \n if (array_key_exists('site_url', $data) && null !== $data['site_url'] && !is_string($data['site_url'])) {\n $this->errors[] = 'Site url should be type of string';\n }\n \n if (array_key_exists('logo_filename', $data) && null !== $data['logo_filename'] && !is_string($data['logo_filename'])) {\n $this->errors[] = 'Logo filename should be type of string';\n }\n \n if (!array_key_exists('ordering', $data) || null === $data['ordering'] || '' === $data['ordering']) {\n $this->errors[] = 'Ordering is required';\n }\n elseif (!is_int($data['ordering']) || 0 === $data['ordering']) {\n $this->errors[] = 'Ordering should be type of integer greater then zero';\n }\n \n if (array_key_exists('source_id', $data) && null !== $data['source_id'] && !is_string($data['source_id'])) {\n $this->errors[] = 'Source Id should be type of string';\n }\n \n if (!empty($this->errors)) {\n $this->isValid = false;\n }\n \n return $this->isValid;\n }", "protected function validateData()\n {\n $errors = 0;\n $errorFields = [];\n\n foreach ($this->requireData as $key) {\n if (!isset($this->data[$key])) {\n ++$errors;\n $errorFields[] = $key;\n }\n }\n\n if (0 === $errors) {\n return true;\n }\n\n $this->validateErrorMsg = 'Fields '.trim(implode(', ', $errorFields)).' are required';\n\n return false;\n }", "private function _validateConfigurationOptions($app) {\n\n // TODO: Validate the config file\n // If not valid, throw new Exception();\n // Validate hooks, are they really added?\n\n }", "public function checkData();", "public function validate ()\n {\n if ( trim ($this->app_uid) === \"\" )\n {\n $this->validationFailures[] = \"App Id is missing\";\n }\n\n if ( count ($this->validationFailures) > 0 )\n {\n return false;\n }\n\n return true;\n }", "private function _authDataValid($data) {\n if (isset($data['email']) && (filter_var($data['email'], FILTER_VALIDATE_EMAIL) != $data['email'])) {\n $result = array(\n 'ok' => 0,\n 'message' => 'E-mail invalid'\n );\n\n echo json_encode($result, true);\n\n return false;\n }\n\n $fullname_regexp = array(\"options\"=>array(\"regexp\"=>\"/^[\\\\s\\\\w]{6,64}$/u\"));\n\n if(isset($data['fullname']) && filter_var($data['fullname'], FILTER_VALIDATE_REGEXP, $fullname_regexp) != $data['fullname']) {\n $result = array(\n 'ok' => 0,\n 'message' => 'Fullname invalid'\n );\n\n echo json_encode($result, true);\n\n return false;\n }\n\n $pass_regexp = array(\"options\"=>array(\"regexp\"=>\"/^[\\\\S]{8,256}$/\"));\n\n if(isset($data['password']) && filter_var($data['password'], FILTER_VALIDATE_REGEXP, $pass_regexp) != $data['password']) {\n $result = array(\n 'ok' => 0,\n 'message' => 'Password invalid'\n );\n\n echo json_encode($result, true);\n\n return false;\n }\n\n $valid_regexp = array(\"options\"=>array(\"regexp\"=>\"/^\\w{64}+$/\"));\n\n if(isset($data['valid']) && filter_var($data['valid'], FILTER_VALIDATE_REGEXP, $valid_regexp) != $data['valid']) {\n $result = array(\n 'ok' => 0,\n 'message' => 'Password invalid'\n );\n\n echo json_encode($result, true);\n\n return false;\n }\n\n return true;\n }", "public function testBadJson()\n\t{\n\t\t$loader = LoadManager::getInstance();\n\n\t\t$config1 = tempnam(\"./\", \"config1\");\n\t\t$handle1 = fopen($config1, \"w\");\n\t\tfwrite($handle1, \"{\\\"load:\\\"$config1\\\"}\"); // json missing a quotation\n\n\t\ttry {\n\t\t\tLoadManager::load($config1);\n\t\t\t$this->fail('Did not throw an exception with a bad JSON file.');\n\t\t} catch(\\Vcms\\Exception\\Syntax $e) {}\n\n\t\tfclose($handle1);\n\t\tunlink($config1);\n\t}", "public static function validateConfig($config)\n\t{\n\t\tif(sizeof($config['apps']) < 1)\n\t\t{\n\t\t\tthrow new Exception('Missing apps setting in config.yml');\n\t\t\treturn false;\n\t\t}\n\n\t\t$has_default_app = false;\n\t\tforeach($config['apps'] as $app_name => $app_config)\n\t\t{\n\t\t\tif(isset($app_config['default_app'])) { $has_default_app = true; }\n\n\t\t\tif(!isset($app_config['default_module']))\n\t\t\t{\n\t\t\t\tthrow new Exception('Missing default_module setting for module \\'' . $app_name . '\\' in config.yml');\n\t\t\t}\n\n\t\t\tif(!isset($app_config['base_href']))\n\t\t\t{\n\t\t\t\tthrow new Exception('Missing base_href setting for module \\'' . $app_name . '\\' in config.yml');\n\t\t\t}\n\t\t}\n\n\t\tif(!$has_default_app)\n\t\t{\n\t\t\tthrow new Exception('Missing default_app setting in config.yml');\n\t\t}\n\n\t\treturn true;\n\t}", "public function validate($json) : bool\n {\n try {\n $structure = $this->serializer->unserialize($json);\n if (is_array($structure) && (!isset($structure['type']) && !isset($structure['contentType']))) {\n $structure = current($structure);\n }\n $result = is_array($structure) && (isset($structure['type']) || isset($structure['contentType']));\n } catch (\\InvalidArgumentException $exception) {\n $result = false;\n }\n return $result;\n }", "public function testInvalidFormat(): void\n {\n $this->expectException(\\RuntimeException::class);\n $this->expectExceptionMessage('Invalid JSON format');\n\n $data = json_encode([\n 'wiki' => 'https://some_test_wiki.com/w/api.php',\n 'category' => 'TestCategory'\n ]);\n\n // Break JSON format to cause exception.\n $data .= '---///';\n\n file_put_contents('config_test_invalid.json', $data);\n\n $config = new ConfigJson('config_test_invalid.json');\n\n $config->parseConfig();\n }", "private function validateAppConf($conf) {\n\t\t$appclass = $conf->getAppClass();\n\t\t$title = $conf->getAppTitle();\n\t\tif(empty($appclass) || empty($title)) {\n\t\t\tIndexerLog( $conf->getConfPath() . \": Invalid app conf\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\treturn TRUE;\n\t}" ]
[ "0.655042", "0.63260627", "0.6115014", "0.6036897", "0.5856544", "0.5848443", "0.58465225", "0.5840349", "0.5840349", "0.5833054", "0.577154", "0.5769812", "0.56571907", "0.56503916", "0.56315935", "0.5592016", "0.55888546", "0.5588349", "0.5576286", "0.55194354", "0.55058485", "0.55045354", "0.5504338", "0.5468256", "0.54429483", "0.5440255", "0.54365087", "0.54325813", "0.5409463", "0.5374292" ]
0.67847717
0
Creates a new Receipt model. If creation is successful, the browser will be redirected to the 'view' page.
public function actionCreate() { $model = new Receipt(); $searchModel = new ReceiptSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->pagination->pageSize = 50; if ($model->load(Yii::$app->request->post())) { // проверяем все поля, если что-то не так показываем форму с ошибками if (!$model->validate()) { return $this->render('create', ['model' => $model, 'dataProvider' => $dataProvider]); } // сохраняем запись if ($model->save(false)) { return $this->redirect(['view', 'id' => $model->_id]); } else { return $this->render('create', ['model' => $model, 'dataProvider' => $dataProvider]); } } else { return $this->render('create', ['model' => $model, 'dataProvider' => $dataProvider]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public\n function actionNew()\n {\n if (isset($_POST['receiptUuid']))\n $model = Receipt::find()->where(['uuid' => $_POST['receiptUuid']])->one();\n else\n $model = new Receipt();\n if ($model->load(Yii::$app->request->post())) {\n if ($model->save(false)) {\n return true;\n }\n }\n return true;\n }", "public function create()\n {\n return view('receipt.create');\n }", "public function create()\n {\n return view('receipt.create');\n }", "public function actionCreate()\n {\n $model = new CashRecord();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate() {\n $model = new ProductAdjustmentMaster();\n\n if ($model->load(Yii::$app->request->post())) {\n $model->document_date = date(\"Y-m-d\", strtotime($model->document_date));\n $transaction = Yii::$app->db->beginTransaction();\n try {\n if ($model->save() && $this->InvoiceDetails($model)) {\n $transaction->commit();\n Yii::$app->session->setFlash('success', \"Invoice Created successfully\");\n } else {\n $transaction->rollBack();\n Yii::$app->session->setFlash('error', \"There was a problem creating new invoice. Please try again.\");\n }\n } catch (Exception $e) {\n $transaction->rollBack();\n Yii::$app->session->setFlash('error', \"There was a problem creating new invoice. Please try again.\");\n }\n $model = new ProductAdjustmentMaster();\n } return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate() {\n\t\t$model = new Invoices;\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\t\tif (isset($_GET['byorder']) and is_numeric($_GET['byorder']))\n\t\t\t$model->order_id = (int) $_GET['byorder'];\n\n\t\tif (isset($_POST['Invoices'])) {\n\t\t\t$model->attributes = $_POST['Invoices'];\n//\t\t\t$model->client_id = $model->order->client_id;\n\t\t\tif ($model->save()) {\n\t\t\t\t$msg = 'Счёт #' . $model->id . ' для Заказа #' . $model->order_id . ' ' . $model->order->name . ' создан';\n\t\t\t\tYii::app()->user->setFlash('success', $msg);\n\t\t\t\tYii::app()->logger->write($msg);\n\n\t\t\t\tif (isset($model->order_id))\n\t\t\t\t\t$this->redirect(array('orders/view', 'id' => $model->order_id));\n\t\t\t\telse\n\t\t\t\t\t$this->redirect(array('view', 'id' => $model->id));\n\t\t\t}\n\t\t}\n\t\t$model->date = date('Y-m-d');\n\t\t$model->num = $model->getLastNum() + 1;\n\n\t\t$this->render('create', array(\n\t\t\t'model' => $model,\n\t\t));\n\n//\t\tYii::app()->user->setFlash('error', 'Счет следует создавать из заказа');\n//\t\t$this->redirect('admin');//Yii::app()->request->urlReferrer);\n\t}", "public function actionCreate()\n {\n $model = new Reservacion();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n exit;\n // $this->layout = 'default'; \n // $model = new Userpay();\n\n // if ($model->load(Yii::$app->request->post()) && $model->save()) {\n // return $this->redirect(['view', 'id' => $model->id]);\n // } else {\n // return $this->render('create', [\n // 'model' => $model,\n // ]);\n // }\n }", "public function actionCreate()\n {\n $model = new Receita();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Order();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Order();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Payments();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new CustomerNotes();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function create()\n {\n $this->authorize('admin.receipt.create');\n\n return view('admin.receipt.create');\n }", "public function actionCreate()\n {\n /*\n $model = new Customer();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n */\n }", "public function actionCreate()\n {\n $model = new Request();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new RhNoteRecord();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->note_id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new ContractAmountDue();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function newReceipt() {\n if ( Auth::user()->cant('create', Receipt::class) )\n return redirect()->route('home');\n\n $accounts = Account::where('is_global', '=', true)\n ->orWhere('user_id', '=', Auth::user()->id)\n ->orderBy('name', 'asc')\n ->get();\n\n $subjects = Subject::where('is_global', '=', true)\n ->orWhere('user_id', '=', Auth::user()->id)\n ->orderBy('name', 'asc')\n ->get();\n\n return view('Templates.receipts.newReceipt', [\n 'accounts' => $accounts,\n 'subjects' => $subjects\n ]);\n }", "public function actionCreate()\n {\n $model = new Customer();\n\n if ($model->load(Yii::$app->request->post()) ) {\n\n if( $model->create()){\n $model->sendSuccess();\n return $this->redirect(['index']);\n }else{\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new ProProduct();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Order();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "function create_receipt($receipt){\n \t\n \t\t\tif($this->db->insert('reciepts', $receipt)){\n\t \t\t\treturn 'Receipt has been created successfully';\n\t \t\t}\n\t \t\telse{\n\t \t\t\treturn false;\n\t \t\t}\n \t\t\n \t}", "public function actionCreate()\n {\n $model = new Proses();\n\n if ($model->load(Yii::$app->request->post()) ) {\n $model->kd_urusan = Yii::$app->user->identity->tperan->kd_urusan;\n $model->kd_bidang = Yii::$app->user->identity->tperan->kd_bidang;\n $model->kd_unit = Yii::$app->user->identity->tperan->kd_unit;\n $model->kd_sub = Yii::$app->user->identity->tperan->kd_sub;\n $model->input_phased = 2;\n $model->user_id = Yii::$app->user->identity->id;\n IF($model->save()){\n return $this->redirect(['view', 'id' => $model->id]);\n }\n \n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Cashwithdraw();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n\t{ \n\t\tYii::app()->user->setState('items_data',Product::getArrayData());\n\t\tif(!Yii::app()->user->hasState('items_belanja'))\n\t\t\tYii::app()->user->setState('promocode',null);\n\t\telse{\n\t\t\tif(count(Yii::app()->user->getState('items_belanja'))==0)\n\t\t\t\tYii::app()->user->setState('promocode',null);\n\t\t}\n\t\tif(Yii::app()->user->hasState('promocode'))\n\t\t\t$promocode=Promo::model()->findByPk(Yii::app()->user->getState('promocode'))->code;\n\t\tif(!Yii::app()->user->hasState('currency'))\n\t\t\tYii::app()->user->setState('currency',Currency::getDefault());\n\t\t//check whether there is equity\n\t\tif((int)Yii::app()->config->get('use_initial_capital')>0){\n\t\t\tif(!PaymentSession::hasSession())\n\t\t\t\t$this->forward('addmodal');\n\t\t}\n\t\t$this->render('create',array(\n\t\t\t'model'=>$model,\n\t\t\t'promocode'=>$promocode,\n\t\t));\n\t}", "public function actionCreate()\n {\n $model = new PaymentsAmount();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id, 'payments_id' => $model->payments_id, 'payment_setup_id' => $model->payment_setup_id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate() {\n $model = new PettyCashBook();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Notification();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new StoreCabinet();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }" ]
[ "0.7561631", "0.7143693", "0.7143693", "0.7123515", "0.7062635", "0.706115", "0.69852793", "0.6950148", "0.6930576", "0.68936086", "0.68936086", "0.6893059", "0.6885652", "0.6854164", "0.6853562", "0.6841294", "0.68253326", "0.6823177", "0.680999", "0.6805694", "0.67913496", "0.6788177", "0.6761967", "0.6754709", "0.6745759", "0.6731828", "0.6724351", "0.67210495", "0.6720065", "0.67183006" ]
0.8356903
0
Finds the Receipt model based on its primary key value. If the model is not found, a 404 HTTP exception will be thrown.
protected function findModel($id) { if (($model = Receipt::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function find($key): ?Model;", "protected function findModel($item_id)\n\t{\n\t\tif (($model = SapItem::findOne($item_id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new HttpException(404, 'The requested page does not exist.');\n\t\t}\n\t}", "public function find($id)\n {\n $rel = $this->currentOrClone();\n $modelClass = $this->modelClass;\n $tableName = $modelClass::tableName();\n $first = $rel->where([$tableName . '.' . $modelClass::primaryKey() => $id])->first();\n if (!$first) {\n throw new RecordNotFoundException(sprintf(\n \"Couldn't find %s with %s=%s\",\n $this->modelClass,\n $modelClass::primaryKey(),\n $id\n ));\n }\n return $first;\n }", "protected function findModel($transactionId){\n \tif (($model = Transaction::findOne($transactionId)) !== null) {\n \t\treturn $model;\n \t} else {\n \t\t$this->setHeader(400);\n \t\techo json_encode(array('status'=>0,'error_code'=>400,'message'=>'Bad request'),JSON_PRETTY_PRINT);\n \t\texit;\n \t}\n }", "protected function findModel($id) {\n if (($model = PettyCashBook::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id) {\n if (($model = Invoice::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel(int $id): IssuePayCalculation {\n\t\tif (($model = IssuePayCalculation::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t}\n\n\t\tthrow new NotFoundHttpException('The requested page does not exist.');\n\t}", "protected function findModel($id)\n {\n if (($model = CashRecord::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n if (($model = Prodrec::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));\n }", "protected function findModel($id) {\n if (($model = ProductAdjustmentMaster::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n if (($model = PaymentSystems::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException(Yii::t('main', 'Sahifa topilmadi'));\n }", "public function find($id)\n {\n return $this->model->findOrFail($id);\n }", "protected function findModel($id)\n {\n if (($model = BoxRecycleOrder::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n if (($model = Invoice::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n if (($model = Invoice::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n\t{\n\t\tif (($model = Office::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new NotFoundHttpException('The requested page does not exist.');\n\t\t}\n\t}", "protected function findModel(int $id)\n {\n if (!is_null($model = SaleItems::findOne($id))) {\n return $model;\n }\n\n throw new NotFoundHttpException(Yii::t('app', 'La página que ustéd solicitó no existe.'));\n }", "protected function findModel($id)\n {\n if (($model = BillProduct::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "protected function findModel($id)\n {\n if (($model = Prerrequisito::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n\t{\n\t\tif (($model = Premio::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new NotFoundHttpException('The requested page does not exist.');\n\t\t}\n\t}", "protected function findModel($id)\n {\n if (($model = Produit::findOne($id)) !== null) {\n return $model;\n } \n\n throw new NotFoundHttpException('Produit non trouvé.');\n }", "public function first() : Model\n\t{\n\t\tif(count($this->results) >= 1)\n\t\t{\n\t\t\treset($this->results);\n\t\t\treturn current($this->results);\n\t\t}\n\t\telse\n\t\t\tthrow new ModelNotFoundException();\n\n\t}", "protected function findModel($id)\n {\n if (($model = Invoice::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "protected function findModel($id)\n {\n if (($model = Invoice::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "protected function findModel($id)\r\n {\r\n if (($model = WarehouseVoucher::findOne($id)) !== null) {\r\n return $model;\r\n } else {\r\n throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));\r\n }\r\n }", "public function loadModel($id)\n\t{\n\t\t$model=PurchaseOrder::model()->findByPk($id);\n\t\tif($model===null)\n\t\tthrow new CHttpException(404,'Purchase Order related does not exist.');\n\t\treturn $model;\n\t}", "protected function findModel($id)\n {\n if (($model = AppUserRefundRequest::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n if (($model = Purchase::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n if (($model = InvoiceSpec::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "protected function findModel($id)\n {\n if (($model = Bill::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }" ]
[ "0.66835827", "0.66607887", "0.64194244", "0.63515776", "0.63513327", "0.63438284", "0.6336159", "0.632768", "0.6314487", "0.6298431", "0.62684757", "0.6263766", "0.625938", "0.62509906", "0.62509906", "0.62385595", "0.6235058", "0.6223736", "0.6219816", "0.6217443", "0.6217392", "0.62169033", "0.62021005", "0.62021005", "0.6201147", "0.6199518", "0.6195144", "0.61931586", "0.61926717", "0.619046" ]
0.69686264
0
Creates a new Receipt model.
public function actionNew() { if (isset($_POST['receiptUuid'])) $model = Receipt::find()->where(['uuid' => $_POST['receiptUuid']])->one(); else $model = new Receipt(); if ($model->load(Yii::$app->request->post())) { if ($model->save(false)) { return true; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionCreate()\n {\n $model = new Receipt();\n $searchModel = new ReceiptSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n $dataProvider->pagination->pageSize = 50;\n\n if ($model->load(Yii::$app->request->post())) {\n // проверяем все поля, если что-то не так показываем форму с ошибками\n if (!$model->validate()) {\n return $this->render('create', ['model' => $model, 'dataProvider' => $dataProvider]);\n }\n\n // сохраняем запись\n if ($model->save(false)) {\n return $this->redirect(['view', 'id' => $model->_id]);\n } else {\n return $this->render('create', ['model' => $model, 'dataProvider' => $dataProvider]);\n }\n } else {\n return $this->render('create', ['model' => $model, 'dataProvider' => $dataProvider]);\n }\n }", "public function create()\n {\n return view('receipt.create');\n }", "public function create()\n {\n return view('receipt.create');\n }", "public function store(Request $request)\n {\n $request->validate([\n 'created_for' => ['required'],\n 'type' => ['required'],\n 'amount' => ['required', 'integer', 'min:0', 'not_in:0'],\n 'note' => 'max:500'\n ]);\n $receipt = Request()->type;\n $amount = Request()->amount;\n if($receipt === 'P'){\n $amount = $amount * -1;\n }\n\n $created_by = User::find(auth()->user()->id);\n $created_for = User::find(Request()->created_for);\n $created_for->receipts()->create([\n 'created_for' => $created_for->id,\n 'created_by' => $created_by->id,\n 'type' => Request()->type,\n 'amount' => $amount,\n 'note' => Request()->note,\n ]);\n return redirect('/receipt')->with('message', 'created receipt successfully');\n }", "protected function createReceipt(array $data)\n {\n $data['items'] = @json_decode($data['items'], true);\n $data['payments'] = @json_decode($data['payments'], true);\n\n if (!is_array($data['items'])) {\n $data['items'] = array();\n }\n\n if (!is_array($data['payments'])) {\n $data['payments'] = array();\n }\n\n $data['requisites'] = Requisites::fromArray($data);\n\n return Receipt::fromArray($data);\n }", "public function newAction()\n {\n $entity = new Receipt();\n \n $form = $this->createCreateForm($entity);\n $translator = $this->get('translator');\n $flashBag = $this->get('session')->getFlashBag();\n foreach ($flashBag->keys() as $type) {\n $flashBag->set($type, array());\n }\n $translator = $this->get('translator');\n $maincompany = $this->getUser()->getMainCompany();\n $countreceipt = $maincompany->getCountreceipts(); \n $plan = $maincompany->getPlan();\n if (($plan->getReceipts()) && ($countreceipt >= $plan->getMaxreceipts())) {\n $message = 'Ha llegado al número máximo de ' . $translator->trans('Recibos') .' permitidos. Para crear más debe actualizar su plan a uno superior.';\n if ($this->isGranted('ROLE_ADMIN')) {\n $message = $message . '<a href=\"' . $this->generateUrl('loginmain') . '\" > Actualizar ahora</a>';\n }\n $flashBag->add('notice',$message);\n }\n \n return array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'edition' => false,\n 'nameform' => 'Crear ' . $translator->trans('Recibo') ,\n );\n }", "function create_receipt($receipt){\n \t\n \t\t\tif($this->db->insert('reciepts', $receipt)){\n\t \t\t\treturn 'Receipt has been created successfully';\n\t \t\t}\n\t \t\telse{\n\t \t\t\treturn false;\n\t \t\t}\n \t\t\n \t}", "protected function createReceipt($referenceId)\n {\n return new Receipt('behpardakht', $referenceId);\n }", "public function newReceipt() {\n if ( Auth::user()->cant('create', Receipt::class) )\n return redirect()->route('home');\n\n $accounts = Account::where('is_global', '=', true)\n ->orWhere('user_id', '=', Auth::user()->id)\n ->orderBy('name', 'asc')\n ->get();\n\n $subjects = Subject::where('is_global', '=', true)\n ->orWhere('user_id', '=', Auth::user()->id)\n ->orderBy('name', 'asc')\n ->get();\n\n return view('Templates.receipts.newReceipt', [\n 'accounts' => $accounts,\n 'subjects' => $subjects\n ]);\n }", "public function actionCreate() {\n $model = new ProductAdjustmentMaster();\n\n if ($model->load(Yii::$app->request->post())) {\n $model->document_date = date(\"Y-m-d\", strtotime($model->document_date));\n $transaction = Yii::$app->db->beginTransaction();\n try {\n if ($model->save() && $this->InvoiceDetails($model)) {\n $transaction->commit();\n Yii::$app->session->setFlash('success', \"Invoice Created successfully\");\n } else {\n $transaction->rollBack();\n Yii::$app->session->setFlash('error', \"There was a problem creating new invoice. Please try again.\");\n }\n } catch (Exception $e) {\n $transaction->rollBack();\n Yii::$app->session->setFlash('error', \"There was a problem creating new invoice. Please try again.\");\n }\n $model = new ProductAdjustmentMaster();\n } return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function createReceipt($referenceId)\n {\n return new Receipt('zarinpal', $referenceId);\n }", "public function create()\n {\n $this->authorize('admin.receipt.create');\n\n return view('admin.receipt.create');\n }", "public function store(ReceiptRequest $request)\n {\n //\n $receipt = new Receipt;\n $receipt->client_id = $request->client_id;\n $id= $request->client_id;\n $client = Client::findorfail($id);\n // $client = Client::findorfail($id)->where('name', '=', $request->name)->get();\n // $users = DB::table('clients')->where('votes', '>', 100)->get();\n\n\n $receipt->name = $client->name;\n $receipt->noreceipt = $request->noreceipt;\n $receipt->preaccount = $client->sumdept;\n $receipt->received = $request->received;\n $receipt->postaccount = ($client->sumdept - $request->received);\n $receipt->datereceipt = $request->datereceipt;\n $receipt->save();\n \n \n $client->sumdept=$receipt->postaccount;\n $client->save();\n\n return response([\n 'data' => new ReceiptResource($receipt)\n ], Response::HTTP_CREATED);\n\n }", "protected function create(){\r\n $view = new NewModel();\r\n $view->create();\r\n }", "public function actionCreate() {\n $model = new Invoice();\n $dgets = Yii::$app->request->get();\n $model->load($dgets);\n $model->reff_type = ($model->type == $model::TYPE_INCOMING) ? $model::REFF_PURCH : null;\n $model->reff_type = ($model->type == $model::TYPE_OUTGOING) ? $model::REFF_SALES : $model->reff_type;\n\n $model->status = Invoice::STATUS_DRAFT;\n $model->date = date('Y-m-d');\n $model->due_date = date('Y-m-d', time() + 30 * 24 * 3600);\n $model->value = 0;\n\n if (isset($dgets['goodsMovement']['id'])) {\n $gmv = \\backend\\models\\inventory\\GoodsMovement::find()\n ->where(['=', 'id', $dgets['goodsMovement']['id']])\n ->with(['vendor'])\n ->one();\n $model->reff_type = $model::REFF_GOODS_MOVEMENT;\n $model->reff_id = $gmv->id;\n $model->vendor_id = $gmv->vendor_id;\n $model->vendor_name = $gmv->vendor->name;\n $model->description = 'GR Invoice';\n $gmItems = [];\n $subtotal = 0;\n foreach ($gmv->items as $rvalue) {\n $ditem = new \\backend\\models\\accounting\\InvoiceDtl();\n $ditem->item_id = $rvalue->product_id;\n $ditem->qty = $rvalue->qty;\n $ditem->item_value = $rvalue->cogs;\n $subtotal += ($rvalue->qty * $rvalue->cogs);\n $gmItems[] = $ditem;\n }\n $model->value = $subtotal;\n $model->items = $gmItems;\n }\n\n if ($model->load(Yii::$app->request->post())) {\n $transaction = Yii::$app->db->beginTransaction();\n try {\n $model->items = Yii::$app->request->post('InvoiceDtl', []);\n if ($model->save()) {\n $transaction->commit();\n return $this->redirect(['view', 'id' => $model->id]);\n }\n } catch (\\Exception $exc) {\n $transaction->rollBack();\n throw $exc;\n }\n $transaction->rollBack();\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function create()\n {\n $reNo = Payment::where('type',2)->where('session_id',Session::get('session_id'))->orderBy('id','DESC')->select('receiptSn')->first();\n $prefix = sessionTb::where('id',Session::get('session_id'))->select('SPPrefix')->first();\n \n $receiptSn = isset($reNo->receiptSn) ? $reNo->receiptSn +1 : 1;\n $SnNo = str_pad($receiptSn, 4, '0', STR_PAD_LEFT); \n $NoReceipt = $prefix->SPPrefix.\"/\".$SnNo;\n $parties = party::where('supplier',1)->get();\n return view('supplierPayment.supplierPayment',compact('parties','NoReceipt','receiptSn'));\n }", "public function actionCreate() {\n $this->active_menu = \"cps\";\n $this->open_class = \"inventory\";\n $this->active_class = \"generatepo\";\n $model = new Purchaseorder;\n if (isset($_POST['Purchaseorder'])) {\n $model->attributes = $_POST['Purchaseorder'];\n $model->state_code = $_POST['Purchaseorder']['state_code'];\n $model->place = Gststatecodes::model()->findByAttributes(array(\"state_code\" => $_POST['Purchaseorder']['state_code']))->state_name;\n $model->order_status = 'pending';\n if ($model->save())\n $this->redirect(array('admin'));\n }\n $this->render('create', array(\n 'model' => $model\n ));\n }", "public function actionCreate() {\n\t\t$model = new Invoices;\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\t\tif (isset($_GET['byorder']) and is_numeric($_GET['byorder']))\n\t\t\t$model->order_id = (int) $_GET['byorder'];\n\n\t\tif (isset($_POST['Invoices'])) {\n\t\t\t$model->attributes = $_POST['Invoices'];\n//\t\t\t$model->client_id = $model->order->client_id;\n\t\t\tif ($model->save()) {\n\t\t\t\t$msg = 'Счёт #' . $model->id . ' для Заказа #' . $model->order_id . ' ' . $model->order->name . ' создан';\n\t\t\t\tYii::app()->user->setFlash('success', $msg);\n\t\t\t\tYii::app()->logger->write($msg);\n\n\t\t\t\tif (isset($model->order_id))\n\t\t\t\t\t$this->redirect(array('orders/view', 'id' => $model->order_id));\n\t\t\t\telse\n\t\t\t\t\t$this->redirect(array('view', 'id' => $model->id));\n\t\t\t}\n\t\t}\n\t\t$model->date = date('Y-m-d');\n\t\t$model->num = $model->getLastNum() + 1;\n\n\t\t$this->render('create', array(\n\t\t\t'model' => $model,\n\t\t));\n\n//\t\tYii::app()->user->setFlash('error', 'Счет следует создавать из заказа');\n//\t\t$this->redirect('admin');//Yii::app()->request->urlReferrer);\n\t}", "public function create()\n {\n Cart::instance($this->instancia)->destroy();\n Cart::instance($this->instancia_carro_procesa)->destroy();\n\n $data['proceso'] = 'crea';\n $data['var'] = $this->var;\n $data['instancia'] = $this->instancia;\n $data['documentosCompra'] = PurchaseDocument::crsdocumentocom($this->ventana);\n $data['impuestos'] = Taxes::crsimpuesto();\n $data['tiposBienServicio'] = GoodsServicesType::all();\n $data['tipocompras'] = PurchasesType::all();\n $data['monedas'] = Currency::all();\n $data['condicionpagos'] = PaymentCondition::all();\n $data['terceros'] = Customer::all();\n $data['date'] = date('Y-m-d');\n $data['period'] = Period::where('descripcion', Session::get('period'))->first();\n $data['route'] = route('creditdebitnotes');\n $data['view'] = link_view('Compras', 'Transacción', 'Notas de Crédito/Débito', '');\n $data['header'] = headeroptions($this->var, 'crea', '', '');\n $data['sucursales'] = Subsidiaries::all();\n $data['impuestos2'] = Taxes::crsimpuesto2();\n return view('creditdebitnotes.create', $data);\n }", "public function create(Request $request)\n {\n $latest = invoice::latest()->first();\n $year = date('y');\n\n\n if (!$latest) {\n $receipt = 'ZTI' . $year . '0001';\n print_r($receipt);\n } else {\n $string = preg_replace(\"/[^0-9\\.]/\", '', $latest->invoicenumber);\n\n $receipt = 'ZTI' . sprintf('%04d', $string + 1);\n }\n\n invoice::create([\n 'clientid' => $request->clientid,\n 'invoicetype' => $request->invoicetype,\n 'invoicenumber' => $receipt,\n 'paymenttype' => $request->paymenttype,\n 'paymentstatus' => $request->paymentstatus,\n 'totalamount' => $request->totalamount,\n 'dueamount' => $request->dueamount,\n 'status' => $request->status,\n\n\n ]);\n return response()->json('The invoice created successfully');\n }", "public function create() {\n //create new book\n $new_book = $this->book_model->create_book();\n if (!$new_book) {\n //handle errors\n $message = \"There was a problem creating the new book.\";\n $this->error($message);\n return;\n }\n \n //display the updated book details\n $confirm = \"The book was successfully created.\";\n \n $view = new CreateBook();\n $view->display($confirm);\n }", "public function createReceipt($data, $transaction = null){\n\t\tif(!array_key_exists('receipt', $data)){\n\t\t\tthrow new Exception('Missing param receipt');\n\t\t}\n\t\t \n\t\t$aPReceipt = $data['receipt'];\n\t\t \n\t\tif(!array_key_exists('type', $aPReceipt)){\n\t\t\tthrow new Exception('Missing param type');\n\t\t}\n\t\t \n\t\t$type = $aPReceipt['type'];\n\t\t \n\t\tif(!Billing_Model_Receipt::isValidType($type)){\n\t\t\tthrow new Exception('Illegal/unknown receipt type');\n\t\t}\n\t\t \n\t\t$orderId = $aPReceipt['orderId'];\n\t\t \n\t\t$receiptController = Billing_Controller_Receipt::getInstance();\n\n\t\t$receipt = $receiptController->getEmptyReceipt();\n\t\t$shippingDoc = null;\n\t\t$receipt->__set('order_id',$orderId);\n\t\t$receipt->__set('type', $type);\n\n\t\tif(array_key_exists('receiptData', $aPReceipt)){\n\t\t\t$receiptData = $aPReceipt['receiptData'];\n\t\t\tforeach($receiptData as $key => $value){\n\t\t\t\t$receipt->__set($key, $value);\n\t\t\t}\n\t\t}\n\t\t\n\t\t$receipt = $receiptController->create($receipt);\n\n\t\tif(array_key_exists('positions',$aPReceipt)){\n\t\t\t$positions = $aPReceipt['positions'];\n\t\t\t$receiptPositionController = Billing_Controller_OrderPosition::getInstance();\n\t\t\t \n\t\t\t$posCount = 0;\n\t\t\tforeach($positions as $posData){\n\t\t\t\t$receiptPosition = $receiptPositionController->getEmptyOrderPosition();\n\t\t\t\t$receiptPosition->__set('receipt_id', $receipt->getId());\n\t\t\t\t$receiptPosition->__set('position_nr', ++$posCount);\n\n\t\t\t\tforeach($posData['positionData'] as $key => $value){\n\t\t\t\t\tif($key == 'price_group_id'){\n\t\t\t\t\t\tif(is_array($value)){\n\t\t\t\t\t\t\t$value = $value['id'];\n\t\t\t\t\t\t}elseif(is_object($value)){\n\t\t\t\t\t\t\t$value = $value->getId();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$receiptPosition->__set($key,$value);\n\t\t\t\t}\n\t\t\t\tif(array_key_exists('additionalData', $posData)){\n\t\t\t\t\t$receiptPosition->setAdditionalData($posData['additionalData']);\n\t\t\t\t}\n\t\t\t\t$receiptPositionController->create($receiptPosition);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $receipt->getId();\n\t}", "public function actionCreate()\n {\n $model = new Invoice();\n\t\t$items = [new InvoiceItem];\n\n if ($model->load(Yii::$app->request->post())) {\n $this->processItems($model, $items);\n }\n\n return $this->render('create', [\n 'model' => $model,\n\t\t\t'items' => $items\n ]);\n }", "public function actionCreate($id)\n\t{\n\t\t$model=new PurchaseOrder;\n\t\t$modelpr=$this->loadModelpr($id);\n\n\t\t// Uncomment the following line if AJAX validation is needed\n\t\t// $this->performAjaxValidation($model);\n\n\t\tif(isset($_POST['PurchaseOrder']))\n\t\t{\n\t\t\t$model->attributes=$_POST['PurchaseOrder'];\n\n\t\t\t$model->id_purchase_request=$id;\n\t\t\t$model->Status='PO';\n\t\t\t$model->created_user=Yii::app()->user->id;\n\t\t\t$model->created_date=date(\"Y-m-d H:i:s\");\n\t\t\t$model->ip_user_updated=$_SERVER['REMOTE_ADDR'];\n\t\t\t$model->TermOfPayment=Vendor::model()->findByPk($_POST['PurchaseOrder']['id_vendor'])->term_of_payment;\n\n\t\t\tif($model->save()){\n\n\t\t\t\t// insert nomornya\n\t\t\t\t$modelNew= new PurchaseOrder;\n\t\t\t\t$updateModel=PurchaseOrder::model()->findByPk($model->id_purchase_order);\n\t\t\t\t$dataformatnumber=NumberingDocumentDBPurchaseOrder::getFormatNumber($modelNew,'id_purchase_order','PONo','POMonth','POYear',$model->id_purchase_order);\n\t\t\t\t$updateModel->PONumber = $dataformatnumber['NumberFormat']; \n\t\t\t\t$updateModel->PONo = $dataformatnumber['NoOrder']; \n\t\t\t\t$updateModel->POMonth = NumberingDocumentDBPurchaseOrder::getMonthNow(); \n\t\t\t\t$updateModel->POYear = NumberingDocumentDBPurchaseOrder::getYearNow(); \n\t\t\t\t$updateModel->save(false);\n\n\n\n\t\t\t\t$updatepr=$this->loadModelpr($model->id_purchase_request);\n\t\t\t\t$updatepr->Status='PO';\n\t\t\t\t$updatepr->save(false);\n\n\t\t\t\tYii::app()->user->setFlash('success', \" Data Saved\");\n\t\t\t\t//$this->redirect(array('view','id'=>$model->id_purchase_request));\n\t\t\t\t$this->redirect(array('view','id'=>$model->id_purchase_order));\n\t\t\t}\n\t\t}\n\n\n\t\t$this->render('create',array(\n\t\t'model'=>$model,\n\t\t'modelpr'=>$modelpr,\n\t\t));\n\t}", "public function create()\n {\n /*\n * TODO remove this function, since notes belong to many Models\n *\n * */ }", "protected function createReceipt($resCode)\n {\n $receipt = new Receipt('sizpay', $resCode);\n\n return $receipt;\n }", "function Receipt()\n {\n \t$this->receipt = 1;\n }", "public function create() {\n\t\t$this->product = ( new Krokedil_Simple_Product() )->create();\n\t\t$order = ( new Krokedil_Order() )->create();\n\t\t$order->add_product( $this->product );\n\t\t$order->calculate_totals();\n\t\t$order->save();\n\t\t$this->order = $order;\n\t}", "public function create()\n {\n //\n $model = new Invoice();\n $client = Client::get();\n $item = 1;\n return view('invoice.form')->with('model',$model)\n ->with('client',$client)->with('item',$item);\n }", "public function actionCreate()\n {\n $model = new Prerrequisito();\n $modelsDetallepre = [new Detallepre];\n\n if ($model->load(Yii::$app->request->post()) && $model->save())\n {\n $modelsDetallepre = Model::createMultiple(Detallepre::classname());\n Model::loadMultiple($modelsDetallepre, Yii::$app->request->post());\n\n // validate all models\n $valid = $model->validate();\n $valid = Model::validateMultiple($modelsDetallepre) && $valid;\n\n if ($valid) {\n $transaction = \\Yii::$app->db->beginTransaction();\n try {\n if ($flag = $model->save(false)) {\n foreach ($modelsDetallepre as $modelsDetallepre)\n {\n $modelsDetallepre->idPrerreq = $model->idPrerreq;\n if (! ($flag = $modelsDetallepre->save(false))) {\n $transaction->rollBack();\n break;\n }\n }\n }\n if ($flag) {\n $transaction->commit();\n return $this->redirect(['view', 'id' => $model->idPrerreq]);\n }\n } catch (Exception $e) {\n $transaction->rollBack();\n }\n }\n return $this->redirect(['view','id' => $model->idPrerreq]);\n }\n else {\n return $this->render('create', [\n 'model' => $model,\n 'modelsDetallepre' => (empty($modelsDetallepre)) ? [new Detallepre] : $modelsDetallepre\n ]);\n }\n }" ]
[ "0.73168874", "0.6457993", "0.6457993", "0.64546597", "0.6419445", "0.6363247", "0.63571244", "0.63530517", "0.6347821", "0.63045883", "0.6283273", "0.61364836", "0.6106755", "0.6076518", "0.60335046", "0.60148895", "0.5999475", "0.5975141", "0.595632", "0.59370965", "0.5932358", "0.5929946", "0.591653", "0.59106064", "0.5900988", "0.5861796", "0.5852243", "0.579658", "0.5777323", "0.57688177" ]
0.6541949
1
Returns sub expressions by breaking given expression into individual sub expressions using PHP regular expressions.
public function getSubExpressions($expression_to_be_evaluated) { // Breaking an expression into sub expressions by logical operators &&, ||, etc. $sub_expressions = preg_split('/[&&,||]{2}/', $expression_to_be_evaluated); return $sub_expressions; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_outer_filter_expressions ($expression) {\n if (contains_logic_operator($expression) === false && !contains_brackets($expression) === false) {\n return $expression;\n }\n \n global $logicOperators;\n\n $outerExpressions = array();\n $expressionDepth = 0;\n $minExpressionDepth = get_minimum_expression_depth($expression);\n $subExpression = \"\";\n \n for ($i = 0; $i < strlen($expression); $i++) {\n $char = substr($expression, $i, 1);\n \n if ($char === \"(\") {\n $expressionDepth++;\n\n // Flush current subexpression (e.g. in case of 'not (... ')\n if ($expressionDepth === ($minExpressionDepth + 1)) {\n $subExpression = trim($subExpression);\n \n if (!empty($subExpression)) {\n array_push($outerExpressions, $subExpression);\n $subExpression = \"\";\n }\n }\n \n if ($expressionDepth > $minExpressionDepth) {\n $subExpression .= $char;\n }\n } else if ($char === \")\") {\n $expressionDepth--;\n \n // This is essential for expressions such as '(src ctry NL)' (to strip the last bracket properly)\n if ($expressionDepth >= $minExpressionDepth) {\n $subExpression .= $char;\n }\n \n // Flush current subexpression\n if ($expressionDepth === $minExpressionDepth) {\n $subExpression = trim($subExpression);\n \n if (!empty($subExpression)) {\n array_push($outerExpressions, $subExpression);\n $subExpression = \"\";\n }\n } \n } else {\n $subExpression .= $char;\n \n // Check if last keyword was a logic operator\n if ($expressionDepth === $minExpressionDepth) {\n foreach ($logicOperators as $operator) {\n if (strpos($subExpression, \" \".$operator) !== false) {\n $subExpression = trim(str_replace($operator, \"\", $subExpression));\n \n // Only add non-empty subexpression. Can be empty in\n // '(dst ctry CZ) and (src ctry NL)', for instance.\n if (!empty($subExpression)) {\n array_push($outerExpressions, $subExpression);\n $subExpression = \"\";\n }\n \n array_push($outerExpressions, trim($operator));\n\n // Since we check the presence of a logic operator principally\n // after each char, there can be at most one operator at a time\n break;\n }\n }\n unset($operator);\n }\n }\n }\n \n // Flush the 'character cache'\n if (!empty($subExpression)) {\n array_push($outerExpressions, trim($subExpression));\n $subExpression = \"\";\n }\n\n return $outerExpressions;\n }", "public static function parseToExpressions($expr)\n {\n $string = self::trim($expr);\n if($string == \"\") {\n return [];\n }\n $expressions = [];\n $tail = explode(\",\", $string);\n $head = array_shift($tail);\n while($head != null && strpos($head, self::OPEN_TAG) === false)\n {\n $head = rtrim($head, self::CLOSE_TAG);\n $expressions[] = $head;\n $head = array_shift($tail);\n }\n if(count($tail) == 0) {\n return $expressions;\n }\n // We've encountered an array within the array, so we need to find the corresponding closing tag\n array_unshift($tail, $head);\n $string = implode(\",\", $tail);\n $org = $string;\n\n $pos = 0;\n\n $depth = 1;\n while($depth > 0) {\n $a = strpos($string, self::OPEN_TAG);\n $b = strpos($string, self::CLOSE_TAG);\n\n // We encounter an opening tag\n if($a !== false && $a < $b) {\n $depth++;\n $string = substr($string, $a + 1);\n $pos += $a;\n // We encounter a closing tag\n } else if($b !== false) {\n $depth--;\n $string = substr($string, $b + 1);\n $pos += $b;\n } else {\n $depth--;\n }\n }\n\n $tail = $string;\n\n // Our sub-array\n $expressions[] = substr($org, 0, strlen($org) - strlen($tail));\n\n // Recursively solve it\n return array_merge($expressions, self::parseToExpressions($tail));\n }", "public function &getExpressions();", "public function parse($expression);", "public function testRecursiveAllowNestedBalancedParentheis_AndEscapedUnbalancedParentheis(){\n print __METHOD__ . \"\\n\"; \n $string = \n \"AND ( color: \\) #888; )\n OR ( body ( color: \\( #333; ) ) \n NOT ( body \\( color: \\( #333; \\) ) \n ( help me (forest) help me ) \n don't capture me ( color: blue;\\(\\) )\"; \n \n //$pattern = '/\\((?:[^()]+|(?R))*\\)/s';\n #$pattern = '/(?:AND[\\s]*)?' . '\\((?:[^()]+|(?R))*\\)/s';\n # AND followed by space is optional, e.g., when we have descended into it.\n \n $pattern = '/(?:(?:AND|OR|NOT)[\\s]*)?' . \n '\\((?:(?:\\\\\\\\[()]|[^()])+|(?R))*\\)'.\n '/s';\n \n // 2nd line: \n /*\n * \\( # find first opening of '(' \n * (?: # | start a new group but don't capture group\n * (?: # | |start a new group but don't capture group \n * \\\\\\\\[()] # | | allow escaped parenthesis in group e.g. '\\(' or '\\)' \n * | # | | or \n * [^()] # | | allow any char except parenthesis in group\n * )+ # | |close group, must occur once or more \n * | # | or\n * (?R) # | we may be at the start of a new group, repeat whole pattern.\n * )* # close group, occurs zero or many \n * \\) # expect balanced closing ')'\n */\n preg_match_all($pattern, $string, $groups);\n //print_r($groups); \n $this->assertEquals('AND ( color: \\) #888; )', $groups[0][0]); \n $this->assertEquals('OR ( body ( color: \\( #333; ) )', $groups[0][1]); \n $this->assertEquals('NOT ( body \\( color: \\( #333; \\) )', $groups[0][2]); \n $this->assertEquals('( help me (forest) help me )', $groups[0][3]); \n $this->assertEquals('( color: blue;\\(\\) )', $groups[0][4]); \n }", "public function build()\n {\n // Apply Shunting Yard algorithm to convert the infix expression\n // into Reverse Polish Notation. Since we have a very limited\n // set of operators and binding rules, the implementation becomes\n // really simple\n $ops = new \\SplStack();\n $rpn = array();\n foreach ($this->parts as $token) {\n if ($token instanceof Operator) {\n while (!$ops->isEmpty() && $token->compare($ops->top()) <= 0) {\n $rpn[] = $ops->pop();\n }\n $ops->push($token);\n } else {\n $rpn[] = $token;\n }\n }\n // Append the remaining operators\n while (!$ops->isEmpty()) {\n $rpn[] = $ops->pop();\n }\n\n // Walk the RPN expression to create AnyOf and AllOf matchers\n $stack = new \\splStack();\n foreach ($rpn as $token) {\n if ($token instanceof Operator) {\n\n // Our operators always need two operands\n if ($stack->count() < 2) {\n throw new \\RuntimeException('Unable to build a valid expression. Not enough operands available.');\n }\n\n $operands = array(\n $stack->pop(),\n $stack->pop(),\n );\n\n // Check what kind of matcher we need to create\n if ($token->getKeyword() === 'OR') {\n $matcher = new \\Hamcrest_Core_AnyOf($operands);\n } else { // AND, BUT\n $matcher = new \\Hamcrest_Core_AllOf($operands);\n }\n\n $stack->push($matcher);\n } else {\n $stack[] = $token;\n }\n }\n\n if ($stack->count() !== 1) {\n throw new \\RuntimeException('Unable to build a valid expression. The RPN stack should have just one item.');\n }\n\n return $stack->pop();\n }", "public function testRecursiveWithParaentheis(){\n print __METHOD__ . \"\\n\"; \n $string = <<<AAA\n body ( color: #888; )\n @media print ( body ( color: #333; ) )\n code ( color: blue; )\nAAA;\n $pattern = '/\\((?:[^()]+|(?R))*\\)/s';\n preg_match_all($pattern, $string, $groups);\n //print_r($groups); \n $this->assertEquals('( color: #888; )', $groups[0][0]); \n $this->assertEquals('( body ( color: #333; ) )', $groups[0][1]); \n $this->assertEquals('( color: blue; )', $groups[0][2]); \n }", "private function process_expr_list($tokens)\n {\n $expr = '';\n $type = '';\n $prev_token = '';\n $skip_next = false;\n $sub_expr = '';\n\n $in_lists = array();\n foreach ($tokens as $key => $token) {\n if (0 == strlen(trim($token))) {\n continue;\n }\n if ($skip_next) {\n $skip_next = false;\n continue;\n }\n\n $processed = false;\n $upper = strtoupper(trim($token));\n if (trim($token)) {\n $token = trim($token);\n }\n\n /* is it a subquery?*/\n if (preg_match('/^\\\\s*\\\\(\\\\s*SELECT/i', $token)) {\n $type = 'subquery';\n //tokenize and parse the subquery.\n //we remove the enclosing parenthesis for the tokenizer\n $processed = $this->parse(trim($token, ' ()'));\n /* is it an inlist */\n } elseif ('(' == $upper[0] && ')' == substr($upper, -1)) {\n if ('IN' == $prev_token) {\n $type = 'in-list';\n $processed = $this->split_sql(substr($token, 1, -1));\n $list = array();\n foreach ($processed as $v) {\n if (',' == $v) {\n continue;\n }\n $list[] = $v;\n }\n $processed = $list;\n unset($list);\n $prev_token = '';\n } elseif ('AGAINST' == $prev_token) {\n $type = 'match-arguments';\n $list = $this->split_sql(substr($token, 1, -1));\n if (count($list) > 1) {\n $match_mode = implode('', array_slice($list, 1));\n $processed = array($list[0], $match_mode);\n } else {\n $processed = $list[0];\n }\n $prev_token = '';\n }\n /* it is either an operator, a colref or a constant */\n } else {\n switch ($upper) {\n case 'AND':\n case '&&':\n case 'BETWEEN':\n case 'BINARY':\n case '&':\n case '~':\n case '|':\n case '^':\n case 'CASE':\n case 'WHEN':\n case 'END':\n case 'DIV':\n case '/':\n case '<=>':\n case '=':\n case '>=':\n case '>':\n case 'IS':\n case 'NOT':\n case 'NULL':\n case '<<':\n case '<=':\n case '<':\n case 'LIKE':\n case '-':\n case '%':\n case '!=':\n case '<>':\n case 'REGEXP':\n case '!':\n case '||':\n case 'OR':\n case '+':\n case '>>':\n case 'RLIKE':\n case 'SOUNDS':\n case '*':\n case 'XOR':\n case 'IN':\n $processed = false;\n $type = 'operator';\n break;\n default:\n switch ($token[0]) {\n case \"'\":\n case '\"':\n $type = 'const';\n break;\n case '`':\n $type = 'colref';\n break;\n\n default:\n if (is_numeric($token)) {\n $type = 'const';\n } else {\n $type = 'colref';\n }\n break;\n }\n //$processed = $token;\n $processed = false;\n }\n }\n /* is a reserved word? */\n if (('operator' != $type && 'in-list' != $type && 'sub_expr' != $type) && in_array($upper, $this->reserved)) {\n $token = $upper;\n if (!in_array($upper, $this->functions)) {\n $type = 'reserved';\n } else {\n switch ($token) {\n case 'AVG':\n case 'SUM':\n case 'COUNT':\n case 'MIN':\n case 'MAX':\n case 'STDDEV':\n case 'STDDEV_SAMP':\n case 'STDDEV_POP':\n case 'VARIANCE':\n case 'VAR_SAMP':\n case 'VAR_POP':\n case 'GROUP_CONCAT':\n case 'BIT_AND':\n case 'BIT_OR':\n case 'BIT_XOR':\n $type = 'aggregate_function';\n if (!empty($tokens[$key + 1])) {\n $sub_expr = $tokens[$key + 1];\n }\n //$skip_next=true;\n break;\n\n default:\n $type = 'function';\n if (!empty($tokens[$key + 1])) {\n $sub_expr = $tokens[$key + 1];\n } else {\n $sub_expr = '()';\n }\n //$skip_next=true;\n\n break;\n }\n }\n }\n\n if (!$type) {\n if ('(' == $upper[0]) {\n $local_expr = substr(trim($token), 1, -1);\n } else {\n $local_expr = $token;\n }\n $processed = $this->process_expr_list($this->split_sql($local_expr));\n $type = 'expression';\n\n if (1 == count($processed)) {\n $type = $processed[0]['expr_type'];\n $base_expr = $processed[0]['base_expr'];\n $processed = $processed[0]['sub_tree'];\n }\n }\n\n $sub_expr = trim($sub_expr);\n $sub_expr = '';\n\n $expr[] = array('expr_type' => $type, 'base_expr' => $token, 'sub_tree' => $processed);\n $prev_token = $upper;\n $expr_type = '';\n $type = '';\n }\n if ($sub_expr) {\n $processed['sub_tree'] = $this->process_expr_list($this->split_sql(substr($sub_expr, 1, -1)));\n }\n\n if (!is_array($processed)) {\n print_r($processed);\n $processed = false;\n }\n\n if ($expr_type) {\n $expr[] = array('expr_type' => $type, 'base_expr' => $token, 'sub_tree' => $processed);\n }\n $mod = false;\n\n /*\n\n for($i=0;$i<count($expr);++$i){\n if($expr[$i]['expr_type'] == 'function' ||\n $expr[$i]['expr_type'] == 'aggregate_function') {\n if(!empty($expr[$i+1])) {\n $expr[$i]['sub_tree']=$expr[$i+1]['sub_tree'];\n unset($expr[$i+1]);\n $mod = 1;\n ++$i; // BAD FORM TO MODIFY THE LOOP COUNTER\n }\n }\n\n }\n\n */\n\n if ($mod) {\n $expr = array_values($expr);\n }\n\n return $expr;\n }", "protected function parseFunction_regexp() {\n\t\t$input = func_get_args();\n\t\t$nodes = array();\n\n\t\t$regexp = array_shift($input);\n\n\t\t// $input is an array of arrays, e.g.,\n\t\t// array_diff($input[0], $input[1])\n\t\t$input = call_user_func_array('array_merge',\n\t\t\tarray_values($input));\n\n\t\twhile(list($junk, $node) = each($input)) {\n\t\t\tif(preg_match($regexp, $node)) {\n\t\t\t\t$nodes[] = $node;\n\t\t\t}\n\t\t}\n\t\treset($input);\n\n\t\treturn $nodes;\n\t}", "function my_preg_split($regexp, $string) {\n// useful for distinguishing between whitespace and endline\n $new_string = array();\n $string_tmp = preg_split($regexp, $string, -1, PREG_SPLIT_OFFSET_CAPTURE);\n $counter = 0;\n foreach ($string_tmp as $key => $this_string_tmp) {\n $counter++;\n $new_string[$key][0] = $this_string_tmp[0];\n if ($counter != sizeof($string_tmp)) {\n $new_string[$key][1] = substr($string, $this_string_tmp[1] + strlen($this_string_tmp[0]), 1);\n }\n }\n return $new_string;\n}", "private function parseEquation(string $equation) \n {\n $length = strlen($equation);\n $equationParts = [];\n $operandTemporaryContainer = [];\n \n for ($i = 0; $i < $length; $i++) {\n $token = $this->getToken($equation, $i);\n if(is_numeric($token)) {\n $equationParts[] = $token;\n } else {\n if(!in_array($token, $this->validTokens)) {\n throw new \\Exception('Not a valid token');\n }\n\n while($lastAddedOperand = $this->readLastAddedOperand($operandTemporaryContainer)) {\n if (\n self::$operators[$token]['assoc'] == 'left' &&\n self::$operators[$token]['pre'] <= self::$operators[$lastAddedOperand]['pre']\n ) {\n $function = self::$operators[$lastAddedOperand]['function'];\n $equationParts[] = $function;\n\n /**\n * Se lo abbiamo aggiunto, dobbiamo rimuoverlo\n */\n array_pop($operandTemporaryContainer);\n } else {\n break;\n }\n }\n $operandTemporaryContainer[] = $token;\n }\n }\n \n while (count($operandTemporaryContainer) > 0) {\n $operand = array_pop($operandTemporaryContainer);\n $function = self::$operators[$operand]['function'];\n $equationParts[] = $function;\n }\n \n return $equationParts;\n }", "protected function buildRegexPatterns()\n {\n $regex = [];\n $regex[self::ESCAPABLE] = self::REGEX_ESCAPABLE;\n $regex[self::ESCAPED_CHAR] = '\\\\\\\\' . $regex[self::ESCAPABLE];\n $regex[self::IN_DOUBLE_QUOTES] = '\"(' . $regex[self::ESCAPED_CHAR] . '|[^\"\\x00])*\"';\n $regex[self::IN_SINGLE_QUOTES] = '\\'(' . $regex[self::ESCAPED_CHAR] . '|[^\\'\\x00])*\\'';\n $regex[self::IN_PARENS] = '\\\\((' . $regex[self::ESCAPED_CHAR] . '|[^)\\x00])*\\\\)';\n $regex[self::REG_CHAR] = '[^\\\\\\\\()\\x00-\\x20]';\n $regex[self::IN_PARENS_NOSP] = '\\((' . $regex[self::REG_CHAR] . '|' . $regex[self::ESCAPED_CHAR] . '|\\\\\\\\)*\\)';\n $regex[self::TAGNAME] = '[A-Za-z][A-Za-z0-9-]*';\n $regex[self::BLOCKTAGNAME] = '(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|title|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)';\n $regex[self::ATTRIBUTENAME] = '[a-zA-Z_:][a-zA-Z0-9:._-]*';\n $regex[self::UNQUOTEDVALUE] = '[^\"\\'=<>`\\x00-\\x20]+';\n $regex[self::SINGLEQUOTEDVALUE] = '\\'[^\\']*\\'';\n $regex[self::DOUBLEQUOTEDVALUE] = '\"[^\"]*\"';\n $regex[self::ATTRIBUTEVALUE] = '(?:' . $regex[self::UNQUOTEDVALUE] . '|' . $regex[self::SINGLEQUOTEDVALUE] . '|' . $regex[self::DOUBLEQUOTEDVALUE] . ')';\n $regex[self::ATTRIBUTEVALUESPEC] = '(?:' . '\\s*=' . '\\s*' . $regex[self::ATTRIBUTEVALUE] . ')';\n $regex[self::ATTRIBUTE] = '(?:' . '\\s+' . $regex[self::ATTRIBUTENAME] . $regex[self::ATTRIBUTEVALUESPEC] . '?)';\n $regex[self::OPENTAG] = '<' . $regex[self::TAGNAME] . $regex[self::ATTRIBUTE] . '*' . '\\s*\\/?>';\n $regex[self::CLOSETAG] = '<\\/' . $regex[self::TAGNAME] . '\\s*[>]';\n $regex[self::OPENBLOCKTAG] = '<' . $regex[self::BLOCKTAGNAME] . $regex[self::ATTRIBUTE] . '*' . '\\s*\\/?>';\n $regex[self::CLOSEBLOCKTAG] = '<\\/' . $regex[self::BLOCKTAGNAME] . '\\s*[>]';\n $regex[self::HTMLCOMMENT] = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';\n $regex[self::PROCESSINGINSTRUCTION] = '[<][?].*?[?][>]';\n $regex[self::DECLARATION] = '<![A-Z]+' . '\\s+[^>]*>';\n $regex[self::CDATA] = '<!\\[CDATA\\[[\\s\\S]*?]\\]>';\n $regex[self::HTMLTAG] = '(?:' . $regex[self::OPENTAG] . '|' . $regex[self::CLOSETAG] . '|' . $regex[self::HTMLCOMMENT] . '|' .\n $regex[self::PROCESSINGINSTRUCTION] . '|' . $regex[self::DECLARATION] . '|' . $regex[self::CDATA] . ')';\n $regex[self::HTMLBLOCKOPEN] = '<(?:' . $regex[self::BLOCKTAGNAME] . '(?:[\\s\\/>]|$)' . '|' .\n '\\/' . $regex[self::BLOCKTAGNAME] . '(?:[\\s>]|$)' . '|' . '[?!])';\n $regex[self::LINK_TITLE] = '^(?:\"(' . $regex[self::ESCAPED_CHAR] . '|[^\"\\x00])*\"' .\n '|' . '\\'(' . $regex[self::ESCAPED_CHAR] . '|[^\\'\\x00])*\\'' .\n '|' . '\\((' . $regex[self::ESCAPED_CHAR] . '|[^)\\x00])*\\))';\n\n $this->regex = $regex;\n }", "private function build_expresssion_regexp($expression, &$name, &$type) {\r\n \t\t$arr_expression = explode(':', $expression);\r\n \t\t$name = Arr::get_item($arr_expression, 0, '');\r\n \t\t$type = Arr::get_item($arr_expression, 1, 's');\r\n \t\t$params = Arr::get_item($arr_expression, 2, false);\r\n \t\tif (empty($name)) {\r\n \t\t\tthrow new Exception(tr('Illegal expression name found: %i', 'core', array('%i' => $expression)));\r\n \t\t}\r\n \t\t\r\n \t\t$handler = $this->get_handler($type);\r\n \t\tif ($handler) {\r\n\t\t\treturn $handler->get_validate_regex($params); \t\t\t\r\n \t\t}\r\n \t\telse {\r\n \t\t\treturn $this->build_unknown_type_regexp($type, $params);\t\r\n \t\t}\r\n \t}", "public function exprToOperands(string $expr):array\n {\n $expr = str_split($expr);\n $operands = [];\n $operand = null;\n\n foreach ($expr as $literal) {\n if ($this->isNumber($literal) || ($literal===static::OPERATOR_MINUS && $operand===null)) {\n $operand .= $literal;\n }else{\n $this->arrayPush($operands, $operand);\n $this->arrayPush($operands, $literal);\n $operand = '';\n }\n }\n $this->arrayPush($operands, $operand);\n\n return $this->normalizeOperands($operands);\n }", "private function process_select_expr($expression)\n {\n $capture = false;\n $alias = '';\n $base_expression = $expression;\n $upper = trim(strtoupper($expression));\n //if necessary, unpack the expression\n if ('(' == $upper[0]) {\n //$expression = substr($expression,1,-1);\n $base_expression = $expression;\n }\n\n $tokens = $this->split_sql($expression);\n $token_count = count($tokens);\n\n /* Determine if there is an explicit alias after the AS clause.\n If AS is found, then the next non-whitespace token is captured as the alias.\n The tokens after (and including) the AS are removed.\n */\n $base_expr = '';\n $stripped = array();\n $capture = false;\n $alias = '';\n $processed = false;\n for ($i = 0; $i < $token_count; ++$i) {\n $token = strtoupper($tokens[$i]);\n if (trim($token)) {\n $stripped[] = $tokens[$i];\n }\n\n if ('AS' == $token) {\n unset($tokens[$i]);\n $capture = true;\n continue;\n }\n\n if ($capture) {\n if (trim($token)) {\n $alias .= $tokens[$i];\n }\n unset($tokens[$i]);\n continue;\n }\n $base_expr .= $tokens[$i];\n }\n\n $stripped = $this->process_expr_list($stripped);\n $last = array_pop($stripped);\n if (!$alias && 'colref' == $last['expr_type']) {\n $prev = array_pop($stripped);\n if ('operator' == $prev['expr_type'] || 'const' == $prev['expr_type'] || 'function' == $prev['expr_type'] || 'expression' == $prev['expr_type'] || //$prev['expr_type'] == 'aggregate_function' ||\n 'subquery' == $prev['expr_type'] || 'colref' == $prev['expr_type']\n ) {\n $alias = $last['base_expr'];\n\n //remove the last token\n array_pop($tokens);\n\n $base_expr = implode('', $tokens);\n }\n }\n\n if (!$alias) {\n $base_expr = implode('', $tokens);\n $alias = $base_expr;\n }\n\n /* Properly escape the alias if it is not escaped */\n if ('`' != $alias[0]) {\n $alias = '`'.str_replace('`', '``', $alias).'`';\n }\n $processed = false;\n $type = 'expression';\n\n if ('(' == substr(trim($base_expr), 0, 1)) {\n $base_expr = substr($expression, 1, -1);\n if (preg_match('/^sel/i', $base_expr)) {\n $type = 'subquery';\n $processed = $this->parse($base_expr);\n }\n }\n if (!$processed) {\n $processed = $this->process_expr_list($tokens);\n }\n\n if (1 == count($processed)) {\n $type = $processed[0]['expr_type'];\n $processed = false;\n }\n\n return array('expr_type' => $type, 'alias' => $alias, 'base_expr' => $base_expr, 'sub_tree' => $processed);\n }", "function preg_match($pattern, $subject, &$subpatterns, $flags, $offset) {}", "function preg_match_batch($expr, $batch = array() , $flag = 0) {\n $matches = array();\n $i=0;\n\n // If empty matches should be discarded\n if ($flag === self::PREG_DISCARD_EMPTY_MATCHES) {\n foreach ($batch as $str) {\n if (preg_match($expr, $str, $found)) {\n $matches[$i] = $found;\n ++$i;\n }\n }\n }\n // If empty matches should not be discarded\n else {\n foreach ($batch as $str) {\n preg_match($expr, $str, $found);\n $matches[$i] = $found;\n ++$i;\n }\n }\n\n return $matches;\n }", "function match($expr, $subject = NULL, array $constraints = array()) {\n static $tokens = NULL;\n\n\n if (is_null($tokens)) {\n $latin = '\\pL';\n\n if ( ! IS_UNICODE) {\n $latin = 'a-zA-Z€$';\n $latin .= 'âêîôûÂÊÎÔÛÄËÏÖÜäëïöü';\n $latin .= 'áéíóúÁÉÍÓÚñÑÙÒÌÈÀùòìèàŷŶŸÿ';\n }\n\n\n $chars = preg_quote('$-_.+!*\\'(),', '/');\n $tokens = array(\n '/\\\\\\\\\\*([a-z_][a-z\\d_]*?)(?=\\b)/i' => '(?<\\\\1>.+?)',\n '/\\\\\\:([a-z_][a-z\\d_]*?)(?=\\b)/i' => '(?<\\\\1>[^\\/]+?)',\n '/%s/' => '(?<=\\W|^)(\\w*[\\d' . $latin . $chars . ']+\\w*)(?=\\W|$)',\n '/%r/' => '([\\d' . $latin . $chars . ']+?)',\n '/%R/' => '[^\\d' . $latin . $chars . ']+',\n '/%d/' => '(?<=\\D|^)(-?[0-9\\.,]+?)(?=\\D|$)',\n '/%g/' => '([\\d' . $latin . ']+?)',\n '/%G/' => '[^\\d' . $latin . ']+',\n '/%l/' => '\\d' . $latin . $chars,\n '/%L/' => '\\d' . $latin,\n '/\\\\\\\\([\\^|bws+$?[\\]])/i' => '\\\\1',\n '/\\\\\\\\\\*/' => '(.+?|())',\n '/\\\\\\\\\\)/' => '|())',\n '/\\\\\\\\\\(/' => '(?:',\n );\n }\n\n\n $expr = preg_quote($expr, '/');\n\n if (is_array($constraints)) {\n $test = array();\n\n foreach ($constraints as $item => $value) {\n if (is_num($as = preg_replace('/[^a-z\\d_]/', '', $item))) {\n continue;\n }\n\n $item = preg_quote($item, '/');\n $value = strtr($value, '/', '\\\\/');\n $expr = str_replace($item, \"(?<$as>$value)\", $expr);\n }\n }\n\n\n $regex = preg_replace(array_keys($tokens), $tokens, $expr);\n\n if (func_num_args() === 1) {\n return \"/$regex/\";\n } elseif (@preg_match(\"/$regex/u\", $subject, $matches)) {\n return $matches;\n }\n\n return FALSE;\n}", "function splitExpression($expression): array\n {\n $expressionSplit = str_split($expression);\n $timeUnit = '';\n $integer = 1; // default 1 if no integer set\n if (count($expressionSplit) == 2) {\n $timeUnit = $expressionSplit[1];\n $integer = $expressionSplit[0];\n } else if (count($expressionSplit) == 1) {\n $timeUnit = $expressionSplit[0];\n }\n return ['time_unit' => $timeUnit, 'integer' => $integer];\n }", "public function eachMatch($regularExpression, $replace='$0') {\n $result = new String\\Collection();\n if (preg_match_all($regularExpression, $this->value, $matchesCollection, PREG_SET_ORDER)) {\n foreach ($matchesCollection as $matches) {\n $result->addOne(new String(preg_replace($regularExpression, $replace, $matches[0])));\n }\n }\n return $result;\n }", "public static function parse($expr)\n {\n $expressions = self::parseToExpressions($expr);\n $elements = [];\n foreach($expressions as $expression) {\n $elements[] = ExpressionFactory::create($expression);\n }\n return $elements;\n }", "function build_regexp(&$bbcode_match, &$bbcode_tpl)\n{\n\t$bbcode_match = trim($bbcode_match);\n\t$bbcode_tpl = trim($bbcode_tpl);\n\n\t$fp_match = preg_quote($bbcode_match, '!');\n\t$fp_replace = preg_replace('#^\\[(.*?)\\]#', '[$1:$uid]', $bbcode_match);\n\t$fp_replace = preg_replace('#\\[/(.*?)\\]$#', '[/$1:$uid]', $fp_replace);\n\n\t$sp_match = preg_quote($bbcode_match, '!');\n\t$sp_match = preg_replace('#^\\\\\\\\\\[(.*?)\\\\\\\\\\]#', '\\[$1:$uid\\]', $sp_match);\n\t$sp_match = preg_replace('#\\\\\\\\\\[/(.*?)\\\\\\\\\\]$#', '\\[/$1:$uid\\]', $sp_match);\n\t$sp_replace = $bbcode_tpl;\n\n\t// @todo Make sure to change this too if something changed in message parsing\n\t$tokens = array(\n\t\t'TEXT' => array(\n\t\t\t'!(.*?)!es'\t =>\t\"str_replace(array(\\\"\\\\r\\\\n\\\", '\\\\\\\"', '\\\\'', '(', ')'), array(\\\"\\\\n\\\", '\\\"', '&#39;', '&#40;', '&#41;'), trim('\\$1'))\"\n\t\t)\n\t);\n\n\t$sp_tokens = array(\n\t\t'TEXT' => '(.*?)',\n\t);\n\n\t$pad = 0;\n\t$modifiers = 'i';\n\n\tif (preg_match_all('/\\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\\}/i', $bbcode_match, $m))\n\t{\n\t\tforeach ($m[0] as $n => $token)\n\t\t{\n\t\t\t$token_type = $m[1][$n];\n\n\t\t\treset($tokens[strtoupper($token_type)]);\n\t\t\tlist($match, $replace) = each($tokens[strtoupper($token_type)]);\n\n\t\t\t// Pad backreference numbers from tokens\n\t\t\tif (preg_match_all('/(?<!\\\\\\\\)\\$([0-9]+)/', $replace, $repad))\n\t\t\t{\n\t\t\t\t$repad = $pad + sizeof(array_unique($repad[0]));\n\t\t\t\t$replace = preg_replace('/(?<!\\\\\\\\)\\$([0-9]+)/e', \"'\\${' . (\\$1 + \\$pad) . '}'\", $replace);\n\t\t\t\t$pad = $repad;\n\t\t\t}\n\n\t\t\t// Obtain pattern modifiers to use and alter the regex accordingly\n\t\t\t$regex = preg_replace('/!(.*)!([a-z]*)/', '$1', $match);\n\t\t\t$regex_modifiers = preg_replace('/!(.*)!([a-z]*)/', '$2', $match);\n\n\t\t\tfor ($i = 0, $size = strlen($regex_modifiers); $i < $size; ++$i)\n\t\t\t{\n\t\t\t\tif (strpos($modifiers, $regex_modifiers[$i]) === false)\n\t\t\t\t{\n\t\t\t\t\t$modifiers .= $regex_modifiers[$i];\n\n\t\t\t\t\tif ($regex_modifiers[$i] == 'e')\n\t\t\t\t\t{\n\t\t\t\t\t\t$fp_replace = \"'\" . str_replace(\"'\", \"\\\\'\", $fp_replace) . \"'\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ($regex_modifiers[$i] == 'e')\n\t\t\t\t{\n\t\t\t\t\t$replace = \"'.$replace.'\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match);\n\t\t\t$fp_replace = str_replace($token, $replace, $fp_replace);\n\n\t\t\t$sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match);\n\t\t\t$sp_replace = str_replace($token, '${' . ($n + 1) . '}', $sp_replace);\n\t\t}\n\n\t\t$fp_match = '!' . $fp_match . '!' . $modifiers;\n\t\t$sp_match = '!' . $sp_match . '!s';\n\n\t\tif (strpos($fp_match, 'e') !== false)\n\t\t{\n\t\t\t$fp_replace = str_replace(\"'.'\", '', $fp_replace);\n\t\t\t$fp_replace = str_replace(\".''.\", '.', $fp_replace);\n\t\t}\n\t}\n\telse\n\t{\n\t\t// No replacement is present, no need for a second-pass pattern replacement\n\t\t// A simple str_replace will suffice\n\t\t$fp_match = '!' . $fp_match . '!' . $modifiers;\n\t\t$sp_match = $fp_replace;\n\t\t$sp_replace = '';\n\t}\n\n\t// Lowercase tags\n\t$bbcode_tag = preg_replace('/.*?\\[([a-z0-9_-]+=?).*/i', '$1', $bbcode_match);\n\t$bbcode_search = preg_replace('/.*?\\[([a-z0-9_-]+)=?.*/i', '$1', $bbcode_match);\n\n\t$fp_match = preg_replace('#\\[/?' . $bbcode_search . '#ie', \"strtolower('\\$0')\", $fp_match);\n\t$fp_replace = preg_replace('#\\[/?' . $bbcode_search . '#ie', \"strtolower('\\$0')\", $fp_replace);\n\t$sp_match = preg_replace('#\\[/?' . $bbcode_search . '#ie', \"strtolower('\\$0')\", $sp_match);\n\t$sp_replace = preg_replace('#\\[/?' . $bbcode_search . '#ie', \"strtolower('\\$0')\", $sp_replace);\n\n\treturn array(\n\t\t'bbcode_tag'\t\t\t\t=> $bbcode_tag,\n\t\t'first_pass_match'\t\t\t=> $fp_match,\n\t\t'first_pass_replace'\t\t=> $fp_replace,\n\t\t'second_pass_match'\t\t\t=> $sp_match,\n\t\t'second_pass_replace'\t\t=> $sp_replace\n\t);\n}", "function regex($regex) {\r\n $f = function ($res) use ($regex, & $f) { // &$f for anonymous recursion\r\n if ($res === null) {\r\n return null;\r\n } else if (is_string($res)) {\r\n preg_match($regex, $res, $m);\r\n if (count(array_filter(array_keys($m), 'is_string')) === 0) { // regex has no named subpatterns\r\n unset($m[0]);\r\n } else {\r\n foreach ($m as $k => $v) if (is_int($k)) unset($m[$k]);\r\n }\r\n return $m;\r\n } else if (is_array($res)) {\r\n $return = array();\r\n foreach ($res as $k => $v) $return[$k] = $f($v);\r\n return $return;\r\n } else {\r\n throw new \\Exception(\"Method `regex' should be applied only to Matcher::single which returns string or array of strings\");\r\n }\r\n };\r\n return $this->map($f);\r\n }", "public static function evaluateExpression($expression) {\n\t\t$returnValue = '';\n\t\t$hasValue = FALSE;\n\t\tif (!isset($expression) || $expression === '') {\n\t\t\tthrow new Exception('Empty expression received');\n\t\t} else {\n\t\t\t\t// First of all, evaluate any subexpressions that may be contained in the expression\n\t\t\t$parsedExpression = self::evaluateString($expression, FALSE);\n\t\t\t\t// An expression may contain several expressions as alternativtye values, separated by a double slash (//)\n\t\t\t$allExpressions = t3lib_div::trimExplode('//', $parsedExpression, TRUE);\n\t\t\t$numberOfAlternatives = count($allExpressions);\n\t\t\tforeach ($allExpressions as $anExpression) {\n\t\t\t\t\t// Decrease the number of remaining alternatives\n\t\t\t\t$numberOfAlternatives--;\n\t\t\t\t\t// Check if there's a function call\n\t\t\t\t$functions = array();\n\t\t\t\tif (strpos($anExpression, '->') !== FALSE) {\n\t\t\t\t\t\t// Split on the function call marker (->)\n\t\t\t\t\t$expressionParts = t3lib_div::trimExplode('->', $anExpression, TRUE);\n\t\t\t\t\t\t// The first part is the expression itself\n\t\t\t\t\t$anExpression = array_shift($expressionParts);\n\t\t\t\t\t\t// All other parts are function definitions\n\t\t\t\t\t$functions = $expressionParts;\n\t\t\t\t}\n\t\t\t\t\t// If there's no colon (:) in the expression, take it to be a litteral value and return it as is\n\t\t\t\tif (strpos($anExpression, ':') === FALSE) {\n\t\t\t\t\t$returnValue = $anExpression;\n\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t} else {\n\t\t\t\t\t$subParts = t3lib_div::trimExplode(':', $anExpression, TRUE);\n\t\t\t\t\t$key = array_shift($subParts);\n\t\t\t\t\t$indices = implode(':', $subParts);\n\t\t\t\t\tif (empty($indices)) {\n\t\t\t\t\t\tthrow new Exception('No indices in expression: ' . $expression);\n\t\t\t\t\t}\n\t\t\t\t\t$key = strtolower($key);\n\t\t\t\t\tswitch ($key) {\n\t\t\t\t\t\t\t// Search for a value in the TSFE\n\t\t\t\t\t\tcase 'tsfe':\n\t\t\t\t\t\t\tif (TYPO3_MODE == 'FE') {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t$returnValue = self::getValue($GLOBALS['TSFE'], $indices);\n\t\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Throw exception, but only if we have run out of alternatives\n\t\t\t\t\t\t\t\tif ($numberOfAlternatives == 0) {\n\t\t\t\t\t\t\t\t\tthrow new Exception('TSFE not available in this mode (' . TYPO3_MODE . ')');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in the page record\n\t\t\t\t\t\t\t// This is a convenience shortcut, as the page record is in the TSFE\n\t\t\t\t\t\tcase 'page':\n\t\t\t\t\t\t\tif (TYPO3_MODE == 'FE') {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t$returnValue = self::getValue($GLOBALS['TSFE']->page, $indices);\n\t\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Throw exception, but only if we have run out of alternatives\n\t\t\t\t\t\t\t\tif ($numberOfAlternatives == 0) {\n\t\t\t\t\t\t\t\t\tthrow new Exception('TSFE->page not available in this mode (' . TYPO3_MODE . ')');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in the template configuration\n\t\t\t\t\t\t\t// This is a convenience shortcut, as the template configuration is in the TSFE\n\t\t\t\t\t\tcase 'config':\n\t\t\t\t\t\t\tif (TYPO3_MODE == 'FE') {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t$returnValue = self::getValue($GLOBALS['TSFE']->config['config'], $indices);\n\t\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Throw exception, but only if we have run out of alternatives\n\t\t\t\t\t\t\t\tif ($numberOfAlternatives == 0) {\n\t\t\t\t\t\t\t\t\tthrow new Exception('TSFE->config not available in this mode (' . TYPO3_MODE . ')');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in the merged GET and POST arrays\n\t\t\t\t\t\tcase 'plugin':\n\t\t\t\t\t\t\tif (TYPO3_MODE == 'FE') {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t$returnValue = self::getValue($GLOBALS['TSFE']->tmpl->setup['plugin.'], $indices);\n\t\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Throw exception, but only if we have run out of alternatives\n\t\t\t\t\t\t\t\tif ($numberOfAlternatives == 0) {\n\t\t\t\t\t\t\t\t\tthrow new Exception('Plugin setup not available in this mode (' . TYPO3_MODE . ')');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in the merged GET and POST arrays\n\t\t\t\t\t\tcase 'gp':\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$returnValue = self::getValue(array_merge(t3lib_div::_GET(), t3lib_div::_POST()), $indices);\n\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in the local variables\n\t\t\t\t\t\tcase 'vars':\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$returnValue = self::getValue(self::$vars, $indices);\n\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in the extra data\n\t\t\t\t\t\tcase 'extra':\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$returnValue = self::getValue(self::$extraData, $indices);\n\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Calculate a value using the PHP date() function\n\t\t\t\t\t\tcase 'date':\n\t\t\t\t\t\t\t$returnValue = date($indices);\n\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'strtotime':\n\t\t\t\t\t\t\t$value = strtotime($indices);\n\t\t\t\t\t\t\tif ($value === FALSE || $value === -1) {\n\t\t\t\t\t\t\t\tthrow new Exception('Date string could not be parsed: ' . $indices);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$returnValue = $value;\n\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Get data from the session\n\t\t\t\t\t\t\t// The session key is the first segment after the \"session\" keyword\n\t\t\t\t\t\tcase 'session':\n\t\t\t\t\t\t\t$segments = t3lib_div::trimExplode('|', $indices, TRUE);\n\t\t\t\t\t\t\t$cacheKey = array_shift($segments);\n\t\t\t\t\t\t\t$indices = implode('|', $segments);\n\t\t\t\t\t\t\t$cache = $GLOBALS['TSFE']->fe_user->getKey('ses', $cacheKey);\n\t\t\t\t\t\t\tif (empty($cache)) {\n\t\t\t\t\t\t\t\t\t// Throw exception, but only if we have run out of alternatives\n\t\t\t\t\t\t\t\tif ($numberOfAlternatives == 0) {\n\t\t\t\t\t\t\t\t\tthrow new Exception('No session data found for expression: ' . $expression);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$returnValue = self::getValue($cache, $indices);\n\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in FE User\n\t\t\t\t\t\tcase 'fe_user':\n\t\t\t\t\t\t\tif (TYPO3_MODE == 'FE') {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t$returnValue = self::getValue($GLOBALS['TSFE']->fe_user->user, $indices);\n\t\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Throw exception, but only if we have run out of alternatives\n\t\t\t\t\t\t\t\tif ($numberOfAlternatives == 0) {\n\t\t\t\t\t\t\t\t\tthrow new Exception('TSFE->fe_user not available in this mode (' . TYPO3_MODE . ')');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// Search for a value in the environment variables as returned by t3lib_div::getIndpEnv()\n\t\t\t\t\t\tcase 'env':\n\t\t\t\t\t\t\t$returnValue = t3lib_div::getIndpEnv(strtoupper($indices));\n\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t// If none of the standard keys matched, try looking for a hook for that given key\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tif (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][self::$extKey]['keyProcessor'][$key])) {\n\t\t\t\t\t\t\t\t\t/** @var $keyProcessor tx_expressions_keyProcessor */\n\t\t\t\t\t\t\t\t$keyProcessor = &t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][self::$extKey]['keyProcessor'][$key]);\n\t\t\t\t\t\t\t\tif ($keyProcessor instanceof tx_expressions_keyProcessor) {\n\t\t\t\t\t\t\t\t\t$returnValue = $keyProcessor->getValue($indices);\n\t\t\t\t\t\t\t\t\t$hasValue = TRUE;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\t// If a value was found, process it and exit the loop\n\t\t\t\tif ($hasValue) {\n\t\t\t\t\t\t// Call functions, if any\n\t\t\t\t\tif (count($functions) > 0) {\n\t\t\t\t\t\tforeach ($functions as $functionDefinition) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t$returnValue = self::processFunctionCall($returnValue, $functionDefinition);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Do nothing on exceptions, value is unchanged\n\t\t\t\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t// If a value was found, call a post-processing hook and return the value\n\t\tif ($hasValue) {\n\t\t\tif (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][self::$extKey]['postprocessReturnValue'])) {\n\t\t\t\tforeach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][self::$extKey]['postprocessReturnValue'] as $className) {\n\t\t\t\t\t\t/** @var $postProcessor tx_expressions_valuePostProcessor */\n\t\t\t\t\t$postProcessor = &t3lib_div::getUserObj($className);\n\t\t\t\t\tif ($postProcessor instanceof tx_expressions_valuePostProcessor) {\n\t\t\t\t\t\t$returnValue = $postProcessor->postprocessReturnValue($returnValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $returnValue;\n\n\t\t\t// No value was found, throw an exception\n\t\t} else {\n\t\t\tthrow new Exception('No value found for expression: ' . $expression);\n\t\t}\n\t}", "public function getTokens($string, &$needle = 0)\n {\n $exprTokenizer = new ExpressionTokenizer();\n $ret = array();\n $depth = 0;\n $needle = 0;\n $len = strlen($string);\n while ($needle < $len) {\n $before = $needle;\n $substr = substr($string, $needle);\n if ($depth === 0) {\n // match either '$(' or '@(' and mark that as an EXPR_START token.\n if (preg_match('/^([$@])\\(/', $substr, $m)) {\n $needle += strlen($m[0]);\n $ret[] = new Token(Token::EXPR_START, $m[0]);\n\n // record expression depth, to make sure the usage of parentheses inside the expression doesn't\n // break tokenization (e.g. '$( (\"foo\") )'\n $depth++;\n } else {\n // store the current token in a temp var for appending, in case it's a DATA token\n $token = end($ret);\n\n // handle escaping of the $( syntax, '$$(' becomes '$('\n if (preg_match('/^\\$\\$\\(/', $substr, $m)) {\n $value = substr($m[0], 1);\n $needle += strlen($m[0]);\n } else {\n $value = $string{$needle};\n $needle += strlen($value);\n }\n\n // if the current token is DATA, and the previous token is DATA, append the value to the previous\n // and ignore the current.\n if ($token && $token->match(Token::DATA)) {\n $token->value .= $value;\n unset($token);\n } else {\n $ret[] = new Token(Token::DATA, $value);\n }\n }\n } else {\n $ret = array_merge($ret, $exprTokenizer->getTokens($string, $needle));\n $depth = 0;\n }\n if ($before === $needle) {\n // safety net.\n throw new \\UnexpectedValueException(\n \"Unexpected input near token {$string{$needle}}, unsupported character\"\n );\n }\n }\n return $ret;\n }", "protected function parse_full_regex() {\n $mask = $this->fullregex;\n while (true) {\n $b = preg_replace_callback('/\\([^\\)\\(]+\\)/',\n create_function('$a', 'if (preg_match(\"/^\\(\\?P/\", $a[0])) { return $a[0]; } else { return str_repeat(\"-\", strlen($a[0])); }'),\n $mask);\n if ($b === $mask) {\n break;\n }\n $mask = $b;\n }\n\n // Split the mask string by parenthesis, use the maskchunk's lengths to cut the text into chunks.\n // Chunks with indexes 0,2,4,... are texts, 1,3,5,... are parameters regexps.\n $maskchunks = preg_split('/[\\)\\(]/', $mask);\n $this->steptext = '';\n $this->params = array();\n $regex = '';\n $pos = 0;\n foreach ($maskchunks as $i => $maskchunk) {\n $chunk = substr($this->fullregex, $pos, strlen($maskchunk));\n if ($i%2 == 0) {\n // This is part of text.\n $this->steptext .= $chunk;\n $regex .= $chunk;\n } else {\n // This is a parameter.\n $p = $this->prepare_param($chunk, ($i+1)/2);\n $this->steptext .= html_writer::tag('span', '', $p);\n $regex .= '('.$p['data-regex'].')';\n $this->params[] = $p;\n }\n $pos += strlen($maskchunk) + 1;\n }\n //$this->steptext = preg_replace(array('|^\\/|','|\\/$|'), '', $this->steptext);\n //$this->fullregex = $regex;\n\n $this->prepare_additional_params();\n }", "private function readsub($tokens, &$position) {\n\n $sub = $tokens[$position];\n $tokenCount = count($tokens);\n $position ++;\n while ( ! in_array($tokens[$position], self::$endparens) && $position < $tokenCount ) {\n \n if (in_array($tokens[$position], self::$startparens)) {\n $sub .= $this->readsub($tokens, $position);\n } else {\n $sub .= $tokens[$position];\n }\n $position ++;\n }\n $sub .= $tokens[$position];\n return $sub;\n }", "public function getRegEx();", "protected function _extendRegex()\n {\n return [];\n }", "private function reduce($pieces) {\n $limit = (int) (count($pieces) / 2);\n // Incrementally transforms an array of symbols to an array of expressions\n for ($i = 0; $i < $limit; $i++) {\n $j = 0;\n // Look for valid 3-symbols groups and replace them with an Expression\n while ($j <= count($pieces) - 3) {\n $slice = array_slice($pieces, $j, 3);\n $expression = new OperationExpression($slice[0], $slice[1], $slice[2]);\n if ($expression->isValid()) {\n $before = array_slice($pieces, 0, $j);\n $after = array_slice($pieces, $j + 3);\n $pieces = array_merge($before, array($expression), $after);\n }\n $j++;\n }\n }\n return $pieces;\n }" ]
[ "0.60316515", "0.5585202", "0.5521602", "0.5427196", "0.5379866", "0.5333383", "0.5282423", "0.52803767", "0.52563447", "0.5221215", "0.52166694", "0.5211604", "0.5141302", "0.5133901", "0.5112487", "0.5096596", "0.5096363", "0.50803757", "0.50732297", "0.5019804", "0.49936447", "0.49704716", "0.49512082", "0.49284077", "0.49048233", "0.48906088", "0.48828688", "0.48620647", "0.48517764", "0.48414603" ]
0.69791156
0
Lists all Dmfacebookcf models.
public function actionIndex() { $searchModel = new DmfacebookcfSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function listModels()\n {\n $models = array();\n $this->get();\n foreach ($this->responseObj as $key => $blob) {\n $model = new Model($this->getConfig());\n self::fromArray($model, $blob);\n $models[$key] = $model;\n }\n return $models;\n }", "function GetAllModels()\n\t{\n\t}", "public function index()\n {\n return FeeMeta::all();\n }", "public function allFilmsAction()\n {\n\n // $em = EntityManager = $connexion $em est dans la doc officielle\n\n $em = $this->getDoctrine()->getManager(); // récupération de doctrine\n\n $allFilms = $em->getRepository(\"TroiswaBackBundle:Films\")->findAll();\n\n return $this->render(\"TroiswaBackBundle:Films:index.html.twig\",['allFilms'=>$allFilms]);\n\n }", "function getAllCategoryFundraiser(){\n\t\n\t \t\tApp::import('model','Category');\n\t\t $this->Category = new Category(); \n\n\t\t\t\n\t\t\t$categoryList = $this->Category->find('all', array('fields' => array('id', 'categoryname'),'order' => 'Category.order,Category.categoryname ASC','recursive' => -1,'conditions' => array('Category.publish' => 'yes')));\n\t\t\treturn $categoryList;\n\t }", "public function show()\n {\n $class = new \\App\\Classe();\n return $class->getClassList();\n }", "public function admin_getAllModel(){\n\n\t}", "public function showAll()\n {\n $model = $this->newModel();\n\n return $model->orderBy('created_at', 'desc')\n ->paginate(10, ['*']);\n }", "public function actionBusinessListAll() {\r\n // $criteria->condition = \"id = 4\";\r\n $dataProvider = new CActiveDataProvider('Business');\r\n $dataProvider->pagination->pageSize = 15;\r\n $this->render(\"/Home/BusinessListAll\", array(\r\n \"dataProvider\" => $dataProvider,\r\n \"txtsearch\" => \"Display All\"));\r\n }", "public function listAction()\n {\n $app = $this->params['app'];\n $clazz = $this->params['class'];\n\n // paginacion\n if (!isset($this->params['max']))\n {\n $this->params['max'] = 10;\n $this->params['offset'] = 0;\n }\n \n // Tengo que asegurarme de que cargue la config de DB para esa aplicacion\n // Asi en lugar de obtener 'core' en la app, obtiene el nombre de la apliciacion real cuando crea la DAL en PM.\n $ctx = YuppContext::getInstance();\n $ctx->setRealApp( $app );\n \n // Verifica que la clase esta cargada, si no, carga todo (porque no se de que aplicacion es)\n $loadedClasses = get_declared_classes(); //YuppLoader::getLoadedModelClasses(); // FIXME: Tengo clases cargadas en YuppLoader pero no estan incluidas (debe ser por persistencia del singleton en session)\n if (!in_array($clazz, $loadedClasses)) YuppLoader::loadModel();\n\n eval ('$list = ' . $clazz . '::listAll( $this->params );'); // Se pasan los params por si vienen atributos de paginacion.\n $this->params['list'] = $list;\n\n eval ('$count = ' . $clazz . '::count();');\n $this->params['count'] = $count; // Maximo valor para el paginador.\n\n return $this->render(\"list\");\n }", "public function getAll()\n {\n $model = $this->model;\n return $model::all();\n }", "function listaAll() {\n require ROOT . \"config/bootstrap.php\";\n return $em->getRepository('models\\Cabos')->findby(array(), array(\"id\" => \"DESC\"));\n $em->flush();\n }", "public static function getAllModel() {\n\t\treturn array(self::_getDao()->count(), self::_getDao()->getAll());\n\t}", "public function actionIndex()\n {\n $model = Co::find()->orderBy([\n 'created_at'=>SORT_ASC,\n 'id' => SORT_DESC,\n ])->limit(50)->all();\n \n $countAll = Co::getCountAll();\n \n return $this->render('index',[\n 'models' => $model,\n 'countAll' => $countAll,\n ]);\n }", "public function list()\n {\n return \\App\\Compromisso::all();\n }", "public function modelListCategories(){\n\t\t\t$conn = Connection::getInstance();\n\t\t\t$query = $conn->query(\"select * from categories where displayhome=1 order by id desc\");\n\t\t\treturn $query->fetchAll();\n\t\t}", "public function all() {\n\n\t\t// Dont render view\n\t\t$this->autoRender = false;\n\n\t\t// Get page\n\t\t$page = $this->_getFbpage();\n\n\t\t$this->paginate = array(\n\t\t\t'fields' => array('User.facebookid', 'User.name', 'User.total_comments', 'User.total_likes'),\n\t\t\t'conditions' => array(\n\t\t\t\t'User.page' => $page\n\t\t\t),\n\t\t\t'group' => 'User.facebookid',\n\t\t\t'order' => array('User.id DESC')\n\t\t);\n\t\t\n\t\t$this->DataTable->emptyElements = 0;\n\t\techo json_encode($this->DataTable->getResponse(), true);\n\t}", "public function modelList() \n {\n\t\treturn view('pages.customers.modelList');\n }", "public function getAll()\n {\n return $this->model->get();\n }", "private function get_all_models() {\n\t\treturn (object) Model::get_all_objects();\n\t}", "public function getAll()\n {\n return $this->model->all();\n }", "public function list()\n {\n try {\n $result = $this->get_all();\n $this->response($result);\n } catch (Exception $e) {\n $this->response(array(\n \"message\" => $e->getMessage()\n ), ERROR_CODE);\n }\n }", "public static function listAll($className)\n\t{\n\t $lang = Yii::app()->language;\n $models = $className::model()->findAll();\n $pk = $className::model()->tableSchema->primaryKey;\n // format models resulting using listData \n $list = CHtml::listData($models, $pk, 'name_'.$lang);\n return $list;\n\t}", "public function all()\n {\n return $this->model->get();\n }", "public function all()\n {\n return $this->model->get();\n }", "public function all()\n {\n return $this->model->get();\n }", "public function getAll()\n {\n return $this->model->get();\n }", "public function getAll()\n {\n return $this->model->get();\n }", "public function getAllFilms () {\n\t\t$allmovies = $this->orm->films()->find();\n\t\t$returnedL = [];\n\t\tforeach ( $allmovies as $movie ) {\n\t\t $returnedL[] = $this->hydrateMovie( new Film, $movie );\t\n\t\t}\n\n\t\treturn $returnedL;\n\t}", "public function list(){\n\t\t\t$data = $this->customerModel->All();\n\t\t\t/*echo \"<pre>\";\n\t\t\t\tprint_r($data);\n\t\t\techo \"</pre>\";*/\n\t\t\trequire_once('views/customer/list.php');\n\t\t}" ]
[ "0.618307", "0.6028243", "0.5906952", "0.5863298", "0.57846415", "0.57842433", "0.5770735", "0.57629836", "0.5754618", "0.57443684", "0.5734959", "0.5715056", "0.5714418", "0.5712883", "0.5700348", "0.56999654", "0.56768864", "0.5666853", "0.56663793", "0.5662086", "0.56495607", "0.5629392", "0.5621416", "0.5597538", "0.5597538", "0.5597538", "0.5596973", "0.5596973", "0.5596012", "0.5594076" ]
0.72356796
0
Creates a new Dmfacebookcf model. If creation is successful, the browser will be redirected to the 'view' page.
public function actionCreate() { $model = new Dmfacebookcf(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->PAGE_ID]); } else { return $this->render('create', [ 'model' => $model, ]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionCreate()\n {\n $model = new Golfer();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Fcttype();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate() {\n $model = new Forms();\n\n if ($this->request->isPost) {\n if ($model->load($this->request->post())) {\n $model->save();\n\n return $this->redirect(['view', 'id' => $model->id]);\n }\n } else {\n $model->loadDefaultValues();\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Comment();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n//\n// if ($model->load(Yii::$app->request->post()) && $model->validate()) {\n// try {\n// $model->save();\n// Yii::$app->session->setFlash('alert', [\n// 'body' => Yii::$app->params['create-success'],\n// 'class' => 'bg-success',\n// ]);\n// } catch (\\yii\\db\\Exception $exception) {\n Yii::$app->session->setFlash('alert', [\n 'body' => Yii::$app->params['create-danger'],\n 'class' => 'bg-danger',\n ]);\n// }\n return $this->redirect(['index']);\n// }\n\n// return $this->render('create', [\n// 'model' => $model,\n// ]);\n }", "public function actionCreate() {\n $model = new Squibcard();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate() {\n $model = new FlightMaster;\n \n // Uncomment the following line if AJAX validation is needed\n // $this->performAjaxValidation($model);\n\n $msg = isset($_GET['msg']) ? $_GET['msg'] : null;\n\t\tswitch($msg){\n\t\t\tcase 1:\n\t\t\t\t$this->message_type='alert';\n\t\t\t\t$this->message_content = \"Problem in adding Flight\";\n\t\t\t\tbreak;\t\n\t\t\tdefault:\n\t\t\t\t$this->message_type='';\n\t\t\t\t$this->message_content = '';\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t$BranchMasterModel=new BranchMaster;\n\t\t$criteria= new CDbCriteria;\n\t\t$criteria->select='id,branch_name';\n\t\t$criteria->order='branch_name';\n\t\t$branchData=$BranchMasterModel->findAll($criteria);\n\t\t$this->branches=array();\n\t\t$this->branches[\"\"]= \"Select Branch\";\n\t\tforeach($branchData as $data){\n\t\t\t$this->branches[$data->id]=$data->branch_name;\n\t\t}\n\t\t\n\t\tif (isset($_POST['FlightMaster'])) {\n\t\t\t$model->attributes=$_POST['FlightMaster'];\n\t\t\t$model->branch_id_fk = $_POST['FlightMaster']['branch_id_fk'];\n\t\t\t$model->arrival_time = $_POST['FlightMaster']['ahh'].\":\".$_POST['FlightMaster']['amm'];\n\t\t\t$model->departure_time = $_POST['FlightMaster']['dhh'].\":\".$_POST['FlightMaster']['dmm'];\n\t\t\tif ($model->save())\n $this->redirect(array('admin', 'msg' => 1));\n\t\t\telse\n\t\t\t $this->redirect(array('create', 'msg' => 1));\n\t\t\t\t\n\t\t}\n \n $this->render('create', array(\n 'model' => $model,\n ));\n }", "public function actionCreate()\n {\n $model = new MotoClubs();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n \n $model = null;\n if (Yii::$app->request->isPost)\n { \n $type = $_POST['createtype'];\n $id =$_POST['createid'];\n if($type!=\"WEN_QU_PU\") {\n return;\n } \n $model = $this->findModel($id);\n $model->load(['formName'=>$_POST],'formName');\n if(!$model->save()) {\n return var_dump($model->errors);\n }\n else {\n if ($model->status == Creation::STATUS_PUBLIC) {\n //插入记录(Feed)\n $title = Html::a(Html::encode($model->post_title), $model->url);\n preg_match_all(\"/<[img|IMG].*?src=\\\"([^^]*?)\\\".*?>/\", $model->post_content, $images);\n $images = \"<img src='\" . $model->post_path . \"'>\";\n $content = mb_substr(strip_tags($model->post_content), 0, 140, 'utf-8') . '... ' . Html::a(Yii::t('app', 'View Details'), $model->url) . '<br>' . $images;\n $creationData = ['{title}' => $title, '{content}' => $content];\n Feed::addFeed('blogtuneopus', $creationData);\n }\n $this->layout = '@app/modules/user/views/layouts/user';\n return $this->redirect(['/user/dashboard']);\n } \n }\n else {\n $model = $this->findUserLastModel();\n }\n if (is_null($model)) {\n $model = new Creation();\n if(!$model->save()) {\n var_dump($model->errors);\n }\n } \n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Forum();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->forum_url]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new ActivityDetail();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(Yii::$app->request->getReferrer());\n\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new StoreCabinet();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $modelClass = $this->modelClass;\n /** @var Category $model */\n $model = new $modelClass;\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('@app/core/modules/category/views/category/create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n /*\n $model = new Customer();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n */\n }", "public function actionCreate()\r\n\t{\r\n\t\t$model=new FinanceFees;\r\n\r\n\t\t// Uncomment the following line if AJAX validation is needed\r\n\t\t// $this->performAjaxValidation($model);\r\n\r\n\t\tif(isset($_POST['FinanceFees']))\r\n\t\t{\r\n\t\t\t$model->attributes=$_POST['FinanceFees'];\r\n\t\t\tif($model->save())\r\n\t\t\t\t$this->redirect(array('view','id'=>$model->id));\r\n\t\t}\r\n\r\n\t\t$this->render('create',array(\r\n\t\t\t'model'=>$model,\r\n\t\t));\r\n\t}", "public function actionCreate() {\n\n $model = new Farmers();\n\n if ($model->load(Yii::$app->request->post())) {\n\n $model->created_dt = date(\"Y-m-d\");\n $model->birth_date = date(\"Y-m-d\", strtotime($model->birth_date));\n $model->created_by = Yii::$app->user->identity->id;\n //echo \"<pre>\";print_r($model);die;\n\n if ($model->validate()) {\n $model->profile_pic = UploadedFile::getInstance($model, 'profile_pic');\n\n if ($model->profile_pic && $model->validate()) {\n $fileName = date(\"Y-m-d\") . \"_\" . rand(100, 500000) . \".jpg\";\n $model->profile_pic->saveAs('images/farmerImages/' . $fileName);\n $model->profile_pic = $fileName;\n } else {\n $model->profile_pic = null;\n }\n\n if ($model->save()) {\n Yii::$app->session->setFlash('insert', \"Farmer added successfully. Please add farm details.\");\n return $this->redirect(['update', 'id' => $model->farmer_id, 'tab' => 2]);\n }\n } else {\n\n return $this->render('create', [\n 'model' => $model\n ]);\n }\n }\n return $this->render('create', [\n 'model' => $model\n ]);\n }", "public function actionCreate()\n {\n $model = new Fraudinfo;\n\n if ($model->load(Yii::$app->request->post())) {\n\t\t\t$model->fraud_info_systime = date('Y-m-d H:m:s');\n\t\t\t$model->fraud_info_ip = CommonUtility::getIP();\t\t\n\t\t\tif ($model->save()) {\n\t\t\t\t//获取介质分类\n\t\t\t\t$fm = CommonUtility::getDictsList('fraud_medium', 0);\n\t\t\t\tforeach ($fm as $key => $value) {\n\t\t\t\t\tif (isset($_POST['medium_content_'.$key])) {\n\t\t\t\t\t\t//循环空格隔开的内容\n\t\t\t\t\t\tif($_POST['medium_content_'.$key])\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$str = trim($_POST['medium_content_'.$key]);// 首先去掉头尾空格 \n\t\t\t\t\t\t\t$str = preg_replace('/\\s(?=\\s)/', '', $str);// 接着去掉两个空格以上的\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$r = explode(\" \", $str);\n\t\t\t\t\t\t\t//多个介质\n\t\t\t\t\t\t\tfor ($i = 0; $i < sizeof($r); $i++) {\n\t\t\t\t\t\t\t\t$mfc = new FraudMediumContent;\n\t\t\t\t\t\t\t\t//存储诈骗介质的值\n\t\t\t\t\t\t\t\t$mfc->fraud_info_id = $model->fraud_info_id;\n\t\t\t\t\t\t\t\t$mfc->fraud_medium = $key;\n\t\t\t\t\t\t\t\t$mfc->medium_content = $r[$i];\n\t\t\t\t\t\t\t\t$mfc->save();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn $this->redirect(['index']);\n\t\t\t}\n\t\t} else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new ScbStudentHasActivityMain();\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect([\n 'activity/index#jtab2_nobg',\n 'model_upload' => ScbStudentHasActivityMain::find()->all()]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate() {\n $model = new Foro();\n\n if ($model->load(Yii::$app->request->post())) {\n $model->id_usuario=$_SESSION[\"__id\"];\n $model->id_estado=1;\n $model->id_categoria=$_POST[\"Categoria\"];\n $model->fecha= date(\"Y-m-d H:i:s\");\n $model->save();\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate() {\n $model = new CFLCatalog;\n\n// Uncomment the following line if AJAX validation is needed\n// $this->performAjaxValidation($model);\n\n if (isset($_POST['CFLCatalog'])) {\n $model->attributes = $_POST['CFLCatalog'];\n if ($model->save())\n $this->redirect(array('view', 'id' => $model->id));\n }\n\n $this->render('create', array(\n 'model' => $model,\n ));\n }", "public function actionCreate()\n {\n $model = new Customer();\n\n if ($model->load(Yii::$app->request->post()) ) {\n\n if( $model->create()){\n $model->sendSuccess();\n return $this->redirect(['index']);\n }else{\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Category();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Post();\n\n if (Yii::$app->request->isPost) \n {\n $model->attributes = Yii::$app->request->post('Post');\n\n $transaction = Yii::$app->db->beginTransaction();\n\n try \n {\n if($model->save())\n {\n $transaction->commit();\n }\n\n return $this->redirect(['manage']);\n }\n catch (\\Exception $e) \n {\n $transaction->rollBack();\n throw $e;\n }\n } \n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Ambil();\n\n /*if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->no_ambil]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);*/\n\n if ($model->load(Yii::$app->request->post())) {\n try{\n if($model->save()){\n Yii::$app->getSession()->setFlash(\n 'success','Data saved!'\n );\n return $this->redirect(['index']);\n }\n }catch(Exception $e){\n Yii::$app->getSession()->setFlash(\n 'error',\"{$e->getMessage()}\"\n );\n }\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new MovBancarios();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new Device();\n\t\t\t\t\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Konsultasi();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Haus();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['update', 'id' => $model->id]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate()\n {\n $model = new Contacts();\n \n if ($model->load(Yii::$app->request->post())) {\n $model->user_id = Yii::$app->user->identity->id;\n if($model->save()){\n return $this->redirect(['view', 'id' => $model->contact_id]);\n }\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function actionCreate()\n {\n $model = new SCCategories();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->categoryID]);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }" ]
[ "0.6824071", "0.6793661", "0.6699074", "0.6684508", "0.6651602", "0.6648367", "0.66071254", "0.6605836", "0.657846", "0.65501606", "0.65388274", "0.6535993", "0.6528628", "0.65256345", "0.65220815", "0.65127486", "0.64952797", "0.64904267", "0.64777046", "0.6473204", "0.64652556", "0.64641523", "0.64596957", "0.6449009", "0.64289206", "0.6427278", "0.64197934", "0.64122593", "0.64087576", "0.6406128" ]
0.8508725
0
Finds the Dmfacebookcf model based on its primary key value. If the model is not found, a 404 HTTP exception will be thrown.
protected function findModel($id) { if (($model = Dmfacebookcf::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function find($key): ?Model;", "public function loadModel($id)\r\n\t{\r\n\t\t$model=FinanceFees::model()->findByPk($id);\r\n\t\tif($model===null)\r\n\t\t\tthrow new CHttpException(404,Yii::t('app','The requested page does not exist.'));\r\n\t\treturn $model;\r\n\t}", "public function loadModel($id)\n\t{\n\t\t$model=Fabric::model()->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\treturn $model;\n\t}", "public function loadModel($id)\r\n\t{\r\n\t\t$model=Contacts::model()->findByPk($id);\r\n\t\tif($model===null)\r\n\t\t\tthrow new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));\r\n\t\treturn $model;\r\n\t}", "private function findModel($id)\n {\n $model=Post::model()->findByPk($id);\n if($model===null)\n throw new CHttpException(404,'The requested page does not exist.');\n return $model;\n }", "public function loadModel($id) {\n $model = Fieldbook::model()->findByPk($id);\n if ($model === null)\n throw new CHttpException(404, 'The requested page does not exist.');\n return $model;\n }", "public function loadModel($id) {\n $model = Swift::model()->findByPk($id);\n if ($model === null)\n throw new CHttpException(404, 'The requested page does not exist.');\n return $model;\n }", "public function loadModel($id) {\n $model = FlightMaster::model()->findByPk($id);\n if ($model === null)\n throw new CHttpException(404, 'The requested page does not exist.');\n return $model;\n }", "public function find($uid) {\n\t\ttry {\n\t\t\t$model = $this->map->get($uid);\n\t\t} catch (tx_oelib_Exception_NotFound $exception) {\n\t\t\t$model = $this->createGhost($uid);\n\t\t}\n\n\t\treturn $model;\n\t}", "protected function findModel($item_id)\n\t{\n\t\tif (($model = SapItem::findOne($item_id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new HttpException(404, 'The requested page does not exist.');\n\t\t}\n\t}", "public function find($id)\n {\n $wpdb = $this->__connect();\n $sql = $wpdb->prepare(\"SELECT * FROM \" . $this->get_table() . \" WHERE id = %d\", $id);\n $record = $wpdb->get_row($sql, ARRAY_A);\n if ($record) {\n $model = $this->fetch_model($record);\n return $model;\n }\n\n return null;\n }", "protected function findModel($id) {\n\t\tif (($model = ServiceMapping::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t}\n\n\t\tthrow new NotFoundHttpException('The requested page does not exist.');\n\t}", "protected function findModel($id) {\n if (($model = Squibcard::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "public function loadModel($id) {\r\n $model = Documents::model()->findByPk($id);\r\n if ($model === null)\r\n throw new CHttpException(404, 'The requested page does not exist.');\r\n return $model;\r\n }", "protected function findModel($id)\n {\n if (is_array($id)) {\n /** @var Comment $model */\n $model = Comment::findAll($id);\n } else {\n /** @var Comment $model */\n $model = Comment::findOne($id);\n }\n if ($model !== null) {\n return $model;\n } else {\n throw new HttpException(404);\n }\n }", "protected function findModel($id) {\n if (($model = PdmP52::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n\t{\n\t\tif (($model = TicketComment::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new HttpException(404, 'The requested page does not exist.');\n\t\t}\n\t}", "public function findModel($id){\n\n\n\t\t$id = (int) $id; //convertimos el id que se envio, en un entero\n\n\t\t$model = $this->db->query(\"select * from \".$this->name.\" where \".$this->field_key.\" = $id\");\n\t\treturn $model->fetch();\n\n\t}", "protected function findModel($id)\n {\n if (($model = AfCode::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "public function findModel($clz, $key)\n {\n return $clz ? $clz::find($key) : null;\n }", "public function find(int $id): ?Model;", "public function find($id)\n {\n return $this->model->findOrFail($id);\n }", "protected function findModel($id)\n {\n \tif (($model = Constancia::findOne($id)) !== null) {\n \t\treturn $model;\n \t} else {\n \t\tthrow new NotFoundHttpException('The requested page does not exist.');\n \t}\n }", "public function loadModel($id) {\n $model = CFLCatalog::model()->findByPk($id);\n if ($model === null)\n throw new CHttpException(404, 'The requested page does not exist.');\n return $model;\n }", "public function loadModel($id) \n\t{\n\t\t$model = Digitals::model()->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));\n\t\treturn $model;\n\t}", "public function findOneByKey($key, $value) {\n\t\ttry {\n\t\t\t$model = $this->findOneByKeyFromCache($key, $value);\n\t\t} catch (tx_oelib_Exception_NotFound $exception) {\n\t\t\t$model = $this->findSingleByWhereClause(array($key => $value));\n\t\t}\n\n\t\treturn $model;\n\t}", "public function loadModel($id)\n\t{\n\t\t$model=CallerResult::model()->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\treturn $model;\n\t}", "public static function find( $id ){\r\n\r\n try{\r\n $child = get_called_class();\r\n $model = new $child();\r\n\r\n $query = \"select * from `\" .$model->table. \"` where `\".$model->key.\"` = ? limit 1\";\r\n $argTypes = \"i\";\r\n $args = array();\r\n $args[] = &$argTypes;\r\n $args[] = &$id;\r\n $row = [];\r\n\r\n $dbHandler = new MySqlHandler();\r\n if( ! $dbHandler->dbConnected() ){\r\n throw new Exception('DB connection failed');\r\n }\r\n $select = $dbHandler->executePreparedQuery( $query, $args, $row );\r\n if( $select !== null && $select instanceof mysqli_stmt && $select->num_rows === 1 ){\r\n $select->fetch();\r\n $select->close();\r\n\r\n $model->original = $row;\r\n $model->attributes = $row;\r\n }else{\r\n $model = null;\r\n }\r\n\r\n $dbHandler->close();\r\n }catch (Exception $e){\r\n unset($dbHandler);\r\n unset($model);\r\n throw new Exception( $e->getMessage() );\r\n }\r\n\r\n return $model;\r\n }", "public function loadModel($id) {\n\t\t$model = Document::model ()->findByPk ( $id );\n\t\tif ($model === null)\n\t\t\tthrow new CHttpException ( 404, 'The requested page does not exist.' );\n\t\treturn $model;\n\t}", "public function loadModel($id) {\n\t\t$model = Document::model ()->findByPk ( $id );\n\t\tif ($model === null)\n\t\t\tthrow new CHttpException ( 404, 'The requested page does not exist.' );\n\t\treturn $model;\n\t}" ]
[ "0.6708764", "0.64359736", "0.6401191", "0.6398248", "0.6384401", "0.6375431", "0.6338892", "0.633425", "0.62949723", "0.6292719", "0.62807584", "0.6264133", "0.62519884", "0.62436515", "0.62326455", "0.6208861", "0.620211", "0.6189081", "0.61720544", "0.6170501", "0.61630714", "0.61627233", "0.6158831", "0.6151936", "0.61250913", "0.6122835", "0.6122653", "0.6116578", "0.61124235", "0.61124235" ]
0.69960314
0
configObject should be an array of hostgroup names
public function loadConfig($configObject) { foreach($configObject as $hostgroup) { $tempHostgroupItem = new GWWidgetsHostGroupListWidgetItem($hostgroup); $this->hostgroups[] = $hostgroup; $this->items[] = $tempHostgroupItem; } $this->update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function get_config_name($config, $class, $plugin, $metric, $hostgroup=null) {\n\n\t\tforeach($config as $hostgroup_name=>$hostgroup_config) {\n\n\t\t\tif(!isset($hostgroup_config['hostgroup']) && !isset($hostgroup_config['class'])){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$conf_hostgroup = str_replace('.*','',$hostgroup_name);\n\t\t\t$conf_class = $hostgroup_config['class'];\n\t\t\tif($class!==$conf_class) continue;\n\t\t\tif(!empty($hostgroup) && $hostgroup !== $conf_hostgroup) continue;\n\n\t\t\tforeach ($hostgroup_config as $name=>$conf) {\n\n\t\t\t\tif(!is_array($conf)) continue;\n\n\t\t\t\t// supress any warnings \n\t\t\t\t$conf_plugin = @$conf['vertica_plugin'];\n\t\t\t\t$conf_metric = @$conf['metric'];\n\t\t\t\t$max_threshold = @$conf['max_threshold'];\n\t\t\t\t$min_threshold = @$conf['min_threshold'];\n\t\t\t\t$max_value = @$conf['max_value'];\n\t\t\t\t$complement = @$conf['complement'];\n\t\t\t\t$mysql_col_name = @$conf['mysql_column_name'];\n\t\t\t\t$col_prefix = $hostgroup_config['hostgroup'];\n\n\t\t\t\tif ( $plugin==$conf_plugin && $conf_metric == $metric ) {\n\n\t\t\t\t\treturn array('name' => $name, \n\t\t\t\t\t\t 'max_threshold' => $max_threshold,\n\t\t\t\t\t\t 'min_threshold' => $min_threshold,\n\t\t\t\t\t\t 'max_value' => $max_value,\n\t\t\t\t\t\t 'complement' => $complement,\n\t\t\t\t\t\t 'mysql_col_name' => $mysql_col_name,\n\t\t\t\t\t\t 'col_prefix' => str_replace(\"-\",\"_\",$col_prefix),\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function init_config_data($host_obj)\n {\n }", "public function validate_config_on_load($host_obj)\n {\n }", "abstract public function validate_config_on_save($host_obj);", "public function validate_config_on_save($host_obj)\n\t\t{\n\n\t\t}", "public function validate_config_on_load($host_obj)\n\t\t{\n\n\t\t}", "public function init_config_data($host_obj) \n\t\t{\n\t\t\t$this->host_obj->test_mode = true;\n\t\t\t$this->host_obj->min_weight = 1;\n\t\t\t$this->host_obj->max_weight = 150;\n\t\t}", "public function init_config_data($host_obj)\n\t\t{\n\t\t\t$host_obj->test_mode = 1;\n\t\t}", "public function renderGroupConfig()\n\t{\n\t\t$description = $this->l('Add New Group');\n\t\tif (!Tools::isSubmit(\"deletegroup\") && !Tools::isSubmit(\"addNewGroup\") && $this->_currentGroup[\"id_group\"]) {\n\t\t\t$description = $this->l('You are editting group:') . \" \" . $this->_currentGroup[\"title\"];\n\t\t}\n\t\t$selectHook = array();\n\t\tforeach ($this->_hookSupport as $value)\n\t\t{\n\t\t\t$selectHook[] = array(\"id\" => $value, \"name\" => $value);\n\t\t}\n\n\t\t$fullWidth = array(array(\"id\" => \"\", \"name\" => $this->l(\"Boxed\")),\n\t\t\tarray(\"id\" => \"fullwidth\", \"name\" => $this->l(\"Fullwidth\")),\n\t\t\tarray(\"id\" => \"fullscreen\", \"name\" => $this->l(\"Fullscreen\")));\n\n\t\t$shadowType = array(array(\"id\" => 0, \"name\" => $this->l(\"No Shadown\")), array(\"id\" => \"1\", \"name\" => 1),\n\t\t\tarray(\"id\" => \"2\", \"name\" => 2), array(\"id\" => \"3\", \"name\" => 3));\n\n\t\t$timeLinerPosition = array(array(\"id\" => \"bottom\", \"name\" => $this->l(\"Bottom\")), array(\"id\" => \"top\", \"name\" => $this->l(\"Top\")));\n\n\t\t$arrayCol = array('12', '10', '9-6', '9', '8', '7-2', '6', '4-8', '4', '3', '2-4', '2');\n\n\t\t$navigatorType = array(array(\"id\" => \"none\", \"name\" => $this->l(\"None\")), array(\"id\" => \"bullet\", \"name\" => $this->l(\"Bullet\")),\n\t\t\tarray(\"id\" => \"thumb\", \"name\" => $this->l(\"Thumbnail\"))\n// , array(\"id\" => \"both\", \"name\" => $this->l(\"Both\"))\n\t\t);\n\t\t$navigatorArrows = array(array(\"id\" => \"none\", \"name\" => $this->l(\"None\")), array(\"id\" => \"nexttobullets\", \"name\" => $this->l(\"Next To Bullets\")),\n\t\t\tarray(\"id\" => \"verticalcentered\", \"name\" => $this->l(\"Vertical Colorentered\")));\n\n\t\t$navigationStyle = array(array(\"id\" => \"round\", \"name\" => $this->l(\"Round\")), array(\"id\" => \"navbar\", \"name\" => $this->l(\"Navbar\")),\n\t\t\tarray(\"id\" => \"round-old\", \"name\" => $this->l(\"Round Old\")), array(\"id\" => \"square-old\", \"name\" => $this->l(\"Square Old\")), array(\"id\" => \"navbar-old\", \"name\" => $this->l(\"Navbar Old\")));\n\n//\t\t$hiden_phone = array(array(\"id\" => \"\", \"name\" => $this->l(\"None\")), array(\"id\" => \"hidden-xs\", \"name\" => $this->l(\"hidden in phone\")),\n//\t\t\tarray(\"id\" => \"hidden-sm\", \"name\" => $this->l(\"Hidden in tablet\")));\n\n\t\t$hidden_config = array('hidden-lg' => $this->l('Hidden in Large devices'), 'hidden-md' => $this->l('Hidden in Medium devices'),\n\t\t\t'hidden-sm' => $this->l('Hidden in Small devices'), 'hidden-xs' => $this->l('Hidden in Extra small devices'), 'hidden-sp' => $this->l('Hidden in Smart Phone'));\n\n\t\t//general config\n\t\t$fields_form = array(\n\t\t\t'form' => array(\n\t\t\t\t'legend' => array(\n\t\t\t\t\t'title' => $description,\n\t\t\t\t\t'icon' => 'icon-cogs'\n\t\t\t\t),\n\t\t\t\t//'description' =>$description,\n\t\t\t\t'input' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'group_button',\n\t\t\t\t\t\t'id_group' => $this->_currentGroup[\"id_group\"],\n\t\t\t\t\t\t'name' => 'group_button',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'sperator_form',\n\t\t\t\t\t\t'text' => $this->l('General Setting'),\n\t\t\t\t\t\t'name' => 'sperator_form',\n\t\t\t\t\t\t'show_button' => 1,\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Group Title:'),\n\t\t\t\t\t\t'name' => 'title_group',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t\t'required' => 1\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Active:'),\n\t\t\t\t\t\t'name' => 'active_group',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('active'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'label' => $this->l('Show in Hook:'),\n\t\t\t\t\t\t'name' => 'hook_group',\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $selectHook,\n\t\t\t\t\t\t\t'id' => 'id',\n\t\t\t\t\t\t\t'name' => 'name',\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Auto Play:'),\n\t\t\t\t\t\t'name' => 'group[auto_play]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('active'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Delay:'),\n\t\t\t\t\t\t'name' => 'group[delay]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'label' => $this->l('Slideshow Width Mode:'),\n\t\t\t\t\t\t'name' => 'group[fullwidth]',\n\t\t\t\t\t\t'class' => 'slideshow-mode',\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $fullWidth,\n\t\t\t\t\t\t\t'id' => 'id',\n\t\t\t\t\t\t\t'name' => 'name',\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Start With Slide:'),\n\t\t\t\t\t\t'name' => 'group[start_with_slide]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'col_width',\n\t\t\t\t\t\t'label' => $this->l('Medium and Large Desktops Width:'),\n\t\t\t\t\t\t'name' => 'group[md_width]',\n\t\t\t\t\t\t'class' => 'mode-width mode-',\n\t\t\t\t\t\t'lang' => FALSE\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'col_width',\n\t\t\t\t\t\t'label' => $this->l('Small devices Tablets Width:'),\n\t\t\t\t\t\t'name' => 'group[sm_width]',\n\t\t\t\t\t\t'class' => 'mode-width mode-',\n\t\t\t\t\t\t'arrayVal' => $arrayCol,\n\t\t\t\t\t\t'lang' => FALSE\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'col_width',\n\t\t\t\t\t\t'label' => $this->l('Extra small devices Phones:'),\n\t\t\t\t\t\t'name' => 'group[xs_width]',\n\t\t\t\t\t\t'class' => 'mode-width mode-',\n\t\t\t\t\t\t'arrayVal' => $arrayCol,\n\t\t\t\t\t\t'lang' => FALSE\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'sperator_form',\n\t\t\t\t\t\t'text' => $this->l('Mode Boxed: You can config width of slideshow. It will display float with other module'),\n\t\t\t\t\t\t'class' => 'alert alert-warning mode-width mode-',\n\t\t\t\t\t\t'name' => 'sperator_form',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'sperator_form',\n\t\t\t\t\t\t'text' => $this->l('Mode FullScreen: The slideshow will show full in your Web browser. You have to disable other module in hook_slideshow'),\n\t\t\t\t\t\t'class' => 'alert alert-warning mode-width mode-fullscreen',\n\t\t\t\t\t\t'name' => 'sperator_form',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'sperator_form',\n\t\t\t\t\t\t'text' => $this->l('Mode FullWidth: The slideshow will show 100% in container of hook_slideshow. You have to config width of other module in hook_slideshow'),\n\t\t\t\t\t\t'class' => 'alert alert-warning mode-width mode-fullwidth',\n\t\t\t\t\t\t'name' => 'sperator_form',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Touch Mobile'),\n\t\t\t\t\t\t'name' => 'group[touch_mobile]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('touch_mobile'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Stop On Hover'),\n\t\t\t\t\t\t'name' => 'group[stop_on_hover]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('stop_on_hover'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Shuffle Mode'),\n\t\t\t\t\t\t'name' => 'group[shuffle_mode]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('shuffle_mode'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'sperator_form',\n\t\t\t\t\t\t'text' => $this->l('Css Setting'),\n\t\t\t\t\t\t'name' => 'sperator_form',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'label' => $this->l('Shadow Type:'),\n\t\t\t\t\t\t'name' => 'group[shadow_type]',\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $shadowType,\n\t\t\t\t\t\t\t'id' => 'id',\n\t\t\t\t\t\t\t'name' => 'name',\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Show Time Line'),\n\t\t\t\t\t\t'name' => 'group[show_time_line]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('show_time_line'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'label' => $this->l('Time Liner Position'),\n\t\t\t\t\t\t'name' => 'group[time_line_position]',\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $timeLinerPosition,\n\t\t\t\t\t\t\t'id' => 'id',\n\t\t\t\t\t\t\t'name' => 'name',\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Margin:'),\n\t\t\t\t\t\t'name' => 'group[margin]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Padding(border):'),\n\t\t\t\t\t\t'name' => 'group[padding]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'color',\n\t\t\t\t\t\t'label' => $this->l('Background Color:'),\n\t\t\t\t\t\t'name' => 'group[background_color]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Show Background Image:'),\n\t\t\t\t\t\t'name' => 'group[background_image]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('background_image'),\n\t\t\t\t\t\t'desc' => $this->l(\"This configuration will override back-ground color config\"),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'group_background',\n\t\t\t\t\t\t'label' => $this->l('Background URL:'),\n\t\t\t\t\t\t'name' => 'group[background_url]',\n\t\t\t\t\t\t'id' => 'background_url',\n\t\t\t\t\t\t'lang' => FALSE\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'group_class',\n\t\t\t\t\t\t'label' => $this->l('Group Class:'),\n\t\t\t\t\t\t'name' => 'group[group_class]'\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'sperator_form',\n\t\t\t\t\t\t'text' => $this->l('Navigator'),\n\t\t\t\t\t\t'name' => 'sperator_form',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'label' => $this->l('Navigator Type:'),\n\t\t\t\t\t\t'name' => 'group[navigator_type]',\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $navigatorType,\n\t\t\t\t\t\t\t'id' => 'id',\n\t\t\t\t\t\t\t'name' => 'name',\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'desc' => $this->l('Thumbnail ** In Fullwidth version thumbs wont be displayed if navigation offset set to shwop thumbs outside of the container ! Thumbs must be showen in the container!')\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'label' => $this->l('Arrows:'),\n\t\t\t\t\t\t'name' => 'group[navigator_arrows]',\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $navigatorArrows,\n\t\t\t\t\t\t\t'id' => 'id',\n\t\t\t\t\t\t\t'name' => 'name',\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'desc' => $this->l('Next to Bullets only apply for Navigator Type: Bullets')\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'label' => $this->l('Style:'),\n\t\t\t\t\t\t'name' => 'group[navigation_style]',\n\t\t\t\t\t\t'options' => array(\n\t\t\t\t\t\t\t'query' => $navigationStyle,\n\t\t\t\t\t\t\t'id' => 'id',\n\t\t\t\t\t\t\t'name' => 'name',\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n// array(\n// 'type' => 'text',\n// 'label' => $this->l('Offset Horizontal:'),\n// 'name' => 'group[offset_horizontal]',\n// 'desc' => $this->l('The Bar is centered but could be moved this pixel count left(e.g. -10) or right (Default: 0) ** By resizing the banner, it will be always centered !!'),\n// 'lang' => FALSE,\n// ),\n// array(\n// 'type' => 'text',\n// 'label' => $this->l('Offset Vertical:'),\n// 'name' => 'group[offset_vertical]',\n// 'desc' => $this->l('The Bar is bound to the bottom but could be moved this pixel count up (e. g. -20) or down (Default: 20)'),\n// 'lang' => FALSE,\n// ),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Always Show Navigator'),\n\t\t\t\t\t\t'name' => 'group[show_navigator]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'values' => $this->getSwitchValue('show_navigator'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Hide Navigator After:'),\n\t\t\t\t\t\t'name' => 'group[hide_navigator_after]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'sperator_form',\n\t\t\t\t\t\t'text' => $this->l('Image Setting'),\n\t\t\t\t\t\t'name' => 'sperator_form',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'switch',\n\t\t\t\t\t\t'label' => $this->l('Image Cropping:'),\n\t\t\t\t\t\t'name' => 'group[image_cropping]',\n\t\t\t\t\t\t'is_bool' => true,\n\t\t\t\t\t\t'desc' => $this->l('Auto turn off is you use mode fullscreen for slideshow'),\n\t\t\t\t\t\t'values' => $this->getSwitchValue('image_cropping'),\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Image Width:'),\n\t\t\t\t\t\t'name' => 'group[width]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t\t'desc' => $this->l('Use for resize image and Max-Height')\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Image Height:'),\n\t\t\t\t\t\t'name' => 'group[height]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t\t'desc' => $this->l('Use for resize image and Max-Height')\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Thumbnail Width:'),\n\t\t\t\t\t\t'name' => 'group[thumbnail_width]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Thumbnail Height:'),\n\t\t\t\t\t\t'name' => 'group[thumbnail_height]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'label' => $this->l('Number of Thumbnails:'),\n\t\t\t\t\t\t'name' => 'group[thumbnail_amount]',\n\t\t\t\t\t\t'lang' => FALSE,\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\t'submit' => array(\n\t\t\t\t\t'title' => $this->l('Save'),\n\t\t\t\t\t'class' => 'btn btn-default')\n\t\t\t),\n\t\t);\n\n\t\tif (Tools::isSubmit('id_group') && LeoSliderGroup::groupExists((int) Tools::getValue('id_group'))) {\n\t\t\t//$slide = new LeoSliderGroup((int)Tools::getValue('id_group'));\n\t\t\t$fields_form['form']['input'][] = array('type' => 'hidden', 'name' => 'id_group');\n\t\t} else if ($this->_currentGroup[\"id_group\"] && LeoSliderGroup::groupExists($this->_currentGroup[\"id_group\"])) {\n\t\t\t$fields_form['form']['input'][] = array('type' => 'hidden', 'name' => 'id_group');\n\t\t}\n\n\n\t\t$helper = new HelperForm();\n\t\t$helper->show_toolbar = false;\n\t\t$helper->table = $this->table;\n\t\t$helper->module = $this;\n\t\t$helper->name_controller = 'sliderlayer';\n\t\t$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));\n\t\t$helper->default_form_language = $lang->id;\n\t\t$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;\n\t\t$this->fields_form = array();\n\n\t\t$helper->identifier = $this->identifier;\n\t\t$helper->submit_action = 'submitGroup';\n\t\t$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;\n\t\t$helper->token = Tools::getAdminTokenLite('AdminModules');\n\t\t$helper->tpl_vars = array(\n\t\t\t'fields_value' => $this->getGroupFieldsValues(),\n\t\t\t'languages' => $this->context->controller->getLanguages(),\n\t\t\t'id_language' => $this->context->language->id,\n\t\t\t'exportLink' => Context::getContext()->link->getAdminLink('AdminLeoSliderLayer') . \"&exportGroup=1\",\n\t\t\t'psBaseModuleUri' => $this->img_url,\n\t\t\t'ajaxfilelink' => Context::getContext()->link->getAdminLink('AdminLeoSliderLayer'),\n\t\t\t'leo_width' => $arrayCol,\n\t\t\t'hidden_config' => $hidden_config\n\t\t);\n\n\t\treturn $helper->generateForm(array($fields_form));\n\t}", "function theme_esco_ldap_config(){\n global $DB;\n $configs = $DB->get_records('config_plugins', array(\"plugin\" => \"enrol_simplesco\"));\n $config = array(\n \"host_url\" => \"\",\n \"bind_dn\" => \"\",\n \"bind_pw\" => \"\",\n \"branch\" => \"\",\n );\n\n foreach($configs as $tmp){\n if(isset($config[$tmp->name])){\n $config[$tmp->name] = $tmp->value;\n }\n }\n\n $config[\"branch\"] = str_ireplace(\"people\",\"structures\",$config[\"branch\"]);\n return $config;\n}", "private function load_config($game) {\n\n\t\t$return = array();\n\t\tif(empty($game)) {\n\t\t\treturn $return;\n\t\t}\n\n\t\t$hostgroupConfigObj = new HostgroupConfig($this->server_cfg, $game);\n\t\treturn $hostgroupConfigObj->load_hostgroup_config();\n\t}", "public function getConfig()\n {\n $config = array(\n 'group' => $this->getData('group'),\n );\n return $config;\n }", "function set_groups_to_object($parameters){\n\t\t$object\t\t\t = $this->check_parameters($parameters, \"object\", -1);\n\t\t$module\t\t\t = $this->check_parameters($parameters, \"module\", \"\");\n\t\t$params\t\t\t = $this->check_parameters($parameters, \"params\", Array());\n\t\t$tnoc_grps\t\t = $this->check_parameters($params, \"totalnumberofchecks_group_list\",0);\n\t\t$list=Array();\n\t\tfor($i=1;$i<=$tnoc_grps;$i++){\n\t\t\t$grp=$this->check_parameters($params, \"group_list_\".$i, Array());\n\t\t for($c=0;$c<count($grp);$c++){\n\t\t\t\t$list[count($list)] = $grp[$c];\n\t\t\t}\n\t\t}\n\t\tif ($module==\"\"){\n\t\t\treturn \"\";\n\t\t}\n\t\t$sql = \"delete from group_to_object where gto_client=$this->client_identifier and gto_object=$object and gto_module ='$module'\";\n\t\t$this->call_command(\"DB_QUERY\",array($sql));\n\t\tfor($i=0;$i<count($list);$i++){\n\t\t\t$sql = \"insert into group_to_object (gto_client, gto_object, gto_module, gto_identifier, gto_rank) values ($this->client_identifier, $object, '$module', '\".$list[$i].\"', 0)\";\n\t\t\t$this->call_command(\"DB_QUERY\",array($sql));\n\t\t}\n\t}", "abstract public function build_config_ui($host_obj, $context = null);", "public function getGroups() {\n if (null !== $this->groups) {\n return $this->groups;\n }\n $groups = array();\n $current_group = null;\n $handle = \\fopen($this->config_file, 'r');\n while (($buffer = \\fgets($handle, 4096)) !== false) {\n if (\\preg_match(\"/\\[(repo|gitosis|gitweb).*\\]/\", $buffer)) {\n $current_group = null;\n }\n\n if (\\preg_match(\"/\\[group (.*)\\]/\", $buffer, $matches)) {\n $group = new \\stdClass();\n $group->name = $matches[1];\n $current_group = $group;\n $groups[] = $group;\n unset($matches);\n }\n\n if (\\preg_match(\"/members = (.*)/\", $buffer, $matches) && null !== $current_group) {\n $current_group->members = \\explode(\" \", $matches[1]);\n unset($matches);\n }\n\n if (\\preg_match(\"/writable = (.*)/\", $buffer, $matches) && null !== $current_group) {\n $current_group->writable = \\explode(\" \", $matches[1]);\n unset($matches);\n }\n\n if (\\preg_match(\"/readonly = (.*)/\", $buffer, $matches) && null !== $current_group) {\n $current_group->readonly = \\explode(\" \", $matches[1]);\n unset($matches);\n }\n }\n \\fclose($handle);\n return $this->groups = $groups;\n }", "function getConfigs()\n {\n // Let's load the data if it doesn't already exist\n if(empty($this->_configs))\n {\n // Get the data of the categories which will actually be displayed\n $query = $this->_buildQuery();\n $this->_db->setQuery($query, $this->getState('list.start'), $this->getState('list.limit'));\n $configs = $this->_db->loadObjectList('group_id');\n\n $this->_configs = array();\n foreach($configs as $key => $config)\n {\n // If there is at least one config row with a higher ordering value which belongs\n // to a parent user group the current config row can/will never be applied to a user\n if($this->getActiveParentConfigs($config->group_id, $config->ordering))\n {\n $config->usergroups = false;\n\n continue;\n }\n\n // With the following code we want to get all user groups\n // for which the current config row applies.\n $subgroups = $this->getTree($config->group_id);\n $config->usergroups = array();\n $removing = false;\n foreach($subgroups as $key => $subgroup)\n {\n // If the removing flag is set we won't store user groups\n // which are children of the group stored in $removing\n if($removing)\n {\n if($subgroup->rgt > $removing)\n {\n // If rgt of current group is greater than the\n // stored one the complete sub-tree was parsed\n $removing = false;\n }\n else\n {\n continue;\n }\n }\n\n // If there is a config row for the current user group with a higher ordering value\n // that one will be used for the current user group and all of its sub-groups\n if(isset($configs[$subgroup->id]) && $configs[$subgroup->id]->ordering > $config->ordering)\n {\n $removing = $subgroup->rgt;\n\n continue;\n }\n\n // If we reach this point the current config row will\n // be applied to the current user group, so store it\n $config->usergroups[] = $subgroup->title;\n }\n\n // Prepend the user group the config row belongs to\n array_unshift($config->usergroups, $config->title);\n }\n\n $this->_configs = $configs;\n }\n\n return $this->_configs;\n }", "protected function listHosts()\n {\n $hosts = $this->hbClient->search('', $this->option('limit'), true);\n\n $output = ['_meta' => ['hostvars' => []]];\n $hostvars = &$output['_meta']['hostvars'];\n\n foreach ($hosts as $host) {\n $hostvars[$host['fqdn']] = $host;\n\n foreach ($this->groups as $group) {\n\n if (isset($host[$group])) {\n\n $groupName = \"{$group}-{$host[$group]}\";\n\n if ( ! isset($output[$groupName]['hosts'][$host['fqdn']])) {\n $output[$groupName]['hosts'][] = $host['fqdn'];\n }\n }\n\n }\n }\n\n // list groups, if requested\n if ($this->option('list-groups')) {\n $groups = array_keys($output);\n unset($groups[0]); // remove _meta\n natsort($groups);\n foreach($groups as $group) {\n $this->line($group);\n }\n exit(0);\n }\n\n $this->output($output);\n }", "public function getConfig($object)\n {\n }", "public function groups(): array\n {\n $result = [];\n foreach ($this->_config['groups'] as $group) {\n $value = $this->_Redis->get($this->_config['prefix'] . $group);\n if (!$value) {\n $value = $this->serialize(1);\n $this->_Redis->set($this->_config['prefix'] . $group, $value);\n }\n $result[] = $group . $value;\n }\n\n return $result;\n }", "public function addHost($addArray)\n {\n return $this->addRemItem(\n 'groups',\n (array)$addArray,\n 'merge'\n );\n }", "public function get_allowed_objecttype_group_configs()\n {\n // Check for inactive auth system\n if (!$this->is_auth_active())\n {\n return true;\n } // if\n\n global $g_comp_database;\n\n $l_objecttypes = $this->get_allowed_objecttype_configs();\n\n if (is_array($l_objecttypes))\n {\n return isys_cmdb_dao::instance($g_comp_database)\n ->get_objtype_group_const_by_type_id($l_objecttypes);\n }\n else\n {\n if (is_bool($l_objecttypes))\n {\n return $l_objecttypes;\n } // if\n } // if\n\n return false;\n }", "function stregistry_getConfigArray() {\n\tglobal $CONFIG;\n \n $configarray = array(\n \"FriendlyName\" => array(\n \"Type\" => \"System\",\n \"Value\" => 'ST Registry'\n ),\n 'Description' => array(\n 'Type' => 'System',\n 'Value'\t=> 'Official ST Registry Module. Become ST Registrar here: <a href=\"http://www.registry.st/registrars/become-registrar\" target=\"_blank\">www.registry.st/registrars/become-registrar</a>',\n ),\n \"apiHost\" => array(\n \t\"Type\" => \"text\",\n \"Size\" => \"20\",\n \"FriendlyName\" => \"Api gateway hostname\",\n \"Description\" => \"Enter your API hostname\",\n ),\n \"apiPort\" => array(\n \t\"Type\" => \"text\",\n \"Size\" => \"10\",\n \"FriendlyName\" => \"Api gateway port\",\n \"Description\" => \"Enter your API port\",\n ),\n 'apiUseSSL' => array(\n \"Type\" => \"yesno\",\n \"FriendlyName\" => \"SSL\",\n \"Description\" => \"Check if you want to use SSL connection\"\n ),\n \"apiUsername\" => array(\n \"Type\" => \"text\",\n \"Size\" => \"20\",\n \"FriendlyName\" => \"Api Username\",\n \"Description\" => \"Enter your API username here\",\n ),\n \"apiPassword\" => array(\n \"Type\" => \"text\",\n \"Size\" => \"32\",\n \"FriendlyName\" => \"Api Password\",\n \"Description\" => \"Enter your API Password here\",\n ),\n 'allowPremium' => array(\n \"Type\" => \"yesno\",\n \"FriendlyName\" => \"Allow premium domains registration\",\n \"Description\" => \"1 and 2 character(s) domains\"\n ),\n \"oneLetterFee\" => array(\n \t\"Type\" => \"text\",\n \"Size\" => \"20\",\n \"FriendlyName\" => \"One letter premium fee\",\n ),\n \"twoLetterFee\" => array(\n \t\"Type\" => \"text\",\n \"Size\" => \"20\",\n \"FriendlyName\" => \"Two letter premium fee\",\n ),\n \"tesConnection\" => array(\n \"FriendlyName\" => \"Test Connection\",\n ## This jQuery for Test Connection Button: sends request to ST Registry and shows corresponding message (success/fail) ##\n \"Description\" => '<input type=\"button\" id=\"st_testconnection\" class=\"btn primary\" value=\"Test\"/><span id=\"canvasloader-container\" class=\"result_con\"></span>'\n . '<script src=\"../modules/registrars/stregistry/heartcode-canvasloader.js\"></script>'\n . '<script>'\n . '$(\"#st_testconnection\").click(function(){\n if($(\"span#canvasloader-container\").is(\":not(:empty)\")) {\n $(\"span#canvasloader-container\").children().remove();\n }\n var cl = new CanvasLoader(\"canvasloader-container\");\n\t\t\t\tcl.setDiameter(20); // default is 40\n\t\t\t\tcl.show(); // Hidden by default\n\t\t\t\t\n\t\t\t\t// This bit is only for positioning - not necessary\n\t\t\t\t var loaderObj = document.getElementById(\"canvasLoader\");\n\t\t \t\tloaderObj.style[\"top\"] = cl.getDiameter() * -0.5 + \"px\";\n\t\t \t\tloaderObj.style[\"left\"] = cl.getDiameter() * -0.5 + \"px\";\n \n\n var button = $(this);\n\t jQuery.post(\\'../modules/registrars/stregistry/stregistry.php\\', {\n\t \"st_action\": \"st_testconn\",\n\t \"apiUsername\" : button.parents(\"tbody\").find(\"input[name=apiUsername]\").val(),\n \"apiPassword\" : button.parents(\"tbody\").find(\"input[name=apiPassword]\").val(),\n \"apiHost\" : button.parents(\"tbody\").find(\"input[name=apiHost]\").val(),\n \"apiPort\" : button.parents(\"tbody\").find(\"input[name=apiPort]\").val(),\n \"apiUseSSL\" : button.parents(\"tbody\").find(\"input[type=checkbox][name=apiUseSSL]\").prop(\"checked\") ? \"on\" : \"\"\n\t }, function(data){\n\t if(data == \"success\"){\n\t button.parent().find(\"span.result_con\").html(\"<span style=\\\"color:green;font-weight:bold\\\"> Connection success<span>\");\n\t } else {\n\t button.parent().find(\"span.result_con\").html(\"<span style=\\\"color:red;font-weight:bold\\\"> Connection failed<span>\");\n\t }\n\t });\n\t });'\n . '</script>',\n ),\n );\n\n return $configarray;\n}", "function get_groups_to_object($parameters){\n\t\t$object\t\t\t = $this->check_parameters($parameters, \"object\", -1);\n\t\t$module\t\t\t = $this->check_parameters($parameters, \"module\", \"\");\n\t\tif ($module==\"\"){\n\t\t\treturn \"\";\n\t\t}\n\t\t$sql = \"Select * from group_data \n\t\t\t\t\tinner join group_type on group_type_identifier = group_type \n\t\t\t\t\tleft outer join group_to_object on gto_identifier=group_identifier and gto_client=group_client and gto_object=$object and gto_module ='$module'\n\t\t\t\twhere group_data.group_client=$this->client_identifier order by group_type_label, group_label\";\n\t\t$result = $this->call_command(\"DB_QUERY\",array($sql));\n\t\t$g_type =\"\";\n\t\t$group_list = \"\";\n\t\t$gdata = Array();\n\t\t$set_default=1;\n\t\twhile ($r = $this->call_command(\"DB_FETCH_ARRAY\",array($result))){\n\t\t\tif (\"__NOT_FOUND__\" == $this->check_parameters($gdata,$r[\"group_type_label\"],\"__NOT_FOUND__\")){\n\t\t\t\t$gdata[$r[\"group_type_label\"]] = Array();\n\t\t\t}\n\t\t\t$gdata[$r[\"group_type_label\"]][count($gdata[$r[\"group_type_label\"]])] = Array(\n\t\t\t\t\"label\" \t=> $r[\"group_label\"], \n\t\t\t\t\"default\"\t=> $r[\"group_default\"],\n\t\t\t\t\"identifier\"=> $r[\"group_identifier\"],\n\t\t\t\t\"selected\"\t=> $this->check_parameters($r,\"gto_object\",0)\n\t\t\t);\n\t\t\tif($this->check_parameters($r,\"gto_object\",0)>0){\n\t\t\t\t$set_default=0;\n\t\t\t}\n\t\t}\n\t\t$this->call_command(\"DB_FREE\",array($result));\n\t\tforeach($gdata as $key =>$list){\n\t\t\t$type \t\t = $this->get_constant($key);\n\t\t\t$group_list .=\"<options module=\\\"\".$type.\"\\\">\";\n\t\t\t$m=count($gdata[$key]);\n\t\t\tfor($i=0;$i<$m;$i++){\n\t\t\t\t$group_list .=\"<option value=\\\"\".$gdata[$key][$i][\"identifier\"].\"\\\"\";\n\t\t\t\tif ($gdata[$key][$i][\"selected\"]!=0 || ($set_default==1 && $gdata[$key][$i][\"default\"]==1)){\n\t\t\t\t\t$group_list .=\" selected=\\\"true\\\"\";\n\t\t\t\t}\n\t\t\t\t$group_list .=\">\".$gdata[$key][$i][\"label\"].\"</option>\";\n\t\t\t}\n\t\t\t$group_list .=\"</options>\";\n\t\t}\n\t\treturn $group_list;\n\t}", "public function configs();", "public static function load($group)\r\n\t{\r\n\t\tif( ! count(self::$_sources))\r\n\t\t{\r\n\t\t\tthrow new Kohana_Exception('No configuration sources attached');\r\n\t\t}\r\n\r\n\t\tif (empty($group))\r\n\t\t{\r\n\t\t\tthrow new Kohana_Exception(\"Need to specify a config group\");\r\n\t\t}\r\n\r\n\t\tif ( ! is_string($group))\r\n\t\t{\r\n\t\t\tthrow new Kohana_Exception(\"Config group must be a string\");\r\n\t\t}\r\n\r\n\t\tif (strpos($group, '.') !== FALSE)\r\n\t\t{\r\n\t\t\t// Split the config group and path\r\n\t\t\tlist ($group, $path) = explode('.', $group, 2);\r\n\t\t}\r\n\t\t\r\n\t\tif(isset(Config::$_items[$group])) \r\n\t\t{\r\n\t\t\tif (isset($path))\r\n\t\t\t{\r\n\t\t\t\treturn Arr::path(Config::$_items[$group]->as_array(), $path, NULL, '.');\r\n\t\t\t}\r\n\t\t\treturn Config::$_items[$group];\r\n\t\t}\r\n\t\t\r\n\t\t$config = array();\r\n\r\n\t\t// We search from the \"lowest\" source and work our way up\r\n\t\t$sources = array_reverse(self::$_sources);\r\n\r\n\t\tforeach ($sources as $source)\r\n\t\t{\r\n\t\t\tif ($source instanceof Config_Source)\r\n\t\t\t{\r\n\t\t\t\tif ($source_config = $source->load($group))\r\n\t\t\t\t{\r\n\t\t\t\t\t$config = Arr::merge($config, $source_config);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif ( ! isset(Config::$_items[$group]) )\r\n\t\t{\r\n\t\t\tConfig::$_items[$group] = array();\r\n\t\t}\r\n\t\r\n\t\tConfig::$_items[$group] = new Config_group($config, $group);\r\n\t\r\n\t\tif (isset($path))\r\n\t\t{\r\n\t\t\treturn Arr::path($config, $path, NULL, '.');\r\n\t\t}\r\n\r\n\t\treturn Config::$_items[$group];\r\n\t}", "public final function getHostGroup() {\n\t\treturn $this->hostGroup;\n\t}", "public function retrieveConfig(string $stackName) : array {\n\n\n\t\t$stackId = $this->getStackIdByName($stackName);\n\n\t\t$url = implode('/', [\n\t\t\t$this->account->getUrl(),\n\t\t\t'environments',\n\t\t\t$stackId,\n\t\t\t'?action=exportconfig'\n\t\t]);\n\n\t\t$headers = [];\n\t\t$this->addAuthHeader($headers);\n\n\t\t$jsonContent = json_encode([\n\t\t\t'serviceIds' => []\n\t\t]);\n\t\t$data = $this->apiService->post($url, $jsonContent, $headers, [200]);\n\n\t\t$decodedData = json_decode($data, true);\n\t\t$dockerCompose = $decodedData['dockerComposeConfig'];\n\t\t$rancherCompose = $decodedData['rancherComposeConfig'];\n\n\t\t// Empty files are not sent empty so we force them to be\n\t\tif(substr($dockerCompose, 0, 2) === '{}')\n\t\t\t$dockerCompose = '';\n\t\tif(substr($rancherCompose, 0, 2) === '{}')\n\t\t\t$rancherCompose = '';\n\n\t\treturn [$dockerCompose, $rancherCompose];\n\t}", "protected function loadGroups()\n {\n $groups = self::getSubObjectIDs(\n 'GroupAssociation',\n array('hostID' => $this->get('id')),\n 'groupID'\n );\n $groups = self::getSubObjectIDs(\n 'Group',\n array('id' => $groups)\n );\n $this->set('groups', $groups);\n }", "public function storageGroupSetting($arguments)\n {\n if (!in_array($this->node, (array)self::$pluginsinstalled)) {\n return;\n }\n if (!$arguments['Host']->isValid()) {\n return;\n }\n $Locations = self::getSubObjectIDs(\n 'LocationAssociation',\n array(\n 'hostID' => $arguments['Host']->get('id')\n ),\n 'locationID'\n );\n foreach ((array)self::getClass('LocationManager')\n ->find(array('id' => $Locations)) as &$Location\n ) {\n $StorageGroup = $Location\n ->getStorageGroup();\n if (!$StorageGroup->isValid()) {\n continue;\n }\n $arguments['StorageGroup'] = $StorageGroup;\n unset($Location);\n }\n }", "protected function _config($config) {\n\t\t\n\t \tif ($config instanceof Zend_Config) { $config = $config->toArray(); }\n\n if (!is_array($config)) {\n require_once 'Zend/Exception.php';\n throw new Zend_Exception('Invalid argument: $config must be an array or an instance of Zend_Config');\n }\n\t\t\n foreach ($config as $key => $value) {\n \t// inscription dans l'element dans la configuration\n \tif (property_exists($this, '_'.$key)) {eval ('$this->_' . $key . ' = ' .var_export($value, true) .';');}\n \telse {$this->addConfig($key, $value);}\n }\n\t}" ]
[ "0.6155782", "0.5890984", "0.53174704", "0.5266222", "0.5246508", "0.5223388", "0.51948035", "0.5187875", "0.51179266", "0.5111124", "0.5063114", "0.50373775", "0.49799708", "0.49435288", "0.49427342", "0.49257013", "0.49216715", "0.48549893", "0.48534802", "0.48279363", "0.48220202", "0.48142642", "0.47910878", "0.47706297", "0.47499162", "0.4739874", "0.47065276", "0.46909907", "0.4685784", "0.4682566" ]
0.7300705
0
General | Admin | Messages
private function general_admin_messages() { $new_options[ 'log_import_messages' ] = array( 'type' => 'checkbox' , 'default' => '0' ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_general','section' => 'admin', 'group' => 'messages' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function messages();", "public function messages();", "public function messagesAction()\n {\n $messages = ContactUsMessage::getContactUsMessage();\n\n View::renderTemplate('Admin/Messages.html', [\n 'user' => $this->user,\n 'messages' => $messages]);\n }", "public function index() {\n $this->permission('Garden.Community.Manage');\n $this->setHighlightRoute('dashboard/message');\n $this->addJsFile('jquery.autosize.min.js');\n $this->addJsFile('jquery.tablednd.js');\n $this->title(t('Messages'));\n Gdn_Theme::section('Moderation');\n\n // Load all messages from the db\n $this->MessageData = $this->MessageModel->get('Sort');\n $this->render();\n }", "function ht_admin_messages() {\n\t$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';\n\t\n\tif( current_user_can('activate_plugins') ){\n\t\t//New User Intro\n\t\tif (isset ( $_GET ['disable_ht_admin_message'] ) && $_GET ['disable_ht_admin_message'] == 'true'){\n\t\t\t// Disable Hello to new user if requested\n\t\t\tupdate_option('disable_ht_admin_message',0);\n\t\t}elseif ( get_option ( 'disable_ht_admin_message' ) ) {\n\t\t\t\n\t\t\t$advice = sprintf( __(\"<p><strong>Headlines Tool</strong> plugin is ready to go! <a href='%s'>Click here</a> to start adding data. <a href='%s' title='Don't show this advice again' style='margin-left: 50px;'>Dismiss</a></p>\", 'ht'), ht_get_url('entries'), $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'disable_ht_admin_message=true');\n\t\t\t?>\n\t\t\t<div id=\"message\" class=\"updated\">\n\t\t\t\t<?php echo $advice; ?>\n\t\t\t</div>\n\t\t\t<?php\n\t\t}\n\t}\n}", "public function messages() {\n // $messages = [];\n $messages = $this->listMessages();\n print $this->render(messages,$messages);\n }", "public function messageAction()\n {\n $name = 'admin-message';\n\n $content = $this->params()->fromPost('content');\n if (Pi::service('permission')->isAdmin()) {\n Pi::user()->data->set(0, $name, $content);\n }\n\n if ($content) {\n $data = [\n 'value' => $content,\n 'time' => time(),\n ];\n } else {\n $data = Pi::user()->data->get(0, 'admin-welcome', true);\n }\n\n $message = [\n 'time' => _date($data['time']),\n 'content' => Pi::service('markup')->render(\n $data['value'],\n 'text'\n ),\n ];\n\n return $message;\n }", "public function message(){\n\t\t\t$this->admin_model->message();\n\t\t\tredirect('admin/messages');\n\t\t}", "public function messages(){\n\t\treturn View::make('admin.pages.messages');\n\t}", "public function messages()\n {\n // use trans instead on Lang \n return [\n //'username.required' => Lang::get('userpasschange.usernamerequired'),\n\t 'u_name.required' => 'We need u to specify your name',\n\t 'u_email.email' => 'Give us real email',\n\t 'u_phone.regex' => 'Phone must be in format +380....',\n\t\t];\n\t}", "function getMessages(){\r\n\t}", "public function messages()\n {\n\t$this->viewBuilder()->layout('backendlayout');\n\t $user_detail=$this->Users->find('all')->toArray();\n \n\t $this->set(compact('id','user_detail'));\n\t\t}", "public function myMessages() {\n $messages = $this->listMessageByUser($_SESSION['user']['id']);\n print $this->render(myMessages,$messages);\n }", "public function messages()\n {\n return parent::messages(); // TODO: Change the autogenerated stub\n }", "public function network_admin_menus()\n {\n }", "function draftScheduler_manage_page() {\r\n\t\t\t$ifds_msg = $this->ifdsManagePg();\r\n\t\t\tif ( trim( $ifds_msg ) != '' ) {\r\n\t\t\t\techo '<div id=\"message\" class=\"updated fade\"><p><strong>' . $ifds_msg . '</strong></p></div>';\r\n\t\t\t}\r\n\t\t\techo '<div class=\"wrap\">';\r\n\t\t\t$this->draftScheduler_admin_page();\r\n\t\t\techo '</div>';\r\n\t\t}", "protected static function includeMessages()\r\n\t{\r\n\t}", "public function messages()\n {\n return [\n // Custom messages\n ];\n }", "public function custom_menu_messages() {\n global $USER;\n $messagemenu = new custom_menu();\n\n $addmessagemenu = true;\n\n if (!isloggedin() || isguestuser()) {\n $addmessagemenu = false;\n }\n\n if ($addmessagemenu) {\n $messages = $this->get_user_messages();\n $messagecount = 0;\n foreach ($messages as $message) {\n if (!$message->from) { // Workaround for issue #103 in Elegance.\n continue;\n }\n $messagecount++;\n }\n\n $messagetitle = $messagecount.' ';\n if ($messagecount == 0) {\n $messagemenuicon = html_writer::tag('i', '', array('class' => 'fa fa-envelope-o'));\n $messagetitle .= get_string('messages', 'message');\n } else {\n $messagemenuicon = html_writer::tag('i', '', array('class' => 'fa fa-envelope'));\n if ($messagecount == 1) {\n $messagetitle .= get_string('message', 'message');\n } else {\n $messagetitle .= get_string('messages', 'message');\n }\n }\n $messagemenucount = $messagecount.' ';\n $messagemenutext = html_writer::tag('span', $messagemenucount).$messagemenuicon;\n $messagesubmenu = $messagemenu->add(\n $messagemenutext,\n new moodle_url('/message/index.php', array('viewing' => 'recentconversations')),\n $messagetitle,\n 9999\n );\n foreach ($messages as $message) {\n if (!$message->from) { // Workaround for issue #103.\n continue;\n }\n $senderpicture = new user_picture($message->from);\n $senderpicture->link = false;\n $senderpicture->size = 60;\n\n $messagecontent = html_writer::start_span('msg-picture').$this->render($senderpicture).html_writer::end_span();\n $messagecontent .= html_writer::start_span('msg-body');\n $messagecontent .= html_writer::span($message->from->firstname, 'msg-sender');\n $messagecontent .= html_writer::span($message->text, 'msg-text');\n $messagecontent .= html_writer::start_span('msg-time');\n $messagecontent .= html_writer::tag('i', '', array('class' => 'fa fa-comments'));\n $messagecontent .= html_writer::span($this->get_time_difference($message->date));\n $messagecontent .= html_writer::end_span();\n $messagecontent .= html_writer::end_span();\n\n $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));\n $messagesubmenu->add($messagecontent, $messageurl, $message->text);\n }\n }\n\n return $this->render_custom_menu($messagemenu);\n }", "public function messages()\n {\n return \n [\n 'role.required' => 'Such user does not exist !!!',\n 'role.in' => 'You can select User|Company|Festival',\n ];\n }", "public function commonMessages() {\n\n return [\n 'marks.regex' => trans('admin/rewards.marks_regex'),\n 'marks.max' => trans('admin/rewards.max_marks'),\n 'marks.required' => trans('admin/admin.marks_error'),\n 'certi.required' => trans('admin/admin.select_error'),\n ];\n }", "function keativa_dashboard_messages() {\n\t\techo \"<p>Administrasi website resmi Khalifah Umroh & Tour.</p>\";\n\t}", "function index()\n {\n Modules::run('login/is_logged_in');\n //TODO: if the user survives this, he/she has been cleared\n $data['page_title'] = 'Messaging';\n $data['module'] = 'message';\n $data['view_file'] = 'messages_list';\n echo Modules::run('templates/main_site', $data);\n }", "public function backendSmsMessagingIndexAction()\n {\n $languages = array(\n 'Deutsch' => CommunityUser::USERLANGUAGE_GERMAN,\n 'Französisch' => CommunityUser::USERLANGUAGE_FRENCH,\n 'Italienisch' => CommunityUser::USERLANGUAGE_ITALIAN\n );\n\n $kantons = $this->kantonRepository->findAll();\n $admins = $this->communityUserRepository->findEasyVoteAdminUsers();\n\n if ($admins->count() === 0) {\n $group = $this->frontendUserGroupRepository->findByUid((int)$this->settings['easyvoteAdminUserGroupUid']);\n if ($group instanceof FrontendUserGroup) {\n $groupname = $group->getTitle();\n } else {\n $groupname = '(no group found for uid ' . $this->settings['easyvoteAdminUserGroupUid'] . ')';\n }\n $this->addFlashMessage('Es existiert noch kein FE-User mit der Gruppe \"' . $groupname . '\" für den Testversand');\n }\n\n $dateTime = new \\DateTime();\n $dateTime = $dateTime->format('Y-m-d\\TH:i:s');\n\n $this->view->assignMultiple(array(\n 'languages' => $languages,\n 'kantons' => $kantons,\n 'admins' => $admins,\n 'dateTime' => $dateTime\n ));\n }", "function bbp_admin_notices()\n{\n}", "public function listPrivilegesMessages()\n {\n $_lang = $_CMAPP[i18n]->getTranslationArray(\"admin\");\n return array( self::PRIV_ADMIN_ALL=>$_lang['privs_admin_all'],\n \tself::PRIV_MANAGE_USERS=>$_lang['privs_manage_user'],\n \tself::PRIV_MANAGE_MODULES=>$_lang['privs_manage_modules']\n );\n }", "public function messages()\n {\n return [\n //\n ];\n }", "public function messages()\n {\n return [\n //\n ];\n }", "public function messages()\n {\n return [\n //\n ];\n }", "public function messages()\n {\n return [\n //\n ];\n }" ]
[ "0.67400336", "0.67400336", "0.67106974", "0.6708605", "0.66663754", "0.66178954", "0.66124755", "0.6595935", "0.6457772", "0.64067507", "0.63670874", "0.6351392", "0.63337463", "0.63155717", "0.62986034", "0.6288154", "0.6280485", "0.6269474", "0.6254609", "0.6245657", "0.61991924", "0.61885107", "0.6187137", "0.61822367", "0.6138405", "0.6137174", "0.61340785", "0.61340785", "0.61340785", "0.61340785" ]
0.74787426
0
General / Data / Packaged Data Extensions
private function augment_general_data_packaged_data_extensions() { $new_options['use_contact_fields'] = array( 'type' => 'checkbox', 'default' > '0' , 'call_when_changed' => array( $this , 'activate_contact_fields' ) ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_general','section' => 'data', 'group' => 'packaged_data_extensions' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addDataObjectAndExtensionInfo()\n {\n $extensions = ClassInfo::subclassesFor('DataExtension');\n array_shift($extensions);\n $classes = array(\n 'DataObjects' => ClassInfo::dataClassesFor('DataObject'),\n 'DataExtensions' => $extensions\n );\n foreach ($classes as $label => $dataClasses) {\n ksort($dataClasses);\n $this->addDatabaseInfo($dataClasses, $label);\n }\n }", "public function extension();", "abstract protected function storeExtension();", "public abstract function getDataAccess();", "abstract protected function getData();", "abstract protected function getData();", "abstract public function getData();", "abstract protected function _getDataStore();", "abstract protected function _getDataStore();", "abstract protected function getExtension();", "public abstract function getData();", "public abstract function data();", "abstract function getData();", "public function data();", "public function data();", "public function data();", "abstract public function getDataClass () : string;", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();", "public function getData();" ]
[ "0.6573636", "0.6406782", "0.6398664", "0.62810916", "0.62643003", "0.62643003", "0.62631786", "0.62433225", "0.62433225", "0.6205141", "0.6173485", "0.6151763", "0.6142585", "0.6129372", "0.6129372", "0.6129372", "0.60311866", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143", "0.59849143" ]
0.64591986
1
General / Server / Security
private function augment_general_server_security() { $new_options['use_nonces'] = array( 'type' => 'checkbox', 'default' > '1' , 'use_in_javascript' => true ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_general','section' => 'server', 'group' => 'security' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getSecurityInformation();", "function getSolarSystemSecurity()\n {\n return $this->getSystem()->getSecurity();\n }", "public function isSecured();", "public function setSecurity()\n {\n $this->lang->site->menu = $this->lang->security->menu;\n $this->lang->menuGroups->site = 'security';\n\n $captcha = (isset($this->config->site->captcha) and ($this->config->site->captcha == 'open' and ($this->post->captcha == 'close' or $this->post->captcha == 'auto')) or ((!isset($this->config->site->captcha) or $this->config->site->captcha == 'auto') and $this->post->captcha == 'close'));\n $checkEmail = (isset($this->config->site->checkEmail) and $this->config->site->checkEmail == 'open' and $this->post->checkEmail == 'close');\n $front = (isset($this->config->site->front) and $this->config->site->front == 'login' and $this->post->front == 'guest');\n $checkLocation = (isset($this->config->site->checkLocation) and $this->config->site->checkLocation == 'open' and $this->post->checkLocation == 'close');\n $checkSessionIP = (isset($this->config->site->checkSessionIP) and $this->config->site->checkSessionIP == 1 and $this->post->checkSessionIP == 0);\n $allowedIP = (isset($this->config->site->allowedIP) and ($this->config->site->allowedIP != $this->post->allowedIP));\n\n $newImportantValidate = $this->post->importantValidate ? $this->post->importantValidate : array();\n $oldImportantValidate = explode(',', $this->config->site->importantValidate);\n\n $importantChange = false;\n foreach($oldImportantValidate as $validate)\n {\n if(!in_array($validate, $newImportantValidate))\n {\n $importantChange = true;\n break;\n }\n }\n\n if($captcha or $checkEmail or $front or $checkLocation or $checkSessionIP or $allowedIP or $importantChange)\n {\n $okFile = $this->loadModel('common')->verifyAdmin();\n $pass = $this->loadModel('guarder')->verify('okFile');\n $this->view->pass = $pass;\n $this->view->okFile = $okFile;\n if(!empty($_POST) && !$pass) $this->send(array('result' => 'fail', 'reason' => 'captcha'));\n }\n\n if(!empty($_POST))\n {\n $setting = fixer::input('post')\n ->setDefault('captcha', 'auto')\n ->setDefault('filterSensitive', 'close')\n ->setDefault('checkIP', 'close')\n ->setDefault('checkSessionIP', '0')\n ->setDefault('checkLocation', 'close')\n ->setDefault('checkEmail', 'close')\n ->setDefault('allowedIP', '')\n ->setDefault('importantValidate', '')\n ->join('importantValidate', ',')\n ->setForce('sensitive', seo::unify($this->post->sensitive, ','))\n ->get();\n\n /* check IP. */\n $ips = !$this->post->allowedIP ? array() : explode(',', $this->post->allowedIP);\n foreach($ips as $ip)\n {\n if(!empty($ip) and !helper::checkIP($ip))\n {\n dao::$errors['allowedIP'][] = $this->lang->site->wrongAllowedIP;\n break;\n }\n }\n\n $result = $this->loadModel('setting')->setItems('system.common.site', $setting, 'all');\n\n if($result) $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess, 'locate' => inlink('setsecurity')));\n $this->send(array('result' => 'fail', 'message' => dao::getError()));\n }\n\n $location = $this->app->loadClass('IP')->find(helper::getRemoteIp());\n if(is_array($location))\n {\n $locations = $location;\n $location = join(' ', $locations);\n if(count($location) > 3) $location = $locations[0] . ' ' . $locations[1] . ' ' . $locations[2];\n }\n\n $this->view->title = $this->lang->site->setSecurity;\n $this->view->location = $location;\n $this->display();\n }", "public static function usingSecureMode()\n {\n }", "private function _confirmGeneralSecurity()\n\t{\n\t\tif( MODULE != 'security' )\n\t\t{\n\t \t\n\t\t\t$min_security_level = $this->system_register->getModuleSecurityLevel(MODULE,'security_access');\n\t \t//check the security against the module\n\t \tif($min_security_level > 1)\n\t \t{\n\t\t \tif( !isset($_SESSION['user_security_level']) )\n\t\t \t{\n\t\t\t \t//get the correct security link to log in\n\t \t\t\t$_SESSION['system_security_redirect'] = 1;\n\t \t\t\t$_SESSION['system_security_point'] = 'module control';\n\t\t\t\t\t$_SESSION['system_security_reason'] = 'You do not have the security level needed to access the requested model';\n\t\t\t\t\t\n\t\t\t\t\t//handle the page information\n\t\t\t\t\t$_SESSION['system_original_page_info_link'] = $this->page_info_link;\t\t\n\t\t\t\t\t$_SESSION['system_original_page_info_options'] = $this->page_info_options;\n\t\t\t\t\t$_SESSION['system_original_page_info_home'] = $this->page_info->getHome();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t//need the security link\n\t\t\t\t\t$menu_register_ns = NS_APP_CLASSES.'\\\\menu_register\\\\menu_register';\n\t\t\t\t\t$menu_register = $menu_register_ns::getInstance();\n\t\t\t\t\t\n\t\t\t\t\t//check if we have the right security access\n\t\t\t\t\t$security_link = $menu_register->getModuleLink('security');\n\t\t\t\t\t\n\t\t \t\theader(\"Location: /$security_link\");\n\t\t\t\t\texit();\n\t\t\t \t\n\t\t \t}\n\t \t}\n\t }\n\t\n\t\treturn;\n\t}", "public function procLsSecurity($ar=NULL) {\n $p = new XParam($ar, array());\n $nlevel=$p->get('nlevel');\n $level1=$nlevel[$this->_moid];\n $message=array();\n $noauth=XLabels::getSysLabel('security','noauthtosetsec');\n foreach($level1 as $uoid=>$level2) {\n foreach($level2 as $lang=>$level) {\n\t$xuser=new XUser(array(\"UID\"=>$uoid));\n\t$ok=$xuser->setUserAccess(NULL,$this->_moid,$lang,NULL,$level,null,false,false);\n\tif(!$ok){\n\t $xds=XDataSource::objectFactoryHelper8('BCLASS=XDSTable&SPECS='.$uoid);\n\t $d=$xds->rDisplayText($uoid,$lang);\n\t $message[]=$d['link'].' ('.$lang.') : '.$noauth;\n\t}\n\tunset($xuser);\n }\n }\n if(!empty($message)) setSessionVar('message',implode('<br/>',$message));\n }", "public function lsSecurity($ar=NULL) {\n $p = new XParam($ar, array('all'=>'groups'));\n $tplentry=$p->get('tplentry');\n $all=$p->get('all');\n XLabels::loadLabels('security');\n $r1=XUser::getModuleAccess($this,$all);\n XShell::toScreen1($tplentry.'u',$r1[0]);\n XShell::toScreen1($tplentry.'g',$r1[1]);\n }", "function isSecure ()\n {\n\n return FALSE;\n\n }", "public function securityCheckAction() {\n }", "public function is_secure();", "public function getSecurity()\n {\n return $this->security;\n }", "public function getSecurity()\n {\n return $this->security;\n }", "private function CheckPrivilage(){\n \t\t// what level of control required to access function.\n \t\tswitch($_SESSION['TYPE']){\n \t\t\tcase 'ADMIN': \n \t\t\t\treturn 3;\n \t\t\tcase 'Manager':\n \t\t\tcase 'Sizing':\n \t\t\t\treturn 2;\n \t\t\tcase 'Employee':\n \t\t\t\treturn 1;\n \t\t\tdefault:\n \t\t\t\treturn 0;\t\t\n \t\t}\n \t}", "function bfg_security_headers() {\n\n\tif( is_admin() )\n\t\treturn;\n\n\theader( 'X-Frame-Options: DENY' );\n\theader( 'X-Content-Type-Options: nosniff' );\n\theader( 'X-XSS-Protection: 1; mode=block' );\n\n\t// Strict-Transport-Security: https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet\n\t// header( 'Strict-Transport-Security: max-age=31536000; includeSubDomains; preload' );\n\n}", "public function getSecurity() {\n return $this->security;\n }", "public function securityCheckAction()\r\n {\r\n }", "public function isSecure();", "public function securityCheckAction()\r\n {\r\n\r\n }", "function doSecurityChecks()\n{\n\tglobal $modSettings, $context, $maintenance, $txt, $options;\n\n\t$show_warnings = false;\n\n\t$cache = Cache::instance();\n\n\tif (allowedTo('admin_forum') && User::$info->is_guest === false)\n\t{\n\t\t// If agreement is enabled, at least the english version shall exists\n\t\tif ($modSettings['requireAgreement'] && !file_exists(SOURCEDIR . '/ElkArte/Languages/Agreement/English.txt'))\n\t\t{\n\t\t\t$context['security_controls_files']['title'] = $txt['generic_warning'];\n\t\t\t$context['security_controls_files']['errors']['agreement'] = $txt['agreement_missing'];\n\t\t\t$show_warnings = true;\n\t\t}\n\n\t\t// Cache directory writable?\n\t\tif ($cache->isEnabled() && !is_writable(CACHEDIR))\n\t\t{\n\t\t\t$context['security_controls_files']['title'] = $txt['generic_warning'];\n\t\t\t$context['security_controls_files']['errors']['cache'] = $txt['cache_writable'];\n\t\t\t$show_warnings = true;\n\t\t}\n\n\t\tif (checkSecurityFiles())\n\t\t{\n\t\t\t$show_warnings = true;\n\t\t}\n\n\t\t// We are already checking so many files...just few more doesn't make any difference! :P\n\t\t$attachmentsDir = new AttachmentsDirectory($modSettings, database());\n\t\t$path = $attachmentsDir->getCurrent();\n\t\tsecureDirectory($path, true);\n\t\tsecureDirectory(CACHEDIR, false, '\"\\.(js|css)$\"');\n\n\t\t// Active admin session?\n\t\tif (isAdminSessionActive())\n\t\t{\n\t\t\t$context['warning_controls']['admin_session'] = sprintf($txt['admin_session_active'], (getUrl('admin', ['action' => 'admin', 'area' => 'adminlogoff', 'redir', '{session_data}'])));\n\t\t}\n\n\t\t// Maintenance mode enabled?\n\t\tif (!empty($maintenance))\n\t\t{\n\t\t\t$context['warning_controls']['maintenance'] = sprintf($txt['admin_maintenance_active'], (getUrl('admin', ['action' => 'admin', 'area' => 'serversettings', '{session_data}'])));\n\t\t}\n\n\t\t// New updates\n\t\tif (defined('FORUM_VERSION'))\n\t\t{\n\t\t\t$index = 'new_in_' . str_replace(array('ElkArte ', '.'), array('', '_'), FORUM_VERSION);\n\t\t\tif (!empty($modSettings[$index]) && empty($options['dismissed_' . $index]))\n\t\t\t{\n\t\t\t\t$show_warnings = true;\n\t\t\t\t$context['new_version_updates'] = array(\n\t\t\t\t\t'title' => $txt['new_version_updates'],\n\t\t\t\t\t'errors' => array(replaceBasicActionUrl($txt['new_version_updates_text'])),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check for database errors.\n\tif (!empty($_SESSION['query_command_denied']))\n\t{\n\t\tif (User::$info->is_admin)\n\t\t{\n\t\t\t$context['security_controls_query']['title'] = $txt['query_command_denied'];\n\t\t\t$show_warnings = true;\n\t\t\tforeach ($_SESSION['query_command_denied'] as $command => $error)\n\t\t\t{\n\t\t\t\t$context['security_controls_query']['errors'][$command] = '<pre>' . Util::htmlspecialchars($error) . '</pre>';\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$context['security_controls_query']['title'] = $txt['query_command_denied_guests'];\n\t\t\tforeach ($_SESSION['query_command_denied'] as $command => $error)\n\t\t\t{\n\t\t\t\t$context['security_controls_query']['errors'][$command] = '<pre>' . sprintf($txt['query_command_denied_guests_msg'], Util::htmlspecialchars($command)) . '</pre>';\n\t\t\t}\n\t\t}\n\t}\n\n\t// Are there any members waiting for approval?\n\tif (allowedTo('moderate_forum') && ((!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2) || !empty($modSettings['approveAccountDeletion'])) && !empty($modSettings['unapprovedMembers']))\n\t{\n\t\t$context['warning_controls']['unapproved_members'] = sprintf($txt[$modSettings['unapprovedMembers'] == 1 ? 'approve_one_member_waiting' : 'approve_many_members_waiting'], getUrl('admin', ['action' => 'admin', 'area' => 'viewmembers', 'sa' => 'browse', 'type' => 'approve']), $modSettings['unapprovedMembers']);\n\t}\n\n\tif (!empty($context['open_mod_reports']) && (empty(User::$settings['mod_prefs']) || User::$settings['mod_prefs'][0] == 1))\n\t{\n\t\t$context['warning_controls']['open_mod_reports'] = '<a href=\"' . getUrl('action', ['action' => 'moderate', 'area' => 'reports']) . '\">' . sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']) . '</a>';\n\t}\n\n\tif (!empty($context['open_pm_reports']) && allowedTo('admin_forum'))\n\t{\n\t\t$context['warning_controls']['open_pm_reports'] = '<a href=\"' . getUrl('action', ['action' => 'moderate', 'area' => 'pm_reports']) . '\">' . sprintf($txt['pm_reports_waiting'], $context['open_pm_reports']) . '</a>';\n\t}\n\n\tif (isset($_SESSION['ban']['cannot_post']))\n\t{\n\t\t// An admin cannot be banned (technically he could), and if it is better he knows.\n\t\t$context['security_controls_ban']['title'] = sprintf($txt['you_are_post_banned'], User::$info->is_guest ? $txt['guest_title'] : User::$info->name);\n\t\t$show_warnings = true;\n\n\t\t$context['security_controls_ban']['errors']['reason'] = '';\n\n\t\tif (!empty($_SESSION['ban']['cannot_post']['reason']))\n\t\t{\n\t\t\t$context['security_controls_ban']['errors']['reason'] = $_SESSION['ban']['cannot_post']['reason'];\n\t\t}\n\n\t\tif (!empty($_SESSION['ban']['expire_time']))\n\t\t{\n\t\t\t$context['security_controls_ban']['errors']['reason'] .= '<span class=\"smalltext\">' . sprintf($txt['your_ban_expires'], standardTime($_SESSION['ban']['expire_time'], false)) . '</span>';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$context['security_controls_ban']['errors']['reason'] .= '<span class=\"smalltext\">' . $txt['your_ban_expires_never'] . '</span>';\n\t\t}\n\t}\n\n\t// Finally, let's show the layer.\n\tif ($show_warnings || !empty($context['warning_controls']))\n\t{\n\t\ttheme()->getLayers()->addAfter('admin_warning', 'body');\n\t}\n}", "public function executeSecure()\n\t{\n\t}", "public function isuser() {\n\t\t\treturn $this->manager->framework->issecured();\t\t\n\t\t}", "private function checkForbidden(){\n\n }", "public function authorize()\n {\n if ($this->serverIsOwnedByUser()) {\n return true;\n }\n if (Auth::user()->can('create-server-sites')) {\n return true;\n }\n return false;\n }", "protected function readSecurityData()\n {\n $this->readData(self::SOLR_SECURITY_CONF_PATH, $this->securityData, true);\n }", "public function executeSecure()\n {\n }", "public function secure()\n {\n $release = $this->paths->release;\n $shared = $this->paths->shared;\n $this->section(\"Securing file and folder permissions...\");\n $this->exec(\" find $release -type d -exec chmod 755 {} \\;\n find $release -type f -exec chmod 644 {} \\;\n chmod 440 $release/site/config.php\n chmod 440 $shared/site/config-local.php\", true);\n $this->ok();\n }", "public static function isSecure() {\n\t return (isset($_SERVER['http']) && strtolower($_SERVER['http']) == 'on');\n\t}", "public function addSitePrivileges()\n {\n\n }", "function IsSecure()\r\n\t{\r\n\t\treturn 'on' == strtolower(GetValue('HTTPS', $_SERVER)) || 1 == GetValue('HTTPS', $_SERVER);\r\n\t}" ]
[ "0.65146625", "0.6443271", "0.6388385", "0.6366575", "0.6254083", "0.62526184", "0.62411386", "0.6205075", "0.6096566", "0.60232884", "0.6016788", "0.6004773", "0.6004773", "0.598934", "0.5981149", "0.5951342", "0.59470147", "0.5930894", "0.5903324", "0.5889389", "0.58881426", "0.58701044", "0.58594966", "0.5833063", "0.5809605", "0.5807604", "0.580544", "0.58000034", "0.57963187", "0.57870626" ]
0.74878275
0
General / Server / Web App
private function augment_general_server_web_app() { $new_options['use_pages'] = array( 'type' => 'checkbox', 'default' > '0' ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_general','section' => 'server', 'group' => 'web_app_settings' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function index()\n {\n print_r($_SERVER);\n }", "public function getServer();", "public function getServer();", "public function getServer();", "public function server(){\n return $_SERVER['SERVER_NAME'];\n }", "public function isWebServer();", "function indexAction(){\n\t\t $this->view->host = $_SERVER['SERVER_NAME'].\"/\";\n\t\n\t\n }", "public function init()\n {\n //1) rendering the real admin page via browser\n //2) accepting request from cron from localhost\n }", "public function actionServer()\n\t{\n\t\t// using the default layout 'protected/views/layouts/main.php'\n\t\t$this->render('server');\n }", "private function fronteEnd() {\n\n }", "public static function app() {}", "private function get_appname()\n {\n return SAE_APPNAME;\n }", "function nomServer(){\n\t\techo $_SERVER['HTTP_HOST'];//pareil sauf si c'est localhost\n\t\techo $_SERVER['PHP_SELF'];//affiche le domaine et le chemin jusqu'à la page actuelle\n\t}", "final public function getServer()\n {\n }", "public function action_app()\n\t{\n\t\t$this->access('admin.data.app');\n\n\t\tif(!$this->request->is_ajax())\n\t\t{\n\t\t\tThrow new HTTP_Exception_403;\n\t\t}\n\t}", "static function getFrontendApplication()\n {\n\n return null;\n }", "public function getApp();", "static function mainSiteAccessOnly() {\r\n if (self::currentIsMainSite() == false) {\r\n self::redirect(_CONFIG_SITE_PROTOCOL . '://' . _CONFIG_CORE_SITE_HOST_URL);\r\n }\r\n }", "public function serve() \n\t{\n\n\t}", "protected function set_up()\n {\n // to simuulate that we have an actual webserver.\n if (!isset($_SERVER) || !is_array($_SERVER)) {\n $_SERVER = [];\n }\n $_SERVER['HTTP_HOST'] = 'localhost';\n $_SERVER['REQUEST_URI'] = '/my_script.php?wsdl';\n $_SERVER['SCRIPT_NAME'] = '/my_script.php';\n $_SERVER['HTTPS'] = \"off\";\n }", "public static function starApp()\n {\n $url = App_controlador::getRute();\n $app = new App_controlador();\n //Incluir la vista que cargara mi aplicacion con include\n include_once 'vista/app.php';\n }", "public function getServer()\n {\n return static::$server;\n }", "abstract protected function getApplication();", "public function Services() {\n require_once ('_server/views/header.php');\n if(GlobalData::IsLoggedIn()) {\n require_once (\"_server/views/dash_navi.php\");\n require_once (\"_server/views/ContentsView_Menu.php\");\n require_once (\"_server/modules/search/SearchView_Client.php\");\n }\n require_once ('_server/views/footer.php');\n }", "public function getServer(): string;", "public function getServerVars();", "public function getResourceServer();", "public function index(){\n \tdump(\"Page frontend controller is working\");\n }", "public static function init()\n\t{\n\t\tset_error_handler(array('App', \"appError\"));\n\t\tset_exception_handler(array('App', \"appException\"));\n\t\t//set timezone\n\t\tif(function_exists('data_default_timezone_set'))\n\t\t{\n\t\t\tdate_default_timezone_set(C('default_timezone'));\n\t\t}\n\t\t//set autoloader\n\t\tif(function_exists('spl_autoload_register'))\n\t\t{\n\t\t\tspl_autoload_register(array('Base','autoload'));\n\t\t}\n\t\t // Session initial lize\n\t\tif(isset($_REQUEST[C(\"VAR_SESSION_ID\")]))\n\t\t{\n\t\t\tsession_id($_REQUEST[C(\"VAR_SESSION_ID\")]);\n\t\t}\n\t\t\n if(C('SESSION_AUTO_START')) \n { \n\t\t\tsession_start();\n }\n\t\t//if is WEB PUB MODE do the dispatche from the request prams\n\t\tif(PUB_MODE == 'WEB') //for web/wap/mis project\n\t\t{\n\t\t\tRouter::dispatch();\n\t\t}elseif(PUB_MODE == 'IO'){ //for api project\n\t\t\t// DO IO ACTION\n\t\t\tif(isset($_GET['m']) && isset($_GET['a'])){\n\t\t\t\tdefine('MODULE_NAME',$_GET['m']);\n\t\t\t\tdefine('ACTION_NAME',$_GET['a']);\n\t\t\t}else{\n\t\t\t\tdefine('MODULE_NAME','index');\n\t\t\t\tdefine('ACTION_NAME','index');\n\t\t\t}\n\t\t}elseif(PUB_MODE == 'CLI'){ //for backend project\n\t\t\t//CLI MODE\n\t\t\tdefine('MODULE_NAME', isset($_SERVER['argv'][1]) ? strtolower($_SERVER['argv'][1]) : 'index');\n\t\t\tdefine('ACTION_NAME', isset($_SERVER['argv'][2]) ? strtolower($_SERVER['argv'][2]) : 'index');\n\t\t}\n\t\t//check language\n\t\tself::checkLanguage();\n\t\treturn ;\n\t}", "function index() {\n\t\twelcome_to_pApi();\n\t}" ]
[ "0.6742579", "0.6558635", "0.6558635", "0.6558635", "0.6120809", "0.6098416", "0.6088311", "0.60683334", "0.60428196", "0.59304285", "0.5911881", "0.5906187", "0.5890064", "0.5888317", "0.5853788", "0.5830595", "0.5813967", "0.580321", "0.5780636", "0.5770956", "0.57540196", "0.57480127", "0.57346934", "0.5714594", "0.56950897", "0.56936926", "0.56922907", "0.5689088", "0.568853", "0.5681396" ]
0.6889568
0
General / UI / JavaScript
private function augment_general_user_interface_javascript() { $new_options['use_sensor'] = array( 'type' => 'checkbox', 'default' > '1' , 'use_in_javascript' => true ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_general','section' => 'user_interface', 'group' => 'javascript' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function renderJavascripts();", "public function widget_scripts() {}", "public function Javascript(){\r\n $this->Main(404);\r\n }", "function addCommonJs() \n\t{\n\t\t// call parent if need RunnerJS API \n\t\tRunnerPage::addCommonJs();\n\t\t$this->addJsGroupsAndRights();\t\t\n\t}", "function index(){\n\t\t$this->layouts->add_include('assets/js/jquery-ui.js')\n\t\t\t\t\t ->add_include('assets/js/jquery.autocomplete.pack.js')\n\t\t\t\t\t ->add_include('assets/js/jquery.dataTables.min.js')\n\t\t\t\t\t ->add_include('assets/css/planogramas.css');\n\n\t\t$this->layouts->profile('oracle-vista.php', $op);\n\t}", "protected function js() {\n // nothing\n }", "private function ui() : void\n {\n $state = new UiState();\n\n $ui = [\n 'navbar' => $this->navbar(),\n 'tool' => $this->tool(),\n 'toolbar' => $this->toolbar($state->getTool())\n ];\n\n $this->layout()->setVariables($ui)->setTemplate($this->layout);\n }", "public function getJavaScript();", "function CommonScript()\r\n {\r\n// echo \" $this->Name.setLeft(0);\\n\";\r\n// echo \" $this->Name.setTop(0);\\n\";\r\n echo \" $this->Name.setWidth($this->Width);\\n\";\r\n echo \" $this->Name.setHeight($this->Height);\\n\";\r\n\r\n // adds Enabled, Visible, Font and Color property\r\n $this->dumpCommonQWidgetProperties($this->Name, 0);\r\n\r\n // set font the the button's label\r\n echo \" var lblobj = $this->Name.getLabelObject();\\n\";\r\n echo \" if (lblobj) lblobj.setFont(\\\"{$this->Font->Size} '{$this->Font->Family}' {$this->Font->Weight}\\\");\\n\";\r\n // set the font color\r\n if ($this->Font->Color != \"\")\r\n echo \" $this->Name.setColor(new qx.renderer.color.Color('{$this->Font->Color}'));\\n\";\r\n\r\n // set the layout\r\n if ($this->_buttonlayout != blImageLeft)\r\n {\r\n $iconPos = \"\";\r\n switch ($this->_buttonlayout)\r\n {\r\n case blImageBottom: $iconPos = \"bottom\"; break;\r\n case blImageRight: $iconPos = \"right\"; break;\r\n case blImageTop: $iconPos = \"top\"; break;\r\n }\r\n echo \" $this->Name.setIconPosition('$iconPos');\\n\";\r\n }\r\n\r\n // set hint\r\n $hint = $this->getHintAttribute();\r\n if ($hint != \"\")\r\n echo \" $this->Name.setHtmlAttribute('title', '$this->Hint');\\n\";\r\n\r\n // set cursor\r\n if ($this->Cursor != \"\")\r\n echo \" $this->Name.setStyleProperty('cursor', '\".strtolower(substr($this->Cursor, 2)).\"');\\n\";\r\n\r\n // set background color\r\n if ($this->Color != \"\")\r\n echo \" \".$this->Name.\".setBackgroundColor(new qx.renderer.color.Color('$this->Color'));\\n\";\r\n else\r\n echo \" \".$this->Name.\".setBackgroundColor(new qx.renderer.color.ColorObject('buttonface'));\\n\";\r\n }", "function ssBase_ui() {\t\t\n\t\t$ssBase_domain = 'superslider';\n\t\tinclude_once 'admin/superslider-ui.php';\n\t\t\n\t}", "public function js_template() {\n\t\t?>\n <script id=\"js-builderius-setting-<?php echo $this->setting_key; ?>-tmpl\" type=\"text/template\">\n <div class=\"uni-modal-row uni-clear\">\n\t\t\t\t<?php echo $this->generate_field_label_html() ?>\n <div class=\"uni-modal-row-second\">\n\t\t\t\t\t<?php echo $this->generate_select_html() ?>\n </div>\n </div>\n </script>\n\t\t<?php\n\t}", "function CreateHeader()\n\t{\n\t\t// TODO - invoke it on className (not all textarea elements)\n\t\t//e107::getJs()->requireCoreLib('core/admin.js');\n\t\te107::js('core','core/admin.js','prototype');\n\t}", "public function default_jsAction()\n {\n\t\t$this->layout ='empty';\n\t\t\n @header(\"Content-type:text/javascript\");\n\t\t\n\t\techo \"/*\n* File Defination\n* - Website JS Section\n*\n* Template Name : {$this->theme}\n* Project Name : {$this->get_config('site_title')}\n**/\";\n\t\t\n\t\tApp::Module('Hook')->getHandler('Javascript', 'register_javascript_code', __FILE__, 'display');\n\t\texit;\n }", "protected function loadJavascript() {\n\n\t\t// *********************************** //\n\t\t// Load ExtCore library\n\t\t$this->pageRenderer->loadExtJS();\n\t\t$this->pageRenderer->enableExtJsDebug();\n\n\t\t// Manage State Provider\n\t\t$this->template->setExtDirectStateProvider();\n\t\t$states = $GLOBALS['BE_USER']->uc['moduleData']['Taxonomy']['States'];\n\t\t$this->pageRenderer->addInlineSetting('Taxonomy', 'States', $states);\n\n\t\t// *********************************** //\n\t\t// Defines what files should be loaded and loads them\n\t\t$files = array();\n\t\t$files[] = 'Utility.js';\n\n\t\t// Application\n\t\t$files[] = 'Application.js';\n\t\t$files[] = 'Application/MenuRegistry.js';\n\t\t$files[] = 'Application/AbstractBootstrap.js';\n\n\t\t$files[] = 'Concept/ConceptTree.js';\n\t\t$files[] = 'Concept/ConceptGrid.js';\n\n//\t\t// Override\n//\t\t$files[] = 'Override/Chart.js';\n//\n\t\t// Stores\n//\t\t$files[] = 'Stores/Bootstrap.js';\n\t\t$files[] = 'Stores/ConceptStore.js';\n//\n//\t\t// User interfaces\n\t\t$files[] = 'UserInterface/Bootstrap.js';\n\t\t$files[] = 'UserInterface/FullDoc.js';\n\t\t$files[] = 'UserInterface/TopPanel.js';\n\t\t$files[] = 'UserInterface/DocHeader.js';\n\t\t$files[] = 'UserInterface/TreeEditor.js';\n\t\t$files[] = 'UserInterface/TreeNodeUI.js';\n\t\t$files[] = 'UserInterface/RecordTypeCombo.js';\n\t\t$files[] = 'UserInterface/ConfirmWindow.js';\n\n//\t\t// Plugins\n\t\t$files[] = 'Plugins/FitToParent.js';\n\t\t$files[] = 'Plugins/StateTreePanel.js';\n\n//\t\t// Newsletter Planner\n//\t\t$files[] = 'Planner/Bootstrap.js';\n//\t\t$files[] = 'Planner/PlannerForm.js';\n//\t\t#$files[] = 'Planner/PlannerForm/PlannerTab.js';\n//\t\t#$files[] = 'Planner/PlannerForm/SettingsTab.js';\n//\t\t#$files[] = 'Planner/PlannerForm/StatusTab.js';\n//\n//\t\t// Statistics\n//\t\t$files[] = 'Statistics/Bootstrap.js';\n//\t\t$files[] = 'Statistics/ModuleContainer.js';\n//\t\t$files[] = 'Statistics/NoStatisticsPanel.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel.js';\n//\t\t$files[] = 'Statistics/NewsletterListMenu.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/OverviewTab.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/LinkTab.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/LinkTab/LinkGrid.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/LinkTab/LinkGraph.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/EmailTab.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/EmailTab/EmailGrid.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/EmailTab/EmailGraph.js';\n//\t\t$files[] = 'Statistics/StatisticsPanel/OverviewTab/General.js';\n////\t\t$files[] = 'Statistics/StatisticsPanel/OverviewTab/Graph.js';\n\n\t\tforeach ($files as $file) {\n\t\t\t$this->pageRenderer->addJsFile($this->javascriptPath . $file, 'text/javascript', FALSE);\n\t\t}\n\t\t\n\t\t$this->pageRenderer->addJsFile('../t3lib/js/extjs/ExtDirect.StateProvider.js', 'text/javascript', FALSE);\n\n\t\t// ExtDirect\n//\t\t$this->pageRenderer->addExtDirectCode(array(\n//\t\t\t'TYPO3.Taxonomy'\n//\t\t));\n\t\t\n\t\t// Add ExtJS API\n\t\t#$this->pageRenderer->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Taxonomy', 'text/javascript', FALSE);\n\n\t\t#$numberOfStatistics = json_encode($this->statisticRepository->countStatistics($this->id));\n\t\t#TYPO3.Taxonomy.Data.numberOfStatistics = $numberOfStatistics;\n\n\t\t// *********************************** //\n\t\t// Defines onready Javascript\n\t\t$this->readyJavascript = array();\n\t\t$this->readyJavascript[] .= <<< EOF\n\n\t\t\tExt.ns(\"TYPO3.Taxonomy.Data\");\n\t\t\tTYPO3.Taxonomy.Data.imagePath = '$this->imagePath';\n\n\t\t\t// Enable our remote calls\n\t\t\t//for (var api in Ext.app.ExtDirectAPI) {\n\t\t\t//\tExt.Direct.addProvider(Ext.app.ExtDirectAPI[api]);\n\t\t\t//}\nEOF;\n\n\t\t$this->pageRenderer->addExtOnReadyCode(PHP_EOL . implode(\"\\n\", $this->readyJavascript) . PHP_EOL);\n\n\t\t// *********************************** //\n\t\t// Defines contextual variables\n\t\t$labels = json_encode($this->getLabels());\n\t\t$configuration = json_encode($this->getConfiguration());\n\t\t$sprites = json_encode($this->getSprites());\n\n\t\t$this->inlineJavascript[] .= <<< EOF\n\n\t\tExt.ns(\"TYPO3.Taxonomy\");\n\t\tTYPO3.Taxonomy.Language = $labels;\n\t\tTYPO3.Taxonomy.Configuration = $configuration;\n\t\tTYPO3.Taxonomy.Sprites = $sprites;\n\nEOF;\n\t\t$this->pageRenderer->addJsInlineCode('newsletter', implode(\"\\n\", $this->inlineJavascript));\n\t}", "public function renderizar() {\n $this->estilo();\n $this->html();\n $this->script();\n }", "public function view(){\n\t\t\t$html = Loader::helper('html');\n\t\t\t$this->addFooterItem($html->javascript(DIR_REL.'/application/blocks/movie_listing/js/script.js'));\n\t\t}", "function formJavascriptClass()\n\t{\n\t\tFabrikHelperHTML::script('javascript.js', 'components/com_fabrik/plugins/element/fabrikaccess/', false);\n\t}", "function init_js() {\n /** Maak het forms object in JS. */\n echo <<<HTML\n <script>\n forms = new Forms();\n </script>\nHTML;\n\n /** Link alle knoppen in JS. */\n for ($i = 0; $i < count($this->knoppen); $i++) {\n $id = $this->knoppen[$i];\n echo <<<HTML\n <script>\n forms.addKnop(\"$id\");\n </script>\nHTML;\n }\n\n /** Initialiseer alle forms in JS. */\n foreach($this->forms as $x => $form) {\n if (!$form->get_disabled()) {\n $form->init_js();\n }\n }\n\n /** Voeg een event toe om de condities te controlleren na laden. */\n echo <<<HTML\n <script>\n window.onload = function() {\n forms.init();\n }\n </script>\nHTML;\n }", "public function event()\n\t{\n\t\t$CI =& get_instance();\n\t\t\n\t\t$html = $CI->type->load_view('wysiwyg', 'wysiwyg_js_code', '', TRUE);\n\t\t\n\t\t$CI->type->add_misc($html);\n\t}", "public function getJs(){ }", "public static function ui()\n\t{\n\t\t// Only load once\n\t\tif (!empty(static::$loaded[__METHOD__]))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tself::framework();\n\n\t\tRHelperAsset::load('lib/jquery-ui/jquery-ui.min.js', self::EXTENSION);\n\n\t\t// Include datepicker translations\n\t\t$langTag = JFactory::getLanguage()->getTag();\n\t\t$langTagParts = explode('-', $langTag);\n\t\t$mainLang = reset($langTagParts);\n\t\tRHelperAsset::load('lib/jquery-ui/i18n/jquery.ui.datepicker-' . $langTag . '.js', self::EXTENSION);\n\t\tRHelperAsset::load('lib/jquery-ui/i18n/jquery.ui.datepicker-' . $mainLang . '.js', self::EXTENSION);\n\n\t\t// CSS\n\t\tRHelperAsset::load('lib/jquery-ui/jquery-ui.custom.min.css', self::EXTENSION);\n\n\t\tstatic::$loaded[__METHOD__] = true;\n\n\t\treturn;\n\t}", "function formJavascriptClass()\n\t{\n\t\t$params =& $this->getParams();\n\t\t$document =& JFactory::getDocument();\n\t\t$params = $this->getParams();\n\t\t$slideshow_type = $params->get('slideshow_type', 1);\n\t\tFabrikHelperHTML::script('slideshow.js', 'components/com_fabrik/libs/slideshow2/js/', true);\n\t\tswitch ($slideshow_type) {\n\t\t\tcase 1:\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tFabrikHelperHTML::script('slideshow.kenburns.js', 'components/com_fabrik/libs/slideshow2/js/', true);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tFabrikHelperHTML::script('slideshow.push.js', 'components/com_fabrik/libs/slideshow2/js/', true);\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tFabrikHelperHTML::script('slideshow.fold.js', 'components/com_fabrik/libs/slideshow2/js/', true);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tJHTML::stylesheet('slideshow.css', 'components/com_fabrik/libs/slideshow2/css/');\n\t\tFabrikHelperHTML::script('javascript.js', 'components/com_fabrik/plugins/element/fabrikslideshow/', false);\n\t}", "function _javascript($view) {\n switch ($view) {\n case 'main':\n $java = array(\n \"'\" . base_url() . \"../assets/global/plugins/jquery.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/jquery-migrate.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/jquery-ui/jquery-ui.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/bootstrap/js/bootstrap.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/jquery.blockui.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/jquery.cokie.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/uniform/jquery.uniform.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/flot/jquery.flot.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/flot/jquery.flot.resize.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/flot/jquery.flot.categories.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/jquery-easypiechart/jquery.easypiechart.min.js'\",\n \"'\" . base_url() . \"../assets/global/plugins/jquery.sparkline.min.js'\",\n \"'\" . base_url() . \"../assets/global/scripts/metronic.js'\",\n \"'\" . base_url() . \"../assets/admin/layout/scripts/layout.js'\",\n \"'\" . base_url() . \"../assets/admin/layout/scripts/quick-sidebar.js'\",\n \"'\" . base_url() . \"../assets/admin/layout/scripts/demo.js'\",\n \"'\" . base_url() . \"../assets/admin/pages/scripts/index.js'\",\n \"'\" . base_url() . \"../assets/admin/pages/scripts/tasks.js'\"\n );\n break;\n }\n return $java;\n }", "public function hookDisplayBackOfficeHeader()\n {\n $this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js');\n }", "private function _javascript() {\n\t\t// Don't output javascript more than once\n\t\tif(@$this->_javascripted) return;\n\t\t\n\t\t?>\n\t\t<script type=\"text/javascript\">\n\t\t(function(NS, $) {\n\t\t\t// __________________________________________\n\t\t\t// /---------- Initialize namespace ----------\\\n\t\t\t(window[NS]) || (window[NS] = {});\n\t\t\tvar $ns, ns = window[NS];\n\t\t\t// \\__________________________________________/\n\t\t\n\t\t\t// _[ Initialize ]___________________________________\n\t\t\t// | |\n\t\t\t// | One-time initialization of namespace |\n\t\t\t// |__________________________________________________|\n\t\t\tns.initialize = function() {\n\t\t\t\t// Find the namespace element\n\t\t\t\t$ns = $(\".\" + NS);\n\t\t\t\t// Listen to ajaxComplete messages\n\t\t\t\t$ns.bind(\"ajaxComplete\", ns, jackal.interpretMessage);\n\t\t\t\t// Connect event listeners\n\t\t\t\tns.rebind();\n\t\t\t};\n\t\t\n\t\t\t// _[ Rebind ]_______________________________________\n\t\t\t// | |\n\t\t\t// | Reconnect event listeners to their elements |\n\t\t\t// | (usually as a result of an ajax call) |\n\t\t\t// |__________________________________________________|\n\t\t\tns.rebind = function() {\n\t\t\t\t$ns.click(ns.click);\n\t\t\t};\n\n\t\t\t// _[ Click ]________________________________________\n\t\t\t// | |\n\t\t\t// | Handle all clicks in this $ns |\n\t\t\t// |__________________________________________________|\n\t\t\tns.click = function(event) {\n\t\t\t\tvar $this = $(event.target);\n\t\t\t\t\n\t\t\t\t// Fire runTest if it's a run button\n\t\t\t\t$this.closest(\".run\").each(ns.runTest);\n\t\t\t};\n\n\t\t\t// _[ Run Test ]_____________________________________\n\t\t\t// | |\n\t\t\t// | Runs the clicked test |\n\t\t\t// |__________________________________________________|\n\t\t\tns.runTest = function() {\n\t\t\t\tvar $this = $(this);\n\n\t\t\t\t$this.closest(\"li\").find(\"[path]\").closest(\"li\").find(\".status\")\n\t\t\t\t\t.addClass(\"status-waiting\");\n\n\t\t\t\tevent.stopPropagation();\n\t\t\t};\n\n\t\t\tns[\"Testing/runTest.complete\"] = function(event, response) {\n\t\t\t\tvar $result = $(\"<p>\"+response.responseText+\"</p>\");\n\t\t\t\tvar success = $result.find(\".subtest-result\").is(\".success\");\n\n\t\t\t\t$ns.find(\".status-running\")\n\t\t\t\t\t.toggleClass(\"status-success\", success)\n\t\t\t\t\t.toggleClass(\"status-failed\", !success);\n\t\t\t};\n\n\n\t\t\t$(ns.initialize);\n\t\t})(\"Testing-TestList\", jQuery);\n\t\t</script>\n\t\t<?php\n\t}", "function headerScript(){\n\t\t$this->scriptText .= '<script type=\"text/javascript\">';\n\t\t//phan script edit nhanh text box\n\t\t$this->scriptText .= '$(function() {\n\n\t\t\t\t\t\t\t\t\t $(\".clickedit\").editable(\"listing.php?ajaxedit=1\", {\n\t\t\t\t\t\t\t\t\t\t\tindicator : \"<img src=\\'../../resource/images/grid/indicator.gif\\'>\",\n\t\t\t\t\t\t\t\t\t\t\ttooltip : \"' . translate_text(\"Click để thay đổi...\") . '\",\n\t\t\t\t\t\t\t\t\t\t\tstyle : \"inherit\",\n\t\t\t\t\t\t\t\t\t\t\theight: \"25px\",\n\t\t\t\t\t\t\t\t\t\t\tcssclass : \"formquickedit\",\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\t';\n\n\n\t\t//phan javascript hover vao cac tr\n\t\t$this->scriptText .= \"$( function(){\n\t\t\t\t\t\t\t\t\t\t\tvar bg = '';\n\t\t\t\t\t\t\t\t\t\t\t$('table#listing tr').hover( function(){\n\t\t\t\t\t\t\t\t\t\t\t\tbg = $(this).css('background-color');\n\t\t\t\t\t\t\t\t\t\t\t\t$(this).css('background-color', '#FFFFCC');\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\t\t\t\t\t\t$(this).css('background-color', bg);\n\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t});\";\n\t\t$this->scriptText .= '</script>';\n\t\t$this->scriptText .= '<script language=\"javascript\" src=\"../../resource/js/grid.js\"></script>';\n\n\t\treturn $this->scriptText;\n\n\t}", "public static function loadGeneralJS()\n\t{\n\t\tparent::renderFilesFromFolder(MainJsPath.'general'.DIRECTORY_SEPARATOR, 'js');\n\t}", "function showScripts()\n {\n parent::showScripts();\n if ($this->arg('avatarsettings_isCrop')) {\n $this->element('script', array('type' => 'text/javascript',\n 'src' => common_path('js/jquery.jcrop.js')));\n $this->element('script', array('type' => 'text/javascript',\n 'src' => common_path('js/lshai_jcrop.js')));\n } else {\n \t$this->script('js/lshai_uploadfile.js');\n }\n }", "public function indexAction() {\n $this->_helper->layout->setLayout('layout_default');\n $this->view->title = ' - Plantões';\n \n $this->view->headScript()\n ->appendFile($this->view->baseUrl('public/modules/dashboard/event/js/library.select.js'))\n ->appendFile($this->view->baseUrl('public/modules/dashboard/event/js/library.insert.js'))\n ->appendFile($this->view->baseUrl('public/modules/dashboard/event/js/library.alter.js'))\n ->appendFile($this->view->baseUrl('public/modules/dashboard/event/js/library.delete.js'));\n }", "abstract public function getJs();" ]
[ "0.69007087", "0.6765988", "0.65733576", "0.64821905", "0.6423215", "0.63228613", "0.63042974", "0.6293237", "0.6293169", "0.62841177", "0.6275408", "0.6255622", "0.6245219", "0.6243339", "0.61948615", "0.6189106", "0.61608773", "0.6160272", "0.6133857", "0.61269355", "0.60982186", "0.60768884", "0.6062842", "0.6060111", "0.6043656", "0.6042692", "0.60402066", "0.6029927", "0.6021289", "0.6013651" ]
0.6777826
1
Settings / Map / Markers
private function augment_settings_map_markers() { $related_to = 'map_end_icon,default_icons'; $new_options[ 'default_icons' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'map', 'group' => 'markers' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function set_map_markers() {\n\t\t$markers = $this->input['map_markers'];\n\t\tif ( ! is_array( $markers ) && count( $markers ) > 0 ) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tforeach( $markers as $marker ) {\n\t\t\t\t$this->verify_and_add_marker_data( $marker );\n\t\t\t}\n\t\t\tif ( ! empty( $this->map_markers > 0 ) ) {\n\t\t\t\t$this->has_markers = true;\n\t\t\t}\n\t\t}\n\t}", "abstract protected function setMap(): void;", "function setup_map() {\n\t\t\n\t\t// Set theme objects\n\t\t$apoc = apoc();\n\t\t$apoc->classes \t\t= array_merge( $apoc->classes , array( 'singular','page','map' ) );\n\t\t$apoc->crumbs[]\t\t= \"Interactive Map\";\n\t\t$apoc->title \t\t= \"Interactive Map of Tamriel\";\n\t\t$apoc->description \t= \"A richly interactive map of the entirety of Tamriel which is available in The Elder Scrolls Online.\";\n\t\t\n\t\t// Add custom scripts and styles\n\t\tadd_action( 'wp_enqueue_scripts' , array( $this , 'enqueue_scripts' ) );\n\t}", "function cptmm_setup_menu(){\n add_menu_page(\n 'CPT map marker',\n 'CPT map marker',\n 'manage_options',\n 'CPT-map-marker',\n 'cptmm_setup_menu_content',\n 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTguMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDI5Ni45OTkgMjk2Ljk5OSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjk2Ljk5OSAyOTYuOTk5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgd2lkdGg9IjUxMnB4IiBoZWlnaHQ9IjUxMnB4Ij4KPGc+Cgk8cGF0aCBkPSJNMTQxLjkxNCwxODUuODAyYzEuODgzLDEuNjU2LDQuMjM0LDIuNDg2LDYuNTg3LDIuNDg2YzIuMzUzLDAsNC43MDUtMC44Myw2LjU4Ny0yLjQ4NiAgIGMyLjM4NS0yLjEwMSw1OC4zOTEtNTIuMDIxLDU4LjM5MS0xMDMuNzkzYzAtMzUuODQyLTI5LjE0OC02NS4wMDItNjQuOTc3LTY1LjAwMmMtMzUuODMsMC02NC45NzksMjkuMTYtNjQuOTc5LDY1LjAwMiAgIEM4My41MjEsMTMzLjc4MSwxMzkuNTI5LDE4My43MDEsMTQxLjkxNCwxODUuODAyeiBNMTQ4LjUwMSw2NS4wMjVjOS4zMDIsMCwxNi44NDUsNy42MDIsMTYuODQ1LDE2Ljk4NCAgIGMwLDkuMzgxLTcuNTQzLDE2Ljk4NC0xNi44NDUsMTYuOTg0Yy05LjMwNSwwLTE2Ljg0Ny03LjYwNC0xNi44NDctMTYuOTg0QzEzMS42NTQsNzIuNjI3LDEzOS4xOTYsNjUuMDI1LDE0OC41MDEsNjUuMDI1eiIgZmlsbD0iIzAwMDAwMCIvPgoJPHBhdGggZD0iTTI3My4zNTcsMTg1Ljc3M2wtNy41MjctMjYuMzc3Yy0xLjIyMi00LjI4MS01LjEzMy03LjIzMi05LjU4My03LjIzMmgtNTMuNzE5Yy0xLjk0MiwyLjg4Ny0zLjk5MSw1Ljc4NS02LjE1OCw4LjY5OSAgIGMtMTUuMDU3LDIwLjIzLTMwLjM2NCwzMy45MTQtMzIuMDYxLDM1LjQxYy00LjM3LDMuODQ4LTkuOTgzLDUuOTY3LTE1LjgwOCw1Ljk2N2MtNS44MjEsMC0xMS40MzQtMi4xMTctMTUuODEtNS45NjkgICBjLTEuNjk1LTEuNDk0LTE3LjAwNC0xNS4xOC0zMi4wNi0zNS40MDhjLTIuMTY3LTIuOTE0LTQuMjE2LTUuODEzLTYuMTU4LTguNjk5aC01My43MmMtNC40NSwwLTguMzYxLDIuOTUxLTkuNTgzLDcuMjMyICAgbC04Ljk3MSwzMS40MzZsMjAwLjUyOSwzNi43M0wyNzMuMzU3LDE4NS43NzN6IiBmaWxsPSIjMDAwMDAwIi8+Cgk8cGF0aCBkPSJNMjk2LjYxNywyNjcuMjkxbC0xOS4yMy02Ny4zOTZsLTk1LjQxMiw4MC4wOThoMTA1LjA2YzMuMTI3LDAsNi4wNzItMS40NjcsNy45NTUtMy45NjMgICBDMjk2Ljg3MywyNzMuNTMzLDI5Ny40NzQsMjcwLjI5NywyOTYuNjE3LDI2Ny4yOTF6IiBmaWxsPSIjMDAwMDAwIi8+Cgk8cGF0aCBkPSJNNDguNzkzLDIwOS44ODhsLTMwLjQ0LTUuNTc2TDAuMzgzLDI2Ny4yOTFjLTAuODU3LDMuMDA2LTAuMjU2LDYuMjQyLDEuNjI4LDguNzM4YzEuODgzLDIuNDk2LDQuODI4LDMuOTYzLDcuOTU1LDMuOTYzICAgaDM4LjgyN1YyMDkuODg4eiIgZmlsbD0iIzAwMDAwMCIvPgoJPHBvbHlnb24gcG9pbnRzPSI2Mi43NDYsMjEyLjQ0NSA2Mi43NDYsMjc5Ljk5MiAxNjAuMjczLDI3OS45OTIgMjA4Ljg1NywyMzkuMjA3ICAiIGZpbGw9IiMwMDAwMDAiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K',\n 30\n );\n}", "public function site_map()\r\n {\r\n try\r\n {\t\t\r\n\t\t\t$this->data['breadcrumb'] = array('Site Map'=>'');\t\r\n\t\t\t$this->i_footer_menu = 8;\t\t\t\r\n\t\t\t$this->render();\r\n\t\t}\r\n\r\n catch(Exception $err_obj)\r\n {\r\n show_error($err_obj->getMessage());\r\n } \t \r\n }", "public function setMark();", "public function simple_map_settings_section_callback() {\n\n\t\techo esc_html__( 'Set your Google Maps API key.', 'simple-map' );\n\n\t}", "function map($options=null){\n\t\tif($options!=null) extract($options);\n\t\tif(!isset($width)) \t\t$width=$this->defaultWidth;\n\t\tif(!isset($height)) \t$height=$this->defaultHeight;\t\n\t\tif(!isset($zoom)) \t\t$zoom=$this->defaultZoom;\t\t\t\n\t\tif(!isset($type)) \t\t$type=$this->defaultType;\t\t\n\t\tif(!isset($latitude)) \t$latitude=$this->defaultLatitude;\t\n\t\tif(!isset($longitude)) \t$longitude=$this->defaultLongitude;\n\t\tif(!isset($localize)) \t$localize=$this->defaultLocalize;\t\t\n\t\tif(!isset($marker)) \t$marker=$this->defaultMarker;\t\t\n\t\tif(!isset($markerIcon)) $markerIcon=$this->defaultMarkerIcon;\t\n\t\tif(!isset($infoWindow)) $infoWindow=$this->defaultInfoWindow;\t\n\t\tif(!isset($windowText)) $windowText=$this->defaultWindowText;\n\t\t\n\t\techo '<script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=true\"></script>';\n\t\techo '<script type=\"text/javascript\" src=\"http://code.google.com/apis/gears/gears_init.js\"></script>';\n\t\t$map = \"<div id=\\\"map_canvas\\\" style=\\\"width:\".$width.\"; height:\".$height.\"\\\"></div>\";\n\t\t$map .= \"\n\t\t<script>\n\t\t\tvar noLocation = new google.maps.LatLng(\".$latitude.\", \".$longitude.\");\n\t\t\tvar initialLocation;\n\t\t var browserSupportFlag = new Boolean();\n\t\t var map;\n\t\t var myOptions = {\n\t\t zoom: \".$zoom.\",\n\t\t mapTypeId: google.maps.MapTypeId.\".$type.\"\n\t\t };\n\t\t map = new google.maps.Map(document.getElementById(\\\"map_canvas\\\"), myOptions);\n\t\t //To store eventual added markers\n\t\t markers = [];\n\t\t\";\n\t\t\n\t\t\n\t\t\n\t\tif(isset($mapListener)){\n\t\t\t$map .= \"google.maps.event.addListener(map, 'click', \".$mapListener.\");\";\t\n\t\t}\n\t\t\n\t\tif($localize) $map .= \"localize();\"; else $map .= \"map.setCenter(noLocation);\";\n\t\t$map .= \"\n\t\t\tfunction localize(){\n\t\t if(navigator.geolocation) { // Try W3C Geolocation method (Preferred)\n\t\t browserSupportFlag = true;\n\t\t navigator.geolocation.getCurrentPosition(function(position) {\n\t\t initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);\n\t\t map.setCenter(initialLocation);\";\n\t\t\t\t\t if($marker) $map .= \"setMarker(initialLocation);\";\n\t\t \n\t\t $map .= \"}, function() {\n\t\t handleNoGeolocation(browserSupportFlag);\n\t\t });\n\t\t \n\t\t } else if (google.gears) { // Try Google Gears Geolocation\n\t\t browserSupportFlag = true;\n\t\t var geo = google.gears.factory.create('beta.geolocation');\n\t\t geo.getCurrentPosition(function(position) {\n\t\t initialLocation = new google.maps.LatLng(position.latitude,position.longitude);\n\t\t map.setCenter(initialLocation);\";\n\t\t\t\t\t if($marker) $map .= \"setMarker(initialLocation);\"; \n\t\t \n\t\t $map .= \"}, function() {\n\t\t handleNoGeolocation(browserSupportFlag);\n\t\t });\n\t\t } else {\n\t\t // Browser doesn't support Geolocation\n\t\t browserSupportFlag = false;\n\t\t handleNoGeolocation(browserSupportFlag);\n\t\t }\n\t\t }\n\t\t \n\t\t function handleNoGeolocation(errorFlag) {\n\t\t if (errorFlag == true) {\n\t\t initialLocation = noLocation;\n\t\t contentString = \\\"Error: The Geolocation service failed.\\\";\n\t\t } else {\n\t\t initialLocation = noLocation;\n\t\t contentString = \\\"Error: Your browser doesn't support geolocation.\\\";\n\t\t }\n\t\t map.setCenter(initialLocation);\n\t\t map.setZoom(3);\n\t\t }\";\n\t\t \n\t\t $map .= \"\n\t\t\tfunction setMarker(position){\n\t\t var contentString = '\".$windowText.\"';\n\t\t var image = '\".$markerIcon.\"';\n\t\t var infowindow = new google.maps.InfoWindow({\n\t\t content: contentString\n\t\t });\n\t\t var marker = new google.maps.Marker({\n\t\t position: position,\n\t\t map: map,\n\t\t icon: image,\n\t\t title:\\\"My Position\\\"\n\t\t });\";\n\t\t \n\t\t if($infoWindow){ \n\t\t \t$map .= \"google.maps.event.addListener(marker, 'click', function() {\n\t\t\t\t\t\t\t\tinfowindow.open(map,marker);\n\t\t \t\t\t});\";\n\t\t }\n\t\t $map .= \"}\";\n\t\t$map .= \"</script>\";\n\t\treturn $map;\n\t}", "public function beforeFilter()\n\t{\n\t $map_options = array(\n\t 'id' => 'map_canvas', \n\t 'width' => '100%', \n\t 'height' => '100%',\n\t 'style' => '',\n\t 'zoom' => 18,\n\t 'type' => 'HYBRID', //options:: ROADMAP`, `SATELLITE`, `HYBRID` or `TERRAIN`\n\t 'custom' => null,\n\t 'localize' => true, //if true: latitude, longitude and address are been overrriden.\n\t 'latitude' => 40.69847032728747,\n\t 'longitude' => -1.9514422416687,\n\t 'address' => '1 Infinite Loop, Cupertino',\n\t 'marker' => true,\n\t 'markerTitle' => 'This is my position',\n\t 'markerIcon' => 'http://google-maps-icons.googlecode.com/files/home.png',\n\t 'markerShadow' => 'http://google-maps-icons.googlecode.com/files/shadow.png',\n\t 'infoWindow' => true,\n\t 'windowText' => 'My Position'\n\t );\n\t\n\t $marker_options = array(\n\t 'showWindow' => true,\n\t 'windowText' => 'This is the Marker TEXT',\n\t 'markerTitle' => 'This is the marker TITLE',\n\t 'markerIcon' => 'http://www.smsaruba.com/business.png',\n\t//'http://labs.google.com/ridefinder/images/mm_20_purple.png',\n\t 'markerShadow' => 'http://labs.google.com/ridefinder/images/mm_20_purpleshadow.png',\n\t );\t\n\t\n\t $directions_options = array(\n\t 'travelMode' => \"WALKING\",\n\t 'directionsDiv' => 'directions',\n\t );\t\t\n\t\t\n\t\t$this->set('map_options', $map_options);\n\t\t$this->set('marker_options', $marker_options);\n\t\t$this->set('directions_options', $directions_options);\n\t\t$this->set('base_url', Configure::read('system.root'));\t\t\n\t}", "function iform_map_get_map_options($args, $readAuth) {\n // read out the activated preset layers\n $presetLayers = [];\n if (!empty($args['preset_layers'])) {\n foreach($args['preset_layers'] as $key => $value) {\n if (is_int($key)) {\n // normally a checkbox group would just output an array\n $presetLayers[] = $value;\n } elseif ($value!==0) {\n // but the Drupal version of the the parameters form (deprecated) leaves a strange array structure in the parameter value.\n $presetLayers[] = $key;\n }\n }\n }\n\n $options = array(\n 'readAuth' => $readAuth,\n 'presetLayers' => $presetLayers,\n 'editLayer' => true,\n 'layers' => [],\n 'initial_lat'=>$args['map_centroid_lat'],\n 'initial_long'=>$args['map_centroid_long'],\n 'initial_zoom'=>(int) $args['map_zoom'],\n 'width'=>$args['map_width'],\n 'height'=>$args['map_height'],\n 'standardControls'=>array('layerSwitcher','panZoomBar'),\n 'rememberPos'=>isset($args['remember_pos']) ? ($args['remember_pos']==true) : false\n );\n // If they have defined a custom base layer, add it\n if (!empty($args['wms_base_title']) && !empty($args['wms_base_url']) && !empty($args['wms_base_layer'])) {\n data_entry_helper::$onload_javascript .= \"var baseLayer = new OpenLayers.Layer.WMS(\n '\".$args['wms_base_title'].\"',\n '\".$args['wms_base_url'].\"',\n {layers: '\".$args['wms_base_layer'].\"', sphericalMercator: true}, {singleTile: true}\n );\\n\";\n $options['layers'][] = 'baseLayer';\n }\n // Also add any custom base layers they have defined\n if (!empty($args['tile_cache_layers'])) {\n $options['tilecacheLayers'] = json_decode($args['tile_cache_layers'], true);\n }\n if (!empty($args['other_base_layer_config'])) {\n $options['otherBaseLayerConfig'] = json_decode($args['other_base_layer_config'], true);\n }\n // And any indicia Wms layers from the GeoServer\n if (!empty($args['indicia_wms_layers'])) {\n $wmsLayers = explode(\"\\n\", $args['indicia_wms_layers']);\n // Each layer may either just be a feature name or, optionally, may be\n // prefixed by a title in the form title = feature.\n foreach ($wmsLayers as $layer) {\n $separatorPos = strpos($layer, '=');\n if ($separatorPos !== FALSE) {\n // A title is present.\n $title = trim(substr($layer, 0, $separatorPos));\n $feature = trim(substr($layer, $separatorPos + 1));\n $options['indiciaWMSLayers'][$title] = $feature;\n }\n else {\n $options['indiciaWMSLayers'][] = $layer;\n }\n }\n }\n // set up standard control list if supplied\n if (array_key_exists('standard_controls', $args) && $args['standard_controls']) {\n $args['standard_controls'] = str_replace(\"\\r\\n\", \"\\n\", $args['standard_controls']);\n $options['standardControls']=explode(\"\\n\", $args['standard_controls']);\n // If drawing controls are enabled, then allow polygon recording.\n if (count(array_intersect(['drawPolygon', 'drawLine', 'drawPoint'], $options['standardControls'])) > 0)\n $options['allowPolygonRecording']=true;\n }\n // And pass through any translation strings, only if they exist\n $msgGeorefSelectPlace = lang::get('LANG_Georef_SelectPlace');\n if ($msgGeorefSelectPlace!='LANG_Georef_SelectPlace') $options['msgGeorefSelectPlace'] = $msgGeorefSelectPlace;\n $msgGeorefNothingFound = lang::get('LANG_Georef_NothingFound');\n if ($msgGeorefNothingFound!='LANG_Georef_NothingFound') $options['msgGeorefNothingFound'] = $msgGeorefNothingFound;\n // if in Drupal, and IForm proxy is installed, then use this path as OpenLayers proxy\n if (function_exists('hostsite_module_exists') && hostsite_module_exists('iform_proxy')) {\n $options['proxy'] = data_entry_helper::getRootFolder(true) . hostsite_get_config_value('iform', 'proxy_path', 'proxy') . '&url=';\n }\n // And a single location boundary if defined\n if (!empty($args['location_boundary_id']))\n $location = $args['location_boundary_id'];\n elseif (isset($args['display_user_profile_location']) && $args['display_user_profile_location']) {\n $location = hostsite_get_user_field('location');\n }\n if (!empty($location)) {\n iform_map_zoom_to_location($location, $readAuth);\n }\n return $options;\n}", "public function indexAction()\n\t{\n\t\t$this->view->assign('contentId', $this->ceData['uid']);\n\n\t\t// assign width and height of map\n\t\tif (0 < (int)$this->settings['cbgmMapWidth'])\n\t\t\t$width = $this->settings['cbgmMapWidth'];\n\t\telse\n\t\t\t$width = $this->settings['display']['width'];\n\t\t$this->view->assign('width', $width);\n\n\n\t\tif (0 < (int)$this->settings['cbgmMapHeight'])\n\t\t\t$height = $this->settings['cbgmMapHeight'];\n\t\telse\n\t\t\t$height = $this->settings['display']['height'];\n\t\t$this->view->assign('height', $height);\n\n\t\t// assign pin description text\n\t\t$infoText = ($this->settings['cbgmDescription']);\n\t\t$this->view->assign('infoText', urlencode($infoText));\n\n\t\t// assign icon if given by constant and/or typoscript\n\t\tif (!empty($this->settings['display']['icon'])\n\t\t\t\t&& file_exists(PATH_site . $this->settings['display']['icon'])\n\t\t)\n\t\t\t$this->view->assign('icon', TYPO3\\CMS\\Core\\Utility\\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $this->settings['display']['icon']);\n\t\telse\n\t\t\t$this->view->assign('icon', null);\n\n\t\t// assign deactivation of zooming by mousewheel\t\t\t\n\t\t$this->view->assign('useScrollwheel',\n\t\t\t\t($this->settings['options']['useScrollwheel'] ? 'true' : 'false'));\n\n\t\t// assign location (longitude and latitude) to the view\n\t\t$this->view->assign('latitude', (float)$this->settings['cbgmLatitude']);\n\t\t$this->view->assign('longitude', (float)$this->settings['cbgmLongitude']);\n\n\t\t// assign map zoom level to the view ,if given value is valid\n\t\tif (0 <= (int)$this->settings['cbgmScaleLevel'] && !empty($this->settings['cbgmScaleLevel']))\n\t\t\t$mapZoom = (int)$this->settings['cbgmScaleLevel'];\n\t\telse\n\t\t\t$mapZoom = $this->settings['display']['zoom'];\n\t\t$this->view->assign('mapZoom', $mapZoom);\n\n\t\t// assign map type to the view, if given value is valid\n\t\tif (in_array((string)$this->settings['cbgmMapType'],\n\t\t\t\tpreg_split(\"/[\\s]*[,][\\s]*/\", $this->settings['valid']['mapTypes'])))\n\t\t\t$mapType = $this->settings['cbgmMapType'];\n\t\telse\n\t\t\t$mapType = $this->settings['display']['mapType'];\n\t\t$this->view->assign('mapType', $mapType);\n\n\t\t// assign navigation controls to the view\n\t\tif (in_array((string)$this->settings['cbgmNavigationControl'],\n\t\t\t\tpreg_split(\"/[\\s]*[,][\\s]*/\", $this->settings['valid']['navigationControl'])))\n\t\t\t$navigationControl = $this->settings['cbgmNavigationControl'];\n\t\telse\n\t\t\t$navigationControl = $this->settings['display']['navigationControl'];\n\n\t\t$this->view->assign('mapControl', $navigationControl);\n\n\t\t// assign map styling, if given\n\t\t$this->view->assign('mapStyling', null);\n\n\t\tif (!empty($this->settings['display']['mapStyling'])\n\t\t && file_exists(PATH_site . $this->settings['display']['mapStyling']) ){\n\n\t\t\t$styling = file_get_contents(PATH_site. $this->settings['display']['mapStyling']);\n\n\t\t\tif (!is_null(json_decode($styling))) {\n\t\t\t\t$this->view->assign('mapStyling', $styling);\n\t\t\t}\n\t\t} else if (!empty($this->settings['display']['mapStyling'])\n\t\t \t\t&& !is_null(json_decode($this->settings['display']['mapStyling']))){\n\t\t\t$this->view->assign('mapStyling', $this->settings['display']['mapStyling']);\n\t\t}\n\n\t\t$this->view->assign('braceStart', '{');\n\t\t$this->view->assign('braceEnd', '}');\n\t\t\n\n\t\t// assign auto open flag to the view\n\t\t$this->view->assign('openInfoBox', ($this->settings['cbgmAutoOpen'])?true:false );\n\n\t}", "private function setWaterMark() {\n\n if (isset($this->options['water_mark_image'])) {\n $this->water_mark_image = $this->options['water_mark_image'];\n } else {\n $this->water_mark_image = $this->config['water_mark_image'];\n }\n\n if (isset($this->options['water_mark_position'])) {\n $this->water_mark_position = $this->options['water_mark_position'];\n } elseif (isset($this->config['water_mark_position'])) {\n $this->water_mark_position = $this->config['water_mark_position'];\n } else {\n $this->water_mark_position = 'top-center';\n }\n }", "function process_intractive_map_options(){\n\tregister_setting('map_settings_group','map_settings');\n}", "function feature_map_locator_json() {\n $markers = load_all_markers();\n \n // make code below optional? Do something with display suite.. \n\n // and use the filtering array!\n foreach((array)$markers as $key => $marker) {\n $markers[$key]['teaser'] = '<span class=\"name\">' . $marker['teaser'] . '</span>';\n unset($marker['lat'], $marker['lng'], $marker['id'], $marker['full']);\n unset($marker['teaser']);\n foreach((array)$marker as $label => $value){\n $markers[$key]['teaser'] .= '<span class=\"' . $label . '\">' . $value . '</span>';\n }\n }\n\n\n // check for hooks altering the resultset : hook_markers_alter\n apply_markers_alter($markers);\n\n return drupal_json_output($markers);\n}", "function qode_restaurant_map_map() {\n\t\t\tbridge_qode_add_admin_page(array(\n\t\t\t\t'title' => 'Restaurant',\n\t\t\t\t'slug' => '_restaurant',\n\t\t\t\t'icon' => 'fa fa-cutlery'\n\t\t\t));\n\n\t\t\t//#Working Hours panel\n\t\t\t$panel_working_hours = bridge_qode_add_admin_panel(array(\n\t\t\t\t'page' => '_restaurant',\n\t\t\t\t'name' => 'panel_working_hours',\n\t\t\t\t'title' => 'Working Hours'\n\t\t\t));\n\n\t\t\t$monday_group = bridge_qode_add_admin_group(array(\n\t\t\t\t'name' => 'monday_group',\n\t\t\t\t'title' => 'Monday',\n\t\t\t\t'parent' => $panel_working_hours,\n\t\t\t\t'description' => 'Working hours for Monday'\n\t\t\t));\n\n\t\t\t$monday_row = bridge_qode_add_admin_row(array(\n\t\t\t\t'name' => 'monday_row',\n\t\t\t\t'parent' => $monday_group\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_monday_from',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'From',\n\t\t\t\t'parent' => $monday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_monday_to',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'To',\n\t\t\t\t'parent' => $monday_row\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_monday_closed',\n\t\t\t\t'type' => 'yesnosimple',\n\t\t\t\t'default_value' => 'no',\n\t\t\t\t'label' => esc_html__('Closed', 'qode-restaurant'),\n\t\t\t\t'parent' => $monday_row,\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_monday_description',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => esc_html__('Description', 'qode-restaurant'),\n\t\t\t\t'parent' => $monday_row\n\t\t\t));\n\t\t\t$tuesday_group = bridge_qode_add_admin_group(array(\n\t\t\t\t'name' => 'tuesday_group',\n\t\t\t\t'title' => 'Tuesday',\n\t\t\t\t'parent' => $panel_working_hours,\n\t\t\t\t'description' => 'Working hours for Tuesday'\n\t\t\t));\n\n\t\t\t$tuesday_row = bridge_qode_add_admin_row(array(\n\t\t\t\t'name' => 'tuesday_row',\n\t\t\t\t'parent' => $tuesday_group\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_tuesday_from',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'From',\n\t\t\t\t'parent' => $tuesday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_tuesday_to',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'To',\n\t\t\t\t'parent' => $tuesday_row\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_tuesday_closed',\n\t\t\t\t'type' => 'yesnosimple',\n\t\t\t\t'default_value' => 'no',\n\t\t\t\t'label' => esc_html__('Closed', 'qode-restaurant'),\n\t\t\t\t'parent' => $tuesday_row,\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_tuesday_description',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => esc_html__('Description', 'qode-restaurant'),\n\t\t\t\t'parent' => $tuesday_row\n\t\t\t));\n\n\t\t\t$wednesday_group = bridge_qode_add_admin_group(array(\n\t\t\t\t'name' => 'wednesday_group',\n\t\t\t\t'title' => 'Wednesday',\n\t\t\t\t'parent' => $panel_working_hours,\n\t\t\t\t'description' => 'Working hours for Wednesday'\n\t\t\t));\n\n\t\t\t$wednesday_row = bridge_qode_add_admin_row(array(\n\t\t\t\t'name' => 'wednesday_row',\n\t\t\t\t'parent' => $wednesday_group\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_wednesday_from',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'From',\n\t\t\t\t'parent' => $wednesday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_wednesday_to',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'To',\n\t\t\t\t'parent' => $wednesday_row\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_wednesday_closed',\n\t\t\t\t'type' => 'yesnosimple',\n\t\t\t\t'default_value' => 'no',\n\t\t\t\t'label' => esc_html__('Closed', 'qode-restaurant'),\n\t\t\t\t'parent' => $wednesday_row,\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_wednesday_description',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => esc_html__('Description', 'qode-restaurant'),\n\t\t\t\t'parent' => $wednesday_row\n\t\t\t));\n\n\t\t\t$thursday_group = bridge_qode_add_admin_group(array(\n\t\t\t\t'name' => 'thursday_group',\n\t\t\t\t'title' => 'Thursday',\n\t\t\t\t'parent' => $panel_working_hours,\n\t\t\t\t'description' => 'Working hours for Thursday'\n\t\t\t));\n\n\t\t\t$thursday_row = bridge_qode_add_admin_row(array(\n\t\t\t\t'name' => 'thursday_row',\n\t\t\t\t'parent' => $thursday_group\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_thursday_from',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'From',\n\t\t\t\t'parent' => $thursday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_thursday_to',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'To',\n\t\t\t\t'parent' => $thursday_row\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_thursday_closed',\n\t\t\t\t'type' => 'yesnosimple',\n\t\t\t\t'default_value' => 'no',\n\t\t\t\t'label' => esc_html__('Closed', 'qode-restaurant'),\n\t\t\t\t'parent' => $thursday_row,\n\t\t\t));\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_thursday_description',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => esc_html__('Description', 'qode-restaurant'),\n\t\t\t\t'parent' => $thursday_row\n\t\t\t));\n\n\t\t\t$friday_group = bridge_qode_add_admin_group(array(\n\t\t\t\t'name' => 'friday_group',\n\t\t\t\t'title' => 'Friday',\n\t\t\t\t'parent' => $panel_working_hours,\n\t\t\t\t'description' => 'Working hours for Friday'\n\t\t\t));\n\n\t\t\t$friday_row = bridge_qode_add_admin_row(array(\n\t\t\t\t'name' => 'friday_row',\n\t\t\t\t'parent' => $friday_group\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_friday_from',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'From',\n\t\t\t\t'parent' => $friday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_friday_to',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'To',\n\t\t\t\t'parent' => $friday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_friday_closed',\n\t\t\t\t'type' => 'yesnosimple',\n\t\t\t\t'default_value' => 'no',\n\t\t\t\t'label' => esc_html__('Closed', 'qode-restaurant'),\n\t\t\t\t'parent' => $friday_row,\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_friday_description',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => esc_html__('Description', 'qode-restaurant'),\n\t\t\t\t'parent' => $friday_row\n\t\t\t));\n\n\t\t\t$saturday_group = bridge_qode_add_admin_group(array(\n\t\t\t\t'name' => 'saturday_group',\n\t\t\t\t'title' => 'Saturday',\n\t\t\t\t'parent' => $panel_working_hours,\n\t\t\t\t'description' => 'Working hours for Saturday'\n\t\t\t));\n\n\t\t\t$saturday_row = bridge_qode_add_admin_row(array(\n\t\t\t\t'name' => 'saturday_row',\n\t\t\t\t'parent' => $saturday_group\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_saturday_from',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'From',\n\t\t\t\t'parent' => $saturday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_saturday_to',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'To',\n\t\t\t\t'parent' => $saturday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_saturday_closed',\n\t\t\t\t'type' => 'yesnosimple',\n\t\t\t\t'default_value' => 'no',\n\t\t\t\t'label' => esc_html__('Closed', 'qode-restaurant'),\n\t\t\t\t'parent' => $saturday_row,\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_saturday_description',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => esc_html__('Description', 'qode-restaurant'),\n\t\t\t\t'parent' => $saturday_row\n\t\t\t));\n\n\t\t\t$sunday_group = bridge_qode_add_admin_group(array(\n\t\t\t\t'name' => 'sunday_group',\n\t\t\t\t'title' => 'Sunday',\n\t\t\t\t'parent' => $panel_working_hours,\n\t\t\t\t'description' => 'Working hours for Sunday'\n\t\t\t));\n\n\t\t\t$sunday_row = bridge_qode_add_admin_row(array(\n\t\t\t\t'name' => 'sunday_row',\n\t\t\t\t'parent' => $sunday_group\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_sunday_from',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'From',\n\t\t\t\t'parent' => $sunday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_sunday_to',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => 'To',\n\t\t\t\t'parent' => $sunday_row\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_sunday_closed',\n\t\t\t\t'type' => 'yesnosimple',\n\t\t\t\t'default_value' => 'no',\n\t\t\t\t'label' => esc_html__('Closed', 'qode-restaurant'),\n\t\t\t\t'parent' => $sunday_row,\n\t\t\t));\n\n\t\t\tbridge_qode_add_admin_field(array(\n\t\t\t\t'name' => 'wh_sunday_description',\n\t\t\t\t'type' => 'textsimple',\n\t\t\t\t'label' => esc_html__('Description', 'qode-restaurant'),\n\t\t\t\t'parent' => $sunday_row\n\t\t\t));\n\t\t}", "public function getMapSettings()\n {\n //Main template access\n if ($layout = $this->getTpl($this->getShopFile($this->pointers))) {\n //Points template Access\n if ($point = $this->getTpl($this->getShopFile($this->point))) {\n //Put all points in config string\n if ($shops = $this->getShops()) {\n $allPointers = '';\n foreach ($shops as $val) {\n $allPointers .= str_replace(\n array(\n '{{x}}',\n '{{y}}',\n '{{text}}',\n ),\n array(\n $val->x,\n $val->y,\n $val->text,\n ),\n $point);\n }\n return str_replace(\"{{points}}\", $allPointers, $layout);\n }\n }\n }\n return false;\n }", "function drawMap() {\n\n\t\t// TODO: devlog start\n\t\tif(TYPO3_DLOG) {\n\t\t\tt3lib_div::devLog($this->mapName.': starting map drawing', 'wec_map_api');\n\t\t\tt3lib_div::devLog($this->mapName.': API key: '.$this->key, 'wec_map_api');\n\t\t\tt3lib_div::devLog($this->mapName.': domain: '.t3lib_div::getIndpEnv('HTTP_HOST'), 'wec_map_api');\n\t\t\tt3lib_div::devLog($this->mapName.': map type: '.$this->type, 'wec_map_api');\n\t\t}\n\t\t// devlog end\n\n\t\t/* Initialize locallang. If we're in the backend context, we're fine.\n\t\t If we're in the frontend, then we need to manually set it up. */\n\t\tglobal $LANG;\n\t\tif(!is_object($LANG)) {\n\t\t\trequire_once(t3lib_extMgm::extPath('lang').'lang.php');\n\t\t\t$LANG = t3lib_div::makeInstance('language');\n\t\t\tif(TYPO3_MODE == 'BE') {\n\t\t\t\t$LANG->init($BE_USER->uc['lang']);\n\t\t\t} else {\n\t\t\t\t$LANG->init($GLOBALS['TSFE']->config['config']['language']);\n\t\t\t}\n\t\t}\n\t\t$LANG->includeLLFile('EXT:wec_map/map_service/google/locallang.xml');\n\t\t$hasKey = $this->hasKey();\n\t\t$hasThingsToDisplay = $this->hasThingsToDisplay();\n\t\t$hasHeightWidth = $this->hasHeightWidth();\n\n\t\t// make sure we have markers to display and an API key\n\t\tif ($hasThingsToDisplay && $hasKey && $hasHeightWidth) {\n\n\t\t\t// auto center and zoom if necessary\n\t\t\t$this->autoCenterAndZoom();\n\n\t\t\t$htmlContent .= $this->mapDiv();\n\n\t\t\t$get = t3lib_div::_GPmerged('tx_wecmap_api');\n\n\t\t\t// if we're forcing static display, skip the js\n\t\t\tif($this->static && ($this->staticMode == 'force' || ($this->staticUrlParam && intval($get['static']) == 1))) {\n\t\t\t\treturn $htmlContent;\n\t\t\t}\n\n\t\t\t// get desired Google Maps API version\n\t\t\t$apiVersion = tx_wecmap_backend::getExtConf('apiVersion');\n\n\t\t\t// get the correct API URL\n\t\t\t$apiURL = tx_wecmap_backend::getExtConf('apiURL');\n\t\t\t$apiURL = sprintf($apiURL, $apiVersion, $this->key, $this->lang);\n\n\t\t\tif (TYPO3_DLOG) {\n\t\t\t\tt3lib_div::devLog($this->mapName.': loading API from URL: '.$apiURL, 'wec_map_api');\n\t\t\t}\n\n\t\t\t/* If we're in the frontend, use TSFE. Otherwise, include JS manually. */\n\t\t\t$jsFile = t3lib_extMgm::siteRelPath('wec_map') . 'res/wecmap.js';\n\t\t\tif (TYPO3_MODE == 'FE') {\n\t\t\t\t$GLOBALS['TSFE']->additionalHeaderData['wec_map_googleMaps'] = '<script src=\"'.$apiURL.'\" type=\"text/javascript\"></script>';\n\t\t\t\t$GLOBALS['TSFE']->additionalHeaderData['wec_map'] = '<script src=\"' . $jsFile . '\" type=\"text/javascript\"></script>';\n\t\t\t} else {\n\t\t\t\t$htmlContent .= '<script src=\"'.$apiURL.'\" type=\"text/javascript\"></script>';\n\t\t\t\t$htmlContent .= '<script src=\"' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $jsFile . '\" type=\"text/javascript\"></script>';\n\t\t\t}\n\n\t\t\t$jsContent = array();\n\t\t\t$jsContent[] = $this->js_createLabels();\n\t\t\t$jsContent[] = $this->js_errorHandler();\n\t\t\t$jsContent[] = '';\n\t\t\t$jsContent[] = $this->js_drawMapStart();\n\t\t\t$jsContent[] = $this->js_newGMap2();\n\t\t\t$jsContent[] = $this->js_newGDirections();\n\t\t\t$jsContent[] = $this->js_addKMLOverlay();\n\t\t\t$jsContent[] = $this->js_setCenter($this->mapName, $this->lat, $this->long, $this->zoom, $this->type);\n\t\t\t$jsContent = array_merge($jsContent, $this->controls);\n\t\t\t$jsContent[] = $this->js_icons();\n\n\t\t\tforeach ($this->groups as $key => $group ) {\n\t\t\t\t// TODO: devlog start\n\t\t\t\tif(TYPO3_DLOG) {\n\t\t\t\t\tt3lib_div::devLog($this->mapName.': adding '. $group->getMarkerCount() .' markers from group '.$group->id, 'wec_map_api');\n\t\t\t\t}\n\t\t\t\t// devlog end\n\t\t\t\t$jsContent = array_merge($jsContent, $group->drawMarkerJS());\n\t\t\t\t$jsContent[] = '';\n\t\t\t}\n\n\t\t\t$jsContent[] = $this->js_initialOpenInfoWindow();\n\t\t\t$jsContent[] = $this->js_drawMapEnd();\n\t\t\t$jsContent[] = $this->js_loadCalls();\n\n\t\t\t// TODO: devlog start\n\t\t\tif(TYPO3_DLOG) {\n\t\t\t\tt3lib_div::devLog($this->mapName.': finished map drawing', 'wec_map_api');\n\t\t\t}\n\t\t\t// devlog end\n\n\t\t\t// get our content out of the array into a string\n\t\t\t$jsContentString = implode(chr(10), $jsContent);\n\n\t\t\t// then return it\n\t\t\treturn $htmlContent.t3lib_div::wrapJS($jsContentString);\n\n\t\t} else if (!$hasKey) {\n\t\t\t$error = '<p>'.$LANG->getLL('error_noApiKey').'</p>';\n\t\t\t// syslog start\n\t\t\t\tt3lib_div::sysLog('No API key set for domain: '.t3lib_div::getIndpEnv('HTTP_HOST').' & page id: '.$GLOBALS['TSFE']->id, 'wec_map', 3);\n\t\t\t// syslog end\n\t\t} else if (!$hasThingsToDisplay) {\n\t\t\t$error = '<p>'.$LANG->getLL('error_nothingToDisplay').'</p>';\n\t\t} else if (!$hasHeightWidth) {\n\t\t\t$error = '<p>'.$LANG->getLL('error_noHeightWidth').'</p>';\n\t\t}\n\t\t// TODO: devlog start\n\t\tif(TYPO3_DLOG) {\n\t\t\tt3lib_div::devLog($this->mapName.': finished map drawing with errors', 'wec_map_api', 2);\n\t\t}\n\t\treturn $error;\n\t}", "public function setMap($map){ $this->map = $map; return $this;}", "function mim_settings_api_init() {\n\n // Add the section to reading settings so we can add our fields to it\n add_settings_section(\n 'map_setting_section',\n 'Pagina mappa interattiva',\n 'mim_setting_section_callback_function',\n 'reading'\n );\n\n // Add the field with the names and function to use for our new settings, put it in our new section\n add_settings_field(\n 'mim_map_page_id',\n 'Pagina mappa interattiva',\n 'mim_setting_callback_function',\n 'reading',\n 'map_setting_section'\n );\n\n // Register our setting in the \"reading\" settings section\n register_setting( 'reading', 'mim_map_page_id' );\n\n}", "public function Map()\n\n {\n\n $this->loadViews(\"admin/admin_views/map\", $this->global, NULL);\n\n }", "public function renderMap()\n\t{\n\t\t$this->init();\n\t\t$this->run();\n\t}", "function staticMapWithMarkers($filename, $countryData,$center='0,0',$markersize=\"mid\",$markercolor=\"blue\")\n{\n $file = $filename;\n $u = env('MAP_OPTIONS');\n// $u .= \"&center=$center\";\n\n $markers = '';\n $markers .= '&markers=' . (\"color:$markercolor|size:$markersize\");\n foreach ($countryData as $country ):\n $markers .= \"|\".urlencode($country);\n endforeach;\n\n $u .= '&zoom=1&size=1100x400';\n $u .= $markers;\n $u .= '&key=' . env('STATICAPIKEY');\n\n// echo '<a target=\"_blank\" href=\"'.$u.'\">URL</a>';\n\n file_put_contents($file, file_get_contents($u));\n return;\n}", "public function map() {\n $this->display(\"Pages/map\");\n }", "public function init_gmaps() {\n\t\t\n\t\t//Cache path to view templates\n\t\t$this->view_template_path = $this->plugin_root . '/templates';\n\t\t\n\t\t//Format maps api url with any options\n\t\t$this->format_api_url_options();\n\t\t\n\t\t//Enqueue and scripts needed for the plugin\n\t\t$this->enqueue_scripts();\n\t\t\n\t\t//Cache Map data\n\t\t$this->get_map_data();\n\t\t\n\t\t//Localize map params\n\t\t$this->localize_map_params();\n\t\t\n\t\t//Render view template\n\t\t$this->render_view();\n\t\t\n\t}", "function _default() {\n\t\tif (count($this->URI)<3 || empty($this->URI[2])) {\n\t\t\t$this->show_map();\n\t\t} else {\n\t\t\t$this->show_cluster($this->URI[2]);\n\t\t}\n\t}", "function setImageMap($Mode=TRUE,$GraphID='MyGraph')\r\n\t{\r\n\t\t$this->BuildMap = $Mode;\r\n\t\t$this->MapID = $GraphID;\r\n\t}", "public function __construct()\n {\n parent::__construct();\n\n $this->setContainerId('map');\n $this->setZoom(14);\n $this->setWidth(350);\n $this->setHeight(300);\n }", "function startMap(){\n\t\t?>\n\t\tthis.layers = [];\n\t\tthis.tileset_name\t\t \t\t= \"res/tilesets/Testset.png\";\n\t\tthis.tileset_grid_size \t\t= 32;\n\t\tthis.tileset_zoom_factor = 1.0;\n\t\tthis.tileset_row_width \t\t= 8;\n\t\tthis.tileset_passable \t\t= [[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,1,1,1],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[1,1,1,1],[1,1,1,1],[1,1,1,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[1,1,1,1],[1,1,1,1],[1,1,1,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[1,1,1,1],[1,1,1,1],[1,1,1,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[0,0,0,0],[0,0,0,0]];\n\t\t\n\t\tthis.map_width \t\t\t\t\t= 21*this.tileset_zoom_factor*this.tileset_grid_size;\n\t\tthis.map_height \t\t\t\t= 21*this.tileset_zoom_factor*this.tileset_grid_size;\n\t\t\n\t\tthis.layers[0] = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [39,39,39,39,39,39,39,40,9,9,9,38,39,39,39,39,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [39,39,39,39,39,39,39,40,9,9,9,38,39,39,39,39,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [39,39,39,39,39,39,39,40,9,9,9,38,39,39,39,39,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [39,39,39,39,39,53,47,48,9,9,9,38,39,39,39,39,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [39,39,39,39,39,40, 9, 9,9,9,9,38,39,39,39,39,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [47,47,47,47,47,48, 9, 9,9,9,9,38,39,39,39,39,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9],\n\t\t\t\t\t\t\t\t\t [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9]];\n\t\t\n\t\tthis.layers[1] = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [49,50,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [57,58,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [65,66,67,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,7,0,0],\n\t\t\t\t\t\t\t\t\t [0,7,0,6,6,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6]];\n\t\t\n\t\tthis.layers[2] = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [41,42,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],\n\t\t\t\t\t\t\t\t\t [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];\n\t\t\n\t\t<?php\n\t\t// Events and characters:\n\t\taddChara(\"player\", \"res/chara/Poyo_chara.png\", 230, 230, 1);\n\t\taddChara(\"old\", \"res/chara/OldPoyo_chara.png\", 330, 270, 1);\n\t\t\n\t\t//addEvent(\"talk_old\", \"keynewpress_13\", '[[\"move\",-1, \"turn\", [\"towards_chara\", \"player\"], 1], [\"speak\", \"old_speech\", [\"[s=12]Hallo, ich bins, der alte Poyo.[/s]\",\"[s=12]Ich hoffe du erinnerst dich noch an mich.[/s]\"]], [\"choice\",\"old_speech\",\"[s=12]Erinnerst du dich?[/s]\"]]', '[[[ \"distance\", -1, \"player\", function(d){ return d < 46;}], [\"facing_towards\", \"player\", -1]]]', \"old\");\n\t\taddEvent(\"talk_old\", \"keynewpress_13\", '[[\"move\",-1, \"turn\", [\"towards_chara\", \"player\"], 1], '.speakEffect('old', '[\"[s=12]Hallo, ich bins, der alte Poyo.[/s]\",\"[s=12]Ich hoffe du erinnerst dich noch an mich.[/s]\"]').', '.choiceEffect('old', '[s=12]Erinnerst du dich?[/s]', '[\"[s=12]ja\",\"[s=12]nein\"]').', [\"map_variable\", \"frozen\", function(){ return false;}]]', '[[[ \"distance\", -1, \"player\", function(d){ return d < 46;}], [\"facing_towards\", \"player\", -1]]]', \"old\");\n\t\t\n\t\t// scrolling\n\t\taddEvent(\"player_scrolling\", \"auto\", '[[\"scroll\", function(sx, e){ return 320-e.get_chara().x-e.get_chara().get_width()/2; }, function(sy, e){ return 240-e.get_chara().y-e.get_chara().get_height()/2; }]]', '[]', \"player\", \"true\");\n\t\t\n\t\t// player walking\n\t\taddEvent(\"player_move_left\", \"keypress_37\", '[[\"player_move\", \"player\", \"walk\", [0,3,\"inf\"], 1, true]]', ' [[[\"chara_variable\",\"player\",\"walking\",function(v){ return v != true; }], [\"map_variable\",\"frozen\",function(v){ return v != true; }]]]', \"player\", \"true\");\n\t\taddEvent(\"player_stop_left\", \"keyrelease_37\", '[[\"player_move\", \"player\", \"stand\", [], 1, false]]', '[[[\"facing\",\"player\",3]]]', \"player\", \"true\");\n\t\taddEvent(\"player_move_up\", \"keypress_38\", '[[\"player_move\", \"player\", \"walk\", [0,0,\"inf\"], 1, true]]', ' [[[\"chara_variable\",\"player\",\"walking\",function(v){ return v != true; }], [\"map_variable\",\"frozen\",function(v){ return v != true; }]]]', \"player\", \"true\");\n\t\taddEvent(\"player_stop_up\", \"keyrelease_38\", '[[\"player_move\", \"player\", \"stand\", [], 1, false]]', '[[[\"facing\",\"player\",0]]]', \"player\", \"true\");\n\t\taddEvent(\"player_move_right\", \"keypress_39\", '[[\"player_move\", \"player\", \"walk\", [0,1,\"inf\"], 1, true]]', ' [[[\"chara_variable\",\"player\",\"walking\",function(v){ return v != true; }], [\"map_variable\",\"frozen\",function(v){ return v != true; }]]]', \"player\", \"true\");\n\t\taddEvent(\"player_stop_right\", \"keyrelease_39\", '[[\"player_move\", \"player\", \"stand\", [], 1, false]]', '[[[\"facing\",\"player\",1]]]', \"player\", \"true\");\n\t\taddEvent(\"player_move_down\", \"keypress_40\", '[[\"player_move\", \"player\", \"walk\", [0,2,\"inf\"], 1, true]]', ' [[[\"chara_variable\",\"player\",\"walking\",function(v){ return v != true; }], [\"map_variable\",\"frozen\",function(v){ return v != true; }]]]', \"player\", \"true\");\n\t\taddEvent(\"player_stop_down\", \"keyrelease_40\", '[[\"player_move\", \"player\", \"stand\", [], 1, false]]', '[[[\"facing\",\"player\",2]]]', \"player\", \"true\");\n\t\t\n\t\t// teleport to other map\n\t\taddEvent(\"tp\", \"keynewpress_50\", '[[\"change_map\",2]]');\n\t\t\n\t\taddEvent(\"save\", \"keynewpress_83\", '[[\"save_game\",1]]');\n\t\t\n\t\taddTriggerKey(13);\n\t\taddTriggerKey(37);\n\t\taddTriggerKey(38);\n\t\taddTriggerKey(39);\n\t\taddTriggerKey(40);\n\t\taddTriggerKey(50);\n\t\taddTriggerKey(83);\n\t}", "public function setMaps($maps)\n {\n $this->maps = $maps;\n }", "private function init_spotter_settings() {\r\n $settings = array();\r\n $settings[12] = \"FOLLOWERS\";\r\n $settings[14] = \"YES\";\r\n for ($i = 27; $i <= 29; $i++) {\r\n $settings[$i] = false;\r\n }\r\n $settings[34] = true;\r\n $settings[35] = false;\r\n $settings[36] = true;\r\n $settings[37] = true;\r\n $settings[38] = false;\r\n return $settings;\r\n }" ]
[ "0.6727726", "0.63667417", "0.62181675", "0.6185612", "0.6137716", "0.60719776", "0.5988078", "0.5931766", "0.592354", "0.5840173", "0.58379686", "0.57910514", "0.57900596", "0.5788461", "0.5763926", "0.5745278", "0.570961", "0.57019", "0.57004845", "0.5694644", "0.5657995", "0.5630734", "0.5600274", "0.5587409", "0.55768794", "0.5561963", "0.55536", "0.5526741", "0.5512222", "0.55093336" ]
0.72691846
0
Settings / Results / Appearance
private function augment_settings_results_appearance() { $related_to = 'show_icon_array'; $new_options[ 'show_icon_array' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'results', 'group' => 'appearance' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function appearance() {\n \n // Check if the session exists and if the login user is admin\n $this->check_session($this->user_role, 1);\n \n // Get all options\n $options = $this->options->get_all_options();\n\n $this->content = [\n 'options' => $options\n ];\n \n // Get the appearance page\n $this->body = 'admin/appearance';\n $this->admin_layout();\n \n }", "public function settingsSummary();", "public function index() {\n\t\t$this->displaySettings();\n\t}", "function render_MainSettings() {\n print '<p>'.\n __('Use these settings to filter out the plugins that are returned on the Add New plugin page.','csa-plugintel').\n '</p>';\n }", "public function showSettings(){\n\t\t// Show settings\n\t\treturn $this->showDefaultSettings();\n\t}", "public function display_settings()\n {\n $this->setup_ft();\n\n return $this->call_ft(__FUNCTION__, $this->settings());\n }", "public function settings();", "public function load_settings_view_advanced() {\n printf( '<p>If there are collisions with the custom post type of <code>%s</code> you can change it here:</p>', $this->settings['post_type'] );\n }", "private function augment_settings_view_appearance() {\n\n\t\t$related_to = 'show_legend_text';\n\t\t$new_options[ 'show_legend_text' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'view', 'group' => 'appearance' ) );\n\t}", "public function settings() {\n\t\t\t\n\t\t}", "public function SA_theme_setting()\n {\n }", "public function display_general_settings() {\n\t\t// echo 'General Settings';\n\t}", "function settings_page() {\n\t\techo '<div class=\"wrap\">';\n\t\techo sprintf(\"<h2>%s</h2>\", __('Menu List Settings', 'themeplate'));\n\t\t$this->settings_api->show_settings();\n\t\techo '</div>';\n\n\t}", "public function actionDefault()\n {\n $this->model->rewriteActionConfigField('background_color', '#262626');\n\n // TODO: figure out when this should be called\n // $this->model->clearTmpStorage();\n\n $this->data['programs'] = ProgramSelectionModel::getAllUserPrograms($this->playid);\n $this->data['training_field_types'] = $this->trainingFieldTypes();\n $this->data['food_field_types'] = $this->foodFieldTypes();\n\n return ['Settings', $this->data];\n }", "public function status()\n\t{\n\t\t// This is what you would put in to include the style sheet on the front page...\n\t\t// $document = JFactory::getDocument();\n\t\t// $document->addStyleSheet(JURI::base(). \"plugins/authentication/aaf/assets/aaf.css\");\n\t\t// Or this if you had the stylesheet in plugins/authentication/aaf/assets/css/aaf.css ...\n\t\t// \\Hubzero\\Document\\Assets::addPluginStylesheet('authentication', 'aaf', 'aaf.css');\n\t}", "public function display_options();", "function cricket_theme_settings_page(){\r\n}", "public function add_appearance_settings() {\n add_settings_section(\n 'laterpay_appearance',\n sprintf( esc_html__( '%s Appearance %s', 'laterpay' ), '<a href=\"#lpappearance\" class=\"lp_options_a\"><div id=\"lpappearance\">', '</div></a>' ),\n array( $this, 'get_appearance_section_description' ),\n 'laterpay'\n );\n\n // Teaser content word count Settings.\n add_settings_field(\n 'laterpay_teaser_content_word_count',\n esc_html__( 'Default Teaser Content Word Count', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_teaser_content_word_count',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Teaser Content Word Count', 'laterpay' ),\n 'modal' => array(\n 'id' => 'teaser_word_count_id',\n 'message' => sprintf( esc_html__( 'The Laterpay WordPress plugin automatically generates teaser content for every paid post without teaser content. %1$s %1$s While technically possible, setting this parameter to zero is HIGHLY DISCOURAGED. %1$s %1$s If you really, really want to have NO teaser content for a post, enter one space into the teaser content editor for that post.', 'laterpay' ), '<br/>' ),\n 'style' => 'font-size:24px',\n ),\n )\n\n );\n\n // Percentage of post content Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_percentage_of_content',\n esc_html__( 'Percentage of Post Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_percentage_of_content',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Percentage of Post Content', 'laterpay' ),\n 'modal' => array(\n 'id' => 'percentage_count_id',\n 'message' => esc_html__( 'Percentage of content to be extracted; 20 means \"extract 20% of the total number of words of the post\".', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n // Minimum Count Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_word_count_min',\n esc_html__( 'Minimum Number of Words Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_word_count_min',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Minimum Number of Words', 'laterpay' ),\n 'modal' => array(\n 'id' => 'minimum_word_count_id',\n 'message' => esc_html__( 'Applied if number of words as percentage of the total number of words is less than this value.', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n // Maximum Count Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_word_count_max',\n esc_html__( 'Maximum Number of Words Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_word_count_max',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Maximum Number of Words', 'laterpay' ),\n 'modal' => array(\n 'id' => 'minimum_word_count_id',\n 'message' => esc_html__( 'Applied if number of words as percentage of the total number of words exceeds this value.', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n register_setting( 'laterpay', 'laterpay_main_color' );\n register_setting( 'laterpay', 'laterpay_hover_color' );\n register_setting( 'laterpay', 'laterpay_teaser_content_word_count', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_percentage_of_content', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_word_count_min', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_word_count_max', 'absint' );\n\n }", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "public function get_qual_settings_page()\n {\n \n }", "public function get_qual_settings_page()\n {\n \n }", "public function run()\n {\n App\\Appearance::create([\n \t'icon' => '',\n \t'api_key' => 'a2500d818957188618c5c0ae24a841a8',\n \t'footer' => 'Some footer text',\n \t'keywords' => 'blog,art,artist,renaissance,history,war,christ,michelangelo',\n \t'description' => \"Welcome to Medium, a place where words matter. Medium taps into the brains of the world's most insightful writers, thinkers, and storytellers to bring you the\",\n 'theme_id' => 1\n ]);\n }", "static function get_settings(){\n\t\t\t\treturn array(\n\t\t\t\t\t'icon' => 'fa-signal',\n\t\t\t\t\t'title' => esc_html__('Chart', 'goodlayers-core')\n\t\t\t\t);\n\t\t\t}", "public function settings_page() {\n\t\techo 'From Settings';\n\t}", "private function pages_settings_appearance() {\n\t\t$new_options[ 'pages_directory_wrapper_css_class' ] = array( 'default' => 'slp_pages_list' , 'allow_empty' => true );\n\t\t$new_options[ 'pages_directory_entry_css_class' ] = array( 'default' => 'slp_page location_details' , 'allow_empty' => true );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp-pages','section' => 'settings', 'group' => 'appearance' ) );\n\t}", "function rp_layout_settings() {\n $this->options = get_option('rp_results_parser_einstellungen');\n $this->pageTypes = array(''=>__('Posts'), 'page' => __('Pages'), __('Theme Templates') => array_flip(get_page_templates()));\n ?>\n <div class=\"wrap\">\n <h2><?php echo esc_html($this->title); ?></h2>\n <form action=\"options.php\" method=\"post\">\n <?php\n settings_fields('rp_results_parser_einstellungen');\n do_settings_sections('results_parser-admin');\n submit_button();\n ?>\n </form>\n <form action=\"\" method=\"post\">\n <?php\n do_settings_sections('results_parser_import-admin');\n ?>\n </form>\n </div >\n <?php\n }", "function firstone_settings_display()\r\n{\r\n\techo '<h1>first one Settings</h1>';\r\n\techo '<hr>';\r\n}", "function pqrc_setting_section() {\n\t\t\t\t\techo \"<p>\" . __( \"Setting for Post to QR code Plugin\" ) . \"</p>\";\n\t\t\t\t}", "private function augment_settings_search_appearance() {\n\n\t\t// Category Selector Options For Front End\n\t\t$related_to = 'search_appearance_category_header,label_category,show_cats_on_search,show_option_all,hide_empty';\n\t\t$new_options[ 'search_appearance_category_header' ] = array( 'related_to' => $related_to , 'type' => 'subheader' , 'description' => '' );\n\t\t$new_options[ 'show_cats_on_search' ] = array( 'related_to' => $related_to , 'type' => 'dropdown' , 'default' => 'none' , 'get_items_callback' => array( $this , 'get_show_cats_on_search_items' ) );\n\t\t$new_options[ 'label_category' ] = array( 'related_to' => $related_to , 'default' => __( 'Category' , 'slp-power') , 'allow_empty' => true );\n\t\t$new_options[ 'show_option_all' ] = array( 'related_to' => $related_to , 'default' => __( 'Any' , 'slp-power') , 'allow_empty' => true );\n\t\t$new_options[ 'hide_empty' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'search', 'group' => 'appearance' ) );\n\t}" ]
[ "0.65878874", "0.6278565", "0.614186", "0.6056052", "0.60218835", "0.601261", "0.5994394", "0.5987638", "0.5913798", "0.58578", "0.5849474", "0.5843175", "0.5813377", "0.5794376", "0.5790736", "0.5777193", "0.57291025", "0.57005817", "0.56919664", "0.56919664", "0.5687691", "0.5687691", "0.56645817", "0.5645118", "0.5615091", "0.56124806", "0.55973923", "0.5593708", "0.5585478", "0.5583974" ]
0.68662685
0
Settings / Search / Appearance
private function augment_settings_search_appearance() { // Category Selector Options For Front End $related_to = 'search_appearance_category_header,label_category,show_cats_on_search,show_option_all,hide_empty'; $new_options[ 'search_appearance_category_header' ] = array( 'related_to' => $related_to , 'type' => 'subheader' , 'description' => '' ); $new_options[ 'show_cats_on_search' ] = array( 'related_to' => $related_to , 'type' => 'dropdown' , 'default' => 'none' , 'get_items_callback' => array( $this , 'get_show_cats_on_search_items' ) ); $new_options[ 'label_category' ] = array( 'related_to' => $related_to , 'default' => __( 'Category' , 'slp-power') , 'allow_empty' => true ); $new_options[ 'show_option_all' ] = array( 'related_to' => $related_to , 'default' => __( 'Any' , 'slp-power') , 'allow_empty' => true ); $new_options[ 'hide_empty' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'search', 'group' => 'appearance' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bbp_admin_setting_callback_search()\n{\n}", "function register_brokendoor_appearance_settingsfroms(){\n\tadd_settings_section('broken_door_media_appearance_options' ,\n\t\t'Front Page Settings ',\n\t\t'render_brokendor_appearance_settings_from_prompt' ,\n\t\t'theme-settings' );\n\n\tadd_settings_field('left_home_box_page' ,\n\t\t'Left Box' ,\n\t\t'render_leftbox_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\tadd_settings_field('right_home_box_page' ,\n\t\t'Right Box' ,\n\t\t'render_rightbox_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\tadd_settings_field('front_youtube_link' ,\n\t\t'Youtube Link for front page video' ,\n\t\t'render_youtube_link_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\t//this adds in some of those settings for them\n}", "private function pages_settings_appearance() {\n\t\t$new_options[ 'pages_directory_wrapper_css_class' ] = array( 'default' => 'slp_pages_list' , 'allow_empty' => true );\n\t\t$new_options[ 'pages_directory_entry_css_class' ] = array( 'default' => 'slp_page location_details' , 'allow_empty' => true );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp-pages','section' => 'settings', 'group' => 'appearance' ) );\n\t}", "private function augment_settings_results_appearance() {\n\n\t\t$related_to = 'show_icon_array';\n\t\t$new_options[ 'show_icon_array' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'results', 'group' => 'appearance' ) );\n\t}", "function cricket_theme_settings_page(){\r\n}", "function b4st_settings($wp_customize) {\n$wp_customize->add_setting('search_toggle');\n\n$wp_customize->add_control( 'search_toggle', array(\n 'type' => 'checkbox',\n 'label' => 'Toggle Search in Header',\n 'section' => 'title_tagline',\n 'settings' => 'search_toggle',\n) );\n}", "public function add_appearance_settings() {\n add_settings_section(\n 'laterpay_appearance',\n sprintf( esc_html__( '%s Appearance %s', 'laterpay' ), '<a href=\"#lpappearance\" class=\"lp_options_a\"><div id=\"lpappearance\">', '</div></a>' ),\n array( $this, 'get_appearance_section_description' ),\n 'laterpay'\n );\n\n // Teaser content word count Settings.\n add_settings_field(\n 'laterpay_teaser_content_word_count',\n esc_html__( 'Default Teaser Content Word Count', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_teaser_content_word_count',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Teaser Content Word Count', 'laterpay' ),\n 'modal' => array(\n 'id' => 'teaser_word_count_id',\n 'message' => sprintf( esc_html__( 'The Laterpay WordPress plugin automatically generates teaser content for every paid post without teaser content. %1$s %1$s While technically possible, setting this parameter to zero is HIGHLY DISCOURAGED. %1$s %1$s If you really, really want to have NO teaser content for a post, enter one space into the teaser content editor for that post.', 'laterpay' ), '<br/>' ),\n 'style' => 'font-size:24px',\n ),\n )\n\n );\n\n // Percentage of post content Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_percentage_of_content',\n esc_html__( 'Percentage of Post Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_percentage_of_content',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Percentage of Post Content', 'laterpay' ),\n 'modal' => array(\n 'id' => 'percentage_count_id',\n 'message' => esc_html__( 'Percentage of content to be extracted; 20 means \"extract 20% of the total number of words of the post\".', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n // Minimum Count Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_word_count_min',\n esc_html__( 'Minimum Number of Words Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_word_count_min',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Minimum Number of Words', 'laterpay' ),\n 'modal' => array(\n 'id' => 'minimum_word_count_id',\n 'message' => esc_html__( 'Applied if number of words as percentage of the total number of words is less than this value.', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n // Maximum Count Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_word_count_max',\n esc_html__( 'Maximum Number of Words Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_word_count_max',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Maximum Number of Words', 'laterpay' ),\n 'modal' => array(\n 'id' => 'minimum_word_count_id',\n 'message' => esc_html__( 'Applied if number of words as percentage of the total number of words exceeds this value.', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n register_setting( 'laterpay', 'laterpay_main_color' );\n register_setting( 'laterpay', 'laterpay_hover_color' );\n register_setting( 'laterpay', 'laterpay_teaser_content_word_count', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_percentage_of_content', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_word_count_min', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_word_count_max', 'absint' );\n\n }", "public function SA_theme_setting()\n {\n }", "public function load_settings_view_advanced() {\n printf( '<p>If there are collisions with the custom post type of <code>%s</code> you can change it here:</p>', $this->settings['post_type'] );\n }", "public function likesSettings_search()\n\t{\n\t\treturn $this->_likesSettings();\n\t}", "private function augment_settings_view_appearance() {\n\n\t\t$related_to = 'show_legend_text';\n\t\t$new_options[ 'show_legend_text' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'view', 'group' => 'appearance' ) );\n\t}", "static function get_settings(){\n\t\t\t\treturn array(\n\t\t\t\t\t'icon' => 'fa-newspaper-o',\n\t\t\t\t\t'title' => esc_html__('Blog', 'goodlayers-core')\n\t\t\t\t);\n\t\t\t}", "public function settings_search()\n\t{\n\t\treturn $this->_settings();\n\t}", "public function settings_search()\n\t{\n\t\treturn $this->_settings();\n\t}", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "function cf_general_options() {\n\tadd_settings_section('cf_menu','Centreforge Options','cf_main_text','reading');\n\tadd_settings_field('cf_navSetting','Navigation','cf_nav_text','reading','cf_menu');\n\tadd_settings_field('cf_colourSetting','Navigation Colour','cf_nav_colour','reading','cf_menu');\n\tadd_settings_field('cf_footSetting','Footer','cf_footer_text','reading','cf_menu');\n\tregister_setting('reading','cf_navText','esc_html');\n\tregister_setting('reading','cf_navColour','esc_html');\n\tregister_setting('reading','cf_footerText','esc_html');\n}", "public function settings();", "function render_MainSettings() {\n print '<p>'.\n __('Use these settings to filter out the plugins that are returned on the Add New plugin page.','csa-plugintel').\n '</p>';\n }", "private function pages_tab() {\n\t\t$this->pages_settings_appearance();\n\t}", "function settings_page() {\n\t\techo '<div class=\"wrap\">';\n\t\techo sprintf(\"<h2>%s</h2>\", __('Menu List Settings', 'themeplate'));\n\t\t$this->settings_api->show_settings();\n\t\techo '</div>';\n\n\t}", "public function layoutSettings_search()\n\t{\n\t\treturn $this->_layoutSettings();\n\t}", "public function basicSettings_search()\n\t{\n\t\treturn $this->_basicSettings();\n\t}", "function tainacan_the_faceted_search() {\n\n\t$props = ' ';\n\t\n\t$default_view_mode = apply_filters( 'tainacan-default-view-mode-for-themes', 'masonry' );\n\t$enabled_view_modes = apply_filters( 'tainacan-enabled-view-modes-for-themes', ['table', 'cards', 'masonry', 'slideshow'] );\n\t\n\t// if in a collection page\n\t$collection_id = tainacan_get_collection_id();\n\tif ($collection_id) {\n\t\t\n\t\t$props .= 'collection-id=\"' . $collection_id . '\" ';\n\t\t$collection = new \\Tainacan\\Entities\\Collection($collection_id);\n\t\t$default_view_mode = $collection->get_default_view_mode();\n\t\t$enabled_view_modes = $collection->get_enabled_view_modes();\n\t}\n\t\n\t// if in a tainacan taxonomy\n\t$term = tainacan_get_term();\n\tif ($term) {\n\t\t$props .= 'term-id=\"' . $term->term_id . '\" ';\n\t\t$props .= 'taxonomy=\"' . $term->taxonomy . '\" ';\n\t\t// $props .= 'custom-filters=\"[72432,84385]\" '; // Only to be used when dealing with custom filters\n\t\t// $props .= 'collection-id=\"43385\" '; // Only to be used when dealing with custom filters\n\t}\n\t\n\t$props .= 'default-view-mode=\"' . $default_view_mode . '\" ';\n\t$props .= 'enabled-view-modes=\"' . implode(',', $enabled_view_modes) . '\" ';\n\n\techo \"<main id='tainacan-items-page' $props ></main>\";\n\t\n}", "public function get_qual_settings_page()\n {\n \n }", "public function get_qual_settings_page()\n {\n \n }", "public function appearance() {\n \n // Check if the session exists and if the login user is admin\n $this->check_session($this->user_role, 1);\n \n // Get all options\n $options = $this->options->get_all_options();\n\n $this->content = [\n 'options' => $options\n ];\n \n // Get the appearance page\n $this->body = 'admin/appearance';\n $this->admin_layout();\n \n }", "function bbp_admin_setting_callback_search_slug()\n{\n}", "public function settings() {\n\t\t\t\n\t\t}", "function term_faceted_search() {\n\n\t\t$props = ' ';\n\t\t\n\t\t$default_view_mode = apply_filters( 'tainacan-default-view-mode-for-themes', 'masonry' );\n\t\t$enabled_view_modes = apply_filters( 'tainacan-enabled-view-modes-for-themes', ['table', 'cards', 'masonry'] );\n\t\t\n\t\t// if in a collection page\n\t\t$collection_id = $this->main_collection->get_id();\n\t\tif ($collection_id) {\n\t\t\t\n\t\t\t$props .= 'collection-id=\"' . $collection_id . '\" ';\n\t\t\t$collection = new \\Tainacan\\Entities\\Collection($collection_id);\n\t\t\t$default_view_mode = $collection->get_default_view_mode();\n\t\t\t$enabled_view_modes = $collection->get_enabled_view_modes();\n\t\t}\n\t\t\n\t\t// if in a tainacan taxonomy\n\t\t$term = tainacan_get_term();\n\t\tif ($term) {\n\t\t\t$props .= 'term-id=\"' . $term->term_id . '\" ';\n\t\t\t$props .= 'taxonomy=\"' . $term->taxonomy . '\" ';\n\t\t}\n\t\t\n\t\t// collection filters \n\t\t$filters = $this->filters_repo->fetch_by_collection($this->main_collection, [], 'OBJECT');\n\t\t//var_dump($filters);\n\t\t$filters_id = array_map(function($a) { return $a->get_id(); }, $filters);\n\t\t\n\t\t$props .= 'default-view-mode=\"' . $default_view_mode . '\" ';\n\t\t$props .= 'enabled-view-modes=\"' . implode(',', $enabled_view_modes) . '\" ';\n\t\t$props .= 'custom-filters=\"' . implode(',', $filters_id) . '\" ';\n\n\t\techo \"<div id='tainacan-items-page' $props ></div>\";\n\n\t}" ]
[ "0.64670336", "0.6350453", "0.6252935", "0.6203226", "0.6119385", "0.60873556", "0.60230136", "0.5967936", "0.59611756", "0.5938173", "0.5938173", "0.5931735", "0.59166336", "0.59166336", "0.5895319", "0.5895319", "0.58939487", "0.5891814", "0.58818674", "0.5878334", "0.58501583", "0.5847478", "0.5846834", "0.5842218", "0.58233833", "0.58233833", "0.580853", "0.5802881", "0.57866824", "0.5752752" ]
0.71722454
0
Settings / View / Appearance
private function augment_settings_view_appearance() { $related_to = 'show_legend_text'; $new_options[ 'show_legend_text' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'view', 'group' => 'appearance' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function appearance() {\n \n // Check if the session exists and if the login user is admin\n $this->check_session($this->user_role, 1);\n \n // Get all options\n $options = $this->options->get_all_options();\n\n $this->content = [\n 'options' => $options\n ];\n \n // Get the appearance page\n $this->body = 'admin/appearance';\n $this->admin_layout();\n \n }", "public function SA_theme_setting()\n {\n }", "function cricket_theme_settings_page(){\r\n}", "public function load_settings_view_advanced() {\n printf( '<p>If there are collisions with the custom post type of <code>%s</code> you can change it here:</p>', $this->settings['post_type'] );\n }", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "function settings_page() {\n\t\techo '<div class=\"wrap\">';\n\t\techo sprintf(\"<h2>%s</h2>\", __('Menu List Settings', 'themeplate'));\n\t\t$this->settings_api->show_settings();\n\t\techo '</div>';\n\n\t}", "public function SettingsView(){\n\t\t//Meta is usually not setup yet, so we manually do this before loading css file\n\t\t$this->meta = new Meta();\n\t\t\n\t\t//This class requires an extra css file\n\t\t$this->getMeta()->addExtra('<link href=\"core/fragments/css/admin.css\" rel=\"stylesheet\" type=\"text/css\" />');\t\n\t}", "public function add_appearance_settings() {\n add_settings_section(\n 'laterpay_appearance',\n sprintf( esc_html__( '%s Appearance %s', 'laterpay' ), '<a href=\"#lpappearance\" class=\"lp_options_a\"><div id=\"lpappearance\">', '</div></a>' ),\n array( $this, 'get_appearance_section_description' ),\n 'laterpay'\n );\n\n // Teaser content word count Settings.\n add_settings_field(\n 'laterpay_teaser_content_word_count',\n esc_html__( 'Default Teaser Content Word Count', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_teaser_content_word_count',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Teaser Content Word Count', 'laterpay' ),\n 'modal' => array(\n 'id' => 'teaser_word_count_id',\n 'message' => sprintf( esc_html__( 'The Laterpay WordPress plugin automatically generates teaser content for every paid post without teaser content. %1$s %1$s While technically possible, setting this parameter to zero is HIGHLY DISCOURAGED. %1$s %1$s If you really, really want to have NO teaser content for a post, enter one space into the teaser content editor for that post.', 'laterpay' ), '<br/>' ),\n 'style' => 'font-size:24px',\n ),\n )\n\n );\n\n // Percentage of post content Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_percentage_of_content',\n esc_html__( 'Percentage of Post Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_percentage_of_content',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Percentage of Post Content', 'laterpay' ),\n 'modal' => array(\n 'id' => 'percentage_count_id',\n 'message' => esc_html__( 'Percentage of content to be extracted; 20 means \"extract 20% of the total number of words of the post\".', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n // Minimum Count Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_word_count_min',\n esc_html__( 'Minimum Number of Words Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_word_count_min',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Minimum Number of Words', 'laterpay' ),\n 'modal' => array(\n 'id' => 'minimum_word_count_id',\n 'message' => esc_html__( 'Applied if number of words as percentage of the total number of words is less than this value.', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n // Maximum Count Settings.\n add_settings_field(\n 'laterpay_preview_excerpt_word_count_max',\n esc_html__( 'Maximum Number of Words Blurred behind Overlay', 'laterpay' ),\n array( $this, 'get_input_field_markup' ),\n 'laterpay',\n 'laterpay_appearance',\n array(\n 'name' => 'laterpay_preview_excerpt_word_count_max',\n 'class' => 'lp_number-input',\n 'tooltip' => true,\n 'title' => esc_html__( 'Maximum Number of Words', 'laterpay' ),\n 'modal' => array(\n 'id' => 'minimum_word_count_id',\n 'message' => esc_html__( 'Applied if number of words as percentage of the total number of words exceeds this value.', 'laterpay' ),\n 'style' => 'font-size:24px',\n ),\n )\n );\n\n register_setting( 'laterpay', 'laterpay_main_color' );\n register_setting( 'laterpay', 'laterpay_hover_color' );\n register_setting( 'laterpay', 'laterpay_teaser_content_word_count', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_percentage_of_content', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_word_count_min', 'absint' );\n register_setting( 'laterpay', 'laterpay_preview_excerpt_word_count_max', 'absint' );\n\n }", "private function pages_settings_appearance() {\n\t\t$new_options[ 'pages_directory_wrapper_css_class' ] = array( 'default' => 'slp_pages_list' , 'allow_empty' => true );\n\t\t$new_options[ 'pages_directory_entry_css_class' ] = array( 'default' => 'slp_page location_details' , 'allow_empty' => true );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp-pages','section' => 'settings', 'group' => 'appearance' ) );\n\t}", "private function pages_tab() {\n\t\t$this->pages_settings_appearance();\n\t}", "public function index()\n\t{\n\t\tabort_unless(User::current()->hasPermission('super') ||\n\t\t\tUser::current()->hasPermission(Faviconator::PERMISSION_GENERAL_KEY), 403);\n\n\t\t$config = $this->getFaviconatorConfig();\n\n\t\treturn view(Faviconator::getNamespacedKey('settings'), [\n\t\t\t'title' => Faviconator::getCpTranslation('title'),\n\t\t\t'action' => cp_route(Faviconator::ROUTE_SETTINGS_INDEX),\n\t\t\t'blueprint' => $config->blueprint()->toPublishArray(),\n\t\t\t'values' => $config->values(),\n\t\t\t'meta' => $config->fields()->meta()\n\t\t]);\n\t}", "public function settings();", "function _admin_settings() {\r\n $params = array( 'endpoint' => $this );\r\n $this->load_template( 'settings.php', $params );\r\n }", "function register_brokendoor_appearance_settingsfroms(){\n\tadd_settings_section('broken_door_media_appearance_options' ,\n\t\t'Front Page Settings ',\n\t\t'render_brokendor_appearance_settings_from_prompt' ,\n\t\t'theme-settings' );\n\n\tadd_settings_field('left_home_box_page' ,\n\t\t'Left Box' ,\n\t\t'render_leftbox_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\tadd_settings_field('right_home_box_page' ,\n\t\t'Right Box' ,\n\t\t'render_rightbox_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\tadd_settings_field('front_youtube_link' ,\n\t\t'Youtube Link for front page video' ,\n\t\t'render_youtube_link_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\t//this adds in some of those settings for them\n}", "public function settings() {\n\t\t\t\n\t\t}", "public function settings()\n\t{\n\t\t$this->admin_model->admin_logged_in();\n\n\t\t$data = array(\n\t\t\t'title' => 'Settings',\n\t\t\t'content' => 'settings',\n\t\t\t'common' => $this->admin_model->load_common_data(),\n\t\t\t'active' => ''\n\t\t);\n\n\t\t$this->load->view('common/admin_template', $data);\n\t}", "public function index() {\n\t\t$this->displaySettings();\n\t}", "public function setting(){\n\n\t\t$title['title']=\"Setting\";\n\t\t$this->load->view('includes/service/metadata',$title);\n\t\t$this->load->view('includes/service/header',$title);\n\t\t$this->load->view('includes/service/sidebar');\n\t\t$this->load->view('service/setting');\n\t\t$this->load->view('includes/service/footer');\t\n\t}", "public function settings()\n {\n $user = Auth::user();\n\n if ($user->hasRole('admin')) {\n $siteMeta = Meta::where('key', 'site_meta')->first();\n $settings = !is_null($siteMeta) ? $siteMeta->value : new Collection;\n } else {\n $settings = $user->getMeta('settings', new Collection);\n }\n $background = isset($siteMeta) ? $siteMeta->background : new Collection;\n\n return View::make($user->hasRole('admin') ? 'admin.settings' : 'admin.model-settings')\n ->with(compact('settings', 'background'));\n }", "public function settings_page() {\n\n require_once 'views/settings-page.php';\n\n }", "public function action_setting() {\n if (Session::get('isAdmin')) {\n $data['content'] = 'admin/setting';\n $view = View::forge('admin/index', $data);\n $view->set_global('categories', Model_Categorie::find(\"all\"), false);\n $view->set_global('secteurs', Model_Secteur::getAll(), false);\n return $view;\n } else\n Response::redirect('admin/admin/connection');\n }", "function niterbox_theme_settings_page() {\n}", "function settings(){\r\n\t\tglobal $wpdb;\r\n\t\t// data\r\n\t\t$data = array();\t\t\r\n\t\t// set \r\n\t\t$data['module'] = $this;\r\n\t\t// load template view\r\n\t\t$this->load->template('settings', array('data'=>$data));\r\n\t}", "static function get_settings(){\n\t\t\t\treturn array(\n\t\t\t\t\t'icon' => 'fa-newspaper-o',\n\t\t\t\t\t'title' => esc_html__('Blog', 'goodlayers-core')\n\t\t\t\t);\n\t\t\t}", "public function index() {\n\t\t$this->tpl->display('settings.phtml');\n\t}", "public function index()\n {\n return view('tax::content/setting');\n }", "public function display(){\n \t$model = &$this->getModel();\n \t$themes = $model->getThemes();\n \t$controls = $this->createControls();\n \t\n \t$this->assignRef('themes', $themes);\n \t$this->assignRef('controls', $controls);\n parent::display();\n }", "public function index() {\n\t\treturn view('admin.settings', ['title' => trans('admin.settings')]);\n\t}", "public function showSettings(){\n\t\t// Show settings\n\t\treturn $this->showDefaultSettings();\n\t}" ]
[ "0.7091115", "0.67769945", "0.67449605", "0.672605", "0.6723465", "0.6723465", "0.6693772", "0.6660375", "0.6594346", "0.6533932", "0.65321565", "0.6513217", "0.6416354", "0.63985586", "0.6386355", "0.63841295", "0.63751465", "0.633687", "0.63324225", "0.63210267", "0.6320142", "0.63072425", "0.62730116", "0.6262877", "0.6255262", "0.6235669", "0.622889", "0.62214524", "0.62065", "0.619776" ]
0.68633926
1
Set Pages Tab options
private function pages_tab() { $this->pages_settings_appearance(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function my_custom_option_page_modify_tab( $avia_pages )\n{\n\tif( current_user_can( 'manage_options' ) )\n\t{\n\t\treturn $avia_pages;\n\t}\n\t\n\t$found = -1;\n\t\n\tforeach( $avia_pages as $index => $page ) \n\t{\n\t\tif( 'google' == $page['slug'] )\n\t\t{\n\t\t\t$found = $index;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif( $found >= 0 )\n\t{\n\t\t$page = $avia_pages[ $found ];\n\t\t\n\t\t/**\n\t\t * add hidden to class to hide tab\n\t\t */\n\t\t$page['class'] = ! empty( $page['class'] ) ? \"{$page['class']} hidden\" : ' hidden';\n\t\t\n\t\t$avia_pages[ $found ] = $page;\n\t}\n\t\n\treturn $avia_pages;\n}", "public function add_options_pages() {\n if ( function_exists('acf_add_options_page') ) {\n acf_add_options_page(array(\n \"page_title\" => \"Home Page\",\n \"capability\" => \"edit_posts\",\n \"position\" => 5,\n \"icon_url\" => \"dashicons-admin-home\"\n ));\n }\n }", "public function setPage() {\n }", "private function pluginOptionsTabs()\n {\n $current_tab = isset($_GET['tab']) ? $_GET['tab'] : \\EburyLabs\\Hreflang::$general_settings_key;\n \n echo '<h2 class=\"nav-tab-wrapper\">';\n \n foreach (\\EburyLabs\\Hreflang::$plugin_settings_tabs as $tab_key => $tab_caption) {\n \n $active = $current_tab == $tab_key ? 'nav-tab-active' : '';\n $key = \\EburyLabs\\Hreflang::$plugin_options_key;\n \n echo \"<a class='nav-tab \".$active.\"' href='?page=\".$key.\"&tab=\".$tab_key.\"'>\";\n echo $tab_caption;\n echo \"</a>\";\n \n }\n echo '</h2>';\n }", "public function setup_settings_tabs() {\n\t\t// @codingStandardsIgnoreStart\n\t\t$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : false;\n\t\t// @codingStandardsIgnoreEnd\n\n\t\t// Verify that the current page is WSAL settings page.\n\t\tif ( empty( $page ) || $this->GetSafeViewName() !== $page ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Tab links.\n\t\t$wsal_setting_tabs = array(\n\t\t\t'general' => array(\n\t\t\t\t'name' => __( 'General', 'wp-security-audit-log' ),\n\t\t\t\t'link' => add_query_arg( 'tab', 'general', $this->GetUrl() ),\n\t\t\t\t'render' => array( $this, 'tab_general' ),\n\t\t\t\t'save' => array( $this, 'tab_general_save' ),\n\t\t\t\t'priority' => 10,\n\t\t\t),\n\t\t\t'audit-log' => array(\n\t\t\t\t'name' => __( 'Activity Log Viewer', 'wp-security-audit-log' ),\n\t\t\t\t'link' => add_query_arg( 'tab', 'audit-log', $this->GetUrl() ),\n\t\t\t\t'render' => array( $this, 'tab_audit_log' ),\n\t\t\t\t'save' => array( $this, 'tab_audit_log_save' ),\n\t\t\t\t'priority' => 20,\n\t\t\t),\n\t\t\t'file-changes' => array(\n\t\t\t\t'name' => __( 'File Changes', 'wp-security-audit-log' ),\n\t\t\t\t'link' => add_query_arg( 'tab', 'file-changes', $this->GetUrl() ),\n\t\t\t\t'render' => array( $this, 'tab_file_changes' ),\n\t\t\t\t'priority' => 30,\n\t\t\t),\n\t\t\t'exclude-objects' => array(\n\t\t\t\t'name' => __( 'Exclude Objects', 'wp-security-audit-log' ),\n\t\t\t\t'link' => add_query_arg( 'tab', 'exclude-objects', $this->GetUrl() ),\n\t\t\t\t'render' => array( $this, 'tab_exclude_objects' ),\n\t\t\t\t'save' => array( $this, 'tab_exclude_objects_save' ),\n\t\t\t\t'priority' => 40,\n\t\t\t),\n\t\t\t'advanced-settings' => array(\n\t\t\t\t'name' => __( 'Advanced Settings', 'wp-security-audit-log' ),\n\t\t\t\t'link' => add_query_arg( 'tab', 'advanced-settings', $this->GetUrl() ),\n\t\t\t\t'render' => array( $this, 'tab_advanced_settings' ),\n\t\t\t\t'save' => array( $this, 'tab_advanced_settings_save' ),\n\t\t\t\t'priority' => 100,\n\t\t\t),\n\t\t);\n\n\t\t/**\n\t\t * Filter: `wsal_setting_tabs`\n\t\t *\n\t\t * This filter is used to filter the tabs of WSAL settings page.\n\t\t *\n\t\t * Setting tabs structure:\n\t\t * $wsal_setting_tabs['unique-tab-id'] = array(\n\t\t * 'name' => Name of the tab,\n\t\t * 'link' => Link of the tab,\n\t\t * 'render' => This function is used to render HTML elements in the tab,\n\t\t * 'name' => This function is used to save the related setting of the tab,\n\t\t * 'priority' => Priority of the tab,\n\t\t * );\n\t\t *\n\t\t * @param array $wsal_setting_tabs – Array of WSAL Setting Tabs.\n\t\t *\n\t\t * @since 3.2.3\n\t\t */\n\t\t$wsal_setting_tabs = apply_filters( 'wsal_setting_tabs', $wsal_setting_tabs );\n\n\t\t// Sort by priority.\n\t\tarray_multisort( array_column( $wsal_setting_tabs, 'priority' ), SORT_ASC, $wsal_setting_tabs );\n\n\t\t$this->wsal_setting_tabs = $wsal_setting_tabs;\n\n\t\t// Get the current tab.\n\t\t$current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );\n\t\t$this->current_tab = empty( $current_tab ) ? 'general' : $current_tab;\n\t}", "function HtmlTabPlugin_admin_actions()\n{\t \n\tadd_options_page('HtmlTabPlugin','HtmlTabPlugin-Text','manage_options',_FILE_,'HtmlTabPlugin_admin');//Add to Setting as sub item\n\t//add_options_page('HtmlTabPlugin','HtmlTabPlugin-Text','manage_options',_FILE_,'HtmlTabPlugin_admin');\n\t//add_object_page(\"1\",\"2\",\"manage_options\",_FILE_,\"menuFunc\");//Show bottom comment as new Item\n\t//add_utility_page(\"1\",\"2\",\"manage_options\",_FILE_,\"menuFunc\");//Show on bottom as new Item\n\t//add_menu_page(\"1\",\"2\",\"manage_options\",_FILE_,\"menuFunc\");//Show on bottom as new Item\n}", "public function add_option_pages()\n {\n $options = [\n 'dashboard' => __('Dashboard Page', 'theme-translations'),\n 'leads' => __('Leads Page', 'theme-translations'),\n 'reception' => __('Reception Page', 'theme-translations'),\n 'reception_2' => __('Reception Page 2', 'theme-translations'),\n 'tco' => __('TCO Page', 'theme-translations'),\n 'tco_2' => __('TCO Page 2', 'theme-translations'),\n 'create_leads' => __('Blank Lead Page', 'theme-translations'),\n ];\n\n foreach ($options as $key => $name) {\n $option_name = 'theme_page_' . $key;\n\n register_setting('reading', $option_name);\n\n add_settings_field(\n 'theme_setting_' . $key,\n $name,\n [__CLASS__, 'page_select_callback'],\n 'reading',\n 'theme-pages-section',\n [\n 'id' => 'theme_setting_' . $key,\n 'option_name' => $option_name,\n ]\n );\n }\n }", "public function plugin_options_tabs() {\n\t\t$current_tab = isset ( $_GET ['tab'] ) ? $_GET ['tab'] : $this->general_settings_key;\n\t\tif ( version_compare( $GLOBALS['wp_version'], '3.8.0', '<' ) ) {\n\t\t\tscreen_icon();\n\t\t}\t\n\t\techo '<h2 class=\"nav-tab-wrapper\">';\n\t\tforeach ( $this->plugin_settings_tabs as $tab_key => $tab_caption ) {\n\t\t\t$active = $current_tab == $tab_key ? 'nav-tab-active' : '';\n\t\t\techo '<a class=\"nav-tab ' . $active . '\" href=\"?page=' . $this->plugin_options_key . '&tab=' . $tab_key . '\">' . $tab_caption . '</a>';\n\t\t}\n\t\techo '</h2>';\n\t}", "public function addOptionsPage() {\n\n\t\t$this->_options_page_hook = add_options_page(\n\t\t\t'Managed Missions Options',\n\t\t\t'Managed Missions',\n\t\t\t'manage_options',\n\t\t\tself::OPT_GROUP,\n\t\t\tarray( $this, 'renderOptionsPage' )\n\t\t);\n\t}", "function foundationpress_add_option_pages() {\n\tif ( function_exists( 'acf_add_options_page' ) ) {\n\t\tacf_add_options_page(\n\t\t\t[\n\t\t\t\t'page_title' => 'Theme Einstellungen',\n\t\t\t\t'menu_title' => 'Theme Einstellungen',\n\t\t\t\t'menu_slug' => 'theme-settings',\n\t\t\t\t'redirect' => false,\n\t\t\t\t'autoload' => true,\n\t\t\t]\n\t\t);\n\t}\n}", "function aerospace_add_options_page() {\n\n\tadd_options_page(\n\t\t'Aerospace Settings',\n\t\t'Aerospace Settings',\n\t\t'manage_options',\n\t\t'aerospace-options-page',\n\t\t'aerospace_display_options_page'\n\t);\n}", "public function setup_pages() {\n\t\t$this->pages = array(\n\t\t\t'the7-dashboard' => array(\n\t\t\t\t'title' => __( 'My The7', 'the7mk2' ),\n\t\t\t\t'capability' => 'edit_theme_options',\n\t\t\t),\n\t\t\t'the7-demo-content' => array(\n\t\t\t\t'title' => __( 'Pre-made Websites', 'the7mk2' ),\n\t\t\t\t'capability' => 'edit_theme_options',\n\t\t\t),\n\t\t\t'the7-plugins' => array(\n\t\t\t\t'title' => __( 'Plugins', 'the7mk2' ),\n\t\t\t\t'capability' => 'install_plugins',\n\t\t\t),\n\t\t\t'the7-status' => array(\n\t\t\t\t'title' => __( 'Service Information', 'the7mk2' ),\n\t\t\t\t'capability' => 'switch_themes',\n\t\t\t),\n\t\t);\n\t}", "public function setHelpTabs() {\n // $this->args['help_tabs'][] = array(\n // 'id' => 'redux-help-tab-1',\n // 'title' => __( 'Theme Information 1', 'business-review' ),\n // 'content' => __( '<p>This is the tab content, HTML is allowed.</p>', 'business-review' )\n // );\n\n // $this->args['help_tabs'][] = array(\n // 'id' => 'redux-help-tab-2',\n // 'title' => __( 'Theme Information 2', 'business-review' ),\n // 'content' => __( '<p>This is the tab content, HTML is allowed.</p>', 'business-review' )\n // );\n\n // Set the help sidebar\n // $this->args['help_sidebar'] = __( '<p>This is the sidebar content, HTML is allowed.</p>', 'business-review' );\n }", "public function setPage($page);", "function options_page() {\n\t\tadd_options_page(\n\t\t\tesc_html__( 'Dashboard Access Settings', 'remove_dashboard_access' ),\n\t\t\tesc_html__( 'Dashboard Access', 'remove_dashboard_access' ),\n\t\t\t'manage_options',\n\t\t\t'dashboard-access',\n\t\t\tarray( $this, 'options_page_cb' )\n\t\t);\n\t}", "function wp_list_pages_menu()\n{\t\n\tadd_options_page('wp_list_pages tweaks', 'wp_list_pages tweaks', 'manage_options', 'wp_list_pages_tweaks', 'wp_list_pages_admin');\n}", "public function setPage($page) {\n }", "function pt_tab( $tabs, $pod, $addtl_args ) {\r\n\t\t$tabs[ 'fs-pods-repeater' ] = __( 'FS Repeater Options', 'fs-pods-repeater-field' );\r\n\t\t\r\n\t\treturn $tabs;\r\n\t\t\r\n\t}", "public function options_page() {\n\t\tpremise_field_section( array(\n\t\t\tarray(\n\t\t\t\t'type' => 'text',\n\t\t\t\t'name' => 'pwps_theme_options',\n\t\t\t),\n\n\t\t\tarray(\n\t\t\t\t'type' => 'submit',\n\t\t\t)\n\t\t) );\n\t}", "function xrr_add_pages() {\r\n\tadd_options_page(\"Xavin's Review Ratings\", \"X Review Ratings\", 8, basename(__FILE__), 'xrr_options_page');\r\n}", "private function pages_settings_appearance() {\n\t\t$new_options[ 'pages_directory_wrapper_css_class' ] = array( 'default' => 'slp_pages_list' , 'allow_empty' => true );\n\t\t$new_options[ 'pages_directory_entry_css_class' ] = array( 'default' => 'slp_page location_details' , 'allow_empty' => true );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp-pages','section' => 'settings', 'group' => 'appearance' ) );\n\t}", "function SetupMultiPages() {\r\n\t\t$pages = new cSubPages();\r\n\t\t$pages->Add(0);\r\n\t\t$pages->Add(1);\r\n\t\t$pages->Add(2);\r\n\t\t$pages->Add(3);\r\n\t\t$this->MultiPages = $pages;\r\n\t}", "public function edd_cjs_constructed_settings_page() {\n\t\tglobal $constructed_active_tab;\n\t\t$constructed_active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'cesium-viewer'; ?>\n\n\t\t<h2 class=\"nav-tab-wrapper\">\n\t\t\t<?php\n\t\t\tdo_action( 'constructed_settings_tab' );\n\t\t\t?>\n\t\t</h2>\n\t\t<?php\n\t\tdo_action( 'constructed_settings_content' );\n\t}", "function _rex721_add_tab_option($params) {\n echo '<a href=\"#\" class=\"rex488_extra_settings_tab\" rel=\"social\" onclick=\"Rexblog.Article.ToggleExtraSettings(this, event);\">Social Links</a>&nbsp;|&nbsp;';\n}", "public function add_options_page() {\n\t\t$this->options_page = add_menu_page( $this->title, $this->title, 'manage_options', $this->key, array( $this, 'admin_page_display' ) );\n\t}", "public function add_options_page() {\n\t\t$this->options_page = add_menu_page( $this->title, $this->title, 'manage_options', $this->key, array( $this, 'admin_page_display' ) );\n\t}", "static function add_options_page()\n\t{\n\t\tif (apply_filters('social_connect_enable_options_page', false))\n\t\t{\n\t\t\tadd_options_page('Social Connect', 'Social Connect', 'manage_options', 'social-connect-id', array('SC_Admin','render_options') );\n\t\t}\n\t}", "protected function setCurrentPage(){\n\n if ($this->per_page == -1) return ;\n if( $this->hasInput('page') ){\n $this->page = $this->getInput('page');\n }\n }", "function wpdynabox_add_pages() {\n if (function_exists('add_options_page')) {\n add_options_page('WP-Dynabox', 'WP-Dynabox', 9, 'wp-dynabox.php', 'wpdynabox_options_page');\n }\n}", "public function setPage(int $page);" ]
[ "0.68593746", "0.670895", "0.66689885", "0.6598844", "0.65955156", "0.65629905", "0.6397068", "0.6233755", "0.6194784", "0.61806375", "0.6107782", "0.6106987", "0.60918826", "0.60863465", "0.6079749", "0.6008246", "0.60016656", "0.5985429", "0.5978608", "0.5972122", "0.5940663", "0.59364194", "0.59323597", "0.5920467", "0.591619", "0.591619", "0.5910517", "0.58984643", "0.5898444", "0.5874223" ]
0.7602226
0
Pages | Settings | Appearance
private function pages_settings_appearance() { $new_options[ 'pages_directory_wrapper_css_class' ] = array( 'default' => 'slp_pages_list' , 'allow_empty' => true ); $new_options[ 'pages_directory_entry_css_class' ] = array( 'default' => 'slp_page location_details' , 'allow_empty' => true ); $this->attach_to_slp( $new_options , array( 'page'=> 'slp-pages','section' => 'settings', 'group' => 'appearance' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function pages_tab() {\n\t\t$this->pages_settings_appearance();\n\t}", "function cricket_theme_settings_page(){\r\n}", "function niterbox_theme_settings_page() {\n}", "public function SA_theme_setting()\n {\n }", "function settings_page() {\n\t\techo '<div class=\"wrap\">';\n\t\techo sprintf(\"<h2>%s</h2>\", __('Menu List Settings', 'themeplate'));\n\t\t$this->settings_api->show_settings();\n\t\techo '</div>';\n\n\t}", "public function getSettingsPage();", "function settings_page() {\n\tadd_submenu_page(\n\t\t'options-general.php',\n\t\t'Fedora Embed',\n\t\t'Fedora Embed',\n\t\t'manage_options',\n\t\tFEM_PREFIX . 'settings_page',\n\t\t__NAMESPACE__ . '\\settings_page_html'\n\t);\n}", "static function get_settings(){\n\t\t\t\treturn array(\n\t\t\t\t\t'icon' => 'fa-newspaper-o',\n\t\t\t\t\t'title' => esc_html__('Blog', 'goodlayers-core')\n\t\t\t\t);\n\t\t\t}", "function settingsPage() {\n\t\t$slug = $this->slug;\n\t\t$callback = [ $this, 'settingsPageContent' ];\n\t\tadd_submenu_page( $this->file_name, 'REST Routes', 'REST Routes', 'manage_options', $slug, $callback );\n\t}", "function add_settings_page()\n\t{\n\t\tadd_submenu_page($parent_slug = 'edit.php?post_type=my_contest', $page_title = 'myContest Settings', $menu_title = 'Settings', $capability='manage_options', $menu_slug='my_contest_settings', $function = array($this,'settings_render'));\n\t}", "public static function _general_tab() {\n\t\t/**\n\t\t * @since 2.9.0\n\t\t */\n\t\t\\do_action( 'the_seo_framework_pre_page_inpost_general_tab' );\n\t\t\\the_seo_framework()->get_view( 'edit/seo-settings-singular', [], 'general' );\n\t\t/**\n\t\t * @since 2.9.0\n\t\t */\n\t\t\\do_action( 'the_seo_framework_pro_page_inpost_general_tab' );\n\t}", "function demotheme_settings() {\r\n register_taxonomy_for_object_type('post_tag', 'page'); \r\n // Add category metabox to page\r\n register_taxonomy_for_object_type('category', 'page'); \r\n}", "function foundationpress_add_option_pages() {\n\tif ( function_exists( 'acf_add_options_page' ) ) {\n\t\tacf_add_options_page(\n\t\t\t[\n\t\t\t\t'page_title' => 'Theme Einstellungen',\n\t\t\t\t'menu_title' => 'Theme Einstellungen',\n\t\t\t\t'menu_slug' => 'theme-settings',\n\t\t\t\t'redirect' => false,\n\t\t\t\t'autoload' => true,\n\t\t\t]\n\t\t);\n\t}\n}", "public function get_qual_settings_page()\n {\n \n }", "public function get_qual_settings_page()\n {\n \n }", "function themeprefix_add_options_pages() {\n if ( function_exists( 'acf_add_options_page' ) ) {\n \n acf_add_options_page(\n [\n 'page_title' => __( 'Site Settings', 'theme_domain' ),\n 'menu_slug' => 'site-settings',\n 'capability' => 'edit_posts',\n 'redirect' => false,\n ] \n );\n\n }\n}", "public function page_settings() {\n\n\t\tinclude( plugin_dir_path( __FILE__ ) . 'partials/nfl-teams-settings.php' );\n\n\t}", "function az_register_settings_page() {\n\treturn new AZ_SETTINGS_PAGE();\n}", "function acf_custom_menu_name( $settings )\n{\n $settings['title'] = 'Social Media';\n $settings['pages'] = array('Links');\n return $settings;\n}", "public function create_theme_options_page() {\n if ( function_exists( 'acf_add_options_page' ) ) {\n\n acf_add_options_page(\n array(\n 'page_title' => esc_html__( 'General Settings', 'init_theme_name' ),\n 'menu_title' => esc_html__( 'Theme Options' , 'init_theme_name' ),\n 'menu_slug' => $this->theme_options_general_slug,\n 'capability' => 'edit_theme_options',\n 'redirect' => false,\n 'icon_url' => 'dashicons-welcome-view-site',\n )\n );\n }\n }", "public function page_settings() {\n\t\t\tNetPay_Page_Settings::render();\n\t\t}", "function register_brokendoor_appearance_settingsfroms(){\n\tadd_settings_section('broken_door_media_appearance_options' ,\n\t\t'Front Page Settings ',\n\t\t'render_brokendor_appearance_settings_from_prompt' ,\n\t\t'theme-settings' );\n\n\tadd_settings_field('left_home_box_page' ,\n\t\t'Left Box' ,\n\t\t'render_leftbox_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\tadd_settings_field('right_home_box_page' ,\n\t\t'Right Box' ,\n\t\t'render_rightbox_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\tadd_settings_field('front_youtube_link' ,\n\t\t'Youtube Link for front page video' ,\n\t\t'render_youtube_link_input' ,\n\t\t'theme-settings' ,\n\t\t'broken_door_media_appearance_options');\n\n\t//this adds in some of those settings for them\n}", "function register_settings_page() {\r\n add_submenu_page('tools.php', $this->longname, $this->shortname.' API', 'manage_options', $this->hook.'-api', array($this, 'api_page'));\n add_options_page($this->longname, $this->shortname, 'manage_options', $this->hook, array($this, 'config_page'));\r\n }", "public function page_settings(){\n\t\t// get user roles\n\t\tglobal $wp_roles;\n\t\t$roles = $wp_roles->get_names();\n\t\t// remove administrator and subscriber\n\t\tunset( $roles['administrator'], $roles['subscriber'] );\n\t\t// get the plugin settings\n\t\t$settings = fa_get_options('settings');\t\n\t\t// get CodeFlavors license key details\n\t\t$license = fa_get_options('license');\t\n\t\t// get any available API keys\n\t\t$api_keys = fa_get_options('apis');\n\t\t// load the template\n\t\t$template = fa_template_path( 'settings' );\n\t\tinclude_once $template;\n\t}", "function cv_register_page_settings() {\n\n add_meta_box(\n THEME_SLUG . '_page_settings_meta_box',\n sprintf( __( '%s Page Settings', 'canvys' ), THEME_NAME ),\n 'cv_page_settings_meta_box',\n 'page',\n 'side',\n 'default'\n );\n\n add_meta_box(\n THEME_SLUG . '_meta_box',\n sprintf( __( '%s Page Settings', 'canvys' ), THEME_NAME ),\n 'cv_page_settings_meta_box',\n 'portfolio_item',\n 'side',\n 'default'\n );\n\n}", "function ssb_settings()\n{\n\tadd_options_page( \"FirstImpression\", \"FirstImpression\", 'administrator', 'firstimpression', 'ssb_admin_function');\n\t//this adds the page: parameters are: \"page title\", \"link title\", \"role\", \"slug\",\"function that shows the result\"\n}", "public function appearance() {\n \n // Check if the session exists and if the login user is admin\n $this->check_session($this->user_role, 1);\n \n // Get all options\n $options = $this->options->get_all_options();\n\n $this->content = [\n 'options' => $options\n ];\n \n // Get the appearance page\n $this->body = 'admin/appearance';\n $this->admin_layout();\n \n }", "function add_settings_page() {\nadd_menu_page( __( 'Theme Settings' ), __( 'Theme Settings' ), 'manage_options', 'settings', 'theme_settings_page');\n}", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}" ]
[ "0.73911077", "0.7077351", "0.6840672", "0.6697544", "0.6632368", "0.66022015", "0.6588367", "0.65808487", "0.65352535", "0.65321726", "0.6524297", "0.648209", "0.6477147", "0.64491665", "0.64491665", "0.6424881", "0.6423251", "0.6415804", "0.6407646", "0.6398074", "0.63528466", "0.63519853", "0.63483566", "0.633523", "0.6328055", "0.629154", "0.6285211", "0.6284637", "0.62660426", "0.62660426" ]
0.72644645
1
get product data and encode to be JSON object
function get_product_json() { header('Content-Type: application/json'); echo $this->crud_model->get_all_product(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getProductData(){\n\n $meta = Mage::getModel('favizone_recommender/meta_product');\n $store = Mage::app()->getStore();\n $product = Mage::registry('current_product');\n // Load the product model for this particular store view.\n $product = Mage::getModel('catalog/product')\n ->setStoreId($store->getId())\n ->load($product->getId());\n \n $favizone_product = $meta->loadProductData($product, $store, false);\n \n return json_encode($favizone_product);\n }", "public static function GetProductos(){\n $lista = ProductoDb::GetProductos();\n return json_encode($lista);\n }", "public function getProductData(Mage_Catalog_Model_Product $product)\n {\n try {\n $data = array('url' => $product->getProductUrl(),\n 'title' => htmlspecialchars($product->getName()),\n //'date' => '',\n 'spider' => 1,\n 'price' => $product->getPrice(),\n 'description' => urlencode($product->getDescription()),\n 'tags' => htmlspecialchars($product->getMetaKeyword()),\n 'images' => array(),\n 'vars' => array('sku' => $product->getSku(),\n 'storeId' => '',\n 'typeId' => $product->getTypeId(),\n 'status' => $product->getStatus(),\n 'categoryId' => $product->getCategoryId(),\n 'categoryIds' => $product->getCategoryIds(),\n 'websiteIds' => $product->getWebsiteIds(),\n 'storeIds' => $product->getStoreIds(),\n //'attributes' => $product->getAttributes(),\n 'groupPrice' => $product->getGroupPrice(),\n 'formatedPrice' => $product->getFormatedPrice(),\n 'calculatedFinalPrice' => $product->getCalculatedFinalPrice(),\n 'minimalPrice' => $product->getMinimalPrice(),\n 'specialPrice' => $product->getSpecialPrice(),\n 'specialFromDate' => $product->getSpecialFromDate(),\n 'specialToDate' => $product->getSpecialToDate(),\n 'relatedProductIds' => $product->getRelatedProductIds(),\n 'upSellProductIds' => $product->getUpSellProductIds(),\n 'getCrossSellProductIds' => $product->getCrossSellProductIds(),\n 'isSuperGroup' => $product->isSuperGroup(),\n 'isGrouped' => $product->isGrouped(),\n 'isConfigurable' => $product->isConfigurable(),\n 'isSuper' => $product->isSuper(),\n 'isSalable' => $product->isSalable(),\n 'isAvailable' => $product->isAvailable(),\n 'isVirtual' => $product->isVirtual(),\n 'isRecurring' => $product->isRecurring(),\n 'isInStock' => $product->isInStock(),\n 'weight' => $product->getSku()\n )\n );\n\n // Add product images\n if(self::validateProductImage($product->getImage())) {\n $data['images']['full'] = array (\"url\" => $product->getImageUrl());\n }\n\n if(self::validateProductImage($product->getSmallImage())) {\n $data['images']['smallImage'] = array(\"url\" => $product->getSmallImageUrl($width = 88, $height = 77));\n }\n\n if(self::validateProductImage($product->getThumbnail())) {\n $data['images']['thumb'] = array(\"url\" => $product->getThumbnailUrl($width = 75, $height = 75));\n }\n\n return $data;\n\n\n return $data;\n } catch(Exception $e) {\n Mage::logException($e);\n }\n\n }", "public function transform( Product $product ) {\n\t\treturn json_encode( [\n\t\t\t'title' => $this->getTitle( $product ),\n\t\t\t'size' => $this->getSize( $product ),\n\t\t\t'unit_price' => $this->getUnitPrice( $product ),\n\t\t\t'description' => $this->getDescription( $product ),\n\t\t] );\n\t}", "public function getProduct_list(){\n $profits=new Product_model;\n\t $data['data']=$profits->getProduct();\n $this->output\n ->set_content_type('application/json')\n ->set_output(json_encode($data));\n \n }", "public function info() {\n\t\t$productData = array(\t'id' \t\t\t=> $this->id,\n\t\t\t\t\t\t\t\t'sku' \t\t\t=> $this->sku,\n\t\t\t\t\t\t\t\t'name'\t\t\t=> $this->name,\n\t\t\t\t\t\t\t\t'image_url'\t\t=> $this->image_url,\n\t\t\t\t\t\t\t\t'product_url'\t=> $this->product_url,\n\t\t\t\t\t\t\t\t//Checks if product currently has special price\n\t\t\t\t\t\t\t\t'current_price' => ($this->current_price > $this->current_special & $this->current_special >0 ?$this->current_special: $this->current_price),\n\t\t\t\t\t\t\t\t'current_cost'\t=> $this->current_cost,\n\t\t\t\t\t\t\t\t'manufacturer'\t=> $this->manufacturer,\n\t\t\t\t\t\t\t\t'vendor'\t\t=> $this->vendor,\n\t\t\t\t\t\t\t\t'type'\t\t\t=> $this->type,\n\t\t\t\t\t\t\t\t'status'\t\t=> $this->status,\n\t\t\t\t\t\t\t\t'updated_at'\t=> $this->updated_at\n\n\t\t\t\t\t);\n\t\treturn $productData;\n\t}", "public function jsonSerialize()\n {\n $json = array();\n $json['product_id'] = $this->productId;\n $json['name'] = $this->name;\n $json['purchase_history'] = $this->purchaseHistory;\n $json['product_timestamps'] = $this->productTimestamps;\n $json['product_identifiers'] = $this->productIdentifiers;\n $json['product_details'] = $this->productDetails;\n\n return $json;\n }", "function getProductDetail()\r\n{\r\n\tglobal $DB, $objComm;\r\n\t$SQL = $SQL=\"SELECT \r\n\t\tproduct_type.product_type,\r\n\t\tproduct_type.id\tAS ptID,\t\r\n\t\tproduct.id AS pID,\r\n\t\tproduct.product_type_id,\r\n\t\tproduct.product_name,\r\n\t\tproduct.product_image,\r\n\t\tproduct.product_price,\r\n\t\tproduct.product_variations,\r\n\t\tproduct.product_size,\r\n\t\tproduct.product_color,\r\n\t\tSUBSTRING(product.product_desc,1,50) AS product_desc,\r\n\t\tDATE(product.product_date) AS product_date,\r\n\t\tproduct.product_status,\r\n\t\tproduct.product_total_products,\r\n\t\tproduct.product_remain_total_products\r\n\t\tFROM product_type \r\n\t\tJOIN product ON product_type.id=product.product_type_id\r\n\t\tWHERE product_status='Active' AND product.id='\".$_REQUEST[\"id\"].\"' AND product.product_remain_total_products > 0 ORDER BY product_type.id ASC\";\r\n\r\n\t\t$DATAproduct=$DB->fetchOne($SQL,\"\");\r\n\t\t$DATAproduct->status=\"OK\";$DATAproduct->msg=\"WELL DONE\";\r\n\techo json_encode($DATAproduct);\r\n}", "public function jsonSerialize()\n {\n return [\n 'id' => $this->id,\n 'name' => $this->name,\n 'price' => $this->price,\n 'category' => $this->category,\n 'description' => $this->description,\n 'attributes' => $this->productAttributes->getValues()\n ];\n }", "public function getProductData(Mage_Catalog_Model_Product $product)\n {\n try {\n\t\t\tif($product->getMsrpEnabled()==1){\n\t\t\t\t$price = \"\";\n\t\t\t}else if($product->getFinalPrice() < $product->getPrice()){\n\t\t\t\t$price = $product->getFinalPrice()*100;\n\t\t\t}else{\n\t\t\t\t$price = $product->getPrice()*100;\n\t\t\t} \t\n $data = array('url' => str_replace('index.php/','',str_replace('admin.','www.', $product->getProductUrl())),\n 'title' => htmlspecialchars($product->getName()),\n //'date' => '',\n 'key' => 'url',\n 'keys' => array('sku' => $product->getSku()),\n 'spider' => 1,\n 'price' => $price,\n 'description' => strip_tags($product->getDescription()),\n 'tags' => htmlspecialchars($this->getProductMetaKeyword($product->getId())),\n 'inventory' => $product->getStockItem() ? $product->getStockItem()->getStockQty() : 0,\n 'images' => array(),\n 'vars' => array('sku' => $product->getSku(),\n 'storeId' => '',\n 'typeId' => $product->getTypeId(),\n 'status' => $product->getStatus(),\n 'categoryId' => $product->getCategoryId(),\n 'categoryIds' => $product->getCategoryIds(),\n 'websiteIds' => $product->getWebsiteIds(),\n 'storeIds' => $product->getStoreIds(),\n //'attributes' => $product->getAttributes(),\n 'groupPrice' => $product->getGroupPrice(),\n 'formatedPrice' => $product->getFormatedPrice(),\n 'calculatedFinalPrice' => $product->getCalculatedFinalPrice(),\n 'minimalPrice' => $product->getMinimalPrice(),\n 'specialPrice' => $product->getSpecialPrice(),\n 'specialFromDate' => $product->getSpecialFromDate(),\n 'specialToDate' => $product->getSpecialToDate(),\n 'relatedProductIds' => $product->getRelatedProductIds(),\n 'upSellProductIds' => $product->getUpSellProductIds(),\n 'getCrossSellProductIds' => $product->getCrossSellProductIds(),\n 'isSuperGroup' => $product->isSuperGroup(),\n 'isGrouped' => $product->isGrouped(),\n 'isConfigurable' => $product->isConfigurable(),\n 'isSuper' => $product->isSuper(),\n 'isSalable' => $product->isSalable(),\n 'isAvailable' => $product->isAvailable(),\n 'isVirtual' => $product->isVirtual(),\n 'isRecurring' => $product->isRecurring(),\n 'isInStock' => $product->isInStock(),\n 'weight' => $product->getSku()\n )\n );\n\n // Add product images\n /* if(self::validateProductImage($product->getImage())) {\n $data['images']['full'] = array (\"url\" => $product->getImageUrl());\n }\n\n if(self::validateProductImage($product->getSmallImage())) {\n $data['images']['smallImage'] = array(\"url\" => $product->getSmallImageUrl($width = 88, $height = 77));\n }\n\n if(self::validateProductImage($product->getThumbnail())) {\n $data['images']['thumb'] = array(\"url\" => $product->getThumbnailUrl($width = 75, $height = 75));\n }*/\n if(self::validateProductImage($product->getImage())) {\n\t\t $pImage = $product->getImage();\n\t\t $pImageUrl = \"\";\n\t\t $pImageUrl = Mage::helper('sailthruemail')->getSailthruProductImage($pImage);\n\t\t if(empty($pImageUrl)){\n\t\t $pImageUrl = $product->getImageUrl();\n\t\t }\t\t \n $data['images']['full'] = array (\"url\" => str_replace('admin.','www.',$pImageUrl));\n }\n\n if(self::validateProductImage($product->getSmallImage())) {\n\t\t $pSmallImage \t= $product->getSmallImage();\n\t\t $pSmallImageUrl \t= \"\";\n\t\t $pSmallImageUrl = Mage::helper('sailthruemail')->getSailthruProductImage($pSmallImage,'300x300');\n\t\t if(empty($pSmallImageUrl)){\n\t\t $pSmallImageUrl= $product->getSmallImageUrl($width = 300, $height = 300);\n\t\t }\t\t \n $data['images']['smallImage'] = array(\"url\" => str_replace('admin.','www.',$pSmallImageUrl));\n }\n\n if(self::validateProductImage($product->getThumbnail())) {\n\t\t $pThumbnail \t= $product->getThumbnail();\n\t\t $pThumbnailUrl \t\t= \"\";\n\t\t $pThumbnailUrl \t= Mage::helper('sailthruemail')->getSailthruProductImage($pThumbnail,'300x300'); \t\n\t\t if(empty($pThumbnailUrl)){\n\t\t $pThumbnailUrl = $product->getThumbnailUrl($width = 300, $height = 300);\n\t\t } \t\n $data['images']['thumb'] = array(\"url\" => str_replace('admin.','www.',$pThumbnailUrl));\n }\n\n return $data;\n\n } catch(Exception $e) {\n Mage::logException($e);\n }\n\n }", "public function getProducts()\n {\n $objDb = new Db();\n $conn = $objDb->getDbConnection();\n $query = \"SELECT name_id AS productId, `name` AS productName, price, image_url AS productImage \n FROM products ORDER BY name ASC\";\n $statement = $conn->prepare($query);\n $statement->execute();\n $result = $statement->fetchAll(PDO::FETCH_ASSOC);\n // echo '<pre>';\n // print_r($result);\n $result = array(\n \"status\" => 200,\n \"order_id\" => null,\n \"type\" => \"products\",\n \"count\" => count($result),\n \"result\" => $result,\n );\n header(\"Content-Type: application/json\");\n return json_encode($result, JSON_UNESCAPED_SLASHES);\n //echo(json_encode($result));\n\n }", "public function json() {\n $json = parent::json();\n $json['pro_text'] = $this->pro_text;\n $json['pro_url'] = $this->pro_url;\n return $json;\n }", "public function getProductDetail(): JsonResponse\n {\n try {\n $productDetails = ProductDetail::all();\n\n return $this->jsonData($productDetails);\n } catch (\\Exception $e) {\n return $this->jsonError($e);\n }\n }", "public function getProducts()\n {\n $result = $this->productService->getProducts();\n return json_encode($result);\n }", "public function myproduct() {\n\t\t// header(\"Access-Control-Allow-Credentials: true\");\n\t\t// header(\"Access-Control-Allow-Origin: *\");\n\t\t// header(\"Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS\"); \n\t\t// header(\"Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization\");\n\t\t$this->autoRender = FALSE;\n\t\t$request_data = $this->request->data;\n\t\t$dataSource = $this->Machineproduct->getDataSource();\n\t\t$dataSource->begin();\n\t\tif($this->request->is('POST')) {\n\t\t\t try{\n\t\t\t\t$machine_info = $this->Machine->getmachineid( $request_data['machineid'] );\n\t\t\t\t$machine_id = $machine_info['Machine']['id'];\n\t\t\t\t$product_data = $this->Machineproduct->getproductinfobymcid($machine_id);\n\t\t\t\tif($product_data['Product']['Cost'] != ''){\n\t\t\t\t\t$cost = $product_data['Product']['Cost'];\n\t\t\t\t\t$string = str_replace('$', '', $cost); \n\t\t\t\t\tif(strpos($string,\".\") != ''){\n\t\t\t\t\t\t$prodcost = explode(\".\",$string);\n\t\t\t\t\t\t$dolar = $prodcost[0];\n\t\t\t\t\t\t$cent = $prodcost[1];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$dolar = $string;\n\t\t\t\t\t\t$cent = 00;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$this->out['MyProduct'] = $product_data['Product'];\t\n\t\t\t\t$this->out['MyProduct']['dolar'] = $dolar;\t\n\t\t\t\t$this->out['MyProduct']['cent'] = $cent;\t\t\t\n\t\t\t\t$this->message = TRUE;\n\t\t\t\t$this->code = 200;\n\t\t\t } catch(Exception $ex) {\n\t\t\t\t$dataSource->rollback();\n\t\t\t\t$this->message = $ex->getMessage();\n\t\t\t\t$this->code = $ex->getCode();\n\t\t\t }\n\t\t}\n\t\t$data = json_encode($this->out);\n\t\treturn $data; \n\t\t\n\t}", "public function getProductList()\n {\n $db = Database::getInstance();\n $db->query(\"SELECT * FROM Product\");\n return $db->resultsToJson();\n\n }", "function getData() {\t\t\n\t\tif(isset($_SESSION['pharmacyId'])) {\n\t\t\t$productModel = new ProductModel();\n\t\t\t$content = $productModel->grabAll($_SESSION['pharmacyId']);\n\t\t\t$data['products'] = $content;\n\t\t\t$data['counter'] = sizeof($content);\n\t\t\treturn $data;\n\t\t}\n\t}", "public function product_details(){\n\t\t$editpdata = $this->input->post('editpdata');\n\t\t$this->output\n\t\t\t->set_content_type('application/json')\n\t\t\t->set_output(json_encode(array('status' => 'success','prodetails' => $this->M_product->get_productdetails($editpdata) )));\n\t}", "function productsToJSON($products, $type) {\n echo \"<script>\";\n echo \"var product_array = []; \\n\"; //create product array\n switch ($type) {\n case 'Atlantean':\n foreach ($products as $product) {\n if ($product['collection'] == $type) {\n echo \"product_array.push(\" . json_encode($product) . \"); \\n\";\n }\n } \n break;\n case 'Mermaid':\n foreach ($products as $product) {\n if ($product['collection'] == $type) {\n echo \"product_array.push(\" . json_encode($product) . \"); \\n\";\n }\n }\n break;\n default:\n foreach ($products as $product) {\n if ($product['product_type_id'] == $type) {\n echo \"product_array.push(\" . json_encode($product) . \"); \\n\";\n }\n }\n }\n echo \"</script>\";\n}", "function IGV_get_product_data($product) {\n $attr_list = '';\n \n if ($product->get_attributes()) {\n $attributes = $product->get_attributes();\n foreach ($attributes as $attribute) {\n $attr_list .= '<li>' . $attribute['name'] . ' ' . $attribute['value'] . '</li>';\n }\n }\n\n $product_data = array(\n 'title' => $product->get_title(),\n 'id' => $product->id,\n 'url' => $product->get_permalink(),\n 'content' => apply_filters('the_content', $product->post->post_content),\n 'attributes' => $attr_list,\n 'price' => $product->get_price_html(),\n 'stock' => $product->is_in_stock(),\n 'availability' => $product->get_availability(),\n 'button_text' => $product->single_add_to_cart_text(),\n );\n\n return $product_data;\n}", "public function DBProductToArray($product) { \n if (!$product) return null;\n $p = $product->toArray();\n unset($p['id']);\n unset($p['brand_id']);\n unset($p['retailer_id']);\n unset($p['clothing_type_id']);\n unset($p['garment_detail']);\n unset($p['description']);\n unset($p['target']);\n \n $p['garment_name'] = $p['name']; unset($p['name']);\n $p['style'] = $p['control_number']; unset($p['control_number']);\n $p['fit_priority'] = json_decode($p['fit_priority']); \n $p['fabric_content'] = json_decode($p['fabric_content']); \n $p['neck_line'] = $p['neckline']; unset($p['neckline']);\n $p['layring'] = $p['layering']; unset($p['layering']);\n \n foreach ($product->getProductSizes() as $ps) {\n foreach ($ps->getProductSizeMeasurements() as $psm) {\n $p['sizes'][$ps->getTitle()][$psm->getTitle()] = $psm->toArray();\n unset($p['sizes'][$ps->getTitle()][$psm->getTitle()]['title']);\n $p['sizes'][$ps->getTitle()][$psm->getTitle()]['maximum_body_measurement'] = $p['sizes'][$ps->getTitle()][$psm->getTitle()]['max_body_measurement'];\n unset($p['sizes'][$ps->getTitle()][$psm->getTitle()]['max_body_measurement']);\n unset($p['sizes'][$ps->getTitle()][$psm->getTitle()]['horizontal_stretch']);\n unset($p['sizes'][$ps->getTitle()][$psm->getTitle()]['vertical_stretch']);\n unset($p['sizes'][$ps->getTitle()][$psm->getTitle()]['stretch_type_percentage']);\n $p['sizes'][$ps->getTitle()][$psm->getTitle()]['fit_model'] = $p['sizes'][$ps->getTitle()][$psm->getTitle()]['fit_model_measurement'];\n unset($p['sizes'][$ps->getTitle()][$psm->getTitle()]['fit_model_measurement']);\n\n \n unset($p['sizes'][$ps->getTitle()][$psm->getTitle()]['vertical_stretch']);\n }\n }\n \n $p['product_color']= array();\n foreach ($product->getProductColors() as $pc) {\n array_push($p['product_color'],$pc->getTitle());\n }\n $this->db_product=$p;\n return $p;\n }", "function listar_tradeproductsdetails() {\r\n $id_tradeproducts = $this->input->post('recn');\r\n $tradeproducts = $this->M_tradeproductsdetails->get_tradeproductsdetails_by_tradeproducts($id_tradeproducts);\r\n\r\n print_r(json_encode($tradeproducts));\r\n\r\n }", "public function getProducts(){\n\t\t\n\t\t$currentPage=$_POST['page'];\n\t\t$productData=$this->model->getProducts($currentPage);\n\t\techo json_encode($productData);\n\t}", "public function getProduct();", "public function getProductList()\n {\n $db = Database::getInstance();\n $db->query(\"SELECT * FROM Product WHERE fkidSupplier = ?\", array($this->_id));\n return $db->resultsToJson();\n\n }", "protected function _buildData(){\r\n\t\tforeach($this->_products as $product){\r\n\t\t\t$data\t=\tarray();\r\n\t\t\tforeach($this->_keyMappings as $key => $attribute){\r\n\t\t\t\t/**\r\n\t\t\t\t * Take specific action based on the product\r\n\t\t\t\t * attribute that is being dealt with.\r\n\t\t\t\t */\r\n\t\t\t\tswitch($key){\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * Product URL. Build full path based on Magento LINK url and product URL key\r\n\t\t\t\t\t */\r\n\t\t\t\t\tcase self::KEY_PRODUCT_URL:\r\n\t\t\t\t\t\t$data[$key]\t=\tMage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK).$product->getUrlPath();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * Product Image. Resize based on image type\r\n\t\t\t\t\t */\r\n\t\t\t\t\tcase self::KEY_IMAGE_URL:\r\n\t\t\t\t\t\ttry{\r\n\t\t\t\t\t\t\t$data[$key]\t=\tMage::helper('catalog/image')->init($product, $attribute)->resize(Mage::helper('ordergroove/config')->getDefaultImageDimensions($attribute))->__toString();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcatch(Exception $e){\r\n\t\t\t\t\t\t\t$data[$key]\t=\t'';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * All remaining fields set straight key value pair, with a 0 if no value is found\r\n\t\t\t\t\t */\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t$data[$key]\t= (string)($product->getData($attribute) ? str_replace('', '', $product->getData($attribute)) : 0);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * Add product data to the array\r\n\t\t\t */\r\n\t\t\t$this->_productData[$product->getSku()]\t=\t$data;\r\n\t\t}\r\n\t}", "public function listProducts() {\n $json = Storage::disk('local')->get('shopify.json');\n return json_decode($json, true);\n }", "function jsonSerialize()\n {\n return [\n '_id' => $this->_id,\n '_sku' => $this->_sku,\n '_name' => $this->_name,\n '_category' => $this->_category,\n '_cost' => $this->_cost,\n '_stock' => $this->_stock\n ];\n }", "private function generateProductJson($products)\n {\n\t// get the latest rev of the product\n\t$repository = $this->getDoctrine()\n\t ->getManager()\n\t\t\t ->getRepository('AchPoManagerBundle:Revision');\n\t$activeRev = $repository->findLatestActiveRev($products[0]->getPn());\n\tif($activeRev == null)\n\t{\n\t\t$rev = \"N/A\";\n\t}\n\telse\n\t{\n\t\t$rev = $activeRev->getRevisionCust();\n\t}\n\n\t$jsonTable = array(\"PN\" => $products[0]->getPn(), \"SKPN\" => $products[0]->getCustPn(), \"DESC\" => $products[0]->getDescription(), \"PRICE\" => $products[0]->getPrice()->getPrice(), \"CURRENCY\" => $products[0]->getPrice()->getCurrency()->getTLA(), \"REV\" => $rev);\n\t$response = new JsonResponse();\n\t$response->setData($jsonTable);\n\treturn $response;\n }", "public function transform($product) {\n\t\t$data = [\n 'id' \t\t => $product->id,\n 'name' \t\t => $product->name,\n 'unit' \t\t => $product->unit,\n 'unit_cost' => $this->getUnitCost($product),\n 'code' \t\t => $product->code,\n 'description' => $product->description,\n 'selling_price' => $this->getSellingPrice($product),\n 'conversion_size' => $product->conversion_size,\n ];\n\n return $data;\n\t}" ]
[ "0.765199", "0.72756565", "0.72548753", "0.71261156", "0.7009761", "0.69626343", "0.69236803", "0.68922114", "0.68497527", "0.68274736", "0.68246716", "0.6810827", "0.6808942", "0.67811674", "0.6749724", "0.6739409", "0.67314774", "0.67221457", "0.6684255", "0.66798514", "0.6634374", "0.66257745", "0.66206884", "0.6613739", "0.65567577", "0.65515304", "0.65276843", "0.6524768", "0.6518961", "0.6515661" ]
0.79589725
0
The Omeka_Navigaton object Initializes the form. Loads the navigation object from the saved main navigation object.
public function init() { parent::init(); $this->setAttrib('id', self::FORM_ELEMENT_ID); $this->_nav = new Omeka_Navigation(); $this->_nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME); $this->_nav->addPagesFromFilter(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_FILTER_NAME); $this->_initElements(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _saveNavigationFromPost()\n {\n $nav = $this->_getNavigationFromPost();\n $nav->saveAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);\n $this->_nav = $nav;\n }", "public function loadNavigations(): self\n {\n // Get info file path\n $infoFilePath = $this->getPath('info.php');\n\n // Fetch info data\n $info = $this->fetchInfoFile($infoFilePath);\n\n if (is_array($info)) {\n $navigations = NavigationModel::repo()->where('navigation_id', '!=', 1)->fetchAll();\n $index = 0;\n foreach ($navigations as $navigation) {\n if (isset($info['navigations'][$index][0]) && isset($info['navigations'][$index][1])) {\n $navigation->navigation_key = $info['navigations'][$index][0];\n $navigation->title = $info['navigations'][$index][1];\n $navigation->validate();\n $navigation->save();\n } else {\n $navigation->delete();\n }\n ++$index;\n }\n\n $numberOfNavigations = count($info['navigations']);\n for ($index; $index <= $numberOfNavigations; ++$index) {\n if (isset($info['navigations'][$index][0]) && isset($info['navigations'][$index][1])) {\n NavigationModel::create([\n 'navigation_key' => $info['navigations'][$index][0],\n 'title' => $info['navigations'][$index][1],\n ])->save();\n }\n }\n }\n\n return $this;\n }", "function __construct() {\n\n\t\tparent::__construct(get_class());\n\n\n\t\t$this->db = UT_NAV; //SITE_DB.\".navigation\";\n\t\t$this->db_nodes = UT_NAV_NODES; // SITE_DB.\".navigation_nodes\";\n\t\t$this->level_iterator = 0;\n\n\n\t\t// Name\n\t\t$this->addToModel(\"name\", array(\n\t\t\t\"type\" => \"string\",\n\t\t\t\"label\" => \"Navigation name\",\n\t\t\t\"required\" => true,\n\t\t\t\"hint_message\" => \"Give your navigation link list a name - this will only be displayed in the backend\", \n\t\t\t\"error_message\" => \"Name must be filled out\"\n\t\t));\n\n\n\t\t// node_name\n\t\t$this->addToModel(\"node_name\", array(\n\t\t\t\"type\" => \"string\",\n\t\t\t\"label\" => \"Navigation node name\",\n\t\t\t\"required\" => true,\n\t\t\t\"hint_message\" => \"This is the name used to display the node in the link list\",\n\t\t\t\"error_message\" => \"A navigation node must have a name\"\n\t\t));\n\n\t\t// node_link\n\t\t$this->addToModel(\"node_link\", array(\n\t\t\t\"type\" => \"string\",\n\t\t\t\"label\" => \"Static link\",\n\t\t\t\"hint_message\" => \"Type absolute url, starting with / or http://\",\n\t\t\t\"error_message\" => \"\"\n\t\t));\n\n\t\t// node_page_id\n\t\t$this->addToModel(\"node_item_id\", array(\n\t\t\t\"type\" => \"integer\",\n\t\t\t\"label\" => \"Page\",\n\t\t\t\"hint_message\" => \"Select an existing page as link for this node\",\n\t\t\t\"error_message\" => \"\"\n\t\t));\n\t\t// node_page_controller\n\t\t$this->addToModel(\"node_item_controller\", array(\n\t\t\t\"type\" => \"string\",\n\t\t\t\"label\" => \"Controller\",\n\t\t\t\"hint_message\" => \"Select an existing controller to render this page\",\n\t\t\t\"error_message\" => \"\"\n\t\t));\n\n\t\t// node_classname\n\t\t$this->addToModel(\"node_classname\", array(\n\t\t\t\"type\" => \"string\",\n\t\t\t\"label\" => \"Node classname\",\n\t\t\t\"hint_message\" => \"Add a classname to this node\",\n\t\t\t\"error_message\" => \"\"\n\t\t));\n\t\t// node_target\n\t\t$this->addToModel(\"node_target\", array(\n\t\t\t\"type\" => \"string\",\n\t\t\t\"label\" => \"Open link in new window\",\n\t\t\t\"hint_message\" => \"Add a target to this link\",\n\t\t\t\"error_message\" => \"\"\n\t\t));\n\t\t// node_fallback\n\t\t$this->addToModel(\"node_fallback\", array(\n\t\t\t\"type\" => \"string\",\n\t\t\t\"label\" => \"Fallback url\",\n\t\t\t\"hint_message\" => \"You can provide a fallback link, in case the end user does not have access to the given page. Leave empty to hide link for unautorized users.\",\n\t\t\t\"error_message\" => \"\"\n\t\t));\n\n\n\t}", "protected function _initNavigation() {\n //pro tenhle layout\n $this->bootstrap('layout');\n //ziskame si layout\n $layout = $this->getResource('layout');\n //ziskame si viewu\n $view = $layout->getView();\n //vytvorime si nas config ze souboru\n $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');\n //vytvroime novou navigaci z daneho konfiguraku\n $navigation = new Zend_Navigation($config);\n //nastavime ho do viewu\n $view->navigation($navigation);\n }", "protected function _getNavigationFromPost()\n {\n $nav = new Omeka_Navigation();\n $nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);\n $pageUids = array();\n if ($pageLinks = $this->getValue(self::HIDDEN_ELEMENT_ID)) {\n if ($pageLinks = json_decode($pageLinks, true)) {\n // add and update the pages in the navigation\n $pageOrder = 0;\n $pages = array();\n $parentPageIds = array();\n $pageIdsToPageUids = array();\n foreach ($pageLinks as $pageLink) {\n $pageOrder++;\n // add or update the page in the navigation\n $pageUid = $nav->createPageUid($pageLink['uri']);\n if (!($page = $nav->getPageByUid($pageUid))) {\n $page = new Omeka_Navigation_Page_Uri();\n $page->setHref($pageLink['uri']); // this sets both the uri and the fragment\n $page->set('uid', $pageUid);\n }\n $page->setLabel($pageLink['label']);\n $page->set('can_delete', (bool) $pageLink['can_delete']);\n $page->setVisible($pageLink['visible']);\n $page->setOrder($pageOrder);\n $parentPageIds[] = $pageLink['parent_id'];\n $pageUids[] = $page->uid;\n $pages[] = $page;\n $pageIdsToPageUids[strval($pageLink['id'])] = $page->uid;\n }\n\n // structure the parent/child relationships\n // this assumes that the $pages are in a flattened hierarchical order\n for ($i = 0; $i < $pageOrder; $i++) {\n $page = $pages[$i];\n $page->removePages(); // remove old children pages\n $parentPageId = $parentPageIds[$i];\n if ($parentPageId === null\n || !array_key_exists($parentPageId, $pageIdsToPageUids)\n ) {\n // add a page that lacks a parent\n $nav->addPage($page);\n } else {\n // add a child page to its parent page\n // we assume that all parents already exist in the navigation\n $parentPageUid = $pageIdsToPageUids[$parentPageId];\n if (!($parentPage = $nav->getPageByUid($parentPageUid))) {\n throw new RuntimeException(__(\"Cannot find parent navigation page.\"));\n } else {\n $parentPage->addPage($page);\n }\n }\n }\n }\n }\n // prune the remaining expired pages from navigation\n $otherPages = $nav->getOtherPages($pageUids);\n $expiredPages = array();\n foreach ($otherPages as $otherPage) {\n $nav->prunePage($otherPage);\n }\n return $nav;\n }", "public function __construct()\n {\n\n $this->entityName = Navigation::NAVIGATION_ENTITY_NAME;\n $this->modelClass = \"\\Navigations\\Model\\Navigation\";\n $this->dataItem = Navigation::NAVIGATION_DATA_ENTITY;\n }", "private function loadForm($name, $nav, $parent = null) {\n if (!isset($nav['type'])) $nav['type'] = 'form';\n $name = $this->loadNavigationItem($name, $nav, $parent);\n \n // Load tabs\n if (isset($nav['tabs']) AND count($nav['tabs'] > 0)) {\n foreach($nav['tabs'] as $tab_name => $tab_nav) {\n $tab_name = $this->loadTab($tab_name, $tab_nav, $name);\n $this->navigation[$name]['tabs'][] = $tab_name;\n }\n }\n \n // Load add button\n if (isset($nav['button_add'])) {\n $nav['button_add']['type'] = 'button_add';\n $button_add_name = $this->loadNavigationItem('button_add', $nav['button_add'], $name);\n $this->navigation[$name]['button_add'] = $button_add_name;\n }\n \n // Load delete button\n if (isset($nav['button_delete'])) {\n $nav['button_delete']['type'] = 'button_delete';\n $button_add_name = $this->loadNavigationItem('button_delete', $nav['button_delete'], $name);\n $this->navigation[$name]['button_delete'] = $button_add_name;\n }\n \n // Load menu actions\n if (isset($nav['menu_actions']) AND count($nav['menu_actions'] > 0)) {\n foreach($nav['menu_actions'] as $menu_action_name => $menu_action_nav) {\n $menu_action_name = $this->loadMenu('menu_action', $menu_action_name, $menu_action_nav, $name);\n $this->navigation[$name]['menu_actions'][] = $menu_action_name;\n }\n }\n \n // Load menu reports\n if (isset($nav['menu_reports']) AND count($nav['menu_reports'] > 0)) {\n foreach($nav['menu_reports'] as $menu_report_name => $menu_report_nav) {\n $menu_report_name = $this->loadMenu('menu_report', $menu_report_name, $menu_report_nav, $name);\n $this->navigation[$name]['menu_reports'][] = $menu_report_name;\n }\n }\n \n return $name;\n }", "protected function _initNavigation(){\n\t\n\t\t$this->bootstrap('layout');\n\t\n\t\t$layout = $this->getResource('layout');\n\t\t$view = $layout->getView();\n\t\t$config = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml', 'nav');\n\t\n\t\t$navigation = new Zend_Navigation($config);\n\t\t$view->navigation($navigation)\n\t\t->menu()\n\t\t->setMinDepth(1)\n\t\t->setUlClass('nav nav-pills')\n\t\t->setAcl(Zend_Registry::get('Zend_Acl'))\n\t\t->setRole(App_User::getProfileId());\n\t}", "public function __construct()\n {\n $this-> navigationItems=[\n ['label'=>'About','href'=>'#about'],\n ['label'=>'Projects','href'=>'#portfolio'],\n ['label'=>'Tutorials','href'=>'#tutorials'],\n ['label'=>'Contact','href'=>'#contact'],\n ];\n }", "public function init() {\n $this->view->assign('classActive', 'biblioteca');\n /*\n * Mensagem para o formulário\n */\n $this->view->menssagens = $this->_helper->flashMessenger->getMessages();\n /*\n * Monta o menu principal\n */\n $this->_helper->actionStack('navigator', 'Menu');\n }", "public function form() {\n $form = new Form(Utils::getUrl(array('manage', 'navigation', 'itemedit')));\n $form->ajax(\".content\");\n $form->disableAuto();\n $form->hidden(\"additional-form-url\", Utils::getUrl(array('api', 'edit-navigation-item-additional-form')));\n $form->hidden(\"event\", $this->events[0]);\n $form->hidden(\"item_id\", $this->item['id']);\n $form->input(\"new_name\", \"new_name\", i('Item name'), 'input', $this->item['name']);\n\n $items = $this->getItems();\n $form->select(array(\n \"key\" => 'item',\n \"label\" => i('Select item'),\n \"values\" => $this->getItems(),\n 'chosen' => true\n ), $this->item['item_type'].'##'.$this->item['item_id']);\n\n $items = $this->getNavigationItems($this->navigation);\n $items[\"0\"] = i('No Parent');\n asort($items);\n\n $form->select(array(\n \"key\" => 'parent',\n \"label\" => i('Select a parent item'),\n \"values\" => $items\n ), $this->item['parent']);\n\n $form->input('directlink', 'directlink', i('Set a direct link', 'core'), 'text', $this->item['direct'], i('If this value is set, the other settings will be ignored', 'core'));\n\n $form->submit(i('Save changes'));\n return $form->render();\n }", "function Page_Main() {\r\n\t\tglobal $objForm, $Language, $gsFormError;\r\n\t\tglobal $gbSkipHeaderFooter;\r\n\r\n\t\t// Check modal\r\n\t\t$this->IsModal = (@$_GET[\"modal\"] == \"1\" || @$_POST[\"modal\"] == \"1\");\r\n\t\tif ($this->IsModal)\r\n\t\t\t$gbSkipHeaderFooter = TRUE;\r\n\r\n\t\t// Process form if post back\r\n\t\tif (@$_POST[\"a_add\"] <> \"\") {\r\n\t\t\t$this->CurrentAction = $_POST[\"a_add\"]; // Get form action\r\n\t\t\t$this->CopyRecord = $this->LoadOldRecord(); // Load old recordset\r\n\t\t\t$this->LoadFormValues(); // Load form values\r\n\t\t} else { // Not post back\r\n\r\n\t\t\t// Load key values from QueryString\r\n\t\t\t$this->CopyRecord = TRUE;\r\n\t\t\tif (@$_GET[\"NroPedido\"] != \"\") {\r\n\t\t\t\t$this->NroPedido->setQueryStringValue($_GET[\"NroPedido\"]);\r\n\t\t\t\t$this->setKey(\"NroPedido\", $this->NroPedido->CurrentValue); // Set up key\r\n\t\t\t} else {\r\n\t\t\t\t$this->setKey(\"NroPedido\", \"\"); // Clear key\r\n\t\t\t\t$this->CopyRecord = FALSE;\r\n\t\t\t}\r\n\t\t\tif ($this->CopyRecord) {\r\n\t\t\t\t$this->CurrentAction = \"C\"; // Copy record\r\n\t\t\t} else {\r\n\t\t\t\t$this->CurrentAction = \"I\"; // Display blank record\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Set up Breadcrumb\r\n\t\t$this->SetupBreadcrumb();\r\n\r\n\t\t// Validate form if post back\r\n\t\tif (@$_POST[\"a_add\"] <> \"\") {\r\n\t\t\tif (!$this->ValidateForm()) {\r\n\t\t\t\t$this->CurrentAction = \"I\"; // Form error, reset action\r\n\t\t\t\t$this->EventCancelled = TRUE; // Event cancelled\r\n\t\t\t\t$this->RestoreFormValues(); // Restore form values\r\n\t\t\t\t$this->setFailureMessage($gsFormError);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif ($this->CurrentAction == \"I\") // Load default values for blank record\r\n\t\t\t\t$this->LoadDefaultValues();\r\n\t\t}\r\n\r\n\t\t// Perform action based on action code\r\n\t\tswitch ($this->CurrentAction) {\r\n\t\t\tcase \"I\": // Blank record, no action required\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"C\": // Copy an existing record\r\n\t\t\t\tif (!$this->LoadRow()) { // Load record based on key\r\n\t\t\t\t\tif ($this->getFailureMessage() == \"\") $this->setFailureMessage($Language->Phrase(\"NoRecord\")); // No record found\r\n\t\t\t\t\t$this->Page_Terminate(\"paquetes_provisionlist.php\"); // No matching record, return to list\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"A\": // Add new record\r\n\t\t\t\t$this->SendEmail = TRUE; // Send email on add success\r\n\t\t\t\tif ($this->AddRow($this->OldRecordset)) { // Add successful\r\n\t\t\t\t\tif ($this->getSuccessMessage() == \"\")\r\n\t\t\t\t\t\t$this->setSuccessMessage($Language->Phrase(\"AddSuccess\")); // Set up success message\r\n\t\t\t\t\t$sReturnUrl = $this->getReturnUrl();\r\n\t\t\t\t\tif (ew_GetPageName($sReturnUrl) == \"paquetes_provisionlist.php\")\r\n\t\t\t\t\t\t$sReturnUrl = $this->AddMasterUrl($sReturnUrl); // List page, return to list page with correct master key if necessary\r\n\t\t\t\t\telseif (ew_GetPageName($sReturnUrl) == \"paquetes_provisionview.php\")\r\n\t\t\t\t\t\t$sReturnUrl = $this->GetViewUrl(); // View page, return to view page with keyurl directly\r\n\t\t\t\t\t$this->Page_Terminate($sReturnUrl); // Clean up and return\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$this->EventCancelled = TRUE; // Event cancelled\r\n\t\t\t\t\t$this->RestoreFormValues(); // Add failed, restore form values\r\n\t\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Render row based on row type\r\n\t\t$this->RowType = EW_ROWTYPE_ADD; // Render add type\r\n\r\n\t\t// Render row\r\n\t\t$this->ResetAttrs();\r\n\t\t$this->RenderRow();\r\n\t}", "function __construct() {\n\t\tparent::__construct();\n\n\t\t// load our proper pages etc\n\t\t$this->load->model(array(\"pages/elements\", \"pages/navigation\"));\n\n\t}", "function getNavigationObject(){\r\n return Zend_Registry::get('Navigation');\r\n}", "public function __construct() {\n\t\t$this->name = 'nav_menu';\n\t\t$this->label = __( 'Nav Menu' );\n\t\t$this->category = 'relational';\n\t\t$this->defaults = array(\n\t\t\t'save_format' => 'id',\n\t\t\t'allow_null' => 0,\n\t\t\t'container' => 'div',\n\t\t);\n\t\tparent::__construct();\n\t}", "function __construct() {\n\t\t$this->SelectedHead = \"\";\n\t\t$this->SelectedMenuItem = 0;\n\t\t$this->Position = 0;\n\t\t$this->NameArray = array();\n\t\t$this->URLArray = array();\n\t\t$this->ChildrenArray = array(array());\n\t\t$this->IsHeadArray = array();\n\t\t$this->ParentArray = array();\n\t\t$this->Content = \"\";\n\t\t$this->LoadMenus();\n\n\t}", "function init()\t{\n\t\tglobal $BE_USER,$BACK_PATH,$LANG;\n\n\t\t// Main GPvars:\n\t\t$this->pointer = t3lib_div::_GP('pointer');\n\t\t$this->bparams = t3lib_div::_GP('bparams');\n\t\t$this->P = t3lib_div::_GP('P');\n\t\t$this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');\n\t\t$this->expandPage = t3lib_div::_GP('expandPage');\n\t\t$this->expandFolder = t3lib_div::_GP('expandFolder');\n\t\t$this->PM = t3lib_div::_GP('PM');\n\t\t$this->contentTypo3Language = t3lib_div::_GP('typo3ContentLanguage');\n\t\t$this->contentTypo3Charset = t3lib_div::_GP('typo3ContentCharset');\n\t\t$this->editorNo = t3lib_div::_GP('editorNo');\n\n\t\t\t// Find \"mode\"\n\t\t$this->mode=t3lib_div::_GP('mode');\n\t\tif (!$this->mode)\t{\n\t\t\t$this->mode='rte';\n\t\t}\n\n\t\t//init hookObjectArray:\n\t\tif (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['browseLinksHook'])) {\n\t\t\tforeach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['browseLinksHook'] as $_classData) {\n\t\t\t\t\t\t$_procObj = & t3lib_div::getUserObj($_classData);\n\t\t\t\t\t\t$_procObj->init($this,array());\n\t\t\t\t\t\t$this->hookObjectsArr[]=$_procObj;\n\t\t\t\t\t}\n\t\t}\n\n\t\t\t// Site URL\n\t\t$this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');\t// Current site url\n\n\t\t\t// the script to link to\n\t\t$this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');\n\n\t\t\t// CurrentUrl - the current link url must be passed around if it exists\n\t\tif ($this->mode=='wizard')\t{\n\t\t\t$currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);\n\t\t\t$this->curUrlArray = array(\n\t\t\t\t'target' => $currentLinkParts[1]\n\t\t\t);\n\t\t\t$this->curUrlInfo=$this->parseCurUrl($this->siteURL.'?id='.$currentLinkParts[0],$this->siteURL);\n\t\t} else {\n\t\t\t$this->curUrlArray = t3lib_div::_GP('curUrl');\n\t\t\tif ($this->curUrlArray['all'])\t{\n\t\t\t\t$this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);\n\t\t\t}\n\t\t\t$this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);\n\t\t}\n\n\n\t\t\t// Determine nature of current url:\n\t\t$this->act=t3lib_div::_GP('act');\n\n\t\tif (!$this->act)\t{\n\t\t\t$this->act=$this->curUrlInfo['act'];\n\t\t}\n\n\t\t\t// Initializing the titlevalue\n\t\t$this->setTitle = $LANG->csConvObj->conv($this->curUrlArray['title'], 'utf-8', $LANG->charSet);\n\n\t\t\t// Rich Text Editor specific configuration:\n\t\t$addPassOnParams='';\n\t\tif ((string)$this->mode=='rte')\t{\n\t\t\t$RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);\n\t\t\t$addPassOnParams .= '&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);\n\t\t\t$addPassOnParams .= ($this->contentTypo3Language ? '&typo3ContentLanguage=' . rawurlencode($this->contentTypo3Language) : '');\n\t\t\t$addPassOnParams .= ($this->contentTypo3Charset ? '&typo3ContentCharset=' . rawurlencode($this->contentTypo3Charset) : '');\n\t\t\t$RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));\n\t\t\t$this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);\n\t\t\tif (is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['link.'])) {\n\t\t\t\t$this->buttonConfig = $this->thisConfig['buttons.']['link.'];\n\t\t\t}\n\t\t\tif($this->thisConfig['classesAnchor']) {\n\t\t\t\t$this->setClass = $this->curUrlArray['class'];\n\t\t\t\t$classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesAnchor'],1);\n\t\t\t\t$anchorTypes = array( 'page', 'url', 'file', 'mail', 'spec');\n\t\t\t\t$classesAnchor = array();\n\t\t\t\t$classesAnchorDefault = array();\n\t\t\t\t$this->classesAnchorDefaultTitle = array();\n\t\t\t\t$classesAnchor['all'] = array();\n\t\t\t\tif (is_array($RTEsetup['properties']['classesAnchor.'])) {\n\t\t\t\t\treset($RTEsetup['properties']['classesAnchor.']);\n\t\t\t\t\twhile(list($label,$conf)=each($RTEsetup['properties']['classesAnchor.'])) {\n\t\t\t\t\t\t$classesAnchor['all'][] = $conf['class'];\n\t\t\t\t\t\tif (in_array($conf['type'], $anchorTypes)) {\n\t\t\t\t\t\t\t$classesAnchor[$conf['type']][] = $conf['class'];\n\t\t\t\t\t\t\tif (is_array($this->thisConfig['classesAnchor.']) && is_array($this->thisConfig['classesAnchor.']['default.']) && $this->thisConfig['classesAnchor.']['default.'][$conf['type']] == $conf['class']) {\n\t\t\t\t\t\t\t\t$classesAnchorDefault[$conf['type']] = $conf['class'];\n\t\t\t\t\t\t\t\tif ($conf['titleText']) {\n\t\t\t\t\t\t\t\t\t$string = trim($conf['titleText']);\n\t\t\t\t\t\t\t\t\tif (substr($string,0,4)=='LLL:') { // language file\n\t\t\t\t\t\t\t\t\t\t$arr = explode(':',$string);\n\t\t\t\t\t\t\t\t\t\tif($arr[0] == 'LLL' && $arr[1] == 'EXT') {\n\t\t\t\t\t\t\t\t\t\t\t$BE_lang = $LANG->lang;\n\t\t\t\t\t\t\t\t\t\t\t$BE_origCharset = $LANG->origCharSet;\n\t\t\t\t\t\t\t\t\t\t\t$LANG->lang = $this->contentTypo3Language;\n\t\t\t\t\t\t\t\t\t\t\t$LANG->origCharSet = $LANG->csConvObj->charSetArray[$this->contentTypo3Language];\n\t\t\t\t\t\t\t\t\t\t\t$LANG->origCharSet = $LANG->origCharSet ? $LANG->origCharSet : 'iso-8859-1';\n\t\t\t\t\t\t\t\t\t\t\t$string = $LANG->getLLL($arr[3], $LANG->readLLfile($arr[1].':'.$arr[2]), true);\n\t\t\t\t\t\t\t\t\t\t\t$LANG->lang = $BE_lang;\n\t\t\t\t\t\t\t\t\t\t\t$LANG->origCharSet = $BE_origCharset;\n\t\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\t$this->classesAnchorDefaultTitle[$conf['type']] = $string;\n\t\t\t\t\t\t\t\t}\n\t\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\t$this->classesAnchorJSOptions = array();\n\t\t\t\treset($anchorTypes);\n\t\t\t\twhile (list(, $anchorType) = each($anchorTypes) ) {\n\t\t\t\t\treset($classesAnchorArray);\n\t\t\t\t\twhile(list(,$class)=each($classesAnchorArray)) {\n\t\t\t\t\t\tif (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {\n\t\t\t\t\t\t\t$selected = '';\n\t\t\t\t\t\t\tif ($this->setClass == $class) $selected = 'selected=\"selected\"';\n\t\t\t\t\t\t\tif (!$this->setClass && $classesAnchorDefault[$anchorType] == $class) {\n\t\t\t\t\t\t\t\t$selected = 'selected=\"selected\"';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$this->classesAnchorJSOptions[$anchorType] .= '<option ' . $selected . ' value=\"' .$class . '\">' . $class . '</option>';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ($this->classesAnchorJSOptions[$anchorType]) {\n\t\t\t\t\t\t$selected = '';\n\t\t\t\t\t\tif (!$this->setClass && !$classesAnchorDefault[$anchorType]) $selected = 'selected=\"selected\"';\n\t\t\t\t\t\t$this->classesAnchorJSOptions[$anchorType] = '<option ' . $selected . ' value=\"\"></option>' . $this->classesAnchorJSOptions[$anchorType];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t\t// Initializing the target value (RTE)\n\t\t$this->setTarget = $this->curUrlArray['target'];\n\t\tif ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target']))\t{\n\t\t\t$this->setTarget=$this->thisConfig['defaultLinkTarget'];\n\t\t}\n\n\t\t\t// Creating backend template object:\n\t\t$this->doc = t3lib_div::makeInstance('template');\n\t\t$this->doc->docType= 'xhtml_trans';\n\t\t$this->doc->backPath = $BACK_PATH;\n\n\t\t\t// BEGIN accumulation of header JavaScript:\n\t\t$JScode = '';\n\t\t$JScode.= '\n\t\t\tif (window.opener) {\n\t\t\t\tvar editor = window.opener.RTEarea[' . $this->editorNo . '][\"editor\"];\n\t\t\t\tvar HTMLArea = window.opener.HTMLArea;\n\t\t\t}\n\t\t\t\t// This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...\n\t\t\tvar add_href=\"'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'\";\n\t\t\tvar add_target=\"'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'\";\n\t\t\tvar add_class=\"'.($this->setClass?'&curUrl[class]='.rawurlencode($this->setClass):'').'\";\n\t\t\tvar add_title=\"'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'\";\n\t\t\tvar add_params=\"'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'\";\n\n\t\t\tvar cur_href=\"'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'\";\n\t\t\tvar cur_target=\"'.($this->setTarget?$this->setTarget:'').'\";\n\t\t\tvar cur_class=\"'.($this->setClass?$this->setClass:'').'\";\n\t\t\tvar cur_title=\"'.($this->setTitle?$this->setTitle:'').'\";\n\n\t\t\tfunction setTarget(value)\t{\n\t\t\t\tcur_target=value;\n\t\t\t\tadd_target=\"&curUrl[target]=\"+encodeURIComponent(value);\n\t\t\t}\n\t\t\tfunction setClass(value)\t{\n\t\t\t\tcur_class=value;\n\t\t\t\tadd_class=\"&curUrl[class]=\"+encodeURIComponent(value);\n\t\t\t}\n\t\t\tfunction setTitle(value)\t{\n\t\t\t\tcur_title=value;\n\t\t\t\tadd_title=\"&curUrl[title]=\"+encodeURIComponent(value);\n\t\t\t}\n\t\t\tfunction setValue(value)\t{\n\t\t\t\tcur_href=value;\n\t\t\t\tadd_href=\"&curUrl[href]=\"+value;\n\t\t\t}\n';\n\n\t\tif ($this->mode=='wizard')\t{\t// Functions used, if the link selector is in wizard mode (= TCEforms fields)\n\t\t\tunset($this->P['fieldChangeFunc']['alert']);\n\t\t\treset($this->P['fieldChangeFunc']);\n\t\t\t$update='';\n\t\t\twhile(list($k,$v)=each($this->P['fieldChangeFunc']))\t{\n\n\t\t\t\t$update.= '\n\t\t\t\twindow.opener.'.$v;\n\t\t\t}\n\n\t\t\t$P2=array();\n\t\t\t$P2['itemName']=$this->P['itemName'];\n\t\t\t$P2['formName']=$this->P['formName'];\n\t\t\t$P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];\n\t\t\t$addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);\n\n\t\t\t$JScode.='\n\t\t\t\tfunction link_typo3Page(id,anchor)\t{\t//\n\t\t\t\t\tupdateValueInMainForm(id+(anchor?anchor:\"\")+\" \"+cur_target);\n\t\t\t\t\tclose();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tfunction link_folder(folder)\t{\t//\n\t\t\t\t\tupdateValueInMainForm(folder+\" \"+cur_target);\n\t\t\t\t\tclose();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tfunction link_current()\t{\t//\n\t\t\t\t\tif (cur_href!=\"http://\" && cur_href!=\"mailto:\")\t{\n\t\t\t\t\t\tvar setValue = cur_href+\" \"+cur_target+\" \"+cur_class+\" \"+cur_title;\n\t\t\t\t\t\tif (setValue.substr(0,7)==\"http://\")\tsetValue = setValue.substr(7);\n\t\t\t\t\t\tif (setValue.substr(0,7)==\"mailto:\")\tsetValue = setValue.substr(7);\n\t\t\t\t\t\tupdateValueInMainForm(setValue);\n\t\t\t\t\t\tclose();\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tfunction checkReference()\t{\t//\n\t\t\t\t\tif (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'[\"'.$this->P['itemName'].'\"] )\t{\n\t\t\t\t\t\treturn window.opener.document.'.$this->P['formName'].'[\"'.$this->P['itemName'].'\"];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclose();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction updateValueInMainForm(input)\t{\t//\n\t\t\t\t\tvar field = checkReference();\n\t\t\t\t\tif (field)\t{\n\t\t\t\t\t\tfield.value = input;\n\t\t\t\t\t\t'.$update.'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t';\n\t\t} else {\t// Functions used, if the link selector is in RTE mode:\n\t\t\t$JScode.='\n\t\t\t\tfunction link_typo3Page(id,anchor)\t{\n\t\t\t\t\tvar theLink = \\''.$this->siteURL.'?id=\\'+id+(anchor?anchor:\"\");\n\t\t\t\t\tif (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);\n\t\t\t\t\tif (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);\n\t\t\t\t\teditor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tfunction link_folder(folder)\t{\t//\n\t\t\t\t\tvar theLink = \\''.$this->siteURL.'\\'+folder;\n\t\t\t\t\tif (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);\n\t\t\t\t\tif (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);\n\t\t\t\t\teditor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tfunction link_spec(theLink)\t{\t//\n\t\t\t\t\tif (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);\n\t\t\t\t\tif (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);\n\t\t\t\t\teditor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tfunction link_current()\t{\t//\n\t\t\t\t\tif (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);\n\t\t\t\t\tif (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);\n\t\t\t\t\tif (cur_href!=\"http://\" && cur_href!=\"mailto:\")\t{\n\t\t\t\t\t\teditor.renderPopup_addLink(cur_href,cur_target,cur_class,cur_title);\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t';\n\t\t}\n\n\t\t\t// General \"jumpToUrl\" function:\n\t\t$JScode.='\n\t\t\tfunction jumpToUrl(URL,anchor)\t{\t//\n\t\t\t\tvar add_editorNo = URL.indexOf(\"editorNo=\")==-1 ? \"&editorNo='.$this->editorNo.'\" : \"\";\n\t\t\t\tvar add_contentTypo3Language = URL.indexOf(\"contentTypo3Language=\")==-1 ? \"&contentTypo3Language='.$this->contentTypo3Language.'\" : \"\";\n\t\t\t\tvar add_contentTypo3Charset = URL.indexOf(\"contentTypo3Charset=\")==-1 ? \"&contentTypo3Charset='.$this->contentTypo3Charset.'\" : \"\";\n\t\t\t\tvar add_act = URL.indexOf(\"act=\")==-1 ? \"&act='.$this->act.'\" : \"\";\n\t\t\t\tvar add_mode = URL.indexOf(\"mode=\")==-1 ? \"&mode='.$this->mode.'\" : \"\";\n\t\t\t\tvar theLocation = URL+add_act+add_editorNo+add_contentTypo3Language+add_contentTypo3Charset+add_mode+add_href+add_target+add_class+add_title+add_params'.($addPassOnParams?'+\"'.$addPassOnParams.'\"':'').'+(anchor?anchor:\"\");\n\t\t\t\twindow.location.href = theLocation;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t';\n\n\t\t\t// This is JavaScript especially for the TBE Element Browser!\n\t\t$pArr = explode('|',$this->bparams);\n\t\t$formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';\n\t\t$JScode.='\n\t\t\tvar elRef=\"\";\n\t\t\tvar targetDoc=\"\";\n\n\t\t\tfunction launchView(url)\t{\t//\n\t\t\t\tvar thePreviewWindow=\"\";\n\t\t\t\tthePreviewWindow = window.open(\"' . $BACK_PATH . 'show_item.php?table=\"+url,\"ShowItem\",\"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0\");\n\t\t\t\tif (thePreviewWindow && thePreviewWindow.focus)\t{\n\t\t\t\t\tthePreviewWindow.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t\tfunction setReferences()\t{\t//\n\t\t\t\tif (parent.window.opener\n\t\t\t\t&& parent.window.opener.content\n\t\t\t\t&& parent.window.opener.content.document.editform\n\t\t\t\t&& parent.window.opener.content.document.editform[\"'.$formFieldName.'\"]\n\t\t\t\t\t\t) {\n\t\t\t\t\ttargetDoc = parent.window.opener.content.document;\n\t\t\t\t\telRef = targetDoc.editform[\"'.$formFieldName.'\"];\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfunction insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close)\t{\t//\n\t\t\t\tif (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).')\t{\n\t\t\t\t\taddElement(filename,table+\"_\"+uid,fp,close);\n\t\t\t\t} else {\n\t\t\t\t\tif (setReferences())\t{\n\t\t\t\t\t\tparent.window.opener.group_change(\"add\",\"'.$pArr[0].'\",\"'.$pArr[1].'\",\"'.$pArr[2].'\",elRef,targetDoc);\n\t\t\t\t\t} else {\n\t\t\t\t\t\talert(\"Error - reference to main window is not set properly!\");\n\t\t\t\t\t}\n\t\t\t\t\tif (close)\t{\n\t\t\t\t\t\tparent.window.opener.focus();\n\t\t\t\t\t\tparent.close();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfunction addElement(elName,elValue,altElValue,close)\t{\t//\n\t\t\t\tif (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin)\t{\n\t\t\t\t\tparent.window.opener.setFormValueFromBrowseWin(\"'.$pArr[0].'\",altElValue?altElValue:elValue,elName);\n\t\t\t\t\tif (close)\t{\n\t\t\t\t\t\tparent.window.opener.focus();\n\t\t\t\t\t\tparent.close();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\talert(\"Error - reference to main window is not set properly!\");\n\t\t\t\t\tparent.close();\n\t\t\t\t}\n\t\t\t}\n\t\t';\n\n\t\t\t// Finally, add the accumulated JavaScript to the template object:\n\t\t$this->doc->JScode = $this->doc->wrapScriptTags($JScode);\n\n\t\t\t// Debugging:\n\t\tif (FALSE) debug(array(\n\t\t\t'pointer' => $this->pointer,\n\t\t\t'act' => $this->act,\n\t\t\t'mode' => $this->mode,\n\t\t\t'curUrlInfo' => $this->curUrlInfo,\n\t\t\t'curUrlArray' => $this->curUrlArray,\n\t\t\t'P' => $this->P,\n\t\t\t'bparams' => $this->bparams,\n\t\t\t'RTEtsConfigParams' => $this->RTEtsConfigParams,\n\t\t\t'expandPage' => $this->expandPage,\n\t\t\t'expandFolder' => $this->expandFolder,\n\t\t\t'PM' => $this->PM,\n\t\t),'Internal variables of Script Class:');\n\n\t}", "protected function _loadNavigation() {\r\n // Get navigation directory.\r\n $navDir = Zend_Controller_Front::getInstance()\r\n ->getModuleDirectory($this->_moduleNameUC)\r\n . '/configs/'\r\n ;\r\n \r\n // Load navigation's static file.\r\n self::setDataNavigation(require \"{$navDir}/{$this->_nav_filename_static}\");\r\n\t\t\r\n\t\t// Make ref to current bootstrap instance\r\n\t\t$bt = $this;\r\n\r\n // Load navigation's dynamic file.\r\n $this->_eventManager->attach('__SYSTEM__.dispatchLoopStartup', function(Zend_EventManager_Event $e) use ($bt, $navDir) {\r\n // Call helper: check if current request for current module?\r\n $isMCAMatch = $e->getTarget()->isMCAMatch(array(\r\n 'module' => $bt->getModuleNameUC()\r\n ));\r\n if ($isMCAMatch) {\r\n \t\t$bt::setDataNavigation(require \"{$navDir}\" . $bt->getNavFilenameDynamic());\r\n }\r\n });\r\n \r\n // Return\r\n return $this;\r\n }", "public function generateNavigationStructure() {\n $pages = $this->collection->getPages();\n\n $structure = [];\n\n foreach ($pages as $page) {\n $pageNav = $page->getNavigationMenu();\n $structure = $this->nestedMerge($structure, $pageNav->menu);\n }\n\n $this->setStructure($structure);\n }", "function __construct()\n\t\t{\n\t\t\t$this->getMenuInformation();\n\n\t\t}", "public function initialize()\n {\n\n // load configurations\n $this->_config = $this->di->get('config');\n if ($this->_config->logger->enable === true) {\n $this->_logger = $this->di->get('logger');\n }\n\n // setup breadcrumbs\n $this->_breadcrumbs = $this->di->get('breadcrumbs');\n\n // setup navigation\n\n $navigation = $this->di->get('navigation');\n\n $navigation->setActiveNode(\n $this->router->getActionName(),\n $this->router->getControllerName(),\n $this->router->getModuleName()\n );\n\n if (APPLICATION_ENV === 'development') {\n // add toolbar to the layout\n $toolbar = new \\Fabfuel\\Prophiler\\Toolbar($this->di->get('profiler'));\n $toolbar->addDataCollector(new \\Fabfuel\\Prophiler\\DataCollector\\Request());\n $this->view->setVar('toolbar', $toolbar);\n }\n\n // global view variables\n $this->view->setVars([\n 'user' => $this->_user,\n 'breadcrumbs' => $this->_breadcrumbs,\n 'navigation' => $navigation,\n 'search' => new Forms\\SearcherForm()\n ]);\n }", "protected function _setupNavigation($sNode)\n {\n $myAdminNavig = $this->getNavigation();\n $sNode = oxRegistry::getConfig()->getRequestParameter(\"menu\");\n\n // active tab\n $iActTab = oxRegistry::getConfig()->getRequestParameter('actedit');\n $iActTab = $iActTab ? $iActTab : $this->_iDefEdit;\n\n $sActTab = $iActTab ? \"&actedit=$iActTab\" : '';\n\n // list url\n $this->_aViewData['listurl'] = $myAdminNavig->getListUrl($sNode) . $sActTab;\n\n // edit url\n $sEditUrl = $myAdminNavig->getEditUrl($sNode, $iActTab) . $sActTab;\n if (!getStr()->preg_match(\"/^http(s)?:\\/\\//\", $sEditUrl)) {\n //internal link, adding path\n /** @var oxUtilsUrl $oUtilsUrl */\n $oUtilsUrl = oxRegistry::get(\"oxUtilsUrl\");\n $sSelfLinkParameter = $this->getViewConfig()->getViewConfigParam('selflink');\n $sEditUrl = $oUtilsUrl->appendParamSeparator($sSelfLinkParameter) . $sEditUrl;\n }\n\n $this->_aViewData['editurl'] = $sEditUrl;\n\n // tabs\n $this->_aViewData['editnavi'] = $myAdminNavig->getTabs($sNode, $iActTab);\n\n // active tab\n $this->_aViewData['actlocation'] = $myAdminNavig->getActiveTab($sNode, $iActTab);\n\n // default tab\n $this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab($sNode, $this->_iDefEdit);\n\n // passign active tab number\n $this->_aViewData['actedit'] = $iActTab;\n\n // buttons\n $this->_aViewData['bottom_buttons'] = $myAdminNavig->getBtn($sNode);\n }", "function as_navigation() {\t\n\t\t$as_nav_items = array();\t\t\t\t\t\n\t\t$myaccount = isset( $_SESSION['kmdnwdems_account'] ) ? $_SESSION['kmdnwdems_account'] : null;\n\t\t\n\t\t/*$as_nav_items['home']=array(\n\t\t\t'label' => 'Home',\n\t\t\t'url' => '.',\n\t\t);\n\t\t*/\n\t\tif ($myaccount){ \n\t\t\t$as_nav_items['item_all']=array(\n\t\t\t\t'label' => 'Clients',\n\t\t\t\t'url' => 'index.php?action=item_all',\n\t\t\t);\n\t\t\t$as_nav_items['record_all']=array(\n\t\t\t\t'label' => 'records',\n\t\t\t\t'url' => 'index.php?action=record_all',\n\t\t\t);\n\t\t\t$as_nav_items['user_all']=array(\n\t\t\t\t'label' => 'Users',\n\t\t\t\t'url' => 'index.php?action=user_all',\n\t\t\t);\n\t\t\t$as_nav_items['options']=array(\n\t\t\t\t'label' => 'Site Options',\n\t\t\t\t'url' => 'index.php?action=options',\n\t\t\t);\n\t\t\t$as_nav_items['logout']=array(\n\t\t\t\t'label' => 'Logout?',\n\t\t\t\t'url' => 'index.php?action=logout',\n\t\t\t);\n\t\t\n\t\t} else {\n\t\t\t$as_nav_items['register']=array(\n\t\t\t\t'label' => 'Register',\n\t\t\t\t'url' => 'index.php?action=register',\n\t\t\t);\n\t\t\t$as_nav_items['forgot_password']=array(\n\t\t\t\t'label' => 'Forgot Password',\n\t\t\t\t'url' => 'index.php?action=forgot_password',\n\t\t\t);\n\t\t\t$as_nav_items['forgot_username']=array(\n\t\t\t\t'label' => 'Forgot Username',\n\t\t\t\t'url' => 'index.php?action=forgot_username',\n\t\t\t);\n\t\t}\n\t\treturn $as_nav_items;\n\t}", "function init()\t{\n\t\tglobal $BE_USER,$BACK_PATH;\n\t\t\n\t\t\t// Setting GPvars:\n\t\t$this->currentSubScript = t3lib_div::_GP('currentSubScript');\n\t\t$this->cMR = t3lib_div::_GP('cMR');\n\t\t$this->setTempDBmount = t3lib_div::_GP('setTempDBmount');\n\n\t\t\t// Generate Folder if neassessary\n\t\ttx_commerce_create_folder::init_folders();\n\n\t\t\t// Create page tree object:\n\t\t$this->pagetree = t3lib_div::makeInstance('localPageTree');\n\t\t$this->pagetree->ext_IconMode = $BE_USER->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu');\n\t\t$this->pagetree->ext_showPageId = $BE_USER->getTSConfigVal('options.pageTree.showPageIdWithTitle');\n\t\t$this->pagetree->thisScript = $BACK_PATH.PATH_txcommerce_rel.'mod_statistic/class.tx_commerce_statistic_navframe.php';\n\t\t$this->pagetree->addField('alias');\n\t\t$this->pagetree->addField('shortcut');\n\t\t$this->pagetree->addField('shortcut_mode');\n\t\t$this->pagetree->addField('mount_pid');\n\t\t$this->pagetree->addField('mount_pid_ol');\n\t\t$this->pagetree->addField('nav_hide');\n\t\t$this->pagetree->addField('url');\n\n#\t\t$this->settingTemporaryMountPoint(11);\n\t\t\t// Temporary DB mounts:\n\t\t$this->pagetree->MOUNTS=array_unique(tx_commerce_folder_db::initFolders('Orders','Commerce',0,'Commerce'));\n\t\t$this->initializeTemporaryDBmount();\n\n\t\t\t// Setting highlight mode:\n\t\t$this->doHighlight = !$BE_USER->getTSConfigVal('options.pageTree.disableTitleHighlight');\n\n\t\t\t// Create template object:\n\t\t$this->doc = t3lib_div::makeInstance('template');\n\t\t$this->doc->docType='xhtml_trans';\n\n\t\t\t// Setting backPath\n\t\t$this->doc->backPath = $BACK_PATH;\n\n\t\t\t// Setting JavaScript for menu.\n\t\t$this->doc->JScode=$this->doc->wrapScriptTags(\n\t($this->currentSubScript?'top.currentSubScript=unescape(\"'.rawurlencode($this->currentSubScript).'\");':'').'\n\n\t\t// Function, loading the list frame from navigation tree:\n\tfunction jumpTo(id,linkObj,highLightID)\t{\t//\n\t\tvar theUrl = top.TS.PATH_typo3+top.currentSubScript+\"?id=\"+id;\n\n\t\tif (top.condensedMode)\t{\n\t\t\ttop.content.document.location=theUrl;\n\t\t} else {\n\t\t\tparent.list_frame.document.location=theUrl;\n\t\t}\n\n\t\t'.($this->doHighlight?'hilight_row(\"web\",highLightID);':'').'\n\n\t\t'.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) {linkObj.blur();}').'\n\t\treturn false;\n\t}\n\n\t\t// Call this function, refresh_nav(), from another script in the backend if you want to refresh the navigation frame (eg. after having changed a page title or moved pages etc.)\n\t\t// See t3lib_BEfunc::getSetUpdateSignal()\n\tfunction refresh_nav()\t{\t//\n\t\twindow.setTimeout(\"_refresh_nav();\",0);\n\t}\n\tfunction _refresh_nav()\t{\t//\n\t\tdocument.location=\"'.$this->pagetree->thisScript.'?unique='.time().'\";\n\t}\n\n\t\t// Highlighting rows in the page tree:\n\tfunction hilight_row(frameSetModule,highLightID) {\t//\n\n\t\t\t// Remove old:\n\t\ttheObj = document.getElementById(top.fsMod.navFrameHighlightedID[frameSetModule]);\n\t\tif (theObj)\t{\n\t\t\ttheObj.style.backgroundColor=\"\";\n\t\t}\n\n\t\t\t// Set new:\n\t\ttop.fsMod.navFrameHighlightedID[frameSetModule] = highLightID;\n\t\ttheObj = document.getElementById(highLightID);\n\t\tif (theObj)\t{\n\t\t\ttheObj.style.backgroundColor=\"'.t3lib_div::modifyHTMLColorAll($this->doc->bgColor,-20).'\";\n\t\t}\n\t}\n\n\t'.($this->cMR?\"jumpTo(top.fsMod.recentIds['web'],'');\":'').';\n\t\t');\n\n\t\t\t// Click menu code is added:\n\t\t$CMparts=$this->doc->getContextMenuCode();\n\t\t$this->doc->bodyTagAdditions = $CMparts[1];\n\t\t$this->doc->JScode.= $CMparts[0];\n\t\t$this->doc->postCode.= $CMparts[2];\n\t}", "public function __construct() {\n $this->model = new finalModel();\n $this->view = new finalView();\n \n $this->nav = $_GET['nav'] ? $_GET['nav'] : 'home';\n $this->action = $_POST['action'];\n }", "public function __construct()\n {\n // Sitenavigation can be constructed while this sitearea class is empty, since the navigation is only called in the templates, at which time the sitearea will already be filled\n $this->navigation = Wi3_Sitearea_Navigation::inst();\n }", "public function init() {\n $this->_model = new Model_Content();\n $this->_form = new Form_Content_Add();\n $this->_categoryModel = new Model_Category();\n $this->_categoryForm = new Form_Content_Category_Add();\n $this->_langModel = new Model_Lang();\n $this->view->langs = $this->_langModel->fetchAll();\n $this->suburi = '/content/admin/';\n $flashMessenger = $this->_helper->FlashMessenger;\n $this->view->flashmsg = implode('<br/>', $flashMessenger->getMessages('flash'));\n }", "public function __construct()\r\n\t{\r\n\t\t$this->view = new view();\r\n\r\n\t\t/*** create the bread crumbs in case we want to show the menu path to a visitor ***/\r\n\t\t$bc = new breadcrumbs();\r\n\t\t// $bc->setPointer('->');\r\n\t\t$bc->crumbs();\r\n\t\t$this->view->breadcrumbs = $bc->breadcrumbs;\r\n\r\n\t\t// Create common css and js links in header. Add additional links to individual\r\n\t\t//\tlayouts as necessary.\r\n\t\t$links = new linkMaker();\r\n\t\t$this->view->links = $links;\r\n\t\t// Create the menu with current selection highlighted\r\n\t\t$menu = new menuMaker();\r\n\t\t$this->view->menu = $menu;\r\n\t}", "public function loadLinkedFromaccession() { \n // ForeignKey in: accession\n $t = new accession();\n }", "function as_navigation($request, $html = '')\n\t{\n\t\t$managerid = isset( $_SESSION['loggedin_manager'] ) ? $_SESSION['loggedin_manager'] : \"\";\n\t\t$level = isset( $_SESSION['loggedin_level'] ) ? $_SESSION['loggedin_level'] : \"\";\n\t\t$navigation = array();\n\t\tif ( $managerid ) {\t\t\t\n\t\t\t$navigation['farmers'] = array('label' => 'Farmers', 'url' => 'index.php?open=farmer_all');\n\t\t\t$navigation['payments'] = array('label' => 'Payments', 'url' => 'index.php?open=payment_all');\n\t\t\t$navigation['managers'] = array('label' => 'Managers', 'url' => 'index.php?open=manager_all');\n\t\t\t$navigation['settings'] = array('label' => 'Settings', 'url' => 'index.php?open=settings');\t\t\t\n\t\t\t$navigation['signout'] = array('label' => 'Sign Out?', 'url' => 'index.php?open=signout');\n\t\t} else {\n\t\t\t$navigation['signin'] = array('label' => 'Sign In', 'url' => 'index.php?open=signin');\n\t\t\t$navigation['register'] = array('label' => 'SignUp', 'url' => 'index.php?open=register');\n\t\t}\t\t\t\n\t\tif (isset($navigation[$request])) $navigation[$request]['selected']=true;\n\t\tforeach ($navigation as $k => $a){\n\t\t\tif ( $k != 'home'){\n\t\t\t\t$html .= '<li><a '.(($request==$k) ? 'class=\"current\" ': '').'href=\"'.$a['url'].'\">'.$a['label'].'</a></li>'.\"\\n\\t\\t\";\n\t\t\t} else {\n\t\t\t\t$html .= '<li><a '.(empty($request) ? 'class=\"current\" ': '').'href=\".\">Home</a></li>'.\"\\n\\t\\t\";\n\t\t\t}\n\t\t}\n\t\treturn $html;\n\t}" ]
[ "0.6511096", "0.6476281", "0.640576", "0.61225784", "0.60781235", "0.5701462", "0.5657074", "0.56555414", "0.56017864", "0.55184597", "0.5491269", "0.5450621", "0.54471684", "0.54464746", "0.5378016", "0.53304833", "0.5327847", "0.52391416", "0.52367544", "0.5172866", "0.5163765", "0.5146172", "0.51436275", "0.5127023", "0.5102496", "0.5101468", "0.5085873", "0.50515705", "0.50354284", "0.50053" ]
0.70516557
0
Saves the navigation and homepage from the form post data
public function saveFromPost() { // Save the navigation from post $this->_saveNavigationFromPost(); // Save the homepage uri $this->_saveHomepageFromPost(); // Reset the form elements to display the updated navigation $this->_initElements(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _saveNavigationFromPost()\n {\n $nav = $this->_getNavigationFromPost();\n $nav->saveAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);\n $this->_nav = $nav;\n }", "public function save()\n {\n $k = $this->getPages()->search(function ($item) {\n return $item->name == Request::get('page');\n });\n if ($k === false) {\n throw new \\Exception(\"Request invalid\", 1);\n }\n\n $page = $this->getPage(Request::get('page'));\n\n foreach ($page->fields as $field) {\n switch ($field->type) {\n case Input::GALLERY:\n if (Request::get($field->name) != '') {\n $items = json_decode(stripslashes(Request::get($field->name)), true);\n $field->setItems(new Collection($items));\n $field->save();\n }\n break;\n case Input::FILE:\n if (!empty($_FILES[$field->name])) {\n $uploadedfile = $_FILES[$field->name];\n $upload_overrides = array('test_form' => false);\n $movefile = wp_handle_upload($uploadedfile, $upload_overrides);\n\n if ($movefile && !isset($movefile['error'])) {\n $field->value = $movefile['url'];\n $field->save();\n } else {\n Log::info($movefile['error']);\n }\n }\n break;\n default:\n $field->value = Request::get($field->name);\n $field->save();\n break;\n }\n }\n update_option(Manager::NTO_SAVED_SUCCESSED, 'should_flash', false);\n $redirect_url = $this->getTabUrl(Request::get('page'));\n wp_redirect($redirect_url);\n }", "protected function _saveHomepageFromPost()\n {\n $homepageUri = $this->getValue(self::SELECT_HOMEPAGE_ELEMENT_ID);\n // make sure the homepageUri still exists in the navigation\n $pageExists = false;\n $iterator = new RecursiveIteratorIterator($this->_nav, RecursiveIteratorIterator::SELF_FIRST);\n foreach ($iterator as $page) {\n if ($page->getHref() == $homepageUri) {\n $pageExists = true;\n break;\n }\n }\n if (!$pageExists) {\n $homepageUri = '/';\n }\n set_option(self::HOMEPAGE_URI_OPTION_NAME, $homepageUri);\n }", "public function post_save(){\n\t\t\t\n\t\t$income_data \t\t= \tFiledb::_rawurldecode(json_decode(stripcslashes(Input::get('data')), true));\n\t\t$page \t\t\t\t= \tPages::prepare_results_to_model($income_data);\n\t\t$required_fields \t= \tUtilites::prepare_validation('pages');\n\n\t\tif(isset($income_data[\"link\"])){\n\t\t\t\n\t\t\t$income_data[\"link\"] = $page->link = preg_replace('/[\\s~@#$^*()+=[\\]{}\"\\'|\\\\\\\\,.?:;<>\\/ ]/', '', str_replace(' ', '_', $income_data[\"link\"]));\n\t\t}\n\n\t\tif(Input::get('new')){\n\n\t\t\tif(!isset($page->lang)){\n\t\t\t\t\n\t\t\t\t$page->lang = (isset($income_data[\"lang\"])) ? $income_data[\"lang\"] : Config::get('application.language');\n\t\t\t}\n\n\t\t\t$required_fields['title'] = Utilites::add_to_validation($required_fields['title'], 'unique:Pages');\n\t\t}\n\n\t\tif(isset($page->id)){\n\n\t\t\t$required_fields['title'] = Utilites::add_to_validation($required_fields['title'], 'unique:Pages,title,'.$page->id);\n\t\t}\n\n\t\t$validation = Validator::make($income_data, $required_fields);\n\n\t\tif($validation->fails()){\n\n\t\t\treturn Utilites::compose_error($validation);\n\t\t}\n\n\t\t$page->save();\n\n\t\tif($page->id !== 0){\n\n\t\t\t$success_message = Utilites::alert(__('forms.saved_notification', array('item' => $page->title)), 'success');\n\n\t\t\tif(Input::get('new')){\n\n\t\t\t\t$data \t\t\t\t= \tarray();\n\t\t\t\t$data[\"text\"] \t\t= \t$success_message;\n\t\t\t\t$data[\"data_out\"] \t= \t'work_area';\n\t\t\t\t$data[\"data_link\"] \t= \taction('admin.pages.home@edit', array($page->id));\n\t\t\t\t$data[\"data_title\"] = \tUtilites::build_title(array('content.application_name', 'content.pages_word', $page->title));\n\n\t\t\t\treturn View::make('assets.message_redirect', $data); \n\n\t\t\t}else{\n\n\t\t\t\treturn $success_message;\n\t\t\t}\n\n\t\t}else{\n\n\t\t\treturn Utilites::alert(__('forms_errors.undefined'), 'error');\n\t\t}\n\t}", "function save() {\n\n\t\t// Get posted values to make them available for models\n\t\t$this->getPostedEntities();\n\n\t\t// does values validate\n\t\tif($this->validateList(array(\"name\"))) {\n\n\t\t\t$query = new Query();\n\n\t\t\t// make sure type tables exist\n\t\t\t$query->checkDbExistence($this->db);\n\t\t\t$query->checkDbExistence($this->db_nodes);\n\n\t\t\t$entities = $this->data_entities;\n\t\t\t$names = array();\n\t\t\t$values = array();\n\n\t\t\t$name = $entities[\"name\"][\"value\"];\n\t\t\t$handle = superNormalize($name);\n\n\t\t\tif($name && $handle) {\n\t\t\t\t$sql = \"INSERT INTO \".$this->db.\" SET name = '$name', handle = '$handle'\";\n//\t\t\t\tprint $sql;\n\n\t\t\t\tif($query->sql($sql)) {\n\t\t\t\t\tmessage()->addMessage(\"navigation created\");\n\t\t\t\t\treturn array(\"item_id\" => $query->lastInsertId());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmessage()->addMessage(\"Creating navigation failed\", array(\"type\" => \"error\"));\n\t\treturn false;\n\t}", "public function save( $data = null ) {\n\t\tforeach ( $this->fields as $field ) {\n\t\t\t$field->set_value_from_input( Helper::input() );\n\t\t\t$field->save();\n\t\t}\n\n\t\tdo_action( 'carbon_fields_nav_menu_item_container_saved', $this );\n\t}", "protected function save_if_submit()\n\t{\n\t\tif ( isset($_POST[ $this->settings_id . '_save' ]) )\n\t\t{\n\t\t\tdo_action('wordpressmenu_page_save_' . $this->settings_id);\n\t\t}\n\t}", "function Page_heading_save_postdata( $post_id ) {\n// verify if this is an auto save routine. \n// If it is our form has not been submitted, so we dont want to do anything\nif ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) \nreturn;\n// verify this came from the our screen and with proper authorization,\n// because save_post can be triggered at other times\nif ( ( isset ( $_POST['Page_heading_noncename'] ) ) && ( ! wp_verify_nonce( $_POST['Page_heading_noncename'], plugin_basename( __FILE__ ) ) ) )\nreturn;\n// Check permissions\nif ( ( isset ( $_POST['post_type'] ) ) && ( 'page' == $_POST['post_type'] ) ) {\nif ( ! current_user_can( 'edit_page', $post_id ) ) {\nreturn;\n} \n}\nelse {\nif ( ! current_user_can( 'edit_post', $post_id ) ) {\nreturn;\n}\n}\n// OK, we're authenticated: we need to find and save the data\n//About Page\n$templateName = get_post_meta( $post_id, '_wp_page_template', true ); \nif($templateName=='tpl-about.php'){\nupdate_post_meta( $post_id, 'about_banner_title', $_POST['about_banner_title'] );\nupdate_post_meta( $post_id, 'about_banner_content', $_POST['about_banner_content'] );\nupdate_post_meta( $post_id, 'about_banner_learn_more_button_link', $_POST['about_banner_learn_more_button_link'] );\nupdate_post_meta( $post_id, 'page_heading', $_POST['page_heading'] );\nupdate_post_meta( $post_id, 'page_sub_heading', $_POST['page_sub_heading'] );\nupdate_post_meta( $post_id, 'page_video', $_POST['page_video'] );\nupdate_post_meta( $post_id, 'money_train_mission_heading', $_POST['money_train_mission_heading'] );\nupdate_post_meta( $post_id, 'money_train_mission_sub_heading', $_POST['money_train_mission_sub_heading'] );\nupdate_post_meta( $post_id, 'money_train_content', $_POST['money_train_content'] );\nupdate_post_meta( $post_id, 'money_train_notified_title', $_POST['money_train_notified_title'] );\nupdate_post_meta( $post_id, 'money_train_notified_content', $_POST['money_train_notified_content'] );\n} \n//Event Page\nif($templateName=='tpl-events.php'){\nupdate_post_meta( $post_id, 'event_photo_gallary_title', $_POST['event_photo_gallary_title'] );\nupdate_post_meta( $post_id, 'event_photo_gallary_content', $_POST['event_photo_gallary_content'] );\nupdate_post_meta( $post_id, 'event_video_gallary_title', $_POST['event_video_gallary_title'] );\nupdate_post_meta( $post_id, 'event_video_gallary_content', $_POST['event_video_gallary_content'] );\nupdate_post_meta( $post_id, 'event_quick_links_title', $_POST['event_quick_links_title'] );\nupdate_post_meta( $post_id, 'event_quick_links_sub_title', $_POST['event_quick_links_sub_title'] );\nupdate_post_meta( $post_id, 'event_design_animation_title', $_POST['event_design_animation_title'] );\nupdate_post_meta( $post_id, 'event_design_animation_sub_title', $_POST['event_design_animation_sub_title'] );\nupdate_post_meta( $post_id, 'event_design_animation_content', $_POST['event_design_animation_content'] );\nupdate_post_meta( $post_id, 'event_request_button', $_POST['event_request_button'] );\nupdate_post_meta( $post_id, 'event_video_embed_code', $_POST['event_video_embed_code'] );\nupdate_post_meta( $post_id, 'event_loadmore_album_url', $_POST['event_loadmore_album_url'] );\nupdate_post_meta( $post_id, 'event_loadmore_video_url', $_POST['event_loadmore_video_url'] );\nupdate_post_meta( $post_id, 'eventtiming', $_POST['eventtiming'] );\nupdate_post_meta( $post_id, 'Things_to_Rememeber', $_POST['Things_to_Rememeber'] );\nupdate_post_meta( $post_id, 'Things_to_Rememeber_content', $_POST['Things_to_Rememeber_content'] );\nupdate_post_meta( $post_id, 'sign_up_guest_list', $_POST['sign_up_guest_list'] );\nupdate_post_meta( $post_id, 'Celebrate_Birthday', $_POST['Celebrate_Birthday'] );\nupdate_post_meta( $post_id, 'sign_up_email_list', $_POST['sign_up_email_list'] );\nupdate_post_meta( $post_id, 'Table_Reservation', $_POST['Table_Reservation'] );\n}\n//services Page.\nif($templateName=='tpl-services.php'){\nupdate_post_meta( $post_id, 'services_page_title', $_POST['services_page_title'] );\nupdate_post_meta( $post_id, 'event_banner_conent', $_POST['event_banner_conent'] );\nupdate_post_meta( $post_id, 'services_page_testimonial_title', $_POST['services_page_testimonial_title'] );\nupdate_post_meta( $post_id, 'services_page_testimonial_sub_title', $_POST['services_page_testimonial_sub_title'] );\nupdate_post_meta( $post_id, 'services_man_brand_title', $_POST['services_man_brand_title'] );\nupdate_post_meta( $post_id, 'services_man_brand_sub_title', $_POST['services_man_brand_sub_title'] );\nupdate_post_meta( $post_id, 'services_man_brand_content', $_POST['services_man_brand_content'] );\n} \n//moneytraintv Page\nif($templateName=='tpl-moneytraintv.php'){\nupdate_post_meta( $post_id, 'moneytraintv_post_title', $_POST['moneytraintv_post_title'] );\nupdate_post_meta( $post_id, 'moneytraintv_post_sub_title', $_POST['moneytraintv_post_sub_title'] );\nupdate_post_meta( $post_id, 'moneytraintv_featured_post_title', $_POST['moneytraintv_featured_post_title'] );\nupdate_post_meta( $post_id, 'moneytraintv_featured_post_sub_title', $_POST['moneytraintv_featured_post_sub_title'] );\nupdate_post_meta( $post_id, 'moneytraintv_sec_title', $_POST['moneytraintv_sec_title'] );\nupdate_post_meta( $post_id, 'moneytraintv_music_title', $_POST['moneytraintv_music_title'] );\nupdate_post_meta( $post_id, 'moneytraintv_music_sub_title', $_POST['moneytraintv_music_sub_title'] );\n}\n//contact Page.\nif($templateName=='tpl-contact.php'){\nupdate_post_meta( $post_id, 'contact_page_banner_map', $_POST['contact_page_banner_map'] );\nupdate_post_meta( $post_id, 'contact_page_title', $_POST['contact_page_title'] );\nupdate_post_meta( $post_id, 'contact_page_heading', $_POST['contact_page_heading'] );\nupdate_post_meta( $post_id, 'contact_page_sub_heading', $_POST['contact_page_sub_heading'] );\nupdate_post_meta( $post_id, 'contact_page_call_button', $_POST['contact_page_call_button'] );\nupdate_post_meta( $post_id, 'contact_page_quick_contact_title', $_POST['contact_page_quick_contact_title'] );\nupdate_post_meta( $post_id, 'contact_page_quick_contact_sub_title', $_POST['contact_page_quick_contact_sub_title'] );\nupdate_post_meta( $post_id, 'contact_page_address_title', $_POST['contact_page_address_title'] );\nupdate_post_meta( $post_id, 'contact_page_address_sub_title', $_POST['contact_page_address_sub_title'] );\nupdate_post_meta( $post_id, 'contact_page_callus_title', $_POST['contact_page_callus_title'] );\nupdate_post_meta( $post_id, 'contact_page_call_phone', $_POST['contact_page_call_phone'] );\nupdate_post_meta( $post_id, 'contact_page_getin_touch_title', $_POST['contact_page_getin_touch_title'] );\nupdate_post_meta( $post_id, 'contact_page_getin_touch_content', $_POST['contact_page_getin_touch_content'] );\n}\n}", "function save_object()\n {\n // Update the listing class, this is necessary to get post\n // actions from it.\n $this->listing->save_object();\n\n // Get the selected distribution and release from the listing widget.\n $cont = $this->listing->getSelectedContainer();\n if(isset($_POST['ROOT'])){\n $this->setCurrentContainer('/root');\n }elseif(isset($_POST['BACK'])){\n $path = $this->selectedContainer;\n if($this->dataModel->itemExistsByPath($path)){\n $data = $this->dataModel->getItemByPath($path);\n if($data['parentPath']){\n $this->setCurrentContainer($data['parentPath']);\n }\n }\n }else{\n $this->setCurrentContainer($cont);\n }\n }", "public function store()\n {\n $input = Input::all();\n $validation = Validator::make($input, Page::$rules);\n\n if ($validation->passes())\n {\n\t $slug = Input::get('slug');\n\n\n\t $this->createViewPage( $slug );\n // Set homepage\n if(Input::has('homepage') && Input::get('homepage') == 1){\n Page::wherehomepage(1)->update(array('homepage'=>0));\n }\n $this->page->create($input);\n\n return Redirect::route('admin.pages.index');\n }\n\n return Redirect::route('admin.pages.create')\n ->withInput()\n ->withErrors($validation)\n ->with('message', 'There were validation errors.');\n }", "public function store()\n\t{\n\t\t//\n if($this->page->addpage(Input::all()))\n\t\t{\n return $this->redirectToIndexWithMessage($this->page->message);\n }\n return $this->redirectBackWithInputsAndErrors($this->page->validator->errors);\n }", "public function store()\n {\n\n if ($model = $this->form->save(Input::all())) {\n return Input::get('exit') ?\n Redirect::route('admin.pages.index') :\n Redirect::route('admin.pages.edit', $model->id) ;\n }\n\n return Redirect::route('admin.pages.create')\n ->withInput()\n ->withErrors($this->form->errors());\n\n }", "function saveItem ()\n{\n\n\tglobal $id, $message, $do;\n\n\t$parentId = validateInput('page_parentid', FILTER_VALIDATE_INT);\n\t$metaDataId = validateInput('meta_data_id', FILTER_VALIDATE_INT);\n\t$menuLabel = validateInput('menu_label');\n\t\n\t$photoPath = validateInput('photo_path');\n\t$thumbPhotoPath = validateInput('thumb_photo_path');\n\t$motifPath = validateInput('motif_path');\n\t\n\t$newHeroThumbPath = Helper::createImageThumb(\n\t\t\t\t\t\t\t\t\t\t\t\t$photoPath, \n\t\t\t\t\t\t\t\t\t\t\t\tTHUMB_WIDTH, \n\t\t\t\t\t\t\t\t\t\t\t\tTHUMB_HEIGHT, \n\t\t\t\t\t\t\t\t\t\t\t\t$thumbPhotoPath);\n\t\n\t$templateId = sanitizeInput('template_id', FILTER_VALIDATE_INT);\n\t$templateId = (($id == 1) ? HOME_TEMPLATE_ID: ((!empty($templateId)) ? $templateId: DEFAULT_TEMPLATE_ID)) ;\n\n\t$url = (requestVar('url')) ? validateInput('url') : validateInput('name');\n\t$url = Helper::url($url);\n\n\t$pageSlideshowId = validateInput('slideshow_id', FILTER_VALIDATE_INT);\n\t$pageGallertId = validateInput('gallery_id', FILTER_VALIDATE_INT);\n\t$pageMetaIndexId = validateInput('page_mrobots', FILTER_VALIDATE_INT);\n\t\n\t/** SAVE PAGE META DATA */\n\t$arrMetaData = array();\n\n\t$arrMetaData['name'] = validateInput('name');\n\t$arrMetaData['menu_label'] = $menuLabel;\n\t$arrMetaData['footer_menu'] = validateInput('footer_menu');\n\t\n\t$arrMetaData['heading'] = validateInput('heading');\n\t$arrMetaData['sub_heading'] = validateInput('sub_heading');\n\t$arrMetaData['url'] \t\t\t\t\t\t\t= ($id != 1) ? \"{$url}\" : 'home';\n\t$arrMetaData['full_url'] \t\t\t\t\t\t\t= ($id != 1) ? \"/{$url}\": \"/\";\n\t$arrMetaData['introduction'] = validateInput('introduction');\n\t$arrMetaData['short_description'] = validateInput('short_description');\n\t\n\t$arrMetaData['photo_caption_heading'] = validateInput('photo_heading');\n\t$arrMetaData['photo_caption'] = validateInput('photo_caption');\n\t$arrMetaData['photo_path'] = $photoPath;\n\t$arrMetaData['thumb_photo_path'] = $newHeroThumbPath;\n\t$arrMetaData['motif_photo_path'] = $motifPath;\n\n\t$arrMetaData['video_id'] = validateInput('video_id');\n\t$arrMetaData['quicklink_heading'] = validateInput('ql_heading');\n\t$arrMetaData['quicklink_photo_path'] = validateInput('ql_photo_path');\n\t$arrMetaData['quicklink_button_text'] = validateInput('ql_button_text');\n\t$arrMetaData['quicklink_description'] = validateInput('ql_description');\n\t\n\t$arrMetaData['title'] = validateInput('title');\n\t$arrMetaData['meta_description'] = validateInput('meta_description');\n\t$arrMetaData['og_title'] = validateInput('og_title');\n\t$arrMetaData['og_meta_description'] = validateInput('og_meta_description');\n\t$arrMetaData['og_image'] = (!empty(requestVar('og_image'))) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? validateInput('og_image')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: $photoPath;\n\t\n\t$arrMetaData['page_code_head_close'] \t= requestVar('page_code_head_close');\n\t$arrMetaData['page_code_body_open'] \t= requestVar('page_code_body_open');\n\t$arrMetaData['page_code_body_close'] \t= requestVar('page_code_body_close');\n\t\n\t$arrMetaData['date_updated'] \t\t\t\t\t= Helper::getCurrentDateTimeStr();\n\t$arrMetaData['updated_by'] = USER_ID;\n\t$arrMetaData['gallery_id'] = $pageGallertId;\n\t$arrMetaData['slideshow_id'] = $pageSlideshowId;\n\t$arrMetaData['template_id'] = $templateId;\n\t$arrMetaData['page_meta_index_id'] = $pageMetaIndexId;\n\n\tupdateRow($arrMetaData, 'page_meta_data', \"WHERE id = '{$metaDataId}'\");\n\t\n\t/** SAVE PAGE DETAILS */\n\n\t$arrPageData = array();\n\n\t$arrPageData['parent_id'] \t\t= $parentId;\n\n\tupdateRow($arrPageData, 'general_pages', \"WHERE id='{$id}' LIMIT 1\");\n\n\tif ($id != 1){\n\t \n\t\t$pgFullUrl \t\t= Helper::buildPageUrl($id);\n\t\t\n\t\tif ($pgFullUrl){\n\t\t\t\n\t\t\t$arrPageData = array('full_url' => \"/{$pgFullUrl}\");\n\n\t\t\tupdateRow($arrPageData, 'page_meta_data', \"WHERE `id` = '{$metaDataId}'\");\n\n\t\t}\n\t}\n\t\n\n\t/** save quicklinks */\n\n\trunQuery(\"DELETE FROM `page_has_quicklink` WHERE `page_id` = '{$id}'\");\n\n\t$primaryQuicklinks = requestVar('quicklink_id');\n\t$primaryQuicklinksRank = requestVar('quicklink_rank');\n\n\tif (!empty($primaryQuicklinks)) { \n\n\t\tfor ($i=0; $i < count($primaryQuicklinks); $i++) { \n\n\t\t\t$arrPrimaryQuicklinkData = array();\n\t\t\n\t\t\t$primaryQuicklinkId = $primaryQuicklinks[$i];\n\t\t\t$primary_quicklink_rank = $primaryQuicklinksRank[$primaryQuicklinkId];\n\t\t\t$primary_quicklink_rank = (!empty($primary_quicklink_rank)) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? $primary_quicklink_rank \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 0;\n\n\t\t\t$arrPrimaryQuicklinkData['page_id'] = $id;\n\t\t\t$arrPrimaryQuicklinkData['quicklink_page_id'] = $primaryQuicklinkId;\n\t\t\t$arrPrimaryQuicklinkData['type'] = 'P';\n\t\t\t$arrPrimaryQuicklinkData['rank'] = $primary_quicklink_rank;\n\n\t\t\tinsertRow($arrPrimaryQuicklinkData, 'page_has_quicklink');\n\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Save page responsive content\n\t * Check if content record exist for this page\n\t * get all exisitng row belong to this page's content\n\t */\n\n\t$existingRows = fetchValue(\"SELECT GROUP_CONCAT(`id`) \n\t\tFROM `content_row` \n\t\tWHERE `page_meta_data_id` = '{$metaDataId}'\");\n\n\tif ($existingRows) { \n\n\t\t/** delete all columns */\n\t\trunQuery(\"DELETE FROM `content_column` \n\t\t\tWHERE `content_row_id` IN({$existingRows})\");\n\n\t\t/** delete all rows */\n\t\trunQuery(\"DELETE FROM `content_row` \n\t\t\tWHERE `id` IN($existingRows)\");\n\t}\n\n\n\tif (!empty(requestVar('row-index')) && $metaDataId) {\n\n\t\t/** save new content rows and columns */\n\t\t$rows = requestVar('row-index');\n\t\t$rowsRanks = requestVar('row-rank');\n\t\t$totalRows = count($rows);\n\n\t\tif ($totalRows > 0) { \n\n\t\t\tfor ($i=0; $i < $totalRows; $i++) { \n\n\t\t\t\t$rowData = array();\n\n\t\t\t\t$rowData['rank'] = ($rowsRanks[$i]);\n\t\t\t\t$rowData['page_meta_data_id'] = $metaDataId;\n\n\t\t\t\t$rowId = insertRow($rowData, 'content_row');\n\n\t\t\t\tif ($rowId) { \n\t\t\t\t\t\n\t\t\t\t\t$columnsRank = requestVar(\"content-{$rows[$i]}-rank\");\n\t\t\t\t\t$columnsContent = requestVar(\"content-{$rows[$i]}-text\");\n\t\t\t\t\t$columnsClass = requestVar(\"content-{$rows[$i]}-class\");\n\n\t\t\t\t\t$totalROwColumns = count($columnsContent);\n\n\t\t\t\t\tif ($totalROwColumns > 0) {\n\n\t\t\t\t\t\tfor ($k=0; $k < $totalROwColumns; $k++) { \n\n\t\t\t\t\t\t\t$columnData = array();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$columnData['content'] = $columnsContent[$k];\n\t\t\t\t\t\t\t$columnData['css_class'] = $columnsClass[$k];\n\t\t\t\t\t\t\t$columnData['rank'] = $columnsRank[$k];\n\t\t\t\t\t\t\t$columnData['content_row_id'] = $rowId;\n\n\t\t\t\t\t\t\tinsertRow($columnData, 'content_column');\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}\n\n\t/** save page modules */\n\t\n\t$moduleRank = requestVar('mp_rank');\n\t$moduleIds = requestVar('mod_id');\n\n\t$sql = \"DELETE mp.* \n\t\tFROM `module_pages` mp\n\t\tLEFT JOIN `modules` m \n\t\t \tON (m.`mod_id` = mp.`mod_id`)\n WHERE mp.`page_id` = '{$id}'\n\t\t\tAND m.`mod_showincms`='\".FLAG_YES.\"'\";\n\t\t\t\n\trunQuery($sql);\n\n\tfor ($i=0; $i <= count($moduleIds); $i++) {\n\n\t\t$arrModuleData = array();\n\n\t\tif ($moduleRank[$i] > 0) {\n\n\t\t\t$arrModuleData['page_id'] = $id;\n\t\t\t$arrModuleData['modpages_rank'] = $moduleRank[$i];\n\t\t\t$arrModuleData['mod_id'] = $moduleIds[$i];\n\n\t\t\tinsertRow($arrModuleData, 'module_pages');\n\t\t}\n\t}\n\t\n\t$message = \"Page has been saved\";\n}", "function saveInfoMenu()\n\t{\n\t\t//Configure::write('debug', 2);\n\t\t$users= $this->Session->read('infoAdminLogin');\n \n Controller::loadModel('Option');\n \t$urlLocal= $this->getUrlLocal();\n \t\n if($users)\n {\n \t$id= $_POST['id'];\n \t$name= $_POST['name'];\n \t\n \t$this->Option->saveInfoMenu($name,$id);\n \t$this->redirect($urlLocal['urlOptions'].'menus');\n }\n else \n {\n $this->redirect($urlLocal['urlAdmins'].'login');\n }\n\t}", "private function save()\n\t{\n\t\tif ( isset( $_POST['submit'] ) )\n\t\t{\n\t\t\tif ( isset( $_POST['Config'] ) && is_array( $_POST['Config'] ) )\n\t\t\t{\n\t\t\t\tforeach ( $_POST['Config'] as $key => $value )\n\t\t\t\t{\n\t\t\t\t\tConfiguration::setValue( $key, $value );\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->halt();\n\t\t}\n\t}", "public function prepareSave(Form $form, SiteTreeNodeInterface $page)\n {\n $areaPointer = $this->widgetTool->parseAreaPointer(\n $form['redirect__redirect_target_i']\n );\n $page->redirect_type = 'internal';\n $page->redirect_target = $areaPointer['pageId'] . '#' . $this->widgetTool->widgetToAnchor($form['widget__select']);\n }", "private function saveMenu()\n\t\t{\n\t\t\t$id = (int)$_REQUEST['id'];\n\t\t\t$name = FN::sanitise($_REQUEST['name']);\n\t\t\t$value = NULL;\n\t\t\t$index = 0;\n\t\t\twhile (TRUE)\n\t\t\t{\n\t\t\t\tif (isset($_REQUEST[\"item$index\"]))\n\t\t\t\t{\n\t\t\t\t\tif (isset($_REQUEST['toDelete']) && $_REQUEST['toDelete'] == $index)\n\t\t\t\t\t{\n\t\t\t\t\t\t$index++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$template = FN::sanitise($_REQUEST[\"template$index\"]);\n\t\t\t\t\t$item = FN::sanitise($_REQUEST[\"item$index\"]);\n\t\t\t\t\tif ($value) $value .= \"\\n\";\n\t\t\t\t\t$value .= \"$template,$item\";\n\t\t\t\t\t$index++;\n\t\t\t\t}\n\t\t\t\telse break;\n\t\t\t}\n\t\t\tDB::update(\"menu\", array(\n\t\t\t\t\"name\"=>$name,\n\t\t\t\t\"value\"=>$value,\n\t\t\t\t\"user\"=>0,\n\t\t\t\t\"timestamp\"=>time(),\n\t\t\t\t\"attributes\"=>NULL\n\t\t\t\t), \"WHERE id=$id\");\n\t\t}", "function save(){\n\t\techo \"<script>console.log('Saving.');</script>\";\n\t\t// Pull the values from the form.\n\t\t$inID = trim($_POST['id']); \n\t\t//$inBook = determineBook();\n\t\t// Validate ID.\n\t\tif (validateID($inID)){\n\t\t\t$_SESSION['DB']->query(\"UPDATE pages SET \"\n\t\t\t\t. \"p_id = '$inID', \"\n\t\t\t\t. \"name = '\".trim($_POST['name']).\"', \"\n\t\t\t\t. \"title = '\".trim($_POST['title']).\"', \"\n\t\t\t\t. \"b_id = '\".trim($_POST['book']).\"', \"\n\t\t\t\t. \"content = '\".addslashes(trim($_POST['content'])).\"', \"\n\t\t\t\t. \"updated = CURRENT_TIMESTAMP \"\n\t\t\t\t. \"WHERE p_id = $inID;\"\n\t\t\t\t);\n\t\t\t} \n\t\telse {\n\t\t\techo \"<div style='background:red;'><p style='font-size:2em;'>Could not save: Attempting to save invalid Page ID: '$inID'.</p></div>\";\n\t\t\t}\n\t\tloadPage($inID); \n\t\t}", "public function store(SavePage $request)\n {\n $user = $request->user();\n $pageData = $request->only(self::ALLOWED_FIELDS);\n\n $page = $this->pages->create($user, $pageData);\n\n if($request->menu_label) {\n $page->menu_items()->create([\n 'menuable_type' => 'page',\n 'label' => $request->menu_label,\n ]);\n }\n\n \treturn redirect()->route('admin.page.index')->withStatus(trans('admin.page.add_success'));\n }", "public function saveRedirect($data)\n\t{\n\t\t$new_link = [\n\t\t\t'post_title' => sanitize_text_field($data['menuTitle']),\n\t\t\t'post_status' => sanitize_text_field('publish'),\n\t\t\t'post_parent' => sanitize_text_field($data['parent_id']),\n\t\t\t'post_type' => 'np-redirect',\n\t\t\t'post_excerpt' => ''\n\t\t];\n\t\tif ( isset($data['url']) && $data['url'] !== \"\" ){\n\t\t\t$new_link['post_content'] = esc_url($data['url']);\n\t\t}\n\t\t$this->new_id = wp_insert_post($new_link);\n\t\t$this->updateMenuMeta($data);\n\t\treturn $this->new_id;\n\t}", "function cmp_save_meta_box_data($post_id) {\r\n /*\r\n * We need to verify this came from our screen and with proper authorization,\r\n * because the save_post action can be triggered at other times.\r */\r\n // Check if our nonce is set.\r\n if (!isset($_POST['cmp_meta_box_nonce'])) {\r\n return;\r\n }\r\n // Verify that the nonce is valid.\r\n if (!wp_verify_nonce($_POST['cmp_meta_box_nonce'], 'cmp_meta_box')) {\r\n return;\r\n }\r\n // If this is an autosave, our form has not been submitted, so we don't want to do anything.\r\n if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {\r\n return;\r\n }\r\n // Check the user's permissions.\r\n if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {\r\n if (!current_user_can('edit_page', $post_id)) {\r\n return;\r\n }\r\n } else {\r\n if (!current_user_can('edit_post', $post_id)) {\r\n return;\r\n }\r\t}\r\n /* OK, it's safe for us to save the data now. */\r\n // Make sure that it is set.\r\n if (!isset($_POST['menu_field'])) {\r\n return;\r\n }\r // Sanitize user input.\r\n $selectMenu_data = isset($_POST['menu_field']) ? sanitize_text_field($_POST['menu_field']) : \"\";\r\n // Add Or Update the meta field in the database.\r\n if ( !update_post_meta($post_id, '_page_custom_menu_val', $selectMenu_data) ){\r\n add_post_meta($post_id, '_page_custom_menu_val', $selectMenu_data);\r\n }\r\n}", "public function save_page($page = false) {\n global $CFG;\n $mform = new pages_edit_product_form($page);\n if ($mform->is_cancelled()) {\n redirect(new moodle_url($CFG->wwwroot . '/local/pages/pages.php'));\n } else if ($data = $mform->get_data()) {\n require_once($CFG->libdir . '/formslib.php');\n\n $context = context_system::instance();\n $data->pagecontent['text'] = file_save_draft_area_files($data->pagecontent['itemid'], $context->id,\n 'local_pages', 'pagecontent',\n 0, array('subdirs' => true), $data->pagecontent['text']);\n\n $data->pagedata = '';\n if (strtolower($data->pagetype) == \"form\") {\n $pagedata = array();\n $fieldnames = required_param_array('fieldname', PARAM_RAW);\n $fieldtype = required_param_array('fieldtype', PARAM_RAW);\n $fieldrequired = required_param_array('fieldrequired', PARAM_RAW);\n $fielddefault = required_param_array('defaultvalue', PARAM_RAW);\n $fieldreadsfrom = required_param_array('readsfrom', PARAM_RAW);\n\n foreach ($fieldnames as $key => $value) {\n // Get all data sent from the form.\n // Stop empty fields being created.\n if (trim($value) != '') {\n $pagedata[] = array(\"name\" => $value,\n \"type\" => $fieldtype[$key],\n \"required\" => $fieldrequired[$key],\n \"defaultvalue\" => $fielddefault[$key],\n \"readsfrom\" => $fieldreadsfrom[$key]);\n }\n }\n $data->pagedata = json_encode($pagedata);\n }\n $recordpage = new stdClass();\n $recordpage->id = $data->id;\n $recordpage->pagedate = $data->pagedate;\n $recordpage->pagename = $data->pagename;\n $recordpage->pageorder = intval($data->pageorder);\n $recordpage->menuname = strtolower(str_replace(array(\" \", \"/\", \"\\\\\", \"'\", '\"', \";\", \"~\",\n \"?\", \"&\", \"@\", \"#\", \"$\", \"%\", \"^\", \"*\", \"(\", \")\", \"+\", \"=\"), \"\", trim($data->menuname)));\n $recordpage->onmenu = $data->onmenu;\n $recordpage->loginrequired = $data->loginrequired;\n $recordpage->accesslevel = $data->accesslevel;\n $recordpage->pagedata = $data->pagedata;\n $recordpage->pagetype = $data->pagetype;\n $recordpage->emailto = $data->emailto;\n $recordpage->pagelayout = $data->pagelayout;\n $recordpage->pageparent = intval($data->pageparent);\n $recordpage->pagecontent = $data->pagecontent['text'];\n $result = $page->update($recordpage);\n if ($result && $result > 0) {\n redirect(new moodle_url($CFG->wwwroot . '/local/pages/edit.php', array('id' => $result)));\n }\n }\n }", "protected function saveLoginInfo()\n\t{\n\t\tglobal $rbacsystem, $lng,$ilSetting;\n\n\t\tif(!$rbacsystem->checkAccess(\"write\",$this->getRefId()))\n\t\t{\n\t\t\t$ilErr->raiseError($this->lng->txt(\"permission_denied\"),$ilErr->MESSAGE);\n\t\t}\n\n\t\t$this->initLoginForm();\n\t\tif ($this->form->checkInput())\n\t\t{\n\t\t\tif (is_array($_POST))\n\t\t\t{\n\t\t\t\t// @todo: Move settings ilAuthLoginPageSettings\n\t\t\t\t$this->loginSettings = new ilSetting(\"login_settings\");\n\n\t\t\t\tforeach ($_POST as $key => $val)\n\t\t\t\t{\n\t\t\t\t\tif (substr($key, 0, 14) == \"login_message_\")\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->loginSettings->set($key, $val);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($_POST['default_auth_mode'])\n\t\t\t{\n\t\t\t\t$ilSetting->set('default_auth_mode',(int) $_POST['default_auth_mode']);\n\t\t\t}\n\n\t\t\tilUtil::sendSuccess($this->lng->txt(\"login_information_settings_saved\"),true);\n\t\t}\n\n\t\t$this->ctrl->redirect($this,'show');\n\t}", "public function save() {\n\t\t\t$inputs = $this->inputs;\n\t\t\t$prefix = $this->prefix;\n\t\t\tforeach ( $inputs as $input ) {\n\t\t\t\tif ( is_array( $_POST ) && array_key_exists( $input['id'], $_POST ) ) {\n\t\t\t\t\tif ( isset( $_POST[ $input['id'] ] ) ) {\n\t\t\t\t\t\tif ( is_array( $_POST[ $input['id'] ] ) ) {\n\t\t\t\t\t\t\t$data = array();\n\t\t\t\t\t\t\t$post_data = $_POST[ $input['id'] ];\n\t\t\t\t\t\t\tforeach ( $post_data as $one_data ) {\n\t\t\t\t\t\t\t\t$data[] = sanitize_text_field( $one_data );//just sanitizing fields and regrouping again into the array before saving to db\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdate_option( $prefix . $input['id'], $data );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$post_data = $_POST[ $input['id'] ];\n\t\t\t\t\t\t\tswitch ( $post_data ) {\n\t\t\t\t\t\t\t\tcase filter_var( $post_data, FILTER_VALIDATE_URL ):\n\t\t\t\t\t\t\t\t\t$data = esc_url( $post_data );\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase is_email( $post_data ):\n\t\t\t\t\t\t\t\t\t$data = sanitize_email( $post_data );\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t$data = sanitize_textarea_field( $post_data );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdate_option( $prefix . $input['id'], $data );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\twp_safe_redirect( $this->redirect );\n\t\t\texit();\n\t\t}", "function save() {\r\n //JSession::checkToken() or jexit(JText::_('INVALID TOKEN'));\r\n $app = JFactory::getApplication(); \r\n $model = $this->getModel('blog_categories');\r\n $data = $app->input->getArray($_POST); \r\n //storeCategorie if the input field is not empty \r\n if($data['title'] != '') { \r\n \t$model->storeCategorie();\r\n \t/*if(!$model->storeCategorie()) {\r\n //throw new Exception('categorie controller store categorie failed');\r\n } */ \r\n } \r\n $this->setRedirect('index.php?option=com_ablog&act=blog_categories&task=add');\r\n }", "function saveEditReturn() {\r\n \t$model = $this->getModel('blog_categories');\r\n \t$app = JFactory::getApplication();\r\n \t \r\n \t//Get the $data from the form\r\n \t$data = $app->input->getArray($_POST);\r\n \r\n \t//updateKategorie() if the input field is not empty\r\n \tif($data['title'] != '') {\r\n \t\t$model->updateKategorieFields();\r\n \t}\r\n \t$this->setRedirect('index.php?option=com_ablog&act=blog_categories'); \t \r\n }", "public function postEloquaSavedData();", "function saveMetaBoxe(){\n\n if(isset($_POST['post_type']) && $_POST['post_type'] == 'page' && isset($_POST[\"_safeWpMeta\"])){ \n\n $template_file = get_post_meta($_POST['post_ID'],'_wp_page_template',TRUE);\n if ($template_file == $this->templateName) {\n $id = $_POST['post_ID']; \n \n foreach($this->models as $modelName => $model){\n pn_select_save_method($id, \"page\", $modelName, $model); \n } \n \n } \n } \n \n }", "static function nev_save_form(){\n $nonce = $_POST['nonce'];\n if( !wp_verify_nonce($nonce, 'nev_nonce') ){\n header(\"HTTP/1.0 403 Security Check.\");\n die('Security Check');\n }\n \n if (!is_user_logged_in()){\n header(\"HTTP/1.0 403 Security Check.\");\n exit;\n\t\t\t}\n\t\t\t\n $data = $_POST['info'];\n\t\t\tnev_core::save_form($data);\n \techo json_encode( array( 'action' => 'save_form') );\n \texit;\n }", "function process_form_post_request($database) {\n add_form_item($database);\n \n // redirect to self\n $relative_URL = $_SERVER['REQUEST_URI'];\n header('Location: ' . $relative_URL);\n exit;\n}" ]
[ "0.7248685", "0.7030383", "0.68104714", "0.67662144", "0.668501", "0.65322703", "0.64968324", "0.63196075", "0.6219998", "0.617614", "0.6143255", "0.61413246", "0.60967404", "0.6090275", "0.607363", "0.6013391", "0.59623194", "0.5961088", "0.5922462", "0.5880207", "0.587362", "0.58669484", "0.58658385", "0.58657676", "0.5855179", "0.58445585", "0.58225244", "0.58219767", "0.5799235", "0.5784416" ]
0.81394297
0
Adds the hidden element to the form.
protected function _addHiddenElement() { $this->addElement('hidden', self::HIDDEN_ELEMENT_ID, array( 'value' => '', 'decorators' => array( 'ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'div')), array('Label'), 'Errors', ) )); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addHidden($name, $value)\n {\n $this->form .= '<input type=\"hidden\" name=\"'.$name.'\" value=\"'.$value.'\">';\n }", "public function addHidden() {\n parent::createHiddenWithValidator(\"id\");\n }", "function add_hidden($name, $value='', $id='')\n\t{\n\t\t$this->add_input('hidden', $name, $value, $id);\n\t}", "public function addHidden(Element $e){\n\t\t$this->hidden_elements[] = $e;\n\t}", "public function appendHiddenElement($name, $value)\n {\n if ($this->form != null) {\n $nl = $this->form->ownerDocument->createTextNode(\"\\n\");\n $node = $this->form->ownerDocument->createElement('input');\n $node->setAttribute('type', 'hidden');\n $node->setAttribute('name', $name);\n $node->setAttribute('value', Template::objectToString($value));\n $this->form->appendChild($node);\n $this->form->appendChild($nl);\n }\n }", "function add_hidden($hidden)\r\n {\r\n if (!is_object($hidden))\r\n die(\"invalid argument in add_hidden()\");\r\n\r\n $this->element[$this->number_of_elements] = $hidden;\r\n\r\n $this->number_of_elements++;\r\n }", "function sethiddenform($hiddenform) {\n\t\t$this->hiddenform[]=$hiddenform;\n\t}", "public function as_hidden()\n\t{\n\t\treturn '<input type=\"hidden\" ' . $this->name . $this->value . '>';\n\t}", "public function addFormInputHidden($name = '', $value = '') {\n //$tags = array();\n //$tags[] = 'name=\"'.$name.'\"';\n //$tags[] = 'value=\"'.$value.'\"';\n //$tags[] = 'type=\"hidden\"';\n //$this->addForm('', 'input', $tags);\n return '<input type=\"hidden\" name=\"' . $name . '\" value=\"' . $value . '\"/>';\n }", "public function appendHiddenElement($name, $value)\n {\n if ($this->form != null) {\n $nl = $this->form->ownerDocument->createTextNode(\"\\n\");\n $node = $this->form->ownerDocument->createElement('input');\n $node->setAttribute('type', 'hidden');\n $node->setAttribute('name', $name);\n $node->setAttribute('value', $value);\n $this->form->appendChild($node);\n $this->form->appendChild($nl);\n $this->elements[$name][] = $node;\n }\n return $node;\n }", "public function addHidden(string $name, $value)\n {\n $this->add([\n 'input',\n [\n 'name' => $name,\n 'type' => 'hidden',\n 'value' => $value\n ]\n ]);\n }", "public function addHiddenSentValue() {\n\t\t$this->addHiddenSent = true;\n\t}", "public function renderHidden(HTML_QuickForm2_Node $element)\r\n {\r\n if ($this->options['group_hiddens']) {\r\n $this->hidden[] = $element->__toString();\r\n }\r\n }", "function add_field_hidden($name, $value = '', bool $recursing = false): string\n {\n $inputHtml = '';\n $inputHtml .= form_hidden($name, $value, $recursing);\n return $inputHtml;\n }", "function form_hidden($name, $value, $edit = 'edit', $attributes = NULL) {\n return '<input type=\"hidden\" name=\"'. $edit .'['. $name .']\" id=\"'. form_clean_id($edit .'-'. $name) .'\" value=\"'. check_plain($value) .'\"'. drupal_attributes($attributes) .\" />\\n\";\n}", "public function hidden_input()\n\t{\n\t\treturn form_hidden( $this->name, $this->value );\n\t}", "private function inputHidden()\n {\n ?>\n <input type=\"hidden\" name=\"_token\" value=\"<?= $this->key_csfr ?>\"/>\n <?php\n }", "function form_hidden($hiddens=\"\")\n\t{\n\t\tif (is_array($hiddens))\n\t\t{\n\t\t\tforeach ($hiddens as $v)\n\t\t\t{\n\t\t\t\t$form .= \"\\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>\";\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $form;\n\t}", "public function addHidden($aName, $aValue=null)\n\t{\n\t\t$elt = new Bn_Balise('input/');\n\n\t\t$elt->setAttribute('type', 'hidden');\n\t\t$elt->setAttribute('name', $aName);\n\t\t$elt->setAttribute('id', $aName);\n\t\tif ( is_null($aValue) )\n\t\t{\n\t\t\t$elt->setAttribute('value', Bn::getValue($aName,''));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$elt->setAttribute('value', $aValue);\n\t\t}\n\t\t$this->_body[] = $elt;\n\t\treturn $elt;\n\t}", "public function setHidden($hidden);", "public function hidden($f, $v, $o = array()) { $o['as'] = 'hidden'; $o['value'] = $v; return $this->input($f, $o); }", "public function hidden($name, $value)\r\n\t\t{\r\n\t\t\techo \"<input name='\".$name.\"' id ='\".$name.\"' type='hidden' value='\".$value.\"'/>\";\t\r\n\t\t}", "public function insertHiddenInput(HiddenInput $input): HiddenInput {\n $this->inputs[] = $input;\n return $input;\n }", "public function addHiddenID($value = null) {\n $hiddenID = $this->createElement('hidden','id');\n\n if (is_int($value)) {\n $hiddenID->setValue($value);\n } \n\n $this->addElement($hiddenID);\n }", "public function hiddenFields()\n\t{\n\n\t}", "function addHiddenData($name, $value) \n {\n $xmlItem = new XMLObject( XMLObject_AdminBox::XML_NODE_HIDDEN );\n $xmlItem->addElement( XMLObject_AdminBox::XML_ELEMENT_HIDDEN_NAME, $name);\n $xmlItem->addElement( XMLObject_AdminBox::XML_ELEMENT_HIDDEN_VALUE, $value);\n \n $this->hiddenData->addXmlObject( $xmlItem );\n \n }", "function add_hidden_fields($data) \n {\n\tforeach ($this->all_fields as $f) {\n\t\tif (!in_array($f,$this->fields,TRUE)) {\n\t\t\tif (isset($data[$f])) echo \"\\n<input type='hidden' name='$f' value='\".$data[$f].\"'>\";\n\t\t}\n\t}\n }", "function addHidden($name, $value) {\n $this->directive['hiddens'][$name] = $value;\n }", "public static function inputHidden($fieldName, $value=''){\n return self::tag('input', array_merge(array('type'=>'hidden', 'id'=>$fieldName, 'name'=>$fieldName,'value'=>$value), array()), null, true);\n }", "function hidden($name, array $options = array()) {\n\t\treturn $this->add('hidden', array('name' => $name) + $options);\n\t}" ]
[ "0.7649806", "0.76252717", "0.7470731", "0.72270024", "0.7217552", "0.7166031", "0.7049772", "0.69574106", "0.6939297", "0.6897618", "0.68421525", "0.6834511", "0.67793083", "0.67558765", "0.6649076", "0.6636592", "0.66338843", "0.6624449", "0.6481335", "0.645714", "0.64553213", "0.6368836", "0.6316545", "0.62698686", "0.62553173", "0.6241777", "0.62271523", "0.6216325", "0.6200585", "0.6193345" ]
0.79078114
0
Adds the homepage select element to the form
protected function _addHomepageSelectElement() { $elementIds = array(); $pageLinks = array(); $pageLinks['/'] = __('[Default]'); // Add the default homepage link option $iterator = new RecursiveIteratorIterator($this->_nav, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $page) { $pageLinks[$page->getHref()] = $page->getLabel(); } $this->addElement('select', self::SELECT_HOMEPAGE_ELEMENT_ID, array( 'label' => __('Select a Homepage'), 'multiOptions' => $pageLinks, 'value' => get_option(self::HOMEPAGE_URI_OPTION_NAME), 'registerInArrayValidator' => false, 'decorators' => array( 'ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'div')), array('Label'), 'Errors', ) )); $elementIds[] = self::SELECT_HOMEPAGE_ELEMENT_ID; $this->addDisplayGroup( $elementIds, self::HOMEPAGE_SELECT_DISPLAY_ELEMENT_ID, array('class' => 'field') ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function print_choose_site() {\n $ret = '<div class=\\'\\'>Select a site to work with:';\n $sql = 'SELECT sitename, snuuid FROM sites';\n\n $res = pg_query($sql);\n if($res) {\n $ret .= '<form action=\\'.\\' >\n\t<input type=\\'hidden\\' name=\\'action\\' value=\\'do_choose_site\\'>\n\t<select name=\\'snuuid\\'>\n\t';\n while($row = pg_fetch_assoc($res)) {\n $ret .= '<option value=\\''.$row['snuuid'].'\\'>';\n $ret .= $row['sitename'].'</option>';\n }\n $ret .= \"</select>\\n\";\n $ret .= \"<input type='submit' value='Choose Site'></form>\\n\";\n } else {\n $ret .= 'Error loading sites.';\n }\n\n return $ret.'</div>';\n}", "public function getBrowseSearchForm() {\n\n $searchForm = array();\n $viewer = Engine_Api::_()->user()->getViewer();\n $searchFormSettings = Engine_Api::_()->getDbTable('searchformsetting', 'seaocore')->getModuleOptions('sitegroup');\n $sitegroupofferEnabled = Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitegroupoffer');\n $sitegroupreviewEnabled = Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitegroupreview');\n\n if (isset($searchFormSettings['show']) && !empty($searchFormSettings['show']) && isset($searchFormSettings['show']['display']) && !empty($searchFormSettings['show']['display'])) {\n $searchForm[] = array(\n 'type' => 'Select',\n 'name' => 'show',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Show'),\n 'multiOptions' => array(\n '1' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Everyone\\'s Groups'),\n '2' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Only My Friends\\' Groups'),\n '4' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Groups I Like'),\n '5' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Featured Groups')\n )\n );\n }\n\n if (isset($searchFormSettings['orderby']) && !empty($searchFormSettings['orderby']) && !empty($searchFormSettings['orderby']['display']) && isset($sitegroupreviewEnabled) && !empty($sitegroupreviewEnabled)) {\n $searchForm[] = array(\n 'type' => 'Select',\n 'name' => 'orderby',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Browse By'),\n 'multiOptions' => array(\n '' => '',\n 'creation_date' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Recent'),\n 'view_count' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Viewed'),\n 'comment_count' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Commented'),\n 'like_count' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Liked'),\n 'title' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Alphabetical'),\n 'review_count' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Reviewed'),\n 'rating' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Rated')\n ),\n );\n } elseif (isset($searchFormSettings['orderby']) && !empty($searchFormSettings['orderby']) && isset($searchFormSettings['orderby']['display']) && !empty($searchFormSettings['orderby']['display'])) {\n $searchForm[] = array(\n 'type' => 'Select',\n 'name' => 'orderby',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Browse By'),\n 'multiOptions' => array(\n '' => '',\n 'creation_date' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Recent'),\n 'view_count' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Viewed'),\n 'comment_count' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Commented'),\n 'like_count' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Most Liked'),\n 'title' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Alphabetical'),\n ),\n );\n }\n\n if (!empty($searchFormSettings['search']) && !empty($searchFormSettings['search']['display'])) {\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'search',\n 'label' => $this->translate('Search Groups')\n );\n }\n\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'sitegroup_location',\n 'label' => $this->translate(' Location ')\n );\n\n if (!empty($searchFormSettings['location']) && !empty($searchFormSettings['location']['display'])) {\n $enableLocation = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitegroup.locationfield', 1);\n if (!empty($enableLocation)) {\n if (!empty($searchFormSettings['locationmiles']) && !empty($searchFormSettings['locationmiles']['display'])) {\n $enableProximitysearch = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitegroup.proximitysearch', 1);\n if (!empty($enableProximitysearch)) {\n $flage = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitegroup.proximity.search.kilometer', 0);\n if ($flage) {\n $locationLable = \"Within Kilometers\";\n $locationOption = array(\n '0' => '',\n '1' => '1 Kilometer',\n '2' => '2 Kilometers',\n '5' => '5 Kilometers',\n '10' => '10 Kilometers',\n '20' => '20 Kilometers',\n '50' => '50 Kilometers',\n '100' => '100 Kilometers',\n '250' => '250 Kilometers',\n '500' => '500 Kilometers',\n '750' => '750 Kilometers',\n '1000' => '1000 Kilometers',\n );\n } else {\n $locationLable = \"Within Miles\";\n $locationOption = array(\n '0' => '',\n '1' => '1 Mile',\n '2' => '2 Miles',\n '5' => '5 Miles',\n '10' => '10 Miles',\n '20' => '20 Miles',\n '50' => '50 Miles',\n '100' => '100 Miles',\n '250' => '250 Miles',\n '500' => '500 Miles',\n '750' => '750 Miles',\n '1000' => '1000 Miles',\n );\n }\n\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'locationmiles',\n 'label' => $locationLable,\n 'multiOptions' => $locationOption,\n );\n }\n }\n\n\n if (!empty($searchFormSettings['street']) && !empty($searchFormSettings['street']['display'])) {\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'sitegroup_street',\n 'label' => $this->translate('Street')\n );\n }\n\n if (!empty($this->_searchFormSettings['city']) && !empty($this->_searchFormSettings['city']['display'])) {\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'sitegroup_city',\n 'label' => $this->translate('City')\n );\n }\n\n if (!empty($this->_searchFormSettings['state']) && !empty($this->_searchFormSettings['state']['display'])) {\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'sitegroup_state',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('State')\n );\n }\n\n if (!empty($this->_searchFormSettings['country']) && !empty($this->_searchFormSettings['country']['display'])) {\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'sitegroup_country',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Country')\n );\n }\n }\n }\n\n\n if (!empty($searchFormSettings['category_id']) && !empty($searchFormSettings['category_id']['display'])) {\n $categories = Engine_Api::_()->getDbTable('categories', 'sitegroup')->getCategories(array('category_id', 'category_name'), null, 0, 0, 1);\n $getCategoryArray = array();\n $getCategoryArray[0] = '';\n if (isset($categories) && !empty($categories)) {\n foreach ($categories as $category)\n $getCategoryArray[$category->category_id] = $category->category_name;\n }\n\n if (count($getCategoryArray) > 1) {\n $searchForm[] = array(\n 'type' => 'Select',\n 'name' => 'category_id',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Category'),\n 'multiOptions' => $getCategoryArray\n );\n }\n }\n\n\n if (Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitegroupbadge') && Engine_Api::_()->getApi('settings', 'core')->getSetting('sitegroupbadge.seaching.bybadge', 1) && !empty($searchFormSettings['badge_id']) && !empty($searchFormSettings['badge_id']['display'])) {\n\n $params = array();\n $params['search_code'] = 1;\n $badgeData = Engine_Api::_()->getDbTable('badges', 'sitegroupbadge')->getBadgesData($params);\n if (!empty($badgeData)) {\n $badgeData = $badgeData->toArray();\n $badgeCount = Count($badgeData);\n\n if (!empty($badgeCount)) {\n $badge_options = array();\n $badge_options[0] = '';\n foreach ($badgeData as $name) {\n $badge_options[$name['badge_id']] = $name['title'];\n }\n $searchForm[] = array(\n 'type' => 'Select',\n 'name' => 'badge_id',\n 'label' => $this->translate('Badge'),\n 'multiOptions' => $badge_options,\n );\n }\n }\n }\n\n if (isset($sitegroupofferEnabled) && !empty($sitegroupofferEnabled) && isset($searchFormSettings['offer_type']) && !empty($searchFormSettings['offer_type']) && isset($searchFormSettings['offer_type']['display']) && !empty($searchFormSettings['offer_type']['display'])) {\n $searchForm[] = array(\n 'type' => 'Select',\n 'name' => 'offer_type',\n 'label' => $this->translate('Groups With Offers'),\n 'multiOptions' => array(\n '' => '',\n 'all' => 'All Offers',\n 'hot' => 'Hot Offers',\n 'featured' => 'Featured Offers',\n )\n );\n }\n\n\n\n if (isset($searchFormSettings['closed']) && !empty($searchFormSettings['closed']) && isset($searchFormSettings['closed']['display']) && !empty($searchFormSettings['closed']['display'])) {\n $searchForm[] = array(\n 'type' => 'Select',\n 'name' => 'closed',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Status'),\n 'multiOptions' => array(\n '' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('All Groups'),\n '0' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Only Open Groups'),\n '1' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Only Closed Groups')\n )\n );\n }\n\n if (!empty($searchFormSettings['price']) && !empty($searchFormSettings['price']['display'])) {\n $enablePrice = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitegroup.price.field', 1);\n if (!empty($enablePrice)) {\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'min',\n 'label' => $this->translate('Min Price')\n );\n $searchForm[] = array(\n 'type' => 'Text',\n 'name' => 'max',\n 'label' => $this->translate('Max Price')\n );\n }\n }\n\n if (!empty($searchFormSettings['has_photo']) && !empty($searchFormSettings['has_photo']['display'])) {\n $searchForm[] = array(\n 'type' => 'Checkbox',\n 'name' => 'has_photo',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Only Groups With Photos'),\n );\n }\n\n if (Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('sitegroupreview') && !empty($searchFormSettings['has_review']) && !empty($searchFormSettings['has_review']['display'])) {\n $searchForm[] = array(\n 'type' => 'Checkbox',\n 'name' => 'has_review',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Only Groups With Reviews'),\n );\n }\n\n $searchForm[] = array(\n 'type' => 'Submit',\n 'name' => 'submit',\n 'label' => Engine_Api::_()->getApi('Core', 'siteapi')->translate('Search')\n );\n\n $searchFormData = array();\n $searchFormData['form'] = $searchForm;\n return $searchFormData;\n }", "function action_select()\n { \n $output = $this->invoke(\"selectPage\");\n if ($output!=\"\")\n {\n $page = &$this->getPage();\n $page->addContent($this->m_node->renderActionPage(\"select\", $output));\n }\n }", "public function optin_form();", "function clients_selectmenu_setupSearch($ctlData,$data,$element_count) {\n\t## first we prepare the field selector entry\n\tif($ctlData['IDENTIFIER'] == $data[$element_count]['identifier']) {\n\t\t$value_box_visibility = '';\n\t\t$field_selector = '<option label=\"'.$ctlData['NAME'].'\" value=\"'.$ctlData['IDENTIFIER'].'\" selected>'.$ctlData['NAME'].'</option>';\n\t} else {\n\t\t$value_box_visibility = 'style=\"display:none;\"';\n\t\t$field_selector = '<option label=\"'.$ctlData['NAME'].'\" value=\"'.$ctlData['IDENTIFIER'].'\">'.$ctlData['NAME'].'</option>';\t\t\n\t}\n\n\t## then we must tell the main programm the fucntionality for selecting our desired input form set\n\t$input_selector = \" else if (document.s.search#.value == '\".$ctlData['IDENTIFIER'].\"') { showElement_row#('row#_\".$ctlData['IDENTIFIER'].\"'); }\";\n\t\n\t## finally in the case, that we want to specify our own input element we can do this here\n\t\n\t## we need to get all possible values\n\t$values = clients_selectmenu_getValues($ctlData['IDENTIFIER']);\n\t\n\t## now preare the HTMl-Code for it\n\t$output = '';\n\t$output .= '<option label=\"select\" value=\"-1\">select</option>';\n\tforeach($values as $key=>$value) {\n\t\tif($key == $data[$element_count]['value']) {\n\t\t\t$output .= '<option label=\"'.$value.'\" value=\"'.$key.'\" selected>'.$value.'</option>';\n\t\t} else {\n\t\t\t$output .= '<option label=\"'.$value.'\" value=\"'.$key.'\">'.$value.'</option>';\n\t\t}\t\n\t}\n\t\n\t\n\t$input_element = '<div id=\"row#_'.$ctlData['IDENTIFIER'].'\" '.$value_box_visibility.'><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"middle\">\n\t\t\t\t\t\t<select name=\"operator#_'.$ctlData['IDENTIFIER'].'\"><option label=\"contains\" value=\"contains\">contains</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t</td><td align=\"left\" valign=\"top\"><img src=\"../../interface/images/blank.gif\" alt=\"\" width=\"10\" height=\"24\" border=\"0\">\n\t\t\t\t\t\t</td><td align=\"left\" valign=\"middle\"><select name=\"search_value#_'.$ctlData['IDENTIFIER'].'\">'.$output.'</select></td></tr></table></div>';\n\n\t## finally we return the setting\n\treturn array('fieldSelector'=>$field_selector,'inputSelector'=>$input_selector,'inputElement'=>$input_element,'inputName'=>\"row#_\".$ctlData['IDENTIFIER']);\n}", "function gp_project_type_create_form() {\n ?>\n <div class=\"form-field\">\n <label for=\"project-type-layout\"><?php _e( 'Layout', 'gp' ); ?></label>\n <select name=\"project-type-layout\" id=\"project-type-layout\" class=\"postform\">\n <?php echo it_array_to_select_options( gp_portfolio_layouts() ); ?>\n </select>\n <br>\n <span class=\"description\"><?php _e( 'Portfolio layout that will be used to display the project type.', 'gp' ); ?></span>\n </div>\n <div id=\"project-type-layout-option\" class=\"form-field\" style=\"display: none\">\n <label for=\"project-type-grid-size\"><?php _e( 'Grid Size', 'gp' ); ?></label>\n <select name=\"project-type-grid-size\" id=\"project-type-grid-size\">\n <?php echo it_array_to_select_options( GridPortfolioAdmin::get_grid_size_options(), GridPortfolio::DEFAULT_GRID_SIZE ); ?>\n </select>\n </div>\n <?php\n}", "public static function dropdown_pages( $select )\n {\n if ( false === strpos( $select, \" name='page_on_front'\" ) ) { return $select; }\n $forms = get_forms( array(\n 'numberposts' => -1,\n 'order' => 'ASC',\n 'orderby' => 'title'\n ) );\n if ( ! $forms ) { return $select; }\n $current = get_option( 'page_on_front', 0 );\n $options = walk_page_dropdown_tree( $forms, 0, array(\n 'selected' => $current,\n 'echo' => 0,\n 'name' => 'page_on_front'\n ) );\n $default = '<option value=\"0\">&mdash; Select &mdash;</option>';\n $select = str_replace( $default, $default . '<optgroup label=\"' . __( 'Pages', 'wm-forms' ) . '\">', $select );\n return str_replace( '</select>', '</optgroup><optgroup label=\"' . __( 'Forms', 'wm-forms' ) . '\">' . $options . '</optgroup></select>', $select );\n }", "public function add_options_pages() {\n if ( function_exists('acf_add_options_page') ) {\n acf_add_options_page(array(\n \"page_title\" => \"Home Page\",\n \"capability\" => \"edit_posts\",\n \"position\" => 5,\n \"icon_url\" => \"dashicons-admin-home\"\n ));\n }\n }", "public function wpmuOptionsForm()\n {\n }", "protected function _saveHomepageFromPost()\n {\n $homepageUri = $this->getValue(self::SELECT_HOMEPAGE_ELEMENT_ID);\n // make sure the homepageUri still exists in the navigation\n $pageExists = false;\n $iterator = new RecursiveIteratorIterator($this->_nav, RecursiveIteratorIterator::SELF_FIRST);\n foreach ($iterator as $page) {\n if ($page->getHref() == $homepageUri) {\n $pageExists = true;\n break;\n }\n }\n if (!$pageExists) {\n $homepageUri = '/';\n }\n set_option(self::HOMEPAGE_URI_OPTION_NAME, $homepageUri);\n }", "public function makeSelect(){\r\n echo \"<select name=\\\"\" .$this->getName(). \"\\\">\\n\";\r\n //Create options.\r\n $this->makeOptions($this->getValue());\r\n echo \"</select>\" ;\r\n }", "function options_form(&$form, &$form_state) {\n parent::options_form($form, $form_state);\n\n $view_display = $this->view->name . ':' . $this->view->current_display;\n\n $options = array('' => t('-Select-'));\n $options += views_get_views_as_options(FALSE, 'all', $view_display, FALSE, TRUE);\n $form['view_to_insert'] = array(\n '#type' => 'select',\n '#title' => t('View to insert'),\n '#default_value' => $this->options['view_to_insert'],\n '#description' => t('The view to insert into this area.'),\n '#options' => $options,\n );\n\n $form['inherit_arguments'] = array(\n '#type' => 'checkbox',\n '#title' => t('Inherit contextual filters'),\n '#default_value' => $this->options['inherit_arguments'],\n '#description' => t('If checked, this view will receive the same contextual filters as its parent.'),\n );\n }", "function snt_def_top_form() {\n\n $options = array(\n\t\t'' => ' ' . _x( 'Select Default Top Value...', 'Setting option', 'snt-en' ),\n\t\t'region' => _x( 'Region', 'Top meta-data option in Taxonomy/Meta Defaults screen', 'snt-en' ),\n\t\t'topic' => _x( 'Topic', 'Top meta-data option in Taxonomy/Meta Defaults screen', 'snt-en' ),\n\t\t'none' => _x( 'Nowhere', 'Top meta-data option in Taxonomy/Meta Defaults screen', 'snt-en' )\n\t);\n\t$opt_name = 'snt_def_top_meta_user_' . get_current_user_id();\n\t$sel = get_option( $opt_name );\n\t$html = \"<div><select title='$opt_name' name='$opt_name' class='def-tax-input' id='$opt_name'>\";\n\tforeach ( $options as $val => $txt ) :\n $html .= \"<option value='$val' \" . ( $val === $sel ? 'selected' : '' ) . \">$txt</option>\";\n\tendforeach;\n $html .= \"</select></div>\";\n\n echo $html;\n\n}", "public function select() {\n\t\tif( $this->require_role('admin,super-agent,agent') ) {\n\t\t\t$polls = array();\n\t\t\t\n\t\t\tforeach ($this->main_model->getActivePolls() as $poll) {\n\t\t\t\t$polls[$poll->id] = '['.$poll->code.'] '.$poll->label;\n\t\t\t}\n\t\t\t\t\n\t\t\t$data = array(\n\t\t\t\t'content' => 'polls/select',\n\t\t\t\t'title' => \"Sélection de sondage\",\n\t \t\t'js_to_load' => array('polls.js?v=1'),\n\t \t\t'content_data' => array(\n\t\t\t\t\t'fields' => array(\n\t\t\t\t\t\t'Sondage' \t=> form_dropdown('poll', $polls, null, 'class=\"form-control\"')\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\tif( strtolower( $_SERVER['REQUEST_METHOD'] ) == 'post' && set_value('poll', false)){\n\t\t\t\t$seleted_poll_id = set_value('poll', false);\n\t\t\t\t\n\t\t\t\tredirect('/respondents/add/'.$seleted_poll_id);\n\t\t\t}\n\t\t\t\n\t\t\t$this->load->view('global/layout', $data);\n\t\t}\n\t}", "function horse_search_form() {\n\n $types = get_terms('horse-category', array('hide_empty' => 1));\n foreach ($types as $type) {\n $horse_types .= \"<option value='$type->slug'\" . selected($type->slug, true, false) . \">$type->name\" . \"&nbsp;(\" . \"$type->count\" . \")\" . \"</option>\";\n }\n\n $statuses = get_terms('horse-status', array('hide_empty' => 1));\n foreach ($statuses as $status) {\n $horse_status .= \"<option value='$status->slug'\" . selected($status->slug, true, false) . \">$status->name\" . \"&nbsp;(\" . \"$status->count\" . \")\" . \"</option>\";\n }\n\n $genders = get_terms('horse-gender', array('hide_empty' => 1));\n foreach ($genders as $gender) {\n $horse_genders .= \"<option value='$gender->slug'\" . selected($gender->slug, true, false) . \">$gender->name\" . \"&nbsp;(\" . \"$gender->count\" . \")\" . \"</option>\";\n }\n\n $sizes = get_terms('horse-size', array('hide_empty' => 1));\n foreach ($sizes as $size) {\n $horse_sizes .= \"<option value='$size->slug'\" . selected($size->slug, true, false) . \">$size->name\" . \"&nbsp;(\" . \"$size->count\" . \")\" . \"</option>\";\n }\n\n $ages = get_terms('horse-age', array('hide_empty' => 1));\n foreach ($ages as $age) {\n $horse_ages .= \"<option value='$age->slug'\" . selected($size->slug, true, false) . \">$age->name\" . \"&nbsp;(\" . \"$age->count\" . \")\" . \"</option>\";\n }\n\n $searchform .= '<form action=\"' . get_home_url() . '/\" method=\"get\" id=\"searchhorseform\"><fieldset><ol>' .\n '<li id=\"item-status\"><label for=\"horse_status\">' . __('Status', 'wp_horse') . '</label><select id=\"horse_status\" name=\"horse-status\">' .\n '<option value=\"0\"></option>' .\n $horse_status .\n '</select></li>' .\n '<li id=\"item-category\"><label for=\"horse_category\">' . __('Category', 'wp_horse') . '</label><select id=\"horse_category\" name=\"horse-category\">' .\n '<option value=\"0\"></option>' .\n $horse_types .\n '</select></li>' .\n '<li id=\"item-gender\"><label for=\"horse_gender\">' . __('Gender', 'wp_horse') . '</label><select id=\"horse_gender\" name=\"horse-gender\">' .\n '<option value=\"0\"></option>' .\n $horse_genders .\n '</select></li>' .\n '<li id=\"item-size\"><label for=\"horse_size\">' . __('Size', 'wp_horse') . '</label><select id=\"horse_size\" name=\"horse-size\">' .\n '<option value=\"0\"></option>' .\n $horse_sizes .\n '</select></li>' .\n '<li id=\"item-age\"><label for=\"horse_age\">' . __('Age', 'wp_horse') . '</label><select id=\"horse_size\" name=\"horse-size\">' .\n '<option value=\"0\"></option>' .\n $horse_ages .\n '</select></li>' .\n '<input type=\"hidden\" name=\"post_type\" value=\"horse\" />' .\n '<br /><input type=\"submit\" id=\"searchhorse\" name=\"search\" value=\"' . __('Search horse', 'wp_horse') . '\">' .\n '' .\n '' .\n '</ol></fieldset></form>';\n\n return $searchform;\n}", "function adverts_dropdown_pages( $field ) {\r\n \r\n if(isset($field[\"value\"])) {\r\n $value = $field[\"value\"];\r\n } else {\r\n $value = null;\r\n }\r\n \r\n $args = array(\r\n 'selected' => $value, \r\n 'echo' => 1,\r\n\t'name' => $field[\"name\"], \r\n 'id' => $field[\"name\"],\r\n\t'show_option_none' => ' ',\r\n 'option_none_value' => 0\r\n );\r\n \r\n wp_dropdown_pages( $args );\r\n}", "public function wpjmaf_select_form($post) {\n wp_nonce_field( 'wpjmaf_page_header_meta_box_nonce', 'meta_box_nonce' );\n\n $form_id = get_post_meta( $post->ID, 'wpjmaf_form_id', true );\n\n ?>\n\n\t <div class=\"wpjmaf_page_header_box\">\n\t\t <style>\n\t\t </style>\n\t\t <p class=\"meta-options wpjmaf_page_header_field hide_show\">\n <?php \n if ( class_exists('GFAPI') ) {\n printf('<label for=\"wpjmaf_page_header_title\">%s</label>', esc_html__( 'Gravity forms', 'wpjmaf' )); \n\n echo '<select name=\"wpjmaf_form_id\"><option value=\"\">'. esc_html__('No form', 'wpjmaf') .'</option>';\n $forms = GFAPI::get_forms();\n foreach ( $forms as $form) {\n $formId = $form['fields'][0]->formId;\n $selected = $formId == $form_id ? 'selected' : '';\n printf('<option value=\"%d\" %s>%s</option>', $formId, $selected, $form['title']);\n }\n echo '</select>';\n } else {\n printf(\"<p>%s</p>\", esc_html__(\"Gravity form isn't active\", 'wpjmaf'));\n }\n ?>\n\t\t </p>\n\t\t</div>\n <?php\n }", "function search_category( $search_category ) {\n $url = INDEX . 'productslx';\n return ''\n . NL . '<div class=right>'\n . NL . '<form action=\"' . $url . '\" method=\"post\">'\n . NL . '<span id=category>'\n . NL . '<select id=\"search_category\" name=\"search_category\" onchange=\"submit()\" >'\n . NL . get_control_options( 'CA', 'search_category', $search_category, 'All' )\n . NL . '</select>'\n . NL . '</span>'\n . NL . '</form>'\n . NL . '</div>'\n . NL . '<div class=right>'\n . NL . '<span class=fs90>' . translate( 'Category' ) . ': &nbsp; </span>'\n . NL . '</div>'\n . NL . '<div class=clear></div>'\n ;\n}", "function build() {\n\t\t$t=getdate();\n \t\t$myear=$t[year]+1;\n\n\t\t$this->day = new view_element(\"select\");\n\t\t\n\n\t\t$this->day->options = array(\"1\"=>\"1\", \"5\"=>\"5\", \"10\"=>\"10\", \"15\"=>\"15\", \"20\"=>\"20\", \"25\"=>\"25\", \"30\"=>\"30\");\n\t\t\n\t\t\t\t\t\t\t\t \n\t\tparent::build();\n\t}", "public function form( $instance )\n\t{\t\n\t\t\n\t\t$widget = explode('-', $this->id);\n\t\t\n\t\t// Get Pages\n\t\t$pages = get_pages( array(\n\t\t\t'sort_order' => 'ASC',\n\t\t\t'sort_column' => 'menu_order',\n\t\t\t'post_type' => 'page',\n\t\t\t'post_status' => 'publish'\n\t\t) ); \n\t\t\n\t\t// Loop through all pages, adding them to dropdown for internal link.\n\t\tforeach ( $pages as $page ) {\n\t\t\t\n\t\t\tif ( $page->post_parent != 0 ) {\n\t\t\t\t$page_title = '-' . $page->post_title;\n\t\t\t} else {\n\t\t\t\t$page_title = $page->post_title;\n\t\t\t}\n\t\t\t\n\t\t\t$this->fields[4]['items'][$page->ID] = $page_title;\n\t\t\t\n\t\t}\n\t\t\n\t\t// Display interface for each field\n\t\tforeach ( $this->fields as $field )\n\t\t{\n\t\t\t\n\t\t\t$field['value'] = isset($instance[$field['name']]) ? $instance[$field['name']] : '';\n\t\t\t$field['id'] = $this->get_field_id($field['name']);\n\t\t\t$field['name'] = $this->get_field_name($field['name']);\n\t\t\t$field['widget_name'] = get_called_class();\n\t\t\t$field['widget_id'] = $widget[1] == '__i__' ? 'Save to Generate an ID' : $widget[1];\n\t\t\t\n\t\t\t\n\t\t\tswitch ( $field['type'] ) {\n\t\t\t\tcase 'select' :\n\t\t\t\t\techo '<p>';\n\t\t\t\t\techo '<label for=\"' . $field['id'] . '\">' . _($field['label']) . '</label><br />';\n\t\t\t\t\techo '<select name=\"' . $field['name'] . '\" id=\"' . $field['id'] . '\">';\n\t\t\t\t\t\t\t\n\t\t\t\t\tforeach ( (array) $field['items'] as $val => $label )\n\t\t\t\t\t{\n\t\t\t\t\t\tif ( !is_array($label) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo '<option value=\"' . $val . '\"' . ($val == $field['value'] ? ' selected' : '') . '>' . _($label) . '</option>';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\techo '<optgroup label=\"' . $val . '\">';\n\t\t\t\t\t\t\tforeach ( $label as $value => $text ) {\n\t\t\t\t\t\t\t\techo '<option value=\"' . $value . '\"' . ($value == $field['value'] ? ' selected' : '') . '>' . _($text) . '</option>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\techo '</optgroup>';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\techo '</select>';\n\t\t\t\t\techo '</p>';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'text' :\n\t\t\t\t\techo '<p>';\n\t\t\t\t\techo '<label for=\"' . $field['id'] . '\">' . _($field['label']) . '</label><br />';\n\t\t\t\t\techo '<input class=\"widefat\" type=\"text\" name=\"' . $field['name'] . '\" id=\"' . $field['id'] .'\" value=\"' . (isset($field['value']) ? $field['value'] : '') . '\" />';\n\t\t\t\t\techo '</p>';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'textarea' :\n\t\t\t\t\techo '<p>';\n\t\t\t\t\techo '<label for=\"' . $field['id'] . '\">' . _($field['label']) . '</label><br />';\n\t\t\t\t\techo '<textarea class=\"widefat\" rows=\"3\" name=\"' . $field['name'] . '\" id=\"' . $field['id'] .'\">' . (isset($field['value']) ? $field['value'] : '') . '</textarea>';\n\t\t\t\t\techo '</p>';\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t}", "public function select($name, $label, $form, $data, $valueindex = [], $inputclass = 'form-control')\n {\n $labelTag = \"<label for='$name'>$label</label>\";\n $select = \"<select class='$inputclass' name='$name' form='$form'>\";\n $element = $labelTag . $select;\n \n foreach ($data as $key => $value) {\n \n $element .= \"<option value=\". $value[$valueindex[0]] .'>'. $value[$valueindex[1]].\"</option>\";\n \n } \n $this->output[] = $element.'</select>';\n }", "protected function build_option_page()\n\t{\n\t\t/* intentionally left blank */\n\t}", "function build_option_form()\n {\n $renderer = $this->defaultRenderer();\n \n if (! $this->isSubmitted())\n {\n unset($_SESSION['select_number_of_options']);\n unset($_SESSION['select_skip_options']);\n unset($_SESSION['select_answer_type']);\n }\n if (! isset($_SESSION['select_number_of_options']))\n {\n $_SESSION['select_number_of_options'] = 3;\n }\n if (! isset($_SESSION['select_skip_options']))\n {\n $_SESSION['select_skip_options'] = array();\n }\n if (! isset($_SESSION['select_answer_type']))\n {\n $_SESSION['select_answer_type'] = 'radio';\n }\n if (isset($_POST['add']))\n {\n $_SESSION['select_number_of_options'] = $_SESSION['select_number_of_options'] + 1;\n }\n if (isset($_POST['remove']))\n {\n $indexes = array_keys($_POST['remove']);\n $_SESSION['select_skip_options'][] = $indexes[0];\n }\n if (isset($_POST['change_answer_type']))\n {\n $_SESSION['select_answer_type'] = $_SESSION['select_answer_type'] == 'radio' ? 'checkbox' : 'radio';\n }\n $object = $this->get_content_object();\n if (! $this->isSubmitted() && $object->get_number_of_options() != 0)\n {\n $_SESSION['select_number_of_options'] = $object->get_number_of_options();\n $_SESSION['select_answer_type'] = $object->get_answer_type();\n }\n $number_of_options = intval($_SESSION['select_number_of_options']);\n \n if ($_SESSION['select_answer_type'] == 'radio')\n {\n $switch_label = Translation::get('SwitchToMultipleSelect');\n }\n elseif ($_SESSION['select_answer_type'] == 'checkbox')\n {\n $switch_label = Translation::get('SwitchToSingleSelect');\n }\n \n $this->addElement(\n 'hidden', \n 'select_answer_type', \n $_SESSION['select_answer_type'], \n array('id' => 'select_answer_type'));\n $this->addElement(\n 'hidden', \n 'select_number_of_options', \n $_SESSION['select_number_of_options'], \n array('id' => 'select_number_of_options'));\n \n $buttons = array();\n // TODO adding fix for multiple select question\n $buttons[] = $this->createElement(\n 'style_button', \n 'change_answer_type', \n $switch_label, \n array('id' => 'change_answer_type'), \n null, \n 'retweet');\n // Notice: The [] are added to this element name so we don't have to deal with the _x and _y suffixes added when\n // clicking an image button\n $buttons[] = $this->createElement(\n 'style_button', \n 'add[]', \n Translation::get('AddSelectOption'), \n array('id' => 'add_option'), \n null, \n 'plus');\n $this->addGroup($buttons, 'question_buttons', null, '', false);\n \n $html_editor_options = array();\n $html_editor_options['style'] = 'width: 100%; height: 65px;';\n $html_editor_options['toolbar'] = 'RepositoryQuestion';\n \n $table_header = array();\n $table_header[] = '<table class=\"table table-striped table-bordered table-hover table-data\">';\n $table_header[] = '<thead>';\n $table_header[] = '<tr>';\n $table_header[] = '<th class=\"list\"></th>';\n $table_header[] = '<th style=\"width: 320px;\">' . Translation::get('Options') . '</th>';\n $table_header[] = '<th class=\"action\"></th>';\n $table_header[] = '</tr>';\n $table_header[] = '</thead>';\n $table_header[] = '<tbody>';\n $this->addElement('html', implode(PHP_EOL, $table_header));\n \n $visual_number = 0;\n \n for ($option_number = 0; $option_number < $number_of_options; $option_number ++)\n {\n if (! in_array($option_number, $_SESSION['select_skip_options']))\n {\n $group = array();\n \n $visual_number ++;\n $group[] = $this->createElement('static', null, null, $visual_number);\n $group[] = & $this->createElement(\n 'text', \n SelectOption::PROPERTY_VALUE . '[' . $option_number . ']', \n Translation::get('Answer'), \n array('style' => 'width: 300px;'));\n \n if ($number_of_options - count($_SESSION['select_skip_options']) > 2)\n {\n $group[] = & $this->createElement(\n 'image', \n 'remove[' . $option_number . ']', \n Theme::getInstance()->getCommonImagePath('Action/Delete'), \n array('class' => 'remove_option', 'id' => 'remove_' . $option_number));\n }\n else\n {\n $group[] = & $this->createElement(\n 'static', \n null, \n null, \n '<img class=\"remove_option\" src=\"' .\n Theme::getInstance()->getCommonImagePath('Action/DeleteNa') . '\" />');\n }\n \n $this->addGroup($group, SelectOption::PROPERTY_VALUE . '_' . $option_number, null, '', false);\n \n $renderer->setElementTemplate(\n '<tr id=\"option_' . $option_number . '\" class=\"' . ($option_number % 2 == 0 ? 'row_even' : 'row_odd') .\n '\">{element}</tr>', \n SelectOption::PROPERTY_VALUE . '_' . $option_number);\n $renderer->setGroupElementTemplate(\n '<td>{element}</td>', \n SelectOption::PROPERTY_VALUE . '_' . $option_number);\n }\n }\n \n $table_footer[] = '</tbody>';\n $table_footer[] = '</table>';\n $this->addElement('html', implode(PHP_EOL, $table_footer));\n \n $this->addGroup($buttons, 'question_buttons', null, '', false);\n \n $renderer->setElementTemplate(\n '<div style=\"margin: 10px 0px 10px 0px;\">{element}<div class=\"clear\"></div></div>', \n 'question_buttons');\n $renderer->setGroupElementTemplate(\n '<div style=\"float:left; text-align: center; margin-right: 10px;\">{element}</div>', \n 'question_buttons');\n }", "function allBrandsAsSelectInput() {\n $brands = getBrandList();\n\n echo (\"<select name='brand'>\");\n echo (\"<option value='new'>Add New</option>\");\n\n foreach ($brands as $brand) {\n echo (\"<option value='\" . $brand . \"'>\" . $brand . \"</option>\");\n }\n\n echo (\"</select>\");\n\n }", "public function showAddHomeworkForm()\n {\n $subjects = $this->subject->options();\n\n return View::make('add-homework')\n ->with('title', 'Huiswerk toevoegen')\n ->with('subjects', $subjects);\n }", "function _ws_site_options_menu() {\n add_options_page('Site Options', 'Site Options', 'manage_options', 'site', '_ws_site_options_page');\n}", "public function versionhtmlforaddpage()\n {\n return \"<label>Taal:</label><select name='plugin_multilanguage_languagetag'><option value='nl'>Nederlands</option><option value='en'>English</option></select>\";\n }", "public function wpjmaf_page_header_metabox() {\n add_meta_box(\n 'wpjmaf_page_header',\n __( 'Select Application Form', 'wpjmaf' ),\n array($this, 'wpjmaf_select_form' ),\n array('job_listing'),\n 'normal',\n 'high'\n );\n }", "function options_form(&$form, &$form_state) {\n // Build list of valid fields\n $options = array();\n $handlers = $this->display->handler->get_handlers('field');\n foreach ($handlers as $field => $handler) {\n if (empty($handler->options['exclude'])) {\n $options[$field] = $handler->label();\n }\n }\n\n $form['project'] = array(\n '#tree' => TRUE,\n '#type' => 'fieldset',\n '#title' => t('Project fields'),\n );\n foreach ($this->project_elements() as $element) {\n $form['project'][$element] = array(\n '#title' => $element,\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $this->options['project'][$element],\n );\n }\n\n $form['release'] = array(\n '#tree' => TRUE,\n '#type' => 'fieldset',\n '#title' => t('Release fields'),\n );\n foreach ($this->release_elements() as $element) {\n $form['release'][$element] = array(\n '#title' => $element,\n '#type' => 'select',\n '#options' => $options,\n '#default_value' => $this->options['release'][$element],\n );\n }\n }", "function paintFormTop()\n{\n\techo '<form action=\"';\n\techo get_option('home');\n\techo '/dashboard\" method=\"post\">';\n\t\n}" ]
[ "0.5856646", "0.5815948", "0.57710445", "0.57266605", "0.57006943", "0.56868494", "0.5684272", "0.56708753", "0.56697977", "0.56421345", "0.5590576", "0.5578614", "0.55497646", "0.55449474", "0.549819", "0.5489195", "0.54763305", "0.54742694", "0.54712844", "0.5441131", "0.54214036", "0.5419626", "0.54140925", "0.541079", "0.5402463", "0.5393269", "0.53831387", "0.5367127", "0.53656244", "0.53625375" ]
0.7712964
0
Saves the main navigation object from the form post data
protected function _saveNavigationFromPost() { $nav = $this->_getNavigationFromPost(); $nav->saveAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME); $this->_nav = $nav; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function saveFromPost()\n {\n // Save the navigation from post\n $this->_saveNavigationFromPost();\n // Save the homepage uri\n $this->_saveHomepageFromPost();\n // Reset the form elements to display the updated navigation\n $this->_initElements();\n }", "function save() {\n\n\t\t// Get posted values to make them available for models\n\t\t$this->getPostedEntities();\n\n\t\t// does values validate\n\t\tif($this->validateList(array(\"name\"))) {\n\n\t\t\t$query = new Query();\n\n\t\t\t// make sure type tables exist\n\t\t\t$query->checkDbExistence($this->db);\n\t\t\t$query->checkDbExistence($this->db_nodes);\n\n\t\t\t$entities = $this->data_entities;\n\t\t\t$names = array();\n\t\t\t$values = array();\n\n\t\t\t$name = $entities[\"name\"][\"value\"];\n\t\t\t$handle = superNormalize($name);\n\n\t\t\tif($name && $handle) {\n\t\t\t\t$sql = \"INSERT INTO \".$this->db.\" SET name = '$name', handle = '$handle'\";\n//\t\t\t\tprint $sql;\n\n\t\t\t\tif($query->sql($sql)) {\n\t\t\t\t\tmessage()->addMessage(\"navigation created\");\n\t\t\t\t\treturn array(\"item_id\" => $query->lastInsertId());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmessage()->addMessage(\"Creating navigation failed\", array(\"type\" => \"error\"));\n\t\treturn false;\n\t}", "public function save()\n {\n $k = $this->getPages()->search(function ($item) {\n return $item->name == Request::get('page');\n });\n if ($k === false) {\n throw new \\Exception(\"Request invalid\", 1);\n }\n\n $page = $this->getPage(Request::get('page'));\n\n foreach ($page->fields as $field) {\n switch ($field->type) {\n case Input::GALLERY:\n if (Request::get($field->name) != '') {\n $items = json_decode(stripslashes(Request::get($field->name)), true);\n $field->setItems(new Collection($items));\n $field->save();\n }\n break;\n case Input::FILE:\n if (!empty($_FILES[$field->name])) {\n $uploadedfile = $_FILES[$field->name];\n $upload_overrides = array('test_form' => false);\n $movefile = wp_handle_upload($uploadedfile, $upload_overrides);\n\n if ($movefile && !isset($movefile['error'])) {\n $field->value = $movefile['url'];\n $field->save();\n } else {\n Log::info($movefile['error']);\n }\n }\n break;\n default:\n $field->value = Request::get($field->name);\n $field->save();\n break;\n }\n }\n update_option(Manager::NTO_SAVED_SUCCESSED, 'should_flash', false);\n $redirect_url = $this->getTabUrl(Request::get('page'));\n wp_redirect($redirect_url);\n }", "function save_object()\n {\n // Update the listing class, this is necessary to get post\n // actions from it.\n $this->listing->save_object();\n\n // Get the selected distribution and release from the listing widget.\n $cont = $this->listing->getSelectedContainer();\n if(isset($_POST['ROOT'])){\n $this->setCurrentContainer('/root');\n }elseif(isset($_POST['BACK'])){\n $path = $this->selectedContainer;\n if($this->dataModel->itemExistsByPath($path)){\n $data = $this->dataModel->getItemByPath($path);\n if($data['parentPath']){\n $this->setCurrentContainer($data['parentPath']);\n }\n }\n }else{\n $this->setCurrentContainer($cont);\n }\n }", "public function save( $data = null ) {\n\t\tforeach ( $this->fields as $field ) {\n\t\t\t$field->set_value_from_input( Helper::input() );\n\t\t\t$field->save();\n\t\t}\n\n\t\tdo_action( 'carbon_fields_nav_menu_item_container_saved', $this );\n\t}", "function save_object()\n {\n if((isset($_POST['SubObjectFormSubmitted'])) && !preg_match(\"/freeze/\", $this->FAIstate)){\n foreach($this->attributes as $attrs){\n if($this->acl_is_writeable($attrs)){\n if(isset($_POST[$attrs])){\n $this->$attrs = get_post($attrs);\n }else{\n $this->$attrs = \"\";\n }\n }\n }\n }\n }", "public function post_save(){\n\t\t\t\n\t\t$income_data \t\t= \tFiledb::_rawurldecode(json_decode(stripcslashes(Input::get('data')), true));\n\t\t$page \t\t\t\t= \tPages::prepare_results_to_model($income_data);\n\t\t$required_fields \t= \tUtilites::prepare_validation('pages');\n\n\t\tif(isset($income_data[\"link\"])){\n\t\t\t\n\t\t\t$income_data[\"link\"] = $page->link = preg_replace('/[\\s~@#$^*()+=[\\]{}\"\\'|\\\\\\\\,.?:;<>\\/ ]/', '', str_replace(' ', '_', $income_data[\"link\"]));\n\t\t}\n\n\t\tif(Input::get('new')){\n\n\t\t\tif(!isset($page->lang)){\n\t\t\t\t\n\t\t\t\t$page->lang = (isset($income_data[\"lang\"])) ? $income_data[\"lang\"] : Config::get('application.language');\n\t\t\t}\n\n\t\t\t$required_fields['title'] = Utilites::add_to_validation($required_fields['title'], 'unique:Pages');\n\t\t}\n\n\t\tif(isset($page->id)){\n\n\t\t\t$required_fields['title'] = Utilites::add_to_validation($required_fields['title'], 'unique:Pages,title,'.$page->id);\n\t\t}\n\n\t\t$validation = Validator::make($income_data, $required_fields);\n\n\t\tif($validation->fails()){\n\n\t\t\treturn Utilites::compose_error($validation);\n\t\t}\n\n\t\t$page->save();\n\n\t\tif($page->id !== 0){\n\n\t\t\t$success_message = Utilites::alert(__('forms.saved_notification', array('item' => $page->title)), 'success');\n\n\t\t\tif(Input::get('new')){\n\n\t\t\t\t$data \t\t\t\t= \tarray();\n\t\t\t\t$data[\"text\"] \t\t= \t$success_message;\n\t\t\t\t$data[\"data_out\"] \t= \t'work_area';\n\t\t\t\t$data[\"data_link\"] \t= \taction('admin.pages.home@edit', array($page->id));\n\t\t\t\t$data[\"data_title\"] = \tUtilites::build_title(array('content.application_name', 'content.pages_word', $page->title));\n\n\t\t\t\treturn View::make('assets.message_redirect', $data); \n\n\t\t\t}else{\n\n\t\t\t\treturn $success_message;\n\t\t\t}\n\n\t\t}else{\n\n\t\t\treturn Utilites::alert(__('forms_errors.undefined'), 'error');\n\t\t}\n\t}", "protected function save()\n {\n sfContext::getInstance()->getRequest()->setParameter('IceBreadcrumbs', $this);\n }", "function save_object()\n {\n if(isset($_POST['vacation_release_'.$this->object_id])){\n $this->days = stripslashes($_POST['vacation_release_'.$this->object_id]);\n }\n\n /* Check if we want to toggle the expert mode */\n if(isset($_POST['Toggle_Expert_'.$this->object_id])){\n $this->Expert = !$this->Expert;\n }\n\n /* Get release date */\n if(isset($_POST['vacation_receiver_'.$this->object_id])){\n $vr = stripslashes ($_POST['vacation_receiver_'.$this->object_id]);\n $tmp = array();\n $tmp2 = explode(\",\",$vr);\n foreach($tmp2 as $val){\n $ad = trim($val);\n if(!empty($ad)){\n $tmp[] = $ad;\n }\n }\n $this->addresses = $tmp;\n }\n\n /* Get reason */\n if(isset($_POST['vacation_reason_'.$this->object_id])){\n $vr = stripslashes ($_POST['vacation_reason_'.$this->object_id]);\n $this->reason = trim($vr);\n }\n }", "protected function save_if_submit()\n\t{\n\t\tif ( isset($_POST[ $this->settings_id . '_save' ]) )\n\t\t{\n\t\t\tdo_action('wordpressmenu_page_save_' . $this->settings_id);\n\t\t}\n\t}", "public function saveForm() {\n\n\t\tparent::saveForm();\n\n\t}", "function save_org_structure() {\n\t\n\t\t\tif($_POST['parent_id'] == '') {\n\t\t\t\tunset($_POST['parent_id']);\n\t\t\t}\n\t\t\t\t\n\t\t\tswitch ($_POST['mode']) {\n\t\t\t\tcase 'add':\n\t\t\t\t\tif($this->_validate_post_data($this->data_object->organization_structure, 'add') != FALSE) {\n\t\t\n\t\t\t\t\t\t$data = array_intersect_key($_POST, $this->data_object->organization_structure);\n\t\t\t\t\t\t$data['organization_id'] = get_user_data('organization_id');\n\t\t\t\t\t\t$this->db->insert('system_security.organization_structure', $data);\n\t\t\t\t\t\t$id = $this->db->insert_id();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tset_success_message('Struktur berhasil ditambahkan.');\n\t\t\t\t\t\tredirect('global/admin/org_structure_detail/' . $id);\n\t\t\t\t\t\texit;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tset_error_message(validation_errors());\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase 'edit':\n\t\t\t\t\tif($this->_validate_post_data($this->data_object->organization_structure, 'edit') != FALSE) {\n\t\t\t\t\t\n\t\t\t\t\t\t$id = $_POST['organization_structure_id'];\n\t\t\t\t\t\tunset($_POST['organization_structure_id']);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t$data = array_intersect_key($_POST, $this->data_object->organization_structure);\n\t\t\t\t\t\t$this->db->update('system_security.organization_structure', $data, array('organization_structure_id' => $id));\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tset_success_message('Struktur berhasil diperbaharui.');\n\t\t\t\t\t\tredirect('global/admin/org_structure_detail/' . $id);\n\t\t\t\t\t\texit;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tset_error_message(validation_errors());\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t}", "public function postSaveAction(array $data) {}", "function saveItem ()\n{\n\n\tglobal $id, $message, $do;\n\n\t$parentId = validateInput('page_parentid', FILTER_VALIDATE_INT);\n\t$metaDataId = validateInput('meta_data_id', FILTER_VALIDATE_INT);\n\t$menuLabel = validateInput('menu_label');\n\t\n\t$photoPath = validateInput('photo_path');\n\t$thumbPhotoPath = validateInput('thumb_photo_path');\n\t$motifPath = validateInput('motif_path');\n\t\n\t$newHeroThumbPath = Helper::createImageThumb(\n\t\t\t\t\t\t\t\t\t\t\t\t$photoPath, \n\t\t\t\t\t\t\t\t\t\t\t\tTHUMB_WIDTH, \n\t\t\t\t\t\t\t\t\t\t\t\tTHUMB_HEIGHT, \n\t\t\t\t\t\t\t\t\t\t\t\t$thumbPhotoPath);\n\t\n\t$templateId = sanitizeInput('template_id', FILTER_VALIDATE_INT);\n\t$templateId = (($id == 1) ? HOME_TEMPLATE_ID: ((!empty($templateId)) ? $templateId: DEFAULT_TEMPLATE_ID)) ;\n\n\t$url = (requestVar('url')) ? validateInput('url') : validateInput('name');\n\t$url = Helper::url($url);\n\n\t$pageSlideshowId = validateInput('slideshow_id', FILTER_VALIDATE_INT);\n\t$pageGallertId = validateInput('gallery_id', FILTER_VALIDATE_INT);\n\t$pageMetaIndexId = validateInput('page_mrobots', FILTER_VALIDATE_INT);\n\t\n\t/** SAVE PAGE META DATA */\n\t$arrMetaData = array();\n\n\t$arrMetaData['name'] = validateInput('name');\n\t$arrMetaData['menu_label'] = $menuLabel;\n\t$arrMetaData['footer_menu'] = validateInput('footer_menu');\n\t\n\t$arrMetaData['heading'] = validateInput('heading');\n\t$arrMetaData['sub_heading'] = validateInput('sub_heading');\n\t$arrMetaData['url'] \t\t\t\t\t\t\t= ($id != 1) ? \"{$url}\" : 'home';\n\t$arrMetaData['full_url'] \t\t\t\t\t\t\t= ($id != 1) ? \"/{$url}\": \"/\";\n\t$arrMetaData['introduction'] = validateInput('introduction');\n\t$arrMetaData['short_description'] = validateInput('short_description');\n\t\n\t$arrMetaData['photo_caption_heading'] = validateInput('photo_heading');\n\t$arrMetaData['photo_caption'] = validateInput('photo_caption');\n\t$arrMetaData['photo_path'] = $photoPath;\n\t$arrMetaData['thumb_photo_path'] = $newHeroThumbPath;\n\t$arrMetaData['motif_photo_path'] = $motifPath;\n\n\t$arrMetaData['video_id'] = validateInput('video_id');\n\t$arrMetaData['quicklink_heading'] = validateInput('ql_heading');\n\t$arrMetaData['quicklink_photo_path'] = validateInput('ql_photo_path');\n\t$arrMetaData['quicklink_button_text'] = validateInput('ql_button_text');\n\t$arrMetaData['quicklink_description'] = validateInput('ql_description');\n\t\n\t$arrMetaData['title'] = validateInput('title');\n\t$arrMetaData['meta_description'] = validateInput('meta_description');\n\t$arrMetaData['og_title'] = validateInput('og_title');\n\t$arrMetaData['og_meta_description'] = validateInput('og_meta_description');\n\t$arrMetaData['og_image'] = (!empty(requestVar('og_image'))) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? validateInput('og_image')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: $photoPath;\n\t\n\t$arrMetaData['page_code_head_close'] \t= requestVar('page_code_head_close');\n\t$arrMetaData['page_code_body_open'] \t= requestVar('page_code_body_open');\n\t$arrMetaData['page_code_body_close'] \t= requestVar('page_code_body_close');\n\t\n\t$arrMetaData['date_updated'] \t\t\t\t\t= Helper::getCurrentDateTimeStr();\n\t$arrMetaData['updated_by'] = USER_ID;\n\t$arrMetaData['gallery_id'] = $pageGallertId;\n\t$arrMetaData['slideshow_id'] = $pageSlideshowId;\n\t$arrMetaData['template_id'] = $templateId;\n\t$arrMetaData['page_meta_index_id'] = $pageMetaIndexId;\n\n\tupdateRow($arrMetaData, 'page_meta_data', \"WHERE id = '{$metaDataId}'\");\n\t\n\t/** SAVE PAGE DETAILS */\n\n\t$arrPageData = array();\n\n\t$arrPageData['parent_id'] \t\t= $parentId;\n\n\tupdateRow($arrPageData, 'general_pages', \"WHERE id='{$id}' LIMIT 1\");\n\n\tif ($id != 1){\n\t \n\t\t$pgFullUrl \t\t= Helper::buildPageUrl($id);\n\t\t\n\t\tif ($pgFullUrl){\n\t\t\t\n\t\t\t$arrPageData = array('full_url' => \"/{$pgFullUrl}\");\n\n\t\t\tupdateRow($arrPageData, 'page_meta_data', \"WHERE `id` = '{$metaDataId}'\");\n\n\t\t}\n\t}\n\t\n\n\t/** save quicklinks */\n\n\trunQuery(\"DELETE FROM `page_has_quicklink` WHERE `page_id` = '{$id}'\");\n\n\t$primaryQuicklinks = requestVar('quicklink_id');\n\t$primaryQuicklinksRank = requestVar('quicklink_rank');\n\n\tif (!empty($primaryQuicklinks)) { \n\n\t\tfor ($i=0; $i < count($primaryQuicklinks); $i++) { \n\n\t\t\t$arrPrimaryQuicklinkData = array();\n\t\t\n\t\t\t$primaryQuicklinkId = $primaryQuicklinks[$i];\n\t\t\t$primary_quicklink_rank = $primaryQuicklinksRank[$primaryQuicklinkId];\n\t\t\t$primary_quicklink_rank = (!empty($primary_quicklink_rank)) \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? $primary_quicklink_rank \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 0;\n\n\t\t\t$arrPrimaryQuicklinkData['page_id'] = $id;\n\t\t\t$arrPrimaryQuicklinkData['quicklink_page_id'] = $primaryQuicklinkId;\n\t\t\t$arrPrimaryQuicklinkData['type'] = 'P';\n\t\t\t$arrPrimaryQuicklinkData['rank'] = $primary_quicklink_rank;\n\n\t\t\tinsertRow($arrPrimaryQuicklinkData, 'page_has_quicklink');\n\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Save page responsive content\n\t * Check if content record exist for this page\n\t * get all exisitng row belong to this page's content\n\t */\n\n\t$existingRows = fetchValue(\"SELECT GROUP_CONCAT(`id`) \n\t\tFROM `content_row` \n\t\tWHERE `page_meta_data_id` = '{$metaDataId}'\");\n\n\tif ($existingRows) { \n\n\t\t/** delete all columns */\n\t\trunQuery(\"DELETE FROM `content_column` \n\t\t\tWHERE `content_row_id` IN({$existingRows})\");\n\n\t\t/** delete all rows */\n\t\trunQuery(\"DELETE FROM `content_row` \n\t\t\tWHERE `id` IN($existingRows)\");\n\t}\n\n\n\tif (!empty(requestVar('row-index')) && $metaDataId) {\n\n\t\t/** save new content rows and columns */\n\t\t$rows = requestVar('row-index');\n\t\t$rowsRanks = requestVar('row-rank');\n\t\t$totalRows = count($rows);\n\n\t\tif ($totalRows > 0) { \n\n\t\t\tfor ($i=0; $i < $totalRows; $i++) { \n\n\t\t\t\t$rowData = array();\n\n\t\t\t\t$rowData['rank'] = ($rowsRanks[$i]);\n\t\t\t\t$rowData['page_meta_data_id'] = $metaDataId;\n\n\t\t\t\t$rowId = insertRow($rowData, 'content_row');\n\n\t\t\t\tif ($rowId) { \n\t\t\t\t\t\n\t\t\t\t\t$columnsRank = requestVar(\"content-{$rows[$i]}-rank\");\n\t\t\t\t\t$columnsContent = requestVar(\"content-{$rows[$i]}-text\");\n\t\t\t\t\t$columnsClass = requestVar(\"content-{$rows[$i]}-class\");\n\n\t\t\t\t\t$totalROwColumns = count($columnsContent);\n\n\t\t\t\t\tif ($totalROwColumns > 0) {\n\n\t\t\t\t\t\tfor ($k=0; $k < $totalROwColumns; $k++) { \n\n\t\t\t\t\t\t\t$columnData = array();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$columnData['content'] = $columnsContent[$k];\n\t\t\t\t\t\t\t$columnData['css_class'] = $columnsClass[$k];\n\t\t\t\t\t\t\t$columnData['rank'] = $columnsRank[$k];\n\t\t\t\t\t\t\t$columnData['content_row_id'] = $rowId;\n\n\t\t\t\t\t\t\tinsertRow($columnData, 'content_column');\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}\n\n\t/** save page modules */\n\t\n\t$moduleRank = requestVar('mp_rank');\n\t$moduleIds = requestVar('mod_id');\n\n\t$sql = \"DELETE mp.* \n\t\tFROM `module_pages` mp\n\t\tLEFT JOIN `modules` m \n\t\t \tON (m.`mod_id` = mp.`mod_id`)\n WHERE mp.`page_id` = '{$id}'\n\t\t\tAND m.`mod_showincms`='\".FLAG_YES.\"'\";\n\t\t\t\n\trunQuery($sql);\n\n\tfor ($i=0; $i <= count($moduleIds); $i++) {\n\n\t\t$arrModuleData = array();\n\n\t\tif ($moduleRank[$i] > 0) {\n\n\t\t\t$arrModuleData['page_id'] = $id;\n\t\t\t$arrModuleData['modpages_rank'] = $moduleRank[$i];\n\t\t\t$arrModuleData['mod_id'] = $moduleIds[$i];\n\n\t\t\tinsertRow($arrModuleData, 'module_pages');\n\t\t}\n\t}\n\t\n\t$message = \"Page has been saved\";\n}", "public function saveAction()\n {\n if ($data = $this->getRequest()->getPost()) {\n Mage::getModel('orderoptions/item')->update($data);\n $this->loadLayout()->renderLayout();\n } else {\n echo $this->__('Something went wrong, probably empty data has been sent');\n }\n }", "function save_object()\n {\n if(isset($_POST['classSelector']) && $_POST['classSelector'] == 1 \n && isset($_POST['edit_continue'])){\n $this->ClassName = get_post('UseTextInputName');\n $this->ClassAlreadyExists = true;\n }\n \n if(isset($_POST['classSelector']) && $_POST['classSelector'] == 2 \n && isset($_POST['edit_continue'])){\n $this->ClassAlreadyExists = false;\n $this->ClassName = get_post('SelectedClass');\n }\n }", "public function store(SavePage $request)\n {\n $user = $request->user();\n $pageData = $request->only(self::ALLOWED_FIELDS);\n\n $page = $this->pages->create($user, $pageData);\n\n if($request->menu_label) {\n $page->menu_items()->create([\n 'menuable_type' => 'page',\n 'label' => $request->menu_label,\n ]);\n }\n\n \treturn redirect()->route('admin.page.index')->withStatus(trans('admin.page.add_success'));\n }", "protected function saving()\n {\n /*\n * Compile the \"metafields\" property within the data object so that all the metafields\n * retrieved so far will get saved together with their parent object (i.e. $this)\n */\n $this->shopifyData->metafields = [];\n foreach ($this->getMetafields() as $metafield) {\n $this->savingMetafield($metafield);\n }\n }", "public function saveObject()\n\t{\n\t\t/**\n\t\t * @var $ilCtrl ilCtrl\n\t\t */\n\t\tglobal $ilCtrl;\n\n\t\ttry\n\t\t{\n\t\t\tparent::saveObject();\n\t\t}\n\t\tcatch(Exception $e)\n\t\t{\n\t\t\tif($this->plugin->txt($e->getMessage()) != '-' . $e->getMessage() . '-')\n\t\t\t{\n\t\t\t\tilUtil::sendFailure($this->plugin->txt($e->getMessage()), true);\n\t\t\t}\n\n\t\t\t$ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', (int)$_GET['ref_id']);\n\t\t\t$ilCtrl->redirectByClass('ilrepositorygui');\n\t\t}\n\t}", "function save_object($save_current= FALSE)\n {\n /* Update amount of entries displayed */\n if(isset($_POST['EntriesPerPage'])){\n $this->range = get_post('EntriesPerPage');\n }\n\n if(isset($_POST['p_server']) && isset($this->ServerList[$_POST['p_server']])){\n $this->Server = get_post('p_server');\n }\n\n if(isset($_POST['p_time'])){\n $this->Time = get_post('p_time');\n }\n if(isset($_POST['search_for'])){\n $this->Search = get_post('search_for');\n }\n if(isset($_POST['Stat'])){\n $this->Stat = get_post('Stat');\n }\n if((isset($_GET['start']))&&(is_numeric($_GET['start']))&&($_GET['start']>=0)){\n $this->Page = $_GET['start'];\n }\n\n if((isset($_GET['sort']))&&(!empty($_GET['sort']))){\n $old = $this->OrderBy;\n $this->OrderBy = $_GET['sort'];\n if($this->OrderBy == $old)\n {\n if($this->SortType== \"up\"){\n $this->SortType = \"down\";\n }else{\n $this->SortType = \"up\";\n }\n }\n }\n\n }", "function saveInSession(&$save){\n\t\tparent::saveInSession($save);\n\t\t$save[2] = $this->NavigationItems;\n\n\t}", "public function postEloquaSavedData();", "public function store()\n {\n\n if ($model = $this->form->save(Input::all())) {\n return Input::get('exit') ?\n Redirect::route('admin.pages.index') :\n Redirect::route('admin.pages.edit', $model->id) ;\n }\n\n return Redirect::route('admin.pages.create')\n ->withInput()\n ->withErrors($this->form->errors());\n\n }", "public function save_form(\\stdclass $data) {\n global $DB;\n $record = $this->workshop->get_record();\n $record->assesswithoutsubmission = (int)!empty($data->assesswithoutsubmission);\n // Intructions for reviewers.\n if ($draftitemid = $data->instructreviewerseditor['itemid']) {\n $record->instructreviewers = file_save_draft_area_files($draftitemid, $this->workshop->context->id,\n 'mod_udmworkshop',\n 'instructreviewers',\n 0, \\workshop::instruction_editors_options($this->workshop->context), $data->instructreviewerseditor['text']);\n $record->instructreviewersformat = $data->instructreviewerseditor['format'];\n }\n // Assessment start date.\n if (isset($data->assessmentstart)) {\n $record->assessmentstart = $data->assessmentstart;\n } else {\n $record->assessmentstart = 0;\n }\n // Assessment end date.\n $record->assessmentend = $data->assessmentend;\n // Anonymity settings.\n if (isset($data->displayappraiseesname)) {\n $record->displayappraiseesname = $data->displayappraiseesname;\n }\n if (isset($data->displayappraisersname)) {\n $record->displayappraisersname = $data->displayappraisersname;\n }\n $anonymitysettings = new \\mod_udmworkshop\\anonymity_settings($this->workshop->context);\n $anonymitysettings->save_changes($record);\n // Update time modified.\n $record->timemodified = time();\n $DB->update_record('udmworkshop', $record);\n }", "public function save() {\n $new = empty($this->post_id);\n\n if ($this->terms->changed())\n $this->_changed[] = 'terms';\n\n $success = $this->_save('wp.newPost', 'wp.editPost', 'post_id');\n\n if ($success) {\n //Reload object to get all the new info\n $this->load($this->post_id);\n }\n\n return $success;\n }", "public function save() {\n\t\t\t$inputs = $this->inputs;\n\t\t\t$prefix = $this->prefix;\n\t\t\tforeach ( $inputs as $input ) {\n\t\t\t\tif ( is_array( $_POST ) && array_key_exists( $input['id'], $_POST ) ) {\n\t\t\t\t\tif ( isset( $_POST[ $input['id'] ] ) ) {\n\t\t\t\t\t\tif ( is_array( $_POST[ $input['id'] ] ) ) {\n\t\t\t\t\t\t\t$data = array();\n\t\t\t\t\t\t\t$post_data = $_POST[ $input['id'] ];\n\t\t\t\t\t\t\tforeach ( $post_data as $one_data ) {\n\t\t\t\t\t\t\t\t$data[] = sanitize_text_field( $one_data );//just sanitizing fields and regrouping again into the array before saving to db\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdate_option( $prefix . $input['id'], $data );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$post_data = $_POST[ $input['id'] ];\n\t\t\t\t\t\t\tswitch ( $post_data ) {\n\t\t\t\t\t\t\t\tcase filter_var( $post_data, FILTER_VALIDATE_URL ):\n\t\t\t\t\t\t\t\t\t$data = esc_url( $post_data );\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tcase is_email( $post_data ):\n\t\t\t\t\t\t\t\t\t$data = sanitize_email( $post_data );\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t$data = sanitize_textarea_field( $post_data );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tupdate_option( $prefix . $input['id'], $data );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\twp_safe_redirect( $this->redirect );\n\t\t\texit();\n\t\t}", "private function save_post() {\n\t\t\n\t\t//Call wp function to setup saving meta box\n\t\t//add_action( 'save_post', array( $this, 'save_fields' ) );\n\t\t\n\t}", "public function store(Request $request)\n {\n $rules = [\n \"name\" => \"required|unique:navigations\",\n \"position\" => \"required\",\n \"type\" => \"required\",\n \"serial\" => \"required\",\n ];\n\n if ($request->type == 1) {\n $rules['page'] = 'required';\n } else {\n $rules['custom_url'] = 'required';\n }\n\n if ($request->position == 3) {\n $rules['footer_position'] = 'required';\n }\n\n $message = [\n 'type.required' => \"Navigation type is required\",\n ];\n\n $validation = Validator::make($request->all(), $rules, $message);\n\n if ($validation->fails()) {\n return redirect()->back()->withInput()->withErrors($validation);\n } else {\n\n $navigation = new Navigation();\n $navigation->name = $request->name;\n $navigation->position = $request->position;\n $navigation->type = $request->type;\n $navigation->type = $request->type;\n $navigation->serial = $request->serial;\n $navigation->meta_tag = $request->meta_tag;\n $navigation->meta_description = $request->meta_description;\n $navigation->footer_position = $request->footer_position ?? null;\n\n if ($request->type == 1) {\n $navigation->url = $request->page;\n } else {\n $navigation->url = $request->custom_url;\n }\n\n if ($navigation->save()) {\n session()->flash(\"success\", \"Navigation successfully created\");\n return redirect()->route(\"navigation.index\");\n } else {\n session()->flash(\"error\", \"Navigation not created\");\n return redirect()->back()->withInput();\n }\n }\n }", "function saveInfoMenu()\n\t{\n\t\t//Configure::write('debug', 2);\n\t\t$users= $this->Session->read('infoAdminLogin');\n \n Controller::loadModel('Option');\n \t$urlLocal= $this->getUrlLocal();\n \t\n if($users)\n {\n \t$id= $_POST['id'];\n \t$name= $_POST['name'];\n \t\n \t$this->Option->saveInfoMenu($name,$id);\n \t$this->redirect($urlLocal['urlOptions'].'menus');\n }\n else \n {\n $this->redirect($urlLocal['urlAdmins'].'login');\n }\n\t}", "private function saveMenu()\n\t\t{\n\t\t\t$id = (int)$_REQUEST['id'];\n\t\t\t$name = FN::sanitise($_REQUEST['name']);\n\t\t\t$value = NULL;\n\t\t\t$index = 0;\n\t\t\twhile (TRUE)\n\t\t\t{\n\t\t\t\tif (isset($_REQUEST[\"item$index\"]))\n\t\t\t\t{\n\t\t\t\t\tif (isset($_REQUEST['toDelete']) && $_REQUEST['toDelete'] == $index)\n\t\t\t\t\t{\n\t\t\t\t\t\t$index++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$template = FN::sanitise($_REQUEST[\"template$index\"]);\n\t\t\t\t\t$item = FN::sanitise($_REQUEST[\"item$index\"]);\n\t\t\t\t\tif ($value) $value .= \"\\n\";\n\t\t\t\t\t$value .= \"$template,$item\";\n\t\t\t\t\t$index++;\n\t\t\t\t}\n\t\t\t\telse break;\n\t\t\t}\n\t\t\tDB::update(\"menu\", array(\n\t\t\t\t\"name\"=>$name,\n\t\t\t\t\"value\"=>$value,\n\t\t\t\t\"user\"=>0,\n\t\t\t\t\"timestamp\"=>time(),\n\t\t\t\t\"attributes\"=>NULL\n\t\t\t\t), \"WHERE id=$id\");\n\t\t}" ]
[ "0.757595", "0.7089882", "0.68415177", "0.6781126", "0.6667388", "0.6286643", "0.6232721", "0.6094443", "0.60814804", "0.60660136", "0.60406345", "0.5950209", "0.5818307", "0.5817058", "0.57948816", "0.5792123", "0.5790882", "0.5769308", "0.57602805", "0.57328415", "0.57272834", "0.5717901", "0.5696471", "0.56923646", "0.5671472", "0.5662757", "0.56499183", "0.56299406", "0.56139576", "0.5613813" ]
0.7695747
0
Returns the navigation object from the post data
protected function _getNavigationFromPost() { $nav = new Omeka_Navigation(); $nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME); $pageUids = array(); if ($pageLinks = $this->getValue(self::HIDDEN_ELEMENT_ID)) { if ($pageLinks = json_decode($pageLinks, true)) { // add and update the pages in the navigation $pageOrder = 0; $pages = array(); $parentPageIds = array(); $pageIdsToPageUids = array(); foreach ($pageLinks as $pageLink) { $pageOrder++; // add or update the page in the navigation $pageUid = $nav->createPageUid($pageLink['uri']); if (!($page = $nav->getPageByUid($pageUid))) { $page = new Omeka_Navigation_Page_Uri(); $page->setHref($pageLink['uri']); // this sets both the uri and the fragment $page->set('uid', $pageUid); } $page->setLabel($pageLink['label']); $page->set('can_delete', (bool) $pageLink['can_delete']); $page->setVisible($pageLink['visible']); $page->setOrder($pageOrder); $parentPageIds[] = $pageLink['parent_id']; $pageUids[] = $page->uid; $pages[] = $page; $pageIdsToPageUids[strval($pageLink['id'])] = $page->uid; } // structure the parent/child relationships // this assumes that the $pages are in a flattened hierarchical order for ($i = 0; $i < $pageOrder; $i++) { $page = $pages[$i]; $page->removePages(); // remove old children pages $parentPageId = $parentPageIds[$i]; if ($parentPageId === null || !array_key_exists($parentPageId, $pageIdsToPageUids) ) { // add a page that lacks a parent $nav->addPage($page); } else { // add a child page to its parent page // we assume that all parents already exist in the navigation $parentPageUid = $pageIdsToPageUids[$parentPageId]; if (!($parentPage = $nav->getPageByUid($parentPageUid))) { throw new RuntimeException(__("Cannot find parent navigation page.")); } else { $parentPage->addPage($page); } } } } } // prune the remaining expired pages from navigation $otherPages = $nav->getOtherPages($pageUids); $expiredPages = array(); foreach ($otherPages as $otherPage) { $nav->prunePage($otherPage); } return $nav; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getCurrentNavigation()\n {\n if (get_option('page_for_' . get_post_type() . '_navigation')) {\n return get_post(get_option('page_for_' . get_post_type() . '_navigation'));\n }\n return;\n }", "protected function _saveNavigationFromPost()\n {\n $nav = $this->_getNavigationFromPost();\n $nav->saveAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);\n $this->_nav = $nav;\n }", "public function getNavigation()\n {\n return $this->_navigation;\n }", "public function createNavigationToObject()\n\t{\n\t\t$result = null;\n\n\t\tif ($this->total > $this->size)\n\t\t{\n\t\t\t$result = (object)[\n\t\t\t\t'prev' => null,\n\t\t\t\t'next' => null,\n\t\t\t\t'body' => null,\n\t\t\t];\n\n\t\t\tif ($this->block > 0)\n\t\t\t{\n\t\t\t\t$prev_block = ($this->block - 1) * $this->scale + 1;\n\t\t\t\t$str = ($prev_block == 1) ? \"\" : \"page=$prev_block\";\n\t\t\t\t$amp = ($this->tails && $str) ? \"&\" : \"\";\n\t\t\t\t$str = ($str || $this->tails) ? $this->tails.$amp.$str : \"\";\n\t\t\t\t$result->prev = (object)[\n\t\t\t\t\t'name' => 'prev',\n\t\t\t\t\t'id' => $prev_block,\n\t\t\t\t\t'url' => $str,\n\t\t\t\t];\n\t\t\t}\n\n\t\t\t$this->start_page = $this->block * $this->scale + 1;\n\n\t\t\tfor ($i=1; $i<=$this->scale && $this->start_page<=$this->page_max; $i++, $this->start_page++)\n\t\t\t{\n\t\t\t\t$k = $i - 1;\n\t\t\t\tif ($this->start_page == $this->page)\n\t\t\t\t{\n\t\t\t\t\t$result->body[$k] = (object)[\n\t\t\t\t\t\t'id' => $this->start_page,\n\t\t\t\t\t\t'name' => $this->start_page,\n\t\t\t\t\t\t'active' => true,\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$str = ($this->start_page == 1) ? \"\" : \"page=$this->start_page\";\n\t\t\t\t\t$amp = ($this->tails && $str) ? \"&\" : \"\";\n\t\t\t\t\t$str = ($str || $this->tails) ? $this->tails.$amp.$str : \"\";\n\t\t\t\t\t$result->body[$k] = (object)[\n\t\t\t\t\t\t'id' => $this->start_page,\n\t\t\t\t\t\t'name' => $this->start_page,\n\t\t\t\t\t\t'url' => $str,\n\t\t\t\t\t];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($this->page_max > ($this->block + 1) * $this->scale)\n\t\t\t{\n\t\t\t\t$next_block = ($this->block + 1) * $this->scale + 1;\n\t\t\t\t$amp = ($this->tails) ? \"&\" : \"\";\n\t\t\t\t$result->next = (object)[\n\t\t\t\t\t'name' => 'next',\n\t\t\t\t\t'id' => $next_block,\n\t\t\t\t\t'url' => \"{$this->tails}{$amp}page={$next_block}\",\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$result = null;\n\t\t}\n\n\t\treturn ($result) ? $result : null;\n\t}", "public function saveFromPost()\n {\n // Save the navigation from post\n $this->_saveNavigationFromPost();\n // Save the homepage uri\n $this->_saveHomepageFromPost();\n // Reset the form elements to display the updated navigation\n $this->_initElements();\n }", "public function navigableIn();", "public function getPost() {\n return $this->post;\n }", "function getNavigationObject(){\r\n return Zend_Registry::get('Navigation');\r\n}", "public function getPost()\n {\n return $this->post;\n }", "public function getPost()\n {\n return $this->post;\n }", "public function getPost()\n {\n return $this->post;\n }", "public function getPost()\n {\n return $this->get('post');\n }", "public function getMainNavigation(){\n\t\t\n\t\t$d = new Database();\n\t\t$d->open('hacker_blog');\n\t\t$s = $d->q(\"SELECT * FROM navigation\");\n\t\tif($s){\n\t\t\t$r = $d->mfa();\n\t\t\t$this->messages = array(\"success\"=>\"Found Navigation\");\n\t\t\t$d->close();\n\t\t\treturn $r;\n\t\t} else {\n\t\t\t$this->messages = array(\"error\"=>\"Could not Find Navigation\");\n\t\t\t$d->close();\n\t\t\treturn false;\n\t\t}\n\t}", "protected function getCurrentPage()\n {\n if (is_post_type_archive()) {\n $pageForPostType = get_option('page_for_' . get_post_type());\n return get_post($pageForPostType);\n }\n\n global $post;\n\n if (!is_object($post)) {\n return get_queried_object();\n }\n\n return $post;\n }", "function query_current_page_object(){\n parse_str($_SERVER['QUERY_STRING'], $query_string);\n\n if ($query_string['view'] == 'view_agent'){\n return Process_Data::get_agent_object($query_string['id']);\n } else if ($query_string['view'] == 'view_target') {\n return Process_Data::get_target_object($query_string['id']);\n } else {\n return null;\n }\n}", "function get_current_post_data_and_fields() {\r\n $result = [\r\n 'data'=>get_post(),\r\n 'permalink'=>get_permalink(),\r\n 'fields'=>get_field_objects()\r\n ];\r\n $result['data']->page_title = get_raw_title();\r\n $result['data']->guid = htmlspecialchars_decode($result['data']->guid);\r\n return $result;\r\n}", "public function getNavigationData($mode);", "public function getParent(): ?WpPostQueryInterface;", "public function get_current_data(){\n\t\treturn $this->current_post;\n\t}", "public function getCurrentPost() {\n\t\treturn $this->_getPost();\n\t}", "function linkedObj() {\n\t\tif(!$this->linkedObj) {\n\t\t\t$this->linkedObj = DataObject::get_by_id($this->urlParams['Class'], $this->urlParams['ID']);\n\t\t\tif(!$this->linkedObj) {\n\t\t\t\tuser_error(\"Data object '{$this->urlParams['Class']}.{$this->urlParams['ID']}' couldn't be found\", E_USER_ERROR);\n\t\t\t}\n\t\t}\t\t\t\t\n\t\treturn $this->linkedObj;\n\t}", "public static function extractLink($data)\n {\n switch ($data->type) {\n case 'Link.web':\n return WebLink::parse($data->value);\n case 'Link.document':\n return DocumentLink::parse($data->value);\n case 'Link.file';\n return FileLink::parse($data->value);\n case 'Link.image';\n return ImageLink::parse($data->value);\n default:\n return null;\n }\n }", "public function getPostAsObj() {\n $rawJsonData = file_get_contents('php://input');\n \n $oDecodedJsonData = json_decode($rawJsonData);\n // Debug::echo(StrUtil::asStr($oDecodedJsonData, 'api received POST'));\n \n return $oDecodedJsonData;\n }", "public static function post() {\n\t\treturn static::instance()->getPost();\n\t}", "public function ParsePostData() {}", "public function post(){\n\t\treturn $this->_post;\n\t}", "public function getPostData()\n {\n return $this->post;\n }", "public function getNavigation($key){\n\t\t$data = [\n\t\t\t'META_INFO' => [\n\t\t\t\t'changedID'\t\t\t=> 98765,\t\n\t\t\t],\n\t\t\t'NAV_LINKS' => [\n\t\t\t\t'Home' \t\t=> '/',\n\t\t\t\t'Sub Menu'\t=> [\n\t\t\t\t\t'Sub Menu 1' => '/google',\n\t\t\t\t\t'Sub Menu 2' => '/yahoo',\n\t\t\t\t\t'Sub Menu 3' => '/gmail',\n\t\t\t\t],\n\t\t\t]\n\t\t];\n\t\t$this -> _response($data);\n\t}", "function gcpta_posts_nav() {\n\tglobal $post;\n\t\n\tif ( ! is_post_type_archive() ) \n\t\t$nav = genesis_get_option( 'posts_nav' );\n\telse\n\t\t$nav = genesis_get_option( 'gcpta_posts_nav_' . $post->post_type, 'gcpta-settings-' . $post->post_type );\n\n\tif( 'prev-next' == $nav )\n\t\tgenesis_prev_next_posts_nav();\n\telseif( 'numeric' == $nav )\n\t\tgenesis_numeric_posts_nav();\n\telse\n\t\tgenesis_older_newer_posts_nav();\n\n}", "public function getNavigation() {\n\t\treturn false;\n\t}" ]
[ "0.6548986", "0.6389555", "0.591521", "0.5284459", "0.52646923", "0.5230135", "0.52290237", "0.5216588", "0.51546216", "0.51546216", "0.51546216", "0.5129782", "0.51212686", "0.5116998", "0.5109477", "0.5091591", "0.5048619", "0.50085807", "0.4971298", "0.49685937", "0.49479637", "0.49457234", "0.49304247", "0.48978695", "0.48851782", "0.48714128", "0.48648033", "0.48565295", "0.48515984", "0.48322904" ]
0.68235797
0
Returns JSON with the hidden info for a navigation page link.
protected function _getPageHiddenInfo(Zend_Navigation_Page $page) { $hiddenInfo = array( 'can_delete' => (bool) $page->can_delete, 'uri' => $page->getHref(), 'label' => $page->getLabel(), 'visible' => $page->isVisible(), ); return json_encode($hiddenInfo); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _getNavigationFromPost()\n {\n $nav = new Omeka_Navigation();\n $nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);\n $pageUids = array();\n if ($pageLinks = $this->getValue(self::HIDDEN_ELEMENT_ID)) {\n if ($pageLinks = json_decode($pageLinks, true)) {\n // add and update the pages in the navigation\n $pageOrder = 0;\n $pages = array();\n $parentPageIds = array();\n $pageIdsToPageUids = array();\n foreach ($pageLinks as $pageLink) {\n $pageOrder++;\n // add or update the page in the navigation\n $pageUid = $nav->createPageUid($pageLink['uri']);\n if (!($page = $nav->getPageByUid($pageUid))) {\n $page = new Omeka_Navigation_Page_Uri();\n $page->setHref($pageLink['uri']); // this sets both the uri and the fragment\n $page->set('uid', $pageUid);\n }\n $page->setLabel($pageLink['label']);\n $page->set('can_delete', (bool) $pageLink['can_delete']);\n $page->setVisible($pageLink['visible']);\n $page->setOrder($pageOrder);\n $parentPageIds[] = $pageLink['parent_id'];\n $pageUids[] = $page->uid;\n $pages[] = $page;\n $pageIdsToPageUids[strval($pageLink['id'])] = $page->uid;\n }\n\n // structure the parent/child relationships\n // this assumes that the $pages are in a flattened hierarchical order\n for ($i = 0; $i < $pageOrder; $i++) {\n $page = $pages[$i];\n $page->removePages(); // remove old children pages\n $parentPageId = $parentPageIds[$i];\n if ($parentPageId === null\n || !array_key_exists($parentPageId, $pageIdsToPageUids)\n ) {\n // add a page that lacks a parent\n $nav->addPage($page);\n } else {\n // add a child page to its parent page\n // we assume that all parents already exist in the navigation\n $parentPageUid = $pageIdsToPageUids[$parentPageId];\n if (!($parentPage = $nav->getPageByUid($parentPageUid))) {\n throw new RuntimeException(__(\"Cannot find parent navigation page.\"));\n } else {\n $parentPage->addPage($page);\n }\n }\n }\n }\n }\n // prune the remaining expired pages from navigation\n $otherPages = $nav->getOtherPages($pageUids);\n $expiredPages = array();\n foreach ($otherPages as $otherPage) {\n $nav->prunePage($otherPage);\n }\n return $nav;\n }", "public function getNavigation() {\n\t\treturn false;\n\t}", "public function getPagesLinks()\n\t{\n\t\t$app = JFactory::getApplication();\n\n\t\t// Build the page navigation list.\n\t\t$data = $this->_buildDataObject();\n\n\t\t$list = array();\n\t\t$list['prefix'] = $this->prefix;\n\n\t\tif ($data->start->base !== null)\n\t\t{\n\t\t\t$list['start']['active'] = true;\n\t\t\t$list['start']['data'] = $this->item_active($data->start);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$list['start']['active'] = false;\n\t\t\t$list['start']['data'] = $this->item_inactive($data->start);\n\t\t}\n\n\t\tif ($data->previous->base !== null)\n\t\t{\n\t\t\t$list['previous']['active'] = true;\n\t\t\t$list['previous']['data'] = $this->item_active($data->previous);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$list['previous']['active'] = false;\n\t\t\t$list['previous']['data'] = $this->item_inactive($data->previous);\n\t\t}\n\n\t\t$list['pages'] = array();\n\n\t\tforeach ($data->pages as $i => $page)\n\t\t{\n\t\t\tif ($page->base !== null)\n\t\t\t{\n\t\t\t\t$list['pages'][$i]['active'] = true;\n\t\t\t\t$list['pages'][$i]['data'] = $this->item_active($page);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$list['pages'][$i]['active'] = false;\n\t\t\t\t$list['pages'][$i]['data'] = $this->item_inactive($page);\n\t\t\t}\n\t\t}\n\n\t\tif ($data->next->base !== null)\n\t\t{\n\t\t\t$list['next']['active'] = true;\n\t\t\t$list['next']['data'] = $this->item_active($data->next);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$list['next']['active'] = false;\n\t\t\t$list['next']['data'] = $this->item_inactive($data->next);\n\t\t}\n\n\t\tif ($data->end->base !== null)\n\t\t{\n\t\t\t$list['end']['active'] = true;\n\t\t\t$list['end']['data'] = $this->item_active($data->end);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$list['end']['active'] = false;\n\t\t\t$list['end']['data'] = $this->item_inactive($data->end);\n\t\t}\n\n\t\tif ($this->total > $this->limit)\n\t\t{\n\t\t\treturn $this->_list_render($list);\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn '';\n\t\t}\n\t}", "function portal_generate_link_navigation() {\n\t\n\t$results = portal_get_child_links(0);\n\t\n\t$links = array();\n\t\t\n\tfor ($i = 0; $i < count($results); $i++) {\n\t\n\t\t$url = $results[$i]['link_href'];\n\t\t\n\t\tif ($url == '') {\n\t\t\t$url = '/links/' . $results[$i]['link_id'] . '/';\n\t\t}\n\t\t\n\t\t$al = '<a href=\"' . $url . '\" title=\"' . $results[$i]['link_title'] . '\">';\n\t\t$ar = '</a>';\n\t\n\t\tif ($GLOBALS['_PORTAL']['section'] == 'links' && $GLOBALS['_PORTAL']['activity'] == $results[$i]['link_id']) {\n\t\t\n\t\t\t// don't \"link\" this link\n\t\t\t\n\t\t\t$al = '<strong>';\n\t\t\t$ar = '</strong>';\n\t\t\n\t\t}\n\n\t\t$links[] = '<li>' . $al . $results[$i]['link_nav_title'] . $ar . '</li>';\n\t\n\t}\n\t\t\n\treturn $links;\n\n}", "function notDoneLinksAction(){\n\t\n\t\t $this->_helper->viewRenderer->setNoRender();\n\t\t $baseURI = $_REQUEST[\"baseURI\"];\n\t\t \n\t\t header('Content-Type: application/json; charset=utf8');\n\t\t echo file_get_contents($baseURI.\"/link/not-done-links\");\n\t\n }", "public function getHTMLNavigations();", "public function get_nav_links() {\n\n\t\t\treturn apply_filters( 'wapu-core/single-download/nav', array(\n\t\t\t\tarray(\n\t\t\t\t\t'id' => 'item_details',\n\t\t\t\t\t'label' => 'Item Details',\n\t\t\t\t\t'type' => 'sub',\n\t\t\t\t\t'page' => '',\n\t\t\t\t),\n\t\t\t\tarray(\n\t\t\t\t\t'id' => 'item_reviews',\n\t\t\t\t\t'label' => 'Reviews',\n\t\t\t\t\t'type' => 'sub',\n\t\t\t\t\t'page' => 'reviews',\n\t\t\t\t),\n\t\t\t\tarray(\n\t\t\t\t\t'id' => 'item_support',\n\t\t\t\t\t'label' => 'Support',\n\t\t\t\t\t'type' => 'remote',\n\t\t\t\t\t'url' => '#',\n\t\t\t\t\t'target' => '_blank',\n\t\t\t\t),\n\t\t\t) );\n\n\t\t}", "function jsonSerialize()\n {\n return [\n \"id\" => $this->id,\n \"description\" => $this->description,\n \"_links\" => [\n [\n \"rel\" => \"self\",\n \"path\" => \"/specialities/{$this->id}\"\n ],\n [\n \"rel\" => \"doctors\",\n \"path\" => \"/specialities/{$this->id}/doctors\"\n ]\n ]\n ];\n }", "public function showInNavigation();", "function the_nav(){\n\t\tglobal $data;\n\t\t$ex = func_get_args();\n\t\t$r = '';\n\t\tforeach($data['pages'] as $key => $val){\n\t\t\t$t = (isset($val['title']) ? $val['title'] : $key);\n\t\t\tif(array_search($t, $ex)===false && $val['type']!='hidden'){\n\t \t\t$r .= '<li class=\"' . $key . '\"><a href=\"' . $key . '\">' . strtoupper($t) . '</a></li>';\n\t \t}\n \t}\n \treturn '<ul>' . $r . '</ul>';\n\t}", "protected function getNav($pages) {\nglobal $_LW;\n$will_recache=false; // default to cached response\n$use_h4=($_LW->dbo->query('select', '1', 'livewhale_pages', 'livewhale_pages.host='.$_LW->escape($_LW->CONFIG['HTTP_HOST']).' AND livewhale_pages.path='.$_LW->escape($_SERVER['PHP_SELF']))->innerJoin('livewhale_tags2any', 'livewhale_tags2any.id2=livewhale_pages.id AND livewhale_tags2any.type=\"pages\"')->innerJoin('livewhale_tags', 'livewhale_tags.title=\"Include H4\" AND livewhale_tags.id=livewhale_tags2any.id1')->exists()->run() ? true : false);\n$use_h5=($_LW->dbo->query('select', '1', 'livewhale_pages', 'livewhale_pages.host='.$_LW->escape($_LW->CONFIG['HTTP_HOST']).' AND livewhale_pages.path='.$_LW->escape($_SERVER['PHP_SELF']))->innerJoin('livewhale_tags2any', 'livewhale_tags2any.id2=livewhale_pages.id AND livewhale_tags2any.type=\"pages\"')->innerJoin('livewhale_tags', 'livewhale_tags.title=\"Include H5\" AND livewhale_tags.id=livewhale_tags2any.id1')->exists()->run() ? true : false);\n$hash='handbook_'.hash('md5', serialize($pages).'_'.(!empty($use_h4) ? 'h4' : 'noh4').(!empty($use_h5) ? 'h5' : 'noh5'));\n$mtime=(int)$_LW->getVariableMTime($hash);\nforeach($pages as $path) { // for each page\n\tif ($mtime2=@filemtime($_LW->WWW_DIR_PATH.$path)) {\n\t\tif ($mtime2>$mtime) { // recache only if a page is modified since last cache\n\t\t\t$will_recache=true;\n\t\t\tbreak;\n\t\t};\n\t};\n};\nif (!empty($_LW->_GET['recache_handbook'])) {\n\t$will_recache=true;\n};\nif (empty($will_recache)) { // return cached response until any of the pages become modified\n\tif ($output=$_LW->getVariable($hash)) {\n\t\treturn $output;\n\t};\n};\n$output='<div class=\"table_of_contents\">'.\"\\n\\t\".'<h2>Table of Contents</h2>'.\"\\n\\t\".'<ul class=\"table_of_contents link-list\">';\nforeach($pages as $path) { // for each page\n\t$data=$this->getAnchorLinks($_LW->WWW_DIR_PATH.$path, false); // get anchors\n\tif (!empty($data['anchors'])) {\n\t\tforeach($data['anchors'] as $anchor) { // and build nav\n\t\t\t$output.=\"\\n\\t\\t\".'<li class=\"anchor-h'.$anchor['header'].'\"><a href=\"'.$anchor['path'].'#'.$anchor['id'].'\">'.$anchor['title'].'</a></li>';\n\t\t};\n\t};\n};\n$output.=\"\\n\\t\".'</ul>'.\"\\n\".'</div>';\n$_LW->setVariable($hash, $output, 3600); // cache response\nreturn $output;\n}", "function navigation($access=0, $page=''){\n $pages = 'menu'.'items'.'menus'.'menu_items'.'menu_sets'.'orders'.'hospitals'.\n'wards'.'beds'.'patients'.'users'.'pat_bed'.'pat_diet'.'set_location'.\n'bed_pat_diet'.'view_order'.'logs'.'login';\n if($page == ''){\n \t$nav = '';\n \t$nava = array(\n \t\t'menu' => '<li><a href=\"index.php\">[+m1+]</a></li>',\n \t\t'items' => '<li><a href=\"index.php?page=items\">[+m2+]</a></li>',\n \t\t'menus' => '<li><a href=\"index.php?page=menus\">[+m3+]</a></li>',\n \t\t'menu_items' => '<li><a href=\"index.php?page=menu_items\">[+m13+]</a></li>',\n \t\t'menu_sets' => '<li><a href=\"index.php?page=menu_sets\">[+m14+]</a></li>',\n \t\t'orders' => '<li><a href=\"index.php?page=orders\">[+m4+]</a></li>',\n \t\t'hospitals' => '<li><a href=\"index.php?page=hospitals\">[+m5+]</a></li>',\n \t\t'wards' => '<li><a href=\"index.php?page=wards\">[+m6+]</a></li>',\n \t\t'beds' => '<li><a href=\"index.php?page=beds\">[+m7+]</a></li>',\n \t\t'patients' => '<li><a href=\"index.php?page=patients\">[+m8+]</a></li>',\n \t\t'users' => '<li><a href=\"index.php?page=users\">[+m9+]</a></li>',\n \t\t'pat_bed' => '<li><a href=\"index.php?page=pat_bed\">[+m10+]</a></li>',\n \t\t'pat_diet' => '<li><a href=\"index.php?page=pat_diet\">[+m11+]</a></li>',\n \t\t'set_location' => '<li><a href=\"index.php?page=set_location\">[+m15+]</a></li>',\n \t\t'bed_pat_diet' => '<li><a href=\"index.php?page=bed_pat_diet\">[+m16+]</a></li>',\n \t\t'view_order' => '<li><a href=\"index.php?page=view_order\">[+m17+]</a></li>',\n \t\t'logs' => '<li><a href=\"index.php?page=logs\">[+m18+]</a></li>',\n \t\t'login' => '<li><a href=\"index.php?page=login\">[+m19+]</a></li>'\n \t);\n \tif($access >= 0){ // for not confirmed registred user\n \t\t$nav = $nava['menu'];\n \t}\n \tif($access >= 1){ // for confiremd registred user with minimum access level like Ward Host\n \t\t$nav .= $nava['set_location']; // $nav .= $nava['bed_pat_diet'];\n \t\t$nav .= $nava['view_order'];\n \t}\n \tif($access >= 2){ // for confiremd registred user with minimum access level like Health Care Assistant\n \t\t$nav .= $nava['bed_pat_diet']; // $nav .= $nava['users'];\n \t}\n \tif($access >= 3){\n \t\t$nav .= $nava['items'];\n \t\t$nav .= $nava['menus'];\n \t\t$nav .= $nava['menu_sets'];\n \t\t$nav .= $nava['menu_items'];\n \t}\n \tif($access >= 4){\n \t\t$nav .= $nava['hospitals'];\n \t\t$nav .= $nava['wards'];\n \t\t$nav .= $nava['beds'];\n \t\t$nav .= $nava['patients'];\n \t\t$nav .= $nava['logs'];\n \t}\n \tif($access >= 5){\n \t\t$nav .= $nava['users'];\n \t}\n \tif($access >= 6){\n \t\t$nav .= $nava['orders'];\n \t\t$nav .= $nava['pat_bed'];\n \t\t$nav .= $nava['pat_diet'];\n \t}\n \t$nav .= $nava['login'];\n \treturn $nav;\n }else{\n return strpos($pages, $page);\n }\n}", "protected function get_nav_items() {\n }", "public function getInternalLinkContent();", "function get_accessable_page_links() {\n\t// TODO: ad more links\n $links = '<ul class=\"sidebar-nav navbar-nav\">'; // start list\n $links = $links.'<li class=\"nav-item\"><a class=\"nav-link\" href=\"index.php\"><i class=\"fa fa-fw fa-dashboard\"></i> Dashboard</a> </li>';\n $links = $links.'<li class=\"nav-item active\"><a class=\"nav-link\" href=\"my_rso_list.php\"><i class=\"fa fa-fw fa-address-book\"></i> My RSOs</a> </li>';\n $links = $links.'<li class=\"nav-item\"><a class=\"nav-link\" href=\"all_universities.php\"><i class=\"fa fa-fw fa-institution\"></i> Universities</a> </li>';\n $links = $links.'<li class=\"nav-item\"><a class=\"nav-link\" href=\"my_event_list.php\"><i class=\"fa fa-fw fa-calendar-o\"></i> My Events</a> </li>';\n $links = $links.'<li class=\"nav-item\"><a class=\"nav-link\" href=\"search_join_rso.php\"><i class=\"fa fa-fw fa-search\"></i> Search/Join RSO</a> </li>';\n if ($_SESSION[\"userType\"] == \"admin\") {\n $links = $links.'<li class=\"nav-item\"><a class=\"nav-link\" href=\"rso_requests.php\"><i class=\"fa fa-fw fa-user-plus\"></i> RSO Join Requests</a> </li>';\n }\n if ($_SESSION[\"userType\"] == \"superadmin\") {\n $links = $links.'<li class=\"nav-item\"><a class=\"nav-link\" href=\"my_university_list.php\"><i class=\"fa fa-fw fa-sitemap\"></i> My Universities</a> </li>';\n $links = $links.'<li class=\"nav-item\"><a class=\"nav-link\" href=\"event_requests.php\"><i class=\"fa fa-fw fa-plus-square\"></i> Non-RSO Event Requests</a> </li>';\n }\n $links = $links.'</ul>'; // close list\n return $links;\n}", "public function getNavigation($key){\n\t\t$data = [\n\t\t\t'META_INFO' => [\n\t\t\t\t'changedID'\t\t\t=> 98765,\t\n\t\t\t],\n\t\t\t'NAV_LINKS' => [\n\t\t\t\t'Home' \t\t=> '/',\n\t\t\t\t'Sub Menu'\t=> [\n\t\t\t\t\t'Sub Menu 1' => '/google',\n\t\t\t\t\t'Sub Menu 2' => '/yahoo',\n\t\t\t\t\t'Sub Menu 3' => '/gmail',\n\t\t\t\t],\n\t\t\t]\n\t\t];\n\t\t$this -> _response($data);\n\t}", "public function getShowDetailsBack() {//http://admin.mangomolo.com/analytics/index.php/nand?scope=awaan&action=showsPage&user_id=71&key=e2c420d928d4bf8ce0ff2ec1&p_ms=1&limit_ms=3&p_ts=1&limit_ts=3&limit_fv=5&p_fv=1&limit_fs=3&p_fs=1&limit_s=2&p_s=1&limit_lv=10&p_lv=1&p_s=1&limit_lv=1&p_lv=1&no_cat=0\n $this->url = config('mangoapi.base_uri').'index.php/nand?scope='.config('mangoapi.clientscope').'&action='.config('mangoapi.showdetails2').'&key='.config('mangoapi.apikey').$this->extraquery.'&p_ms=1&limit_ms=3&p_ts=1&limit_ts=3&limit_fv=5&p_fv=1&limit_fs=10&p_fs=1&limit_s=4&p_s=1&limit_lv=10&p_lv=1&p_s=1&limit_lv=1&p_lv=1&no_cat=0&limit_sv=0&most_videos=true&channel_user_id='.\n Session::get('user')['id'].'&user_id='.config('mangoapi.user_id').'';\n if(!empty($this->url)) {\n $responses = $this->GetResponse(array('url' => $this->url));\n }\n return ($responses);\n }", "function get_navigation($conn) {\n\t$sql = \"SELECT * FROM cms_pages WHERE status = '1' and pid = '0' ORDER BY sort ASC\";\n\t$result = mysqli_query($conn, $sql);\n\tif (!$result)\n\t return false;\n\t$count_rows = mysqli_num_rows($result);\n\tif ($count_rows < 1)\n\t return false;\n\t$result = mysqli_fetch_all($result, MYSQLI_ASSOC);\n\treturn $result;\n}", "public function getHidden();", "public function displayNavigationLinks()\n {\n $html = '<ul id=\"navigation_main_list\">';\n $pageCount = 0;\n foreach ($this->_nav as $page) {\n $html .= $this->_displayNavigationPageLink($page, $pageCount);\n }\n $html .= '</ul>';\n return $html;\n }", "public function getNavigationLinks() {\n return $this->navigationLinks;\n }", "public function linkAction()\n {\n $this->saveAjax('admin-link');\n\n return [];\n }", "public function getNavigationData($mode);", "function getNavigationUrls(&$node, $mode=\"\", $filter=\"\")\n {\n global $ATK_VARS;\n\n $res = array();\n\n $count = $this->getCount($node, $mode, $filter);\n\n // maximum number of bookmarks to pages.\n $max_bm = 10;\n\n $limit = $this->getLimit($node);\n\n if (!($limit > 0 && $count > $limit && ceil($count / $limit) > 1)) return array();\n\n $pages = ceil($count / $limit);\n $curr = $this->getCurrentPage($node);\n $begpg = $curr - floor(($max_bm-1) / 2);\n $endpg = $curr + ceil(($max_bm-1) / 2);\n\n if ($begpg < 1)\n {\n $begpg = 1;\n $endpg = min($pages, $max_bm);\n }\n\n if ($endpg > $pages)\n {\n $endpg = $pages;\n $begpg = max(1,$pages - $max_bm + 1);\n }\n\n // When we are editing a page and make an update, if afterwards we navigate\n // through something we're not updating any more so we set the action to edit\n if ($node->m_action == \"update\" || $node->m_action==\"save\") $action =\"edit\";\n else $action = $node->m_action;\n\n if ($curr > 1)\n {\n $newstart = $node->m_postvars['atkstartat'] - $limit;\n $res['previous'] = array( \"title\"=>atktext(\"previous\", \"atk\"),\n \"url\"=>atkSelf().\n \"?atknodetype=\".$ATK_VARS[\"atknodetype\"].\n \"&atkaction=\".$action.\n (isset($ATK_VARS[\"atktarget\"])?\"&atktarget=\".rawurlencode($ATK_VARS[\"atktarget\"]):\"\").\n \"&atkstartat\".(isset($node->m_postvars[\"limitPostfix\"])?$node->m_postvars[\"limitPostfix\"]:\"\").\"=\".$newstart);\n }\n\n for ($i = $begpg; $i <= $endpg; $i++)\n {\n if ($i==$curr) $res[$i] = array(\"title\"=>\"<b>$i</b>\", \"url\"=>\"\");\n else $res[$i] = array(\"title\"=>$i,\n \"url\"=>atkSelf().\n \"?atknodetype=\".$ATK_VARS[\"atknodetype\"].\n \"&atkaction=\".$action.\n \"&atkstartat\".(isset($node->m_postvars[\"limitPostfix\"])?$node->m_postvars[\"limitPostfix\"]:\"\").\"=\".max(0, ($i-1) * $limit).\n (isset($ATK_VARS[\"atkselector\"])?\"&atkselector=\".rawurlencode($ATK_VARS['atkselector']):\"\").\n (isset($ATK_VARS[\"atktarget\"])?\"&atktarget=\".rawurlencode($ATK_VARS[\"atktarget\"]):\"\"));\n }\n\n if ($curr < $pages)\n {\n $newstart = $node->m_postvars['atkstartat'] + $limit;\n $res['next'] = array(\"title\"=>atktext(\"next\", \"atk\"),\n \"url\"=>atkSelf().\n \"?atknodetype=\".$ATK_VARS[\"atknodetype\"].\n \"&atkaction=\".$node->m_action.\n \"&atkstartat\".(isset($node->m_postvars[\"limitPostfix\"])?$node->m_postvars[\"limitPostfix\"]:\"\").\"=\".$newstart.\n (isset($ATK_VARS[\"atktarget\"])?\"&atktarget=\".rawurlencode($ATK_VARS[\"atktarget\"]):\"\"));\n }\n return $res;\n }", "public function navigableIn();", "function navigationArray()\n {\n return filterclass::$navigationArray;\n }", "public static function getStaicPagesDetails()\n\t{\t\t\n\t\t$session = session();\n\t\t$email_id = $session->get('email_id');\n\t\t$validation_id = $session->get('validation_id');\n\t\t$data = array();\n\t\tif(!empty($email_id) && !empty($validation_id)){\n\t\t\t\n\t\t\t$db = \\Config\\Database::connect();\n\t\t\t$builder = $db->table('247custompages'); \n\t\t\t$builder->select('*'); \n\t\t\t$builder->where('email_id', $email_id);\n\t\t\t$builder->where('token_validation_id', $validation_id);\n\t\t\t$query = $builder->get();\n\t\t\t$result = $query->getResultArray();\n\t\t\tif (count($result) > 0) {\n\t\t\t\t$data = $result;\n\t\t\t}\n\t\t}\n\t\treturn $data;\t\n\t}", "public function hideReferenceAction()\n {\n \t$reference_id = Extended\\reference_request::hideReference( Auth_UserAdapter::getIdentity ()->getId (), $this->getRequest()->getparam('reference_req_id'), \\Extended\\reference_request::VISIBILITY_CRITERIA_HIDDEN );\n \tif($reference_id)\n \t{\n \t\t$this->view->reference_not_visible=$reference_id;\n \t\techo Zend_Json::encode( 1 );\n \t}\n \tdie;\n }", "public function testNavigationLinkWithoutValidPage()\n {\n $containerMock = $this->getMock('Zend_Navigation_Container', array('findOneBy'));\n $containerMock->expects($this->once())\n ->method('findOneBy')\n ->with($this->equalTo('id'), $this->equalTo('my-page-id'))\n ->will($this->returnValue(null));\n\n $navigationMock = $this->getMock('stdClass', array('getContainer', 'menu'));\n $navigationMock->expects($this->once())\n ->method('getContainer')\n ->will($this->returnValue($containerMock));\n\n $viewMock = $this->getMock('Zend_View', array('navigation', 'escape'));\n $viewMock->expects($this->once())\n ->method('navigation')\n ->will($this->returnValue($navigationMock));\n $viewMock->expects($this->once())\n ->method('escape')\n ->will($this->returnArgument(0));\n\n $helperMock = $this->getMock('YinYang_View_Helper_NavigationLink', array('getView'));\n $helperMock->expects($this->exactly(2))\n ->method('getView')\n ->will($this->returnValue($viewMock));\n\n $this->assertSame('my-label', $helperMock->navigationLink('my-page-id', 'my-label'));\n }", "public function encode()\n\t{\n\t\t$hal = new \\Nocarrier\\Hal(Request::current()->uri(), $this->_data);\n\n\t\tforeach ($this->_links as $link)\n\t\t{\n\t\t\t$hal->addLink($link[0], $link[1], $link[2], $link[3]);\n\t\t}\n\n\t\treturn $hal->asJson();\n\t}" ]
[ "0.6023505", "0.56494856", "0.56174", "0.5482343", "0.5302223", "0.5214537", "0.5186465", "0.51631725", "0.5144679", "0.51305294", "0.50169176", "0.5007032", "0.49988192", "0.49937168", "0.49855268", "0.49732834", "0.4973207", "0.49485585", "0.49373975", "0.4916447", "0.49049732", "0.49039212", "0.49022973", "0.49009863", "0.48835096", "0.4880032", "0.4854599", "0.48479667", "0.48456067", "0.4843842" ]
0.709204
0
Returns whether the post is attempting to delete an undeletable page
protected function _postHasDeletedUndeletablePage() { // get undeleteable page uids from new navigation $nav = $this->_getNavigationFromPost(); $iterator = new RecursiveIteratorIterator($nav, RecursiveIteratorIterator::SELF_FIRST); $newUndeleteableUids = array(); foreach ($iterator as $page) { if ($page->can_delete == false) { $newUndeleteableUids[] = $page->uid; } } // make sure every undeleteable page uid from old navigation is in the list of new undeleteable page uids $nav = Omeka_Navigation::createNavigationFromFilter('public_navigation_main'); $iterator = new RecursiveIteratorIterator($nav, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $page) { if ($page->can_delete == false) { if (!in_array($page->uid, $newUndeleteableUids)) { $this->addError(__('Navigation links that have undeleteable sublinks cannot be deleted.')); return true; } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isDeletable(): bool\n {\n return !($this->hasChildren() || $this->isIndexPage() || $this->isErrorPage());\n }", "function CanDelete()\n\t{\treturn $this->CanAdminUserDelete() && !$this->attendance && (!$this->payments || $this->CanAdminUser(\"full-booking-deletions\"));\n\t}", "public function isDeletable(): bool\n {\n return !empty($this->delete);\n }", "function can_delete() {\n\t\tif ($this->permissions['all']) {\n\t\t\treturn $this->check_permission($this->permissions['all']);\n\t\t} elseif ($this->permissions['delete']) {\n\t\t\treturn $this->check_permission($this->permissions['delete']);\n\t\t} elseif ($this->object && $this->permissions['delete_own']) {\n\t\t\tif (current_user()->id == $this->object->author) {\n\t\t\t\treturn $this->check_permission($this->permissions['delete_own']);\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "protected function checkDelete(AAM_Core_Object_Post $post) {\n $result = null;\n \n if (!$post->allowed('api.delete')) {\n $result = new WP_Error(\n 'rest_post_cannot_delete', \n \"User is unauthorized to delete the post. Access denied.\", \n array(\n 'action' => 'api.delete',\n 'status' => 401\n )\n );\n }\n \n return $result;\n }", "public function isDeletable()\n {\n if($this->getPayment()){\n return false;\n }\n \n return true;\n }", "public function wantsDeletion()\n\t{\n\t\treturn ! is_null($this->deleting()) && $this->deleting()->count() > 0;\n\t}", "protected function isDeletable()\n {\n return $this->is_deletable;\n }", "function CanDelete()\n\t{\treturn $this->id && $this->CanAdminUserDelete();\n\t}", "public function isDeleted()\n {\n return 0 < ($this->getState() & self::STATE_DELETED);\n }", "public function isDeletable()\n {\n return $this->deletable && (\\Auth::user()->role == 'admin' || $this->moderationDeletable);\n }", "public function isDeletable() {\n\t\treturn (($this->userID == WCF::getUser()->userID && WCF::getUser()->getPermission('user.business.canEditOwnComment'))\n\t\t\t|| (WCF::getUser()->getPermission('mod.business.canDeleteComments')));\n\t}", "public function cantAccessDeletedOverview(): bool\n {\n return ! $this->hasRole('webmaster') && url()->current() === url('/logins/verwijderd');\n }", "public function can_delete() {\n\t\treturn false;\n\t}", "function isSoftDeletable() {\n\t\treturn $this->table->hasTemplate('Doctrine_Template_SoftDelete');\n\t}", "public function isDeleted()\n {\n return $this->object()->isDeleted();\n }", "public function isDeleted(): bool\n {\n return !$this->vc_active;\n }", "public function isDeleted() {\n return $this->status == self::STATUS_DELETED;\n }", "function allowDelete()\r\n\t{\r\n\t\tif(!$this->question_id)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t$count = count($this->Answers());\r\n\t\treturn ($count > 0) ? false : true;\r\n\t}", "public function isDeleting()\n {\n return $this->isMode(static::MODE_DELETE);\n }", "public function isDeletable()\n {\n return $this->deletable;\n }", "public function isDeleted();", "public function a_post_can_be_deleted()\n {\n $post = factory(Post::class)->create(['slug' => 'i-am-slug']);\n\n $this->be($post->user, 'api')\n ->deleteJson('api/posts/'.$post->id)\n ->assertStatus(200);\n\n $this->assertDatabaseMissing('posts', ['id' => $post->id]);\n }", "protected function _isAllowed()\n {\n return $this->_authorization->isAllowed('Pronko_TaskManagement::TaskManagement_delete');\n }", "public function isDeleted()\n {\n return $this->deleted === true;\n }", "public function authorize()\n {\n return Auth::user()->UserDeleted == false;\n }", "public function undeleteToDraft(Post $post): bool\n {\n if (!$this->blogPublishStateMachine->can($post, 'undeletetodraft')) {\n $this->addError('draft');\n return false;\n }\n $update = $this->blogPublishStateMachine->apply($post, 'undeletetodraft');\n if ($update) {\n $post->setPublishedAt(null);\n $this->entityManager->flush();\n $this->addSuccess('draft');\n return true;\n } else {\n $this->addError('draft');\n return false;\n }\n }", "public function canDelete()\n {\n if($this->authCheck($model,'delete') && $this->authIsRelated($model,'project_id',$this->_authRead('Project.id')))\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public function isDeletable()\n {\n return true;\n }", "public function hasBeenUndeleted()\n {\n return $this->object()->hasBeenUndeleted();\n }" ]
[ "0.7617622", "0.69263816", "0.68923527", "0.68493986", "0.68001777", "0.6789378", "0.6789137", "0.67285144", "0.66908777", "0.6686307", "0.6684939", "0.66663724", "0.662526", "0.66087085", "0.657088", "0.6569229", "0.6538967", "0.6531684", "0.6522939", "0.6519477", "0.6510578", "0.6509521", "0.6503944", "0.64861315", "0.64773834", "0.644698", "0.64236563", "0.6421435", "0.6419266", "0.64094657" ]
0.7776671
0
showChange Displays the change database page.
function showChange() { $main .= "<form name='dbChange' method='POST' >"; $query = Database::buildQuery("select", "db"); $dbs = Database::runQuery($query); /* Admins can see all databases regardless of ACL */ if ($_SESSION['admin'] == "t") { $availDB = $dbs; } else { foreach ($_SESSION['tables'] as $i => $table) { foreach ($dbs as $j => $db) { if ($db['db_id'] == $table['db_id']) { /* Databases ACL is based on table ACL. $j will be the same for each identical database id. */ $availDB[$j] = $db; break; } } } } /* This is the raw text and HTML. */ $main .= "Please select a database from the list. All report that you can create and run will be based on the data available within this database or datamart<br/><br/>"; $main .= "<select name='db'>"; foreach ($availDB as $i => $db) { $selected = ""; if ($db['db_id'] == $_SESSION['curDB']) { $selected = " selected"; } $main .= "<option value=".$db['db_id']." ".$selected.">".$db['db_name']."</option>"; } $main .= "</select>"; $main .= "<input type='submit' value='Change Database'>"; $main .= "</form>"; return $main; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show()\n\t{\n\t\treturn View::make('pages.changelog');\n\t}", "public function show()\n {\n return ChangeLog::view();\n }", "public function display_changelog() {\n\t\t\t//contents of changelog display page when api-key is invalid or missing. It will ONLY show the changelog (hook into existing thickbox?)\n\t\t}", "public function changesAction()\n {\n $this->disableRender(true);\n $file = file_get_contents(ROOT_DIR . '/docs/changes.txt');\n echo nl2br($file);\n }", "function makeChange() {\n\t$query = Database::buildQuery(\"select\", \"db\", array(\"db_id\"=>$_POST['db']));\n\t$dbs = Database::runQuery($query);\n\t$_SESSION['curDB'] = $_POST['db'];\n\t$_SESSION['curDB_psql'] = $dbs[0]['psql_name'];\n\tif ($_SESSION['admin'] == \"t\") {\n\t\t$query = Database::buildQuery(\"select\", \"ea_table\", array(\"db_id\"=>$_SESSION['curDB']));\n\t\t$_SESSION['tables'] = Database::runQuery($query);\n\t} else {\n\t\t$query = \"select * from ea_table t, tableacl x where t.ea_table_id=x.ea_table_id and x.username='\".$_SESSION['username'].\"' and x.access='t' and t.db_id='\".$_SESSION['curDB'].\"' \";\n\t\t$_SESSION['tables'] = Database::runQuery($query);\n\t}\n\treturn $main;\n}", "function echoChange($id_in) {\n\t$changeRaw = db(\"SELECT * FROM xalendar_changes WHERE id = \".$id_in);\n\t$numrows = $chaneRaw->num_rows;\n\tif ($numrows != 1) {\n\t\tdie(\"ERROR:\\nInvalid change ID\");\n\t}\n\t$change = $changeRaw->fetch_assoc();\n\t$changed_table = $change[\"changed_table\"];\n\t$changed_id = $change[\"changed_id\"];\n\t$change_type = $chnage[\"change_type\"];\n\t$change_user_id = $change[\"user_id\"];\n\n\techo \"CHANGE \".$changed_table.\" \".$changed_id.\" \".$change_type.\"\\n\";\n\techo \"user_id: \".$change_user_id.\"\\n\";\n\tswitch (change_type) {\n\t\tcase 'add':\n\t\t\techoEvent($changed_table, $changed_id);\n\t\t\tbreak;\n\t\tcase 'edit':\n\t\t\techoEvent($changed_table, $changed_id);\n\t\t\tbreak;\n\t\tcase 'delete':\n\t\t\t\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tdie(\"ERROR:\\nInvalid change type\");\n\t\t\tbreak;\n\t}\n}", "function showChangeName() {\r\n\r\n\t\t$this->pageTitle = 'Change Username'; \r\n\r\n\t\t$this->showHead();\r\n\r\n\t\r\n\r\n\t\techo <<<HTML\r\n\r\n\t\t<form method=\"post\">\r\n\r\n\t\t\t<input type=\"hidden\" name=\"do\" value=\"name\" />\r\n\r\n\t\t\t<div class=\"left\">Current name:</div>\r\n\r\n\t\t\t<div class=\"right current truncated\" title=\"{$this->fname} {$this->lname}\">{$this->fname} {$this->lname}</div>\r\n\r\n\t\t\t<br class=\"clear\" />\r\n\r\n\t\t\t<div class=\"left\">Edit First Name:</div>\r\n\r\n\t\t\t<div class=\"right\"><input type=\"text\" name=\"fname\" value=\"{$this->fname}\" /></div>\r\n\r\n\t\t\t<br class=\"clear\" />\r\n\r\n\t\t\t<div class=\"left\">Edit Last Name:</div>\r\n\r\n\t\t\t<div class=\"right\"><input type=\"text\" name=\"lname\" value=\"{$this->lname}\" /></div>\r\n\r\n\t\t\t<br class=\"clear\" />\r\n\r\n\t\t\t<div class=\"left\">Password:</div>\r\n\r\n\t\t\t<div class=\"right\"><input type=\"password\" name=\"password\" /></div>\r\n\r\n\t\t\t<br class=\"clear\" />\r\n\r\n\t\t\t<div class=\"note\">* Password is required for editing your name.</div><br />\r\n\r\n\t\t\t<div class=\"center\"><button type=\"submit\" id=\"submit\"><span>Save</span></button></div><br />\r\n\r\n\t\t\t{$this->errorDiv()}\t\t\t\r\n\r\n\t\t</form>\r\n\r\nHTML;\r\n\r\n\t\t\t\r\n\r\n\t\t$this->showFoot();\r\n\r\n\t}", "private function view() {\r\n\t\t$id=$this->getId();\r\n\t\tglobal $db;\r\n\t\t$viewSql='select * from '.$this->tableName.' where '.$this->idField.' = ?';\r\n\t\t//\t\tdebug($viewSql);\r\n\t\terror($row = $db->getRow($viewSql,array($id),DB_FETCHMODE_ASSOC));\r\n\t\t//\t\tdebug($row);\r\n\t\techo '<a href=\"?do=show\">返回</a> ';\r\n\t\tif (in_array('modify',$this->showActions)) {\r\n\t\t\techo '<a href=\"?do=modify&'.$this->idField.'='.$id.'\">修改</a> ';\r\n\t\t}\r\n\t\tif (in_array('delete',$this->showActions)) {\r\n\t\t\techo '<a href=\"javascript:if (confirm(\\'您确定要删除么?\\')) window.location=\\'?do=delete&'.$this->idField.'='.$row[$this->idField].'\\';\">删除</a> ';\r\n\t\t}\r\n\t\techo '<form><table class=\"grid\"><tr><th><nobr>域名</nobr></th><th><nobr>域值</nobr></th></tr>';\r\n\t\t//\t\t\tdebug($this->insertFields);\r\n\t\t//\t\tdebug($this->areaFields);\r\n\t\tforeach($this->updateFields as $fieldName) {\r\n\t\t\techo '<tr><td>'.$this->getFieldTitle($fieldName).'</td><td>';\r\n\t\t\tif (in_array($fieldName, $this->richFields)) {\r\n\t\t\t\t// 处理富文本类型域,使用FCKEditor,因为global.php中decode,需要decode\r\n\t\t\t\techo htmlspecialchars_decode($row[$fieldName]);\r\n\t\t\t} else if (in_array($fieldName, $this->areaFields)) {\r\n\t\t\t\t// 处理textarea类型域\r\n\t\t\t\techo $row[$fieldName];\r\n\t\t\t} else if (array_key_exists($fieldName, $this->listFields)) {\r\n\t\t\t\t// 处理列表类型域\r\n\t\t\t\techo $this->listFields[$fieldName][$row[$fieldName]];\r\n\t\t\t} else if (array_key_exists($fieldName, $this->refFields)) {\r\n\t\t\t\t// 处理外键类型域\r\n\t\t\t\terror($refs=$db->getAssoc($this->refFields[$fieldName]));\r\n\t\t\t\techo $refs[$row[$fieldName]];\r\n\t\t\t} else if (array_key_exists($fieldName, $this->multiChoiceFields)) {\r\n\t\t\t\t// 处理多选类型域\r\n\t\t\t\t$value=$row[$fieldName];\r\n\t\t\t\tif (trim($value)=='') {\r\n\t\t\t\t\t$choices=array();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$choices=explode(',',substr($value,1,-1));\r\n\t\t\t\t}\r\n\t\t\t\t$choiceTitle='';\r\n\t\t\t\tforeach($choices as $choice) {\r\n\t\t\t\t\t$choiceTitle.=$this->multiChoiceFields[$fieldName][intval($choice)].',';\r\n\t\t\t\t}\r\n\t\t\t\techo substr($choiceTitle,0,-1);\r\n\t\t\t} else if (array_key_exists($fieldName, $this->pwdFields)) {\r\n\t\t\t\t// 处理密码域\r\n\t\t\t\techo '********';\r\n\t\t\t} else if (array_key_exists($fieldName, $this->imageFields)) {\r\n\t\t\t\t// 处理图形类型域\r\n\t\t\t\t$value=$row[$fieldName];\r\n\t\t\t\tif (!empty($value)){\r\n\t\t\t\t\t$imageField = $this->imageFields[$fieldName];\r\n\t\t\t\t\techo '<img src=\"/upload/'.$imageField['upload'].'/full/'.$value.'\">';\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\techo $row[$fieldName];\r\n\t\t\t}\r\n\t\t\techo '</td></tr>';\r\n\t\t}\r\n\t\techo '</table>';\r\n\t}", "public function show()\n {\n ini_set('max_execution_time', 300); //300 seconds = 5 minutes\n\n $query = AppversionSetting::query();\n return DataTables::of($query)\n\n ->addColumn('action', function ($appversion) {\n $html = '';\n $html .= '<a href=\"javascript:void(0)\" data-url=\"'.route('super_admin.appversion.edit', ['appversion' => $appversion->id]) .'\" class=\"btn waves-effect waves-light btn-warning btn-icon edit-form-button\"><i class=\"icofont icofont-pen-alt-4\"></i></a>';\n return $html;\n })\n ->addIndexColumn()\n ->make(true);\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $echanges = $em->getRepository('EchangeBundle:Echange')->findAll();\n\n return $this->render('@Echange\\Default\\index.html.twig', array(\n 'echanges' => $echanges,\n ));\n }", "function show() {\r\n\t\t$this->echoHeader();\r\n\t\tif (!isset($this->selectSql)) {\r\n\t\t\t$this->selectSql=\"select * from \".$this->tableName;\r\n\t\t}\r\n\t\tif ($this->sortFields==array()) {\r\n\t\t\t$this->sortFields=array($this->idField=>'desc');\r\n\t\t}\r\n\t\t$this->numberFields=array_merge($this->numberFields,array($this->idField));\r\n\t\tglobal $db;\r\n\t\t$fieldInfos=$db->tableInfo($this->tableName);\r\n\t\tif ($this->notNullFields==array()) {\r\n\t\t\tforeach($fieldInfos as $fieldInfo) {\r\n\t\t\t\t$flags=$fieldInfo['flags'];\r\n//\t\t\t\tdebug($fieldInfo);\r\n//\t\t\t\tdebug(strpos($flags,'primary_key')===false&&strpos($flags,'timestamp')===false);\r\n\t\t\t\tif (strpos($flags,'primary_key')===false&&strpos($flags,'timestamp')===false) {\r\n\t\t\t\t\t$field=$fieldInfo['name'];\r\n\t\t\t\t\tif (!(strpos($flags,'not_null')===false)) {\r\n\t\t\t\t\t\t$this->notNullFields=array_merge($this->notNullFields,array($field));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n//\t\tdebug($this->notNullFields);\r\n\t\tforeach($fieldInfos as $fieldInfo) {\r\n//\t\t\tdebug($fieldInfo);\r\n\t\t\t$field=$fieldInfo['name'];\r\n\t\t\t$fieldType=$fieldInfo['type'];\r\n\t\t\tif ($fieldType=='string') {\r\n\t\t\t\t$this->fieldLens[$field]=$fieldInfo['len']/3;\r\n\t\t\t} else if ($fieldType=='date' || $fieldType=='datetime' ) {\r\n\t\t\t\t$this->dateFields=array_merge($this->dateFields,array($field));\r\n\t\t\t}\r\n\t\t}\r\n\t\t$do=isset($_GET[\"do\"])?$_GET['do']:'show';\r\n\t\tif ($do=='add') {\r\n\t\t\t$this->add();\r\n\t\t} else if ($do=='append') {\r\n\t\t\t$this->append();\r\n\t\t} else if ($do=='delete') {\r\n\t\t\t$this->delete();\r\n\t\t} else if ($do=='view') {\r\n\t\t\t$this->view();\r\n\t\t} else if ($do=='modify') {\r\n\t\t\t$this->modify();\r\n\t\t} else if ($do=='update') {\r\n\t\t\t$this->update();\r\n\t\t} else {\r\n\t\t\t$this->search();\r\n\t\t}\r\n\t}", "function show_edit()\n\t{\n\t\tglobal $g_db, $new, $pid;\n\n\t\tif (!empty($new)) { $this->value = $pid; }\n\t\t\n\t\t$this->tpl->set_var('name', '_f_'.$this->name);\n\t\t$this->tpl->set_var('description', $this->description);\n\t\t$this->tpl->set_var('error', $this->error);\n\t\t\n\t\tif ($this->s_order) { $this->s_order = \" ORDER BY $this->s_order \"; }\n\t\t$options = $g_db->get_result(\"SELECT $this->c_value AS o_value, $this->c_name AS o_name FROM $this->s_table $this->s_order\");\n\n\t\tif ($this->empty != 'none')\n\t\t{\n\t\t\t// pastumiam masyva per viena\n\t\t\tfor ($i = count($options); $i != 0; $i--)\n\t\t\t{\n\t\t\t\t$options[$i] = $options[$i - 1];\n\t\t\t}\n\n\t\t\t$options[0]['o_value'] = $this->empty;\n\t\t\t$options[0]['o_name'] = '';\n\t\t}\n\n\t\tfor ($i = 0; isset($options[$i]); $i++)\n\t\t{\n\t\t\tif ($options[$i]['o_value'] == $this->value) \n\t\t\t{\n\t\t\t\t$options[$i]['selected'] = 'selected';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$options[$i]['selected'] = '';\n\t\t\t}\n\n\t\t}\n\t\t\n\t\t$this->tpl->set_loop('options', $options);\n\n\t\t$out = $this->tpl->process('temp', 'avcDbSelect_edit', 2);\n\n\t\t$this->tpl->drop_var('name');\n\t\t$this->tpl->drop_var('description');\n\t\t$this->tpl->drop_var('error');\n\n\t\treturn $out;\n\t}", "public function show()\n {\n echo \"<h1> view show </h1>\";\n }", "public function showForEditHistory(){\n\t\n\t\t$histories = new History();\n\t\t$histories->showHistory();\n\t\treturn View::make('showHistoryForEdit')->with('histories',$histories->showHistory());\n\t}", "public function show()\n\t{\n\t\t//\n\n\t}", "public function showRecord()\n\t\t{\n\t\t\t\n\t\t}", "function Show()\n {\n\tif( empty($this->sort) ) {\n\t\t$this->sort='move';\n\t}\n\t$q = \"SELECT\n\t\t\t\t`\".TblSysCurrencies.\"`.id,\n\t\t\t\t`\".TblSysCurrencies.\"`.value,\n\t\t\t\t`\".TblSysCurrencies.\"`.cashless,\n\t\t\t\t`\".TblSysCurrencies.\"`.is_default,\n\t\t\t\t`\".TblSysCurrencies.\"`.move,\n\t\t\t\t`\".TblSysCurrencies.\"`.visible,\n\t\t\t\t `\".TblSysCurrenciesSprName.\"`.name,\n\t\t\t\t `\".TblSysCurrenciesSprName.\"`.pref,\n\t\t\t\t `\".TblSysCurrenciesSprName.\"`.suf,\n\t\t\t\t `\".TblSysCurrenciesSprName.\"`.short\n\t\t\tFROM `\".TblSysCurrencies.\"` , `\".TblSysCurrenciesSprName.\"`\n\t\t\tWHERE `\".TblSysCurrencies.\"`.id = `\".TblSysCurrenciesSprName.\"`.cod\n\t\t\tAND `\".TblSysCurrenciesSprName.\"`.lang_id='\".$this->lang_id.\"'\n\t\t\t\";\n\t$q = $q.\" ORDER BY `$this->sort` $this->asc_desc\";\n\t$result = $this->Right->QueryResult( $q, $this->user_id, $this->module );\n\t//echo '<br>$q='.$q.' $res='.$res.' $this->Right->result='.$this->Right->result.' $this->user_id='.$this->user_id;\n// if( !$res )return false;\n\t$rows = count($result);\n\t/* Write Form Header */\n\t$this->Form->WriteHeader( $this->script );\n\t/* Write Table Part */\n\tAdminHTML::TablePartH();\n\t?><tr><td colspan=\"12\">\n <div><?\n\t/* Write Links on Pages */\n\t$this->Form->WriteLinkPages( $this->script, $rows, $this->display, $this->start, $this->sort );\n\n\t?></div><div class=\"topPanel\"><div class=\"SavePanel\"><?\n\t/* Write Top Panel (NEW,DELETE - Buttons) */\n\t$this->Form->WriteTopPanel( $this->script );\n\n\t$linkEdit = $this->Msg['TXT_EDIT'];\n\t$txtUnvisible =$this->Msg['TXT_UNVISIBLE'];\n\t$txtVisibleBackend = $this->Msg['TXT_VISIBLE_ONLY_ON_BACKEND'];\n\t$txtVisible = $this->Msg['_TXT_VISIBLE'];\n\t?></div>\n\t<TR>\n\t<Th class=\"THead\">*</Th>\n\t<Th class=\"THead\"><?$this->Form->Link($this->script.\"&sort=id\", $this->Msg['FLD_ID']);?></Th>\n\t<Th class=\"THead\"><?=$this->Msg['_FLD_NAME'];?></Th>\n\t<Th class=\"THead\"><?=$this->Msg['_FLD_SHORT_NAME'];?></Th>\n\t<Th class=\"THead\"><?=$this->Msg['FLD_PREFIX'];?></Th>\n\t<Th class=\"THead\"><?=$this->Msg['FLD_VALUE'];?></Th>\n\t<? if($this->use_non_cash){?>\n\t<Th class=\"THead\"><?=$this->Msg['FLD_VALUE_CASHLESS'];?></Th> <?}?>\n\t<Th class=\"THead\"><?=$this->Msg['FLD_SUFIX'];?></Th>\n\t<Th class=\"THead\"><?=$this->Msg['FLD_EXAMPLE_OUTPUT'];?></Th>\n\t<Th class=\"THead\"><?=$this->Msg['FLD_DEFAULT'];?></Th>\n\t<Th class=\"THead\"><?$this->Form->Link($this->script.\"&sort=visible\", $this->Msg['_FLD_VISIBLE']);?></Th>\n\t<Th class=\"THead\"><?$this->Form->Link($this->script.\"&sort=move\", $this->Msg['FLD_DISPLAY']);?></Th>\n\t<?\n\t$a=$rows;\n\t$j = 0;\n\t$up = 0;\n\t$down = 0;\n\tfor( $i = 0; $i < $rows; ++$i )\n\t{\n\t $row = $result[$i];\n\t if( $i >=$this->start && $i < ( $this->start+$this->display ) )\n\t {\n\t\t if ( (float)$i/2 == round( $i/2 ) ){\n\t\t\t ?><tr class=\"TR1\"><?\n\t\t }\n\t\t else{\n\t\t\t ?><tr class=\"TR2\"><?\n\t\t }\n\t\t ?>\n\t\t <td align=\"center\"><?=$this->Form->CheckBox( \"id_del[]\", $row['id'] );?></td>\n\t\t <td align=\"center\"><?=$this->Form->Link( $this->script.\"&task=edit&id=\".$row['id'], stripslashes($row['id']), $linkEdit );?></td>\n\t\t <td align=\"center\"><?=$row['name'] //$this->Spr->GetNameByCod(TblSysCurrenciesSprName, $row['id'], $this->lang_id, 1);?></td>\n\t\t <td align=\"center\"><?=$row['short'] //$this->Spr->GetNameByCod(TblSysCurrenciesSprShort, $row['id'], $this->lang_id, 1);?></td>\n\t\t <td align=\"center\"><?=$row['pref']// $this->Spr->GetNameByCod(TblSysCurrenciesSprPrefix, $row['id'], $this->lang_id, 1);?></td>\n\t\t <td align=\"center\"><?=stripslashes($row['value']);?></td>\n\t\t <? if($this->use_non_cash){?>\n\t\t <td align=\"center\"><?=stripslashes($row['cashless']);?></td>\n\t\t <?}?>\n\t\t <td align=\"center\"><?=$row['suf']//$this->Spr->GetNameByCod(TblSysCurrenciesSprSufix, $row['id'], $this->lang_id, 1);?></td>\n\t\t <td align=\"left\">&nbsp;\n\t\t\t<?\n echo $this->ShowPrice(100, true, 2, $row['id']);\n echo ' = ';\n echo $this->ShowPriceWithConverting(100, true, 2, $row['id'], $this->def_curr['id'] );\n ?>\n\t </td>\n\t\t <td align=\"center\">\n\t\t <?\n\t\t if( $row['is_default']==1) $this->Form->ButtonCheck();\n\t\t ?>\n\t\t </td>\n\t\t <td align=\"center\">\n\t\t <?\n\t\t if( $row['visible'] == 0 ) $this->Form->Img( 'http://'.NAME_SERVER.'/admin/images/icons/publish_x.png', $txtUnvisible, 'border=0' );\n\t\t if( $row['visible'] == 1 ) $this->Form->Img( 'http://'.NAME_SERVER.'/admin/images/icons/publish_r.png', $txtVisibleBackend, 'border=0' );\n\t\t if( $row['visible'] == 2 ) $this->Form->Img( 'http://'.NAME_SERVER.'/admin/images/icons/publish_g.png', $txtVisible, 'border=0' );\n\t\t ?>\n\t\t </td>\n\t\t <td align=\"center\">\n\t\t <?\n\t\t if( $up!=0 )\n\t\t {\n\t\t ?>\n\t\t\t<a href=\"<?=$this->script?>&task=up&move=<?=$row['move']?>\"><?=$this->Form->ButtonUp( $row['id'] );?></a>\n\t\t <?\n\t\t }\n\t\t if( $i!=($rows-1) )\n\t\t {\n\t\t ?>\n\t\t\t <a href=\"<?=$this->script?>&task=down&move=<?=$row['move']?>\"><?=$this->Form->ButtonDown( $row['id'] );?></a>\n\t\t <?\n\t\t }\n\t\t $up=$row['id'];\n\t\t $a=$a-1;\n\t\t ?>\n\t\t </td>\n\t\t </tr>\n\t\t <?\n\t }\n\t}\n\tAdminHTML::TablePartF();\n\t/* Write Form Footer */\n\t$this->Form->WriteFooter();\n\treturn true;\n }", "function show()\r\n\t{\r\n\t\t$goods = new \\Model\\GoodsModel();\r\n\t\t$info = $goods->select();\r\n\r\n\t\t$this->assign('info', $info);\r\n\r\n\r\n\t\t$this->display();\r\n\t}", "private function displayCustomersForUpdate()\n {\n $dbDisplay = new EloDisplay();\n\n $dbDisplay->displayCustomersForUpdate();\n }", "function display() {\n $db = JFactory::getDBO();\n $db->setQuery('SET SQL_BIG_SELECTS=1');\n $db->query();\n\n require_once(JPATH_COMPONENT . DS . 'helpers' . DS . 'biblestudy.php');\n BiblestudyHelper::addSubmenu(JRequest::getWord('view', 'cpanel'));\n\n $view = JRequest::getWord('view', 'cpanel');\n $layout = JRequest::getWord('layout', 'default');\n $id = JRequest::getInt('id');\n\n $type = JRequest::getWord('view');\n if (!$type) {\n JRequest::setVar('view', 'cpanel');\n }\n if ($type == 'admin') {\n $tool = JRequest::getVar('tooltype', '', 'post');\n if ($tool) {\n switch ($tool) {\n case 'players':\n $player = $this->changePlayers();\n $this->setRedirect('index.php?option=com_biblestudy&view=admin', $player);\n break;\n\n case 'popups':\n $popups = $this->changePopup();\n $this->setRedirect('index.php?option=com_biblestudy&view=admin', $popups);\n break;\n }\n }\n }\n\n if (JRequest::getCmd('view') == 'studydetails') {\n $model = & $this->getModel('studydetails');\n }\n $fixassets = JRequest::getWord('fixassetid', '', 'get');\n if ($fixassets == 'fixassetid') {\n $dofix = $this->fixAsset_id();\n }\n parent::display();\n }", "public function show(Database $database)\n {\n //\n }", "public function getEdit($show)\n\t{\n // Title\n $title = Lang::get('admin/shows/venu.show_update');\n\n // Show the page\n return View::make('admin/shows/create_edit', compact('show', 'title'));\n\t}", "public function showwAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $notesrv = $em->getRepository('NoteserviceBundle:Notesrv')->findAll();\n\n return $this->render('notesrv/show2.html.twig', array(\n 'notesrv' => $notesrv,\n ));\n }", "public function index()\n {\n\n //Carbon::setLocale('nl');\n\n $changes = \\App\\Changes::limit(20)->get();\n\n return view('admin/dashboard')\n ->with([\n 'user' => auth()->user(),\n 'changes' => $changes\n ]);\n\n }", "public function show()\n {\n //return view('admin::show');\n }", "public function show()\n {\n //return view('admin::show');\n }", "function displayAdminPage()\r\n\t\t{\r\n\t\t\t\r\n\t\t\t$Options = $this->getAdminOptions();\r\n\t\t\t\r\n\t\t\t//fetch given file and display\r\n\t\t\tinclude \"php/admin_view.php\";\r\n\t\t}", "function display_page() {\n if ($this->db_conn) {\n parent::display_page();\n }\n }", "function showChangePassword() {\r\n\r\n\t\t$this->pageTitle = 'Change Password';\r\n\r\n\t\t$this->showHead();\r\n\r\n\t\t\r\n\r\n\t\techo <<<HTML\r\n\r\n\t\t<form method=\"post\"><br />\r\n\r\n\t\t\t<input type=\"hidden\" name=\"do\" value=\"password\" />\r\n\r\n\t\t\t<div class=\"left\">Current Password:</div>\r\n\r\n\t\t\t<div class=\"right\"><input id=\"focused\" type=\"password\" name=\"cur_password\" /></div>\r\n\r\n\t\t\t<br class=\"clear\" />\r\n\r\n\t\t\t<div class=\"left\">New Password:</div>\r\n\r\n\t\t\t<div class=\"right\"><input type=\"password\" name=\"new_password\" /></div>\r\n\r\n\t\t\t<br class=\"clear\" />\r\n\r\n\t\t\t<div class=\"left\">Retry New Password:</div>\r\n\r\n\t\t\t<div class=\"right\"><input type=\"password\" name=\"retry_new_password\" /></div>\r\n\r\n\t\t\t<br class=\"clear\" /><br />\r\n\r\n\t\t\t<div class=\"center\"><button type=\"submit\" id=\"submit\"><span>Save</span></button></div><br />\r\n\r\n\t\t\t{$this->errorDiv()}\r\n\r\n\t\t</form>\r\n\r\nHTML;\r\n\r\n\t\t\r\n\r\n\t\t$this->showFoot();\r\n\r\n\t}", "function show( $id )\n {\n\t\t$this->session->set_userdata('tag','ECM');\n\t\t$data = $this->model_ecmnote->get( $id );\n $fields = $this->model_ecmnote->fields( TRUE );\n \n $this->template->assign( 'id', $id );\n\t\t$this->template->assign( 'ecmnote_fields', $fields );\n\t\t$this->template->assign( 'data', $data );\n\t\t$this->template->assign( 'table_name', 'Ecmnote' );\n\t\t$this->template->assign( 'template', 'show_ecmnote' );\n\t\t$this->template->display( 'frame_admin.tpl' );\n }" ]
[ "0.63495255", "0.6295875", "0.61335063", "0.6047306", "0.5953366", "0.59061486", "0.58822787", "0.5764666", "0.57124496", "0.56578934", "0.5630573", "0.5629106", "0.55919755", "0.55829877", "0.5532996", "0.55242443", "0.5521457", "0.5514992", "0.549284", "0.54911476", "0.54707193", "0.5458781", "0.54496396", "0.5426329", "0.5417762", "0.5417762", "0.5414264", "0.54022366", "0.53999513", "0.53636277" ]
0.7079411
0
makeChange Changes the current database. This effects the tables and reports that can be utilised. It will update the curDB and curDB_psql SESSION variables.
function makeChange() { $query = Database::buildQuery("select", "db", array("db_id"=>$_POST['db'])); $dbs = Database::runQuery($query); $_SESSION['curDB'] = $_POST['db']; $_SESSION['curDB_psql'] = $dbs[0]['psql_name']; if ($_SESSION['admin'] == "t") { $query = Database::buildQuery("select", "ea_table", array("db_id"=>$_SESSION['curDB'])); $_SESSION['tables'] = Database::runQuery($query); } else { $query = "select * from ea_table t, tableacl x where t.ea_table_id=x.ea_table_id and x.username='".$_SESSION['username']."' and x.access='t' and t.db_id='".$_SESSION['curDB']."' "; $_SESSION['tables'] = Database::runQuery($query); } return $main; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function change()\n {\n $this->execute(\"CREATE TABLE users (\n email VARCHAR(32) PRIMARY KEY CHECK (email LIKE '%_@__%.__%'),\n passwd VARCHAR(32) NOT NULL CHECK (LENGTH(passwd) >= 6),\n first_name VARCHAR(32) NOT NULL,\n last_name VARCHAR(32) NOT NULL,\n gender CHAR(1) NOT NULL CHECK (gender IN ('M', 'F')),\n age INTEGER NOT NULL CHECK (age > 0),\n occupation VARCHAR(32) NOT NULL\n )\");\n\n $this->execute('CREATE TABLE cars (\n plate_number VARCHAR(8) PRIMARY KEY,\n driver_email VARCHAR(32) REFERENCES users(email),\n car_type VARCHAR(16) NOT NULL,\n size INTEGER NOT NULL CHECK (size > 0)\n )');\n\n $this->execute(\"CREATE TABLE administrators (\n email VARCHAR(32) PRIMARY KEY CHECK (email LIKE '%_@__%.__%'),\n passwd VARCHAR(32) NOT NULL CHECK (LENGTH(passwd) >= 6)\n )\");\n\n $this->execute('CREATE TABLE car_rides (\n plate_number VARCHAR(8) REFERENCES cars(plate_number),\n start_time TIMESTAMP NOT NULL CHECK (start_time >= NOW()::timestamp),\n origin VARCHAR(32) NOT NULL,\n destination VARCHAR(32) NOT NULL,\n price NUMERIC(15,2) NOT NULL,\n vacancy INTEGER NOT NULL CHECK (vacancy >= 0),\n PRIMARY KEY (plate_number, start_time)\n )');\n\n $this->execute('CREATE TABLE bids (\n passenger_email VARCHAR(32) REFERENCES users(email),\n plate_number VARCHAR(8),\n start_time TIMESTAMP,\n price NUMERIC(15,2) NOT NULL,\n accepted BOOLEAN NOT NULL,\n FOREIGN KEY (plate_number, start_time) REFERENCES car_rides(plate_number, start_time),\n PRIMARY KEY (passenger_email, plate_number, start_time)\n )');\n }", "public function change()\n {\n $this->execute( 'CREATE TABLE `content` (\n `content_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n `content_type` enum(\\'general\\',\\'tutorial\\') NOT NULL DEFAULT \\'general\\',\n `user_id` int(11) NOT NULL,\n `title` varchar(255) NOT NULL DEFAULT \\'\\',\n `description` varchar(1028) DEFAULT NULL,\n `video_id` int(11) DEFAULT NULL,\n `main_image_id` int(11) DEFAULT NULL,\n `card_image_id` int(11) DEFAULT NULL,\n `sort_order` int(11) NOT NULL DEFAULT \\'1\\',\n `status` enum(\\'published\\',\\'draft\\',\\'hidden\\',\\'deleted\\') NOT NULL DEFAULT \\'draft\\',\n `created_ts` datetime DEFAULT NULL,\n `updated_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n PRIMARY KEY (`content_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;' );\n\n $this->execute( 'CREATE TABLE `content_tags` (\n `content_id` int(11) unsigned NOT NULL,\n `tag_id` int(11) NOT NULL,\n `updated_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n PRIMARY KEY (`content_id`,`tag_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;' );\n\n }", "function showChange() {\n\t$main .= \"<form name='dbChange' method='POST' >\";\n\t$query = Database::buildQuery(\"select\", \"db\");\n\t$dbs = Database::runQuery($query);\n\t/* Admins can see all databases regardless of ACL */\n\tif ($_SESSION['admin'] == \"t\") {\n\t\t$availDB = $dbs;\t\n\t} else {\n\t\tforeach ($_SESSION['tables'] as $i => $table) {\n\t\t\tforeach ($dbs as $j => $db) {\n\t\t\t\tif ($db['db_id'] == $table['db_id']) {\n\t\t\t\t\t/* Databases ACL is based on table ACL. $j will be the same for each identical database id. */\n\t\t\t\t\t$availDB[$j] = $db;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t/* This is the raw text and HTML. */\n\t$main .= \"Please select a database from the list. All report that you can create and run will be based on the data available within this database or datamart<br/><br/>\";\n\t$main .= \"<select name='db'>\";\n\tforeach ($availDB as $i => $db) {\n\t\t$selected = \"\";\n\t\tif ($db['db_id'] == $_SESSION['curDB']) {\n\t\t\t$selected = \" selected\";\n\t\t}\n\t\t$main .= \"<option value=\".$db['db_id'].\" \".$selected.\">\".$db['db_name'].\"</option>\";\n\t}\n\t$main .= \"</select>\";\n\t$main .= \"<input type='submit' value='Change Database'>\";\n\t$main .= \"</form>\";\n\treturn $main;\n}", "public function change_database( $newDb )\n {\n $this->database = $newDb;\n if ( isset( $this->mysqli ) )\n {\n $this->mysqli->select_db( $newDb );\n }\n else\n {\n $this->connect();\n }\n }", "public function change()\n {\n\t // Session storage table\n\t\tif ($this->hasTable('todo_ci_sessions'))\n\t\t{\n\t\t\t$this->table('todo_ci_sessions')->drop();\n\n\t\t\t$this->table('todo_ci_sessions', [\n\t\t\t\t'id' => FALSE,\n\t\t\t\t'primary_key' => 'id'\n\t\t\t])->addColumn('id' , 'string', ['limit' => 128, 'null' => FALSE])\n\t\t\t\t->addColumn('ip_address', 'string', ['limit' => 45, 'null' => FALSE])\n\t\t\t\t->addColumn('timestamp', 'integer', ['default' => 0, 'null' => FALSE])\n\t\t\t\t->addColumn('data', 'text', ['default' => '', 'null' => FALSE])\n\t\t\t\t->create();\n\t\t}\n }", "function ChangeDatabase($strpDbname)\r\n\t{\r\n\t \t if( ! @$this->objDBLink->select_db($strpDbname) ) {\r\n\t\t\t $this->setError($this->objDBLink->errno,$this->objDBLink->error);\r\n\t\t\t throw new Exception(\"Unable to change database\" . $this->objDBLink->errno. ' ' .$this->objDBLink->error);\r\n\t\t }\r\n\t\t else\r\n\t\t $this->database = $strpDbname;\r\n\r\n\t}", "public function change()\n {\n $this->execute('\nCREATE TABLE \"users\" (\n\"id\" BIGSERIAL,\n\"username\" VARCHAR NOT NULL,\n\"email\" VARCHAR NOT NULL,\n\"password\" VARCHAR NOT NULL,\n\"status\" INTEGER NOT NULL DEFAULT 0,\n\"created_at\" TIMESTAMP,\n\"updated_at\" TIMESTAMP,\nCONSTRAINT \"users_username_unique\" UNIQUE (\"username\"),\nCONSTRAINT \"users_email_unique\" UNIQUE (\"email\"),\nPRIMARY KEY (\"id\")\n);\nCREATE INDEX \"users_created_at_index\" ON \"users\" (\"created_at\");\nCREATE INDEX \"users_updated_at_index\" ON \"users\" (\"updated_at\");\nCOMMENT ON COLUMN \"users\".\"status\" IS \\'inactive, active, banned\\';\n\nCREATE TABLE \"user_details\" (\n\"id\" BIGSERIAL,\n\"user_id\" BIGINT NOT NULL,\n\"key\" VARCHAR NOT NULL,\n\"value\" TEXT,\nCONSTRAINT \"user_details_users_user_id_id_foreign\" FOREIGN KEY (\"user_id\") REFERENCES \"users\" (\"id\") ON UPDATE NO ACTION ON DELETE CASCADE DEFERRABLE INITIALLY IMMEDIATE,\nPRIMARY KEY (\"id\")\n)\n');\n }", "private static function run_database_refactor()\n {\n global $wpdb;\n\n /**\n * First We need to create new tables\n */\n self::create_tables();\n\n Huge_Forms_DB_Refactor::init();\n\n }", "function update(){\n\t\t do_dbDelta(Configuration::getQueries());\n }", "public function change()\n {\n // NetID最大长度\n $useridLength = 50;\n // 电话号码最大长度\n $phoneLength = 20;\n // 人名的最大长度\n $nameLength = 20;\n\n // SystemInfo表\n $systemInfo = $this->table('system_info', [\n 'engine' => 'InnoDB',\n 'id' => false,\n 'primary_key' => ['key'],\n ]);\n $systemInfo->addColumn('key', 'string', ['limit' => 30, 'comment' => 'info key'])\n ->addColumn('value', 'string', ['limit' => 150, 'comment' => 'info value'])\n ->create();\n\n // User表\n $user = $this->table('user', [\n 'engine' => 'InnoDB',\n 'id' => false,\n 'primary_key' => ['userid'],\n ]);\n $user->addColumn('userid', 'string', ['limit' => $useridLength, 'comment' => '用户NetID'])\n ->addColumn('user_name', 'string', ['limit' => $phoneLength, 'comment' => '用户姓名'])\n ->addColumn('phone', 'string', ['limit' => $nameLength, 'comment' => '用户手机号'])\n ->addColumn('auth', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'comment' => '用户权限,1申请者,2审查者,3数据库管理员'])\n ->addColumn('sms', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'comment' => '是否使用短息服务'])\n ->create();\n\n // Apply表\n $apply = $this->table('apply', [\n 'engine' => 'InnoDB',\n 'signed' => false,\n ]);\n $apply->addColumn('resource_id', 'integer', ['limit' => 32767, 'signed' => false, 'comment' => '资源,如会议室、投影仪'])\n ->addColumn('applicant_userid', 'string', ['limit' => $useridLength, 'comment' => '申请者NetID'])\n ->addColumn('applicant_name', 'text', ['comment' => '申请者姓名'])\n ->addColumn('activity', 'text', ['comment' => '活动名称'])\n ->addColumn('organization', 'text', ['comment' => '申请组织'])\n ->addColumn('apply_scale', 'text', ['comment' => '申请人数'])\n ->addColumn('start_time', 'datetime', ['comment' => '申请开始时间'])\n ->addColumn('end_time', 'datetime', ['comment' => '申请结束时间'])\n ->addColumn('apply_time', 'datetime', ['comment' => '申请时间'])\n ->addColumn('phone', 'string', ['limit' => $phoneLength,'comment' => '申请者手机号'])\n ->addColumn('status', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'comment' => '申请状态,0已撤销,1审核中,2通过,3失败'])\n ->addColumn('reason', 'text', ['comment' => '拒绝原因'])\n ->addIndex(['resource_id'], ['name' => 'resource'])\n ->addIndex(['applicant_userid'], ['name' => 'userid'])\n ->addIndex(['start_time', 'end_time'], ['name' => 'target_time'])\n ->addIndex(['apply_time'], ['name' => 'apply_time'])\n ->addIndex(['phone'], ['name' => 'phone'])\n ->addIndex(['status'], ['name' => 'status'])\n ->create();\n\n // History表\n $history = $this->table('history', [\n 'engine' => 'MyISAM',\n 'signed' => false,\n ]);\n $history->addColumn('apply_id', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'comment' => '被操作申请的编号'])\n ->addColumn('detail', 'text', ['comment' => '操作详情'])\n ->addColumn('operator_userid', 'string', ['limit' => $useridLength, 'comment' => '操作者NetID'])\n ->addColumn('operator_auth', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'comment' => '操作者权限,1申请者,2审查者,3数据库管理员'])\n ->addColumn('operation_time', 'datetime', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '申请开始时间'])\n ->addIndex(['apply_id'], ['name' => 'apply_id'])\n ->addIndex(['operator_userid'], ['name' => 'userid'])\n ->addIndex(['operator_auth'], ['name' => 'auth'])\n ->addIndex(['operation_time'], ['name' => 'optime'])\n ->create();\n\n // 注意:\n // 以下两个表数据表不会经常改变,故将其改为数据库与json文件相结合的形式\n // 减轻数据库压力的同时保持可修改性\n // 查询筛选功能移至前端执行,也可以减缓服务器压力\n\n // Place表\n $place = $this->table('place', [\n 'engine' => 'InnoDB',\n 'signed' => false,\n ]);\n $place->addColumn('place_name', 'text', ['comment' => '场所名'])\n ->addColumn('location', 'text', ['comment' => '坐标(json)'])\n ->addColumn('committee', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'comment' => '场地类型,0非团委,1团委'])\n ->create();\n\n // Resource表\n $resource = $this->table('resource', [\n 'engine' => 'InnoDB',\n 'signed' => false,\n ]);\n $resource->addColumn('resource_name', 'text', ['comment' => '资源名'])\n ->addColumn('place_id', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'comment' => '场所编号'])\n ->addColumn('start', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'comment' => '开始时间'])\n ->addColumn('end', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'comment' => '结束时间'])\n ->addColumn('device', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'comment' => '资源类型,0教室,1设备'])\n ->addColumn('capacity', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'comment' => '容纳人数'])\n ->addColumn('other', 'text', ['comment' => '其他(暂留)'])\n ->create();\n\n // AdminResource表\n $admin_resource = $this->table('admin_resource', [\n 'engine' => 'InnoDB',\n 'id' => false,\n ]);\n $admin_resource->addColumn('admin_id', 'string', ['limit' => $useridLength, 'comment' => '负责人的NetID'])\n ->addColumn('resource_id', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'comment' => '资源编号'])\n ->addIndex(['admin_id', 'resource_id'], ['name' => 'link'])\n ->create();\n \n // Notification表\n $notification = $this->table('notification', [\n 'engine' => 'InnoDB',\n 'signed' => false\n ]);\n $notification->addColumn('title', 'text', ['comment' => '通知标题'])\n ->addColumn('content', 'text', ['comment' => '通知内容'])\n ->addColumn('tend', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'comment' => '通知类型, 1成功,2警告,3消息,4错误'])\n ->addColumn('overtime', 'datetime', ['comment' => '通知过期时间'])\n ->create();\n }", "public function change(): void\n {\n $table = $this->table('plugs_installed', [\n 'engine' => 'InnoDb',\n 'signed' => FALSE,\n 'comment' => '插件安装表',\n 'id' => 'id',\n ]);\n $table\n ->addColumn('plugs_name', 'string',[\n 'limit' => 50,\n 'comment'=>'插件包名'\n ])\n ->addColumn('plugs_version', 'string',[\n 'limit' => 50,\n 'comment'=>'插件包版本号'\n ])\n ->addColumn('create_time', 'datetime',[\n 'comment'=>'安装时间'\n ])\n ->create();\n \n if ($this->isMigratingUp()) {\n $table->insert([\n [\n 'plugs_name' => 'siam/plugs',\n 'plugs_version' => '1.0',\n 'create_time' => date(\"Y-m-d H:i:s\"),\n ],\n ])\n ->save();\n }\n }", "public function change()\n {\n $table = $this->table('banner');\n $table->addColumn(Column::string('link')->setDefault('http://www.baidu.com')->setComment('链接'));\n $table->save();\n\n $table = $this->table('adv');\n $table->addColumn(Column::string('link')->setDefault('http://www.baidu.com')->setComment('链接'));\n $table->save();\n\n $table = $this->table('member_store');\n $table->addColumn(Column::char('show',3)->setDefault('on')->setComment('显示'));\n $table->save();\n\n $table = $this->table('goods');\n $table->addColumn(Column::decimal('weight',18)->setDefault(0)->setComment('重量'));\n $table->save();\n\n $table = $this->table('order_send');\n $table->addColumn(Column::string('send_order')->setComment('发货编号,订单号+编号'));\n $table->save();\n\n $table = $this->table('member');\n $table->addColumn(Column::string('cover')->setNullable()->setComment('头像'));\n $table->save();\n }", "public function change()\n {\n // $q = $this->execute('CREATE VIEW `view_article_category` AS select `c`.`slug` AS `category_slug`,`articles`.`id` AS `id`,`articles`.`slug` AS `slug`,`articles`.`title` AS `title`,`articles`.`desciption` AS `desciption`,`articles`.`content` AS `content`,`articles`.`thumbnail` AS `thumbnail`,`articles`.`source_id` AS `source_id`,`articles`.`status` AS `status`,`articles`.`created` AS `created`,`articles`.`updated` AS `updated`,`articles`.`published` AS `published`, `sources`.`name` AS `url_name`, `sources`.`url` AS `url` from ((`categories` `c` left join `article_category` `ac` on((`c`.`id` = `ac`.`category_id`))) left join `articles` on((`articles`.`id` = `ac`.`article_id`)) left join `sources` on((`sources`.`id` = `articles`.`source_id`)))');\n $q = $this->execute('CREATE VIEW view_article_category AS select c.slug AS category_slug,articles.id AS id,articles.slug AS slug,articles.title AS title,articles.desciption AS desciption,articles.content AS content,articles.thumbnail AS thumbnail,articles.source_id AS source_id,articles.status AS status,articles.created AS created,articles.updated AS updated,articles.published AS published, sources.name AS url_name, sources.url AS url from ((categories c left join article_category ac on((c.id = ac.category_id))) left join articles on((articles.id = ac.article_id)) left join sources on((sources.id = articles.source_id)))');\n }", "function main_upgrade($oldversion=0) {\n\n global $CFG, $THEME, $db;\n\n $result = true;\n\n if ($oldversion == 0) {\n execute_sql(\"\n CREATE TABLE `config` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `name` (`name`)\n ) COMMENT='Moodle configuration variables';\");\n notify(\"Created a new table 'config' to hold configuration data\");\n }\n if ($oldversion < 2002073100) {\n execute_sql(\" DELETE FROM `modules` WHERE `name` = 'chat' \");\n }\n if ($oldversion < 2002080200) {\n execute_sql(\" ALTER TABLE `modules` DROP `fullname` \");\n execute_sql(\" ALTER TABLE `modules` DROP `search` \");\n }\n if ($oldversion < 2002080300) {\n execute_sql(\" ALTER TABLE `log_display` CHANGE `table` `mtable` VARCHAR( 20 ) NOT NULL \");\n execute_sql(\" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 3 ) DEFAULT '3' NOT NULL \");\n }\n if ($oldversion < 2002082100) {\n execute_sql(\" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL \");\n }\n if ($oldversion < 2002082101) {\n execute_sql(\" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` \");\n }\n if ($oldversion < 2002090100) {\n execute_sql(\" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL \");\n }\n if ($oldversion < 2002090701) {\n execute_sql(\" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 10 ) DEFAULT '3' NOT NULL \");\n execute_sql(\" ALTER TABLE `user_teachers` ADD `role` VARCHAR(40) NOT NULL AFTER `authority` \");\n }\n if ($oldversion < 2002090800) {\n execute_sql(\" ALTER TABLE `course` ADD `teachers` VARCHAR( 100 ) DEFAULT 'Teachers' NOT NULL AFTER `teacher` \");\n execute_sql(\" ALTER TABLE `course` ADD `students` VARCHAR( 100 ) DEFAULT 'Students' NOT NULL AFTER `student` \");\n }\n if ($oldversion < 2002091000) {\n execute_sql(\" ALTER TABLE `user` CHANGE `personality` `secret` VARCHAR( 15 ) DEFAULT NULL \");\n }\n if ($oldversion < 2002091400) {\n execute_sql(\" ALTER TABLE `user` ADD `lang` VARCHAR( 3 ) DEFAULT 'en' NOT NULL AFTER `country` \");\n }\n if ($oldversion < 2002091900) {\n notify(\"Most Moodle configuration variables have been moved to the database and can now be edited via the admin page.\");\n notify(\"Although it is not vital that you do so, you might want to edit <U>config.php</U> and remove all the unused settings (except the database, URL and directory definitions). See <U>config-dist.php</U> for an example of how your new slim config.php should look.\");\n }\n if ($oldversion < 2002092000) {\n execute_sql(\" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL \");\n }\n if ($oldversion < 2002092100) {\n execute_sql(\" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` \");\n }\n if ($oldversion < 2002101001) {\n execute_sql(\" ALTER TABLE `user` ADD `htmleditor` TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL AFTER `maildisplay` \");\n }\n if ($oldversion < 2002101701) {\n execute_sql(\" ALTER TABLE `reading` RENAME `resource` \"); // Small line with big consequences!\n execute_sql(\" DELETE FROM `log_display` WHERE module = 'reading'\");\n execute_sql(\" INSERT INTO log_display VALUES ('resource', 'view', 'resource', 'name') \");\n execute_sql(\" UPDATE log SET module = 'resource' WHERE module = 'reading' \");\n execute_sql(\" UPDATE modules SET name = 'resource' WHERE name = 'reading' \");\n }\n\n if ($oldversion < 2002102503) {\n execute_sql(\" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` \");\n require_once(\"$CFG->dirroot/mod/forum/lib.php\");\n require_once(\"$CFG->dirroot/course/lib.php\");\n\n if (! $module = get_record(\"modules\", \"name\", \"forum\")) {\n notify(\"Could not find forum module!!\");\n return false;\n }\n\n // First upgrade the site forums\n if ($site = get_site()) {\n print_heading(\"Making News forums editable for main site (moving to section 1)...\");\n if ($news = forum_get_course_forum($site->id, \"news\")) {\n $mod->course = $site->id;\n $mod->module = $module->id;\n $mod->instance = $news->id;\n $mod->section = 1;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the site\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n }\n\n\n // Now upgrade the courses.\n if ($courses = get_records_sql(\"SELECT * FROM course WHERE category > 0\")) {\n print_heading(\"Making News and Social forums editable for each course (moving to section 0)...\");\n foreach ($courses as $course) {\n if ($course->format == \"social\") { // we won't touch them\n continue;\n }\n if ($news = forum_get_course_forum($course->id, \"news\")) {\n $mod->course = $course->id;\n $mod->module = $module->id;\n $mod->instance = $news->id;\n $mod->section = 0;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the course '$course->fullname'\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n if ($social = forum_get_course_forum($course->id, \"social\")) {\n $mod->course = $course->id;\n $mod->module = $module->id;\n $mod->instance = $social->id;\n $mod->section = 0;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the course '$course->fullname'\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n }\n }\n }\n\n if ($oldversion < 2002111003) {\n execute_sql(\" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` \");\n if ($courses = get_records_sql(\"SELECT * FROM course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '$course->fullname'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2002111100) {\n print_simple_box_start(\"CENTER\", \"\", \"#FFCCCC\");\n echo \"<FONT SIZE=+1>\";\n echo \"<P>Changes have been made to all built-in themes, to add the new popup navigation menu.\";\n echo \"<P>If you have customised themes, you will need to edit theme/xxxx/header.html as follows:\";\n echo \"<UL><LI>Change anywhere it says <B>$\".\"button</B> to say <B>$\".\"menu</B>\";\n echo \"<LI>Add <B>$\".\"button</B> elsewhere (eg at the end of the navigation bar)</UL>\";\n echo \"<P>See the standard themes for examples, eg: theme/standard/header.html\";\n print_simple_box_end();\n }\n\n if ($oldversion < 2002111200) {\n execute_sql(\" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` \");\n }\n\n if ($oldversion < 2002111400) {\n // Rebuild all course caches, because some may not be done in new installs (eg site page)\n if ($courses = get_records_sql(\"SELECT * FROM course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '$course->fullname'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2002112000) {\n set_config(\"guestloginbutton\", 1);\n }\n\n if ($oldversion < 2002122300) {\n execute_sql(\"ALTER TABLE `log` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_admins` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_teachers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `start` `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `end` `timeend` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n }\n\n if ($oldversion < 2002122700) {\n if (! record_exists(\"log_display\", \"module\", \"user\", \"action\", \"view\")) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display VALUES ('user', 'view', 'user', 'CONCAT(firstname,' ',lastname)') \");\n }\n }\n if ($oldversion < 2003010101) {\n delete_records(\"log_display\", \"module\", \"user\");\n $new->module = \"user\";\n $new->action = \"view\";\n $new->mtable = \"user\";\n $new->field = \"CONCAT(firstname,\\\" \\\",lastname)\";\n insert_record(\"log_display\", $new);\n\n delete_records(\"log_display\", \"module\", \"course\");\n $new->module = \"course\";\n $new->action = \"view\";\n $new->mtable = \"course\";\n $new->field = \"fullname\";\n insert_record(\"log_display\", $new);\n $new->action = \"update\";\n insert_record(\"log_display\", $new);\n $new->action = \"enrol\";\n insert_record(\"log_display\", $new);\n }\n\n if ($oldversion < 2003012200) {\n // execute_sql(\" ALTER TABLE `log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL \");\n // Commented out - see below where it's done properly\n }\n\n if ($oldversion < 2003032500) {\n modify_database(\"\", \"CREATE TABLE `prefix_user_coursecreators` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`)\n ) ENGINE=MyISAM COMMENT='One record per course creator';\");\n }\n if ($oldversion < 2003032602) {\n // Redoing it because of no prefix last time\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL \");\n // Add some indexes for speed\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(course) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(userid) \");\n }\n\n if ($oldversion < 2003041400) {\n table_column(\"course_modules\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"not null\", \"score\");\n }\n\n if ($oldversion < 2003042104) { // Try to update permissions of all files\n if ($files = get_directory_list($CFG->dataroot)) {\n echo \"Attempting to update permissions for all files... ignore any errors.\";\n foreach ($files as $file) {\n echo \"$CFG->dataroot/$file<br />\";\n @chmod(\"$CFG->dataroot/$file\", $CFG->directorypermissions);\n }\n }\n }\n\n if ($oldversion < 2003042400) {\n // Rebuild all course caches, because of changes to do with visible variable\n if ($courses = get_records_sql(\"SELECT * FROM {$CFG->prefix}course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '$course->fullname'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2003042500) {\n // Convert all usernames to lowercase.\n $users = get_records_sql(\"SELECT id, username FROM {$CFG->prefix}user\");\n $cerrors = \"\";\n $rarray = array();\n\n foreach ($users as $user) { // Check for possible conflicts\n $lcname = trim(moodle_strtolower($user->username));\n if (in_array($lcname, $rarray)) {\n $cerrors .= $user->id.\"->\".$lcname.'<br/>' ;\n } else {\n array_push($rarray,$lcname);\n }\n }\n\n if ($cerrors != '') {\n notify(\"Error: Cannot convert usernames to lowercase.\n Following usernames would overlap (id->username):<br/> $cerrors .\n Please resolve overlapping errors.\");\n $result = false;\n }\n\n $cerrors = \"\";\n echo \"Checking userdatabase:<br />\";\n foreach ($users as $user) {\n $lcname = trim(moodle_strtolower($user->username));\n if ($lcname != $user->username) {\n $convert = set_field(\"user\" , \"username\" , $lcname, \"id\", $user->id);\n if (!$convert) {\n if ($cerrors){\n $cerrors .= \", \";\n }\n $cerrors .= $item;\n } else {\n echo \".\";\n }\n }\n }\n if ($cerrors != '') {\n notify(\"There were errors when converting following usernames to lowercase.\n '$cerrors' . Sorry, but you will need to fix your database by hand.\");\n $result = false;\n }\n }\n\n if ($oldversion < 2003042600) {\n /// Some more indexes - we need all the help we can get on the logs\n //execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(module) \");\n //execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(action) \");\n }\n\n if ($oldversion < 2003042700) {\n /// Changing to multiple indexes\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX module \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX action \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX course \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX userid \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX coursemoduleaction (course,module,action) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX courseuserid (course,userid) \");\n }\n\n if ($oldversion < 2003042801) {\n execute_sql(\"CREATE TABLE `{$CFG->prefix}course_display` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `course` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `display` int(10) NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `courseuserid` (course,userid)\n ) ENGINE=MyISAM COMMENT='Stores info about how to display the course'\");\n }\n\n if ($oldversion < 2003050400) {\n table_column(\"course_sections\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"\");\n }\n\n if ($oldversion < 2003050900) {\n table_column(\"modules\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"\");\n }\n\n if ($oldversion < 2003050902) {\n if (get_records(\"modules\", \"name\", \"pgassignment\")) {\n print_simple_box(\"Note: the pgassignment module has been removed (it will be replaced later by the workshop module). Go to the new 'Manage Modules' page and DELETE IT from your system\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n }\n }\n\n if ($oldversion < 2003051600) {\n print_simple_box(\"Thanks for upgrading!<p>There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n }\n\n if ($oldversion < 2003052300) {\n table_column(\"user\", \"\", \"autosubscribe\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"htmleditor\");\n }\n\n if ($oldversion < 2003072100) {\n table_column(\"course\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"marker\");\n }\n\n if ($oldversion < 2003072101) {\n table_column(\"course_sections\", \"sequence\", \"sequence\", \"text\", \"\", \"\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2003072800) {\n print_simple_box(\"The following database index improves performance, but can be quite large - if you are upgrading and you have problems with a limited quota you may want to delete this index later from the '{$CFG->prefix}log' table in your database\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n flush();\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX timecoursemoduleaction (time,course,module,action) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX courseuserid (course,userid) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX courseuserid (course,userid) \");\n }\n\n if ($oldversion < 2003072803) {\n table_column(\"course_categories\", \"\", \"description\", \"text\", \"\", \"\", \"\");\n table_column(\"course_categories\", \"\", \"parent\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course_categories\", \"\", \"sortorder\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course_categories\", \"\", \"courseorder\", \"text\", \"\", \"\", \"\");\n table_column(\"course_categories\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\");\n table_column(\"course_categories\", \"\", \"timemodified\", \"integer\", \"10\", \"unsigned\");\n }\n\n if ($oldversion < 2003080400) {\n table_column(\"course_categories\", \"courseorder\", \"courseorder\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course\", \"\", \"sortorder\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"category\");\n }\n\n if ($oldversion < 2003080700) {\n notify(\"Cleaning up categories and course ordering...\");\n fix_course_sortorder();\n }\n\n if ($oldversion < 2003081001) {\n table_column(\"course\", \"format\", \"format\", \"varchar\", \"10\", \"\", \"topics\");\n }\n\n if ($oldversion < 2003081500) {\n// print_simple_box(\"Some important changes have been made to how course creators work. Formerly, they could create new courses and assign teachers, and teachers could edit courses. Now, ordinary teachers can no longer edit courses - they <b>need to be a teacher of a course AND a course creator</b>. A new site-wide configuration variable allows you to choose whether to allow course creators to create new courses as well (by default this is off). <p>The following update will automatically convert all your existing teachers into course creators, to maintain backward compatibility. Make sure you look at your upgraded site carefully and understand these new changes.\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n\n// $count = 0;\n// $errorcount = 0;\n// if ($teachers = get_records(\"user_teachers\")) {\n// foreach ($teachers as $teacher) {\n// if (! record_exists(\"user_coursecreators\", \"userid\", $teacher->userid)) {\n// $creator = NULL;\n// $creator->userid = $teacher->userid;\n// if (!insert_record(\"user_coursecreators\", $creator)) {\n// $errorcount++;\n// } else {\n// $count++;\n// }\n// }\n// }\n// }\n// print_simple_box(\"$count teachers were upgraded to course creators (with $errorcount errors)\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n\n }\n\n if ($oldversion < 2003081501) {\n execute_sql(\" CREATE TABLE `{$CFG->prefix}scale` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `name` varchar(255) NOT NULL default '',\n `scale` text NOT NULL,\n `description` text NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (id)\n ) ENGINE=MyISAM COMMENT='Defines grading scales'\");\n\n }\n\n if ($oldversion < 2003081503) {\n table_column(\"forum\", \"\", \"scale\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"assessed\");\n get_scales_menu(0); // Just to force the default scale to be created\n }\n\n if ($oldversion < 2003081600) {\n table_column(\"user_teachers\", \"\", \"editall\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"role\");\n table_column(\"user_teachers\", \"\", \"timemodified\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"editall\");\n }\n\n if ($oldversion < 2003081900) {\n table_column(\"course_categories\", \"courseorder\", \"coursecount\", \"integer\", \"10\", \"unsigned\", \"0\");\n }\n\n if ($oldversion < 2003082001) {\n table_column(\"course\", \"\", \"showgrades\", \"integer\", \"2\", \"unsigned\", \"1\", \"\", \"format\");\n }\n\n if ($oldversion < 2003082101) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX category (category) \");\n }\n if ($oldversion < 2003082702) {\n execute_sql(\" INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname,\\\" \\\",lastname)') \");\n }\n\n if ($oldversion < 2003091400) {\n table_column(\"course_modules\", \"\", \"indent\", \"integer\", \"5\", \"unsigned\", \"0\", \"\", \"score\");\n }\n\n if ($oldversion < 2003092900) {\n table_column(\"course\", \"\", \"maxbytes\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"marker\");\n }\n\n if ($oldversion < 2003102700) {\n table_column(\"user_students\", \"\", \"timeaccess\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"time\");\n table_column(\"user_teachers\", \"\", \"timeaccess\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"timemodified\");\n\n $db->debug = false;\n $CFG->debug = 0;\n notify(\"Calculating access times. Please wait - this may take a long time on big sites...\", \"green\");\n flush();\n\n if ($courses = get_records_select(\"course\", \"category > 0\")) {\n foreach ($courses as $course) {\n notify(\"Processing $course->fullname ...\", \"green\");\n flush();\n if ($users = get_records_select(\"user_teachers\", \"course = '$course->id'\",\n \"id\", \"id, userid, timeaccess\")) {\n foreach ($users as $user) {\n $loginfo = get_record_sql(\"SELECT id, time FROM {$CFG->prefix}log WHERE course = '$course->id' and userid = '$user->userid' ORDER by time DESC\");\n if (empty($loginfo->time)) {\n $loginfo->time = 0;\n }\n execute_sql(\"UPDATE {$CFG->prefix}user_teachers SET timeaccess = '$loginfo->time'\n WHERE userid = '$user->userid' AND course = '$course->id'\", false);\n\n }\n }\n\n if ($users = get_records_select(\"user_students\", \"course = '$course->id'\",\n \"id\", \"id, userid, timeaccess\")) {\n foreach ($users as $user) {\n $loginfo = get_record_sql(\"SELECT id, time FROM {$CFG->prefix}log\n WHERE course = '$course->id' and userid = '$user->userid'\n ORDER by time DESC\");\n if (empty($loginfo->time)) {\n $loginfo->time = 0;\n }\n execute_sql(\"UPDATE {$CFG->prefix}user_students\n SET timeaccess = '$loginfo->time'\n WHERE userid = '$user->userid' AND course = '$course->id'\", false);\n\n }\n }\n }\n }\n notify(\"All courses complete.\", \"green\");\n $db->debug = true;\n }\n\n if ($oldversion < 2003103100) {\n table_column(\"course\", \"\", \"showreports\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"maxbytes\");\n }\n\n if ($oldversion < 2003121600) {\n modify_database(\"\", \"CREATE TABLE `prefix_groups` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `name` varchar(254) NOT NULL default '',\n `description` text NOT NULL,\n `lang` varchar(10) NOT NULL default 'en',\n `picture` int(10) unsigned NOT NULL default '0',\n `timecreated` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) ENGINE=MyISAM COMMENT='Each record is a group in a course.'; \");\n\n modify_database(\"\", \"CREATE TABLE `prefix_groups_members` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `groupid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `timeadded` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `groupid` (`groupid`)\n ) ENGINE=MyISAM COMMENT='Lists memberships of users in groups'; \");\n }\n\n if ($oldversion < 2003121800) {\n table_column(\"course\", \"modinfo\", \"modinfo\", \"longtext\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2003122600) {\n table_column(\"course\", \"\", \"groupmode\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"showreports\");\n table_column(\"course\", \"\", \"groupmodeforce\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"groupmode\");\n }\n\n if ($oldversion < 2004010900) {\n table_column(\"course_modules\", \"\", \"groupmode\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"visible\");\n }\n\n if ($oldversion < 2004011700) {\n modify_database(\"\", \"CREATE TABLE `prefix_event` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `description` text NOT NULL,\n `courseid` int(10) unsigned NOT NULL default '0',\n `groupid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `modulename` varchar(20) NOT NULL default '',\n `instance` int(10) unsigned NOT NULL default '0',\n `eventtype` varchar(20) NOT NULL default '',\n `timestart` int(10) unsigned NOT NULL default '0',\n `timeduration` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`)\n ) ENGINE=MyISAM COMMENT='For everything with a time associated to it'; \");\n }\n\n if ($oldversion < 2004012800) {\n modify_database(\"\", \"CREATE TABLE `prefix_user_preferences` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `name` varchar(50) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `useridname` (userid,name)\n ) ENGINE=MyISAM COMMENT='Allows modules to store arbitrary user preferences'; \");\n }\n\n if ($oldversion < 2004012900) {\n table_column(\"config\", \"value\", \"value\", \"text\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2004013101) {\n table_column(\"log\", \"\", \"cmid\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"module\");\n set_config(\"upgrade\", \"logs\");\n }\n\n if ($oldversion < 2004020900) {\n table_column(\"course\", \"\", \"lang\", \"varchar\", \"5\", \"\", \"\", \"\", \"groupmodeforce\");\n }\n\n if ($oldversion < 2004020903) {\n modify_database(\"\", \"CREATE TABLE `prefix_cache_text` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `md5key` varchar(32) NOT NULL default '',\n `formattedtext` longtext NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `md5key` (`md5key`)\n ) ENGINE=MyISAM COMMENT='For storing temporary copies of processed texts';\");\n }\n\n if ($oldversion < 2004021000) {\n $textfilters = array();\n for ($i=1; $i<=10; $i++) {\n $variable = \"textfilter$i\";\n if (!empty($CFG->$variable)) { /// No more filters\n if (is_readable(\"$CFG->dirroot/\".$CFG->$variable)) {\n $textfilters[] = $CFG->$variable;\n }\n }\n }\n $textfilters = implode(',', $textfilters);\n if (empty($textfilters)) {\n $textfilters = 'mod/glossary/dynalink.php';\n }\n set_config('textfilters', $textfilters);\n }\n\n if ($oldversion < 2004021201) {\n modify_database(\"\", \"CREATE TABLE `prefix_cache_filters` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `filter` varchar(32) NOT NULL default '',\n `version` int(10) unsigned NOT NULL default '0',\n `md5key` varchar(32) NOT NULL default '',\n `rawtext` text NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `filtermd5key` (filter,md5key)\n ) ENGINE=MyISAM COMMENT='For keeping information about cached data';\");\n }\n\n if ($oldversion < 2004021500) {\n table_column(\"groups\", \"\", \"hidepicture\", \"integer\", \"2\", \"unsigned\", \"0\", \"\", \"picture\");\n }\n\n if ($oldversion < 2004021700) {\n if (!empty($CFG->textfilters)) {\n $CFG->textfilters = str_replace(\"tex_filter.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"multilang.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"censor.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"mediaplugin.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"algebra_filter.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"dynalink.php\", \"filter.php\", $CFG->textfilters);\n set_config(\"textfilters\", $CFG->textfilters);\n }\n }\n\n if ($oldversion < 2004022000) {\n table_column(\"user\", \"\", \"emailstop\", \"integer\", \"1\", \"unsigned\", \"0\", \"not null\", \"email\");\n }\n\n if ($oldversion < 2004022200) { /// Final renaming I hope. :-)\n if (!empty($CFG->textfilters)) {\n $CFG->textfilters = str_replace(\"/filter.php\", \"\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"mod/glossary/dynalink.php\", \"mod/glossary\", $CFG->textfilters);\n $textfilters = explode(',', $CFG->textfilters);\n foreach ($textfilters as $key => $textfilter) {\n $textfilters[$key] = trim($textfilter);\n }\n set_config(\"textfilters\", implode(',',$textfilters));\n }\n }\n\n if ($oldversion < 2004030702) { /// Because of the renaming of Czech language pack\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang = 'cs' WHERE lang = 'cz'\");\n execute_sql(\"UPDATE {$CFG->prefix}course SET lang = 'cs' WHERE lang = 'cz'\");\n }\n\n if ($oldversion < 2004041800) { /// Integrate Block System from contrib\n table_column(\"course\", \"\", \"blockinfo\", \"varchar\", \"255\", \"\", \"\", \"not null\", \"modinfo\");\n }\n\n if ($oldversion < 2004042600) { /// Rebuild course caches for resource icons\n include_once(\"$CFG->dirroot/course/lib.php\");\n rebuild_course_cache();\n }\n\n if ($oldversion < 2004042700) { /// Increase size of lang fields\n table_column(\"user\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"en\");\n table_column(\"groups\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"\");\n table_column(\"course\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"\");\n }\n\n if ($oldversion < 2004042701) { /// Add hiddentopics field to control hidden topics behaviour\n table_column(\"course\", \"\", \"hiddentopics\", \"integer\", \"1\", \"unsigned\", \"0\", \"not null\", \"visible\");\n }\n\n if ($oldversion < 2004042702) { /// add a format field for the description\n table_column(\"event\", \"\", \"format\", \"integer\", \"4\", \"unsigned\", \"0\", \"not null\", \"description\");\n }\n\n if ($oldversion < 2004042900) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP `showrecent` \");\n }\n\n if ($oldversion < 2004043001) { /// Change hiddentopics to hiddensections\n table_column(\"course\", \"hiddentopics\", \"hiddensections\", \"integer\", \"2\", \"unsigned\", \"0\", \"not null\");\n }\n\n if ($oldversion < 2004050400) { /// add a visible field for events\n table_column(\"event\", \"\", \"visible\", \"tinyint\", \"1\", \"\", \"1\", \"not null\", \"timeduration\");\n if ($events = get_records('event')) {\n foreach($events as $event) {\n if ($moduleid = get_field('modules', 'id', 'name', $event->modulename)) {\n if (get_field('course_modules', 'visible', 'module', $moduleid, 'instance', $event->instance) == 0) {\n set_field('event', 'visible', 0, 'id', $event->id);\n }\n }\n }\n }\n }\n\n if ($oldversion < 2004052800) { /// First version tagged \"1.4 development\", version.php 1.227\n set_config('siteblocksadded', true); /// This will be used later by the block upgrade\n }\n\n if ($oldversion < 2004053000) { /// set defaults for site course\n $site = get_site();\n set_field('course', 'numsections', 0, 'id', $site->id);\n set_field('course', 'groupmodeforce', 1, 'id', $site->id);\n set_field('course', 'teacher', get_string('administrator'), 'id', $site->id);\n set_field('course', 'teachers', get_string('administrators'), 'id', $site->id);\n set_field('course', 'student', get_string('user'), 'id', $site->id);\n set_field('course', 'students', get_string('users'), 'id', $site->id);\n }\n\n if ($oldversion < 2004060100) {\n set_config('digestmailtime', 0);\n table_column('user', \"\", 'maildigest', 'tinyint', '1', '', '0', 'not null', 'mailformat');\n }\n\n if ($oldversion < 2004062400) {\n table_column('user_teachers', \"\", 'timeend', 'int', '10', 'unsigned', '0', 'not null', 'editall');\n table_column('user_teachers', \"\", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall');\n }\n\n if ($oldversion < 2004062401) {\n table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname');\n execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default\n }\n\n if ($oldversion < 2004062600) {\n table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang');\n }\n\n if ($oldversion < 2004072900) {\n table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate');\n }\n\n if ($oldversion < 2004072901) { // Fixing error in schema\n if ($record = get_record('log_display', 'module', 'course', 'action', 'update')) {\n delete_records('log_display', 'module', 'course', 'action', 'update');\n insert_record('log_display', $record, false, 'module');\n }\n }\n\n if ($oldversion < 2004081200) { // Fixing version errors in some blocks\n set_field('blocks', 'version', 2004081200, 'name', 'admin');\n set_field('blocks', 'version', 2004081200, 'name', 'calendar_month');\n set_field('blocks', 'version', 2004081200, 'name', 'course_list');\n }\n\n if ($oldversion < 2004081500) { // Adding new \"auth\" field to user table to allow more flexibility\n table_column('user', '', 'auth', 'varchar', '20', '', 'manual', 'not null', 'id');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = 'manual'\"); // Set everyone to 'manual' to be sure\n\n if ($admins = get_admins()) { // Set all the NON-admins to whatever the current auth module is\n $adminlist = array();\n foreach ($admins as $user) {\n $adminlist[] = $user->id; \n }\n $adminlist = implode(',', $adminlist);\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)\");\n }\n }\n \n if ($oldversion < 2004082200) { // Making admins teachers on site course\n $site = get_site();\n $admins = get_admins();\n foreach ($admins as $admin) {\n add_teacher($admin->id, $site->id);\n }\n }\n\n if ($oldversion < 2004082600) {\n //update auth-fields for external users\n include_once ($CFG->dirroot.\"/auth/\".$CFG->auth.\"/lib.php\");\n if (function_exists('auth_get_userlist')) {\n $externalusers = auth_get_userlist();\n if (!empty($externalusers)){\n $externalusers = '\\''. implode('\\',\\'',$externalusers).'\\'';\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE username IN ($externalusers)\");\n }\n }\n }\n\n if ($oldversion < 2004082900) { // Make sure guest is \"manual\" too.\n set_field('user', 'auth', 'manual', 'username', 'guest');\n }\n \n /* Commented out unused guid-field code\n if ($oldversion < 2004090300) { // Add guid-field used in user syncronization\n table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth');\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX authguid (auth, guid)\");\n }\n */\n\n if ($oldversion < 2004091900) { // modify idnumber to hold longer values\n table_column('user', 'idnumber', 'idnumber', 'varchar', '64', '', '', '', '');\n execute_sql(\"ALTER TABLE {$CFG->prefix}user DROP INDEX user_idnumber\",false); // added in case of conflicts with upgrade from 14stable\n execute_sql(\"ALTER TABLE {$CFG->prefix}user DROP INDEX user_auth\",false); // added in case of conflicts with upgrade from 14stable\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX idnumber (idnumber)\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX auth (auth)\");\n }\n\n if ($oldversion < 2004093001) { // add new table for sessions storage\n execute_sql(\" CREATE TABLE `{$CFG->prefix}sessions` (\n `sesskey` char(32) NOT null,\n `expiry` int(11) unsigned NOT null,\n `expireref` varchar(64),\n `data` text NOT null,\n PRIMARY KEY (`sesskey`), \n KEY (`expiry`) \n ) ENGINE=MyISAM COMMENT='Optional database session storage, not used by default';\");\n }\n\n if ($oldversion < 2004111500) { // Update any users/courses using wrongly-named lang pack\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang = 'mi_nt' WHERE lang = 'ma_nt'\");\n execute_sql(\"UPDATE {$CFG->prefix}course SET lang = 'mi_nt' WHERE lang = 'ma_nt'\");\n }\n\n if ($oldversion < 2004111700) { // add indexes. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP INDEX idnumber;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP INDEX shortname;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` DROP INDEX userid;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` DROP INDEX userid;\",false);\n\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX idnumber (idnumber);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX shortname (shortname);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX userid (userid);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX userid (userid);\");\n }\n\n if ($oldversion < 2004111700) {// add an index to event for timestart and timeduration. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}event DROP INDEX timestart;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}event DROP INDEX timeduration;\",false); \n\n modify_database('','ALTER TABLE prefix_event ADD INDEX timestart (timestart);');\n modify_database('','ALTER TABLE prefix_event ADD INDEX timeduration (timeduration);');\n }\n\n if ($oldversion < 2004111700) { //add indexes on modules and course_modules. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key visible;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key course;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key module;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key instance;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key deleted;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}modules drop key name;\",false);\n\n modify_database('','ALTER TABLE prefix_course_modules add key visible(visible);');\n modify_database('','ALTER TABLE prefix_course_modules add key course(course);');\n modify_database('','ALTER TABLE prefix_course_modules add key module(module);');\n modify_database('','ALTER TABLE prefix_course_modules add key instance (instance);');\n modify_database('','ALTER TABLE prefix_course_modules add key deleted (deleted);');\n modify_database('','ALTER TABLE prefix_modules add key name(name);');\n }\n\n if ($oldversion < 2004111700) { // add an index on the groups_members table. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}groups_members DROP INDEX userid;\",false);\n\n modify_database('','ALTER TABLE prefix_groups_members ADD INDEX userid (userid);');\n }\n\n if ($oldversion < 2004111700) { // add an index on user students timeaccess (used for sorting)- drop them first silently to avoid conflicts when upgrading\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_students DROP INDEX timeaccess;\",false);\n\n modify_database('','ALTER TABLE prefix_user_students ADD INDEX timeaccess (timeaccess);');\n }\n\n if ($oldversion < 2004111700) { // add indexes on faux-foreign keys. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}scale DROP INDEX courseid;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_admins DROP INDEX userid;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_coursecreators DROP INDEX userid;\",false);\n\n modify_database('','ALTER TABLE prefix_scale ADD INDEX courseid (courseid);');\n modify_database('','ALTER TABLE prefix_user_admins ADD INDEX userid (userid);');\n modify_database('','ALTER TABLE prefix_user_coursecreators ADD INDEX userid (userid);');\n }\n\n if ($oldversion < 2004111700) { // replace index on course\n fix_course_sortorder(0,0,1);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}course` DROP KEY category\",false);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}course` DROP KEY category_sortorder;\",false);\n modify_database('', \"ALTER TABLE `prefix_course` ADD UNIQUE KEY category_sortorder(category,sortorder)\"); \n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;\",false); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;\",false); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;\",false);\n\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_deleted_idx (deleted)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_confirmed_idx (confirmed)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_firstname_idx (firstname)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastname_idx (lastname)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_city_idx (city)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_country_idx (country)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastaccess_idx (lastaccess)\");\n }\n \n if ($oldversion < 2004111700) { // one more index for email (for sorting)\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_email_idx;\",false);\n modify_database('','ALTER TABLE `prefix_user` ADD INDEX prefix_user_email_idx (email);');\n }\n\n if ($oldversion < 2004112200) { // new 'enrol' field for enrolment tables\n table_column('user_students', '', 'enrol', 'varchar', '20', '', '', 'not null');\n table_column('user_teachers', '', 'enrol', 'varchar', '20', '', '', 'not null');\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX enrol (enrol);\");\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX enrol (enrol);\");\n }\n \n if ($oldversion < 2004112400) {\n /// Delete duplicate enrolments \n /// and then tell the database course,userid is a unique combination\n if ($users = get_records_select(\"user_students\", \"userid > 0 GROUP BY course, userid \".\n \"HAVING count(*) > 1\", \"\", \"max(id) as id, userid, course ,count(*)\")) {\n foreach ($users as $user) {\n delete_records_select(\"user_students\", \"userid = '$user->userid' \".\n \"AND course = '$user->course' AND id <> '$user->id'\");\n }\n }\n flush();\n \n modify_database('','ALTER TABLE prefix_user_students DROP INDEX courseuserid;');\n modify_database('','ALTER TABLE prefix_user_students ADD UNIQUE INDEX courseuserid(course,userid);'); \n\n /// Delete duplicate teacher enrolments \n /// and then tell the database course,userid is a unique combination\n if ($users = get_records_select(\"user_teachers\", \"userid > 0 GROUP BY course, userid \".\n \"HAVING count(*) > 1\", \"\", \"max(id) as id, userid, course ,count(*)\")) {\n foreach ($users as $user) {\n delete_records_select(\"user_teachers\", \"userid = '$user->userid' \".\n \"AND course = '$user->course' AND id <> '$user->id'\");\n }\n }\n flush();\n modify_database('','ALTER TABLE prefix_user_teachers DROP INDEX courseuserid;');\n modify_database('','ALTER TABLE prefix_user_teachers ADD UNIQUE INDEX courseuserid(course,userid);'); \n } \n\n if ($oldversion < 2004112900) {\n table_column('user', '', 'policyagreed', 'integer', '1', 'unsigned', '0', 'not null', 'confirmed');\n }\n\n if ($oldversion < 2004121400) {\n table_column('groups', '', 'password', 'varchar', '50', '', '', 'not null', 'description');\n }\n\n if ($oldversion < 2004121500) {\n modify_database('',\"CREATE TABLE prefix_dst_preset (\n id int(10) NOT NULL auto_increment,\n name char(48) default '' NOT NULL,\n \n apply_offset tinyint(3) default '0' NOT NULL,\n \n activate_index tinyint(1) default '1' NOT NULL,\n activate_day tinyint(1) default '1' NOT NULL,\n activate_month tinyint(2) default '1' NOT NULL,\n activate_time char(5) default '03:00' NOT NULL,\n \n deactivate_index tinyint(1) default '1' NOT NULL,\n deactivate_day tinyint(1) default '1' NOT NULL,\n deactivate_month tinyint(2) default '2' NOT NULL,\n deactivate_time char(5) default '03:00' NOT NULL,\n \n last_change int(10) default '0' NOT NULL,\n next_change int(10) default '0' NOT NULL,\n current_offset tinyint(3) default '0' NOT NULL,\n \n PRIMARY KEY (id))\");\n } \n\n if ($oldversion < 2004122800) {\n execute_sql(\"DROP TABLE {$CFG->prefix}message\", false);\n execute_sql(\"DROP TABLE {$CFG->prefix}message_read\", false);\n execute_sql(\"DROP TABLE {$CFG->prefix}message_contacts\", false);\n\n modify_database('',\"CREATE TABLE `prefix_message` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `useridfrom` int(10) NOT NULL default '0',\n `useridto` int(10) NOT NULL default '0',\n `message` text NOT NULL,\n `timecreated` int(10) NOT NULL default '0',\n `messagetype` varchar(50) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `useridfrom` (`useridfrom`),\n KEY `useridto` (`useridto`)\n ) ENGINE=MyISAM COMMENT='Stores all unread messages';\");\n\n modify_database('',\"CREATE TABLE `prefix_message_read` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `useridfrom` int(10) NOT NULL default '0',\n `useridto` int(10) NOT NULL default '0',\n `message` text NOT NULL,\n `timecreated` int(10) NOT NULL default '0',\n `timeread` int(10) NOT NULL default '0',\n `messagetype` varchar(50) NOT NULL default '',\n `mailed` tinyint(1) NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `useridfrom` (`useridfrom`),\n KEY `useridto` (`useridto`)\n ) ENGINE=MyISAM COMMENT='Stores all messages that have been read';\");\n\n modify_database('',\"CREATE TABLE `prefix_message_contacts` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `contactid` int(10) unsigned NOT NULL default '0',\n `blocked` tinyint(1) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `usercontact` (`userid`,`contactid`)\n ) ENGINE=MyISAM COMMENT='Maintains lists of relationships between users';\");\n\n modify_database('', \"INSERT INTO prefix_log_display VALUES ('message', 'write', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display VALUES ('message', 'read', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n }\n\n if ($oldversion < 2004122801) {\n table_column('message', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message');\n table_column('message_read', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message');\n }\n\n if ($oldversion < 2005010100) {\n modify_database('', \"INSERT INTO prefix_log_display VALUES ('message', 'add contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display VALUES ('message', 'remove contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display VALUES ('message', 'block contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display VALUES ('message', 'unblock contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n }\n\n if ($oldversion < 2005011000) { // Create a .htaccess file in dataroot, just in case\n if (!file_exists($CFG->dataroot.'/.htaccess')) {\n if ($handle = fopen($CFG->dataroot.'/.htaccess', 'w')) { // For safety\n @fwrite($handle, \"deny from all\\r\\n\");\n @fclose($handle); \n notify(\"Created a default .htaccess file in $CFG->dataroot\");\n }\n }\n }\n \n\n if ($oldversion < 2005012500) { \n /*\n // add new table for meta courses.\n modify_database(\"\",\"CREATE TABLE `prefix_meta_course` (\n `id` int(1) unsigned NOT NULL auto_increment,\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course)\n );\");\n // add flag to course field\n table_column('course','','meta_course','integer','1','','0','not null');\n */ // taking this OUT for upgrade from 1.4 to 1.5 (those tracking head will have already seen it)\n }\n\n if ($oldversion < 2005012501) { \n execute_sql(\"DROP TABLE {$CFG->prefix}meta_course\",false); // drop silently\n execute_sql(\"ALTER TABLE {$CFG->prefix}course DROP COLUMN meta_course\",false); // drop silently\n \n // add new table for meta courses.\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course)\n );\");\n // add flag to course field\n table_column('course','','metacourse','integer','1','','0','not null');\n }\n\n if ($oldversion < 2005012800) {\n // fix a typo (int 1 becomes int 10) \n table_column('course_meta','id','id','integer','10','','0','not null');\n }\n\n if ($oldversion < 2005020100) {\n fix_course_sortorder(0, 1, 1);\n } \n\n\n if ($oldversion < 2005020101) {\n // hopefully this is the LAST TIME we need to do this ;)\n if ($rows = count_records(\"course_meta\")) {\n // we need to upgrade\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta_tmp` (\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0);\");\n \n execute_sql(\"INSERT INTO {$CFG->prefix}course_meta_tmp (parent_course,child_course) \n SELECT {$CFG->prefix}course_meta.parent_course, {$CFG->prefix}course_meta.child_course\n FROM {$CFG->prefix}course_meta\");\n $insertafter = true;\n }\n\n execute_sql(\"DROP TABLE {$CFG->prefix}course_meta\");\n\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `parent_course` int(10) unsigned NOT NULL default 0,\n `child_course` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course));\");\n\n if (!empty($insertafter)) {\n execute_sql(\"INSERT INTO {$CFG->prefix}course_meta (parent_course,child_course) \n SELECT {$CFG->prefix}course_meta_tmp.parent_course, {$CFG->prefix}course_meta_tmp.child_course\n FROM {$CFG->prefix}course_meta_tmp\");\n\n execute_sql(\"DROP TABLE {$CFG->prefix}course_meta_tmp\");\n }\n }\n\n if ($oldversion < 2005020800) { // Expand module column to max 20 chars\n table_column('log','module','module','varchar','20','','','not null');\n }\n\n if ($oldversion < 2005021000) { // New fields for theme choices\n table_column('course', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n table_column('groups', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n table_column('user', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n\n set_config('theme', 'standardwhite'); // Reset to a known good theme \n }\n \n if ($oldversion < 2005021600) { // course.idnumber should be varchar(100)\n table_column('course', 'idnumber', 'idnumber', 'varchar', '100', '', '', '', '');\n }\n\n if ($oldversion < 2005021700) {\n table_column('user', '', 'dstpreset', 'int', '10', '', '0', 'not null', 'timezone');\n }\n\n if ($oldversion < 2005021800) { // For database debugging, not for normal use\n modify_database(\"\",\" CREATE TABLE `adodb_logsql` (\n `created` datetime NOT NULL,\n `sql0` varchar(250) NOT NULL,\n `sql1` text NOT NULL,\n `params` text NOT NULL,\n `tracer` text NOT NULL,\n `timer` decimal(16,6) NOT NULL\n );\");\n }\n\n if ($oldversion < 2005022400) {\n // Add more visible digits to the fields\n table_column('dst_preset', 'activate_index', 'activate_index', 'tinyint', '2', '', '0', 'not null');\n table_column('dst_preset', 'activate_day', 'activate_day', 'tinyint', '2', '', '0', 'not null');\n // Add family and year fields\n table_column('dst_preset', '', 'family', 'varchar', '100', '', '', 'not null', 'name');\n table_column('dst_preset', '', 'year', 'int', '10', '', '0', 'not null', 'family');\n }\n\n if ($oldversion < 2005030501) {\n table_column('user', '', 'msn', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'aim', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'yahoo', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'skype', 'varchar', '50', '', '', '', 'icq');\n }\n\n if ($oldversion < 2005032300) {\n table_column('user', 'dstpreset', 'timezonename', 'varchar', '100');\n execute_sql('UPDATE `'.$CFG->prefix.'user` SET timezonename = \\'\\'');\n }\n\n if ($oldversion < 2005032600) {\n execute_sql('DROP TABLE '.$CFG->prefix.'dst_preset', false);\n modify_database('',\"CREATE TABLE `prefix_timezone` (\n `id` int(10) NOT NULL auto_increment,\n `name` varchar(100) NOT NULL default '',\n `year` int(11) NOT NULL default '0',\n `rule` varchar(20) NOT NULL default '',\n `gmtoff` int(11) NOT NULL default '0',\n `dstoff` int(11) NOT NULL default '0',\n `dst_month` tinyint(2) NOT NULL default '0',\n `dst_startday` tinyint(3) NOT NULL default '0',\n `dst_weekday` tinyint(3) NOT NULL default '0',\n `dst_skipweeks` tinyint(3) NOT NULL default '0',\n `dst_time` varchar(5) NOT NULL default '00:00',\n `std_month` tinyint(2) NOT NULL default '0',\n `std_startday` tinyint(3) NOT NULL default '0',\n `std_weekday` tinyint(3) NOT NULL default '0',\n `std_skipweeks` tinyint(3) NOT NULL default '0',\n `std_time` varchar(5) NOT NULL default '00:00',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM COMMENT='Rules for calculating local wall clock time for users';\");\n }\n\n if ($oldversion < 2005032800) {\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_category` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(64) default NULL,\n `courseid` int(10) unsigned NOT NULL default '0',\n `drop_x_lowest` int(10) unsigned NOT NULL default '0',\n `bonus_points` int(10) unsigned NOT NULL default '0',\n `hidden` int(10) unsigned NOT NULL default '0',\n `weight` decimal(4,2) default '0.00',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) ENGINE=MyISAM ;\");\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_exceptions` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `grade_itemid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) ENGINE=MyISAM ;\");\n\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_item` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned default NULL,\n `category` int(10) unsigned default NULL,\n `modid` int(10) unsigned default NULL,\n `cminstance` int(10) unsigned default NULL,\n `scale_grade` float(11,10) default '1.0000000000',\n `extra_credit` int(10) unsigned NOT NULL default '0',\n `sort_order` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) ENGINE=MyISAM ;\");\n\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_letter` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `letter` varchar(8) NOT NULL default 'NA',\n `grade_high` decimal(4,2) NOT NULL default '100.00',\n `grade_low` decimal(4,2) NOT NULL default '0.00',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) ENGINE=MyISAM ;\");\n \n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_preferences` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned default NULL,\n `preference` int(10) NOT NULL default '0',\n `value` int(10) NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `courseidpreference` (`courseid`,`preference`)\n ) ENGINE=MyISAM ;\");\n \n }\n\n if ($oldversion < 2005033100) { // Get rid of defunct field from course modules table\n delete_records('course_modules', 'deleted', 1); // Delete old records we don't need any more\n execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP INDEX `deleted`'); // Old index\n execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP `deleted`'); // Old field\n }\n\n if ($oldversion < 2005040800) {\n table_column('user', 'timezone', 'timezone', 'varchar', '100', '', '99');\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user` DROP `timezonename` \");\n }\n \n if ($oldversion < 2005041101) {\n require_once($CFG->libdir.'/filelib.php');\n if (is_readable($CFG->dirroot.'/lib/timezones.txt')) { // Distribution file\n if ($timezones = get_records_csv($CFG->dirroot.'/lib/timezones.txt', 'timezone')) {\n $db->debug = false;\n update_timezone_records($timezones);\n notify(count($timezones).' timezones installed');\n $db->debug = true;\n }\n }\n }\n\n if ($oldversion < 2005041900) { // Copy all Dialogue entries into Messages, and hide Dialogue module\n\n if ($entries = get_records_sql('SELECT e.id, e.userid, c.recipientid, e.text, e.timecreated\n FROM '.$CFG->prefix.'dialogue_conversations c,\n '.$CFG->prefix.'dialogue_entries e\n WHERE e.conversationid = c.id')) {\n foreach ($entries as $entry) {\n $message = new object;\n $message->useridfrom = $entry->userid;\n $message->useridto = $entry->recipientid;\n $message->message = addslashes($entry->text);\n $message->format = FORMAT_HTML;\n $message->timecreated = $entry->timecreated;\n $message->messagetype = 'direct';\n \n insert_record('message_read', $message);\n }\n }\n\n set_field('modules', 'visible', 0, 'name', 'dialogue');\n\n notify('The Dialogue module has been disabled, and all the old Messages from it copied into the new standard Message feature. If you really want Dialogue back, you can enable it using the \"eye\" icon here: Admin >> Modules >> Dialogue');\n\n }\n\n if ($oldversion < 2005042100) {\n $result = table_column('event', '', 'repeatid', 'int', '10', 'unsigned', '0', 'not null', 'userid') && $result;\n }\n\n if ($oldversion < 2005042400) { // Add user tracking prefs field.\n table_column('user', '', 'trackforums', 'int', '4', 'unsigned', '0', 'not null', 'autosubscribe');\n }\n\n if ($oldversion < 2005052301 ) { // Add config_plugins table\n \n execute_sql(\"CREATE TABLE `{$CFG->prefix}config_plugins` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `plugin` varchar(100) NOT NULL default 'core',\n `name` varchar(100) NOT NULL default '',\n `value` text NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `plugin_name` (`plugin`, `name`)\n ) ENGINE=MyISAM \n COMMENT='Moodle modules and plugins configuration variables';\");\n }\n\n if ($oldversion < 2005052302) { // migrate some config items to config_plugins table\n\n // NOTE: this block is in both postgres AND mysql upgrade\n // files. If you edit either, update the otherone. \n $user_fields = array(\"firstname\", \"lastname\", \"email\", \n \"phone1\", \"phone2\", \"department\", \n \"address\", \"city\", \"country\", \n \"description\", \"idnumber\", \"lang\");\n if (!empty($CFG->auth)) { // if we have no auth, just pass\n foreach ($user_fields as $field) {\n $suffixes = array('', '_editlock', '_updateremote', '_updatelocal');\n foreach ($suffixes as $suffix) {\n $key = 'auth_user_' . $field . $suffix;\n if (isset($CFG->$key)) {\n \n // translate keys & values\n // to the new convention\n // this should support upgrading \n // even 1.5dev installs\n $newkey = $key;\n $newval = $CFG->$key;\n if ($suffix === '') {\n $newkey = 'field_map_' . $field;\n } elseif ($suffix === '_editlock') {\n $newkey = 'field_lock_' . $field;\n $newval = ($newval==1) ? 'locked' : 'unlocked'; // translate 0/1 to locked/unlocked\n } elseif ($suffix === '_updateremote') {\n $newkey = 'field_updateremote_' . $field; \n } elseif ($suffix === '_updatelocal') {\n $newkey = 'field_updatelocal_' . $field;\n $newval = ($newval==1) ? 'onlogin' : 'oncreate'; // translate 0/1 to locked/unlocked\n }\n\n if (!(set_config($newkey, addslashes($newval), 'auth/'.$CFG->auth)\n && delete_records('config', 'name', $key))) {\n notify(\"Error updating Auth configuration $key to {$CFG->auth} $newkey .\");\n $result = false;\n }\n } // end if isset key\n } // end foreach suffix\n } // end foreach field\n }\n }\n\n if ($oldversion < 2005060201) { // Close down the Attendance module, we are removing it from CVS.\n if (!file_exists($CFG->dirroot.'/mod/attendance/lib.php')) {\n if (count_records('attendance')) { // We have some data, so should keep it\n\n set_field('modules', 'visible', 0, 'name', 'attendance');\n notify('The Attendance module has been discontinued. If you really want to \n continue using it, you should download it individually from \n http://download.moodle.org/modules and install it, then \n reactivate it from Admin >> Configuration >> Modules. \n None of your existing data has been deleted, so all existing \n Attendance activities should re-appear.');\n\n } else { // No data, so do a complete delete\n\n execute_sql('DROP TABLE '.$CFG->prefix.'attendance', false);\n delete_records('modules', 'name', 'attendance');\n notify(\"The Attendance module has been discontinued and removed from your site. \n You weren't using it anyway. ;-)\");\n }\n }\n }\n\n if ($oldversion < 2005060221) { // run the online assignment cleanup code\n include($CFG->dirroot.'/'.$CFG->admin.'/oacleanup.php');\n if (function_exists('online_assignment_cleanup')) {\n online_assignment_cleanup();\n }\n }\n\n if ($oldversion < 2005060222) { // Delete the mistakenly-added currencies table from enrol_authorize\n execute_sql(\"DROP TABLE {$CFG->prefix}currencies\",false); // drop silently\n }\n\n if ($oldversion < 2005060231) { // Add an index to course_sections that was never upgraded (bug 5100)\n execute_sql(\" CREATE INDEX coursesection ON {$CFG->prefix}course_sections (course,section) \", false);\n }\n\n return $result;\n}", "function main_upgrade($oldversion=0) {\n\n global $CFG, $THEME, $db;\n\n $result = true;\n\n if ($oldversion == 0) {\n execute_sql(\"\n CREATE TABLE `config` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `name` (`name`)\n ) COMMENT='Moodle configuration variables';\");\n notify(\"Created a new table 'config' to hold configuration data\");\n }\n if ($oldversion < 2002073100) {\n execute_sql(\" DELETE FROM `modules` WHERE `name` = 'chat' \");\n }\n if ($oldversion < 2002080200) {\n execute_sql(\" ALTER TABLE `modules` DROP `fullname` \");\n execute_sql(\" ALTER TABLE `modules` DROP `search` \");\n }\n if ($oldversion < 2002080300) {\n execute_sql(\" ALTER TABLE `log_display` CHANGE `table` `mtable` VARCHAR( 20 ) NOT NULL \");\n execute_sql(\" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 3 ) DEFAULT '3' NOT NULL \");\n }\n if ($oldversion < 2002082100) {\n execute_sql(\" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL \");\n }\n if ($oldversion < 2002082101) {\n execute_sql(\" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` \");\n }\n if ($oldversion < 2002090100) {\n execute_sql(\" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL \");\n }\n if ($oldversion < 2002090701) {\n execute_sql(\" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 10 ) DEFAULT '3' NOT NULL \");\n execute_sql(\" ALTER TABLE `user_teachers` ADD `role` VARCHAR(40) NOT NULL AFTER `authority` \");\n }\n if ($oldversion < 2002090800) {\n execute_sql(\" ALTER TABLE `course` ADD `teachers` VARCHAR( 100 ) DEFAULT 'Teachers' NOT NULL AFTER `teacher` \");\n execute_sql(\" ALTER TABLE `course` ADD `students` VARCHAR( 100 ) DEFAULT 'Students' NOT NULL AFTER `student` \");\n }\n if ($oldversion < 2002091000) {\n execute_sql(\" ALTER TABLE `user` CHANGE `personality` `secret` VARCHAR( 15 ) NOT NULL DEFAULT '' \");\n }\n if ($oldversion < 2002091400) {\n execute_sql(\" ALTER TABLE `user` ADD `lang` VARCHAR( 3 ) DEFAULT 'en' NOT NULL AFTER `country` \");\n }\n if ($oldversion < 2002091900) {\n notify(\"Most Moodle configuration variables have been moved to the database and can now be edited via the admin page.\");\n notify(\"Although it is not vital that you do so, you might want to edit <U>config.php</U> and remove all the unused settings (except the database, URL and directory definitions). See <U>config-dist.php</U> for an example of how your new slim config.php should look.\");\n }\n if ($oldversion < 2002092000) {\n execute_sql(\" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL \");\n }\n if ($oldversion < 2002092100) {\n execute_sql(\" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` \");\n }\n if ($oldversion < 2002101001) {\n execute_sql(\" ALTER TABLE `user` ADD `htmleditor` TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL AFTER `maildisplay` \");\n }\n if ($oldversion < 2002101701) {\n execute_sql(\" ALTER TABLE `reading` RENAME `resource` \"); // Small line with big consequences!\n execute_sql(\" DELETE FROM `log_display` WHERE module = 'reading'\");\n execute_sql(\" INSERT INTO log_display (module, action, mtable, field) VALUES ('resource', 'view', 'resource', 'name') \");\n execute_sql(\" UPDATE log SET module = 'resource' WHERE module = 'reading' \");\n execute_sql(\" UPDATE modules SET name = 'resource' WHERE name = 'reading' \");\n }\n\n if ($oldversion < 2002102503) {\n execute_sql(\" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` \");\n require_once(\"$CFG->dirroot/mod/forum/lib.php\");\n require_once(\"$CFG->dirroot/course/lib.php\");\n\n if (! $module = get_record(\"modules\", \"name\", \"forum\")) {\n notify(\"Could not find forum module!!\");\n return false;\n }\n\n // First upgrade the site forums\n if ($site = get_site()) {\n print_heading(\"Making News forums editable for main site (moving to section 1)...\");\n if ($news = forum_get_course_forum($site->id, \"news\")) {\n $mod->course = $site->id;\n $mod->module = $module->id;\n $mod->instance = $news->id;\n $mod->section = 1;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the site\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n }\n\n\n // Now upgrade the courses.\n if ($courses = get_records_sql(\"SELECT * FROM course WHERE category > 0\")) {\n print_heading(\"Making News and Social forums editable for each course (moving to section 0)...\");\n foreach ($courses as $course) {\n if ($course->format == \"social\") { // we won't touch them\n continue;\n }\n if ($news = forum_get_course_forum($course->id, \"news\")) {\n $mod->course = $course->id;\n $mod->module = $module->id;\n $mod->instance = $news->id;\n $mod->section = 0;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the course '\" . format_string($course->fullname) . \"'\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n if ($social = forum_get_course_forum($course->id, \"social\")) {\n $mod->course = $course->id;\n $mod->module = $module->id;\n $mod->instance = $social->id;\n $mod->section = 0;\n if (! $mod->coursemodule = add_course_module($mod) ) {\n notify(\"Could not add a new course module to the course '\" . format_string($course->fullname) . \"'\");\n return false;\n }\n if (! $sectionid = add_mod_to_section($mod) ) {\n notify(\"Could not add the new course module to that section\");\n return false;\n }\n if (! set_field(\"course_modules\", \"section\", $sectionid, \"id\", $mod->coursemodule)) {\n notify(\"Could not update the course module with the correct section\");\n return false;\n }\n }\n }\n }\n }\n\n if ($oldversion < 2002111003) {\n execute_sql(\" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` \");\n if ($courses = get_records_sql(\"SELECT * FROM course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '\" . format_string($course->fullname) . \"'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2002111100) {\n print_simple_box_start(\"CENTER\", \"\", \"#FFCCCC\");\n echo \"<FONT SIZE=+1>\";\n echo \"<P>Changes have been made to all built-in themes, to add the new popup navigation menu.\";\n echo \"<P>If you have customised themes, you will need to edit theme/xxxx/header.html as follows:\";\n echo \"<UL><LI>Change anywhere it says <B>$\".\"button</B> to say <B>$\".\"menu</B>\";\n echo \"<LI>Add <B>$\".\"button</B> elsewhere (eg at the end of the navigation bar)</UL>\";\n echo \"<P>See the standard themes for examples, eg: theme/standard/header.html\";\n print_simple_box_end();\n }\n\n if ($oldversion < 2002111200) {\n execute_sql(\" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` \");\n }\n\n if ($oldversion < 2002111400) {\n // Rebuild all course caches, because some may not be done in new installs (eg site page)\n if ($courses = get_records_sql(\"SELECT * FROM course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '\" . format_string($course->fullname) . \"'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2002112000) {\n set_config(\"guestloginbutton\", 1);\n }\n\n if ($oldversion < 2002122300) {\n execute_sql(\"ALTER TABLE `log` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_admins` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_teachers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `start` `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n execute_sql(\"ALTER TABLE `user_students` CHANGE `end` `timeend` INT(10) UNSIGNED DEFAULT '0' NOT NULL \");\n }\n\n if ($oldversion < 2002122700) {\n if (! record_exists(\"log_display\", \"module\", \"user\", \"action\", \"view\")) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname,' ',lastname)') \");\n }\n }\n if ($oldversion < 2003010101) {\n delete_records(\"log_display\", \"module\", \"user\");\n $new->module = \"user\";\n $new->action = \"view\";\n $new->mtable = \"user\";\n $new->field = \"CONCAT(firstname,\\\" \\\",lastname)\";\n insert_record(\"log_display\", $new);\n\n delete_records(\"log_display\", \"module\", \"course\");\n $new->module = \"course\";\n $new->action = \"view\";\n $new->mtable = \"course\";\n $new->field = \"fullname\";\n insert_record(\"log_display\", $new);\n $new->action = \"update\";\n insert_record(\"log_display\", $new);\n $new->action = \"enrol\";\n insert_record(\"log_display\", $new);\n }\n\n if ($oldversion < 2003012200) {\n // execute_sql(\" ALTER TABLE `log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL \");\n // Commented out - see below where it's done properly\n }\n\n if ($oldversion < 2003032500) {\n modify_database(\"\", \"CREATE TABLE `prefix_user_coursecreators` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`)\n ) TYPE=MyISAM COMMENT='One record per course creator';\");\n }\n if ($oldversion < 2003032602) {\n // Redoing it because of no prefix last time\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL \");\n // Add some indexes for speed\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(course) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(userid) \");\n }\n\n if ($oldversion < 2003041400) {\n table_column(\"course_modules\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"not null\", \"score\");\n }\n\n if ($oldversion < 2003042104) { // Try to update permissions of all files\n if ($files = get_directory_list($CFG->dataroot)) {\n echo \"Attempting to update permissions for all files... ignore any errors.\";\n foreach ($files as $file) {\n echo \"$CFG->dataroot/$file<br />\";\n @chmod(\"$CFG->dataroot/$file\", $CFG->directorypermissions);\n }\n }\n }\n\n if ($oldversion < 2003042400) {\n // Rebuild all course caches, because of changes to do with visible variable\n if ($courses = get_records_sql(\"SELECT * FROM {$CFG->prefix}course\")) {\n require_once(\"$CFG->dirroot/course/lib.php\");\n foreach ($courses as $course) {\n $modinfo = serialize(get_array_of_activities($course->id));\n\n if (!set_field(\"course\", \"modinfo\", $modinfo, \"id\", $course->id)) {\n notify(\"Could not cache module information for course '\" . format_string($course->fullname) . \"'!\");\n }\n }\n }\n }\n\n if ($oldversion < 2003042500) {\n // Convert all usernames to lowercase.\n $users = get_records_sql(\"SELECT id, username FROM {$CFG->prefix}user\");\n $cerrors = \"\";\n $rarray = array();\n\n foreach ($users as $user) { // Check for possible conflicts\n $lcname = trim(moodle_strtolower($user->username));\n if (in_array($lcname, $rarray)) {\n $cerrors .= $user->id.\"->\".$lcname.'<br/>' ;\n } else {\n array_push($rarray,$lcname);\n }\n }\n\n if ($cerrors != '') {\n notify(\"Error: Cannot convert usernames to lowercase.\n Following usernames would overlap (id->username):<br/> $cerrors .\n Please resolve overlapping errors.\");\n $result = false;\n }\n\n $cerrors = \"\";\n echo \"Checking userdatabase:<br />\";\n foreach ($users as $user) {\n $lcname = trim(moodle_strtolower($user->username));\n if ($lcname != $user->username) {\n $convert = set_field(\"user\" , \"username\" , $lcname, \"id\", $user->id);\n if (!$convert) {\n if ($cerrors){\n $cerrors .= \", \";\n }\n $cerrors .= $item;\n } else {\n echo \".\";\n }\n }\n }\n if ($cerrors != '') {\n notify(\"There were errors when converting following usernames to lowercase.\n '$cerrors' . Sorry, but you will need to fix your database by hand.\");\n $result = false;\n }\n }\n\n if ($oldversion < 2003042600) {\n /// Some more indexes - we need all the help we can get on the logs\n //execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(module) \");\n //execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(action) \");\n }\n\n if ($oldversion < 2003042700) {\n /// Changing to multiple indexes\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX module \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX action \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX course \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` DROP INDEX userid \", false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX coursemoduleaction (course,module,action) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX courseuserid (course,userid) \");\n }\n\n if ($oldversion < 2003042801) {\n execute_sql(\"CREATE TABLE `{$CFG->prefix}course_display` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `course` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `display` int(10) NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `courseuserid` (course,userid)\n ) TYPE=MyISAM COMMENT='Stores info about how to display the course'\");\n }\n\n if ($oldversion < 2003050400) {\n table_column(\"course_sections\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"\");\n }\n\n if ($oldversion < 2003050900) {\n table_column(\"modules\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"\");\n }\n\n if ($oldversion < 2003050902) {\n if (get_records(\"modules\", \"name\", \"pgassignment\")) {\n print_simple_box(\"Note: the pgassignment module has been removed (it will be replaced later by the workshop module). Go to the new 'Manage Modules' page and DELETE IT from your system\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n }\n }\n\n if ($oldversion < 2003051600) {\n print_simple_box(\"Thanks for upgrading!<p>There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n }\n\n if ($oldversion < 2003052300) {\n table_column(\"user\", \"\", \"autosubscribe\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"htmleditor\");\n }\n\n if ($oldversion < 2003072100) {\n table_column(\"course\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"marker\");\n }\n\n if ($oldversion < 2003072101) {\n table_column(\"course_sections\", \"sequence\", \"sequence\", \"text\", \"\", \"\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2003072800) {\n print_simple_box(\"The following database index improves performance, but can be quite large - if you are upgrading and you have problems with a limited quota you may want to delete this index later from the '{$CFG->prefix}log' table in your database\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n flush();\n execute_sql(\" ALTER TABLE `{$CFG->prefix}log` ADD INDEX timecoursemoduleaction (time,course,module,action) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX courseuserid (course,userid) \");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX courseuserid (course,userid) \");\n }\n\n if ($oldversion < 2003072803) {\n table_column(\"course_categories\", \"\", \"description\", \"text\", \"\", \"\", \"\");\n table_column(\"course_categories\", \"\", \"parent\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course_categories\", \"\", \"sortorder\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course_categories\", \"\", \"courseorder\", \"text\", \"\", \"\", \"\");\n table_column(\"course_categories\", \"\", \"visible\", \"integer\", \"1\", \"unsigned\", \"1\");\n table_column(\"course_categories\", \"\", \"timemodified\", \"integer\", \"10\", \"unsigned\");\n }\n\n if ($oldversion < 2003080400) {\n table_column(\"course_categories\", \"courseorder\", \"courseorder\", \"integer\", \"10\", \"unsigned\");\n table_column(\"course\", \"\", \"sortorder\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"category\");\n }\n\n if ($oldversion < 2003080700) {\n notify(\"Cleaning up categories and course ordering...\");\n fix_course_sortorder();\n }\n\n if ($oldversion < 2003081001) {\n table_column(\"course\", \"format\", \"format\", \"varchar\", \"10\", \"\", \"topics\");\n }\n\n if ($oldversion < 2003081500) {\n// print_simple_box(\"Some important changes have been made to how course creators work. Formerly, they could create new courses and assign teachers, and teachers could edit courses. Now, ordinary teachers can no longer edit courses - they <b>need to be a teacher of a course AND a course creator</b>. A new site-wide configuration variable allows you to choose whether to allow course creators to create new courses as well (by default this is off). <p>The following update will automatically convert all your existing teachers into course creators, to maintain backward compatibility. Make sure you look at your upgraded site carefully and understand these new changes.\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n\n// $count = 0;\n// $errorcount = 0;\n// if ($teachers = get_records(\"user_teachers\")) {\n// foreach ($teachers as $teacher) {\n// if (! record_exists(\"user_coursecreators\", \"userid\", $teacher->userid)) {\n// $creator = NULL;\n// $creator->userid = $teacher->userid;\n// if (!insert_record(\"user_coursecreators\", $creator)) {\n// $errorcount++;\n// } else {\n// $count++;\n// }\n// }\n// }\n// }\n// print_simple_box(\"$count teachers were upgraded to course creators (with $errorcount errors)\", \"center\", \"50%\", \"$THEME->cellheading\", \"20\", \"noticebox\");\n\n }\n\n if ($oldversion < 2003081501) {\n execute_sql(\" CREATE TABLE `{$CFG->prefix}scale` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `name` varchar(255) NOT NULL default '',\n `scale` text NOT NULL,\n `description` text NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (id)\n ) TYPE=MyISAM COMMENT='Defines grading scales'\");\n\n }\n\n if ($oldversion < 2003081503) {\n table_column(\"forum\", \"\", \"scale\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"assessed\");\n get_scales_menu(0); // Just to force the default scale to be created\n }\n\n if ($oldversion < 2003081600) {\n table_column(\"user_teachers\", \"\", \"editall\", \"integer\", \"1\", \"unsigned\", \"1\", \"\", \"role\");\n table_column(\"user_teachers\", \"\", \"timemodified\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"editall\");\n }\n\n if ($oldversion < 2003081900) {\n table_column(\"course_categories\", \"courseorder\", \"coursecount\", \"integer\", \"10\", \"unsigned\", \"0\");\n }\n\n if ($oldversion < 2003082001) {\n table_column(\"course\", \"\", \"showgrades\", \"integer\", \"2\", \"unsigned\", \"1\", \"\", \"format\");\n }\n\n if ($oldversion < 2003082101) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX category (category) \");\n }\n if ($oldversion < 2003082702) {\n execute_sql(\" INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname,\\\" \\\",lastname)') \");\n }\n\n if ($oldversion < 2003091400) {\n table_column(\"course_modules\", \"\", \"indent\", \"integer\", \"5\", \"unsigned\", \"0\", \"\", \"score\");\n }\n\n if ($oldversion < 2003092900) {\n table_column(\"course\", \"\", \"maxbytes\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"marker\");\n }\n\n if ($oldversion < 2003102700) {\n table_column(\"user_students\", \"\", \"timeaccess\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"time\");\n table_column(\"user_teachers\", \"\", \"timeaccess\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"timemodified\");\n\n $db->debug = false;\n $CFG->debug = 0;\n notify(\"Calculating access times. Please wait - this may take a long time on big sites...\", \"green\");\n flush();\n\n if ($courses = get_records_select(\"course\", \"category > 0\")) {\n foreach ($courses as $course) {\n notify(\"Processing \" . format_string($course->fullname) . \" ...\", \"green\");\n flush();\n if ($users = get_records_select(\"user_teachers\", \"course = '$course->id'\",\n \"id\", \"id, userid, timeaccess\")) {\n foreach ($users as $user) {\n $loginfo = get_record_sql(\"SELECT id, time FROM {$CFG->prefix}log WHERE course = '$course->id' and userid = '$user->userid' ORDER by time DESC\");\n if (empty($loginfo->time)) {\n $loginfo->time = 0;\n }\n execute_sql(\"UPDATE {$CFG->prefix}user_teachers SET timeaccess = '$loginfo->time'\n WHERE userid = '$user->userid' AND course = '$course->id'\", false);\n\n }\n }\n\n if ($users = get_records_select(\"user_students\", \"course = '$course->id'\",\n \"id\", \"id, userid, timeaccess\")) {\n foreach ($users as $user) {\n $loginfo = get_record_sql(\"SELECT id, time FROM {$CFG->prefix}log\n WHERE course = '$course->id' and userid = '$user->userid'\n ORDER by time DESC\");\n if (empty($loginfo->time)) {\n $loginfo->time = 0;\n }\n execute_sql(\"UPDATE {$CFG->prefix}user_students\n SET timeaccess = '$loginfo->time'\n WHERE userid = '$user->userid' AND course = '$course->id'\", false);\n\n }\n }\n }\n }\n notify(\"All courses complete.\", \"green\");\n $db->debug = true;\n }\n\n if ($oldversion < 2003103100) {\n table_column(\"course\", \"\", \"showreports\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"maxbytes\");\n }\n\n if ($oldversion < 2003121600) {\n modify_database(\"\", \"CREATE TABLE `prefix_groups` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `name` varchar(254) NOT NULL default '',\n `description` text NOT NULL,\n `lang` varchar(10) NOT NULL default 'en',\n `picture` int(10) unsigned NOT NULL default '0',\n `timecreated` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM COMMENT='Each record is a group in a course.'; \");\n\n modify_database(\"\", \"CREATE TABLE `prefix_groups_members` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `groupid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `timeadded` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `groupid` (`groupid`)\n ) TYPE=MyISAM COMMENT='Lists memberships of users in groups'; \");\n }\n\n if ($oldversion < 2003121800) {\n table_column(\"course\", \"modinfo\", \"modinfo\", \"longtext\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2003122600) {\n table_column(\"course\", \"\", \"groupmode\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"showreports\");\n table_column(\"course\", \"\", \"groupmodeforce\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"groupmode\");\n }\n\n if ($oldversion < 2004010900) {\n table_column(\"course_modules\", \"\", \"groupmode\", \"integer\", \"4\", \"unsigned\", \"0\", \"\", \"visible\");\n }\n\n if ($oldversion < 2004011700) {\n modify_database(\"\", \"CREATE TABLE `prefix_event` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `description` text NOT NULL,\n `courseid` int(10) unsigned NOT NULL default '0',\n `groupid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `modulename` varchar(20) NOT NULL default '',\n `instance` int(10) unsigned NOT NULL default '0',\n `eventtype` varchar(20) NOT NULL default '',\n `timestart` int(10) unsigned NOT NULL default '0',\n `timeduration` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`)\n ) TYPE=MyISAM COMMENT='For everything with a time associated to it'; \");\n }\n\n if ($oldversion < 2004012800) {\n modify_database(\"\", \"CREATE TABLE `prefix_user_preferences` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `name` varchar(50) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id` (`id`),\n KEY `useridname` (userid,name)\n ) TYPE=MyISAM COMMENT='Allows modules to store arbitrary user preferences'; \");\n }\n\n if ($oldversion < 2004012900) {\n table_column(\"config\", \"value\", \"value\", \"text\", \"\", \"\", \"\");\n }\n\n if ($oldversion < 2004013101) {\n table_column(\"log\", \"\", \"cmid\", \"integer\", \"10\", \"unsigned\", \"0\", \"\", \"module\");\n set_config(\"upgrade\", \"logs\");\n }\n\n if ($oldversion < 2004020900) {\n table_column(\"course\", \"\", \"lang\", \"varchar\", \"5\", \"\", \"\", \"\", \"groupmodeforce\");\n }\n\n if ($oldversion < 2004020903) {\n modify_database(\"\", \"CREATE TABLE `prefix_cache_text` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `md5key` varchar(32) NOT NULL default '',\n `formattedtext` longtext NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `md5key` (`md5key`)\n ) TYPE=MyISAM COMMENT='For storing temporary copies of processed texts';\");\n }\n\n if ($oldversion < 2004021000) {\n $textfilters = array();\n for ($i=1; $i<=10; $i++) {\n $variable = \"textfilter$i\";\n if (!empty($CFG->$variable)) { /// No more filters\n if (is_readable(\"$CFG->dirroot/\".$CFG->$variable)) {\n $textfilters[] = $CFG->$variable;\n }\n }\n }\n $textfilters = implode(',', $textfilters);\n if (empty($textfilters)) {\n $textfilters = 'mod/glossary/dynalink.php';\n }\n set_config('textfilters', $textfilters);\n }\n\n if ($oldversion < 2004021201) {\n modify_database(\"\", \"CREATE TABLE `prefix_cache_filters` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `filter` varchar(32) NOT NULL default '',\n `version` int(10) unsigned NOT NULL default '0',\n `md5key` varchar(32) NOT NULL default '',\n `rawtext` text NOT NULL,\n `timemodified` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `filtermd5key` (filter,md5key)\n ) TYPE=MyISAM COMMENT='For keeping information about cached data';\");\n }\n\n if ($oldversion < 2004021500) {\n table_column(\"groups\", \"\", \"hidepicture\", \"integer\", \"2\", \"unsigned\", \"0\", \"\", \"picture\");\n }\n\n if ($oldversion < 2004021700) {\n if (!empty($CFG->textfilters)) {\n $CFG->textfilters = str_replace(\"tex_filter.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"multilang.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"censor.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"mediaplugin.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"algebra_filter.php\", \"filter.php\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"dynalink.php\", \"filter.php\", $CFG->textfilters);\n set_config(\"textfilters\", $CFG->textfilters);\n }\n }\n\n if ($oldversion < 2004022000) {\n table_column(\"user\", \"\", \"emailstop\", \"integer\", \"1\", \"unsigned\", \"0\", \"not null\", \"email\");\n }\n\n if ($oldversion < 2004022200) { /// Final renaming I hope. :-)\n if (!empty($CFG->textfilters)) {\n $CFG->textfilters = str_replace(\"/filter.php\", \"\", $CFG->textfilters);\n $CFG->textfilters = str_replace(\"mod/glossary/dynalink.php\", \"mod/glossary\", $CFG->textfilters);\n $textfilters = explode(',', $CFG->textfilters);\n foreach ($textfilters as $key => $textfilter) {\n $textfilters[$key] = trim($textfilter);\n }\n set_config(\"textfilters\", implode(',',$textfilters));\n }\n }\n\n if ($oldversion < 2004030702) { /// Because of the renaming of Czech language pack\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang = 'cs' WHERE lang = 'cz'\");\n execute_sql(\"UPDATE {$CFG->prefix}course SET lang = 'cs' WHERE lang = 'cz'\");\n }\n\n if ($oldversion < 2004041800) { /// Integrate Block System from contrib\n table_column(\"course\", \"\", \"blockinfo\", \"varchar\", \"255\", \"\", \"\", \"not null\", \"modinfo\");\n }\n\n if ($oldversion < 2004042600) { /// Rebuild course caches for resource icons\n include_once(\"$CFG->dirroot/course/lib.php\");\n rebuild_course_cache();\n }\n\n if ($oldversion < 2004042700) { /// Increase size of lang fields\n table_column(\"user\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"en\");\n table_column(\"groups\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"\");\n table_column(\"course\", \"lang\", \"lang\", \"varchar\", \"10\", \"\", \"\");\n }\n\n if ($oldversion < 2004042701) { /// Add hiddentopics field to control hidden topics behaviour\n table_column(\"course\", \"\", \"hiddentopics\", \"integer\", \"1\", \"unsigned\", \"0\", \"not null\", \"visible\");\n }\n\n if ($oldversion < 2004042702) { /// add a format field for the description\n table_column(\"event\", \"\", \"format\", \"integer\", \"4\", \"unsigned\", \"0\", \"not null\", \"description\");\n }\n\n if ($oldversion < 2004042900) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP `showrecent` \");\n }\n\n if ($oldversion < 2004043001) { /// Change hiddentopics to hiddensections\n table_column(\"course\", \"hiddentopics\", \"hiddensections\", \"integer\", \"2\", \"unsigned\", \"0\", \"not null\");\n }\n\n if ($oldversion < 2004050400) { /// add a visible field for events\n table_column(\"event\", \"\", \"visible\", \"tinyint\", \"1\", \"\", \"1\", \"not null\", \"timeduration\");\n if ($events = get_records('event')) {\n foreach($events as $event) {\n if ($moduleid = get_field('modules', 'id', 'name', $event->modulename)) {\n if (get_field('course_modules', 'visible', 'module', $moduleid, 'instance', $event->instance) == 0) {\n set_field('event', 'visible', 0, 'id', $event->id);\n }\n }\n }\n }\n }\n\n if ($oldversion < 2004052800) { /// First version tagged \"1.4 development\", version.php 1.227\n set_config('siteblocksadded', true); /// This will be used later by the block upgrade\n }\n\n if ($oldversion < 2004053000) { /// set defaults for site course\n $site = get_site();\n set_field('course', 'numsections', 0, 'id', $site->id);\n set_field('course', 'groupmodeforce', 1, 'id', $site->id);\n set_field('course', 'teacher', get_string('administrator'), 'id', $site->id);\n set_field('course', 'teachers', get_string('administrators'), 'id', $site->id);\n set_field('course', 'student', get_string('user'), 'id', $site->id);\n set_field('course', 'students', get_string('users'), 'id', $site->id);\n }\n\n if ($oldversion < 2004060100) {\n set_config('digestmailtime', 0);\n table_column('user', \"\", 'maildigest', 'tinyint', '1', '', '0', 'not null', 'mailformat');\n }\n\n if ($oldversion < 2004062400) {\n table_column('user_teachers', \"\", 'timeend', 'int', '10', 'unsigned', '0', 'not null', 'editall');\n table_column('user_teachers', \"\", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall');\n }\n\n if ($oldversion < 2004062401) {\n table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname');\n execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default\n }\n\n if ($oldversion < 2004062600) {\n table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang');\n }\n\n if ($oldversion < 2004072900) {\n table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate');\n }\n\n if ($oldversion < 2004072901) { // Fixing error in schema\n if ($record = get_record('log_display', 'module', 'course', 'action', 'update')) {\n delete_records('log_display', 'module', 'course', 'action', 'update');\n insert_record('log_display', $record, false);\n }\n }\n\n if ($oldversion < 2004081200) { // Fixing version errors in some blocks\n set_field('blocks', 'version', 2004081200, 'name', 'admin');\n set_field('blocks', 'version', 2004081200, 'name', 'calendar_month');\n set_field('blocks', 'version', 2004081200, 'name', 'course_list');\n }\n\n if ($oldversion < 2004081500) { // Adding new \"auth\" field to user table to allow more flexibility\n table_column('user', '', 'auth', 'varchar', '20', '', 'manual', 'not null', 'id');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = 'manual'\"); // Set everyone to 'manual' to be sure\n\n if ($admins = get_admins()) { // Set all the NON-admins to whatever the current auth module is\n $adminlist = array();\n foreach ($admins as $user) {\n $adminlist[] = $user->id; \n }\n $adminlist = implode(',', $adminlist);\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)\");\n }\n }\n \n if ($oldversion < 2004082200) { // Making admins teachers on site course\n $site = get_site();\n $admins = get_admins();\n foreach ($admins as $admin) {\n add_teacher($admin->id, $site->id);\n }\n }\n\n if ($oldversion < 2004082600) {\n //update auth-fields for external users\n // following code would not work in 1.8\n/* include_once ($CFG->dirroot.\"/auth/\".$CFG->auth.\"/lib.php\");\n if (function_exists('auth_get_userlist')) {\n $externalusers = auth_get_userlist();\n if (!empty($externalusers)){\n $externalusers = '\\''. implode('\\',\\'',$externalusers).'\\'';\n execute_sql(\"UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE username IN ($externalusers)\");\n }\n }*/\n }\n\n if ($oldversion < 2004082900) { // Make sure guest is \"manual\" too.\n set_field('user', 'auth', 'manual', 'username', 'guest');\n }\n \n /* Commented out unused guid-field code\n if ($oldversion < 2004090300) { // Add guid-field used in user syncronization\n table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth');\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX authguid (auth, guid)\");\n }\n */\n\n if ($oldversion < 2004091900) { // modify idnumber to hold longer values\n table_column('user', 'idnumber', 'idnumber', 'varchar', '64', '', '', '', '');\n execute_sql(\"ALTER TABLE {$CFG->prefix}user DROP INDEX user_idnumber\",false); // added in case of conflicts with upgrade from 14stable\n execute_sql(\"ALTER TABLE {$CFG->prefix}user DROP INDEX user_auth\",false); // added in case of conflicts with upgrade from 14stable\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX idnumber (idnumber)\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}user ADD INDEX auth (auth)\");\n }\n\n if ($oldversion < 2004093001) { // add new table for sessions storage\n execute_sql(\" CREATE TABLE `{$CFG->prefix}sessions` (\n `sesskey` char(32) NOT null,\n `expiry` int(11) unsigned NOT null,\n `expireref` varchar(64),\n `data` text NOT null,\n PRIMARY KEY (`sesskey`), \n KEY (`expiry`) \n ) TYPE=MyISAM COMMENT='Optional database session storage, not used by default';\");\n }\n\n if ($oldversion < 2004111500) { // Update any users/courses using wrongly-named lang pack\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang = 'mi_nt' WHERE lang = 'ma_nt'\");\n execute_sql(\"UPDATE {$CFG->prefix}course SET lang = 'mi_nt' WHERE lang = 'ma_nt'\");\n }\n\n if ($oldversion < 2004111700) { // add indexes. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP INDEX idnumber;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` DROP INDEX shortname;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` DROP INDEX userid;\",false);\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` DROP INDEX userid;\",false);\n\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX idnumber (idnumber);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}course` ADD INDEX shortname (shortname);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX userid (userid);\");\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX userid (userid);\");\n }\n\n if ($oldversion < 2004111700) {// add an index to event for timestart and timeduration. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}event DROP INDEX timestart;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}event DROP INDEX timeduration;\",false); \n\n modify_database('','ALTER TABLE prefix_event ADD INDEX timestart (timestart);');\n modify_database('','ALTER TABLE prefix_event ADD INDEX timeduration (timeduration);');\n }\n\n if ($oldversion < 2004111700) { //add indexes on modules and course_modules. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key visible;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key course;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key module;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key instance;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_modules drop key deleted;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}modules drop key name;\",false);\n\n modify_database('','ALTER TABLE prefix_course_modules add key visible(visible);');\n modify_database('','ALTER TABLE prefix_course_modules add key course(course);');\n modify_database('','ALTER TABLE prefix_course_modules add key module(module);');\n modify_database('','ALTER TABLE prefix_course_modules add key instance (instance);');\n modify_database('','ALTER TABLE prefix_course_modules add key deleted (deleted);');\n modify_database('','ALTER TABLE prefix_modules add key name(name);');\n }\n\n if ($oldversion < 2004111700) { // add an index on the groups_members table. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}groups_members DROP INDEX userid;\",false);\n\n modify_database('','ALTER TABLE prefix_groups_members ADD INDEX userid (userid);');\n }\n\n if ($oldversion < 2004111700) { // add an index on user students timeaccess (used for sorting)- drop them first silently to avoid conflicts when upgrading\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_students DROP INDEX timeaccess;\",false);\n\n modify_database('','ALTER TABLE prefix_user_students ADD INDEX timeaccess (timeaccess);');\n }\n\n if ($oldversion < 2004111700) { // add indexes on faux-foreign keys. - drop them first silently to avoid conflicts when upgrading.\n execute_sql(\"ALTER TABLE {$CFG->prefix}scale DROP INDEX courseid;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_admins DROP INDEX userid;\",false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_coursecreators DROP INDEX userid;\",false);\n\n modify_database('','ALTER TABLE prefix_scale ADD INDEX courseid (courseid);');\n modify_database('','ALTER TABLE prefix_user_admins ADD INDEX userid (userid);');\n modify_database('','ALTER TABLE prefix_user_coursecreators ADD INDEX userid (userid);');\n }\n\n if ($oldversion < 2004111700) { // replace index on course\n fix_course_sortorder(0,0,1);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}course` DROP KEY category\",false);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}course` DROP KEY category_sortorder;\",false);\n modify_database('', \"ALTER TABLE `prefix_course` ADD UNIQUE KEY category_sortorder(category,sortorder)\"); \n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;\",false); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;\",false); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;\",false);\n\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_deleted_idx (deleted)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_confirmed_idx (confirmed)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_firstname_idx (firstname)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastname_idx (lastname)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_city_idx (city)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_country_idx (country)\");\n modify_database(\"\", \"ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastaccess_idx (lastaccess)\");\n }\n \n if ($oldversion < 2004111700) { // one more index for email (for sorting)\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_email_idx;\",false);\n modify_database('','ALTER TABLE `prefix_user` ADD INDEX prefix_user_email_idx (email);');\n }\n\n if ($oldversion < 2004112200) { // new 'enrol' field for enrolment tables\n table_column('user_students', '', 'enrol', 'varchar', '20', '', '', 'not null');\n table_column('user_teachers', '', 'enrol', 'varchar', '20', '', '', 'not null');\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX enrol (enrol);\");\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX enrol (enrol);\");\n }\n \n if ($oldversion < 2004112400) {\n /// Delete duplicate enrolments \n /// and then tell the database course,userid is a unique combination\n if ($users = get_records_select(\"user_students\", \"userid > 0 GROUP BY course, userid \".\n \"HAVING count(*) > 1\", \"\", \"max(id) as id, userid, course ,count(*)\")) {\n foreach ($users as $user) {\n delete_records_select(\"user_students\", \"userid = '$user->userid' \".\n \"AND course = '$user->course' AND id <> '$user->id'\");\n }\n }\n flush();\n \n modify_database('','ALTER TABLE prefix_user_students DROP INDEX courseuserid;');\n modify_database('','ALTER TABLE prefix_user_students ADD UNIQUE INDEX courseuserid(course,userid);'); \n\n /// Delete duplicate teacher enrolments \n /// and then tell the database course,userid is a unique combination\n if ($users = get_records_select(\"user_teachers\", \"userid > 0 GROUP BY course, userid \".\n \"HAVING count(*) > 1\", \"\", \"max(id) as id, userid, course ,count(*)\")) {\n foreach ($users as $user) {\n delete_records_select(\"user_teachers\", \"userid = '$user->userid' \".\n \"AND course = '$user->course' AND id <> '$user->id'\");\n }\n }\n flush();\n modify_database('','ALTER TABLE prefix_user_teachers DROP INDEX courseuserid;');\n modify_database('','ALTER TABLE prefix_user_teachers ADD UNIQUE INDEX courseuserid(course,userid);'); \n } \n\n if ($oldversion < 2004112900) {\n table_column('user', '', 'policyagreed', 'integer', '1', 'unsigned', '0', 'not null', 'confirmed');\n }\n\n if ($oldversion < 2004121400) {\n table_column('groups', '', 'password', 'varchar', '50', '', '', 'not null', 'description');\n }\n\n if ($oldversion < 2004121500) {\n modify_database('',\"CREATE TABLE prefix_dst_preset (\n id int(10) NOT NULL auto_increment,\n name char(48) default '' NOT NULL,\n \n apply_offset tinyint(3) default '0' NOT NULL,\n \n activate_index tinyint(1) default '1' NOT NULL,\n activate_day tinyint(1) default '1' NOT NULL,\n activate_month tinyint(2) default '1' NOT NULL,\n activate_time char(5) default '03:00' NOT NULL,\n \n deactivate_index tinyint(1) default '1' NOT NULL,\n deactivate_day tinyint(1) default '1' NOT NULL,\n deactivate_month tinyint(2) default '2' NOT NULL,\n deactivate_time char(5) default '03:00' NOT NULL,\n \n last_change int(10) default '0' NOT NULL,\n next_change int(10) default '0' NOT NULL,\n current_offset tinyint(3) default '0' NOT NULL,\n \n PRIMARY KEY (id))\");\n } \n\n if ($oldversion < 2004122800) {\n execute_sql(\"DROP TABLE {$CFG->prefix}message\", false);\n execute_sql(\"DROP TABLE {$CFG->prefix}message_read\", false);\n execute_sql(\"DROP TABLE {$CFG->prefix}message_contacts\", false);\n\n modify_database('',\"CREATE TABLE `prefix_message` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `useridfrom` int(10) NOT NULL default '0',\n `useridto` int(10) NOT NULL default '0',\n `message` text NOT NULL,\n `timecreated` int(10) NOT NULL default '0',\n `messagetype` varchar(50) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `useridfrom` (`useridfrom`),\n KEY `useridto` (`useridto`)\n ) TYPE=MyISAM COMMENT='Stores all unread messages';\");\n\n modify_database('',\"CREATE TABLE `prefix_message_read` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `useridfrom` int(10) NOT NULL default '0',\n `useridto` int(10) NOT NULL default '0',\n `message` text NOT NULL,\n `timecreated` int(10) NOT NULL default '0',\n `timeread` int(10) NOT NULL default '0',\n `messagetype` varchar(50) NOT NULL default '',\n `mailed` tinyint(1) NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `useridfrom` (`useridfrom`),\n KEY `useridto` (`useridto`)\n ) TYPE=MyISAM COMMENT='Stores all messages that have been read';\");\n\n modify_database('',\"CREATE TABLE `prefix_message_contacts` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `contactid` int(10) unsigned NOT NULL default '0',\n `blocked` tinyint(1) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `usercontact` (`userid`,`contactid`)\n ) TYPE=MyISAM COMMENT='Maintains lists of relationships between users';\");\n\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'write', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'read', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n }\n\n if ($oldversion < 2004122801) {\n table_column('message', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message');\n table_column('message_read', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message');\n }\n\n if ($oldversion < 2005010100) {\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'add contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'remove contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'block contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n modify_database('', \"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'unblock contact', 'user', 'CONCAT(firstname,\\\" \\\",lastname)'); \");\n }\n\n if ($oldversion < 2005011000) { // Create a .htaccess file in dataroot, just in case\n if (!file_exists($CFG->dataroot.'/.htaccess')) {\n if ($handle = fopen($CFG->dataroot.'/.htaccess', 'w')) { // For safety\n @fwrite($handle, \"deny from all\\r\\nAllowOverride None\\r\\n\");\n @fclose($handle); \n notify(\"Created a default .htaccess file in $CFG->dataroot\");\n }\n }\n }\n \n\n if ($oldversion < 2005012500) { \n /*\n // add new table for meta courses.\n modify_database(\"\",\"CREATE TABLE `prefix_meta_course` (\n `id` int(1) unsigned NOT NULL auto_increment,\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course)\n );\");\n // add flag to course field\n table_column('course','','meta_course','integer','1','','0','not null');\n */ // taking this OUT for upgrade from 1.4 to 1.5 (those tracking head will have already seen it)\n }\n\n if ($oldversion < 2005012501) { \n execute_sql(\"DROP TABLE {$CFG->prefix}meta_course\",false); // drop silently\n execute_sql(\"ALTER TABLE {$CFG->prefix}course DROP COLUMN meta_course\",false); // drop silently\n \n // add new table for meta courses.\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course)\n );\");\n // add flag to course field\n table_column('course','','metacourse','integer','1','','0','not null');\n }\n\n if ($oldversion < 2005012800) {\n // fix a typo (int 1 becomes int 10) \n table_column('course_meta','id','id','integer','10','','0','not null');\n }\n\n if ($oldversion < 2005020100) {\n fix_course_sortorder(0, 1, 1);\n } \n\n\n if ($oldversion < 2005020101) {\n // hopefully this is the LAST TIME we need to do this ;)\n if ($rows = count_records(\"course_meta\")) {\n // we need to upgrade\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta_tmp` (\n `parent_course` int(10) NOT NULL default 0,\n `child_course` int(10) NOT NULL default 0);\");\n \n execute_sql(\"INSERT INTO {$CFG->prefix}course_meta_tmp (parent_course,child_course) \n SELECT {$CFG->prefix}course_meta.parent_course, {$CFG->prefix}course_meta.child_course\n FROM {$CFG->prefix}course_meta\");\n $insertafter = true;\n }\n\n execute_sql(\"DROP TABLE {$CFG->prefix}course_meta\");\n\n modify_database(\"\",\"CREATE TABLE `prefix_course_meta` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `parent_course` int(10) unsigned NOT NULL default 0,\n `child_course` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `parent_course` (parent_course),\n KEY `child_course` (child_course));\");\n\n if (!empty($insertafter)) {\n execute_sql(\"INSERT INTO {$CFG->prefix}course_meta (parent_course,child_course) \n SELECT {$CFG->prefix}course_meta_tmp.parent_course, {$CFG->prefix}course_meta_tmp.child_course\n FROM {$CFG->prefix}course_meta_tmp\");\n\n execute_sql(\"DROP TABLE {$CFG->prefix}course_meta_tmp\");\n }\n }\n\n if ($oldversion < 2005020800) { // Expand module column to max 20 chars\n table_column('log','module','module','varchar','20','','','not null');\n }\n\n if ($oldversion < 2005021000) { // New fields for theme choices\n table_column('course', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n table_column('groups', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n table_column('user', '', 'theme', 'varchar', '50', '', '', '', 'lang');\n\n set_config('theme', 'standardwhite'); // Reset to a known good theme \n }\n \n if ($oldversion < 2005021600) { // course.idnumber should be varchar(100)\n table_column('course', 'idnumber', 'idnumber', 'varchar', '100', '', '', '', '');\n }\n\n if ($oldversion < 2005021700) {\n table_column('user', '', 'dstpreset', 'int', '10', '', '0', 'not null', 'timezone');\n }\n\n if ($oldversion < 2005021800) { // For database debugging, not for normal use\n modify_database(\"\",\" CREATE TABLE `adodb_logsql` (\n `created` datetime NOT NULL,\n `sql0` varchar(250) NOT NULL,\n `sql1` text NOT NULL,\n `params` text NOT NULL,\n `tracer` text NOT NULL,\n `timer` decimal(16,6) NOT NULL\n );\");\n }\n\n if ($oldversion < 2005022400) {\n // Add more visible digits to the fields\n table_column('dst_preset', 'activate_index', 'activate_index', 'tinyint', '2', '', '0', 'not null');\n table_column('dst_preset', 'activate_day', 'activate_day', 'tinyint', '2', '', '0', 'not null');\n // Add family and year fields\n table_column('dst_preset', '', 'family', 'varchar', '100', '', '', 'not null', 'name');\n table_column('dst_preset', '', 'year', 'int', '10', '', '0', 'not null', 'family');\n }\n\n if ($oldversion < 2005030501) {\n table_column('user', '', 'msn', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'aim', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'yahoo', 'varchar', '50', '', '', '', 'icq');\n table_column('user', '', 'skype', 'varchar', '50', '', '', '', 'icq');\n }\n\n if ($oldversion < 2005032300) {\n table_column('user', 'dstpreset', 'timezonename', 'varchar', '100');\n execute_sql('UPDATE `'.$CFG->prefix.'user` SET timezonename = \\'\\'');\n }\n\n if ($oldversion < 2005032600) {\n execute_sql('DROP TABLE '.$CFG->prefix.'dst_preset', false);\n modify_database('',\"CREATE TABLE `prefix_timezone` (\n `id` int(10) NOT NULL auto_increment,\n `name` varchar(100) NOT NULL default '',\n `year` int(11) NOT NULL default '0',\n `rule` varchar(20) NOT NULL default '',\n `gmtoff` int(11) NOT NULL default '0',\n `dstoff` int(11) NOT NULL default '0',\n `dst_month` tinyint(2) NOT NULL default '0',\n `dst_startday` tinyint(3) NOT NULL default '0',\n `dst_weekday` tinyint(3) NOT NULL default '0',\n `dst_skipweeks` tinyint(3) NOT NULL default '0',\n `dst_time` varchar(5) NOT NULL default '00:00',\n `std_month` tinyint(2) NOT NULL default '0',\n `std_startday` tinyint(3) NOT NULL default '0',\n `std_weekday` tinyint(3) NOT NULL default '0',\n `std_skipweeks` tinyint(3) NOT NULL default '0',\n `std_time` varchar(5) NOT NULL default '00:00',\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM COMMENT='Rules for calculating local wall clock time for users';\");\n }\n\n if ($oldversion < 2005032800) {\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_category` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(64) NOT NULL default '',\n `courseid` int(10) unsigned NOT NULL default '0',\n `drop_x_lowest` int(10) unsigned NOT NULL default '0',\n `bonus_points` int(10) unsigned NOT NULL default '0',\n `hidden` int(10) unsigned NOT NULL default '0',\n `weight` decimal(4,2) NOT NULL default '0.00',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_exceptions` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `grade_itemid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_item` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `category` int(10) unsigned NOT NULL default '0',\n `modid` int(10) unsigned NOT NULL default '0',\n `cminstance` int(10) unsigned NOT NULL default '0',\n `scale_grade` float(11,10) default '1.0000000000',\n `extra_credit` int(10) unsigned NOT NULL default '0',\n `sort_order` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n\n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_letter` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `letter` varchar(8) NOT NULL default 'NA',\n `grade_high` decimal(4,2) NOT NULL default '100.00',\n `grade_low` decimal(4,2) NOT NULL default '0.00',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`)\n ) TYPE=MyISAM ;\");\n \n\n execute_sql(\"CREATE TABLE `{$CFG->prefix}grade_preferences` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default '0',\n `preference` int(10) NOT NULL default '0',\n `value` int(10) NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `courseidpreference` (`courseid`,`preference`)\n ) TYPE=MyISAM ;\");\n \n }\n\n if ($oldversion < 2005033100) { // Get rid of defunct field from course modules table\n delete_records('course_modules', 'deleted', 1); // Delete old records we don't need any more\n execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP INDEX `deleted`'); // Old index\n execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP `deleted`'); // Old field\n }\n\n if ($oldversion < 2005040800) {\n table_column('user', 'timezone', 'timezone', 'varchar', '100', '', '99');\n execute_sql(\" ALTER TABLE `{$CFG->prefix}user` DROP `timezonename` \");\n }\n \n if ($oldversion < 2005041101) {\n require_once($CFG->libdir.'/filelib.php');\n if (is_readable($CFG->dirroot.'/lib/timezones.txt')) { // Distribution file\n if ($timezones = get_records_csv($CFG->dirroot.'/lib/timezones.txt', 'timezone')) {\n $db->debug = false;\n update_timezone_records($timezones);\n notify(count($timezones).' timezones installed');\n $db->debug = true;\n }\n }\n }\n\n if ($oldversion < 2005041900) { // Copy all Dialogue entries into Messages, and hide Dialogue module\n\n if ($entries = get_records_sql('SELECT e.id, e.userid, c.recipientid, e.text, e.timecreated\n FROM '.$CFG->prefix.'dialogue_conversations c,\n '.$CFG->prefix.'dialogue_entries e\n WHERE e.conversationid = c.id')) {\n foreach ($entries as $entry) {\n $message = new object;\n $message->useridfrom = $entry->userid;\n $message->useridto = $entry->recipientid;\n $message->message = addslashes($entry->text);\n $message->format = FORMAT_HTML;\n $message->timecreated = $entry->timecreated;\n $message->messagetype = 'direct';\n \n insert_record('message_read', $message);\n }\n }\n\n set_field('modules', 'visible', 0, 'name', 'dialogue');\n\n notify('The Dialogue module has been disabled, and all the old Messages from it copied into the new standard Message feature. If you really want Dialogue back, you can enable it using the \"eye\" icon here: Admin >> Modules >> Dialogue');\n\n }\n\n if ($oldversion < 2005042100) {\n $result = table_column('event', '', 'repeatid', 'int', '10', 'unsigned', '0', 'not null', 'userid') && $result;\n }\n\n if ($oldversion < 2005042400) { // Add user tracking prefs field.\n table_column('user', '', 'trackforums', 'int', '4', 'unsigned', '0', 'not null', 'autosubscribe');\n }\n\n if ($oldversion < 2005053000 ) { // Add config_plugins table\n \n // this table was created on the MOODLE_15_STABLE branch\n // so it may already exist.\n $result = execute_sql(\"CREATE TABLE IF NOT EXISTS `{$CFG->prefix}config_plugins` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `plugin` varchar(100) NOT NULL default 'core',\n `name` varchar(100) NOT NULL default '',\n `value` text NOT NULL default '',\n PRIMARY KEY (`id`),\n UNIQUE KEY `plugin_name` (`plugin`, `name`)\n ) TYPE=MyISAM \n COMMENT='Moodle modules and plugins configuration variables';\");\n }\n\n if ($oldversion < 2005060200) { // migrate some config items to config_plugins table\n\n // NOTE: this block is in both postgres AND mysql upgrade\n // files. If you edit either, update the otherone. \n $user_fields = array(\"firstname\", \"lastname\", \"email\", \n \"phone1\", \"phone2\", \"department\", \n \"address\", \"city\", \"country\", \n \"description\", \"idnumber\", \"lang\");\n if (!empty($CFG->auth)) { // if we have no auth, just pass\n foreach ($user_fields as $field) {\n $suffixes = array('', '_editlock', '_updateremote', '_updatelocal');\n foreach ($suffixes as $suffix) {\n $key = 'auth_user_' . $field . $suffix;\n if (isset($CFG->$key)) {\n \n // translate keys & values\n // to the new convention\n // this should support upgrading \n // even 1.5dev installs\n $newkey = $key;\n $newval = $CFG->$key;\n if ($suffix === '') {\n $newkey = 'field_map_' . $field;\n } elseif ($suffix === '_editlock') {\n $newkey = 'field_lock_' . $field;\n $newval = ($newval==1) ? 'locked' : 'unlocked'; // translate 0/1 to locked/unlocked\n } elseif ($suffix === '_updateremote') {\n $newkey = 'field_updateremote_' . $field; \n } elseif ($suffix === '_updatelocal') {\n $newkey = 'field_updatelocal_' . $field;\n $newval = ($newval==1) ? 'onlogin' : 'oncreate'; // translate 0/1 to locked/unlocked\n }\n\n if (!(set_config($newkey, addslashes($newval), 'auth/'.$CFG->auth)\n && delete_records('config', 'name', $key))) {\n notify(\"Error updating Auth configuration $key to {$CFG->auth} $newkey .\");\n $result = false;\n }\n } // end if isset key\n } // end foreach suffix\n } // end foreach field\n }\n }\n\n if ($oldversion < 2005060201) { // Close down the Attendance module, we are removing it from CVS.\n if (!file_exists($CFG->dirroot.'/mod/attendance/lib.php')) {\n if (count_records('attendance')) { // We have some data, so should keep it\n\n set_field('modules', 'visible', 0, 'name', 'attendance');\n notify('The Attendance module has been discontinued. If you really want to \n continue using it, you should download it individually from \n http://download.moodle.org/modules and install it, then \n reactivate it from Admin >> Configuration >> Modules. \n None of your existing data has been deleted, so all existing \n Attendance activities should re-appear.');\n\n } else { // No data, so do a complete delete\n\n execute_sql('DROP TABLE '.$CFG->prefix.'attendance', false);\n delete_records('modules', 'name', 'attendance');\n notify(\"The Attendance module has been discontinued and removed from your site. \n You weren't using it anyway. ;-)\");\n }\n }\n }\n\n if ($oldversion < 2005071700) { // Close down the Dialogue module, we are removing it from CVS.\n if (!file_exists($CFG->dirroot.'/mod/dialogue/lib.php')) {\n if (count_records('dialogue')) { // We have some data, so should keep it\n\n set_field('modules', 'visible', 0, 'name', 'dialogue');\n notify('The Dialogue module has been discontinued. If you really want to \n continue using it, you should download it individually from \n http://download.moodle.org/modules and install it, then \n reactivate it from Admin >> Configuration >> Modules. \n None of your existing data has been deleted, so all existing \n Dialogue activities should re-appear.');\n\n } else { // No data, so do a complete delete\n\n execute_sql('DROP TABLE '.$CFG->prefix.'dialogue', false);\n delete_records('modules', 'name', 'dialogue');\n notify(\"The Dialogue module has been discontinued and removed from your site. \n You weren't using it anyway. ;-)\");\n }\n }\n }\n\n if ($oldversion < 2005072000) { // Add a couple fields to mdl_event to work towards iCal import/export\n table_column('event', '', 'uuid', 'char', '36', '', '', 'not null', 'visible');\n table_column('event', '', 'sequence', 'integer', '10', 'unsigned', '1', 'not null', 'uuid');\n }\n\n if ($oldversion < 2005072100) { // run the online assignment cleanup code\n include($CFG->dirroot.'/'.$CFG->admin.'/oacleanup.php');\n if (function_exists('online_assignment_cleanup')) {\n online_assignment_cleanup();\n }\n }\n\n if ($oldversion < 2005072200) { // fix the mistakenly-added currency stuff from enrol/authorize\n execute_sql(\"DROP TABLE {$CFG->prefix}currencies\", false); // drop silently\n execute_sql(\"ALTER TABLE {$CFG->prefix}course DROP currency\", false);\n $defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency;\n table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost');\n }\n\n if ($oldversion < 2005081600) { //set up the course requests table\n modify_database('',\"CREATE TABLE `prefix_course_request` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `fullname` varchar(254) NOT NULL default '',\n `shortname` varchar(15) NOT NULL default '',\n `summary` text NOT NULL,\n `reason` text NOT NULL,\n `requester` int(10) NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `shortname` (`shortname`)\n ) TYPE=MyISAM;\");\n \n table_column('course','','requested');\n }\n\n if ($oldversion < 2005081601) {\n modify_database('',\"CREATE TABLE `prefix_course_allowed_modules` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `course` int(10) unsigned NOT NULL default 0,\n `module` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `course` (`course`),\n KEY `module` (`module`)\n ) TYPE=MyISAM;\");\n \n table_column('course','','restrictmodules','int','1','','0','not null');\n }\n\n if ($oldversion < 2005081700) {\n table_column('course_categories','','depth','integer');\n table_column('course_categories','','path','varchar','255');\n }\n\n if ($oldversion < 2005090100) {\n modify_database(\"\",\"CREATE TABLE `prefix_stats_daily` (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `students` int(10) unsigned NOT NULL default 0,\n `teachers` int(10) unsigned NOT NULL default 0,\n `activestudents` int(10) unsigned NOT NULL default 0,\n `activeteachers` int(10) unsigned NOT NULL default 0,\n `studentreads` int(10) unsigned NOT NULL default 0,\n `studentwrites` int(10) unsigned NOT NULL default 0,\n `teacherreads` int(10) unsigned NOT NULL default 0,\n `teacherwrites` int(10) unsigned NOT NULL default 0,\n `logins` int(10) unsigned NOT NULL default 0,\n `uniquelogins` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_weekly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `students` int(10) unsigned NOT NULL default 0,\n `teachers` int(10) unsigned NOT NULL default 0,\n `activestudents` int(10) unsigned NOT NULL default 0,\n `activeteachers` int(10) unsigned NOT NULL default 0,\n `studentreads` int(10) unsigned NOT NULL default 0,\n `studentwrites` int(10) unsigned NOT NULL default 0,\n `teacherreads` int(10) unsigned NOT NULL default 0,\n `teacherwrites` int(10) unsigned NOT NULL default 0,\n `logins` int(10) unsigned NOT NULL default 0,\n `uniquelogins` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_monthly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `students` int(10) unsigned NOT NULL default 0,\n `teachers` int(10) unsigned NOT NULL default 0,\n `activestudents` int(10) unsigned NOT NULL default 0,\n `activeteachers` int(10) unsigned NOT NULL default 0,\n `studentreads` int(10) unsigned NOT NULL default 0,\n `studentwrites` int(10) unsigned NOT NULL default 0,\n `teacherreads` int(10) unsigned NOT NULL default 0,\n `teacherwrites` int(10) unsigned NOT NULL default 0,\n `logins` int(10) unsigned NOT NULL default 0,\n `uniquelogins` int(10) unsigned NOT NULL default 0,\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_user_daily (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `userid` int(10) unsigned NOT NULL default 0,\n `roleid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `statsreads` int(10) unsigned NOT NULL default 0,\n `statswrites` int(10) unsigned NOT NULL default 0,\n `stattype` varchar(30) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`),\n KEY `roleid` (`roleid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_user_weekly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `userid` int(10) unsigned NOT NULL default 0,\n `roleid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `statsreads` int(10) unsigned NOT NULL default 0,\n `statswrites` int(10) unsigned NOT NULL default 0,\n `stattype` varchar(30) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`),\n KEY `roleid` (`roleid`),\n KEY `timeend` (`timeend`)\n );\");\n\n modify_database(\"\",\"CREATE TABLE prefix_stats_user_monthly (\n `id` int(10) unsigned NOT NULL auto_increment,\n `courseid` int(10) unsigned NOT NULL default 0,\n `userid` int(10) unsigned NOT NULL default 0,\n `roleid` int(10) unsigned NOT NULL default 0,\n `timeend` int(10) unsigned NOT NULL default 0,\n `statsreads` int(10) unsigned NOT NULL default 0,\n `statswrites` int(10) unsigned NOT NULL default 0,\n `stattype` varchar(30) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `courseid` (`courseid`),\n KEY `userid` (`userid`),\n KEY `roleid` (`roleid`),\n KEY `timeend` (`timeend`)\n );\");\n \n }\n\n if ($oldversion < 2005100300) {\n table_column('course','','expirynotify','tinyint','1');\n table_column('course','','expirythreshold','int','10');\n table_column('course','','notifystudents','tinyint','1');\n $new = new stdClass();\n $new->name = 'lastexpirynotify';\n $new->value = 0;\n insert_record('config', $new);\n }\n\n if ($oldversion < 2005100400) {\n table_column('course','','enrollable','tinyint','1','unsigned','1');\n table_column('course','','enrolstartdate','int');\n table_column('course','','enrolenddate','int');\n }\n\n if ($oldversion < 2005101200) { // add enrolment key to course_request.\n table_column('course_request','','password','varchar',50);\n }\n\n if ($oldversion < 2006030800) { # add extra indexes to log (see bug #4112)\n modify_database('',\"ALTER TABLE prefix_log ADD INDEX userid (userid);\");\n modify_database('',\"ALTER TABLE prefix_log ADD INDEX info (info);\");\n }\n\n if ($oldversion < 2006030900) {\n table_column('course','','enrol','varchar','20','','');\n\n if ($CFG->enrol == 'internal' || $CFG->enrol == 'manual') {\n set_config('enrol_plugins_enabled', 'manual');\n set_config('enrol', 'manual');\n } else {\n set_config('enrol_plugins_enabled', 'manual,'.$CFG->enrol);\n }\n\n require_once(\"$CFG->dirroot/enrol/enrol.class.php\");\n $defaultenrol = enrolment_factory::factory($CFG->enrol);\n if (!method_exists($defaultenrol, 'print_entry')) { // switch enrollable to off for all courses in this case\n modify_database('', 'UPDATE prefix_course SET enrollable = 0');\n }\n\n execute_sql(\"UPDATE {$CFG->prefix}user_students SET enrol='manual' WHERE enrol='' OR enrol='internal'\");\n execute_sql(\"UPDATE {$CFG->prefix}user_teachers SET enrol='manual' WHERE enrol=''\");\n\n }\n \n if ($oldversion < 2006031000) {\n\n modify_database(\"\",\"CREATE TABLE prefix_post (\n `id` int(10) unsigned NOT NULL auto_increment,\n `userid` int(10) unsigned NOT NULL default '0',\n `courseid` int(10) unsigned NOT NULL default'0',\n `groupid` int(10) unsigned NOT NULL default'0',\n `moduleid` int(10) unsigned NOT NULL default'0',\n `coursemoduleid` int(10) unsigned NOT NULL default'0',\n `subject` varchar(128) NOT NULL default '',\n `summary` longtext,\n `content` longtext,\n `uniquehash` varchar(128) NOT NULL default '',\n `rating` int(10) unsigned NOT NULL default'0',\n `format` int(10) unsigned NOT NULL default'0',\n `publishstate` enum('draft','site','public') NOT NULL default 'draft',\n `lastmodified` int(10) unsigned NOT NULL default '0',\n `created` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`),\n UNIQUE KEY `id_user_idx` (`id`, `userid`),\n KEY `post_lastmodified_idx` (`lastmodified`),\n KEY `post_subject_idx` (`subject`)\n ) TYPE=MyISAM COMMENT='New moodle post table. Holds data posts such as forum entries or blog entries.';\");\n\n modify_database(\"\",\"CREATE TABLE prefix_tags (\n `id` int(10) unsigned NOT NULL auto_increment,\n `type` varchar(255) NOT NULL default 'official',\n `userid` int(10) unsigned NOT NULL default'0',\n `text` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM COMMENT ='tags structure for moodle.';\");\n\n modify_database(\"\",\"CREATE TABLE prefix_blog_tag_instance (\n `id` int(10) unsigned NOT NULL auto_increment,\n `entryid` int(10) unsigned NOT NULL default'0',\n `tagid` int(10) unsigned NOT NULL default'0',\n `groupid` int(10) unsigned NOT NULL default'0',\n `courseid` int(10) unsigned NOT NULL default'0',\n `userid` int(10) unsigned NOT NULL default'0',\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM COMMENT ='tag instance for blogs.';\");\n }\n\n if ($oldversion < 2006031400) {\n require_once(\"$CFG->dirroot/enrol/enrol.class.php\");\n $defaultenrol = enrolment_factory::factory($CFG->enrol);\n if (!method_exists($defaultenrol, 'print_entry')) {\n set_config('enrol', 'manual');\n }\n }\n \n if ($oldversion < 2006031600) {\n execute_sql(\" ALTER TABLE `{$CFG->prefix}grade_category` CHANGE `weight` `weight` decimal(5,2) default '0.00';\");\n }\n\n if ($oldversion < 2006032000) {\n table_column('post','','module','varchar','20','','','not null', 'id');\n modify_database('',\"ALTER TABLE prefix_post ADD INDEX post_module_idx (module);\");\n modify_database('',\"UPDATE prefix_post SET module = 'blog';\");\n }\n\n if ($oldversion < 2006032001) {\n table_column('blog_tag_instance','','timemodified','integer','10','unsigned','0','not null', 'userid');\n modify_database('',\"ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_entryid_idx (entryid);\");\n modify_database('',\"ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_tagid_idx (tagid);\");\n modify_database('',\"UPDATE prefix_blog_tag_instance SET timemodified = '\".time().\"';\");\n }\n\n if ($oldversion < 2006040500) { // Add an index to course_sections that was never upgraded (bug 5100)\n execute_sql(\" CREATE INDEX coursesection ON {$CFG->prefix}course_sections (course,section) \", false);\n }\n\n /// change all the int(11) to int(10) for blogs and tags\n\n if ($oldversion < 2006041000) {\n table_column('post','id','id','integer','10','unsigned','0','not null');\n table_column('post','userid','userid','integer','10','unsigned','0','not null');\n table_column('post','courseid','courseid','integer','10','unsigned','0','not null');\n table_column('post','groupid','groupid','integer','10','unsigned','0','not null');\n table_column('post','moduleid','moduleid','integer','10','unsigned','0','not null');\n table_column('post','coursemoduleid','coursemoduleid','integer','10','unsigned','0','not null');\n table_column('post','rating','rating','integer','10','unsigned','0','not null');\n table_column('post','format','format','integer','10','unsigned','0','not null');\n table_column('tags','id','id','integer','10','unsigned','0','not null');\n table_column('tags','userid','userid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','id','id','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','entryid','entryid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','tagid','tagid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','groupid','groupid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','courseid','courseid','integer','10','unsigned','0','not null');\n table_column('blog_tag_instance','userid','userid','integer','10','unsigned','0','not null');\n }\n\n if ($oldversion < 2006041001) {\n table_column('cache_text','formattedtext','formattedtext','longblob','','','','not null');\n }\n \n if ($oldversion < 2006041100) {\n table_column('course_modules','','visibleold','integer','1','unsigned','1','not null', 'visible');\n }\n \n if ($oldversion < 2006041801) { // forgot auto_increments for ids\n modify_database('',\"ALTER TABLE prefix_post CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT\");\n modify_database('',\"ALTER TABLE prefix_tags CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT\");\n modify_database('',\"ALTER TABLE prefix_blog_tag_instance CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT\");\n }\n \n // changed user->firstname, user->lastname, course->shortname to varchar(100)\n \n if ($oldversion < 2006041900) {\n table_column('course','shortname','shortname','varchar','100','','','not null');\n table_column('user','firstname','firstname','varchar','100','','','not null');\n table_column('user','lastname','lastname','varchar','100','','','not null');\n }\n \n if ($oldversion < 2006042400) {\n // Look through table log_display and get rid of duplicates.\n $rs = get_recordset_sql('SELECT DISTINCT * FROM '.$CFG->prefix.'log_display');\n \n // Drop the log_display table and create it back with an id field.\n execute_sql(\"DROP TABLE {$CFG->prefix}log_display\", false);\n \n modify_database('', \"CREATE TABLE prefix_log_display (\n `id` int(10) unsigned NOT NULL auto_increment,\n `module` varchar(30),\n `action` varchar(40),\n `mtable` varchar(30),\n `field` varchar(50),\n PRIMARY KEY (`id`)\n ) TYPE=MyISAM\");\n \n // Add index to ensure that module and action combination is unique.\n modify_database('', \"ALTER TABLE prefix_log_display ADD UNIQUE `moduleaction`(`module` , `action`)\");\n \n // Insert the records back in, sans duplicates.\n if ($rs && $rs->RecordCount() > 0) {\n while (!$rs->EOF) {\n $sql = \"INSERT INTO {$CFG->prefix}log_display \".\n \"VALUES('', '\".$rs->fields['module'].\"', \".\n \"'\".$rs->fields['action'].\"', \".\n \"'\".$rs->fields['mtable'].\"', \".\n \"'\".$rs->fields['field'].\"')\";\n \n execute_sql($sql, false);\n $rs->MoveNext();\n }\n }\n }\n \n // change tags->type to varchar(20), adding 2 indexes for tags table.\n if ($oldversion < 2006042401) {\n table_column('tags','type','type','varchar','20','','','not null');\n modify_database('',\"ALTER TABLE prefix_tags ADD INDEX tags_typeuserid_idx (type(20), userid)\");\n modify_database('',\"ALTER TABLE prefix_tags ADD INDEX tags_text_idx(text(255))\");\n }\n \n /***************************************************\n * The following is an effort to change all the *\n * default NULLs to NOT NULL defaut '' in all *\n * mysql tables, to prevent 5303 and be consistent *\n ***************************************************/\n\n if ($oldversion < 2006042800) {\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_category SET name='' WHERE name IS NULL\");\n table_column('grade_category','name','name','varchar','64','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_category SET weight='0' WHERE weight IS NULL\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}grade_category change weight weight decimal(5,2) NOT NULL default 0.00\");\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET courseid='0' WHERE courseid IS NULL\");\n table_column('grade_item','courseid','courseid','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET category='0' WHERE category IS NULL\");\n table_column('grade_item','category','category','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET modid='0' WHERE modid IS NULL\");\n table_column('grade_item','modid','modid','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET cminstance='0' WHERE cminstance IS NULL\");\n table_column('grade_item','cminstance','cminstance','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}grade_item SET scale_grade='0' WHERE scale_grade IS NULL\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}grade_item change scale_grade scale_grade float(11,10) NOT NULL default 1.0000000000\");\n \n execute_sql(\"UPDATE {$CFG->prefix}grade_preferences SET courseid='0' WHERE courseid IS NULL\");\n table_column('grade_preferences','courseid','courseid','int','10','unsigned','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET idnumber='' WHERE idnumber IS NULL\");\n table_column('user','idnumber','idnumber','varchar','64','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET icq='' WHERE icq IS NULL\");\n table_column('user','icq','icq','varchar','15','','','not null');\n \n execute_sql(\"UPDATE {$CFG->prefix}user SET skype='' WHERE skype IS NULL\");\n table_column('user','skype','skype','varchar','50','','','not null');\n \n execute_sql(\"UPDATE {$CFG->prefix}user SET yahoo='' WHERE yahoo IS NULL\");\n table_column('user','yahoo','yahoo','varchar','50','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET aim='' WHERE aim IS NULL\");\n table_column('user','aim','aim','varchar','50','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET msn='' WHERE msn IS NULL\");\n table_column('user','msn','msn','varchar','50','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET phone1='' WHERE phone1 IS NULL\");\n table_column('user','phone1','phone1','varchar','20','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET phone2='' WHERE phone2 IS NULL\");\n table_column('user','phone2','phone2','varchar','20','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET institution='' WHERE institution IS NULL\");\n table_column('user','institution','institution','varchar','40','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET department='' WHERE department IS NULL\");\n table_column('user','department','department','varchar','30','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET address='' WHERE address IS NULL\");\n table_column('user','address','address','varchar','70','','','not null');\n \n execute_sql(\"UPDATE {$CFG->prefix}user SET city='' WHERE city IS NULL\");\n table_column('user','city','city','varchar','20','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET country='' WHERE country IS NULL\");\n table_column('user','country','country','char','2','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET lang='' WHERE lang IS NULL\");\n table_column('user','lang','lang','varchar','10','','en','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET lastIP='' WHERE lastIP IS NULL\");\n table_column('user','lastIP','lastIP','varchar','15','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET secret='' WHERE secret IS NULL\");\n table_column('user','secret','secret','varchar','15','','','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET picture='0' WHERE picture IS NULL\");\n table_column('user','picture','picture','tinyint','1','','0','not null');\n\n execute_sql(\"UPDATE {$CFG->prefix}user SET url='' WHERE url IS NULL\");\n table_column('user','url','url','varchar','255','','','not null');\n }\n \n if ($oldversion < 2006050400) {\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_email_idx;\",false);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_deleted (deleted)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_confirmed (confirmed)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_firstname (firstname)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_lastname (lastname)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_city (city)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_country (country)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_lastaccess (lastaccess)\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_email (email)\",false);\n }\n \n if ($oldversion < 2006050500) {\n table_column('log', 'action', 'action', 'varchar', '40', '', '', 'not null');\n }\n\n if ($oldversion < 2006050501) {\n table_column('sessions', 'data', 'data', 'mediumtext', '', '', '', 'not null');\n }\n \n // renaming of reads and writes for stats_user_xyz\n if ($oldversion < 2006052400) { // change this later\n\n // we are using this because we want silent updates\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_daily` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_daily` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_weekly` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_weekly` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_monthly` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0\", false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}stats_user_monthly` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0\", false);\n \n }\n\n // Adding some missing log actions\n if ($oldversion < 2006060400) {\n // But only if they doesn't exist (because this was introduced after branch and we could be duplicating!)\n if (!record_exists('log_display', 'module', 'course', 'action', 'report log')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report log', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report live')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report live', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report outline')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report outline', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report participation')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report participation', 'course', 'fullname')\");\n }\n if (!record_exists('log_display', 'module', 'course', 'action', 'report stats')) {\n execute_sql(\"INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report stats', 'course', 'fullname')\");\n }\n }\n\n //Renaming lastIP to lastip (all fields lowercase)\n if ($oldversion < 2006060900) {\n //Only if it exists\n $fields = $db->MetaColumnNames($CFG->prefix.'user');\n if (in_array('lastIP',$fields)) {\n table_column(\"user\", \"lastIP\", \"lastip\", \"varchar\", \"15\", \"\", \"\", \"not null\", \"currentlogin\");\n }\n }\n\n // Change in MySQL 5.0.3 concerning how decimals are stored. Mimic from 16_STABLE\n // this isn't dangerous because it's a simple type change, but be careful with\n // versions and duplicate work in order to provide smooth upgrade paths.\n if ($oldversion < 2006071800) {\n table_column('grade_letter', 'grade_high', 'grade_high', 'decimal(5,2)', '', '', '100.00', 'not null', '');\n table_column('grade_letter', 'grade_low', 'grade_low', 'decimal(5,2)', '', '', '0.00', 'not null', '');\n }\n \n if ($oldversion < 2006080400) {\n execute_sql(\"CREATE TABLE {$CFG->prefix}role (\n `id` int(10) unsigned NOT NULL auto_increment,\n `name` varchar(255) NOT NULL default '',\n `shortname` varchar(100) NOT NULL default '',\n `description` text NOT NULL default '',\n `sortorder` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}context (\n `id` int(10) unsigned NOT NULL auto_increment,\n `level` int(10) unsigned NOT NULL default '0',\n `instanceid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}role_assignments (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `contextid` int(10) unsigned NOT NULL default '0',\n `userid` int(10) unsigned NOT NULL default '0',\n `hidden` int(1) unsigned NOT NULL default '0',\n `timestart` int(10) unsigned NOT NULL default '0',\n `timeend` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n `modifierid` int(10) unsigned NOT NULL default '0',\n `enrol` varchar(20) NOT NULL default '',\n `sortorder` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}role_capabilities (\n `id` int(10) unsigned NOT NULL auto_increment,\n `contextid` int(10) unsigned NOT NULL default '0',\n `roleid` int(10) unsigned NOT NULL default '0',\n `capability` varchar(255) NOT NULL default '',\n `permission` int(10) unsigned NOT NULL default '0',\n `timemodified` int(10) unsigned NOT NULL default '0',\n `modifierid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_deny_grant (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `unviewableroleid` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id`)\n )\", true);\n \n execute_sql(\"CREATE TABLE {$CFG->prefix}capabilities ( \n `id` int(10) unsigned NOT NULL auto_increment, \n `name` varchar(255) NOT NULL default '', \n `captype` varchar(50) NOT NULL default '', \n `contextlevel` int(10) unsigned NOT NULL default '0', \n `component` varchar(100) NOT NULL default '', \n PRIMARY KEY (`id`) \n )\", true); \n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_names ( \n `id` int(10) unsigned NOT NULL auto_increment, \n `roleid` int(10) unsigned NOT NULL default '0',\n `contextid` int(10) unsigned NOT NULL default '0', \n `text` text NOT NULL default '',\n PRIMARY KEY (`id`) \n )\", true); \n \n }\n \n if ($oldversion < 2006081000) {\n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role` ADD INDEX `sortorder` (`sortorder`)\",true);\n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD INDEX `instanceid` (`instanceid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `level-instanceid` (`level`, `instanceid`)\",true);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `roleid` (`roleid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `contextid` (`contextid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `userid` (`userid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD UNIQUE INDEX `contextid-roleid-userid` (`contextid`, `roleid`, `userid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `sortorder` (`sortorder`)\",true);\n\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `roleid` (`roleid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `contextid` (`contextid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `modifierid` (`modifierid`)\",true); \n // MDL-10640 adding missing index from upgrade\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `capability` (`capability`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` ADD UNIQUE INDEX `roleid-contextid-capability` (`roleid`, `contextid`, `capability`)\",true); \n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD INDEX `roleid` (`roleid`)\",true);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD INDEX `unviewableroleid` (`unviewableroleid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD UNIQUE INDEX `roleid-unviewableroleid` (`roleid`, `unviewableroleid`)\",true); \n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}capabilities` ADD UNIQUE INDEX `name` (`name`)\",true); \n \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_names` ADD INDEX `roleid` (`roleid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_names` ADD INDEX `contextid` (`contextid`)\",true); \n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_names` ADD UNIQUE INDEX `roleid-contextid` (`roleid`, `contextid`)\",true); \n }\n \n if ($oldversion < 2006081600) {\n execute_sql(\"ALTER TABLE `{$CFG->prefix}role_capabilities` CHANGE permission permission int(10) NOT NULL default '0'\",true); \n }\n \n // drop role_deny_grant table, and create 2 new ones\n if ($oldversion < 2006081700) {\n execute_sql(\"DROP TABLE `{$CFG->prefix}role_deny_grant`\", true);\n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_allow_assign (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `allowassign` int(10) unsigned NOT NULL default '0',\n KEY `roleid` (`roleid`),\n KEY `allowassign` (`allowassign`),\n UNIQUE KEY `roleid-allowassign` (`roleid`, `allowassign`),\n PRIMARY KEY (`id`)\n )\", true); \n \n execute_sql(\"CREATE TABLE {$CFG->prefix}role_allow_override (\n `id` int(10) unsigned NOT NULL auto_increment,\n `roleid` int(10) unsigned NOT NULL default '0',\n `allowoverride` int(10) unsigned NOT NULL default '0',\n KEY `roleid` (`roleid`),\n KEY `allowoverride` (`allowoverride`),\n UNIQUE KEY `roleid-allowoverride` (`roleid`, `allowoverride`),\n PRIMARY KEY (`id`)\n )\", true); \n \n }\n \n if ($oldversion < 2006082100) {\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` DROP INDEX `level-instanceid`;\",false);\n table_column('context', 'level', 'aggregatelevel', 'int', '10', 'unsigned', '0', 'not null', '');\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `aggregatelevel-instanceid` (`aggregatelevel`, `instanceid`)\",false);\n }\n \n if ($oldversion < 2006082200) {\n table_column('timezone', 'rule', 'tzrule', 'varchar', '20', '', '', 'not null', '');\n }\n\n if ($oldversion < 2006082800) {\n table_column('user', '', 'ajax', 'integer', '1', 'unsigned', '1', 'not null', 'htmleditor');\n }\n\n if ($oldversion < 2006082900) {\n execute_sql(\"DROP TABLE {$CFG->prefix}sessions\", true);\n execute_sql(\"\n CREATE TABLE {$CFG->prefix}sessions2 (\n sesskey VARCHAR(64) NOT NULL default '',\n expiry DATETIME NOT NULL,\n expireref VARCHAR(250),\n created DATETIME NOT NULL,\n modified DATETIME NOT NULL,\n sessdata TEXT,\n CONSTRAINT PRIMARY KEY (sesskey)\n ) COMMENT='Optional database session storage in new format, not used by default';\", true);\n\n execute_sql(\"\n CREATE INDEX {$CFG->prefix}sess_exp_ix ON {$CFG->prefix}sessions2 (expiry);\", true);\n execute_sql(\"\n CREATE INDEX {$CFG->prefix}sess_exp2_ix ON {$CFG->prefix}sessions2 (expireref);\", true);\n }\n\n if ($oldversion < 2006083001) {\n table_column('sessions2', 'sessdata', 'sessdata', 'LONGTEXT', '', '', '', '', '');\n }\n \n if ($oldversion < 2006083002) {\n table_column('capabilities', '', 'riskbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', '');\n }\n\n if ($oldversion < 2006083100) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}course CHANGE modinfo modinfo longtext NULL AFTER showgrades\");\n }\n\n if ($oldversion < 2006083101) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_categories CHANGE description description text NULL AFTER name\");\n }\n\n if ($oldversion < 2006083102) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}user CHANGE description description text NULL AFTER url\");\n }\n\n if ($oldversion < 2006090200) {\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_sections CHANGE summary summary text NULL AFTER section\");\n execute_sql(\"ALTER TABLE {$CFG->prefix}course_sections CHANGE sequence sequence text NULL AFTER section\");\n }\n\n\n // table to keep track of course page access times, used in online participants block, and participants list\n if ($oldversion < 2006091200) {\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_lastaccess ( \n `id` int(10) unsigned NOT NULL auto_increment, \n `userid` int(10) unsigned NOT NULL default '0',\n `courseid` int(10) unsigned NOT NULL default '0', \n `timeaccess` int(10) unsigned NOT NULL default '0', \n KEY `userid` (`userid`),\n KEY `courseid` (`courseid`),\n UNIQUE KEY `userid-courseid` (`userid`, `courseid`),\n PRIMARY KEY (`id`) \n )TYPE=MYISAM COMMENT ='time user last accessed any page in a course';\", true);\n }\n\n if ($oldversion < 2006091212) { // Reload the guest roles completely with new defaults\n if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {\n delete_records('capabilities');\n $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);\n foreach ($guestroles as $guestrole) {\n delete_records('role_capabilities', 'roleid', $guestrole->id);\n assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id);\n }\n }\n }\n\n if ($oldversion < 2006091700) {\n table_column('course','','defaultrole','integer','10', 'unsigned', '0', 'not null');\n }\n\n if ($oldversion < 2006091800) {\n delete_records('config', 'name', 'showsiteparticipantslist');\n delete_records('config', 'name', 'requestedteachername');\n delete_records('config', 'name', 'requestedteachersname');\n delete_records('config', 'name', 'requestedstudentname');\n delete_records('config', 'name', 'requestedstudentsname');\n }\n\n if ($oldversion < 2006091901) {\n if ($roles = get_records('role')) {\n $first = array_shift($roles);\n if (!empty($first->shortname)) {\n // shortnames already exist\n } else {\n table_column('role', '', 'shortname', 'varchar', '100', '', '', 'not null', 'name');\n $legacy_names = array('admin', 'coursecreator', 'editingteacher', 'teacher', 'student', 'guest');\n foreach ($legacy_names as $name) {\n if ($roles = get_roles_with_capability('moodle/legacy:'.$name, CAP_ALLOW)) {\n $i = '';\n foreach ($roles as $role) {\n if (empty($role->shortname)) {\n $updated = new object();\n $updated->id = $role->id;\n $updated->shortname = $name.$i;\n update_record('role', $updated);\n $i++;\n }\n }\n }\n }\n }\n }\n }\n\n /// Tables for customisable user profile fields\n if ($oldversion < 2006092000) {\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_info_field (\n id BIGINT(10) NOT NULL auto_increment,\n name VARCHAR(255) NOT NULL default '',\n datatype VARCHAR(255) NOT NULL default '',\n categoryid BIGINT(10) unsigned NOT NULL default 0,\n sortorder BIGINT(10) unsigned NOT NULL default 0,\n required TINYINT(2) unsigned NOT NULL default 0,\n locked TINYINT(2) unsigned NOT NULL default 0,\n visible SMALLINT(4) unsigned NOT NULL default 0,\n defaultdata LONGTEXT,\n CONSTRAINT PRIMARY KEY (id));\", true);\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_info_field COMMENT='Customisable user profile fields';\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_info_category (\n id BIGINT(10) NOT NULL auto_increment,\n name VARCHAR(255) NOT NULL default '',\n sortorder BIGINT(10) unsigned NOT NULL default 0,\n CONSTRAINT PRIMARY KEY (id));\", true);\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_info_category COMMENT='Customisable fields categories';\", true);\n\n execute_sql(\"CREATE TABLE {$CFG->prefix}user_info_data (\n id BIGINT(10) NOT NULL auto_increment,\n userid BIGINT(10) unsigned NOT NULL default 0,\n fieldid BIGINT(10) unsigned NOT NULL default 0,\n data LONGTEXT NOT NULL,\n CONSTRAINT PRIMARY KEY (id));\", true);\n\n execute_sql(\"ALTER TABLE {$CFG->prefix}user_info_data COMMENT='Data for the customisable user fields';\", true);\n\n\n }\n\n if ($oldversion < 2006092200) {\n table_column('context', 'aggregatelevel', 'contextlevel', 'int', '10', 'unsigned', '0', 'not null', '');\n/* execute_sql(\"ALTER TABLE `{$CFG->prefix}context` DROP INDEX `aggregatelevel-instanceid`;\",false);\n execute_sql(\"ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `contextlevel-instanceid` (`contextlevel`, `instanceid`)\",false); // see 2006092409 below */\n }\n\n if ($oldversion < 2006092201) {\n execute_sql('TRUNCATE TABLE '.$CFG->prefix.'cache_text', true);\n table_column('cache_text','formattedtext','formattedtext','longtext','','','','not null');\n }\n\n if ($oldversion < 2006092302) {\n // fix sortorder first if needed\n if ($roles = get_all_roles()) {\n $i = 0;\n foreach ($roles as $rolex) {\n if ($rolex->sortorder != $i) {\n $r = new object();\n $r->id = $rolex->id;\n $r->sortorder = $i;\n update_record('role', $r);\n }\n $i++;\n }\n }\n/* execute_sql(\"ALTER TABLE {$CFG->prefix}role DROP INDEX {$CFG->prefix}role_sor_ix;\", false);\n execute_sql(\"ALTER TABLE {$CFG->prefix}role ADD UNIQUE INDEX {$CFG->prefix}role_sor_uix (sortorder)\", false);*/\n }\n\n if ($oldversion < 2006092400) {\n table_column('user', '', 'trustbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', '');\n }\n\n if ($oldversion < 2006092409) {\n // ok, once more and now correctly!\n execute_sql(\"DROP INDEX `aggregatelevel-instanceid` ON {$CFG->prefix}context ;\", false);\n execute_sql(\"DROP INDEX `contextlevel-instanceid` ON {$CFG->prefix}context ;\", false);\n execute_sql(\"CREATE UNIQUE INDEX {$CFG->prefix}cont_conins_uix ON {$CFG->prefix}context (contextlevel, instanceid);\", false);\n\n execute_sql(\"DROP INDEX {$CFG->prefix}role_sor_ix ON {$CFG->prefix}role ;\", false);\n execute_sql(\"DROP INDEX {$CFG->prefix}role_sor_uix ON {$CFG->prefix}role ;\", false);\n execute_sql(\"CREATE UNIQUE INDEX {$CFG->prefix}role_sor_uix ON {$CFG->prefix}role (sortorder);\", false);\n }\n\n if ($oldversion < 2006092601) {\n table_column('log_display', 'field', 'field', 'varchar', '200', '', '', 'not null', '');\n }\n\n ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions.\n\n return $result;\n}", "public function changeDatabase(string $database)\n {\n $this->wrapper->executeStatement(\"use `$database`;\");\n }", "public function change()\n {\n $table = $this->table('articulos');\n $table->addColumn('revista_id', 'integer', [\n 'default' => null,\n 'null' => false,\n ]);\n $table->addColumn('titulo', 'string', [\n 'default' => null,\n 'limit' => 150,\n 'null' => false,\n ]);\n $table->addColumn('autor', 'string', [\n 'default' => null,\n 'limit' => 150,\n 'null' => true,\n ]);\n $table->addColumn('asunto', 'string', [\n 'default' => null,\n 'limit' => 50,\n 'null' => true,\n ]);\n $table->addColumn('resumen', 'text', [\n 'default' => null,\n 'null' => true,\n ]);\n $table->addColumn('created', 'datetime', [\n 'default' => null,\n 'null' => false,\n ]);\n $table->addColumn('modified', 'datetime', [\n 'default' => null,\n 'null' => false,\n ]);\n $table->addIndex('autor');\n $table->create();\n\n $current_timestamp = Carbon::now();\n // Inserta artículos de la base de datos antigua\n $this->execute('insert into articulos (id, revista_id, titulo, autor, asunto, resumen, created, modified) select id, revista_id, aTitulo, aAutor, aAsunto, aResumen, \"' . $current_timestamp . '\", \"' . $current_timestamp . '\" from old_articulos');\n }", "public function change()\r\n {\r\n $table = $this->table('summary_section');\r\n $table->addColumn('name', 'string', ['after'=>'table'])\r\n ->update();\r\n\r\n $this->execute(\"UPDATE summary_section SET name = IF(`table` = 'ExecutiveSummary', 'Executive Summary', IF(`table` = 'WebTraffic', 'Web Traffic', IF(`table` = 'Questionbox', 'Q&A', `table`)))\");\r\n\r\n }", "public function change()\n {\n $this->query('SET foreign_key_checks = 0');\n $this->table('scenarios_element_elements')->truncate();\n $this->table('scenarios_trigger_elements')->truncate();\n $this->table('scenarios_elements')->truncate();\n $this->table('scenarios_triggers')->truncate();\n $this->table('scenarios')->truncate();\n $this->query('SET foreign_key_checks = 1');\n\n $this->table('scenarios_elements')\n ->changeColumn('type', 'enum', [\n 'null' => false,\n 'values' => ['segment', 'email', 'wait'],\n ])\n ->update();\n }", "function UpdateDatabase()\n\t{\n\t\t$source = \"\";\n\t\tif (isset($_POST['source']))\n\t\t{\n\t\t\t$source = $_POST['source'];\n\t\t}\n\t\tif ($source == \"AddPart\")\n\t\t{\n\t\t\t$vendorNo = $_POST['VendorNo'];\n\t\t\t$description = $_POST['Description'];\n\t\t\t$onHand = $_POST['OnHand'];\n\t\t\t$onOrder = $_POST['OnOrder'];\n\t\t\t$cost = $_POST['Cost'];\n\t\t\t$listPrice = $_POST['ListPrice'];\n\t\t\t\n\t\t\t//validate data\n\t\t\tif (PartVerify($vendorNo, $description, $onHand, $onOrder, $cost, $listPrice))\n\t\t\t{\n\t\t\t\t$GLOBALS['message'] = \"<br/><h3>New part Added: Vendor Number: $vendorNo, Description: $description.</br>$onHand on-hand and $onOrder on-order, cost: $$cost, and list price: $$listPrice.</h3>\";\n\n\t\t\t\t//insert new data\n\t\t\t\t$sql = \"INSERT INTO Parts (VendorNo, Description, OnHand, OnOrder, Cost, ListPrice) VALUES ($vendorNo, '$description', $onHand, $onOrder, $cost, $listPrice)\";\n\n\t\t\t\t$connection = ConnectToDatabase();\n\t\t\t\t//NEED THIS FIXED!!\n\t\t\t\t$preparedQuerySelect = $connection -> prepare($sql);\n\t\t\t\t$preparedQuerySelect -> execute();\n\n\t\t\t}\n\t\t}\n\t}", "public static function update_database() {\n\t\tif ( self::is_latest_version() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$version_from_db = self::get_version();\n\n\t\tif ( version_compare( $version_from_db, '1.0.0', '<' ) ) {\n\t\t\tself::migrate_to_1_0_0();\n\t\t}\n\n\t\tupdate_option( 'webmention_db_version', self::$target_version );\n\t}", "public function change()\n {\n $table = $this->table('session');\n $table->changeColumn('enrollment_closes','integer',['null'=>true]);\n $table->addColumn('session_type','char',['default'=>'s']);\n $table->addColumn('picture','string',['limit'=>250]);\n $table->update();\n\n $table = $this->table('lesson');\n $table->addColumn('test_required','boolean',['default'=>0]);\n $table->addColumn('test_id','integer',['limit'=>10,'signed'=>false,'null'=>true]);\n $table->update();\n\n $table = $this->table('discussion');\n $table->addColumn('session_id','integer',['limit'=>10,'signed'=>false,'null'=>true]);\n $table->addColumn('lecture_id','integer',['limit'=>10,'signed'=>false,'null'=>true]);\n $table->update();\n\n $table = $this->table('session_category',['id'=>'session_category_id']);\n $table->addColumn('category_name','string',['limit'=>250]);\n $table->addColumn('status','boolean',['default'=>1]);\n $table->addColumn('sort_order','integer',['null'=>true]);\n $table->create();\n\n $table= $this->table('session_to_session_category',['id'=>'session_to_session_category_id']);\n $table->addColumn('session_category_id','integer');\n $table->addColumn('session_id','integer',['limit'=>10,'signed'=>false]);\n $table->addForeignKey('session_category_id','session_category','session_category_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->addForeignKey('session_id','session','session_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->create();\n\n $table = $this->table('lesson_group',['id'=>'lesson_group_id']);\n $table->addColumn('group_name','string',['limit'=>250]);\n $table->addColumn('description','text',['null'=>true]);\n $table->create();\n\n $table = $this->table('lesson_to_lesson_group',['id'=>'lesson_to_lesson_group_id']);\n $table->addColumn('lesson_group_id','integer');\n $table->addColumn('lesson_id','integer',['limit'=>10,'signed'=>false]);\n $table->addForeignKey('lesson_group_id','lesson_group','lesson_group_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->addForeignKey('lesson_id','lesson','lesson_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->create();\n\n $table = $this->table('lecture',['id'=>'lecture_id']);\n $table->addColumn('lesson_id','integer',['limit'=>10,'signed'=>false]);\n $table->addColumn('lecture_title','string',['limit'=>250]);\n $table->addColumn('content','text',['null'=>true]);\n $table->addColumn('video_code','text',['null'=>true]);\n $table->addColumn('sort_order','integer',['limit'=>10,'null'=>true]);\n $table->addForeignKey('lesson_id','lesson','lesson_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->create();\n\n $table = $this->table('student_lecture',['id'=>'student_lecture_id']);\n $table->addColumn('student_id','integer',['limit'=>10,'signed'=>false]);\n $table->addColumn('session_id','integer',['limit'=>10,'signed'=>false]);\n $table->addColumn('lecture_id','integer');\n $table->addColumn('date','integer',['limit'=>10]);\n $table->addForeignKey('student_id','student','student_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->addForeignKey('session_id','session','session_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->addForeignKey('lecture_id','lecture','lecture_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->create();\n\n $table = $this->table('lesson_file',['id'=>'lesson_file_id']);\n $table->addColumn('lesson_id','integer',['limit'=>10,'signed'=>false]);\n $table->addColumn('path','text');\n $table->addColumn('created_on','integer',['limit'=>10]);\n $table->addColumn('status','boolean',['default'=>1]);\n $table->addForeignKey('lesson_id','lesson','lesson_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->create();\n\n $table = $this->table('lecture_file',['id'=>'lecture_file_id']);\n $table->addColumn('lecture_id','integer');\n $table->addColumn('path','text');\n $table->addColumn('created_on','integer',['limit'=>10]);\n $table->addColumn('status','boolean',['default'=>1]);\n $table->addForeignKey('lecture_id','lecture','lecture_id',['delete'=>'CASCADE','update'=>'NO_ACTION']);\n $table->create();\n\n\n }", "function update_design_change()\n{\n\tdbQuery(\"REPLACE design_change SET aplikace_id=#1, aplikace_typ_id=#2\",$_SESSION[\"aplikace_id\"], $_SESSION[\"aplikace_typ_id\"]);\n}", "function ft_db_update(string $src_db, string $set_statement, string $where_statement)\n{\n if ((!isset($src_db)) || (!isset($set_statement)) || (!isset($where_statement)) || ($src_db == '') || ($set_statement == '') ||($where_statement == ''))\n return FALSE;\n $resource = pg_connect(\"user=gquence password=aspid0911 dbname=lms_db\");\n if (!$resource)\n {\n throw new InvalidQuery(\"DB connection error\");\n }\n\n $query = \"UPDATE \" . $src_db . \" set \" . $set_statement . \" where \" . $where_statement; \n $result = pg_query($resource, $query);\n if (!$result)\n {\n throw new InvalidQuery((\"Query error. Query = \" . $query));\n }\n pg_close($resource);\n return TRUE;\n}", "public function change()\n {\n $table = $this->table($this->tableName);\n $table->addColumn('name', 'string', [\n 'default' => null,\n 'limit' => 255,\n 'null' => false,\n 'comment' => 'Full Name'\n ]);\n $table->addColumn('description', 'text', [\n 'default' => null,\n 'null' => true,\n 'comment' => 'Comment',\n ]);\n $table->addColumn('balance', 'decimal', [\n 'default' => 0,\n 'null' => false,\n 'comment' => 'Balance',\n ]);\n $table->addColumn('interest', 'decimal', [\n 'default' => 0,\n 'null' => false,\n 'comment' => 'Interest',\n ]);\n $table->addColumn('type', 'string', [\n 'null' => true,\n 'comment' => 'Type',\n ]);\n $table->addColumn('created', 'datetime', [\n 'default' => null,\n 'null' => false,\n 'comment' => 'Created',\n ]);\n $table->addColumn('modified', 'datetime', [\n 'default' => null,\n 'null' => false,\n 'comment' => 'Modified',\n ]);\n $table->create();\n }", "public function setDatabase($name)\n\t{\n\t\tif($this->con)\n\t\t{\n\t\t\tif(@mysql_close())\n\t\t\t{\n\t\t\t\t$this->con = false;\n\t\t\t\t$this->results = null;\n\t\t\t\t$this->db_name = $name;\n\t\t\t\t$this->connect();\n\t\t\t}\n\t\t}\n\n\t}", "public function recreateDatabase()\n {\n\n if( $this->view->isType( View::WINDOW ) )\n {\n $view = $this->view->newWindow('WebfrapMainMenu', 'Default');\n }\n else\n {\n $view = $this->view;\n }\n\n $view->setTemplate( 'MenuModmenu' , 'base' );\n $modMenu = $view->newItem\n (\n 'modMenu' ,\n 'MenuDeveloperModmenu'\n );\n\n\n SFilesystem::cleanFolder( PATH_GW.'cache/entity_cache/');\n\n $db = Db::getActive();\n\n\n if($error = $db->ddlQuery('DROP SCHEMA webfrap cascade;'))\n {\n $this->sys->addError('Failed to delete Schema: '.$error );\n return;\n }\n\n if($error = $db->ddlQuery(SFiles::read(PATH_GW.'data/ddl/postgresql/FullDump.sql')))\n {\n $this->sys->addError('Failed to recreate the Database: '.$error);\n }\n else\n {\n $this->sys->addMessage('Sucessfully recreated Database');\n }\n\n\n }", "public function change()\n {\n $table = $this->table('notices');\n $table->addColumn('author', 'string', array('limit' => 16))\n ->addColumn('text', 'integer')\n ->addColumn('start_time', 'datetime')\n ->addColumn('end_time', 'datetime')\n ->addColumn('hidden', 'boolean', array('null' => false, 'default' => 0))\n ->addColumn('frontpage', 'boolean', array('null' => false, 'default' => 1))\n ->addColumn('sort_order', 'integer')\n ->create();\n\n $table->addForeignKey('text', 'text_story', 'id', array('delete'=> 'CASCADE', 'update'=> 'CASCADE'))\n ->addForeignKey('author', 'user', 'user', array('delete'=> 'CASCADE', 'update'=> 'CASCADE'))\n ->save();\n\n }", "public function update($db=''){\n\t\tif ( empty($db) ){\n\t\t\t$db = $this->db->current;\n\t\t}\n\t\tif ( bbn\\str::check_name($db) ){\n\n $this->db->clear_all_cache();\n\n\t\t\t$change = $this->db->current === $db ? false : $this->db->current;\n\t\t\tif ( $change ){\n\t\t\t\t$this->db->change($db);\n\t\t\t}\n\t\t\t$schema = $this->db->modelize();\n\t\t\tif ( $change ){\n\t\t\t\t$this->db->change($change);\n\t\t\t}\n /*\n\t\t\t$projects = [];\n\t\t\t$r1 = $this->db->query(\"SELECT *\n\t\t\tFROM `{$this->admin_db}`.`{$this->prefix}projects`\n\t\t\tWHERE `db` LIKE '$db'\");\n\t\t\twhile ( $d1 = $r1->get_row() ){\n\t\t\t\t$projects[$d1['id']] = $d1;\n\t\t\t\t$projects[$d1['id']]['forms'] = [];\n\t\t\t\t$r2 = $this->db->query(\"\n\t\t\t\t\tSELECT id\n\t\t\t\t\tFROM `{$this->admin_db}`.`{$this->prefix}forms`\n\t\t\t\t\tWHERE `id_project` = ?\",\n\t\t\t\t\t$d1['id']);\n\t\t\t\twhile ( $d2 = $r2->get_row() ){\n\t\t\t\t\t$projects[$d1['id']]['forms'][$d2['id']] = $this->get_form_config();\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n\t\t\t$this->db->insert_ignore($this->admin_db.'.'.$this->prefix.'dbs',[\n 'id' => $db,\n 'db' => $db,\n 'host' => $this->db->host\n ]);\n $tab_history = false;\n if ( bbn\\appui\\history::$is_used && isset($schema[bbn\\appui\\history::$htable]) ){\n $tab_history = 1;\n }\n if ( !is_array($schema) ){\n\n die(var_dump(\"THIS IS NOT AN ARRAY\", $schema));\n }\n\n\t\t\tforeach ( $schema as $t => $vars ){\n $col_history = $tab_history;\n\t\t\t\tif ( isset($vars['fields']) ){\n $tmp = explode(\".\", $t);\n $db = $tmp[0];\n $table = $tmp[1];\n\t\t\t\t\t$this->db->insert_update($this->admin_db.'.'.$this->prefix.'tables',[\n\t\t\t\t\t\t'id' => $t,\n\t\t\t\t\t\t'db' => $db,\n\t\t\t\t\t\t'table' => $table\n\t\t\t\t\t]);\n if ( $col_history && !array_key_exists(bbn\\appui\\history::$hcol, $vars['fields']) ){\n $col_history = false;\n }\n foreach ( $vars['fields'] as $col => $f ){\n \t\t\t\t$config = new \\stdClass();\n\t\t\t\t\t\tif ( $col_history && ($col !== bbn\\appui\\history::$hcol) ){\n\t\t\t\t\t\t\t$config->history = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( isset($f['default']) ){\n\t\t\t\t\t\t\t$config->default = $f['default'];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( !empty($f['extra']) ){\n\t\t\t\t\t\t\t$config->extra = $f['extra'];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( isset($f['signed']) && $f['signed'] == 1 ){\n\t\t\t\t\t\t\t$config->signed = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( isset($f['null']) && $f['null'] == '1' ){\n\t\t\t\t\t\t\t$config->null = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( isset($f['maxlength']) && $f['maxlength'] > 0 ){\n\t\t\t\t\t\t\t$config->maxlength = (int)$f['maxlength'];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( isset($f['keys']) ){\n\t\t\t\t\t\t\t$config->keys = [];\n\t\t\t\t\t\t\tforeach ( $f['keys'] as $key ){\n\t\t\t\t\t\t\t\t$config->keys[$key] = $vars['keys'][$key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->db->insert_update($this->admin_db.'.'.$this->prefix.'columns',[\n\t\t\t\t\t\t\t'id' => $t.'.'.$col,\n\t\t\t\t\t\t\t'table' => $t,\n\t\t\t\t\t\t\t'column' => $col,\n\t\t\t\t\t\t\t'position' => $f['position'],\n\t\t\t\t\t\t\t'type' => $f['type'],\n\t\t\t\t\t\t\t'null' => $f['null'],\n 'key' => $f['key'],\n 'default' => $f['default'],\n\t\t\t\t\t\t\t'config' => json_encode($config)\n\t\t\t\t\t\t]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n foreach ( $schema as $t => $vars ){\n if ( isset($vars['keys']) && is_array($vars['keys']) ){\n foreach ( $vars['keys'] as $k => $arr ){\n $pos = 1;\n foreach ( $arr['columns'] as $c ){\n $this->db->insert_update($this->admin_db.'.'.$this->prefix.'keys', [\n 'id' => $t.'.'.$c.'.'.$k,\n 'key' => $k,\n 'column' => $t.'.'.$c,\n 'position' => $pos,\n 'ref_column' => is_null($arr['ref_column']) ? null : $arr['ref_db'].'.'.$arr['ref_table'].'.'.$arr['ref_column']\n ]);\n $pos++;\n }\n }\n }\n }\n /*\n\t\t\tforeach ( $projects as $i => $p ){\n\t\t\t\t$this->db->insert($this->admin_db.'.'.$this->prefix.'projects',[\n\t\t\t\t\t'id' => $i,\n\t\t\t\t\t'id_client' => $p['id_client'],\n\t\t\t\t\t'db' => $p['db'],\n\t\t\t\t\t'name' => $p['name'],\n\t\t\t\t\t'config' => $p['config']]);\n\t\t\t\tforeach ( $p['forms'] as $j => $form ){\n\t\t\t\t\t$this->db->insert($this->admin_db.'.'.$this->prefix.'forms',[\n\t\t\t\t\t\t'id' => $j,\n\t\t\t\t\t\t'id_project' => $i\n\t\t\t\t\t]);\n\t\t\t\t\tforeach ( $form as $field ){\n\t\t\t\t\t\t$this->db->insert_ignore($this->admin_db.'.'.$this->prefix.'fields',[\n\t\t\t\t\t\t\t'id' => $field['id'],\n\t\t\t\t\t\t\t'id_form' => $j,\n\t\t\t\t\t\t\t'column' => $field['column'],\n\t\t\t\t\t\t\t'title' => $field['title'],\n\t\t\t\t\t\t\t'position' => $field['position'],\n\t\t\t\t\t\t\t'configuration' => json_encode($field['configuration'])\n\t\t\t\t\t\t]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n * \n */\n $this->db->enable_keys();\n\t\t}\n\t}", "function db_update(){\r\n\t\tinclude('sql_start.php');\r\n\t\t$sql = \"UPDATE \".TBL_DEVICES.\" SET \";\r\n\t\tmysql_close();\r\n\t}" ]
[ "0.60874635", "0.56895417", "0.55856645", "0.5544097", "0.5296108", "0.52783686", "0.52518797", "0.5207245", "0.5156204", "0.51471746", "0.51216507", "0.5116408", "0.5094191", "0.50919616", "0.50919616", "0.50918055", "0.5071678", "0.50612044", "0.504149", "0.49776292", "0.49578246", "0.49292907", "0.4918417", "0.49120063", "0.48864937", "0.48704985", "0.4850046", "0.4842728", "0.48089918", "0.4801543" ]
0.72530437
0
verify from token payload check signer only return true/false
public function tokenverify() { if ($this->jwt) { return $this->jwt->verify($this->signer, APP_KEY); } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function verify(): bool {\n // Recovering secrets and parameters\n $issuer_url = $_ENV[\"APP_URL\"];\n $jwt_secret = $_ENV[\"JWT_SECRET\"];\n\n // Instantiating a ValidationData object\n $validationData = new ValidationData();\n $validationData->setIssuer($issuer_url);\n $validationData->setAudience($issuer_url);\n\n // Validate the parsed token against validation data\n $validated = $this->oldToken->validate($validationData);\n\n // Perform verification & return boolean value\n return ($validated && $this->oldToken\n ->verify($this->signer, $jwt_secret)\n );\n }", "abstract public function verifyToken();", "public function verify() : bool {\n\t\t$jwt_token = $this->get_token();\n\t\t// phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsRemoteFile\n\t\t$webhook_payload = json_decode( file_get_contents( 'php://input' ), true );\n\n\t\ttry {\n\t\t\t$jwt_payload = JWT::decode( $jwt_token, JW_PLAYER_API_WEBHOOK_SECRET, [ 'HS256' ] );\n\t\t} catch ( \\Exception $e ) {\n\t\t\t$jwt_payload = false;\n\t\t}\n\n\t\tif ( ! $jwt_payload ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison\n\t\treturn (array) $jwt_payload == (array) $webhook_payload;\n\t}", "public function verifySignature()\n {\n return $this->request->header('x-gitlab-token', null) === config('webhook.secret', null);\n }", "public function verify()\n {\n $this->signature = explode('=', $this->request->header('X-Hub-Signature'))[1];\n\n if (!$this->signature) {\n return false;\n }\n return hash_equals($this->signature, hash_hmac('sha1', json_encode($this->request->all()), $this->secret));\n }", "public function verify();", "public function verify_token($token)\n {\n // $tokens = explode('.', flayer::crypto()->decrypt($token));\n $tokens = explode('.', $token);\n\n if (count($tokens) != 3) {\n return false;\n }\n\n list($base64header, $base64payload, $sign) = $tokens;\n\n // $base64decodeheader = json_decode(flayer::crypto()->decrypt($base64header), JSON_OBJECT_AS_ARRAY);\n $base64decodeheader = json_decode($this->decode($base64header), JSON_OBJECT_AS_ARRAY);\n\n if (empty($base64decodeheader['alg'])) {\n return false;\n }\n\n // $alg_config = [\n // 'HS256' => 'sha256',\n // ];\n\n if ($this->signature($base64header . '.' . $base64payload, $this->key, $base64decodeheader['alg']) !== $sign) {\n return false;\n }\n\n // if (hash_hmac($alg_config[$this->header['alg']], $base64header . '.' . $base64payload, $this->key, $base64decodeheader['alg']) !== $sign) {\n // return false;\n // }\n\n // $payload = json_decode(flayer::crypto()->decrypt($base64payload), JSON_OBJECT_AS_ARRAY);\n $payload = json_decode($this->decode($base64payload), JSON_OBJECT_AS_ARRAY);\n $api = (isset($this->config['api_key']) && is_value($this->config['api_key']) ? $this->config['api_key'] : \"\");\n\n // If api key is not same\n if (isset($payload['data']['api_key']) && ($payload['data']['api_key'] != $api)) {\n return false;\n }\n\n //If issue time is greater than current server time\n if (isset($payload['iat']) && $payload['iat'] > time()) {\n return false;\n }\n\n // If expiry time is smaller than server time\n if (isset($payload['exp']) && $payload['exp'] < time()) {\n return false;\n }\n\n // Deny access if current time is greater than \"before expiry time\"\n if (isset($payload['nbf']) && $payload['nbf'] > time()) {\n return false;\n }\n\n // If user's IP is not same\n if (isset($payload['data']['ip']) && ($payload['data']['ip'] != get_ip())) {\n return false;\n }\n\n return $payload;\n }", "public function valid_token(){\n $this->get(google_authsub::VERIFY_TOKEN_URL);\n\n if($this->info['http_code'] === 200){\n return true;\n }else{\n return false;\n }\n }", "public function verify()\n {\n $key = new RSA(\n $this->body,\n '',\n static::getPublicKey() \n ? static::getPublicKey() \n : static::getPublicKeyFile()\n );\n return $key->verify($this->sign);\n }", "protected function verifyToken() {\n return $_POST[\"form_token\"] === $this->token();\n }", "public function verify(VerificationTokenAware $account, string $token): bool;", "function token_verify() {\n if (isset($_COOKIE[TOKEN_HEADER])) {\n $token = $_COOKIE[TOKEN_HEADER];\n $tokenParts = explode('.', $token);\n\n if (sizeof($tokenParts) == 3) {\n $secret = json_encode(['secret'=>'this is a secret']);\n $base64Secret = base64_encode($secret);\n\n $payload = base64_decode($tokenParts[1]);\n $signatureProvided = str_replace(\"=\", \"\", $tokenParts[2]);\n\n $signature = hash_hmac('sha256', $base64Secret . \".\" . $tokenParts[0], true);\n\n if ($signature === $signatureProvided) {\n $payload = json_decode($payload);\n\n $user = user::getUser($payload->username);\n if ($user != null) {\n return $user;\n }\n }\n }\n }\n redirect(\"login\", \"index\");\n }", "public function verify()\n {\n if ($this->isVerified) {\n return true;\n }\n $params = $this->params;\n if (empty($params) || !isset($params['sign']) || !isset($params['sign_type'])) {\n return false;\n }\n $utils = Utils::getInstance();\n $sign = $params['sign'];\n $signType = $params['sign_type'];\n $isVerified = $this->alipay->getSigner($signType)->verify($utils->createParamUrl($utils->sortParams($utils->filterParams($params))), $sign);\n if ($isVerified) {\n if (empty($params['notify_id'])) {\n $this->isVerified = true;\n return true;\n }\n $verify_url = $this->notifyServiceUrl . \"partner=\" . $this->alipay->getPartner() . \"&notify_id=\" . $params[\"notify_id\"];\n $responseTxt = $utils->getHttpClient()->executeHttpRequest($verify_url);\n $this->isVerified = $responseTxt === 'true';\n return $this->isVerified;\n }\n return false;\n }", "public function verify_token () {\n $path = $this->server_value('SCRIPT_NAME');\n $x_time = $this->server_value('HTTP_X_TOKEN_TIME');\n $token = $this->server_value('HTTP_X_TOKEN');\n\n if (!$x_time || !$token) {\n $this->res_error(403, \"Forbidden\", \"Header Error\");\n }\n\n if (time() - strtotime($x_time) > $this->token_expire) {\n $this->res_error(403, \"Forbidden\", \"Token Expire\");\n }\n\n $str_to_sign = $this->build_str_to_sign($path, $x_time);\n\n $sign_src = hash_hmac(\"sha256\", $str_to_sign, $this->apikey, true);\n $sign = base64_encode($sign_src);\n\n if ($sign != $token) {\n $this->res_error(403, \"Forbidden\", \"Authorization Failure\");\n }\n }", "public abstract function verifySignature();", "public function verify()\n {\n return $this->service->verify($this->transferCode);\n }", "private function verify($post) {\n\t\t$auth_method = $this->config('websmsd','auth_method');\n\t\t$auth_secret = $this->config('websmsd','auth_secret');\n\t\tswitch ($auth_method) {\n\t\tcase '':\n\t\t\treturn true;\n\t\t\tbreak;\n\t\tcase 'zadarma':\n\t\t\t$result = $post['result'];\n\t\t\t$sign = $post['Signature'];\n\t\t\t$sign_expected = base64_encode(hash_hmac('sha1', $result, $auth_secret));\n\t\t\treturn ($sign === $sign_expected);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ttrigger_error(\"Unknown method (auth_method=$auth_method)\", E_USER_WARNING);\n\t\t\treturn true;\n\t\t\tbreak;\n\t\t}\n\t}", "function verify_signature($data, $signature, $public_key) {\n $raw_signature = base64_decode($signature);\n $result = openssl_verify($data, $raw_signature, $public_key);\n // echo $result;\n return $result === 1 ? true : false; // True if successful\n // Vigenère\n // return 'RK, pym oays onicvr. Iuw bkzhvbw uedf pke conll rt ZV nzxbhz.';\n}", "public function verifyWebhookSignature()\n {\n // 1. Get the request body\n $body = file_get_contents('php://input');\n \n // 2. Get Dwolla's signature\n $headers = getallheaders();\n $signature = $headers['X-Dwolla-Signature'];\n\n // 3. Calculate hash, and compare to the signature\n $hash = hash_hmac('sha1', $body, $this->apiSecret);\n $validated = ($hash == $signature);\n \n if(!$validated) {\n return $this->setError('Dwolla signature verification failed.');\n }\n \n return TRUE;\n }", "function openssl_verify($serial_data, $raw_signature, $public_key)\n{\n return \\Trustly\\Tests\\Unit\\Api\\signedTest::$openssl_verified;\n}", "public function verifyToken () {\n\t\t$token = $_REQUEST['labkeyToken'];\n\t\t$page = $this->sendVerifyToken(self::REMOTE_BASE_URL, $token);\n\t\t\n\t\t$doc = new DOMDocument();\n\t\t$doc->loadXML($page);\n\t\tif ($doc->firstChild->nodeName != 'TokenAuthentication') {\n\t\t\tthrow new Exception('Bad XML received from authenticating server');\n\t\t}\n\t\tif ($doc->firstChild->getAttribute('success') == 'true') {\n\t\t\t# add labkeyToken (effectively logs user in)\n\t\t\t$_SESSION['labkeyToken'] = $token;\n\t\t\t$permissions = $doc->firstChild->getAttribute('permissions');\n\t\t\tif (!is_null($permissions)) {\n\t\t\t\t$_SESSION['permissionMap']['/'] = $permissions;\n\t\t\t}\n\t\t\treturn TRUE;\n\t\t} else {\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public function verify(string $expected, string $payload, Key $key): bool;", "function verify();", "public function verifySignature()\n\t{\n\t\t$signatureValue = Yii::app()->request->getPost('SignatureValue');\n\n\t\t$params = array(\n\t\t\t$this->getVerifiablePrice(),\n\t\t\t$this->getVerifiableOrderId(),\n\t\t\t$this->params['password2']\n\t\t);\n\n\t\treturn strtolower($signatureValue) === md5(implode(':', $params));\n\t}", "function verify($token) {\r\n\t $url = self::VERIFYTOKEN_URL . '?access_token=' . $token;\r\n\t $response = $this->sendCURL($url, NULL, 'GET');\r\n\t return $response;\r\n\t }", "public function verify(string $source, string $payload, string $passphrase): bool\n {\n }", "function verify_token(){\n\t$jwt = new JWT();\n\ttry{\n\t //echo \"Token : \".$token = $jwt->getBearerToken();\n\t $token = $jwt->getBearerToken();\n\t}catch(Exception $e){\n\t $response['error'] = true;\n\t\t$response['message'] = $e->getMessage();\n\t\tprint_r(json_encode($response));\n\t\treturn false;\n\t}\n\tif(!empty($token)){\n\t\ttry{\n\t\t\t// JWT::$leeway = 60;\n\t\t\t$payload = $jwt->decode($token, JWT_SECRET_KEY, ['HS256']);\n\t\t\tif(!isset($payload->iss) || $payload->iss != 'Athidi'){\n\t $response['error']=true;\n\t $response['message'] = 'Invalid Hash';\n\t print_r(json_encode($response));\n\t\t\t return false;\n\t\t\t}else{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}catch (Exception $e){\n\t\t\t$response['error'] = true;\n\t\t\t$response['message'] = $e->getMessage();\n\t\t\tprint_r(json_encode($response));\n\t\t\treturn false;\n\t\t}\n\t}else{\n\t\t$response['error'] = true;\n\t\t$response['message'] = \"Unauthorized access not allowed\";\n\t\tprint_r(json_encode($response));\n\t\treturn false;\n\t}\n\t}", "public static function verifyToken($token)\n\t{\n\t\t$secret = SECRET;\n\n\t\t// Decode Jwt Authentication Token\n\t\t$obj = JWT::decode($token, $secret, array(\"HS256\"));\n\n\t\t// If payload is defined\n\t\tif (isset($obj->payload)) {\n\t\t \t// Gets the actual date\n\t\t\t$now = strtotime(date('Y-m-d H:i:s'));\n\t \t\t// Gets the expiration date\n\t\t\t$exp = strtotime($obj->payload->exp);\n\t \t\t// If token didn't expire\n\t\t\tif (($exp - $now) > 0) {\n\t\t\t\tif ($obj->header->id == CMID && $obj->header->user == CMNAME)\n\t\t\t\t\treturn true;\n\t\t\t\telse\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "private static function verifyPayload(array $payload)\n {\n $signature = base64_decode($payload['user']['signature']);\n\n return $signature == self::expectedSignature($payload);\n }", "public function verifyObjectSignature()\r\n\t{\r\n\t\t$publicKey = SocialRecordManager::retrieveSocialRecord($this->signature->getCreatorGID())->getAccountPublicKey();\r\n\t\t\r\n\t\t$sigmessage = $this->getStringForSignature() . $this->signature->getTargetID() . $this->signature->getCreatorGID() . $this->signature->getTimeSigned() . $this->signature->getRandom();\r\n\t\t//echo \"\\nchecking sig for \\n\".$sigmessage.\"\\n\";\r\n\t\treturn Signature::verifySignature($sigmessage, $publicKey, $this->signature->getSignature());\r\n\t}" ]
[ "0.77716345", "0.7563468", "0.72913516", "0.704836", "0.7048263", "0.7010004", "0.70056283", "0.6989443", "0.6950511", "0.6910811", "0.688263", "0.6817948", "0.67431116", "0.6714365", "0.6700533", "0.6697929", "0.66961044", "0.66114503", "0.66052175", "0.65885013", "0.6573622", "0.65718186", "0.6558639", "0.6552605", "0.6542113", "0.65147257", "0.6509748", "0.65069276", "0.64852554", "0.6465479" ]
0.7648047
1
insert data to maintenance table
public function create($data) { $this->db->insert('maintenance', array( 'ID' => $data['ID'], 'Cond' => $data['Cond'], 'Sol' => $data['Sol'], 'Date' => $data['Date'], 'Timefrom' => $data['Timefrom'], 'Timeto' => $data['Timeto'], 'Workshop' => $data['Workshop'], 'Cost' => $data['Cost'] )); //$this->db->insert('car', $data); print_r($data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function insert()\n\t\t{\n\t\t\t$this->save();\n\t\t}", "protected function _insert()\n {\n $this->_setModificationInfo();\n $this->_setCreatedInfo();\n }", "function insert_batch_table($data) {\n $this->db->insert_batch(\"default_user_accesses\", $data);\n }", "public function insert_admin($data){\r\n $this->db->insert(\"admin\",$data);\r\n }", "public function insert()\n {\n $this->_cleanFields();\n \n parent::insert();\n }", "function _insert($data){\n\t\t$this->load->model('Mdl_category_assign');\n\t\t$this->Mdl_category_assign->_insert($data);\n\t}", "function insert() {\n\t\t$sql = \"INSERT INTO type_complain (tp_id, tp_complain)\n\t\t\t\tVALUES(?, ?)\";\n\t\t$this->ffm->query($sql, array($this->tp_id, $this->tp_complain));\n\t\t$this->last_insert_id = $this->db->insert_id();\n\t}", "public function insert($tblPermiso);", "function insert_data() {\r\n insert_field_data();\r\n insert_record_data();\r\n insert_group_data();\r\n}", "public function insert($data);", "public function insert()\n\t{\n\t\t$this->edit(true);\n\t}", "protected function insert () {\n\n }", "function insert() {\n\t\t$sql = \"INSERT INTO umwgroupservice (WsID, WsWgID, WsSvID)\n\t\t\t\tVALUES(?, ?, ?)\";\n\t\t \n\t\t$this->ums->query($sql, array($this->WsID, $this->WsWgID, $this->WsSvID));\n\t\t$this->last_insert_id = $this->ums->insert_id();\n\t\t\n\t}", "function insertCapacitacion_work($data)\n\t{\n\t\t$this->db->insert('capacitacion_work', $data);\n\t}", "public function insert($powerBaseStationAnalysi);", "public function run()\n {\n\t\tDB::table($this->table)->insert($this->getData());\n }", "public function insert_status($table,$data){\n\t\t\t$this->db->insert($table,$data);\n\t\t}", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n DB:: table('discounts')->truncate();\n DB:: table('discounts') -> insert(array(\n array(\"id\" => \"1\",\"description\" => \"PWD\", \"type\" => 1, \"application\" => 2, \"restricted\" => 0, \"value\" => 20),\n array(\"id\" => \"2\", \"description\" => \"Senior Citizen\", \"type\" => 1, \"application\" => 2, \"restricted\" => 0, \"value\" => 30),\n ));\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public static function insert($data): void;", "public function form_insert($data){\n\t\t$this->db->insert('utilisateurs', $data);\n\t\t}", "function insert()\n\t{\n\t\t$this->edit(true);\n\t}", "function insert()\n\t{\n\t\t$this->edit(true);\n\t}", "protected function insertDemoData()\n {\n $this->Db()->query('DELETE FROM s_emarketing_lastarticles');\n $statement = $this->Db()->prepare(\n 'INSERT INTO s_emarketing_lastarticles (articleID, sessionID, time, userID, shopID)\n VALUES(:articleID, :sessionID, :time, :userID, :shopID)'\n );\n foreach ($this->getDemoData() as $data) {\n $statement->execute($data);\n }\n }", "public function run()\n {\n \\DB::table('cod_cont')->insert(array(\n 'last_doc' => 'DOC1700000',\n 'last_exp' => 'EXP1700000',\n ));\n }", "function insert2($data){\n\t\t$this -> db -> insert_batch(\"test\", $data);\n\t}", "public function insert()\n\t{\n\t\t$pdo = Database::connect();\n\t\t$sql = \"INSERT INTO `tache`(`id`, `content`, `date`, `userId`) VALUES (null, '\".htmlentities(mysql_real_escape_string($this->content)).\"', '\".$this->date.\"', '$this->userId')\";\n\t\t$pdo->exec($sql);\n\t}", "function form_insert($data){\r\n $CI =& get_instance();\r\n $this->db->insert($CI->config->item('table_notice'), $data);\r\n }", "public function insertDb()\n\t{\n\t\t// $result = $stmt->execute();\n\t\t// $stmt->close();\n\t\t$stmt = $this->conn->prepare(\"INSERT INTO front_door VALUES(NULL,'$this->var',NULL)\");\n\n\t\t\t$result = $stmt->execute();\n\t\t\t$stmt->close();\n\t}", "function insert($table, $data);", "function insert_data($data) {\n $this->db->insert('feedback', $data);\n }" ]
[ "0.64950967", "0.6238747", "0.6221882", "0.61977595", "0.615881", "0.6127438", "0.6104543", "0.60857385", "0.6055896", "0.605291", "0.6041207", "0.60282034", "0.6006513", "0.59954846", "0.59856117", "0.5974057", "0.5953089", "0.59253025", "0.5923042", "0.58890986", "0.5880162", "0.5880162", "0.58611804", "0.5859886", "0.5858015", "0.58557725", "0.58546364", "0.58481735", "0.5845497", "0.5844406" ]
0.6278259
1
This function generates a random number representing a key from the outer $quotes array and returns the corresponding value for the given key
function getRandomQuote($array){ $randomKey = array_rand($array); return $array[$randomKey]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomQuote($quotes){\r\n // this function is from php documentation of PHP rand. \r\n $generation = rand(0 , 4);\r\n return $quotes[$generation][\"quote\"];\r\n}", "function getRandomQuote($array){\n //Will generate a random number that will be used to determine which quote to pull from the inner arrays\n $randomNum = rand(0, 7);\n \n //Passing on the randomly selected inner associative array\n return $array[$randomNum];\n }", "function getRandomQuote (){\n global $quotes;\n $random = rand(0, 6);\n return $quotes[$random];\n}", "function getRandomQuote($array){\n //this function should take in an array of quotes\n //select a random quote from array and return it\n $random_number = rand(0,4);\n return $array[$random_number];\n\n}", "function getRandomQuote($array)\n{\n $randNumber = rand(1, count($array));\n return $array[$randNumber];\n}", "public function random()\n\t{\n\t\treturn self::QUOTES[rand(1, count(self::QUOTES))];\n\t}", "public function randomKey()\n {\n return $this->randomKeys(1)->first();\n }", "function zen_quotes(){ \n$quotes[] = 'He who does not climb, will not fall either.';\n$quotes[] = 'Learning is a treasure no thief can touch.';\n$quotes[] = 'Better to have a diamond with a few small flaws than a rock that is perfect.';\n$quotes[] = 'We must not say every mistake is a foolish one.';\n$quotes[] = 'Austerity is an ornament, humility is honorable.';\n$quotes[] = 'He that would perfect his work must first sharpen his tools.';\n$quotes[] = 'Respect yourself and others will respect you.';\n$quotes[] = 'Life is really simple, but we insist on making it complicated.';\n$quotes[] = 'How we spend our days is, of course, how we spend our lives.';\n$quotes[] = 'He who does not climb, will not fall either.';\n$random_number = rand(0,count($quotes)-1);\necho $quotes[$random_number];\n }", "public function randomKey() {}", "function getRandomQuote($array) {\n\n$quote = $array[rand (0,5)];\n//all functions need to have a return\n\nreturn $quote;\n\n}", "protected function generateRandomKey()\n\t{\n\t\treturn rand().rand().rand().rand();\n\t}", "function random()\n{\n\t$input = array(4,6,2,8,5,1,7,3,9,\"N\",\"A\",\"M\",\"E\",\"K\");\n\t$rand_keys = array_rand($input,7);\n\t$rand_number = \"\";\n\tfor($i=0; $i<7; $i++)\n\t{\n\t\t$rand_number = $rand_number.$input[$rand_keys[$i]];\n\t}\n\treturn $rand_number;\n}", "function getRandQuote() {\r\n // Connect to the MySQL DB server and select the database\r\n mysql_connect(\"localhost\",\"webserviceuser\",\"secret\");\r\n mysql_select_db(\"chapter20\");\r\n\r\n // Create and execute the query\r\n $query = \"SELECT boxer, quote, year FROM quotation \r\n ORDER BY RAND() LIMIT 1\";\r\n $result = mysql_query($query);\r\n $row = mysql_fetch_array($result); \r\n\r\n // Retrieve, assemble, and return the quote data\r\n $boxer = $row[\"boxer\"];\r\n $quote = $row[\"quote\"];\r\n $year = $row[\"year\"];\r\n return \"\\\"$quote\\\", $boxer ($year)\";\r\n }", "private function generateRandomKey() : int\n {\n return rand(0, 99);\n }", "public function keyGenerator()\n {\n if($this->key == null):\n $this->key = $this->obscure(\n \t(int) mt_rand(\n \t $this->illumin($this->keyValueMin), \n \t $this->illumin($this->keyValueMax)\n \t)\n );\n return $this->key;\n endif;\n\n return $this->key;\n }", "protected function getRandomKey() {\n return Str::random(32);\n }", "public function srandmember($key);", "private function generateKey()\n {\n return \\PHP_DDNS\\Core\\PHP_DDNS_Helper::generateRandomString( 10 );\n }", "function random_num($size) {\n $alpha_key = '';\n $keys = range('A', 'Z');\n\n for ($i = 0; $i < 2; $i++) {\n $alpha_key .= $keys[array_rand($keys)];\n }\n\n $length = $size - 2;\n\n $key = '';\n $keys = range(0, 9);\n\n for ($i = 0; $i < $length; $i++) {\n $key .= $keys[array_rand($keys)];\n }\n\n return $alpha_key . $key;\n }", "function quote() {\n\t\t$quotes = [\n\t\t\t'“Walk as if you are kissing the Earth with your feet.”',\n\t\t\t'“Life is a journey. Time is a river. The door is ajar”',\n\t\t\t'“Man suffers only because he takes seriously what the gods made for fun.”',\n\t\t\t'“To Do Today, 1/17/08\n\t\t\t\t1. Sit and think\n\t\t\t\t2. Reach enlightenment\n\t\t\t\t3. Feed the cats”',\n\t\t\t'“The truth knocks on the door and you say, \"Go away, I\\'m looking for the truth,\" and so it goes away. Puzzling.” ',\n\t\t\t'“The way out is through the door. Why is it that no one will use this method?”',\n\t\t\t'“Letting go is the lesson. Letting go is always the lesson. Have you ever noticed how much of our agony is all tied up with craving and loss?”',\n\t\t\t'“Only the hand that erases can write the true thing.”',\n\t\t\t'“It is the power of the mind to be unconquerable.”',\n\t\t\t'“Flow with whatever may happen, and let your mind be free: Stay centered by accepting whatever you are doing. This is the ultimate.”',\n\t\t\t'“It is easy to believe we are each waves and forget we are also the ocean.”',\n\t\t\t'“When the mind is exhausted of images, it invents its own.”',\n\t\t\t'“Haiku is not a shriek, a howl, a sigh, or a yawn; rather, it is the deep breath of life.”',\n\t\t\t'“Consider your own place in the universal oneness of which we are all a part, from which we all arise, and to which we all return.”',\n\t\t];\n\n\t\t$randomQuoteIndex = mt_rand(0, count($quotes) - 1);\n\n\t\treturn $quotes[$randomQuoteIndex];\n\t}", "private function _random_number() {\r\n $number_arr = array(\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\");\r\n $i = rand(0, 9);\r\n return $number_arr[$i];\r\n }", "function makeMeAKey(){\n\t\t\t$key = qrRand(6);\n\t\t\t$query = \"SELECT `email_key` FROM `users` WHERE `email_key` = :email_key\";\n\t\t\t$param = array(':email_key' => $key);\n\n\t\t\twhile(myQuery($query,'select', $param, 'assoc')){\n\t\t\t\t$key = qrRand(6);\n\t\t\t}\n\n\t\t\treturn $key;\n\t}", "public function generate_key()\n\t{\n\t\t$CI =& get_instance();\n\t\t$CI->load->helper('string') ;\n\t\treturn random_string('unique') ;\n\t}", "public static function random_guid() {\n $randomKey = 0;\n $randomKey2 = 0;\n do {\n $randomKey = CommonHelper::randomKey();\n $randomKey2 = CommonHelper::randomKey();\n } while ($randomKey == $randomKey2);\n\n return ($randomKey2);\n }", "public static function random_guid() {\n $randomKey = 0;\n $randomKey2 = 0;\n do {\n $randomKey = CommonHelper::randomKey();\n $randomKey2 = CommonHelper::randomKey();\n } while ($randomKey == $randomKey2);\n\n return ($randomKey2);\n }", "private function _random_symbol() {\r\n $symbol_arr = array(\"!\", \"$\", \".\", \"[\", \"]\", \"|\", \"(\", \")\", \"?\", \"*\", \"+\", \"{\", \"}\", \"@\", \"#\");\r\n $i = rand(0, 14);\r\n return $symbol_arr[$i];\r\n }", "function generateRandomOperator($operators) {\n // and return the key in that position.\n return $random_key = array_rand($operators);\n}", "function randomKey($length) {\n\t$pool = array_merge(range(0,9), range('a', 'd'),range('f', 'z'),range('A', 'D'),range('F', 'Z'));\n\t$key = \"\";\n\tfor($i=0; $i < $length; $i++) {\n\t\t$key .= $pool[mt_rand(0, count($pool) - 1)];\n\t}\n\treturn $key;\n}", "private function getRandomKey($object = null)\n {\n $name = 0;\n $array = [];\n\n if (is_array($object)) {\n $array = $object;\n $name = array_rand($object);\n } elseif (is_string($object)) {\n $array = $this->objects[$object];\n $name = array_rand($array);\n }\n\n return string($array[$name]);\n }", "function generate_token(){\n $res = do_hash(time().mt_rand());\n $new_key = substr($res,0,config_item('rest_key_length'));\n return $new_key;\n\n }" ]
[ "0.75132585", "0.7312436", "0.71398926", "0.70177776", "0.7014235", "0.65598184", "0.6223395", "0.62013304", "0.61776614", "0.6133846", "0.60712266", "0.5989288", "0.59557277", "0.59206057", "0.5887919", "0.5768955", "0.57502407", "0.5747511", "0.56934005", "0.56870127", "0.5675267", "0.5633141", "0.56307197", "0.5552603", "0.5552603", "0.55084", "0.5506054", "0.5503694", "0.54798275", "0.5478019" ]
0.7469368
1
This function calls getRandomQuote() and converts the returned array into an HTML string to be printed to the index page
function printQuote($array){ $randomQuote = getRandomQuote($array); $quoteString = ""; $quoteString .= '<p class="quote">'. $randomQuote['quote'] . '</p>'; $quoteString .= '<p class="source">' . $randomQuote['source']; if (isset($randomQuote['tag'])){ $quoteString .= '<span class="tag">' . $randomQuote['tag'] . '</span>'; } if (isset($randomQuote['citation'])){ $quoteString .= '<span class="citation">' . $randomQuote['citation'] . '</span>'; } if (isset($randomQuote['year'])){ $quoteString .= '<span class="year">' . $randomQuote['year'] . '</span>'; } $quoteString .= '</p>'; echo $quoteString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printQuote($array){\n $current_quote = getRandomQuote($array);\n //initialized empty array\n $generated;\n\n /*\n \n if the array selected randomly contains a citation we\n assign the following HTML to the generated variable, otherwise\n we assign the HTML without the span tag for it\n\n */\n if($current_quote['citation'] && $current_quote['category'] ){\n $generated = \"<p class=\\\"quote\\\">\" . $current_quote['quote'] . \n \"<br/><span class=\\\"category\\\">\" .$current_quote['category'] . \"</span></p>\n <p class=\\\"source\\\"> \" . $current_quote['source'] \n . \"- <span class=\\\"citation\\\">\" . $current_quote['citation'] . \"</span>\n </p>\";\n\n } else {\n $generated = \"<p class=\\\"quote\\\">\" . $current_quote['quote'] . \"</p>\n <p class=\\\"source\\\">\" . $current_quote['source'] .\n \"</p>\";\n\n }\n\n //display the results\n echo $generated;\n //displays images I have added to each quote\n printImage($current_quote);\n \n \n \n}", "function printQuote($array)\n{\n $quote = getRandomQuote($array);\n $quoteDisplay = \"\";\n foreach ($quote as $key => $value) {\n if ($key === 'quote') {\n $this_quote = $value;\n $quoteDisplay = \"<p class=\\\"quote\\\">$this_quote</p>\";\n }\n if ($key === 'source') {\n $this_source = $value;\n $quoteDisplay .= \"<p class=\\\"source\\\">$this_source\";\n }\n if ($key === 'citation') {\n $this_citation = $value;\n $quoteDisplay .= \"<span class=\\\"citation\\\">$this_citation</span>\";\n }\n if ($key === 'year') {\n $this_year = $value;\n $quoteDisplay .= \"<span class=\\\"year\\\">$this_year</span>\";\n }\n if ($key === 'tag') {\n $this_tag = $value;\n $quoteDisplay .= \"<span class=\\\"tag\\\">$this_tag</span>\";\n }\n }\n $quoteDisplay .= \"</p>\";\n echo $quoteDisplay;\n}", "function getRandomQuote($array)\n{\n $randNumber = rand(1, count($array));\n return $array[$randNumber];\n}", "function printQuote($array){\n $theQuote = getRandomQuote($array);\n $quoteOutput = '';\n if ($theQuote['citation'] != '' && $theQuote['year'] != '' && $theQuote['tags'] != ''){\n $quoteOutput = \"<p class='quote'>\" . $theQuote['quote'] . \"</p>\";\n $quoteOutput .= \"<p class='source'>\" . $theQuote['source'];\n $quoteOutput .= \"<span class='citation'>\" . $theQuote['citation'] . \"</span>\";\n $quoteOutput .= \"<span class='year'>\" . $theQuote['year'] . \"</span>\";\n $quoteOutput .= \"<span class='year'>\" . $theQuote['year'] . \"</span>\";\n $quoteOutput .= \"<br/>\";\n $quoteOutput .= \"</p>\";\n $quoteOutput .= \"<p class='tag'>Tag:\" . $theQuote['tag'] . \"</p>\";\n } elseif ($theQuote['citation'] != '') {\n $quoteOutput = \"<p class='quote'>\" . $theQuote['quote'] . \"</p>\";\n $quoteOutput .= \"<p class='source'>\" . $theQuote['source'];\n $quoteOutput .= \"<span class='citation'>\" . $theQuote['citation'] . \"</span>\";\n } elseif ($theQuote['year'] != '') {\n $quoteOutput = \"<p class='quote'>\" . $theQuote['quote'] . \"</p>\";\n $quoteOutput .= \"<p class='source'>\" . $theQuote['source'];\n $quoteOutput .= \"<span class='year'>\" . $theQuote['year'] . \"</span>\";\n } elseif ($theQuote['tag'] != '') {\n $quoteOutput = \"<p class='quote'>\" . $theQuote['quote'] . \"</p>\";\n $quoteOutput .= \"<p class='source'>\" . $theQuote['source'];\n $quoteOutput .= \"<p class='tag'>Tag: \" . $theQuote['tag'] . \"</p>\";\n } else {\n $quoteOutput = \"<p class='quote'>\" . $theQuote['quote'] . \"</p>\";\n $quoteOutput .= \"<p class='source'>\" . $theQuote['source'] . \"</p>\";\n }\n //Will print the final quote to the screen\n echo $quoteOutput;\n }", "function printQuote(){\nglobal $quotes;\n$This_quote = getRandomQuote($quotes);\n\n$HTML_quote = '';\n$HTML_quote .= '<p class=\"quote\">'. $This_quote[\"quote\"] . '</p>';\n$HTML_quote .= '<p class=\"source\">' . $This_quote['source'] ;\n//'<span class=\"year\">' . $This_quote['year'] . '</span>' .\n//'<span class=\"tags\">' . $This_quote['tags'] . '</span> </p>';\nif ($This_quote['year']){\n $HTML_quote .= '<span class=\"year\">' . $This_quote['year'] . '</span>';\n}\nif ($This_quote['tags']){\n $HTML_quote .= '<br> <span class=\"tags\">' . $This_quote[\"tags\"] . '</span> </br>';\n}\n$HTML_quote .= \"</p>\";\necho $HTML_quote;\n}", "function zen_quotes(){ \n$quotes[] = 'He who does not climb, will not fall either.';\n$quotes[] = 'Learning is a treasure no thief can touch.';\n$quotes[] = 'Better to have a diamond with a few small flaws than a rock that is perfect.';\n$quotes[] = 'We must not say every mistake is a foolish one.';\n$quotes[] = 'Austerity is an ornament, humility is honorable.';\n$quotes[] = 'He that would perfect his work must first sharpen his tools.';\n$quotes[] = 'Respect yourself and others will respect you.';\n$quotes[] = 'Life is really simple, but we insist on making it complicated.';\n$quotes[] = 'How we spend our days is, of course, how we spend our lives.';\n$quotes[] = 'He who does not climb, will not fall either.';\n$random_number = rand(0,count($quotes)-1);\necho $quotes[$random_number];\n }", "function getRandomQuote($array){ \n $randomKey = array_rand($array);\n return $array[$randomKey]; \n}", "function quote() {\n\t\t$quotes = [\n\t\t\t'“Walk as if you are kissing the Earth with your feet.”',\n\t\t\t'“Life is a journey. Time is a river. The door is ajar”',\n\t\t\t'“Man suffers only because he takes seriously what the gods made for fun.”',\n\t\t\t'“To Do Today, 1/17/08\n\t\t\t\t1. Sit and think\n\t\t\t\t2. Reach enlightenment\n\t\t\t\t3. Feed the cats”',\n\t\t\t'“The truth knocks on the door and you say, \"Go away, I\\'m looking for the truth,\" and so it goes away. Puzzling.” ',\n\t\t\t'“The way out is through the door. Why is it that no one will use this method?”',\n\t\t\t'“Letting go is the lesson. Letting go is always the lesson. Have you ever noticed how much of our agony is all tied up with craving and loss?”',\n\t\t\t'“Only the hand that erases can write the true thing.”',\n\t\t\t'“It is the power of the mind to be unconquerable.”',\n\t\t\t'“Flow with whatever may happen, and let your mind be free: Stay centered by accepting whatever you are doing. This is the ultimate.”',\n\t\t\t'“It is easy to believe we are each waves and forget we are also the ocean.”',\n\t\t\t'“When the mind is exhausted of images, it invents its own.”',\n\t\t\t'“Haiku is not a shriek, a howl, a sigh, or a yawn; rather, it is the deep breath of life.”',\n\t\t\t'“Consider your own place in the universal oneness of which we are all a part, from which we all arise, and to which we all return.”',\n\t\t];\n\n\t\t$randomQuoteIndex = mt_rand(0, count($quotes) - 1);\n\n\t\treturn $quotes[$randomQuoteIndex];\n\t}", "function getRandomQuote($array) {\n\n$quote = $array[rand (0,5)];\n//all functions need to have a return\n\nreturn $quote;\n\n}", "function printQuote (){\n $displayQuote = getRandomQuote(); // Setting the variable here again as it was not global\n $mainQuote = '<p class=\"quote\">' . $displayQuote['quote'] . '</p>' . '<p class=\"source\">' . $displayQuote['source'];\n if (isset($displayQuote['citation'])) {\n $mainQuote .= '<span class=\"citation\">' . $displayQuote['citation'] . '</span>';\n }\n if (isset($displayQuote['year'])) {\n $mainQuote .= '<span class=\"year\">' . $displayQuote['year'] . '</span>';\n }\n return $mainQuote . '</p>';\n}", "function print_quote() {\n\n\t// get random quote\n\t$quote = get_a_random_quote();\n\n\t// print quote in a * container\n\techo \"<div class=\\\"stripfilm-random-quote\\\"><p>$quote</p></div>\";\n\n}", "function getRandomQuote (){\n global $quotes;\n $random = rand(0, 6);\n return $quotes[$random];\n}", "function getRandomQuote($array){\n //this function should take in an array of quotes\n //select a random quote from array and return it\n $random_number = rand(0,4);\n return $array[$random_number];\n\n}", "function getRandomQuote($array){\n //Will generate a random number that will be used to determine which quote to pull from the inner arrays\n $randomNum = rand(0, 7);\n \n //Passing on the randomly selected inner associative array\n return $array[$randomNum];\n }", "function getRandomQuote($quotes){\r\n // this function is from php documentation of PHP rand. \r\n $generation = rand(0 , 4);\r\n return $quotes[$generation][\"quote\"];\r\n}", "public function generateHtml();", "public function ajax() {\n\n\t\t$quotes = get_transient( CF_CACHE );\n $single = rand(0, sizeof( $quotes )-1);\n\n\t\techo '<p id=\"coolwidgetquote\">' . $quotes[$single] . '</p>';\n\n\t\tdie();\n\n\t}", "function displayAboutMeQuote(array $aboutMeQuotes) : string {\n $result=\"\";\n foreach ($aboutMeQuotes as $aboutMeQuote) {\n if(array_key_exists('content', $aboutMeQuote)) {\n $result .= \"<p class='contentEmphasisLine'>\" . $aboutMeQuote['content'] . \"<span class='contentQuote'>\\\"</span></p>\";\n } else {\n $result .=\"\";\n }\n }\n return $result;\n}", "public static function generateNewQuote() {\n $sources = [];\n $sources[] = [\n 'url' => 'http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en',\n 'content' => 'quoteText',\n 'author' => 'quoteAuthor',\n 'original_url' => 'quoteLink',\n 'container' => false\n ];\n $sources[] = [\n 'url' => 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',\n 'content' => 'content',\n 'author' => 'title',\n 'original_url' => 'link',\n 'container' => 'array'\n ];\n shuffle($sources);\n\n $source = $sources[0];\n\n $ch = curl_init($source['url']);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);\n curl_setopt($ch, CURLOPT_TIMEOUT, 3);\n curl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36'\n ]);\n $data = curl_exec($ch);\n\n $content = false;\n $author = false;\n $url = false;\n\n if($data) {\n $data = @json_decode($data, true);\n if($data) {\n if($source['container'] == 'array')\n $data = $data[0];\n if(array_key_exists($source['content'], $data))\n $content = $data[$source['content']];\n if(array_key_exists($source['author'], $data))\n $author = $data[$source['author']];\n if(array_key_exists($source['original_url'], $data))\n $url = $data[$source['original_url']];\n }\n }\n\n if($content && $author && $url) {\n $quote = ORM::for_table('quotes')->where('original_url', $url)->find_one();\n if(!$quote) {\n $quote = ORM::for_table('quotes')->create();\n $quote->author = $author;\n $quote->content = trim(strip_tags($content));\n $quote->original_url = $url;\n $quote->save();\n }\n } else {\n // Getting a new quote failed, so return a cached one\n $quote = ORM::for_table('quotes')->order_by_expr('RAND()')->find_one();\n }\n\n return $quote;\n }", "function getRandQuote() {\r\n // Connect to the MySQL DB server and select the database\r\n mysql_connect(\"localhost\",\"webserviceuser\",\"secret\");\r\n mysql_select_db(\"chapter20\");\r\n\r\n // Create and execute the query\r\n $query = \"SELECT boxer, quote, year FROM quotation \r\n ORDER BY RAND() LIMIT 1\";\r\n $result = mysql_query($query);\r\n $row = mysql_fetch_array($result); \r\n\r\n // Retrieve, assemble, and return the quote data\r\n $boxer = $row[\"boxer\"];\r\n $quote = $row[\"quote\"];\r\n $year = $row[\"year\"];\r\n return \"\\\"$quote\\\", $boxer ($year)\";\r\n }", "function output_footer_markup(){\n\t\n\t$quote = get_random_quote();\n\t\n\t$markup = '<div style=\"width: 960px; margin: 0 auto; padding-top: 80px; padding-bottom: 80px;\"> \n\t\t\t\t\t<h1>Full-Width, Left-Aligned</h1>\n\t\t\t\t\t<div class=\"testimonial-quote group\">\n\t\t\t\t\t\t<img src=\"http://placehold.it/120x120\">\n\t\t\t\t\t\t<div class=\"quote-container\">\n\t\t\t\t\t\t\t<blockquote>\n\t\t\t\t\t\t\t\t<p>' . $quote['quote'] . '</p>\n\t\t\t\t\t\t\t</blockquote> \n\t\t\t\t\t\t\t<cite><span>' . $quote['author'] . '</span>\n\t\t\t\t\t\t\t</cite>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div> \n\t\t\t\t</div>';\n\t\n\n\t\n\techo $markup;\n\t\n}", "public static function quote()\n {\n return Collection::make([\n 'HAPPY NEW YEAR!',\n 'May this year treat you with more laravel',\n 'happi happi happi new year!'\n ])->random();\n }", "public function generate_html_contents() {\n $format =<<<MR\n <div class=\"cart-item\">\n <div>\n <img src=\"%s\" alt=\"%s\">\n </div>\n <div>\n <span>%s</span>\n <span>%s &times; $%s</span>\n <span>Size: %s</span>\n </div>\n </div>\nMR;\n \n $retval = [];\n \n foreach($this->items as $sku => $sizes) {\n $product = new Product($sku);\n \n foreach($sizes as $size => $qty) {\n $htmloutput = sprintf(\n $format,\n $product->img,\n $product->name,\n $product->name,\n $qty,\n $product->price,\n $size\n );\n array_push($retval, $htmloutput); \n }\n }\n \n return implode(\"\\n\", $retval);\n \n }", "public function index(){\n\t\t $quotes = Quotes::all();\n\t\t $randQuote = rand(1,count($quotes));\n\t\t $quotees = $quotes[$randQuote-1];\n\t\t try{\n\t\t\t $statusCode = 200;\n\t\t\t \n\t\t\t $response = $quotees;\n\t\t }\n\t\t catch (Exception $e){\n\t\t\t $statusCode = 404;\n\t\t\t $response = \"error coy\";\n\t\t }\n\t\t finally{\n\t\t\t return Response::json($response, $statusCode);\n\t\t\t //return 'hehe';\n\t\t }\n\t }", "public static function quote()\n {\n return Collection::make([\n\n 'No one has ever become poor by giving. - Anne Frank, diary of Anne Frank ',\n 'It\\'s not how much we give but how much love we put into giving. - Mother Teresa',\n 'There is no exercise better for the heart than reaching down and lifting people up. - John Holmes',\n 'When we give cheerfully and accept gratefully, everyone is blessed. - Maya Angelou',\n 'You have not lived today until you have done something for someone who can never repay you. - John Bunyan',\n 'The simplest acts of kindness are by far more powerful then a thousand heads bowing in prayer. - Mahatma Gandhi',\n 'We only have what we give. - Isabel Allende',\n 'Doing nothing for others is the undoing of ourselves. - Horace Mann',\n\n ])->random();\n }", "public function random()\n\t{\n\t\treturn self::QUOTES[rand(1, count(self::QUOTES))];\n\t}", "function getQuotes(){\n\n\n\t\t\n\tglobal $con; \n\n\t$get_quote = \"select * from quotes ORDER BY id DESC LIMIT 1\";\n\n\t$run_quote = mysqli_query($con, $get_quote); \n\t\n\twhile($row_quote=mysqli_fetch_array($run_quote)){\n\t\n\t\t$quote_author = $row_quote['author'];\n\t\t$quote = $row_quote['quote'];\n\t\t\n\t\techo \"\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t<h3 class='citat'>$quote</h3>\n\t\t\t\t\t<h2 class='author text-center'>$quote_author</h2>\n\t\t\";\n\t\n\t}\n\t\n//}\n\n}", "public function generateHtml()\n {\n // We need to sort the items\n $this->items = $this->items->sortBy(function($item) {\n return $item->order;\n });\n\n // Start html\n $html = '';\n\n foreach ($this->items as $item) {\n $activeClass = '';\n\n // Check if active\n if ($item->active) {\n $activeClass = 'selected';\n }\n\n // Start HTML\n $html .= '<li class=\"' . $activeClass . '\"><a href=\"' . $item->url . '\">';\n\n // Add an icon\n if ($item->icon) {\n $html .= '<i class=\"' . $item->icon . '\"></i>';\n }\n\n // The link and label\n $html .= '<span>' . $item->label . '</span>';\n\n // Close it out\n $html .= '</a></li>'.PHP_EOL;\n }\n\n return $html;\n }", "abstract public function html();", "abstract public function html();" ]
[ "0.7203523", "0.70404845", "0.6903379", "0.6891195", "0.6878512", "0.6756108", "0.66263086", "0.661167", "0.65999484", "0.6591371", "0.65611506", "0.651689", "0.64784515", "0.63250387", "0.6317537", "0.61712307", "0.61442393", "0.6095209", "0.58362746", "0.5782225", "0.5749895", "0.5715224", "0.56835026", "0.565702", "0.56441367", "0.5627432", "0.5606271", "0.5603485", "0.5520298", "0.5520298" ]
0.74685425
0
Gets the images of the webpage.
public function getImages() { $images = array(); $nodes = $this->html->findTags('img'); foreach ($nodes as $node) { $source = trim($node->getAttribute('src')); if (empty($source)) { continue; } $url = $this->getAbsoluteUrl($source); $size = $this->getImageSize($url); if (is_array($size)) { list($width, $height) = $size; } else { continue; } if ($width > 299 || $height > 149) { $images[] = array( 'url' => $url, 'width' => $width, 'height' => $height, 'area' => ($width * $height) ); } } return $images; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getImagesForSeo();", "function getImages()\n {\n global $html;\n //The following regular expression extracts contents from the $html which is enclosed between the tags <img>..</img> and copies it to the $imagetags variable\n preg_match_all('/<img[^>]+>/i',$html, $imagetags);\n //The following loop parses through the each image and extracts source information\n for ($i = 0; $i < count($imagetags[0]); $i++) {\n //From the extracted image tag, the following regular expression match helps in extracting the contents in the src attribute of the img tag\n preg_match('/src=\"([^\"]+)/i',$imagetags[0][$i], $imagetags2);\n //Finally the \"src=\" needs to be removed from the extracted source\n $images[] = str_ireplace( 'src=\"', '', $imagetags2[0]);\n }\n //Returns the images array\n return $images;\n }", "function GetImages()\n {\n echo BlogHelper::GetImages($this->Core, Request::GetPost(\"BlogId\"));\n }", "private function getPageImageUrls($html = '')\n {\n $base_path = $this->current_page_url;\n \n $dom = new DOMDocument();\n @$dom->loadHTML($html);\n\n // check if a base url has been defined in the page\n $x1 = new DOMXPath($dom);\n foreach ($x1->evaluate('/html/head/base') as $bp){\n if ($bp->hasAttribute('href')){\n $base_path = (string) $bp->getAttribute('href');\n break;\n }\n }\n \n // get img tags from page\n $x2 = new DOMXPath($dom);\n $image_urls = array();\n \n foreach ($x2->evaluate('/html/body//img') as $node){\n $src = (string) $node->getAttribute('src');\n if (!$this->ignoreThisImage($src)){\n $ext = myUtil::getFileExtension($src);\n if (in_array($ext, $this->image_types)){\n $url = $this->relativeUrlToAbs($src, $base_path);\n $image_urls[] = str_replace(' ', '%20', $url);\n }\n }\n }\n\n unset($x1);\n unset($xpath);\n unset($dom);\n\n return array_unique($image_urls);\n }", "public function getArticlesImage(){\n\t\t$images = array();\n\t\tforeach($this->_content->find($this->_imageSelector) as $element) \n\t\t\t$images[] = $element->src;\n\t\n\t\treturn $images;\t\n\t}", "public function images();", "public function images();", "public function index()\n {\n return $this->images;\n }", "public function action_images()\n {\n ACL::required('controller_browser_action_index');\n\n $user = User::active_user();\n\n if ($user->id > 0)\n {\n $root = APPPATH . 'media' . DS . 'users' . DS . User::get_group($user->id) . DS . $user->id;\n }\n else\n {\n $root = APPPATH . 'media';\n }\n\n $tree = $this->tree($root);\n $menu = $this->ul($tree);\n\n $view = View::factory('browser/image')\n ->set('root', Assets::path2url($root))\n ->set('tree', $tree)\n ->set('menu', $menu);\n\n $this->response->body($view);\n }", "public function getImages()\n\t{\n\t\treturn $this->getPublicMedia()->filter(function($e){\n\t\t\treturn $e->getMedia()->getType() == 'image';\n\t\t});\n\t}", "protected function parseImages(){\n\t\t$images\t= array();\n\t\t$content\t= strip_tags($this->content, '<img>'); // Remove all non-image tags\n\n\t\tif(preg_match_all('~<img [^>]*?src=\"([^\"]*?)\"~', $content, $matches)){\n\t\t\t$images\t= $matches[1];\n\t\t}\n\n\t\treturn $images;\n\t}", "public function getImagePage () {}", "public function get_images()\n\t{\n\t\tif (isset($_SESSION['imgarr']))\n\t\t{\n\t\t\t$this->files_arr = $_SESSION['imgarr'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ($dh = opendir(IMGDIR))\n\t\t\t{\n\t\t\t\twhile (false !== ($file = readdir($dh)))\n\t\t\t\t{\n\t\t\t\t\tif (preg_match('/^.*\\.(jpg|jpeg|gif|png)$/i', $file))\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->files_arr[] = $file;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tclosedir($dh);\n\t\t\t}\n\t\t\t$_SESSION['imgarr'] = $this->files_arr;\n\t\t}\n\t}", "public function getImages() {\r\n\treturn $this->images;\r\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "private function fetch_image_data()\n {\n try {\n $response = wp_remote_get( 'https://jsonplaceholder.typicode.com/photos' );\n $images = json_decode( $response['body'] );\n\n } catch ( Exception $ex ) {\n $images = null;\n }\n return $images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages($body)\n {\n if (null === $body) {\n return array();\n }\n\n $selector = new Selector();\n $selector->setBody($body);\n $res = $selector->query('img');\n\n $domain = $this->getDomain();\n\n $imgs = array();\n foreach ($res as $result) {\n $iSrc = $result->getAttribute('src');\n $iSrc = $this->absoluteUrl($iSrc, $domain);\n $imgs[md5($iSrc)] = $iSrc;\n }\n\n return $imgs;\n }", "public function getImageUrl();", "public function index()\n {\n $images = Image::all();\n return $images;\n }", "public function index() {\n $images = Image::all();\n return $images;\n }", "public function get_images() {\n // Check if images directory is empty, if not, collect the images.\n if ($this->check_images_dir()) {\n $this->collect_images();\n }\n return $this->images;\n }", "function getImages()\n\t{\n\t\t$dir = $this->getImagesDirectory();\n\t\t$images = array();\n\t\tif (is_dir($dir))\n\t\t{\n\t\t\t$entries = ilUtil::getDir($dir);\n\t\t\tforeach($entries as $entry)\n\t\t\t{\n\t\t\t\tif (substr($entry[\"entry\"],0,1) == \".\")\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif ($entry[\"type\"] != \"dir\")\n\t\t\t\t{\n\t\t\t\t\t$images[] = $entry;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $images;\n\t}", "private function findImages($html)\n {\n $images = [];\n\n foreach ($html->find('img') as $img) {\n $images[] = $img->src;\n }\n\n return $images;\n }", "public function test()\n { \n //$url = 'https://www.milo.co.th/';\n $url = 'http://milo-au-v3.asiadigitalhub.com/champ-squad';\n $contents = file_get_contents($url);\n libxml_use_internal_errors(true);\n $dom = new \\DOMDocument();\n @$dom->loadHTML($contents);\n libxml_clear_errors();\n $xpath = new \\DOMXpath($dom);\n /*$nodes = $xpath->query(\"//div[@id='movie']\");\n foreach ($nodes as $node) {\n $morenodes = $xpath->query(\".//img \", $node);\n foreach($morenodes as $mode){\n dump($mode->getAttribute('src'));\n }\n \n }*/\n $arr_img = array();\n $nodes = $xpath->query(\".//img \");\n foreach ($nodes as $node) {\n if(strpos($node->getAttribute('src'), '/files') != false) {\n $arr_img[] = $node->getAttribute('src');\n }\n }\n \n return view('frontend.test.list_images')->with(array('results' => $arr_img));\n }", "public function image()\n {\n // return Response::download($path);\n\n $images = [];\n\n $titles = DB::table('pages')->pluck('post_thumbnail');\n\n foreach ( $titles as $title ) {\n\n $images[] = public_path() . '/uploads/' . $title;\n\n }\n\n return Response::json(['Links to images' => $images]);\n\n }", "function get_google_images($post_title,$start=0){\n\t\t\t$image_urls = array();\n\n\t $params = [\n\t 'q' => $post_title,\n\t 'source' => 'lnms',\n\t 'tbm' => 'isch',\n\t 'sa' => 'X',\n\t 'ved' => '0ahUKEwia_p_lupDVAhWFjZQKHY-jD3IQ_AUIDCgD',\n\t 'biw'=>'1680',\n\t 'bih'=>'944',\n\t // 'dpr'=>'1',\n\t 'start' => $start*20\n\t ];\n\t\t\t$curl_url = 'https://www.google.com/search?'.http_build_query($params);\n\n\t\t\t$html = $this->get_html_dom($curl_url);\n\t $href_arr = $html->find('.images_table a');\n\t $img_tags = $html->find('.images_table img');\n\t $img_td = $html->find('.images_table td');\n\t if (count($img_tags)>0){\n\t \tforeach ($img_tags as $key=>$img_tag) {\n\t \t\t$img_temp = $img_td[$key]->nodes[count($img_td[$key]->nodes)-1]->_[4];\n\t \t\t$img_temp = explode('-', $img_temp);\n\t \t\t$img_size = explode('&times;', $img_temp[0]);\n\t \t\t$img_width = trim($img_size[0]);\n\t \t\t$img_height = trim($img_size[1]);\n\t \t\t$image_urls[$key]['src'] = $img_tag->attr['src'];\n\t \t\t$image_urls[$key]['href'] = $img_width.'*'.$img_height.'*'.$href_arr[$key]->attr['href'].'*'.$img_tag->attr['src'];\n\t \t}\n\t }\n\t\t\treturn $image_urls;\n\t\t}" ]
[ "0.73917973", "0.7218573", "0.71291405", "0.70845747", "0.69503075", "0.69126946", "0.69126946", "0.67423993", "0.6699837", "0.66853267", "0.6652929", "0.66321695", "0.66055536", "0.6570416", "0.656885", "0.656885", "0.656885", "0.656885", "0.6565215", "0.6561815", "0.65368193", "0.64957887", "0.6487792", "0.64862776", "0.648554", "0.6474397", "0.6451557", "0.6444656", "0.6403635", "0.63947016" ]
0.72845453
1
Get all pattern options
public function getOptions() { if (null === $this->options) { $this->setOptions(new PatternOptions()); } return $this->options; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions();", "public function getOptions(): array {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "public function getOptions() {}", "protected function getOptions()\n\t{\n\t\treturn array(\n\t\t\t\n\t\t);\n\t}", "protected function getOptions()\n {\n return array(\n );\n }", "protected function getOptions()\n {\n return array(\n );\n }", "protected function getOptions()\n\t{\n\t\treturn array(\n\t\t);\n\t}", "protected function getOptions()\n\t{\n\t\treturn array(\n\t\t);\n\t}", "protected function getOptions()\n\t{\n\t\treturn array(\n\t\t);\n\t}" ]
[ "0.6858286", "0.6858286", "0.6858286", "0.6858286", "0.6858286", "0.6858286", "0.6858286", "0.6858286", "0.6623956", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6602033", "0.6598276", "0.65643334", "0.65643334", "0.65295804", "0.65295804", "0.65295804" ]
0.7926446
0
set doctype for standard mode
static function setDoctype() { if (!self::$hasDoctype) { self::$hasDoctype = true; echo "<!doctype html>"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doctype (){$this->add($this->doctype2str());}", "public function setDoctype($type = 'html5') {\n\t\t$this->doctype = $type;\n\n\t\t$doctype = array(\n\t\t\t'html4.01-strict' => 'PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"',\n\t\t\t'html4.01-transitional' => 'PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"',\n\t\t\t'html4.01-frameset' => 'PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\"',\n\t\t\t'xhtml1.0-strict' => 'PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"',\n\t\t\t'xhtml1.0-transitional' => 'PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"',\n\t\t\t'xhtml1.0-frameset' => 'PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\"',\n\t\t\t'xhtml1.1' => 'PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"',\n\t\t\t'html5' => '',\n\t\t);\n\n\t\t// Default doctype\n\t\tif (!array_key_exists($type, $doctype)) return;\n\n\t\t$this->setVar('DOCTYPE', $doctype[$type]);\n\n\t\t// xmlns attribute required for xhtml document\n\t\tif (strpos($type, 'xhtml') === 0)\n\t\t\t$this->setHtmlAttribute('xmlns', 'http://www.w3.org/1999/xhtml');\n\t}", "public function set_doctype ($doctype = XHTML_10_TRANSITIONAL)\n\t{\n\t\t$this->doctype = $doctype;\n\t}", "public function setDoctype(DocType $doctype) {\n $doctype->setEncoding(self::$globalEncoding);\n self::$closeHtmlTagsWithSlash = $doctype->getCloseTagsWithSlash();\n $this->doctype = $doctype;\n }", "public function getDoctype()\n {\n return $this->doctype;\n }", "function doctype($type, $version) {\n\t$doctype['HTML'] ['TRANSITIONAL'] = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">';\n\t$doctype['HTML'] ['STRICT'] = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">';\n\t$doctype['HTML'] ['FRAMESET'] = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">';\n\t$doctype['XHTML']['STRICT'] = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">';\n\t$doctype['XHTML']['TRANSITIONAL'] = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\n\t$doctype['XHTML']['FRAMESET'] = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">';\n\t$doctype['XHTML']['MOBILE'] = '<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">';\n\t$doctype['HTML5']['STRICT'] = '<!DOCTYPE html>';\n\t\n\t$result = \"<?xml version=\\\"1.0\\\" ?>\\n\".$doctype[$type][$version].\"\\n\";\n\t$result .= '<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">'.\"\\n\";\n\treturn $result;\n}", "function xml_set_doctype_handler($handler) {\r\n\t\t$this->DTDHandler =& $handler;\r\n\t}", "function adam_doctype(){\n\techo '<!DOCTYPE html>\n\t';\n\n\t\n}", "function gavernwp_doctype_hook() {\n\t// generate the HTML5 doctype\n\techo '<!DOCTYPE html>' . \"\\n\";\n\n \t// YOUR HOOK CODE HERE\n}", "function testDoctype() {\n $att1 = array(\"html\");\n $node1 = new JNode(\"!DOCTYPE\", 0, 0, $att1, null);\n $nv1 = new NodeValidator($node1);\n $nv1->validate();\n $this->assertTrue(count($nv1->getErrors()) == 0);\n \n $att2 = array(\"html\", \"wrong\");\n $node2 = new JNode(\"!DOCTYPE\", 0, 0, $att2, null);\n $nv2 = new NodeValidator($node2);\n $nv2->validate();\n $this->assertTrue(in_array(\"Doctype must have only one attribute.\", $nv2->getErrors()));\n \n $node3 = new JNode(\"!DOCTYPE\", 0, 0, null, null);\n $nv3 = new NodeValidator($node3);\n $nv3->validate();\n $this->assertTrue(in_array(\"Doctype is missing required specification.\", $nv3->getErrors()));\n \n $att4 = array(\"html4\");\n $node4 = new JNode(\"!DOCTYPE\", 0, 0, $att4, null);\n $nv4 = new NodeValidator($node4);\n $nv4->validate();\n $this->assertTrue(in_array(\"Declared Doctype is not HTML5.\", $nv4->getErrors()));\n \n }", "public function getDoctype()\n {\n $version = $this->getVersion() ?: 4.0;\n\n if ($this->getMethod() !== static::METHOD_HTML) {\n throw new \\RuntimeException('Non HTML output methods are not supported for DOCTYPE');\n }\n\n $doctype = '<!DOCTYPE ';\n\n if ($version === 5.0) {\n return $doctype . 'html>';\n }\n\n if ($version === 4.0) {\n $doctype .= 'HTML';\n } else {\n $doctype .= 'html';\n }\n\n if ($this->getDoctypePublicAttribute() === null && $this->getDoctypeSystemAttribute() === null) {\n if ($version === 4.0) {\n return $doctype\n . ' PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">';\n }\n\n throw new \\RuntimeException(\"No default DOCTYPE declared for HTML version $version\");\n }\n\n if ($this->getDoctypePublicAttribute()) {\n $doctype .= ' PUBLIC \"' . $this->getDoctypePublicAttribute() . '\"';\n\n if ($this->getDoctypeSystemAttribute()) {\n $doctype .= ' \"' . $this->getDoctypePublicAttribute() . '\"';\n }\n }\n\n return $doctype . '>';\n }", "static public function tag_doctype($doctype = XHTML::DOCTYPE_STRICT)\n {\n return '<!DOCTYPE html PUBLIC ' . $doctype . '>';\n }", "private function doctypeSpec($spec) {\n\t\tswitch (strtolower($spec)) {\n\t\t\tcase 'html4':\n\t\t\tcase 'html4-strict':\n\t\t\t\treturn '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">' . PHP_EOL;\n\t\t\tcase 'html4-transitional':\n\t\t\t\treturn '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">' . PHP_EOL;\n\t\t\tcase 'html4-frameset':\n\t\t\t\treturn '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">' . PHP_EOL;\n\t\t\tcase 'xhtml':\n\t\t\tcase 'xhtml1':\n\t\t\tcase 'xhtml1-strict':\n\t\t\t\treturn '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">' . PHP_EOL;\n\t\t\tcase 'xhtml1-transitional':\n\t\t\t\treturn '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">' . PHP_EOL;\n\t\t\tcase 'xhtml1-frameset':\n\t\t\t\treturn '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">' . PHP_EOL;\n\t\t\tcase 'xhtml11':\n\t\t\t\treturn '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">' . PHP_EOL;\n\t\t\tcase 'html':\n\t\t\tcase 'html5':\n\t\t\tdefault:\n\t\t\t\treturn '<!DOCTYPE html>' . PHP_EOL;\n\t\t}\n\t}", "public function setDoctype($docType)\n\t\t{\n\t\t\tParameter::check(array(\n\t\t\t\t\t\"string\" \t=> $docType\n\t\t\t\t), __METHOD__);\n\t\t\t\t\n\t\t\t$this->docType = $docType;\n\t\t}", "protected function getDoctypeAsString()\n {\n switch ($this->doctype) {\n case self::HTML5:\n return '<!DOCTYPE html>';\n case self::HTML401_STRICT:\n return '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"> ';\n case self::HTML401_TRANSITIONAL:\n return '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> ';\n case self::HTML401_FRAMESET:\n return '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\"> ';\n case self::XHTML1_STRICT:\n return '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> ';\n case self::XHTML1_TRANSITIONAL:\n return '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\n case self::XHTML1_FRAMESET:\n return '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">';\n case self::XHTML11:\n return '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">';\n default:\n return '';\n }\n }", "public function setDoctype($doctype)\n {\n $this->doctype = $doctype;\n return $this;\n }", "function rad_doctype_tag() {\n echo '<!DOCTYPE html>';\n}", "public function deleteDoctype(): XmlCleaner\n\t{\n\t\t# Delete doctype if activated\n\t\tif($this->options[self::OPTION_DELETE_DOCTYPE]) {\n\t\t\t$this->xml = preg_replace('`\\<\\!DOCTYPE [^<]*\\>`i', '', $this->xml);\n\t\t}\n\n\t\t# Maintain chainability\n\t\treturn $this;\n\t}", "function childtheme_create_doctype() {\n $content = \"<!doctype html>\" . \"\\n\";\n $content .= '<!--[if lt IE 8]> <html class=\"no-js lt-ie9 lt-ie8\" dir=\"' . get_bloginfo ('text_direction') . '\" lang=\"'. get_bloginfo ('language') . '\"> <![endif]-->'. \"\\n\";\n $content .= '<!--[if IE 8]> <html class=\"no-js lt-ie9\" dir=\"' . get_bloginfo ('text_direction') . '\" lang=\"'. get_bloginfo ('language') . '\"> <![endif]-->' . \"\\n\";\n $content .= \"<!--[if gt IE 8]><!-->\" . \"\\n\";\n $content .= \"<html class=\\\"no-js\\\"\";\n return $content;\n}", "protected function ModifyHtmlDoctype ($s_html) {\n\t\t$s_html = str_replace('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">'\n\t\t\t, \"<!DOCTYPE html\\n\tPUBLIC \\\"-//W3C//DTD XHTML 1.0 Strict//EN\\\"\\n\t\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\\\">\"\n\t\t\t, $s_html);\n\t\treturn $s_html;\n\t}", "public static function getDoctype($xml) {\r\n\t\trequire_once \"Larc/Xml/Element.php\";\r\n\t\t// convert XML object to string\r\n\t\tif($xml instanceof SimpleXMLElement || $xml instanceof Larc_Xml_Element) {\r\n\t\t\t$xml = $xml->asXML();\r\n\t\t} else if($xml instanceof DOMDocument) {\r\n\t\t\t$xml = $xml->saveXML();\r\n\t\t} else if(!is_string($xml)) {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\r\n\t\t// remove extra whitespace at the beginning\r\n\t\t$xml = ltrim($xml);\r\n\r\n\t\t// get doctype\r\n\t\tif(preg_match('/(<!DOCTYPE.*?>)/', $xml, $matches)) {\r\n\t\t\treturn $matches[1];\r\n\t\t} else {\r\n\t\t\treturn \"\";\r\n\t\t}\r\n\t}", "function doctype($page, $css_user)\n\t{\n\t\t//include config for title\n\t\tinclude('config.inc.php');\n\t\t//Strict doctype\n\t\techo '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\t\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">';\n\t\techo '<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">';\n\t\techo '<head>';\n\t\t//metatype\n\t\techo '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />';\n\t\t//Keywords for google etc\n\t\techo '<meta name=\"Keywords\" content=\"\" />';\n\t\t//Description of the website\n\t\techo '<meta name=\"Description\" content=\"\" />';\n\t\t//$overall_title is loaded from config.inc.php, $page = given with the function\n\t\techo \"<title>\".$overall_title.\" - \".$page.\"</title>\";\n\t\t//General stylesheet\n\t\techo '<!-- Stylesheet -->';\n\t\t//This check is because of the include can be fixed a lot easier ofc\n\t\t//by just adding the hardcoded link based on the config.\n\t\tif($css_user == \"user\")\n\t\t{\n\t\t\techo '<link rel=\"stylesheet\" href=\"includes/kia.css\" type=\"text/css\" />';\n\t\t\techo '<link rel=\"stylesheet\" href=\"includes/lightbox/css/lightbox.css\" type=\"text/css\" media=\"screen\" />';\n\t\t?>\n\t\t\t<script type=\"text/javascript\" src=\"includes/lightbox/js/prototype.js\"></script>\n\t\t\t<script type=\"text/javascript\" src=\"includes/lightbox/js/scriptaculous.js?load=effects,builder\"></script>\n\t\t\t<script type=\"text/javascript\" src=\"includes/lightbox/js/lightbox.js\"></script>\n\t\t\t<script type=\"text/javascript\" src=\"includes/custom_elements/custom-form-elements.js\"></script>\n\n\t\t<?php\n\t\t}\n\t\telse if($css_user == \"admin\")\n\t\t{\n\t\t\techo '<link rel=\"stylesheet\" href=\"../includes/kia.css\" type=\"text/css\" />';\n\n\t\t\techo '<script type=\"text/javascript\" src=\"../includes/mootools/mootools.js\"></script>';\n\t\t\t?>\n\t\t\t<script type=\"text/javascript\" src=\"../includes/ckeditor/ckeditor.js\"></script>\n\t\t\t<style type=\"text/css\" media=\"screen\">\n\n\t\t\t\tinput.error {border: 1px dotted red;}\n\n\t\t\t</style>\n<script type=\"text/javascript\">\n\n window.addEvent ('domready', function () {\n\n $$('input.required').each (function (item) {\n\n item.addEvent ('blur', function () {\n\n if (item.get ('value') == '') {\n\n item.setAttribute ('class', 'error');\n\n }\n\n else {\n\n item.setAttribute ('class', 'required');\n\n }\n\n });\n\n });\n\n });\n</script>\n<script type=\"text/javascript\" src=\"includes/imageupload/jquery-1.3.2.js\"></script>\n<script type=\"text/javascript\" src=\"includes/imageupload/swfupload/swfupload.js\"></script>\n<script type=\"text/javascript\" src=\"includes/imageupload/jquery.swfupload.js\"></script>\n\n<script type=\"text/javascript\">\n\n$(function(){\n\t$('#swfupload-control').swfupload({\n\t\tupload_url: \"includes/imageupload/process_upload.php?postcode=<?php echo $_GET['postcode']; ?>&huisnummer=<?php echo $_GET['huisnummer']; ?>&house_id=<?php echo $_GET['house_id']; ?>\",\n\t\tfile_post_name: 'uploadfile',\n\t\tfile_size_limit : \"10240\",\n\t\tfile_types : \"*.jpg;*.png;*.gif; *.JPG\",\n\t\tfile_types_description : \"Image files\",\n\t\tfile_upload_limit : 0,\n\t\tflash_url : \"includes/imageupload/swfupload/swfupload.swf\",\n\t\tbutton_image_url : 'includes/imageupload/swfupload/wdp_buttons_upload_114x29.png',\n\t\tbutton_width : 114,\n\t\tbutton_height : 29,\n\t\tbutton_placeholder : $('#button')[0],\n\t\tdebug: false\n\t})\n\t\t.bind('fileQueued', function(event, file){\n\t\t\tvar listitem='<li id=\"'+file.id+'\" >'+\n\t\t\t\t'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class=\"progressvalue\" ></span>'+\n\t\t\t\t'<div class=\"progressbar\" ><div class=\"progress\" ></div></div>'+\n\t\t\t\t'<p class=\"status\" >Pending</p>'+\n\t\t\t\t'<span class=\"cancel\" >&nbsp;</span>'+\n\t\t\t\t'</li>';\n\t\t\t$('#log').append(listitem);\n\t\t\t$('li#'+file.id+' .cancel').bind('click', function(){\n\t\t\t\tvar swfu = $.swfupload.getInstance('#swfupload-control');\n\t\t\t\tswfu.cancelUpload(file.id);\n\t\t\t\t$('li#'+file.id).slideUp('fast');\n\t\t\t});\n\t\t\t// start the upload since it's queued\n\t\t\t$(this).swfupload('startUpload');\n\t\t})\n\t\t.bind('fileQueueError', function(event, file, errorCode, message){\n\t\t\talert('Size of the file '+file.name+' is greater than limit');\n\t\t})\n\t\t.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){\n\t\t\t$('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued);\n\t\t})\n\t\t.bind('uploadStart', function(event, file){\n\t\t\t$('#log li#'+file.id).find('p.status').text('Uploading...');\n\t\t\t$('#log li#'+file.id).find('span.progressvalue').text('0%');\n\t\t\t$('#log li#'+file.id).find('span.cancel').hide();\n\t\t})\n\t\t.bind('uploadProgress', function(event, file, bytesLoaded){\n\t\t\t//Show Progress\n\t\t\tvar percentage=Math.round((bytesLoaded/file.size)*100);\n\t\t\t$('#log li#'+file.id).find('div.progress').css('width', percentage+'%');\n\t\t\t$('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');\n\t\t})\n\t\t.bind('uploadSuccess', function(event, file, serverData){\n\t\t\tvar item=$('#log li#'+file.id);\n\t\t\titem.find('div.progress').css('width', '100%');\n\t\t\titem.find('span.progressvalue').text('100%');\n\t\t\tvar pathtofile='<a href=\"../images/aanbod/<?php echo $_GET['postcode'].\"/\".$_GET['huisnummer'].\"/\"; ?>'+file.name+'\" target=\"_blank\" >view &raquo;</a>';\n\t\t\titem.addClass('success').find('p.status').html('Succes | '+pathtofile);\n\t\t})\n\t\t.bind('uploadComplete', function(event, file){\n\t\t\t// upload has completed, try the next one in the queue\n\t\t\t$(this).swfupload('startUpload');\n\t\t})\n\n});\n\n </script><style type=\"text/css\" >\n#swfupload-control p{ margin:10px 5px; font-size:0.9em; }\n#log{ margin:0; padding:0; width:500px;}\n#log li{ list-style-position:inside; margin:2px; border:1px solid #ccc; padding:10px; font-size:12px;\n\tfont-family:Arial, Helvetica, sans-serif; color:#333; background:#fff; position:relative;}\n#log li .progressbar{ border:1px solid #333; height:5px; background:#fff; }\n#log li .progress{ background:#999; width:0%; height:5px; }\n#log li p{ margin:0; line-height:18px; }\n#log li.success{ border:1px solid #339933; background:#ccf9b9; }\n#log li span.cancel{ position:absolute; top:5px; right:5px; width:20px; height:20px;\n\tbackground:url('includes/imageupload/swfupload/cancel.png') no-repeat; cursor:pointer; }\n</style><?php\n\t\t}\n\n\t\techo '</head>';\n\t\techo '<body>';\n\t\techo '<!-- Wrapper div -->';\n\t\techo '<div id=\"container\">';\n\t\techo '<!-- Header -->';\n\t\techo '<div id=\"header\">';\n\t}", "function inline_head_doctype() { do_action( 'inline_head_doctype' ); }", "protected function scanDoctype()\n {\n return $this->scanInput('/^doctype *([\\w \\.\\-]+)?/', 'doctype');\n }", "public function __construct($doctype)\n {\n $this->doctype = $doctype;\n }", "public function checkDTD($dom)\n\t{\n\t\t// <!DOCTYPE html>\n\t\tif($dom->doctype->name === 'html')\n\t\t{\n\t\t\t$this->ca1Marks += 0.3125;\n\t\t\t$this->ca1Comments = \"DTD present: Good\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->ca1Comments = \"No HTML5 DTD found\";\n\t\t}\n\t}", "public function getDoctypeSystemAttribute()\n {\n return $this->doctypeSystemAttribute;\n }", "function set_html_content_type() { \treturn 'text/html'; }", "public function setParseMode ($parser_mode = 0) {}", "function set_html_content_type() {return 'text/html';}" ]
[ "0.7404201", "0.69753224", "0.66259885", "0.6600034", "0.6309294", "0.6225616", "0.60071546", "0.5956499", "0.5931029", "0.5847698", "0.5826111", "0.58052814", "0.5735652", "0.5699259", "0.56517357", "0.55681044", "0.551858", "0.5471331", "0.5460114", "0.53711486", "0.53649914", "0.5329471", "0.5320659", "0.5316761", "0.5289816", "0.52553266", "0.51967466", "0.5160646", "0.5094527", "0.5077833" ]
0.75143194
0
For charts that support annotations, the highContrast bool lets you override Google Charts' choice of the annotation color. By default, highContrast is true, which causes Charts to select an annotation color with good contrast: light colors on dark backgrounds, and dark on light. If you set highContrast to false and don't specify your own annotation color, Google Charts will use the default series color for the annotation
public function highContrast($highContrast) { return $this->setBoolOption(__FUNCTION__, $highContrast); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getIsHighContrastEnabled()\n {\n if (array_key_exists(\"isHighContrastEnabled\", $this->_propDict)) {\n return $this->_propDict[\"isHighContrastEnabled\"];\n } else {\n return null;\n }\n }", "public function highContrast($highContrast)\n {\n if (is_bool($highContrast)) {\n $this->highContrast = $highContrast;\n } else {\n throw new InvalidConfigValue(\n __FUNCTION__,\n 'bool'\n );\n }\n\n return $this;\n }", "public function setIsHighContrastEnabled($val)\n {\n $this->_propDict[\"isHighContrastEnabled\"] = $val;\n return $this;\n }", "function getHighContrastColor($hexcolor) {\n \n \t// do we have a CSS color name\n \t// if so we convert and use that\n \t// otherwise use the param\n \t$hexcolor_local = modCiviCRMFullCalendarHelper::GetColor($hexcolor);\n \tif ( $hexcolor_local == null ) {\n \t\t$hexcolor_local = $hexcolor;\n \t}\n \n \n \tdefine(\"_BLACK\", \"000000\");\n \tdefine(\"_WHITE\", \"FFFFFF\");\n \t// determine R, G and B values from the HEX color\n \t$hexcolor_local = strlen($hexcolor_local) == 7 ? substr($hexcolor_local, 1) : $hexcolor_local;\n \tif(strlen($hexcolor_local) == 6){\n \t\t$r = substr($hexcolor_local,0,2);\n \t\t$g = substr($hexcolor_local,2,2);\n \t\t$b = substr($hexcolor_local,4,2);\n \n \t\t$brightness = (hexdec($r) * 0.299) + (hexdec($g) * 0.587) + (hexdec($b) * 0.114);\n \t\tif ( $brightness <= 125) { return _WHITE; }\n \t}\n \t// default\n \treturn _BLACK;\n }", "private function augment_settings_view_appearance() {\n\n\t\t$related_to = 'show_legend_text';\n\t\t$new_options[ 'show_legend_text' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'view', 'group' => 'appearance' ) );\n\t}", "abstract public function getLegendColor();", "function hasContrastValues($myvalues, $form_state=NULL)\r\n {\r\n \r\n $sectionname = 'contrast';\r\n $b1 = isset($myvalues[$sectionname.'_enteric_customtx']) && $myvalues[$sectionname.'_enteric_customtx'] > '';\r\n $b2 = isset($myvalues[$sectionname.'_iv_customtx']) && $myvalues[$sectionname.'_iv_customtx'] > '';\r\n $foundvalues = $b1 || $b2;\r\n if(!$foundvalues && $form_state != NULL)\r\n {\r\n $b1 = isset($form_state['input'][$sectionname.'_enteric_customtx']) && $form_state['input'][$sectionname.'_enteric_customtx'] > '';\r\n $b2 = isset($form_state['input'][$sectionname.'_iv_customtx']) && $form_state['input'][$sectionname.'_iv_customtx'] > '';\r\n $foundvalues = $b1 || $b2;\r\n }\r\n \r\n //die('LOOK>>>>'.$sectionname.'='.$foundvalues.'>>>'.print_r($form_state['input'],TRUE));\r\n \r\n return $foundvalues;\r\n }", "function hasContrastValues($myvalues, $form_state=NULL)\n {\n \n $sectionname = 'contrast';\n $b1 = isset($myvalues[$sectionname.'_enteric_customtx']) && $myvalues[$sectionname.'_enteric_customtx'] > '';\n $b2 = isset($myvalues[$sectionname.'_iv_customtx']) && $myvalues[$sectionname.'_iv_customtx'] > '';\n $foundvalues = $b1 || $b2;\n if(!$foundvalues && $form_state != NULL)\n {\n $b1 = isset($form_state['input'][$sectionname.'_enteric_customtx']) && $form_state['input'][$sectionname.'_enteric_customtx'] > '';\n $b2 = isset($form_state['input'][$sectionname.'_iv_customtx']) && $form_state['input'][$sectionname.'_iv_customtx'] > '';\n $foundvalues = $b1 || $b2;\n }\n \n //die('LOOK>>>>'.$sectionname.'='.$foundvalues.'>>>'.print_r($form_state['input'],TRUE));\n \n return $foundvalues;\n }", "function kirki_twentytwelve_alter_color( $color ) {\n return Kirki_Color::adjust_brightness( $color, -50 );\n}", "function give_draw_chart_image() {\n\trequire_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';\n\trequire_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';\n\trequire_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';\n\n\t$chart = new GoogleChart( 'lc', 900, 330 );\n\n\t$i = 1;\n\t$earnings = \"\";\n\t$sales = \"\";\n\n\twhile ( $i <= 12 ) :\n\t\t$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . \",\";\n\t\t$sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . \",\";\n\t\t$i ++;\n\tendwhile;\n\n\t$earnings_array = explode( \",\", $earnings );\n\t$sales_array = explode( \",\", $sales );\n\n\t$i = 0;\n\twhile ( $i <= 11 ) {\n\t\tif ( empty( $sales_array[ $i ] ) ) {\n\t\t\t$sales_array[ $i ] = 0;\n\t\t}\n\t\t$i ++;\n\t}\n\n\t$min_earnings = 0;\n\t$max_earnings = max( $earnings_array );\n\t$earnings_scale = round( $max_earnings, - 1 );\n\n\t$data = new GoogleChartData( array(\n\t\t$earnings_array[0],\n\t\t$earnings_array[1],\n\t\t$earnings_array[2],\n\t\t$earnings_array[3],\n\t\t$earnings_array[4],\n\t\t$earnings_array[5],\n\t\t$earnings_array[6],\n\t\t$earnings_array[7],\n\t\t$earnings_array[8],\n\t\t$earnings_array[9],\n\t\t$earnings_array[10],\n\t\t$earnings_array[11],\n\t) );\n\n\t$data->setLegend( __( 'Income', 'give' ) );\n\t$data->setColor( '1b58a3' );\n\t$chart->addData( $data );\n\n\t$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );\n\t$shape_marker->setColor( '000000' );\n\t$shape_marker->setSize( 7 );\n\t$shape_marker->setBorder( 2 );\n\t$shape_marker->setData( $data );\n\t$chart->addMarker( $shape_marker );\n\n\t$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );\n\t$value_marker->setColor( '000000' );\n\t$value_marker->setData( $data );\n\t$chart->addMarker( $value_marker );\n\n\t$data = new GoogleChartData( array(\n\t\t$sales_array[0],\n\t\t$sales_array[1],\n\t\t$sales_array[2],\n\t\t$sales_array[3],\n\t\t$sales_array[4],\n\t\t$sales_array[5],\n\t\t$sales_array[6],\n\t\t$sales_array[7],\n\t\t$sales_array[8],\n\t\t$sales_array[9],\n\t\t$sales_array[10],\n\t\t$sales_array[11],\n\t) );\n\t$data->setLegend( __( 'Donations', 'give' ) );\n\t$data->setColor( 'ff6c1c' );\n\t$chart->addData( $data );\n\n\t$chart->setTitle( __( 'Donations by Month for all GiveWP Forms', 'give' ), '336699', 18 );\n\n\t$chart->setScale( 0, $max_earnings );\n\n\t$y_axis = new GoogleChartAxis( 'y' );\n\t$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );\n\t$chart->addAxis( $y_axis );\n\n\t$x_axis = new GoogleChartAxis( 'x' );\n\t$x_axis->setTickMarks( 5 );\n\t$x_axis->setLabels( array(\n\t\t__( 'Jan', 'give' ),\n\t\t__( 'Feb', 'give' ),\n\t\t__( 'Mar', 'give' ),\n\t\t__( 'Apr', 'give' ),\n\t\t__( 'May', 'give' ),\n\t\t__( 'June', 'give' ),\n\t\t__( 'July', 'give' ),\n\t\t__( 'Aug', 'give' ),\n\t\t__( 'Sept', 'give' ),\n\t\t__( 'Oct', 'give' ),\n\t\t__( 'Nov', 'give' ),\n\t\t__( 'Dec', 'give' ),\n\t) );\n\t$chart->addAxis( $x_axis );\n\n\t$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );\n\t$shape_marker->setSize( 6 );\n\t$shape_marker->setBorder( 2 );\n\t$shape_marker->setData( $data );\n\t$chart->addMarker( $shape_marker );\n\n\t$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );\n\t$value_marker->setData( $data );\n\t$chart->addMarker( $value_marker );\n\n\treturn $chart->getUrl();\n}", "function readable_colour( $colour ) {\n\n\t$theme = 'theme-light';\n\n\t$colour = str_replace( '#', '', $colour );\n\n\t$r = hexdec( substr( $colour, 0, 2 ) );\n\t$g = hexdec( substr( $colour, 2, 2 ) );\n\t$b = hexdec( substr( $colour, 4, 2 ) );\n\n\t$contrast = sqrt(\n\t\t$r * $r * .241 +\n\t\t$g * $g * .691 +\n\t\t$b * $b * .068\n\t);\n\n\t//if ( $contrast <= 130 ) {\n\tif ( $contrast <= 150 ) {\n\t\t$theme = 'theme-dark';\n\t}\n\n\treturn $theme;\n\n}", "public function getContrastColorAttribute() : array\n {\n $contrastColor = $this->getLogoColorAsAnRgbArray();\n\n $contrastColor[0] -= 128;\n $contrastColor[1] -= 128;\n $contrastColor[2] -= 128;\n\n $countSmaller = 0;\n if ($contrastColor[0]<0) $countSmaller++;\n if ($contrastColor[1]<0) $countSmaller++;\n if ($contrastColor[2]<0) $countSmaller++;\n\n if ($countSmaller == 2) {\n if ($contrastColor[0]>0) $contrastColor[0] = 255;\n if ($contrastColor[1]>0) $contrastColor[1] = 255;\n if ($contrastColor[2]>0) $contrastColor[2] = 255;\n } elseif ($countSmaller == 1) {\n if ($contrastColor[0]<0) $contrastColor[0] = 0;\n if ($contrastColor[1]<0) $contrastColor[1] = 0;\n if ($contrastColor[2]<0) $contrastColor[2] = 0;\n }\n\n if ($countSmaller == 3 || $countSmaller == 2) {\n if ($contrastColor[0]<0) $contrastColor[0] = 255+$contrastColor[0];\n if ($contrastColor[1]<0) $contrastColor[1] = 255+$contrastColor[1];\n if ($contrastColor[2]<0) $contrastColor[2] = 255+$contrastColor[2];\n }\n\n $contrastColor[0] = round($contrastColor[0]);\n $contrastColor[1] = round($contrastColor[1]);\n $contrastColor[2] = round($contrastColor[2]);\n\n return $contrastColor;\n }", "public function brightnessContrastImage ($brightness, $contrast, $CHANNEL = Imagick::CHANNEL_DEFAULT) { }", "public function googleChartsFormatRuleProvider()\n {\n return array(\n array('annotation', true),\n array('annotationText', true),\n array('style', true),\n array('tooltip', true),\n array('domain', true),\n array('certainty', true),\n array('emphasis', true),\n array('scope', true),\n array('data', true),\n array('interval', true),\n array('fake', false),\n );\n }", "function get_color_text_class( $bg_color_class ) {\n\t\n\t$dark_colors = array('primary', 'secondary', 'accent', 'black');\n\t\n\tif ( in_array( $bg_color_class, $dark_colors ) ) {\n\t\t\n\t\treturn true;\n\t\t\n\t} else {\n\t\t\n\t\treturn false;\n\t\t\n\t}\n\t\n}", "public function contrastImage ($sharpen) {}", "function sc_highlight( $attr, $content = null )\n{\n\textract(shortcode_atts(array(\n\t\t'background' \t=> '',\n\t\t'color' \t\t=> '',\n\t), $attr));\n\t\n\t// style\n\t$style = '';\n\tif( $background ) $style .= 'background-color:'. $background .';';\n\tif( $color ) $style .= ' color:'. $color .';';\n\tif( $style ) $style = 'style=\"'. $style .'\"';\n\t\t\t\t\t\t\n\t$output = '<span class=\"highlight\" '. $style .'>';\n\t\t$output .= $content;\n\t$output .= '</span>'.\"\\n\";\n\n return $output;\n}", "function get_color_text_class( $bg_color_class ) {\n\t\n\t$dark_colors = array('primary', 'secondary', 'black');\n\t\n\tif ( in_array( $bg_color_class, $dark_colors ) ) {\n\t\t\n\t\treturn true;\n\t\t\n\t} else {\n\t\t\n\t\treturn false;\n\t\t\n\t}\n\t\n}", "function get_color_text_class( $bg_color_class ) {\n\t\n\t$dark_colors = array('primary', 'secondary', 'black');\n\t\n\tif ( in_array( $bg_color_class, $dark_colors ) ) {\n\t\t\n\t\treturn true;\n\t\t\n\t} else {\n\t\t\n\t\treturn false;\n\t\t\n\t}\n\t\n}", "function highlight_sc_func($atts, $content = '') {\n $defaultAtts= array(\n 'bgcolor' => 'cornflowerblue',\n 'textcolor' => 'whitesmoke'\n );\n \n extract( shortcode_atts( $defaultAtts, $atts ) );\n $currentShortCode = '<span class=\"tfb-sc-highlight\" style=\"background: ' . $atts['bgcolor'] . '; color: ' . $atts['textcolor'] . ';\">' . do_shortcode( $content ) . '</span>';\n \n return $currentShortCode;\n}", "public function setHighlight($flag) {}", "public function highlightText($text, $theme_style = NULL) // [EDIT] CRNRSTN v2.00.0000 FOR CRNRSTN_UI_PHPNIGHT :: J5\n {\n\n if ($theme_style == CRNRSTN_UI_PHP) {\n\n ini_set('highlight.comment', '#008000');\n ini_set('highlight.default', '#000');\n ini_set('highlight.html', '#808080');\n ini_set('highlight.keyword', '#00B; font-weight: bold');\n ini_set('highlight.string', '#D00');\n\n } else if ($theme_style == CRNRSTN_UI_HTML) {\n\n ini_set('highlight.comment', 'green');\n ini_set('highlight.default', '#C00');\n ini_set('highlight.html', '#000');\n ini_set('highlight.keyword', 'black; font-weight: bold');\n ini_set('highlight.string', '#00F');\n\n } else if ($theme_style == CRNRSTN_UI_PHPNIGHT) // [EDIT] CRNRSTN :: v2.00.0000 :: J5 :: April 13, 2021 2004hrs\n {\n ini_set('highlight.comment', '#FC0');\n ini_set('highlight.default', '#DEDECB');\n ini_set('highlight.html', '#808080');\n ini_set('highlight.keyword', '#8FE28F; font-weight: normal');\n ini_set('highlight.string', '#F66');\n\n }\n\n $text = trim($text);\n $text = highlight_string(\"<?php \" . $text, true); // highlight_string() requires opening PHP tag or otherwise it will not colorize the text\n $text = trim($text);\n $text = preg_replace(\"|^\\\\<code\\\\>\\\\<span style\\\\=\\\"color\\\\: #[a-fA-F0-9]{0,6}\\\"\\\\>|\", \"\", $text, 1); // remove prefix\n $text = preg_replace(\"|\\\\</code\\\\>\\$|\", \"\", $text, 1); // remove suffix 1\n $text = trim($text); // remove line breaks\n $text = preg_replace(\"|\\\\</span\\\\>\\$|\", \"\", $text, 1); // remove suffix 2\n $text = trim($text); // remove line breaks\n $text = preg_replace(\"|^(\\\\<span style\\\\=\\\"color\\\\: #[a-fA-F0-9]{0,6}\\\"\\\\>)(&lt;\\\\?php&nbsp;)(.*?)(\\\\</span\\\\>)|\", \"\\$1\\$3\\$4\", $text); // remove custom added \"<?php \"\n\n return $text;\n }", "public function setForeground(?string $color);", "function mpcth_highlight_shortcode($atts, $content = null) {\r\n\textract(shortcode_atts(array(\r\n\t\t'background' => '',\r\n\t\t'color' => ''\r\n\t), $atts));\r\n\t\r\n\t$return = '<span class=\"mpcth-sc-highlight\" style=\"background: ' . $background . '; color: ' . $color . ';\">' . $content . '</span>';\r\n\r\n\t$return = parse_shortcode_content($return);\r\n\treturn $return;\r\n}", "protected function isDark(){\n return ($this->row%2==0 && $this->col%2==0 );\n}", "function learndash_30_custom_colors() {\n\n\t/**\n\t * Filters default custom colors used in settings to set accent color, progress color, and notifications settings.\n\t *\n\t * @param array $custom_colors An Associative array of color name and values in hex code.\n\t */\n\t$colors = apply_filters(\n\t\t'learndash_30_custom_colors',\n\t\tarray(\n\t\t\t'primary' => LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'color_primary' ),\n\t\t\t'secondary' => LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'color_secondary' ),\n\t\t\t'tertiary' => LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'color_tertiary' ),\n\t\t)\n\t);\n\n\t/**\n\t * Filters responsive videos setting value. Override the value of responsive video set in settings.\n\t *\n\t * @param string|int $resonsive_video_setting Value is yes if enabled and empty string if disabled. Default is set to 0.\n\t */\n\t$responsive_video = apply_filters( 'learndash_30_responsive_video', LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'responsive_video_enabled' ) );\n\n\t/**\n\t * Filters focus mode width setting value. Override the focus mode width set in settings.\n\t *\n\t * @param string $focus_width_setting Focus mode width. Default value is default.\n\t */\n\t$focus_width = apply_filters( 'learndash_30_focus_mode_width', LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Theme_LD30', 'focus_mode_content_width' ) );\n\n\tob_start();\n\tif ( ( isset( $colors['primary'] ) ) && ( ! empty( $colors['primary'] ) ) && ( LD_30_COLOR_PRIMARY != $colors['primary'] ) ) {\n\n\t\t// Convert HEX to RGB for for use with rgba()\n\t\t$primaryBuildRgb = list($r, $g, $b) = sscanf( $colors['primary'], '#%02x%02x%02x' );\n\t\t$primaryRgb = \"$r, $g, $b\";\n\n\t\t?>\n\t\t.learndash-wrapper .ld-item-list .ld-item-list-item.ld-is-next,\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_questionListItem label:focus-within {\n\t\t\tborder-color: <?php echo esc_attr( $colors['primary'] ); ?>;\n\t\t}\n\n\t\t/*\n\t\t.learndash-wrapper a:not(.ld-button):not(#quiz_continue_link):not(.ld-focus-menu-link):not(.btn-blue):not(#quiz_continue_link):not(.ld-js-register-account):not(#ld-focus-mode-course-heading):not(#btn-join):not(.ld-item-name):not(.ld-table-list-item-preview):not(.ld-lesson-item-preview-heading),\n\t\t */\n\n\t\t.learndash-wrapper .ld-breadcrumbs a,\n\t\t.learndash-wrapper .ld-lesson-item.ld-is-current-lesson .ld-lesson-item-preview-heading,\n\t\t.learndash-wrapper .ld-lesson-item.ld-is-current-lesson .ld-lesson-title,\n\t\t.learndash-wrapper .ld-primary-color-hover:hover,\n\t\t.learndash-wrapper .ld-primary-color,\n\t\t.learndash-wrapper .ld-primary-color-hover:hover,\n\t\t.learndash-wrapper .ld-primary-color,\n\t\t.learndash-wrapper .ld-tabs .ld-tabs-navigation .ld-tab.ld-active,\n\t\t.learndash-wrapper .ld-button.ld-button-transparent,\n\t\t.learndash-wrapper .ld-button.ld-button-reverse,\n\t\t.learndash-wrapper .ld-icon-certificate,\n\t\t.learndash-wrapper .ld-login-modal .ld-login-modal-login .ld-modal-heading,\n\t\t#wpProQuiz_user_content a,\n\t\t.learndash-wrapper .ld-item-list .ld-item-list-item a.ld-item-name:hover,\n\t\t.learndash-wrapper .ld-focus-comments__heading-actions .ld-expand-button,\n\t\t.learndash-wrapper .ld-focus-comments__heading a,\n\t\t.learndash-wrapper .ld-focus-comments .comment-respond a,\n\t\t.learndash-wrapper .ld-focus-comment .ld-comment-reply a.comment-reply-link:hover,\n\t\t.learndash-wrapper .ld-expand-button.ld-button-alternate {\n\t\t\tcolor: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-focus-comment.bypostauthor>.ld-comment-wrapper,\n\t\t.learndash-wrapper .ld-focus-comment.role-group_leader>.ld-comment-wrapper,\n\t\t.learndash-wrapper .ld-focus-comment.role-administrator>.ld-comment-wrapper {\n\t\t\tbackground-color:rgba(<?php echo esc_attr( $primaryRgb ); ?>, 0.03) !important;\n\t\t}\n\n\n\t\t.learndash-wrapper .ld-primary-background,\n\t\t.learndash-wrapper .ld-tabs .ld-tabs-navigation .ld-tab.ld-active:after {\n\t\t\tbackground: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\n\n\t\t.learndash-wrapper .ld-course-navigation .ld-lesson-item.ld-is-current-lesson .ld-status-incomplete,\n\t\t.learndash-wrapper .ld-focus-comment.bypostauthor:not(.ptype-sfwd-assignment) >.ld-comment-wrapper>.ld-comment-avatar img,\n\t\t.learndash-wrapper .ld-focus-comment.role-group_leader>.ld-comment-wrapper>.ld-comment-avatar img,\n\t\t.learndash-wrapper .ld-focus-comment.role-administrator>.ld-comment-wrapper>.ld-comment-avatar img {\n\t\t\tborder-color: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\n\n\t\t.learndash-wrapper .ld-loading::before {\n\t\t\tborder-top:3px solid <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-button:hover:not(.learndash-link-previous-incomplete):not(.ld-button-transparent),\n\t\t#learndash-tooltips .ld-tooltip:after,\n\t\t#learndash-tooltips .ld-tooltip,\n\t\t.learndash-wrapper .ld-primary-background,\n\t\t.learndash-wrapper .btn-join,\n\t\t.learndash-wrapper #btn-join,\n\t\t.learndash-wrapper .ld-button:not(.ld-button-reverse):not(.learndash-link-previous-incomplete):not(.ld-button-transparent),\n\t\t.learndash-wrapper .ld-expand-button,\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_button:not(.wpProQuiz_button_reShowQuestion):not(.wpProQuiz_button_restartQuiz),\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_button2,\n\t\t.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-course-navigation-heading,\n\t\t.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-focus-sidebar-trigger,\n\t\t.learndash-wrapper .ld-focus-comments .form-submit #submit,\n\t\t.learndash-wrapper .ld-login-modal input[type='submit'],\n\t\t.learndash-wrapper .ld-login-modal .ld-login-modal-register,\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_certificate a.btn-blue,\n\t\t.learndash-wrapper .ld-focus .ld-focus-header .ld-user-menu .ld-user-menu-items a,\n\t\t#wpProQuiz_user_content table.wp-list-table thead th,\n\t\t#wpProQuiz_overlay_close,\n\t\t.learndash-wrapper .ld-expand-button.ld-button-alternate .ld-icon {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-focus .ld-focus-header .ld-user-menu .ld-user-menu-items:before {\n\t\t\tborder-bottom-color: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-button.ld-button-transparent:hover {\n\t\t\tbackground: transparent !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-focus .ld-focus-header .sfwd-mark-complete .learndash_mark_complete_button,\n\t\t.learndash-wrapper .ld-focus .ld-focus-header #sfwd-mark-complete #learndash_mark_complete_button,\n\t\t.learndash-wrapper .ld-button.ld-button-transparent,\n\t\t.learndash-wrapper .ld-button.ld-button-alternate,\n\t\t.learndash-wrapper .ld-expand-button.ld-button-alternate {\n\t\t\tbackground-color:transparent !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-focus-header .ld-user-menu .ld-user-menu-items a,\n\t\t.learndash-wrapper .ld-button.ld-button-reverse:hover,\n\t\t.learndash-wrapper .ld-alert-success .ld-alert-icon.ld-icon-certificate,\n\t\t.learndash-wrapper .ld-alert-warning .ld-button:not(.learndash-link-previous-incomplete),\n\t\t.learndash-wrapper .ld-primary-background.ld-status {\n\t\t\tcolor:white !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-status.ld-status-unlocked {\n\t\t\tbackground-color: <?php echo esc_attr( learndash_hex2rgb( $colors['primary'], '0.2' ) ); ?> !important;\n\t\t\tcolor: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_addToplist {\n\t\t\tbackground-color: <?php echo esc_attr( learndash_hex2rgb( $colors['primary'], '0.1' ) ); ?> !important;\n\t\t\tborder: 1px solid <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_toplistTable th {\n\t\t\tbackground: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_toplistTrOdd {\n\t\t\tbackground-color: <?php echo esc_attr( learndash_hex2rgb( $colors['primary'], '0.1' ) ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewDiv li.wpProQuiz_reviewQuestionTarget {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_time_limit .wpProQuiz_progress {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['primary'] ); ?> !important;\n\t\t}\n\t\t<?php\n\t}\n\n\tif ( ( isset( $colors['secondary'] ) ) && ( ! empty( $colors['secondary'] ) ) && ( LD_30_COLOR_SECONDARY != $colors['secondary'] ) ) {\n\t\t?>\n\n\t\t.learndash-wrapper #quiz_continue_link,\n\t\t.learndash-wrapper .ld-secondary-background,\n\t\t.learndash-wrapper .learndash_mark_complete_button,\n\t\t.learndash-wrapper #learndash_mark_complete_button,\n\t\t.learndash-wrapper .ld-status-complete,\n\t\t.learndash-wrapper .ld-alert-success .ld-button,\n\t\t.learndash-wrapper .ld-alert-success .ld-alert-icon {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content a#quiz_continue_link {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .course_progress .sending_progress_bar {\n\t\t\tbackground: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_button_reShowQuestion:hover, .learndash-wrapper .wpProQuiz_content .wpProQuiz_button_restartQuiz:hover {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t\topacity: 0.75;\n\t\t}\n\n\t\t.learndash-wrapper .ld-secondary-color-hover:hover,\n\t\t.learndash-wrapper .ld-secondary-color,\n\t\t.learndash-wrapper .ld-focus .ld-focus-header .sfwd-mark-complete .learndash_mark_complete_button,\n\t\t.learndash-wrapper .ld-focus .ld-focus-header #sfwd-mark-complete #learndash_mark_complete_button,\n\t\t.learndash-wrapper .ld-focus .ld-focus-header .sfwd-mark-complete:after {\n\t\t\tcolor: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-secondary-in-progress-icon {\n\t\t\tborder-left-color: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t\tborder-top-color: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-alert-success {\n\t\t\tborder-color: <?php echo esc_attr( $colors['secondary'] ); ?>;\n\t\t\tbackground-color: transparent !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewQuestion li.wpProQuiz_reviewQuestionSolved,\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_box li.wpProQuiz_reviewQuestionSolved {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewLegend span.wpProQuiz_reviewColor_Answer {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['secondary'] ); ?> !important;\n\t\t}\n\n\t\t<?php\n\t}\n\n\tif ( ( isset( $colors['tertiary'] ) ) && ( ! empty( $colors['tertiary'] ) ) && ( LD_30_COLOR_TERTIARY != $colors['tertiary'] ) ) {\n\t\t?>\n\n\t\t.learndash-wrapper .ld-alert-warning {\n\t\t\tbackground-color:transparent;\n\t\t}\n\n\t\t.learndash-wrapper .ld-status-waiting,\n\t\t.learndash-wrapper .ld-alert-warning .ld-alert-icon {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['tertiary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-tertiary-color-hover:hover,\n\t\t.learndash-wrapper .ld-tertiary-color,\n\t\t.learndash-wrapper .ld-alert-warning {\n\t\t\tcolor: <?php echo esc_attr( $colors['tertiary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-tertiary-background {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['tertiary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-alert-warning {\n\t\t\tborder-color: <?php echo esc_attr( $colors['tertiary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .ld-tertiary-background,\n\t\t.learndash-wrapper .ld-alert-warning .ld-alert-icon {\n\t\t\tcolor:white !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewQuestion li.wpProQuiz_reviewQuestionReview,\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_box li.wpProQuiz_reviewQuestionReview {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['tertiary'] ); ?> !important;\n\t\t}\n\n\t\t.learndash-wrapper .wpProQuiz_content .wpProQuiz_reviewLegend span.wpProQuiz_reviewColor_Review {\n\t\t\tbackground-color: <?php echo esc_attr( $colors['tertiary'] ); ?> !important;\n\t\t}\n\n\t\t<?php\n\t}\n\n\tif ( isset( $focus_width ) && ! empty( $focus_width ) && 'default' !== $focus_width ) {\n\t\t?>\n\t\t.learndash-wrapper .ld-focus .ld-focus-main .ld-focus-content {\n\t\t\tmax-width: <?php echo esc_attr( $focus_width ); ?>;\n\t\t}\n\t\t<?php\n\t}\n\n\t$custom_css = ob_get_clean();\n\n\tif ( ! empty( $custom_css ) ) {\n\t\twp_add_inline_style( 'learndash-front', $custom_css );\n\t}\n\n}", "function inferContrastFromPhrase($phrase)\n {\n $haystack = strtoupper($phrase);\n\n //Look for indication of both\n $both_contrast_ind = FALSE; //Assume not both\n $both_contrast_ind[] = 'W&WO CONT';\n $both_contrast_ind[] = 'WITH AND WITHOUT CONT';\n foreach($both_contrast_ind as $needle)\n {\n $p = strpos($haystack, $needle);\n if($p !== FALSE)\n {\n $both_contrast_ind = TRUE;\n break;\n }\n }\n if(!$both_contrast_ind)\n {\n //Look for the NO indicators\n $no_contrast = NULL;\n $no_contrast_ind = array();\n $no_contrast_ind[] = 'W/O CONT';\n $no_contrast_ind[] = 'W/N CONT';\n $no_contrast_ind[] = 'WO CONT';\n $no_contrast_ind[] = 'WN CONT';\n $no_contrast_ind[] = 'NO CONT';\n $no_contrast_ind[] = 'WITHOUT CONT';\n foreach($no_contrast_ind as $needle)\n {\n $p = strpos($haystack, $needle);\n if($p !== FALSE)\n {\n $no_contrast = TRUE;\n break;\n }\n }\n\n //Look for the YES indicators\n $yes_contrast = NULL;\n $yes_contrast_ind = array();\n $yes_contrast_ind[] = 'W CONT';\n $yes_contrast_ind[] = 'WITH CONT';\n $yes_contrast_ind[] = 'W/IV CONT';\n $yes_contrast_ind[] = 'INCLUDE CONT';\n $yes_contrast_ind[] = 'INC CONT';\n foreach($yes_contrast_ind as $needle)\n {\n $p = strpos($haystack, $needle);\n if($p !== FALSE)\n {\n $yes_contrast = TRUE;\n break;\n }\n }\n\n //Return our analysis result.\n if($no_contrast && $yes_contrast === NULL)\n {\n return FALSE;\n }\n if($no_contrast === NULL && $yes_contrast)\n {\n return TRUE;\n }\n }\n \n //No clues or confusing indications.\n return NULL;\n }", "private function augment_settings_results_appearance() {\n\n\t\t$related_to = 'show_icon_array';\n\t\t$new_options[ 'show_icon_array' ] = array( 'related_to' => $related_to , 'type' => 'checkbox' );\n\n\t\t$this->attach_to_slp( $new_options , array( 'page'=> 'slp_experience','section' => 'results', 'group' => 'appearance' ) );\n\t}", "function ts_check_dark_color($hex){\r\n\t$hex = str_replace('#', '', $hex);\r\n\t//break up the color in its RGB components\r\n\t$r = hexdec(substr($hex,0,2));\r\n\t$g = hexdec(substr($hex,2,2));\r\n\t$b = hexdec(substr($hex,4,2));\r\n\t//do simple weighted avarage\r\n\t//\r\n\t//(This might be overly simplistic as different colors are perceived\r\n\t// differently. That is a green of 128 might be brighter than a red of 128.\r\n\t// But as long as it's just about picking a white or black text color...)\r\n\tif($r + $g + $b > 382){\r\n\t\treturn false;\r\n\t\t//bright color, use dark font\r\n\t}else{\r\n\t\treturn true;\r\n\t\t//dark color, use bright font\r\n\t}\r\n}", "function anthology_pro_customizer_get_default_accent_color() {\r\n\treturn apply_filters( 'filter_anthology_pro_customizer_get_default_accent_color', '#8E793E' );\r\n}" ]
[ "0.55266386", "0.54804254", "0.53081703", "0.47759816", "0.4607518", "0.4575657", "0.45051128", "0.4472291", "0.44280258", "0.44079039", "0.43162856", "0.4307382", "0.42992735", "0.42398408", "0.42240596", "0.42209268", "0.42179888", "0.41722426", "0.41722426", "0.41598794", "0.41518807", "0.41405642", "0.4128887", "0.41251218", "0.4116567", "0.4100515", "0.40936682", "0.40883625", "0.40546525", "0.4040262" ]
0.6004892
0
beforeFind callback inject where condition if context is 'tenant'
public function beforeFind( Event $event, Query $query ) { if ( MTApp::getContext() == 'tenant' ) { $query->where( [ $this->_table->alias().'.'.$this->config('foreign_key_field') . ' IN'=> [ $this->config('global_value'), MTApp::tenant()->id ] ] ); } return $query; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function onKernelRequest() {\n $tenant = $this->getTenant();\n if ($tenant) { \n $filter = $this->em->getFilters()->enable('tenant_filter');\n $filter->setParameter('supplier_id', $tenant->getId());\n $filter->setAnnotationReader($this->reader);\n }\n }", "function beforeFind(&$model, $query) { \n\t\treturn true;\n\t}", "public function hasTenant();", "protected static function bootBelongsToTenant()\n {\n static::addGlobalScope(new TenantScope);\n\n static::creating(function ($model) {\n if (session()->has('tenant_id')) {\n $model->tenant_id = session()->get('tenant_id');\n }\n });\n }", "public function beforeRequest()\n\t{\t\t\n\t\t$rootTenant = BaseHelper::getTenantById($this->rootTenant);\t\t\n\t\tif ($rootTenant) {\t\t\t\n\t\t\t\\Yii::$app->tenant->isBackend = true;\n\t\t\t\\Yii::$app->tenant->current = \\Yii::$app->tenant->root = $rootTenant;\n\t\t\t// Start setting the locale component\n\t\t\t// We set default Timezone based on the application config\n\t\t\t// You can change this based on what you want\n\t\t\t\\Yii::$app->locale->defaultTimezone = \\Yii::$app->timeZone;\n\n\t\t\t// You can change local Timezone based on user session\n\t\t\t// application setting, or whatever you want\n\t\t\t\\Yii::$app->locale->localTimezone = \\Yii::$app->locale->defaultTimezone;\n\n\t\t} else {\n\t\t\tthrow new InvalidConfigException(Yii::t('base', 'No Root Tenant Found'));\n\t\t}\t\t\t\t\t\n\t\treturn;\n\t}", "public function beforeFind($event)\n {\n $criteria = $this->getOwner()->getDbCriteria();\n $criteria->addCondition('dateDelete IS NULL');\n }", "protected function onTenantLoad() {\n /**\n * Override with route adding, etc\n */\n return;\n }", "public function userFind($event)\n {\n }", "function beforeFind(&$Model, $query) {\n if ($Model->hasField('is_deactivated')) {\n if (!isset($query['deactivated']) || !$query['deactivated']) {\n $query['conditions'][$Model->alias . '.is_deactivated'] = false;\n }\n }\n return $query;\n }", "public function testCustomFinder()\n {\n $this->_eventManager->on(\n 'Controller.initialize',\n ['priority' => 11],\n function ($event) {\n $this->_controller->Crud->action('edit')\n ->findMethod(['withCustomOptions' => ['foo' => 'bar']]);\n }\n );\n\n $this->get('/blogs/edit/1');\n $this->assertSame(['foo' => 'bar'], $this->_controller->Blogs->customOptions);\n }", "public function __construct(){\n $this->middleware('auth');\n $this->beforeFilter('@find');\n }", "public function getTenant();", "public function beforeFilter() {\n parent::beforeFilter();\n $this->Auth->allow('auto_report_generate','onetime_report_generate','getsalon','getsalonname','getBalancesByOptionalStatus','admin_vendor_payments');\n }", "public function beforeFilter() {\n\t\t$authGroups = [\n\t\t\tUSER_ROLE_USER => 'default'\n\t\t];\n\t\t$authGroupsList = $this->Setting->getAuthGroupsList();\n\t\t$authPrefixes = $this->Setting->getAuthPrefixesList();\n\t\tforeach ($authGroupsList as $userRole => $fieldName) {\n\t\t\t$userGroup = $this->Setting->getConfig($fieldName);\n\t\t\tif (!empty($userGroup)) {\n\t\t\t\t$authGroups[$userRole] = $userGroup;\n\t\t\t}\n\t\t}\n\n\t\t$isExternalAuth = $this->_isExternalAuth();\n\t\t$this->Auth->authenticate = [\n\t\t\t'CakeLdap.Ldap' => [\n\t\t\t\t'externalAuth' => $isExternalAuth,\n\t\t\t\t'groups' => $authGroups,\n\t\t\t\t'prefixes' => $authPrefixes,\n\t\t\t\t'includeFields' => CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID,\n\t\t\t\t'bindFields' => [\n\t\t\t\t\tCAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID => 'Employee.' . CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID\n\t\t\t\t]\n\t\t\t]\n\t\t];\n\t\t$this->Auth->authorize = ['Controller'];\n\t\t$this->Auth->flash = [\n\t\t\t'element' => 'warning',\n\t\t\t'key' => 'auth',\n\t\t\t'params' => []\n\t\t];\n\t\t$this->Auth->loginAction = '/users/login';\n\n\t\t$plugin = (string)$this->request->param('plugin');\n\t\t$controller = (string)$this->request->param('controller');\n\t\t$action = (string)$this->request->param('action');\n\t\tif (($plugin === 'cake_search_info') ||\n\t\t\t(empty($plugin) && ($controller === 'employees') &&\n\t\t\t(mb_strpos($action, 'search') !== false))) {\n\t\t\t$this->loadModel('Employee');\n\t\t\t$userRole = $this->UserInfo->getUserField('role');\n\t\t\t$targetModels = $this->Employee->getSearchTargetModels($userRole);\n\t\t\t$includeFields = $this->Employee->getSearchIncludeFields($userRole);\n\t\t\tConfigure::write('CakeSearchInfo.TargetModels', $targetModels);\n\t\t\tConfigure::write('CakeSearchInfo.IncludeFields', $includeFields);\n\t\t} elseif (($plugin === 'cake_theme') && ($controller === 'tours')) {\n\t\t\t$this->loadModel('Tour');\n\t\t\t$userInfo = $this->Auth->user();\n\t\t\t$tourSteps = $this->Tour->getListSteps($userInfo);\n\t\t\tConfigure::write('CakeTheme.TourApp.Steps', $tourSteps);\n\t\t}\n\t\tif (!$this->ViewExtension->isHtml()) {\n\t\t\treturn parent::beforeFilter();\n\t\t}\n\n\t\t$emailContact = $this->Setting->getConfig('EmailContact');\n\t\t$emailSubject = $this->Setting->getConfig('EmailSubject');\n\t\t$showSearchForm = true;\n\n\t\t$this->loadModel('Deferred');\n\t\t$countDeferredSaves = $this->Deferred->getNumberOf();\n\t\t$useNavbarContainerFluid = false;\n\n\t\t$searchUrlActionSearch = ['controller' => 'employees', 'action' => 'search'];\n\t\t$userPrefix = $this->UserInfo->getUserField('prefix');\n\t\tif (!empty($userPrefix)) {\n\t\t\t$searchUrlActionSearch[$userPrefix] = true;\n\t\t}\n\t\t$showSearchForm = false;\n\t\t$projectName = __d('project', PROJECT_NAME);\n\t\t$projectVersion = PROJECT_VERSION;\n\t\t$projectAuthor = PROJECT_AUTHOR;\n\n\t\t$this->set(compact(\n\t\t\t'isExternalAuth',\n\t\t\t'emailContact',\n\t\t\t'emailSubject',\n\t\t\t'showSearchForm',\n\t\t\t'countDeferredSaves',\n\t\t\t'useNavbarContainerFluid',\n\t\t\t'showSearchForm',\n\t\t\t'projectName',\n\t\t\t'projectVersion',\n\t\t\t'projectAuthor'\n\t\t));\n\t\t$this->set('search_urlActionSearch', $searchUrlActionSearch);\n\t\tparent::beforeFilter();\n\t}", "public function before($user){\n\n if ($user->hasRole('Admin'))\n {\n\n return true;\n }\n\n }", "public function beforeDelete( Event $event, Entity $entity, $options ) {\r\n\r\n\t\tif ( MTApp::getContext() == 'tenant' ) {\r\n\r\n\t\t\t$field = $this->config('foreign_key_field');\r\n\r\n\t\t\t//tenant cannot delete global records if he is not the onwer of the global tenant\r\n\t\t\tif ( $entity->{$field} == $this->config('global_value') &&\r\n\t\t\t\tMTapp::tenant()->id != $this->config('global_value')) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t//paranoid check of ownership\r\n\t\t\tif ( $entity->{$field} != MTApp::tenant()->id ) { //current tenant is NOT owner\r\n\t\t\t\tthrow new DataScopeViolationException('Tenant->id:' . MTApp::tenant()->id . ' does not own '.$this->_table->alias().'->id:' . $entity->id );\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "public function afterFind()\n {\n parent::afterFind();\n $this->roles = $this->getRoles();\n }", "public function __construct(){\n $this->beforeFilter(function(){\n\n $user = Session::get('user'); \n $project = Session::get('project'); \n\n\n if($project!=NULL){\n $userRole = (array) User::getUserRoleOnProject($project['id'], $user['id']);\n if(!($userRole['user_id']==$user['id'])){\n return Redirect::to(URL::action('LoginController@index'));\n }\n } \n\n if(is_null(Session::get('user'))){\n return Redirect::to(URL::action('LoginController@index'));\n }\n\n });\n }", "public function setupCriteria()\n {\n }", "public function beforeFilter() {\n }", "private function getCurrentTenant(EntityPrePersistEvent $event, $entityId, $checkField, $checkValue)\n {\n $queryBuilder = $event\n ->getRepository()\n ->createQueryBuilder()\n ->field('id')->equals($entityId)\n ->select([$checkField])\n ->limit(1)\n ->hydrate(false);\n\n $result = $queryBuilder->getQuery()->getSingleResult();\n\n // record doesn't exist -> return $checkValue to persist\n if ($result === null) {\n return $checkValue;\n }\n\n // field doesn't exist -> assume global admin record!\n if (!isset($result[$checkField])) {\n return null;\n }\n\n return $result[$checkField];\n }", "protected function _postFind()\n {\n return true;\n }", "protected function _postFind()\n {\n return true;\n }", "public function beforeFind( $model, $query ) {\n # TODO: Can we do something to get the right stuff in one call\n # and avoid the work we're currently doing in afterFind?\n \n return true;\n }", "public function beforeCreate()\n {\n }", "public function beforeSave( Event $event, Entity $entity, $options ) {\r\n\r\n\t\tif ( MTApp::getContext() == 'tenant' ) { //save new operation\r\n\r\n\t\t\t$field = $this->config('foreign_key_field');\r\n\r\n\t\t\t//insert operation\r\n\t\t\tif ( $entity->isNew() ) {\r\n\r\n\t\t\t\t//blind overwrite, preventing user from providing explicit value\r\n\t\t\t\t$entity->{$field} = MTApp::tenant()->id;\r\n\r\n\t\t\t} else { //update operation\r\n\r\n\t\t\t\t//prevent tenant from updating global records if he is not the owner of the global tenant\r\n\t\t\t\tif ( $entity->{$field} == $this->config('global_value') &&\r\n\t\t\t\t\tMTapp::tenant()->id != $this->config('global_value')) {\r\n\t\t\t\t\tthrow new DataScopeViolationException( 'Tenant cannot update global records' );\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//paranoid check of ownership\r\n\t\t\t\tif ( $entity->{$field} != MTApp::tenant()->id ) { //current tenant is NOT owner\r\n\t\t\t\t\tthrow new DataScopeViolationException('Tenant->id:' . MTApp::tenant()->id . ' does not own '.$this->_table->alias().'->id:' . $entity->id );\r\n\t\t\t\t}\r\n\r\n\t\t\t} // end if\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "public function getTenantId();", "public function find(IsChargable $customer);", "function beforeFilter() {\n parent::beforeFilter();\n\n // Get a pointer to our model name\n $req = $this->modelClass;\n $model = $this->$req;\n\n // Dynamically adjust validation rules to include the current CO ID for dynamic types.\n // This is a common case for provisioner configuration, but this could plausibly go\n // in StandardController.\n\n foreach($model->validate as $attr => $acfg) {\n if(isset($acfg['content']['rule'][0])\n && $acfg['content']['rule'][0] == 'validateExtendedType') {\n // Inject the current CO so validateExtendedType() works correctly\n\n $vrule = $acfg['content']['rule'];\n $vrule[1]['coid'] = $this->cur_co['Co']['id'];\n\n $model->validator()->getField($attr)->getRule('content')->rule = $vrule;\n }\n }\n }", "public function scopeHasCart($query, $userId)\n{\n return $query->where('user_id', $userId)->exists();\n}" ]
[ "0.6532401", "0.5328123", "0.5255369", "0.50216055", "0.5018164", "0.49177405", "0.4883531", "0.48489934", "0.482555", "0.4823347", "0.4795121", "0.47763735", "0.476617", "0.4754367", "0.47316802", "0.47293225", "0.47133452", "0.4662112", "0.46532616", "0.46393836", "0.4625922", "0.4621184", "0.4621184", "0.46011734", "0.45963278", "0.45565182", "0.4545882", "0.4514657", "0.45106047", "0.45091256" ]
0.62626165
1
beforeSave callback Allow insert of tenant records if in tenant context Allow insert of tenant records if in tenant context Prevent update of records that are global Prevent update if the record belongs to another tenant
public function beforeSave( Event $event, Entity $entity, $options ) { if ( MTApp::getContext() == 'tenant' ) { //save new operation $field = $this->config('foreign_key_field'); //insert operation if ( $entity->isNew() ) { //blind overwrite, preventing user from providing explicit value $entity->{$field} = MTApp::tenant()->id; } else { //update operation //prevent tenant from updating global records if he is not the owner of the global tenant if ( $entity->{$field} == $this->config('global_value') && MTapp::tenant()->id != $this->config('global_value')) { throw new DataScopeViolationException( 'Tenant cannot update global records' ); } //paranoid check of ownership if ( $entity->{$field} != MTApp::tenant()->id ) { //current tenant is NOT owner throw new DataScopeViolationException('Tenant->id:' . MTApp::tenant()->id . ' does not own '.$this->_table->alias().'->id:' . $entity->id ); } } // end if } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function beforeSave() {\n \n // Only one value can be set default for a specific tenant ID\n if( isset($this->is_default_value) && $this->is_default_value ) {\n $this->updateAll(array(\"is_default_value\"=>0), \"module ='\".$this->module.\"' AND tenant = '\".$this->tenant.\"'\" );\n }\n \n return parent::beforeSave();\n }", "protected function beforeSave()\n {\n\n }", "public function beforeSave() { return true; }", "public function beforeSave()\r\n {\r\n }", "public function beforeSave()\n {\n }", "public function beforeSave(){\n \treturn true;\n }", "public function beforeSave()\n\t{\n\n\t}", "protected function beforeSave(){\n //if ($this->isNewRecord) {\n Yii::import('application.vendors.*');\n if ($this->domain) {\n $this->domain = SeoUtils::getSubDomain($this->domain);\n $this->domain_id = self::domainExist($this->domain);\n }\n if ($this->competitora) {\n $this->competitora = SeoUtils::getSubDomain($this->competitora);\n $this->competitora_id = self::domainExist($this->competitora);\n }\n if ($this->competitorb) {\n $this->competitorb = SeoUtils::getSubDomain($this->competitorb);\n $this->competitorb_id = self::domainExist($this->competitorb);\n }\n //}\n\n return parent::beforeSave();\n }", "public function beforeSave(): void;", "public function beforeSave(): void\n {\n }", "public function beforeSave()\n {\n return true;\n }", "public function beforeSave($insert)\n {\n /* TODO checar varialvel correta, antes de descomentar */\n // $this->user_id = Yii::$app->instance->user_id;\n $this->user_id = Yii::$app->user->id;\n return parent::beforeSave($insert); // TODO: Change the autogenerated stub\n\n }", "protected function before_save()\n {\n\n }", "public function beforeInsert() { return true; }", "protected function _beforeSave()\n {\n if ($this->_dataSaveAllowed && !$this->_getResource()->isEntityExists($this)) {\n $this->_dataSaveAllowed = false;\n }\n\n return parent::_beforeSave();\n }", "public function before_save() {\n \n }", "public function beforeSave(): bool\n {\n return true;\n }", "protected function beforeSave()\n\t{\n\t\tif(parent::beforeSave())\n\t\t{\n\t\t\tif($this->isNewRecord)\n\t\t\t{\n\t\t\t}\n\t\t\t\t\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t\treturn false;\n\t}", "protected function _preSave() {}", "public function beforeSave()\n {\n if ($this->_customer) {\n $this->setCustomerId($this->_customer->getId());\n }\n parent::beforeSave();\n }", "public function beforeSave() {\r\n if ($this->isNewRecord) {\r\n $this->created_date = new CDbExpression(\"now()\");\r\n $this->refferal_code = HashHelper::generateRefferalHash();\r\n $this->activation_code = HashHelper::generateActivationHash($this->email);\r\n if (!empty($this->password)) {\r\n $this->password = HashHelper::hashPassword($this->password);\r\n }\r\n if ($this->inviter_refferal) {\r\n $this->parent_id = $this->getInviterIdByRefferalCode();\r\n }\r\n }\r\n if ($this->scenario == self::SCENARIO_RESET_PASSWORD && !empty($this->password)) {\r\n $this->password = HashHelper::hashPassword($this->password);\r\n }\r\n $this->updated_date = new CDbExpression(\"now()\");\r\n return true;\r\n }", "public function beforeSave($insert)\n {\n if (($this->getOldAttribute('status') == self::STATUS_BLACKLIST || $this->getOldAttribute('status') == self::STATUS_BLOCKED)\n && $this->status == self::STATUS_APPROVED) {\n Yii::$app->mailContainer->addToQueue(\n $this->email,\n EmailTemplate::TEMPLATE_USER_UNBLOCKED, [\n 'username' => $this->username\n ]);\n }\n\n // Notify user about account blocked\n if ($this->getOldAttribute('status') == self::STATUS_APPROVED\n && ($this->status == self::STATUS_BLOCKED || $this->status == self::STATUS_BLACKLIST)) {\n Yii::$app->mailContainer->addToQueue(\n $this->email,\n EmailTemplate::TEMPLATE_USER_BLOCKED, [\n 'username' => $this->username,\n 'contact_link' => Url::toRoute(['/contact/index/index'], true)\n ]);\n }\n\n return parent::beforeSave($insert);\n }", "public function beforeSave($insert)\n {\n if ($insert) {\n if (php_sapi_name() != 'cli') {\n $this->registration_ip = LittleBigHelper::getRealIp();\n }\n $this->generateAuthKey();\n } else {\n // Console doesn't have Yii::$app->user, so we skip it for console\n if (php_sapi_name() != 'cli') {\n if (Yii::$app->user->id == $this->id) {\n // Make sure user will not deactivate himself\n $this->status = static::STATUS_ACTIVE;\n\n // Superadmin could not demote himself\n if (Yii::$app->user->isSuperadmin && $this->superadmin != 1) {\n $this->superadmin = 1;\n }\n }\n\n // Don't let non-superadmin edit superadmin\n if (isset($this->oldAttributes['superadmin']) && !Yii::$app->user->isSuperadmin && $this->oldAttributes['superadmin'] == 1) {\n return false;\n }\n }\n }\n\n // If password has been set, than create password hash\n if ($this->password) {\n $this->setPassword($this->password);\n }\n\n return parent::beforeSave($insert);\n }", "public function beforeInsert() {\n }", "public function beforeSave($options = array()) {\n $this->data['BankAccount']['company_id'] = $this->companyId;\n\n return true;\n\n }", "protected function _beforeSave()\n {\n $data = $this->getData();\n if (empty($data['id'])) {\n unset($data['id']);\n }\n if (TM_Helpmate_Model_Status::isSystemOption($data['id'])) {\n $data['status'] = true;\n }\n $this->setData($data);\n return parent::_beforeSave();\n }", "public function beforeSave () {\n\t\t\n\t\tif ($this->remote_sync) {\n\t\t\t$temp_data = $this->data;\n\t\t\tif (!empty($this->data[$this->alias]['braintree_customer_id'])) {\n\t\t\t\t$this->data[$this->alias]['customer_id'] = $this->data[$this->alias]['braintree_customer_id'];\n\t\t\t\tunset($this->data[$this->alias]['braintree_customer_id']);\n\t\t\t}\n\t\t\tif (!empty($this->data[$this->alias]['braintree_credit_card_id'])) {\n\t\t\t\t$this->data[$this->alias]['payment_method_token'] = $this->data[$this->alias]['braintree_credit_card_id'];\n\t\t\t\tunset($this->data[$this->alias]['braintree_credit_card_id']);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!parent::beforeSave()) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif ($this->remote_sync) {\n\t\t\t$this->data[$this->alias] = array_merge(\n\t\t\t\tarray(\n\t\t\t\t\t'id' => $this->id,\n\t\t\t\t\t'braintree_merchant_id' => $this->data[$this->alias]['braintree_merchant_id']\n\t\t\t\t),\n\t\t\t\t$temp_data[$this->alias]\n\t\t\t);\n\t\t}\n\t\t\n\t\tif (!empty($this->id) && !empty($this->data[$this->alias]['braintree_customer_id'])) {\n\t\t\t$this->id = $this->data[$this->alias]['braintree_customer_id'] . '|' . $this->id;\n\t\t\t$this->data[$this->alias][$this->primaryKey] = $this->id;\n\t\t}\n\t\t\n\t\treturn true;\n\t\t\n\t}", "protected function beforeSave()\r\n\t{\r\n\r\n\t\tif(null !== Yii::app()->user)\r\n\t\t\t$id=Yii::app()->user->id;\r\n\t\telse\r\n\t\t\t$id=1; //assumes default admin user exists and with id \"1\"\r\n\r\n\t\tif($this->isNewRecord)\r\n\t\t\t$this->create_user_id=$id;\r\n\r\n\t\t$this->update_user_id=$id;\r\n\r\n\t\treturn parent::beforeSave();\r\n\t}", "public function beforeSave($insert)\n {\n if (parent::beforeSave($insert)) {\n if ($insert) {\n $this->id_usuario = Yii::$app->user->identity->id;\n }\n return true;\n } else {\n return false;\n }\n }", "public function beforeSave($insert)\n {\n if (parent::beforeSave($insert))\n {\n if ($this->isNewRecord)\n {\n $this->Uuid = UuidHelper::uuid();\n }\n return true;\n }\n return false;\n }" ]
[ "0.7027523", "0.6717632", "0.66889876", "0.66575336", "0.6602662", "0.65959966", "0.65515566", "0.64939666", "0.6488712", "0.6453152", "0.64330024", "0.6398098", "0.6305376", "0.6290885", "0.6286044", "0.61652166", "0.6132961", "0.60971797", "0.60906553", "0.60444653", "0.5979046", "0.597781", "0.59675467", "0.5963804", "0.5960171", "0.5935653", "0.5931824", "0.5922167", "0.59119457", "0.590304" ]
0.7009649
1
============================================================================= // Set the Code
function SetCode($code='') { $this->code = $code; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setCode($code);", "public function setCode( $code );", "protected function setCode($value)\n\t{\n\t\t$this->code = $value;\n\t}", "public function setCode($code);", "public function setCode($code);", "function setCode($value) {\n $this->_code = trim($value);\n }", "protected function setCode($code)\n {\n $this->code = $code;\n }", "abstract function code();", "public function setCode($code)\n\t{\n\t\t$this->code = mb_strtoupper($code);\n\t}", "public function codes()\r\n {\r\n $this->options = [\r\n 'text' => $this->_config['title'],\r\n 'size' => $this->_config['size'],\r\n 'readonly' => $this->_config['readonly'],\r\n 'class' => '',\r\n 'id' => $this->id,\r\n ];\r\n\r\n $this->layout = [\r\n 'template' => <<<HTML\r\n <div class=\"input-group\">\r\n <div class=\"input-group-prepend\">\r\n <div class=\"input-group-text \" id=\"{id}-jhgv\" style='height:40px'>\r\n InputName: &nbsp <i class=\"{icon}\"></i> \r\n <input type=\"text\" name=\"{name}\" value=\"{value}\" >\r\n </div>\r\n </div>\r\n </div>\r\nHTML\r\n ];\r\n\r\n $this->htm = strtr($this->layout['template'], [\r\n '{id}' => $this->id,\r\n '{icon}' => $this->_config['icon'],\r\n '{value}' => $this->value,\r\n '{name}' => $this->name,\r\n ]);\r\n \r\n }", "public function setCode($code) {\n\t\t$this->code = $code;\n\t}", "public function setCode($code)\n {\n if (isset($code)) {\n $this->code = $code;\n }\n }", "public function setCode($code)\n\t{\n\t\t$this->code = $code;\n\t}", "public function codes()\r\n {\r\n\r\n\r\n $actions = ZArrayHelper::map(PageAction::find()->all(), 'data', 'data');\r\n $content = '';\r\n\r\n foreach ($actions as $key => $action) {\r\n $content .= <<<HTML\r\n <option value=\"{$key}\">{$action}</option>\r\nHTML;\r\n }\r\n\r\n\r\n $this->htm .= strtr($this->_layout['main'], [\r\n '{title}' => 'Zetsoft Menu Builder',\r\n '{options}' => $content,\r\n '{attribute}' => $this->attribute,\r\n '{modelClass}' => $this->modelClass,\r\n '{id}' => $this->id,\r\n '{value}' => $this->value,\r\n ]);\r\n\r\n\r\n $this->js .= strtr($this->_layout['js'], [\r\n '{id}' => $this->id\r\n ]);\r\n\r\n }", "public function setCode($code) {\n $this->code = $code;\n }", "public function setCode(?string $code): void\n {\n $this->code = $code;\n }", "public function setCode(string $code)\n {\n $this->code = $code;\n }", "public function setScript()\n {\n \n }", "public function setCode($code)\n {\n $this->code = $code;\n }", "public function __construct($code)\n {\n\t $this->code = $code;\n }", "private function setServiceCode()\r\n {\r\n\r\n }", "public function __construct($code)\n {\n //\n $this->code = $code;\n }", "private function set_tracking_code() {\n\t\t$this->js[] = '<!-- Awesome Google Analytics by CodeBrothers, version ' . AGA_VERSION . ' - https://wordpress.org/plugins/awesome-google-analytics/ -->';\n\t\t$this->js[] = '<script type=\"text/javascript\">';\n\t\t$this->add_js_values();\n\t\t$this->js[] = '</script>';\n\t\t$this->js[] = '<!-- / Awesome Google Analytics by CodeBrothers - https://wordpress.org/plugins/awesome-google-analytics/ -->';\n\t}", "public function setCode($val)\n {\n $this->_propDict[\"code\"] = $val;\n return $this;\n }", "public function __construct($code)\n\t{\n\t\t$this->code = $code;\n\t}", "public function set_code($code)\n {\n $this->set_default_property(self::PROPERTY_CODE, $code);\n }", "public function setCode($value) \n {\n $this->code = $value;\n return $this;\n }", "public function __construct($Code=''){\n $this->Code=$Code;\n }", "public function __construct($code)\n {\n $this->code = $code;\n }", "public function setOnLoad($code=''){\n $this->_on_load=$code;\n }" ]
[ "0.8004401", "0.73892736", "0.72724915", "0.71522844", "0.71522844", "0.7044307", "0.6957162", "0.6944092", "0.6907637", "0.68583554", "0.6843309", "0.6788931", "0.6782097", "0.6732433", "0.67126846", "0.6678266", "0.66743815", "0.66692257", "0.66060394", "0.6526185", "0.65243083", "0.64940023", "0.6414852", "0.64059013", "0.63981336", "0.63823897", "0.6382086", "0.63612664", "0.6344109", "0.63247985" ]
0.79586
1
/$data['cuartos'] = $this>modelo>recuperarCuarto(); return view('cuartos', $data);
public function index() { $data['cuartos'] = $this->modeloCuartos->findAll(); return view('cuartos',$data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function crear_proyecto(){\n $cuentas = cuenta::all();\n $bolsones = bolson::all();\n $lineas = linea::all();\n $areasgestion = areagestion::all();\n $fuentesf = fuentef::all();\n $fuentesr = fuenter::all();\n\n return view('backend.paginas.Nuevo_Proyecto',compact('cuentas','bolsones', 'lineas', 'areasgestion', 'fuentesf', 'fuentesr'));\n }", "public function viewCidade(){\n // $listaUsuarios = $usuario->all();\n // esses codigos podem ser substituidos pelo de baixo\n \n $listaCidades = Cidade::all();\n\n return view('cidade',['listaCidades'=>$listaCidades]);\n}", "public function nuevo()\n {\n\nreturn View('/nuevo-profesor' );\n //\n }", "public function TambahRute()\n {\n $data = [\n 'rute'=> Route::all(),\n 'transportasi'=> Transportasi::all() \n ];\n return view(\"Rute/TambahRute\",$data);\n }", "public function contacto(){\n return view('contacto');\n }", "public function saluda(){\n return view('users')->with('name','IGNACIIO')->with('name2','SALUUU'); \n }", "public function index()\n {\n //\n $reimbursments = reimbursments::all();\n return view('tambah',['data_reimbursments'=>$reimbursments]);\n }", "public function index()\n {\n\n $marcas = DB::select('select * from BRAND'); //Tipo 2 \n // $marcas = marcas::all(); //Se llama al modelo marcas Tipo 1\n\n return view('registro.registro_auto' , compact('marcas')); //Compact trae los datos de la base de datos y los envia a la vista\n\n }", "public function index()\n {\n \n $cuentasporpagar=cuentasporpagar::all ();\n return view ('administrador.cuentasporpagar')->with(['cuentasporpagar'=>$cuentasporpagar]); \n }", "public function index()\n {\n //$relacion = Pivot_Contrato_Estimacion::all();\n $constructoras = Constructora::all();\n $estimaciones = Estimacion::all();\n $contratos = Contrato::all();\n \n return view('contratos.index', ['contratos' => $contratos, 'estimaciones' => $estimaciones, 'constructoras' => $constructoras]);\n \n }", "public function Anular()\n {\n return view(\"Proyecto.Desarrollo.Ventas.AnularVenta\");\n }", "public function index()\n {\n # code...\n //return \"Olá sou o controler da Cidade \";\n // $nome ='vinny'\n $cidades = Cidade::all(); \n return view('cidades.index',['cidades'=>$cidades]);\n\n }", "public function index()\n {\n $cuentos = Cuento::all();\n return view('cuentos.index',['cuentos'=>$cuentos]);\n }", "public function realizarArreglo()\n {\n $categories = Category::where('category_type_id', 1)->get();\n $ocasiones = Occasion::All();\n $masVendidos = Product::limit(6)->get();\n $sliders = Slider::all();\n \n\n\n return View('plantillas.realizarArreglo',compact('categories','masVendidos','ocasiones','sliders'));\n }", "public function produto()\n {\n return view('cadastrar_produtos'); \n }", "public function index(){\n $resultado = tbl_viaje::get();\n return view (\"\", array (\"resultado\"=>$resultado) );\n \n }", "public function index()\n {\n $data = MuestrasCamion::all()->reverse();\n //Enviamos esos registros a la vista.\n // return $data; \n \n return view($this->path.'.index', compact('data'));\n }", "public function prueba(){\n\n\n\t\t\t\t$cliente = App\\Cliente::findOrFail(1);\n\t\t\t\treturn $cliente->cursos;\n\n //$cliente->cursos()->sync(2);\n\n return view('demo', ['cursos'=> $cliente->cursos] );\n }", "public function mahasiswa()\n {\n $data=Mahasiswa::all();\n return view ('mahasiswa' ,['mahasiswa'=>$data]);\n // dd($data);\n }", "public function mostrar(){\n $rubros=Rubroingreso::all();\n \n return view('tesoreria.movimientos', compact(\"rubros\"));\n }", "public function index()\n {\n return view('form.buscar')->with('usu',$this->Usuario());\n }", "public function cadastrar() {\n return view('usuarios.cadastrar');\n }", "public function getNuevo($ruc){\r\n //verificamos si la empresa existe\r\n $empresa = Empresa::find($ruc);\r\n if($empresa){\r\n //Si la empresa existe mostramos la vista para ingersar los datos del contrato\r\n //junto con los datos de la empresa y sus clientes.\r\n $clientes = $empresa->clientes;\r\n return View::make('contrato.nuevo')->with('empresa', $empresa)\r\n ->with('clientes', $clientes);\r\n }else{\r\n //si no existe regresamos al panel principal.\r\n return Redirect::to('usuario/panel');\r\n\r\n }\r\n }", "public function caja(){\n\t\tif(Auth::check()){\n\t\t\t//Validar que el usuario tiene sus datos completados\n $id_usuario = Auth::id();\n $cliente = CLiente::idUsuario($id_usuario)->first();\n\n if($cliente->rut){\n \t$carro_compra = CarroCompra::idCliente($cliente->id)->first();\n \t$detalleCarro = DetalleCarroCompra::idCarroCompra($carro_compra->id_carro_compra)->get();\n \treturn view('carrocompra.caja')\n \t\t->with('cliente',$cliente)\t\n \t\t->with('carro_compra',$carro_compra)\n \t\t->with('detalle_carro',$detalleCarro);\t\n }else{\n \treturn redirect()->route('misdatos')->with('warning','Debe completar sus datos personales para continuar.');\n }\n\n }else{\n \treturn view('auth.login');\n }\n\t}", "public function index()\n {\n $productos = DB::table('producto')->orderBy('id', 'asc')->get();\n $data=array();\n $data['productos'] = $productos;\n return View::make('producto.muestra')->with($data);\n }", "public function create()\n {\n //\n $cuentas = cuentas::pluck('cue_numero','cue_numero');\n $usuarios = usuarios::pluck('usu_nombre','usu_cedula');\n return view('retiros.crear',compact('cuentas','usuarios'));\n }", "public function nuevo() {\n\n //$tipocomprobantes = $this->tipocomprobantes->where('activo_tpcomprobante', 1)->findall();\n\n //$data = ['titulo' => 'Agregar Compra', 'tipocomprobantes' => $tipocomprobantes];\n\n echo view('header');\n //echo view('comprasView/nuevo', $data);\n echo view('comprasView/nuevo');\n echo view('footer_piepg');\n\n \n }", "public function buscar(){\n $id = auth()->user()->id;\n $empleado = Empleado::all()->where('user_id', $id)->first();\n $area = Area::find($empleado->area_id);\n $rango = Rango::find($empleado->rango_id);\n\n if($area->nombre == 'Clasificacion' || $area->nombre == 'Almacenaje' || $rango->nombre != 'Empleado'){\n return redirect('registro/registroPaquete')->with('error', 'Pagina no autorizada');\n }\n $datos = ['empleado'=>$empleado, 'area'=>$area, 'rango'=>$rango];\n\n return view('registros.buscar',array('datos'=>$datos));\n\n }", "public function index()\n {\n $cuentasporcobrar=cuentasporcobrar::all ();\n return view ('administrador.cuentasporcobrar')->with(['cuentasporcobrar'=>$cuentasporcobrar]);\n }", "public function getCadastrar() {\n $cargos = DB::table('cargos')->orderBy('id', 'desc')->get();\n return view('gestao.cadastro_funcionario', compact('cargos'));\n }" ]
[ "0.78953725", "0.76810414", "0.76090324", "0.75900906", "0.74693763", "0.7464345", "0.7462808", "0.7448462", "0.7417634", "0.73781997", "0.73688054", "0.73658234", "0.7328425", "0.7326376", "0.72963315", "0.72954315", "0.7279682", "0.7249157", "0.7247345", "0.7240312", "0.72319096", "0.7223707", "0.721239", "0.72056603", "0.72042537", "0.7194966", "0.7181228", "0.717878", "0.7175435", "0.71745086" ]
0.78780156
1
If the value is equal to the username, return the email, else return the value as the email address.
public function getEmailFromName($value) { if (User::where('name', $value)->count() > 0) { return User::where('name', $value)->pluck('email'); } return $value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function username()\n {\n return filter_var($this->loginCredential, FILTER_VALIDATE_EMAIL) ? 'email': 'username';\n }", "public function getUsername(): string\n {\n return (string)$this->email;\n }", "public function getUsername(): string\n {\n return (string)$this->email;\n }", "public function getUsername(): string\n {\n return (string)$this->email;\n }", "public function getUsername(): string\n {\n return (string)$this->email;\n }", "public function getUsername(): string\n {\n return (string)$this->email;\n }", "public function getUsername(): string {\n return (string)$this->email;\n }", "public function getUsername(): string\n\t{\n\t\treturn (string)$this->email;\n\t}", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }", "public function getUsername(): string\n {\n return (string) $this->email;\n }" ]
[ "0.7249436", "0.7196308", "0.7196308", "0.7196308", "0.7196308", "0.7196308", "0.7159922", "0.70918065", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212", "0.7080212" ]
0.7453436
0
Returns the Simulator object that uses this web site.
public function getSimulator() { return $this->simulator; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getWebPage () {\n return $this->_webpage;\n }", "public function getWebpage()\n {\n return $this->webpage;\n }", "public function getBrowser()\n {\n return $this->browser;\n }", "public function getBrowser()\n\t{\n\t\tstatic $userAgent = null;\n\n\t\tif (! isset($this->_browser) || $this->getUserAgent() !== $userAgent) {\n\t\t\t$bscap = new Browscap(_SYSTEM_CACHE_DIR . '/browscap');\n\t\t\t$this->_browser = $bscap->getBrowser();\n\t\t}\n\n\t\treturn $this->_browser;\n\t}", "public function getSitioWeb()\n\t{\n\t\treturn $this->sitio_web;\n\t}", "public abstract function getWebpageManager();", "function &getBrowser()\n\t{\n\t\tjimport('joomla.application.environment.browser');\n\t\t$instance =& JBrowser::getInstance();\n\t\treturn $instance;\n\t}", "public function getSite()\n {\n return $this->site;\n }", "public function getSite()\n {\n return $this->site;\n }", "public function getSite()\n {\n return $this->site;\n }", "protected function getSite()\n {\n $site = new Site();\n $site->setHost('app.fitbase.de');\n $site->setScheme('https');\n return $site;\n }", "function velin()\n{\n\treturn new \\Velin\\Skeletons\\Site();\n}", "public function get_Site() {\n return $this->site;\n }", "public function getSite() {\n\t\treturn $this->site;\n\t}", "public function getSite()\n {\n return Site::getByID($this->sites_id);\n }", "function getBrowserAgent ()\n\t{\n\t return $this->agent;\n\t}", "public function getSite()\n {\n return isset($this->site) ? $this->site : null;\n }", "public function getSelfRobot()\r\n {\r\n return $this->get(self::_SELF_ROBOT);\r\n }", "public function getSelfRobot()\r\n {\r\n return $this->get(self::_SELF_ROBOT);\r\n }", "public function getSelfRobot()\r\n {\r\n return $this->get(self::_SELF_ROBOT);\r\n }", "public function getBrowser()\n {\n return $this->_browser_name;\n }", "public function getBrowser() { return $this->_browser_name; }", "public static function robot()\n\t{\n\t\treturn self::$robot;\n\t}", "public function getWebsite()\n {\n return $this->website;\n }", "public function getWebsite()\n {\n return $this->website;\n }", "public function getWebsite()\n {\n return $this->website;\n }", "public static function shared(){\n\t\t$instance = StaticStore::shared()->get(self::DETECTION_KEY, false);\n\t\tif(!$instance || is_null($instance)){\n\t\t\t$instance = new self();\n\t\t\t$instance->findBrowserInformation();\n\t\t\tStaticStore::shared()->set(self::DETECTION_KEY, $instance);\n\t\t}\n\t\t\n\t\treturn $instance;\n\t}", "function getInstance() {\n\t\tglobal $instanceSimpleHTTP;\n\t\t// initialize if needed\n\t\tif (!isset($instanceSimpleHTTP))\n\t\t\tSimpleHTTP::initialize();\n\t\treturn $instanceSimpleHTTP;\n\t}", "public function getAgent()\n {\n if ($this->agent !== null) {\n return $this->agent;\n }\n\n $this->agent = new Agent();\n $this->agent->setUserAgent($this->user_agent);\n\n return $this->agent;\n }", "public function getSite()\n {\n return $this->getSection()->getSite();\n }" ]
[ "0.6130558", "0.6056979", "0.5718371", "0.57141566", "0.5707784", "0.5662327", "0.56433684", "0.5617452", "0.5617452", "0.5617452", "0.5595605", "0.55781794", "0.55741906", "0.5573641", "0.5554685", "0.5524246", "0.54494125", "0.5431296", "0.5431296", "0.5431296", "0.53967535", "0.53898454", "0.5367669", "0.5336764", "0.5336764", "0.5336764", "0.5334326", "0.53152686", "0.53107905", "0.53102237" ]
0.7288053
0
Set a default attribute value key/pair.
public static function defaultAttribute($attribute, $value) { return self::$attributeDefaults[$attribute] = $value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function attribute(string $kay, string $default = null);", "public function setAttributeValue($key, $value);", "public function setAttribute($key, $value);", "private function setAttributeDefaults() {\n if ($this->data['attrs']['label_input'] === '{default_label}') {\n $this->data['attrs']['label_input'] = $this->fieldMetaData->label !== 'NamedIDLabel' ? $this->fieldMetaData->label : $this->fieldName;\n }\n if ($this->data['attrs']['hint'] && $this->data['attrs']['hide_hint']) {\n $this->data['attrs']['hint'] = '';\n }\n }", "function __set_attribute($key, $value)\n {\n return $this->setattr($key, $value);\n }", "public function setAttribute($key, $value) {\n\t\t$this->attributes->offsetSet($key,$value);\n\t}", "protected function fillDefaultAttributes()\n {\n foreach ($this->defaultAttributes as $name)\n {\n if (! in_array($name, $this->getFillable())) {\n continue;\n }\n\n $this->setAttribute(\n $name, config(\"przelewy24.$name\")\n );\n }\n }", "public function set_default()\n\t{\n\t\t$this->value = Arr::get($this->_extra, Kohana::$config->load('zcolumns.default.default_column.default'));\n\t}", "public function setKeyDefault($key, $value)\n {\n $config = $this->getConfigModel($key);\n if (!$config->final) {\n $config->default = $this->castType($value, $this->keyType($key), false);\n $config->save();\n } else {\n throw new \\InvalidArgumentException(\"Config key '$key' cannot be changed.\");\n }\n }", "function set_attribute($name,$value = NULL)\r\n\t\t{\r\n\t\t\t$this->attrs[$name] = $value;\r\n\t\t\treturn;\r\n\t\t}", "public function setDefault( $default );", "public function set_attribute($key, $value)\n {\n $this->attributes[$key] = $value;\n }", "public function attribute($key, $value = null) {\n if (empty($value) && array_key_exists($key, $this->attributes)) {\n return $this->attributes[$key];\n } else {\n $this->attributes[$key] = $value;\n }\n }", "public function set($key, $value = NULL, $default = NULL) {\n\t\tif (is_array($key)) {\n\t\t\tforeach($key as $k => $v){\n\t\t\t\t$this->params[$k] = $v;\n\t\t\t}\n\t\t} else {\n\t\t\tif ($value !== NULL) {\n\t\t\t\t$this->params[$key] = $value;\n\t\t\t} else {\n\t\t\t\t$this->params[$key] = $default;\n\t\t\t}\n\t\t}\n\t}", "protected function setAttribute($key, $value)\n {\n $this->attributes[$key] = $value;\n }", "function overrideDefault($key, $value)\n\t{\n// echo \"Override: {$key} => {$value}<br />\";\n \tif (!isset($this->defaults[$key])) return FALSE;\n\t\t$this->defaults[$key] = $value;\n\t}", "public static function setDefault($key, $default)\n\t{\n\t\tif (!self::getItem($key))\n\t\t{\n\t\t\tself::setItem($key, $default);\n\t\t}\n\t}", "public function setDefaultValue($var) {}", "public function setDefaultValue($var) {}", "public function setDefault($value)\n {\n $this->_default_val = $value;\n }", "public function setDefaultValue($value);", "public function __set($key, $value)\n {\n $this->attributes[$key] = $value;\n }", "public function __set($key, $value)\n {\n $this->attributes[$key] = $value;\n }", "public function setAttribute($key, $value)\n {\n $this->_attributes[$key] = $value;\n }", "public function getAttributeDefaults();", "public function __set(string $key, $attvalue);", "public function set($key, $value)\n {\n $this->attributes[$key] = $value;\n }", "public function set($key, $value)\n {\n $this->attributes[$key] = $value;\n }", "public function set($key, $value)\n {\n $this->attributes[$key] = $value;\n }", "function set($a,$v) { $this->attributes[$a] = $v; }" ]
[ "0.67814434", "0.655769", "0.64124185", "0.6390012", "0.63462037", "0.6312213", "0.6307821", "0.6259819", "0.62577736", "0.62228376", "0.61680174", "0.6163114", "0.61407906", "0.61383986", "0.6136825", "0.61208254", "0.60949385", "0.60754406", "0.60754406", "0.6066119", "0.6048394", "0.6045943", "0.6045943", "0.603015", "0.60284305", "0.6020581", "0.6010366", "0.6010366", "0.6010366", "0.6006687" ]
0.66282415
1
Get tour header template part
function wpsp_tour_header() { if ( is_singular( 'cp_tour' ) ) { get_template_part( 'partials/tour-header' ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOverviewTemplate();", "abstract protected function get_view_heading();", "function get_headbox_template( $movie ) {\n\n\treturn utils\\get_headbox_template( $movie );\n}", "function rella_get_header_view() {\n\tif( function_exists( 'vc_mode' ) && 'page_editable' === vc_mode() ) {\n\t\treturn;\n\t}\n\n\t$enable = rella_helper()->get_option( 'header-enable-switch', 'raw', '' );\n\t// Check if header is enabled\n\tif( 'off' === $enable ) {\n\t\treturn;\n\t}\n\n\t// Overlay Header\n\t$header_id = rella_get_custom_header_id();\n\t$layout = rella_helper()->get_post_meta( 'header-layout', $header_id );\n\t$enable_titlebar = rella_helper()->get_option( 'title-bar-enable', 'raw', '' );\n\n\tif( 'overlay' === $layout && 'on' === $enable_titlebar ){\n\t\treturn;\n\t}\n\n\tif( $id = rella_helper()->get_option( 'header-template', 'raw', false ) ) {\n\t\tget_template_part( 'templates/header/custom' );\n\t\treturn;\n\t}\n\n\tget_template_part( 'templates/header/default' );\n}", "function bp_header_information() {\n\t\tif ( !bpcp_is_home() && !bpcp_is_edit() )\n\t\t\tbpcp_locate_template( Array( 'event_details.php' ), true );\n\t}", "public static function get_header_id() {\n\n\t\t\t// Template\n\t\t\t$id = oceanwp_custom_header_template();\n\n\t\t\t// If template is selected\n\t\t\tif ( ! empty( $id ) ) {\n\n\t\t\t\t// Get Polylang Translation of template\n\t\t\t\tif ( function_exists( 'pll_get_post' )) {\n\t\t\t\t\t$id_polylang = pll_get_post( $id, pll_current_language() );\n\t\t\t\t\tif ( ! empty( $id_polylang ) ) {\n\t\t\t\t\t\t$id = $id_polylang;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn $id;\n\t\t\t}\n\n\t\t\t// Return\n\t\t\treturn false;\n\t\t\t\n\t\t}", "function shell_get_sidebar_header(){\r\n\tshell_get_template( 'sidebar', 'header' ); // sidebar-header.php\r\n}", "function get_headbox_template( $person ) {\n\n\treturn utils\\get_headbox_template( $person );\n}", "public function getWpHeader()\n {\n return self::buffer('wp_head');\n }", "function mkdf_tours_get_single_tour_item() {\n\t\t$params = array(\n\t\t\t'holder_class' => 'mkdf-tour-item-single-holder',\n\t\t\t'tour_sections' => mkdf_tours_check_tour_sections()\n\t\t);\n\n\t\techo mkdf_tours_get_tour_module_template_part('single/holder', 'tours', 'templates', '', $params);\n\t}", "function wpi_section_name(){\n\tglobal $Wpi;\n\treturn $Wpi->Template->section;\n}", "function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function getTemplate();", "public function template_header()\r\n { \r\n\t$data = \"\r\n\t\t<h1>APP Minimaliste</h1>\r\n\t\t\".$this->commons->menu();\r\n\r\n\treturn $data;\r\n }", "private function get_title_template() {\n\t\treturn $this->get_template( 'title' );\n\t}", "function getheader() { \n /* Removed and included in TypoScript for the case, the User wants to change the CSS file\n $GLOBALS['TSFE']->pSetup['includeCSS.'][$this->extKey . 'shadowbox'] = 'typo3conf/ext/and_shadowbox/res/css/shadowbox.css';\n $GLOBALS['TSFE']->pSetup['includeCSS.'][$this->extKey . 'shadowbox.']['media'] = 'screen';\n $GLOBALS['TSFE']->pSetup['includeCSS.'][$this->extKey . 'andshadowbox'] = 'typo3conf/ext/and_shadowbox/res/css/andshadowbox.css';\n $GLOBALS['TSFE']->pSetup['includeCSS.'][$this->extKey . 'andshadowbox.']['media'] = 'screen';*/\n\n // Local_Lang Werte für Navigation\n $llclose = $this->pi_getLL('close');\n \t\t$llnext = $this->pi_getLL('next');\n \t\t$llprev = $this->pi_getLL('prev');\n \t\t$llof = $this->pi_getLL('of');\n \n // Bilder als Navigationselemente\n if ($this->lconf['naviclose'] != '') {\n $close = '<img src=\"'.$this->lconf['naviclose'].'\" />';\n } else {\n $close = '<span class=\"shortcut\">'.$llclose[0].'</span>'.ltrim($llclose, $llclose[0]);\n }\n if ($this->lconf['navinext'] != '') {\n $next = '<img src=\"'.$this->lconf['navinext'].'\" />';\n } else {\n $next = '<span class=\"shortcut\">'.$llnext[0].'</span>'.ltrim($llnext, $llnext[0]);\n }\n if ($this->lconf['naviprev'] != '') {\n $prev = '<img src=\"'.$this->lconf['naviprev'].'\" />';\n } else {\n $prev = '<span class=\"shortcut\">'.$llprev[0].'</span>'.ltrim($llprev, $llprev[0]);\n }\n\n // Framework Auswahl\n switch ($this->lconf['jsframework']) {\n // Prototype\n case 'prototype':\n if ($this->lconf['jsonlyadapter']==0) {\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_prototype'] = 'typo3conf/ext/and_shadowbox/res/scripts/lib/prototype.js';\n }\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . 'scriptaculous'] = 'typo3conf/ext/and_shadowbox/res/scripts/lib/scriptaculous/scriptaculous.js?load=effects';\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '__prototypeAdapter'] = 'typo3conf/ext/and_shadowbox/res/scripts/adapter/shadowbox-prototype.js';\n break;\n \n /*\n // Mootools\n case 'mootools':\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_mootools'] = 'typo3conf/ext/and_shadowbox/res/scripts/lib/mootools.js';\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_mootoolsAdapter'] = 'typo3conf/ext/and_shadowbox/res/scripts/adapter/shadowbox-mootools.js';\n\n break;\n */\n \n // JQuery\n case 'jquery':\n if ($this->lconf['jsonlyadapter']==0) {\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_jquery'] = 'typo3conf/ext/and_shadowbox/res/scripts/lib/jquery.js';\n }\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_jqueryAdapter'] = 'typo3conf/ext/and_shadowbox/res/scripts/adapter/shadowbox-jquery.js';\n break;\n \n // Dojo\n case 'dojo':\n if ($this->lconf['jsonlyadapter']==0) {\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_dojo'] = 'typo3conf/ext/and_shadowbox/res/scripts/lib/dojo.js';\n }\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_dojoAdapter'] = 'typo3conf/ext/and_shadowbox/res/scripts/adapter/shadowbox-dojo.js';\n break;\n \n // YUI\n case 'yui':\n default:\n if ($this->lconf['jsonlyadapter']==0) {\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_yui'] = 'typo3conf/ext/and_shadowbox/res/scripts/lib/yui-utilities.js';\n }\n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_yuiAdapter'] = 'typo3conf/ext/and_shadowbox/res/scripts/adapter/shadowbox-yui.js';\n break;\n }\n \n $GLOBALS['TSFE']->pSetup['includeJS.'][$this->extKey . '_shadowbox'] = 'typo3conf/ext/and_shadowbox/res/scripts/shadowbox.js';\n \n \t\t$script = ' \n window.onload = function(){\n \n var options = {\n text: {\n cancel: \\''.$this->pi_getLL('cancel').'\\',\n loading: \\''.$this->pi_getLL('loading').'\\', \n close: \\''.$close.'\\',\n next: \\''.$next.'\\',\n prev: \\''.$prev.'\\',\n of: \\''.$llof.'\\'\n },\n keysClose: [\\''.strtolower ($llclose[0]).'\\', 27],\n keysNext: [\\''.strtolower ($llnext[0]).'\\', 39],\n keysPrev: [\\''.strtolower ($llprev[0]).'\\', 37]\n };\n \n Shadowbox.init(options);\n };\n ';\n $GLOBALS['TSFE']->inlineJS[] = $script; #$GLOBALS['TSFE']->setJS($this->extKey, $script);\n }", "public function getHeaderText()\n {\n /** @var \\MageWorx\\SeoXTemplates\\Model\\Template $template */\n $temlate = $this->coreRegistry->registry('mageworx_seoxtemplates_template');\n if ($temlate && $temlate->getId()) {\n return __(\"Edit Category Template '%1'\", $this->escapeHtml($temlate->getName()));\n }\n return __('New Template');\n }", "public function getTemplate(): string;", "public function getTemplate(): string;", "public static function get_vertical_header_id() {\n\n\t\t\t// Template\n\t\t\t$id = get_theme_mod( 'ocean_vertical_header_template' );\n\n\t\t\t// If template is selected\n\t\t\tif ( ! empty( $id ) ) {\n\n\t\t\t\t// Get Polylang Translation of template\n\t\t\t\tif ( function_exists( 'pll_get_post' )) {\n\t\t\t\t\t$id_polylang = pll_get_post( $id, pll_current_language() );\n\t\t\t\t\tif ( ! empty( $id_polylang ) ) {\n\t\t\t\t\t\t$id = $id_polylang;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn $id;\n\t\t\t}\n\n\t\t\t// Return\n\t\t\treturn false;\n\t\t\t\n\t\t}", "public function loadTemplateHead()\n\t{\n\t\t$title = $this->sideTitle;\n\t\tif (isset($this->templateHeader)) { include_once 'views/' . $this->templateHeader; }\n\t}", "private function getHeader()\n {\n $template = \n<<<EOD\n<!DOCTYPE html>\n<html>\n <head>\n <title>Niuware WebFramework Exception Found</title>\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0,minimum-scale=1.0\">\n </head>\n <body style=\"background-color:#fefefe;\">\nEOD;\n return $template;\n }", "abstract public function getTemplate();", "abstract public function getTemplate();", "function rad_do_header_structure() {\n $header = rad_site_title();\n $header .= rad_site_description();\n echo rad_header_group( $header );\n}", "private function createHeaderTitle()\n\t{\n\t\tif(isset($this->content['headerTitle']))\n\t\t\treturn $this->content['headerTitle'];\n\t\telseif(isset($this->content['title']))\n\t\t\treturn $this->content['title'];\n\n\t\treturn $this->defaultTemplateHeaderTitle;\n\t}", "function mkdf_tours_get_tour_module_template_part($template, $module, $part, $slug = '', $params = array()) {\n\n\t\t//HTML Content from template\n\t\t$html = '';\n\t\t$template_path = MIKADO_TOURS_CPT_PATH.'/'.$module.'/'.$part;\n\n\t\t$temp = $template_path.'/'.$template;\n\t\tif(is_array($params) && count($params)) {\n\t\t\textract($params);\n\t\t}\n\n\t\t$template = '';\n\t\t\n\t\tif (!empty($temp)) {\n\t\t\tif (!empty($slug)) {\n\t\t\t\t$template = \"{$temp}-{$slug}.php\";\n\t\t\t\t\n\t\t\t\tif(!file_exists($template)) {\n\t\t\t\t\t$template = $temp.'.php';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$template = $temp.'.php';\n\t\t\t}\n\t\t}\n\t\t\n\t\tif($template) {\n\t\t\tob_start();\n\t\t\tinclude($template);\n\t\t\t$html = ob_get_clean();\n\t\t}\n\n\t\treturn $html;\n\t}" ]
[ "0.65191704", "0.6437646", "0.6406369", "0.6357162", "0.6339527", "0.63336045", "0.6296672", "0.6287479", "0.6259229", "0.6229282", "0.62236536", "0.62167895", "0.61820114", "0.61820114", "0.61820114", "0.61820114", "0.61755735", "0.61463076", "0.61170834", "0.6103582", "0.6080084", "0.6080084", "0.60611105", "0.60477436", "0.6016188", "0.60090214", "0.60090214", "0.60022795", "0.600047", "0.5998997" ]
0.7595582
0
Creating the status of a successfully completed saga.
public static function completed(): self { return new self(self::STATUS_COMPLETED); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function sitemap_create_status( $status ) {\n\t\tif ( (bool) get_option( 'msm_stop_processing' ) === true && (bool) get_option( 'msm_sitemap_create_in_progress' ) === true ) {\n\t\t\treturn __( 'Halting', 'metro-sitemaps' );\n\t\t}\n\t\t\t\n\t\treturn $status;\n\t}", "public function getStatus(){\n return self::COMPLETE;\n }", "public function createSuccess() {\n //var_dump($response);\n }", "public function actionCreateEstado()\n {\n $this->apiResponse(Status::addStatus($_POST['description']));\n }", "public static function createSuccess()\n {\n return array('Detail' => self::CREATE_SUCCESS);\n }", "protected function success(): void\n {\n Splunk::log('payable_success', [\n 'user_id' => $this->getUserId(),\n 'type' => $this->getPayableType(),\n 'id' => $this->getPayableId(),\n ]);\n $this->setStatus(static::$statusComplete);\n }", "public static function SUCCESS() : self\r\n\t{\r\n\t\treturn new self(self::SUCCESS);\r\n\t}", "public function updateTourFinished($status)\n {\n $response = new AmfResponse();\n $pdo = Database::getPDO();\n $update = $pdo->prepare(\"UPDATE users SET tour_finished = :status WHERE id = :playerId\");\n $update->bindParam(\":status\", $status, PDO::PARAM_INT);\n $update->bindParam(\":playerId\", $_SESSION['id'], PDO::PARAM_INT);\n $update->execute();\n $response->statusCode = 0;\n $response->message = \"Tour updated!\";\n $response->valueObject = null;\n return $response;\n }", "public function create()\n {\n return Response::create('ACCEPTED', 201);\n }", "public function actionCompleted()\n\t{\n $this->iostatus = 5;\n $this->_iov();\n\t}", "function getSuccessStatus()\n{\n\treturn array('status' => true);\n}", "public function success()\n {\n return $this->factory->json([\n 'state' => true,\n ]);\n }", "public function success () {}", "function success() {\n\t\treturn $this->customise(array(\n\t\t\t'Sent' => 1,\n\t\t\t'SuccessMessage' => $this->Success\n\t\t));\n\t}", "function pStatusSuccess()\n {\n return 'SUCCESS';\n }", "public function successful();", "public function isSuccessfull(): bool\n {\n return $this->statusCode() >= 200 && $this->statusCode() < 300;\n }", "public function markFinished(){\n $this->status = self::STATUS_FINISHED;\n return $this->save(false,['status']);\n }", "public function isSuccessful()\n {\n return $this->getResult() == 'FINISHED';\n }", "public function isSuccess(): bool\n {\n return $this->status === static::STATUS_SUCCESS;\n }", "public function success(){\n\t\t\t$this->status = 200;\n\t\t\t$this->type = true;\n\t\t\t$this->message = \"Success\";\n\t\t\t\n\t\t\t$this->printJson();\n\t\t}", "public function handleSuccess()\n {\n $this->app->inline($this->msg);\n\n return Status::SUCCESS;\n }", "public static function created(): self\n {\n return new self(self::STATUS_IN_PROGRESS);\n }", "public function run()\n {\n //Making the 2 base status\n Status::create(['name' => 'Scheduled']);\n Status::create(['name' => 'Done']);\n }", "public function testTaskSuccess(): void\n {\n $this->servicesForLocator['task_service'] = fn() => self::createMock(TaskInterface::class);\n\n [$handler, $task] = $this->createHandlerWithEntities(\n MigrationStatus::BEFORE_TASKS,\n TaskType::BEFORE\n );\n $message = new RunTask((int)$task->getId());\n $handler($message);\n\n self::assertSame(ComponentStatus::FINISHED, $task->getStatus());\n }", "protected function postprocessSuccessActionCreate()\n {\n \\XLite\\Core\\TopMessage::addInfo('Profile has been created successfully');\n }", "public function setSuccess()\n {\n \t$this->attributes['status'] = 'Sukses';\n \tself::save();\n }", "public function setSuccess()\n {\n $this->attributes['status'] = 'success';\n self::save();\n }", "public function markSuccess();", "public function processSucceed()\n {\n $this->acquirePINCodes();\n\n if ($this->hasPinCodes()\n && \\XLite\\Core\\Config::getInstance()->CDev->PINCodes->approve_before_download\n && $this->getShippingStatusCode() !== Shipping::STATUS_WAITING_FOR_APPROVE\n ) {\n $this->setShippingStatus(Shipping::STATUS_WAITING_FOR_APPROVE);\n }\n\n parent::processSucceed();\n }" ]
[ "0.59526193", "0.5949547", "0.593908", "0.5799421", "0.5793275", "0.57867867", "0.565484", "0.56544805", "0.5647699", "0.5603996", "0.55803794", "0.55727607", "0.55597955", "0.5559269", "0.5549836", "0.5547513", "0.55445296", "0.55387664", "0.55286145", "0.5480559", "0.5479588", "0.54769146", "0.5467179", "0.5455606", "0.5445572", "0.5436957", "0.5422329", "0.5414921", "0.5402177", "0.53952664" ]
0.65277386
0
Creation of the status of the expired life of the saga.
public static function expired(): self { return new self(self::STATUS_EXPIRED); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setExpired()\n {\n $this->attributes['status'] = 'expired';\n self::save();\n }", "public function getExpired();", "public function isExpired()\n {\n return $this->status === ApprovalStatus::EXPIRED;\n }", "public function getExpired()\n {\n return $this->expired;\n }", "public function isExpired()\n {\n return $this->getStatus() == Status::EXPIRED;\n }", "public function isExpired() {\n return true;\n }", "private function checkExpiration()\n {\n if (!$this->hasLifetime) {\n return;\n }\n\n if (!isset($this->payload['exp']) || !is_numeric($this->payload['exp'])) {\n return $this->state = self::INVALID;\n }\n\n if (0 <= (new \\DateTime())->format('U') - $this->payload['exp']) {\n return $this->state = self::EXPIRED;\n }\n\n if (0 <= (new \\DateTime())->format('U') - ($this->payload['exp'] - $this->refreshTtl)) {\n return $this->state = self::REFRESH;\n }\n }", "public function setExpired()\n {\n \t$this->attributes['status'] = 'Kadaluarsa';\n \tself::save();\n }", "function expiredStatus()\n{\n if(Request::pendente()->count() == 0 ) {\n return -1;\n }\n\n $num = Request::pendente()->expirado()->count();\n\n return $num > 0;\n}", "public function numExpired() {\n return $this->expired;\n }", "public function expired() {\n\t\tif ($this->ttl < 1) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn ($this->creation + $this->ttl) < time();\n\t}", "public function isExpired();", "public function isExpired();", "public function getIsExpiredAttribute()\n {\n return $this->expired_at < Carbon::now();\n }", "public function isExpired(): bool;", "function checkExpired()\r\n {\r\n $date = JFactory::getDate();\r\n $today = $date->toFormat( \"%Y-%m-%d 00:00:00\" );\r\n \r\n // select all subs that have expired but still have status = '1';\r\n JModel::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_tienda/models' );\r\n $model = JModel::getInstance( 'Subscriptions', 'TiendaModel' ); \r\n $model->setState(\"filter_datetype\", 'expires' );\r\n $model->setState(\"filter_date_to\", $today );\r\n $model->setState(\"filter_enabled\", '1' );\r\n if ($list = $model->getList())\r\n {\r\n foreach ($list as $item)\r\n {\r\n $this->setExpired( $item->subscription_id, $item );\r\n }\r\n }\r\n\r\n if ($list = $model->getListByIssues() )\r\n {\r\n foreach ($list as $item)\r\n {\r\n $this->setExpired( $item->subscription_id, $item, true );\r\n }\r\n }\r\n \r\n // Update config to say this has been done\r\n JTable::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_tienda/tables' );\r\n $config = JTable::getInstance( 'Config', 'TiendaTable' );\r\n $config->load( array( 'config_name'=>'subscriptions_last_checked') );\r\n $config->config_name = 'subscriptions_last_checked';\r\n $config->value = $today;\r\n $config->save();\r\n \r\n // TODO send summary email to admins\r\n }", "public function isExpired()\n {\n return $this->created_at->diffInMinutes(Carbon::now()) < static::EXPIRATION_TIME;\n }", "public function getExpiredAttribute()\n {\n return $this->expires_at < now();\n }", "public function IsExpired():bool\n {\n }", "public function isExpired() {\n return !$this->getTeamDate()->isFuture();\n }", "public function updateExpired()\n {\n\n //if($this->delivery_status_id < 3)\n //foreach($deliveries as $delivery)\n //{\n if (strtotime('- 1 day') > strtotime($this->date))\n {\n $this->delivery_status_id = 5;\n $this->save();\n\n foreach($this->drops as $drop)\n {\n if ($drop->drop_status_id < 3)\n {\n $drop->drop_status_id = 5;\n $drop->save();\n }\n }\n }\n //}\n }", "public function isExpired()\n {\n return time() > strtotime( $this->expires );\n }", "public function isExpired(): bool\n {\n return null !== $this->expiry && $this->expiry < new \\DateTime('now');\n }", "public function getExpiredCount()\n {\n if (!property_exists($this, 'expirationDate'))\n return 0;\n\n return $this->getCount('expirationDate < ?', array(date('Y-m-d H:i:s')));\n\n }", "public function getExpiredAttribute()\n {\n if (!$this->code || !$this->expire_at) return false;\n\n return $this->expire_at <= Carbon::now();\n }", "public function hasExpired()\n {\n return $this->expire_at->lt(Carbon::now()->startOfDay());\n }", "public function isExpired() {\n \n if (time() - $this->created > My_Model_Table_ResetPassword::EXPIRE_IN) {\n return true;\n }\n \n return false;\n }", "public function getIsExpired()\n {\n return new \\DateTime('today') > $this->getEndAt();\n }", "public function IsExpired()\r\n\t{\r\n\t\treturn ($this->expiry < time());\r\n\t}", "public function isExpired()\n\t{\n\t\t$expired = $this->expire_date<time();\n\t\tif ($expired && $this->active) $this->deactivate();\n\t\treturn $expired;\n\t}" ]
[ "0.6967502", "0.69441086", "0.6710514", "0.6677967", "0.65661204", "0.65138274", "0.6488772", "0.646925", "0.63842374", "0.62727636", "0.62649065", "0.6250245", "0.6250245", "0.61761934", "0.6161197", "0.614467", "0.6135161", "0.6112107", "0.6109892", "0.59903467", "0.59897524", "0.5983686", "0.5978962", "0.5949735", "0.5945255", "0.5918496", "0.59138435", "0.5899952", "0.5887931", "0.5865346" ]
0.7592708
0
Finds the Theme Base folder absolute path, uses the $themeBase which should be relative from the src folder. So $themeBase = src/MyVendor/MyBundle/Resources/public/css etc.
public function getThemeBase() { return $this->getKernelRootDir() . '/../' . $this->themeBase; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getThemeRelativePath()\n {\n $theme = PageTheme::getSiteTheme();\n\n return $this->app->make('environment')->getURL(DIRNAME_THEMES . '/' . $theme->getThemeHandle(), $theme->getPackageHandle());\n }", "function get_theme_dir() {\n\treturn __DIR__;\n}", "function _getPATHTheme($theme) \r\n {\r\n \treturn MIGUELBASE_THEME_DIR.$theme.'/';\r\n }", "protected function getBasePath()\n {\n // Note that the actual filesystem base is the 'assets' subdirectory within this\n return ASSETS_PATH . '/NormaliseAccessMigrationHelperTest';\n }", "public function getThemePath()\n {\n return $this->getThemeBase() . '/' . $this->getThemeChoice();\n }", "function theme_path(string $path = ''){\n return base_path(config('theme.path').$path);\n }", "public function getThemeCssPath()\n {\n $themeDir = $this->getThemeDir();\n return Director::baseFolder() . '/' . $themeDir . '/css';\n }", "protected function getBasePath()\n {\n return ASSETS_PATH . '/VersionedFilesMigrationTest';\n }", "public function getCurrentThemeJsonPath()\n {\n return $this->getConfiguredBundlePath() . '/css/' . $this->getThemeChoice() . '/theme.json';\n }", "abstract public function getBasePath();", "protected function _getThemeDirDefault() {\n\t\treturn $this->getModuleDir() . '/views/themes/' . $this->getTheme();\t\n\t}", "public static function getBaseAssetPath(){\r\n\t\tglobal $params;\r\n\r\n\t\treturn sprintf(\r\n\t\t \"%s://%s%s\",\r\n\t\t isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',\r\n\t\t $params[\"framework\"][\"path\"][\"asset\"],\r\n\t\t \"\"\r\n\t\t );\r\n\t}", "function getBasepath(){\n\t\t// The absolute path of basePath\n\t\treturn realpath($this->basePath);\n\t}", "public static function base(): string\n {\n return realpath(__DIR__ . '/../..');\n }", "public function activeThemePath()\n {\n return base_path() .\n $this->config->get('theme::themes_dir') . '/' .\n $this->active;\n }", "private function getBaseTheme($theme) {\n $uri = drupal_get_path('theme', $theme) . \"/{$theme}.info.yml\";\n $theme_info = \\Symfony\\Component\\Yaml\\Yaml::parse(file_get_contents($uri));\n if (isset($theme_info['base theme'])) {\n return $theme_info['base theme'];\n }\n return '';\n }", "public function getThemeAssetURL()\n {\n return '/assets/_theme/' . $this->owner->ID;\n }", "function _getURLTheme($theme) \r\n {\r\n \treturn MIGUELBASE_THEME_URLDIR.$theme.'/';\r\n }", "function path_base ($path=''){ return realpath(__DIR__.\"/../\").DIRECTORY_SEPARATOR.$path; }", "private function determineAppNameFromBasePath() {\n return basename(realpath(\"{$this->currentDir}/../\")); // grab the folder that the project lives in.\n }", "public function getModulePath($base = self::DEFAULT_SOURCE)\n {\n if ($base === self::DEFAULT_TARGET) {\n return $this->getPublicPath();\n } else {\n return $this->getPath();\n }\n }", "public function base($base = null) {\r\n if ($base === null) {\r\n return $this->base;\r\n } else {\r\n $this->base = realpath($base);\r\n }\r\n }", "function getBasePath()\n\t{\n\t\treturn '../build/' . $this->strLang . '/test/';\n\t}", "public function getBasePath()\n {\n return config('repository.generator.basePath', app()->path());\n }", "function GetThemeResPath($resname, $restype, $themeid = NULL) {\n //set default theme id\n if (empty($themeid))\n $themeid = GetThemeID();\n\n //get system path\n $syspath = '';\n if (defined('IBC1_SYSTEM_ROOT'))\n $syspath = IBC1_SYSTEM_ROOT;\n\n //get relative path\n $sysrespath = $restype . '/' . $resname;\n $themerespath = 'themes/' . $themeid . '/' . $sysrespath;\n\n //validate\n if (is_file($syspath . $themerespath))\n return $themerespath;\n if (is_file($syspath . $sysrespath))\n return $sysrespath;\n\n //not found\n return '';\n}", "function get_child_theme_path($path = '')\n{\n\treturn get_stylesheet_directory() . '/' . ltrim($path, '/\\\\');\n}", "public function get_base_path() {\n\n\t\t$base_path = Plugin::instance()->files_manager->base_path() . 'export-skins/';\n\n\t\tif ( ! is_dir( $base_path ) ) {\n\t\t\tmkdir( $base_path );\n\t\t}\n\n\t\treturn $base_path;\n\n\t}", "function ms_themePath($theme = '') {\n $theme = $theme == '' ? THEME : $theme;\n return HTTP_TEMPLATE_PATH . \"/\" . $theme;\n}", "public function getThemeAssetsFolder()\n {\n $dir = Director::publicFolder() . $this->getThemeAssetURL();\n if (!is_dir($dir)) {\n mkdir($dir, 0755, true);\n }\n return $dir;\n }", "protected function _getBaseDir()\n {\n return Mage::getModuleDir('base', $this->_moduleName);\n }" ]
[ "0.67668", "0.6388616", "0.63452417", "0.6292744", "0.62259364", "0.6225035", "0.6170559", "0.6150623", "0.6148609", "0.61387706", "0.6116201", "0.60501724", "0.60377455", "0.6007506", "0.599685", "0.5985534", "0.5979213", "0.5967819", "0.5947438", "0.59339327", "0.59180605", "0.59173256", "0.58903813", "0.5887946", "0.58871615", "0.5885066", "0.5878691", "0.58773947", "0.58749163", "0.5863075" ]
0.74993193
0
Finds the Current Theme choice. E.g. "Bootstrap".
public function getThemeChoice() { return $this->getThemeEntity()->getThemeChoice(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_theme() {\n\t\treturn 'default';\n\t}", "protected function getTheme()\n\t{\n\t\treturn strtolower($this->argument('name'));\n\t}", "public function get_theme(){\n\t\t$theme = $this->Option->findByKey('cakecms_theme');\n\t\treturn $theme['Option']['value'];\n\t}", "function get_active_theme()\n{\n return 'default';\n}", "protected function getTheme()\n {\n if ($this->hasArgument('name')) {\n return strtolower($this->argument('name'));\n }\n\n return strtolower($this->option('name'));\n }", "public function getCurrentTheme()\n {\n return $this->getTheme($this->getCurrentThemeCode());\n }", "function fetch_theme()\n {\n global $chosen;\n return $chosen;\n }", "public function foodbakery_get_current_theme() {\n\n\t $foodbakery_theme = wp_get_theme();\n\n\t $theme_name = $foodbakery_theme->get('Name');\n\n\t return $theme_name;\n\n\t}", "function theme() {\r\n return \\query\\main::get_option( 'theme' );\r\n}", "public function getCurrentTheme()\n {\n return $this->currentTheme;\n }", "public static function get_theme():string { return self::$theme; }", "public function getTheme();", "public function getTheme();", "public function getTheme();", "public function getTheme()\n {\n return $this->getValue(self::KEY_DEFAULT_THEME);\n }", "protected function getDefaultTheme()\n {\n return Arrays::dotGet($this->options, 'template.theme', 'default');\n }", "public static function get_current_theme()\n {\n $current_page = ORM::factory('Page')->where_is_current()->find_published();\n\n // See if the theme is overwritten at page-level\n if ($current_page->theme) {\n $theme_name = $current_page->theme;\n }\n elseif (Settings::instance()->get('use_config_file')) {\n $theme_name = @Kohana::$config->load('config')->assets_folder_path;\n }\n else {\n $theme_name = Settings::instance()->get('assets_folder_path');\n }\n $theme = ORM::factory('Engine_Theme')->where('stub', '=', $theme_name)->find_published();\n\n return $theme;\n }", "public function getCurrent()\r\n {\r\n return $this->settingsRepository->get('theme', $this->defaultTheme);\r\n }", "public function getDefaultTheme()\n {\n return version_compare($this->upgradeVersion, '1.7.0.0', '>=') ?\n 'classic' : // 1.7\n 'default-bootstrap'; // 1.6\n }", "function GetTheme() {\n\tglobal $THEME_DIRS_ARR;\n\n\t$THEME_DIRS_ARR[$this->theme] ? $myTheme = $THEME_DIRS_ARR[$this->theme] : $myTheme = DEFAULT_THEME;\n\treturn ($myTheme);\n}", "function getSuitableTheme(){ \n\t\t$config = SiteConfig::current_site_config(); \n\t\t$device = '';\n\t\tif(MobileBrowserDetector::is_iphone()){\n\t\t\t$device = 'iphone';\n\t\t}elseif(MobileBrowserDetector::is_ipad()){\n\t\t\t$device = 'ipad';\n\t\t}elseif(MobileBrowserDetector::is_android()){\n\t\t\t$device = 'android';\n\t\t}elseif(MobileBrowserDetector::is_blackberry()){\n \t\t$device = 'blackberry';\n\t\t}\n\t\telseif(MobileBrowserDetector::is_palm()){\n \t\t$device = 'palm';\n\t\t} \n\t\t\n\t\tif(0 != strcmp($device, '') && $theme = DataObject::get_one('MobileDeviceTheme', \"Device = '{$device}' AND ConfigurationID = {$config->ID}\")){ \n\t\t\treturn $theme->Theme;\n\t\t}else{\n\t\t\treturn $config->MobileTheme;\n\t\t}\n\t}", "public function getTheme()\n\t{\n\t\treturn $this->getKeyValue('theme'); \n\n\t}", "public function current()\n {\n return (string)$this->config->get('system.pages.theme');\n }", "private function setActiveTheme()\n {\n // if ($this->app->runningInConsole() || ! app('asgard.isInstalled')) {\n // return;\n // }\n\n if ($this->inAdministration()) {\n $themeName = $this->app['config']->get('sorter.core.core.admin-theme');\n\n return $this->app['stylist']->activate($themeName, true);\n }\n\n $themeName = $this->app['setting.settings']->get('core::template', null, 'Flatly');\n\n return $this->app['stylist']->activate($themeName, true);\n }", "function getTheme () \r\n {\r\n \t$theme = Session::getValue('userinfo_theme');\r\n\t\t\r\n\t\tif(!Theme::existTheme($theme)){\r\n \t\t$theme = Session::getContextValue('theme');\r\n \t} \r\n\t\t\r\n \treturn Theme::_getPATHTheme($theme);;\r\n }", "public function getDefaultTheme()\n\t{\n\t\treturn $this->default_theme;\n\t}", "public function get_active_wpmu_theme() {\r\n\t\t$result = false;\r\n\t\t$is_network_admin = is_multisite() && ( is_network_admin() || ! empty( $_REQUEST['is_network'] ) );\r\n\r\n\t\t// Network-installations do not support this function.\r\n\t\tif ( $is_network_admin ) {\r\n\t\t\treturn $result;\r\n\t\t}\r\n\r\n\t\t$local_projects = $this->get_cached_projects();\r\n\t\t$current = get_option( 'stylesheet' );\r\n\t\tforeach ( $local_projects as $project_id => $project ) {\r\n\t\t\tif ( 'theme' == $project['type'] && $project['slug'] == $current ) {\r\n\t\t\t\t$result = $project_id;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $result;\r\n\t}", "public function getTheme(): string {\n\t\treturn $this->_theme;\n\t}", "public function getTheme() {\n\t\treturn self::$theme;\n\t}", "public function getTheme()\n {\n return $this->theme;\n }" ]
[ "0.75099105", "0.7451819", "0.73538005", "0.73535484", "0.7353282", "0.73227006", "0.7320808", "0.7320609", "0.7318849", "0.7292489", "0.7180572", "0.71518975", "0.71518975", "0.71518975", "0.7148864", "0.710153", "0.707791", "0.7051003", "0.7042207", "0.70136404", "0.7004246", "0.7000037", "0.69644624", "0.69179136", "0.6888917", "0.6785498", "0.6712926", "0.6686228", "0.6665884", "0.6661027" ]
0.75780463
0
Gets the Current Theme's theme.json file path.
public function getCurrentThemeJsonPath() { return $this->getConfiguredBundlePath() . '/css/' . $this->getThemeChoice() . '/theme.json'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getThemePath()\n {\n return $this->getThemeBase() . '/' . $this->getThemeChoice();\n }", "function get_theme_path()\n {\n static $themePath;\n\n if (!$themePath) {\n $themePath = PageTheme::getSiteTheme()->getThemeURL();\n }\n\n return $themePath;\n }", "private function getThemeRelativePath()\n {\n $theme = PageTheme::getSiteTheme();\n\n return $this->app->make('environment')->getURL(DIRNAME_THEMES . '/' . $theme->getThemeHandle(), $theme->getPackageHandle());\n }", "public function getCurrentThemeLocation(){\r\n\t\t// The default theme is /theme/default\r\n\t\t// Set Path\r\n\t\t$root = str_replace('index.php','',$_SERVER['SCRIPT_FILENAME']).'theme';\r\n\t\tif(isset($_SESSION[db::$config['session_prefix'].'_theme'])){\r\n\t\t\t// Check the theme directory exists...\r\n\t\t\tif(file_exists($root.'/'.$_SESSION[db::$config['session_prefix'].'_theme'].'/theme.txt')){\r\n\t\t\t\t// The file exists...\r\n\t\t\t\t$path = $root.'/'.$_SESSION[db::$config['session_prefix'].'_theme'].'/';\r\n\t\t\t\treturn $path;\r\n\t\t\t}else{\r\n\t\t\t\tunset($_SESSION[db::$config['session_prefix'].'_theme']);\r\n\t\t\t\t// Send back the default path\r\n\t\t\t\t$path = $root.'/default/';\r\n\t\t\t\treturn $path;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t// Send back the default path\r\n\t\t\t$path = $root.'/default/';\r\n\t\t\treturn $path;\r\n\t\t}\r\n\t}", "function wp_irving_site_theme_json_directory_path( $path ) {\n\treturn get_stylesheet_directory() . '/site-theme/';\n}", "public function activeThemePath()\n {\n return base_path() .\n $this->config->get('theme::themes_dir') . '/' .\n $this->active;\n }", "function theme_path($file = null)\n{\n\treturn 'themes/'.Config::get('wardrobe.theme').'/'.$file;\n}", "function _getPATHTheme($theme) \r\n {\r\n \treturn MIGUELBASE_THEME_DIR.$theme.'/';\r\n }", "public function getThemeBase()\n {\n return $this->getKernelRootDir() . '/../' . $this->themeBase;\n }", "public static function get_theme():string { return self::$theme; }", "protected function getThemeURL() {\n return \\Config::getInstance()->getThemeURL() . '/';\n }", "function get_theme_dir() {\n\treturn __DIR__;\n}", "public function foodbakery_get_current_theme() {\n\n\t $foodbakery_theme = wp_get_theme();\n\n\t $theme_name = $foodbakery_theme->get('Name');\n\n\t return $theme_name;\n\n\t}", "protected function _getThemeDirDefault() {\n\t\treturn $this->getModuleDir() . '/views/themes/' . $this->getTheme();\t\n\t}", "public function getPath(): ?string\n {\n if (isset($this->config['theme'])) {\n return ltrim($this->config['theme'], '/');\n }\n return null;\n }", "public function getCurrentTheme()\n {\n return $this->currentTheme;\n }", "public function getCurrent()\r\n {\r\n return $this->settingsRepository->get('theme', $this->defaultTheme);\r\n }", "function theme_path(string $path = ''){\n return base_path(config('theme.path').$path);\n }", "function getTheme () \r\n {\r\n \t$theme = Session::getValue('userinfo_theme');\r\n\t\t\r\n\t\tif(!Theme::existTheme($theme)){\r\n \t\t$theme = Session::getContextValue('theme');\r\n \t} \r\n\t\t\r\n \treturn Theme::_getPATHTheme($theme);;\r\n }", "public static function get_themes_dir()\n {\n if ( ! function_exists('get_theme_root')) {\n return \\WP_CLI_FileSystem::path_join(getcwd(), 'wp-content/themes');\n } else {\n return \\WP_CLI_FileSystem::normalize_path(get_theme_root());\n }\n }", "public function getTheme(): string {\n\t\treturn $this->_theme;\n\t}", "public function getThemeAssetURL()\n {\n return '/assets/_theme/' . $this->owner->ID;\n }", "public static function themePath($theme) {\n\t\t$themeDir = 'Themed' . DS . Inflector::camelize($theme);\n\t\tforeach (self::$_packages['View'] as $path) {\n\t\t\tif (is_dir($path . $themeDir)) {\n\t\t\t\treturn $path . $themeDir . DS;\n\t\t\t}\n\t\t}\n\t\treturn self::$_packages['View'][0] . $themeDir . DS;\n\t}", "function _getURLTheme($theme) \r\n {\r\n \treturn MIGUELBASE_THEME_URLDIR.$theme.'/';\r\n }", "public function getThemeCssPath()\n {\n $themeDir = $this->getThemeDir();\n return Director::baseFolder() . '/' . $themeDir . '/css';\n }", "public static function get_current_theme()\n {\n $current_page = ORM::factory('Page')->where_is_current()->find_published();\n\n // See if the theme is overwritten at page-level\n if ($current_page->theme) {\n $theme_name = $current_page->theme;\n }\n elseif (Settings::instance()->get('use_config_file')) {\n $theme_name = @Kohana::$config->load('config')->assets_folder_path;\n }\n else {\n $theme_name = Settings::instance()->get('assets_folder_path');\n }\n $theme = ORM::factory('Engine_Theme')->where('stub', '=', $theme_name)->find_published();\n\n return $theme;\n }", "private static function askForThemesPath()\n {\n $themes_path = Dialog::getAnswer('Please provide themes directory path [wp-content/themes]:', 'wp-content/themes');\n return $themes_path ?: self::askForThemesPath();\n }", "public function get_acf_json_path() {\n\t\t\treturn plugin_dir_path( $this->file ) . 'acf-json';\n\t\t}", "public function getCustomizationPath(\\Magento\\Framework\\View\\Design\\ThemeInterface $theme)\n {\n $path = null;\n if ($theme->getId()) {\n $path = $this->mediaDirectoryRead->getAbsolutePath(self::DIR_NAME . '/' . $theme->getId());\n }\n return $path;\n }", "function eedt_theme_path()\n\t{\n\t\t$path = '';\n\t\tif(defined('PATH_THIRD_THEMES'))\n\t\t{\n\t\t\t$path = PATH_THIRD_THEMES;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$ee =& get_instance();\n\t\t\t$path = rtrim($ee->config->config['theme_folder_path'], '/') .'/third_party/';\n\t\t}\n\n\t\treturn $path;\n\t}" ]
[ "0.7825746", "0.7802188", "0.7519797", "0.7419283", "0.7367802", "0.72714776", "0.7220604", "0.7201144", "0.70304376", "0.69911164", "0.69656956", "0.6958731", "0.68870604", "0.6834625", "0.6827882", "0.6797755", "0.67891616", "0.67887914", "0.67861015", "0.6775206", "0.6736279", "0.67250067", "0.6721411", "0.6717001", "0.6700371", "0.6678637", "0.66672903", "0.66670996", "0.6650883", "0.6650726" ]
0.8764826
0
Saves the Theme modifications into a theme.json file in the current theme folder. $themeData should contain json key and optionally css keys. When the css key is provided, the css is saved and the theme is installed. This expects the the css would have been compiled if the css export option was chosen when instantiation a Cluckles (The theme editor JS) instance. When this is the case we can avoid server side compilation of the Css by parsing the JSON modifications with $lessParser>ModifyVars() in generateTheme, which tends to take a long time and timeout on shared hosts. If you do have problems with saving themes timing out, then enable the css export option in Cluckles (See for that.
public function saveTheme($themeData) { // Get the current theme folder $themePath = $this->getThemePath(); // Decode the JSON into an array $themeData = json_decode($themeData, true); // Save the theme.json file in the current theme folder file_put_contents($themePath . '/theme.json', json_encode($themeData['json'])); // If the CSS has been provided, it would have already been compiled Client Side if (array_key_exists('css', $themeData)) { // So Save the Compiled CSS file_put_contents($themePath . '/theme.css', $themeData['css']); // Now install the Theme and Skip generating the Css server side // This avoids problems with the generating failing on shared hosting // where the PHP will timeout return $this->installTheme(); } // Now generate the theme using bootstrap.less + theme.json return $this->generateTheme(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function saveThemeConfigs() {\n\n $id_shop = Context::getContext()->shop->id;\n $customName = $id_shop.'custom';\n\n //add new file if don't exist\n if (!file_exists($this->themePath . 'css/local/'.$customName.'.css')) {\n if (!is_dir($this->themePath . 'css/local/')) {\n mkdir($this->themePath . 'css/local/', 755);\n }\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, \"\", 'css');\n }\n\n if (!file_exists($this->themePath . 'js/local/'.$customName.'.js')) {\n if (!is_dir($this->themePath . 'js/local/')) {\n mkdir($this->themePath . 'js/local/', 755);\n }\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, \"\", 'js');\n }\n\n\n $t = $this->themePath . 'css/local/'.$customName.'.css';\n if (is_dir($this->themePath . 'css/local/')) {\n if (is_writeable($t)) {\n $css = trim(Tools::getValue($this->getConfigName('C_CODECSS')));\n if ($css) {\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, $css, 'css');\n } else if (file_exists($t) && filesize($t)) {\n @unlink($t);\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, \"\", 'css');\n }\n }\n }\n\n $t = $this->themePath . 'js/local/'.$customName.'.js';\n if (is_dir($this->themePath . 'js/local/')) {\n if (is_writeable($t)) {\n $js = trim(Tools::getValue($this->getConfigName('C_CODEJS')));\n if ($js) {\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, $js, 'js');\n } else if (file_exists($t) && filesize($t)) {\n @unlink($t);\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, \"\", 'js');\n }\n }\n }\n\n\n $languages = Language::getLanguages(false);\n $this->makeFieldsOptions();\n $content = '';\n //echo \"<pre>\";print_r($this->fields_options);die;\n foreach ($this->fields_options as $f) {\n foreach ($f['form']['input'] as $input) {\n if ($input['name'] == $this->getConfigName('C_CODECSS')) {\n continue;\n }\n if (isset($input['lang'])) {\n $data = array();\n foreach ($languages as $lang) {\n $v = Tools::getValue(trim($input['name']) . '_' . $lang['id_lang']);\n $data[$lang['id_lang']] = $v ? $v : $input['default'];\n }\n Configuration::updateValue(trim($input['name']), $data);\n } else {\n $v = Tools::getValue($input['name'], Configuration::get($input['name']));\n $dataSave = $v ? $v : $input['default'];\n Configuration::updateValue(trim($input['name']), $dataSave );\n if(trim($input['name']) == $this->getConfigName('listing_mode')){\n if(trim($dataSave) == '') $dataSave = 'grid';\n $content .= '\n{assign var=\"LISTING_GRIG_MODE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column')){\n if(trim($dataSave) == '') $dataSave = '3';\n $content .= '\n{assign var=\"LISTING_PRODUCT_COLUMN\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_tablet')){\n if(trim($dataSave) == '') $dataSave = '2';\n $content .= '\n{assign var=\"LISTING_PRODUCT_TABLET\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_mobile')){\n if(trim($dataSave) == '') $dataSave = '1';\n $content .= '\n{assign var=\"LISTING_PRODUCT_MOBILE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_module')){\n if(trim($dataSave) == '') $dataSave = '4';\n $content .= '\n{assign var=\"LISTING_PRODUCT_COLUMN_MODULE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_color')){\n $content .= '\n{assign var=\"ENABLE_COLOR\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_wishlist')){\n $content .= '\n{assign var=\"ENABLE_WISHLIST\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_responsive')){\n $content .= '{assign var=\"ENABLE_RESPONSIVE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }\n }\n }\n }\n if (is_writeable($this->themePath . 'layout/setting.tpl')) {\n $content .= '\n{if $LISTING_PRODUCT_COLUMN==\"5\"}\n {assign var=\"colValue\" value=\"col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-2-4\" scope=\"global\"}\n{else}\n {assign var=\"colValue\" value=\"col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-{12/$LISTING_PRODUCT_COLUMN}\" scope=\"global\"}\n{/if}';\n\n LeoFrameworkHelper::writeToCache($this->themePath . 'layout/', 'setting', $content, 'tpl');\n }\n\n }", "public function saveData($theme = null)\n {\n $themeVersion = null;\n\n if(is_null($theme)) {\n $theme = new Theme();\n $themeVersion = new ThemeVersion();\n } else {\n $themeVersion = $theme->versions()->where('version', $this->config['version'])->first();\n }\n\n $theme['name'] = $this->config['name'];\n $theme->save();\n\n $themeVersion['sha1'] = $this->config['sha1'];\n $themeVersion['version'] = $this->config['version'];\n $themeVersion['requirements'] = $this->config['requirements'];\n $themeVersion['document_url'] = $this->config['document_url'];\n $themeVersion['has_free'] = $this->config['has_free'];\n $themeVersion['free_url'] = $this->config['free_url'];\n $themeVersion['description'] = $this->config['description'];\n $themeVersion['thumbnail'] = $this->config['thumbnail'];\n $themeVersion['thumbnail_tiny'] = $this->config['thumbnail_tiny'];\n $themeVersion['release_at'] = date('Y-m-d H:i:s');\n $themeVersion['store_at'] = sprintf('%s/%s', $this->themeTargetPath, $this->zipThemeFileName);\n $themeVersion['store_type'] = 'local';\n $theme->versions()->save($themeVersion);\n\n $tags = [];\n foreach ($this->config['categories'] as $category) {\n $tag = new Tag();\n $tag['name'] = $category;\n $tag['type'] = 'theme_category';\n $tags[] = $tag;\n }\n foreach ($this->config['types'] as $type) {\n $tag = new Tag();\n $tag['name'] = $type;\n $tag['type'] = 'theme_type';\n $tags[] = $tag;\n }\n\n // detach old tags to the theme version then attach the new tags\n $oldTags = $themeVersion->tags;\n $themeVersion->tags()->detach();\n foreach ($oldTags as $oldTag) {\n $oldTag->delete();\n }\n $themeVersion->tags()->saveMany($tags);\n\n $themeVersionShowcases = [];\n foreach ($this->config['showcases'] as $showcase) {\n $themeVersionShowcase = new ThemeVersionShowcase();\n $themeVersionShowcase['name'] = $showcase['name'];\n $themeVersionShowcase['title'] = $showcase['title'];\n $themeVersionShowcases[] = $themeVersionShowcase;\n }\n\n // delete the old showcases and save the new showcases\n $oldShowcases = $themeVersion->showcases;\n foreach ($oldShowcases as $oldShowcase) {\n $oldShowcase->delete();\n }\n $themeVersion->showcases()->saveMany($themeVersionShowcases);\n\n return $theme;\n }", "public function store_theme_data( $theme_data ) {\n\n\t\t\tif ( isset( $_REQUEST['action'] ) && 'jet_theme_wizard_install_parent' === $_REQUEST['action'] ) {\n\t\t\t\tupdate_option( jet_theme_wizard()->settings['options']['parent_data'], $theme_data );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isset( $_REQUEST['action'] ) && 'jet_theme_wizard_install_child' === $_REQUEST['action'] ) {\n\t\t\t\tupdate_option( jet_theme_wizard()->settings['options']['child_data'], $theme_data );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}", "public function create_theme($data)\n {\n \n //Validate input.\n $data = Data($data)->having('name', 'title')\n ->name->validate('Theme name', array('required', 'string', 'not_empty', 'component_name'))->back()\n ->title->validate('Theme title', array('required', 'string', 'not_empty'))->back();\n \n //What's the path?\n $path = PATH_THEMES.DS.$data->name;\n \n //Define basic sub-folders.\n $subpaths = array(\n 'package' => '.package',\n 'css' => 'css',\n 'img' => 'img'\n );\n \n $gitignore = array(\n 'img'\n );\n \n //Where to copy some template files.\n $copy = array(\n array(null, 'theme.php'),\n array('css', 'style.css'),\n array('package', '.htaccess'),\n array('package', 'DBUpdates.php'),\n array('package', 'package.json')\n );\n \n //The strings to replace inside template files.\n $replace = array(\n '{{TITLE}}' => $data->title->get('string'),\n '{{NAME}}' => $data->name->get('string')\n );\n \n //Perform the filling of the folder.\n $this->make_it('theme', $path, $subpaths, $gitignore, $copy, $replace);\n \n //That should be it!\n return $path;\n \n }", "public function save($data)\n {\n $theme = $this->getRepository()->find($data['id']);\n\n $this->get('theme_service')->saveConfig(\n $theme,\n $data['values']\n );\n\n return ['success' => true];\n }", "public function store( $data ){\n\t\n\t \t$app\t= JFactory::getApplication();\n\t\t$user\t= JFactory::getUser();\n\t\t$id\t\t= $data['theme_id'];\n\t\t\n\t\t$parse_css\t\t= $this->_parseCss( $data['data'] );\n\t\t$theme_styles\t= $this->_generateCss( $parse_css, 'theme_styles.css', $data['theme_id'] );\n\t\t\n\t\t\n\t\t$row\t= $this->getTable();\n\t\t$active = $user->get( 'active_team' );\n\t \t\n\t\t$jsondata = json_encode( $data['data'] );\n\t\tunset( $data['data'] );\t\t\n\t\t\n\t\t$data['theme_data'] = $jsondata;\n\t\t\n\t \tif( !$row->bind( $data ) ){\n\t \t\n\t\t\t$this->setError($this->_db->getErrorMsg());\n\t\t\treturn false;\n\t\t\n\t\t}\n\t\t\n\t\tif( !$row->theme_id ){ \t\n\t\t\n\t\t\t$is_new = 1;\n\t\t\t$row->theme_created_by\t= $user->id;\n\t\t\n\t\t}else{\n\t\t\t\n\t\t\t$date = JFactory::getDate();\n\t\t\t$row->theme_modified_by\t= $user->id;\n\t\t\t$row->theme_modified\t= $date->toSql();\t\t\t\n\t\t\t$row->version++;\n\t\t\n\t\t}\n\t\t\n\t\t//alright, good to go. Store it to the Joomla db\n\t\tif( !$row->store() ){\n\t\t\n\t\t\t$this->setError($this->_db->getErrorMsg());\n\t\t\treturn false;\n\t\t\n\t\t}\n\t\t\n\t\treturn $row;\n\t\t\n\t}", "public function generateTheme()\n {\n // Get the current theme folder\n $themePath = $this->getThemePath();\n \n // Create a Less parse so we can compile the theme\n $lessParser = new \\Less_Parser();\n\n // If a theme.json file already exist, we can use the details inside to apply\n // custom modifications to the base bootstrap theme\n if (file_exists($themePath . '/theme.json')) {\n $themeOptions = file_get_contents($themePath . '/theme.json');\n $themeOptions = json_decode($themeOptions);\n }\n\n // Try to parse the source files and modify the variables if theme.json exists\n try {\n $lessParser->parseFile($this->getKernelRootDir() . '/../vendor/ilp/bootstrap-theme-bundle/ILP/BootstrapThemeBundle/Resources/public/Cluckles/build/less/bootstrap.less');\n \n if (isset($themeOptions)) {\n $lessParser->ModifyVars($themeOptions);\n }\n } catch (Exception $ex) {\n }\n\n // Now get the compiled CSS and save it in the current theme folder\n $compiledCss = $lessParser->getCss();\n\n // Save the compiled theme file to the current Theme directory\n file_put_contents($themePath . '/theme.css', $compiledCss);\n \n // Now Install/Dump the Theme so the changes to the css files will appear\n return $this->installTheme();\n }", "public function theme() {\n\t\t$this->set('pageTitle', __('Change theme: %s', $this->Auth->user('name')));\n\t\t$this->set('subTitle', __(''));\n\t\t$model = ClassRegistry::init(\"UserSetting\");\n\t\t$currentTheme = $model->findByNameAndUserId(\"UserInterface.theme\", $this->Auth->user('id'));\n\t\tif ($this->request->is('post')) {\n\n\t\t\t$data = $this->_cleanPost(array(\"Setting.UserInterface.theme\"));\n\t\t\t$save = array('UserSetting' => array(\n\t\t\t\t'user_id' => $this->Auth->user('id'),\n\t\t\t\t'name' => 'UserInterface.theme',\n\t\t\t\t'value' => (string)$data['Setting']['UserInterface']['theme']\n\t\t\t));\n\n\t\t\tif (!empty($currentTheme)) {\n\t\t\t\t$save['UserSetting']['id'] = $currentTheme['UserSetting']['id'];\n\t\t\t}\n\n\t\t\tif ($model->save($save)) {\n\t\t\t\t$this->Session->setFlash(__('Your changes have been saved.'), 'default', array(), 'success');\n\t\t\t\treturn $this->redirect(array('action' => 'theme'));\n\t\t\t} else {\n\t\t\t\t$this->Session->setFlash(__('There was a problem saving your changes. Please try again.'), 'default', array(), 'error');\n\t\t\t}\n\t\t}\n\n\t\tif (!empty($currentTheme)) {\n\t\t\t$currentTheme = $currentTheme['UserSetting']['value'];\n\t\t} else {\n\t\t\t$currentTheme = 'default';\n\t\t}\n\n\t\t$this->request->data['Setting'] = array('UserInterface' => array('theme' => $currentTheme));\n\t\t$this->set('username', $this->Auth->user('name'));\n\t}", "public function pre_set_site_transient_update_themes( $data ){\n\n\t\tforeach ( $this->config as $theme ) {\n\t\t\tif ( empty( $theme->uri ) ) continue;\n\n\t\t\t// setup update array to append version info\n\t\t\t$update = array();\n\t\t\t$update['new_version'] = $theme->newest_tag;\n\t\t\t$update['url'] = $theme->uri;\n\t\t\t$update['package'] = $theme->download_link;\n\n\t\t\tif ( version_compare( $theme->local_version, $theme->newest_tag, '>=' ) ) {\n\t\t\t\t// up-to-date!\n\t\t\t\t$data->up_to_date[ $theme->repo ]['rollback'] = $theme->tags;\n\t\t\t\t$data->up_to_date[ $theme->repo ]['response'] = $update;\n\t\t\t} else {\n\t\t\t\t$data->response[ $theme->repo ] = $update;\n\t\t\t}\n\t\t}\n\t\treturn $data;\n\t}", "function theme_get_theme_archive() {\n if (isset($_REQUEST['id'])) {\n $theme = wp_get_theme($_REQUEST['id']);\n if (!$theme->exists())\n throw new Exception('Error: Theme '.$_REQUEST['id'].' does not exists');\n } else {\n $theme = wp_get_theme();\n }\n\n $current_name = get_template();\n $name = $theme->get_template();\n\n $base_template_dir = $theme->get_template_directory();\n $preview_template_dir = $base_template_dir . '_preview';\n\n if (!file_exists($base_template_dir) || $current_name === $name && !file_exists($preview_template_dir)) {\n throw new Exception('Error: No Theme Folders');\n }\n\n $base_upload_dir = wp_upload_dir();\n if (false !== $base_upload_dir['error']) {\n throw new Exception('Upload folder error!');\n }\n require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');\n\n $archive_name = 'theme_' . uniqid(time()) . '.zip';\n $archive_file = $base_upload_dir['basedir'] . '/' . $archive_name;\n\n $new_name = isset($_REQUEST['themeName']) ? $_REQUEST['themeName'] : $name;\n $editable_version = !isset($_REQUEST['includeEditor']) || $_REQUEST['includeEditor'] === 'true';\n $include_content = isset($_REQUEST['includeContent']) && $_REQUEST['includeContent'] === 'true';\n\n if (!$new_name)\n throw new Exception('Error: theme name is empty');\n\n if ($current_name !== $name && $new_name !== $name)\n throw new Exception(\"Error: renaming not active theme does not supported ($current_name, $name, $new_name)\");\n\n if ($current_name === $name) {\n theme_set_name($base_template_dir . '/style.css', $new_name);\n theme_set_name($preview_template_dir . '/style.css', theme_get_preview_theme_name($new_name));\n FilesHelper::empty_dir($base_template_dir . '/preview', true);\n }\n $preview_new_template = $new_name . '_preview';\n $archive = new PclZip($archive_file);\n\n // move old content to tmp folder\n $tmp_content_dir = $base_upload_dir['basedir'] . '/theme-content';\n FilesHelper::empty_dir($tmp_content_dir, true);\n FilesHelper::rename_if_exists($base_template_dir . '/content', $tmp_content_dir);\n\n if (0 == $archive->create($base_template_dir,\n PCLZIP_OPT_ADD_PATH, $new_name,\n PCLZIP_OPT_REMOVE_PATH, $base_template_dir))\n throw new Exception(\"Error: \" . $archive->errorInfo(true));\n\n if ($editable_version) {\n if ($current_name === $name && 0 == $archive->add($preview_template_dir,\n PCLZIP_OPT_ADD_PATH, $new_name . '/preview/' . $preview_new_template,\n PCLZIP_OPT_REMOVE_PATH, $preview_template_dir))\n throw new Exception(\"Error: \" . $archive->errorInfo(true));\n } else {\n if (($list = $archive->listContent()) == 0)\n throw new Exception(\"Error : \" . $archive->errorInfo(true));\n\n $remove_list = array();\n foreach ($list as $i => $file) {\n if (\n strpos($file['filename'], \"$new_name/export/\") !== false\n || strpos($file['filename'], \".preview.\") !== false\n )\n $remove_list[] = \"$i\";\n }\n\n if (!empty($remove_list) && 0 == $archive->delete(PCLZIP_OPT_BY_INDEX, implode(',', $remove_list)))\n throw new Exception(\"Error: cannot remove export dir\");\n }\n\n if ($include_content) {\n $content_dir = theme_include_content();\n if (false !== $content_dir) {\n if (0 == $archive->add($content_dir,\n PCLZIP_OPT_ADD_PATH, $new_name . '/content/',\n PCLZIP_OPT_REMOVE_PATH, $content_dir)) {\n throw new Exception(\"Content-zip error: \" . $archive->errorInfo(true));\n }\n }\n }\n\n // restore content folder\n FilesHelper::rename_if_exists($tmp_content_dir, $base_template_dir . '/content');\n\n if ($current_name === $name) {\n theme_set_name($base_template_dir . '/style.css', $current_name);\n theme_set_name($preview_template_dir . '/style.css', theme_get_preview_theme_name($current_name));\n }\n return array(\n 'path' => $archive_file,\n 'name' => $new_name\n );\n}", "private function saveRecycleThemeAdmin($param, $theme_info){\r\n\t\t$insert = array();\r\n\t\t$insert['member_id']\t\t= $theme_info['member_id'];\r\n\t\t$insert['member_name']\t\t= $theme_info['member_name'];\r\n\t\t$insert['circle_id']\t\t= $theme_info['circle_id'];\r\n\t\t$insert['circle_name']\t\t= $theme_info['circle_name'];\r\n\t\t$insert['theme_name']\t\t= $theme_info['theme_name'];\r\n\t\t$insert['recycle_content']\t= $theme_info['theme_content'];\r\n\t\t$insert['recycle_opid']\t\t= $param['op_id'];\r\n\t\t$insert['recycle_opname']\t= $param['op_name'];\r\n\t\t$insert['recycle_type']\t\t= 1;\r\n\t\t$insert['recycle_time']\t\t= time();\r\n\t\treturn $this->add($insert);\r\n\t}", "function __preRun_Theme()\n {\n\n //currently specified theme\n $current_theme = $this->data['fields']['settings_general']['theme']; //get content of language folder\n $themes_folder = directory_map(PATHS_APPLICATION_FOLDER . 'themes', false, false);\n /* get each 'folder' name (only folders in first level)\n * - at this first stage, we only check the admin themes\n * - assume its a valid theme\n * - add it to array and pulldown\n */\n $this->data['lists']['all_themes'] = '';\n foreach ($themes_folder as $key => $value) {\n\n //add folder name to theme array\n $this->data['themes_available'][] = $key; //add folder name to pull down list\n $this->data['lists']['all_themes'] .= '<option value=\"' . $key . '\">' . ucfirst($key) . '</option>';\n }\n\n // check if theme that is currently set in settings_general, physically exists\n if (!in_array($current_theme, $this->data['themes_available'])) {\n\n //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n $message = '<b>File: </b>' . __file__ . '<br/>\n <b>Function: </b>' . __function__ . '<br/>\n <b>Line: </b>' . __line__ . '<br/>\n <b>Notes: </b> Specified theme could not be found (' . $current_theme . ')'; //display error\n show_error($message, 500); //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n\n }\n\n /* now save the current theme in a constant for global use\n * also set the client theme to same name\n */\n define('PATHS_ADMIN_THEME', FCPATH . \"application/themes/$current_theme/admin/\");\n define('PATHS_CLIENT_THEME', FCPATH . \"application/themes/$current_theme/client/\");\n define('PATHS_COMMON_THEME', FCPATH . \"application/themes/$current_theme/common/\"); //check if client theme/folder also exists\n if (!is_dir(PATHS_CLIENT_THEME)) {\n\n //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n $message = '<b>File: </b>' . __file__ . '<br/>\n <b>Function: </b>' . __function__ . '<br/>\n <b>Line: </b>' . __line__ . '<br/>\n <b>Notes: </b> Specified [client] theme could not be found (' . $current_theme . ')'; //display error\n show_error($message, 500); //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n\n }\n }", "function setTheme($cssFile)\n\t{\n\t\t$cssFile\t\t\t\t=\tsubstr($cssFile, 0, -4);\n\t\t\n\t\t$file\t\t\t\t\t=\tfile(\"config.php\");\n\t\t$new_file\t\t\t\t=\tarray();\n\t\t\n\t\t// Search Variabeln\n\t\t$search_lang\t\t\t=\t'STYLE';\n\t\t\n\t\t// Dateiliste neu schreiben\n\t\tfor ($i = 0; $i < count($file); $i++)\n\t\t{\n\t\t\tif(strpos($file[$i], $search_lang))\n\t\t\t{\n\t\t\t\t$new_file[$i]\t\t=\t\"\\tdefine(\\\"STYLE\\\", \\\"\" . $cssFile . \"\\\");\\n\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$new_file[$i]\t\t=\t$file[$i];\n\t\t\t};\n\t\t};\n\t\t\n\t\t// Dateien übertragen\n\t\tfile_put_contents(\"config.php\", \"\");\n\t\tfile_put_contents(\"config.php\", $new_file);\n\t\t\n\t\twriteInLog(4, $_SESSION['user']['benutzer'].\": Change the theme to '\".$cssFile.\"'!\", true);\n\t\t\n\t\treturn true;\n\t}", "function _sp_save_theme_mods() {\t\n\t$spdata = _sp_get_data();\n\n\t// save theme mod settings into theme data\n\t$theme_mods = get_theme_mods(); // array\n\n\t// save the theme data with theme mods added\n\t$spdata['theme_mods'] = $theme_mods;\n\t_sp_save_data( $spdata );\n\n\treturn true;\t\n}", "private function saveRecycleTheme($param){\r\n\t\t$theme_info = $this->themeInfo($param);\r\n\t\tif(empty($theme_info)) return false;\r\n\t\t$insert = array();\r\n\t\t$insert['member_id']\t\t= $theme_info['member_id'];\r\n\t\t$insert['member_name']\t\t= $theme_info['member_name'];\r\n\t\t$insert['circle_id']\t\t= $theme_info['circle_id'];\r\n\t\t$insert['circle_name']\t\t= $theme_info['circle_name'];\r\n\t\t$insert['theme_name']\t\t= $theme_info['theme_name'];\r\n\t\t$insert['recycle_content']\t= $theme_info['theme_content'];\r\n\t\t$insert['recycle_opid']\t\t= $param['op_id'];\r\n\t\t$insert['recycle_opname']\t= $param['op_name'];\r\n\t\t$insert['recycle_type']\t\t= 1;\r\n\t\t$insert['recycle_time']\t\t= time();\r\n\t\treturn $this->add($insert);\r\n\t}", "public function manageportalTheme($action,$themeId,$themeName,$themeFile,$updatedBy)\n\t{\n\t\t$path\t= commonClass::webPath();\n\t\tcommonClass::isSpclChar($action,$path.'home');\n\t\tcommonClass::isSpclChar($themeId,$path.'home');\n\t\tcommonClass::isSpclChar($themeName,$path.'home');\n\t\tcommonClass::isSpclChar($themeFile,$path.'home');\n\t\tcommonClass::isSpclChar($updatedBy,$path.'home');\n\t\t$themeSql=\"CALL USP_THEME_MASTER('$action','$themeId','$themeName','$themeFile','$updatedBy',@out);\";\n\t\t$themeResult\t= commonClass::ExecuteQuery($themeSql);\n\t\treturn $themeResult;\n\t}", "function theme_essential_process_css($css, $theme)\r\n{\r\n $pagewidth = theme_essential_get_setting('pagewidth');\r\n $css = theme_essential_set_pagewidth($css, $pagewidth);\r\n\r\n // Set the theme font\r\n $headingfont = theme_essential_get_setting('fontnameheading');\r\n $bodyfont = theme_essential_get_setting('fontnamebody');\r\n\r\n $css = theme_essential_set_headingfont($css, $headingfont);\r\n $css = theme_essential_set_bodyfont($css, $bodyfont);\r\n $css = theme_essential_set_fontfiles($css, 'heading', $headingfont, $theme);\r\n $css = theme_essential_set_fontfiles($css, 'body', $bodyfont, $theme);\r\n\r\n // Set the theme colour.\r\n $themecolor = theme_essential_get_setting('themecolor');\r\n $css = theme_essential_set_color($css, $themecolor, '[[setting:themecolor]]', '#30ADD1');\r\n\r\n // Set the theme text colour.\r\n $themetextcolor = theme_essential_get_setting('themetextcolor');\r\n $css = theme_essential_set_color($css, $themetextcolor, '[[setting:themetextcolor]]', '#047797');\r\n\r\n // Set the theme url colour.\r\n $themeurlcolor = theme_essential_get_setting('themeurlcolor');\r\n $css = theme_essential_set_color($css, $themeurlcolor, '[[setting:themeurlcolor]]', '#FF5034');\r\n\r\n // Set the theme hover colour.\r\n $themehovercolor = theme_essential_get_setting('themehovercolor');\r\n $css = theme_essential_set_color($css, $themehovercolor, '[[setting:themehovercolor]]', '#F32100');\r\n\r\n // Set the theme icon colour.\r\n $themeiconcolor = theme_essential_get_setting('themeiconcolor');\r\n $css = theme_essential_set_color($css, $themeiconcolor, '[[setting:themeiconcolor]]', '#30ADD1');\r\n\r\n // Set the theme navigation colour.\r\n $themenavcolor = theme_essential_get_setting('themenavcolor');\r\n $css = theme_essential_set_color($css, $themenavcolor, '[[setting:themenavcolor]]', '#ffffff');\r\n\r\n // Set the footer colour.\r\n $footercolor = theme_essential_hex2rgba(theme_essential_get_setting('footercolor'), '0.95');\r\n $css = theme_essential_set_color($css, $footercolor, '[[setting:footercolor]]', '#555555');\r\n\r\n // Set the footer text color.\r\n $footertextcolor = theme_essential_get_setting('footertextcolor');\r\n $css = theme_essential_set_color($css, $footertextcolor, '[[setting:footertextcolor]]', '#bbbbbb');\r\n\r\n // Set the footer heading colour.\r\n $footerheadingcolor = theme_essential_get_setting('footerheadingcolor');\r\n $css = theme_essential_set_color($css, $footerheadingcolor, '[[setting:footerheadingcolor]]', '#cccccc');\r\n\r\n // Set the footer separator colour.\r\n $footersepcolor = theme_essential_get_setting('footersepcolor');\r\n $css = theme_essential_set_color($css, $footersepcolor, '[[setting:footersepcolor]]', '#313131');\r\n\r\n // Set the footer URL color.\r\n $footerurlcolor = theme_essential_get_setting('footerurlcolor');\r\n $css = theme_essential_set_color($css, $footerurlcolor, '[[setting:footerurlcolor]]', '#217a94');\r\n\r\n // Set the footer hover colour.\r\n $footerhovercolor = theme_essential_get_setting('footerhovercolor');\r\n $css = theme_essential_set_color($css, $footerhovercolor, '[[setting:footerhovercolor]]', '#30add1');\r\n\r\n // Set the slide background colour.\r\n $slidebgcolor = theme_essential_hex2rgba(theme_essential_get_setting('themecolor'), '.75');\r\n $css = theme_essential_set_color($css, $slidebgcolor, '[[setting:carouselcolor]]', '#30add1');\r\n\r\n // Set the slide active pip colour.\r\n $slidebgcolor = theme_essential_hex2rgba(theme_essential_get_setting('themecolor'), '.25');\r\n $css = theme_essential_set_color($css, $slidebgcolor, '[[setting:carouselactivecolor]]', '#30add1');\r\n\r\n // Set the slide header colour.\r\n $slideshowcolor = theme_essential_get_setting('slideshowcolor');\r\n $css = theme_essential_set_color($css, $slideshowcolor, '[[setting:slideshowcolor]]', '#30add1');\r\n\r\n // Set the slide header colour.\r\n $slideheadercolor = theme_essential_get_setting('slideheadercolor');\r\n $css = theme_essential_set_color($css, $slideheadercolor, '[[setting:slideheadercolor]]', '#30add1');\r\n\r\n // Set the slide text colour.\r\n $slidecolor = theme_essential_get_setting('slidecolor');\r\n $css = theme_essential_set_color($css, $slidecolor, '[[setting:slidecolor]]', '#ffffff');\r\n\r\n // Set the slide button colour.\r\n $slidebuttoncolor = theme_essential_get_setting('slidebuttoncolor');\r\n $css = theme_essential_set_color($css, $slidebuttoncolor, '[[setting:slidebuttoncolor]]', '#30add1');\r\n\r\n // Set the slide button hover colour.\r\n $slidebuttonhcolor = theme_essential_get_setting('slidebuttonhovercolor');\r\n $css = theme_essential_set_color($css, $slidebuttonhcolor, '[[setting:slidebuttonhovercolor]]', '#217a94');\r\n\r\n if ((get_config('theme_essential', 'enablealternativethemecolors1')) ||\r\n (get_config('theme_essential', 'enablealternativethemecolors2')) ||\r\n (get_config('theme_essential', 'enablealternativethemecolors3'))\r\n ) {\r\n // Set theme alternative colours.\r\n $defaultcolors = array('#a430d1', '#d15430', '#5dd130');\r\n $defaulthovercolors = array('#9929c4', '#c44c29', '#53c429');\r\n\r\n foreach (range(1, 3) as $alternative) {\r\n $default = $defaultcolors[$alternative - 1];\r\n $defaulthover = $defaulthovercolors[$alternative - 1];\r\n $css = theme_essential_set_alternativecolor($css, 'color' . $alternative,\r\n theme_essential_get_setting('alternativethemehovercolor' . $alternative), $default);\r\n $css = theme_essential_set_alternativecolor($css, 'textcolor' . $alternative,\r\n theme_essential_get_setting('alternativethemetextcolor' . $alternative), $default);\r\n $css = theme_essential_set_alternativecolor($css, 'urlcolor' . $alternative,\r\n theme_essential_get_setting('alternativethemeurlcolor' . $alternative), $default);\r\n $css = theme_essential_set_alternativecolor($css, 'hovercolor' . $alternative,\r\n theme_essential_get_setting('alternativethemehovercolor' . $alternative), $defaulthover);\r\n }\r\n }\r\n\r\n // Set custom CSS.\r\n $customcss = theme_essential_get_setting('customcss');\r\n $css = theme_essential_set_customcss($css, $customcss);\r\n\r\n // Set the background image for the logo.\r\n $logo = $theme->setting_file_url('logo', 'logo');\r\n $css = theme_essential_set_logo($css, $logo);\r\n\r\n // Set the background image for the page.\r\n $pagebackground = $theme->setting_file_url('pagebackground', 'pagebackground');\r\n $css = theme_essential_set_pagebackground($css, $pagebackground);\r\n\r\n // Set the background style for the page.\r\n $pagebgstyle = theme_essential_get_setting('pagebackgroundstyle');\r\n $css = theme_essential_set_pagebackgroundstyle($css, $pagebgstyle);\r\n\r\n // Set Marketing Image Height.\r\n $marketingheight = theme_essential_get_setting('marketingheight');\r\n $css = theme_essential_set_marketingheight($css, $marketingheight);\r\n\r\n // Set Marketing Images.\r\n if (theme_essential_get_setting('marketing1image')) {\r\n $setting = 'marketing1image';\r\n $marketingimage = $theme->setting_file_url($setting, $setting);\r\n $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);\r\n }\r\n\r\n if (theme_essential_get_setting('marketing2image')) {\r\n $setting = 'marketing2image';\r\n $marketingimage = $theme->setting_file_url($setting, $setting);\r\n $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);\r\n }\r\n\r\n if (theme_essential_get_setting('marketing3image')) {\r\n $setting = 'marketing3image';\r\n $marketingimage = $theme->setting_file_url($setting, $setting);\r\n $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);\r\n }\r\n\r\n // Set FontAwesome font loading path\r\n $css = theme_essential_set_fontwww($css);\r\n\r\n // Finally return processed CSS\r\n return $css;\r\n}", "public function setAdminTheme()\n {\n $sAdminThemeName = getGlobalSetting('admintheme'); // We retrieve the admin theme in config ( {{settings_global}} or config-defaults.php )\n $sStandardTemplateRootDir = Yii::app()->getConfig(\"styledir\"); // Path for the standard Admin Themes\n $sUserTemplateDir = Yii::app()->getConfig('uploaddir').DIRECTORY_SEPARATOR.'admintheme'; // Path for the user Admin Themes\n\n // Check if the required theme is a standard one\n if($this->isStandardAdminTheme($sAdminThemeName))\n {\n $sTemplateDir = $sStandardTemplateRootDir; // It's standard, so it will be in standard path\n $sTemplateUrl = Yii::app()->getConfig('styleurl').$sAdminThemeName ; // Available via a standard URL\n }\n else\n {\n // If it's not a standard theme, we bet it's a user one.\n // In fact, it could also be a old 2.06 admin theme just aftet an update (it will then be caught as \"non existent\" in the next if statement\")\n $sTemplateDir = $sUserTemplateDir;\n $sTemplateUrl = Yii::app()->getConfig('uploadurl').DIRECTORY_SEPARATOR.'admintheme'.DIRECTORY_SEPARATOR.$sAdminThemeName;\n }\n\n // If the theme directory doesn't exist, it can be that:\n // - user updated from 2.06 and still have old theme configurated in database\n // - user deleted a custom theme\n // In any case, we just set Sea Green as the template to use\n if(!is_dir($sTemplateDir.DIRECTORY_SEPARATOR.$sAdminThemeName))\n {\n $sAdminThemeName = 'Sea_Green';\n $sTemplateDir = $sStandardTemplateRootDir;\n $sTemplateUrl = Yii::app()->getConfig('styleurl').DIRECTORY_SEPARATOR.$sAdminThemeName ;\n setGlobalSetting('admintheme', 'Sea_Green');\n }\n\n // Now that we are sure we have an existing template, we can set the variables of the AdminTheme\n $this->sTemplateUrl = $sTemplateUrl;\n $this->name = $sAdminThemeName;\n $this->path = $sTemplateDir . DIRECTORY_SEPARATOR . $this->name;\n\n // This is necessary because a lot of files still use \"adminstyleurl\".\n // TODO: replace everywhere the call to Yii::app()->getConfig('adminstyleurl) by $oAdminTheme->sTemplateUrl;\n Yii::app()->setConfig('adminstyleurl', $this->sTemplateUrl );\n\n\n //////////////////////\n // Config file loading\n\n $bOldEntityLoaderState = libxml_disable_entity_loader(true); // @see: http://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html#xml-external-entity-injection\n $sXMLConfigFile = file_get_contents( realpath ($this->path.'/config.xml')); // Now that entity loader is disabled, we can't use simplexml_load_file; so we must read the file with file_get_contents and convert it as a string\n\n // Simple Xml is buggy on PHP < 5.4. The [ array -> json_encode -> json_decode ] workaround seems to be the most used one.\n // @see: http://php.net/manual/de/book.simplexml.php#105330 (top comment on PHP doc for simplexml)\n $this->config = json_decode( json_encode ( ( array ) simplexml_load_string($sXMLConfigFile), 1));\n\n // If developers want to test asset manager with debug mode on\n self::$use_asset_manager = isset($this->config->engine->use_asset_manager_in_debug_mode)?( $this->config->engine->use_asset_manager_in_debug_mode == 'true'):'false';\n\n $this->defineConstants(); // Define the (still) necessary constants\n $this->registerStylesAndScripts(); // Register all CSS and JS\n\n libxml_disable_entity_loader($bOldEntityLoaderState); // Put back entity loader to its original state, to avoid contagion to other applications on the server\n\n return $this;\n }", "protected function themeSetter()\n {\n if (defined('ADMIN')) {\n $theme = Setting::get('admin_theme');\n $themePath = ADMIN_THEME;\n } else {\n $theme = Setting::get('public_theme');\n $themePath = THEMES;\n }\n\n // Add for Multisite\n if (! Dir::is($themePath.$theme)) {\n if (Dir::is(SHARED.'themes'.DS.$theme)) {\n $themePath = SHARED.'themes'.DS;\n }\n }\n\n // Register Event from Theme\n $events = $themePath.$theme.DS.'events.php';\n if (File::is($events)) {\n require $events;\n }\n\n return new Theme($this->app, $theme, $themePath);\n }", "public function select($data)\n {\n $required = array(\n 'code' => 'Theme code is missing',\n );\n $this->di['validator']->checkRequiredParamsForArray($required, $data);\n\n $theme = $this->getService()->getTheme($data['code']);\n\n $systemService = $this->di['mod_service']('system');\n if($theme->isAdminAreaTheme()) {\n $systemService->setParamValue('admin_theme', $data['code']);\n } else {\n $systemService->setParamValue('theme', $data['code']);\n }\n\n $this->di['logger']->info('Changed default theme');\n return true;\n }", "function add_color_theme(){\n\t\t\n\t\t$this->form_validation->set_rules('color_theme_name', 'Theme Name', 'required|max_length[30]');\n\t\t\n\t\t// To check form is validated\n\t\tif($this->form_validation->run()){\n\t\t\t// Retrieve data posted in form posted by user using input class\n\t\t\t\t\t\t\t\t/* 'header_bg'=>'#'.$this->input->get_post('theme_header_color', true), */\n\t\t\t$insert_array=array('theme_name'=>$this->input->get_post('color_theme_name', true),\n\t\t\t\t\t\t\t\t'body_bg'=>'#'.$this->input->get_post('theme_body_color', true),\n\t\t\t\t\t\t\t\t'border_color'=>'#'.$this->input->get_post('theme_border_color', true),\n\t\t\t\t\t\t\t\t'footer_bg'=>'#'.$this->input->get_post('theme_footer_color', true),\n\t\t\t\t\t\t\t\t'body_font_color'=>'#'.$this->input->get_post('theme_body_font_color', true),\n\t\t\t\t\t\t\t\t'footer_font_color'=>'#'.$this->input->get_post('theme_footer_font_color', true),\n\t\t\t\t\t\t\t\t'preheader_font_color'=>'#'.$this->input->get_post('theme_preheader_color', true),\n\t\t\t\t\t\t\t\t'outer_bg'=>'#'.$this->input->get_post('theme_outer_bg_color', true),\n\t\t\t\t\t\t\t\t'member_id'=>$this->session->userdata('member_id')\n\t\t\t);\n\t\t\t// Sends form delete data to database via model object\n\t\t\t$inserted_id=$this->Campaign_Model->create_color_theme($insert_array);\n\t\t\techo \"Success:\".$inserted_id;\n\t\t}else{\n\t\t\t// print validation errors\n\t\t\techo \"error:\".validation_errors();\n\t\t}\n\t\t\n\t}", "function setTheme($themeUrl) {\n\t$pathToIndexHtml = joinPaths(BASE_DIR, 'index.html');\n\t$content = file_get_contents($pathToIndexHtml);\n\t$pattern = '/(.+)(https:\\/\\/maxcdn.bootstrapcdn.com\\/.+\\/bootstrap.min.css)(.+)/i';\n\t$replacement = '${1}'.$themeUrl.'${3}';\n\t$content = preg_replace($pattern, $replacement, $content, 1);\n\tif (!is_null($content)) {\n\t\tfile_put_contents($pathToIndexHtml, $content);\n\t}\n}", "public function processConfigs(){\n $savePath = _PS_ALL_THEMES_DIR_.$this->_theme_dir . \"samples/\";\n if (!is_dir($savePath)) {\n if(!mkdir($savePath , 0755)){\n die(\"Please create folder samples in \"._PS_ALL_THEMES_DIR_.$this->_theme_dir.\" and set permission 755\");\n } \n }\n $id_theme = Context::getContext()->shop->id_theme;\n $theme_name = Context::getContext()->shop->theme_name;\n $theme = Db::getInstance()->executeS('SELECT `responsive`,`default_left_column`,`default_right_column`,`product_per_page` FROM `'. _DB_PREFIX_.'theme` WHERE id_theme='.(int)$id_theme.'');\n \n $theme_meta = Db::getInstance()->executeS('SELECT `id_meta`,`left_column`,`right_column` FROM `'. _DB_PREFIX_.'theme_meta` WHERE id_theme='.(int)$id_theme.'');\n\n $this->_content = '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n <dataSample>';\n $this->_content .= '<fields objectName=\"theme\">';\n $this->getContentXml($theme);\n $this->_content .= '</fields>';\n $this->_content .= '<fields objectName=\"theme_meta\">';\n $this->getContentXml($theme_meta);\n $this->_content .= '</fields>'; \n $this->_content .= \n '</dataSample>';\n $fp = @fopen($savePath.\"themeconfig.xml\", 'w');\n fwrite($fp, $this->_content);\n $this->_content = '';\n fclose($fp);\n $this->_html[\"confirm\"][] .= 'Restore configs theme success';\n }", "function wp_irving_site_theme_json_directory_path( $path ) {\n\treturn get_stylesheet_directory() . '/site-theme/';\n}", "public function store(StoreThemeRequest $request)\n {\n //Create new theme, store in database and associate all files with it.\n $theme = $this->themeService->store($request->validated());\n\n $this->addAllFiles($request, $theme);\n\n return redirect()\n ->route('admin.themes.edit', $theme)\n ->withFlashSuccess(__(\"Successfully Created the Theme\"));\n }", "public function ThemeEngineRender() {\n // Save to session before output anything\n $this->session->StoreInSession();\n\n // Get the paths and settings for the theme\n $themeName = $this->config['theme']['name'];\n $themePath = MOVIC_INSTALL_PATH . \"/themes/{$themeName}\";\n $themeUrl = $this->request->base_url . \"themes/{$themeName}\";\n \n // Add stylesheet path to the $mo->data array\n $this->data['stylesheet'] = \"{$themeUrl}/style.css\";\n\n // Include the global functions.php and the functions.php that are part of the theme\n $mo = &$this;\n include(MOVIC_INSTALL_PATH . '/themes/functions.php');\n $functionsPath = \"{$themePath}/functions.php\";\n if(is_file($functionsPath)) {\n include $functionsPath;\n }\n\n // Extract $mo->data and $mo->view->data to own variables and handover to the template file\n extract($this->data); \n extract($this->views->GetData()); \n include(\"{$themePath}/default.tpl.php\");\n }", "function LF_save_custom_css_data(){\r\n\t\tcheck_ajax_referer( 'savepluginData', 'token' );\r\n\t\t$customCss = $_POST['LF_customCss'];\r\n if (!empty($customCss))\r\n\t\t{\r\n\t\t\tLF_add_settings('customCss',$customCss);\r\n\t\t\t$stylesheet = plugin_dir_path( __FILE__ ).'assets/css/lf-style.css';\r\n\t\t\tfile_put_contents($stylesheet, stripslashes_deep($customCss));\r\n\t\t}\r\n\t\techo 1;\r\n\t\tdie();\r\n\t}", "function install_theme_information() {\n\t//TODO: This function needs a LOT of UI work :)\n\tglobal $tab, $themes_allowedtags;\n\n\t$api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) ));\n\n\tif ( is_wp_error($api) )\n\t\twp_die($api);\n\n\t// Sanitize HTML\n\tforeach ( (array)$api->sections as $section_name => $content )\n\t\t$api->sections[$section_name] = wp_kses($content, $themes_allowedtags);\n\tforeach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )\n\t\t$api->$key = wp_kses($api->$key, $themes_allowedtags);\n\n\tiframe_header( __('Theme Install') );\n\n\tif ( empty($api->download_link) ) {\n\t\techo '<div id=\"message\" class=\"error\"><p>' . __('<strong>Error:</strong> This theme is currently not available. Please try again later.') . '</p></div>';\n\t\tiframe_footer();\n\t\texit;\n\t}\n\n\tif ( !empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>') )\n\t\techo '<div class=\"updated\"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';\n\telse if ( !empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<') )\n\t\techo '<div class=\"updated\"><p>' . __('<strong>Warning:</strong> This theme has not been marked as <strong>compatible</strong> with your version of WordPress.') . '</p></div>';\n\n\t// Default to a \"new\" theme\n\t$type = 'install';\n\t// Check to see if this theme is known to be installed, and has an update awaiting it.\n\t$update_themes = get_transient('update_themes');\n\tif ( is_object($update_themes) && isset($update_themes->response) ) {\n\t\tforeach ( (array)$update_themes->response as $theme_slug => $theme_info ) {\n\t\t\tif ( $theme_slug === $api->slug ) {\n\t\t\t\t$type = 'update_available';\n\t\t\t\t$update_file = $theme_slug;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t$themes = get_themes();\n\tforeach ( $themes as $this_theme ) {\n\t\tif ( is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug ) {\n\t\t\tif ( $this_theme['Version'] == $api->version ) {\n\t\t\t\t$type = 'latest_installed';\n\t\t\t} elseif ( $this_theme['Version'] > $api->version ) {\n\t\t\t\t$type = 'newer_installed';\n\t\t\t\t$newer_version = $this_theme['Version'];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n?>\n\n<div class='available-theme'>\n<img src='<?php echo esc_url($api->screenshot_url) ?>' width='300' class=\"theme-preview-img\" />\n<h3><?php echo $api->name; ?></h3>\n<p><?php printf(__('by %s'), $api->author); ?></p>\n<p><?php printf(__('Version: %s'), $api->version); ?></p>\n\n<?php\n$buttons = '<a class=\"button\" id=\"cancel\" href=\"#\" onclick=\"tb_close();return false;\">' . __('Cancel') . '</a> ';\n\nswitch ( $type ) {\ndefault:\ncase 'install':\n\tif ( current_user_can('install_themes') ) :\n\t$buttons .= '<a class=\"button-primary\" id=\"install\" href=\"' . wp_nonce_url(admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '\" target=\"_parent\">' . __('Install Now') . '</a>';\n\tendif;\n\tbreak;\ncase 'update_available':\n\tif ( current_user_can('update_themes') ) :\n\t$buttons .= '<a class=\"button-primary\" id=\"install\"\thref=\"' . wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '\" target=\"_parent\">' . __('Install Update Now') . '</a>';\n\tendif;\n\tbreak;\ncase 'newer_installed':\n\tif ( current_user_can('install_themes') || current_user_can('update_themes') ) :\n\t?><p><?php printf(__('Newer version (%s) is installed.'), $newer_version); ?></p><?php\n\tendif;\n\tbreak;\ncase 'latest_installed':\n\tif ( current_user_can('install_themes') || current_user_can('update_themes') ) :\n\t?><p><?php _e('This version is already installed.'); ?></p><?php\n\tendif;\n\tbreak;\n} ?>\n<br class=\"clear\" />\n</div>\n\n<p class=\"action-button\">\n<?php echo $buttons; ?>\n<br class=\"clear\" />\n</p>\n\n<?php\n\tiframe_footer();\n\texit;\n}", "function editor_page_admin_Theme() {\n\t$page_theme = THEME;\n\trun_hook('site_theme', array(&$page_theme));\n\tglobal $lang;\n?>\n\t<form method=\"post\" action=\"\">\n\t\t<label class=\"kop2\" for=\"cont1\"><?php echo $lang['editor']['content_theme']; ?></label>\n\t\t<br />\n\t\t<textarea name=\"cont1\" id=\"cont1\" cols=\"90\" rows=\"20\" class=\"mceNoEditor\"><?php echo read_themes($page_theme); ?></textarea>\n\t\t<br />\n\t\t<input type=\"submit\" name=\"Submit\" value=\"<?php echo $lang['general']['save']; ?>\" />\n\t\t<input type=\"button\" name=\"Cancel\" value=\"<?php echo $lang['general']['cancel']; ?>\" onclick=\"javascript: window.location='admin.php?module=editor';\" />\n\t</form>\n\t<script type=\"text/javascript\">tinymce.remove('textarea');</script>\n<?php\n\t//Save style.\n\tif (isset($_POST['Submit'])) {\n\t\t$cont1 = $_POST['cont1'];\n\t\tsave_themes($page_theme, $cont1);\n\t\tredirect('admin.php?module=editor', 0);\n\t}\n}", "protected function collectThemeData()\n {\n $currentTheme = $this->themeManager->getCurrentTheme();\n\n if (!is_null($currentTheme)) {\n $this->data['currentTheme'] = array(\n 'name' => $currentTheme->getName(),\n );\n }\n }" ]
[ "0.679282", "0.6456332", "0.6381143", "0.6267924", "0.6247903", "0.6227927", "0.6081374", "0.59996736", "0.59826404", "0.5840315", "0.56965643", "0.56839895", "0.56278276", "0.56032217", "0.5578533", "0.5522487", "0.54475814", "0.5442581", "0.5434829", "0.5434508", "0.5422648", "0.5413443", "0.5409122", "0.5402146", "0.53945863", "0.5353221", "0.53235847", "0.5319596", "0.5303884", "0.52947134" ]
0.82773775
0
Generates the theme.css file for the current theme and Installs/Dumps the file.
public function generateTheme() { // Get the current theme folder $themePath = $this->getThemePath(); // Create a Less parse so we can compile the theme $lessParser = new \Less_Parser(); // If a theme.json file already exist, we can use the details inside to apply // custom modifications to the base bootstrap theme if (file_exists($themePath . '/theme.json')) { $themeOptions = file_get_contents($themePath . '/theme.json'); $themeOptions = json_decode($themeOptions); } // Try to parse the source files and modify the variables if theme.json exists try { $lessParser->parseFile($this->getKernelRootDir() . '/../vendor/ilp/bootstrap-theme-bundle/ILP/BootstrapThemeBundle/Resources/public/Cluckles/build/less/bootstrap.less'); if (isset($themeOptions)) { $lessParser->ModifyVars($themeOptions); } } catch (Exception $ex) { } // Now get the compiled CSS and save it in the current theme folder $compiledCss = $lessParser->getCss(); // Save the compiled theme file to the current Theme directory file_put_contents($themePath . '/theme.css', $compiledCss); // Now Install/Dump the Theme so the changes to the css files will appear return $this->installTheme(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function generateTheme()\n {\n // Create base themes directory\n if (!$this->files->isDirectory(public_path(config('themes.paths.base')))) {\n $this->files->makeDirectory(public_path(config('themes.paths.base')));\n }\n\n $directory = config('themes.paths.absolute') . '/' . $this->container['slug'];\n $source = __DIR__ . '/../../../resources/theme';\n\n $this->files->makeDirectory($directory);\n\n $sourceFiles = $this->files->allFiles($source, true);\n\n foreach ($sourceFiles as $file) {\n $contents = $this->replacePlaceholders($file->getContents());\n $subPath = $file->getRelativePathname();\n\n $filePath = $directory . '/' . $subPath;\n $dir = dirname($filePath);\n\n if (!$this->files->isDirectory($dir)) {\n $this->files->makeDirectory($dir, 0755, true);\n }\n\n $this->files->put($filePath, $contents);\n }\n }", "public function saveThemeConfigs() {\n\n $id_shop = Context::getContext()->shop->id;\n $customName = $id_shop.'custom';\n\n //add new file if don't exist\n if (!file_exists($this->themePath . 'css/local/'.$customName.'.css')) {\n if (!is_dir($this->themePath . 'css/local/')) {\n mkdir($this->themePath . 'css/local/', 755);\n }\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, \"\", 'css');\n }\n\n if (!file_exists($this->themePath . 'js/local/'.$customName.'.js')) {\n if (!is_dir($this->themePath . 'js/local/')) {\n mkdir($this->themePath . 'js/local/', 755);\n }\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, \"\", 'js');\n }\n\n\n $t = $this->themePath . 'css/local/'.$customName.'.css';\n if (is_dir($this->themePath . 'css/local/')) {\n if (is_writeable($t)) {\n $css = trim(Tools::getValue($this->getConfigName('C_CODECSS')));\n if ($css) {\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, $css, 'css');\n } else if (file_exists($t) && filesize($t)) {\n @unlink($t);\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, \"\", 'css');\n }\n }\n }\n\n $t = $this->themePath . 'js/local/'.$customName.'.js';\n if (is_dir($this->themePath . 'js/local/')) {\n if (is_writeable($t)) {\n $js = trim(Tools::getValue($this->getConfigName('C_CODEJS')));\n if ($js) {\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, $js, 'js');\n } else if (file_exists($t) && filesize($t)) {\n @unlink($t);\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, \"\", 'js');\n }\n }\n }\n\n\n $languages = Language::getLanguages(false);\n $this->makeFieldsOptions();\n $content = '';\n //echo \"<pre>\";print_r($this->fields_options);die;\n foreach ($this->fields_options as $f) {\n foreach ($f['form']['input'] as $input) {\n if ($input['name'] == $this->getConfigName('C_CODECSS')) {\n continue;\n }\n if (isset($input['lang'])) {\n $data = array();\n foreach ($languages as $lang) {\n $v = Tools::getValue(trim($input['name']) . '_' . $lang['id_lang']);\n $data[$lang['id_lang']] = $v ? $v : $input['default'];\n }\n Configuration::updateValue(trim($input['name']), $data);\n } else {\n $v = Tools::getValue($input['name'], Configuration::get($input['name']));\n $dataSave = $v ? $v : $input['default'];\n Configuration::updateValue(trim($input['name']), $dataSave );\n if(trim($input['name']) == $this->getConfigName('listing_mode')){\n if(trim($dataSave) == '') $dataSave = 'grid';\n $content .= '\n{assign var=\"LISTING_GRIG_MODE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column')){\n if(trim($dataSave) == '') $dataSave = '3';\n $content .= '\n{assign var=\"LISTING_PRODUCT_COLUMN\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_tablet')){\n if(trim($dataSave) == '') $dataSave = '2';\n $content .= '\n{assign var=\"LISTING_PRODUCT_TABLET\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_mobile')){\n if(trim($dataSave) == '') $dataSave = '1';\n $content .= '\n{assign var=\"LISTING_PRODUCT_MOBILE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_module')){\n if(trim($dataSave) == '') $dataSave = '4';\n $content .= '\n{assign var=\"LISTING_PRODUCT_COLUMN_MODULE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_color')){\n $content .= '\n{assign var=\"ENABLE_COLOR\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_wishlist')){\n $content .= '\n{assign var=\"ENABLE_WISHLIST\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_responsive')){\n $content .= '{assign var=\"ENABLE_RESPONSIVE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }\n }\n }\n }\n if (is_writeable($this->themePath . 'layout/setting.tpl')) {\n $content .= '\n{if $LISTING_PRODUCT_COLUMN==\"5\"}\n {assign var=\"colValue\" value=\"col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-2-4\" scope=\"global\"}\n{else}\n {assign var=\"colValue\" value=\"col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-{12/$LISTING_PRODUCT_COLUMN}\" scope=\"global\"}\n{/if}';\n\n LeoFrameworkHelper::writeToCache($this->themePath . 'layout/', 'setting', $content, 'tpl');\n }\n\n }", "protected function setupTheme()\n {\n File::cleanDirectory(resource_path('views/vendor/spark'));\n File::copyDirectory(__DIR__ . '/stubs/spark', resource_path('views/vendor/spark'));\n $this->setupWelcomePage();\n }", "public function installTheme()\n {\n // Create a new Application, which we can use to run the GenerateThemeCommand\n // Inject the kernel because thats required\n $app = new Application($this->kernel);\n // Add the Other commands our command will run\n $app->add(new AssetsInstallCommand());\n $app->add(new DumpCommand());\n\n // Create a new GenerateThemeCommand so we can run it\n $themeCommand = new GenerateThemeCommand();\n\n // Set the Application, so the Command can run\n $themeCommand->setApplication($app);\n\n // Find the full path to the web directory\n // Remove app from the kernelRootDir e.g. /path/Corvus/app\n // As /path/Corvus/app/../web doesnt work\n $webDirectory = substr($this->getKernelRootDir(), 0, -3) . 'web';\n \n // The String input sends the path to the web directory to the Command,\n // So that the assets can be installed to the web directory\n $resultCode = $themeCommand->run(new StringInput($webDirectory), new NullOutput());\n \n // return the status code indicating status\n return $resultCode;\n }", "public function default_cssAction()\n {\n @header(\"Content-type:text/css\");\n\t\t\n\t\techo \"/*\n* File Defination\n* - Website CSS Section\n*\n* Template Name : {$this->theme}\n* Project Name : {$this->get_config('site_title')}\n**/\";\n\t\t\n\t\tApp::Module('Hook')->getHandler('CSS', 'register_css_code', __FILE__, 'display');\n\t\t\n\t\texit;\n }", "public function stylesheet()\n {\n $uploads = wp_get_upload_dir();\n\n $dir = $uploads['basedir'] . '/wptheme';\n\n if( ! is_dir($dir) ) wp_mkdir_p($dir);\n\n return $dir . '/customized.css';\n }", "function template_css()\n{\n\ttheme()->template_css();\n}", "public function generate()\n {\n if (!$this->configurationHandler->isTheme() || $this->theme->getName() != $this->configurationHandler->handledTheme()) {\n return;\n }\n\n $templates = array_keys($this->templates[\"template\"]);\n $homepage = json_decode(file_get_contents($this->configurationHandler->pagesDir() . '/' .$this->configurationHandler->homepage() . '/page.json'), true);\n $homepageTemplate = $homepage[\"template\"];\n if (!in_array($homepageTemplate, $templates)) {\n $homepageTemplate = $templates[0];\n }\n\n $themeDefinition = array(\n \"home_template\" => $homepageTemplate,\n \"templates\" => $templates,\n );\n\n $this->synchronizeThemeSlots();\n FilesystemTools::writeFile($this->themeDir . '/theme.json', json_encode($themeDefinition));\n }", "function goa_theme_custom_css_page() {\n\trequire_once( get_template_directory() . '/inc/templates/goa-theme-custom-css.php');\n}", "public function cssgenerate()\n\t{\n\t\t$section = Mage::app()->getRequest()->getParam('section');\n\t\tif ($section == 'themeoptions')\n\t\t{\n\t\t\t$store_ids = array();\n\t\t\tif(Mage::app()->getRequest()->getParam('store') && Mage::app()->getRequest()->getParam('website'))\n\t\t\t{\n\t\t\t\t$store_ids[] = Mage::getModel( \"core/store\" )->load(Mage::app()->getRequest()->getParam('store'))->getStore_id();\n\t\t\t}\n\t\t\telseif(Mage::app()->getRequest()->getParam('website'))\n\t\t\t{\n\t\t\t\t$store_ids = Mage::getModel('core/website')->load(Mage::app()->getRequest()->getParam('website'))->getstoreIds();\n\t\t\t}else{\n\t\t\t\tforeach (Mage::app()->getWebsites() as $website){\n\t\t\t\t\tforeach ($website->getGroups() as $group){\n\t\t\t\t\t\t$stores = $group->getStores();\n\t\t\t\t\t\tforeach ($stores as $store) {\n\t\t\t\t\t\t\t$store_ids[] = $store->getId();\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\n\t\t\tforeach($store_ids as $store_id)\n\t\t\t{\n\t\t\t\t$this->setLocation($store_id);\n\t\t\t\t\n\t\t\t\tif(!$this->getConfig('reset_css',$store_id))\n\t\t\t\t{ \n\t\t\t\t\tif($this->getConfig('font_main',$store_id))\n\t\t\t\t\t\t$css .= '.top-cart-title,.pt_custommenu div.pt_menu .parentMenu a,.pt_custommenu div.pt_menu .parentMenu span.block-title,.ratings .amount a,.item-options dt,.item-options dd,.block-best h2,.block-featured h2{font-family:'.str_replace(\"+\",\" \",$this->getConfig('font',$store_id)).';font-weight:'.$this->getConfig('font_weight',$store_id).'}';\n\t\t\t\t\t\n\t\t\t\t\tif($this->getConfig('font_content_main',$store_id))\n\t\t\t\t\t$css .= 'body,.breadcrumbs li,.footer-static-2{font-family:'.str_replace(\"+\",\" \",$this->getConfig('font_content',$store_id)).';\n\t\t\t\t\t\tfont-weight:'.$this->getConfig('font_contentweight',$store_id).'}';\n\n\t\t\t\t\tif($this->getConfig('font_price_main',$store_id))\n\t\t\t\t\t$css .= ' .new-icon,.sale-icon,.block-layered-nav h2,.price-box .price,.footer-static .footer-title h2,.banner-static .banner-box .box-hover a,.banner-left .banner-content h1,.title-vmega-menu h2{font-family:'.str_replace(\"+\",\" \",$this->getConfig('font_price',$store_id)).';\n\t\t\t\t\t\tfont-weight:'.$this->getConfig('font_priceweight',$store_id).'}';\n\t\t\t\t\t\t\n\t\t\t\t\t// background_color\t\n\t\t\t\t\t$css .= $this->getConfig('color_tag',$store_id).'{background-color:'.$this->getConfig('color',$store_id).'}';\n\t\t\t\t\t\n\t\t\t\t\t// background_color_hover\n\t\t\t\t\t$css .= $this->getConfig('color_hover_tag',$store_id).'{background-color:'.$this->getConfig('color_hover',$store_id).'}'; \n\t\t\t\t\t\n\t\t\t\t\t// text_color\n\t\t\t\t\t$css .= $this->getConfig('text_color_tag',$store_id).'{color:'.$this->getConfig('text_color',$store_id).'}';\n\t\t\t\t\t\n\t\t\t\t\t// text_color_hover\n\t\t\t\t\t$css .= $this->getConfig('text_color_hover_tag',$store_id).'{color:'.$this->getConfig('text_color_hover',$store_id).'}';\n\t\t\t\t\t\n\t\t\t\t\t// border\n\t\t\t\t\t$css .= $this->getConfig('border_tag',$store_id).'{border-color:'.$this->getConfig('border',$store_id).'}';\n\t\t\t\t\t\n\t\t\t\t\t// border_hover\n\t\t\t\t\t$css .= $this->getConfig('border_hover_tag',$store_id).'{border-color:'.$this->getConfig('border_hover',$store_id).'}';\n\t\t\t\t\t\n\t\t\t\t\t$image_bg = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/'.$this->dir_store.'/images/pattern/'.$this->getConfig('bg_pattern',$store_id).'.png';\n\t\t\t\t\t$css .= 'body{background-color:'.$this->getConfig('bg_color',$store_id);\n\t\t\t\t\t\n\t\t\t\t\tif($this->getConfig('bg_pattern',$store_id ))\n\t\t\t\t\t\t$css .=';background-image:url(\"'.$image_bg.'\")';\n\t\t\t\t\t\t$css .='}'; \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}else{\n\t\t\t\t\t$css = '';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttry{\n\t\t\t\t\t$fh = new Varien_Io_File(); \n\t\t\t\t\t$fh->setAllowCreateFolders(true); \n\t\t\t\t\t$fh->open(array('path' => $this->dirPath));\n\t\t\t\t\t$fh->streamOpen($this->filePath, 'w+'); \n\t\t\t\t\t$fh->streamLock(true); \n\t\t\t\t\t$fh->streamWrite($css); \n\t\t\t\t\t$fh->streamUnlock(); \n\t\t\t\t\t$fh->streamClose(); \n\t\t\t\t}\n\t\t\t\tcatch (Exception $e) {\n\t\t\t\t\tMage::getSingleton('adminhtml/session')->addError(Mage::helper('themeoptions')->__('Failed creation custom css rules. '.$e->getMessage()));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function ThemeEngineRender() {\n\t\t//Get paths and settings for the theme\n\t\t$themeName = $this->config['theme']['name'];\n\t\t$themePath = LYDIGAMVC_INSTALL_PATH . \"/themes/{$themeName}\";\n\t\t$themeURL = $this->request->base_url . \"themes/{$themeName}\";\n\n\t\t//Add stylesheet path to the data array\n\t\t$this->data['stylesheet'] = \"{$themeURL}/style.css\";\n\n\t\t// Include the global functions.php and the functions.php\n\t\t// that is part of the theme.\n\t\t$ly = &$this;\n\t\t$functionsPath = \"{$themePath}/functions.php\";\n\t\tinclude LYDIGAMVC_INSTALL_PATH . '/themes/functions.php';\n\t\tif (is_file($functionsPath)) {\n\t\t\tinclude $functionsPath;\n\t\t}\t\n\n\t\t// Extract $ly->data to own variables and hand over to the\n\t\t// template file.\n\t\textract($this->data);\n\t\tinclude(\"{$themePath}/default.tpl.php\");\n\t}", "public function run()\n\t{\n\t\tif( !empty($this->theme_menu) ) {\n\t\t\tadd_action('admin_menu', 'create_theme_menu');\t\t\n\t\t\teval(\"function create_theme_menu() { global \\$theme; \\$theme->add_menu(\\$theme->theme_menu); }\");\n\t\t}\n\t\t\n\t\tadd_action('admin_head', 'theme_css');\n\t\teval(\"function theme_css() {\n\t\t\t\\$url = get_bloginfo('template_url') .'/THBFramework/admin.css';\n\t\t\techo '<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"' . \\$url . '\\\" />';\n\t\t}\");\n\t}", "function page_themes() {\n $f3=$this->framework;\n\t\t$f3->set('themes', $this->themes() );\n\t\t$f3->set('content','themes.html');\n\t\t$f3->set('html_title','Themes - '.$this->site_title() );\n\t\tprint Template::instance()->render( \"page.html\" );\n\t}", "public function ThemeEngineRender() {\n // Save to session before output anything\n $this->session->StoreInSession();\n\n // Get the paths and settings for the theme\n $themeName = $this->config['theme']['name'];\n $themePath = MOVIC_INSTALL_PATH . \"/themes/{$themeName}\";\n $themeUrl = $this->request->base_url . \"themes/{$themeName}\";\n \n // Add stylesheet path to the $mo->data array\n $this->data['stylesheet'] = \"{$themeUrl}/style.css\";\n\n // Include the global functions.php and the functions.php that are part of the theme\n $mo = &$this;\n include(MOVIC_INSTALL_PATH . '/themes/functions.php');\n $functionsPath = \"{$themePath}/functions.php\";\n if(is_file($functionsPath)) {\n include $functionsPath;\n }\n\n // Extract $mo->data and $mo->view->data to own variables and handover to the template file\n extract($this->data); \n extract($this->views->GetData()); \n include(\"{$themePath}/default.tpl.php\");\n }", "function custom_theme_style() {\n wp_enqueue_style( \n 'theme-style', \n get_stylesheet_directory_uri().'/css/main.css', \n false, \n ENV == 'PRODUCTION' ? '1.0' : theme_get_timestamp()\n );\n}", "function theme_essential_process_css($css, $theme)\r\n{\r\n $pagewidth = theme_essential_get_setting('pagewidth');\r\n $css = theme_essential_set_pagewidth($css, $pagewidth);\r\n\r\n // Set the theme font\r\n $headingfont = theme_essential_get_setting('fontnameheading');\r\n $bodyfont = theme_essential_get_setting('fontnamebody');\r\n\r\n $css = theme_essential_set_headingfont($css, $headingfont);\r\n $css = theme_essential_set_bodyfont($css, $bodyfont);\r\n $css = theme_essential_set_fontfiles($css, 'heading', $headingfont, $theme);\r\n $css = theme_essential_set_fontfiles($css, 'body', $bodyfont, $theme);\r\n\r\n // Set the theme colour.\r\n $themecolor = theme_essential_get_setting('themecolor');\r\n $css = theme_essential_set_color($css, $themecolor, '[[setting:themecolor]]', '#30ADD1');\r\n\r\n // Set the theme text colour.\r\n $themetextcolor = theme_essential_get_setting('themetextcolor');\r\n $css = theme_essential_set_color($css, $themetextcolor, '[[setting:themetextcolor]]', '#047797');\r\n\r\n // Set the theme url colour.\r\n $themeurlcolor = theme_essential_get_setting('themeurlcolor');\r\n $css = theme_essential_set_color($css, $themeurlcolor, '[[setting:themeurlcolor]]', '#FF5034');\r\n\r\n // Set the theme hover colour.\r\n $themehovercolor = theme_essential_get_setting('themehovercolor');\r\n $css = theme_essential_set_color($css, $themehovercolor, '[[setting:themehovercolor]]', '#F32100');\r\n\r\n // Set the theme icon colour.\r\n $themeiconcolor = theme_essential_get_setting('themeiconcolor');\r\n $css = theme_essential_set_color($css, $themeiconcolor, '[[setting:themeiconcolor]]', '#30ADD1');\r\n\r\n // Set the theme navigation colour.\r\n $themenavcolor = theme_essential_get_setting('themenavcolor');\r\n $css = theme_essential_set_color($css, $themenavcolor, '[[setting:themenavcolor]]', '#ffffff');\r\n\r\n // Set the footer colour.\r\n $footercolor = theme_essential_hex2rgba(theme_essential_get_setting('footercolor'), '0.95');\r\n $css = theme_essential_set_color($css, $footercolor, '[[setting:footercolor]]', '#555555');\r\n\r\n // Set the footer text color.\r\n $footertextcolor = theme_essential_get_setting('footertextcolor');\r\n $css = theme_essential_set_color($css, $footertextcolor, '[[setting:footertextcolor]]', '#bbbbbb');\r\n\r\n // Set the footer heading colour.\r\n $footerheadingcolor = theme_essential_get_setting('footerheadingcolor');\r\n $css = theme_essential_set_color($css, $footerheadingcolor, '[[setting:footerheadingcolor]]', '#cccccc');\r\n\r\n // Set the footer separator colour.\r\n $footersepcolor = theme_essential_get_setting('footersepcolor');\r\n $css = theme_essential_set_color($css, $footersepcolor, '[[setting:footersepcolor]]', '#313131');\r\n\r\n // Set the footer URL color.\r\n $footerurlcolor = theme_essential_get_setting('footerurlcolor');\r\n $css = theme_essential_set_color($css, $footerurlcolor, '[[setting:footerurlcolor]]', '#217a94');\r\n\r\n // Set the footer hover colour.\r\n $footerhovercolor = theme_essential_get_setting('footerhovercolor');\r\n $css = theme_essential_set_color($css, $footerhovercolor, '[[setting:footerhovercolor]]', '#30add1');\r\n\r\n // Set the slide background colour.\r\n $slidebgcolor = theme_essential_hex2rgba(theme_essential_get_setting('themecolor'), '.75');\r\n $css = theme_essential_set_color($css, $slidebgcolor, '[[setting:carouselcolor]]', '#30add1');\r\n\r\n // Set the slide active pip colour.\r\n $slidebgcolor = theme_essential_hex2rgba(theme_essential_get_setting('themecolor'), '.25');\r\n $css = theme_essential_set_color($css, $slidebgcolor, '[[setting:carouselactivecolor]]', '#30add1');\r\n\r\n // Set the slide header colour.\r\n $slideshowcolor = theme_essential_get_setting('slideshowcolor');\r\n $css = theme_essential_set_color($css, $slideshowcolor, '[[setting:slideshowcolor]]', '#30add1');\r\n\r\n // Set the slide header colour.\r\n $slideheadercolor = theme_essential_get_setting('slideheadercolor');\r\n $css = theme_essential_set_color($css, $slideheadercolor, '[[setting:slideheadercolor]]', '#30add1');\r\n\r\n // Set the slide text colour.\r\n $slidecolor = theme_essential_get_setting('slidecolor');\r\n $css = theme_essential_set_color($css, $slidecolor, '[[setting:slidecolor]]', '#ffffff');\r\n\r\n // Set the slide button colour.\r\n $slidebuttoncolor = theme_essential_get_setting('slidebuttoncolor');\r\n $css = theme_essential_set_color($css, $slidebuttoncolor, '[[setting:slidebuttoncolor]]', '#30add1');\r\n\r\n // Set the slide button hover colour.\r\n $slidebuttonhcolor = theme_essential_get_setting('slidebuttonhovercolor');\r\n $css = theme_essential_set_color($css, $slidebuttonhcolor, '[[setting:slidebuttonhovercolor]]', '#217a94');\r\n\r\n if ((get_config('theme_essential', 'enablealternativethemecolors1')) ||\r\n (get_config('theme_essential', 'enablealternativethemecolors2')) ||\r\n (get_config('theme_essential', 'enablealternativethemecolors3'))\r\n ) {\r\n // Set theme alternative colours.\r\n $defaultcolors = array('#a430d1', '#d15430', '#5dd130');\r\n $defaulthovercolors = array('#9929c4', '#c44c29', '#53c429');\r\n\r\n foreach (range(1, 3) as $alternative) {\r\n $default = $defaultcolors[$alternative - 1];\r\n $defaulthover = $defaulthovercolors[$alternative - 1];\r\n $css = theme_essential_set_alternativecolor($css, 'color' . $alternative,\r\n theme_essential_get_setting('alternativethemehovercolor' . $alternative), $default);\r\n $css = theme_essential_set_alternativecolor($css, 'textcolor' . $alternative,\r\n theme_essential_get_setting('alternativethemetextcolor' . $alternative), $default);\r\n $css = theme_essential_set_alternativecolor($css, 'urlcolor' . $alternative,\r\n theme_essential_get_setting('alternativethemeurlcolor' . $alternative), $default);\r\n $css = theme_essential_set_alternativecolor($css, 'hovercolor' . $alternative,\r\n theme_essential_get_setting('alternativethemehovercolor' . $alternative), $defaulthover);\r\n }\r\n }\r\n\r\n // Set custom CSS.\r\n $customcss = theme_essential_get_setting('customcss');\r\n $css = theme_essential_set_customcss($css, $customcss);\r\n\r\n // Set the background image for the logo.\r\n $logo = $theme->setting_file_url('logo', 'logo');\r\n $css = theme_essential_set_logo($css, $logo);\r\n\r\n // Set the background image for the page.\r\n $pagebackground = $theme->setting_file_url('pagebackground', 'pagebackground');\r\n $css = theme_essential_set_pagebackground($css, $pagebackground);\r\n\r\n // Set the background style for the page.\r\n $pagebgstyle = theme_essential_get_setting('pagebackgroundstyle');\r\n $css = theme_essential_set_pagebackgroundstyle($css, $pagebgstyle);\r\n\r\n // Set Marketing Image Height.\r\n $marketingheight = theme_essential_get_setting('marketingheight');\r\n $css = theme_essential_set_marketingheight($css, $marketingheight);\r\n\r\n // Set Marketing Images.\r\n if (theme_essential_get_setting('marketing1image')) {\r\n $setting = 'marketing1image';\r\n $marketingimage = $theme->setting_file_url($setting, $setting);\r\n $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);\r\n }\r\n\r\n if (theme_essential_get_setting('marketing2image')) {\r\n $setting = 'marketing2image';\r\n $marketingimage = $theme->setting_file_url($setting, $setting);\r\n $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);\r\n }\r\n\r\n if (theme_essential_get_setting('marketing3image')) {\r\n $setting = 'marketing3image';\r\n $marketingimage = $theme->setting_file_url($setting, $setting);\r\n $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);\r\n }\r\n\r\n // Set FontAwesome font loading path\r\n $css = theme_essential_set_fontwww($css);\r\n\r\n // Finally return processed CSS\r\n return $css;\r\n}", "public function installStyles()\n {\n $log = start_install_log(\"installStyles\");\n if (copy($this->src_path . \"styles.css\", BasePath . \"styles/$this->module.css\")) {\n $db = db_init();\n $qry = \"INSERT INTO system \";\n $qry .= \"(date,version,entry,value,grp,info) \";\n $qry .= \"VALUES ('\" . date(\"Y-m-d H:i:s\") . \"','\" . $this->version . \"','styles','\" . $this->module . \".css','\" . $this->group . \"','\" . $info . \"');\";\n // var_dump ( $qry );\n if (! $db->query($qry)) {\n $log->write(\"Data base error: \" . $db->error, LOG_ERROR);\n return false;\n } else\n $log->write(\"Installed styles of module \" . $this->module, LOG_INFO);\n } else\n return false;\n\n return true;\n }", "function css_styles() {\nwp_register_style( 'style-theme',get_template_directory_uri() . '/dist/style-theme.css' );\nwp_enqueue_style( 'style-theme' );\n}", "function ssd_print_styles() {\n\t//check for a copy of the css in the current theme folder\n\t$css_file = get_theme_root() . \"/\" . basename(get_bloginfo(\"template_url\")) . '/ssd-ss-downloads.css';\n\tif(file_exists($css_file))\n\t{\n\t\t$myStyleUrl = get_bloginfo(\"template_url\") . \"/ssd-ss-downloads.css\";\n\t\t$myStyleFile = $css_file;\n\t}\n\telse\n\t{\t\n\t\t$myStyleUrl = WP_PLUGIN_URL . '/ss-downloads/css/ss-downloads.css';\n\t\t$myStyleFile = WP_PLUGIN_DIR . '/ss-downloads/css/ss-downloads.css';\t\t\n\t}\n\t\n\t//load it up\n\tif ( file_exists($myStyleFile) ) {\n\t\twp_register_style('ss-downloads', $myStyleUrl);\n\t\twp_enqueue_style( 'ss-downloads');\n\t}\n}", "function set_theme_styles() {\n\twp_enqueue_style( 'main_stylesheet' , get_template_directory_uri() . '/css/main.css?v=' .time() );\n}", "function loginPageCssModification()\n{\n echo '<link rel=\"stylesheet\" type=\"text/css\" href=\"' . get_theme_file_uri('/css/login.css') . '\">';\n}", "public static function make_css() {\n\n\t\tglobal $wp_filesystem;\n\n\t\t/**\n\t\t * Initialize the Wordpress filesystem.\n\t\t */\n\t\tif ( empty( $wp_filesystem ) ) {\n\t\t\trequire_once( ABSPATH . '/wp-admin/includes/file.php' );\n\t\t\tWP_Filesystem();\n\t\t}\n\n\t\t/**\n\t\t * Creates the content of the CSS file.\n\t\t * We're adding a warning at the top of the file to prevent users from editing it.\n\t\t * The warning is then followed by the actual CSS content.\n\t\t */\n\t\t$content = \"/********* Compiled - Do not edit *********/\\n\" . aione_dynamic_css_cached();\n\n\n\t\t/**\n\t\t * When using domain-mapping plugins we have to make sure that any references to the original domain\n\t\t * are replaced with references to the mapped domain.\n\t\t * We're also stripping protocols from these domains so that there are no issues with SSL certificates.\n\t\t */\n\t\tif ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {\n\n\t\t\tif ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {\n\n\t\t\t\t/**\n\t\t\t\t * The mapped domain of the site\n\t\t\t\t */\n\t\t\t\t$mapped_domain = domain_mapping_siteurl( false );\n\t\t\t\t$mapped_domain = str_replace( 'https://', '//', $mapped_domain );\n\t\t\t\t$mapped_domain = str_replace( 'http://', '//', $mapped_domain );\n\t\t\t\t/**\n\t\t\t\t * The original domain of the site\n\t\t\t\t */\n\t\t\t\t$original_domain = get_original_url( 'siteurl' );\n\t\t\t\t$original_domain = str_replace( 'https://', '//', $original_domain );\n\t\t\t\t$original_domain = str_replace( 'http://', '//', $original_domain );\n\t\t\t\t/**\n\t\t\t\t * Replace original domain with mapped domain\n\t\t\t\t */\n\t\t\t\t$content = str_replace( $original_domain, $mapped_domain, $content );\n\n\t\t\t}\n\n\t\t}\n\n\t\t/**\n\t\t * Strip protocols.\n\t\t * This helps avoid any issues with https sites.\n\t\t */\n\t\t$content = str_replace( 'https://', '//', $content );\n\t\t$content = str_replace( 'http://', '//', $content );\n\n\t\t/**\n\t\t * Since we've already checked if the file is writable in the can_write() method (called by the mode() method)\n\t\t * it's safe to continue without any additional checks as to the validity of the file.\n\t\t */\n\t\tif ( ! $wp_filesystem->put_contents( self::file( 'path' ), $content, FS_CHMOD_FILE ) ) {\n\t\t\t/**\n\t\t\t * Writing to the file failed\n\t\t\t * return false\n\t\t\t */\n\t\t\treturn false;\n\t\t} else {\n\t\t\t/**\n\t\t\t * Writing to the file succeeded.\n\t\t\t * Update the opion in the db so that we know the css for this post has been successfully generated\n\t\t\t * and then return true.\n\t\t\t */\n\t\t\t$page_id = ( self::page_id() ) ? self::page_id() : 'global';\n\t\t\t$option = get_option( 'aione_dynamic_css_posts', array() );\n\t\t\t$option[ $page_id ] = true;\n\t\t\tupdate_option( 'aione_dynamic_css_posts', $option );\n\t\t\t/**\n\t\t\t * Update the 'aione_dynamic_css_time' option.\n\t\t\t */\n\t\t\tself::update_saved_time();\n\n\t\t\t/**\n\t\t\t * Success!\n\t\t\t * Return true.\n\t\t\t */\n\t\t\treturn true;\n\t\t}\n\n\t}", "private function brand_patch_roots()\n\t{\n\t\t$style = file($this->theme_path.'style.css');\n\t\t$style[1] = \"\\tTheme Name:\\t\\t\".$this->project_name.\"\\r\\n\";\n\t\t$style[2] = \"\\tDescription:\\tCustom theme for \".$this->project_name.\"\\r\\n\";\n\t\t$style[4] = \"\\tAuthor:\\t\\t\\t\".get_config('theme_author').\"\\r\\n\";\n\t\tfile_put_contents($this->theme_path.'style.css', $style);\n\n\t\t// update scripts.php to point to css filename based on project slug\n\t\t$search_pairs = array('site.css' => $this->project_slug.'.css');\n\t\tfile_search_replace($this->theme_path.'lib/scripts.php', $search_pairs);\n\n\t\t// rename site.css to filename based on the project slug\n\t\trename($this->theme_path.'assets/css/site.css', $this->theme_path.'assets/css/'.$this->project_slug.'.css');\n\t}", "public function setup() {\n // Interactively ask the user for some information.\n $replacements = array();\n $replacements['name'] = $this->ask('Name of the new theme: ');\n $replacements['theme_uri'] = $this->ask('Theme URI: ');\n $replacements['author_name'] = $this->ask('Author name: ');\n $replacements['author_uri'] = $this->ask('Author URI: ');\n $replacements['description'] = $this->ask('Description: ');\n\n // Try to open our style.css.\n $fp = fopen('./style.css', 'rb');\n if(!$fp) { $this->e('Could not open style.css. Please ensure it\\'s readable'); }\n $data = fread($fp, filesize('./style.css')); // Read it into $data\n\n // Run string replacements.\n $data = str_replace(['420_name', '420_uri', '420_author', '420_authoruri', '420_description'], $replacements, $data);\n\n // Finally update the file.\n if(!file_put_contents('./style.css', $data)) {\n $this->e('An error has occured while writing to style.css. Please ensure it\\'s writable!');return;\n }\n $this->e('Updated style.css successfully!');\n }", "private function css(){\n $this->output = implode('', array_map('file_get_contents', $this->currentFiles)); \n //less\n if($this->config['less']==true){$this->lessToCss();}\n //compress CSS\n if($this->config['CSScompressor']==true){$this->compressCSS();} \n \n }", "function css($filename)\r\n\t\t{\r\n\t\t\tglobal $current_controller;\r\n\t\t\techo \"<link type=\\\"text/css\\\" rel=\\\"stylesheet\\\" href=\\\"/\".THEMES.SEPARATOR.$current_controller->theme.SEPARATOR.$filename.\".css\\\"/>\";\r\n\t\t}", "public function generate()\n {\n $stub = $this->finder->get(__DIR__ . '/../stubs/composerJson.stub');\n\n $stub = $this->replaceContentInStub($stub);\n\n $this->finder->put($this->themePathForFile($this->options['name'], 'composer.json'), $stub);\n }", "function my_theme_files() {\n\n // Scripts\n wp_enqueue_script(\n 'my_theme_main_scripts',\n get_theme_file_uri(\"/js/scripts-bundled.js\"),\n NULL,\n microtime(),\n true\n );\n \n // Nos permite usar variables en el fichero pasado como primer argumento. Para acceder al root_url en javascript\n wp_localize_script( 'my_theme_main_scripts', 'themeData', array(\n 'root_url' => get_site_url(),\n 'nonce' => wp_create_nonce('wp_rest')\n ));\n // si tuviesemos que cargar jquery\n // wp_enqueue_script(\n // 'my_theme_main_scripts',\n // get_theme_file_uri(\"/js/scripts-bundled.js\"),\n // array('jquery'),\n // 1.0,\n // true\n // );\n\n wp_enqueue_style( 'custom-google-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:100,300,300i,400,,400i,700,700i');\n\n // Font awesome\n wp_enqueue_style(\n 'font-awesome',\n 'https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'\n );\n\n // style.css\n wp_enqueue_style(\n 'my_theme_main_styles',\n get_stylesheet_uri(),\n NULL,\n microtime()\n );\n }", "function __preRun_Theme()\n {\n\n //currently specified theme\n $current_theme = $this->data['fields']['settings_general']['theme']; //get content of language folder\n $themes_folder = directory_map(PATHS_APPLICATION_FOLDER . 'themes', false, false);\n /* get each 'folder' name (only folders in first level)\n * - at this first stage, we only check the admin themes\n * - assume its a valid theme\n * - add it to array and pulldown\n */\n $this->data['lists']['all_themes'] = '';\n foreach ($themes_folder as $key => $value) {\n\n //add folder name to theme array\n $this->data['themes_available'][] = $key; //add folder name to pull down list\n $this->data['lists']['all_themes'] .= '<option value=\"' . $key . '\">' . ucfirst($key) . '</option>';\n }\n\n // check if theme that is currently set in settings_general, physically exists\n if (!in_array($current_theme, $this->data['themes_available'])) {\n\n //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n $message = '<b>File: </b>' . __file__ . '<br/>\n <b>Function: </b>' . __function__ . '<br/>\n <b>Line: </b>' . __line__ . '<br/>\n <b>Notes: </b> Specified theme could not be found (' . $current_theme . ')'; //display error\n show_error($message, 500); //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n\n }\n\n /* now save the current theme in a constant for global use\n * also set the client theme to same name\n */\n define('PATHS_ADMIN_THEME', FCPATH . \"application/themes/$current_theme/admin/\");\n define('PATHS_CLIENT_THEME', FCPATH . \"application/themes/$current_theme/client/\");\n define('PATHS_COMMON_THEME', FCPATH . \"application/themes/$current_theme/common/\"); //check if client theme/folder also exists\n if (!is_dir(PATHS_CLIENT_THEME)) {\n\n //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n $message = '<b>File: </b>' . __file__ . '<br/>\n <b>Function: </b>' . __function__ . '<br/>\n <b>Line: </b>' . __line__ . '<br/>\n <b>Notes: </b> Specified [client] theme could not be found (' . $current_theme . ')'; //display error\n show_error($message, 500); //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n\n }\n }", "protected function createTheme()\n\t{\n\t\t// check if the the theme exists\n\t\tif(is_dir(FRONTENDPATH . 'themes/' . $this->themeName)) return false;\n\n\t\t// create the dirs\n\t\t$this->createDirs();\n\n\t\t// create the files\n\t\t$this->createFiles();\n\n\t\t// set info in the database\n\t\tif(!$this->createDatabaseInfo()) return false;\n\n\t\t// return\n\t\treturn true;\n\t}" ]
[ "0.73179835", "0.6729057", "0.6618808", "0.6562734", "0.6556253", "0.6525931", "0.6344903", "0.63421357", "0.6321902", "0.63207793", "0.6315743", "0.6307796", "0.6307786", "0.63022274", "0.62725216", "0.62630606", "0.6257728", "0.622988", "0.6216968", "0.61987376", "0.61868286", "0.615142", "0.6150538", "0.61166817", "0.6094247", "0.6078163", "0.60639405", "0.605174", "0.60485744", "0.60436314" ]
0.78395283
0
Calls the GenerateThemeCommand which Installs and Dumps the theme file for the current theme.
public function installTheme() { // Create a new Application, which we can use to run the GenerateThemeCommand // Inject the kernel because thats required $app = new Application($this->kernel); // Add the Other commands our command will run $app->add(new AssetsInstallCommand()); $app->add(new DumpCommand()); // Create a new GenerateThemeCommand so we can run it $themeCommand = new GenerateThemeCommand(); // Set the Application, so the Command can run $themeCommand->setApplication($app); // Find the full path to the web directory // Remove app from the kernelRootDir e.g. /path/Corvus/app // As /path/Corvus/app/../web doesnt work $webDirectory = substr($this->getKernelRootDir(), 0, -3) . 'web'; // The String input sends the path to the web directory to the Command, // So that the assets can be installed to the web directory $resultCode = $themeCommand->run(new StringInput($webDirectory), new NullOutput()); // return the status code indicating status return $resultCode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function generateTheme()\n {\n // Get the current theme folder\n $themePath = $this->getThemePath();\n \n // Create a Less parse so we can compile the theme\n $lessParser = new \\Less_Parser();\n\n // If a theme.json file already exist, we can use the details inside to apply\n // custom modifications to the base bootstrap theme\n if (file_exists($themePath . '/theme.json')) {\n $themeOptions = file_get_contents($themePath . '/theme.json');\n $themeOptions = json_decode($themeOptions);\n }\n\n // Try to parse the source files and modify the variables if theme.json exists\n try {\n $lessParser->parseFile($this->getKernelRootDir() . '/../vendor/ilp/bootstrap-theme-bundle/ILP/BootstrapThemeBundle/Resources/public/Cluckles/build/less/bootstrap.less');\n \n if (isset($themeOptions)) {\n $lessParser->ModifyVars($themeOptions);\n }\n } catch (Exception $ex) {\n }\n\n // Now get the compiled CSS and save it in the current theme folder\n $compiledCss = $lessParser->getCss();\n\n // Save the compiled theme file to the current Theme directory\n file_put_contents($themePath . '/theme.css', $compiledCss);\n \n // Now Install/Dump the Theme so the changes to the css files will appear\n return $this->installTheme();\n }", "protected function generateTheme()\n {\n // Create base themes directory\n if (!$this->files->isDirectory(public_path(config('themes.paths.base')))) {\n $this->files->makeDirectory(public_path(config('themes.paths.base')));\n }\n\n $directory = config('themes.paths.absolute') . '/' . $this->container['slug'];\n $source = __DIR__ . '/../../../resources/theme';\n\n $this->files->makeDirectory($directory);\n\n $sourceFiles = $this->files->allFiles($source, true);\n\n foreach ($sourceFiles as $file) {\n $contents = $this->replacePlaceholders($file->getContents());\n $subPath = $file->getRelativePathname();\n\n $filePath = $directory . '/' . $subPath;\n $dir = dirname($filePath);\n\n if (!$this->files->isDirectory($dir)) {\n $this->files->makeDirectory($dir, 0755, true);\n }\n\n $this->files->put($filePath, $contents);\n }\n }", "public function generate()\n {\n $stub = $this->finder->get(__DIR__ . '/../stubs/composerJson.stub');\n\n $stub = $this->replaceContentInStub($stub);\n\n $this->finder->put($this->themePathForFile($this->options['name'], 'composer.json'), $stub);\n }", "public function generate()\n {\n if (!$this->configurationHandler->isTheme() || $this->theme->getName() != $this->configurationHandler->handledTheme()) {\n return;\n }\n\n $templates = array_keys($this->templates[\"template\"]);\n $homepage = json_decode(file_get_contents($this->configurationHandler->pagesDir() . '/' .$this->configurationHandler->homepage() . '/page.json'), true);\n $homepageTemplate = $homepage[\"template\"];\n if (!in_array($homepageTemplate, $templates)) {\n $homepageTemplate = $templates[0];\n }\n\n $themeDefinition = array(\n \"home_template\" => $homepageTemplate,\n \"templates\" => $templates,\n );\n\n $this->synchronizeThemeSlots();\n FilesystemTools::writeFile($this->themeDir . '/theme.json', json_encode($themeDefinition));\n }", "protected function setupTheme()\n {\n File::cleanDirectory(resource_path('views/vendor/spark'));\n File::copyDirectory(__DIR__ . '/stubs/spark', resource_path('views/vendor/spark'));\n $this->setupWelcomePage();\n }", "function install_theme($theme){\n\t\n\t\tif(!is_writeable(\"./themes\"))\n\t\t\treturn 0;\n\t\t\t\n\t\t// If the theme already has the start and end on it then remove though\n\t\t$theme = eregi_replace(\"^x7cs_\",\"\",$theme);\n\t\t$theme = eregi_replace(\"\\.zip$\",\"\",$theme);\n\t\t\t\n\t\t// Unzip the theme\n\t\t$shell = exec(\"unzip -o ./mods/x7cs_$theme.zip -d ./themes/$theme\");\n\t\t\n\t\treturn 1;\n\t}", "public function run()\n {\n //\n $themes = [\n ['name' => 'charity','active'=> false, 'id'=>1 ],\n ['name' => 'eStartup', 'active'=> true,'id'=>2 ],\n ];\n foreach($themes as $theme){\n App\\Theme::create($theme);\n }\n }", "function install_theme_information() {\n\t//TODO: This function needs a LOT of UI work :)\n\tglobal $tab, $themes_allowedtags;\n\n\t$api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) ));\n\n\tif ( is_wp_error($api) )\n\t\twp_die($api);\n\n\t// Sanitize HTML\n\tforeach ( (array)$api->sections as $section_name => $content )\n\t\t$api->sections[$section_name] = wp_kses($content, $themes_allowedtags);\n\tforeach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )\n\t\t$api->$key = wp_kses($api->$key, $themes_allowedtags);\n\n\tiframe_header( __('Theme Install') );\n\n\tif ( empty($api->download_link) ) {\n\t\techo '<div id=\"message\" class=\"error\"><p>' . __('<strong>Error:</strong> This theme is currently not available. Please try again later.') . '</p></div>';\n\t\tiframe_footer();\n\t\texit;\n\t}\n\n\tif ( !empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>') )\n\t\techo '<div class=\"updated\"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';\n\telse if ( !empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<') )\n\t\techo '<div class=\"updated\"><p>' . __('<strong>Warning:</strong> This theme has not been marked as <strong>compatible</strong> with your version of WordPress.') . '</p></div>';\n\n\t// Default to a \"new\" theme\n\t$type = 'install';\n\t// Check to see if this theme is known to be installed, and has an update awaiting it.\n\t$update_themes = get_transient('update_themes');\n\tif ( is_object($update_themes) && isset($update_themes->response) ) {\n\t\tforeach ( (array)$update_themes->response as $theme_slug => $theme_info ) {\n\t\t\tif ( $theme_slug === $api->slug ) {\n\t\t\t\t$type = 'update_available';\n\t\t\t\t$update_file = $theme_slug;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t$themes = get_themes();\n\tforeach ( $themes as $this_theme ) {\n\t\tif ( is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug ) {\n\t\t\tif ( $this_theme['Version'] == $api->version ) {\n\t\t\t\t$type = 'latest_installed';\n\t\t\t} elseif ( $this_theme['Version'] > $api->version ) {\n\t\t\t\t$type = 'newer_installed';\n\t\t\t\t$newer_version = $this_theme['Version'];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n?>\n\n<div class='available-theme'>\n<img src='<?php echo esc_url($api->screenshot_url) ?>' width='300' class=\"theme-preview-img\" />\n<h3><?php echo $api->name; ?></h3>\n<p><?php printf(__('by %s'), $api->author); ?></p>\n<p><?php printf(__('Version: %s'), $api->version); ?></p>\n\n<?php\n$buttons = '<a class=\"button\" id=\"cancel\" href=\"#\" onclick=\"tb_close();return false;\">' . __('Cancel') . '</a> ';\n\nswitch ( $type ) {\ndefault:\ncase 'install':\n\tif ( current_user_can('install_themes') ) :\n\t$buttons .= '<a class=\"button-primary\" id=\"install\" href=\"' . wp_nonce_url(admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '\" target=\"_parent\">' . __('Install Now') . '</a>';\n\tendif;\n\tbreak;\ncase 'update_available':\n\tif ( current_user_can('update_themes') ) :\n\t$buttons .= '<a class=\"button-primary\" id=\"install\"\thref=\"' . wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '\" target=\"_parent\">' . __('Install Update Now') . '</a>';\n\tendif;\n\tbreak;\ncase 'newer_installed':\n\tif ( current_user_can('install_themes') || current_user_can('update_themes') ) :\n\t?><p><?php printf(__('Newer version (%s) is installed.'), $newer_version); ?></p><?php\n\tendif;\n\tbreak;\ncase 'latest_installed':\n\tif ( current_user_can('install_themes') || current_user_can('update_themes') ) :\n\t?><p><?php _e('This version is already installed.'); ?></p><?php\n\tendif;\n\tbreak;\n} ?>\n<br class=\"clear\" />\n</div>\n\n<p class=\"action-button\">\n<?php echo $buttons; ?>\n<br class=\"clear\" />\n</p>\n\n<?php\n\tiframe_footer();\n\texit;\n}", "function __preRun_Theme()\n {\n\n //currently specified theme\n $current_theme = $this->data['fields']['settings_general']['theme']; //get content of language folder\n $themes_folder = directory_map(PATHS_APPLICATION_FOLDER . 'themes', false, false);\n /* get each 'folder' name (only folders in first level)\n * - at this first stage, we only check the admin themes\n * - assume its a valid theme\n * - add it to array and pulldown\n */\n $this->data['lists']['all_themes'] = '';\n foreach ($themes_folder as $key => $value) {\n\n //add folder name to theme array\n $this->data['themes_available'][] = $key; //add folder name to pull down list\n $this->data['lists']['all_themes'] .= '<option value=\"' . $key . '\">' . ucfirst($key) . '</option>';\n }\n\n // check if theme that is currently set in settings_general, physically exists\n if (!in_array($current_theme, $this->data['themes_available'])) {\n\n //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n $message = '<b>File: </b>' . __file__ . '<br/>\n <b>Function: </b>' . __function__ . '<br/>\n <b>Line: </b>' . __line__ . '<br/>\n <b>Notes: </b> Specified theme could not be found (' . $current_theme . ')'; //display error\n show_error($message, 500); //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n\n }\n\n /* now save the current theme in a constant for global use\n * also set the client theme to same name\n */\n define('PATHS_ADMIN_THEME', FCPATH . \"application/themes/$current_theme/admin/\");\n define('PATHS_CLIENT_THEME', FCPATH . \"application/themes/$current_theme/client/\");\n define('PATHS_COMMON_THEME', FCPATH . \"application/themes/$current_theme/common/\"); //check if client theme/folder also exists\n if (!is_dir(PATHS_CLIENT_THEME)) {\n\n //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n $message = '<b>File: </b>' . __file__ . '<br/>\n <b>Function: </b>' . __function__ . '<br/>\n <b>Line: </b>' . __line__ . '<br/>\n <b>Notes: </b> Specified [client] theme could not be found (' . $current_theme . ')'; //display error\n show_error($message, 500); //---- CODEIGNITER SYSTEM ERROR HANDLING-----\\\\\n\n }\n }", "public function run()\n\t{\n\t\tif( !empty($this->theme_menu) ) {\n\t\t\tadd_action('admin_menu', 'create_theme_menu');\t\t\n\t\t\teval(\"function create_theme_menu() { global \\$theme; \\$theme->add_menu(\\$theme->theme_menu); }\");\n\t\t}\n\t\t\n\t\tadd_action('admin_head', 'theme_css');\n\t\teval(\"function theme_css() {\n\t\t\t\\$url = get_bloginfo('template_url') .'/THBFramework/admin.css';\n\t\t\techo '<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"' . \\$url . '\\\" />';\n\t\t}\");\n\t}", "function installTheme($filename,$fileinfo=array()){\r\n\t\treturn $this->installItemFromZip($filename, $fileinfo, 'wp-content/themes/');\r\n\t}", "protected function createTheme()\n\t{\n\t\t// check if the the theme exists\n\t\tif(is_dir(FRONTENDPATH . 'themes/' . $this->themeName)) return false;\n\n\t\t// create the dirs\n\t\t$this->createDirs();\n\n\t\t// create the files\n\t\t$this->createFiles();\n\n\t\t// set info in the database\n\t\tif(!$this->createDatabaseInfo()) return false;\n\n\t\t// return\n\t\treturn true;\n\t}", "public function theme_first_run() {\n\t\t// Flush permalink\n\t\tflush_rewrite_rules();\n\n\t\t// Generate default Theme, Template, and Template Part\n\t\tif ( ! TF_Model::theme_exists() ) {\n\t\t\t$this->import_base_theme();\n\t\t}\n\n\t\t// Redirect to about screen\n\t\twp_safe_redirect( esc_url_raw( add_query_arg( array( 'page' => 'tf-about' ), admin_url( 'index.php' ) ) ) );\n\t}", "public function generate(Request $request) {\n // 1. Setup elements needed.\n $files = []; // Files that will be created for this theme.\n $functions = []; // Theme functions to be included.\n $plugin_definitions = $this->type->getDefinitions();\n $original_theme = $request->request->get('theme');\n $new_theme = $request->request->get('new_theme');\n $uri = drupal_get_path('theme', $original_theme) . \"/{$original_theme}.info.yml\";\n\n // 2. Load our templates\n $query = \\Drupal::entityQuery('template');\n $entity_ids = $query->execute();\n $templates = \\Drupal::entityTypeManager()->getStorage('template')->loadMultiple($entity_ids);\n\n // Next sort by weight.\n usort($plugin_definitions, function($a, $b) {\n return $a['weight'] < $b['weight'];\n });\n\n $data = [];\n\n foreach($plugin_definitions as $id => $definition) {\n $plugin = $this->manager->createInstance($id, [ ]);\n $data[] = $plugin->generate($templates);\n }\n\n // 3. Generate the theme, for now just download - zip.\n foreach($data as $row) {\n // 3. a. create the files.\n\n\n }\n\n\n $theme_info = \\Symfony\\Component\\Yaml\\Yaml::parse(file_get_contents($uri));\n $libraries_info = \\Symfony\\Component\\Yaml\\Yaml::parse(file_get_contents(drupal_get_path('theme', $original_theme) . \"/{$original_theme}.libraries.yml\"));\n\n $theme_info['name'] = $new_theme;\n $theme_info['base theme'] = $original_theme;\n $theme_info['description'] = \"A {$original_theme} based theme built by Dragon Drupal.\";\n $theme_info['dragon_built'] = 'Yes';\n\n $theme_info['libraries']= [\n \"{$new_theme}/global\"\n ];\n\n $theme_uri = drupal_get_path('theme', $original_theme);\n $theme_parts = explode('/', $theme_uri);\n $theme_parts[count($theme_parts)-1] = $new_theme;\n\n if ($key = array_search('contrib', $theme_parts)) {\n $theme_parts[$key] = 'custom';\n }\n\n $theme_uri = implode('/', $theme_parts);\n if (!file_exists($theme_uri)) {\n mkdir($theme_uri, 0777, true);\n mkdir($theme_uri . '/dragon/css', 0777, true);\n mkdir($theme_uri . '/templates/system', 0777, true);\n }\n\n // Store the theme info.\n $info_yaml['libraries'] = [\n $new_theme . '/global'\n ];\n $info_yaml = \\Symfony\\Component\\Yaml\\Yaml::dump($theme_info);\n $files[] = [\n 'filename' => \"{$new_theme}/{$new_theme}.info.yml\",\n 'contents' => $info_yaml\n ];\n\n // @todo find out how do do this via Yaml dump..\n $files[] = [\n 'filename' => \"{$new_theme}/{$new_theme}.libraries.yml\",\n 'contents' =>\n \"global:\n css:\n theme:\n dragon/css/style.css: {}\"\n ];\n\n // 2. Load all templates that are associated for the target theme from the database.\n $query = \\Drupal::entityQuery('template');\n $entity_ids = $query->execute();\n $templates = \\Drupal::entityTypeManager()->getStorage('template')->loadMultiple($entity_ids);\n\n // 3. Update the current physical templates.\n $libraries= [];\n $style_css ='';\n foreach($templates as $id => $template) {\n if ($template->get('id') == $original_theme. '-' . $template->get('template')) {\n $id = $template->get('id');\n $data = $template->get('layout');\n\n $template_path = \"{$new_theme}/templates/system/\" . $template->get('template');\n $css_content .= \"\\n\\r\" . $data['gjs-css'];\n $files[] = [\n 'filename' => $template_path,\n 'contents' => $data['gjs-html']\n ];\n $style_css .= $css_content . \"\\n\\r\";\n }\n }\n\n $files[] = [\n 'filename' => \"{$new_theme}/dragon/css/style.css\",\n 'contents' => $style_css,\n ];\n\n // 8. Create the zip file for the theme.\n $zip = new \\ZipArchive();\n $filepath = drupal_realpath('public://') . \"/{$new_theme}.zip\";\n if (file_exists($filepath)) {\n unlink($filepath);\n }\n if ($zip->open($filepath, \\ZipArchive::CREATE)!==TRUE) {\n \\Drupal::logger('dragon')->notice(\"Could not open:\" . $filepath);\n return new JsonResponse([\n 'success' => 0\n ]);\n }\n\n // Add all of our required files to the theme.\n foreach($files as $file) {\n $zip->addFromString($file['filename'], $file['contents']);\n }\n $zip->close();\n\n return new JsonResponse([\n 'success' => 1,\n 'uri' => file_create_url(\"public://{$new_theme}.zip\"),\n ]);\n }", "public function run() {\n\t\t\tfactory(GameTheme::class, 100)->create();\n\t\t}", "public function ThemeEngineRender() {\n // Save to session before output anything\n $this->session->StoreInSession();\n\n // Get the paths and settings for the theme\n $themeName = $this->config['theme']['name'];\n $themePath = MOVIC_INSTALL_PATH . \"/themes/{$themeName}\";\n $themeUrl = $this->request->base_url . \"themes/{$themeName}\";\n \n // Add stylesheet path to the $mo->data array\n $this->data['stylesheet'] = \"{$themeUrl}/style.css\";\n\n // Include the global functions.php and the functions.php that are part of the theme\n $mo = &$this;\n include(MOVIC_INSTALL_PATH . '/themes/functions.php');\n $functionsPath = \"{$themePath}/functions.php\";\n if(is_file($functionsPath)) {\n include $functionsPath;\n }\n\n // Extract $mo->data and $mo->view->data to own variables and handover to the template file\n extract($this->data); \n extract($this->views->GetData()); \n include(\"{$themePath}/default.tpl.php\");\n }", "public function processConfigs(){\n $savePath = _PS_ALL_THEMES_DIR_.$this->_theme_dir . \"samples/\";\n if (!is_dir($savePath)) {\n if(!mkdir($savePath , 0755)){\n die(\"Please create folder samples in \"._PS_ALL_THEMES_DIR_.$this->_theme_dir.\" and set permission 755\");\n } \n }\n $id_theme = Context::getContext()->shop->id_theme;\n $theme_name = Context::getContext()->shop->theme_name;\n $theme = Db::getInstance()->executeS('SELECT `responsive`,`default_left_column`,`default_right_column`,`product_per_page` FROM `'. _DB_PREFIX_.'theme` WHERE id_theme='.(int)$id_theme.'');\n \n $theme_meta = Db::getInstance()->executeS('SELECT `id_meta`,`left_column`,`right_column` FROM `'. _DB_PREFIX_.'theme_meta` WHERE id_theme='.(int)$id_theme.'');\n\n $this->_content = '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n <dataSample>';\n $this->_content .= '<fields objectName=\"theme\">';\n $this->getContentXml($theme);\n $this->_content .= '</fields>';\n $this->_content .= '<fields objectName=\"theme_meta\">';\n $this->getContentXml($theme_meta);\n $this->_content .= '</fields>'; \n $this->_content .= \n '</dataSample>';\n $fp = @fopen($savePath.\"themeconfig.xml\", 'w');\n fwrite($fp, $this->_content);\n $this->_content = '';\n fclose($fp);\n $this->_html[\"confirm\"][] .= 'Restore configs theme success';\n }", "function theme_get_theme_archive() {\n if (isset($_REQUEST['id'])) {\n $theme = wp_get_theme($_REQUEST['id']);\n if (!$theme->exists())\n throw new Exception('Error: Theme '.$_REQUEST['id'].' does not exists');\n } else {\n $theme = wp_get_theme();\n }\n\n $current_name = get_template();\n $name = $theme->get_template();\n\n $base_template_dir = $theme->get_template_directory();\n $preview_template_dir = $base_template_dir . '_preview';\n\n if (!file_exists($base_template_dir) || $current_name === $name && !file_exists($preview_template_dir)) {\n throw new Exception('Error: No Theme Folders');\n }\n\n $base_upload_dir = wp_upload_dir();\n if (false !== $base_upload_dir['error']) {\n throw new Exception('Upload folder error!');\n }\n require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');\n\n $archive_name = 'theme_' . uniqid(time()) . '.zip';\n $archive_file = $base_upload_dir['basedir'] . '/' . $archive_name;\n\n $new_name = isset($_REQUEST['themeName']) ? $_REQUEST['themeName'] : $name;\n $editable_version = !isset($_REQUEST['includeEditor']) || $_REQUEST['includeEditor'] === 'true';\n $include_content = isset($_REQUEST['includeContent']) && $_REQUEST['includeContent'] === 'true';\n\n if (!$new_name)\n throw new Exception('Error: theme name is empty');\n\n if ($current_name !== $name && $new_name !== $name)\n throw new Exception(\"Error: renaming not active theme does not supported ($current_name, $name, $new_name)\");\n\n if ($current_name === $name) {\n theme_set_name($base_template_dir . '/style.css', $new_name);\n theme_set_name($preview_template_dir . '/style.css', theme_get_preview_theme_name($new_name));\n FilesHelper::empty_dir($base_template_dir . '/preview', true);\n }\n $preview_new_template = $new_name . '_preview';\n $archive = new PclZip($archive_file);\n\n // move old content to tmp folder\n $tmp_content_dir = $base_upload_dir['basedir'] . '/theme-content';\n FilesHelper::empty_dir($tmp_content_dir, true);\n FilesHelper::rename_if_exists($base_template_dir . '/content', $tmp_content_dir);\n\n if (0 == $archive->create($base_template_dir,\n PCLZIP_OPT_ADD_PATH, $new_name,\n PCLZIP_OPT_REMOVE_PATH, $base_template_dir))\n throw new Exception(\"Error: \" . $archive->errorInfo(true));\n\n if ($editable_version) {\n if ($current_name === $name && 0 == $archive->add($preview_template_dir,\n PCLZIP_OPT_ADD_PATH, $new_name . '/preview/' . $preview_new_template,\n PCLZIP_OPT_REMOVE_PATH, $preview_template_dir))\n throw new Exception(\"Error: \" . $archive->errorInfo(true));\n } else {\n if (($list = $archive->listContent()) == 0)\n throw new Exception(\"Error : \" . $archive->errorInfo(true));\n\n $remove_list = array();\n foreach ($list as $i => $file) {\n if (\n strpos($file['filename'], \"$new_name/export/\") !== false\n || strpos($file['filename'], \".preview.\") !== false\n )\n $remove_list[] = \"$i\";\n }\n\n if (!empty($remove_list) && 0 == $archive->delete(PCLZIP_OPT_BY_INDEX, implode(',', $remove_list)))\n throw new Exception(\"Error: cannot remove export dir\");\n }\n\n if ($include_content) {\n $content_dir = theme_include_content();\n if (false !== $content_dir) {\n if (0 == $archive->add($content_dir,\n PCLZIP_OPT_ADD_PATH, $new_name . '/content/',\n PCLZIP_OPT_REMOVE_PATH, $content_dir)) {\n throw new Exception(\"Content-zip error: \" . $archive->errorInfo(true));\n }\n }\n }\n\n // restore content folder\n FilesHelper::rename_if_exists($tmp_content_dir, $base_template_dir . '/content');\n\n if ($current_name === $name) {\n theme_set_name($base_template_dir . '/style.css', $current_name);\n theme_set_name($preview_template_dir . '/style.css', theme_get_preview_theme_name($current_name));\n }\n return array(\n 'path' => $archive_file,\n 'name' => $new_name\n );\n}", "public function ThemeEngineRender() {\n\t\t//Get paths and settings for the theme\n\t\t$themeName = $this->config['theme']['name'];\n\t\t$themePath = LYDIGAMVC_INSTALL_PATH . \"/themes/{$themeName}\";\n\t\t$themeURL = $this->request->base_url . \"themes/{$themeName}\";\n\n\t\t//Add stylesheet path to the data array\n\t\t$this->data['stylesheet'] = \"{$themeURL}/style.css\";\n\n\t\t// Include the global functions.php and the functions.php\n\t\t// that is part of the theme.\n\t\t$ly = &$this;\n\t\t$functionsPath = \"{$themePath}/functions.php\";\n\t\tinclude LYDIGAMVC_INSTALL_PATH . '/themes/functions.php';\n\t\tif (is_file($functionsPath)) {\n\t\t\tinclude $functionsPath;\n\t\t}\t\n\n\t\t// Extract $ly->data to own variables and hand over to the\n\t\t// template file.\n\t\textract($this->data);\n\t\tinclude(\"{$themePath}/default.tpl.php\");\n\t}", "private function import_base_theme() {\n\t\tglobal $TF;\n\n\t\t$zip_file = $TF->framework_path() . '/includes/data/theme-base.zip';\n\t\t$filename = $TF->framework_path() . '/theme_export.xml';\n\t\tif ( ! function_exists( 'WP_Filesystem' ) ) {\n\t\t\trequire_once( ABSPATH . 'wp-admin/includes/file.php' );\n\t\t}\n\t\tWP_Filesystem();\n\t\tglobal $wp_filesystem;\n\n\t\tif ( $wp_filesystem->exists( $zip_file ) ) {\n\t\t\t\n\t\t\tunzip_file( $zip_file, $TF->framework_path() );\n\n\t\t\tif( $wp_filesystem->exists( $filename ) ) {\n\t\t\t\t// Remove function hooked in class-tf-engine-style-loader.php\n\t\t\t\tremove_action( 'tf_import_end', array( 'TF_Model', 'create_stylesheets' ) );\n\t\t\t\tadd_action( 'tf_import_end', array( $this, 'set_initial_active_theme' ) );\n\n\t\t\t\t$import = new TF_Import();\n\t\t\t\t$import->fetch_attachments = true;\n\t\t\t\t$import->base_theme = true;\n\t\t\t\t$import->import( $filename );\n\t\t\t\t$wp_filesystem->delete( $filename );\n\t\t\t}\n\t\t}\n\t}", "public function create_theme($data)\n {\n \n //Validate input.\n $data = Data($data)->having('name', 'title')\n ->name->validate('Theme name', array('required', 'string', 'not_empty', 'component_name'))->back()\n ->title->validate('Theme title', array('required', 'string', 'not_empty'))->back();\n \n //What's the path?\n $path = PATH_THEMES.DS.$data->name;\n \n //Define basic sub-folders.\n $subpaths = array(\n 'package' => '.package',\n 'css' => 'css',\n 'img' => 'img'\n );\n \n $gitignore = array(\n 'img'\n );\n \n //Where to copy some template files.\n $copy = array(\n array(null, 'theme.php'),\n array('css', 'style.css'),\n array('package', '.htaccess'),\n array('package', 'DBUpdates.php'),\n array('package', 'package.json')\n );\n \n //The strings to replace inside template files.\n $replace = array(\n '{{TITLE}}' => $data->title->get('string'),\n '{{NAME}}' => $data->name->get('string')\n );\n \n //Perform the filling of the folder.\n $this->make_it('theme', $path, $subpaths, $gitignore, $copy, $replace);\n \n //That should be it!\n return $path;\n \n }", "public function install() {\n $pkg = parent::install();\n PageTheme::add('starter', $pkg);\n\n //Install Concrete5 Page types\n $this->addCollectionTypes($pkg);\n //Create pages if we have to.\n $this->checkCreatePages();\n //Create blocks if we need to\n $this->checkCreateBlocks();\n }", "public function saveTheme($themeData)\n {\n // Get the current theme folder\n $themePath = $this->getThemePath();\n \n // Decode the JSON into an array\n $themeData = json_decode($themeData, true);\n \n // Save the theme.json file in the current theme folder\n file_put_contents($themePath . '/theme.json', json_encode($themeData['json']));\n\n // If the CSS has been provided, it would have already been compiled Client Side\n if (array_key_exists('css', $themeData)) {\n // So Save the Compiled CSS\n file_put_contents($themePath . '/theme.css', $themeData['css']);\n \n // Now install the Theme and Skip generating the Css server side\n // This avoids problems with the generating failing on shared hosting\n // where the PHP will timeout\n return $this->installTheme();\n }\n\n // Now generate the theme using bootstrap.less + theme.json\n return $this->generateTheme();\n }", "function page_themes() {\n $f3=$this->framework;\n\t\t$f3->set('themes', $this->themes() );\n\t\t$f3->set('content','themes.html');\n\t\t$f3->set('html_title','Themes - '.$this->site_title() );\n\t\tprint Template::instance()->render( \"page.html\" );\n\t}", "public static function startWizard($args = null)\n {\n try {\n $themes_path = self::askForThemesPath();\n self::build(['themes-path' => $themes_path]);\n Dialog::write('Configuration completed!', 'green');\n } catch (\\Exception $e) {\n Dialog::write($e->getMessage(), 'red');\n exit;\n }\n }", "public function saveThemeConfigs() {\n\n $id_shop = Context::getContext()->shop->id;\n $customName = $id_shop.'custom';\n\n //add new file if don't exist\n if (!file_exists($this->themePath . 'css/local/'.$customName.'.css')) {\n if (!is_dir($this->themePath . 'css/local/')) {\n mkdir($this->themePath . 'css/local/', 755);\n }\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, \"\", 'css');\n }\n\n if (!file_exists($this->themePath . 'js/local/'.$customName.'.js')) {\n if (!is_dir($this->themePath . 'js/local/')) {\n mkdir($this->themePath . 'js/local/', 755);\n }\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, \"\", 'js');\n }\n\n\n $t = $this->themePath . 'css/local/'.$customName.'.css';\n if (is_dir($this->themePath . 'css/local/')) {\n if (is_writeable($t)) {\n $css = trim(Tools::getValue($this->getConfigName('C_CODECSS')));\n if ($css) {\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, $css, 'css');\n } else if (file_exists($t) && filesize($t)) {\n @unlink($t);\n LeoFrameworkHelper::writeToCache($this->themePath . 'css/local/', $customName, \"\", 'css');\n }\n }\n }\n\n $t = $this->themePath . 'js/local/'.$customName.'.js';\n if (is_dir($this->themePath . 'js/local/')) {\n if (is_writeable($t)) {\n $js = trim(Tools::getValue($this->getConfigName('C_CODEJS')));\n if ($js) {\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, $js, 'js');\n } else if (file_exists($t) && filesize($t)) {\n @unlink($t);\n LeoFrameworkHelper::writeToCache($this->themePath . 'js/local/', $customName, \"\", 'js');\n }\n }\n }\n\n\n $languages = Language::getLanguages(false);\n $this->makeFieldsOptions();\n $content = '';\n //echo \"<pre>\";print_r($this->fields_options);die;\n foreach ($this->fields_options as $f) {\n foreach ($f['form']['input'] as $input) {\n if ($input['name'] == $this->getConfigName('C_CODECSS')) {\n continue;\n }\n if (isset($input['lang'])) {\n $data = array();\n foreach ($languages as $lang) {\n $v = Tools::getValue(trim($input['name']) . '_' . $lang['id_lang']);\n $data[$lang['id_lang']] = $v ? $v : $input['default'];\n }\n Configuration::updateValue(trim($input['name']), $data);\n } else {\n $v = Tools::getValue($input['name'], Configuration::get($input['name']));\n $dataSave = $v ? $v : $input['default'];\n Configuration::updateValue(trim($input['name']), $dataSave );\n if(trim($input['name']) == $this->getConfigName('listing_mode')){\n if(trim($dataSave) == '') $dataSave = 'grid';\n $content .= '\n{assign var=\"LISTING_GRIG_MODE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column')){\n if(trim($dataSave) == '') $dataSave = '3';\n $content .= '\n{assign var=\"LISTING_PRODUCT_COLUMN\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_tablet')){\n if(trim($dataSave) == '') $dataSave = '2';\n $content .= '\n{assign var=\"LISTING_PRODUCT_TABLET\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_mobile')){\n if(trim($dataSave) == '') $dataSave = '1';\n $content .= '\n{assign var=\"LISTING_PRODUCT_MOBILE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('grid_column_module')){\n if(trim($dataSave) == '') $dataSave = '4';\n $content .= '\n{assign var=\"LISTING_PRODUCT_COLUMN_MODULE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_color')){\n $content .= '\n{assign var=\"ENABLE_COLOR\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_wishlist')){\n $content .= '\n{assign var=\"ENABLE_WISHLIST\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }elseif(trim($input['name']) == $this->getConfigName('enable_responsive')){\n $content .= '{assign var=\"ENABLE_RESPONSIVE\" value=\"'.$dataSave.'\" scope=\"global\"}';\n }\n }\n }\n }\n if (is_writeable($this->themePath . 'layout/setting.tpl')) {\n $content .= '\n{if $LISTING_PRODUCT_COLUMN==\"5\"}\n {assign var=\"colValue\" value=\"col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-2-4\" scope=\"global\"}\n{else}\n {assign var=\"colValue\" value=\"col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-{12/$LISTING_PRODUCT_COLUMN}\" scope=\"global\"}\n{/if}';\n\n LeoFrameworkHelper::writeToCache($this->themePath . 'layout/', 'setting', $content, 'tpl');\n }\n\n }", "function setupTheme() {\n\tglobal $_zp_gallery, $_zp_current_album, $_zp_current_search, $_zp_themeroot, $_zp_last_modified;\n\tif (!is_object($_zp_gallery)) $_zp_gallery = new Gallery();\n\t$albumtheme = '';\n\tif (in_context(ZP_SEARCH_LINKED)) {\n\t\t$name = $_zp_current_search->dynalbumname;\n\t\tif (!empty($name)) {\n\t\t\t$album = new Album($_zp_gallery, $name);\n\t\t} else {\n\t\t\t$album = NULL;\n\t\t}\n\t} else {\n\t\t$album = $_zp_current_album;\n\t}\n\t$theme = $_zp_gallery->getCurrentTheme();\n\t$id = 0;\n\tif (!is_null($album)) {\n\t\t$parent = getUrAlbum($album);\n\t\t$albumtheme = $parent->getAlbumTheme();\n\t\tif (!empty($albumtheme)) {\n\t\t\t$theme = $albumtheme;\n\t\t\t$id = $parent->id;\n\t\t}\n\t}\n\t$theme = zp_apply_filter('setupTheme', $theme);\n\t$themeindex = getPlugin('index.php', $theme);\n\tif (empty($theme) || empty($themeindex)) {\n\t\theader('Last-Modified: ' . $_zp_last_modified);\n\t\theader('Content-Type: text/html; charset=' . LOCAL_CHARSET);\n\t\t?>\n\t\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t<head>\n\t\t</head>\n\t\t<body>\n\t\t\t<strong><?php printf(gettext('Zenphoto found no theme scripts. Please check the <em>%s</em> folder of your installation.'),THEMEFOLDER); ?></strong>\n\t\t</body>\n\t\t</html>\n\t\t<?php\n\t\texit();\n\t} else {\n\t\tloadLocalOptions($id,$theme);\n\t\t$_zp_themeroot = WEBPATH . \"/\".THEMEFOLDER.\"/$theme\";\n\t}\n\treturn $theme;\n}", "function ccs_after_setup_theme() {\n // launching this stuff after theme setup\n WM_theme_support();\n \n}", "public function createTheme($name = NULL) {\n }", "public function run()\n {\n $resources = [\n ['key' => 'nord'],\n ];\n\n Theme::truncate();\n\n foreach($resources as $resource) {\n Theme::create([\n 'key' => $resource['key'],\n ]);\n }\n }" ]
[ "0.7355422", "0.68544763", "0.6703937", "0.66603297", "0.6649216", "0.6393171", "0.63470525", "0.62301755", "0.62249076", "0.62172484", "0.61271006", "0.60814536", "0.60536087", "0.6000442", "0.5948081", "0.5927659", "0.5921924", "0.5884483", "0.5882258", "0.58801985", "0.58317214", "0.5819213", "0.5793634", "0.5770813", "0.5770402", "0.57473505", "0.57445174", "0.57206064", "0.57194084", "0.5707004" ]
0.7272678
1
Find the names of the Folders in the Base Template folder.
public function getTemplateFolders() { return $this->scanFolderNamesInDirectory($this->getTemplateBase()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTemplateDirectories();", "public function getThemeFolders()\n {\n return $this->scanFolderNamesInDirectory($this->getThemeBase());\n }", "public function getAllFolders()\n\t{\n\t\t$templateId = (new \\App\\Db\\Query())->select(['vtiger_field.fieldparams'])\n\t\t\t->from('vtiger_field')\n\t\t\t->where(['vtiger_field.columnname' => 'folderid', 'vtiger_field.tablename' => 'vtiger_notes'])\n\t\t\t->scalar();\n\t\treturn (new \\App\\Db\\Query())\n\t\t\t\t->select(['tree', 'name'])\n\t\t\t\t->from('vtiger_trees_templates_data')\n\t\t\t\t->where(['templateid' => $templateId])\n\t\t\t\t->createCommand()->queryAllByGroup();\n\t}", "public function getFolders()\n {\n return config('themes.paths.generator');\n }", "public function getTemplateDirectories() {\n return [];\n }", "protected function getThemeLocations(){\n\n\t\t\t$templates = $this->removeDuplicates( $this->getHierarchy() );\n\n\t\t\tif( !empty( $templates ) ){\n\t\t\t\t\n\t\t\t\t//general filter:\n\t\t\t\t$templates = apply_filters( \n\t\t\t\t\t\t\t\t'chef_sections_template_files', \n\t\t\t\t\t\t\t\t$templates, \n\t\t\t\t\t\t\t\t$this->object\n\t\t\t\t);\n\n\t\t\t\t//type based filter:\n \t\t$templates = apply_filters( \n \t\t\t\t\t\t'chef_sections_'.$this->type.'_template_files', \n \t\t\t\t\t\t$templates, \n \t\t\t\t\t\t$this->object\n \t\t);\n\n \t\t//sorting\n\t\t\t\t$templates = Sort::appendValues( $templates, '.php' );\n\n\t\t\t}\n\n\t\t\treturn $templates;\n\t\t}", "protected function getAllBaseNames()\n {\n $pluggables = [];\n\n $path = $this->getPath();\n\n if (!is_dir($path)) {\n return $pluggables;\n }\n\n $folders = $this->files->directories($path);\n\n foreach ($folders as $plug) {\n $pluggables[] = basename($plug);\n }\n\n return $pluggables;\n }", "public function folders()\n {\n return $this->content('folders');\n }", "public function getSubDirectories();", "public function getAllDirectoryNames(): array\n {\n $files = glob($this->articleBasePath . '*' , GLOB_ONLYDIR);\n $files = array_map(function(string $file) {\n return basename($file);\n }, $files);\n\n return $files;\n }", "public function themeDirs() {\n\t\t\t$_ThemeDir = new Folder(App::paths()['View'][0] . 'Themed');\n\t\t\treturn $_ThemeDir->read()[0];\n\t\t}", "function get_template_list()\n\t{\n\t\t$verzeichnisse = array ();\n\t\t$pfad = PAPOO_ABS_PFAD . \"/templates/\";\n\t\t$handle = opendir( $pfad );\n\t\twhile (($file = readdir($handle)) !== false) {\n\t\t\tif (is_dir($pfad . $file)) {\n\t\t\t\tif (strpos(\"XXX\" . $file, \".\") != 3) {\n\t\t\t\t\t$verzeichnisse[] = $file; // Nur nicht-unsichtbare Verzeichnisse aufnehmen\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// $dir=$this->diverse->lese_dir(PAPOO_ABS_PFAD.\"/css\");\n\t\treturn $verzeichnisse;\n\t}", "public function folder_listing()\n {\n\t\t//$this->flasher->set_success('');\n $path = $this->company_lib->get_uploads_folder($this->company['id']);\t\t\t\n\t\t$directories = glob($path . '/*' , GLOB_ONLYDIR);\n\t\tfor($i=0; $i < count($directories); $i++) {\n\t\t\t$directory_path = $directories[$i];\n\t\t\t$folderArr = explode(\"/\", $directory_path);\n\t\t\t$subDir = end($folderArr);\n\t\t\t$subDirArr[] = $subDir;\n\t\t}\n\t\t$this->breadcrumbs->push('Folder Listing', 'documents/folder_listing');\n $this->template->title('Folder Listing')\n ->set('subDirArr', $subDirArr)\n ->set_js(['masonry.pkgd.min', 'bootbox-4.4.0.min'])\n ->set_partial('custom_js', 'documents/index_js')\n ->build('documents/folder_listing', $this->data);\n }", "public function formatLayoutTemplateFiles()\n {\n if(defined('THEME_FOLDER')) {\n $name = $this->getName();\n $presenter = substr($name, strrpos(':' . $name, ':'));\n $layout = $this->layout ? $this->layout : 'layout';\n $dir = dirname($this->getReflection()->getFileName());\n $dir = is_dir(\"$dir/templates\") ? $dir : dirname($dir);\n $list = array(\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter/@$layout.latte\",\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter.@$layout.latte\",\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter/@$layout.phtml\",\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter.@$layout.phtml\",\n );\n do {\n $list[] = \"$dir/templates/\" . THEME_FOLDER . \"/@$layout.latte\";\n $list[] = \"$dir/templates/\" . THEME_FOLDER . \"/@$layout.phtml\";\n $dir = dirname($dir);\n } while ($dir && ($name = substr($name, 0, strrpos($name, ':'))));\n return $list;\n } else {\n return parent::formatLayoutTemplateFiles();\n }\n }", "public function index()\n {\n return $this->myFiles->getFolders();\n }", "public function formatTemplateFiles()\n {\n if(defined('THEME_FOLDER')) {\n $name = $this->getName();\n $presenter = substr($name, strrpos(':' . $name, ':'));\n $dir = dirname($this->getReflection()->getFileName());\n $dir = is_dir(\"$dir/templates\") ? $dir : dirname($dir);\n return array(\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter/$this->view.latte\",\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter.$this->view.latte\",\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter/$this->view.phtml\",\n \"$dir/templates/\" . THEME_FOLDER . \"/$presenter.$this->view.phtml\",\n );\n } else {\n return parent::formatTemplateFiles();\n }\n }", "protected function getFileNames()\n {\n return collect(iterator_to_array(\n Finder::create()->in($this->locations)->directories()\n ))->map(function (SplFileInfo $file) {\n return $file->getFilename();\n })->sort();\n }", "public static function getBaseFolders()\n {\n if (self::$baseFolders === null) {\n self::$baseFolders = array();\n defined('PROJECT_FOLDER') && self::$baseFolders[] = VENDOR_FOLDER;\n defined('PROJECT_FOLDER') && self::$baseFolders[] = SOURCE_FOLDER;\n self::$baseFolders = array_filter(self::$baseFolders, 'file_exists');\n }\n\n return self::$baseFolders;\n }", "protected function generateFolders()\n {\n $slug = $this->data['slug'];\n\n //\n $path = $this->plugin->getPath();\n\n if (! $this->files->isDirectory($path)) {\n $this->files->makeDirectory($path);\n }\n\n $path = $this->getPluginPath($slug, true);\n\n $this->files->makeDirectory($path);\n\n //\n $pluginPath = $this->getPluginPath($slug);\n\n // Generate the Plugin directories.\n $mode = $this->option('extended') ? 'extended' : 'default';\n\n $pluginFolders = $this->pluginFolders[$mode];\n\n foreach ($pluginFolders as $folder) {\n $path = $pluginPath .$folder;\n\n $this->files->makeDirectory($path);\n }\n\n // Generate the Language inner directories.\n $languageFolders = $this->getLanguagePaths($slug);\n\n foreach ($languageFolders as $folder) {\n $path = $pluginPath .$folder;\n\n $this->files->makeDirectory($path);\n }\n }", "public function getFolders()\n {\n $folder_types = [];\n $root_folders = [];\n\n if (parent::allowMultiUser()) {\n $folder_types['user'] = 'root';\n }\n\n if ((parent::allowMultiUser() && parent::enabledShareFolder()) || !parent::allowMultiUser()) {\n $folder_types['share'] = 'shares';\n }\n\n foreach ($folder_types as $folder_type => $lang_key) {\n $root_folder_path = parent::getRootFolderPath($folder_type);\n\n array_push($root_folders, (object)[\n 'name' => trans('laravel-filemanager::lfm.title-' . $lang_key),\n 'path' => parent::getInternalPath($root_folder_path),\n 'children' => parent::getDirectories($root_folder_path),\n 'has_next' => !($lang_key == end($folder_types))\n ]);\n }\n\n return view('laravel-filemanager::tree')\n ->with(compact('root_folders'));\n }", "function getTemplateFiles()\r\n\t{\r\n\t\t$directory = \"models/site-templates/\";\r\n\t\t$languages = glob($directory . \"*.css\");\r\n\t\t//print each file name\r\n\t\treturn $languages;\r\n\t}", "public function getFolders()\n {\n $folder_types = [];\n $root_folders = [];\n\n if (parent::allowMultiUser()) {\n $folder_types['user'] = 'root';\n }\n\n if (parent::allowShareFolder()) {\n $folder_types['share'] = 'shares';\n }\n\n foreach ($folder_types as $folder_type => $lang_key) {\n $root_folder_path = $this->getRootFolderPath($folder_type);\n $children = $this->getDirectories($root_folder_path);\n usort($children, function ($a, $b) {\n return strcmp($a->name, $b->name);\n });\n\n array_push($root_folders, (object) [\n 'name' => trans('laravel-filemanager::lfm.title-' . $lang_key),\n 'path' => $this->getInternalPath($root_folder_path),\n 'children' => $children,\n 'has_next' => ! ($lang_key == end($folder_types)),\n ]);\n }\n\n return view('laravel-filemanager::tree')\n ->with(compact('root_folders'));\n }", "function getCreateDirectories() {\n\t\t$directories = parent::getCreateDirectories();\n\t\t$directories[] = 'journals';\n\t\treturn $directories;\n\t}", "public function getPageFolders()\n {\n return $this->page_folders;\n }", "public static function getAllTemplates () {\n return file::getFileList(conf::pathHtdocs() . \"/templates\", array ('dir_only' => true));\n }", "function register_page_builder_folder($folders){\n $folders[] = get_template_directory() .\"/inc/siteorigin/\";\n return $folders;\n }", "public function templates()\n\t{\n\t\t$templates = scandir($this->dir);\n\t\tforeach($templates as $template){\n\t\t\techo '<li>'.$template.'</li>';\n\t\t}\n\t}", "public function getAllTemplates()\n {\n $files = FileManager::getFolders(Application::getBaseDir() . \"templates\");\n unset($files[0]);\n unset($files[1]);\n $Files = array();\n foreach ($files as $value) {\n $Files[$value] = $value;\n }\n return $this->AllTemplates = $Files;\n }", "public function getBaseDirs()\n {\n return $this->baseDirs;\n }", "public static function getAllLayouts()\n\t{\n\t\t$all = (new \\App\\Db\\Query())->select(['name', 'label'])->from('vtiger_layout')->all();\n\t\t$folders = [\n\t\t\t'basic' => Language::translate('LBL_DEFAULT'),\n\t\t];\n\t\tforeach ($all as $row) {\n\t\t\t$folders[$row['name']] = Language::translate($row['label']);\n\t\t}\n\n\t\treturn $folders;\n\t}" ]
[ "0.7193914", "0.66549206", "0.6550329", "0.64823365", "0.6430969", "0.63975376", "0.6372948", "0.61941224", "0.6184696", "0.6107047", "0.6074901", "0.6054647", "0.603981", "0.59765565", "0.5975529", "0.59404624", "0.58990186", "0.58789754", "0.58778894", "0.5858462", "0.58557767", "0.5850612", "0.58293664", "0.5801334", "0.5801296", "0.5778509", "0.5771859", "0.5771034", "0.57519", "0.5740633" ]
0.80407244
0
Find the names of the Folders in the Base Theme folder.
public function getThemeFolders() { return $this->scanFolderNamesInDirectory($this->getThemeBase()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function themeDirs() {\n\t\t\t$_ThemeDir = new Folder(App::paths()['View'][0] . 'Themed');\n\t\t\treturn $_ThemeDir->read()[0];\n\t\t}", "public function getFolders()\n {\n return config('themes.paths.generator');\n }", "public function getTemplateFolders()\n {\n return $this->scanFolderNamesInDirectory($this->getTemplateBase());\n }", "function theme_folder(string $folders = ''){\n return theme_path(str_replace('.','/',$folders));\n }", "public function getAllThemeNames();", "protected function getAllBaseNames()\n {\n $pluggables = [];\n\n $path = $this->getPath();\n\n if (!is_dir($path)) {\n return $pluggables;\n }\n\n $folders = $this->files->directories($path);\n\n foreach ($folders as $plug) {\n $pluggables[] = basename($plug);\n }\n\n return $pluggables;\n }", "function themeslist() {\n\t$layouts = array();\n\n\tif ($handle = opendir(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'layouts')) {\n\t\twhile (false !== ($file = readdir($handle))) {\n\t\t\tif ($file != \".\" && $file != \"..\" && is_dir(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'layouts'.DIRECTORY_SEPARATOR.$file) && file_exists(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'layouts'.DIRECTORY_SEPARATOR.$file.DIRECTORY_SEPARATOR.'css'.DIRECTORY_SEPARATOR.'cometchat.css')) {\n\t\t\t\t$layouts[] = $file;\n\t\t\t}\n\t\t}\n\t\tclosedir($handle);\n\t}\n\n\n\treturn $layouts;\n}", "public static function getBaseFolders()\n {\n if (self::$baseFolders === null) {\n self::$baseFolders = array();\n defined('PROJECT_FOLDER') && self::$baseFolders[] = VENDOR_FOLDER;\n defined('PROJECT_FOLDER') && self::$baseFolders[] = SOURCE_FOLDER;\n self::$baseFolders = array_filter(self::$baseFolders, 'file_exists');\n }\n\n return self::$baseFolders;\n }", "protected function getThemeLocations(){\n\n\t\t\t$templates = $this->removeDuplicates( $this->getHierarchy() );\n\n\t\t\tif( !empty( $templates ) ){\n\t\t\t\t\n\t\t\t\t//general filter:\n\t\t\t\t$templates = apply_filters( \n\t\t\t\t\t\t\t\t'chef_sections_template_files', \n\t\t\t\t\t\t\t\t$templates, \n\t\t\t\t\t\t\t\t$this->object\n\t\t\t\t);\n\n\t\t\t\t//type based filter:\n \t\t$templates = apply_filters( \n \t\t\t\t\t\t'chef_sections_'.$this->type.'_template_files', \n \t\t\t\t\t\t$templates, \n \t\t\t\t\t\t$this->object\n \t\t);\n\n \t\t//sorting\n\t\t\t\t$templates = Sort::appendValues( $templates, '.php' );\n\n\t\t\t}\n\n\t\t\treturn $templates;\n\t\t}", "public function folders()\n {\n return $this->content('folders');\n }", "public static function getFolders() {\n\t\t$folders = self::getDefaultFolders();\n\t\t$folders += self::getUserFolders();\n\t\t\n\t\treturn $folders;\n\t}", "function get_installed_themes($dir = APPPATH . '/views/frontend')\n {\n $result = array();\n $cdir = $files = preg_grep('/^([^.])/', scandir($dir));\n foreach ($cdir as $key => $value) {\n if (!in_array($value, array(\".\", \"..\"))) {\n if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {\n array_push($result, $value);\n }\n }\n }\n return $result;\n }", "public function getAllDirectoryNames(): array\n {\n $files = glob($this->articleBasePath . '*' , GLOB_ONLYDIR);\n $files = array_map(function(string $file) {\n return basename($file);\n }, $files);\n\n return $files;\n }", "public function getList()\r\n {\r\n $themes = array();\r\n\r\n foreach (Glob::glob($this->getTemplatePath().'*') as $dir) {\r\n if (is_dir($dir)) {\r\n $themes[] = str_replace($this->getTemplatePath(), '', $dir);\r\n }\r\n }\r\n return $themes;\r\n }", "public static function get_all()\n\t{\n\t\tif ( !isset( self::$all_themes ) ) {\n\t\t\t$dirs = array( FILMIO_PATH . '/system/themes/*' , FILMIO_PATH . '/3rdparty/themes/*', FILMIO_PATH . '/user/themes/*' );\n\t\t\tif ( Site::is( 'multi' ) ) {\n\t\t\t\t$dirs[] = Site::get_dir( 'config' ) . '/themes/*';\n\t\t\t}\n\t\t\t$themes = array();\n\t\t\tforeach ( $dirs as $dir ) {\n\t\t\t\t$themes = array_merge( $themes, Utils::glob( $dir, GLOB_ONLYDIR | GLOB_MARK ) );\n\t\t\t}\n\n\t\t\t$themes = array_filter( $themes, function($a) {return file_exists( $a . \"/theme.xml\" );} );\n\t\t\t$themefiles = array_map( 'basename', $themes );\n\t\t\tself::$all_themes = array_combine( $themefiles, $themes );\n\t\t}\n\t\treturn self::$all_themes;\n\t}", "function get_all_dirs()\n {\n if(!$this->all_dirs)\n $this->all_dirs = $this->load_dirs('.');\n\n return $this->all_dirs;\n }", "public function available()\n\t{\n\t\t$theme_path = public_path() . '/themes';\n\t\t$themes = array();\n\t\tif (is_dir($theme_path)) {\n\t\t\tforeach(scandir($theme_path) as $dir_content) {\n\t\t\t\tif (is_dir($theme_path . '/' . $dir_content) AND $dir_content != '.' AND $dir_content != '..') {\n\t\t\t\t\tif (file_exists($theme_path . '/' . $dir_content . '/theme.php')) {\n\t\t\t\t\t\t$themes[$dir_content] = require $theme_path . '/' . $dir_content . '/theme.php';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $themes;\n\t}", "public function getThemesList()\n\t{\n\t\t$themes = array();\n\t\t@chmod( TIMBER_ROOT . TIMBER_THEMES_DIR , 0755);\n\t\t$dirs = @scandir( TIMBER_ROOT . TIMBER_THEMES_DIR );\n\n\t\tif( $dirs === false ){\n\t\t\treturn array();\n\t\t}\n\n\t\tforeach ( $dirs as $dir ) {\n\t\t\tif ( $dir === '.' || $dir === '..'){ continue; }\n\t\t\t$dir = strtolower($dir);\n\t\t\tif ( $dir != preg_replace('/[^a-z0-9]/i', '', $dir) ){ continue; }\n\t\t\tif ( (is_dir(TIMBER_ROOT . TIMBER_THEMES_DIR . '/' . $dir)) && (is_file(TIMBER_ROOT . TIMBER_THEMES_DIR . '/' . $dir . '/info.php')) ) {\n\t\t\t\t$themes[] = $dir;\n\t\t\t}\n\t\t}\n\t\treturn $themes;\n\t}", "public function types()\n {\n $directories = $this->file->directories($this->themePath);\n $types = [];\n\n foreach($directories as $directory) {\n $types[] = $this->findDirectoryName($directory);\n }\n\n return $types;\n }", "public function getPageFolders()\n {\n return $this->page_folders;\n }", "public function GetFolderList() {\n\t\t$folders = array();\n\t\t$folder = $this->StatFolder(BackendGoConfig::CONTACTBACKENDFOLDER);\n\t\t$folders[] = $folder;\n\n\t\treturn $folders;\n\t}", "private function BuildFolderList() {\n $config = $this->applyConfig(array());\n $this->folders = array();\n $this->folders['UploadsDir'] = wp_upload_dir();\n $this->folders['PluginDir'] = plugin_dir_path(__FILE__);\n $this->folders['PluginUrl'] = plugins_url('', __FILE__);\n $this->folders['PluginAdmin'] = admin_url() . 'options-general.php?page=' . $config['config']['slug'];\n $this->folders['Basename'] = plugin_basename(__FILE__);\n }", "function themes_directory()\n {\n return WP_CONTENT_DIR . '/themes';\n }", "function find_dirs_in_path($chercher) {\n\t$liste_dossiers = array();\n\n\tif (!$chercher) return array();\n\t\n\t// on retrouve le chemin souhaite prive themes spip\n\t$chercher = explode('/', $chercher);\n\t$dir_base = array_shift($chercher);\n\n\t// Parcourir le chemin\n\tforeach (creer_chemin() as $d) {\n\t\t$dd = $d . $dir_base;\n\t\tif (@is_dir($dd)) {\n\t\t\tif (!count($chercher)) {\n\t\t\t\t$liste_dossiers[] = $dd;\n\t\t\t} else {\n\t\t\t\t// on descend dans les sous chemins\n\t\t\t\t$chercher_copie = $chercher;\n\t\t\t\twhile ($dir = array_shift($chercher_copie)) {\n\t\t\t\t\t$dd .= '/' . $dir;\n\t\t\t\t\tif (@is_dir($dd)) {\n\t\t\t\t\t\tif (!count($chercher_copie)) {\n\t\t\t\t\t\t\t$liste_dossiers[] = $dd;\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}\n\n\treturn $liste_dossiers;\n}", "public function getThemes()\n\t{\n\t\t$themes = array();\n\n\t\t@chmod( TIMBER_ROOT . TIMBER_THEMES_DIR , 0755);\n\t\t$dirs = @scandir( TIMBER_ROOT . TIMBER_THEMES_DIR );\n\n\t\tif( $dirs === false ){\n\t\t\treturn array();\n\t\t}\n\n\t\tforeach ( $dirs as $dir ) {\n\t\t\tif ( ($dir === '.') || ($dir === '..') ){ continue; }\n\t\t\t$dir = strtolower($dir);\n\t\t\tif ( $dir != preg_replace('/[^a-z0-9]/i', '', $dir) ){ continue; }\n\t\t\tif ( (is_dir(TIMBER_ROOT . TIMBER_THEMES_DIR . '/' . $dir)) && (is_file(TIMBER_ROOT . TIMBER_THEMES_DIR . '/' . $dir . '/info.php')) ) {\n\t\t\t\t$themes[] = array(\n\t\t\t\t\t'slug' => $dir,\n\t\t\t\t\t'value' => ucfirst($dir),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn $themes;\n\t}", "function themes($name, $theme_dir) {\r\n $handle = @opendir($theme_dir);\r\n $list = array();\r\n while ($file = readdir($handle)) {\r\n if ($file == '.' || $file == '..')\r\n continue;\r\n // TODO: optimize the string concatenation\r\n if (!is_dir($theme_dir . '/' . $file))\r\n continue;\r\n if (!is_file($theme_dir . '/' . $file . '/theme.php'))\r\n continue;\r\n $list[$theme_dir . '/' . $file] = $file;\r\n }\r\n closedir($handle);\r\n\r\n $this->select($name, $list);\r\n }", "public function getListFromDisk()\n {\n $suffix = 'config/theme.yml';\n $themeDirectories = glob(_PS_ALL_THEMES_DIR_ . '*/' . $suffix, GLOB_NOSORT);\n\n $themes = [];\n foreach ($themeDirectories as $directory) {\n $themes[] = [\n 'name' => basename(substr($directory, 0, -strlen($suffix))),\n 'directory' => substr($directory, 0, -strlen($suffix)),\n ];\n }\n\n return $themes;\n }", "public function index()\n {\n return $this->myFiles->getFolders();\n }", "protected function find_style_dirs()\n\t{\n\t\t$styles = array();\n\n\t\t$dp = @opendir($this->styles_path);\n\t\tif ($dp)\n\t\t{\n\t\t\twhile (($file = readdir($dp)) !== false)\n\t\t\t{\n\t\t\t\t$dir = $this->styles_path . $file;\n\t\t\t\tif ($file[0] == '.' || !is_dir($dir))\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (file_exists(\"{$dir}/style.cfg\"))\n\t\t\t\t{\n\t\t\t\t\t$styles[] = $file;\n\t\t\t\t}\n\t\t\t}\n\t\t\tclosedir($dp);\n\t\t}\n\n\t\treturn $styles;\n\t}", "public static function getDirectories()\n {\n return static::$directories;\n }" ]
[ "0.76261055", "0.70991683", "0.6839903", "0.67282754", "0.66785717", "0.65711504", "0.6484858", "0.64529055", "0.6442766", "0.64088714", "0.63509333", "0.6297357", "0.628945", "0.6262594", "0.62027764", "0.6194262", "0.6185356", "0.61648905", "0.6164754", "0.6155535", "0.6104877", "0.6102983", "0.6082645", "0.60756564", "0.6073407", "0.6035883", "0.60286003", "0.6025055", "0.60196656", "0.60186" ]
0.8265988
0
Finds the Theme Entity.
private function getThemeEntity() { // Only load the ThemeEntity if we need to if ($this->themeEntity === null) { $this->themeEntity = $this->em->getRepository('ILPBootstrapThemeBundle:Theme')->Find(1); } return $this->themeEntity; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getInstance()\n {\n return Doctrine_Core::getTable('Theme');\n }", "public function getThemeController()\n {\n $host = $this->context->getHost();\n /*\n * First we look for theme according to hostname.\n */\n $theme = Kernel::getService('em')\n ->getRepository('RZ\\Roadiz\\Core\\Entities\\Theme')\n ->findAvailableNonStaticFrontendWithHost($host);\n\n /*\n * If no theme for current host, we look for\n * any frontend available theme.\n */\n if (null === $theme) {\n $theme = Kernel::getService('em')\n ->getRepository('RZ\\Roadiz\\Core\\Entities\\Theme')\n ->findFirstAvailableNonStaticFrontend();\n }\n\n if (null !== $theme) {\n return $theme;\n } else {\n return null;\n }\n }", "public function getTheme();", "public function getTheme();", "public function getTheme();", "function kitmoo_get_theme($kitmooid) {\n global $DB;\n\n $kitmootheme = $DB->get_record('kitmoo_theme', array('kitmooid' => $kitmooid));\n\n return $kitmootheme->theme;\n}", "public function getByTheme($theme);", "public function getIdTheme(){\n return $this->idTheme;\n }", "public function getThemeChoice()\n {\n return $this->getThemeEntity()->getThemeChoice();\n }", "public function findTheme($theme){\n $sql = \"SELECT * FROM \" . $this->table . \" WHERE theme = :cle AND date_debut >= CURDATE() ORDER BY date_debut DESC\";\n\n $sth = $this->dbh->prepare($sql);\n\t\t$sth->bindValue(\":cle\", $theme);\n\t\t$sth->execute();\n\n\t\treturn $sth->fetchAll();\n\n }", "public static function get_current_theme()\n {\n $current_page = ORM::factory('Page')->where_is_current()->find_published();\n\n // See if the theme is overwritten at page-level\n if ($current_page->theme) {\n $theme_name = $current_page->theme;\n }\n elseif (Settings::instance()->get('use_config_file')) {\n $theme_name = @Kohana::$config->load('config')->assets_folder_path;\n }\n else {\n $theme_name = Settings::instance()->get('assets_folder_path');\n }\n $theme = ORM::factory('Engine_Theme')->where('stub', '=', $theme_name)->find_published();\n\n return $theme;\n }", "function fetch_theme()\n {\n global $chosen;\n return $chosen;\n }", "public function theme()\n {\n return $this->belongsTo('App\\Models\\Theme');\n }", "public function getTheme()\n {\n $frontend_theme = $this->getStoreSettings()['frontend_theme'];\n return Theme::findByFolder($frontend_theme);\n }", "public function getTheme(){\n return $this->theme;\n }", "public function get_theme(){\n\t\t$theme = $this->Option->findByKey('cakecms_theme');\n\t\treturn $theme['Option']['value'];\n\t}", "public function getModel()\n {\n return once(function () {\n return Theme::whereLocation($this->location)->firstOrFail();\n });\n }", "protected function getTheme()\n {\n return $this->theme;\n }", "public function getTheme(): ?Theme\n {\n return $this->theme;\n }", "public function getTheme()\n\t{\n\t\treturn $this->getKeyValue('theme'); \n\n\t}", "public static function get_theme():string { return self::$theme; }", "public function getTheme()\n {\n return $this->theme;\n }", "public function getCdnTheme();", "public function getThemes();", "public function getThemes();", "protected function findFirstEntity()\n\t{\n\t\treturn blx()->assets->findFile($this);\n\t}", "public function model()\n {\n return AcademyTheme::class;\n }", "public function get($data)\n {\n $required = array(\n 'code' => 'Theme code is missing',\n );\n $this->di['validator']->checkRequiredParamsForArray($required, $data);\n\n return $this->getService()->loadTheme($data['code']);\n }", "public function getCurrent()\r\n {\r\n return $this->settingsRepository->get('theme', $this->defaultTheme);\r\n }", "function getTheme () \r\n {\r\n \t$theme = Session::getValue('userinfo_theme');\r\n\t\t\r\n\t\tif(!Theme::existTheme($theme)){\r\n \t\t$theme = Session::getContextValue('theme');\r\n \t} \r\n\t\t\r\n \treturn Theme::_getPATHTheme($theme);;\r\n }" ]
[ "0.6834971", "0.6344786", "0.63079023", "0.63079023", "0.63079023", "0.62573946", "0.61357576", "0.59044033", "0.58300036", "0.57557005", "0.5684908", "0.5669866", "0.5657137", "0.56264555", "0.5568235", "0.55628955", "0.5533839", "0.5493654", "0.5463514", "0.5434753", "0.5420655", "0.5374594", "0.5363841", "0.5340934", "0.5340934", "0.5302447", "0.5228093", "0.5219722", "0.5192658", "0.5190941" ]
0.7743417
0
Gets the Kernel Root Directory.
private function getKernelRootDir() { return $this->kernel->getRootDir(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static function getKernelDirectory()\n {\n $dir = getcwd().'/app';\n if (!is_dir($dir)) {\n $dir = dirname($dir);\n }\n\n return $dir;\n }", "public function getRootDir()\n {\n return $this->rootDir;\n }", "public function getRootDirectory()\n {\n return $this->rootDirectory;\n }", "static private function rootDir(): string\n {\n $root_dir = str_replace('/system/core', '', __DIR__);\n $root_dir = explode('/', $root_dir);\n return $root_dir[count($root_dir) - 1];\n }", "public function getRootDir();", "public function getRootDir();", "public function rootDir()\n {\n return dirname(__DIR__) . DIRECTORY_SEPARATOR;\n }", "public static function getRootPath()\n {\n return dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))));\n }", "protected function getRootPath()\n {\n $rootPath = dirname(dirname(__DIR__));\n return str_replace('\\\\', '/', $rootPath);\n }", "private static function getRoot()\n\t{\n\n\t\treturn Settings::getSetting('filesystem_root');\n\t}", "public static function root(): string\n {\n return dirname(__FILE__, 3);\n }", "public function getRootDir(): string;", "function getRootPath() {\r\n $registry = &KISS_Framework_Registry::instance();\r\n return $registry->getEntry('root_path');\r\n }", "public function getBaseDir()\n {\n return $this->_directoryList->getPath(DirectoryList::ROOT).\"/\";\n }", "public function getRootPath() {\n\t\treturn $this->rootPath;\n\t}", "private function root()\n {\n if (defined('__alphaz__ROOT__')) {\n return __alphaz__ROOT__.'/';\n }\n\n return '../';\n }", "private function getAppRootDir()\n {\n return $this->container->get('app.parameter_bag')->get('kernel.project_dir');\n }", "private function rootDir()\n\t{\n\t\treturn YiiBase::getPathOfAlias('application.runtime').$this->pollPath;\n\t}", "function getRootPath() {\n $path = getcwd();\n if (strstr($path, \"/admin\"))\n $path = substr($path, 0, strlen($path) - strlen(\"/admin\"));\n return $path;\n}", "public static function getRootPath()\n\t{\n\t\treturn self::getItem('core.root');\n\t}", "public static function root()\n\t{\n\t\treturn VAR_CACHE_DIR.DIRECTORY_SEPARATOR;\n\t}", "protected function getRootDir()\n {\n return $this->container->getParameter('kernel.root_dir').'/Resources/pgschema/';\n }", "public function getDirectoryPath(){\n if( $this->root ){\n return $this->root->getPath();\n }\n // without a root directory return WordPress root\n return rtrim(ABSPATH,'/');\n }", "public function rootDir()\n {\n // Get the root URL and only get the dir if it contains the starting script\n // file name (for example '/index.php')\n $url = $this->rootUrl();\n\n if (strpos($url, $_SERVER['SCRIPT_NAME']) !== false) {\n $url = dirname($url) . '/';\n }\n\n return $url;\n }", "public static function directory()\n {\n return PCERHOME.'/';\n }", "public final function GetHomeRootMount()\r\n\t\t{\r\n\t\t\treturn $this->GetFolderMount(CF_ENV_HOMEROOT);\r\n\t\t}", "function rootPath()\n\t{\n\t\t$root = $this->user ?\n\t\t\t\\Pails\\File\\Config::getUserFilePath() . '/' . (User::find($_SESSION['userPieUser']->user_id)->username) :\n\t\t\t\\Pails\\File\\Config::getCommonFilePath();\n\n\t\tif (!file_exists($root))\n\t\t\tmkdir($root);\n\n\t\treturn $root;\n\t}", "public function getDocRoot(): string\n {\n return rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR).'/';\n }", "protected static function serverRoot()\n {\n if (static::$serverRoot !== null) {\n return static::$serverRoot;\n }\n return dirname(__DIR__).DIRECTORY_SEPARATOR.'www';\n }", "Protected function Kernel(){ \n $Kernel = str_replace(\"\\\\\", \"/\", IPS_GetKernelDir());\n return $Kernel;\n }" ]
[ "0.8027041", "0.77886206", "0.7665047", "0.74743354", "0.74016345", "0.74016345", "0.737876", "0.7354956", "0.7348383", "0.7303091", "0.71851504", "0.71494037", "0.7095741", "0.70861465", "0.70497954", "0.701527", "0.7001373", "0.6998812", "0.6986074", "0.6983741", "0.697081", "0.6967054", "0.69658375", "0.68885744", "0.6818145", "0.6736853", "0.66926956", "0.65708154", "0.6556974", "0.65485394" ]
0.8661066
0
rolase 4d6 descartando o menor...
function habilidade85pts();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bissextile($a){\n\tif($a%400==0||(($a%4==0)&($a%100!=0))){\n\t\treturn(29);//année bissextile\n\t}else{\n\t\treturn(28);//année non bissextile\n\t}\n}", "function gerarNotas(){\n return ((rand(0, 10) + rand(0, 10) + rand(0, 10) + rand(0, 10)) /4);\n}", "public static function get6to4()\n {\n if (self::$sixToFour === null) {\n self::$sixToFour = self::fromString('2002::/16');\n }\n\n return self::$sixToFour;\n }", "public function getWidthZ();", "function makeChar4x4x8x8($index) {\n // 111\n // 2 3\n // 444\n // 5 6\n // 777\n $numbers = array(\n //76543210 - which \"areas\" to activate (make color 1)\n 0b11101110,//0\n 0b01001000,//1\n 0b10111010,//2\n 0b11011010,//3\n 0b01011100,//4\n 0b11010110,//5\n 0b11110110,//6\n 0b01001010,//7\n 0b11111110,//8\n 0b01011110,//9\n );\n \n // A segment bitmap. Open 7seg.bmp with a TEXT EDITOR to get this (it's a color code <=> ASCII haxx).\n $segments = array(\n array(0, 0, 0, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 0, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(2, 2, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 2 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 0, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 0, 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(5, 5, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 5 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 0, 7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n array(0, 0, 0, 7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),\n );\n\n $numberMask = $numbers[$index];\n \n $result = array();\n for($row = 0; $row < 4; $row++) {\n $rowResult = array();\n for($column = 0; $column < 4; $column++) {\n // Let's create an individual tile here\n $tile = \"\";\n \n for($tileRow = 0; $tileRow < 8; $tileRow++) {\n $bitPlane0 = 0;\n for($bit = 7; $bit >= 0; $bit--) {\n $bitPlane0 <<= 1;\n $bitType = $segments[$row*8 + $tileRow][$column*8 + (7 - $bit)]; // E.g. 0, 1, 2, ..., 7.\n $bitPlane0 |= (($numberMask >> $bitType) & 1 != 0) ? 1 : 0;\n }\n $tile .= chr($bitPlane0) . \"\\0\"; // bitPlane1 = 0\n }\n \n // bitPlane2 and bitPlane3 is all 0\n $tile .= str_repeat(\"\\0\\0\", 8);\n \n $rowResult[] = $tile;\n }\n $result[] = $rowResult;\n }\n \n return $result;\n}", "function block_era( $height ) {\n return floor($height/210000)+1;\n}", "public function getGtin8();", "function get_freight()\n {\n return 7;\n }", "function TampilkanHeaderYudisium() {\r\n}", "function diagonaalZoeken($woordenzoeker, $gesplitst, $niveau) {\n if ($niveau >= 4) {\n global $gevondenWoordenCoordinaten;\n foreach ($gesplitst as $zoekendwoord) {\n $hetWoord = implode('', $zoekendwoord);\n $cordinaat[$hetWoord] = array();\n $verticaleletters = count($woordenzoeker);\n $horizontaleletters = count($woordenzoeker[0]);\n $aantalk = $horizontaleletters - count($zoekendwoord);\n $aantalr = $verticaleletters - count($zoekendwoord);\n for ($r = 0; $r <= $aantalr; $r++) {\n for ($k = 0; $k <= $aantalk; $k++) {\n //van linksboven naar rechtsonder\n $check = 0;\n for ($i = 0; $i < count($zoekendwoord); $i++) {\n if ($zoekendwoord[$i] == $woordenzoeker[$i + $r][$i + $k]) {\n $check = $check + 1;\n $x = $k + $i;\n $y = $r + $i;\n $c = \"x\" . $x . \"y\" . $y;\n array_push($cordinaat[$hetWoord], $c);\n }\n }\n if ($check == count($zoekendwoord)) {\n $gevondenWoordenCoordinaten[$hetWoord] = $cordinaat[$hetWoord];\n $gevondenWoordenCoordinaten[$hetWoord] = array_slice($gevondenWoordenCoordinaten[$hetWoord], count($gevondenWoordenCoordinaten[$hetWoord]) - count($zoekendwoord));\n }\n if ($check <> count($zoekendwoord)) {\n for ($a = 0; $a < count($zoekendwoord); $a++) {\n unset($cordinaat[$hetWoord][$a]);\n }\n }\n //van rechtsonder naar linksboven\n $check = 0;\n for ($i = 0; $i < count($zoekendwoord); $i++) {\n if ($zoekendwoord[$i] == $woordenzoeker[$verticaleletters - $i - $r - 1][$horizontaleletters - $i - $k - 1]) {\n $check = $check + 1;\n $x = $horizontaleletters - $i - $k - 1;\n $y = $verticaleletters - $i - $r - 1;\n $c = \"x\" . $x . \"y\" . $y;\n array_push($cordinaat[$hetWoord], $c);\n }\n }\n if ($check == count($zoekendwoord)) {\n $gevondenWoordenCoordinaten[$hetWoord] = $cordinaat[$hetWoord];\n $gevondenWoordenCoordinaten[$hetWoord] = array_slice($gevondenWoordenCoordinaten[$hetWoord], count($gevondenWoordenCoordinaten[$hetWoord]) - count($zoekendwoord));\n }\n if ($check <> count($zoekendwoord)) {\n for ($a = 0; $a < count($zoekendwoord); $a++) {\n unset($cordinaat[$hetWoord][$a]);\n }\n }\n //van rechtsboven naar linksonder\n $check = 0;\n for ($i = 0; $i < count($zoekendwoord); $i++) {\n if ($zoekendwoord[$i] == $woordenzoeker[$i + $r][$horizontaleletters - $i - $k - 1]) {\n $check = $check + 1;\n $x = $horizontaleletters - $i - $k - 1;\n $y = $i + $r;\n $c = \"x\" . $x . \"y\" . $y;\n array_push($cordinaat[$hetWoord], $c);\n }\n }\n if ($check == count($zoekendwoord)) {\n $gevondenWoordenCoordinaten[$hetWoord] = $cordinaat[$hetWoord];\n $gevondenWoordenCoordinaten[$hetWoord] = array_slice($gevondenWoordenCoordinaten[$hetWoord], count($gevondenWoordenCoordinaten[$hetWoord]) - count($zoekendwoord));\n }\n if ($check <> count($zoekendwoord)) {\n for ($a = 0; $a < count($zoekendwoord); $a++) {\n unset($cordinaat[$hetWoord][$a]);\n }\n }\n //van linksonder naar rechtsboven\n $check = 0;\n for ($i = 0; $i < count($zoekendwoord); $i++) {\n if ($zoekendwoord[$i] == $woordenzoeker[$verticaleletters - $i - $r - 1][$i + $k]) {\n $check = $check + 1;\n $x = $i + $k;\n $y = $verticaleletters - $i - $r - 1;\n $c = \"x\" . $x . \"y\" . $y;\n array_push($cordinaat[$hetWoord], $c);\n }\n }\n if ($check == count($zoekendwoord)) {\n $gevondenWoordenCoordinaten[$hetWoord] = $cordinaat[$hetWoord];\n $gevondenWoordenCoordinaten[$hetWoord] = array_slice($gevondenWoordenCoordinaten[$hetWoord], count($gevondenWoordenCoordinaten[$hetWoord]) - count($zoekendwoord));\n }\n if ($check <> count($zoekendwoord)) {\n for ($a = 0; $a < count($zoekendwoord); $a++) {\n unset($cordinaat[$hetWoord][$a]);\n }\n }\n }\n }\n }\n //echo \"<pre>\", PRINT_R($gevondenWoordenCoordinaten), \"</pre>\";\n }\n}", "public function getAanvullend6() {\n\t\treturn $this->aanvullend6;\n\t}", "function getCcLast4();", "function aturan1($x,$y){ \n\t\tglobal $x;\n\t\tglobal $y;\n\t\tif ($x<4) {\n\t\t\t$x=4;\n\t\t // echo \"(\".$x.\",\".$y.\")\";\n\t\t} else {\n\t\t\t$x=5;\n\t\t\t$y=5;\n\t\t}\n\n\t}", "function getSixImgForRank($rank, $align) {\n\t$appRoot = realpath( dirname( __FILE__ ) ).'/';\n require($appRoot.'../variables.php');\n\n\t$img1 = '<img style=\"vertical-align:'.$align.';\" src=\"'.$directory.'/gfx/';\n\t$img2 = '\" />';\n\n if ($rank == 1) {\n $img = $img1.$gfx_rank1_six.$img2;\n } elseif ($rank == 2) {\n $img = $img1.$gfx_rank2_six.$img2;\n } elseif ($rank == 3) {\n $img = $img1.$gfx_rank3_six.$img2;\n } elseif ($rank == 4) {\n $img = $img1.$gfx_rank4_six.$img2;\n } elseif ($rank == 5) {\n $img = $img1.$gfx_rank5_six.$img2;\n } elseif ($rank == 6) {\n $img = $img1.$gfx_rank6_six.$img2;\n } else {\n $img = \"\";\n }\n\treturn $img;\n}", "public function test6(): void\n {\n $chess = new ChessPublicator('r4rk1/1pp1qppp/p1np1n2/2b1p1B1/2B1P1b1/P1NP1N2/1PP1QPPP/R4RK1 w - - 0 10');\n $this->assertSame($chess->perft(1), 46);\n $this->assertSame($chess->perft(2), 2079);\n //~ $this->assertSame($chess->perft(3), 89890);\n }", "function base32_encoder_last_quintet($length)\n{\n\t$quintets = intval($length * 8 / 5);\n\t$remainder = $length % 5;\n\tif ($remainder!=0) {\n\t\t$quintets++;\t\t\n\t}\n\treturn $quintets;\n}", "function calculerSurface ($longueur, $largeur, $hauteur)\n{\n \n $surfaceMurs = 2 * $hauteur * ($longueur + $largeur);\n\n return $surfaceMurs;\n}", "public function checkLeftUpperQuadrant(){\n// 6. Left Upper Quadrant pain/nausea >4x / year\n// R/o Gastritis\n\n\n $data = DB::select('SELECT * from history where title like \"%left upper quadrant%\" and userId = \"'. $this->userId . '\" and year = \"' . date(\"Y\") . '\" ');\n \n if(count($data) >= 4){\n $luq = true;\n }\n\n \t$this->checkSnoring();\n }", "public function getGtin14();", "static function missing_length($r){//adj/opp/hyp \n$a=self::missing_angle($r);\nif(!$r[0])$r[0]=$r[2]*self::cosinus($a);\nif(!$r[1])$r[1]=$r[2]*self::sinus($a);\nif(!$r[2])$r[2]=$r[0]/self::cosinus($a);\nreturn $r;}", "function id2x($id){\n global $version;\n switch($version){\n case 2: return (($id - 3079) % 512 - 250); break;\n case 3: return (($id - 1) % 801 - 400); break;\n }\n}", "function $berekening( bedrag percentage jaar){\n static $bedrag ;\n\n if($jaar == 0)\n {\n // bedrag = 100 000 + ( 100 000 * 0.08 ) = 100 000 + 8 000 = 108 000\n $bedrag = $bedrag + ($beginbedrag * $percentage);\n array_push($array, $bedrag);\n }\n else {\n // bedrag = 108 000 + ( 108 000 * 0.08 ) = 108 000 + 8 640 = 116 640\n $bedrag = $bedrag + ($bedrag * $percentage);\n array_push($array, $bedrag);\n }\n\n//$berekening oproepen hier\n\n}", "public function flopImage() {\n\t}", "function giorno($dd, $mf)\n {\n if ($mf == 02)\n $dd += 40;\n\n return $dd;\n }", "public function flopImage () {}", "function dosti($y, $n, $d, $h, $m, $s){\r\n return (int)((int)(((int)$y - 1980) << 25) | (int)((int)$n << 21) | \r\n (int)((int)$d << 16) | (int)((int)$h << 11) | \r\n (int)((int)$m << 5) | (int)((int)$s >> 1));\r\n}", "public function getWidthN();", "function gen_6()\r\n{\r\n $a = rand(1,6);\r\n $b = rand(($a+1),7);\r\n $c = rand(1,6);\r\n $d = rand(($c+1),7);\r\n reduce($a,$b);\r\n reduce($c,$d);\r\n $question = $a.\"/\".$b.\" + \".$c.\"/\".$d;\r\n $numerator = $a*$d+$b*$c;\r\n $denominator = $b * $d;\r\n reduce($numerator,$denominator,9);\r\n If($Denominator!=1)\r\n $numerator=$numerator.\"/\".$denominator;\r\n $answer = array($question,$numerator,1,0,0,0);\r\n return $answer;\r\n}", "public function luassegitiga()\n {\n \n return ($this-> alas * $this-> tinggi / 2);\n }", "function triangulo ($base,$altura) {\n\n return (($base*$altura)/2);\n\n}" ]
[ "0.5574538", "0.54312116", "0.53582287", "0.5339448", "0.53024566", "0.52583444", "0.52144355", "0.5188677", "0.51435965", "0.51385707", "0.5102933", "0.5099871", "0.50723857", "0.5072259", "0.50649536", "0.50588953", "0.50528044", "0.5043709", "0.5035496", "0.5034374", "0.5025151", "0.5017252", "0.50172305", "0.501584", "0.5008516", "0.4990091", "0.49716675", "0.49680716", "0.49542722", "0.49483007" ]
0.59870297
0
mostrar pagina de ingresar Categorias
function MostrarPagninaIngresarCategorias() { if ($this->admin) { $this->categoriasView->ingresarCategoriaPagina(); } else { header("Location: " . BASE_URL); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listar_categoria(){\n\t\t$this->crearArbol('categoria','id_cat','nombre_cat','padre_cat',0,'&mdash;');\n\n\t\t$this->mensaje=\"si\";\n\t}", "public function Categorias() {\r\n \r\n $this->load->helper('url');\r\n $this->load->model('Model_tienda', \"tienda\");\r\n //llamamos a la funcion traer categorias para obtener todas las categorias de productos.0\r\n $categorias = $this->tienda->Traer_categorias();\r\n //Cargamos la vista en el cuerpo de la aplicacion.\r\n $cuerpo = $this->load->view('Categorias_view', Array('Categorias' => $categorias), true);\r\n \r\n $this->load->view('Index', Array('cuerpo' => $cuerpo));\r\n \r\n }", "public function indexCategoria()\r\n {\r\n $resultado = $this-> categoria-> listarCategoria();\r\n return $resultado;\r\n\r\n }", "function category(){\n // obtiene las categorias\n $cat = $this->model->getCategories(); \n $this->view->showCategories($cat);\n }", "function mostrar_categoria(){\n\t\tif (isset($_GET['id']) && $_GET['id']!=\"\"){\n\t\t\t$id=$_GET['id'];\n\t\t\t$sql=\"SELECT * FROM categoria WHERE id_cat='$id'\";\n\t\t\t$consulta=mysql_query($sql);\n\t\t\t$resultado = mysql_fetch_array($consulta);\n\t\t\t$this->id=$id;\n\t\t\t$this->nombre=$resultado['nombre_cat'];\n\t\t\t$this->etiqueta=$resultado['etiqueta_cat'];\n\t\t\t$this->prioridad=$resultado['prioridad_cat'];\n\t\t\t$this->padre=$resultado['padre_cat'];\n\t\t\t$this->claves=$resultado['claves_cat'];\n\t\t\t$this->descripcion=$resultado['descripcion_cat'];\n\t\t\t$this->crearArbol('categoria','id_cat','nombre_cat','padre_cat',0,'&mdash;');\n\t\t//print_r($this->listado);\n\t\t}\n\t}", "public function indexCategoryAction() {\n\n $paginate = $this->get(\"index_paginate\");\n $paginate->setH1('Toutes les catégories de mail');\n $paginate->setView('FPMailerBundle:Back:indexCategory.html.twig');\n $paginate->setAddNew('bo_mailer_category_new');\n\n $query = $this->get('mailer_category_repository')->getElements($paginate->getParamsForQuery());\n\n $paginate->setQuery($query);\n\n return $this->render($paginate->getTemplate(), $paginate->getParams());\n }", "function show() {\n\t\t\t$categorias = CatDAO::select();\n\t\t\t$subCat = SubCatDAO::select();\n\t\t\t$data = $this->pushSubCategories($categorias, $subCat);\n\t\t\tView::set(\"categorias\", $data);\n\t\t\tView::render('admin' . DS . 'categorias');\n\t\t}", "public function listaCategorias()\n {\n $categorias=Categorias::orderBy('id','desc')->where('eliminado','false')->simplePaginate(15);\n \n return view('panel.lista-categorias')->with('categorias', $categorias);\n }", "public function index(){\n Utils::isAdmin(); //ESTO IDENTIFICARA QUE SEA UN ADMINISTRADOR, YA QUE ESE ROL SE EL UNICO QUE \n //PODRA VER, AGREGAR Y MODIFICAR LAS CATEGORIAS\n $categoria = new Categoria();\n $categorias=$categoria->getCategorias();\n require_once 'views/categoria/index.php';\n }", "public function CrearCategoria(){\n\t\trequire_once 'vistas/pages/encabezadopagina1.php';\n\t\trequire_once 'vistas/pages/registrar/crearcategoria.php';\n\t\trequire_once 'vistas/pages/piepagina.php';\n\t}", "function getCategorias();", "private function categorie(){\n if(isset($_GET['id'])){\n \n $this->_categorieManager = new CategorieManager();\n $categorie = $this->_categorieManager->getCategorie($_GET['id']);\n \n $this->_view = new View('SinglePost');\n $this->_view->generate(array('categorie' => $categorie));\n }\n\n\n }", "public function getCategorie();", "public function mostrar_categorias(){\n $conexion = Conexion();\n $sql=\"SELECT * from tbl_categoria\"; \n foreach ($conexion->query($sql) as $row){\n echo \"<option value='{$row ['id']}'>{$row ['nombre']}</option>\"; \n }\n }", "public function listar(){\n try{\n $this->data['categorias'] = $this->categorias->getCategorias();\n if($this->data['categorias'] === NULL){\n throw new Exception('Se ha producido un error con la base de datos, disculpe las molestias');\n }\n $this->view = 'categorias/listar';\n } catch (Exception $e){\n show_error($e->getMessage());\n }\n }", "function listarCategoria(){\n\t\t$this->procedimiento='cd.ft_categoria_sel';\n\t\t$this->transaccion='CD_CAT_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('id_categoria','int4');\n\t\t$this->captura('nombre','varchar');\n\t\t$this->captura('id_moneda','int4');\n\t\t$this->captura('codigo','varchar');\n\t\t$this->captura('monto','numeric');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('id_tipo_categoria','int4');\n\t\t$this->captura('id_usuario_ai','int4');\n\t\t$this->captura('usuario_ai','varchar');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t$this->captura('desc_moneda','varchar');\n\t\t\n\t\t\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function index()\n {\n $e = categoria::all();\n return view('categorias.index');\n }", "public function actionIndex()\n {\n $categorie = new Categorie();\n $categories = $categorie->find()->where('statut<>0')->all();\n\n return $this->render('index', [\n 'categories' => $categories,\n 'categorie' => $categorie,\n ]);\n }", "public function select_categorie(){\n $spathSQL= $this->GLOBALS_INI[\"PATH_HOME\"] . $this->GLOBALS_INI[\"PATH_MODEL\"] . \"select_categorie.sql\";\n $this->resultat[\"devis_select_categorie\"]= $this->oBdd->getSelectDatas($spathSQL);\n }", "public function index()\n {\n $categorias = Categoria::all();\n return view('supervisor.Categorias.index')->with('categorias',$categorias);\n }", "public function ctrMostrarCategorias(){\n \n //3-Enviamos un parametro al modelo con el nombre de la tabla\n $tabla = \"categorias\";\n \n //4-Pedimos respuesta al modelo, instanciando la clase ModeloCategorias, donde ejecuta el metodo mdlMostrarCategorias y le pasamos de parametro la $tabla\n $respuesta = ModeloCategorias::mdlMostrarCategorias($tabla);\n \n //5-y se lo retornamos a la vista\n return $respuesta;\n\n }", "public function getCategoriaapoyo()\n {\n try {\n $datos = $_REQUEST;\n $filtros = array_filter($datos);\n $dbm = new DbmAdmisiones($this->get(\"db_manager\")->getEntityManager());\n $entidad = $dbm->BuscarCategoriaapoyo($filtros);\n if (!$entidad) {\n return new View(\"No se encontro ningun registro \", Response::HTTP_PARTIAL_CONTENT);\n }\n return new View($entidad, Response::HTTP_OK);\n } catch (Exception $e) {\n return new View($e->getMessage(), Response::HTTP_BAD_REQUEST);\n }\n }", "public function categoriasPresentacion()\r\n {\r\n require __DIR__ . '/../Repositorio/articuloRepositorio.php';\r\n $listacategorias = (new ArticuloRepositorio)->categoriasInicio();\r\n require __DIR__ . '/../../app/plantillas/categorias.php';\r\n }", "public function categories() {\n\t\tif ($this->permissions->products [\"products_see\"] != \"1\")\n\t\t\t$this->mfunctions->noPermission();\n\t\t$cats = $this->mproducts->getAllCats ();\n\t\t$data [\"cats\"] = $cats;\n\t\t$data [\"target\"] = \"pro_cats\";\n\t\t$this->load->view ( \"admin/index\", $data );\n\t}", "function ListarCategoria()\n\t{\n\t\t$sql = \"SELECT * FROM categoria\";\n\t\treturn EjecutarConsulta($sql);\n\t}", "public function categories();", "public function categories();", "public function categories();", "function listar_categoria_menu(){\n\t\t$sql=\"SELECT *, id_cat AS lista FROM categoria WHERE padre_cat='0' ORDER BY prioridad_cat,id_cat, nombre_cat ASC\";\n\t\t$consulta=mysql_query($sql) or die(mysql_error());\n\t\twhile ($resultado = mysql_fetch_array($consulta)){\n\t\t\t$this->mensaje=\"si\";\n\t\t\t$padre=$resultado['id_cat'];\n\t\t\t$sql2=\"SELECT * FROM categoria WHERE padre_cat='$padre' ORDER BY prioridad_cat,id_cat, nombre_cat ASC\";\n\t\t\t$consulta2=mysql_query($sql2) or die(mysql_error());\n\t\t\t$lista=\"\";\n\t\t\twhile ($resultado2 = mysql_fetch_array($consulta2)){\n\t\t\t\t$lista[]=$resultado2;\n\t\t\t}\n\t\t\t$resultado['lista']=$lista;\n\t\t\t$this->listado[] = $resultado;\n\t\t}\n\t}", "public function CrearAnunciosMostrarSubCategoriasController(){\n\n\t\t$capturar_cat_plan_post = filter_input(INPUT_POST, 'cat-plan');\n\t\t$separar_valor_cat_plan_post = explode('|', $capturar_cat_plan_post);\n\t\t$valor_uno_cat = $separar_valor_cat_plan_post[0];\n\t\t$valor_dos_plan = $separar_valor_cat_plan_post[1];\n\t\t\n\t\t#$captura_Categoria = $_POST[\"cat\"];\n\t\t$captura_Categoria = $valor_uno_cat;\n\n\t\t$respuesta = GestorCategoriasModel::CrearAnunciosMostrarSubCategoriasModel($captura_Categoria, \"Tcategorias\");\n\n\t\tforeach($respuesta as $row => $item){\n\t\t\techo '<option value='.$item['idsubcategoria'].'>'.$item['nombre_subcategoria'].'</option>';\n\n\t\t}\n\t}" ]
[ "0.77725965", "0.7695629", "0.75210327", "0.7457363", "0.7447816", "0.74327254", "0.7340854", "0.72658587", "0.7257901", "0.72407484", "0.7216946", "0.7118765", "0.70903444", "0.70895755", "0.7058985", "0.7054026", "0.70530474", "0.7023402", "0.7009883", "0.7006096", "0.70046455", "0.6946656", "0.6934504", "0.69317067", "0.6926929", "0.69259745", "0.69259745", "0.69259745", "0.6913085", "0.69044083" ]
0.82459533
0
Find authors by id_book
public static function findByIdBook($id_book) { return static::find() ->where(['id_book' => $id_book]) ->orderBy(['id_author' => SORT_DESC]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findBooksByAuthor($db, $authorId){\n\t\tif($authorId < 0){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!($stmtSelectBooksForAuthor = $db->prepare(' SELECT count(book_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM books_authors\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE author_id = '.$authorId ))) {\n\t\t\techo ' Prepare select failed: (' . $db->errno . ' ) ' . $db->error;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!$stmtSelectBooksForAuthor->execute()) {\n\t\t\techo ' Execute select failed: (' . $stmtSelectBooksForAuthor->errno . ' ) ' . $stmtSelectBooksForAuthor->error;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t/* store result */\n\t\t$stmtSelectBooksForAuthor->store_result();\n\t\t\n\t\t/* bind result variables */\n\t\t$stmtSelectBooksForAuthor->bind_result($books);\n\t\t\n\t\tif($stmtSelectBooksForAuthor->num_rows > 0) {\n\t\t\twhile ($row = $stmtSelectBooksForAuthor->fetch()) {\n\t\t\t\t$result = $books;\n\t\t\t\treturn $books;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$stmtSelectBooksForAuthor->close();\n\n return 0; \n\t}", "public function getAuthorDetails($author_id);", "public static function getBookById($id)\n { \n $id = intval($id);\n $book=array();\n $sql='SELECT * FROM book WHERE id=' . $id;\n if ($id) { \n $db = Db::getConnection();\n $result = $db->query($sql);\n $result->setFetchMode(PDO::FETCH_ASSOC);\n $result->execute();\n while ($row = $result->fetch()) {\n $book['id'] = $row['id'];\n $book['title'] = $row['title'];\n $book['author_id']=$row['author_id'];\n $book['year'] = $row['year'];\n $book['price'] = $row['price'];\n $book['info'] = $row['info'];\n $sql2= \"SELECT id, name FROM authors WHERE id=\".$book['author_id'];\n $result1 = $db->prepare($sql2);\n $result1->bindParam(':count', $count, PDO::PARAM_INT);\n $result1->setFetchMode(PDO::FETCH_ASSOC);\n $result1->execute();\n $book['author'] = $result1->fetch()['name'];\n \n\n }\n return $book;\n }\n }", "function getAuthors ()\n {\n $authors_query = $GLOBALS['DB']->query(\n \"SELECT authors.* FROM\n books JOIN authorships ON (books.id = authorships.book_id)\n JOIN authors ON (authorships.author_id = authors.id)\n WHERE books.id = {$this->getId()};\"\n );\n\n $matching_authors = array();\n foreach ($authors_query as $author) {\n $name = $author['name'];\n $id = $author['id'];\n $new_author = new Author($name, $id);\n array_push($matching_authors, $new_author);\n }\n return $matching_authors;\n }", "function getAuthor()\n {\n //Starts@ t_books w/ id for books -> authors_books w/ book_id and matches it to the associated author_id -> takes the author id and links it to the original author id in t_authors -> looks for this specific instance of author. This results in an associated array with keys first_name, last_name, and id\n $returned_authors = $GLOBALS['DB']->query(\"SELECT t_authors.* FROM t_books\n JOIN authors_books ON (t_books.id = authors_books.books_id)\n JOIN t_authors ON (authors_books.authors_id = t_authors.id)\n WHERE t_books.id = {$this->getId()};\");\n //creates empty array to insert the linked author information\n $authors = array();\n //goes through the associated array created by the join statement and builds a new author object from that information\n foreach ($returned_authors as $author) {\n $first_name = $author['first_name'];\n $last_name = $author['last_name'];\n $id = $author['id'];\n $new_author = new Author($first_name, $last_name, $id);\n //pushes the newly created author objects to the empty array\n array_push($authors, $new_author);\n }\n //returns the newly filled array with the resulting author objects\n return $authors;\n }", "abstract public function getBooksForAuthor($authorName);", "function displayAuthors($filter)\n {\n // Prevent injections:\n $filter = $this->conn->real_escape_string($filter);\n // Build query:\n $query = \"SELECT a.authorid, a.name, \n COUNT(b.authorid) AS bookcount\n FROM authors AS a\n LEFT JOIN books AS b\n ON a.authorid = b.authorid\n WHERE b.title LIKE '%$filter%'\n OR b.ISBN = '%$filter%'\n OR a.authorid = '$filter'\n OR a.name LIKE '%$filter%'\n GROUP BY b.authorid\";\n\n $result = $this->conn->query($query);\n\n return $this->buildAuthorsTable($result);\n }", "function selectAllBooksByAuthors($db, $authorIds, $bookIds) {\n\t\t\n\t\tif (!is_array($authorIds) || !is_array($bookIds) || count($authorIds) <= 0 || count($bookIds) <=0) {\n\t\t\t$whereStmt = '';\n\t\t}\n\t\tif (count($authorIds)>0){\n\t\t\t$whereStmt = ' WHERE ba.author_id IN(' . implode(',', $authorIds) . ')';\n\t\t}\n\t\t\n\t\tif (count($bookIds)>0 && strlen($whereStmt)>0){\n\t\t\t$whereStmt = $whereStmt . ' AND ba.book_id IN(' . implode(',', $bookIds) . ')';\n\t\t}\n\t\telse if (count($bookIds)>0 ) {\n\t\t\t$whereStmt = ' WHERE ba.book_id IN(' . implode(',', $bookIds) . ')';\n\t\t}\n\t\t\n\t\t//echo $whereStmt;\n\t\tif (!($stmtSelectAllBooksByAuthors = $db->prepare(' SELECT DISTINCT b.book_title, \n\t\t\t a.author_name, \n\t\t\t a.author_id, \n\t\t\t b.book_id,\n\t\t\t ba.collection_id,\n\t\t\t c.collection_name,\n\t\t\t b.notes\n\t\t\t FROM books_authors as ba\n\t\t\t\t\t\t\t\t\t\t\t\t\t INNER JOIN books as b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ON ba.book_id = b.book_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN books_authors as bba\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t ON bba.book_id = ba.book_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN authors as a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ON bba.author_id = a.author_id \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT OUTER JOIN collections c\n ON c.collection_id = ba.collection_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t' . $whereStmt \n\t\t\t\t\t\t\t\t\t\t\t\t\t . ' ORDER BY b.book_title, a.author_name'))) {\n\t\t\techo ' Prepare select failed: (' . $db->errno . ' ) ' . $db->error;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!$stmtSelectAllBooksByAuthors->execute()) {\n\t\t\techo ' Execute select failed: (' . $stmtSelectAllBooksByAuthors->errno . ' ) ' . $stmtSelectAllBooksByAuthors->error;\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t/* store result */\n\t\t$stmtSelectAllBooksByAuthors->store_result();\n\t\t\n\t\t/* bind result variables */\n\t\t$stmtSelectAllBooksByAuthors->bind_result($bookName, $authorName, $authorId, $bookId, \n\t\t\t $collectionId, $collectionName, $bookNotes);\n\t\t\n\t\t/* fetch values */\n\t\t$booksByAuthors = array();\n\t\tif($stmtSelectAllBooksByAuthors->num_rows > 0) {\n\t\t\twhile ($row = $stmtSelectAllBooksByAuthors->fetch()) {\n\t\t\t\t$booksByAuthors[$bookId]['bookName'] = $bookName;\n\t\t\t\t$booksByAuthors[$bookId]['authors'][$authorId] = $authorName;\n\t\t\t\t//$booksByAuthors[$bookId]['collectionName'] = $collectionName;\n\t\t\t\t$booksByAuthors[$bookId]['collectionName'][$collectionId] = $collectionName;\n\t\t\t\t$booksByAuthors[$bookId]['bookNotes'] = $bookNotes;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t$stmtSelectAllBooksByAuthors->close();\n\t\t\n\t\t//echo '<pre>'.print_r($booksByAuthors, true).'</pre>';\n\t\treturn $booksByAuthors;\n\t}", "public function readAuthor($id){\n return Authors::findOrFail($id);\n }", "public function getAuthors();", "public function getAuthors();", "public function get_author_by_id($authorid){\n $this->load->database();\n $sql = \"SELECT * FROM authors WHERE author_id=?\";\n $query=$this->db->query($sql,$authorid);\n $row = $query->row_array();\n //$this->db->close();\n return $row;\n }", "function searchBookAuthor($search)\n\t\t{\n\t\t\t$search = '%' . $search . '%';\n\t\t\t$sql = 'SELECT bookID,ISBN,author,bookTitle,edition,picture FROM ' . $this->tablename . ' WHERE author LIKE :search;';\n\t\t\t$statement = $this->dbconn->prepare($sql);\n\t\t\t$statement->bindValue(':search', $search);\n\t\t\t$statement->execute();\n\t\t\t$entry = $statement->fetchall(PDO::FETCH_ASSOC);\n\t\t\treturn($entry);\n\t\t}", "function test_models_find_automagic_author(){\n\n // ---- Arrange\n $post_id = $this->factory->post->create_many(100, array(\n 'post_type' => 'book',\n 'post_author' => 1\n ));\n\n // ---- Act\n $book = $this->app->book->findByAuthor(1);\n\n // ---- Assert\n $this->assertTrue(is_array($book));\n $this->assertInstanceOf('PostObject', $book[0]);\n\n }", "private function handleAuthors($authors, $bookid) {\r\n // Handle removals and bookauthors\r\n $bookAuthorGateway = new BookAuthorGateway($this->db);\r\n $bookAuthors = $bookAuthorGateway->get($bookid, null);\r\n\r\n for($i = 0; $i < sizeof($bookAuthors); $i++) {\r\n // Search for a book author\r\n $found = false;\r\n for($j = 0; $j < sizeof($authors); $j++) {\r\n if($authors[$j][\"id\"] == $bookAuthors[$i][\"authorid\"]) {\r\n $found = true;\r\n } \r\n }\r\n\r\n // Delete any bookauthors that aren't found\r\n if($found == false) {\r\n $bookAuthorGateway->delete($bookAuthors[$i][\"bookid\"], $bookAuthors[$i][\"authorid\"]);\r\n }\r\n }\r\n\r\n $authorGateway = new AuthorGateway($this->db);\r\n for($i = 0; $i < sizeof($authors); $i++) {\r\n // Update an author\r\n if($authors[$i][\"id\"] != \"-1\") {\r\n $authorGateway->update($authors[$i][\"id\"], $authors[$i]);\r\n }\r\n // Insert a new author\r\n else {\r\n $newAuthorId = $authorGateway->insert($authors[$i]);\r\n $bookAuthorGateway->insert(array('bookid' => $bookid, 'authorid' => $newAuthorId));\r\n }\r\n }\r\n }", "public function index(Book $book): AnonymousResourceCollection\n {\n return AuthorsIdentifierResource::collection($book->authors);\n }", "function retrieve_authors($paperID , $err_message = \"\" )\n{\n\t//Establish connection with database\n\t$db = adodb_connect( &$err_message );\n\t\n\t//Retrieve the authors info of the paper\n\t$GetAuthorsSql = \"SELECT * FROM \" . $GLOBALS[\"DB_PREFIX\"] . \"Written\" ;\n\t$GetAuthorsSql .= \" WHERE PaperID=\" .$paperID;\t\t\t\t\n\t\t\t\t\n\t//Execute the retrieve of written table\n\t$authors_result = $db -> Execute($GetAuthorsSql);\n\t\n\tif ( !$authors_result )\n\t{\n\t\t$err_message .= \" Cannot retrieve information from database in \\\"retrieve_authors\\\". <br>\\n\" ;\t\t\n\t\treturn false ;\t\n\t}\n\t\n\t$author_numrows = $authors_result -> RecordCount();\n\t$authorInfo = $authors_result -> FetchNextObj() ;\n\t$authorSQL = \"SELECT * FROM \" . $GLOBALS[\"DB_PREFIX\"] . \"Author WHERE AuthorID = \".$authorInfo -> AuthorID;\n\t$author = $db -> Execute($authorSQL);\n\t$authorInfo = @$author -> FetchNextObj(); // suppress errors if no authors specified\n\t$authorCount = 1 ;\n\t$first = stripslashes ( $authorInfo -> FirstName ) ;\n\t$middle = stripslashes ( $authorInfo -> MiddleName ) ;\n\t$last = stripslashes ( $authorInfo -> LastName ) ;\n\t$authorIDList = formatAuthor ( $first , $middle , $last , $authorCount) ;\n\t\n\twhile ( $authorInfo = $authors_result -> FetchNextObj() )\n\t{\n\t\t$authorSQL = \"SELECT * FROM \" . $GLOBALS[\"DB_PREFIX\"] . \"Author WHERE AuthorID = \".$authorInfo -> AuthorID;\n\t\t$author = $db -> Execute($authorSQL);\n\t\t$authorInfo = $author -> FetchNextObj();\n\t\t$authorCount++ ;\n\t\tif ($authorCount == $author_numrows)\n\t\t{\n\t\t\t$first = stripslashes ( $authorInfo -> FirstName ) ;\n\t\t\t$middle = stripslashes ( $authorInfo -> MiddleName ) ;\n\t\t\t$last = stripslashes ( $authorInfo -> LastName ) ;\n\t\t\t$name = formatAuthor ( $first , $middle , $last , $authorCount) ;\n\t\t\tif ( $author_numrows == 2 )\t// Check for only two authors\n\t\t\t{\n\t\t\t\t$authorIDList .= \" and \" . $name;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t$authorIDList .= \", and \" . $name;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$first = stripslashes ( $authorInfo -> FirstName ) ;\n\t\t\t$middle = stripslashes ( $authorInfo -> MiddleName ) ;\n\t\t\t$last = stripslashes ( $authorInfo -> LastName ) ;\n\t\t\t$name = formatAuthor ( $first , $middle , $last , $authorCount) ;\n\t\t\t$authorIDList .= \", \" . $name;\n\t\t}\n\t\t\n\t}\t\t\n\t\n\treturn $authorIDList ;\n}", "public function list($authorId)\n\t{\n\t\treturn Book::where('author_id', $authorId)->get();\n\t}", "public function read_by_author()\n {\n //Create Query\n $query =\n 'SELECT \n c.category as category_name,\n a.author as author_name,\n q.id,\n q.quote,\n q.authorId,\n q.categoryId \n FROM \n ' .\n $this->table .\n ' q\n LEFT JOIN \n categories c ON q.categoryId = c.id\n LEFT JOIN \n authors a ON q.authorId = a.id\n WHERE \n q.authorId = :authorId\n ORDER BY \n id ASC';\n\n //Prepare Statement\n $stmt = $this->conn->prepare($query);\n //Bind data\n $stmt->bindParam(':authorId', $this->authorId);\n\n //Execute query\n $stmt->execute();\n\n return $stmt;\n }", "public function findByAuthorId($authorId)\n {\n $qb = $this->getBaseSelect()\n ->addSelect('main.id')\n ->leftJoin('main', 'books_authors_link', 'bal', 'bal.book = main.id')\n ->leftJoin('main', 'authors', 'author', 'author.id = bal.author')\n ->andWhere('author.id = :author_id')\n ->orderBy('serie.name')\n ->addOrderBy('series_index')\n ->addOrderBy('title')\n ->setParameter('author_id', $authorId, PDO::PARAM_INT);\n\n $this->handleExcludedSerie($qb);\n $this->handleExcludedBook($qb);\n\n return $this->paginate($qb)\n ->execute()\n ->fetchAll(PDO::FETCH_ASSOC);\n }", "function getAuthorByPost($authorId)\n\t{\n\t\t$author = $this->authorfactory->create();\n\t\t$list = $author->load($authorId);\n\t\treturn $list;\n\t}", "function the_authors() {\n\techo get_the_authors($id);\n}", "public function get_book_by_book_id($id)\n\t{\n\t\t$this->db->where('id', $id);\n\t\t$query=$this->db->get('library_books');\n\t\treturn $query->result_array();\n\t}", "function get_books($book_ids) {\n\t$sz = count($book_ids);\n\t$books = array();\n\t$trash = array(\"\\\"\", \"'\", \"\\n\", \"\\t\");\n\tfor ($i = 0; $i < $sz; $i++) {\n\t\t$books[$i] = new Book();\n\t\t$bid = $book_ids[$i];\n\t\t$books[$i] -> setBookId($bid);\n\t\t// get book details.\n\t\t$title = mysql_query(\"select title from Books where book_id='$bid';\");\n\t\t$authors = mysql_query(\"select Link_BookAuthors.author_id, Authors.name from Link_BookAuthors left join Authors on Link_BookAuthors.author_id=Authors.author_id where Link_BookAuthors.book_id='$bid';\");\n\t\t$subjects = mysql_query(\"select subject from Subjects where book_id='$bid';\");\n\t\t$description = mysql_query(\"select description from Books where book_id='$bid';\");\n\n\t\t// fetch and set title\n\t\t$tmp_t = mysql_fetch_array($title);\n\t\t$books[$i] -> setTitle(str_replace($trash, \"\", $tmp_t['title']));\n\n\t\t// fetch and set authors\n\t\t$ccounter = 0;\n\t\t$tmp_a = array();\n\t\twhile ($row = mysql_fetch_array($authors)) {\n\t\t\t$tmp_a[$ccounter] = str_replace($trash, \"\", $row['name']);\n\t\t\t$ccounter++;\n\t\t}\n\t\tif ($ccounter == 0) {\n\t\t\t$tmp_a[0] = 'No author was found the database';\n\t\t}\n\t\t$books[$i] -> setAuthors($tmp_a);\n\n\t\t// fetch and set subjects\n\t\t$ccounter = 0;\n\t\t$tmp_s = array();\n\t\twhile ($row = mysql_fetch_array($subjects)) {\n\t\t\t$tmp_s[$ccounter] = str_replace($trash, \"\", $row['subject']);\n\t\t\t$ccounter++;\n\t\t}\n\t\tif ($ccounter == 0) {\n\t\t\t$tmp_s[0] = 'No subject was found the database';\n\t\t}\n\t\t$books[$i] -> setSubjects($tmp_s);\n\n\t\t// fetch and set description\n\t\t$tmp_d = mysql_fetch_array($description);\n\t\t$books[$i] -> setDescription(str_replace($trash, \"\", $tmp_d['description']));\n\t}\n\treturn $books;\n\n}", "function displayBooks($filter)\n {\n // Prevent injections:\n $filter = $this->conn->real_escape_string($filter);\n // Build query:\n $query = \"SELECT b.bookid, b.title, a.name, b.pub_year, b.available \n FROM books b, authors a \n WHERE (a.authorid = b.authorid)\n AND (b.bookid LIKE '%$filter%'\n OR b.title LIKE '%$filter%'\n OR b.ISBN LIKE '%$filter%'\n OR b.pub_year LIKE '%$filter%'\n OR b.available LIKE '%$filter%'\n OR a.name LIKE '%$filter%')\n ORDER BY b.bookid\";\n $result = $this->conn->query($query);\n\n return $this->buildBooksTable($result);\n }", "public function listBooksAndAuthors()\n {\n $cli = new Client(['base_uri' => $this->apiUrl]);\n\n $booksRequest = $cli->request('GET', 'books');\n\n $booksArray = json_decode(response()->json($booksRequest->getBody()->getContents())->getData(), true);\n\n $books = [];\n\n foreach ($booksArray as $book) {\n\n $authorRequest = $cli->request('GET', 'authors/' . $book['authorId']);\n\n $authorArray = json_decode(response()->json($authorRequest->getBody()->getContents())->getData(), true);\n\n $books[] = [\n 'title' => $book['title'],\n 'author' => $authorArray['firstName'] . ' ' . $authorArray['lastName']\n ];\n }\n\n return response()->json($books)->getData();\n }", "public function findByAuthor($author_id) {\n // get author author\n $author = $this->authorDAO->find($author_id);\n\n // $author_id is not selected by the SQL query\n // The $author won't be retrieved during domain objet construction\n $sql = \"select * from t_quote where a_id=? order by time(q_id) asc\";\n $result = $this->getDb()->fetchAll($sql, array($author_id));\n\n // Convert query result to an array of domain objects\n $auth_quotes = array();\n foreach ($result as $row) {\n $quoteId = $row['q_id'];\n $quote = $this->buildDomainObject($row);\n // The associated author is defined for the constructed comment\n $quote->setAuthor($author);\n $auth_quotes[$quoteId] = $quote;\n }\n return $auth_quotes;\n\n }", "public function getAllAuthorsWithIds()\n {\n $authors = $this->authorRepository->getAllAuthors();\n $result = [];\n if (!empty($authors)) {\n foreach ($authors as $author) {\n $result[$author['id']] = $author['first_name'] . ' ' . $author['last_name'];\n }\n }\n return $result;\n }", "public static function get_author($id)\n\t{\n\t\treturn DB::select(array('category.category', 'author'))\n\t\t\t->from(array(self::CATEGORY_TABLE, 'category'))\n\t\t\t->join(array(self::CATEGORY_TABLE, 'parent'))->on('category.parent_id', '=', 'parent.id')\n\t\t\t->join(array(self::TABLE_CATEGORIES, 'pc'))->on('pc.category_id', '=', 'category.id')\n\t\t\t->join(array(self::MAIN_TABLE, 'product'))->on('pc.product_id', '=', 'product.id')\n\t\t\t->where('parent.category', '=', 'Authors')\n\t\t\t->where('category.publish', '=', 1)\n\t\t\t->where('category.deleted', '=', 0)\n\t\t\t->where('product.id', '=', $id)\n\t\t\t->execute()\n\t\t\t->get('author', '');\n\t}", "public function findAllByBook($book) {\n\t\tif (empty($book)) {\n\t\t\tthrow new NullPointerException(\"The parameter [book] is empty.\");\n\t\t}\n\t\treturn dibi::dataSource(\"SELECT [view_my_following].* FROM [view_my_following] INNER JOIN [following] ON [following].[id_user_followed] = [view_my_following].[id_user] WHERE [id_book_title] = %i AND [following].[id_user] = %i\", $book, System::user()->getId());\n\t}" ]
[ "0.69911635", "0.69421256", "0.6768594", "0.67530614", "0.66824424", "0.6560212", "0.65558094", "0.65389866", "0.6522947", "0.6485729", "0.6485729", "0.6410823", "0.6374016", "0.63014954", "0.62890255", "0.6180921", "0.61726147", "0.61546206", "0.6127648", "0.6127069", "0.6080898", "0.6080015", "0.6077979", "0.6068353", "0.6048636", "0.60377467", "0.6026627", "0.6019044", "0.6003736", "0.5988944" ]
0.730682
0
Update Hashtag selecting by ID and updating by updateArr
public static function updLocaleHashtagByID($id, $updateArr) { return self::where('id', $id)->update($updateArr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update(array $data,$id);", "public function update(array $arr, $id)\n {\n }", "public function update(array $data, $id = 0);", "public function update(array $data, $id);", "public function update(array $data, $id);", "public function update(array $data, $id);", "public function update(array $data, $id);", "public function update(array $data, $id)\n {\n }", "public function update(array $data, $id)\n {\n }", "public function updateItem($array)\n {\n $id = $array['id'];\n\n $entity = $this->baseQuery()->find($id);\n $entity->fill($array);\n\n if ($entity->status === \"on\") {\n $entity->status = Statuses::ACTIVE;\n } else {\n $entity->status = Statuses::NOT_ACTIVE;\n }\n\n $entity->save();\n }", "public function update(array $data, int $id)\n {\n }", "function update(array $update);", "public function update($id, array $data);", "public function update($id, array $data);", "public function update($id, array $data);", "public function update($id, array $data);", "public function update($id, array $data);", "public function update($id, array $data);", "public function updateById();", "public function update($id, array $input);", "function update_data($infoId, $dataString, $dataArray){\n\n\t$sql = \"UPDATE $infoId SET $dataString WHERE id =\" . $dataArray['id'];\n\t//echo $sql; //turn this on will effect the success callback of $http with Yes return\n\t//error can accur if the field is in the mysql reserve words like change, update\n\ttry {\n\t\t$db = getDB();\n\t\t$stmt = $db->prepare($sql);\n\t\tforeach($dataArray as $x => &$x_val){\n\t \t\t$stmt->bindParam($x, $x_val);\n \t\t}\n\t\t $status = $stmt->execute();\t\n\t\t $db = null;\n\t\treturn 'done';\n\t} \n\tcatch(PDOException $e) {\t\n echo $e;\n\t}\n}", "protected function _update($id, $tbl, $array)\n {\n \tforeach ($array as &$item) {\n foreach ($item as &$cell) {\n if (is_array($cell)) {\n $cell = $this->_prepareToTree($cell);\n }\n }\n }\n\n if (is_array($tbl)) {\n $tbl = $tbl['title'];\n }\n \n return $this->_db->update($tbl, $array, $tbl . '_id = ' . $id);\n }", "private function update() {\r\n return DB::updateQuery($this->id, 'id', self::TABLE_NAME, $this->toArray());\r\n }", "function _message_column_update($update_data,$msg_id_arr)\n {\n \tif(!empty($msg_id_arr))\n\t\t{\n $this->db->where_in('message_id',$msg_id_arr);\n $this->db->set($update_data['key'],$update_data['value']);\n $this->db->update('message_inbox');\n\t\t}\n }", "function update_track($id,$params)\n {\n $this->db->where('id',$id);\n return $this->db->update('track',$params);\n }", "public function update($data,$id);", "public function update($id, array $data)\n {\n }", "protected function arrayupdate() {\n \n }", "private function updateAppHeadById(Int $appId, Array $dataArr){\n return QP_App_Head::where('row_id', $appId)\n ->update($dataArr);\n }", "public function update($data,$id){\n $query = 'update '.$this->db_table;\n $query .= ' set ';\n foreach ($data as $key=>$value){\n $query .= \"$key=\\\"$value\\\",\";\n }\n $query = rtrim($query,',');\n $query .= ' where '.$this->table_id.'='.$id;\n $this->db->query($query);\n }" ]
[ "0.6529848", "0.6367562", "0.63527054", "0.63068324", "0.63068324", "0.63068324", "0.63068324", "0.606929", "0.606929", "0.60305095", "0.60295874", "0.59671235", "0.5870129", "0.5870129", "0.5870129", "0.5870129", "0.5870129", "0.5870129", "0.58381987", "0.58243793", "0.5758797", "0.5752302", "0.5751844", "0.57504344", "0.5739059", "0.5732789", "0.5731045", "0.56976616", "0.56833375", "0.5675438" ]
0.67788416
0
/ Method to get a list of plugins / apps for the related category, based and as set in the "XiveIRM App Config" NOTE: WORKS ALREADY WITH THE NEW SITUATION THAT ONE USER COULD HAVE MORE THAN ONE CLIENT_ID (USERGROUPS)
public function getPlugins($app, $catid) { if ( !$app || !$catid ) { return false; } $catIds = array(); $catIds[$catid] = $catid; // Get all relevant category id's and build the sql prepared string $appCatId = IRMComponentHelper::getConfigValue($app, 'parent_app_category'); if ( $appCatId > 0 ) { $catIds[$appCatId] = $appCatId; } // All Categories ( eg for system based stuff ) $catIds[0] = 0; $catIdString = implode(',', $catIds); // Get usergroups as implode string ($implode = true) and injected usergroup as global (injectGroup = 0) $usergroups = NFWUserGroup::getParents( true, array(0 => 'System Global') ); // Prepare database query $db = JFactory::getDbo(); $query = $db->getQuery(true); // Get active and configurated plugins, join extended with plugin folder from #__extensions // TODO: remove folder from plugins table, because we get it from extensions $query ->select( array('a.id', 'a.client_id', 'a.plugin', 'a.catid', 'a.config', 'b.folder') ) ->from( '#__xiveirm_plugins AS a' ) ->join( 'LEFT', '#__extensions as b ON (a.plugin = b.element)' ) ->where( 'b.enabled = 1' ) ->where( 'a.catid IN (' . $catIdString . ')' ) ->where( 'a.client_id IN (' . $usergroups . ')' ); $db->setQuery($query); $results = $db->loadObjectlist(); return $results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getApps();", "function _horde_listApps($filter = null)\n{\n return $GLOBALS['registry']->listApps($filter);\n}", "public function getApplications();", "public function getInstalledApps(){\n $command = new Command($this->host, self::APPS_INSTALLED,\"GET\", $this->enableCache, $this->cacheLifetime, $this->cacheFolder);\n $command->execute();\n return $command->getData(\"dapps\");\n }", "public function getplugins()\n\t{\n\t\ttry\n\t\t{\n\t\t\t$app = JFactory::getApplication();\n\t\t\t$jinput = $app->input;\n\t\t\t$jform = $jinput->post->get('jform', array(), 'ARRAY');\n\t\t\t$client = $jform['client'];\n\t\t\t$userid = isset($jform['userid']) ? $jform['userid'] : 0;\n\t\t\t$id = $jform['id'];\n\n\t\t\t$model = $this->getModel('tjreport');\n\t\t\t$reports = $model->getClientPlugins($client, $id, $userid);\n\n\t\t\techo new JResponseJson($reports);\n\t\t}\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\techo new JResponseJson($e);\n\t\t}\n\t}", "function drush_apps_installable_apps() {\n module_load_include('inc', 'apps', 'apps.manifest');\n\n $apps_list = array();\n $servers = apps_servers();\n foreach ($servers as $server) {\n $apps = apps_apps($server);\n foreach ($apps as $key => $app) {\n if ($app['status'] == APPS_DISABLED || $app['status'] == APPS_INSTALLABLE) {\n $apps_list[$key] = $app['server']['name'];\n }\n }\n }\n return $apps_list;\n}", "public function getApps()\n {\n return $this->apps;\n }", "public function getApps() : array\n {\n return $this->apps;\n }", "public function getApps()\n {\n return $this->_apps;\n }", "public function getInstalledPlugins();", "public function getInstalledAppsIds(){\n $command = new Command($this->host, self::APPS_INSTALLED_IDS,\"GET\", $this->enableCache, $this->cacheLifetime, $this->cacheFolder);\n $command->execute();\n return $command->getData(\"ids\");\n }", "function htvcenter_ansible_get_cloud_applications() {\n\tglobal $event;\n\tglobal $htvcenter_SERVER_BASE_DIR;\n\tglobal $htvcenter_SERVER_IP_ADDRESS;\n\tglobal $htvcenter_EXEC_PORT;\n\n\t$ansible_group_list = array();\n\t$ansible = new ansible();\n\t$ansible_group_array = $ansible->get_available_playbooks();\n\tforeach ($ansible_group_array as $index => $ansible_app) {\n\t\t$ansible_group_list[] = \"ansible/\".$ansible_app;\n\t}\n\treturn $ansible_group_list;\n}", "public function searchForOtherTechnologies()\n {\n $applications = [];\n $otherTechnologies = (new Togglyzer($this->siteAnatomy))->check();\n if (isset($otherTechnologies->applications)) {\n foreach ($otherTechnologies->applications as $application) {\n\n if ($application->name != 'WordPress') {\n\n $app = (new \\App\\Engine\\ApplicationComponents\\Application())\n ->setName($application->name)\n ->setConfidence($application->confidence)\n ->setVersion($application->version)\n ->setIcon($application->icon)\n ->setWebsite($application->website)\n ->setCategories($application->categories);\n\n $applications[] = $app;\n }\n\n\n }\n }\n\n return $applications;\n }", "public function get_addon_data() {\n global $CFG;\n $branch = local_rlsiteadmin_get_branch_number();\n // Bitmask for all (UI will filter).\n $level = 7;\n // Requirement: Only display private plugins if they belong to this site.\n $private = 1;\n $data = array('branchnum' => $branch, 'level' => $level, 'private' => $private, 'url' => $CFG->wwwroot);\n\n $response = $this->send_request('get_moodle_plugins', $data);\n return $response;\n }", "function getConfigs()\n {\n // Let's load the data if it doesn't already exist\n if(empty($this->_configs))\n {\n // Get the data of the categories which will actually be displayed\n $query = $this->_buildQuery();\n $this->_db->setQuery($query, $this->getState('list.start'), $this->getState('list.limit'));\n $configs = $this->_db->loadObjectList('group_id');\n\n $this->_configs = array();\n foreach($configs as $key => $config)\n {\n // If there is at least one config row with a higher ordering value which belongs\n // to a parent user group the current config row can/will never be applied to a user\n if($this->getActiveParentConfigs($config->group_id, $config->ordering))\n {\n $config->usergroups = false;\n\n continue;\n }\n\n // With the following code we want to get all user groups\n // for which the current config row applies.\n $subgroups = $this->getTree($config->group_id);\n $config->usergroups = array();\n $removing = false;\n foreach($subgroups as $key => $subgroup)\n {\n // If the removing flag is set we won't store user groups\n // which are children of the group stored in $removing\n if($removing)\n {\n if($subgroup->rgt > $removing)\n {\n // If rgt of current group is greater than the\n // stored one the complete sub-tree was parsed\n $removing = false;\n }\n else\n {\n continue;\n }\n }\n\n // If there is a config row for the current user group with a higher ordering value\n // that one will be used for the current user group and all of its sub-groups\n if(isset($configs[$subgroup->id]) && $configs[$subgroup->id]->ordering > $config->ordering)\n {\n $removing = $subgroup->rgt;\n\n continue;\n }\n\n // If we reach this point the current config row will\n // be applied to the current user group, so store it\n $config->usergroups[] = $subgroup->title;\n }\n\n // Prepend the user group the config row belongs to\n array_unshift($config->usergroups, $config->title);\n }\n\n $this->_configs = $configs;\n }\n\n return $this->_configs;\n }", "public function getCategories(){\n $command = new Command($this->host, self::APPS_CATEGORIES,\"GET\", $this->enableCache, $this->cacheLifetime, $this->cacheFolder);\n $command->execute();\n return $command->getData(\"category\");\n }", "public function getApps()\r\n {\r\n if( empty($this->loginTokens) )\r\n {\r\n trigger_error( \"BlackBerryStats::getApps(): Login tokens are empty. Login first!\" );\r\n return null;\r\n }\r\n\r\n $response = $this->reqApps();\r\n $result = $this->reqAppsResult($response);\r\n\r\n return $result;\r\n }", "public function getPlugins();", "public function getModels() {\n\t\t$result = array();\n\n\t\t$result['app'] = App::objects('Model', null, false);\n\t\t// getting rid of AppModel if its present\n\t\tif(($AppModelPos = array_search('AppModel', $result['app'])) !== false) {\n\t\t\tarray_splice($result['app'], $AppModelPos, 1);\n\t\t}\n\t\t\n\t\t$plugins = App::objects('plugins', null, false);\n\t\tif (!empty($plugins)) {\n\t\t\tforeach ($plugins as $plugin) {\n\t\t\t\t\n\t\t\t\t$pluginModels = App::objects('Model', App::pluginPath($plugin) . 'Model' . DS, false);\n\t\t\t\t\n\t\t\t\tif (!empty($pluginModels)) {\n\t\t\t\t\t\n\t\t\t\t\tif (empty($result[$plugin])) {\n\t\t\t\t\t\t$result[$plugin] = array();\n\t\t\t\t\t}\n\n\t\t\t\t\tforeach ($pluginModels as $model) {\n\t\t\t\t\t\tif ($model != $plugin .'AppModel'){\n\t\t\t\t\t\t\t$result[$plugin][] = \"$plugin.$model\";\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\treturn $result;\n\t}", "public function load_api_applications() {\n \n (new MidrubBaseAdminCollectionSettingsHelpers\\Oauth)->load_applications_list();\n \n }", "public function getApps($category = null, $name = null, $type = null, $link = null, $limit = null, $offset = null, $orderBy = null){\n $command = new Command($this->host, self::APPS_GET_REGISTERED,\"GET\", $this->enableCache, $this->cacheLifetime, $this->cacheFolder);\n $command->setParam(\"category\", $category);\n $command->setParam(\"name\", $name);\n $command->setParam(\"type\", $type);\n $command->setParam(\"link\", $link);\n $command->setParam(\"limit\", $limit);\n $command->setParam(\"offset\", $offset);\n $command->setParam(\"orderBy\", $orderBy);\n $command->execute();\n return $command->getData(\"dapps\");\n }", "public static function applicationGetCategories() {\r\n //creates database connection if one doesn't already exist\r\n self::setInstance();\r\n \r\n $query = \"SELECT DISTINCT category FROM applications WHERE moderation_state = 'ACTIVE'\";\r\n \r\n //Submit the query and store results\r\n $cats = self::$instance->query($query)->fetchAll(PDO::FETCH_ASSOC);\r\n \r\n //Create an array to hold categories\r\n $application_categories = array();\r\n \r\n //Generate clean array from SQL results\r\n foreach($cats as $cat) {\r\n $application_categories[] = $cat[\"category\"];\r\n }\r\n \r\n return $application_categories;\r\n }", "function getAppName() {\n\t\t$db = PearDatabase::getInstance();\n\t\t$result = $db->pquery('SELECT appname,visible FROM vtiger_app2tab WHERE tabid = ?', array($this->getId()));\n\t\t$count = $db->num_rows($result);\n\t\t$apps = array();\n\t\tif ($count > 0) {\n\t\t\tfor ($i = 0; $i < $count; $i++) {\n\t\t\t\t$appName = $db->query_result($result, $i, 'appname');\n\t\t\t\t$visibility = $db->query_result($result, $i, 'visible');\n\t\t\t\t$apps[$appName] = $visibility;\n\t\t\t}\n\t\t}\n\n\t\treturn $apps;\n\t}", "function drush_apps_list() {\n $servers = func_get_args();\n module_load_include('inc', 'apps', 'apps.manifest');\n $servers = !empty($servers)? $servers : array_keys(apps_servers());\n $rows = array(array(dt('Key'), dt('Name'), dt('version'), dt('server'), dt('status')));\n foreach ($servers as $server) {\n $apps = apps_apps($server);\n foreach ($apps as $k => $app) {\n $status = '';\n switch ($app['status']) {\n CASE APPS_INCOMPATIBLE : $status = 'Incompatible'; break;\n CASE APPS_DISABLED : $status = 'Disabled'; break;\n CASE APPS_ENABLED : $status = 'Enabled'; break;\n CASE APPS_INSTALLABLE : $status = 'Installable'; break;\n }\n $rows[] = array(\n $k,\n $app['name'],\n $app['version'],\n $server,\n $status,\n );\n }\n unset($apps);\n }\n drush_print_table($rows, TRUE);\n}", "function local_amos_standard_plugins() {\n global $CFG;\n static $list = null;\n\n if (is_null($list)) {\n $xml = simplexml_load_file($CFG->dirroot.'/local/amos/plugins.xml');\n foreach ($xml->moodle as $moodle) {\n $version = (string)$moodle['version'];\n $list[$version] = array();\n $list[$version]['moodle'] = 'core';\n foreach ($moodle->plugins as $plugins) {\n $type = (string)$plugins['type'];\n foreach ($plugins as $plugin) {\n $name = (string)$plugin;\n if ($type == 'core' or $type == 'mod') {\n $list[$version][$name] = \"{$type}_{$name}\";\n } else {\n $list[$version][\"{$type}_{$name}\"] = \"{$type}_{$name}\";\n }\n }\n }\n }\n }\n\n return $list;\n}", "private function _get_installed_plugins()\n\t{\n\t\t$this->EE->load->helper('file');\n\n\t\t$ext_len = strlen('.php');\n\n\t\t$plugin_files = array();\n\t\t$plugins = array();\n\n\t\t// Get a list of all plugins\n\t\t// first party first!\n\t\tif (($list = get_filenames(PATH_PI)) !== FALSE)\n\t\t{\n\t\t\tforeach ($list as $file)\n\t\t\t{\n\t\t\t\tif (strncasecmp($file, 'pi.', 3) == 0 &&\n\t\t\t\t\tsubstr($file, -$ext_len) == '.php' &&\n\t\t\t\t\tstrlen($file) > 7 &&\n\t\t\t\t\tin_array(substr($file, 3, -$ext_len), $this->core->native_plugins))\n\t\t\t\t{\n\t\t\t\t\t$plugin_files[$file] = PATH_PI.$file;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\t// third party, in packages\n\t\tif (($map = directory_map(PATH_THIRD, 2)) !== FALSE)\n\t\t{\n\t\t\tforeach ($map as $pkg_name => $files)\n\t\t\t{\n\t\t\t\tif ( ! is_array($files))\n\t\t\t\t{\n\t\t\t\t\t$files = array($files);\n\t\t\t\t}\n\n\t\t\t\tforeach ($files as $file)\n\t\t\t\t{\n\t\t\t\t\tif (is_array($file))\n\t\t\t\t\t{\n\t\t\t\t\t\t// we're only interested in the top level files for the addon\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// we gots a plugin?\n\t\t\t\t\tif (strncasecmp($file, 'pi.', 3) == 0 &&\n\t\t\t\t\t\tsubstr($file, -$ext_len) == '.php' &&\n\t\t\t\t\t\tstrlen($file) > strlen('pi.'.'.php'))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (substr($file, 3, -$ext_len) == $pkg_name)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$plugin_files[$file] = PATH_THIRD.$pkg_name.'/'.$file;\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\n\t\tksort($plugin_files);\n\n\t\t// Grab the plugin data\n\t\tforeach ($plugin_files as $file => $path)\n\t\t{\n\t\t\t// Used as a fallback name and url identifier\n\t\t\t$filename = substr($file, 3, -$ext_len);\n\n\t\t\t// Magpie maight already be in use for an accessory or other function\n\t\t\t// If so, we still need the $plugin_info, so we'll open it up and\n\t\t\t// harvest what we need. This is a special exception for Magpie.\n\t\t\tif ($file == 'pi.magpie.php' &&\n\t\t\t\tin_array($path, get_included_files()) &&\n\t\t\t\tclass_exists('Magpie'))\n\t\t\t{\n\t\t\t\t$contents = file_get_contents($path);\n\t\t\t\t$start = strpos($contents, '$plugin_info');\n\t\t\t\t$length = strpos($contents, 'Class Magpie') - $start;\n\t\t\t\teval(substr($contents, $start, $length));\n\t\t\t}\n\n\t\t\t@include_once($path);\n\n\t\t\tif (isset($plugin_info) && is_array($plugin_info))\n\t\t\t{\n\t\t\t\t// Third party?\n\t\t\t\t$plugin_info['installed_path'] = $path;\n\n\t\t\t\t// fallback on the filename if no name is given\n\t\t\t\tif ( ! isset($plugin_info['pi_name']) OR $plugin_info['pi_name'] == '')\n\t\t\t\t{\n\t\t\t\t\t$plugin_info['pi_name'] = $filename;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isset($plugin_info['pi_version']))\n\t\t\t\t{\n\t\t\t\t\t$plugin_info['pi_version'] = '--';\n\t\t\t\t}\n\t\t\t\t$plugins[$filename] = $plugin_info;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//log_message('error', \"Invalid Plugin Data: {$filename}\");\n\t\t\t}\n\n\t\t\tunset($plugin_info);\n\t\t}\n\n\t\treturn $plugins;\n\t}", "public function get_all_plugins() {\r\n\t\t$registered = $this->get( array( 'plugins' ) );\r\n\t\treturn $registered;\r\n\t}", "public function appConfigurationAction()\n {\n // try to get logged in user\n $communityUser = $this->communityUserService->getCommunityUser();\n $appConfiguration = array();\n $appConfiguration['results']['PushChannels'] = array();\n foreach ($this->settings['pushChannels'] as $key => $pushChannel) {\n $appConfiguration['results']['PushChannels']['Channel' . $key] = $pushChannel;\n }\n if ($communityUser instanceof CommunityUser) {\n $appConfiguration['results']['token'] = $communityUser->getAuthToken();\n $appConfiguration['results']['PushChannels']['Channel0'] = 'userid_' . $communityUser->getUid();\n }\n return json_encode($appConfiguration);\n }", "public function getPlugins() {\n $pluginDirs = App::objects('plugin', null, false);\n $plugins = array();\n foreach ($pluginDirs as $pluginDir) {\n\n $pluginClasses = App::objects('controller', APP . 'Plugin' . DS . $pluginDir . DS . 'Controller', false);\n\n App::import('Controller', $pluginDir . '.' . $pluginDir . 'App');\n $parentActions = get_class_methods($pluginDir . 'AppController');\n\n foreach ($pluginClasses as $plugin) {\n\n if (strpos($plugin, 'App') === false) {\n\n $plugin = str_ireplace('Controller', '', $plugin);\n App::import('Controller', $pluginDir . '.' . $plugin);\n $actions = get_class_methods($plugin . 'Controller');\n\n foreach ($actions as $k => $v) {\n if ($v{0} == '_') {\n unset($actions[$k]);\n }\n }\n\n $plugins[$pluginDir][$plugin] = array_diff($actions, $parentActions);\n }\n }\n }\n\n return $plugins;\n }", "public function getApplications()\n {\n return $this->hasMany(Application::className(), ['category_id' => 'id']);\n }" ]
[ "0.6568537", "0.6111254", "0.5914447", "0.57481617", "0.57191706", "0.5633799", "0.56114864", "0.55897444", "0.55794185", "0.5550913", "0.554011", "0.55370975", "0.5484273", "0.5438815", "0.54362255", "0.5418888", "0.5384052", "0.5367333", "0.53624076", "0.53373826", "0.531482", "0.5309688", "0.5298608", "0.52939314", "0.5283719", "0.5281054", "0.52696174", "0.525", "0.5248419", "0.52447915" ]
0.6645192
0
Validation list Address: chppermval Access: 'anai chp list permit validation'
function chpperm_validation_list_form($form_state) { drupal_set_title(t('Permit validations')); global $user; $form = array(); ahah_helper_register($form, $form_state); $settings = array(); $settings['tag'] = 'ajax'; $settings['show_companies'] = TRUE; $settings['show_regions'] = TRUE; $settings['show_clients'] = TRUE; $settings['show_properties'] = TRUE; $settings['show_lots'] = TRUE; $settings['buttons']['back']['title'] = t('Back'); if (user_access('anai chp add permit validation')) { $settings['buttons']['add']['submit'] = 'chpperm_validation_list_form_submit_add'; } $settings['buttons']['back']['submit'] = 'chpperm_validation_list_form_submit_back'; if (chpprop_produce_header(&$form, &$form_state, $settings)) { return $form; } $company_id = $form_state['storage']['ajax']['CompanyId']; $region_id = $form_state['storage']['ajax']['RegionId']; $client_id = $form_state['storage']['ajax']['ClientId']; $property_id = $form_state['storage']['ajax']['PropertyId']; $lot_id = $form_state['storage']['ajax']['LotId']; if ($client_id === 'ANY') { $form['ajax']['error'] = array('#value' => '<p>'.t('Client missing.').'<p>'); $form['ajax']['cancel'] = array('#type' => 'image_button', '#src' => drupal_get_path('module', 'anai').'/cancel.png', '#submit' => array('chpperm_validation_list_form_submit_back')); return $form; } $groups = chpperm_retrieve_groups($user->uid, $company_id, $property_id); $groups = $groups[$client_id]; if (empty($groups)) { $form['ajax']['error'] = array('#value' => '<p>'.t('Account missing.').'<p>'); $form['ajax']['cancel'] = array('#type' => 'image_button', '#src' => drupal_get_path('module', 'anai').'/cancel.png', '#submit' => array('chpperm_validation_list_form_submit_back')); return $form; } $group_options = array(); foreach ($groups as $key => $value) { $group_options[$key] = decode_entities($value['data']['Alias']); } if (!isset($form_state['storage']['ajax']['GroupId'])) { $form_state['storage']['ajax']['GroupId'] = key($group_options); } $form['ajax']['GroupId'] = array('#type' => 'select', '#title' => t('Account'), '#options' => $group_options, '#default_value' => $form_state['storage']['ajax']['GroupId'], '#ahah' => array('event' => 'change', 'path' => ahah_helper_path(array('ajax')), 'wrapper' => 'ajax-wrapper')); $group_id = $form_state['storage']['ajax']['GroupId']; $group = $groups[$group_id]['data']; $now = chpuser_datetime_utc_to_utc('now'); $permits = chdbperm_cc_get_permits($company_id, $property_id, $lot_id, TRUE, $group_id, FALSE, NULL, // $member_id FALSE, NULL, TRUE, $now->format("Y-m-d H:i:s"), TRUE, $now->format("Y-m-d H:i:s"), FALSE, NULL, TRUE, TRUE, TRUE, FALSE, TRUE, 'Validation'); $local = chpuser_datetime_utc_to_usertimezone($now->format("Y-m-d H:i:s")); $form['ajax']['time'] = array('#value' => '<p>'.$local->format("D, M j,Y H:i:s")); if (empty($permits)) { $form['ajax']['empty'] = array('#value' => '<p>'.t('No active validations.')); return $form; } else { $form['ajax']['entries'] = array('#value' => '<p>'.t('Active validations: NUM', array('NUM' => count($permits))).'<p>'); } if (0 < $group['ValDailyMax']) { $stats = chdbperm_get_validationcounts($company_id, $client_id, $group_id, array($local->format("Y-m-d"))); $form['ajax']['daily'] = array('#value' => t('Daily usage: USED out of LIMIT', array('USED' => empty($stats) ? 0 : $stats[0]['Count'], 'LIMIT' => $group['ValDailyMax'])).'<br>'); } if (0 < $group['ValWeeklyMax']) { $time = chpuser_datetime_utc_to_usertimezone($now->format("Y-m-d H:i:s")); $time->modify(sprintf("-%d days", (int)$time->format("N") - 1)); $datetimes = array(); for ($i = 0; $i < 7; $i++) { $datetimes[] = $time->format("Y-m-d"); $time->modify("+1 day"); } $value = 0; foreach (chdbperm_get_validationcounts($company_id, $client_id, $group_id, $datetimes) as $stats) { $value += $stats['Count']; } $form['ajax']['weekly'] = array('#value' => t('Weekly usage: USED out of LIMIT', array('USED' => $value, 'LIMIT' => $group['ValWeeklyMax'])).'<br>'); } if (0 < $group['ValMonthlyMax']) { $stats = chdbperm_get_validationcounts($company_id, $client_id, $group_id, array($local->format("Y-m"))); $form['ajax']['monthly'] = array('#value' => t('Monthly usage: USED out of LIMIT', array('USED' => empty($stats) ? 0 : $stats[0]['Count'], 'LIMIT' => $group['ValMonthlyMax'])).'<br>'); } if (!empty($permits)) { $form['ajax']['list'] = chpperm_validation_list_table_form($permits); } return $form; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function requestValidationProvider()\n {\n return [\n ['admin', '', 'Owner', '1', '400'], // no email\n ['admin', 'unknown', '', '1', '400'], // no role\n ['admin', 'unknown', 'notARole', '1', '400'], // unknown role\n ['admin', 'unknown', 'Member', '', '400'], // no service for owner\n ['admin', '[email protected]', 'Member', '1', '401'], // cannot alter himself\n ['admin', 'unknown', 'Owner', '', '400'], // no service for member\n ['admin', 'unknown', 'Member', '54986468', '400'], // unknown service\n\n ['admin', 'unknown', 'Admin', '', '200'], // can add admin\n ['admin', 'unknown', 'Owner', '1', '200'], // can add owner\n ['admin', 'unknown', 'Member', '1', '200'], // can add member\n\n ['editor', 'unknown', 'Admin', '', '401'], // cannot add admin\n ['editor', '[email protected]', 'Admin', '', '401'], // cannot make himself Admin\n ['editor', 'unknown', 'Owner', '1', '401'], // cannot add owner\n ['editor', '[email protected]', 'Owner', '1', '401'], // cannot make himself Owner\n ['editor', 'unknown', 'Member', '1', '401'], // cannot add member\n\n ['owner', 'unknown', 'Admin', '', '401'], // cannot add admin\n ['owner', 'unknown', 'Owner', '5', '401'], // cannot assign others to not owned service\n ['owner', '[email protected]', 'Owner', '5', '401'], // cannot assign himself to not owned service\n ['owner', '[email protected]', 'Member', '5', '401'], // cannot assign himself to not owned service\n ['owner', 'unknown', 'Owner', '1', '200'], // can add owner to owned service\n ['owner', '[email protected]', 'Admin', '', '401'], // cannot make himself Admin\n ['owner', '[email protected]', 'Member', '1', '401'], // cannot alter himself\n ['owner', 'unknown', 'Member', '5', '401'], // cannot add member to other service\n ['owner', 'unknown', 'Member', '1', '200'], // can add member to owned service\n\n ['member', 'unknown', 'Admin', '', '401'], // cannot add admin\n ['member', '[email protected]', 'Admin', '', '401'], // cannot make himself Admin\n ['member', 'unknown', 'Owner', '1', '401'], // cannot add owner\n ['member', '[email protected]', 'Owner', '1', '401'], // cannot make himself Owner\n ['member', 'unknown', 'Member', '1', '401'], // cannot add member\n ];\n }", "public function rules()\n\t{\n\t\t$list_id = $this->route('list');\n\t\tif($list_id) {\n\t\t\treturn [\n\t\t\t\t'name' => 'required|min:3|max:30|valid_charset|unique:location_lists,name,'.$list_id,\n\t\t\t\t'category' => 'required|in:'.implode(\",\",config('constants.list_categories')),\n\t\t\t\t'private' => 'required|boolean',\n\t\t\t];\n\t\t} else {\n\t\t\treturn [\n\t\t\t\t'name' => 'required|min:3|max:30|valid_charset|unique:location_lists',\n\t\t\t\t'category' => 'required|in:'.implode(\",\",config('constants.list_categories')),\n\t\t\t\t'private' => 'required|boolean',\n\t\t\t];\n\t\t}\n\t}", "function inbound_checker_form_list_validate($form, &$form_state) {\n // Check the keyword text field in settings tab for it isn't empty.\n if (!variable_get('inbound_checker_keyword', '')) {\n form_set_error('inbound_checker_check_zeros', t('Please fill the keyword textfield in settings tab.'));\n }\n // Check available sites.\n // TODO: @sepehr: Use module's API when ready.\n if ($form_state['values']['inbound_checker_check_zeros']) {\n $results = db_result(db_query(\"SELECT COUNT(icid) FROM {inbound_checker} WHERE count = 0\"));\n if (!$results) {\n form_set_error('inbound_checker_check_zeros', t('There were no links to check.'));\n }\n }\n}", "function validate($sellist)\n{\n\tglobal $ip,$bannerloc_country,$bannerloc_uscity , $bannerloc_incity , $smarty,$ctc,$agemax,$agemin,$mem;\n\tglobal $mstatus , $rel , $occ , $com , $edu;\n\tglobal $propcity , $propinr , $proptype , $proprentinr , $propcat;\n\n if($sellist[\"age\"]==\"true\")\n {\n\t\n \tif($agemin=='')\n \t{\n \t\t$err[0][\"age\"]=\"true\";\n \t\t$err[1][\"age\"]=\"You have not selected the minimum age.Please select the minimum age to continue.\";\n \t}\n\t \tif($agemax=='')\n \t{\n \t\t$err[0][\"age\"]=\"true\";\n \t\t$err[1][\"age\"]=\"You have not selected the maximum age.Please select the maximum age to continue.\";\n \t}\n\t\n }\n if($sellist[\"mem\"]==\"true\")\n {\n if(count($mem)==0)\n {\n $err[0][\"mem\"]=\"true\";\n $err[1][\"mem\"]=\"You have not selected desired subscription.Please select subscription type to continue.\";\n }\n \n }\n\tif($sellist[\"mstatus\"]==\"true\")\n {\n if(count($mstatus)==0)\n {\n $err[0][\"mstatus\"]=\"true\";\n $err[1][\"mstatus\"]=\"You have not selected desired marital status.Please select marital status type to continue.\";\n }\n }\n\tif($sellist[\"rel\"]==\"true\")\n {\n if(count($rel)==0)\n {\n $err[0][\"rel\"]=\"true\";\n $err[1][\"rel\"]=\"You have not selected desired religion.Please select religion type to continue.\";\n }\n }\n\tif($sellist[\"edu\"]==\"true\")\n {\n if(count($edu)==0)\n {\n $err[0][\"edu\"]=\"true\";\n $err[1][\"edu\"]=\"You have not selected desired education qualifications.Please select education qualifications to continue.\";\n }\n }\n\tif($sellist[\"occ\"]==\"true\")\n {\n if(count($occ)==0)\n {\n $err[0][\"occ\"]=\"true\";\n $err[1][\"occ\"]=\"You have not selected desired occupation.Please select occupation to continue.\";\n }\n }\n\tif($sellist[\"com\"]==\"true\")\n {\n if(count($com)==0)\n {\n $err[0][\"com\"]=\"true\";\n $err[1][\"com\"]=\"You have not selected community.Please select community to continue.\";\n }\n }\n\tif($sellist[\"propcity\"]==\"true\")\n {\n if(count($propcity)==0)\n {\n $err[0][\"propcity\"]=\"true\";\n $err[1][\"propcity\"]=\"You have not selected property city.Please select property city to continue.\";\n }\n }\n\tif($sellist[\"propcat\"]==\"true\")\n {\n if(!($propcat))\n {\n $err[0][\"propcat\"]=\"true\";\n $err[1][\"propcat\"]=\"You have not selected property category.Please select property category to continue.\";\n }\n }\n\tif($sellist[\"propinr\"]==\"true\")\n {\n if($propcat=='Rent' && count($proprentinr)==0)\n {\n $err[0][\"propinr\"]=\"true\";\n $err[1][\"propinr\"]=\"You have not selected Rent property INR.Please select property INR continue.\";\n }\n\t\telseif ($propcat=='Buy' && count($propinr)==0)\n\t\t{\n\t\t\t$err[0][\"propinr\"]=\"true\";\n $err[1][\"propinr\"]=\"You have not selected Rent property INR.Please select property INR continue.\";\n\t\t}\n\n }\n\n\tif($sellist[\"proptype\"]==\"true\")\n {\n if(count($proptype)==0)\n {\n $err[0][\"proptype\"]=\"true\";\n $err[1][\"proptype\"]=\"You have not selected property type.Please select property type to continue.\";\n }\n }\n if($sellist[\"ctc\"]==\"true\")\n {\n\t \tif(count($ctc)==0)\n \t{\n \t\t$err[0][\"ctc\"]=\"true\";\n \t\t$err[1][\"ctc\"]=\"You have not selected the cost to company.Please select the cost to company to continue.\";\n \t}\n }\n \n\tif($sellist[\"location\"]==\"true\")\n {\n \tif(count($bannerloc_country) < 1)\n \t{\n \t\t$err[0][\"location\"]=\"true\";\n \t\t$err[1][\"location\"]=\"Location cannot be left blank. Kindly fill the an appropriate location to continue.\";\n \t}\n }\n\n\tif($sellist[\"ip\"]==\"true\")\n\t{\n\t\t$cnt_ip=count($ip);\n\t\tif($cnt_ip==0)\n\t\t{\n\t \t\t$err[0][\"ip\"]=\"true\";\n \t\t$err[1][\"ip\"]=\"You have not selected an appropriate City. Kindly select the City to continue.\";\n\t \t}\n\t\telse\n\t \t{\n\t \t\tif($cnt_ip==1 && $ip[0]==\"\")\n\t \t\t{\n\t\t \t\t$err[0][\"ip\"]=\"true\";\n\t \t\t$err[1][\"ip\"]=\"You have not selected an appropriate City. Kindly select the City to continue.\";\n\t\t\t}\t \n\t \t}\n\t}\n\n\tif(is_array($err[0]))\n\t{\n\t\t$smarty->assign('err',$err);\n\t\treturn(\"false\");\n\t}\n\telse\n\t{\n\t\treturn(\"true\");\n\t}\n\n }", "public function allowed();", "function ldc_list_validate($att, $valid) {\n\n //// Convert a comma-delimited attribute to an array of sub-attributes. \n $sub_atts = explode(',', $att);\n\n //// Validate each sub-attribute. \n foreach ($sub_atts as $sub_att) {\n if (! in_array($sub_att, $valid) ) { return false; }\n }\n\n //// Nothing invalid found! \n return true;\n}", "function inbound_checker_form_validate($form, &$form_state) {\n // TODO: @sepehr: Check the logic.\n if ($form_state['values']['inbound_checker_site_name']) {\n $pos = strpos($form_state['values']['inbound_checker_site_name'], '<');\n if (!empty($pos)) {\n form_set_error($form_state['values']['inbound_checker_site_name'], t('Please enter a valid name.'));\n }\n }\n\n if (isset($form_state['values']['inbound_checker_site_address'])) {\n if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $form_state['values']['inbound_checker_site_address'])) {\n form_set_error('inbound_checker_site_address', t('Please enter a valid URL.'));\n }\n }\n\n // TODO: @sepehr: Define the module API functions and do such operations through that layer.\n if($form_state['values']['op'] == t('Add')) {\n $results = db_query(\"SELECT * FROM {inbound_checker} WHERE site_address = '%s'\", $form_state['values']['inbound_checker_site_address']);\n $result = db_fetch_object($results);\n if ($result) {\n form_set_error('inbound_checker_site_address', t('Your url already existes.'));\n }\n }\n}", "private function getAddressRules()\n {\n return [\n 'country_id' => 'required',\n 'first_name' => 'required',\n 'line_one' => 'required',\n 'city' => 'required',\n 'postcode' => 'required',\n ];\n }", "function validate_ip_address() {\r\n\t\t$myoptionalmodules_dnsbl = sanitize_text_field ( get_option ( 'myoptionalmodules_dnsbl' ) );\r\n\t\t\r\n\t\tif( $myoptionalmodules_dnsbl ) {\r\n\t\t\t/**\r\n\t\t\t * Validate the IP address\r\n\t\t\t * \"This function converts a human readable IPv4 or IPv6 address\r\n\t\t\t * (if PHP was built with IPv6 support enabled) into an address \r\n\t\t\t * family appropriate 32bit or 128bit binary structure.\"\r\n\t\t\t * Read more at: //php.net/manual/en/function.inet-pton.php\r\n\t\t\t */\r\n\t\t\tif( inet_pton ( $_SERVER[ 'REMOTE_ADDR' ] ) === false ) {\r\n\t\t\t\t$this->ipaddress = false;\r\n\t\t\t\t/**\r\n\t\t\t\t * If the IP address can't validate, treat it like it's hostile, and flag it \r\n\t\t\t\t * as being DNSBL listed (regardless of whether it actually is or isn't)\r\n\t\t\t\t */\r\n\t\t\t\t$this->DNSBL = true;\r\n\t\t\t} else {\r\n\t\t\t\t/**\r\n\t\t\t\t * If the IP address DOES validate, pass it along for further analysis\r\n\t\t\t\t */\r\n\t\t\t\t$this->ipaddress = esc_attr ( $_SERVER[ 'REMOTE_ADDR' ] );\r\n\t\t\t\t$this->DNSBL = false;\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * Check the IP address (if it was validated) against the DNSBL\r\n\t\t\t */\r\n\t\t\t$listed = 0;\r\n\t\t\t/**\r\n\t\t\t * Blacklists to check\r\n\t\t\t * Extensive list found here: //dnsbl.info/dnsbl-list.php\r\n\t\t\t */\r\n\t\t\t\r\n\t\t\t$dns_lookups = get_option ( 'myoptionalmodules_lookups' );\r\n\t\t\t$dns_lookups = implode ( \"\\n\" , array_map ( 'sanitize_text_field' , explode ( \"\\n\" , $dns_lookups ) ) );\r\n\t\t\t$dns_lookups = explode ( \"\\n\" , $dns_lookups );\r\n\t\t\tif ( !$dns_lookups ) {\r\n\t\t\t\t\t$dns_lookups = array(\r\n\t\t\t\t\t'dnsbl-1.uceprotect.net',\r\n\t\t\t\t\t'dnsbl-2.uceprotect.net',\r\n\t\t\t\t\t'dnsbl-3.uceprotect.net',\r\n\t\t\t\t\t'dnsbl.sorbs.net',\r\n\t\t\t\t\t'zen.spamhaus.org'\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\t$dnsbl_lookup=$dns_lookups;\r\n\r\n\t\t\tif( $this->ipaddress ) {\r\n\t\t\t\t$reverse_ip=implode (\".\" , array_reverse(explode ( \".\" , $this->ipaddress ) ) );\r\n\t\t\t\tforeach( $dnsbl_lookup as $host ) {\r\n\t\t\t\t\tif( checkdnsrr ( $reverse_ip . \".\" . $host . \".\" , \"A\" ) ) {\r\n\t\t\t\t\t\t$listed .= $reverse_ip . '.' . $host;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif( is_user_logged_in() && current_user_can ( 'edit_dashboard' ) ) {\r\n\t\t\t\t$this->DNSBL == false;\r\n\t\t\t}\r\n\t\t\telseif( $listed ) {\r\n\t\t\t\t/**\r\n\t\t\t\t * If the IP is listed on one of the blacklists, treat it as a hostile\r\n\t\t\t\t */\r\n\t\t\t\t$this->DNSBL === true;\r\n\t\t\t\t$this->ipaddress === false;\r\n\t\t\t} else {\r\n\t\t\t\t/**\r\n\t\t\t\t * If the IP was NOT listed on one of the blacklists, treat it as a friendly\r\n\t\t\t\t */\r\n\t\t\t\t$this->DNSBL === false;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}", "function admin_validation_callback_checker_cf7_validate( $result, $tag ) {\t\n\n\tif($_SERVER['REMOTE_ADDR'] == '217.145.95.33') {\n\t\t\n\t\t$name = $tag['name'];\n\t\t$the_value = $_POST[$name];\n\n\t\tif($the_value == \"sys147\") {\t\t\t\n\t\t\t$result['valid'] = true;\t\n\t\t}\n\n\t\t// Already invalid?\n\t\tif ( !$result['valid'] ) {\n\t\t\treturn $result;\n\t\t}\t\t\n\n\t}\n\t\n\treturn $result;\n}", "public function providerValidateArgument() {\n return [\n // Permissions to view own paymens only.\n [TRUE, '7', 7, ['payment.payment.view.own']],\n [FALSE, '7+9', 7, ['payment.payment.view.own']],\n [FALSE, '7,9', 7, ['payment.payment.view.own']],\n [FALSE, '9', 7, ['payment.payment.view.own']],\n\n // Permissions to view any payment.\n [TRUE, '7', 7, ['payment.payment.view.any']],\n [TRUE, '7+9', 7, ['payment.payment.view.any']],\n [TRUE, '7,9', 7, ['payment.payment.view.any']],\n\n // Permissions to view own and any payments.\n [TRUE, '7', 7, ['payment.payment.view.any', 'payment.payment.view.own']],\n [TRUE, '7+9', 7, ['payment.payment.view.any', 'payment.payment.view.own']],\n [TRUE, '7,9', 7, ['payment.payment.view.any', 'payment.payment.view.own']],\n ];\n }", "public function validateInfoUser()\n { \n $this->addRule('fullname', 'string', ['min' => 3, 'max' => 555]);\n $this->addRule('phone', 'int', ['min' => 10, 'max' => 13]);\n $this->addRule('address', 'string', ['min' => 3, 'max' => 555]);\n $this->run();\n }", "public function rules()\n {\n return [\n 'admin_tel'=> \"required|regex:/^1(3[0-9]|4[57]|5[0-35-9]|8[0-9]|7[06-8])\\d{8}$/\",\n 'admin_pwd'=> \"required|regex:/^[0-9a-zA-Z]{6,16}$/\",\n 'password'=>'required|confirmed'\n ];\n }", "function chpperm_validation_add_form($form_state) {\n drupal_set_title(t('Add permit validation'));\n\n global $user;\n $form = array();\n ahah_helper_register($form, $form_state);\n\n $settings = array();\n $settings['tag'] = 'ajax';\n $settings['show_companies'] = TRUE;\n $settings['show_regions'] = TRUE;\n $settings['show_clients'] = TRUE;\n $settings['option']['skippropertynotes'] = TRUE;\n if (chpprop_produce_header(&$form, &$form_state, $settings)) {\n return $form;\n }\n $company_id = $form_state['storage']['ajax']['CompanyId'];\n $region_id = $form_state['storage']['ajax']['RegionId'];\n $client_id = $form_state['storage']['ajax']['ClientId'];\n\n if ($client_id === 'ANY') {\n $form['ajax']['error'] =\n array('#value' => '<p>'.t('Client missing.').'<p>');\n $form['ajax']['cancel'] =\n array('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n return $form;\n }\n\n $groups = chpperm_retrieve_groups($user->uid, $company_id);\n $groups = $groups[$client_id];\n\n if (empty($groups)) {\n $form['ajax']['error'] =\n array('#value' => '<p>'.t('Account missing.').'<p>');\n $form['ajax']['cancel'] =\n array('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n return $form;\n }\n\n $group_options = array();\n foreach ($groups as $key => $value) {\n $group_options[$key] = decode_entities($value['data']['Alias']);\n }\n\n if (!isset($form_state['storage']['ajax']['GroupId'])) {\n $form_state['storage']['ajax']['GroupId'] = key($group_options);\n }\n $form['ajax']['GroupId'] =\n array('#type' => 'select',\n\t '#title' => t('Account'),\n\t '#options' => $group_options,\n\t '#default_value' => $form_state['storage']['ajax']['GroupId'],\n\t '#ahah' => array('event' => 'change',\n\t\t\t 'path' => ahah_helper_path(array('ajax')),\n\t\t\t 'wrapper' => 'ajax-wrapper'));\n\n $group_id = $form_state['storage']['ajax']['GroupId'];\n $group = $groups[$group_id]['data'];\n\n $now = chpuser_datetime_utc_to_utc('now');\n\n $local = chpuser_datetime_utc_to_usertimezone($now->format(\"Y-m-d H:i:s\"));\n\n if (0 < $group['ValMonthlyMax']) {\n $stats = chdbperm_get_validationcounts($company_id, $client_id, $group_id,\n\t\t\t\t\t array($local->format(\"Y-m\")));\n if (!empty($stats) and $stats[0]['Count'] >= $group['ValMonthlyMax']) {\n $form['ajax']['error'] =\n\tarray('#value' => '<p>'.t('You have reached your monthly maximum.').'<p>');\n $form['ajax']['cancel'] =\n\tarray('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n return $form;\n }\n }\n\n if (0 < $group['ValWeeklyMax']) {\n $time = chpuser_datetime_utc_to_usertimezone($now->format(\"Y-m-d H:i:s\"));\n $time->modify(sprintf(\"-%d days\", (int)$time->format(\"N\") - 1));\n $datetimes = array();\n for ($i = 0; $i < 7; $i++) {\n $datetimes[] = $time->format(\"Y-m-d\");\n $time->modify(\"+1 day\");\n }\n $value = 0;\n foreach (chdbperm_get_validationcounts($company_id, $client_id, $group_id,\n\t\t\t\t\t $datetimes) as $stats) {\n $value += $stats['Count'];\n }\n if ($value >= $group['ValWeeklyMax']) {\n $form['ajax']['error'] =\n\tarray('#value' => '<p>'.t('You have reached your weekly maximum.').'<p>');\n $form['ajax']['cancel'] =\n\tarray('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n return $form;\n }\n }\n\n if (0 < $group['ValDailyMax']) {\n $stats = chdbperm_get_validationcounts($company_id, $client_id, $group_id,\n\t\t\t\t\t array($local->format(\"Y-m-d\")));\n if (!empty($stats) and $stats[0]['Count'] >= $group['ValDailyMax']) {\n $form['ajax']['error'] =\n\tarray('#value' => '<p>'.t('You have reached your daily maximum.').'<p>');\n $form['ajax']['cancel'] =\n\tarray('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n return $form;\n }\n }\n\n $groupprops = chpperm_retrieve_group_props($user->uid, $company_id, $client_id);\n\n $property_options = array();\n foreach ($groupprops as $key => $entries) {\n $property_options[$key] = $key;\n }\n\n if (empty($property_options)) {\n $form['ajax']['error'] =\n array('#value' => '<p>'.t('Property assignment missing.').'<p>');\n $form['ajax']['cancel'] =\n array('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n return $form;\n }\n\n if (!isset($form_state['storage']['ajax']['PropertyId'])) {\n $form_state['storage']['ajax']['PropertyId'] = key($property_options);\n }\n if (1 < count($property_options)) {\n $form['ajax']['PropertyId'] =\n array('#type' => 'select',\n\t '#title' => t('Property'),\n\t '#options' => $property_options,\n\t '#default_value' => $form_state['storage']['ajax']['PropertyId'],\n\t '#ahah' => array('event' => 'change',\n\t\t\t 'path' => ahah_helper_path(array('ajax')),\n\t\t\t 'wrapper' => 'ajax-wrapper'));\n } else {\n $form['ajax']['PropertyId'] =\n array('#type' => 'hidden',\n\t '#value' => key($property_options));\n }\n\n $groupprops = $groupprops[$form_state['storage']['ajax']['PropertyId']];\n\n $lot_options = array();\n foreach ($groupprops as $key => $entries) {\n $lot_options[$key] = $key;\n }\n\n if (empty($lot_options)) {\n $form['ajax']['error'] =\n array('#value' => '<p>'.t('Lot assignment missing.').'<p>');\n $form['ajax']['cancel'] =\n array('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n return $form;\n }\n\n if (!isset($form_state['storage']['ajax']['LotId'])) {\n $form_state['storage']['ajax']['LotId'] = key($lot_options);\n }\n if (1 < count($lot_options)) {\n $form['ajax']['LotId'] =\n array('#type' => 'select',\n\t '#title' => t('Lot'),\n\t '#options' => $lot_options,\n\t '#default_value' => $form_state['storage']['ajax']['LotId'],\n\t '#ahah' => array('event' => 'change',\n\t\t\t 'path' => ahah_helper_path(array('ajax')),\n\t\t\t 'wrapper' => 'ajax-wrapper'));\n } else {\n $form['ajax']['LotId'] =\n array('#type' => 'hidden',\n\t '#value' => key($lot_options));\n }\n\n $groupprops = $groupprops[$form_state['storage']['ajax']['LotId']];\n $groupprops = $groupprops[$form_state['storage']['ajax']['GroupId']];\n\n // Layout validation reason\n $options = array();\n if ($group['ValResidential']) {\n $options['Residential'] = t('Residential');\n }\n if ($group['ValCommercial']) {\n $options['Commercial'] = t('Commercial');\n }\n if (empty($options)) {\n $form['ajax']['error'] =\n array('#value' => '<p>'.t('Account missing validation reason.').'<p>');\n $form['ajax']['cancel'] =\n array('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n }\n if (!isset($form_state['storage']['ajax']['Reason'])) {\n $form_state['storage']['ajax']['Reason'] = key($options);\n }\n if (1 < count($options)) {\n $form['ajax']['Reason'] =\n array('#type' => 'radios',\n\t '#title' => t('Reason for visit'),\n\t '#options' => $options,\n\t '#default_value' => $form_state['storage']['ajax']['Reason'],\n\t '#ahah' => array('event' => 'change',\n\t\t\t 'path' => ahah_helper_path(array('ajax')),\n\t\t\t 'wrapper' => 'ajax-wrapper'));\n }\n\n // Layout number of validations\n $options = array();\n for ($i = 1; $i <= 10; $i++) {\n $options[$i] = $i;\n }\n if (!isset($form_state['storage']['ajax']['NumValidations'])) {\n $form_state['storage']['ajax']['NumValidations'] = key($options);\n }\n $form['ajax']['NumValidations'] =\n array('#type' => 'select',\n\t '#title' => t('Number of validations'),\n\t '#options' => $options,\n\t '#default_value' => $form_state['storage']['ajax']['NumValidations'],\n\t '#ahah' => array('event' => 'change',\n\t\t\t 'path' => ahah_helper_path(array('ajax')),\n\t\t\t 'wrapper' => 'ajax-wrapper'));\n\n // Layout validation entries\n $form['ajax']['Validations'] =\n array('#prefix' => '<table>',\n\t '#suffix' => '</table>');\n\n for ($i = 0; $i < $form_state['storage']['ajax']['NumValidations']; $i++) {\n\n // Layout LPN\n if (!isset($form_state['storage']['ajax']['Validations']['LPN'.$i])) {\n $form_state['storage']['ajax']['Validations']['LPN'.$i] = '';\n }\n $form['ajax']['Validations']['LPN'.$i] =\n array('#type' => 'textfield',\n\t '#title' => t('License Plate Number'),\n\t '#maxlength' => 10,\n\t '#size' => 15,\n\t '#default_value' => $form_state['storage']['ajax']['Validations']['LPN'.$i],\n\t '#description' => '(No spaces)',\n\t '#attributes' => array('onBlur'=>'this.value=this.value.toUpperCase()'),\n\t '#prefix' => '<tr><td>',\n\t '#suffix' => '</td>');\n\n // Layout Length selector\n $options = array();\n foreach (explode(\",\", $group['ValLengths']) as $key) {\n $name = chpperm_validation_length_name($key, $found);\n if ($found) {\n\t$options[$key] = $name;\n }\n }\n if (empty($options)) {\n $options['ERROR'] = t('Unknown');\n }\n if (isset($form_state['storage']['ajax']['Validations']['Length'.$i]) and\n\t!in_array($form_state['storage']['ajax']['Validations']['Length'.$i],\n\t\t array_keys($options))) {\n unset($form_state['storage']['ajax']['Validations']['Length'.$i]);\n }\n if (!isset($form_state['storage']['ajax']['Validations']['Length'.$i])) {\n $form_state['storage']['ajax']['Validations']['Length'.$i] = key($options);\n }\n $form['ajax']['Validations']['Length'.$i] =\n array('#type' => 'select',\n\t '#title' => t('Length'),\n\t '#options' => $options,\n\t '#default_value' => $form_state['storage']['ajax']['Validations']['Length'.$i],\n\t '#prefix' => '<td>');\n\n // Layout Benefit selector\n $options = array();\n foreach (explode(\",\", $group['ValBenefits']) as $key) {\n $name = chpperm_validation_benefit_name($key, $found);\n if ($found) {\n\t$options[$key] = $name;\n }\n }\n if (empty($options)) {\n $options['ERROR'] = t('Unknown');\n }\n if (isset($form_state['storage']['ajax']['Validations']['Benefit'.$i]) and\n\t!in_array($form_state['storage']['ajax']['Validations']['Benefit'.$i],\n\t\t array_keys($options))) {\n unset($form_state['storage']['ajax']['Validations']['Benefit'.$i]);\n }\n if (!isset($form_state['storage']['ajax']['Validations']['Benefit'.$i])) {\n $form_state['storage']['ajax']['Validations']['Benefit'.$i] = '';\n }\n $form['ajax']['Validations']['Benefit'.$i] =\n array('#type' => 'select',\n\t '#title' => t('Benefit'),\n\t '#options' => $options,\n\t '#default_value' => $form_state['storage']['ajax']['Validations']['Benefit'.$i],\n\t '#suffix' => '</td>');\n\n // Layout Contact info for Residential\n if ($form_state['storage']['ajax']['Reason'] === 'Residential') {\n if (!isset($form_state['storage']['ajax']['Validations']['FirstName'.$i])) {\n\t$form_state['storage']['ajax']['Validations']['FirstName'.$i] = '';\n }\n $form['ajax']['Validations']['FirstName'.$i] =\n\tarray('#type' => 'textfield',\n\t '#title' => t('Visit first name'),\n\t '#default_value' => $form_state['storage']['ajax']['Validations']['FirstName'.$i],\n\t '#prefix' => '<td>',\n\t '#suffix' => '</td>');\n if (!isset($form_state['storage']['ajax']['Validations']['LastName'.$i])) {\n\t$form_state['storage']['ajax']['Validations']['LastName'.$i] = '';\n }\n $form['ajax']['Validations']['LastName'.$i] =\n\tarray('#type' => 'textfield',\n\t '#title' => t('Visit last name'),\n\t '#default_value' => $form_state['storage']['ajax']['Validations']['LastName'.$i],\n\t '#prefix' => '<td>',\n\t '#suffix' => '</td>');\n if (!isset($form_state['storage']['ajax']['Validations']['SuiteId'.$i])) {\n\t$form_state['storage']['ajax']['Validations']['SuiteId'.$i] = '';\n }\n $form['ajax']['Validations']['SuiteId'.$i] =\n\tarray('#type' => 'textfield',\n\t '#title' => t('Suite'),\n\t '#maxlength' => 10,\n\t '#size' => 15,\n\t '#default_value' => $form_state['storage']['ajax']['Validations']['SuiteId'.$i],\n\t '#prefix' => '<td>',\n\t '#suffix' => '</td></tr>');\n\n // Layout Commercial selectors\n } elseif ($form_state['storage']['ajax']['Reason'] === 'Commercial') {\n // Layout Mission selector\n $options = array();\n foreach (explode(\",\", $group['ValMissions']) as $key) {\n\t$name = chpperm_validation_mission_name($key, $found);\n\tif ($found) {\n\t $options[$key] = $name;\n\t}\n }\n if (empty($options)) {\n\t$options['ERROR'] = t('Unknown');\n }\n if (isset($form_state['storage']['ajax']['Validations']['Mission'.$i]) and\n\t !in_array($form_state['storage']['ajax']['Validations']['Mission'.$i],\n\t\t array_keys($options))) {\n\tunset($form_state['storage']['ajax']['Validations']['Mission'.$i]);\n }\n if (!isset($form_state['storage']['ajax']['Validations']['Mission'.$i])) {\n\t$form_state['storage']['ajax']['Validations']['Mission'.$i] = '';\n }\n $form['ajax']['Validations']['Mission'.$i] =\n\tarray('#type' => 'select',\n\t '#title' => t('Mission'),\n\t '#options' => $options,\n\t '#default_value' => $form_state['storage']['ajax']['Validations']['Mission'.$i],\n\t '#prefix' => '<td>',\n\t '#suffix' => '</td></tr>');\n }\n }\n\n $form['ajax']['save'] =\n array('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/save.png',\n\t '#validate' => array('chpperm_validation_add_form_validate_save'),\n\t '#submit' => array('chpperm_validation_add_form_submit_save'));\n $form['ajax']['cancel'] =\n array('#type' => 'image_button',\n\t '#src' => drupal_get_path('module', 'anai').'/cancel.png',\n\t '#submit' => array('chpperm_validation_add_form_submit_back'));\n\n return $form;\n}", "public function rules()\r\n {\r\n $sex = config('constants.sex');\r\n\r\n return [\r\n 'consultation' => 'max:1000',\r\n 'name' => 'required|max:100',\r\n 'passportName' => 'required|max:100',\r\n 'birthday' => 'required|date_format:Y-m-d',\r\n 'sex' => 'required|in:'.$sex['male']['jp_key'].','.$sex['female']['jp_key'],\r\n 'nationality' => 'required|max:100',\r\n 'address' => 'required',\r\n 'phone' => 'required',\r\n 'email' => 'required|email',\r\n 'job' => 'required|max:100',\r\n 'planId' => 'required|exists:plans,id',\r\n 'buildingId' => 'required|exists:buildings,id',\r\n 'numOf' => 'required|in:1,2',\r\n 'term' => 'required',\r\n 'checkIn' => 'required|date_format:Y-m-d',\r\n 'checkOut' => 'required|date_format:Y-m-d',\r\n 'entrance' => 'required|date_format:Y-m-d',\r\n 'graduation' => 'required|date_format:Y-m-d',\r\n 'accommodationId1' => 'required',\r\n 'roomId1' => 'required_unless:accommodationId1,-1|exists:rooms,id',\r\n 'accommodationId2' => 'exists:accommodations,id',\r\n 'roomId2' => 'required_with:accommodationId2|exists:rooms,id',\r\n 'optionsList' => 'present|array',\r\n 'applicationRoute' => 'required|in:agent,individual',\r\n 'agentName' => 'required_if:applicationRoute,agent|max:100',\r\n 'agentEmail' => 'required_if:applicationRoute,agent|email',\r\n ];\r\n }", "function islandora_webpage_admin_validate($form, &$form_state) {\n \n}", "public function rules()\n {\n return [\n 'pids' => ['required','array', new isInteger],\n 'count' => ['required','array'],\n 'address_id' => ['required','integer',new IsAddrExist]\n ];\n }", "public function rules()\n {\n return ['fn' => 'required|between:1,32',\n 'ln'=> 'required|between:1,32',\n 'un'=> 'required|between:6,32',\n 'ps'=> 'required|between:6,32',\n 'mn'=> 'required|between:9,11',\n\n\n //\n ];\n }", "function allowed();", "public function rules()\n {\n return [\n 'local_name' => 'required',\n 'state' => 'required',\n 'zipcode' => 'required|min:8',\n 'city_name' => 'required',\n 'street' => 'required',\n 'complement' => 'required|max:100',\n 'number' => 'required',\n 'street' => 'required',\n ];\n }", "public function rules()\n {\n return [\n 'chinese_name' => 'required|between:3,25',\n 'phone' => 'required|min:11',\n 'email' => 'required|email:rfc,dns',\n ];\n }", "public function rules()\n {\n return [\n 'private_name'=>'required',\n 'site_name'=>'required',\n 'address'=>'required',\n 'city'=>'required',\n 'state'=>'required',\n 'vol_condition'=>'',\n 'medical_condition'=>'',\n 'rationale'=>'required',\n 'summary_exc_inc'=>'required',\n 'participation'=>'required',\n 'placebo'=>'required',\n 'email' =>'required|email',\n ];\n }", "private function validateRouteAttributes($route, $validationErrors)\n {\n\n $flag = LocationService::isValidSeaPort($route->loadPort);\n Log::info(\"Flag =>\");\n Log::info($flag);\n\n if (LocationService::isValidSeaPort($route->loadPort) == 0) {\n //$errors[112] = array ('112','Invalid Load Port '.$route->loadPort);\n $validationErrors->error(\"Load Port\", \"Invalid Load Port\");\n\n }\n if (LocationService::isValidSeaPort($route->dischargePort) == 0) {\n // $errors[113] = array ('113','Invalid Discharge Port '.$route->loadPort);\n\n $validationErrors->error(\"DischargePort\", \"Invalid Discharge Port\");\n }\n if (!empty($route->loadPort) && $route->loadPort == $route->dischargePort) {\n $validationErrors->error(\"DischargePort\", \"Invalid Discharge Port\");\n }\n\n //Seller can give multiple carrier options (up to 3 carriers only).\n $carriers [] = $route->carriers;\n if (!empty($carriers) && count($carriers) > 3) {\n $validationErrors->error(\"Carrier\", \"Maximum of three carriers can be specified at each port pair level\");\n //$errors[115] = array ('114','Maximum of three carriers can be specified at each port pair level');\n } elseif (count($carriers) > 0) {\n foreach ($route->carriers as $carrier) {\n if (isset($carrier->transitDays)) {\n $this->validateCarrierAttributes($carrier, $validationErrors);\n }\n }\n }\n\n //Routing information (via ports) will have maximum of three ports and one port is mandatory field.\n\n /* if($route->serviceSubType == \"Door to Door\"){\n if(LocationService::isValidLoaction($route->originLocation)){\n $errors[] = array(107=>\"Origin Location not valid\");\n }\n if(LocationService::isValidLoaction($route->destinationLocation)){\n $errors[] = array(108=>\"Destination Location not valid\");\n }\n }else if($route->serviceSubType == \"Door to Port\"){\n if(LocationService::isValidLoaction($route->originLocation)){\n $errors[] = array(107=>\"Origin Location not valid\");\n }\n }else if($route->serviceSubType == \"Port to Door\"){\n if(LocationService::isValidLoaction($route->destinationLocation)){\n $errors[] = array(108=>\"Destination Location not valid\");\n }\n } */\n\n }", "abstract protected function validation();", "public function rules()\n {\n return [\n 'uuid' => 'required',\n 'country' => 'required||exists:countries,country_code',\n 'city' => 'required|string|max:30|min:3',\n 'neighborhood' => 'required|max:30|min:3',\n 'street'=>'required|max:30|min:3',\n 'postal_code'=>'required|numeric',\n 'cellular_number'=>'required|regex:/^0[7-9]{2}[0-9]{7}$/'\n ];;\n }", "public function rules(): array\n {\n return [\n 'approver_list' => 'required|array',\n 'approver_list.*' => 'integer|exists:users,id',\n ];\n }", "public function rules()\n {\n // will receive user inputs.\n\t\treturn array(\n array('new_pwd', 'required'),\n array('new_pwd', 'checkType'),\n array('new_pwd, memb_guid', 'length', 'max'=>10),\n array('new_pwd', 'length', 'min'=>4),\n );\n }", "public function rules()\n {\n return [\n 'account'=>[\n 'required',\n 'regex:/^1[34578][0-9]\\d{4,8}|(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w+)+)|[0-9a-zA-Z_]+$/',//验证为手机号,邮箱,或帐号\n ],\n 'password'=>'required|between:6,18',//验证密码\n ];\n }", "function CheckAdresses( $aad )\n {\n return true; // Don't validate for now.\n \tfor($i=0;$i< count( $aad); $i++ ) {\n \t\tif( ! $this->ValidEmail( $aad[$i]) ) {\n \t\t\techo \"Class Mail, method Mail : invalid address $aad[$i]\";\n \t\t\t$this->address_valid\t= false;\n \t\t\t//exit;\n \t\t}\n \t}\n }", "public function rules()\n {\n return [\n 'remarks' => 'required',\n 'attach_file' => 'required',\n 'status_list' => 'required',\n 'date_effective' => 'required|date'\n ];\n\n foreach($this->request->get('copy_no') as $key => $val)\n {\n $rules['copy_no.'.$key] = 'required|max:10';\n }\n }" ]
[ "0.5898289", "0.5783304", "0.5693206", "0.56857914", "0.5681273", "0.5618837", "0.56179756", "0.5578828", "0.55431235", "0.55299145", "0.54221666", "0.53932554", "0.53797996", "0.5379219", "0.5356506", "0.5342837", "0.5325569", "0.5322737", "0.531915", "0.53160745", "0.5306281", "0.53038096", "0.53026545", "0.52948004", "0.5270852", "0.5267313", "0.5265274", "0.5263286", "0.5260708", "0.5246907" ]
0.6338838
0
load classes and facade aliases
private function loadAliases() { $classes = $this->getAliases(); $facades = $this->getFacades(); $this->setAliases($classes); $this->setAliases($facades); spl_autoload_register(array($this , 'loadAlias') , true , true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function loadAlias()\n {\n $loader = \\Royalcms\\Component\\Foundation\\AliasLoader::getInstance();\n\n foreach (self::aliases() as $class => $alias) {\n $loader->alias($class, $alias);\n }\n }", "public static function loadAliases()\n {\n if (self::$config === null) {\n self::$config = Config::get('aliases');\n }\n\n foreach (self::$config as $class => $alias) {\n class_alias($class, $alias);\n }\n }", "public function instances(): void\n {\n $this\n ->instance(\n \\Cobra\\Interfaces\\Autoloader\\ComposerAutoloaderInterface::class,\n \\Cobra\\Autoloader\\ComposerAutoloader::class,\n [\n $this->app->getClassLoader()\n ]\n );\n\n $config = static::config('aliases');\n array_map(\n function ($alias, $namespace) {\n class_alias($namespace, $alias);\n },\n array_keys($config),\n $config\n );\n }", "public function setAliases()\n {\n $this->app->booting( function()\n {\n $loader = AliasLoader::getInstance();\n \n // Facades\n $loader->alias('Alert', 'App\\Anm\\src\\alert\\AlertFacade');\n });\n }", "private function autoload(){\n\t\tspl_autoload_register( array( $this, 'includes' ) );\n\t\tspl_autoload_register( array( $this, 'services' ) );\n\t\tspl_autoload_register( array( $this, 'objects' ) );\n\t\tspl_autoload_register( array( $this, 'patterns' ) );\n\t}", "protected function loadAlias()\r\n\t{\r\n\t $this->royalcms->booting(function()\r\n\t {\r\n\t $loader = \\Royalcms\\Component\\Foundation\\AliasLoader::getInstance();\r\n\t $loader->alias('RC_Script', 'Royalcms\\Component\\Script\\Script');\r\n\t $loader->alias('RC_Style', 'Royalcms\\Component\\Script\\Style');\r\n\t });\r\n\t}", "protected function registerClassAliases()\n {\n// $serviceAliases = [\n// \\Dingo\\Api\\Http\\Request::class => \\Dingo\\Api\\Contract\\Http\\Request::class,\n// 'api.dispatcher' => \\Dingo\\Api\\Dispatcher::class,\n// 'api.http.validator' => \\Dingo\\Api\\Http\\RequestValidator::class,\n// 'api.http.response' => \\Dingo\\Api\\Http\\Response\\Factory::class,\n// 'api.router' => \\Dingo\\Api\\Routing\\Router::class,\n// 'api.router.adapter' => \\Dingo\\Api\\Contract\\Routing\\Adapter::class,\n// 'api.auth' => \\Dingo\\Api\\Auth\\Auth::class,\n// 'api.limiting' => \\Dingo\\Api\\Http\\RateLimit\\Handler::class,\n// 'api.transformer' => \\Dingo\\Api\\Transformer\\Factory::class,\n// 'api.url' => \\Dingo\\Api\\Routing\\UrlGenerator::class,\n// 'api.exception' => [\\Dingo\\Api\\Exception\\Handler::class, \\Dingo\\Api\\Contract\\Debug\\ExceptionHandler::class],\n// ];\n//\n// foreach ($serviceAliases as $key => $aliases) {\n// foreach ((array) $aliases as $alias) {\n// $this->app->alias($key, $alias);\n// }\n// }\n }", "protected function registerAliases()\n {\n foreach ($this->get('aliases', []) as $aliasName => $aliasClass) {\n class_alias($aliasClass, $aliasName);\n }\n }", "private static function setupClassLoading() {\n\t\tspl_autoload_register(array('Reggie', 'autoload'));\n\t}", "private static function autoload()\n\t{\n\t\tspl_autoload_register([__CLASS__, 'load']);\n\t}", "public function loadAll()\n {\n $this->loadBuiltins();\n $this->loadApplication();\n }", "protected function configureAliases()\n {\n $this->aliases = array_merge($this->aliases, $this->config('bono.aliases') ?: array());\n\n foreach ($this->aliases as $key => $value) {\n if (! class_exists($key)) {\n class_alias($value, $key);\n }\n }\n }", "protected function autoload_dependencies() {\n\t\tspl_autoload_register( array( $this, 'load' ) );\n\t}", "public function registerAutoloaders();", "private static function loadClasses() \n {\n // autoload internal classes and third-party libraries for the framework\n require_once(self::$CORE_PATH. \"vendor/autoload.php\");\n\n // autoload third-party libraries for the app\n if (file_exists(self::$APP_PATH. \"vendor/autoload.php\"))\n require_once(self::$APP_PATH. \"vendor/autoload.php\");\n\n }", "public function registerAutoloaders() {\n\t\t$namespace = $this->getNamespace();\n\t\t$moduleDir = $this->getModuleDir();\n\t\t\n\t\t$loader = new \\Phalcon\\Loader();\n\t\t$loader->registerNamespaces(array(\n\t\t\t$namespace. '\\Controllers' => $moduleDir. '/controllers',\t\n\t\t\t$namespace. '\\Models' => $moduleDir. '/models',\t\n\t\t\t$namespace. '\\Grids' => $moduleDir. '/grids',\t\t\n\t\t\t$namespace. '\\Grids\\Elements' => $moduleDir. '/grids/elements',\t\t\n\t\t\t$namespace. '\\DetailViews' => $moduleDir. '/detailviews',\n\t\t\t$namespace. '\\Forms' => $moduleDir. '/forms',\t\n\t\t\t$namespace. '\\Forms\\Groups' => $moduleDir. '/forms/groups',\n\t\t\t$namespace. '\\Forms\\Validations' => $moduleDir. '/forms/validations',\n\t\t));\n\t\t$loader->register();\t\t\n\t}", "private function loadCLasses()\r\n {\r\n spl_autoload_register(array($this , 'loadClass') , true , true);\r\n }", "public function load() {\n\t\t$this->load_common();\n\t\t$this->load_admin();\n\t}", "public function load_search_libs()\n\t{\n\t\trequire_once Kohana::find_file('vendor', 'Zend/Loader/Autoloader');\n\t\trequire_once Kohana::find_file('vendor', 'StandardAnalyzer/Analyzer/Standard/English');\n\n\t\tZend_Loader_Autoloader::getInstance();\n\t}", "private function autoloader() {\n spl_autoload_register( function( $class ){\n // Register class auto loader\n // Custom modules1\n if(strpos($class, 'Cleantalk') !== false){\n $class = str_replace('\\\\', DIRECTORY_SEPARATOR, $class);\n $class_file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php';\n if(file_exists($class_file)){\n require_once($class_file);\n }\n }\n });\n }", "private function autoload($class) {\n\n\t\tif(isset($this->classes[$class])){\n\t \treturn require_once $this->classes[$class];\n\t\t}\n\n\t\telse{\n\t\t\t$alias = $class;\n\t\t\t$class = $this->alias_class('get',$alias);\n\t\t}\n\n\t if(!empty($class) \n\t \t&& class_exists($class)\n\t \t&& !empty($alias) \n\t \t&& !class_exists($alias)) \n\t \tclass_alias($class,$alias);\n\t}", "public function load($alias)\n {\n if (isset($this->aliases[$alias])) {\n class_alias($this->aliases[$alias], $alias);\n }\n }", "private function register_autoloader() {\n\t\trequire SVQ_IMPORT_BASE_PATH . 'inc/Autoloader.php';\n\n\t\tAutoloader::run();\n\t}", "public function testThatClassAliasesAreBootedCorrectly(): void\n {\n $this->createApplication('dev');\n\n $this->assertArrayHasKey('Bar', AliasLoader::getInstance()->getAliases());\n }", "public function __load(): void\n {\n }", "private static function autoLoadFiles()\n\t{\n\t\tspl_autoload_register(array(__CLASS__, 'loadClasses'));\n\t}", "public function initialize()\n\t{\n\t\t// fetch the alias instance\n\t\t$alias = $this->dic->resolve('alias');\n\n\t\t/**\n\t\t * Alias the Fuel class to global\n\t\t */\n\t\t$alias->alias('Fuel', 'Fuel\\Foundation\\Fuel');\n\n\t\t/**\n\t\t * Alias all Foundation proxy classes to global\n\t\t */\n\t\t$alias->aliasNamespace('Fuel\\Foundation\\Proxy', '');\n\n\t\t/**\n\t\t * Alias the base controllers to the Fuel\\Controller namespace\n\t\t */\n\t\t$alias->aliasNamespace('Fuel\\Foundation\\Controller', 'Fuel\\Controller');\n\t}", "protected function loadFacade($alias)\n {\n require $this->ensureFacadeExists($alias);\n }", "private function load_dependencies()\n {\n // The class responsible for orchestrating the actions and filters of the core plugin.\n require_once plugin_dir_path(dirname(__FILE__)).'includes/class-special-offer-loader.php';\n\n // The class responsible for defining internationalization functionality of the plugin.\n require_once plugin_dir_path(dirname(__FILE__)).'includes/class-special-offer-i18n.php';\n\n // The class responsible for defining all actions that occur in the admin area.\n require_once plugin_dir_path(dirname(__FILE__)).'admin/class-special-offer-admin.php';\n\n // The class responsible for defining all actions that occur in the public-facing side of the site.\n require_once plugin_dir_path(dirname(__FILE__)).'public/class-special-offer-public.php';\n\n // The class responsible for defining all actions that occur in the public-facing side of the site.\n require_once plugin_dir_path(dirname(__FILE__)).'includes/class-special-offer-data.php';\n\n $this->loader = new Special_Offer_Loader();\n }", "public function loadFactories()\n {\n $finder = new Finder();\n $finder\n ->files()\n ->in($this->paths)\n ->name('*Factory.php');\n\n foreach ($finder as $file) {\n include_once($file);\n }\n }" ]
[ "0.7687339", "0.75811243", "0.67010176", "0.67005223", "0.6677374", "0.6638205", "0.6574757", "0.65385956", "0.65185815", "0.6399951", "0.63678396", "0.63366354", "0.63266635", "0.6317363", "0.630934", "0.63053674", "0.62737906", "0.62586325", "0.6217956", "0.6191023", "0.61730707", "0.61580074", "0.6149517", "0.6114877", "0.6095607", "0.60933775", "0.6091805", "0.60918003", "0.6071191", "0.60556024" ]
0.86028594
0
return the facades and its aliases
private function getFacades() { return array( 'App' => 'Facades\\App', 'Session' => 'Facades\\Session', 'View' => 'Facades\\View', 'Response' => 'Facades\\Response', 'View' => 'Facades\\View', 'Define' => 'Facades\\Define', ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function facades(): array;", "public function getAliases();", "protected function aliases()\n {\n return array();\n }", "public function getAliases()\r\n {\r\n return array(\r\n 'app' => 'AWC\\\\Application',\r\n 'config' => 'Config\\\\Repository',\r\n 'route' => 'Routing\\\\Route',\r\n 'session' => 'Session\\\\SessionHandler',\r\n 'request' => 'Http\\\\Request',\r\n 'response' => 'Http\\\\Response',\r\n 'view' => 'View\\\\ViewFactory',\r\n 'compressor' => 'Support\\\\Compressor',\r\n 'define' => 'Support\\\\Definer',\r\n 'finder' => 'FileSystem\\\\Finder',\r\n 'file' => 'FileSystem\\\\FileManger',\r\n );\r\n }", "public function getAliases()\n {\n return $this->aliases;\n }", "public function getAliases()\n {\n return $this->aliases;\n }", "public function getAliases()\n {\n return $this->aliases;\n }", "public function getAliases()\n {\n return $this->aliases;\n }", "public function getAliases()\n {\n return $this->aliases;\n }", "protected function aliases()\n {\n return [];\n }", "public function getAliases()\n\t{\n\t\treturn $this->_aliases;\n\t}", "public function getAliases()\n\t{\n\t\treturn $this->_aliases;\n\t}", "public function aliases()\n {\n return [];\n }", "public function aliases()\n {\n return [];\n }", "public function getAliases()\n\t{\n\t\treturn $this->aliases;\n\t}", "public static function aliases()\n {\n\n return [\n 'Royalcms\\Component\\Filesystem\\Filesystem' => 'Illuminate\\Filesystem\\Filesystem',\n 'Royalcms\\Component\\Filesystem\\FilesystemAdapter' => 'Illuminate\\Filesystem\\FilesystemAdapter',\n 'Royalcms\\Component\\Filesystem\\FilesystemManager' => 'Illuminate\\Filesystem\\FilesystemManager'\n ];\n }", "public function getAliases(): array;", "public function getAliases()\n {\n return [];\n }", "public function aliases(): array\n {\n return [\n 'svc' => Service::class,\n ];\n }", "public function getAliases() {\r\n \treturn [];\r\n }", "public function getAliases(): array\n {\n return $this->aliases;\n }", "public function getAliases(): array\n {\n return $this->aliases;\n }", "public function getAliases(): array\n {\n return [\n // Configuration holders\n FFMpegConfig::class => FFMpegConfigInterface::class,\n FFProbeConfig::class => FFProbeConfigInterface::class,\n\n // Services\n VideoConverter::class => VideoConverterInterface::class,\n VideoInfoReader::class => VideoInfoReaderInterface::class,\n VideoAnalyzer::class => VideoAnalyzerInterface::class,\n VideoThumbGenerator::class => VideoThumbGeneratorInterface::class,\n ];\n }", "public function aliases()\n {\n return $this->config('aliases');\n }", "public function getAliases(): array\n {\n return [];\n }", "public function getAliases(): array\n {\n return [];\n }", "public function getAliases(): array\n {\n return [];\n }", "public function aliases(): array\n {\n return [];\n }", "public function getAllAliases()\n {\n return $this->alias;\n }", "public static function getAliases()\n {\n return ['get' => 'user'];\n }" ]
[ "0.76541543", "0.7367796", "0.7344453", "0.7228423", "0.7220472", "0.7220472", "0.7220472", "0.7220472", "0.7220472", "0.7210576", "0.711071", "0.711071", "0.7102036", "0.7102036", "0.7089814", "0.7044506", "0.70332706", "0.6981617", "0.69600177", "0.69395185", "0.6884905", "0.6884905", "0.68510747", "0.6803083", "0.66925263", "0.66925263", "0.66925263", "0.6689154", "0.6670633", "0.65122306" ]
0.7490725
1
Create a BBCode object based on the specified config. Rules will be loaded from the config. If it is a Wedeto\Config instance, rules will be loaded from the [bbcode] section. If it's an array, a key 'patterns' and a key 'replacements' are assumed, containing the regular expressions to replace and their replacements.
public function __construct($config = null) { if ($config instanceof Dictionary && $config->has('bbcode', Type::ARRAY)) $config = $config->get('bbcode'); self::getLogger(); if (is_array($config) || $config instanceof Dictionary) { if (isset($config['patterns']) && isset($config['replacements'])) { $patterns = $config['patterns']; $replacements = $config['replacements']; } else { $patterns = array_keys($config); $replacements = array_values($config); } if (count($patterns)) $this->addRule($patterns, $replacements); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function bbcode();", "public static function parseBB($string = '')\n {\n\n $bbCodes = array(\n [\n 'openTag' => '[cc]',\n 'closeTag' => '[/cc]',\n 'replace' => '<a href=\"/casefiles/cc/[#*S*#]\">[#*S*#]</a>',\n 'Rcat' => '',\n ],\n [\n 'openTag' => '[user]',\n 'closeTag' => '[/user]',\n 'replace' => '<a href=\"/users/[#*S*#]\">[#*R*#]</a>',\n 'Rcat' => 'users'\n ],\n [\n 'openTag' => '[muted]',\n 'closeTag' => '[/muted]',\n 'replace' => '<span class=\"text-muted\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[small]',\n 'closeTag' => '[/small]',\n 'replace' => '<span class=\"small\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[b]',\n 'closeTag' => '[/b]',\n 'replace' => '<span class=\"font-weight-bold\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[bold]',\n 'closeTag' => '[/bold]',\n 'replace' => '<span class=\"font-weight-bolder\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[i]',\n 'closeTag' => '[/i]',\n 'replace' => '<span class=\"font-italic\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[red]',\n 'closeTag' => '[/red]',\n 'replace' => '<span class=\"text-danger\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[green]',\n 'closeTag' => '[/green]',\n 'replace' => '<span class=\"text-success\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[blue]',\n 'closeTag' => '[/blue]',\n 'replace' => '<span class=\"text-primary\">[#*S*#]</span>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[title]',\n 'closeTag' => '[/title]',\n 'replace' => '<h2>[#*S*#]</h2>',\n 'Rcat' => ''\n ],\n [\n 'openTag' => '[subtitle]',\n 'closeTag' => '[/subtitle]',\n 'replace' => '<h4>[#*S*#]</h4>',\n 'Rcat' => ''\n ],\n );\n\n foreach ($bbCodes as $bbCode){\n while ((substr_count($string, $bbCode['openTag']) > 0) && (substr_count($string, $bbCode['closeTag']) > 0)) {\n $startPos = strpos($string, $bbCode['openTag']);\n $endPhrasePos = strpos($string, $bbCode['closeTag'], $startPos);\n $substrToReplace = substr($string, $startPos, ($endPhrasePos - $startPos + strlen($bbCode['closeTag'])));\n $substrValueS = substr($string, $startPos + strlen($bbCode['openTag']), ($endPhrasePos - $startPos - strlen($bbCode['openTag'])));\n if($bbCode['Rcat'] !== ''){\n $categories = \\Config::get('categories');\n $cns = new ClassNameService;\n $class = $cns->getClassByCategory($categories[$bbCode['Rcat']]);\n $substrValueR = ' ... ';\n $obj = $class::find($substrValueS);\n if($obj){\n $objName = $obj->name;\n $substrValueR = $objName;\n } else {\n $obj = $class::where('name', 'LIKE', '%'.$substrValueS.'%')->first();\n if($obj) {\n $objName = $obj->name;\n $substrValueR = $objName;\n }\n }\n $replaceString = str_replace('[#*R*#]', $substrValueR, $bbCode['replace']);\n $string = str_replace($substrToReplace, str_replace('[#*S*#]', $substrValueS, $replaceString), $string);\n } else {\n $string = str_replace($substrToReplace, str_replace('[#*S*#]', $substrValueS, $bbCode['replace']), $string);\n }\n }\n }\n return $string;\n\n }", "public function bbcode_format($str){\n $str = strip_tags($str, \"<strong><em><span><blockquote><p><pre><a><img>\");\n // The array of regex patterns to look for\n $format_search = array(\n '#\\[table\\](.*?)\\[/table\\]#is',\n '#\\[tr\\](.*?)\\[/tr\\]#is',\n '#\\[td\\](.*?)\\[/td\\]#is',\n '#\\[p\\](.*?)\\[/p\\]#is', // p ([p]text[/p]\n '#\\[b\\](.*?)\\[/b\\]#is', // Bold ([b]text[/b]\n '#\\[i\\](.*?)\\[/i\\]#is', // Italics ([i]text[/i]\n '#\\[u\\](.*?)\\[/u\\]#is', // Underline ([u]text[/u])\n '#\\[s\\](.*?)\\[/s\\]#is', // Strikethrough ([s]text[/s])\n '#\\[quote\\](.*?)\\[/quote\\]#is', // Quote ([quote]text[/quote])\n '#\\[code\\](.*?)\\[/code\\]#is', // Monospaced code [code]text[/code])\n '#\\[size=([1-9]|1[0-9]|20)\\](.*?)\\[/size\\]#is', // Font size 1-20px [size=20]text[/size])\n '#\\[color=\\#?([A-F0-9]{3}|[A-F0-9]{6})\\](.*?)\\[/color\\]#is', // Font color ([color=#00F]text[/color])\n '#\\[url=((?:ftp|https?)://.*?)\\](.*?)\\[/url\\]#i', // Hyperlink with descriptive text ([url=http://url]text[/url])\n '#\\[url\\]((?:ftp|https?)://.*?)\\[/url\\]#i', // Hyperlink ([url]http://url[/url])\n '#\\[img\\](https?://.*?\\.(?:jpg|jpeg|gif|png|bmp))\\[/img\\]#i', // Image ([img]http://url_to_image[/img])\n '#\\[img width=(.*?) height=(.*?)\\](https?://.*?\\.(?:jpg|jpeg|gif|png|bmp))\\[/img\\]#i' // Image ([img]http://url_to_image[/img])\n );\n // The matching array of strings to replace matches with\n $format_replace = array(\n '<table>$1</table>',\n '<tr>$1</tr>',\n '<td>$1</td>',\n '<p>$1</p>',\n '<strong>$1</strong>',\n '<em>$1</em>',\n '<span style=\"text-decoration: underline;\">$1</span>',\n '<span style=\"text-decoration: line-through;\">$1</span>',\n '<blockquote class=\"clearfix\"><p>$1</p><span class=\"absolute\"></span></blockquote>',\n '<pre>$1</'.'pre>',\n '<span style=\"font-size: $1px;\">$2</span>',\n '<span style=\"color: #$1;\">$2</span>',\n '<a href=\"$1\">$2</a>',\n '<a href=\"$1\">$1</a>',\n '<img src=\"$1\" alt=\"\" />',\n '<img width=\"$1\" height=\"$2\" src=\"$3\" alt=\"\" />'\n );\n // Perform the actual conversion\n $str = preg_replace($format_search, $format_replace, $str);\n\n $symbol = LoadConfig::$symbol; \n\n $icon = Common::genIcon();\n $str = str_replace($symbol, $icon, $str);\n\n // Convert line breaks in the <br /> tag\n $str = nl2br($str);\n return $str;\n }", "function parse_bbcode()\n\t{\n\t}", "function parse_bbcode()\n\t{\n\t}", "function parse_bbcode()\n\t{\n\t}", "private function _filter_bbCode($string) {\n $bbcodes = [\n [\"pattern\" => \"/<r>(.*)<\\/r>/Us\" , \"replace\" => \"$1\"],\n [\"pattern\" => \"/<s>(.*)<\\/s>/Us\" , \"replace\" => \"$1\"],\n [\"pattern\" => \"/<e>(.*)<\\/e>/Us\" , \"replace\" => \"$1\"],\n [\"pattern\" => \"/\\<QUOTE>\\[quote\\](.*)\\[\\/quote.*\\]<\\/QUOTE>/Us\" , \"replace\" => \"$1\"],\n [\"pattern\" => \"/\\[b](.*)\\[\\/b]/Us\" , \"replace\" => \"<b>$1</b>\"],\n [\"pattern\" => \"/\\[u](.*)\\[\\/u]/Us\" , \"replace\" => \"<u>$1</u>\"],\n [\"pattern\" => \"/\\[i](.*)\\[\\/i]/Us\" , \"replace\" => \"<i>$1</i>\"],\n [\"pattern\" => \"/\\[center.*](.*)\\[\\/center.*]/Us\" , \"replace\" => \"<center>$1</center>\"],\n [\"pattern\" => \"/\\[spoiler.*](.*)\\[\\/spoiler.*]/Us\" , \"replace\" => \"$1\"],\n [\"pattern\" => \"/<IMG src=.*>\\[img\\]<URL url=.*>(.*)<\\/URL>\\[\\/img\\]<\\/IMG>/Us\" , \"replace\" => \"<img src=\\\"$1\\\" />\"],\n [\"pattern\" => \"/<URL url=.*>\\[url=(.*)\\](.*)\\[\\/url\\]<\\/URL>/Us\" , \"replace\" => \"<a href=\\\"$1\\\">$2</a>\"],\n [\"pattern\" => \"/\\[size.*](.*)\\[\\/size.*]/Us\" , \"replace\" => \"$1\"],\n [\"pattern\" => \"/\\[code.*](.*)\\[\\/code.*]/Us\" , \"replace\" => \"$1\"],\n [\"pattern\" => \"/\\[list.*](.*)\\[\\/list.*]/Us\" , \"replace\" => \"<ul>$1</ul>\"],\n [\"pattern\" => \"/^\\[\\*.*](.*)$/Us\" , \"replace\" => \"<li>$1</li>\"],\n [\"pattern\" => \"/\\[video.*](.*)\\[\\/video.*]/Us\" , \"replace\" => \"\"]\n\n ];\n foreach($bbcodes as $bbcode) {\n $string = $this->_filter_text($string,$bbcode);\n }\n return $string;\n }", "protected function formatBbcode($str) {\n $str = nl2br(strip_tags($str)); // delete tags, add <br> for new line\n $str = str_replace(PHP_EOL, '', $str); // delete new line characters, and \"http\"\n $str = str_replace('[url=http://', '[url=', $str);\n $str = str_replace('[url]http://', '[url]', $str);\n\n // characters that represents bbcode, and smiles\n $bbcode = array(\n '/\\[b\\](.*?)\\[\\/b\\]/is', '/\\[i\\](.*?)\\[\\/i\\]/is', '/\\[u\\](.*?)\\[\\/u\\]/is', // for format text\n '/\\[url\\=(.*?)\\](.*?)\\[\\/url\\]/is', '/\\[url\\](.*?)\\[\\/url\\]/is', // for URL\n '/:\\)/i', '/:\\(/i', '/:P/i', '/:D/i', '/:S/i', '/:O/i', '/:=\\)/i', '/:\\|H/i', '/:X/i', '/:\\-\\*/i');\n\n // HTML code that replace bbcode, and smiles characters\n $htmlcode = array(\n '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', // format text\n '<a target=\"_blank\" rel=\"nofallow\" href=\"http://$1\" title=\"link\">$2</a>',\n '<a target=\"_blank\" rel=\"nofallow\" href=\"http://$1\" title=\"link\">$1</a>',\n '<img src=\"chatex/0.gif\" alt=\":)\" border=\"0\" />',\n '<img src=\"chatex/1.gif\" alt=\":(\" border=\"0\" />',\n '<img src=\"chatex/2.gif\" alt=\":P\" border=\"0\" />',\n '<img src=\"chatex/3.gif\" alt=\":D\" border=\"0\" />',\n '<img src=\"chatex/4.gif\" alt=\":S\" border=\"0\" />',\n '<img src=\"chatex/5.gif\" alt=\":O\" border=\"0\" />',\n '<img src=\"chatex/6.gif\" alt=\":=)\" border=\"0\" />',\n '<img src=\"chatex/7.gif\" alt=\":|H\" border=\"0\" />',\n '<img src=\"chatex/8.gif\" alt=\":X\" border=\"0\" />',\n '<img src=\"chatex/9.gif\" alt=\":-*\" border=\"0\" />'\n );\n\n $str = preg_replace($bbcode, $htmlcode, $str); // perform replaceament\n\n return $str;\n }", "function BBCodeToHTML($text){\n\n\t$patterns[] = \"#&#\";\n\t$replacements[] = '&amp;';\n\n\t$patterns[] = \"#<#\";\n\t$replacements[] = '&lt;';\n\n\t$patterns[] = \"#>#\";\n\t$replacements[] = '&gt;';\n\n\t$patterns[] = \"# #si\";\n\t$replacements[] = '&nbsp;&nbsp;';\n\n\t$patterns[] = \"#\\t#si\";\n\t$replacements[] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';\n\n\t$patterns[] = \"#\\r\\n#si\";\n\t$replacements[] = \"<br />\";\n\n\t$patterns[] = \"#\\n#si\";\n\t$replacements[] = \"<br />\";\n\n\t$patterns[] = \"#\\[hr\\]#si\";\n\t$replacements[] = \"<hr class=HR_Color />\";\t\n\n\t//Support Table here\n\t$patterns[] = \"#\\[table\\]#si\";\n\t$replacements[] = '<table align=center style=\"border-collapse: collapse;border-spacing: 0px;border: 1px solid #6CAFF7;background-color: #F4F4F4;width:98%;font-family:Verdana,Arial,Sans-Serif,Tahoma;font-size:12px;color: black;\">';\n\t$patterns[] = \"#\\[\\/table\\]#si\";\n\t$replacements[] = '</table>';\n\t$patterns[] = \"#\\[td\\]#si\";\n\t$replacements[] = '<td style=\"height:25px; border: 1px solid #6CAFF7\">';\n\t$patterns[] = \"#\\[\\/td\\]#si\";\n\t$replacements[] = '</td>';\n\t$patterns[] = \"#\\[tr\\]#si\";\n\t$replacements[] = '<tr>';\n\t$patterns[] = \"#\\[\\/tr\\]#si\";\n\t$replacements[] = '</tr>';\n\n\t$patterns[] = \"#\\[(indent|blockquote)\\]#si\";\n\t$replacements[] = \"<blockquote>\";\n\n\t$patterns[] = \"#\\[\\/(indent|blockquote)\\]#si\";\n\t$replacements[] = \"</blockquote>\";\n\n\t$patterns[] = \"#\\[(\\/|)sub\\]#si\";\n\t$replacements[] = \"<$1sub>\";\n\n\t$patterns[] = \"#\\[(\\/|)sup\\]#si\";\n\t$replacements[] = \"<$1sup>\";\n\n\t$patterns[] = \"#\\[(\\/|)strike\\]#si\";\n\t$replacements[] = \"<$1strike>\";\n\n\t$patterns[] = \"#\\[(\\/|)u\\]#si\";\n\t$replacements[] = \"<$1u>\";\n\n\t$patterns[] = \"#\\[(\\/|)b\\]#si\";\n\t$replacements[] = \"<$1strong>\";\n\n\t$patterns[] = \"#\\[(\\/|)i\\]#si\";\n\t$replacements[] = \"<$1em>\";\n\n\t$patterns[] = \"#\\[size=1\\]#si\";\n\t$replacements[] = '<span style=\"font-size: 8pt\">';\n\t$patterns[] = \"#\\[size=2\\]#si\";\n\t$replacements[] = '<span style=\"font-size: 10pt\">';\n\t$patterns[] = \"#\\[size=3\\]#si\";\n\t$replacements[] = '<span style=\"font-size: 12pt\">';\n\t$patterns[] = \"#\\[size=4\\]#si\";\n\t$replacements[] = '<span style=\"font-size: 14pt\">';\n\t$patterns[] = \"#\\[size=5\\]#si\";\n\t$replacements[] = '<span style=\"font-size: 18pt\">';\n\t$patterns[] = \"#\\[size=6\\]#si\";\n\t$replacements[] = '<span style=\"font-size: 24pt\">';\n\t$patterns[] = \"#\\[size=7\\]#si\";\n\t$replacements[] = '<span style=\"font-size: 36pt\">';\n\n\t$patterns[] = \"#\\[font=(.*?)\\]#si\";\n\t$replacements[] = '<span style=\"font-family: $1\">';\n\n\t$patterns[] = \"#\\[color=(.*?)\\]#si\";\n\t$replacements[] = '<span style=\"color: $1\">';\n\n\t$patterns[] = \"#\\[highlight=(.*?)\\]#si\";\n\t$replacements[] = '<span style=\"background-color: $1\">';\n\n\t$patterns[] = \"#\\[\\/(font|color|size|highlight)\\]#si\";\n\t$replacements[] = '</span>';\n\n\t$patterns[] = \"#\\[(center|left|right|justify)\\]#si\";\n\t$replacements[] = \"<div align=\\\"$1\\\">\";\n\n\t$patterns[] = \"#\\[\\/(center|left|right|justify)\\]#si\";\n\t$replacements[] = \"</div>\";\n\n\t$patterns[] = \"#\\[email=(.*?)\\]#si\";\n\t$replacements[] = '<a href=\"mailto:$1\">';\n\t$patterns[] = \"#\\[email\\](.*?)\\[\\/email\\]#si\";\n\t$replacements[] = '<a href=\"mailto:$1\">$1[/email]';\n\n\t$patterns[] = \"#\\[url=(.*?)\\]#si\";\n\t$replacements[] = '<a href=\"$1\">';\n\t$patterns[] = \"#\\[url\\](.*?)\\[\\/url\\]#si\";\n\t$replacements[] = '<a href=\"$1\">$1[/url]';\n\n\t$patterns[] = \"#\\[\\/(email|url)\\]#si\";\n\t$replacements[] = \"</a>\";\n\n\t$patterns[] = \"#\\[img\\](.*?)\\[\\/img\\]#si\";\n\t$replacements[] = '<img src=\"$1\" alt=\"\" />';\n\n\t$patterns[] = \"#\\[list=1\\]#si\";\n\t$replacements[] = \"<ol>\";\n\n\t$patterns[] = \"#\\[list\\]#si\";\n\t$replacements[] = \"<ul>\";\n\n\t$patterns[] = \"#\\[\\*\\]#si\";\n\t$replacements[] = \"<li>\";\n\n\t$patterns[] = \"#<br[^>]*><li>#si\";\n\t$replacements[] = \"<li>\";\n\n\t$patterns[] = \"#<br[^>]*> <li>#si\";\n\t$replacements[] = \"<li>\";\n\n\t$patterns[] = \"#<br[^>]*><\\/li>#si\";\n\t$replacements[] = \"</li>\";\n\n\t$patterns[] = \"#\\[\\/list\\]#si\";\n\t$replacements[] = '</list>';\n\n\t$patterns[] = \"#\\[FLASH=(.*?),(.*?)\\](.*?)\\[\\/FLASH\\]#si\";\n\t$replacements[] = '<object width=\"$1\" height=\"$2\"><param name=\"movie\" value=\"$3\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"$3\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"$1\" height=\"$2\"></embed></object>';\n\n\t$text = preg_replace($patterns, $replacements, $text);\n\t\n\tif (preg_match(\"/<ol/si\",$text) || preg_match(\"/<ul/si\",$text)){\n\t\t$array=split(\"<\",$text);\n\t\t$output=\"\";\n\t\t$x=0;\n\t\tforeach($array as $line){\n\t\t\tif($x>0)$line=\"<\".$line;\n\t\t\tif(preg_match(\"/<ol/i\",$line)){\n\t\t\t\t$temp=\"</ol>\";\n\t\t\t}\n\t\t\telseif(preg_match(\"/<ul/i\",$line)){\n\t\t\t\t$temp=\"</ul>\";\n\t\t\t}\n\t\t\tif(preg_match(\"/<\\/list>/i\",$line)){\n\t\t\t\t$line=str_replace(\"</list>\",$temp,$line);\n\t\t\t}\n\t\t\t$output.=$line;\n\t\t\t$x++;\n\t\t}\n\t}\n\telse{\n\t\t$output=$text;\n\t}\n\n\t//Try to close tag <li>\n\t$output=str_replace(\"<li>\",\"</li><li>\",$output);\n\t$output=str_replace(\"<ul></li>\",\"<ul>\",$output);\n\t$output=str_replace(\"<ol></li>\",\"<ol>\",$output);\n\t$output=str_replace(\"</ul>\",\"</li></ul>\",$output);\n\t$output=str_replace(\"</ol>\",\"</li></ol>\",$output);\n\n\treturn $output;\n}", "static public function build(array $config) {\n $file = File::load(633);\n $id = 'atomizer-bessel';\n // What is it - just a dialog with a div and canvas\n $content = [\n '#type' => 'container',\n '#attributes' => [\n 'class' => ['bessel-canvas-wrapper'],\n ],\n 'canvas' => [\n '#markup' => '<canvas class=\"bessel-canvas\"></canvas>',\n '#allowed_tags' => ['canvas'],\n ],\n 'image' => [\n '#theme' => 'image',\n// '#theme' => 'image_style`',\n// '#style_name' => '640x480',\n// '#width' => 100,\n// '#height' => 100,\n '#uri' => $file->getFileUri(),\n ],\n ];\n return [\n 'content' => $content,\n 'buttons' => ['Cancel', 'Reset', 'Apply'],\n 'id' => $id,\n ];\n }", "function _convertHTMLToBBCode($html)\n {\n\t\n\t\t//Gets rid of extra comment bug\n\t\t$html = str_replace('<!--?prettify lang=html linenums=true?-->', '', $html); \n\t\n //Covert square brackets to html codes \n $html = str_replace(['[', ']', '\\\\'], ['&#91;', '&#93;', '&#92;'], $html);\n \n $pattern = [\n '/[\\r|\\n]/',\n '/<br.*?>/i',\n '/<b.*?>/i',\n '/<\\/b>/i',\n '/<strong.*?>/i',\n '/<\\/strong>/i',\n '/<div(.*?)>/i',\n '/<\\/div>/i',\n '/<pre(.*?)>/i',\n '/<\\/pre>/i',\n '/<font(.*?)>/i',\n '/<\\/font>/i',\n '/<span(.*?)>/i',\n '/<\\/span>/i',\n '/<p(.*?)>/i',\n '/<\\/p>/i',\n '/<ul>/i',\n '/<\\/ul>/i',\n '/<ol>/i',\n '/<\\/ol>/i',\n '/<li>/i',\n '/<\\/li>/i', \n '/<em.*?>/i',\n '/<\\/em>/i',\n '/<u.*?>/i',\n '/<\\/u>/i',\n '/<ins.*?>/i',\n '/<\\/ins>/i',\n '/<strike>/i',\n '/<\\/strike>/i',\n '/<del>/i',\n '/<\\/del>/i',\n '/<a.*?href=\"(.*?)\".*?>(.*?)<\\/a>/i',\n '/<img(.*?)src=\"(.*?)\"(.*?)>/i', \n '/<i.*?>/i',\n '/<\\/i>/i',\n '/<iframe.*>(.*?)<\\/iframe>/i',\n '/<frameset.*>(.*?)<\\/frameset>/i',\n '/<frame.*>/i',\n '/<([a-zA-Z0-9]+)([^<]*)>(.*?)<\\/\\1>/i'\n ];\n \n $replace = [\n \"\",\n '\\n',\n '[b]',\n '[/b]',\n '[b]',\n '[/b]',\n '[div$1]',\n '[/div]',\n '[code$1]',\n '[/code]',\n '[font$1]',\n '[/font]',\n '[span$1]',\n '[/span]',\n '[p$1]',\n '[/p]',\n '[list]',\n '[/list]',\n '[list=1]',\n '[/list]',\n '[*]',\n '[/*]',\n '[i]',\n '[/i]', \n '[u]',\n '[/u]',\n '[u]',\n '[/u]',\n '[s]',\n '[/s]',\n '[s]',\n '[/s]',\n '[url=$1]$2[/url]',\n '[img $1$3]$2[/img]',\n '[i]',\n '[/i]',\n '$1',\n '$1',\n '$1',\n '[$1 $2]$3[/$1]'\n ];\n foreach($pattern as $i=>$p)\n {\n while (preg_match($p, $html)) {\n $html = preg_replace($p, $replace[$i], $html);\n }\n }\n \n //Convert Single Quote to Double Quote for div, code, font, img and other html tags tags\n $html = preg_replace_callback('/\\[code(.*?)\\](.*?)\\[\\/code\\]/i', create_function('$matches', 'return \"[code\" . str_replace(\\'\"\\', \";squote;\", $matches[1]) . \"]\" . $matches[2] . \"[/code]\";'), $html);\n $html = preg_replace_callback('/\\[font(.*?)\\](.*?)\\[\\/font\\]/i', create_function('$matches', 'return \"[font\" . str_replace(\\'\"\\', \";squote;\", $matches[1]) . \"]\" . $matches[2] . \"[/font]\";'), $html);\n $html = preg_replace_callback('/\\[span(.*?)\\](.*?)\\[\\/span\\]/i', create_function('$matches', 'return \"[span\" . str_replace(\\'\"\\', \";squote;\", $matches[1]) . \"]\" . $matches[2] . \"[/span]\";'), $html);\n $html = preg_replace_callback('/\\[div(.*?)\\](.*?)\\[\\/div\\]/i', create_function('$matches', 'return \"[div\" . str_replace(\\'\"\\', \";squote;\", $matches[1]) . \"]\" . $matches[2] . \"[/div]\";'), $html);\n $html = preg_replace_callback('/\\[p(.*?)\\](.*?)\\[\\/p\\]/i', create_function('$matches', 'return \"[p\" . str_replace(\\'\"\\', \";squote;\", $matches[1]) . \"]\" . $matches[2] . \"[/p]\";'), $html);\n $html = preg_replace_callback('/\\[img(.*?)\\](.*?)\\[\\/img\\]/i', create_function('$matches', 'return \"[img\" . str_replace(\\'\"\\', \";squote;\", $matches[1]) . \"]\" . $matches[2] . \"[/img]\";'), $html);\n \n $html = preg_replace_callback('/\\[([a-zA-Z0-9]+)([^\\]]+)\\]/i', create_function('$matches', 'return \"[\" . $matches[1] . str_replace(\\'\"\\', \";squote;\", $matches[2]) . \"]\";'), $html);\n \n return $html;\n }", "function bbcode_format ($str) {\n\n //$str = htmlentities($str, ENT_QUOTES, 'UTF-8'); \n\n\n\n $simple_search = array(\n\n //added line break\n\n '/\\[br\\]/is',\n\n '/\\[b\\](.*?)\\[\\/b\\]/is',\n\n '/\\[i\\](.*?)\\[\\/i\\]/is',\n\n '/\\[u\\](.*?)\\[\\/u\\]/is',\n\n '/\\[url\\=(.*?)\\](.*?)\\[\\/url\\]/is',\n\n '/\\[url\\](.*?)\\[\\/url\\]/is',\n\n '/\\[align\\=(left|center|right)\\](.*?)\\[\\/align\\]/is',\n\n '/\\[img\\](.*?)\\[\\/img\\]/is',\n\n '/\\[mail\\=(.*?)\\](.*?)\\[\\/mail\\]/is',\n\n '/\\[mail\\](.*?)\\[\\/mail\\]/is',\n\n '/\\[font\\=(.*?)\\](.*?)\\[\\/font\\]/is',\n\n '/\\[size\\=(.*?)\\](.*?)\\[\\/size\\]/is',\n\n '/\\[color\\=(.*?)\\](.*?)\\[\\/color\\]/is',\n\n //added textarea for code presentation\n\n '/\\[codearea\\](.*?)\\[\\/codearea\\]/is',\n\n //added pre class for code presentation\n\n '/\\[code\\](.*?)\\[\\/code\\]/is',\n\n //added paragraph\n\n '/\\[p\\](.*?)\\[\\/p\\]/is',\n\n );\n\n\n\n $simple_replace = array(\n\n //added line break\n\n '<br />',\n\n '<strong>$1</strong>',\n\n '<em>$1</em>',\n\n '<u>$1</u>',\n\n // added nofollow to prevent spam\n\n '<a href=\"$1\" rel=\"nofollow\" title=\"$2 - $1\">$2</a>',\n\n '<a href=\"$1\" rel=\"nofollow\" title=\"$1\">$1</a>',\n\n '<div style=\"text-align: $1;\">$2</div>',\n\n //added alt attribute for validation\n\n '<img src=\"$1\" alt=\"\" />',\n\n '<a href=\"mailto:$1\">$2</a>',\n\n '<a href=\"mailto:$1\">$1</a>',\n\n '<span style=\"font-family: $1;\">$2</span>',\n\n '<span style=\"font-size: $1;\">$2</span>',\n\n '<span style=\"color: $1;\">$2</span>',\n\n //added textarea for code presentation\n\n '<textarea class=\"code_container\" rows=\"30\" cols=\"70\">$1</textarea>',\n\n //added pre class for code presentation\n\n '<pre class=\"code\">$1</pre>',\n\n //added paragraph\n\n '<p>$1</p>',\n\n );\n\n\n\n // Do simple BBCode's \n\n $str = preg_replace ($simple_search, $simple_replace, $str);\n\n\n\n // Do <blockquote> BBCode \n\n //$str = bbcode_quote ($str); \n\n\n\n return $str;\n\n}", "public function create($config);", "function bbcode_to_html($bbtext){\n $bbtags = array(\n '[heading1]' => '<h1>','[/heading1]' => '</h1>',\n '[heading2]' => '<h2>','[/heading2]' => '</h2>',\n '[heading3]' => '<h3>','[/heading3]' => '</h3>',\n '[h1]' => '<h1>','[/h1]' => '</h1>',\n '[h2]' => '<h2>','[/h2]' => '</h2>',\n '[h3]' => '<h3>','[/h3]' => '</h3>',\n\n '[paragraph]' => '<p>','[/paragraph]' => '</p>',\n '[para]' => '<p>','[/para]' => '</p>',\n '[p]' => '<p>','[/p]' => '</p>',\n '[left]' => '<p style=\"text-align:left;\">','[/left]' => '</p>',\n '[right]' => '<p style=\"text-align:right;\">','[/right]' => '</p>',\n '[center]' => '<p style=\"text-align:center;\">','[/center]' => '</p>',\n '[justify]' => '<p style=\"text-align:justify;\">','[/justify]' => '</p>',\n\n '[bold]' => '<span style=\"font-weight:bold;\">','[/bold]' => '</span>',\n '[italic]' => '<span style=\"font-weight:bold;\">','[/italic]' => '</span>',\n '[underline]' => '<span style=\"text-decoration:underline;\">','[/underline]' => '</span>',\n '[b]' => '<span style=\"font-weight:bold;\">','[/b]' => '</span>',\n '[i]' => '<span style=\"font-weight:bold;\">','[/i]' => '</span>',\n '[u]' => '<span style=\"text-decoration:underline;\">','[/u]' => '</span>',\n '[break]' => '<br>',\n '[br]' => '<br>',\n '[newline]' => '<br>',\n '[nl]' => '<br>',\n \n '[unordered_list]' => '<ul>','[/unordered_list]' => '</ul>',\n '[list]' => '<ul>','[/list]' => '</ul>',\n '[ul]' => '<ul>','[/ul]' => '</ul>',\n\n '[ordered_list]' => '<ol>','[/ordered_list]' => '</ol>',\n '[ol]' => '<ol>','[/ol]' => '</ol>',\n '[list_item]' => '<li>','[/list_item]' => '</li>',\n '[li]' => '<li>','[/li]' => '</li>',\n \n '[*]' => '<li>','[/*]' => '</li>',\n '[code]' => '<code>','[/code]' => '</code>',\n '[preformatted]' => '<pre>','[/preformatted]' => '</pre>',\n '[pre]' => '<pre>','[/pre]' => '</pre>',\n '[video]' => '<br/><iframe src=\"http://youtube.com/embed/','[/video]' => '\"width=\"100%\" height=\"480\" frameborder=\"0\"></iframe><br/>' \n );\n\n $bbtext = str_ireplace(array_keys($bbtags), array_values($bbtags), $bbtext);\n\n $bbextended = array(\n \"/\\[url](.*?)\\[\\/url]/i\" => \"<a href=\\\"http://$1\\\" title=\\\"$1\\\">$1</a>\",\n \"/\\[url=(.*?)\\](.*?)\\[\\/url\\]/i\" => \"<a href=\\\"$1\\\" title=\\\"$1\\\">$2</a>\",\n \"/\\[email=(.*?)\\](.*?)\\[\\/email\\]/i\" => \"<a href=\\\"mailto:$1\\\">$2</a>\",\n \"/\\[mail=(.*?)\\](.*?)\\[\\/mail\\]/i\" => \"<a href=\\\"mailto:$1\\\">$2</a>\",\n \"/\\[img\\]([^[]*)\\[\\/img\\]/i\" => \"<img src=\\\"$1\\\" alt=\\\" \\\" />\",\n \"/\\[image\\]([^[]*)\\[\\/image\\]/i\" => \"<img src=\\\"$1\\\" alt=\\\" \\\" />\",\n \"/\\[image_left\\]([^[]*)\\[\\/image_left\\]/i\" => \"<img src=\\\"$1\\\" alt=\\\" \\\" class=\\\"img_left\\\" />\",\n \"/\\[image_right\\]([^[]*)\\[\\/image_right\\]/i\" => \"<img src=\\\"$1\\\" alt=\\\" \\\" class=\\\"img_right\\\" />\",\n );\n\n foreach($bbextended as $match=>$replacement){\n $bbtext = preg_replace($match, $replacement, $bbtext);\n }\n return $bbtext;\n}", "public function applyConfig($config) {\n $config['tabs'] = array(\n 0 => array( 'Settings', 'tabs__settings_withinboredom'),\n 1 => array('About', 'tabs__about_withinboredom'),\n 2 => array('Support', 'tabs__support_withinboredom'),\n );\n $config['help'] = array(\n // The tab to display on\n '0' => array(\n // The title content of the help menu\n 0 => array('Overview', \"Basic settings for the Abundatrade Calculator.\"),\n 1 => array('Help', 'Enter your affiliate id and the location of your thank you page')\n )\n );\n $config['config'] = array(\n 'settings' => true,\n 'page_title' => 'Abundatrade',\n 'button_title' => 'Abundatrade',\n 'slug' => 'abundatrade',\n 'shortcodes' => array(\n 'abundatrade'\n ),\n );\n return $config;\n }", "public static function getBBCODE()\n\t{\n\t\t$bbcode = array();\n\t\t$oReflectionClass = new ReflectionClass('specialetekens');\n\t\tforeach ($oReflectionClass->getConstants() as $key => $val) {\n\t\t\tif (strstr($key, \"BBCODE\")) {\n\t\t\t\t$bbcode[$key] = $val;\n\t\t\t}\n\t\t}\n\t\treturn $bbcode;\n\t}", "public static function fromArray(array $config): Config;", "function parse_bbcode()\n\t{\n\t\t$this->post['message'] = parse_pm_bbcode($this->post['message'], $this->post['allowsmilie']);\n\t}", "function parse_bbcode()\n\t{\n\t\t$this->post['message'] = parse_usernote_bbcode($this->post['message'], $this->post['allowsmilies']);\n\t}", "function parse_bbcode($str)\n {\n\t$keys = array();\n\t$data = array();\n\tforeach (array(\"r\", \"s\", \"e\", \"S\", \"E\", \"LI\", \"LIST\") as $rep) {\n\t\t$keys[] = \"/<$rep>/\";\n\t\t$data[] = \"\";\n\n\t\t$keys[] = \"/<\\/$rep>/\";\n\t\t$data[] = \"\";\n\t}\n\n\tforeach (array(\"URL\", \"IMG\") as $rep) {\n\t\t$keys[] = '/<'.$rep.' \\w+=\".*\">/';\n\t\t$data[] = \"\";\n\n\t\t$keys[] = \"/<\\/$rep>/\";\n\t\t$data[] = \"\";\n\t}\n\t$keys[] = \"/\\r/\";\n\t$data[] = \"\";\n\n\t$keys[] = \"/\\n/\";\n\t$data[] = \"\";\n\n $str = preg_replace($keys, $data, $str);\n\n $keys = array('/{SMILIES_PATH}/',\n '/\\[b]/',\n '/\\[\\/b]/',\n '/\\[u:\\w*\\]/',\n '/\\[\\/u:\\w*\\]/',\n '/\\[s\\]/',\n '/\\[\\/s\\]/',\n '/\\[i:\\w*\\]/',\n '/\\[\\/i:\\w*\\]/',\n '/\\[url]/',\n '/\\[url=(.*?)\\]/',\n '/\\[\\/url\\]/',\n '/\\[list]\\n?/',\n '/\\[\\*\\]\\n?/',\n '/\\[\\/\\*[:\\w]*\\]\\n?/',\n '/\\[\\/list[:\\w]*\\]\\n?/',\n '/\\[img\\]/',\n '/\\[\\/img\\]/',\n '/\\[size=(.*?):\\w*\\]/',\n '/\\[\\/size:\\w*\\]/',\n '/\\[color=([^\\]]+)\\]/',\n '/\\[\\/color\\]/',\n '/\\n/',\n '/\\[code\\]/',\n );\n $data = array('/phpbb/images/smilies',\n '<b>',\n '</b>',\n '<u>',\n '</u>',\n '<span style=\"text-decoration:line-through\">',\n '</span>',\n '<i>',\n '</i>',\n '<a href=\"$1\">$1</a>',\n '<a href=\"$1\">',\n '</a>',\n '<ul>',\n '<li>',\n '</li>',\n '</ul>',\n '<img alt=\"\" src=\"',\n '\" />',\n '',\n '',\n '<span style=\"color:$1\">',\n '</span>',\n '<br />',\n '<div class=\"codebox\">',\n '</div>',\n );\n return preg_replace($keys, $data, $str);\n }", "function declare_bread( $config ){\n\t\t$default\t=\tarray(\n\t\t\t'divider' \t\t\t=>\t\t'/',\n\t\t\t'wrapper'\t\t\t=>\t\t'ul',\n\t\t\t'wrapper_class'\t\t=>\t\t'wrapper-class',\n\t\t\t'wrapper_id'\t\t=>\t\t'wrappper-id',\n\t\t\t'item_class'\t\t=>\t\t'item-class',\n\t\t\t'item_id'\t\t\t=>\t\t'item-id',\n\t\t\t'text_before_bread'\t=>\t\t'',\n\t\t\t'container'\t\t\t=>\t\t'div',\n\t\t\t'container_class'\t=>\t\t'container-class',\n\t\t\t'container_id'\t\t=>\t\t'container-id',\n\t\t\t'word_limiter'\t\t=>\t\t10,\n\t\t\t'text_before_bread_loop'\t=>\t''\n\t\t);\n\t\t$config\t\t=\tarray_merge( $default , $config );\n\t\treturn set_active_theme_vars( 'breadcrumbs_setup' , $config );\n\t}", "function forumbb($post){\n $zpattern[a] = \"<\";\n $zpattern[b] = \">\";\n $zreplace[a] = \"&lt;\";\n $zreplace[b] = \"&gt;\";\n $postinforawz = str_replace($zpattern, $zreplace, $post);\n $epattern[1] = \"/\\[b\\](.*?)\\[\\/b\\]/is\";\n $epattern[2] = \"/\\[u\\](.*?)\\[\\/u\\]/is\";\n $epattern[3] = \"/\\[i\\](.*?)\\[\\/i\\]/is\";\n $epattern[4] = \"/\\[center\\](.*?)\\[\\/center\\]/is\";\n $epattern[5] = \"/\\[color=(.*?)\\](.*?)\\[\\/color\\]/is\";\n $epattern[6] = \"/\\[img\\](.*?)\\[\\/img\\]/is\";\n $epattern[7] = \"/\\[font=(.*?)\\](.*?)\\[\\/font\\]/is\";\n $epattern[8] = \"/\\[br\\]/is\";\n $epattern[9] = \"/\\[size=(.*?)\\](.*?)\\[\\/size\\]/is\";\n $epattern[10] = \"/\\[quote\\](.*?)\\[\\/quote\\]/is\";\n $epattern[11] = \"/\\[left\\](.*?)\\[\\/left\\]/is\";\n $epattern[12] = \"/\\[right\\](.*?)\\[\\/right\\]/is\";\n $epattern[13] = \"/\\[s\\](.*?)\\[\\/s\\]/is\";\n $ereplace[1] = \"<b>$1</b>\";\n $ereplace[2] = \"<u>$1</u>\";\n $ereplace[3] = \"<i>$1</i>\";\n $ereplace[4] = \"<center>$1</center>\";\n $ereplace[5] = \"<font color=\\\"$1\\\">$2</font>\";\n $ereplace[6] = \"<img src=\\\"$1\\\">\";\n $ereplace[7] = \"<font face=\\\"$1\\\">$2</font>\";\n $ereplace[8] = \"<br>\";\n $ereplace[9] = \"<font size=\\\"$1\\\">$2</font>\";\n $ereplace[10] = \"<blockquote><b>$1</b></blockquote>\";\n $ereplace[11] = \"<div align=\\\"left\\\">$1</div>\";\n $ereplace[12] = \"<div align=\\\"right\\\">$1</div>\";\n $ereplace[13] = \"<s>$1</s>\";\n $postinforawb = preg_replace($epattern, $ereplace, $postinforawz);\n $fpattern[1] = \":arrow:\";\n $fpattern[2] = \":D\";\n $fpattern[3] = \":S\";\n $fpattern[4] = \"8)\";\n $fpattern[5] = \":cry:\";\n $fpattern[6] = \"8|\";\n $fpattern[7] = \":evil:\";\n $fpattern[8] = \":!:\";\n $fpattern[9] = \":idea:\";\n $fpattern[10] = \":lol:\";\n $fpattern[11] = \":mad:\";\n $fpattern[12] = \":?:\";\n $fpattern[13] = \":redface:\";\n $fpattern[14] = \":rolleyes:\";\n $fpattern[15] = \":(\";\n $fpattern[16] = \":)\";\n $fpattern[17] = \":o\";\n $fpattern[18] = \":tdn:\";\n $fpattern[19] = \":P\";\n $fpattern[20] = \":tup:\";\n $fpattern[21] = \":twisted:\";\n $fpattern[22] = \";)\";\n $fpattern[23] = \":slepy:\";\n $fpattern[24] = \":whistle:\";\n $fpattern[25] = \":wub:\";\n $fpattern[26] = \":muah:\";\n $fpattern[27] = \":zipped:\";\n $fpattern[28] = \":love:\";\n $fpattern[29] = \":sarcasm:\";\n\n $freplace[1] = '<img src=/layout/smiles/arrow.gif class=\"smileys\">';\n $freplace[2] = '<img src=/layout/smiles/biggrin.gif class=\"smileys\">';\n $freplace[3] = '<img src=/layout/smiles/confused.gif class=\"smileys\">';\n $freplace[4] = '<img src=/layout/smiles/cool.gif class=\"smileys\">';\n $freplace[5] = '<img src=/layout/smiles/cry.gif class=\"smileys\">';\n $freplace[6] = '<img src=/layout/smiles/eek.gif class=\"smileys\">';\n $freplace[7] = '<img src=/layout/smiles/evil.gif class=\"smileys\">';\n $freplace[8] = '<img src=/layout/smiles/exclaim.gif class=\"smileys\">';\n $freplace[9] = '<img src=/layout/smiles/idea.gif class=\"smileys\">';\n $freplace[10] = '<img src=/layout/smiles/lol.gif class=\"smileys\">';\n $freplace[11] = '<img src=/layout/smiles/mad.gif class=\"smileys\">';\n $freplace[12] = '<img src=/layout/smiles/question.gif class=\"smileys\">';\n $freplace[13] = '<img src=/layout/smiles/redface.gif class=\"smileys\">';\n $freplace[14] = '<img src=/layout/smiles/rolleyes.gif class=\"smileys\">';\n $freplace[15] = '<img src=/layout/smiles/sad.gif class=\"smileys\">';\n $freplace[16] = '<img src=/layout/smiles/smile.gif class=\"smileys\">';\n $freplace[17] = '<img src=/layout/smiles/surprised.gif class=\"smileys\">';\n $freplace[18] = '<img src=/layout/smiles/tdown.gif class=\"smileys\">';\n $freplace[19] = '<img src=/layout/smiles/toungue.gif class=\"smileys\">';\n $freplace[20] = '<img src=/layout/smiles/tup.gif class=\"smileys\">';\n $freplace[21] = '<img src=/layout/smiles/twisted.gif class=\"smileys\">';\n $freplace[22] = '<img src=/layout/smiles/wink.gif class=\"smileys\">';\n $freplace[23] = '<img src=/layout/smiles/slepy.png class=\"smileys\">';\n $freplace[24] = '<img src=/layout/smiles/whistle.gif class=\"smileys\">';\n $freplace[25] = '<img src=/layout/smiles/wub.gif class=\"smileys\">';\n $freplace[26] = '<img src=/layout/smiles/muah.gif class=\"smileys\">';\n $freplace[27] = '<img src=/layout/smiles/zipped.gif class=\"smileys\">';\n $freplace[28] = '<img src=/layout/smiles/love.gif class=\"smileys\">';\n $freplace[29] = '<img src=/layout/smiles/sarcasm.gif class=\"smileys\">';\n\n $postinfo = str_replace($fpattern, $freplace, $postinforawb);\n return $postinfo;}", "public static function factory($config)\n {\n return new self();\n }", "function _convertBBCodeToHTML($code)\n {\t\t\n //For Prettyprint\n $code = str_replace('[code class=&quot;prettyprint&quot;', '<?prettify lang=html linenums=true?>[code class=\"prettyprint\"', $code);\n $code = str_replace('[code class=;squote;prettyprint;squote;', '<?prettify lang=html linenums=true?>[code class=\"prettyprint\"', $code);\n $code = str_replace('[code class=&#039;prettyprint&#039;', '<?prettify lang=html linenums=true?>[code class=\"prettyprint\"', $code);\n //Process Single Quote\n $code = str_replace(';squote;', \"'\", $code);\t\n\n\t\t//Tring to fix edit bug - works but breaks prettify\n //$code = str_replace('\\n', '<br>', $code);\t\t\n\n $pattern = [\n '/\\\\\\r/',\n '/\\\\\\n/',\n '/\\[b\\]/i',\n '/\\[\\/b\\]/i',\n '/\\[code(.*?)\\]/i',\n '/\\[\\/code\\]/i',\n '/\\[font(.*?)\\]/i',\n '/\\[\\/font\\]/i',\n '/\\[div(.*?)\\]/i', \n '/\\[\\/div\\]/i', \n '/\\[span(.*?)\\]/i',\n '/\\[\\/span\\]/i',\n '/\\[p(.*?)\\]/i',\n '/\\[\\/p\\]/i',\n '/\\[i\\]/i',\n '/\\[\\/i\\]/i',\n '/\\[u\\]/i',\n '/\\[\\/u\\]/i',\n '/\\[s\\]/i',\n '/\\[\\/s\\]/i',\n '/\\[url=(.*?)\\](.*?)\\[\\/url\\]/i',\n '/\\[img(.*?)\\](.*?)\\[\\/img\\]/i',\n '/\\[list\\](.*?)\\[\\/list\\]/i',\n '/\\[list=1\\](.*?)\\[\\/list\\]/i',\n '/\\[list\\]/i',\n '/\\[list=1\\]/i',\n '/\\[\\*\\](.*?)\\[\\/\\*\\]/',\n '/\\[\\*\\]/',\n '/\\[([a-zA-Z0-9]+)([^\\]]*)\\](.*?)\\[\\/\\1\\]/i'\n ];\n $replace = [\n \"\",\n '<br />',\n '<b>',\n '</b>',\n '<code><pre$1>',\n '</pre></code>',\n '<font$1>',\n '</font>',\n '<div$1>', \n '</div>', \n '<span$1>',\n '</span>',\n '<p$1>',\n '</p>',\n '<i>',\n '</i>',\n '<u>',\n '</u>',\n '<strike>',\n '</strike>',\n '<a href=\\'$1\\'>$2</a>',\n '<img $1 src=\\'$2\\'>',\n '<ul>$1</ul>',\n '<ol>$1</ol>',\n '<ul>',\n '<ol>',\n '<li>$1</li>',\n '<li>',\n '<$1 $2>$3</$1>'\n ];\n \n foreach($pattern as $i=>$p)\n {\n while (preg_match($p, $code)) {\n $code = preg_replace($p, $replace[$i], $code);\n }\n }\n// $code = preg_replace($pattern, $replace, $code);\n \n $pos = 0;\n //For PrettyPrint\n while( ($pos = strpos($code, '<?prettify lang=html linenums=true?>', $pos)) !== false)\n {\n $rpos = strpos($code, '</pre>', $pos);\n if($rpos !== false)\n {\n $subcode = substr($code, $pos, $rpos - $pos);\n $subcode = str_replace('<br />', PHP_EOL, $subcode);\n $code = substr($code, 0, $pos) . $subcode . substr($code, $rpos);\n $pos = strpos($code, '</pre>', $pos);\n }else{\n $subcode = substr($code, $pos);\n $subcode = str_replace('<br />', PHP_EOL, $subcode);\n $code = substr($code, 0, $pos) . $subcode;\n break;\n }\n }\n \n return $code;\n }", "function bbc($eintrag)\n{\n if (@file_exists(__DIR__.'/inc.bbc_conf.php')) {\n require __DIR__.'/inc.bbc_conf.php';\n } else {\n if (file_exists('inc.bbc_conf.php')) {\n include 'inc.bbc_conf.php';\n } else {\n $set = array();\n $set[0] = 0;\n $set[1] = 0;\n $set[2] = 1;\n $set[3] = 1;\n $set[4] = 1;\n $set[5] = 1;\n $set[6] = 2;\n $set[7] = 1;\n $set[8] = 1;\n $set[9] = 1;\n $set[10] = 0;\n $set[11] = 1;\n $set[12] = 0;\n $set[13] = 1;\n $set[14] = 0;\n $set[15] = 1;\n $set[16] = 1;\n $set[17] = 1;\n $set[18] = 0;\n $set[19] = 0;\n }\n }\n if ($set[0] == 0) {\n return $eintrag;\n }\n\n if ($set[1] == 1) {\n $eintrag = str_replace('<br />', \"\\n\", $eintrag);\n $eintrag = str_replace('<br>', \"\\n\", $eintrag);\n $eintrag = str_replace('<hr>', '[hr]', $eintrag);\n $eintrag = str_replace('<hr />', '[hr]', $eintrag);\n $eintrag = preg_replace('#<b>(.*)</b>#isU', '[b]$1[/b]', $eintrag);\n $eintrag = preg_replace('#<strong>(.*)</strong>#isU', '[b]$1[/b]', $eintrag);\n $eintrag = preg_replace('#<big>(.*)</big>#isU', '[big]$1[/big]', $eintrag);\n $eintrag = preg_replace('#<i>(.*)</i>#isU', '[i]$1[/i]', $eintrag);\n $eintrag = preg_replace('#<em>(.*)</em>#isU', '[i]$1[/i]', $eintrag);\n $eintrag = str_replace('&lt;', '<', $eintrag);\n $eintrag = str_replace('&gt;', '>', $eintrag);\n $eintrag = str_replace('&#038;', '&', $eintrag);\n $eintrag = str_replace('&amp;', '&', $eintrag);\n }\n\n $eintrag = str_replace('&', '&amp;', $eintrag);\n $eintrag = str_replace('\"', '&quot;', $eintrag);\n $eintrag = str_replace(\"\\'\", '&#039;', $eintrag);\n $eintrag = str_replace('ä', '&auml;', $eintrag);\n $eintrag = str_replace('ü', '&uuml;', $eintrag);\n $eintrag = str_replace('ö', '&ouml;', $eintrag);\n $eintrag = str_replace('Ä', '&Auml;', $eintrag);\n $eintrag = str_replace('Ü', '&Uuml;', $eintrag);\n $eintrag = str_replace('Ö', '&Ouml;', $eintrag);\n $eintrag = str_replace('ß', '&szlig;', $eintrag);\n $eintrag = str_replace('<', '&lt;', $eintrag);\n $eintrag = str_replace('>', '&gt;', $eintrag);\n $eintrag = str_replace('*', '&#042;', $eintrag);\n $eintrag = str_replace(\"\\r\\n\\r\\n\", '<br />&nbsp;<br />', $eintrag);\n $eintrag = str_replace(\"\\n\", '<br />', $eintrag);\n\n if ($set[15] == 1) {\n $eintrag = eregi_replace(\"\\[hr\\]\", '<hr>', $eintrag);\n }\n\n if ($set[4] == 1 && $set[19] != 1) {\n $eintrag = preg_replace_callback(\"/\\[noparse\\](.*)\\[\\/noparse\\]/Usi\", 'noparse', $eintrag);\n }\n\n if ($set[2] == 1 && $set[3] == 1) {\n $eintrag = preg_replace('#\\[html\\](.*)\\[/html\\]#isU',\n '<br><span title=\"Quellcode\" style=\"font-weight:bold; text-decoration:underline\">HTML:</span><div style=\"background-color:#EEEEEE; text-align:justify; font:10pt, Arial, normal; border-color:steelblue; border-style:inset; border-width:4pt; white-space:nowrap; height:150px; width:575px; overflow:auto\">[var]$1[/var]</div>',\n $eintrag);\n } else {\n if ($set[2] == 2) {\n $eintrag = preg_replace_callback(\"/\\[html\\](.*)\\[\\/html\\]/Usi\", 'html', $eintrag);\n }\n }\n\n if ($set[3] == 1) {\n $eintrag = preg_replace('#\\[code\\](.*)\\[/code\\]#isU',\n '<br><span title=\"Quellcode\" style=\"font-weight:bold; text-decoration:underline\">Code:</span><div style=\"background-color:#EEEEEE; text-align:justify; font:10pt, Arial, normal; border-color:steelblue; border-style:inset; border-width:4pt; white-space:nowrap; height:150px; width:575px; overflow:auto\">[var]$1[/var]</div>',\n $eintrag);\n $eintrag = preg_replace('#\\[php\\](.*)\\[/php\\]#isU',\n '<br><span title=\"Quellcode\" style=\"font-weight:bold; text-decoration:underline\">PHP:</span><div style=\"background-color:#EEEEEE; text-align:justify; font:10pt, Arial, normal; border-color:steelblue; border-style:inset; border-width:4pt; white-space:nowrap; height:150px; width:575px; overflow:auto\">[var]$1[/var]</div>',\n $eintrag);\n $eintrag = preg_replace('#\\[code=(.*)\\](.*)\\[/code\\]#isU',\n '<br><span title=\"Quellcode\" style=\"font-weight:bold; text-decoration:underline\">$1:</span><div style=\"background-color:#EEEEEE; text-align:justify; font:10pt, Arial, normal; border-color:steelblue; border-style:inset; border-width:4pt; white-space:nowrap; height:150px; width:575px; overflow:auto\">[var]$2[/var]</div>',\n $eintrag);\n $eintrag = preg_replace_callback(\"/\\[var\\](.*)\\[\\/var\\]/Usi\", 'parseVar', $eintrag);\n }\n\n\n if ($set[5] == 1 && @file_exists(__DIR__.'/smilies.php')) {\n require __DIR__.'/smilies.php';\n for ($zaehler = 0; $zaehler < count($smilie); $zaehler++) {\n $text1 = $smilie[$zaehler]['text'];\n $text2 = '<img src=\"'.$smilie[$zaehler]['src'].'\" alt=\"'.$smilie[$zaehler]['alt'].'\" title=\"'.$smilie[$zaehler]['text'].'\"></img>';\n $eintrag = eregi_replace($text1, $text2, $eintrag);\n }\n } else {\n if ($set[5] == 1 && file_exists('smilies.php')) {\n include 'smilies.php';\n for ($zaehler = 0; $zaehler < count($smilie); $zaehler++) {\n $text1 = $smilie[$zaehler]['text'];\n $text2 = '<img src=\"'.$smilie[$zaehler]['src'].'\" alt=\"'.$smilie[$zaehler]['alt'].'\" title=\"'.$smilie[$zaehler]['text'].'\"></img>';\n $eintrag = eregi_replace($text1, $text2, $eintrag);\n }\n }\n }\n\n $eintrag = preg_replace('#\\[b\\](.*)\\[/b\\]#isU', '<strong>$1</strong>', $eintrag);\n $eintrag = preg_replace('#\\[big\\](.*)\\[/big\\]#isU', '<big>$1</big>', $eintrag);\n $eintrag = preg_replace('#\\[i\\](.*)\\[/i\\]#isU', '<em>$1</em>', $eintrag);\n $eintrag = preg_replace('#\\[u\\](.*)\\[/u\\]#isU', '<u>$1</u>', $eintrag);\n $eintrag = preg_replace('#\\[s\\](.*)\\[/s\\]#isU', '<strike style=\"color:red\"><span style=\"color:white\">$1</span></strike>', $eintrag);\n if ($set[14] == 1) {\n $eintrag = preg_replace('#\\[highlight\\](.*)\\[/highlight\\]#isU', '<span style=\"color:blue; font-weight:bolder\"><blink>$1</blink></span>', $eintrag);\n } else {\n $eintrag = preg_replace('#\\[highlight\\](.*)\\[/highlight\\]#isU', '<span style=\"color:blue; font-weight:bolder\">$1</span>', $eintrag);\n }\n if ($set[16] == 1) {\n $eintrag = preg_replace('#\\[(sup|high|top)\\](.*)\\[/(sup|high|top)\\]#isU', '<supscript>$2</supscript>', $eintrag);\n $eintrag = preg_replace('#\\[(sub|down)\\](.*)\\[/(sub|down)\\]#isU', '<subscript>$2</subscript>', $eintrag);\n }\n if ($set[12] == 1) {\n $eintrag = preg_replace('#\\[pre\\](.*)\\[/pre\\]#isU', '<pre>$1</pre>', $eintrag);\n }\n\n $eintrag = preg_replace('#\\[align\\](.*)\\[/align\\]#isU', '<div align=\"center\" style=\"width:550pt\">$1</div>', $eintrag);\n $eintrag = preg_replace('#\\[(left|align=left)\\](.*)\\[/(left|align)\\]#isU', '<div align=\"left\" style=\"width:550pt\">$2</div>', $eintrag);\n $eintrag = preg_replace('#\\[(center|align=center)\\](.*)\\[/(center|align)\\]#isU', '<div align=\"center\" style=\"width:550pt\">$2</div>', $eintrag);\n $eintrag = preg_replace('#\\[(right|align=right)\\](.*)\\[/(right|align)\\]#isU', '<div align=\"right\" style=\"width:550pt\">$2</div>', $eintrag);\n\n if ($set[14] == 1) {\n $eintrag = preg_replace('#\\[blink\\](.*)\\[/blink\\]#isU', '<blink>$1</blink>', $eintrag);\n }\n\n if ($set[17] == 1) {\n while (preg_match('#\\[(spoiler|hide|hidden)\\](.*)\\[/(spoiler|hide|hidden)\\]#isU', $eintrag)) {\n $eintrag = preg_replace('#\\[(spoiler|hide|hidden)\\](.*)\\[/(spoiler|hide|hidden)\\]#isU',\n \"<div><input type=\\\"button\\\" onClick=\\\"var inner = this.parentNode.getElementsByTagName('div')[0]; if (inner.style.display == 'none'){inner.style.display = '';this.value=' - ';}else{inner.style.display = 'none';this.value=' + ';}\\\" value=\\\" + \\\"><div style=\\\"color:gray; background-color:white; display:none\\\">$2</div></div>\",\n $eintrag);\n }\n }\n\n $eintrag = preg_replace('#\\[color=(.*)\\](.*)\\[/color\\]#isU', '<span style=\"color: $1\">$2</span>', $eintrag);\n $eintrag = preg_replace('#\\[color\\](.*)\\[/color\\]#isU', '<span style=\"color:#FF0000\">$1</span>', $eintrag);\n $eintrag = preg_replace('#\\[mark=(.*)\\](.*)\\[/mark\\]#isU', '<span style=\"background-color: $1\">$2</span>', $eintrag);\n $eintrag = preg_replace('#\\[mark\\](.*)\\[/mark\\]#isU', '<span style=\"background-color:yellow\">$1</span>', $eintrag);\n if ($set[18] == 1) {\n $eintrag = preg_replace('#\\[size=(.*)\\](.*)\\[/size\\]#isU', '<span style=\"font-size: $1 pt\">$2</span>', $eintrag);\n }\n\n if ($set[6] == 1) {\n $eintrag = preg_replace('#\\[url\\](.*)\\[/url\\]#isU', '<a href=\"$1\" target=\"_blank\" title=\"$1\">$1</a>', $eintrag);\n $eintrag = preg_replace('#\\[url=(.*)\\](.*)\\[/url\\]#isU', '<a href=\"$1\" target=\"_blank\" title=\"$1\">$2</a>', $eintrag);\n } else {\n if ($set[6] == 2) {\n $eintrag = preg_replace('#\\[url\\](.*)\\[/url\\]#isU', '<a href=\"$1\" target=\"_self\" title=\"$1\">$1</a>', $eintrag);\n $eintrag = preg_replace('#\\[url=(.*)\\](.*)\\[/url\\]#isU', '<a href=\"$1\" target=\"_self\" title=\"$1\">$2</a>', $eintrag);\n }\n }\n\n if ($set[10] == 1) {\n $eintrag = preg_replace('#\\[google\\](.*)\\[/google\\]#isU', '<a href=\"http://www.google.de/search?q=$1\" target=\"_blank\" title=\"$1\">Google-Suche</a>', $eintrag);\n $eintrag = preg_replace('#\\[google=(.*)\\](.*)\\[/google\\]#isU', '<a href=\"http://www.google.de/search?q=$1\" target=\"_blank\" title=\"$1\">$2</a>', $eintrag);\n } else {\n if ($set[10] == 2) {\n $eintrag = preg_replace('#\\[google\\](.*)\\[/google\\]#isU', '<a href=\"http://www.google.de/search?q=$1\" target=\"_top\" title=\"$1\">Google-Suche</a>', $eintrag);\n $eintrag = preg_replace('#\\[google=(.*)\\](.*)\\[/google\\]#isU', '<a href=\"http://www.google.de/search?q=$1\" target=\"_top\" title=\"$1\">$2</a>', $eintrag);\n }\n }\n\n if ($set[11] == 2 && $set[10] == 2) {\n $eintrag = preg_replace('#\\[img\\](.*)\\[/img\\]#isU', '<a href=\"$1\" title=\"$1\" target=\"_top\"><img src=\"$1\" alt=\"$1\"></a>', $eintrag);\n $eintrag = preg_replace('#\\[img=(.*)\\](.*)\\[/img\\]#isU', '<a href=\"$1\" title=\"$2\" target=\"_top\"><img src=\"$1\" alt=\"$2\"></a>', $eintrag);\n } else {\n if ($set[11] == 2) {\n $eintrag = preg_replace('#\\[img\\](.*)\\[/img\\]#isU', '<a href=\"$1\" title=\"$1\" target=\"_blank\"><img src=\"$1\" alt=\"$1\"></a>', $eintrag);\n $eintrag = preg_replace('#\\[img=(.*)\\](.*)\\[/img\\]#isU', '<a href=\"$1\" title=\"$2\" target=\"_blank\"><img src=\"$1\" alt=\"$2\"></a>', $eintrag);\n } else {\n if ($set[11] == 1) {\n $eintrag = preg_replace('#\\[img\\](.*)\\[/img\\]#isU', '<img src=\"$1\" alt=\"$1\">', $eintrag);\n $eintrag = preg_replace('#\\[img=(.*)\\](.*)\\[/img\\]#isU', '<img src=\"$1\" alt=\"$2\">', $eintrag);\n }\n }\n }\n\n if ($set[7] == 1) {\n $eintrag = preg_replace('#\\[mail\\](.*)\\[/mail\\]#isU', '<a href=\"mailto:$1\" target=\"_blank\" title=\"Mail an: $1\">$1</a>', $eintrag);\n $eintrag = preg_replace('#\\[mail=(.*)\\](.*)\\[/mail\\]#isU', '<a href=\"mailto:$1\" target=\"_blank\" title=\"Mail an: $1\">$2</a>', $eintrag);\n }\n\n if ($set[13] == 1) {\n $eintrag = preg_replace('#\\[list\\](.*)\\[/list\\]#isU', '<ul>$1</ul>', $eintrag);\n $eintrag = preg_replace('#\\[list=(1|a|A|i|I)\\](.*)\\[/list\\]#isU', '<ol type=\"$1\">$2</ol>', $eintrag);\n $eintrag = str_replace('[&#042;]', '<li>', $eintrag);\n }\n\n $width = 575;\n while (preg_match('#\\[quote\\](.*)\\[/quote\\]#isU', $eintrag)) {\n $width -= 10;\n $eintrag = preg_replace('#\\[quote\\](.*)\\[/quote\\]#isU', \"<div class=\\\"zitatmeldung\\\" style=\\\"width: $width px\\\">Zitat:</div><div style=\\\"width: $width px\\\" class=\\\"zitat\\\">$1</div>\",\n $eintrag);\n }\n\n $width = 575;\n while (preg_match('#\\[quote=(.*)\\](.*)\\[/quote\\]#isU', $eintrag)) {\n $width -= 10;\n $eintrag = preg_replace('#\\[quote=(.*)\\](.*)\\[/quote\\]#isU',\n \"<div style=\\\"font-style:normal; font-weight:bold; background-color:lightskyblue; color:black; border:solid 1px black; width: $width px\\\">Zitat von $1:</div><div style=\\\"color:#101010; font-style:normal; background-color:white; border:solid 1px black; margin:0px auto; margin-left:5px; width: $width px\\\">$2</div>\",\n $eintrag);\n }\n\n if ($set[9] == 1) {\n $eintrag = preg_replace('#\\[(ironie|iron)\\](.*)\\[/(ironie|iron)\\]#isU',\n '<span style=\"text-weight:bold; background-color:#FFFF00\"><img src=\"http://www.my-smileys.de/smileys3/annieironie.gif\" alt=\"Ironie!\" width=44 height=46>$2<img src=\"http://www.my-smileys.de/smileys3/annieironie.gif\" alt=\"Ironie!\" width=44 height=46></span>',\n $eintrag);\n }\n\n if ($set[8] == 1) {\n while (preg_match('#\\[(tab|table)\\](.*)\\[/(tab|table)\\]#isU', $eintrag)) {\n $eintrag = preg_replace('#\\[(tab|table)\\](.*)\\[/(tab|table)\\]#isU',\n '<table width=90% bgcolor=white border bordercolordark=black bordercolorlight=gray><tbody><tr><td>$2</td></tr></tbody></table>', $eintrag);\n $eintrag = preg_replace('#\\[(tab|table)=(hide|hidden|structure)\\](.*)\\[/(tab|table)\\]#isU', '<table border=0 rules=none><tbody><tr><td>$3</td></tr></tbody></table>', $eintrag);\n $eintrag = preg_replace('#\\[(tab|table)=(all|cols|rows|none)\\](.*)\\[/(tab|table)\\]#isU',\n '<table width=90% bgcolor=white border bordercolordark=black bordercolorlight=gray rules=\"$2\"><tbody><tr><td>$3</td></tr></tbody></table>', $eintrag);\n $eintrag = preg_replace('#\\[(tab|table)=(.*)\\](.*)\\[/(tab|table)\\]#isU',\n '<table width=90% bgcolor=$2 border bordercolordark=black bordercolorlight=gray rules=all><tbody><tr><td>$3</td></tr></tbody></table>', $eintrag);\n }\n $eintrag = eregi_replace('\\[(row|zeile|z|tr)\\]', '<tr><td>', $eintrag);\n $eintrag = preg_replace('#\\[(row|zeile|z|tr)=(.*)\\]#isU', '<tr><td rowspan=$2>', $eintrag);\n $eintrag = eregi_replace('\\[(col|spalte|sp|td)\\]', '<td>', $eintrag);\n $eintrag = preg_replace('#\\[(col|spalte|sp|td)=(.*)\\]#isU', '<td colspan=$2>', $eintrag);\n }\n\n if ($set[19] == 1) {\n $eintrag = clearCode($eintrag);\n }\n\n return $eintrag;\n}", "public static function make($config = array())\n\t{\n\t\treturn new static($config);\n\t}", "public function phpCaptcha($config = array())\n {\n if (!function_exists('gd_info')) {\n throw new Exception('Required GD library is missing');\n }\n\n $bg_path = BASEPATH . '/web/captcha/backgrounds/';\n\n // Default values\n $captcha_config = array(\n 'code' => '',\n 'min_length' => CAPTCHA_CONFIG['min_length'],\n 'max_length' => CAPTCHA_CONFIG['max_length'],\n 'backgrounds' => array(\n $bg_path . '45-degree-fabric.png',\n $bg_path . 'cloth-alike.png',\n $bg_path . 'grey-sandbag.png',\n $bg_path . 'kinda-jean.png',\n $bg_path . 'polyester-lite.png',\n $bg_path . 'stitched-wool.png',\n $bg_path . 'white-carbon.png',\n $bg_path . 'white-wave.png',\n ),\n 'fonts' => self::$font_array,\n 'characters' => CAPTCHA_CONFIG['characters'],\n 'min_font_size' => CAPTCHA_CONFIG['phpOption']['min_font_size'],\n 'max_font_size' => CAPTCHA_CONFIG['phpOption']['max_font_size'],\n 'color' => self::$colorArray[rand(0, 6)]\n ,\n 'angle_min' => 1,\n 'angle_max' => 12,\n 'shadow' => true,\n 'shadow_color' => '#fff',\n 'shadow_offset_x' => -1,\n 'shadow_offset_y' => 1,\n );\n\n // Overwrite defaults with custom config values\n if (is_array($config)) {\n foreach ($config as $key => $value) {\n $captcha_config[$key] = $value;\n }\n\n }\n\n // Restrict certain values\n if ($captcha_config['min_length'] < 1) {\n $captcha_config['min_length'] = 1;\n }\n\n if ($captcha_config['angle_min'] < 0) {\n $captcha_config['angle_min'] = 0;\n }\n\n if ($captcha_config['angle_max'] > 12) {\n $captcha_config['angle_max'] = 12;\n }\n\n if ($captcha_config['angle_max'] < $captcha_config['angle_min']) {\n $captcha_config['angle_max'] = $captcha_config['angle_min'];\n }\n\n if ($captcha_config['min_font_size'] < 10) {\n $captcha_config['min_font_size'] = 10;\n }\n\n if ($captcha_config['max_font_size'] < $captcha_config['min_font_size']) {\n $captcha_config['max_font_size'] = $captcha_config['min_font_size'];\n }\n\n // Generate CAPTCHA code if not set by user\n if (empty($captcha_config['code'])) {\n $captcha_config['code'] = '';\n $length = mt_rand($captcha_config['min_length'], $captcha_config['max_length']);\n while (strlen($captcha_config['code']) < $length) {\n $captcha_config['code'] .= substr($captcha_config['characters'], mt_rand() % (strlen($captcha_config['characters'])), 1);\n }\n }\n\n // Generate HTML for image src\n if (strpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['DOCUMENT_ROOT'])) {\n $image_src = substr(__FILE__, strlen(realpath($_SERVER['DOCUMENT_ROOT']))) . '?_CAPTCHA&amp;t=' . urlencode(microtime());\n $image_src = '/' . ltrim(preg_replace('/\\\\\\\\/', '/', $image_src), '/');\n } else {\n $_SERVER['WEB_ROOT'] = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME']);\n $image_src = substr(__FILE__, strlen(realpath($_SERVER['WEB_ROOT']))) . '?_CAPTCHA&amp;t=' . urlencode(microtime());\n $image_src = '/' . ltrim(preg_replace('/\\\\\\\\/', '/', $image_src), '/');\n }\n\n $_SESSION['_CAPTCHA']['config'] = serialize($captcha_config);\n\n return [\n 'code' => $captcha_config['code'],\n 'image_src' => BASEURL . 'captcha/showPhp?_CAPTCHA&amp;t=' . urlencode(microtime()),\n ];\n }", "protected function evalConfig($config)\n {\n if (is_null($config)) {\n $config = [];\n }\n\n /*\n * Standard config:property values\n */\n $applyConfigValues = [\n 'commentHtml',\n 'placeholder',\n 'dependsOn',\n 'required',\n 'disabled',\n 'cssClass',\n 'stretch',\n 'context',\n 'hidden',\n 'trigger',\n 'preset',\n 'path',\n ];\n\n foreach ($applyConfigValues as $value) {\n if (array_key_exists($value, $config)) {\n $this->{$value} = $config[$value];\n }\n }\n\n /*\n * Custom applicators\n */\n if (isset($config['options'])) {\n $this->options($config['options']);\n }\n if (isset($config['span'])) {\n $this->span($config['span']);\n }\n if (isset($config['size'])) {\n $this->size($config['size']);\n }\n if (isset($config['tab'])) {\n $this->tab($config['tab']);\n }\n if (isset($config['commentAbove'])) {\n $this->comment($config['commentAbove'], 'above');\n }\n if (isset($config['comment'])) {\n $this->comment($config['comment']);\n }\n if (isset($config['default'])) {\n $this->defaults = $config['default'];\n }\n if (isset($config['defaultFrom'])) {\n $this->defaultFrom = $config['defaultFrom'];\n }\n if (isset($config['attributes'])) {\n $this->attributes($config['attributes']);\n }\n if (isset($config['containerAttributes'])) {\n $this->attributes($config['containerAttributes'], 'container');\n }\n\n if (isset($config['valueFrom'])) {\n $this->valueFrom = $config['valueFrom'];\n }\n else {\n $this->valueFrom = $this->fieldName;\n }\n\n return $config;\n }", "static public function factory($config);", "public static function create($config = [])\n {\n return new static($config);\n }" ]
[ "0.5417821", "0.5400969", "0.5382368", "0.53491443", "0.53491443", "0.53491443", "0.5339357", "0.53126884", "0.525476", "0.5198071", "0.51962745", "0.51802623", "0.51134306", "0.5051448", "0.5044781", "0.5029311", "0.49905416", "0.49825865", "0.49781707", "0.49611014", "0.49507937", "0.4948146", "0.49397784", "0.4936551", "0.49247745", "0.48384255", "0.4825747", "0.4825305", "0.48182496", "0.48165947" ]
0.72759616
0
Apply all the configured rules to the provided text and return the result
public function apply($txt) { if (!is_string($txt)) throw new \RuntimeException("Argument should be a string"); foreach ($this->rules as $pattern => $replacement) { if (is_callable($replacement)) $txt = preg_replace_callback($pattern, $replacement, $txt); else $txt = preg_replace($pattern, $replacement, $txt); } return $txt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function apply($text);", "public function apply(string $text): string;", "public static function apply($text) {\r\n\t\t$ret = $text;\r\n\t\tforeach(self::$placeholders as $placeholder) {\r\n\t\t\t$ret = $placeholder->apply($ret);\r\n\t\t}\r\n\t\treturn $ret;\r\n\t}", "protected function parseText($text)\n {\n }", "function Process($result, $text, $scope) {\n\n $pre = '%(?<=^|[!\\^()+=\\[\\]{}\"\\'<>?,.\\s])';\n $mid = '([^<>\\r\\n]*?)';\n $post = '(?=[!\\^()+=\\[\\]{}\"\\'<>?,.\\s]|$)%imu';\n\n // Bold\n $text = preg_replace(\"{$pre}\\*{$mid}\\*{$post}\", '<strong>$1</strong>', $text);\n\n // Italics\n $text = preg_replace(\"{$pre}/{$mid}/{$post}\", '<em>$1</em>', $text);\n\n // Underline\n $text = preg_replace(\"{$pre}_{$mid}_{$post}\", '<span class=\"underline\">$1</span>', $text);\n\n // Strikethrough\n $text = preg_replace(\"{$pre}-{$mid}-{$post}\", '<span class=\"strikethrough\">$1</span>', $text);\n\n // Code\n $text = preg_replace(\"{$pre}`{$mid}`{$post}\", '<code>$1</code>', $text);\n\n return $text;\n }", "public function run()\n {\n RulesManual::create([\n 'text' => '<p>Nulla aliquet turpis non ultricies varius. Mauris molestie faucibus cursus. Morbi pharetra, erat posuere porttitor ultrices, dui ante euismod neque, ac varius orci quam non nisi. Ut euismod vehicula mi, ut gravida justo vulputate eget. Nam ac ultricies sem, ut venenatis turpis. Etiam ac leo turpis. Duis lacinia orci sit amet purus euismod sodales in ut est.</p><p>Fusce non euismod erat. Donec quis mi sit amet sapien feugiat laoreet non ut sem. Maecenas eleifend laoreet metus, sit amet molestie nulla porta at. Nam finibus dapibus sodales. Pellentesque nisl mauris, lobortis ut orci in, aliquam tempor turpis. Cras tempor et urna vitae sodales. Ut non nunc vehicula metus sagittis congue eget placerat mauris.</p>'\n ]);\n }", "public static function filter($text) {\n $text = self::setLinks($text);\n return $text;\n }", "public function process()\n {\n foreach ($this->text as $key1 => $parts) {\n foreach ($parts as $key2 => $char) {\n foreach ($this->filters as $function_name) {\n call_user_func_array(array($this, $function_name), array($key1,$key2));\n }\n }\n }\n }", "public function applyTextFilters($string) {\n\n // Apply the textfilters (let's reuse Joomla's ContentHelper class)\n if (!class_exists('ContentHelper')) {\n require_once JPATH_SITE . '/administrator/components/com_content/helpers/content.php';\n }\n\n return ContentHelper::filterText((string) $string);\n }", "abstract public function rules();", "abstract public function rules();", "abstract public function rules();", "abstract public function rules();", "private function addConditionForText() {\n if (substr(trim($this->input['text']), 0, 1) == '#') {\n \t // looking for an article uid?\n \t\t$uid = intval(substr(trim($this->input['text']), 1));\n \t\tif (trim($this->input['text']) == '#' . $uid) {\n \t\t\t// text contains a query like #[int], so search for this uid ONLY\n \t\t\t$this->table_references = array('tx_newspaper_article');\n \t\t\t$this->where = array('uid=' . $uid);\n return self::TEXT_SEARCH_FOR_UID;\n \t\t}\n \t}\n\n // Search for all terms divided by a space character\n // So \"demo example\" finds all articles with both the \"demo\" AND \"example\" somewhere in the article\n $wherePart = array();\n foreach(t3lib_div::trimExplode(' ', $this->input['text']) as $term) {\n $wherePart[] = '(' .\n 'title LIKE \"%' . addslashes($term) . '%\" OR ' .\n 'kicker LIKE \"%' . addslashes($term) . '%\" OR ' .\n 'teaser LIKE \"%' . addslashes($term) . '%\" OR ' .\n 'bodytext LIKE \"%' . addslashes($term) . '%\"' .\n ')';\n }\n\n $this->addWhere(implode(' AND ', $wherePart));\n return self::TEXT_SEARCH_FOR_TEXT;\n }", "public function applyRuleToContent(string $content) : bool;", "public function apply($content);", "public static function parse($text);", "public function compute($text)\n {\n return metaphone($text);\n }", "abstract protected function rules();", "public function apply($text, $data) {\n\t\tforeach ($this->_macros as $macro) {\n\t\t\t$text = $macro['macro']->apply($text, $data);\n\t\t}\n\n\t\treturn $text;\n\t}", "private function parse($text)\n {\n $unwantedChars = array(\n ',', '!', '?', '.', ']', '[', '!', '\"', '#', '$', '%', '&', '\\'', '(', ')', '*', '+', '/', ':', ';', '<',\n '=', '>', '?', '^', '{', '|', '}', '~', '-', '@', '\\', ', '_', '`',' (', ') '\n );\n\n $str = str_replace($unwantedChars, ' ', $text);\n\n //var_dump($str);\n\n $reulst = $this->ansyWord($str);\n\n //var_dump($reulst);\n\n return $reulst;\n\n\n\n $array = explode(\" \", $str);\n $array = array_map('trim', $array);\n $array = array_unique($array);\n $array = array_values($array);\n\n $clean = array();\n\n\n foreach ($array as $k)\n if ($this->startsWithUppercase($k))\n $clean[ ] = $k;\n\n return array_values($clean);\n }", "function process_text($text) {\n //replace astersiked rows as unordered lists\n $return = preg_replace(\"/_([^_]*)_/\",'<em>$1</em>',$text);\n $return = preg_replace(\"/\\[ahfow:show_id=([0-9]+)\\]/\",'<a href=\"'. site_url('/database/gigography/show/$1/test') . '\">show details</a>', $return);\n $return = preg_replace(\"/(\\<\\/ul\\>\\n(.*)\\<ul\\>*)+/\",\"\",preg_replace(\"/\\*+(.*)?/i\",\"<ul><li>$1</li></ul>\",$return));\n $return = preg_replace(\"/\\[([^|]*)\\|([^\\]]*)]/\", \"<a href=\\\"$2\\\">$1</a>\", $return);\n \n \n \n return $return;\n}", "abstract public function accept($text);", "function applyRule1(string $word = \"\"): string\n{\n return addAy($word);\n}", "public static function parse($text) {\n\t\tself::$text = $text;\n\t\t\n\t\t// cache codes\n\t\tself::$text = self::cacheCodes(self::$text);\n\t\t\n\t\t// call event\n\t\tEventHandler::fireAction('URLParser', 'shouldParse');\n\t\t\n\t\t// define pattern\n\t\t$urlPattern = '~(?<!\\B|\"|\\'|=|/|\\]|,|\\?)\n\t\t\t(?:\t\t\t\t\t\t# hostname\n\t\t\t\t(?:ftp|https?)://'.self::$illegalChars.'(?:\\.'.self::$illegalChars.')*\n\t\t\t\t|\n\t\t\t\twww\\.(?:'.self::$illegalChars.'\\.)+\n\t\t\t\t(?:[a-z]{2,4}(?=\\b))\n\t\t\t)\n\n\t\t\t(?::\\d+)?\t\t\t\t\t# port\n\n\t\t\t(?:\n\t\t\t\t/\n\t\t\t\t[^!.,?;\"\\'<>()\\[\\]{}\\s]*\n\t\t\t\t(?:\n\t\t\t\t\t[!.,?;(){}]+ [^!.,?;\"\\'<>()\\[\\]{}\\s]+\n\t\t\t\t)*\n\t\t\t)?\n\t\t\t~ix';\n\t\t\t\n\t\t$emailPattern = '~(?<!\\B|\"|\\'|=|/|\\]|,|:)\n\t\t\t(?:)\n\t\t\t\\w+(?:[\\.\\-]\\w+)*\n\t\t\t@\n\t\t\t(?:'.self::$illegalChars.'\\.)+\t\t# hostname\n\t\t\t(?:[a-z]{2,4}(?=\\b))\n\t\t\t(?!\"|\\'|\\[|\\-|\\.[a-z])\n\t\t\t~ix';\n\t\t\n\t\t// add url tags\n\t\tself::$text = preg_replace($urlPattern, '[url]\\\\0[/url]', self::$text);\n\t\tif (StringUtil::indexOf(self::$text, '@') !== false) self::$text = preg_replace($emailPattern, '[email]\\\\0[/email]', self::$text);\n\t\n\t\t// call event\n\t\tEventHandler::fireAction('URLParser', 'didParse');\n\t\t\n\t\tif (count(self::$cachedCodes) > 0) {\n\t\t\t// insert cached codes\n\t\t\tself::$text = self::insertCachedCodes(self::$text);\n\t\t}\n\t\t\n\t\treturn self::$text;\n\t}", "public function parse($text)\n {\n $text = parent::parse($text);\n $text = trim($text);\n $text = preg_replace(\"/\\r?\\n\\r?\\n+/s\", \"\\n\\n\", $text);\n\n return $text;\n }", "public function transform($text) {\n $text = parent::transform($text);\n return $text;\n }", "public function parse($text) {\n\t\treturn $this->_Parser->parse($text);\n\t}", "abstract public function resolveText($text): string;", "public static function parseText($text)\n {\n// Rays::import(\"application.vendors.php-markdown.Michelf.Markdown_inc\");\n// return \\Michelf\\Markdown::defaultTransform($text);\n\n Rays::import(\"application.vendors.php-markdown.Michelf.MarkdownExtra_inc\");\n return MarkdownExtra::defaultTransform($text);\n }" ]
[ "0.74245614", "0.66121256", "0.6360462", "0.58761394", "0.5865514", "0.5754427", "0.5722253", "0.5629615", "0.562642", "0.55733573", "0.55733573", "0.55733573", "0.55733573", "0.55494386", "0.55453205", "0.5543787", "0.5541518", "0.55181974", "0.5454873", "0.54535085", "0.5409232", "0.5383179", "0.5379431", "0.53628343", "0.5338748", "0.53184164", "0.5308118", "0.53019863", "0.52998686", "0.5299604" ]
0.6795389
1
Run queued content task.
public function run_queue();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run(): void\n {\n $this->downloadChunk->run();\n }", "public function run_task(){\n\t $data = $this->send_get();\n if ($data){\n $this->send_post($data, $data[\"date\"]);\n }\n }", "public function runQueue()\n {\n while (true) {\n $container = $this->getStorage()->dequeue($this->id);\n if (null === $container) {\n break;\n }\n\n if ($this->getOutboundPolicy()->isReadyToResend($container)) {\n $raw = $container->getData();\n $data = $this->getSerializer()->unserialize($raw);\n $this->transfer($data);\n }\n }\n }", "public function execute()\n {\n $queue = $this->container->getDelayedExecutionTaskQueue();\n if($queue->length() == 0){\n return;\n }\n ignore_user_abort(true);\n $queue->execute();\n }", "public function execute() {\n\t\treturn $this->content = $this->request->wasPosted() ? $this->processSubmission() : $this->buildContent();\n\t}", "public function dispatch_queue() {\n\t\tif ( ! empty( $this->data ) ) {\n\t\t\t$this->save()->dispatch();\n\t\t}\n\t}", "public function run()\n {\n $this->Execute();\n }", "public function run()\r\n {\r\n\r\n return $this->dispatch();\r\n\r\n }", "public function run()\n {\n $this->worker->setUrl($this->url);\n $this->title = $this->worker->go();\n }", "public function execute()\n\t{\n\t\t$this->run();\n\t}", "public function runQueue() {\r\n\t\tif (count($this->queue) > 0) {\r\n\t\t\t$this->startBatch($this->queue);\r\n\t\t\t$this->queue = [];\r\n\t\t}\r\n\t}", "public function run()\n {\n $this->registerOurself();\n $this->connectToQueue();\n }", "public function dispatch()\n {\n RunStackTask::dispatch($this);\n }", "public function execute()\n\t{\n\t\tglobal $Mysql, $Memcached, $User;\n\t\t\n\t\t// Begin capturing output to a buffer.\n\t\tob_start();\n\t\t// Include the specified \"content\" file.\n\t\tinclude(WEBROOT .'content/'. $this->name .'.php');\n\t\t// Save buffer contents and clear buffer.\n\t\t$this->content_html = ob_get_clean();\n\t\t\n\t\t// note: the content file included above may change: \n\t\t//\t\t $this->layout, $this->page_title, $this->meta_description, etc.\n\t}", "public function getContent($rundata) { }", "public function execute()\n\t{\n\t\t$this->registerTask('success_story', 'story');\n\n\t\tparent::execute();\n\t}", "public function run()\n {\n DB::table('content')->insert([\n [ \n 'transaksi_id' => 1,\n 'paket_id' => 1,\n 'playlist_id' => 1,\n 'user_id' => 1,\n 'status' => 0,\n 'startTayang' => Carbon\\Carbon::now(),\n 'endTayang' => Carbon\\Carbon::now(),\n 'numberFile' => '69',\n 'typeFile' => 1,\n 'urlFile' => 'trial.arbasignage.com/dummy',\n 'orderFile' => 111,\n ]\n ]);\n }", "public function run( ){\n\n\t\t\n\n\t\t// $settings = $this->plugin->get('fetcher')->get_settings();\n\t\t// list($header, $msg, $isPosted) = $this->plugin->get('restApi')->doBigContent($settings['cron_key']);\n\n\t\t// Register the rest route here.\n\t\tadd_action( 'rest_api_init', function () {\n\t\t\t\t\n\t\t\t\t// register_rest_route( 'oto-post/v1', 'post-now',array(\n\t\n\t\t\t\t// \t'methods' => 'GET',\n\t\t\t\t// \t'callback' => array($this, 'routeBigContent')\n\t\n\t\t\t\t// ) );\n \n\t\t\t\t// register_rest_route( 'oto-post/v1', 'post-now-2',array(\n\t\n\t\t\t\t// \t'methods' => 'GET',\n\t\t\t\t// \t'callback' => array($this, 'routeEzineMark')\n\t\n\t\t\t\t// ) );\n\n\t\t} );\n\t\t\n }", "public function execute()\n {\n try {\n $currentStore = $this->storeManager->getStore()->getId();\n $currentPage = 1;\n do {\n $quoteCollection = $this->createCollection($currentPage);\n $this->logger->debug('Fetched quote collection to cancel');\n foreach ($quoteCollection as $quote) {\n $this->processQuote($quote);\n usleep(1000000); //delay for 1 second\n }\n $currentPage++;\n } while ($currentPage <= $quoteCollection->getLastPageNumber());\n } finally {\n $this->storeManager->setCurrentStore($currentStore);\n }\n }", "public function enqueue() {}", "public function enqueue() {}", "public function enqueue() {}", "public function enqueue();", "public function run()\n\t{\n\t\tforeach ( $this->data as $source ) {\n\t\t\tTask::create($source);\n\t }\n\t}", "protected function doExecute()\n\t{\n\n\t\t$config = JFactory::getConfig();\n\t\t$this->dbo = JFactory::getDbo();\n\t\t$this->session = JFactory::getSession();\n\t\tJFactory::$application = $this;\n\t\ttry\n\t\t{\n\t\t\t// Storing the default in the configuration for now.\n\t\t\t$default = $config->get('default');\n\t\t\t$defaulttype = $config->get('defaulttype');\n\t\t\t$type = $this->input->get('type');\n\t\t\t$task = $this->input->get('task');\n\t\t\t$content_id = $this->input->get('content_id');\n\t\t\t$factory = JContentFactory::getInstance();\n\t\t\t// This navigation is going to be loaded for all pages.\n\t\t\t$topnav = $factory->getContent('Navigation')->load(1510);\n\t\t\t$sidenav = $factory->getContent('Navigation')->load(1518);\n\t\t\tif (!$task)\n\t\t\t{\n\t\t\t\tif ($type && $content_id)\n\t\t\t\t{\n\t\t\t\t\t$content = $factory->getContent($type)->load($content_id);\n\t\t\t\t}\n\t\t\t\tif (!$content_id && !$type || !isset($content) )\n\t\t\t\t{\n\t\t\t\t\t$content = $factory->getContent($defaulttype)->load($default);\n\t\t\t\t}\n\t\t\t\telseif (!$type && $content_id)\n\t\t\t\t{\n\t\t\t\t\t$content = $factory->getContent($defaulttype)->load($content_id);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\tcatch (RuntimeException $e)\n\t\t{\n\t\t\t// handle error\n\t\t}\n\n\t\t$this->setBody(\n\t\t\t'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">'\n\t\t);\n\t\t$this->appendBody('<html>\n\t\t\t\t<head>\n\t\t\t\t\t<link rel=\"stylesheet\" href=\"themes/simplecontent/css/template.css\" type=\"text/css\" />\n\t\t\t\t\t<link rel=\"stylesheet\" href=\"themes/simplecontent/css/bootstrap/css/bootstrap.css\" type=\"text/css\" />\n\t\t\t\t\t<title>Hello UCM! ');\n\t\tif (isset($content))\n\t\t{\n\t\t\t\t\t$this->appendBody( $content->title);\n\t\t}\n\t\t\t\t$this->appendBody('</title>\n\t\t\t\t</head>\n\t\t\t\t<body >');\n\t\t\t\t$this->appendBody(\n\t\t\t\t\t'<div class=\"navbar navbar span10 offset2\">\n\t\t\t\t\t<div class=\"navbar-inner\">\n\t\t\t\t\t<div class=\"container\">');\n\t\t\t\t\t\t$this->appendBody( $topnav->body );\n\t\t\t\t\t$this->appendBody('</div></div></div>');\n\t\t\t\t\t$this->appendBody('<div class=\"clear\"></div>');\n\t\t\t$this->appendBody('<div class=\"container-fluid\">');\n\t\t\t$this->appendBody('<div class=\"span2\" >');\n\t\t\t$this->appendBody('<div id=\"page-nav\" class=\"well sidebar-nav\">');\n \t\t\t$this->appendBody( $sidenav->body );\n\t\t\t$this->appendBody('</div></div>');\n\t\t\t$this->appendBody('<div class=\"span8\">');\n\t\t\tif ($task == 'create')\n\t\t\t{\n\t\t\t\tinclude_once ('create.php');\n\t\t\t}\n\t\t\tif ($task == 'update')\n\t\t\t{\n\t\t\t\tinclude_once ('update.php');\n\t\t\t}\n\t\t\tif ($task == 'save')\n\t\t\t{\n\t\t\t\tinclude_once ('save.php');\n\t\t\t}\n\t\tif (!$task)\n\t\t{\n\t\t\t// Need ACL here\n\t\t\t$this->appendBody('<a href=\"index.php?type='.$type. '&content_id='.$content_id.'&task=update\">JEdit</a>');\n\t\t\t$this->appendBody(' <a href=\"index.php?type='.$type. '&task=create\">JNew '. ucfirst($type) . '</a>');\n\n\t\t\t$typefile = dirname(__FILE__) .'/views/'.$type .'.php';\n\t\t\tif (file_exists($typefile)){\n\t\t\t\tinclude_once ($typefile);\n\t\t\t\t$this->appendBody('</div>');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->appendBody('<h1>'. $content->title . '</h1>')\n\t\t\t\t->appendBody($content->body);\n\t\t\t\t$this->appendBody('</div>');\n\t\t\t}\n\t\t}\n\t\t\t$this->appendBody('<div class=\"span2\"></div>');\n\t\t\t$this->appendBody('</div >')\n\t\t\t->appendBody('</div ></div >')\n\t\t\t->appendBody('</body></html>');\n\n\t}", "public function run() {\n\t\t$settings = new SettingsHelper(db()->setting);\n\n\t\t/*\n\t\t * Prepare the keys. This allows the tasks to defer behavior to another \n\t\t * server when needed.\n\t\t */\n\t\t$keys = new KeyHelper(db(), $settings->read('uniqid'), $settings->read('pubkey'), $settings->read('privkey'));\n\n\t\t/*\n\t\t * Initialize the task dispatcher. This object is in charge of fetching the\n\t\t * tasks.\n\t\t */\n\t\t$dispatcher = new TaskDispatcher($keys);\n\t\t\n\t\t$run = [\n\t\t\t cloudy\\task\\DiscoveryTask::class,\n\t\t\t cloudy\\task\\LeaderDiscoveryTask::class,\n\t\t\t cloudy\\task\\TopographyTask::class,\n\t\t\t cloudy\\task\\QueueHealthCheckTask::class,\n\t\t\t \n\t\t\t cloudy\\task\\CleanupFileTask::class,\n\t\t\t cloudy\\task\\CleanupRevisionTask::class,\n\t\t\t cloudy\\task\\CleanupMediaTask::class,\n\t\t\t cloudy\\task\\CleanupLinkTask::class\n\t\t];\n\t\t\n\t\tforeach ($run as $t) {\n\t\t\t$task = $dispatcher->get($t);\n\t\t\t$dispatcher->send(db()->table('server')->get('uniqid', $settings->read('uniqid'))->first(true), $task);\n\t\t\tsleep(30);\n\t\t}\n\t\t\n\t}", "public function run();", "public function run();", "public function run();", "public function run();" ]
[ "0.596205", "0.593721", "0.58845747", "0.5851371", "0.5800125", "0.57858634", "0.5746288", "0.5741068", "0.57204163", "0.57161057", "0.5687609", "0.5675343", "0.56734663", "0.56581837", "0.56551856", "0.5652505", "0.56522256", "0.56157583", "0.5615003", "0.5592337", "0.5592337", "0.5592337", "0.55651826", "0.55639327", "0.55286825", "0.55221415", "0.54809076", "0.54809076", "0.54809076", "0.54809076" ]
0.64164615
0