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
Move Array Item (Key/Value) to bottom of Array
static function array_to_bottom($array, $key, $value_instead = false) { if ($value_instead) { if (($array_key = array_search($key, $array)) !== false) { unset($array[$array_key]); } array_push($array,$key); } else { $value = $array[$key]; unset($array[$key]); array_push($array, $value); } return $array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function acadp_array_insert_after( $key, $array, $new_array ) {\n\n\tif( array_key_exists( $key, $array ) ) {\n \t$new = array();\n \tforeach( $array as $k => $value ) {\n \t\t$new[ $k ] = $value;\n \t\tif( $k === $key ) {\n\t\t\t\tforeach( $new_array as $new_key => $new_value ) {\n \t\t\t$new[ $new_key ] = $new_value;\n\t\t\t\t}\n \t\t}\n \t}\n \treturn $new;\n \t}\n\n \treturn $array;\n\n}", "static function array_to_top($array, $key, $value_instead = false) {\n\n\t\tif ($value_instead) {\n\t\t\tif (($array_key = array_search($key, $array)) !== false) {\n\t\t\t\tunset($array[$array_key]);\n\t\t\t}\n\t\t\tarray_unshift($array , $key);\n\t\t}\n\t\telse {\n\t\t\t$value = array($key => $array[$key]);\n\t\t\tunset($array[$key]);\n\t\t\t$array = $value + $array;\n\t\t}\n\n\t\treturn $array;\n\t}", "public function array_put_to_position() {\n $count = 0;\n $return = array();\n foreach ($this->array as $k => $v) {\n // insert new object\n if ($count == $this->position) {\n if (!$this->name)\n $name = $count;\n $return[$name] = $this->object;\n $inserted = true;\n }\n // insert old object\n $return[$k] = $v;\n $count++;\n }\n if (!$name)\n $name = $count;\n if (!$inserted)\n $return[$name];\n $array = $return;\n return $array;\n }", "public function arrayMove(&$array, $key) {\n\t\tif(!array_key_exists($key, $array)) {\n\t\t\tthrow new Exception('Key '.$key.' not found from '.\n\t\t\t\t$this->className.'->'.__FUNCTION__.'() line '.__LINE__\n\t\t\t);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t$append = $array[$key];\n\t\t\t\tarray_splice($array, $key, 1);\n\t\t\t\tarray_unshift($array, $append);\n\t\t\t} catch (Exception $e) { \n\t\t\t\tthrow new Exception($e->getMessage().' from '.$this->className\n\t\t\t\t\t.'->'.__FUNCTION__.'() line '.__LINE__\n\t\t\t\t);\n\t\t\t} //<-- end try -->\n\t\t} //<-- end if -->\n\t}", "function unshift(array & $array, $key, $val) {\n $array = array_reverse($array, TRUE);\n $array[$key] = $val;\n $array = array_reverse($array, TRUE);\n\n return $array;\n}", "function arrayShift($array) {\n\n unset($array[0]);\n return $array;\n}", "public static function array_insert_after($key, array &$array, $new_key, $new_value) {\n if (array_key_exists ($key, $array)) {\n $new = array();\n foreach ($array as $k => $value) {\n $new[$k] = $value;\n if ($k === $key) {\n $new[$new_key] = $new_value;\n }\n }\n return $new;\n }\n return $array;\n }", "function moveElementToEnd(array $arr, int $value): array\n{\n\t$cnt = count($arr);\n\t$i = 0;\n\t$j = $cnt - 1;\n\twhile ($i < $j)\n\t{\n\t\tif ($arr[$j] == $value)\n\t\t{\n\t\t\t$j--;\n\t\t}\n\t\tif ($arr[$i] == $value)\n\t\t{\n\t\t\t$temp = $arr[$j];\n\t\t\t$arr[$j] = $arr[$i];\n\t\t\t$arr[$i] = $temp;\n\t\t}\n\t\t$i++;\n\t}\n\treturn $arr;\n\n}", "public static function insertAfterKey(&$array, $key, $newKey, $newValue) {\n $newArray = [];\n $has_found = FALSE;\n\n foreach ($array as $_key => $_item) {\n $newArray[$_key] = $_item;\n\n if ($_key === $key) {\n $has_found = TRUE;\n $newArray[$newKey] = $newValue;\n }\n }\n\n if (!$has_found) {\n $newArray[$newKey] = $newValue;\n }\n\n $array = $newArray;\n }", "public function inserirFinal(array &$array, $item)\n\t{\n\t\t$array[] = $item;\n\t}", "function array_shift_over($array, $index) {\n\n $size = sizeof($array);\n if($index >= $size || $index < 0) {\n return $array;\n } else {\n for($i=$index;$i<$size;$i++) {\n if($i === ($size-1)) {\n unset($array[$i]);\n } else {\n $array[$i] = $array[$i+1];\n }\n }\n }\n return $array;\n}", "public function mvUp(array &$array, string $path): void\n {\n // Build the path object\n $pathObject = new PropertyPath($path);\n\n // get the values to move one level up\n $values = $this->pa->getValue($array, $path);\n\n // Remove the key to move one level up\n $this->rm($array, $path);\n\n /*\n * Fails on\n * - phpstan (ubuntu-latest, 8.0, --prefer-stable --prefer-lowest, ~3.4)\n * - phpstan (ubuntu-latest, 7.3, --prefer-stable --prefer-lowest, ~3.4)\n * - phpstan (ubuntu-latest, 7.4, --prefer-stable --prefer-lowest, ~3.4)\n *\n * @phpstan-ignore-next-line\n */\n $parentPath = $pathObject->getParent() ?? '[]';\n\n // Get the values of the up level\n $parentValues = $this->getValue($array, $parentPath);\n\n $mergedArray = \\array_merge(self::forceArray($parentValues), self::forceArray($values));\n\n $this->edit($array, $parentPath, $mergedArray);\n }", "protected function unshift($value)\n {\n array_unshift($this->items, $this->set($value));\n }", "public function shift()\n {\n reset($this->items);\n\n return $this->pull($this->key());\n }", "public static function insertAfter(array $targetArray, $afterKey, $value, $keyValue = null)\n {\n if (null === $keyValue) {\n $newArray[count($targetArray)] = $value;\n } else {\n $newArray[$keyValue] = $value;\n }\n $pos = self::getKeyPos($targetArray, $afterKey);\n\n if (false === $pos) {\n return $targetArray + $newArray;\n }\n\n array_splice($targetArray, $pos + 1, 0, $newArray);\n \n return $targetArray;\n }", "static function insertAfter(&$array, $position, $insert)\n {\n if (is_int($position)) {\n array_splice($array, $position, 0, $insert);\n } else {\n $pos = array_search($position, array_keys($array));\n $array = array_merge(\n array_slice($array, 0, $pos + 1),\n $insert,\n array_slice($array, $pos - 1)\n );\n }\n }", "function swapKeyValue($data)\n{\n $rawData = array_flip($data->toArray());\n foreach ($rawData as $key => $value) {\n $data->unset($value);\n $data->set($key, $value);\n }\n return $data;\n}", "public static function unshift( array & $array, $key, $val )\n\t{\n\t\t$array = array_reverse( $array, TRUE );\n\t\t$array[$key] = $val;\n\t\t$array = array_reverse( $array, TRUE );\n\n\t\treturn $array;\n\t}", "function wpb_move_comment_field_to_bottom($fields)\n{\n $comment_field = $fields['comment'];\n unset($fields['comment']);\n $fields['comment'] = $comment_field;\n return $fields;\n}", "public function shift()\n {\n return array_shift($this->items);\n }", "public function shift()\n {\n return array_shift($this->items);\n }", "public function shift()\n\t{\n\t\treturn array_shift($this->items);\n\t}", "function ins2ary(&$ary, $element, $pos) {\n\t $ar1=array_slice($ary, 0, $pos); $ar1[]=$element;\n\t $ary=array_merge($ar1, array_slice($ary, $pos));\n\t}", "public function unshift($key, $value)\n {\n $this->add(null, $key, $value);\n }", "function ins2ary(&$ary, $element, $pos)\n{\n $ar1 = array_slice($ary, 0, $pos);\n $ar1[] = $element;\n $ary = array_merge($ar1, array_slice($ary, $pos));\n}", "function move_comment_field_to_bottom( $fields ) {\n\n\t\t\t$comment_field = $fields['comment'];\n\t\t\tunset( $fields['comment'] );\n\t\t\t$fields['comment'] = $comment_field;\n\t\t\treturn $fields;\n\n\t\t}", "public static function array_move_to_start ($array, $newFirstName)\r\n\t{\r\n\t\t# Check whether the array is associative\r\n\t\tif (self::isAssociativeArray ($array)) {\r\n\t\t\t\r\n\t\t\t# Extract the first item\r\n\t\t\t$firstItem[$newFirstName] = $array[$newFirstName];\r\n\t\t\t\r\n\t\t\t# Unset the item from the main array\r\n\t\t\tunset ($array[$newFirstName]);\r\n\t\t\t\r\n\t\t\t# Reinsert the item at the start of the main array\r\n\t\t\t$array = $firstItem + $array;\r\n\t\t\t\r\n\t\t# If not associative, loop through until the item is found, remove then reinsert it\r\n\t\t#!# This assumes there is only one instance in the array\r\n\t\t} else {\r\n\t\t\tforeach ($array as $key => $value) {\r\n\t\t\t\tif ($value == $newFirstName) {\r\n\t\t\t\t\tunset ($array[$key]);\r\n\t\t\t\t\tarray_unshift ($array, $newFirstName);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t# Return the reordered array\r\n\t\treturn $array;\r\n\t}", "function MoveLast() {}", "function array_insert(&$array, $offset, $object, $replace=false){\r\n \r\n if(is_array($array)){\r\n if($replace ){\r\n if($offset<0) $offset = 0;\r\n else if($offset > count($array)-1) $offset = count($array)-1;\r\n $a1 = array_slice($array, 0, $offset);\r\n $a2 = array_slice($array, $offset+1);\r\n array_push($a1, $object);\r\n $array = array_merge($a1, $a2);\r\n }else{ \r\n if($offset == 0){\r\n array_unshift($array, $object);\r\n }else if($offset >= count($array)){\r\n array_push($array, $object);\r\n }else{ \r\n $a1 = array_slice($array, 0, $offset);\r\n $a2 = array_slice($array, $offset);\r\n array_push($a1, $object);\r\n $array = array_merge($a1, $a2);\r\n }\r\n }\r\n } \r\n }", "protected function insertInArrayOnPostion(array &$array, $new_value, $position)\n {\n if (in_array($new_value, $array)) {\n foreach ($array as $key => $value) {\n if ($value == $new_value) {\n unset($array[$key]);\n $count = count($array);\n for ($i = ($key + 1); $i < $count; $i++) {\n $array[$i - 1] = $array[$i];\n }\n break;\n }\n }\n }\n if ($position <= 0) {\n $position = 0;\n array_unshift($array, $new_value);\n } elseif ($position >= count($array)) {\n $array[count($array) - 1] = $new_value;\n } else {\n for ($i = (count($array) - 1); $i >= $position; $i--) {\n $array[$i + 1] = $array[$i];\n }\n $array[$position] = $new_value;\n }\n ksort($array);\n }" ]
[ "0.65382046", "0.639082", "0.63872117", "0.6279185", "0.6028279", "0.60095924", "0.59716326", "0.58767164", "0.577472", "0.57245255", "0.57037497", "0.56383383", "0.5622947", "0.55615455", "0.5550582", "0.5518241", "0.54523754", "0.5373389", "0.53269994", "0.5320326", "0.5320326", "0.5319203", "0.53008133", "0.52697325", "0.5253907", "0.5242149", "0.52362776", "0.5232784", "0.5212459", "0.52106214" ]
0.6967265
0
Move Array Item (Key/Value) to top of Array
static function array_to_top($array, $key, $value_instead = false) { if ($value_instead) { if (($array_key = array_search($key, $array)) !== false) { unset($array[$array_key]); } array_unshift($array , $key); } else { $value = array($key => $array[$key]); unset($array[$key]); $array = $value + $array; } return $array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unshift(array & $array, $key, $val) {\n $array = array_reverse($array, TRUE);\n $array[$key] = $val;\n $array = array_reverse($array, TRUE);\n\n return $array;\n}", "function arrayShift($array) {\n\n unset($array[0]);\n return $array;\n}", "public function array_put_to_position() {\n $count = 0;\n $return = array();\n foreach ($this->array as $k => $v) {\n // insert new object\n if ($count == $this->position) {\n if (!$this->name)\n $name = $count;\n $return[$name] = $this->object;\n $inserted = true;\n }\n // insert old object\n $return[$k] = $v;\n $count++;\n }\n if (!$name)\n $name = $count;\n if (!$inserted)\n $return[$name];\n $array = $return;\n return $array;\n }", "public function arrayMove(&$array, $key) {\n\t\tif(!array_key_exists($key, $array)) {\n\t\t\tthrow new Exception('Key '.$key.' not found from '.\n\t\t\t\t$this->className.'->'.__FUNCTION__.'() line '.__LINE__\n\t\t\t);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t$append = $array[$key];\n\t\t\t\tarray_splice($array, $key, 1);\n\t\t\t\tarray_unshift($array, $append);\n\t\t\t} catch (Exception $e) { \n\t\t\t\tthrow new Exception($e->getMessage().' from '.$this->className\n\t\t\t\t\t.'->'.__FUNCTION__.'() line '.__LINE__\n\t\t\t\t);\n\t\t\t} //<-- end try -->\n\t\t} //<-- end if -->\n\t}", "static function array_to_bottom($array, $key, $value_instead = false) {\n\n\t\tif ($value_instead) {\n\t\t\tif (($array_key = array_search($key, $array)) !== false) {\n\t\t\t\tunset($array[$array_key]);\n\t\t\t}\n\t\t\tarray_push($array,$key);\n\t\t}\n\t\telse {\n\t\t\t$value = $array[$key];\n\t\t\tunset($array[$key]);\n\t\t\tarray_push($array, $value);\n\t\t}\n\t\treturn $array;\n\t}", "protected function unshift($value)\n {\n array_unshift($this->items, $this->set($value));\n }", "function acadp_array_insert_after( $key, $array, $new_array ) {\n\n\tif( array_key_exists( $key, $array ) ) {\n \t$new = array();\n \tforeach( $array as $k => $value ) {\n \t\t$new[ $k ] = $value;\n \t\tif( $k === $key ) {\n\t\t\t\tforeach( $new_array as $new_key => $new_value ) {\n \t\t\t$new[ $new_key ] = $new_value;\n\t\t\t\t}\n \t\t}\n \t}\n \treturn $new;\n \t}\n\n \treturn $array;\n\n}", "public static function array_move_to_start ($array, $newFirstName)\r\n\t{\r\n\t\t# Check whether the array is associative\r\n\t\tif (self::isAssociativeArray ($array)) {\r\n\t\t\t\r\n\t\t\t# Extract the first item\r\n\t\t\t$firstItem[$newFirstName] = $array[$newFirstName];\r\n\t\t\t\r\n\t\t\t# Unset the item from the main array\r\n\t\t\tunset ($array[$newFirstName]);\r\n\t\t\t\r\n\t\t\t# Reinsert the item at the start of the main array\r\n\t\t\t$array = $firstItem + $array;\r\n\t\t\t\r\n\t\t# If not associative, loop through until the item is found, remove then reinsert it\r\n\t\t#!# This assumes there is only one instance in the array\r\n\t\t} else {\r\n\t\t\tforeach ($array as $key => $value) {\r\n\t\t\t\tif ($value == $newFirstName) {\r\n\t\t\t\t\tunset ($array[$key]);\r\n\t\t\t\t\tarray_unshift ($array, $newFirstName);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t# Return the reordered array\r\n\t\treturn $array;\r\n\t}", "function array_shift_over($array, $index) {\n\n $size = sizeof($array);\n if($index >= $size || $index < 0) {\n return $array;\n } else {\n for($i=$index;$i<$size;$i++) {\n if($i === ($size-1)) {\n unset($array[$i]);\n } else {\n $array[$i] = $array[$i+1];\n }\n }\n }\n return $array;\n}", "function arrayPrepend($array, $value) {\n array_unshift($array, $value);\n return $array;\n}", "public static function unshift( array & $array, $key, $val )\n\t{\n\t\t$array = array_reverse( $array, TRUE );\n\t\t$array[$key] = $val;\n\t\t$array = array_reverse( $array, TRUE );\n\n\t\treturn $array;\n\t}", "function util_array_values_prepend(&$item, $key, $prefix)\n{\n $item = $prefix.$item;\n}", "private function array_unshift_assoc(&$arr, $key, $val)\n {\n $arr = array_reverse($arr, true);\n $arr[$key] = $val;\n return array_reverse($arr, true);\n }", "function array_unshift_assoc(&$arr, $key, $val) {\n $arr = array_reverse($arr, true);\n $arr[$key] = $val;\n $arr = array_reverse($arr, true);\n return count($arr);\n}", "function swapKeyValue($data)\n{\n $rawData = array_flip($data->toArray());\n foreach ($rawData as $key => $value) {\n $data->unset($value);\n $data->set($key, $value);\n }\n return $data;\n}", "public function shift()\n {\n reset($this->items);\n\n return $this->pull($this->key());\n }", "public static function array_unshift_ref(&$array, &$value)\n {\n $return = array_unshift($array, '');\n $array[0] =& $value;\n return $return;\n }", "function array_change_key($array, $search, $replace) {\n\t$arr = array();\n\tif (isset($array[0]) and is_arr($array[0])) {\n\t\tforeach ($array as $item) {\n\t\t\t$item = array_change_key($item, $search, $replace);\n\n\t\t\t$arr[] = $item;\n\t\t}\n\t\treturn $arr;\n\t} else {\n\t\tif (is_arr($array)) {\n\t\t\tif (isset($array[$search])) {\n\t\t\t\t$array[$replace] = $array[$search];\n\t\t\t}\n\t\t\treturn $array;\n\t\t}\n\t}\n\t// return TRUE; // Swap complete\n}", "function ins2ary(&$ary, $element, $pos) {\n\t $ar1=array_slice($ary, 0, $pos); $ar1[]=$element;\n\t $ary=array_merge($ar1, array_slice($ary, $pos));\n\t}", "public final function manualSort(){\r\n\t\t$itemid=$this->itemid;\r\n\t\t$position=$this->sortarray;\r\n\t\t$newarray=array();\r\n\t\t$max=-1;\r\n\t\tforeach($this->sorteddata as $pmid){\r\n\t\t\t$i=$itemid[$pmid];\r\n\t\t\tif (!isset($position[$i])) continue;\r\n\t\t\t$newarray[$position[$i]]=$pmid;\r\n\t\t\tif ($max<$position[$i]) $max=$position[$i];\r\n\t\t}\r\n\t\tforeach($this->sorteddata as $pmid){\r\n\t\t\t$i=$itemid[$pmid];\r\n\t\t\tif (!isset($position[$i])) $newarray[++$max]=$pmid;\r\n\t\t}\r\n\t\t$this->sorteddata=$newarray;\r\n\t}", "function ins2ary(&$ary, $element, $pos)\n{\n $ar1 = array_slice($ary, 0, $pos);\n $ar1[] = $element;\n $ary = array_merge($ar1, array_slice($ary, $pos));\n}", "public function unshift($key, $value)\n {\n $this->add(null, $key, $value);\n }", "public function mvUp(array &$array, string $path): void\n {\n // Build the path object\n $pathObject = new PropertyPath($path);\n\n // get the values to move one level up\n $values = $this->pa->getValue($array, $path);\n\n // Remove the key to move one level up\n $this->rm($array, $path);\n\n /*\n * Fails on\n * - phpstan (ubuntu-latest, 8.0, --prefer-stable --prefer-lowest, ~3.4)\n * - phpstan (ubuntu-latest, 7.3, --prefer-stable --prefer-lowest, ~3.4)\n * - phpstan (ubuntu-latest, 7.4, --prefer-stable --prefer-lowest, ~3.4)\n *\n * @phpstan-ignore-next-line\n */\n $parentPath = $pathObject->getParent() ?? '[]';\n\n // Get the values of the up level\n $parentValues = $this->getValue($array, $parentPath);\n\n $mergedArray = \\array_merge(self::forceArray($parentValues), self::forceArray($values));\n\n $this->edit($array, $parentPath, $mergedArray);\n }", "function array_reindex($array)\n{\n if (array_values($array) === $array) {\n $array = array_flip($array);\n }\n\n return $array;\n}", "public function prepend( $key, $value )\n\t{\n\t\t$array = $this->get( $key );\n\t\tarray_unshift( $array, $value );\n\t\t$this->set( $key, $array );\n\t}", "function array_insert(&$array, $offset, $object, $replace=false){\r\n \r\n if(is_array($array)){\r\n if($replace ){\r\n if($offset<0) $offset = 0;\r\n else if($offset > count($array)-1) $offset = count($array)-1;\r\n $a1 = array_slice($array, 0, $offset);\r\n $a2 = array_slice($array, $offset+1);\r\n array_push($a1, $object);\r\n $array = array_merge($a1, $a2);\r\n }else{ \r\n if($offset == 0){\r\n array_unshift($array, $object);\r\n }else if($offset >= count($array)){\r\n array_push($array, $object);\r\n }else{ \r\n $a1 = array_slice($array, 0, $offset);\r\n $a2 = array_slice($array, $offset);\r\n array_push($a1, $object);\r\n $array = array_merge($a1, $a2);\r\n }\r\n }\r\n } \r\n }", "function array_prepend($array, $value, $key = null)\n {\n return Arr::prepend($array, $value, $key);\n }", "public static function prepend($array, $value, $key = null)\n {\n if (is_null($key)) {\n array_unshift($array, $value);\n } else {\n $array = [$key => $value] + $array;\n }\n\n return $array;\n }", "public static function unshift(array & $array, string $key, $val): array\n {\n $array = array_reverse($array, TRUE);\n $array[$key] = $val;\n $array = array_reverse($array, TRUE);\n\n return $array;\n }", "public function & arrayUnShift () {\n $getFunctionArguments = func_get_args ();\n foreach ($getFunctionArguments as $k => $v) {\n array_unshift ($this->varContainer, $v);\n }\n # Return to chain ...\n return $this->returnToChain ();\n }" ]
[ "0.64682126", "0.6390099", "0.63620937", "0.6329725", "0.62322664", "0.61628544", "0.61140645", "0.60008836", "0.5947864", "0.58728665", "0.58698773", "0.5834694", "0.5682076", "0.5677708", "0.56554115", "0.5621479", "0.5611845", "0.55907476", "0.5579645", "0.5530323", "0.55253804", "0.55108106", "0.5505653", "0.5496061", "0.5488918", "0.5474775", "0.54613817", "0.54587597", "0.54581165", "0.54408807" ]
0.7094842
0
Hash String Hashes the string sent to it, and returns an array with both the hash & salt string in it. Config options are use_salt (bool) : Whether to use a salt string or not (`default = true`) encryption (const) : The encryption used (`default = PASSWORD_BCRYPT`)
static function hash_string($input, $config = []) { $defaults = [ 'use_salt' => true, 'encryption' => PASSWORD_BCRYPT ]; $config = array_merge($defaults, $config); //Create random bytes $salt_byte = random_bytes(15); //Make the bytes into a readable string (to save to the database) $salt_string = $config['use_salt'] ? bin2hex($salt_byte) : ""; //Put the salt-string after the password for the hashing for both creation and login $string_hashed = password_hash($input . $salt_string, $config['encryption']); return ['hash' => $string_hashed, 'salt' => $salt_string]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function hash($str)\n\t{\n\t\t// on some servers hash() can be disabled :( then password are not encrypted \n\t\tif (empty($this->config['hash_method']))\n\t\t\treturn $this->config['salt_prefix'].$str.$this->config['salt_suffix']; \n\t\telse\n\t\t\treturn hash($this->config['hash_method'], $this->config['salt_prefix'].$str.$this->config['salt_suffix']); \n\t}", "public function hash_user_pass($password) {\n\n $salt = sha1(rand());\n $salt = substr($salt, 0, 10);\n\n//PASSWORD_DEFAULT is a default function in PHP it contains BCRYPT algo at backend PHP is using BCRYPT currently\n//as it is most secure password hashing algorithm using today the term DEFAULT means that if another hashing algorithm is introduced in\n//future it will automatically updated to the library ny PHP so the developer has no need to update in the code.\n $hashing = password_hash($password.$salt, PASSWORD_DEFAULT);\n $hash = array(\"salt\" => $salt, \"hashing\" => $hashing);\n\n return $hash;\n\n}", "public function getHash($plaintext, $salt = false);", "function my_password_hash($password)\n{\n $salt = createSalt();\n $hash = md5($salt.$password);\n return array(\"hash\" => $hash, \"salt\" => $salt);\n}", "public static function hash($string) {\n $hash = hash_init(Config::get('HASH'));\n hash_update($hash, $string);\n hash_update($hash, Config::get('SALT'));\n\n return hash_final($hash);\n }", "public static function GetPasswordHash($str)\n {\n global $PASSWORD_HASH_INFO;\n if (empty($PASSWORD_HASH_INFO)) {\n $type = 'sha256';\n $user_salt = '';\n $random_salt_length = 8;\n } else {\n $type = $PASSWORD_HASH_INFO['type'];\n $user_salt = $PASSWORD_HASH_INFO['user_salt'];\n $random_salt_length = $PASSWORD_HASH_INFO['random_salt_length'];\n }\n $random_salt = ($random_salt_length)? substr(md5(uniqid(rand())), 0, $random_salt_length) : '';\n return $random_salt . hash($type, $random_salt . $str . $user_salt);\n }", "function hashSSHA($password) {\n\n $salt = sha1(rand());\n $salt = substr($salt, 0, 10);\n $encrypted = base64_encode(sha1($password . $salt, true) . $salt);\n $hash = array(\"salt\" => $salt, \"encrypted\" => $encrypted);\n return $hash;\n }", "function hashSSHA($password) {\n $salt = sha1(rand());\n $salt = substr($salt, 0, 10);\n $encrypted = base64_encode(sha1($password . $salt, true) . $salt);\n $hash = array(\"salt\" => $salt, \"encrypted\" => $encrypted);\n return $hash;\n}", "public function hashPass($str)\n {\n // Phalcon's hashing system\n //return $this->_security->hash($str);\n\n // Using PHP5.5's built in system\n return password_hash($str, PASSWORD_DEFAULT, ['cost' => \\Phalcon\\DI::getDefault()->getShared('config')->auth->hash_workload]);\n }", "public function PasswordHash($password, $isSalt = false) {\n\n if (strlen($password) > 72) {\n\n $password = substr($password, 0, 72);\n }\n\n $hashedPassword = \\FluitoPHP\\Filters\\Filters::GetInstance()->\n Run('FluitoPHP.Authentication.HashPassword', $password, $isSalt);\n\n if ($hashedPassword === $password) {\n\n $hashedPassword = password_hash($password, PASSWORD_BCRYPT);\n }\n\n return $hashedPassword;\n }", "public function hash_password($password, $salt = false) {\n\n\t\t// Create a salt seed, same length as the number of offsets in the pattern\n\t\tif ($salt === false) {\n\t\t\t$salt = substr(hash($this->config['hash_method'], uniqid(null, true)), 0, count($this->config['salt_pattern']));\n\t\t}\n\n\t\t// Password hash that the salt will be inserted into\n\t\t$hash = hash($this->config['hash_method'], $salt . $password);\n\n\t\t// Change salt to an array\n\t\t$salt = str_split($salt, 1);\n\n\t\t// Returned password\n\t\t$password = '';\n\n\t\t// Used to calculate the length of splits\n\t\t$last_offset = 0;\n\n\t\tforeach ($this->config['salt_pattern'] as $offset) {\n\n\t\t\t// Split a new part of the hash off\n\t\t\t$part = substr($hash, 0, $offset - $last_offset);\n\n\t\t\t// Cut the current part out of the hash\n\t\t\t$hash = substr($hash, $offset - $last_offset);\n\n\t\t\t// Add the part to the password, appending the salt character\n\t\t\t$password .= $part . array_shift($salt);\n\n\t\t\t// Set the last offset to the current offset\n\t\t\t$last_offset = $offset;\n\n\t\t}\n\n\t\t// Return the password, with the remaining hash appended\n\t\treturn $password . $hash;\n\t}", "function string5(){\n\n $string5 = \"Hola mundo\";\n $hash2 = password_hash($string5, PASSWORD_BCRYPT);\n\n echo $hash2;\n\n}", "function hash_password($cleartext_password) {\n if (config\\HASHING_ALGORITHM == \"crypt\") {\n return crypt($cleartext_password, \"$1$\" . \\melt\\string\\random_hex_str(8) . \"$\");\n } else if (config\\HASHING_ALGORITHM == \"sha1\") {\n $salt = \\melt\\string\\random_hex_str(40);\n return $salt . sha1($salt . $cleartext_password, false);\n } else if (config\\HASHING_ALGORITHM == \"md5\") {\n $salt = \\melt\\string\\random_hex_str(32);\n return $salt . \\md5($salt . $cleartext_password, false);\n } else\n trigger_error(\"The configured hashing algorithm '\" . config\\HASHING_ALGORITHM . \"' is not supported.\", \\E_USER_ERROR);\n}", "public function hashSSHA($password) {\n \n $salt = sha1(rand());\n $salt = substr($salt, 0, 10);\n $encrypted = base64_encode(sha1($password . $salt, true) . $salt);\n $hash = array(\"salt\" => $salt, \"encrypted\" => $encrypted);\n return $hash;\n }", "public function set_hash($string){\n\t\t\t$string = hash($this->hash_algorithm, $string . $this->password_salt);\n\t\t\t$string = $this->password_addenda . $string . $this->password_addenda;\n\t\t\treturn $string;\n\n\t\t}", "function hashPass($pass, $salt){\n while(strlen($pass) > strlen($salt)){\n $salt = $salt.$salt;\n }\n while(strlen($salt) > strlen($pass)){\n $salt = substr($salt, 0, -1);\n }\n\n $hashable = saltPass($pass, $salt);\n\n //Hash the hashable string a couple of times\n $hashedData = $hashable;\n for($i = 0; $i < 10000; $i++){\n $hashedData = hash('sha512', $hashedData);\n }\n\n return $hashedData;\n}", "function getCryptHash($str)\n{\n $salt = '';\n if (CRYPT_BLOWFISH) {\n if (version_compare(PHP_VERSION, '5.3.7') >= 0) { // http://www.php.net/security/crypt_blowfish.php\n $algo_selector = '$2y$';\n } else {\n $algo_selector = '$2a$';\n }\n $workload_factor = '12$'; // (around 300ms on Core i7 machine)\n $val_arr = array(\n '.',\n '/'\n );\n $range1 = range('0', '9');\n $range2 = range('a', 'z');\n $range3 = range('A', 'Z');\n $res_arr = array_merge($val_arr, $range1, $range2, $range3);\n $salt = $algo_selector . $workload_factor . getRandomStr($res_arr, 22); // './0-9A-Za-z'\n \n } else if (CRYPT_MD5) {\n $algo_selector = '$1$';\n $char1 = chr(33);\n $char2 = chr(127);\n $range = range($char1, $char2);\n $salt = $algo_selector . getRandomStr($range, 12); // actually chr(0) - chr(255), but used ASCII only\n \n } else if (CRYPT_SHA512) {\n $algo_selector = '$6$';\n $workload_factor = 'rounds=5000$';\n $char1 = chr(33);\n $char2 = chr(127);\n $range = range($char1, $char2);\n $salt = $algo_selector . $workload_factor . getRandomStr($range, 16); // actually chr(0) - chr(255), but used ASCII only\n \n } else if (CRYPT_SHA256) {\n $algo_selector = '$5$';\n $workload_factor = 'rounds=5000$';\n $char1 = chr(33);\n $char2 = chr(127);\n $range = range($char1, $char2);\n $salt = $algo_selector . $workload_factor . getRandomStr($range, 16); // actually chr(0) - chr(255), but used ASCII only\n \n } else if (CRYPT_EXT_DES) {\n $algo_selector = '_';\n $val_arr = array(\n '.',\n '/'\n );\n $range1 = range('0', '9');\n $range2 = range('a', 'z');\n $range3 = range('A', 'Z');\n $res_arr = array_merge($val_arr, $range1, $range2, $range3);\n $salt = $algo_selector . getRandomStr($res_arr, 8); // './0-9A-Za-z'.\n \n } else if (CRYPT_STD_DES) {\n $algo_selector = '';\n $val_arr = array(\n '.',\n '/'\n );\n $range1 = range('0', '9');\n $range2 = range('a', 'z');\n $range3 = range('A', 'Z');\n $res_arr = array_merge($val_arr, $range1, $range2, $range3);\n $salt = $algo_selector . getRandomStr($res_arr, 2); // './0-9A-Za-z'\n \n }\n return crypt($str, $salt);\n}", "function getPasswordHash($password,$salt){\n\t\treturn hash('sha256',$salt.$password);\n}", "function getHash( $password, $salt = '' )\r\n{\r\n\treturn hash( 'sha256', $password . $salt );\r\n}", "public function hash_password($password, $salt = FALSE)\n\t{\n\t\tif ($salt == FALSE)\n\t\t{\n\t\t\t// Create a salt string, same length as the number of offsets in the pattern\n\t\t\t$salt = substr($this->hash(uniqid(NULL, TRUE)), 0, count($this->config['salt_pattern']));\n\t\t}\n\n\t\t// Password hash that the salt will be inserted into\n\t\t$hash = $this->hash($salt.$password);\n\n\t\t// Change salt to an array\n\t\t$salt = str_split($salt, 1);\n\n\t\t// Returned password\n\t\t$password = '';\n\n\t\t// Used to calculate the length of splits\n\t\t$last_offset = 0;\n\n\t\tforeach($this->config['salt_pattern'] as $offset)\n\t\t{\n\t\t\t// Split a new part of the hash off\n\t\t\t$part = substr($hash, 0, $offset - $last_offset);\n\n\t\t\t// Cut the current part out of the hash\n\t\t\t$hash = substr($hash, $offset - $last_offset);\n\n\t\t\t// Add the part to the password, appending the salt character\n\t\t\t$password .= $part.array_shift($salt);\n\n\t\t\t// Set the last offset to the current offset\n\t\t\t$last_offset = $offset;\n\t\t}\n\n\t\t// Return the password, with the remaining hash appended\n\t\treturn $password.$hash;\n\t}", "protected function hash_password($string)\n\t{\n\t\t$secret = 'Oi`x+>D-v\"dcpbb]\\'s2|mKv\"L>s?BH9UtAhul=-^=P>z@BMYAR\\'mpk9/KfdFC@w)FDhZW9u8?1kll*nhX!:jU&SJj>+aDunwQpSK,6s-S51FrkxM7?!Tt^m%`W+\\'=ej\\\\';\n\t\tfor($x=0;$x<100;$x++) $string = hash('sha256', $secret.$string); return $string;\n\t}", "public function hash ($string){\n\t\treturn hash('sha512', $string . config_item('encryption_key'));\n\t\t}", "public static function EncodePasswordToHash ($password = '', $options = []);", "public function hash($string){\n return hash('sha512', $string . config_item('encryption_key'));\n }", "public static function hash($string = null) {\n if ($string != null) {\n $options = [\n 'cost' => 12,\n ];\n return password_hash($string, PASSWORD_BCRYPT, $options);\n }\n }", "public function GetPasswordHash ();", "public function hash_password($password, $salt = FALSE)\n {\n \tif ($salt === FALSE)\n \t{\n \t\t// Create a salt seed, same length as the number of offsets in the pattern\n \t\t$salt = substr($this->hash(uniqid(NULL, TRUE)), 0, count($this->_config['salt_pattern']));\n \t}\n\n \t// Password hash that the salt will be inserted into\n \t$hash = $this->hash($salt.$password);\n\n \t// Change salt to an array\n \t$salt = str_split($salt, 1);\n\n \t// Returned password\n \t$password = '';\n\n \t// Used to calculate the length of splits\n \t$last_offset = 0;\n\n \tforeach ($this->_config['salt_pattern'] as $offset)\n \t{\n \t\t// Split a new part of the hash off\n \t\t$part = substr($hash, 0, $offset - $last_offset);\n\n \t\t// Cut the current part out of the hash\n \t\t$hash = substr($hash, $offset - $last_offset);\n\n \t\t// Add the part to the password, appending the salt character\n \t\t$password .= $part.array_shift($salt);\n\n \t\t// Set the last offset to the current offset\n \t\t$last_offset = $offset;\n \t}\n\n \t// Return the password, with the remaining hash appended\n \treturn $password.$hash;\n }", "public function hashPassword($password, $salt = FALSE) {\n\n $this->generateSalt();\n\n if ($salt === FALSE) {\n // Create a salt seed, same length as the number of offsets in the pattern\n $salt = substr($this->hash(uniqid(NULL, TRUE)), 0, count($this->salt_pattern));\n }\n\n // Password hash that the salt will be inserted into\n $hash = $this->hash($salt . $password);\n\n // Change salt to an array\n $salt = str_split($salt, 1);\n\n\n // Returned password\n $password = '';\n\n // Used to calculate the length of splits\n $last_offset = 0;\n\n foreach ($this->salt_pattern as $i => $offset) {\n // Split a new part of the hash off\n $part = substr($hash, 0, $offset - $last_offset);\n\n // Cut the current part out of the hash\n $hash = substr($hash, $offset - $last_offset);\n\n // Add the part to the password, appending the salt character\n $password .= $part . array_shift($salt);\n\n // Set the last offset to the current offset\n $last_offset = $offset;\n }\n // Return the password, with the remaining hash appended\n return $password . $hash;\n }", "public static function hash(string $string, array $options = null): string\n {\n if($options === null)\n $options = static::getHashOptions();\n\n return password_hash($string, static::getHashAlgorithm(), $options);\n }", "public function hash($string, $type = null, $salt = false) {\n\t\treturn Security::hash($string, $type, $salt);\n\t}" ]
[ "0.6824701", "0.64293176", "0.6423593", "0.6302542", "0.62636876", "0.61824", "0.6174575", "0.61459494", "0.6134166", "0.6131271", "0.61271495", "0.6121221", "0.61168444", "0.6109796", "0.6108238", "0.61012346", "0.60608405", "0.6059856", "0.6058442", "0.6049902", "0.6044517", "0.60426086", "0.60253865", "0.6014372", "0.6001692", "0.59876245", "0.5982227", "0.5940653", "0.5940576", "0.59360796" ]
0.722777
0
Redirects to the requested URL with specified schema.
protected function redirectToSchema(CFilterChain $filterChain, $schema) { $controller = $filterChain->controller; $action = $filterChain->action; $route = "{$controller->id}/{$action->id}"; $params = $_GET; $controller->redirect($controller->createAbsoluteUrl($route, $params, $schema)); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function redirect(string $toUrl, int $status = 302, string $schema = 'http'): PsrResponseInterface;", "public function redirectAction()\n {\n $params = array('key' => $_GET['url']);\n $records = $this->getCollection(self::MONGO_COLLECTION)->find($params);\n\n if ($records->hasNext()) {\n $record = $records->getNext();\n $this->set('redirectTo', $record['target']);\n header('Location: ' . $record['target']);\n } else {\n $this->set('redirectTo', 'http://' . $_SERVER['SERVER_NAME']);\n header('Location: ' . 'http://' . $_SERVER['SERVER_NAME']);\n }\n }", "abstract protected function redirect();", "abstract protected function redirectTo();", "public function redirect(Request $request);", "public function redirect();", "public function redirect();", "public function redirect();", "public function redirectToExternalUrl() {}", "public function redirectToSteam(Request $request, ?string $redirectTo): RedirectResponse;", "public function redirect(string $url, $status_code = 302);", "function redirect_canonical($requested_url = \\null, $do_redirect = \\true)\n {\n }", "public function redirectTo();", "public function mustRedirect();", "static function redirect($url, $arguments = array())\n {\n if (substr($url, 0, 1) == '@')\n {\n global $router;\n $url = $router->generate(substr($url, 1), $arguments);\n }\n\n header(\"location: $url\");\n die();\n }", "public function handle_redirection()\n {\n }", "private function redirect(){\n\t\tredirect('browse/office_industrial');//default re-route\n\t}", "protected abstract function redirect(Response $response);", "public function redirectAction()\n\t\t{\n\t\t\t// Load /app/code/community/Mage/Idealcheckoutdirectebanking/Model/Idealcheckoutdirectebanking.php\n\t\t\t$oIdealcheckoutdirectebankingModel = Mage::getSingleton('idealcheckoutdirectebanking/idealcheckoutdirectebanking');\n\n\n\t\t\t// Create transaction record and get URL to /idealcheckoutdirectebanking/setup.php\n\t\t\t$sIdealcheckoutdirectebankingUrl = $oIdealcheckoutdirectebankingModel->setupPayment();\n\n\n\t\t\t// redirect\n\t\t\theader('Location: ' . $sIdealcheckoutdirectebankingUrl);\n\t\t\texit();\n\t\t}", "public function redirect($path);", "public function redirect($path):void;", "function http_redirect($url = null, ?array $params = null, $session = null, $status = null) {}", "function _redirect($url) {\n\theader(\"HTTP/1.1 301 Moved Permanently\");\n\tdheader(\"location: \".str_replace('&amp;', '&', $url));\n\tdexit();\n}", "protected function redirect($url) {\n\t\theader('Location: ' . str_replace('&amp;', '&', $url));\n\t\tdie();\n\t}", "public function redirectToFacebook()\n\t{\n\t return Socialize::with('facebook')->redirect();\n\t}", "final protected function make_secure() {\n\t\t$url = \"https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}\";\n\t\tif (!empty($_SERVER['QUERY_STRING']))\n\t\t\t$url .= \"?{$_SERVER['QUERY_STRING']}\";\n\t\t$this->response->redirect($url);\n\t}", "function redirectTo($target) {\r\n // Pass on query parameters\r\n $qstring = http_build_query($_GET);\r\n if(!empty($qstring)) {\r\n $target = $target.'?'.$qstring;\r\n }\r\n header('Location:'.$target);\r\n exit;\r\n}", "function redirect()\n {\n global $wgOut;\n $wgOut->redirect( $this->getRedirectLink(), 302);\n }", "function qa_redirect($request, $params = null, $rooturl = null, $neaturls = null, $anchor = null)\n{\n\tif (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }\n\n\tqa_redirect_raw(qa_path($request, $params, $rooturl, $neaturls, $anchor));\n}", "public function redirect() {\n\t\tif ( is_404() ) {\n\t\t\t$redirects = $this->get_rewrite_rules();\n\t\t\t$matched_rule = false;\n\t\t\t$request = $this->get_request();\n\t\t\tforeach ( (array) $redirects as $match => $query ) {\n\t\t\t\tif ( preg_match(\"#^$match#\", $request, $matches) ||\n\t\t\t\t\tpreg_match(\"#^$match#\", urldecode($request), $matches) ) {\n\n\t\t\t\t\t// Got a match.\n\t\t\t\t\t$matched_rule = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $matched_rule ) {\n\t\t\t\t$query = preg_replace(\"!^.+\\?!\", '', $query);\n\t\t\t\t$redirect = addslashes(WP_MatchesMapRegex::apply($query, $matches));\n\t\t\t\tif ( $redirect ) {\n\t\t\t\t\twp_redirect( $this->clean_url( home_url( \"?$redirect\" ) ), 301 );\n\t\t\t\t\texit;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.67610604", "0.6102987", "0.5728082", "0.56425965", "0.5543527", "0.5446656", "0.5446656", "0.5446656", "0.5440463", "0.53295106", "0.529658", "0.5252868", "0.52139807", "0.519898", "0.51872313", "0.517975", "0.51673764", "0.5140585", "0.51342213", "0.51269835", "0.5108659", "0.50926507", "0.5082228", "0.5069775", "0.5060305", "0.5058791", "0.5053302", "0.5050417", "0.5047428", "0.50372404" ]
0.683372
0
Tests if this user can perform lookups of course/course catalog mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known lookup methods in this session will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users.
public function canLookupCourseCatalogMappings() { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function supportsCourseLookup() {\n \treturn $this->manager->supportsCourseLookup();\n\t}", "public function supportsCourseCatalogLookup() {\n \treturn $this->manager->supportsCourseCatalogLookup();\n\t}", "public function isAccessible() {\n\t\tif ($this->hasAccessRestrictions() === FALSE) {\n\t\t\treturn TRUE;\n\t\t}\n\n\t\tif ($this->securityContext->canBeInitialized() === FALSE) {\n\t\t\treturn TRUE;\n\t\t}\n\n\t\tforeach ($this->accessRoles as $roleName) {\n\t\t\tif ($this->securityContext->hasRole($roleName)) {\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\t\treturn FALSE;\n\t}", "public function supportsCourseCatalogSearch() {\n \treturn $this->manager->supportsCourseCatalogSearch();\n\t}", "public function supportsCourseOfferingLookup() {\n \treturn $this->manager->supportsCourseOfferingLookup();\n\t}", "function isAuthorized() {\n $roles = $this->Role->calculateCMRoles();\n \n // Construct the permission set for this user, which will also be passed to the view.\n $p = array();\n \n // Determine what operations this user can perform\n \n // Accept an OAuth callback?\n $p['callback'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // Delete an existing SalesforceSource?\n $p['delete'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // Edit an existing SalesforceSource?\n $p['edit'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // View all existing SalesforceSources?\n $p['index'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // View API limits?\n $p['limits'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // View an existing SalesforceSource?\n $p['view'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n $this->set('permissions', $p);\n return($p[$this->action]);\n }", "public function supportsCourseCatalogAssignment() {\n \treturn $this->manager->supportsCourseCatalogAssignment();\n\t}", "public function supportsCourseCatalog() {\n \treturn $this->manager->supportsCourseCatalog();\n\t}", "public function supportsCourseSearch() {\n \treturn $this->manager->supportsCourseSearch();\n\t}", "public function supportsCourseCatalogAdmin() {\n \treturn $this->manager->supportsCourseCatalogAdmin();\n\t}", "public function userHasMappingRights()\r\n\t{\r\n\t\t// Get global vars\r\n\t\tglobal $user_rights;\r\n\t\t// Return boolean\r\n\t\treturn ($user_rights['realtime_webservice_mapping'] == '1');\r\n\t}", "public function authorize()\n {\n if ($this->method() === 'POST') {\n return $this->user()->can('create', Location::class);\n }\n\n return $this->user()->can('update', Location::class);\n }", "public function canGet()\n {\n if ( !$this->actor ) \n {\n $this->actor = get_viewer(); \n }\n \n if ( !$this->actor ) \n {\n return false; \n }\n \n if ( !$this->actor->authorize('administration') ) \n {\n return false; \n }\n \n $this->getService('repos://site/connect.session');\n \n $api = $this->actor->sessions->{$this->getIdentifier()->name}; \n \n if ( !$api ) \n return false;\n \n $this->api = $api;\n }", "abstract protected function canAccess();", "private function canDisplay()\n {\n //Checks roles allowed\n $roles = array(\n 'ROLE_MANAGER',\n 'ROLE_ADMIN',\n );\n\n foreach ($roles as $role) {\n if ($this->security->isGranted($role)) {\n return true;\n }\n }\n\n return false;\n }", "public function authorize()\n {\n $staffSn = $this->staff_sn;\n $staff = Staff::visible()->find($staffSn);\n $authority = app('Authority');\n if (!empty($staffSn) && empty($staff)) {\n return false;\n }\n $departmentId = $this->department_id;\n if (!empty($departmentId) && !$authority->checkDepartment($departmentId)) {\n return false;\n }\n $brandId = $this->brand_id;\n if (!empty($brandId) && !$authority->checkBrand($brandId)) {\n return false;\n }\n return true;\n }", "function isAuthorized() {\n $roles = $this->Role->calculateCMRoles();\n \n // Construct the permission set for this user, which will also be passed to the view.\n $p = array();\n \n // Determine what operations this user can perform\n \n // Add a new Match Server Attribute?\n $p['add'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // Delete an existing Match Server Attribute?\n $p['delete'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // Edit an existing Match Server Attribute?\n $p['edit'] = ($roles['cmadmin'] || $roles['coadmin']);\n\n // View all existing Match Server Attributes?\n $p['index'] = ($roles['cmadmin'] || $roles['coadmin']);\n \n // View an existing Match Server Attribute?\n $p['view'] = ($roles['cmadmin'] || $roles['coadmin']);\n\n $this->set('permissions', $p);\n return $p[$this->action];\n }", "public function authorize()\n {\n $resource = Resource::find($this->route('id'));\n\n if (!$resource) {\n return true;\n }\n\n return $resource && $this->user()->can('access', $resource);\n }", "public function authorize()\n {\n if (env('APP_ENV') == 'testing'):\n return true;\n endif;\n switch ($this->getMethod()):\n case 'POST':\n if (Auth::user()->canCourseCreate()):\n return true;\n else:\n return false;\n endif;\n \n break;\n case 'PUT':\n if (Auth::user()->canCourseEdit()):\n return true;\n else:\n return false;\n endif;\n \n break;\n case 'DELETE':\n if (Auth::user()->canCourseDelete()):\n return true;\n else:\n return false;\n endif;\n \n break;\n default:\n return false;\n break;\n endswitch;\n }", "protected function authorityControl()\n {\n return Authority::can(Permission::ACTION_R, 'Queries');\n }", "public function authorize()\n {\n return Auth::check() && Auth::user()->hasAnyRol([\n 'contractor-superadmin',\n 'contractor-manager',\n 'contractor-worker',\n 'contractor-admin',\n ]);\n }", "public function authorize()\n {\n $user = auth()->user();\n $course = Course::find($this->input('course_id'));\n if (isset($user) && $user->can('update', $course)) {\n $class = $this->input('class');\n $ids = array_map(function ($order) {\n return $order[0];\n }, $this->input('orders'));\n switch ($class) {\n case \"Lesson\":\n return Lesson::whereIn('id', $ids)->where('course_id', '<>', $course->getKey())->doesntExist();\n case \"Topic\":\n return Topic::whereIn('id', $ids)->whereHas('lesson', function(Builder $query) use($course) {\n $query->where('course_id', $course->getKey());\n })->doesntExist();\n }\n\n return true;\n }\n\n return false;\n }", "public function isAuthorized(): bool\n {\n // TODO: implement authorization check\n\n return true;\n }", "public function supportsCourseAdmin() {\n \treturn $this->manager->supportsCourseAdmin();\n\t}", "public function authorize()\n {\n $organizationId = (string) $this->route('id');\n\n $this->organization = Organization::findByUuidOrFail($organizationId);\n\n return $this->user()->can('show', [Organization::class, $this->organization]);\n }", "public function authorize()\n {\n if(Auth::check())\n {\n return (Auth::user()->has_world_admin_access);\n }\n return false;\n }", "public function isRestricted()\n {\n if ($this->_isRestricted !== null) {\n return $this->_isRestricted;\n }\n if ($this->private) {\n $this->_isRestricted = true;\n return true;\n }\n $tabs = array(\n 'source_access_rights',\n 'issues_access_rights',\n 'downloads_access_rights',\n 'wiki_access_rights',\n 'review_access_rights'\n );\n $conf = $this->getConf();\n foreach ($tabs as $tab) {\n if (!in_array($conf->getVal($tab, 'all'),\n array('all', 'none'))) {\n $this->_isRestricted = true;\n return true;\n }\n }\n $this->_isRestricted = false;\n return false;\n }", "public function hasAuthorized() {\n return $this->_has(1);\n }", "public function supportsCourseOfferingCatalogAssignment() {\n \treturn $this->manager->supportsCourseOfferingCatalogAssignment();\n\t}", "public function authorize()\n {\n return PrivateCategory::where([\n ['owner_id', '=', Auth::user()->id],\n ['id', '=', $this->category_id],\n ])->exists();\n }" ]
[ "0.72431564", "0.71832025", "0.6421889", "0.63752073", "0.6372867", "0.61922044", "0.61629236", "0.61516887", "0.6088547", "0.6023293", "0.6015788", "0.5937918", "0.58835906", "0.58796704", "0.58509636", "0.5839969", "0.5832234", "0.5829884", "0.58212954", "0.5810474", "0.57894945", "0.5768476", "0.5757235", "0.57431966", "0.5731996", "0.57315516", "0.572832", "0.5721928", "0.5718553", "0.57183033" ]
0.7472345
0
Gets the list of Course Ids associated with a CourseCatalog.
public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) { $ids = array(); $courses = $this->getCoursesByCatalog($courseCatalogId); while ($courses->hasNext()) { $ids[] = $courses->getNextCourse()->getId(); } return new phpkit_id_ArrayIdList($ids); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCatalogIdsByCourse(osid_id_Id $courseId) {\t\t\n\t\t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->execute($parameters);\n \t\n \t$ids = array();\n \twhile ($row = $statement->fetch(PDO::FETCH_ASSOC)) {\n \t\t$ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog/');\n \t}\n \t$statement->closeCursor();\n \t\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "public function getCourseIdsByCatalogs(osid_id_IdList $courseCatalogIdList) {\n \t$idList = new phpkit_CombinedList('osid_id_IdList');\n \twhile ($courseCatalogIdList->hasNext()) {\n\t\t\ttry {\n\t\t\t\t$idList->addList($this->getCourseIdsByCatalog($courseCatalogIdList->getNextId()));\n\t\t\t} catch (osid_NotFoundException $e) {\n\t\t\t\tif ($this->usesPlenaryView())\n\t\t\t\t\tthrow $e;\n\t\t\t}\n\t\t}\n \treturn $idList;\n }", "public function getCatalogIds() {\n /* @var $productDao \\prosys\\model\\SKCZ_ProductDao */\n $productDao = Agents::getAgent('SKCZ_ProductDao', Agents::TYPE_MODEL);\n \n return array_map(\n function($row) {\n return $row->katalogove_cislo;\n },\n $productDao->findRecordsProjection(\n ['katalogove_cislo'],\n SqlFilter::create()->comparise('id_vyrobce', '=', $this->id)\n ->andL()->comparise('katalogove_cislo', '!=', '')\n ->andL()->comparise('odstranen', '=', '0')\n ->andL()->comparise('aktivni', '=', '1')\n )\n );\n }", "public function getCoursesByCatalog(osid_id_Id $courseCatalogId) {\n \t$lookupSession = $this->manager->getCourseLookupSessionForCatalog($courseCatalogId);\n \t$lookupSession->useIsolatedView();\n \tif ($this->usesPlenaryView())\n \t\t$lookupSession->usePlenaryCourseView();\n \telse\n \t\t$lookupSession->useComparativeCourseView();\n \t\n \treturn $lookupSession->getCourses();\n }", "public function GetCourses()\n\t\t{\n $course_students = CourseStudent::GetAll(['student_id' => $this->GetAttribute(static::$primary_key)]);\n $courses = array();\n\n foreach ($course_students as $course_student) {\n $courses[] = Course::GetFromPrimaryKey($course_student->GetAttribute('course_id'));\n }\n\n return $courses;\n\t\t}", "protected function getCatalogIds( array $catalogCodes ) : array\n\t{\n\t\t$catalogManager = \\Aimeos\\MShop::create( $this->getContext(), 'catalog' );\n\n\t\t$search = $catalogManager->createSearch( true );\n\t\t$expr = array(\n\t\t\t$search->compare( '==', 'catalog.code', $catalogCodes ),\n\t\t\t$search->getConditions(),\n\t\t);\n\t\t$search->setConditions( $search->combine( '&&', $expr ) );\n\n\t\treturn $catalogManager->searchItems( $search )->keys()->toArray();\n\t}", "public static function courses(){\n return Catalog::where('active',1)\n ->where('for_sale', 1)\n ->where('litmos_deleted', 0)\n ->orderBy('name')\n ->lists( 'name', 'id');\n }", "public function get_cat_ids()\n {\n $categories = $this->categories\n ->where('is_active', '=', 1)\n ->find_all();\n\n $ids = [];\n\n foreach ($categories as $category) {\n if ($category->loaded()) {\n $ids[] = $category->id;\n }\n }\n\n return $ids;\n }", "public function getCatalogsByCourse(osid_id_Id $courseId) {\n \t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->execute($parameters);\n \t\n \t$catalogs = array();\n \twhile ($row = $statement->fetch(PDO::FETCH_ASSOC)) {\n \t\t$catalogs[] = new banner_course_CourseCatalog(\n \t\t\t\t\t$this->getOsidIdFromString($row['catalog_id'], 'catalog/'), \n \t\t\t\t\t$row['catalog_title']);\n \t}\n \t$statement->closeCursor();\n \t\n \treturn new phpkit_course_ArrayCourseCatalogList($catalogs);\n }", "public function getAllCourses()\n {\n $courses = TableRegistry::getTableLocator()->get('Courses');\n $courses = $courses->find('all')->distinct('id')->toArray();\n return $courses;\n }", "public function getCourseList()\n {\n $course_list = [];\n\n foreach($this->sections as $section)\n {\n $course_list[$section->getCourseId()] = $section->course_subject.' '.$section->course_number.' '.$section->course_name;\n }\n\n return $course_list;\n }", "public function getCoursesByCatalogs(osid_id_IdList $courseCatalogIdList) {\n \t$courseList = new phpkit_CombinedList('osid_course_CourseList');\n \twhile ($courseCatalogIdList->hasNext()) {\n \t\ttry {\n \t\t\t$courseList->addList($this->getCoursesByCatalog($courseCatalogIdList->getNextId()));\n \t\t} catch (osid_NotFoundException $e) {\n\t\t\t\tif ($this->usesPlenaryView())\n\t\t\t\t\tthrow $e;\n\t\t\t}\n \t}\n \treturn $courseList;\n }", "public static function courses()\n {\n return Course::all()->toArray();\n }", "public function get_ids()\n\t{\n\t\treturn $this->_cat_ids;\n\t}", "public function getIds();", "public function getIds();", "function i4_lms_get_courses() {\n global $wpdb, $wpcwdb;\n\n $SQL = \"SELECT course_id, course_title\n\t\t\tFROM $wpcwdb->courses\n\t\t\tORDER BY course_title ASC\n\t\t\t\";\n\n $courses = $wpdb->get_results($SQL);\n\n return $courses;\n }", "public function getListOfIdOfAllCategories()\n {\n $sqlQuery = \"SELECT `id` FROM `categories` \";\n $queryResult = $this->dataBase->query($sqlQuery);\n $listOfIDofAllCategories = [];\n\n while($tableRow = $queryResult->fetch()) {\n $listOfIDofAllCategories[] = $tableRow[\"id\"];\n }\n\n return $listOfIDofAllCategories;\n }", "public function getCategoryIds()\n {\n if (! $this->hasData('category_ids')) {\n $wasLocked = false;\n if ($this->isLockedAttribute('category_ids')) {\n $wasLocked = true;\n $this->unlockAttribute('category_ids');\n }\n $ids = $this->_getResource()->getCategoryIds($this);\n $this->setData('category_ids', $ids);\n if ($wasLocked) {\n $this->lockAttribute('category_ids');\n }\n }\n\n return (array) $this->_getData('category_ids');\n }", "public function getIdsList() {\n return $this->_get(1);\n }", "function local_mediacore_fetch_lti_tool_ids_by_course_id($cid) {\n global $DB;\n $record = $DB->get_record('config_plugins', array(\n 'plugin' => MEDIACORE_LOCAL_COURSELTI_SETTING_NAME,\n 'name' => (string)$cid,\n ));\n if (empty($record) || empty($record->value)) {\n return array();\n }\n return explode(',', $record->value);\n}", "public function getCourses($conn){\n $courses = [];\n $courses = CourseModel::getCourses($conn);\n return $courses;\n \n }", "private function get_user_courseids($userid) {\n global $DB;\n $sql = \"SELECT e.courseid\n FROM {enrol} e\n LEFT JOIN {user_enrolments} ue\n ON e.id = ue.enrolid\n WHERE ue.userid = :userid;\";\n $courses = $DB->get_recordset_sql($sql, array('userid' => $userid));\n return $courses;\n }", "private function getGetCatalogsStatement () {\n \tif (!isset(self::$getCatalogsByCourse_stmt)) {\n \t\tself::$getCatalogsByCourse_stmt = $this->manager->getDB()->prepare(\n\"SELECT\n\tcourse_catalog.catalog_id,\n\tcatalog_title\nFROM\n\tSCBCRSE\n\tLEFT JOIN course_catalog_college ON SCBCRSE_COLL_CODE = coll_code\n\tLEFT JOIN course_catalog ON course_catalog_college.catalog_id = course_catalog.catalog_id\nWHERE\n\tSCBCRSE_SUBJ_CODE = :subject_code\n\tAND SCBCRSE_CRSE_NUMB = :course_number\n\tAND SCBCRSE_CSTA_CODE NOT IN (\n\t\t'C', 'I', 'P', 'T', 'X'\n\t)\nGROUP BY SCBCRSE_SUBJ_CODE , SCBCRSE_CRSE_NUMB, catalog_id\n\");\n \t}\n \treturn self::$getCatalogsByCourse_stmt;\n }", "public function getCIDs()\n {\n $db = Loader::db();\n $ret = $db->query(\"SELECT * FROM btPagePickerCid WHERE bID=\" . intval($this->bID) );\n\n foreach($ret as $r){\n array_push($this->cids, $r[\"colID\"]);\n }\n\n return $this->cids;\n }", "public static function get_all_courses() {\n\n $context = get_context_instance(CONTEXT_SYSTEM);\n self::validate_context($context);\n require_capability('moodle/course:view', $context); \n $courses = glueserver_course_db::glueserver_get_all_courses();\n $returns = array();\n foreach ($courses as $course) {\n $course = new glueserver_course($course);\n $returns[] = $course->get_data();\n }\n return $returns;\n }", "public function getAllIds();", "function get_video_course_ids () {\n\t$ids = array();\n\t$courses = get_user_paid_orders(); // Get paid courses IDs (products)\n\t\n\tif ( !empty($courses) ) { // If user have purchased courses\n\t\tforeach ($courses as $j => $product_id) {\n\t\t\tif (have_rows('lesson', $product_id)) {\n\t\t\t\t$i = 1; // Inner counter from 1 because haven't free lesson\n\t\t\t\twhile (have_rows('lesson', $product_id)) {\n\t\t\t\t\tthe_row();\n\t\t\t\t\t$ids[\"courseVideo_$j\" . \"_$i\"] = get_sub_field('video_id');\n\t\t\t\t\t$i += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn $ids;\n}", "public static function getCourses()\n {\n global $cont;\n $courses = $cont->prepare(\"SELECT courses.id AS courseId , courses.title AS title , courses.price AS price , courses.body AS body , courses.image AS `image` , categories.name AS catName FROM courses INNER JOIN categories ON courses.catagory_id = categories.id\");\n $courses->execute();\n return $courses;\n }", "public function get_all_courses() {\n\t\t$sql = \"SELECT course_id FROM peducator_courses \n\t\tWHERE peducator_id='$this->peducator_id'\";\n\t\t$result = mysqli_query($this->connect_to_db, $sql);\n\n\t\t$arr = [];\n\t\twhile ($row = mysqli_fetch_array($result)) {\n\t\t\tarray_push($arr, get_course($row['course_id']));\n\t\t}\n\n\t\treturn $arr;\n\n\t}" ]
[ "0.72812325", "0.7099674", "0.6827911", "0.64847654", "0.6342467", "0.6337828", "0.62192035", "0.61992717", "0.61672986", "0.61467516", "0.6085371", "0.5967249", "0.5954191", "0.5940127", "0.5739204", "0.5739204", "0.57051134", "0.5704309", "0.57019484", "0.56833065", "0.56759983", "0.5651543", "0.56325877", "0.56033105", "0.5580916", "0.55626065", "0.5556515", "0.5553982", "0.5521643", "0.5521537" ]
0.7899379
0
Gets the list of Courses associated with a CourseCatalog.
public function getCoursesByCatalog(osid_id_Id $courseCatalogId) { $lookupSession = $this->manager->getCourseLookupSessionForCatalog($courseCatalogId); $lookupSession->useIsolatedView(); if ($this->usesPlenaryView()) $lookupSession->usePlenaryCourseView(); else $lookupSession->useComparativeCourseView(); return $lookupSession->getCourses(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function GetCourses()\n\t\t{\n $course_students = CourseStudent::GetAll(['student_id' => $this->GetAttribute(static::$primary_key)]);\n $courses = array();\n\n foreach ($course_students as $course_student) {\n $courses[] = Course::GetFromPrimaryKey($course_student->GetAttribute('course_id'));\n }\n\n return $courses;\n\t\t}", "public static function courses()\n {\n return Course::all()->toArray();\n }", "public static function courses(){\n return Catalog::where('active',1)\n ->where('for_sale', 1)\n ->where('litmos_deleted', 0)\n ->orderBy('name')\n ->lists( 'name', 'id');\n }", "public function getAllCourses()\n {\n $courses = TableRegistry::getTableLocator()->get('Courses');\n $courses = $courses->find('all')->distinct('id')->toArray();\n return $courses;\n }", "public function getCourseList()\n {\n $course_list = [];\n\n foreach($this->sections as $section)\n {\n $course_list[$section->getCourseId()] = $section->course_subject.' '.$section->course_number.' '.$section->course_name;\n }\n\n return $course_list;\n }", "public function getCourses()\n {\n return $this->courses;\n }", "public function getCourses($conn){\n $courses = [];\n $courses = CourseModel::getCourses($conn);\n return $courses;\n \n }", "public static function getCourses()\n {\n global $cont;\n $courses = $cont->prepare(\"SELECT courses.id AS courseId , courses.title AS title , courses.price AS price , courses.body AS body , courses.image AS `image` , categories.name AS catName FROM courses INNER JOIN categories ON courses.catagory_id = categories.id\");\n $courses->execute();\n return $courses;\n }", "public function coursesCategoryList()\n { \n return CourseCategories::all();\n }", "public function getCatalogsByCourse(osid_id_Id $courseId) {\n \t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->execute($parameters);\n \t\n \t$catalogs = array();\n \twhile ($row = $statement->fetch(PDO::FETCH_ASSOC)) {\n \t\t$catalogs[] = new banner_course_CourseCatalog(\n \t\t\t\t\t$this->getOsidIdFromString($row['catalog_id'], 'catalog/'), \n \t\t\t\t\t$row['catalog_title']);\n \t}\n \t$statement->closeCursor();\n \t\n \treturn new phpkit_course_ArrayCourseCatalogList($catalogs);\n }", "public static function get_all_courses() {\n\n $context = get_context_instance(CONTEXT_SYSTEM);\n self::validate_context($context);\n require_capability('moodle/course:view', $context); \n $courses = glueserver_course_db::glueserver_get_all_courses();\n $returns = array();\n foreach ($courses as $course) {\n $course = new glueserver_course($course);\n $returns[] = $course->get_data();\n }\n return $returns;\n }", "public static function get_courses($category) {\n global $DB, $CFG;\n\n\n $params = self::validate_parameters(self::get_courses_parameters(), array(\n 'categoryid' => $category,\n ));\n if (!$category) {\n return array(array('id' => 0, 'fullname' => get_string('all')));\n }\n $category = $DB->get_record('course_categories', array('id' => $category), '*', MUST_EXIST);\n $courses = get_courses($category->id);\n foreach ($courses as $c) {\n if (!$c->visible) {\n unset($courses[$c->id]);\n }\n }\n return $courses;\n }", "public function getCoursesByCatalogs(osid_id_IdList $courseCatalogIdList) {\n \t$courseList = new phpkit_CombinedList('osid_course_CourseList');\n \twhile ($courseCatalogIdList->hasNext()) {\n \t\ttry {\n \t\t\t$courseList->addList($this->getCoursesByCatalog($courseCatalogIdList->getNextId()));\n \t\t} catch (osid_NotFoundException $e) {\n\t\t\t\tif ($this->usesPlenaryView())\n\t\t\t\t\tthrow $e;\n\t\t\t}\n \t}\n \treturn $courseList;\n }", "public function getAllCourses()\n {\n $courses = $this->courseRepository->getAllCourses();\n if (isset($courses['errorMsg'])) {\n $courses = $this->makeEmptyCollection();\n }\n\n return view('front-end.courses.list', ['courses' => $courses]);\n }", "public function getCategories()\n {\n return $this->request(\"core_course_get_categories\");\n }", "public function getCourses()\n {\n return $this->hasMany(Course::className(), ['language' => 'ISO']);\n }", "function i4_lms_get_courses() {\n global $wpdb, $wpcwdb;\n\n $SQL = \"SELECT course_id, course_title\n\t\t\tFROM $wpcwdb->courses\n\t\t\tORDER BY course_title ASC\n\t\t\t\";\n\n $courses = $wpdb->get_results($SQL);\n\n return $courses;\n }", "public function get_courses(){\n\t\t$query = $this->db->get('course');\n\t\treturn $query->result();\n\t}", "public function get_courses(){\n return $this->courses;\n }", "function get_all_courses()\n\t{\n\t\t// fetch all data\n\t\treturn $this->db->query('SELECT * FROM courses')->result_array();\n\t}", "private function getCourses(Maconomy $client): CourseCollection\n {\n // fetches a single course, if a course id was given\n if ($this->isSingleCourseSync()) {\n return $client->getCourse($this->maconomyId);\n }\n\n return $client->getCourses();\n }", "private function getGetCatalogsStatement () {\n \tif (!isset(self::$getCatalogsByCourse_stmt)) {\n \t\tself::$getCatalogsByCourse_stmt = $this->manager->getDB()->prepare(\n\"SELECT\n\tcourse_catalog.catalog_id,\n\tcatalog_title\nFROM\n\tSCBCRSE\n\tLEFT JOIN course_catalog_college ON SCBCRSE_COLL_CODE = coll_code\n\tLEFT JOIN course_catalog ON course_catalog_college.catalog_id = course_catalog.catalog_id\nWHERE\n\tSCBCRSE_SUBJ_CODE = :subject_code\n\tAND SCBCRSE_CRSE_NUMB = :course_number\n\tAND SCBCRSE_CSTA_CODE NOT IN (\n\t\t'C', 'I', 'P', 'T', 'X'\n\t)\nGROUP BY SCBCRSE_SUBJ_CODE , SCBCRSE_CRSE_NUMB, catalog_id\n\");\n \t}\n \treturn self::$getCatalogsByCourse_stmt;\n }", "public function frontpage_available_courses() {\r\n global $CFG;\r\n require_once($CFG->libdir. '/coursecatlib.php');\r\n\r\n $chelper = new coursecat_helper();\r\n $chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED)->\r\n set_courses_display_options(array(\r\n 'recursive' => true,\r\n 'limit' => $CFG->frontpagecourselimit,\r\n 'viewmoreurl' => new moodle_url('/course/index.php'),\r\n 'viewmoretext' => new lang_string('fulllistofcourses')));\r\n\r\n $chelper->set_attributes(array('class' => 'frontpage-course-list-all'));\r\n $courses = coursecat::get(0)->get_courses($chelper->get_courses_display_options());\r\n $totalcount = coursecat::get(0)->get_courses_count($chelper->get_courses_display_options());\r\n if (!$totalcount && !$this->page->user_is_editing() && has_capability('moodle/course:create', context_system::instance())) {\r\n // Print link to create a new course, for the 1st available category.\r\n return $this->add_new_course_button();\r\n }\r\n return $this->frontpage_courseboxes($chelper, $courses);\r\n }", "public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) {\n \t$ids = array();\n \t$courses = $this->getCoursesByCatalog($courseCatalogId);\n \twhile ($courses->hasNext()) {\n \t\t$ids[] = $courses->getNextCourse()->getId();\n \t}\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "public function getCatalogues()\n {\n return Catalogue::all();\n }", "function i4_get_all_courses() {\n global $wpcwdb, $wpdb;\n\n $course_table_name = $wpdb->prefix . 'wpcw_courses';\n\n $wpdb->show_errors();\n\n $SQL = \"SELECT course_id, course_title FROM $course_table_name ORDER BY course_title\";\n $results = $wpdb->get_results($SQL, OBJECT_K);\n return $this->results_to_course_array($results);\n }", "public function courseList()\n {\n return $this->belongTo(CourseList::class);\n }", "public function courses()\n {\n return $this->morphedByMany(Course::class, 'subjectables');\n }", "private function getCoursesWithLogs()\n {\n return $this->entityManager->createQueryBuilder()\n ->select('course')\n ->from(Course::class, 'course')\n ->innerJoin(ActionLog::class, 'log', Expr\\Join::WITH, 'course.id = log.course')\n ->andWhere('course.sandbox = :false')\n ->andWhere('course.id in (:ids)')\n ->setParameter('false', false)\n ->setParameter('ids', $this->getAvailableCoursesIds())\n ->orderBy('course.info.title', 'ASC')\n ->getQuery()\n ->getResult();\n }", "public static function fetchCatalogs()\n {\n $Sql = \"SELECT * FROM `db_catalogs`\";\n Parent::query($Sql);\n\n $catalogs = Parent::fetchAll();\n if (empty($catalogs)) {\n return array(\n 'status' => false,\n 'data' => []\n );\n }\n\n return array(\n 'status' => true,\n 'data' => $catalogs\n );\n }" ]
[ "0.71496224", "0.7125692", "0.70384246", "0.69054234", "0.68716055", "0.6822623", "0.67812306", "0.6755467", "0.66981727", "0.6686777", "0.66485065", "0.6596202", "0.65363705", "0.6517668", "0.650607", "0.64620215", "0.6339792", "0.6298999", "0.6254616", "0.6078578", "0.6061398", "0.60569704", "0.6039407", "0.6024314", "0.6016104", "0.59827256", "0.5972408", "0.595076", "0.5938298", "0.59196436" ]
0.7477056
0
Gets the list of Course Ids corresponding to a list of CourseCatalog objects.
public function getCourseIdsByCatalogs(osid_id_IdList $courseCatalogIdList) { $idList = new phpkit_CombinedList('osid_id_IdList'); while ($courseCatalogIdList->hasNext()) { try { $idList->addList($this->getCourseIdsByCatalog($courseCatalogIdList->getNextId())); } catch (osid_NotFoundException $e) { if ($this->usesPlenaryView()) throw $e; } } return $idList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) {\n \t$ids = array();\n \t$courses = $this->getCoursesByCatalog($courseCatalogId);\n \twhile ($courses->hasNext()) {\n \t\t$ids[] = $courses->getNextCourse()->getId();\n \t}\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "public function getCatalogIdsByCourse(osid_id_Id $courseId) {\t\t\n\t\t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->execute($parameters);\n \t\n \t$ids = array();\n \twhile ($row = $statement->fetch(PDO::FETCH_ASSOC)) {\n \t\t$ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog/');\n \t}\n \t$statement->closeCursor();\n \t\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "public function getCatalogIds() {\n /* @var $productDao \\prosys\\model\\SKCZ_ProductDao */\n $productDao = Agents::getAgent('SKCZ_ProductDao', Agents::TYPE_MODEL);\n \n return array_map(\n function($row) {\n return $row->katalogove_cislo;\n },\n $productDao->findRecordsProjection(\n ['katalogove_cislo'],\n SqlFilter::create()->comparise('id_vyrobce', '=', $this->id)\n ->andL()->comparise('katalogove_cislo', '!=', '')\n ->andL()->comparise('odstranen', '=', '0')\n ->andL()->comparise('aktivni', '=', '1')\n )\n );\n }", "protected function getCatalogIds( array $catalogCodes ) : array\n\t{\n\t\t$catalogManager = \\Aimeos\\MShop::create( $this->getContext(), 'catalog' );\n\n\t\t$search = $catalogManager->createSearch( true );\n\t\t$expr = array(\n\t\t\t$search->compare( '==', 'catalog.code', $catalogCodes ),\n\t\t\t$search->getConditions(),\n\t\t);\n\t\t$search->setConditions( $search->combine( '&&', $expr ) );\n\n\t\treturn $catalogManager->searchItems( $search )->keys()->toArray();\n\t}", "public function getCoursesByCatalogs(osid_id_IdList $courseCatalogIdList) {\n \t$courseList = new phpkit_CombinedList('osid_course_CourseList');\n \twhile ($courseCatalogIdList->hasNext()) {\n \t\ttry {\n \t\t\t$courseList->addList($this->getCoursesByCatalog($courseCatalogIdList->getNextId()));\n \t\t} catch (osid_NotFoundException $e) {\n\t\t\t\tif ($this->usesPlenaryView())\n\t\t\t\t\tthrow $e;\n\t\t\t}\n \t}\n \treturn $courseList;\n }", "public function GetCourses()\n\t\t{\n $course_students = CourseStudent::GetAll(['student_id' => $this->GetAttribute(static::$primary_key)]);\n $courses = array();\n\n foreach ($course_students as $course_student) {\n $courses[] = Course::GetFromPrimaryKey($course_student->GetAttribute('course_id'));\n }\n\n return $courses;\n\t\t}", "public function get_cat_ids()\n {\n $categories = $this->categories\n ->where('is_active', '=', 1)\n ->find_all();\n\n $ids = [];\n\n foreach ($categories as $category) {\n if ($category->loaded()) {\n $ids[] = $category->id;\n }\n }\n\n return $ids;\n }", "public function getCourseList()\n {\n $course_list = [];\n\n foreach($this->sections as $section)\n {\n $course_list[$section->getCourseId()] = $section->course_subject.' '.$section->course_number.' '.$section->course_name;\n }\n\n return $course_list;\n }", "public function getAllCourses()\n {\n $courses = TableRegistry::getTableLocator()->get('Courses');\n $courses = $courses->find('all')->distinct('id')->toArray();\n return $courses;\n }", "public static function courses(){\n return Catalog::where('active',1)\n ->where('for_sale', 1)\n ->where('litmos_deleted', 0)\n ->orderBy('name')\n ->lists( 'name', 'id');\n }", "public function getIdsList() {\n return $this->_get(1);\n }", "public function get_ids()\n\t{\n\t\treturn $this->_cat_ids;\n\t}", "public function getListOfIdOfAllCategories()\n {\n $sqlQuery = \"SELECT `id` FROM `categories` \";\n $queryResult = $this->dataBase->query($sqlQuery);\n $listOfIDofAllCategories = [];\n\n while($tableRow = $queryResult->fetch()) {\n $listOfIDofAllCategories[] = $tableRow[\"id\"];\n }\n\n return $listOfIDofAllCategories;\n }", "public function getCatalogsByCourse(osid_id_Id $courseId) {\n \t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->execute($parameters);\n \t\n \t$catalogs = array();\n \twhile ($row = $statement->fetch(PDO::FETCH_ASSOC)) {\n \t\t$catalogs[] = new banner_course_CourseCatalog(\n \t\t\t\t\t$this->getOsidIdFromString($row['catalog_id'], 'catalog/'), \n \t\t\t\t\t$row['catalog_title']);\n \t}\n \t$statement->closeCursor();\n \t\n \treturn new phpkit_course_ArrayCourseCatalogList($catalogs);\n }", "public function getIds();", "public function getIds();", "public function getCoursesByCatalog(osid_id_Id $courseCatalogId) {\n \t$lookupSession = $this->manager->getCourseLookupSessionForCatalog($courseCatalogId);\n \t$lookupSession->useIsolatedView();\n \tif ($this->usesPlenaryView())\n \t\t$lookupSession->usePlenaryCourseView();\n \telse\n \t\t$lookupSession->useComparativeCourseView();\n \t\n \treturn $lookupSession->getCourses();\n }", "function get_crs_ids ($courses_list){\n $array_list=array();\n for($i = 0 ; $i<count($courses_list); $i++){\n array_push($array_list, $courses_list[$i][\"Crs_id\"]);\n }\n //var_dump($array_list);\n return $array_list;\n}", "public function getRoleIds() {\n\t \treturn array_map(\n \t\t\tfunction($role) {\n\t\t \t\treturn $role->getRoleid();\n\t\t \t},\n\t\t \t$this->getRoles()\n\t \t );\n\t }", "public function cryptoIds()\n {\n $ticker = $this->ticker();\n\n return array_map(function($o) {\n return $o->id;\n }, $ticker);\n }", "public function getCategoryIds()\n {\n if (! $this->hasData('category_ids')) {\n $wasLocked = false;\n if ($this->isLockedAttribute('category_ids')) {\n $wasLocked = true;\n $this->unlockAttribute('category_ids');\n }\n $ids = $this->_getResource()->getCategoryIds($this);\n $this->setData('category_ids', $ids);\n if ($wasLocked) {\n $this->lockAttribute('category_ids');\n }\n }\n\n return (array) $this->_getData('category_ids');\n }", "public function getCitiesIds()\n {\n $query = City::find()\n ->joinWith(['region'], 'false')\n ->where([\n '{{%regions}}.id' => Leader::getLeaderRegion()\n ])\n ->groupBy('{{%cities}}.id');\n\n return $query->column();\n }", "public function getAllIds();", "public function listId()\n {\n return $this->contractor->all()->pluck('id')->all();\n }", "public abstract function get_ids();", "function get_video_course_ids () {\n\t$ids = array();\n\t$courses = get_user_paid_orders(); // Get paid courses IDs (products)\n\t\n\tif ( !empty($courses) ) { // If user have purchased courses\n\t\tforeach ($courses as $j => $product_id) {\n\t\t\tif (have_rows('lesson', $product_id)) {\n\t\t\t\t$i = 1; // Inner counter from 1 because haven't free lesson\n\t\t\t\twhile (have_rows('lesson', $product_id)) {\n\t\t\t\t\tthe_row();\n\t\t\t\t\t$ids[\"courseVideo_$j\" . \"_$i\"] = get_sub_field('video_id');\n\t\t\t\t\t$i += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn $ids;\n}", "function wpsl_get_term_ids( $cat_list ) {\n\n $term_ids = array();\n $cats = explode( ',', $cat_list );\n\n foreach ( $cats as $key => $term_slug ) {\n $term_data = get_term_by( 'slug', $term_slug, 'wpsl_store_category' );\n\n if ( isset( $term_data->term_id ) && $term_data->term_id ) {\n $term_ids[] = $term_data->term_id;\n }\n }\n\n return $term_ids;\n}", "public static function courses()\n {\n return Course::all()->toArray();\n }", "public function getIds(array $codes)\n {\n array_walk($codes, [$this, 'validateCategoryCode']);\n\n $connection = $this->resourceConnection->getConnection();\n $select = $connection->select()->from(CategoryCodeInterface::CATEGORY_CODE)\n ->where(CategoryCodeInterface::CATEGORY_CODE . ' IN (?)', $codes);\n\n $records = $connection->fetchAll($select);\n\n $idByCode = [];\n foreach ($records as $record) {\n $idByCode[$record[\\Ampersand\\CategoryCode\\Api\\Data\\CategoryCodeInterface::CATEGORY_CODE]] = $record[\\Ampersand\\CategoryCode\\Api\\Data\\CategoryCodeInterface::CATEGORY_ID];\n }\n\n return $idByCode;\n }", "public function getCIDs()\n {\n $db = Loader::db();\n $ret = $db->query(\"SELECT * FROM btPagePickerCid WHERE bID=\" . intval($this->bID) );\n\n foreach($ret as $r){\n array_push($this->cids, $r[\"colID\"]);\n }\n\n return $this->cids;\n }" ]
[ "0.76753193", "0.71126395", "0.6887197", "0.6728595", "0.6565588", "0.6200786", "0.6114252", "0.611215", "0.6048621", "0.60457027", "0.6044892", "0.59037507", "0.5902864", "0.5879822", "0.5832614", "0.5832614", "0.5800741", "0.57538456", "0.5745121", "0.5712706", "0.57010573", "0.56851727", "0.565721", "0.56561995", "0.5615501", "0.55884105", "0.55860525", "0.5573706", "0.5572984", "0.5569369" ]
0.7867208
0
Gets the list of Courses corresponding to a list of CourseCatalog objects.
public function getCoursesByCatalogs(osid_id_IdList $courseCatalogIdList) { $courseList = new phpkit_CombinedList('osid_course_CourseList'); while ($courseCatalogIdList->hasNext()) { try { $courseList->addList($this->getCoursesByCatalog($courseCatalogIdList->getNextId())); } catch (osid_NotFoundException $e) { if ($this->usesPlenaryView()) throw $e; } } return $courseList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function GetCourses()\n\t\t{\n $course_students = CourseStudent::GetAll(['student_id' => $this->GetAttribute(static::$primary_key)]);\n $courses = array();\n\n foreach ($course_students as $course_student) {\n $courses[] = Course::GetFromPrimaryKey($course_student->GetAttribute('course_id'));\n }\n\n return $courses;\n\t\t}", "public function getCourseList()\n {\n $course_list = [];\n\n foreach($this->sections as $section)\n {\n $course_list[$section->getCourseId()] = $section->course_subject.' '.$section->course_number.' '.$section->course_name;\n }\n\n return $course_list;\n }", "public static function courses(){\n return Catalog::where('active',1)\n ->where('for_sale', 1)\n ->where('litmos_deleted', 0)\n ->orderBy('name')\n ->lists( 'name', 'id');\n }", "public function getAllCourses()\n {\n $courses = TableRegistry::getTableLocator()->get('Courses');\n $courses = $courses->find('all')->distinct('id')->toArray();\n return $courses;\n }", "public static function courses()\n {\n return Course::all()->toArray();\n }", "public function getCoursesByCatalog(osid_id_Id $courseCatalogId) {\n \t$lookupSession = $this->manager->getCourseLookupSessionForCatalog($courseCatalogId);\n \t$lookupSession->useIsolatedView();\n \tif ($this->usesPlenaryView())\n \t\t$lookupSession->usePlenaryCourseView();\n \telse\n \t\t$lookupSession->useComparativeCourseView();\n \t\n \treturn $lookupSession->getCourses();\n }", "public static function get_all_courses() {\n\n $context = get_context_instance(CONTEXT_SYSTEM);\n self::validate_context($context);\n require_capability('moodle/course:view', $context); \n $courses = glueserver_course_db::glueserver_get_all_courses();\n $returns = array();\n foreach ($courses as $course) {\n $course = new glueserver_course($course);\n $returns[] = $course->get_data();\n }\n return $returns;\n }", "public function getCourses($conn){\n $courses = [];\n $courses = CourseModel::getCourses($conn);\n return $courses;\n \n }", "public function getCourses()\n {\n return $this->courses;\n }", "public static function getCourses()\n {\n global $cont;\n $courses = $cont->prepare(\"SELECT courses.id AS courseId , courses.title AS title , courses.price AS price , courses.body AS body , courses.image AS `image` , categories.name AS catName FROM courses INNER JOIN categories ON courses.catagory_id = categories.id\");\n $courses->execute();\n return $courses;\n }", "public function getCatalogsByCourse(osid_id_Id $courseId) {\n \t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->execute($parameters);\n \t\n \t$catalogs = array();\n \twhile ($row = $statement->fetch(PDO::FETCH_ASSOC)) {\n \t\t$catalogs[] = new banner_course_CourseCatalog(\n \t\t\t\t\t$this->getOsidIdFromString($row['catalog_id'], 'catalog/'), \n \t\t\t\t\t$row['catalog_title']);\n \t}\n \t$statement->closeCursor();\n \t\n \treturn new phpkit_course_ArrayCourseCatalogList($catalogs);\n }", "public function getCourseIdsByCatalogs(osid_id_IdList $courseCatalogIdList) {\n \t$idList = new phpkit_CombinedList('osid_id_IdList');\n \twhile ($courseCatalogIdList->hasNext()) {\n\t\t\ttry {\n\t\t\t\t$idList->addList($this->getCourseIdsByCatalog($courseCatalogIdList->getNextId()));\n\t\t\t} catch (osid_NotFoundException $e) {\n\t\t\t\tif ($this->usesPlenaryView())\n\t\t\t\t\tthrow $e;\n\t\t\t}\n\t\t}\n \treturn $idList;\n }", "public function courses()\n {\n return $this->morphedByMany(Course::class, 'subjectables');\n }", "public function getCourses()\n {\n return $this->hasMany(Course::className(), ['language' => 'ISO']);\n }", "public function coursesCategoryList()\n { \n return CourseCategories::all();\n }", "function i4_lms_get_courses() {\n global $wpdb, $wpcwdb;\n\n $SQL = \"SELECT course_id, course_title\n\t\t\tFROM $wpcwdb->courses\n\t\t\tORDER BY course_title ASC\n\t\t\t\";\n\n $courses = $wpdb->get_results($SQL);\n\n return $courses;\n }", "public function getAllCourses()\n {\n $courses = $this->courseRepository->getAllCourses();\n if (isset($courses['errorMsg'])) {\n $courses = $this->makeEmptyCollection();\n }\n\n return view('front-end.courses.list', ['courses' => $courses]);\n }", "public function get_courses(){\n\t\t$query = $this->db->get('course');\n\t\treturn $query->result();\n\t}", "public function get_all_courses() {\n\t\t$sql = \"SELECT course_id FROM peducator_courses \n\t\tWHERE peducator_id='$this->peducator_id'\";\n\t\t$result = mysqli_query($this->connect_to_db, $sql);\n\n\t\t$arr = [];\n\t\twhile ($row = mysqli_fetch_array($result)) {\n\t\t\tarray_push($arr, get_course($row['course_id']));\n\t\t}\n\n\t\treturn $arr;\n\n\t}", "function i4_get_all_courses() {\n global $wpcwdb, $wpdb;\n\n $course_table_name = $wpdb->prefix . 'wpcw_courses';\n\n $wpdb->show_errors();\n\n $SQL = \"SELECT course_id, course_title FROM $course_table_name ORDER BY course_title\";\n $results = $wpdb->get_results($SQL, OBJECT_K);\n return $this->results_to_course_array($results);\n }", "public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) {\n \t$ids = array();\n \t$courses = $this->getCoursesByCatalog($courseCatalogId);\n \twhile ($courses->hasNext()) {\n \t\t$ids[] = $courses->getNextCourse()->getId();\n \t}\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "function get_all_courses()\n\t{\n\t\t// fetch all data\n\t\treturn $this->db->query('SELECT * FROM courses')->result_array();\n\t}", "private function getCourses(Maconomy $client): CourseCollection\n {\n // fetches a single course, if a course id was given\n if ($this->isSingleCourseSync()) {\n return $client->getCourse($this->maconomyId);\n }\n\n return $client->getCourses();\n }", "public function courseList()\n {\n return $this->belongTo(CourseList::class);\n }", "private function getCoursesWithLogs()\n {\n return $this->entityManager->createQueryBuilder()\n ->select('course')\n ->from(Course::class, 'course')\n ->innerJoin(ActionLog::class, 'log', Expr\\Join::WITH, 'course.id = log.course')\n ->andWhere('course.sandbox = :false')\n ->andWhere('course.id in (:ids)')\n ->setParameter('false', false)\n ->setParameter('ids', $this->getAvailableCoursesIds())\n ->orderBy('course.info.title', 'ASC')\n ->getQuery()\n ->getResult();\n }", "private function getGetCatalogsStatement () {\n \tif (!isset(self::$getCatalogsByCourse_stmt)) {\n \t\tself::$getCatalogsByCourse_stmt = $this->manager->getDB()->prepare(\n\"SELECT\n\tcourse_catalog.catalog_id,\n\tcatalog_title\nFROM\n\tSCBCRSE\n\tLEFT JOIN course_catalog_college ON SCBCRSE_COLL_CODE = coll_code\n\tLEFT JOIN course_catalog ON course_catalog_college.catalog_id = course_catalog.catalog_id\nWHERE\n\tSCBCRSE_SUBJ_CODE = :subject_code\n\tAND SCBCRSE_CRSE_NUMB = :course_number\n\tAND SCBCRSE_CSTA_CODE NOT IN (\n\t\t'C', 'I', 'P', 'T', 'X'\n\t)\nGROUP BY SCBCRSE_SUBJ_CODE , SCBCRSE_CRSE_NUMB, catalog_id\n\");\n \t}\n \treturn self::$getCatalogsByCourse_stmt;\n }", "public function getCategories()\n {\n return $this->request(\"core_course_get_categories\");\n }", "public function getCourses()\n {\n return array(\n 1 => \"Kids Stage I (Pre School)\",\n 2 => \"Kids Stage II (Grade 01)\",\n 3 => \"Kids Stage III (Grade 02 - 05)\",\n 4 => \"School IT Syllabus (Grade 06 - 09)\",\n 5 => \"O/L ICT (Grade 09 - 11)\",\n 6 => \"A/L IT\",\n 7 => \"A/L GIT\",\n 8 => \"MS Office\",\n 9 => \"Graphic Designer\",\n 10 => \"Hardware & Networking\",\n 11 => \"Software Engineering\",\n 12 => \"Web Designing\",\n 13 => \"Type Setting\"\n );\n }", "public function get_courses(){\n return $this->courses;\n }", "public static function get_courses($category) {\n global $DB, $CFG;\n\n\n $params = self::validate_parameters(self::get_courses_parameters(), array(\n 'categoryid' => $category,\n ));\n if (!$category) {\n return array(array('id' => 0, 'fullname' => get_string('all')));\n }\n $category = $DB->get_record('course_categories', array('id' => $category), '*', MUST_EXIST);\n $courses = get_courses($category->id);\n foreach ($courses as $c) {\n if (!$c->visible) {\n unset($courses[$c->id]);\n }\n }\n return $courses;\n }" ]
[ "0.73062104", "0.71245277", "0.7057654", "0.70350176", "0.6980809", "0.6867817", "0.67235196", "0.6720836", "0.662141", "0.65670955", "0.65172315", "0.64136034", "0.6380824", "0.6318145", "0.63082445", "0.6265644", "0.6240504", "0.62089175", "0.613569", "0.610299", "0.6020837", "0.60105336", "0.6009201", "0.59993577", "0.5947247", "0.59393823", "0.59336644", "0.5932724", "0.5929562", "0.59252095" ]
0.7464477
0
Gets the CourseCatalog Ids mapped to a Course.
public function getCatalogIdsByCourse(osid_id_Id $courseId) { $parameters = array( ':subject_code' => $this->getSubjectFromCourseId($courseId), ':course_number' => $this->getNumberFromCourseId($courseId) ); $statement = $this->getGetCatalogsStatement(); $statement->execute($parameters); $ids = array(); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog/'); } $statement->closeCursor(); return new phpkit_id_ArrayIdList($ids); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCourseIdsByCatalog(osid_id_Id $courseCatalogId) {\n \t$ids = array();\n \t$courses = $this->getCoursesByCatalog($courseCatalogId);\n \twhile ($courses->hasNext()) {\n \t\t$ids[] = $courses->getNextCourse()->getId();\n \t}\n \treturn new phpkit_id_ArrayIdList($ids);\n }", "public function getCatalogIds() {\n /* @var $productDao \\prosys\\model\\SKCZ_ProductDao */\n $productDao = Agents::getAgent('SKCZ_ProductDao', Agents::TYPE_MODEL);\n \n return array_map(\n function($row) {\n return $row->katalogove_cislo;\n },\n $productDao->findRecordsProjection(\n ['katalogove_cislo'],\n SqlFilter::create()->comparise('id_vyrobce', '=', $this->id)\n ->andL()->comparise('katalogove_cislo', '!=', '')\n ->andL()->comparise('odstranen', '=', '0')\n ->andL()->comparise('aktivni', '=', '1')\n )\n );\n }", "public function getCourseIdsByCatalogs(osid_id_IdList $courseCatalogIdList) {\n \t$idList = new phpkit_CombinedList('osid_id_IdList');\n \twhile ($courseCatalogIdList->hasNext()) {\n\t\t\ttry {\n\t\t\t\t$idList->addList($this->getCourseIdsByCatalog($courseCatalogIdList->getNextId()));\n\t\t\t} catch (osid_NotFoundException $e) {\n\t\t\t\tif ($this->usesPlenaryView())\n\t\t\t\t\tthrow $e;\n\t\t\t}\n\t\t}\n \treturn $idList;\n }", "public function GetCourses()\n\t\t{\n $course_students = CourseStudent::GetAll(['student_id' => $this->GetAttribute(static::$primary_key)]);\n $courses = array();\n\n foreach ($course_students as $course_student) {\n $courses[] = Course::GetFromPrimaryKey($course_student->GetAttribute('course_id'));\n }\n\n return $courses;\n\t\t}", "public function getCoursesByCatalog(osid_id_Id $courseCatalogId) {\n \t$lookupSession = $this->manager->getCourseLookupSessionForCatalog($courseCatalogId);\n \t$lookupSession->useIsolatedView();\n \tif ($this->usesPlenaryView())\n \t\t$lookupSession->usePlenaryCourseView();\n \telse\n \t\t$lookupSession->useComparativeCourseView();\n \t\n \treturn $lookupSession->getCourses();\n }", "public function getCatalogsByCourse(osid_id_Id $courseId) {\n \t$parameters = array(\n\t\t\t\t':subject_code' => $this->getSubjectFromCourseId($courseId),\n\t\t\t\t':course_number' => $this->getNumberFromCourseId($courseId)\n\t\t\t);\n\t\t$statement = $this->getGetCatalogsStatement();\n\t\t$statement->execute($parameters);\n \t\n \t$catalogs = array();\n \twhile ($row = $statement->fetch(PDO::FETCH_ASSOC)) {\n \t\t$catalogs[] = new banner_course_CourseCatalog(\n \t\t\t\t\t$this->getOsidIdFromString($row['catalog_id'], 'catalog/'), \n \t\t\t\t\t$row['catalog_title']);\n \t}\n \t$statement->closeCursor();\n \t\n \treturn new phpkit_course_ArrayCourseCatalogList($catalogs);\n }", "public function getAllCourses()\n {\n $courses = TableRegistry::getTableLocator()->get('Courses');\n $courses = $courses->find('all')->distinct('id')->toArray();\n return $courses;\n }", "public static function courses(){\n return Catalog::where('active',1)\n ->where('for_sale', 1)\n ->where('litmos_deleted', 0)\n ->orderBy('name')\n ->lists( 'name', 'id');\n }", "public function getCourseId(): int\n {\n return $this->courseId;\n }", "public function getCourseId(): int\n {\n return $this->courseId;\n }", "public function get_cat_ids()\n {\n $categories = $this->categories\n ->where('is_active', '=', 1)\n ->find_all();\n\n $ids = [];\n\n foreach ($categories as $category) {\n if ($category->loaded()) {\n $ids[] = $category->id;\n }\n }\n\n return $ids;\n }", "public function getCourseList()\n {\n $course_list = [];\n\n foreach($this->sections as $section)\n {\n $course_list[$section->getCourseId()] = $section->course_subject.' '.$section->course_number.' '.$section->course_name;\n }\n\n return $course_list;\n }", "public static function courses()\n {\n return Course::all()->toArray();\n }", "public function get_course_id(){\n\t\treturn $this->_courseid;\n\t}", "public function read_sections_ids() {\n\n\t\t// Get course's sections id data from cache\n\t\t$ids = LP_Object_Cache::get( 'course-' . $this->course_id, 'learn-press/course-sections-ids' );\n\n\t\tif ( ! $ids ) {\n\t\t\tglobal $wpdb;\n\t\t\t// get sections id\n\t\t\t$ids = $wpdb->get_col( $wpdb->prepare( \"SELECT section_id FROM {$wpdb->prefix}learnpress_sections WHERE section_course_id = %d\", $this->course_id ) );\n\t\t\t// Set cache\n\t\t\tLP_Object_Cache::set( 'course-' . $this->course_id, $ids, 'learn-press/course-sections-ids' );\n\t\t}\n\n\t\treturn $ids;\n\t}", "private function get_user_courseids($userid) {\n global $DB;\n $sql = \"SELECT e.courseid\n FROM {enrol} e\n LEFT JOIN {user_enrolments} ue\n ON e.id = ue.enrolid\n WHERE ue.userid = :userid;\";\n $courses = $DB->get_recordset_sql($sql, array('userid' => $userid));\n return $courses;\n }", "public function get_ids()\n\t{\n\t\treturn $this->_cat_ids;\n\t}", "function local_mediacore_fetch_lti_tool_ids_by_course_id($cid) {\n global $DB;\n $record = $DB->get_record('config_plugins', array(\n 'plugin' => MEDIACORE_LOCAL_COURSELTI_SETTING_NAME,\n 'name' => (string)$cid,\n ));\n if (empty($record) || empty($record->value)) {\n return array();\n }\n return explode(',', $record->value);\n}", "function get_video_course_ids () {\n\t$ids = array();\n\t$courses = get_user_paid_orders(); // Get paid courses IDs (products)\n\t\n\tif ( !empty($courses) ) { // If user have purchased courses\n\t\tforeach ($courses as $j => $product_id) {\n\t\t\tif (have_rows('lesson', $product_id)) {\n\t\t\t\t$i = 1; // Inner counter from 1 because haven't free lesson\n\t\t\t\twhile (have_rows('lesson', $product_id)) {\n\t\t\t\t\tthe_row();\n\t\t\t\t\t$ids[\"courseVideo_$j\" . \"_$i\"] = get_sub_field('video_id');\n\t\t\t\t\t$i += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn $ids;\n}", "function i4_lms_get_courses() {\n global $wpdb, $wpcwdb;\n\n $SQL = \"SELECT course_id, course_title\n\t\t\tFROM $wpcwdb->courses\n\t\t\tORDER BY course_title ASC\n\t\t\t\";\n\n $courses = $wpdb->get_results($SQL);\n\n return $courses;\n }", "public function get_course_id()\n {\n return $this->get_default_property(self::PROPERTY_COURSE_ID);\n }", "public static function glueserver_get_urls_course($courseid){\n\t\tglobal $DB,$CFG;\n \n $sql = \"SELECT url.*\n FROM {$CFG->prefix}url url\n WHERE url.course = ?\";\n $sqlparams = array($courseid);\n return $DB->get_records_sql($sql, $sqlparams);\t\t\n }", "private function getGetCatalogsStatement () {\n \tif (!isset(self::$getCatalogsByCourse_stmt)) {\n \t\tself::$getCatalogsByCourse_stmt = $this->manager->getDB()->prepare(\n\"SELECT\n\tcourse_catalog.catalog_id,\n\tcatalog_title\nFROM\n\tSCBCRSE\n\tLEFT JOIN course_catalog_college ON SCBCRSE_COLL_CODE = coll_code\n\tLEFT JOIN course_catalog ON course_catalog_college.catalog_id = course_catalog.catalog_id\nWHERE\n\tSCBCRSE_SUBJ_CODE = :subject_code\n\tAND SCBCRSE_CRSE_NUMB = :course_number\n\tAND SCBCRSE_CSTA_CODE NOT IN (\n\t\t'C', 'I', 'P', 'T', 'X'\n\t)\nGROUP BY SCBCRSE_SUBJ_CODE , SCBCRSE_CRSE_NUMB, catalog_id\n\");\n \t}\n \treturn self::$getCatalogsByCourse_stmt;\n }", "public static function getCourses()\n {\n global $cont;\n $courses = $cont->prepare(\"SELECT courses.id AS courseId , courses.title AS title , courses.price AS price , courses.body AS body , courses.image AS `image` , categories.name AS catName FROM courses INNER JOIN categories ON courses.catagory_id = categories.id\");\n $courses->execute();\n return $courses;\n }", "public function getCitiesIds()\n {\n $query = City::find()\n ->joinWith(['region'], 'false')\n ->where([\n '{{%regions}}.id' => Leader::getLeaderRegion()\n ])\n ->groupBy('{{%cities}}.id');\n\n return $query->column();\n }", "protected function getCatalogIds( array $catalogCodes ) : array\n\t{\n\t\t$catalogManager = \\Aimeos\\MShop::create( $this->getContext(), 'catalog' );\n\n\t\t$search = $catalogManager->createSearch( true );\n\t\t$expr = array(\n\t\t\t$search->compare( '==', 'catalog.code', $catalogCodes ),\n\t\t\t$search->getConditions(),\n\t\t);\n\t\t$search->setConditions( $search->combine( '&&', $expr ) );\n\n\t\treturn $catalogManager->searchItems( $search )->keys()->toArray();\n\t}", "public function getCourses()\n {\n return array(\n 1 => \"Kids Stage I (Pre School)\",\n 2 => \"Kids Stage II (Grade 01)\",\n 3 => \"Kids Stage III (Grade 02 - 05)\",\n 4 => \"School IT Syllabus (Grade 06 - 09)\",\n 5 => \"O/L ICT (Grade 09 - 11)\",\n 6 => \"A/L IT\",\n 7 => \"A/L GIT\",\n 8 => \"MS Office\",\n 9 => \"Graphic Designer\",\n 10 => \"Hardware & Networking\",\n 11 => \"Software Engineering\",\n 12 => \"Web Designing\",\n 13 => \"Type Setting\"\n );\n }", "public function getmaristcourseid($course)\n\t{\n\t\t$sql = \"SELECT course_id FROM marist_courses WHERE course_num = '$course';\";\n\t\t$results = $this->db->query($sql, array($course));\n\t\treturn $results;\n\t}", "public function get_courses(){\n\t\t$query = $this->db->get('course');\n\t\treturn $query->result();\n\t}", "public function getIds();" ]
[ "0.76474375", "0.68942463", "0.6645033", "0.6436734", "0.6417131", "0.62609273", "0.6161324", "0.61395127", "0.6127694", "0.6127694", "0.60481673", "0.6031365", "0.60047334", "0.58725065", "0.5861905", "0.5826808", "0.5821608", "0.5818245", "0.58150244", "0.57863843", "0.5781798", "0.57655984", "0.56816894", "0.56571066", "0.56553024", "0.56523246", "0.56226635", "0.56194353", "0.56079555", "0.5588865" ]
0.7548647
1
Answer the statement for fetching catalogs
private function getGetCatalogsStatement () { if (!isset(self::$getCatalogsByCourse_stmt)) { self::$getCatalogsByCourse_stmt = $this->manager->getDB()->prepare( "SELECT course_catalog.catalog_id, catalog_title FROM SCBCRSE LEFT JOIN course_catalog_college ON SCBCRSE_COLL_CODE = coll_code LEFT JOIN course_catalog ON course_catalog_college.catalog_id = course_catalog.catalog_id WHERE SCBCRSE_SUBJ_CODE = :subject_code AND SCBCRSE_CRSE_NUMB = :course_number AND SCBCRSE_CSTA_CODE NOT IN ( 'C', 'I', 'P', 'T', 'X' ) GROUP BY SCBCRSE_SUBJ_CODE , SCBCRSE_CRSE_NUMB, catalog_id "); } return self::$getCatalogsByCourse_stmt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function fetchCatalogs()\n {\n $Sql = \"SELECT * FROM `db_catalogs`\";\n Parent::query($Sql);\n\n $catalogs = Parent::fetchAll();\n if (empty($catalogs)) {\n return array(\n 'status' => false,\n 'data' => []\n );\n }\n\n return array(\n 'status' => true,\n 'data' => $catalogs\n );\n }", "public function getCatalog() {}", "public static function fetchCatalogByName($name)\n {\n $Sql = \"SELECT * FROM `db_catalogs` WHERE name = :name\";\n Parent::query($Sql);\n\n Parent::bindParams('name', $name);\n $catalog = Parent::fetch();\n if (empty($catalog)) {\n return array(\n 'status' => false,\n 'data' => []\n );\n }\n\n return array(\n 'status' => true,\n 'data' => $catalog\n );\n }", "protected function getSelectStatement()\n {\n return \"SELECT BookID, ISBN10, ISBN13, Title, CopyrightYear, TrimSize, PageCountsEditorialEst\n as PageCount, Description, CoverImage, Status, Subcategories.SubcategoryID, SubcategoryName, Imprints.ImprintID, Imprint, BindingType FROM Books\n JOIN Statuses ON (Books.ProductionStatusID = Statuses.StatusID) JOIN Subcategories ON \n (Books.SubcategoryID = Subcategories.SubcategoryID) JOIN Imprints USING (ImprintID) JOIN BindingTypes USING (BindingTypeID)\";\n }", "function ierg4210_prod_fetch() {\n // DB manipulation\n global $db;\n $db = ierg4210_DB();\n $catid = (int)$_REQUEST['catid'];\n $q = $db->prepare(\"SELECT * FROM products WHERE catid = $catid;\");\n if ($q->execute())\n return $q->fetchAll();\n}", "public function GetCategories() {\n // Setup the Query\n $this->sql = \"SELECT *\n FROM categories\";\n \n // Run the query \n $this->RunBasicQuery();\n }", "public function Catalogo()\n {\n \n try{\n $AccesoAdatos = new AD();\n $vlcScript = \"SELECT * \"\n . \" FROM fve_prod\";\n \n return $AccesoAdatos->RetornarResultado($vlcScript) ;\n } catch (Exception $ex) {\n \n echo $ERROR_MESSAGE; \n \n }\n \n }", "function listCatalogs($args) {\n\n $conn = mysql_pconnect($args['server'], $args['username'], $args['password']);\n if($conn === false) {\n throw 'Connection failed.';\n }\n\n $results = mysql_list_dbs($conn);\n $catalogs = array();\n while( $row = mysql_fetch_assoc($results) ) {\n $catalogs[] = $row;\n }\n\n return array( 'catalogs' => $catalogs );\n }", "public function getCategories()\r\n{\r\n $query_string = \"SELECT categoryid, categoryname, categorydescription \";\r\n $query_string .= \"FROM categories\";\r\n\r\n return $query_string;\r\n}", "private function _get_info() {\n\n\t\t/* Grab the basic information from the catalog and return it */\n\t\t$sql = \"SELECT * FROM `access_list` WHERE `id`='\" . Dba::escape($this->id) . \"'\";\n\t\t$db_results = Dba::query($sql);\n\n\t\t$results = Dba::fetch_assoc($db_results);\n\n\t\treturn $results;\n\n\t}", "public function fetchCatalogs($request, $response)\n {\n $Response = [];\n $JwtMiddleware = new JwtMiddleware();\n $jwtMiddleware = $JwtMiddleware::getAndDecodeToken();\n\n if (isset($jwtMiddleware) && $jwtMiddleware == false) {\n $response->code(401)->json([\n 'status' => 401,\n 'message' => 'Sorry, the authenticity of this token could not be verified.',\n 'data' => []\n ]); \n return;\n }\n\n try {\n $CatalogModel = new CatalogModel();\n $catalogs = $CatalogModel::fetchCatalogs();\n\n if ($catalogs['status']) {\n $Response['status'] = true;\n $Response['data'] = $catalogs['data'];\n $Response['message'] = '';\n\n $response->code(200)->json($Response);\n return;\n }\n\n $Response['status'] = 500;\n $Response['message'] = 'Sorry, An unexpected error occured and your catalogs could be retrieved.';\n $Response['data'] = [];\n \n $response->code(500)->json($Response);\n return;\n } catch (Exception $e) {\n $Response['status'] = 500;\n $Response['message'] = $e->getMessage();\n $Response['data'] = [];\n \n $response->code(500)->json($Response);\n return;\n }\n \n return;\n }", "function getProductCategories () {\r\n $sql = \"SELECT * FROM stockgroups\";\r\n return runQuery($sql);\r\n}", "public function catalogos() \n\t{\n\t}", "public function alls()\r\n {\r\n $all = ShopCatalog::find()\r\n ->where([\r\n 'id' => 12355\r\n ])\r\n ->asArray()\r\n ->all();\r\n\r\n vd($all);\r\n }", "private function getAllCategories()\n {\n $query = Queries::$getAllCategories;\n\n try {\n $stmt = $this->db->prepare($query);\n $stmt->execute();\n $result = $stmt->fetchAll(\\PDO::FETCH_ASSOC);\n $this->successResponse($result);\n } catch (\\PDOException$e) {\n $this->errorResponse($e->getMessage());\n }\n }", "public function catalogIndex($count = 10)\n {\n\n\n /* $sql = 'SELECT products.id, product_name, product_price, product_sku, product_properties_values.property_value FROM `products`\n LEFT JOIN product_properties_values ON products.id = product_properties_values.id_product AND product_properties_values.id_property=1\n WHERE product_sku < 999999\n LIMIT 0,' . (int)$count;*/\n\n\n /*$sql = \"\n \n SET @SQL = NULL;\n SELECT\n GROUP_CONCAT(DISTINCT\n CONCAT('GROUP_CONCAT(IF(pr.product_property_name = \\\"', pr.`product_property_name`, '\\\", pp.property_value, NULL)) AS ', pr.`product_property_name`)\n ) INTO @SQL\n FROM product_properties AS pr;\n \n SET @SQL = CONCAT(\\'SELECT p.*, ', @SQL, '\n FROM products AS p\n LEFT JOIN product_properties_values AS pp ON (p.id = pp.id_product)\n LEFT JOIN product_properties AS pr ON (pr.id = pp.id_property)\n GROUP BY p.id;');\n \n PREPARE stmt FROM @SQL;\n EXECUTE stmt;\n DEALLOCATE PREPARE stmt;\n \n \n \";*/\n\n\n $app = Application::instance();\n $sql = 'SET @SQL = NULL';\n $app->db()->getArrayBySqlQuery($sql);\n $sql = 'SELECT\n GROUP_CONCAT(DISTINCT\n CONCAT(\\'GROUP_CONCAT(IF(pr.product_property_name = \\\"\\', pr.`product_property_name`, \\'\\\", pp.property_value, NULL)) AS \\', pr.`product_property_name`)\n ) INTO @SQL\n FROM product_properties AS pr';\n $app->db()->getArrayBySqlQuery($sql);\n $sql = 'SET @SQL = CONCAT(\\'SELECT p .*, \\', @SQL, \\'\n FROM products AS p\n LEFT JOIN product_properties_values AS pp ON (p.id = pp.id_product)\n LEFT JOIN product_properties AS pr ON (pr.id = pp.id_property)\n WHERE product_sku < 1000000\n AND deleted is NULL\n GROUP BY p.id LIMIT 0, ' . (int)$count . ';\\')';\n\n $app->db()->getArrayBySqlQuery($sql);\n $sql = 'PREPARE stmt FROM @SQL';\n $app->db()->getArrayBySqlQuery($sql);\n $sql = 'EXECUTE stmt';\n $catalog = $app->db()->getArrayBySqlQuery($sql);\n $sql = 'DEALLOCATE PREPARE stmt';\n $app->db()->getArrayBySqlQuery($sql);\n\n foreach ($catalog as $key => $good) {\n $catalog[$key]['Photo'] = explode(',', $catalog[$key]['Photo']);\n }\n $this->catalog = $catalog;\n return $catalog;\n }", "public function cat_select() {\n //formulate select query\n $sql = \"SELECT * FROM categories\"; \n //execute query \n return $this->db_query($sql);\n }", "Function Get_Catalog($int_ContactID,\r\n $int_ProductID=FALSE) {\r\n $int_catalogus = FALSE;\r\n if ($int_ContactID) {\r\n if($int_ProductID) {\r\n $sql = \"SELECT catalogus.CatalogusID FROM catalogusdetails\r\n\t\t\t\t\tLEFT JOIN catalogus ON catalogus.CatalogusID = catalogusdetails.CatalogusID\t\t\t\t\r\n\t\t\t\t\tWHERE catalogus.ContactID = '$int_ContactID'\t\t\t\t\t\t\r\n\t\t\t\t\t\tAND ProductID = '$int_ProductID'\";\r\n } else {\r\n $sql = \"SELECT catalogus.CatalogusID FROM catalogus\r\n\t\t\t\t\tWHERE catalogus.ContactID = '$int_ContactID'\";\r\n }\r\n //echo $sql . \"<BR>\";\r\n $int_catalogus = GetField($sql);\r\n\r\n }\r\n return $int_catalogus;\r\n}", "function getProductsByCat($catId) {\r\n $catId = intval($catId);\r\n $sql = \"SELECT * FROM products WHERE category_id = '{$catId}'\";\r\n\r\n include '../config/db.php';\r\n\r\n $rs = mysqli_query($link, $sql);\r\n mysqli_close($link);\r\n\r\n return createSnartyRsArray($rs);\r\n}", "public static function fetchCatalogByID($Id)\n {\n $Sql = \"SELECT * FROM `db_catalogs` WHERE id = :id\";\n Parent::query($Sql);\n\n Parent::bindParams('id', $Id);\n $catalog = Parent::fetch();\n if (empty($catalog)) {\n return array(\n 'status' => false,\n 'data' => []\n );\n }\n\n return array(\n 'status' => true,\n 'data' => $catalog\n );\n }", "function getProductsByCategory($categoryId){ \n $db = acmeConnect(); \n $sql = 'SELECT * FROM inventory WHERE categoryId = :categoryId'; \n $stmt = $db->prepare($sql); \n $stmt->bindValue(':categoryId', $categoryId, PDO::PARAM_INT); \n $stmt->execute(); \n $products = $stmt->fetchAll(PDO::FETCH_ASSOC); \n $stmt->closeCursor(); \n return $products; \n }", "public function queryAll(){\n\t\t$sql = 'SELECT * FROM categorias_vod';\n\t\t$sqlQuery = new SqlQuery($sql);\n\t\treturn $this->getList($sqlQuery);\n\t}", "private function getCatalogWhereTerms () {\n\t\tif ($this->session->getCourseCatalogId()->isEqual($this->session->getCombinedCatalogId()))\n\t\t\treturn 'TRUE';\n\t\telse\n\t\t\treturn 'catalog_id = :catalog_id';\n\t}", "public function catDisplay(){\n $query = \"SELECT * FROM shop_category\";\n $result = $this->db->select($query);\n\n return $result;\n }", "function getCourses(){\n\t$sql = \"select * from course_details order by course_id\";\n\t$result = DBConnection::execQery($sql);\n\treturn $result;\n}", "public function prepareQueryForCategory()\n {\n $sql = new SqlStatement();\n $sql->select(array('p.*'))\n ->from(array('p' => self::RESULTS_TABLE))\n ->innerJoin(array('pp' => 'product'), 'p.product_id = pp.product_id')\n ->innerJoin(array('pd' => 'product_description'), 'p.product_id = pd.product_id')\n ->where('pd.language_id = ?', (int)$this->config->get('config_language_id'))\n ->order($this->sortOrder)\n ->limit($this->productsLimit, $this->productsStart);\n \n if ($this->conditions->price) {\n if ($this->conditions->price->min) {\n $sql->where(\"{$this->subquery->actualPrice} >= ?\", array($this->conditions->price->min));\n }\n if ($this->conditions->price->max) {\n $sql->where(\"{$this->subquery->actualPrice} <= ?\", array($this->conditions->price->max));\n }\n }\n \n if ($this->conditions->rating) {\n $sql->where('ROUND(total) IN ('. implode(',', $this->conditions->rating[0]) . ')');\n } \n \n return $sql;\n }", "protected abstract function getSelectStatement();", "protected abstract function getSelectStatement();", "public function show(catalogos $catalogos)\n {\n //\n }", "public function index()\n {\n if (!$this->isAuthorized) {\n return prepareResult(false, [], [], \"User not authenticate\", $this->unauthorized);\n }\n\n $product_catalog = ProductCatalog::with('item:id,item_name')->orderBy('id', 'desc')->get();\n\n $product_catalog_array = array();\n if (is_object($product_catalog)) {\n foreach ($product_catalog as $key => $product_catalog1) {\n $product_catalog_array[] = $product_catalog[$key];\n }\n }\n\n $data_array = array();\n $page = (isset($_REQUEST['page'])) ? $_REQUEST['page'] : '';\n $limit = (isset($_REQUEST['page_size'])) ? $_REQUEST['page_size'] : '';\n $pagination = array();\n if ($page != '' && $limit != '') {\n $offset = ($page - 1) * $limit;\n for ($i = 0; $i < $limit; $i++) {\n if (isset($product_catalog_array[$offset])) {\n $data_array[] = $product_catalog_array[$offset];\n }\n $offset++;\n }\n\n $pagination['total_pages'] = ceil(count($product_catalog_array) / $limit);\n $pagination['current_page'] = (int)$page;\n $pagination['total_records'] = count($product_catalog_array);\n } else {\n $data_array = $product_catalog_array;\n }\n\n return prepareResult(true, $data_array, [], \"Product catalog listing\", $this->success, $pagination);\n }" ]
[ "0.68669045", "0.6088272", "0.5808634", "0.5698634", "0.56830096", "0.56573486", "0.55278283", "0.5515977", "0.5488257", "0.54359615", "0.5419701", "0.5405967", "0.5371099", "0.53543603", "0.53422266", "0.5339128", "0.53056455", "0.52927727", "0.5285707", "0.52774066", "0.52445966", "0.5244312", "0.52316934", "0.5222815", "0.5222548", "0.51887167", "0.51650745", "0.51650745", "0.5164721", "0.5161176" ]
0.75474966
0
Automatically create datagrid for master file table
private function generateDatagrid(&$simbio, $str_args) { $_master_tables = $this->global['db_prefix'].$this->dbTable.' AS mst '; if ($this->dbTable != 'unit_kerja') { $this->relation['id_unit'] = array('table' => 'unit_kerja', 'display_field' => 'nama_unit', 'pk_field' => 'id_unit'); } // include datagrid library $simbio->loadLibrary('Datagrid', SIMBIO_BASE.'Databases'.DSEP.'Datagrid.inc.php'); // create datagrid instance $_datagrid = new Datagrid($this->dbc); $_datagrid->numToShow = 20; // create an array of fields to show in datagrid $_fields = array(); $_primary_keys = array(); $_f = 0; foreach ($this->dbFields as $_fld => $_fld_info) { $_fld_label = ucwords(str_replace('_', ' ', $_fld)); $_fields[$_fld_label] = 'mst.'.$_fld; if (isset($_fld_info['isPrimary'])) { $_primary_keys[] = $_fld_label; } if (isset($this->relation[$_fld])) { $_rel_table = $this->global['db_prefix'].$this->relation[$_fld]['table']; $_fields[$_fld_label] = $_rel_table.'.'.$this->relation[$_fld]['display_field']; $_master_tables .= ' LEFT JOIN `'.$_rel_table.'` ON `mst`.'.$_fld.'='.'`'.$_rel_table.'`.'.$this->relation[$_fld]['pk_field']; } if ($_f == $this->gridMaxField) { break; } $_f++; } // set column to view in datagrid $_datagrid->setSQLColumn($_fields); // set primary key for detail view $_datagrid->setPrimaryKeys($_primary_keys); // set record actions $_action['Del.'] = '<input type="checkbox" name="record[]" value="{rowIDs}" />'; $_action['Edit'] = '<a class="datagrid-links" href="index.php?p=master/update/'.$this->dbTable.'/{rowIDs}"><b class="icon-edit"></b>&nbsp;</a>'; $_datagrid->setRowActions($_action); // set multiple record action options $_action_options[] = array('0', 'Pilih tindakan'); $_action_options[] = array('master/remove/'.$this->dbTable, 'Hapus rekod terpilih'); $_datagrid->setActionOptions($_action_options); // set result ordering $_datagrid->setSQLOrder('mst.input_date DESC'); // search criteria if (isset($_GET['keywords'])) { $_search = $simbio->filterizeSQLString($_GET['keywords'], true); $_criteria = ''; $_datagrid->setSQLCriteria($_criteria); } // built the datagrid $_datagrid->create($_master_tables); return $_datagrid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTableModel()\r\n {\r\n?>\r\n // table model\r\n var <?php echo $this->Name; ?>_tableModel = new qx.ui.table.SimpleTableModel();\r\n <?php\r\n if ($this->owner!=null)\r\n {\r\n ?>\r\n <?php echo $this->owner->Name.\".\".$this->Name; ?>_tableModel=<?php echo $this->Name; ?>_tableModel;\r\n <?php\r\n }\r\n ?>\r\n<?php\r\n }", "public function table()\n\t{\n\t\t$sql = '\n\t\t\tselect \n\t\t\t\tid, \n\t\t\t\tname, \n\t\t\t\tenable \n\t\t\tfrom \n\t\t\t\tfile \n\t\t\twhere \n\t\t\t\tuser = ?';\n\n\t\t$results = DB::select($sql, [Auth::id()]);\n\n\t\treturn Datatable::collection(new Collection($results))\n\t\t\t->showColumns('name')\n\t\t\t->addColumn('enable', function($model) \n\t\t\t{\n\t\t\t\treturn '<a href=\"'.url(\"/file/edit&ID=\".$model->id.\"&EN=\".$model->enable).'\">'.$model->enable.'</a>';\n\t\t\t})\n\t\t\t->addColumn('remove', function($model) \n\t\t\t{\n\t\t\t\treturn '<a href=\"'.url(\"/file/delete&ID=\".$model->id).'\"><i class=\"fa fa-times\"></i></a>';\n\t\t\t})\n ->searchColumns('name')\n ->orderColumns('enable', 'name')\n ->make();\n\t}", "protected function constructGrid()\n {\n // jquery script for loading first page of grid\n $table = \"\n <script type=\\\"text/javascript\\\">\n // load first page\n WschangeModelPagination(\n '$this->_id',\n '$this->_action',\n '$this->_modelName',\n '$this->noDataText',\n $this->itemsPerPage,\n $this->showEdit,\n '$this->_order',\n '$this->_formId',\n 0,\n '$this->_id'+'_0',\n '$this->_edit_action',\n '$this->_delete_action'\n );\n </script>\n \";\n\n // container for edit dialog\n if ($this->showEdit) {\n $table .= '<div class=\"uk-modal\" id=\"'.$this->_formId.'\"></div>';\n $table .= '<div class=\"uk-modal\" id=\"'.$this->_formId.'_new\"></div>';\n }\n\n // title\n $table .= '<div class=\"uk-grid\">';\n $table .= '<div class=\"uk-width-small-1-1 uk-width-medium-1-1\">';\n $table .= '<h1>'.$this->_model->metaName.'</h1>';\n $table .= '</div>';\n $table .= '</div>';\n\n // add and search controls\n $table .= '<div class=\"uk-grid\">';\n $table .= '<div class=\"uk-width-small-1-1 uk-width-medium-1-2\">';\n $table .= '<form class=\"uk-form uk-form-horizontal\">';\n $table .= '<fieldset data-uk-margin>';\n // new item button\n if ($this->showEdit) {\n $table .= '<button class=\"uk-button uk-button-success\"'\n .' data-uk-modal=\"{target:\\'#'.$this->_formId\n .'_new\\', center:true}\"'\n .' id=\"btn_create_'.$this->_id.'\"'\n .' type=\"button\" onclick=\"WseditModelID('\n .'\\''.$this->_formId.'_new\\', '\n .'\\''.$this->_modelName.'\\', '\n .'0, \\''.$this->_edit_action.'\\')\">';\n $table .= '<i class=\"uk-icon-plus\"></i>';\n $table .= '</button>';\n }\n // search control\n $table .= '<input';\n $table .= ' type=\"text\" id=\"search_'.$this->_id.'\"';\n $table .= '/>';\n $table .= '<button class=\"uk-button\"'\n .' id=\"btn_search_'.$this->_id\n .'\" type=\"button\" onclick=\"WschangeModelPagination('\n .'\\''.$this->_id.'\\', '\n .'\\''.$this->_action.'\\', '\n .'\\''.$this->_modelName.'\\', '\n .'\\''.$this->noDataText.'\\', '\n .$this->itemsPerPage.', '\n .$this->showEdit.', '\n .'\\''.$this->_order.'\\', '\n .'\\''.$this->_formId.'\\', '\n .'0, \\''.$this->_id.'\\'+\\'_0\\', '\n .'\\''.$this->_edit_action.'\\', '\n .'\\''.$this->_delete_action.'\\')\">';\n $table .= '<i class=\"uk-icon-search\"></i>';\n $table .= '</button>';\n\n $table .= '</fieldset>';\n $table .= '</form>';\n $table .= '</div>';\n $table .= '</div>';\n\n // Grid View table\n $table .= '<div class=\"uk-grid\">';\n $table .= '<div class=\"uk-width-1-1\">';\n $table .= '<div class=\"uk-overflow-container\">';\n $table .= '<table class=\"uk-table uk-table-hover uk-table-striped\">';\n $table .= '<thead>';\n $table .= '<tr>';\n foreach ($this->_model->columns as $column) {\n if (!in_array($column, $this->_model->hiddenColumns)) {\n if (isset($this->_model->columnHeaders[$column])) {\n $table .= '<th>'\n .$this->_model->columnHeaders[$column];\n $table .= '</th>';\n } else {\n $table .= '<th>'.$column.'</th>';\n }\n }\n }\n if ($this->showEdit) {\n $table .= '<th></th>';\n }\n $table .= '</tr>';\n $table .= '</thead>';\n\n // container of table data loaded from AJAX request\n $table .= '<tbody id=\"'.$this->_id.'\"></tbody>';\n\n // end of grid table\n $table .= '</table>';\n $table .= '</div>';\n $table .= '</div>';\n $table .= '</div>';\n\n // get number ow rows from query so that we can make pager\n $db = new WsDatabase();\n $countQuery = 'SELECT COUNT(*) AS nrows FROM '.$this->_model->tableName;\n $result = $db->query($countQuery);\n $this->nRows = intval($result[0]['nrows']);\n $db->close();\n\n // number of items in pager\n $nPages = $this->getPagination($this->nRows);\n\n // construct pager\n $table .= '<ul class=\"uk-pagination uk-pagination-left\">';\n // links to pages\n for ($i = 0; $i < $nPages; $i++) {\n $table .= '<li>';\n $table .= '\n <a id=\"'.$this->_id.'_'.$i.'\"\n href=\"javascript:void(0)\"\n onclick=\"WschangeModelPagination('\n .'\\''.$this->_id.'\\', '\n .'\\''.$this->_action.'\\', '\n .'\\''.$this->_modelName.'\\', '\n .'\\''.$this->noDataText.'\\', '\n .$this->itemsPerPage.', '\n .$this->showEdit.', '\n .'\\''.$this->_order.'\\', '\n .'\\''.$this->_formId.'\\', '\n .$i.',\\''.$this->_id.'_'.$i.'\\', '\n .'\\''.$this->_edit_action.'\\', '\n .'\\''.$this->_delete_action.'\\')\"/>'\n .($i+1).'</a>';\n $table .= '</li>';\n }\n // end of pager\n $table .= '</ul>';\n\n // end of master div element\n $table .= '<br/>';\n\n $table .= '<script type=\"text/javascript\">'\n .'$(\"#search_'.$this->_id.'\").keydown(function(event) {'\n .' if(event.keyCode == 13) {'\n .' event.preventDefault();'\n .' $(\"#btn_search_'.$this->_id.'\").click();'\n .' }'\n .'});'\n .'</script>';\n\n unset($i, $nPages, $db, $result, $countQuery);\n return $table;\n }", "public function buildTable()\n {\n\n $view = View::getActive();\n\n // Creating the Head\n $head = '<thead class=\"ui-widget-header\" >'.NL;\n $head .= '<tr>'.NL;\n\n $head .= '<th >Project Name</th>'.NL;\n //$head .= '<th>File</th>'.NL;\n $head .= '<th >Description</th>'.NL;\n $head .= '<th style=\"width:165px\" >Nav</th>'.NL;\n\n $head .= '</tr>'.NL;\n $head .= '</thead>'.NL;\n //\\ Creating the Head\n\n // Generieren des Bodys\n $body = '<tbody class=\"ui-widget-content\" >'.NL;\n\n $num = 1;\n foreach ($this->data as $key => $row) {\n $rowid = $this->name.\"_row_$key\";\n\n $body .= \"<tr class=\\\"row$num\\\" id=\\\"$rowid\\\" >\";\n\n $urlConf = 'index.php?c=Daidalos.Projects.genMask&amp;objid='.urlencode($key);\n $linkConf = '<a title=\"GenMask\" class=\"wcm wcm_req_ajax wgt_info\" href=\"'.$urlConf.'\">'\n .Wgt::icon('daidalos/bdl_mask.png' , 'xsmall' , 'build').'</a>';\n\n $urlGenerate = 'index.php?c=Genf.Bdl.build&amp;objid='.urlencode($key);\n $linkGenerate = '<a title=\"Code generieren\" class=\"wcm wcm_req_ajax wgt_info\" href=\"'.$urlGenerate.'\">'\n .Wgt::icon('daidalos/parser.png' , 'xsmall' , 'build').'</a>';\n\n\n $urlDeploy = 'index.php?c=Genf.Bdl.deploy&amp;objid='.urlencode($key);\n $linkDeploy = '<a title=\"Deploy the Project\" class=\"wcm wcm_req_ajax wgt_info\" href=\"'.$urlDeploy.'\">'\n .Wgt::icon('genf/deploy.png' , 'xsmall' , 'deploy').'</a>';\n\n $urlRefreshDb = 'index.php?c=Genf.Bdl.refreshDatabase&amp;objid='.urlencode($key);\n $linkRefreshDb = '<a title=\"Refresh the database\" class=\"wcm wcm_req_ajax wgt_info\" href=\"'.$urlRefreshDb.'\">'\n .Wgt::icon('daidalos/db_refresh.png' , 'xsmall' , 'sync db').'</a>';\n\n $urlSyncDb = 'index.php?c=Genf.Bdl.syncDatabase&amp;objid='.urlencode($key);\n $linkSyncDb = '<a title=\"Sync the database with the model\" class=\"wcm wcm_req_ajax wgt_info\" href=\"'.$urlSyncDb.'\">'\n .Wgt::icon('daidalos/db_sync.png' , 'xsmall' , 'sync db').'</a>';\n\n $urlPatchDb = 'index.php?c=Genf.Bdl.createDbPatch&amp;objid='.urlencode($key);\n $linkPatchDb = '<a title=\"Create an SQL Patch to alter the database\" class=\"wcm wcm_req_ajax wgt_info\" href=\"'.$urlPatchDb.'\" >'\n .Wgt::icon('genf/dump.png' , 'xsmall' , 'create alter patch').'</a>';\n\n $urlClean = 'index.php?c=Genf.Bdl.clean&amp;objid='.urlencode($key);\n $linkClean = '<a title=\"Projekt cleanen\" class=\"wcm wcm_req_ajax wgt_info\" href=\"'.$urlClean.'\">'\n .Wgt::icon('genf/clean.png' , 'xsmall' , 'clean').'</a>';\n\n $body .= '<td valign=\"top\" >'.$row[0].'</td>'.NL;\n //$body .= '<td valign=\"top\" >'.$row[1].'</td>'.NL;\n $body .= '<td valign=\"top\" >'.$row[2].'</td>'.NL;\n $body .= '<td valign=\"top\" align=\"center\" >'.$linkConf.' | '.$linkGenerate.$linkDeploy.' | '.$linkSyncDb.' '.$linkRefreshDb.' '.$linkPatchDb.' | '.$linkClean.'</td>'.NL;\n\n $body .= '</tr>'.NL;\n\n $num ++;\n if ($num > $this->numOfColors)\n $num = 1;\n\n }// ENDE FOREACH\n\n $body .= \"</tbody>\".NL;\n //\\ Generieren des Bodys\n\n $html ='<table id=\"table_'.$this->name.'\" class=\"full\" >'.NL;\n $html .= $head;\n $html .= $body;\n $html .= '</table>'.NL;\n\n return $html;\n\n }", "protected function grid()\n {\n return Admin::grid(PlatformFile::class, function (Grid $grid) {\n\n // $grid->id('ID')->sortable();\n\n $grid->platform_id('主机信息')->display(function ($platform_id) {\n $platform = Platform::find($platform_id);\n return $platform->platform_name . '/' . $platform->platform_ip . '/' . $platform->platform_sn;\n });\n $grid->file_id('文件')->display(function ($file_id) {\n return File::find($file_id)->name;\n });\n $grid->upload_path('上传路径');\n $grid->column('状态')->display(function(){\n if($this->status == 0) {\n return '已申请';\n } else if($this->status == 1) {\n return '上传中...';\n } else if($this->status ==2) {\n return '已上传';\n }\n });\n\n $grid->actions(function ($actions) {\n $actions->disableDelete();\n $actions->disableEdit();\n\n if ($actions->row->status == 0) {\n $action_btn = '<a class=\"btn btn-primary btn-xs\" href=\"' . url('/admin/file-upload/' . $actions->row->id) . '\">上传</a>';\n } else if($actions->row->status == 1) {\n $action_btn = '<a class=\"btn btn-primary btn-xs\" href=\"' . url('/admin/file-uploading/' . $actions->row->id) . '\">上传中...</a>';\n } else if($actions->row->status == 2) {\n $action_btn = '<a class=\"btn btn-danger btn-xs\" href=\"' . url('/admin/file-remove/' . $actions->row->id) . '\">移除</a>';\n } else {\n $action_btn = '';\n }\n\n $actions->append($action_btn);\n });\n\n $grid->tools(function ($tools) {\n $tools->batch(function ($batch) {\n $batch->disableDelete();\n });\n });\n\n $grid->disableExport();\n\n });\n }", "public function createComponentDataGrid() {\n\n\t\tif(empty($this->dateRange)) {\n\t\t\t$source = $this->db->table('project')\n\t\t\t\t\t->where('project_institute:institute_id', $this->institute_id);\n\t\t} else {\n\t\t\t$source = $this->db->table('project')\n\t\t\t\t\t->where('project_institute:institute_id', $this->institute_id)\n\t\t\t\t\t->where('project_institute:project_institute_date:start >= ?', $this->dateRange->from)\n\t\t\t\t\t->where('project_institute:project_institute_date:end <= ?', $this->dateRange->to)\n\t\t\t\t\t->select('\n\t\t\t\t\t\tDISTINCT project.id,\n\t\t\t\t\t\tproject.name,\n\t\t\t\t\t\tproject.cost,\n\t\t\t\t\t\tproject.approved_cost,\n\t\t\t\t\t\tproject.participation,\n\t\t\t\t\t\tproject.approved_participation,\n\t\t\t\t\t\tproject.hr,\n\t\t\t\t\t\tproject.approved_hr\n\t\t\t\t\t');\n\t\t}\n\n\t\tif($source->count('*') <= 0) {\n\t\t\t\n\t\t\t$dg = new DataGrid();\n\t\t\t$dg->setDataSource($source);\n\n\t\t\t$dg->template->empty = true;\n\t\t\treturn $dg;\n\t\t}\n\t\t\n $dg = new DataGrid();\n $dg->setDataSource($source);\n\t\t\n $dg->addAction('edit', 'Uprav', ':Projects:Projects:edit', array('id'));\n\n $dg->addColumn('id', 'No.')->setIntFilter('project.id')->setStyle('width: 50px');\n $dg->addColumn('name', 'Name')->setTextFilter('project.name')->setStyle('text-align: left');\n\t\t$dg->addCustomColumn('cost', 'Fin. zdroje')->setIntFilter('project.cost')->setHtml(create_function('$row', '$helper = new EmptyPrice(); return $helper->process($row->cost);')); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t$dg->addCustomColumn('approved_cost', 'Schválené fin.zdroje')->setIntFilter('project.approved_cost')->setHtml(create_function('$row', '$helper = new EmptyPrice(); return $helper->process($row->approved_cost);'));\n\t\t$dg->addCustomColumn('participation', 'Spoluúčasť')->setIntFilter('project.participation')->setHtml(create_function('$row', '$helper = new EmptyPrice(); return $helper->process($row->participation);'));\n\t\t$dg->addCustomColumn('approved_participation', 'Schválená spoluúčasť')->setIntFilter('project.approved_participation')->setHtml(create_function('$row', '$helper = new EmptyPrice(); return $helper->process($row->approved_participation);'));\n\t\t$dg->addCustomColumn('hr', 'Ľudské zdroje')->setIntFilter('project.hr')->setHtml(create_function('$row', '$helper = new EmptyNumber(); return $helper->process($row->hr);'));\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t$dg->addCustomColumn('approved_hr', 'Schválené ľudské zdroje')->setIntFilter('project.approved_hr')->setHtml(create_function('$row', '$helper = new EmptyNumber(); return $helper->process($row->approved_hr);'));\n\t\treturn $dg;\n\t}", "function generar()\r\n\t{\r\n\t\tforeach($this->columnas as $ef) {\r\n\t\t \t$this->datos->tabla('columnas')->nueva_fila($ef->get_datos());\r\n\t\t}\r\n\t\tparent::generar();\r\n\t}", "protected function grid()\n {\n $grid = new Grid(new MobileImport);\n $grid->title('导入标题');\n $grid->employee()->name('所属员工');\n $grid->projectItem()->name('主推产品');\n $grid->labels_html('导入意向')->display(function ($labels_html){\n return $labels_html;\n });\n $grid->status_html('当前状态')->display(function ($status_html){\n return $status_html;\n });\n $grid->error('错误文件')->display(function ($file){\n return $file?'<a href=\"/upload/'.$file.'\" target=\"_blank\">链接</a>':'无';\n });\n $grid->actions(function (Grid\\Displayers\\Actions $actions) {\n $actions->disableDelete();\n $actions->disableEdit();\n $actions->disableView();\n if (Admin::user()->can('mobile-close')) {\n $actions->append(new CloseMobileImportRow($actions->getKey(),$this->row->status));\n }\n });\n $grid->tools(function (Grid\\Tools $tools) {\n $tools->append(new MobileImportTemplate());\n });\n $grid->disableExport();\n $grid->disableFilter();\n $grid->disableRowSelector();\n return $grid;\n }", "function show_childgrid() {\r\n if (($this->action=='edit' or $this->action=='view' or $this->action=='browse') and $this->childds) {\r\n foreach ($this->childds as $child_modulename) {\r\n $child_module = instantiate_module($child_modulename);\r\n $child_module->logical_parent = $this; # 1. for parent: bind children to parent\r\n # bind child's foreign key to me\r\n # - search which field is the foreign key\r\n foreach ($child_module->properties as $k=>$col) {\r\n if ($col->enumerate == $this->module) { # foreign key always int\r\n $child_module->properties[$k]->hidden = 1; # hide this field from browse\r\n $child_module->properties[$k]->parentkey = 1; # flag that this field IS the connecting master/detail key. will be used by add-suggestive-field\r\n $child_module->properties[$k]->parentkey_value = $this->ds->_rowid[$this->_cursor];\r\n $child_module->db_where = '`'.$col->colname.'`='.$this->ds->_rowid[$this->_cursor];\r\n break;\r\n }\r\n }\r\n $child_module->final_init();\r\n if ($this->db_count) # if parent empty, do not populate child\r\n $child_module->populate();\r\n #~ echo '<hr>';\r\n echo '<br>';\r\n echo '<table>';\r\n echo '<tr><td style=\"color:white; background-color:rgb(99,140,181);\">'.$child_module->title.'</td></tr>';\r\n echo '<tr><td>';\r\n $child_module->showgrid('browse');\r\n echo '</tr></td></table>';\r\n }\r\n }\r\n }", "protected function _prepareColumns()\n {\n \t// Checkbox\n \t$checkboxColumnBody = new Lumia_DataGrid_Body_Checkbox('student_id[]');\n \t$checkboxColumnHeader = new Lumia_DataGrid_Header_Checkbox();\n $this->addColumn(new Lumia_DataGrid_Column($checkboxColumnBody, $checkboxColumnHeader));\n \n // Name\n $nameColumnBody = new Lumia_DataGrid_Body_Text('student_name');\n $nameColumnHeader = new Lumia_DataGrid_Header_Text('StudentListView:@Name');\n $this->addColumn(new Lumia_DataGrid_Column($nameColumnBody, $nameColumnHeader));\n \n // Code\n $codeColumnBody = new Lumia_DataGrid_Body_Text('student_code');\n $codeColumnHeader = new Lumia_DataGrid_Header_Text('StudentListView:@Code');\n $this->addColumn(new Lumia_DataGrid_Column($codeColumnBody, $codeColumnHeader));\n \n // Date of birth\n $dateColumnBody = new Lumia_DataGrid_Body_Date('student_birth');\n $dateColumnBody->setOptions(array('dateFormat' => 'dd/MM/yyyy'));\n $dateColumnHeader = new Lumia_DataGrid_Header_Text('StudentListView:@Date of birth');\n $this->addColumn(new Lumia_DataGrid_Column($dateColumnBody, $dateColumnHeader));\n \n // Gender\n $genderColumnBody = new Admin_DataGrid_Student_Body_Gender('student_gender');\n $genderColumnHeader = new Lumia_DataGrid_Header_Text('StudentListView:@Gender');\n $this->addColumn(new Lumia_DataGrid_Column($genderColumnBody, $genderColumnHeader));\n \n // Class\n $classColumnBody = new Lumia_DataGrid_Body_Text('class_department');\n $classColumnHeader = new Lumia_DataGrid_Header_Text('StudentListView:@Class/Department');\n $this->addColumn(new Lumia_DataGrid_Column($classColumnBody, $classColumnHeader));\n \n // Status\n $statusColumnBody = new Admin_DataGrid_Student_Body_Status('user_status');\n $statusColumnHeader = new Lumia_DataGrid_Header_Text('StudentListView:@Status');\n $this->addColumn(new Lumia_DataGrid_Column($statusColumnBody, $statusColumnHeader));\n \n // Action\n $actionColumnBody = new Admin_DataGrid_Student_Body_Action('actionColumn');\n $actionColumnHeader = new Lumia_DataGrid_Header_Text();\n $this->addColumn(new Lumia_DataGrid_Column($actionColumnBody, $actionColumnHeader));\n }", "public function showGrid($fast_search=false)\n {\n //fazer paginação, tenho a classe no mwork/lib\n //$objects = DB::getObjects(\"SELECT {$this->sqlColumns} FROM usuarios\");\n $table = $this->model->getTable();\n \n if (!$this->actions)\n {\n $this->addAction('Ver', $this->viewImage, 'info'); // js func // parameter \n $this->addAction('Editar', $this->editImage, 'edit', array($this->model->getPrimaryKey()), 'showContent', array('conteudo'));\n $this->addAction('Deletar', $this->deleteImage, 'delete');\n }\n \n $objects = new stdClass();\n \n $objects = DB::getObjects($this->getSql());\n \n if(!$fast_search)\n {\n $grid = '<div id =\"' . $this->gridId . '\" > <table width=\"100%\">';\n \n }\n if ($objects)\n {\n if(!$fast_search)\n { \n $grid.='<thead>';\n $gridLabels = '';\n $gridInputs = '';\n foreach ($this->columns as $columnTable => $column)\n {\n $align = $column->parameters[1] ? $column->parameters[1] : 'center';\n $width = $column->parameters[0] ? $column->parameters[0].'%' : ''; \n if($column->relation && !preg_match('/like/', $columnTable)) \n { \n $ref_column = explode('=', $column->relation);\n \n foreach($ref_column as $ref)\n {\n if(preg_match(\".$table.\", $ref))\n {\n $ref_column = explode('.',$ref);\n $ref_column = $ref_column[1];\n break;\n } \n }\n \n $newColumnTable = ''; \n $newColumnTable = str_replace('::','.', $columnTable);\n \n $tableColumn = explode('.', $newColumnTable);\n $tableColumn = $tableColumn[0];\n $tableColumn = trim($tableColumn);\n $ref_column = trim($ref_column);\n \n unset($modelTable);\n $modelTable = $this->MCore->getModelFromTable($tableColumn);\n unset($combo);\n $combo = new MCombo($modelTable->getArray()); \n $combo->setName($tableColumn.'::'.$ref_column.'::'.'=');\n $combo->setId($tableColumn.'::'.$ref_column.'::'.'='); \n $gridInputs .= \"<td align='{$align}' width='{$width}'> \".$combo->show().\" </td>\";\n }\n else\n {\n unset($input);\n $input = new MText();\n $input->setName($columnTable.'::'.'like');\n $gridInputs .= \"<td align='$align' width='{$width}'> \".$input->show().\" </td>\";\n }\n $gridLabels.=\"<td align='{$align}' width='{$width}'> {$column->label} </td>\";\n }\n \n $grid.=\"<tr> {$gridLabels} </tr>\";\n $grid.=\"<tr class='filters-grid'> {$gridInputs} </tr> \";\n $grid.='</thead> <tbody id=\"tbody_'.$this->gridId.'\">';\n }\n \n foreach ($objects as $object)\n {\n $grid.= '<tr>';\n \n foreach ($this->columns as $key => $value)\n {\n $objKey = '';\n if(preg_match('/\\|/',$key))\n { \n $key = explode('|', $key);\n $objKey = trim($key[1]);\n }\n else\n {\n $key = explode('::', $key); \n $objKey = trim($key[1]);\n }\n \n $grid.='<td align=\"center\">' . $object->{$objKey} . '</td>';\n }\n \n foreach ($this->actions as $objAction)\n {\n $params= null;\n if ($objAction->params)\n {\n $params= null;\n foreach ($objAction->params as $actionParam)\n {\n if ($object->{$actionParam})\n {\n $params.= $object->{$actionParam} . ',';\n }\n else\n {\n $params.= $actionParam . ',';\n }\n \n }\n $params = substr($params, 0, -1);\n $params = '(' . $params . ')';\n }\n else\n {\n $params = '()';\n }\n $action = null; \n $action = $objAction->action . $params;\n $jsParams = null;\n if ($objAction->jsParams)\n { \n $jsParams = \"'{$action}',\";\n\n foreach ($objAction->jsParams as $actionJsParam)\n {\n $jsParams .= \"'{$actionJsParam}',\";\n }\n $jsParams = substr($jsParams, 0, -1);\n $jsParams = \"({$jsParams})\";\n }\n else\n {\n $jsParams = \"('{$action}')\";\n }\n \n $grid.=\"<td align='center' width='15'> <img class='grid_img_action' src='{$objAction->icon}' title='{$objAction->title}' onclick = \\\"{$objAction->jsFunction}{$jsParams}\\\"/> </td>\";\n }\n\n $grid.= '</tr>';\n }\n }\n else\n {\n $grid.='<tr> <td> Nothing found </td> </tr>';\n }\n \n if(!$fast_search)\n {\n $grid.='</tbody> </table></div>'; \n echo \" <script>\n $('#{$this->gridId}').keyup(function(e)\n { \n if(e.keyCode == 13) \n {\n var objsFilter = $('.filters-grid').find('input,select'); \n ajaxSubmitObjs('{$this->listControlName}::search(1)','tbody_{$this->gridId}',objsFilter);\n return true;\n }\n });\n\n $('#{$this->gridId}').find('select').change(function(e)\n { \n var objsFilter = $('.filters-grid').find('input,select'); \n ajaxSubmitObjs('{$this->listControlName}::search(1)','tbody_{$this->gridId}',objsFilter);\n return true;\n });\n\n </script>\";\n }\n echo $grid;\n \n \n }", "public function gridtableAction()\n\t{\n\t\t$this->loadLayout();\n\t\t$this->renderLayout();\n\t\t\n\t}", "public function render()\n\t{\n\t\t$template = $this->template;\n\t\t$template->setFile( __DIR__ . '/dataGrid.latte' );\n\n\t\t$template->grid = $this;\n\t\t$template->stencils = $this->stencils;\n\t\t$template->actionWidth = $this->actionWidth;\n\t\t$template->actitle = $this->actitle;\n\t\t$template->acfooter = $this->acfooter;\n\t\t$template->cmd = self::CMD;\n\t\t$template->labels = $this->labels;\n\t\t$template->columns = $this->columns;\n\t\t$template->key = $this->key;\n\t\t$template->isSorting = $this->isSorting();\n\t\t$template->isFiltering = $this->isFiltering();\n\t\t$template->isAdding = $this->isAdding();\n\t\t$template->isRemoving = $this->isRemoving();\n\t\t$template->isEditing = $this->isEditing();\n\t\t$template->hasActions = $this->hasActions();\n\t\t$template->sortable = $this->sortable;\n\t\t$template->sorting = $this->sorting;\n\t\t$template->filtering = $this->filtering;\n\t\t$template->id = $this->id;\n\t\t$template->pgbtn = $this->getPagerButtons();\n\t\t$template->currentPage = $this->getCurrentPage();\n\t\t$template->rowsPerPage = $this->getRowsPerPage();\n\t\t$template->pageCount = $this->getPageCount();\n\n\t\tif ( count( $this->dataSnippet ) ) $template->data = $this->dataSnippet;\n\t\telse $template->data = $this->getData();\n\n\t\t$template->render();\n\t}", "public function getListDataTable(){\n $folders = Folder::select(['id', 'name', 'description'])\n ->where('user_id', Auth::user()->id);\n \n return Datatables::of($folders)->make(true);\n }", "protected static function loadSingleExtTablesFiles() {}", "public function getHtml()\n {\n $header = new TableHeader($this);\n $header->addText('Dokument');\n $header->addText('Ersteller');\n $header->addEmpty();\n\n\n $fileReader = new FileReader();\n\n $contentLogModel = new ContentLogModel();\n $fileReader->addFieldByModel($contentLogModel);\n\n $userModel = new UserModel();\n $fileReader->addFieldByModel($userModel);\n\n $join = new ModelJoin($fileReader);\n $join->externalModel = $contentLogModel;\n $join->type = $fileReader->model->id;\n $join->externalType = $contentLogModel->dataId;\n\n $join = new ModelJoin($fileReader);\n $join->externalModel = $userModel;\n $join->type = $contentLogModel->userCreatedId;;\n $join->externalType = $userModel->id;\n\n $fileReader->filter->andEqual($contentLogModel->parentId, $this->dataId);\n $fileReader->filter->andEqual($contentLogModel->contentTypeId, (new FileTemplateStatus())->contentId);\n\n\n foreach ($fileReader->getData() as $fileRow) {\n\n $row = new TableRow($this);\n\n if (!$fileRow->delete) {\n $row->addHyperlink($fileRow->file->getUrl(), $fileRow->file->getFilename());\n\n } else {\n\n $stroke = new Strike($row);\n $stroke->content = $fileRow->file->getFilename();\n\n }\n // show image bzw. detail ansicht\n\n $userDisplay = $fileRow->getModelValue($userModel->displayName);\n $dateTimeCreated = new DateTime($fileRow->getModelValue($contentLogModel->dateTimeCreated));\n\n $row->addText($userDisplay . ' ' . $dateTimeCreated->getShortDateTimeLeadingZeroFormat());\n\n if (!$fileRow->delete) {\n $site = clone(FileDeleteSite::$site);\n $site->addParameter(new FileParameter($fileRow->id));\n $site->addParameter(new DataIdParameter($this->dataId));\n $row->addIconSite($site);\n } else {\n $row->addEmpty();\n }\n\n\n }\n\n return parent::getHtml();\n\n }", "public function init()\n {\n // load the grid\n $this->setId('demo-full-grid')\n ->addColumn(array(\n 'label' => 'Cod.',\n 'index' => 'id',\n ))\n ->addColumn(array(\n 'label' => 'Company',\n 'index' => 'companyName',\n ))\n ->addColumn(array(\n 'label' => 'Role',\n 'index' => 'roleName',\n ))\n ->addColumn(array(\n 'label' => 'Name',\n 'index' => 'personName',\n ))\n ->addColumn(array(\n 'label' => 'Balance',\n 'index' => 'balance',\n 'align' => 'right',\n 'render' => 'money',\n 'order' => false,\n ))\n ->addColumn(array(\n 'label' => 'Username',\n 'index' => 'username',\n 'render' => array(\n 'type' => 'link',\n 'href' => 'http://www.mdnsolutions.com',\n ),\n ))\n ->addColumn(array(\n 'label' => 'Birthday',\n 'index' => 'birthday',\n 'align' => 'center',\n 'render' => 'date',\n ))\n ->addColumn(array(\n 'label' => 'Last access',\n 'index' => 'lastAccess',\n 'render' => 'dateTime',\n ))\n ->addColumn(array(\n 'label' => 'Status',\n 'index' => 'statusId',\n 'render' => 'EnableOrDisabled',\n ))\n ->setRecordsPerPage(30)\n ->setOrder(false);\n }", "private function createTables() {\n \n foreach($this->G->tableInfo as $table) {\n $this->tables[$table[\"title\"]] = new IdaTable($table[\"title\"]);\n } \n }", "function defgrid( $deployed = false ){\n\t\t$i = 1;\n\t\t$editar = 'false';\n\n\t\t$grid = new $this->jqdatagrid;\n\n\t\t$grid->addField('numero');\n\t\t$grid->label('N&uacute;mero');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 80,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:8, maxlength: 8 }',\n\t\t));\n\n\n\t\t$grid->addField('fecha');\n\t\t$grid->label('Fecha');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 80,\n\t\t\t'align' => \"'center'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true,date:true}',\n\t\t\t'formoptions' => '{ label:\"Fecha\" }'\n\t\t));\n\n\n\t\t$grid->addField('tipo');\n\t\t$grid->label('Tipo');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 40,\n\t\t\t'align' => \"'center'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:1, maxlength: 1 }',\n\t\t\t'cellattr' => 'function(rowId, tv, aData, cm, rdata){\n\t\t\t\tvar tips = \"\";\n\t\t\t\tif(aData.tipo !== undefined){\n\t\t\t\t\tif(aData.tipo==\"C\"){\n\t\t\t\t\t\ttips = \"Cliente\";\n\t\t\t\t\t}else if(aData.tipo == \"P\"){\n\t\t\t\t\t\ttips = \"Proveedor\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\ttips = aData.tipo;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn \\'title=\"\\'+tips+\\'\"\\';\n\t\t\t}'\n\t\t));\n\n\n\t\t$grid->addField('tipod');\n\t\t$grid->label('Mov.');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 50,\n\t\t\t'align' => \"'center'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:1, maxlength: 1 }',\n\t\t\t'cellattr' => 'function(rowId, tv, aData, cm, rdata){\n\t\t\t\tvar tips = \"\";\n\t\t\t\tif(aData.tipod !== undefined){\n\t\t\t\t\tif(aData.tipod==\"E\"){\n\t\t\t\t\t\ttips = \"Entrada\";\n\t\t\t\t\t}else if(aData.tipod == \"S\"){\n\t\t\t\t\t\ttips = \"salida\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\ttips = aData.tipod;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn \\'title=\"\\'+tips+\\'\"\\';\n\t\t\t}'\n\t\t));\n\n\n\t\t$grid->addField('status');\n\t\t$grid->label('Estatus');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 40,\n\t\t\t'align' => \"'center'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:1, maxlength: 1 }',\n\t\t));\n\n\n\t\t$grid->addField('almacen');\n\t\t$grid->label('Almacen');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 40,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:4, maxlength: 4 }',\n\t\t));\n\n\n\t\t$grid->addField('asociado');\n\t\t$grid->label('Asociado');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 80,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:8, maxlength: 8 }',\n\t\t));\n\n\n\t\t$grid->addField('clipro');\n\t\t$grid->label('Cli/Pro');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 50,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:5, maxlength: 5 }',\n\t\t));\n\n\t\t$grid->addField('nombre');\n\t\t$grid->label('Nombre');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 200,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:40, maxlength: 40 }',\n\t\t));\n\n\n\t\t$grid->addField('direc1');\n\t\t$grid->label('Direci&oacute;n');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 200,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:40, maxlength: 40 }',\n\t\t));\n\n\n\t\t$grid->addField('direc2');\n\t\t$grid->label('Direci&oacute;n 2');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 200,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:40, maxlength: 40 }',\n\t\t));\n\n\n\t\t$grid->addField('observ1');\n\t\t$grid->label('Observaci&oacute;n');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 200,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:33, maxlength: 33 }',\n\t\t));\n\n\n\t\t$grid->addField('observ2');\n\t\t$grid->label('Observaci&oacute;n 2');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 200,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:33, maxlength: 33 }',\n\t\t));\n\n\n\t\t$grid->addField('stotal');\n\t\t$grid->label('SubTotal');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'align' => \"'right'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'width' => 100,\n\t\t\t'editrules' => '{ required:true }',\n\t\t\t'editoptions' => '{ size:10, maxlength: 10, dataInit: function (elem) { $(elem).numeric(); } }',\n\t\t\t'formatter' => \"'number'\",\n\t\t\t'formatoptions' => '{decimalSeparator:\".\", thousandsSeparator: \",\", decimalPlaces: 2 }'\n\t\t));\n\n\n\t\t$grid->addField('impuesto');\n\t\t$grid->label('Impuesto');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'align' => \"'right'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'width' => 100,\n\t\t\t'editrules' => '{ required:true }',\n\t\t\t'editoptions' => '{ size:10, maxlength: 10, dataInit: function (elem) { $(elem).numeric(); } }',\n\t\t\t'formatter' => \"'number'\",\n\t\t\t'formatoptions' => '{decimalSeparator:\".\", thousandsSeparator: \",\", decimalPlaces: 2 }'\n\t\t));\n\n\n\t\t$grid->addField('gtotal');\n\t\t$grid->label('Total');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'align' => \"'right'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'width' => 100,\n\t\t\t'editrules' => '{ required:true }',\n\t\t\t'editoptions' => '{ size:10, maxlength: 10, dataInit: function (elem) { $(elem).numeric(); } }',\n\t\t\t'formatter' => \"'number'\",\n\t\t\t'formatoptions' => '{decimalSeparator:\".\", thousandsSeparator: \",\", decimalPlaces: 2 }'\n\t\t));\n\n\n\t\t$grid->addField('peso');\n\t\t$grid->label('Peso');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'align' => \"'right'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'width' => 100,\n\t\t\t'editrules' => '{ required:true }',\n\t\t\t'editoptions' => '{ size:10, maxlength: 10, dataInit: function (elem) { $(elem).numeric(); } }',\n\t\t\t'formatter' => \"'number'\",\n\t\t\t'formatoptions' => '{decimalSeparator:\".\", thousandsSeparator: \",\", decimalPlaces: 2 }'\n\t\t));\n\n\n\t\t$grid->addField('origen');\n\t\t$grid->label('Origen');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 40,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:1, maxlength: 1 }',\n\t\t));\n\n\n\t\t$grid->addField('id');\n\t\t$grid->label('Id');\n\t\t$grid->params(array(\n\t\t\t'align' => \"'center'\",\n\t\t\t'frozen' => 'true',\n\t\t\t'width' => 40,\n\t\t\t'editable' => 'false',\n\t\t\t'search' => 'false'\n\t\t));\n\n\n\t\t$grid->showpager(true);\n\t\t$grid->setWidth('');\n\t\t$grid->setHeight('290');\n\t\t$grid->setTitle($this->titp);\n\t\t$grid->setfilterToolbar(true);\n\t\t$grid->setToolbar('false', '\"top\"');\n\n\t\t$grid->setOnSelectRow('\n\t\t\tfunction(id){\n\t\t\t\tif (id){\n\t\t\t\t\tjQuery(gridId2).jqGrid(\"setGridParam\",{url:\"'.site_url($this->url.'getdatait/').'/\"+id+\"/\", page:1});\n\t\t\t\t\tjQuery(gridId2).trigger(\"reloadGrid\");\n\t\t\t\t}\n\t\t\t}'\n\t\t);\n\t\t$grid->setFormOptionsE('closeAfterEdit:true, mtype: \"POST\", width: 520, height:300, closeOnEscape: true, top: 50, left:20, recreateForm:true, afterSubmit: function(a,b){if (a.responseText.length > 0) $.prompt(a.responseText); return [true, a ];},afterShowForm: function(frm){$(\"select\").selectmenu({style:\"popup\"});} ');\n\t\t$grid->setFormOptionsA('closeAfterAdd:true, mtype: \"POST\", width: 520, height:300, closeOnEscape: true, top: 50, left:20, recreateForm:true, afterSubmit: function(a,b){if (a.responseText.length > 0) $.prompt(a.responseText); return [true, a ];},afterShowForm: function(frm){$(\"select\").selectmenu({style:\"popup\"});} ');\n\t\t$grid->setAfterSubmit(\"$('#respuesta').html('<span style=\\'font-weight:bold; color:red;\\'>'+a.responseText+'</span>'); return [true, a ];\");\n\n\t\t#show/hide navigations buttons\n\t\t$grid->setAdd(false);\n\t\t$grid->setEdit(false);\n\t\t$grid->setDelete( $this->datasis->sidapuede('SCON','BORR_REG%'));\n\t\t$grid->setSearch( $this->datasis->sidapuede('SCON','BUSQUEDA%'));\n\t\t$grid->setRowNum(30);\n\t\t$grid->setShrinkToFit('false');\n\n\t\t$grid->setBarOptions('addfunc: sconaddscli, editfunc: sconedit, delfunc: scondel, viewfunc: sconshow');\n\n\t\t#Set url\n\t\t$grid->setUrlput(site_url($this->url.'setdata/'));\n\n\t\t#GET url\n\t\t$grid->setUrlget(site_url($this->url.'getdata/'));\n\n\t\tif ($deployed) {\n\t\t\treturn $grid->deploy();\n\t\t} else {\n\t\t\treturn $grid;\n\t\t}\n\t}", "public function create()\n {\n // add by dandisy\n $datasource = \\App\\Models\\DataSource::all();\n \n\n // edit by dandisy\n //return view('admin.data_columns.create');\n return view('admin.data_columns.create')\n ->with('datasource', $datasource);\n }", "public function dataTables()\r\r\n {\r\r\n $transfers = $this->transferRepo->findAll();\r\r\n\r\r\n return DataTables::of($transfers)\r\r\n ->addColumn('title', function($row) {\r\r\n return $row->title;\r\r\n })\r\r\n ->addColumn('photo', function($row) {\r\r\n if($row->photo){\r\r\n return '<img src='. asset(\"public/images/transfer/thumb/\" . $row->photo).'/>';\r\r\n } else {\r\r\n return '<strong> No Photo </strong>';\r\r\n }\r\r\n })\r\r\n ->addColumn('edit', function($row) {\r\r\n return '<a href=\"'. url(\"admin-panel/transfers/\" . $row->id . \"/edit\") .'\" type=\"button\" class=\"btn btn-primary\"><i class=\"fa fa-pencil\" aria-hidden=\"true\"></i></a>';\r\r\n })\r\r\n ->addColumn('delete', function ($row) {\r\r\n return '<a href=\"'. url('admin-panel/transfers/delete', $row->id) .'\" class=\"btn btn btn-danger\" data-confirm=\"Are you sure, You want to delete?\" data-method=\"delete\"><i class=\"glyphicon glyphicon-trash\"></i></a>';\r\r\n })\r\r\n ->rawColumns(['delete' => 'delete','edit' => 'edit', 'photo' => 'photo'])\r\r\n ->make(true);\r\r\n }", "protected function grid()\n {\n $grid = new Grid(new $this->currentModel);\n\n $grid->filter(function($filter){\n\n // 去掉默认的id过滤器\n //$filter->disableIdFilter();\n\n // 在这里添加字段过滤器\n $filter->like('title_designer_cn', '标题(设计师)');\n $filter->like('title_name_cn', '标题(项目名称)');\n $filter->like('title_intro_cn', '标题(项目介绍)');\n\n });\n\n $grid->id('ID')->sortable();\n $grid->title_designer_cn('标题(中)')->display(function () {\n return CurrentModel::formatTitle($this, 'cn');\n });\n $grid->title_designer_en('标题(英)')->display(function () {\n return CurrentModel::formatTitle($this, 'en');\n });\n $grid->article_status('状态')->display(function ($article_status) {\n switch ($article_status) {\n case '0' :\n $article_status = '草稿';\n break;\n case '1' :\n $article_status = '审核中';\n break;\n case '2' :\n $article_status = '已发布';\n break;\n }\n return $article_status;\n });\n $grid->release_time('发布时间')->sortable();\n \n // $grid->column('created_at', __('发布时间'));\n $grid->created_at('添加时间')->sortable();\n // $grid->column('updated_at', __('添加时间'));\n\n return $grid;\n }", "private function _generateList()\t{\n\t\tglobal $TCA;\n\n\n\t\t$this->pidSelect = 'pid='.intval($this->id);\n\n\n\t\t$this->tablesInSysFolder = array();\n\t\t\t// Traverse the TCA table array:\n\t\tforeach ($TCA as $tableName => $value) {\n\n\t\t\t// Load full table definitions:\n\t\t\tt3lib_div::loadTCA($tableName);\n\n\t\t\t// for later ... Don't show table if hidden by TCA ctrl section\n\t\t\t// $hideTable = $GLOBALS['TCA'][$tableName]['ctrl']['hideTable'] ? TRUE : FALSE;\n\n\t\t\t/* Setting fields to select: */\n\t\t\t$fields = $this->_makeFieldList($value,$tableName);\n\n\t\t\t/* get user defined columns ... for each table listet in a SysFolder */\n\t\t\tif( isset($this->parentObject->settings['SysFolderContentListAdditionalColumns'][$tableName]) ){\n\n\t\t\t\t$sqlRaw = preg_replace('~[^a-z0-9_,]+~i','',$this->parentObject->settings['SysFolderContentListAdditionalColumns'][$tableName]);\n\t\t\t\t$sqlRawE = t3lib_div::trimExplode(',',$sqlRaw,1);\n\t\t\t\t$fields = array_merge($fields,$sqlRawE);\n\t\t\t}\n\n\t\t\t$orderBy = isset($value['ctrl']['sortby']) ? 'ORDER BY '.$value['ctrl']['sortby'] : ( isset($value['ctrl']['default_sortby']) ? $value['ctrl']['default_sortby'] : 'ORDER BY uid desc' );\n\n\t\t\t$queryParts = array(\n\t\t\t\t'SELECT' => implode(',',$fields),\n\t\t\t\t'FROM' => $tableName,\n\t\t\t\t'WHERE' => $this->pidSelect,\n\t\t\t\t'GROUPBY' => '',\n\t\t\t\t'ORDERBY' => $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy),\n\t\t\t\t'LIMIT' => '0,10'\n\t\t\t);\n\n\t\t\t$result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);\n\t\t\t$dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);\n\n\t\t\t$accRows = false;\n\t\t\tif( $dbCount ){\n\t\t\t\t$this->tablesInSysFolder[$tableName] = array(\n\t\t\t\t\t'TotalItems'=>$this->_getTotalItems($queryParts),\n\t\t\t\t);\n\t\t\t\t$accRows = array();\t// Accumulate rows here\n\t\t\t\twhile($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))\t{\n\t\t\t\t\t// In offline workspace, look for alternative record:\n\t\t\t\t\t// t3lib_BEfunc::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace, TRUE);\n\n\t\t\t\t\tif (is_array($row))\t{\n\t\t\t\t\t\t$accRows = true;\n\t\t\t\t\t\t$this->tablesInSysFolder[$tableName][] = $row;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$GLOBALS['TYPO3_DB']->sql_free_result($result);\n\t\t\t} /* endif $dbCount */\n\n\n\t\t}/* endforeach */\n\n\t}", "function defgrid( $deployed = false ){\n\t\t$i = 1;\n\t\t$editar = 'false';\n\n\t\t$grid = new $this->jqdatagrid;\n\n\t\t$grid->addField('id');\n\t\t$grid->label('N&uacute;mero');\n\t\t$grid->params(array(\n\t\t\t'align' => \"'center'\",\n\t\t\t'frozen' => 'true',\n\t\t\t'width' => 50,\n\t\t\t'editable' => 'false',\n\t\t\t'search' => 'false'\n\t\t));\n\n\n\t\t$grid->addField('tipo');\n\t\t$grid->label('Tipo');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'align' => \"'center'\",\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 40,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:1, maxlength: 1 }',\n\t\t));\n\n\n\t\t$grid->addField('fecha');\n\t\t$grid->label('Fecha');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 80,\n\t\t\t'align' => \"'center'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true,date:true}',\n\t\t\t'formoptions' => '{ label:\"Fecha\" }'\n\t\t));\n\n\n\t\t$grid->addField('retorno');\n\t\t$grid->label('Retorno');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 80,\n\t\t\t'align' => \"'center'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true,date:true}',\n\t\t\t'formoptions' => '{ label:\"Fecha\" }'\n\t\t));\n\n\n\t\t$grid->addField('vende');\n\t\t$grid->label('Vendedor');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 50,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:5, maxlength: 5 }',\n\t\t));\n\n\n\t\t$grid->addField('observa');\n\t\t$grid->label('Observaci&oacute;n');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 250,\n\t\t\t'edittype' => \"'textarea'\",\n\t\t\t'editoptions' => \"'{rows:2, cols:60}'\",\n\t\t));\n\n\n\t\t$grid->addField('facturas');\n\t\t$grid->label('Facturas');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'align' => \"'right'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'width' => 100,\n\t\t\t'editrules' => '{ required:true }',\n\t\t\t'editoptions' => '{ size:10, maxlength: 10, dataInit: function (elem) { $(elem).numeric(); } }',\n\t\t\t'formatter' => \"'number'\",\n\t\t\t'formatoptions' => '{decimalSeparator:\".\", thousandsSeparator: \",\", decimalPlaces: 0 }'\n\t\t));\n\n\n\t\t$grid->addField('monto');\n\t\t$grid->label('Monto');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'align' => \"'right'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'width' => 100,\n\t\t\t'editrules' => '{ required:true }',\n\t\t\t'editoptions' => '{ size:10, maxlength: 10, dataInit: function (elem) { $(elem).numeric(); } }',\n\t\t\t'formatter' => \"'number'\",\n\t\t\t'formatoptions' => '{decimalSeparator:\".\", thousandsSeparator: \",\", decimalPlaces: 2 }'\n\t\t));\n\n\n\t\t$grid->addField('estampa');\n\t\t$grid->label('Estampa');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 80,\n\t\t\t'align' => \"'center'\",\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true,date:true}',\n\t\t\t'formoptions' => '{ label:\"Fecha\" }'\n\t\t));\n\n\n\t\t$grid->addField('usuario');\n\t\t$grid->label('Usuario');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 120,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:12, maxlength: 12 }',\n\t\t));\n\n\n\t\t$grid->addField('hora');\n\t\t$grid->label('Hora');\n\t\t$grid->params(array(\n\t\t\t'search' => 'true',\n\t\t\t'editable' => $editar,\n\t\t\t'width' => 80,\n\t\t\t'edittype' => \"'text'\",\n\t\t\t'editrules' => '{ required:true}',\n\t\t\t'editoptions' => '{ size:8, maxlength: 8 }',\n\t\t));\n\n\n\t\t$grid->showpager(true);\n\t\t$grid->setWidth('');\n\t\t$grid->setHeight('290');\n\t\t$grid->setTitle($this->titp);\n\t\t$grid->setfilterToolbar(true);\n\t\t$grid->setToolbar('false', '\"top\"');\n\n\t\t$grid->setOnSelectRow('\n\t\t\tfunction(id){\n\t\t\t\tif (id){\n\t\t\t\t\tjQuery(gridId2).jqGrid(\"setGridParam\",{url:\"'.site_url($this->url.'getdatait/').'/\"+id+\"/\", page:1});\n\t\t\t\t\tjQuery(gridId2).trigger(\"reloadGrid\");\n\t\t\t\t}\n\t\t\t},\n\t\t\tafterInsertRow:\n\t\t\tfunction( rid, aData, rowe){\n\t\t\t\tif(aData.tipo == \"P\"){\n\t\t\t\t\t$(this).jqGrid( \"setCell\", rid, \"tipo\",\"\",{color:\"#000000\", background:\"#DCFFB5\" });\n\t\t\t\t}else if(aData.tipo == \"A\"){\n\t\t\t\t\t//$(this).jqGrid( \"setRowData\", rid, \"tipo\",{color:\"#000000\", background:\"#C90623\" });\n\t\t\t\t\t$(this).jqGrid( \"setCell\", rid, \"tipo\",\"\",{color:\"#000000\", background:\"##FFDD00\" });\n\t\t\t\t}\n\t\t\t}\n\t\t');\n\n\t\t$grid->setFormOptionsE('closeAfterEdit:true, mtype: \"POST\", width: 520, height:300, closeOnEscape: true, top: 50, left:20, recreateForm:true, afterSubmit: function(a,b){if (a.responseText.length > 0) $.prompt(a.responseText); return [true, a ];},afterShowForm: function(frm){$(\"select\").selectmenu({style:\"popup\"});} ');\n\t\t$grid->setFormOptionsA('closeAfterAdd:true, mtype: \"POST\", width: 520, height:300, closeOnEscape: true, top: 50, left:20, recreateForm:true, afterSubmit: function(a,b){if (a.responseText.length > 0) $.prompt(a.responseText); return [true, a ];},afterShowForm: function(frm){$(\"select\").selectmenu({style:\"popup\"});} ');\n\t\t$grid->setAfterSubmit(\"$('#respuesta').html('<span style=\\'font-weight:bold; color:red;\\'>'+a.responseText+'</span>'); return [true, a ];\");\n\n\t\t#show/hide navigations buttons\n\t\t$grid->setAdd( $this->datasis->sidapuede('RCOBRO','INCLUIR%' ));\n\t\t$grid->setEdit( $this->datasis->sidapuede('RCOBRO','MODIFICA%'));\n\t\t$grid->setDelete( $this->datasis->sidapuede('RCOBRO','BORR_REG%'));\n\t\t$grid->setSearch( $this->datasis->sidapuede('RCOBRO','BUSQUEDA%'));\n\t\t$grid->setRowNum(30);\n\t\t$grid->setShrinkToFit('false');\n\n\t\t$grid->setBarOptions('addfunc: rcobroadd, editfunc: rcobroedit, delfunc: rcobrodel, viewfunc: rcobroshow');\n\n\t\t#Set url\n\t\t$grid->setUrlput(site_url($this->url.'setdata/'));\n\n\t\t#GET url\n\t\t$grid->setUrlget(site_url($this->url.'getdata/'));\n\n\t\tif ($deployed) {\n\t\t\treturn $grid->deploy();\n\t\t} else {\n\t\t\treturn $grid;\n\t\t}\n\t}", "function getFieldSummaryDatastoreAction()\n {\n $this->_helper->viewRenderer->setNoRender(); \n \n //get selected project\n $dataTableName = $_REQUEST['dataTableName'];\n $this->autoClassify($dataTableName);\n\n Zend_Loader::loadClass('Layout_DataGridHelper');\n Zend_Loader::loadClass('Table_FieldSummary');\n $dgHelper = new Layout_DataGridHelper();\n \n //1. set data records:\n $fieldSummaryTable = new Table_FieldSummary();\n $whereClause = (\"source_id = '\" . $dataTableName . \"'\");\n $rows = $fieldSummaryTable->fetchAll($whereClause, \"field_num ASC\");\n $dgHelper->setDataRecords($rows, \"pk_field\");\n \n //2. define a layout:\n //2.a). get field types:\n Zend_Loader::loadClass('Table_FieldType');\n $fieldTypesTable = new Table_FieldType();\n $rows = $fieldTypesTable->fetchAll();\n $fieldOptions = array();\n $i = 0;\n foreach ($rows as $row) \n {\n $fieldOptions[$i] = $row->FIELD_TYPE_NAME;\n ++$i;\n } \n \n //2.b) get property types:\n Zend_Loader::loadClass('Table_PropertyType');\n $fieldPropsTable = new Table_PropertyType();\n $rows = $fieldPropsTable->fetchAll();\n $propOptions = array();\n $propOptions[0] = \"\";\n $i = 1;\n foreach ($rows as $row) \n {\n $propOptions[$i] = $row->NAME;\n ++$i;\n } \n \n //2.c)\n $layout = array(); \n array_push($layout, array(\n 'field' => 'field_label',\n 'name' => 'Field Label',\n 'width' => '100px',\n 'editable' => true\n ));\n array_push($layout, array(\n 'field' => 'field_type',\n 'name' => 'Field Type',\n 'width' => '100px',\n 'type' => 'dojox.grid.cells.Select',\n 'cellType' => 'dojox.grid.cells.Bool',\n 'options' => $fieldOptions,\n 'editable' => true\n ));\n array_push($layout, array(\n 'field' => 'prop_desc',\n 'name' => 'Field Description',\n 'width' => '150px',\n 'editable' => true\n //'editor' => 'dojox.grid.editors.Dijit',\n //'editorClass' => 'dijit.form.Textarea'\n ));\n array_push($layout, array(\n 'field' => 'prop_type',\n 'name' => 'Property Type',\n 'width' => '80px',\n 'type' => 'dojox.grid.cells.Select',\n 'options' => $propOptions,\n 'editable' => true\n ));\n\n $dgHelper->layout = $layout;\n header('Content-Type: application/json; charset=utf8');\n echo Zend_Json::encode($dgHelper);\n }", "public function __construct()\n {\n $this->setColumnsList(array(\n 'tipoId'=>'tipoId',\n 'tipo'=>'tipo',\n 'tipo_eu'=>'tipoEu',\n 'tipo_es'=>'tipoEs',\n 'createdOn'=>'createdOn',\n 'updateOn'=>'updateOn',\n ));\n\n $this->setColumnsMeta(array(\n 'tipo'=> array('ml'),\n ));\n\n $this->setMultiLangColumnsList(array(\n 'tipo'=>'Tipo',\n ));\n\n $this->setAvailableLangs(array('es', 'eu'));\n\n $this->setParentList(array(\n ));\n\n $this->setDependentList(array(\n 'IncidenciasIbfk2' => array(\n 'property' => 'Incidencias',\n 'table_name' => 'Incidencias',\n ),\n ));\n\n\n $this->setOnDeleteSetNullRelationships(array(\n 'incidencias_ibfk_2'\n ));\n\n $this->_defaultValues = array(\n 'tipo' => '',\n 'tipoEu' => '',\n 'tipoEs' => '',\n 'createdOn' => '0000-00-00 00:00:00',\n 'updateOn' => 'CURRENT_TIMESTAMP',\n );\n\n $this->_initFileObjects();\n parent::__construct();\n }", "public function __construct()\n {\n $this->setColumnsMeta(array(\n 'ubicacion'=> array('enum:poste|puntoRecogida|centroEmergencia'),\n ));\n\n $this->setMultiLangColumnsList(array(\n ));\n\n $this->setAvailableLangs(array('es', 'eu'));\n\n $this->setParentList(array(\n 'CubosIbfk1'=> array(\n 'property' => 'Contribuyente',\n 'table_name' => 'Contribuyentes',\n ),\n 'CubosIbfk3'=> array(\n 'property' => 'CubosTipos',\n 'table_name' => 'CubosTipos',\n ),\n 'CubosIbfk4'=> array(\n 'property' => 'PuntosRecogida',\n 'table_name' => 'PuntosRecogida',\n ),\n 'CubosIbfk5'=> array(\n 'property' => 'Poste',\n 'table_name' => 'Postes',\n ),\n 'CubosIbfk6'=> array(\n 'property' => 'CentrosEmergencia',\n 'table_name' => 'CentrosEmergencia',\n ),\n ));\n\n $this->setDependentList(array(\n 'IncidenciasIbfk1' => array(\n 'property' => 'Incidencias',\n 'table_name' => 'Incidencias',\n ),\n 'RecogidasIbfk2' => array(\n 'property' => 'Recogidas',\n 'table_name' => 'Recogidas',\n ),\n ));\n\n\n\n\n $this->_defaultValues = array(\n 'ubicacion' => 'poste',\n );\n\n $this->_initFileObjects();\n parent::__construct();\n }", "protected function Form_Create() {\n\t\t\t$this->dtgTrees = new TreeDataGrid($this);\n\n\t\t\t// Style the DataGrid (if desired)\n\t\t\t$this->dtgTrees->CssClass = 'datagrid';\n\t\t\t$this->dtgTrees->AlternateRowStyle->CssClass = 'alternate';\n\n\t\t\t// Add Pagination (if desired)\n\t\t\t$this->dtgTrees->Paginator = new QPaginator($this->dtgTrees);\n\t\t\t$this->dtgTrees->ItemsPerPage = 20;\n\n\t\t\t// Use the MetaDataGrid functionality to add Columns for this datagrid\n\n\t\t\t// Create an Edit Column\n\t\t\t$strEditPageUrl = __VIRTUAL_DIRECTORY__ . __FORM_DRAFTS__ . '/tree_edit.php';\n\t\t\t$this->dtgTrees->MetaAddEditLinkColumn($strEditPageUrl, 'Edit', 'Edit');\n\n\t\t\t// Create the Other Columns (note that you can use strings for tree's properties, or you\n\t\t\t// can traverse down QQN::tree() to display fields that are down the hierarchy)\n\t\t\t$this->dtgTrees->MetaAddColumn('Idtree');\n\t\t\t$this->dtgTrees->MetaAddColumn(QQN::Tree()->SpeciesIdspeciesObject);\n\t\t\t$this->dtgTrees->MetaAddColumn('Longitude');\n\t\t\t$this->dtgTrees->MetaAddColumn('Latitude');\n\t\t\t$this->dtgTrees->MetaAddColumn('Age');\n\t\t\t$this->dtgTrees->MetaAddColumn('Identifier');\n\t\t}", "protected function grid()\n {\n $grid = new Grid(new Activity());\n $grid->model()->orderBy('created_at','desc');\n\n $grid->column('id', __('Id'));\n $grid->column('log_name', __('Log name'))->using($this->log_name);\n $grid->column('description', __('Description'))->limit(10);\n $grid->column('subject_id', __('Subject id'));\n $grid->column('subject_type', __('Subject type'));\n $grid->column('causer_id', __('Causer id'));\n $grid->column('causer_type', __('Causer type'));\n $grid->column('properties', __('Properties'))->display(function ($properties) {\n $properties = [\n '详情' => isset($properties['description']) ? $properties['description'] : '',\n '备注' => isset($properties['remark']) ? $properties['remark'] : '',\n ];\n return new Table([], $properties);\n });\n $grid->column('created_at', __('Created at'))->sortable();\n $grid->column('updated_at', __('Updated at'));\n\n $grid->filter(function ($filter) {\n\n $filter->equal('log_name', __('Log name'))->select($this->log_name);\n\n });\n\n #禁用创建按钮\n $grid->disableCreateButton();\n\n $grid->actions(function ($actions) {\n $actions->disableDelete();\n $actions->disableView();\n $actions->disableEdit();\n });\n return $grid;\n }", "protected function grid()\n {\n $grid = new Grid(new Barang());\n\n $grid->filter(function($filter){\n $filter->disableIdFilter();\n $filter->like('nama', 'Nama');\n });\n $grid->column('id', __('Id'));\n $grid->column('nama', __('Nama'));\n $grid->column('harga', __('Harga Beli'));\n $grid->column('harga_jual', __('Harga Jual'));\n $grid->column('satuan_id', __('Satuan id'))->display(function($satuan) {\n return Satuan::find($satuan)->nama;\n });\n $grid->column('jumlah_unit', __('Jumlah Unit'));\n $grid->column('parent_id', 'Parent')->display(function($id) {\n if($id) {\n return Barang::find($id)->nama;\n }\n else {\n return null;\n }\n });\n $grid->column('b_pengiriman', __('Pengiriman'));\n $grid->column('b_keamanan', __('Keamanan'));\n // $grid->column('created_at', __('Created at'));\n // $grid->column('updated_at', __('Updated at'));\n\n return $grid;\n }" ]
[ "0.59534377", "0.57892495", "0.5734265", "0.5725187", "0.5685025", "0.56577164", "0.56120133", "0.5571964", "0.5557955", "0.55323964", "0.55260295", "0.55165577", "0.55000925", "0.5490411", "0.5462657", "0.545562", "0.5429502", "0.54096806", "0.54002047", "0.53851837", "0.53773946", "0.5371997", "0.53614515", "0.53387934", "0.5333403", "0.5329208", "0.53241295", "0.53224516", "0.53171945", "0.5315976" ]
0.5799705
1
Cycles through each argument added Based on Rails `cycle` method if last argument begins with ":" then it will change the namespace (allows multiple cycle calls within a loop)
function cycle($first_value, $values = '*') { // keeps up with all counters static $count = array(); // get all arguments passed $values = is_array($first_value) ? $first_value : func_get_args(); // set the default name to use $name = 'default'; // check if last items begins with ":" $last_item = end($values); if( substr($last_item, 0, 1) === ':' ) { // change the name to the new one $name = substr($last_item, 1); // remove the last item from the array array_pop($values); } // make sure counter starts at zero for the name if( !isset($count[$name]) ) $count[$name] = 0; // get the current item for its index $index = $count[$name] % count($values); // update the count and return the value $count[$name]++; return $values[$index]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_loop($loop = array())\n {\n }", "public function cyclesAdd()\n {\n $this->cycles++;\n }", "function addOne(&$arg)\n{\n $arg++;\n}", "public function add()\n {\n for ($i = 0 ; $i < func_num_args(); $i++) {\n $this->addSingle(func_get_arg($i));\n }\n }", "public function incrementArgumentPosition()\n {\n $this->argument++;\n }", "function foo()\n{\n\t// returns an array of all passed arguments\n\t$args = func_get_args();\n\t \n\tforeach ($args as $k => $v)\n\t{\n\t\techo \"arg\".($k+1).\": $v\\n\";\n\t}\n}", "function array_cycle() {\n $y = array();\n $x = new Cycler();\n $x->x =& $y;\n $y[\"one\"][\"bar\"] = $x;\n $y[\"two\"][\"bar\"] =& $y;\n $y[\"three\"] = \"string data\";\n}", "abstract public static function args();", "public static function forwardConnectionArgs()\n {\n }", "public static function forwardConnectionArgs()\n {\n }", "public function setCycle($cycle)\n {\n $this->cycle = $cycle;\n\n return $this;\n }", "public function setAll($args = [], $reassign = false);", "function update_loop($i = 'active', $key = \\null, $value = \\null)\n {\n }", "public function setCategoriesParams($name, $params = array())\n{\nif (empty($params))\n{\nreturn;\n}\n\n$this->$name->setCategoriesParams($this->_restructureParams($params));\n}", "function a() {\n\t\t$args = func_get_args();\n\t\treturn $args;\n\t}", "public function __invoke( ...$args );", "public function add() {\n\t\t\techo implode(\"\", func_get_args());\n\t\t\treturn $this;\n\t\t}", "function css_add(/*group, value, value, value = array()*/)\n{\n\t$CI = &get_instance();\n\t// get args\n\t$args = func_get_args();\n\t// assign args to class\n\t$CI->css->add($args);\n}", "public function __invoke($arguments)\n {\n\n }", "function __call($method, $args=[])\n {\n \tcall_user_func_array($this->container[$method], $args);\n }", "public function run(...$params);", "protected static function updateNodePackages()\n {\n static::updatePackages(...func_get_args());\n }", "public function addUses($args)\n {\n foreach ((array) $args as $key => $value) {\n $value = str_replace('/', '\\\\', $value);\n if (is_int($key)) {\n // namespace or class import\n if (class_exists($value)) {\n // class import\n $this->aliases[StringHelper::basename($value)] = $value;\n } else {\n // namespace\n $this->namespaces[] = $value;\n }\n } else {\n // aliased class import\n $this->aliases[$key] = $value;\n }\n }\n }", "private function buildParameters(\\Phalcon\\Di\\DiInterface $container, array $arguments): array\n {\n }", "public function __invoke(array $args = []);", "abstract protected function get_args();", "function RunnerApply (&$obj, &$argsArr)\n{\t\n\tforeach ($argsArr as $key=>$var)\n\t\tsetObjectProperty($obj,$key,$argsArr[$key]);\n}", "public function setArgument(string $name,$arg) : DefinitionInterface;", "public function __construct()\n {\n $this->arguments = func_get_args();\n }", "function tie_loop($loop_name, &$loop)\r\n\t{\r\n\t\tif (!$loop) $loop = 0;\r\n\t\t$this->loops[$loop_name] =& $loop;\r\n\t}" ]
[ "0.5135708", "0.50927603", "0.505903", "0.48176682", "0.47834137", "0.47525236", "0.4743625", "0.4655114", "0.46123734", "0.46123734", "0.45069978", "0.44575948", "0.44385505", "0.44325992", "0.44205338", "0.4381066", "0.43750358", "0.43711752", "0.43579373", "0.43499324", "0.43385676", "0.4335019", "0.43126452", "0.43051955", "0.43018597", "0.42920583", "0.42776942", "0.42753324", "0.42732364", "0.4260319" ]
0.5561409
0
Saves the Target Grade into the database. It either updates or inserts.
public function save() { if($this->id != -1) { $this->update_target_grade(); } else { $this->insert_target_grade(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function insert_target_grade()\r\n {\r\n global $DB;\r\n $params = $this->get_params();\r\n $this->id = $DB->insert_record('block_bcgt_target_grades', $params);\r\n }", "public function save_grade() {\r\n\r\n\t\t\t//new method\r\n\t\t\t$sql = \"UPDATE grades SET student_id = ?, course_id = ?, degree = ?, examine_at = ? WHERE id = ?;\";\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->student_id, $this->course_id, $this->degree, $this->examine_at, $this->id]);\r\n\t\t\t//old method\r\n\t\t\t/*$sql = \"UPDATE grades SET student_id = ? WHERE id = ?;\";\r\n\t\t\t$sql = \"UPDATE grades SET course_id = ? WHERE id = ?;\";\r\n\t\t\t$sql = \"UPDATE grades SET degree = ? WHERE id = ?;\";\r\n\t\t\t$sql = \"UPDATE grades SET examine_at = ? WHERE id = ?;\";\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->student_id, $this->id]);\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->course_id, $this->id]);\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->degree, $this->id]);\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->examine_at, $this->id]);*/\r\n\t\t}", "public function saveToDb() {\n parent::saveToDb();\n\n require_once 'models/Location.php';\n Location::saveToDb($this->preferredLocation);\n Location::saveToDb($this->currentLocation);\n\n require_once 'libs/DB.php';\n $conn = DB::connect();\n\n $seekerId = $this->id();\n\n // Update the seeker table\n $conn->exec(\"UPDATE seeker SET experience='$this->experience', pref_location_name='$this->preferredLocation', curr_location_name='$this->currentLocation' WHERE id='$seekerId'\");\n\n require_once 'models/Skill.php';\n foreach($this->skills as $skill) {\n Skill::saveToDb($skill);\n }\n\n // Delete old skills\n $conn->exec(\"DELETE FROM seeker_skill WHERE seeker_id='$seekerId'\");\n\n // Add new skills\n foreach($this->skills as $skill) {\n $conn->exec(\"INSERT INTO seeker_skill(seeker_id, skill_name) VALUES('$seekerId', '$skill')\");\n }\n }", "public function save() {\n $db = Db::instance();\n $db_properties = array(\n 'action' => $this->action,\n 'url_mod' => $this->url_mod,\n 'description' => $this->description,\n 'target_id' => $this->target_id,\n 'target_name' => $this->target_name,\n 'creator_id' => $this->creator_id,\n 'creator_username' => $this->creator_username\n );\n $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);\n }", "function languagelesson_save_grade($lessonid, $userid, $gradeval) {\n global $DB;\n\t// build the grade object\n\t$grade = new stdClass;\n\t$grade->lessonid = $lessonid;\n\t$grade->userid = $userid;\n\t$grade->grade = $gradeval;\n\n\t// And update the old grade record, if there is one; if not, insert the record.\n\tif ($oldgrade = $DB->get_record(\"languagelesson_grades\", array(\"lessonid\"=>$lessonid, \"userid\"=>$userid))) {\n\t\t// If the old grade was for a completed lesson attempt, update the completion time.\n\t\tif ($oldgrade->completed) { $grade->completed = time(); }\n\t\t$grade->id = $oldgrade->id;\n\t\tif (! $DB->update_record(\"languagelesson_grades\", $grade)) {\n\t\t\terror(\"Navigation: grade not updated\");\n\t\t}\n\t} else {\n\t\tif (! $DB->insert_record(\"languagelesson_grades\", $grade)) {\n\t\t\terror(\"Navigation: grade not inserted\");\n\t\t}\n\t}\n}", "public function save($obj)\n {\n DB::table('job_grades')->insert($obj);\n }", "public function post_Table_data(){\n\t\t$this->load->model('teach_func/auto_save_tbl', 'this_model');\n\n\t\t$Q = $this->this_model->auto_update();\n\t\t\n\t\tif ($Q) {\n\t\t\t\n\t\t\techo \"Student_grade_updated! :)\";\n\t\t}\n\n\t}", "public function run() {\n\t\t\t$grades = [\n\t\t\t\t[\n\t\t\t\t\t'user_id' => 13, 'teacher_id' => 4, 'lesson_id' => 4, 'grade' => 96, 'class_id'=>4\n\t\t\t\t],\n\t\t\t];\n\t\t\t\n\t\t\tGrade::insert($grades);\n\t\t}", "public function test_insert_grade_record() {\n global $DB, $USER;\n\n $user = $this->getDataGenerator()->create_user();\n $this->setAdminUser();\n\n $record = new stdClass();\n $record->itemid = 4;\n $record->newgradeitem = 25;\n $record->finalgrade = 62.00;\n $record->feedback = 'Some test feedback';\n\n $testobject = new phpunit_gradeimport_csv_load_data();\n $testobject->test_insert_grade_record($record, $user->id);\n\n $gradeimportvalues = $DB->get_records('grade_import_values');\n // Get the insert id.\n $key = key($gradeimportvalues);\n\n $testarray = array();\n $testarray[$key] = new stdClass();\n $testarray[$key]->id = $key;\n $testarray[$key]->itemid = $record->itemid;\n $testarray[$key]->newgradeitem = $record->newgradeitem;\n $testarray[$key]->userid = $user->id;\n $testarray[$key]->finalgrade = $record->finalgrade;\n $testarray[$key]->feedback = $record->feedback;\n $testarray[$key]->importcode = $testobject->get_importcode();\n $testarray[$key]->importer = $USER->id;\n $testarray[$key]->importonlyfeedback = 0;\n\n // Check that the record was inserted into the database.\n $this->assertEquals($gradeimportvalues, $testarray);\n }", "public function save() {\n $db = Db::instance();\n // omit id and any timestamps\n $db_properties = array(\n 'author_id' => $this->author_id,\n 'clothingname' => $this->clothingname,\n 'clothingtype' => $this->clothingtype,\n 'tempmin' => $this->tempmin,\n 'tempmax' => $this->tempmax\n );\n $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);\n }", "public function save()\n {\n $this->checkForNecessaryProperties();\n\n $this->update($this->getCurrentId(), $this->data);\n }", "public function update_qualification_award($qualID, $targetGradeID)\n\t{ \n global $DB;\n logAction(LOG_MODULE_GRADETRACKER, LOG_ELEMENT_GRADETRACKER_QUALIFICATION, LOG_VALUE_GRADETRACKER_UPDATED_QUAL_AWARD, $this->studentID, $qualID, null, null, null);\n\n $courseID = -1;\n $course = Qualification::get_user_course($qualID, $this->studentID);\n if($course)\n {\n $courseID = $course->courseid;\n }\n \n\t\t$obj = new stdClass();\n\t\t$obj->bcgtqualificationid = $qualID;\n\t\t$obj->userid = $this->studentID;\n\t\t//todo\n //breakdown\n $obj->bcgtbreakdownid = -1;\n $obj->bcgttargetgradesid = $targetGradeID;\n $obj->courseid = $courseID;\n $obj->warning = '';\n $obj->type = 'CETA';\n\t\t//lets find out if the user has one inserted before?\n $record = $DB->get_record_sql('SELECT * FROM {block_bcgt_user_award} WHERE userid = ? \n AND bcgtqualificationid = ? AND courseid = ?', array($this->studentID, $qualID, $courseID));\n\t\tif($record)\n\t\t{\n $id = $record->id;\n $obj->id = $id;\n return $DB->update_record('block_bcgt_user_award', $obj);\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $DB->insert_record('block_bcgt_user_award', $obj);\n\t\t}\n\t}", "function addGrade(){\n $categoryId = Slim::getInstance()->request()->post('categoryId');\n $gradeName = Slim::getInstance()->request()->post('gradeName');\n $percentage = Slim::getInstance()->request()->post('percentage');\n try {\n $insertGrade = \"INSERT INTO grades(categoryId, gradeName, percentage) VALUE(:categoryId, :gradeName, :percentage)\";\n $db = getConnection();\n $stmt = $db->prepare($insertGrade);\n $stmt->bindParam(\"categoryId\", $categoryId);\n $stmt->bindParam(\"gradeName\", $gradeName);\n $stmt->bindParam(\"percentage\", $percentage);\n $stmt->execute();\n $db = null;\n\n } catch(PDOException $e) {\n echo '{\"error\":{\"text\":'. $e->getMessage() .'}}'; \n } \n}", "public function save()\n\t{\n\t\t$date = datetime_to_string($this->date);\n\t\t$grades = array_to_csv($this->grades);\n\t\t\n\t\t// Establish DB connection.\n\t\t$dbh = (new DatabaseConnection())->connect();\n\t\t\n\t\t// Prepare and execute query.\n\t\t// Add.\n\t\tif (is_null($this->id)) {\n\t\t\t$stmt = $dbh->prepare('INSERT INTO ' . self::DB_TABLE . ' (challenge_id, date, title, description, author, repository, license, grades, winner) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)');\n\t\t\t$success = $stmt->execute(array($this->challengeId, $date, $this->title, $this->description, $this->author, $this->repository, $this->license, $grades, $this->winner));\n\t\t}\n\t\t// Edit.\n\t\telse {\n\t\t\t$stmt = $dbh->prepare('UPDATE ' . self::DB_TABLE . ' SET challenge_id = ?, date = ?, title = ?, description = ?, author = ?, repository = ?, license = ?, grades = ?, winner = ? WHERE ' . self::DB_PRIMARY_KEY . ' = ?');\n\t\t\t$success = $stmt->execute(array($this->challengeId, $date, $this->title, $this->description, $this->author, $this->repository, $this->license, $grades, $this->winner, $this->id));\n\t\t}\n\t\t\n\t\t// Close connection.\n\t\t$dbh = null;\n\t\t\n\t\treturn $success;\n\t}", "protected function save()\n\t{\n\t\t$this->saveItems();\n\t\t//$this->saveAssignments();\n\t\t//$this->saveRules();\n\t}", "public function store(GradeCreateRequest $request)\n {\n\n\n\n $grade = Grade::create($request->gradeFillData());\n $grade->syncFatherGrades($request->get('father_grade', []));\n return redirect('/admin/grade')\n ->withSuccess(\"分级 '$grade->grade' 创建成功\");\n }", "public function saveData(): void\n {\n studentLoader::saveStudent(new student($_POST['lastName'], $_POST['firstName'], $_POST['email'], new group($_POST['className']), $_POST['id']), $this->pdo);\n }", "public function save(stdClass $grade, stdClass $data) {\n global $DB;\n $feedbackentry = $this->get_feedback_entry($grade->id);\n\n if ($data->helixfeedback_activated != 1) {\n return true;\n }\n\n if ($feedbackentry) {\n /***Nothing needs to change in the DB for an update since the only change is on the HML server, so just return true***/\n return true;\n } else {\n $feedbackentry = new stdClass();\n $feedbackentry->grade = $grade->id;\n $feedbackentry->assignment = $this->assignment->get_instance()->id;\n $prerec = $DB->get_record('helixmedia_pre', array('id' => $data->helixfeedback_preid));\n $feedbackentry->preid = $prerec->id;\n $feedbackentry->servicesalt = $prerec->servicesalt;\n return $DB->insert_record('assignfeedback_helixfeedback', $feedbackentry) > 0;\n }\n }", "function game_save_best_score($game) {\n global $DB, $USER;\n\n // Get all the attempts made by the user\n if (!$attempts = game_get_user_attempts( $game->id, $USER->id)) {\n print_error( 'Could not find any user attempts');\n }\n\n // Calculate the best grade\n $bestscore = game_calculate_best_score( $game, $attempts);\n\n // Save the best grade in the database\n if ($grade = $DB->get_record('game_grades', array( 'gameid' => $game->id, 'userid' => $USER->id))) {\n $grade->score = $bestscore;\n $grade->timemodified = time();\n if (!$DB->update_record('game_grades', $grade)) {\n print_error('Could not update best grade');\n }\n } else {\n $grade->gameid = $game->id;\n $grade->userid = $USER->id;\n $grade->score = $bestscore;\n $grade->timemodified = time();\n if (!$DB->insert_record( 'game_grades', $grade)) {\n print_error( 'Could not insert new best grade');\n }\n }\n\n return true;\n}", "public function assignGrades()\n {\n if(isset($this->data['EarningRatePrisoner']) && is_array($this->data['EarningRatePrisoner']) && $this->data['EarningRatePrisoner']!='')\n {\n if(isset($this->data['EarningRatePrisoner']['uuid']) && $this->data['EarningRatePrisoner']['uuid']=='')\n {\n $uuidArr=$this->EarningRatePrisoner->query(\"select uuid() as code\");\n $this->request->data['EarningRatePrisoner']['uuid']=$uuidArr[0][0]['code'];\n } \n if(isset($this->data['EarningRatePrisoner']['date_of_assignment']) && $this->data['EarningRatePrisoner']['date_of_assignment']!=\"\" )\n {\n $this->request->data['EarningRatePrisoner']['date_of_assignment']=date('Y-m-d',strtotime($this->data['EarningRatePrisoner']['date_of_assignment']));\n }\n if($this->EarningRatePrisoner->save($this->data))\n {\n $this->Session->write('message_type','success');\n $this->Session->write('message','Saved successfully');\n $this->redirect('/earningRates/assignGrades'); \n } \n else\n {\n $this->Session->write('message_type','error');\n $this->Session->write('message','saving failed');\n }\n\n }\n /*\n *Code for delete the Earning Rates\n */\n if(isset($this->data['EarningRatePrisonerDelete']['id']) && (int)$this->data['EarningRatePrisonerDelete']['id'] != 0){\n $this->EarningRatePrisoner->id=$this->data['EarningRatePrisonerDelete']['id'];\n $this->EarningRatePrisoner->saveField('is_trash',1);\n\n $this->Session->write('message_type','success');\n $this->Session->write('message','Deleted Successfully !');\n $this->redirect(array('action'=>'assignGrades'));\n }\n /*\n *Code for edit the Earning Rates\n */\n if(isset($this->data['EarningRatePrisonerEdit']['id']) && (int)$this->data['EarningRatePrisonerEdit']['id'] != 0){\n if($this->EarningRatePrisoner->exists($this->data['EarningRatePrisonerEdit']['id'])){\n $this->data = $this->EarningRatePrisoner->findById($this->data['EarningRatePrisonerEdit']['id']);\n }\n } \n $gradeslist=$this->EarningRate->find('list',array(\n 'recursive' => -1,\n 'fields' => array(\n 'EarningRate.id',\n 'EarningGrade.name',\n ),\n \"joins\" => array(\n array(\n \"table\" => \"earning_grades\",\n \"alias\" => \"EarningGrade\",\n \"type\" => \"LEFT\",\n \"conditions\" => array(\n \"EarningRate.earning_grade_id = EarningGrade.id\"\n )\n )),\n 'conditions' => array(\n 'EarningRate.is_enable' => 1,\n 'EarningRate.is_trash' => 0,\n ),\n 'order'=>array(\n 'EarningGrade.name'\n )\n )); \n $prisonerlist=$this->Prisoner->find('list',array(\n 'recursive' => -1,\n 'fields' => array(\n 'Prisoner.id',\n 'Prisoner.prisoner_no',\n ),\n 'conditions' => array(\n 'Prisoner.is_enable' => 1,\n 'Prisoner.is_trash' => 0,\n ),\n 'order'=>array(\n 'Prisoner.prisoner_no'\n )\n )); \n\n $this->set(compact('gradeslist','prisonerlist'));\n\n }", "public function store()\n {\n $values = DatabaseHelpers::dbAddAudit(request()->all());\n $values['short_name'] = strtoupper($values['short_name']);\n $course = Course::create($values);\n if (! $course->gradeLevels()->sync($values['grade_levels'])) {\n ViewHelpers::flashAlert(\n 'danger',\n 'Could not save grade levels. Please try again.',\n 'fa fa-info-circle mr-1');\n\n return redirect()->back();\n }\n unset($values['grade_levels']);\n ViewHelpers::flash($course, 'course');\n\n if ($course) {\n return redirect()->to('course/'.$course->uuid);\n }\n\n return redirect()->back()->withInput();\n }", "function insert() {\n // Retrieve scale and infer grademax from it\n if (!empty($this->scaleid)) {\n $this->load_scale();\n $this->scale->load_items();\n $this->grademax = count ($this->scale->scale_items);\n $this->grademin = 0;\n }\n\n $result = parent::insert();\n\n // Notify parent grade_item of need to update\n $this->load_grade_item();\n $result = $result && $this->grade_item->flag_for_update();\n\n // Update grade_grades_text if specified\n if ($result && !empty($this->feedback)) {\n $result = $this->annotate(NULL, NULL, $this->feedback, $this->feedbackformat);\n }\n\n return $result && $this->grade_item->flag_for_update();\n }", "public function save()\n {\n $this->_validateModifiable();\n\n if($this->isNew())\n {\n $this->_getDataSource()->create($this);\n }\n else\n {\n $this->_getDataSource()->update($this);\n }\n\n $this->_saveRelations();\n $this->_setNew(false);\n }", "public function store(CreateGradeRequest $request)\n {\n $this->gradeService->store($request);\n return redirect()->route('grades.index');\n }", "public\tfunction\tsave()\n\t\t{\n\t\t}", "public function save_coverages() {\n global $DB;\n\n if (!empty($this->coverages)) {\n foreach ($this->coverages as $cv) {\n if ($cv->id == 0) {\n // New record.\n unset($cv->id);\n $cv->id = $DB->insert_record('userquiz_monitor_coverage', $cv);\n } else {\n $DB->update_record('userquiz_monitor_coverage', $cv);\n }\n }\n }\n }", "public function store(Request $request)\n {\n // // dd($request);\n // $this->validate($request, [\n // 'name' => 'required|unique:grades',\n // 'teacher_id' => ['required',\n // Rule::notIn(['0'])],\n // ]);\n // $newGrade = $request->all();\n //\n // $grade = Grade::create($newGrade);\n //\n // return redirect()->back()\n // ->with('flash_message', 'New grade '.$grade['name'].' successfully added!');\n }", "public function save($obj)\n {\n $obj['created_by'] = $this->requester->getUserId();\n $obj['created_at'] = Carbon::now();\n\n LogDao::insertLogImpact($this->requester->getLogId(), 'grades', $obj);\n\n return DB::table('grades')->insertGetId($obj);\n }", "public function save() {\n $db = Db::instance();\n // omit id \n $db_properties = array(\n 'firstName' => $this->firstName,\n 'lastName' => $this->lastName,\n 'description' => $this->description,\n 'user' => $this->user,\n 'password' => $this->password,\n 'image' => $this->image,\n 'gender' => $this->gender,\n 'topic_id' => $this->topic_id,\n 'topic_id1' => $this->topic_id1,\n 'role_id' => $this->role_id,\n );\n $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);\n }", "function addGrade($grades) {\n\n $columns = implode(\", \", array_keys($grades));\n $escaped_values = array_map($this->db->prepare, array_values($grades));\n $values = implode(\", \", $escaped_values);\n $sql = \"INSERT INTO `grades`($columns) VALUES ($values)\";\n\n $this->executeQuery($sql);\n }" ]
[ "0.76819974", "0.73544496", "0.66014427", "0.64346683", "0.6227649", "0.59803945", "0.59065485", "0.58583045", "0.58172953", "0.5750802", "0.5672258", "0.5603101", "0.55894566", "0.55830395", "0.5562536", "0.5552673", "0.54855484", "0.5479278", "0.54779685", "0.5452694", "0.5451237", "0.54386216", "0.5431636", "0.5428779", "0.54242176", "0.53788364", "0.5375946", "0.5365357", "0.5355", "0.535472" ]
0.82555264
0
Deletes the target grade using the target grade id passed in (from the database.)
public static function delete_target_grade($targetGradeID) { global $DB; $DB->delete_records('block_bcgt_target_grades', array('id'=>$targetGradeID)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete_grade() {\r\n\t\t\t$sql = \"DELETE FROM grades WHERE id = $this->id;\";\r\n\t\t\tDatabase::$db->query($sql);\r\n\t\t}", "function sqlDeleteGrade()\n\t{\n\t\t$sql = \"\n\t\tDELETE FROM tbl_grade\n\t\tWHERE grade_id = :grade_id\n\t\t\";\n\n\t\treturn $sql;\n\t}", "function sb_assignment_delete ($node) {\n\n db_query(\"DELETE FROM {eto_assignments}\n WHERE \" . $node->key_field . \" = %d AND \" . $node->target_field . \" = %d\",\n\t $node->uid, $node->selected_uid);\n\n}", "public function delete($id)\n {\n $grade = Grade::findOrFail($id);\n $grade->delete();\n\n return redirect()->route('grade');\n }", "public function delete() {\n global $DB;\n foreach ($this->targets as $target) {\n $DB->delete_records('progressreview_tutor', array('id' => $target->id));\n }\n }", "public function delete() {\n\t\t$this->assignment->delete();\n\t}", "function delete() {\n\t\t$sql = \"DELETE FROM cost_detail\n\t\t\t\tWHERE cd_fr_id=?, cd_seq=?\";\n\t\t$this->ffm->query($sql, array($this->cd_fr_id, $this->cd_seq));\n\t}", "public function destroy(Grade $grade)\n {\n // $gradeId = $grade->id;\n // $grade = Grade::findOrFail($gradeId);\n // $grade->delete();\n // return redirect()->route('grades.index')\n // ->with('flash_message', \"Grade successfully deleted!\");\n }", "public function delete()\n {\n $stmt = $this->_db->prepare(\"DELETE FROM score;\");\n $stmt->execute();\n }", "public static function delete()\n {\n if ( empty($_REQUEST['mgb_rating_id']) ) return;\n $id = (int) $_REQUEST['mgb_rating_id'];\n\n Database::query(\n \"DELETE FROM ?\n WHERE id=${id}\"\n );\n }", "public function delete($id)\n {\n $data = $this->model->find($id);\n $ship = $data->brand;\n $delete = $data->delete();\n if ($delete) {\n generateAccessesTxt(\n date('H:i:s').utf8_decode(\n ' Excluiu a Grade:'.$data->name.\n ', Tam:'.$data->label.\n ', Fabricante:'.$ship->name)\n );\n return true;\n }\n return false;\n }", "public function destroy(Grade $grade)\n {\n $team = $grade->team_id;\n $grade->delete();\n return redirect()->route('grades.index',$team)->with('success', true);\n }", "final public function delete() {\n global $config; \n # Borrar el elemento de la base de datos\n $this->db->query(\"DELETE FROM guarderia_2 WHERE id_guarderia = $this->id\");\n # Redireccionar a la página principal del controlador\n $this->functions->redir($config['site']['url'] . 'sedes/&success=true');\n }", "function dataform_grade_item_delete($data) {\n global $CFG;\n require_once(\"$CFG->libdir/gradelib.php\");\n\n return grade_update('mod/dataform', $data->course, 'mod', 'dataform', $data->id, 0, NULL, array('deleted'=>1));\n}", "public function delete($id)\n {\n if (!$result = $this->db->query(\"DELETE from `work_experience` WHERE `id` = '$id'\")) {\n throw new \\mysqli_sql_exception(\"Oops! Something has gone wrong on our end. Error Code: workExpDelete\");\n }\n }", "public function deletequaliteAction()\r\n {\r\n if ($this->getRequest()->isPost()) {\r\n $params = $this->getRequest()->getParams();\r\n $qualiteId = $params['qualiteId'];\r\n\r\n\r\n $qualite = new Application_Model_DbTable_FicheQualite();\r\n // delete the qualite\r\n $qualite->deleteQualite($qualiteId);\r\n\r\n // Return to the page informations\r\n $this->_helper->redirector('gestionqualite', 'admin', null);\r\n\r\n }\r\n\r\n }", "public function actionDelete($id)\n\t{\n\t\t$this->loadModel($id)->delete();\n // 需要同时删除此学员所有的成绩\n $model_score = Studentscore::model()->deleteAllByAttributes(array('record_id'=>$id));\n\n\t\t// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser\n\t\tif(!isset($_GET['ajax']))\n\t\t\t$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));\n\t}", "public function destroy($id)\n\t{\n\t\tGrade::destroy($id);\n\n\t\t//return Redirect::route('grades.index');\n\t\treturn array('info' => 'Grade deleted successfully.');\n\t}", "public function delete($id){\n\t\t$sql = 'DELETE FROM tbl_coverage WHERE id = ?';\n\t\t$sqlQuery = new SqlQuery($sql);\n\t\t$sqlQuery->setNumber($id);\n\t\treturn $this->executeUpdate($sqlQuery);\n\t}", "public function destroy($id)\n {\n $this->gradeService->destroy($id);\n return redirect()->route('grades.index');\n }", "public function deleteIdAction() {\n\t\t$id = intval($this->getInput('id'));\n\t\t$game_id = intval($this->getInput('game_id'));\n\t\t$result = Client_Service_Besttj::deleteByBesttjId($game_id,$id);\n\t\tClient_Service_Besttj::updateBesttjDate(intval($id));\n\t\tif (!$result) $this->output(-1, '操作失败');\n\t\t$this->output(0, '操作成功');\n\t}", "public function destroy(Grade $grade)\n {\n \n //Si no funciona con grade find, probar con solo grade\n Grade::find($grade)->delete();\n return redirect()->route('grades.index')->with('success','Grade deleted');\n }", "private function insert_target_grade()\r\n {\r\n global $DB;\r\n $params = $this->get_params();\r\n $this->id = $DB->insert_record('block_bcgt_target_grades', $params);\r\n }", "public function delete() {\r\n global $db;\r\n \r\n $query = \"DELETE FROM `careergoal` WHERE CareerGoal_id = ?\";\r\n \r\n $statement = $db->prepare($query);\r\n \r\n if ($statement == FALSE) {\r\n display_db_error($db->error);\r\n }\r\n \r\n $statement->bind_param(\"i\", $this->id);\r\n \r\n $success = $statement->execute();\r\n \r\n if ($success) {\r\n $count = $db->affected_rows;\r\n $statement->close();\r\n return $count;\r\n } else {\r\n display_db_error($db->error);\r\n }\r\n }", "public function deleteAction() {\n\t\t$id = intval($this->getInput('id'));\n\t\t$info = Client_Service_Besttj::getBesttj($id);\n\t\tif ($info && $info['id'] == 0) $this->output(-1, '无法删除');\n\t\t$result = Client_Service_Besttj::deleteBesttj($id);\n\t\tif (!$result) $this->output(-1, '操作失败');\n\t\t$this->output(0, '操作成功');\n\t}", "function delete_vehicle_geofence_assignment($id) {\n $response = $this->db->delete('vehicle_geofence_assignment', array('id' => $id));\n if ($response) {\n return \"vehicle_geofence_assignment deleted successfully\";\n } else {\n return \"Error occuring while deleting vehicle_geofence_assignment\";\n }\n }", "function bookking_grade_item_delete($bookking) {\n global $CFG;\n require_once($CFG->libdir.'/gradelib.php');\n\n if (!isset($bookking->courseid)) {\n $bookking->courseid = $bookking->course;\n }\n\n return grade_update('mod/bookking', $bookking->courseid, 'mod', 'bookking', $bookking->id, 0, null, array('deleted' => 1));\n}", "public function delete($id_materi);", "public function delete($id) {\r\n $sql= \"delete from bestelling where id=? limit 1\";\r\n $args=func_get_args();\r\n parent::execPreppedStmt($sql,$args);\r\n }", "public function delete() {\r\n\r\n\t\t// Does the Genre object have an ID?\r\n\t\tif ( is_null( $this->id ) ) trigger_error ( \"Genre::delete(): Attempt to delete an Genre object that does not have its ID property set.\", E_USER_ERROR );\r\n\r\n\t\t// Delete the Article\r\n\t\t$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );\r\n\t\t$st = $conn->prepare ( \"DELETE FROM :table WHERE id = :id LIMIT 1\" );\r\n\t\t$st->bindValue( \":table\", DB_TBL_GENRE, PDO::PARAM_STR );\r\n\t\t$st->bindValue( \":id\", $this->id, PDO::PARAM_INT );\r\n\t\t$st->execute();\r\n\t\t$conn = null;\r\n\t}" ]
[ "0.7750345", "0.62856454", "0.62751067", "0.6247999", "0.62387985", "0.6219215", "0.6123618", "0.6043811", "0.6039449", "0.60063916", "0.59998786", "0.5998948", "0.59953314", "0.5958848", "0.59498954", "0.5947142", "0.5945185", "0.5928793", "0.5928475", "0.59033436", "0.58987033", "0.58846897", "0.58624744", "0.5848517", "0.5836931", "0.5827719", "0.58199656", "0.57759804", "0.5767369", "0.5764769" ]
0.78142464
0
Inserts the target grade into the database.
private function insert_target_grade() { global $DB; $params = $this->get_params(); $this->id = $DB->insert_record('block_bcgt_target_grades', $params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function save()\r\n {\r\n if($this->id != -1)\r\n {\r\n $this->update_target_grade();\r\n }\r\n else\r\n {\r\n $this->insert_target_grade();\r\n }\r\n }", "public function test_insert_grade_record() {\n global $DB, $USER;\n\n $user = $this->getDataGenerator()->create_user();\n $this->setAdminUser();\n\n $record = new stdClass();\n $record->itemid = 4;\n $record->newgradeitem = 25;\n $record->finalgrade = 62.00;\n $record->feedback = 'Some test feedback';\n\n $testobject = new phpunit_gradeimport_csv_load_data();\n $testobject->test_insert_grade_record($record, $user->id);\n\n $gradeimportvalues = $DB->get_records('grade_import_values');\n // Get the insert id.\n $key = key($gradeimportvalues);\n\n $testarray = array();\n $testarray[$key] = new stdClass();\n $testarray[$key]->id = $key;\n $testarray[$key]->itemid = $record->itemid;\n $testarray[$key]->newgradeitem = $record->newgradeitem;\n $testarray[$key]->userid = $user->id;\n $testarray[$key]->finalgrade = $record->finalgrade;\n $testarray[$key]->feedback = $record->feedback;\n $testarray[$key]->importcode = $testobject->get_importcode();\n $testarray[$key]->importer = $USER->id;\n $testarray[$key]->importonlyfeedback = 0;\n\n // Check that the record was inserted into the database.\n $this->assertEquals($gradeimportvalues, $testarray);\n }", "public function save_grade() {\r\n\r\n\t\t\t//new method\r\n\t\t\t$sql = \"UPDATE grades SET student_id = ?, course_id = ?, degree = ?, examine_at = ? WHERE id = ?;\";\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->student_id, $this->course_id, $this->degree, $this->examine_at, $this->id]);\r\n\t\t\t//old method\r\n\t\t\t/*$sql = \"UPDATE grades SET student_id = ? WHERE id = ?;\";\r\n\t\t\t$sql = \"UPDATE grades SET course_id = ? WHERE id = ?;\";\r\n\t\t\t$sql = \"UPDATE grades SET degree = ? WHERE id = ?;\";\r\n\t\t\t$sql = \"UPDATE grades SET examine_at = ? WHERE id = ?;\";\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->student_id, $this->id]);\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->course_id, $this->id]);\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->degree, $this->id]);\r\n\t\t\tDatabase::$db->prepare($sql)->execute([$this->examine_at, $this->id]);*/\r\n\t\t}", "public function run() {\n\t\t\t$grades = [\n\t\t\t\t[\n\t\t\t\t\t'user_id' => 13, 'teacher_id' => 4, 'lesson_id' => 4, 'grade' => 96, 'class_id'=>4\n\t\t\t\t],\n\t\t\t];\n\t\t\t\n\t\t\tGrade::insert($grades);\n\t\t}", "function addGrade(){\n $categoryId = Slim::getInstance()->request()->post('categoryId');\n $gradeName = Slim::getInstance()->request()->post('gradeName');\n $percentage = Slim::getInstance()->request()->post('percentage');\n try {\n $insertGrade = \"INSERT INTO grades(categoryId, gradeName, percentage) VALUE(:categoryId, :gradeName, :percentage)\";\n $db = getConnection();\n $stmt = $db->prepare($insertGrade);\n $stmt->bindParam(\"categoryId\", $categoryId);\n $stmt->bindParam(\"gradeName\", $gradeName);\n $stmt->bindParam(\"percentage\", $percentage);\n $stmt->execute();\n $db = null;\n\n } catch(PDOException $e) {\n echo '{\"error\":{\"text\":'. $e->getMessage() .'}}'; \n } \n}", "function insert() {\n // Retrieve scale and infer grademax from it\n if (!empty($this->scaleid)) {\n $this->load_scale();\n $this->scale->load_items();\n $this->grademax = count ($this->scale->scale_items);\n $this->grademin = 0;\n }\n\n $result = parent::insert();\n\n // Notify parent grade_item of need to update\n $this->load_grade_item();\n $result = $result && $this->grade_item->flag_for_update();\n\n // Update grade_grades_text if specified\n if ($result && !empty($this->feedback)) {\n $result = $this->annotate(NULL, NULL, $this->feedback, $this->feedbackformat);\n }\n\n return $result && $this->grade_item->flag_for_update();\n }", "function add_student($student_name, $student_grade, $letter_grade) {\n global $db;\n $query = 'INSERT INTO students\n (student_name, student_grade, letter_grade)\n VALUES\n (:student_name, :student_grade, :letter_grade)';\n $statement = $db->prepare($query);\n $statement->bindValue(':student_name', $student_name);\n $statement->bindValue(':student_grade', $student_grade);\n $statement->bindValue(':letter_grade', $letter_grade);\n $statement->execute();\n $statement->closeCursor();\n }", "function sb_assignment_insert ($node) {\n\n db_query(\"INSERT INTO {eto_assignments}\n (\" . $node->key_field . \", \" . $node->target_field . \")\n VALUES\n (%d, %d)\",\n\t $node->uid, $node->selected_uid);\n\n}", "function sqlInsertGrade($gradeName)\n\t{\n\t\t$sql = \"\n\t\tINSERT INTO tbl_grade(grade_name)\n\t\tSELECT * FROM (SELECT :grade_name) as temp\n\t\tWHERE NOT EXISTS (\n\t\t\tSELECT grade_name FROM tbl_grade\n\t\t\tWHERE grade_name = :grade_name\n\t\t) LIMIT 1 \";\n\n\t\treturn $sql;\n\t}", "function addGrade($grades) {\n\n $columns = implode(\", \", array_keys($grades));\n $escaped_values = array_map($this->db->prepare, array_values($grades));\n $values = implode(\", \", $escaped_values);\n $sql = \"INSERT INTO `grades`($columns) VALUES ($values)\";\n\n $this->executeQuery($sql);\n }", "public function addGrade()\n {\n $this->load->helper('url');\n\n $name = $this->input->post('name');\n $data = array(\n 'grade_name' => $name\n );\n return $this->db->insert('grade', $data);\n }", "public function process_flexpage_grade($data) {\n global $DB;\n\n $data = (object) $data;\n $data->pageid = $this->get_new_parentid('flexpage_page');\n\n $DB->insert_record('format_flexpage_grade', $data);\n }", "function addGrades($grades) {\n $columns = implode(\", \", array_keys($grades[0]));\n\n foreach ($grades as $row) {\n $voter_id = $row[\"voter_id\"];\n $user_id = $row[\"user_id\"];\n $competence_id = $row[\"competence_id\"];\n $grade = $row[\"grade\"];\n $valuesArr[] = \"('$voter_id', '$user_id', '$competence_id', '$grade')\";\n }\n\n $values = implode(\", \", $valuesArr);\n $sql = \"INSERT INTO `grades`($columns) VALUES $values\";\n\n $this->executeQuery($sql);\n }", "protected function insert()\n\t{\n\t\t$query = $this->connection->prepare\n\t\t(\"\n\t\t\tinsert into\n\t\t\t\tBooth (BoothNum)\n\t\t\t\tvalues (?)\n\t\t\");\n\n\t\t$query->execute(array_values($this->fields));\n\n\t}", "public function save($obj)\n {\n DB::table('job_grades')->insert($obj);\n }", "function addAssignmentToDatabase($name, $code, $teacher_id) {\n\t\t# Inserts user into database\n\t\t$result = mysql_query(\"INSERT INTO Assignments (Assignment_Code, Name, Teacher_ID) VALUES ( '$code', '$name', '$teacher_id' )\")\n\t\t\tor die(\"<p>Error inserting into the database: \" .\n\t\t\t\t\tmysql_error() . \"</p>\");\n\t}", "function languagelesson_save_grade($lessonid, $userid, $gradeval) {\n global $DB;\n\t// build the grade object\n\t$grade = new stdClass;\n\t$grade->lessonid = $lessonid;\n\t$grade->userid = $userid;\n\t$grade->grade = $gradeval;\n\n\t// And update the old grade record, if there is one; if not, insert the record.\n\tif ($oldgrade = $DB->get_record(\"languagelesson_grades\", array(\"lessonid\"=>$lessonid, \"userid\"=>$userid))) {\n\t\t// If the old grade was for a completed lesson attempt, update the completion time.\n\t\tif ($oldgrade->completed) { $grade->completed = time(); }\n\t\t$grade->id = $oldgrade->id;\n\t\tif (! $DB->update_record(\"languagelesson_grades\", $grade)) {\n\t\t\terror(\"Navigation: grade not updated\");\n\t\t}\n\t} else {\n\t\tif (! $DB->insert_record(\"languagelesson_grades\", $grade)) {\n\t\t\terror(\"Navigation: grade not inserted\");\n\t\t}\n\t}\n}", "public function test_import_new_grade_item() {\n global $DB;\n\n $this->setAdminUser();\n $this->csv_load($this->oktext);\n $columns = $this->columns;\n\n // The assignment is item 6.\n $key = 6;\n $testobject = new phpunit_gradeimport_csv_load_data();\n\n // Key for this assessment.\n $this->csvimport->init();\n $testarray = array();\n while ($line = $this->csvimport->next()) {\n $testarray[] = $testobject->test_import_new_grade_item($columns, $key, $line[$key]);\n }\n\n // Query the database and check how many results were inserted.\n $newgradeimportitems = $DB->get_records('grade_import_newitem');\n $this->assertEquals(count($testarray), count($newgradeimportitems));\n }", "public function insert_student($row)\n\t\t{\n\t\t\t$this->conn->insert($this->create_student($row));\n\t\t}", "function insert() {\n\t\t$sql = \"INSERT INTO cost_detail (cd_fr_id, cd_seq, cd_start_time, cd_end_time, cd_hour, cd_minute, cd_cost, cd_update, cd_user_update)\n\t\t\t\tVALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)\";\n\t\t$this->ffm->query($sql, array($this->cd_fr_id, $this->cd_seq, $this->cd_start_time, $this->cd_end_time, $this->cd_hour, $this->cd_minute, $this->cd_cost, $this->cd_update, $this->cd_user_update));\n\t\t$this->last_insert_id = $this->ffm->insert_id();\n\t}", "function insert() {\n\t\tglobal $_DB_DATAOBJECT; //Indicate to PHP that we want to use the already-defined global, as opposed to declaring a local var\n\t\t//Grab the database connection that has already been made by the parent's constructor:\n\t\t$__DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];\n\t\tif ($this->reg_type != null) {\n\t\t\t$this->badge_number = $__DB->nextId('badge_number'); //Fetch the next id in the sequence. To set the sequence to a specifc value, use phpMyAdmin to tweak the value in the badge_number_seq table\n\t\t}\n\t\treturn DB_DataObject::insert();\n\t}", "protected function insert()\n\t{\n\t\t$this->autofill();\n\n\t\tparent::insert();\n\n\t}", "public function insert() {\r\n\r\n\t\t// Does the Genre object already have an ID?\r\n\t\tif ( !is_null( $this->id ) ) trigger_error ( \"Genre::insert(): Attempt to insert an Genre object that already has its ID property set (to $this->id).\", E_USER_ERROR );\r\n\r\n\t\t// Insert the Genre\r\n\t\t$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );\r\n\t\t$sql = \"INSERT INTO :table ( id, name ) VALUES ( :id, :name )\";\r\n\t\t$st = $conn->prepare ( $sql );\r\n\t\t$st->bindValue( \":table\", DB_TBL_GENRE, PDO::PARAM_STR );\r\n\t\t$st->bindValue( \":id\", $this->id, PDO::PARAM_INT );\r\n\t\t$st->bindValue( \":name\", $this->name, PDO::PARAM_STR );\r\n\t\t$st->execute();\r\n\t\t$this->id = $conn->lastInsertId();\r\n\t\t$conn = null;\r\n\t}", "function insert() {\n\t \n\t \t$sql = \"INSERT INTO evs_database.evs_group (gru_id, gru_name, gru_head_dept,gru_company_id)\n\t \tVALUES(?, ?, ?,?)\";\n\t\t \n\t \t$this->db->query($sql, array($this->gru_id, $this->gru_name, $this->gru_head_dept ,$this->gru_company_id));\n\t }", "function add_grade($grade) {\n $this->grades[] = $grade;\n }", "private function insert_entry_qual()\n {\n global $DB;\n $params = $this->get_params();\n $this->id = $DB->insert_record('subject', $params);\n }", "public function insertGraceMarks($studentId,$classId,$subjectId,$graceMarks,$int,$ext,$tot){\n $query=\"INSERT INTO \".TEST_GRACE_MARKS_TABLE.\" (studentId,classId,subjectId,graceMarks,internalGraceMarks,externalGraceMarks,totalGraceMarks) \n VALUES($studentId,$classId,$subjectId,$graceMarks,$int,$ext,$tot)\";\n return SystemDatabaseManager::getInstance()->executeUpdateInTransaction($query);\n }", "public function insert()\n {\n if(empty($this->attributes)){\n return;\n }\n if ($this->isAutoInc) {\n $columlList = \" (\";\n $valuelList = \" (\";\n foreach ($this->attributes as $column => $value) {\n $columlList .= $column . \", \";\n $valuelList .= \":\".$column . \", \";\n }\n $columlList = str_last_replace(\", \", \")\", $columlList);\n $valuelList = str_last_replace(\", \", \")\", $valuelList);\n $sqlQuery = \"INSERT INTO \" . $this->table . $columlList . \" VALUES\" . $valuelList;\n\n Db::instance()->execute($sqlQuery,$this->attributes);\n #println($sqlQuery, \"blue\");\n }\n }", "function SaveGame($idPlayer, $IndividualScore)\n{\n $dbh = ConnectDB();\n $req = $dbh->query(\"INSERT INTO fishermenland.history (ScoreHistory, fkPlayerHistory) VALUES ('$IndividualScore','$idPlayer')\");\n}", "public function insert(){\n if($this->muscle_group == -1 || $this->name == \"\"){\n echo \"Error: exercise not set correctly. Please make sure the form has been filled out correctly and try again.\"; \n }else{\n $sql = \"INSERT INTO exercises (muscle_group_id, exercise_name) VALUES (\" . $this->muscle_group . \", '\" . $this->name .\"');\";\n\n if(mysqli_query($this->con, $sql)){\n echo $this->name . \" added to exercise options!\";\n }else{\n echo \"Error: \" . $sql . \"<br>\" . mysqli_error($this->con); \n }\n }\n mysqli_close($this->con);\n }" ]
[ "0.72508174", "0.6786291", "0.6740325", "0.6493337", "0.64287007", "0.6354729", "0.6333785", "0.6196301", "0.612433", "0.6093761", "0.60206985", "0.59183985", "0.5916492", "0.58917445", "0.58423537", "0.56940925", "0.56732213", "0.5664993", "0.5616756", "0.5606822", "0.5601065", "0.55846286", "0.55558044", "0.55539346", "0.55473053", "0.55438507", "0.5539737", "0.5529054", "0.55260634", "0.54834205" ]
0.8400825
0
Gets the params from the object passed in and puts them onto the target grade objectl.
private function extract_params($params) { if(isset($params->id)) { $this->id = $params->id; } $this->grade = $params->grade; $this->ucaspoints = $params->ucaspoints; $this->bcgttargetqualid = $params->bcgttargetqualid; $this->upperscore = $params->upperscore; $this->lowerscore = $params->lowerscore; $this->ranking = $params->ranking; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function get_params()\r\n {\r\n $params = new stdClass();\r\n $params->grade = $this->grade;\r\n $params->ucaspoints = $this->ucaspoints;\r\n $params->bcgttargetqualid = $this->bcgttargetqualid;\r\n $params->upperscore = $this->upperscore;\r\n $params->lowerscore = $this->lowerscore;\r\n $params->ranking = $this->ranking;\r\n return $params;\r\n }", "protected function populateParams()\n\t{\n\n\t\tparent::populateParams();\n\t\t//$acl = ZefaniabibleHelper::getAcl();\n\t\t$mdl_acl = new ZefaniabibleHelper;\n\t\t$acl = $mdl_acl->getAcl();\n\t\tif (!isset($this->_data))\n\t\t\treturn;\n\n\t\t// Convert the parameter fields into objects.\n\t\tforeach ($this->_data as &$item)\n\t\t{\n\n\t\t\tif ($acl->get('core.edit.state')\n\t\t\t\t|| (bool)$item->publish)\n\t\t\t\t$item->params->set('access-view', true);\n\n\t\t\tif ($acl->get('core.edit'))\n\t\t\t\t$item->params->set('access-edit', true);\n\n\t\t\tif ($acl->get('core.delete'))\n\t\t\t\t$item->params->set('access-delete', true);\n\n\n\t\t}\n\n\t}", "protected function populateParams()\n\t{\n\t\tparent::populateParams();\n\t\t$acl = ZefaniabibleHelper::getAcl();\n\t\tif (!isset($this->_data))\n\t\t\treturn;\n\t\t// Convert the parameter fields into objects.\n\t\tforeach ($this->_data as &$item)\n\t\t{\n\t\t\tif ($acl->get('core.edit.state')\n\t\t\t\t|| (bool)$item->publish)\n\t\t\t\t$item->params->set('access-view', true);\n\t\t\tif ($acl->get('core.edit'))\n\t\t\t\t$item->params->set('access-edit', true);\n\t\t\tif ($acl->get('core.delete'))\n\t\t\t\t$item->params->set('access-delete', true);\n\t\t}\n\t}", "public function getParamHistory($object)\n {\n $params = array();\n if (isset($object['upload_songs']))\n {\n $params['selling_total_upload_songs'] = $object['upload_songs'];\n }\n else\n {\n $params['selling_total_upload_songs'] = 0; \n }\n if (isset($object['download_songs']))\n {\n $params['selling_total_download_songs'] = $object['download_songs'];\n }\n else\n {\n $params['selling_total_download_songs'] = 0; \n }\n if (isset($object['sold_songs']))\n {\n $params['selling_sold_songs'] = $object['sold_songs'];\n }\n else\n {\n $params['selling_sold_songs'] = 0; \n }\n if (isset($object['sold_albums']))\n {\n $params['selling_sold_albums'] = $object['sold_albums'];\n }\n else\n {\n $params['selling_sold_albums'] = 0; \n }\n if (isset($object['new_accounts']))\n {\n $params['selling_final_new_account'] = $object['new_accounts'];\n }\n else\n {\n $params['selling_final_new_account'] = 0; \n }\n if (isset($object['transaction_succ']))\n {\n $params['selling_transaction_succ'] = $object['transaction_succ'];\n }\n else\n {\n $params['selling_transaction_succ'] = 0; \n }\n if (isset($object['transaction_fail']))\n {\n $params['selling_transaction_fail'] = $object['transaction_fail'];\n }\n else\n {\n $params['selling_transaction_fail'] = 0; \n }\n if (isset($object['total_amount']))\n {\n $params['selling_total_amount'] = $object['total_amount'];\n }\n else\n {\n $params['selling_total_amount'] = 0; \n }\n if (isset($object['params']))\n {\n $params['params'] = serialize($object['params']);\n }\n else\n {\n $params['params'] = ''; \n }\n return $params;\n \n \n }", "public function loadPostData(){\n \n // ID - if we're editing existing one\n if (isset($_POST['grading_id'])){\n $this->setID($_POST['grading_id']);\n }\n \n $this->setName($_POST['grading_name']);\n $this->setEnabled( (isset($_POST['grading_enabled']) && $_POST['grading_enabled'] == 1 ) ? 1 : 0);\n $this->setIsUsedForAssessments( (isset($_POST['grading_assessments']) && $_POST['grading_assessments'] == 1 ) ? 1 : 0);\n \n // If Build ID use that, otherwise use QualStructureID\n $buildID = optional_param('build', false, PARAM_INT);\n if ($buildID){\n $this->setQualBuildID($buildID);\n $this->setIsUsedForAssessments(1);\n } else {\n $this->setQualStructureID( $_POST['grading_qual_structure_id'] );\n }\n \n $gradeIDs = (isset($_POST['grade_ids'])) ? $_POST['grade_ids'] : false;\n if ($gradeIDs)\n {\n \n foreach($gradeIDs as $key => $id)\n {\n \n $award = new \\GT\\CriteriaAward($id);\n $award->setName($_POST['grade_names'][$key]);\n $award->setShortName($_POST['grade_shortnames'][$key]);\n $award->setSpecialVal($_POST['grade_specialvals'][$key]);\n $award->setPoints($_POST['grade_points'][$key]);\n $award->setPointsLower($_POST['grade_points_lower'][$key]);\n $award->setPointsUpper($_POST['grade_points_upper'][$key]);\n $award->setMet( (isset($_POST['grade_met'][$key])) ? 1 : 0 );\n $award->setImageFile( \\gt_get_multidimensional_file($_FILES['grade_files'], $key) );\n \n // If we have a tmp icon set load that back in\n if ( isset($_POST['grade_icon_names'][$key]) && strpos($_POST['grade_icon_names'][$key], \"tmp//\") === 0 ){\n $award->iconTmp = str_replace(\"tmp//\", \"\", $_POST['grade_icon_names'][$key]);\n }\n \n // If are editing something which already has a valid image saved\n elseif (isset($_POST['grade_icon_names'][$key]) && strlen($_POST['grade_icon_names'][$key]) > 0)\n {\n $award->setImage($_POST['grade_icon_names'][$key]);\n }\n \n $this->addAward($award);\n \n }\n \n }\n \n \n }", "function getParams($passAry,$base){\r\n\t\t$getName=$passAry['param_1'];\r\n\t\t$workAry=$base->utlObj->retrieveValue($getName,&$base);\r\n\t\tif ($workAry != null){\r\n\t\t\tforeach ($workAry as $paramName=>$paramValue){\r\n\t\t\t\t$base->paramsAry[$paramName]=$paramValue;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private function extract_params($params)\n { \n $this->subject = $params->subject;\n }", "public function get_params()\n {\n }", "public function get_params()\n {\n }", "protected function getObjectParams($obj){\n\t\treturn array();\n\t}", "function getParams()\n {\n global $id;\n global $mode;\n global $data_source;\n global $view_mode;\n global $edit_mode;\n global $tab;\n if (isset($id)) {\n $this->id = $id;\n }\n if (isset($mode)) {\n $this->mode = $mode;\n }\n if (isset($data_source)) {\n $this->data_source = $data_source;\n }\n if (isset($view_mode)) {\n $this->view_mode = $view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode = $edit_mode;\n }\n if (isset($tab)) {\n $this->tab = $tab;\n }\n }", "function getParams()\n {\n }", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function getParams() {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $data_source;\n global $tab;\n if (isset($id)) {\n $this->id=$id;\n }\n if (isset($mode)) {\n $this->mode=$mode;\n }\n if (isset($view_mode)) {\n $this->view_mode=$view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode=$edit_mode;\n }\n if (isset($data_source)) {\n $this->data_source=$data_source;\n }\n if (isset($tab)) {\n $this->tab=$tab;\n }\n}", "function getParams()\n {\n global $id;\n global $mode;\n global $view_mode;\n global $edit_mode;\n global $tab;\n if (isset($id)) {\n $this->id = $id;\n }\n if (isset($mode)) {\n $this->mode = $mode;\n }\n if (isset($view_mode)) {\n $this->view_mode = $view_mode;\n }\n if (isset($edit_mode)) {\n $this->edit_mode = $edit_mode;\n }\n if (isset($tab)) {\n $this->tab = $tab;\n }\n }", "public function input (\\stdClass $param);", "function getParams() {\r\n global $id;\r\n global $mode;\r\n global $view_mode;\r\n global $edit_mode;\r\n global $data_source;\r\n global $tab;\r\n if (isset($id)) {\r\n $this->id=$id;\r\n }\r\n if (isset($mode)) {\r\n $this->mode=$mode;\r\n }\r\n if (isset($view_mode)) {\r\n $this->view_mode=$view_mode;\r\n }\r\n if (isset($edit_mode)) {\r\n $this->edit_mode=$edit_mode;\r\n }\r\n if (isset($data_source)) {\r\n $this->data_source=$data_source;\r\n }\r\n if (isset($tab)) {\r\n $this->tab=$tab;\r\n }\r\n}", "private function load_target_grade($id)\r\n {\r\n global $DB;\r\n $sql = \"SELECT * FROM {block_bcgt_target_grades} WHERE id = ?\";\r\n $record = $DB->get_record_sql($sql, array($id));\r\n if($record)\r\n {\r\n $this->extract_params($record);\r\n }\r\n }", "function getParams()\n {\n }", "public function assign_source_object_details()\n\t{\n\t\tusers_overlord::load_users(array($this->post->post_user_id, $this->post->post_edit_user, $this->post->post_delete_user));\n\t\tusers_overlord::assign_details($this->post->post_user_id, 'POSTER_', true);\n\t\t$this->load_contrib_object();\n\n\t\t$action_param = array('hash' => generate_link_hash('attention_action'));\n\n\t\tphpbb::$template->assign_vars(array(\n\t\t\t'OBJECT_TYPE'\t\t=> $this->get_lang_string('object'),\n\t\t\t'PARENT'\t\t\t=> $this->contrib->contrib_name,\n\t\t\t'U_PARENT'\t\t\t=> $this->contrib->get_url(),\n\n\t\t\t'POST_SUBJECT'\t\t=> censor_text($this->post->post_subject),\n\t\t\t'POST_DATE'\t\t\t=> phpbb::$user->format_date($this->post->post_time),\n\t\t\t'POST_TEXT'\t\t\t=> $this->post->generate_text_for_display(),\n\t\t\t'EDITED_MESSAGE'\t=> ($this->post->post_edited) ? sprintf(phpbb::$user->lang['EDITED_MESSAGE'], users_overlord::get_user($this->post->post_edit_user, '_full'), phpbb::$user->format_date($this->post->post_edited)) : '',\n\t\t\t'DELETED_MESSAGE'\t=> ($this->post->post_deleted != 0) ? sprintf(phpbb::$user->lang['DELETED_MESSAGE'], users_overlord::get_user($this->post->post_delete_user, '_full'), phpbb::$user->format_date($this->post->post_deleted), $this->post->get_url('undelete')) : '',\n\t\t\t'POST_EDIT_REASON'\t=> censor_text($this->post->post_edit_reason),\n\n\t\t\t'U_APPROVE'\t\t\t=> (!$this->post->post_approved) ? $this->get_report_url('approve', $action_param) : false,\n\t\t\t'U_DISAPPROVE'\t\t=> (!$this->post->post_approved) ? $this->get_report_url('disapprove', $action_param) : false,\n\t\t\t'U_VIEW'\t\t\t=> $this->post->get_url(),\n\t\t\t'U_EDIT'\t\t\t=> $this->post->get_url('edit'),\n\n\t\t\t'SECTION_NAME'\t\t=> '<a href=\"' . $this->post->get_url() . '\">' . censor_text($this->post->post_subject) . '</a> - ' . phpbb::$user->lang['ATTENTION'],\n\t\t\t'S_UNAPPROVED'\t\t=> !$this->post->post_approved,\n\t\t));\n\t}", "private function get_params()\n { \n $params = new stdClass();\n $params->subject = $this->subject;\n return $params;\n }", "public function getParams();", "public function getParams();", "public function getParams();", "public function getParams();", "public function getParams();", "public function getParams();", "public function getParams();" ]
[ "0.59932023", "0.57584214", "0.55334836", "0.5452479", "0.5435454", "0.5434264", "0.5417483", "0.53067166", "0.53067166", "0.53007376", "0.524095", "0.521113", "0.51391417", "0.51391417", "0.51391417", "0.51391417", "0.5138652", "0.5137212", "0.5130605", "0.510307", "0.50742483", "0.50705695", "0.50668406", "0.50402117", "0.50402117", "0.50402117", "0.50402117", "0.50402117", "0.50402117", "0.50402117" ]
0.65404516
0
Update the sitename placeholder in .ddev/config.yaml with the directory name
protected static function updateDDevName(): void { $base = self::getBasepath(); $directories = explode('/', $base); $directoryName = array_pop($directories); $ddevConfigPath = $base . '/.ddev/config.yaml'; if (file_exists($ddevConfigPath)) { $ddevConfig = file_get_contents($ddevConfigPath); $ddevConfig = str_replace('{sitename}', $directoryName, $ddevConfig); file_put_contents($ddevConfigPath, $ddevConfig); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateConfigApp() : void\n {\n $this->domainName = Str::title(Str::lower(Str::studly($this->domainName)));\n $configAppFilePath = config_path(\"app.php\");\n $oldValue = \"/*NewDomainsServiceProvider*/\";\n $newValue = \"App\\\\\".config(\"domain.path\").\"\\\\{$this->domainName}\\Providers\\DomainServiceProvider::Class,\";\n $newValue .= \"\\n\\t\\t/*NewDomainsServiceProvider*/\";\n $newContent = Str::replaceFirst($oldValue, $newValue, File::get($configAppFilePath));\n File::put($configAppFilePath, $newContent);\n $this->info(\"App Config File Updated and Added the new Service Provider of Domain\");\n }", "public function replace_admin_dir($name, $placeholder = false)\n\t{\n\t\tglobal $mybb;\n\n\t\t$name = str_replace(\"MYBB_ADMIN_DIR\", \"admin\", $name);\n\n\t\tif($mybb->config['admin_dir'] == \"admin\")\n\t\t{\n\t\t\treturn $name;\n\t\t}\n\n\t\tif($placeholder)\n\t\t{\n\t\t\t$replace = \"MYBB_ADMIN_DIR\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$replace = $mybb->config['admin_dir'];\n\t\t}\n\n\t\t$remove_mybb_root = false;\n\t\tif(strpos($name, MYBB_ROOT) !== false)\n\t\t{\n\t\t\t$name = str_replace(MYBB_ROOT, \"\", $name);\n\t\t\t$remove_mybb_root = true;\n\t\t}\n\n\t\t$in_admin_dir = false;\n\t\tif(strpos($name, \"/\") === false)\n\t\t{\n\t\t\tif($name == \"admin\")\n\t\t\t{\n\t\t\t\t$in_admin_dir = true;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(substr($name, 0, strpos($name, \"/\")) == \"admin\")\n\t\t\t{\n\t\t\t\t$in_admin_dir = true;\n\t\t\t}\n\t\t}\n\n\t\tif($in_admin_dir)\n\t\t{\n\t\t\t$name = preg_replace(\"#admin#\", $replace, $name, 1);\n\t\t}\n\n\t\tif($remove_mybb_root)\n\t\t{\n\t\t\t$name = MYBB_ROOT . $name;\n\t\t}\n\n\t\treturn $name;\n\t}", "function setD3forumDirname( $d3forum_dirname = '' )\n{\n\tif( ! empty($this->mod_config['comment_dirname'] ) ) {\n \t\t$this->d3forum_dirname = $this->mod_config['comment_dirname'] ;\n\t} elseif( ! empty( $params['comment_dirname'] ) ) {\n\t\t$this->d3forum_dirname = $params['comment_dirname'] ;\n\t} else {\n\t\t$this->d3forum_dirname = 'd3forum' ;\n\t}\n}", "public function setDirname($dirname);", "public function setDirectoryName($dir)\n {\n // Define a hard theme path for the theme\n $this->path = PUBLIC_THEME_DIR . '/' . $dir;\n $this->directory = $dir;\n }", "function stage_config($key = null, $default = null)\n{\n // Requested config file\n $config = explode('.', $key)[0];\n $file = get_template_directory() . '/config' . '/' . $config . '.php';\n\n if (file_exists($file)) {\n // Get Stage defaults config\n $stage['config'] = include $file;\n\n // Set as new config \"Stage\"\n \\Roots\\config(array( \"stage.{$config}\" => $stage['config'] ));\n\n // Return the config\n return \\Roots\\config(\"stage.{$key}\", $default);\n }\n\n return \\Roots\\config($key, $default);\n}", "protected function getEditableConfigNames() {\n return ['d8_demo.weather_config'];\n }", "private function initialiseConfig()\n {\n $this->mergeConfigFrom(__DIR__ . '/..' . Settings::LARAVEL_REAL_CONFIG, Settings::LARAVEL_CONFIG_NAME);\n }", "public function configDir(): string\n {\n return $this->root.'/etc';\n }", "public function set_domain_name( $app_id, $new_domain ) {\n\t\treturn update_post_meta( $app_id, 'wpapp_domain', $new_domain );\n\t}", "protected function setSiteName() {\r\n\t\t$this->siteName = trim($this->settings['site']['siteName']);\r\n\t}", "public function name(): string {\n return 'config';\n }", "public function getDirname();", "public function writeConfig() {\n $mergedTemplate = $this->mergeTemplate();\n file_put_contents(\"{$this->settings['paths']['hostConfigDir']}/{$this->params['name']}.cfg\", $mergedTemplate);\n file_put_contents(\"{$this->settings['paths']['hostTrackDir']}/{$this->params['type']}.inf\", \"{$this->params['name']}:{$this->params['instanceId']}\" . PHP_EOL, FILE_APPEND);\n $this->logChange();\n }", "public function postMultisiteInit($result, CommandData $commandData) {\n $uri = $commandData->input()->getOption('site-uri');\n $machineName = $this->generateMachineName($uri);\n $dev = \"{$machineName}.dev.drupal.uiowa.edu\";\n $test = \"{$machineName}.stage.drupal.uiowa.edu\";\n $root = $this->getConfigValue('repo.root');\n\n // Re-generate the Drush alias so it is more useful.\n unlink(\"{$root}/drush/sites/{$uri}.site.yml\");\n $default = Yaml::parse(file_get_contents(\"{$root}/drush/sites/uiowa.site.yml\"));\n $default['prod']['uri'] = $uri;\n $default['test']['uri'] = $test;\n $default['dev']['uri'] = $dev;\n file_put_contents(\"{$root}/drush/sites/{$machineName}.site.yml\", Yaml::dump($default, 10, 2));\n $this->say(\"Deleted <comment>{$uri}.site.yml</comment> BLT Drush alias file.\");\n $this->say(\"Created <comment>{$machineName}.site.yml</comment> Drush alias file.\");\n\n // Overwrite the multisite blt.yml file.\n $blt = Yaml::parse(file_get_contents(\"{$root}/docroot/sites/{$uri}/blt.yml\"));\n $blt['project']['machine_name'] = $machineName;\n $blt['drush']['aliases']['remote'] = \"{$machineName}.dev\";\n $blt['drupal']['db']['database'] = $machineName;\n file_put_contents(\"{$root}/docroot/sites/{$uri}/blt.yml\", Yaml::dump($blt, 10, 2));\n $this->say(\"Overwrote <comment>{$root}/docroot/sites/{$uri}/blt.yml</comment> file.\");\n\n // Write sites.php data.\n $data = <<<EOD\n\n// Directory aliases for {$uri}.\n\\$sites['{$machineName}.uiowa.lndo.site'] = '{$uri}';\n\\$sites['{$dev}'] = '{$uri}';\n\\$sites['{$test}'] = '{$uri}';\n\\$sites['{$machineName}.prod.drupal.uiowa.edu'] = '{$uri}';\n\nEOD;\n\n file_put_contents($root . '/docroot/sites/sites.php', $data, FILE_APPEND);\n $this->say('Added <comment>sites.php</comment> entries. Adjust as needed and commit.');\n }", "public function setD3forumDirname( $d3forum_dirname = '' ) {\n\t\tif ( $d3forum_dirname ) {\n\t\t\t$this->d3forum_dirname = $d3forum_dirname;\n\t\t} elseif ( ! empty( $this->mod_config['comment_dirname'] ) ) {\n\t\t\t$this->d3forum_dirname = $this->mod_config['comment_dirname'];\n\t\t} else {\n\t\t\t$this->d3forum_dirname = 'd3forum';\n\t\t}\n\t}", "public function baseDir() {\n return 'uploads/placeholders';\n }", "function wpsight_option_name() {\n\t$wpsight_options_settings = get_option( WPSIGHT_DOMAIN );\n\t$wpsight_options_settings['id'] = WPSIGHT_DOMAIN;\n\tupdate_option( WPSIGHT_DOMAIN, $wpsight_options_settings );\n}", "public function getConfigFilename()\n {\n return 'config.yml';\n }", "protected function lowlevelConfigFix($name)\n {\n $distname = realpath(__DIR__ . '/../../app/config/' . $name . '.yml.dist');\n $ymlname = $this->config->getPath('config') . '/' . $name . '.yml';\n\n if (file_exists($ymlname) && !is_readable($ymlname)) {\n $error = sprintf(\n \"Couldn't read <code>%s</code>-file inside <code>%s</code>. Make sure the file exists and is readable to the user that the web server is using.\",\n htmlspecialchars($name . '.yml', ENT_QUOTES),\n htmlspecialchars($this->config->getPath('config'), ENT_QUOTES)\n );\n throw new BootException($error);\n }\n\n if (!file_exists($ymlname)) {\n // Try and copy from the .dist config file\n try {\n copy($distname, $ymlname);\n } catch (\\Exception $e) {\n $message = sprintf(\n \"Couldn't create a new <code>%s</code>-file inside <code>%s</code>. Create the file manually by copying\n <code>%s</code>, and optionally make it writable to the user that the web server is using.\",\n htmlspecialchars($name . '.yml', ENT_QUOTES),\n htmlspecialchars($this->config->getPath('config'), ENT_QUOTES),\n htmlspecialchars($name . '.yml.dist', ENT_QUOTES)\n );\n\n throw new BootException($message);\n }\n }\n }", "public function directory(): string\n {\n return Configuration::dataDir() . 'configs/etags';\n }", "public function testEnvSolr(string $site_name) {\n $site_folder = $this->getSiteFolder($site_name);\n $pantheon_yml_contents = Yaml::parseFile($site_folder . '/pantheon.yml');\n $pantheon_yml_contents['search'] = ['version' => 8];\n $pantheon_yml_contents = Yaml::dump($pantheon_yml_contents);\n file_put_contents($site_folder . '/pantheon.yml', $pantheon_yml_contents);\n $this->output->writeln($pantheon_yml_contents);\n }", "protected function getSitePath() {\n return getenv('DRUPAL_DEV_SITE_PATH') ?: 'sites/default';\n }", "private function writeConfigFile()\n {\n if (!$this->configFile) {\n $confDir = $this->scratchSpace . DIRECTORY_SEPARATOR . 'config';\n mkdir($confDir);\n $this->configFile = $confDir . DIRECTORY_SEPARATOR . 'config.yml';\n }\n file_put_contents($this->configFile, $this->configYaml);\n $this->container->setParameter('config.filename', $this->configFile);\n }", "function site_name()\n {\n return config_item('site_name');\n }", "function greyhead_configuration_get_path_to_sites_directory($subpath = 'sites/') {\n return GREYHEAD_DRUPAL_ROOT . '/' . $subpath;\n }", "public function setDirName(string $dirName): void\n {\n $this->dirName = $dirName;\n }", "public function addConfigDirectory(string $directory): void;", "private function updateStubsPathsInConfigFile()\n {\n $updated = str_replace('vendor/bpocallaghan/generators/', '',\n File::get($this->getConfigPath()));\n File::put($this->getConfigPath(), $updated);\n }", "public function updateConfig()\n {\n $this->aframe_assets_url = $this->composer->getConfig()->get('aframe-url') ?? '/aframe';\n \n $composer_json = $this->getVendorDir() . DIRECTORY_SEPARATOR . 'mkungla' . DIRECTORY_SEPARATOR . 'aframe-php' . DIRECTORY_SEPARATOR . 'composer.json';\n \n if (file_exists($composer_json)) {\n $config = json_decode(file_get_contents($composer_json));\n $config->config->{'aframe-dir'} = $this->getPublicRoot();\n $config->config->{'aframe-url'} = $this->aframe_assets_url;\n $config->version = self::AFRAME_PHP_VERSION;\n file_put_contents($composer_json, json_encode($config, JSON_PRETTY_PRINT));\n }\n }" ]
[ "0.56040007", "0.53270847", "0.5232809", "0.5228946", "0.5197544", "0.50947136", "0.506499", "0.50548595", "0.5019438", "0.49987584", "0.49904034", "0.49785993", "0.4973142", "0.4967103", "0.49667454", "0.4963577", "0.49460825", "0.49360842", "0.4933854", "0.4931945", "0.49286574", "0.49153644", "0.49142602", "0.491311", "0.4893029", "0.48852062", "0.4860376", "0.48405248", "0.48376876", "0.483621" ]
0.80105674
0
Copies the .env.example to .env if it doesn't exist
protected static function copyEnv(): void { $base = self::getBasepath(); $envPath = $base . '/.env'; $examplePath = $base . '/.env.example'; if (file_exists($examplePath) && !file_exists($envPath)) { copy($examplePath, $envPath); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function createEnvFile()\n {\n if (! file_exists('.env')) {\n copy('.env.example', '.env');\n $this->line('.env file successfully created');\n }\n }", "public static function copyEnv()\n {\n // Get VCAP_APPLICATION\n $vcapsApplication = json_decode(getenv('VCAP_APPLICATION'), true);\n // Copy env of the appropriate space\n if (isset($vcapsApplication['space_name'])) {\n copy(\n '.env.' . strtolower($vcapsApplication['space_name']),\n '.env'\n );\n }\n }", "function merge_env($file, &$config) {\n\t$file = \"env_\" . basename($file);\n\n\t$file = APPPATH.\"config/\".ENVIRONMENT.\"/\" . $file;\n\n\tif (file_exists($file)) {\n\t\trequire ($file);\n\t}\n}", "function init_env() {\n $envs_filename = base_path().DIRECTORY_SEPARATOR.'.env';\n $envs = $envs_array = [];\n \n if ($ressources = fopen($envs_filename, 'r')) {\n while (!feof($ressources)) {\n $element = fgets($ressources);\n\n if (!empty(trim($element))) {\n $element_array = explode('=', $element);\n $envs_array[$element_array[0]] = $element_array[1];\n }\n\n $envs[] = $element;\n }\n\n fclose($ressources);\n }\n\n $_ENV = array_merge($envs_array, $_ENV);\n }", "protected function backupEnvironment()\n {\n $fileNamesInBasePath = scandir(base_path());\n foreach ($fileNamesInBasePath as $fileNameToCheck) {\n if (stripos($fileNameToCheck, '.env') === 0) {\n\n // We have a .env file that might be loaded by laravel,\n // back it up if it's not the dusk file\n if ($fileNameToCheck != $this->duskFile()) {\n $backupFileName = \".dawn.backup{$fileNameToCheck}\";\n // dusk.backup.{name} means we can test for files starting with .env,\n // and then to restore we look for files starting with .dawn.backup\n // using dusk. also helps clarify where the file is coming from\n copy(base_path($fileNameToCheck), base_path($backupFileName));\n }\n }\n }\n\n copy(base_path($this->duskFile()), base_path('.env')); // We should only have $this->duskFile() and .env\n }", "private function loadEnvironment () : void {\n $env = new Dotenv(__DIR__);\n if (file_exists(__DIR__ . '/.env')) {\n $env->load();\n }\n $env->required('SERVERS_LOG_FILE');\n }", "public function __construct()\n {\n $this->envPath = base_path('.env');\n $this->envExamplePath = base_path('.env.example');\n }", "function environment_path($path = '')\n {\n if(strlen($path) > 0) {\n if(strpos($path, '.env') == false) {\n $path = trim($path) . '.env';\n }\n }\n\n return phanda()->environmentPath() . ($path ? DIRECTORY_SEPARATOR . $path : $path);\n }", "protected function checkForSpecificEnvironmentFile()\n {\n if ($this->isRunningInConsole() && isset($_SERVER['argv'])) {\n $input = new ArgvInput();\n\n if ($input->hasParameterOption('--env')) {\n $file = $this->getEnvironmentFile() . '.' . $input->getParameterOption('--env');\n\n $this->loadEnvironmentFile($file);\n }\n }\n\n if (!$this->get('APP_ENV')) {\n return;\n }\n\n if (empty($file)) {\n $file = $this->getEnvironmentFile() . '.' . $this->get('APP_ENV');\n $this->loadEnvironmentFile($file);\n }\n }", "function env($key, $default = '')\n {\n static $variables;\n\n //TODO: Changes flag in env to reload its value.\n\n if ($variables === null) {\n $variables = Dotenv::createImmutable(base_directory());\n $variables->safeLoad();\n }\n\n return (!empty(getenv($key)) && getenv($key) != '') ? getenv($key) : $default;\n }", "protected function setDotEnv()\n {\n try\n {\n (new Dotenv(path('root'),'.env'))->load();\n }\n catch (InvalidPathException $e)\n {\n\n }\n }", "protected function environmentFilePath(): string\n {\n return base_path('.env');\n }", "protected static function loadEnv()\n\t{\n\t\tif (! getenv('APP_ENV')) {\n\t\t\t// Load Dotenv if in a dev environment (no environment vars loaded)\n\t\t\t(new Dotenv(__DIR__ . '/../'))->load();\n\t\t}\n\t}", "function getenv_docker($env, $default) {\n if ($fileEnv = getenv($env . '_FILE')) {\n return rtrim(file_get_contents($fileEnv), \"\\r\\n\");\n }\n else if (($val = getenv($env)) !== false) {\n return $val;\n }\n else {\n return $default;\n }\n}", "public function setDotenv(): void {\n\t\t//TODO this always return uncaught\n\t\ttry {\n\t\t\t$this->dotenv = Dotenv\\Dotenv::create( dirname( __DIR__ ) );\n\t\t} catch ( Dotenv\\Exception\\InvalidPathException | Dotenv\\Exception\\InvalidFileException | Dotenv\\Exception\\ValidationException $e ) {\n\t\t\techo $e->getMessage();\n\t\t}\n\t}", "protected function applyEnvironmentContext(): void\n {\n if (! $context = ($_SERVER['APP_ENV'] ?? null)) {\n return;\n }\n\n $this->setEnvironmentFile(\n $this->environment, $context\n );\n }", "public static function setup()\n {\n try {\n $env = \\Dotenv\\Dotenv::create(__DIR__ . '/../../private/');\n $env->load();\n $env->required([\n 'ENVIRONMENT',\n ]);\n } catch (\\Exception $e) {\n echo $e;\n }\n }", "public function checkCurrentEnv() {\n $currentEnv = $this->getCurrentEnv();\n if (!in_array($currentEnv, $this->defaultEnvs)) {\n $this->log( 'ENV must be set to a value within ('.implode(', ', $this->defaultEnvs).')'.\"\\n\" ,'ERROR');\n }\n }", "protected function loadEnvironmentVariables()\n {\n try {\n $dotenv = new \\Dotenv\\Dotenv(base_path());\n $dotenv->load();\n } catch (\\Exception $exception) {\n if ($exception instanceof InvalidPathException) {\n die('No .env file found');\n }\n }\n }", "function setEnvironment($value){ $_ENV['CURRENT_ENVIRONMENT'] = $value; }", "protected function loadEnvironmentVariables()\n {\n (new Dotenv())->load($this->basePath.'/.env');\n }", "function env($key = null)\n{\n if (!isset($GLOBALS['configs']))\n $GLOBALS['configs'] = json_decode(file_get_contents($GLOBALS['config_path'] . DIRECTORY_SEPARATOR . 'env.json'));\n\n if (!is_null($key) && isset($GLOBALS['configs']->$key))\n return $GLOBALS['configs']->$key;\n elseif (is_null($key) && isset($GLOBALS['configs']))\n return $GLOBALS['configs'];\n else\n Throw new \\Atom\\Environment\\EnvironmentException(\"Environment variable \" . $key . \" not found.\");\n}", "private function _modEnvironment($VAR) {\n $keys = array_keys($VAR);\n $sKeys = array_keys($_SESSION['_ENV']);\n for($sCount = 0; $sCount < count($sKeys); $sCount++) {\n for($count = 0; $count < count($keys); $count++) {#\n if($sKeys[$sCount] == $keys[$count]) {\n $_SESSION['_ENV'][$sKeys[$sCount]] = $VAR[$keys[$count]];\n }\n }\n }\n $target = _BASEDIR_.DS.\"environment.ini.\" . date('Ymd');\n if(file_exists(_BASEDIR_.DS.\"environment.ini.\" . date('Ymd'))) {\n $fileCount=1;\n while(file_exists(_BASEDIR_.DS.\"environment.ini.\" . date('Ymd') . \"_\" . $fileCount)) {\n $fileCount++;\n }\n $target .= \"_\".$fileCount;\n }\n rename(_BASEDIR_.DS.\"environment.ini\", $target);\n $fp = fopen(_BASEDIR_.DS.\"environment.ini\", \"w+\");\n if($fp != null) {\n $keys = array_keys($_SESSION['_ENV']);\n for($count = 0; $count < count($keys); $count++) {\n if(strlen(trim($keys[$count])) > 0) {\n fwrite($fp, $keys[$count].\"=\".$_SESSION['_ENV'][$keys[$count]].\"\\n\");\n }\n }\n fclose($fp);\n }\n }", "public function overload()\n {\n $this->checkForSpecificEnvironmentFile();\n $dotEnv = Dotenv::createImmutable($this->getEnvironmentPath(),$this->getEnvironmentFile());\n //$dotEnv = new Dotenv($this->getEnvironmentPath(), $this->getEnvironmentFile());\n $dotEnv->load();\n\n $this->validateEnvironmentFile($dotEnv);\n }", "public function load()\n {\n $this->checkForSpecificEnvironmentFile();\n $dotEnv = Dotenv::createImmutable($this->getEnvironmentPath(),$this->getEnvironmentFile());\n //$dotEnv = new Dotenv($this->getEnvironmentPath(), $this->getEnvironmentFile());\n\n $dotEnv->load();\n\n $this->validateEnvironmentFile($dotEnv);\n }", "private function initEnvironment() {\n\t\t$env = getenv('APP_ENV');\n\n\t\t$this->_env = ($env !== FALSE) ? $env : 'development';\n\t}", "function env($key, $default = null)\n {\n if(isset($_ENV[$key]))\n return $_ENV[$key];\n\n return $default;\n }", "public static function setEnv($key, $value)\n {\n $file_path = base_path('.env');\n $data = file($file_path);\n $data = array_map(function($data) use ($key, $value) {\n if (stristr($value, \" \")) {\n return stristr($data, $key) ? \"$key='$value'\\n\" : $data;\n } else {\n return stristr($data, $key) ? \"$key=$value\\n\" : $data;\n }\n }, $data);\n\n // Write file\n $env_file = fopen($file_path, 'w') or die('Unable to open file!');\n fwrite($env_file, implode($data, \"\"));\n fclose($env_file);\n }", "public function add_app_env_to_context( array $context ) {\n\t\t$context['APP_ENV'] = getenv( 'APP_ENV' );\n\t\treturn $context;\n\t}", "public function testDomainUpdateEnvCommand() {\n\n $dbName = $this->siteDbName;\n $site = Arr::get($_SERVER, 'SERVER_NAME');\n if (!$site) {\n $this->assertTrue(true);\n return;\n }\n $argDomain = $site ? ['domain' => $site] : [];\n\n $this->artisan('domain:remove', array_merge($argDomain, ['--force' => 1]));\n $this->artisan('domain:add', $argDomain);\n\n $fileContents = explode(\"\\n\",$this->files->get(env_path('.env.'.$site)));\n $this->assertNotContains(\"DB_DATABASE=\".$dbName,$fileContents);\n\n $this->artisan('domain:update_env', array_merge($argDomain, [\n '--domain_values' => '{\"DB_DATABASE\":\"'.$dbName.'\"}',\n ]));\n\n $fileContents = explode(\"\\n\",$this->files->get(env_path('.env.'.$site)));\n $this->assertContains(\"DB_DATABASE=\".$dbName,$fileContents);\n\n $this->artisan('domain:remove', array_merge($argDomain, ['--force' => 1]));\n\n }" ]
[ "0.7551238", "0.6644462", "0.6558725", "0.6294258", "0.61804384", "0.61367", "0.61296517", "0.60745007", "0.6059287", "0.60549015", "0.6017924", "0.59529054", "0.59469897", "0.59280616", "0.5917926", "0.58679223", "0.5857066", "0.5803609", "0.57858473", "0.5783957", "0.5766816", "0.57139117", "0.5691438", "0.5686335", "0.5673264", "0.56643444", "0.5658876", "0.5657792", "0.565529", "0.5647598" ]
0.8148647
0
Runs "npm install" if a package.json file is present in the project.
protected static function installNpm(): void { $basePath = self::getBasepath(); $themePath = $basePath . '/themes/default/'; if (file_exists($themePath . '/package.json')) { echo shell_exec('ddev theme install'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static function installNpm()\n {\n $basePath = self::getBasepath();\n $themePath = $basePath . '/themes/default/';\n\n if (file_exists($themePath . '/package.json')) {\n $current = __DIR__;\n chdir($themePath);\n echo shell_exec('npm install');\n chdir($current);\n }\n }", "protected function installNpmDependencies()\n {\n $this->runCommand(['npm', 'set', 'progress=false'], $this->viewsPath(), $this->output);\n $this->runCommand(['npm', 'install'], $this->viewsPath(), $this->output);\n }", "public function installAssets() {\n $this->info('Checking npm...');\n $npm = 'npm';\n if (!`which npm`) {\n if (file_exists('/snap/bin/npm')) {\n $npm = '/snap/bin/npm';\n }\n else if (file_exists('/usr/local/bin/npm')) {\n $npm = '/usr/local/bin/npm';\n }\n else {\n $this->abort('NPM (https://www.npmjs.com/) is required, but not installed. Aborting.');\n }\n }\n\n $this->_createNpmrc();\n $this->cleanAssets();\n\n exec($npm . ' install --verbose', $output, $return);\n $this->out($output);\n if ($return === 0) {\n\n $this->success('Scid assets installed successfully.');\n }\n else {\n $this->abort('SCid assets could not be installed.');\n }\n }", "public function install($path = null, $isDevMode = null)\n {\n if (null === $isDevMode) {\n $isDevMode = true;\n }\n\n if ($isDevMode) {\n $arguments = array('install');\n } else {\n $arguments = array('install', '--production');\n }\n\n $this->executeNpm($arguments, $path);\n }", "private function composerInstall(string $package)\n {\n shell_exec(sprintf('composer require %s --dev', $package));\n }", "protected function addScriptsToNpmPackage()\n {\n $package = json_decode(file_get_contents(base_path('package.json')), true);\n\n $package['scripts']['build-'.$this->viewsName()] = 'cd '.$this->relativeViewsPath().' && npm run dev';\n $package['scripts']['build-'.$this->viewsName().'-prod'] = 'cd '.$this->relativeViewsPath().' && npm run prod';\n\n file_put_contents(\n base_path('package.json'),\n json_encode($package, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)\n );\n }", "function install(){}", "public function check(): void\n\t{\n\t\t$installed = 0;\n\t\tif (is_file(ROOTPATH . 'composer.json'))\n\t\t{\n\t\t\t$installed = 1;\n\n\t\t\t// Read in the entire composer.json\n\t\t\t$composer = json_decode(file_get_contents(ROOTPATH . 'composer.json'), true);\n\t\t\t$this->record('composer.json', 'array', $composer);\n\t\t}\n\n\t\t// Check for composer.lock (for installed versions)\n\t\tif (is_file(ROOTPATH . 'composer.lock'))\n\t\t{\n\t\t\t$installed = 1;\n\n\t\t\t// Read in the lock file\n\t\t\t$composer = json_decode(file_get_contents(ROOTPATH . 'composer.lock'), true);\n\n\t\t\t// Save packages\n\t\t\t$packages = $composer['packages'];\n\t\t\tunset($composer['packages'], $composer['_readme']);\n\n\t\t\t// Save remaining values\n\t\t\t$this->record('composer.lock', 'array', $composer);\n\n\t\t\t// Parse packages\n\t\t\t$result = [];\n\t\t\tforeach ($packages as $package)\n\t\t\t{\n\t\t\t\tunset($package['dist'], $package['notification-url'], $package['license'], $package['authors'], $package['keywords']);\n\t\t\t\t$result[] = $package;\n\t\t\t}\n\n\t\t\tif (! empty($result))\n\t\t\t{\n\t\t\t\t$this->record('packages', 'array', $result);\n\t\t\t}\n\t\t}\n\n\t\t$this->record('installed', 'bool', $installed);\n\t}", "public function handle()\n {\n\n $this->runTask('npm : install', function (BeautyTask $task, $theme) {\n\n if (empty(config('theme.assets.npm.install')) && !file_exists(theme_path(\"$theme/\" . config('theme.assets.path') . \"package.json\"))) {\n $task->message('npm : nothing to install...');\n return $task->stop();\n }\n\n // Global installation\n if (!$this->option('only-package') && !empty(config('theme.assets.npm.install'))) {\n $n = count(config('theme.assets.npm.install'));\n $flags = '';\n foreach (config('theme.assets.npm.flags') as $flag) {\n $flags .= \" $flag\";\n }\n $assets_dir = theme_path(\"$theme/\" . config('theme.assets.path'));\n chdir($assets_dir);\n\n if (!file_exists($assets_dir . \"package.json\")) {\n exec(\"npm init -y\", $out, $exit_code);\n if ($exit_code != 0) {\n $task->message('npm : bad package.json :(');\n return $task->stop(true);\n } else {\n $task->message('npm : package.json created');\n }\n };\n\n $warning = false;\n foreach (config('theme.assets.npm.install') as $package) {\n\n $task->message(\"npm : install $package\");\n exec(\"npm install $flags $package\", $out, $exit_code);\n\n if ($exit_code != 0) $warning = true;\n $task->advance();\n }\n if($warning){\n $task->warning('npm : something gone wrong...');\n }\n }\n\n // Install from package.json\n if (!$this->option('only-global') && file_exists(theme_path(\"$theme/\" . config('theme.assets.path') . \"package.json\"))) {\n $assets_dir = theme_path(\"$theme/\" . config('theme.assets.path'));\n chdir($assets_dir);\n $task->message(\"npm : installing package.json dependencies\");\n exec(\"npm install\", $out, $exit_code);\n if ($exit_code != 0) {\n $task->warning('npm : something gone wrong...');\n }\n $task->advance();\n }\n\n $task->message('npm : installation complete');\n\n }, $this->argument('theme'));\n\n }", "function install() {}", "public function install()\n\t{\n\t\treturn true;\n\t}", "public static function onPackageInstall($event)\n {\n $dir = $event->getComposer()->getConfig()->get('vendor-dir');\n require_once $dir . '/autoload.php';\n\n $base_dir = $dir . '/..';\n require_once $base_dir . '/core/app.php';\n $files = scandir($dir);\n\n array_walk($files, function ($file) use ($dir) {\n\n if (!str_starts_with($file, 'cube-php')) {\n return;\n }\n\n $full_dir = $dir . DIRECTORY_SEPARATOR . $file;\n self::discoverPackages($full_dir);\n });\n }", "public function install($package)\n {\n if (!is_null($package)) {\n $package = '\"' . $package . '\"';\n }\n \n $this->process($package, 'require');\n }", "public function install(): bool;", "private function addRequirePackages()\n {\n $devPackages = [\n \"orangehill/iseed:*\",\n \"barryvdh/laravel-debugbar:*\",\n \"barryvdh/laravel-ide-helper:*\",\n \"laravel/dusk:*\",\n \"mediactive-digital/laravel:*\",\n \"mediactive-digital/migrations-generator:*\"\n ];\n $this->doCommand(\"composer require \" . implode(' ', $devPackages) . \" --dev\");\n\n if ($this->hasOption('theme')) {\n $this->doCommand('composer require ' . $this->option('theme').'');\n }\n }", "public function runComposer()\n\t{\n\t\t// Find Composer\n\t\t$composer = $this->getComposer();\n\t\tif (!$composer) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Check for Composer file\n\t\t$dependencies = $this->releasesManager->getCurrentReleasePath().'/composer.json';\n\t\tif (!$this->fileExists($dependencies)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Run install\n\t\t$this->command->comment('Installing Composer dependencies');\n\t\t$output = $this->runForCurrentRelease($this->getComposer(). ' install');\n\n\t\treturn $this->checkStatus('Composer could not install dependencies', $output);\n\t}", "public function testComposerInstall()\n {\n $this->assertFileNotExists('vendor/test/strawberry-jam/subordinate/jam.out');\n\n PH::runOk('COMPOSER_COMPILE=1 composer install -v');\n\n $this->assertFileContent('vendor/test/strawberry-jam/subordinate/jam.out', \"STRAWBERRY-FIELDS\\n\");\n }", "protected function install()\n {\n $this->modx->runProcessor('workspace/packages/scanLocal');\n $answer = $this->modx->runProcessor('workspace/packages/install',\n ['signature' => join('-', [self::PKG_NAME, self::PKG_VERSION, self::PKG_RELEASE])]\n );\n\n if ($answer) {\n $response = $answer->getResponse();\n echo $response['message'] . PHP_EOL;\n }\n\n $this->modx->getCacheManager()->refresh();\n $this->modx->reloadConfig();\n }", "public function checkIfPackageExists()\n {\n if (is_dir($this->packagePath())) {\n throw new RuntimeException('Package already exists');\n }\n }", "public function install( $args, $assoc_args ) {\n\n\t\tlist( $package ) = $args;\n\n\t\t$defaults = array(\n\t\t\t\t'version' => 'dev-master',\n\t\t\t);\n\t\t$assoc_args = array_merge( $defaults, $assoc_args );\n\n\t}", "public function needsToBeInstalledWithAllDependencies(): bool\n {\n return false;\n }", "public function isPackageInstalled(PackageInterface $package)\n {\n return $this->filesystem->exists($this->config->getInstallDir() . '/' . $package->getName() . '/.bower.json');\n }", "function pkg_install($pkg_name, $force = false) {\n\tglobal $g;\n\t$result = false;\n\n\t$shortname = $pkg_name;\n\tpkg_remove_prefix($shortname);\n\n\t$pkg_force = \"\";\n\tif ($force) {\n\t\t$pkg_force = \"-f \";\n\t}\n\n\tpkg_debug(\"Installing package {$shortname}\\n\");\n\tif ($force || !is_pkg_installed($pkg_name)) {\n\t\t$result = pkg_call(\"install -y \" . $pkg_force . $pkg_name);\n\t\t/* Cleanup cache to free disk space */\n\t\tpkg_call(\"clean -y\");\n\t}\n\n\treturn $result;\n}", "protected function packages(): void\n {\n $rootPackages = json_decode(file_get_contents(__DIR__.'/../../../package.json'), true);\n\n if (file_exists($this->laravel->basePath('package.json'))) {\n $packages = json_decode(file_get_contents($this->laravel->basePath('package.json')), true);\n\n $packages['dependencies'] = array_replace(\n $packages['dependencies'] ?? [], $rootPackages['dependencies']\n );\n\n ksort($packages['dependencies']);\n }\n\n file_put_contents(\n $this->laravel->basePath('package.json'),\n json_encode($packages ?? $rootPackages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL\n );\n\n $this->info('The \"packages.json\" file has been updated.');\n }", "public function install(Event $event) {\n $composer = $event->getComposer();\n\n $installed_json_file = new JsonFile($this->getInstalledJsonPath(), NULL, $this->io);\n\n $installed = NULL;\n if ($installed_json_file->exists()) {\n $installed = $installed_json_file->read();\n }\n\n // Reset if the schema doesn't match the current version.\n if (!isset($installed['schema-version']) || $installed['schema-version'] !== static::SCHEMA_VERSION) {\n $installed = [\n 'schema-version' => static::SCHEMA_VERSION,\n 'installed' => [],\n ];\n }\n\n $applied_drupal_libraries = $installed['installed'];\n\n // Process the root package first.\n $root_package = $composer->getPackage();\n $processed_drupal_libraries = $this->processPackage([], $applied_drupal_libraries, $root_package);\n\n // Process libraries declared in dependencies.\n if (!empty($root_package->getExtra()['drupal-libraries-dependencies'])) {\n $allowed_dependencies = $root_package->getExtra()['drupal-libraries-dependencies'];\n $local_repo = $composer->getRepositoryManager()->getLocalRepository();\n foreach ($local_repo->getCanonicalPackages() as $package) {\n if (\n $allowed_dependencies === TRUE ||\n (is_array($allowed_dependencies) && in_array($package->getName(), $allowed_dependencies, TRUE))\n ) {\n if (!empty($package->getExtra()['drupal-libraries'])) {\n $processed_drupal_libraries += $this->processPackage(\n $processed_drupal_libraries,\n $applied_drupal_libraries,\n $package\n );\n }\n }\n }\n }\n\n // Remove unused libraries from disk before attempting to download new ones.\n // Avoids the edge-case where the removed folder happens to be the same as the one where the new one is being\n // installed to.\n $removed_libraries = array_diff_key($applied_drupal_libraries, $processed_drupal_libraries);\n if ($removed_libraries) {\n $this->removeUnusedLibraries($removed_libraries);\n }\n\n // Attempt to download the libraries.\n $this->downloadLibraries($processed_drupal_libraries, $applied_drupal_libraries);\n\n // Write the lock file to disk.\n if ($this->io->isDebug()) {\n $this->io->write(static::PACKAGE_NAME . ':');\n $this->io->write(\n sprintf(' - Writing to %s', $this->fileSystem->normalizePath($installed_json_file->getPath()))\n );\n }\n\n $installed['installed'] = $processed_drupal_libraries;\n $installed_json_file->write($installed);\n }", "public function install()\n {\n $this->shareDependenciesFolder();\n\n return $this->runWithBeforeAfterEvents(function () {\n return $this->getBinary()->runForApplication('install', [], $this->getInstallationOptions('install'));\n });\n }", "function install()\n {\n }", "public function collectInstalledComposerJson()\r\n {\r\n $this->collectFiles(\r\n $this->site_root.\"/vendor/composer\",\r\n array(\"json\")\r\n );\r\n }", "public static function install(): void\n {\n static::updatePackages();\n static::updatePackages(false);\n static::updateComposerPackages();\n static::updateComposerPackages(false);\n static::updateComposerScripts();\n static::updatePackagesScripts();\n static::updateStyles();\n static::updateBootstrapping();\n static::updateWelcomePage();\n static::updatePagination();\n static::updateLayout();\n static::removeNodeModules();\n }", "function rpostinstall() {\n\t\tif (file_exists('composer.json')) {\n\t\t\t$composer = json_decode(file_get_contents('composer.json'));\n\t\t\t//debug($composer);\n\t\t\tif (isset($composer->scripts) && isset($composer->scripts->{'post-install-cmd'})) {\n\t\t\t\t$cmd = $this->composerCommand . ' run-script post-install-cmd';\n\t\t\t\t$deployPath = $this->getVersionPath();\n\t\t\t\t$remoteCmd = 'cd ' . $deployPath . ' && ' . $cmd;\n\t\t\t\t$this->ssh_exec($remoteCmd);\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.7334342", "0.65567833", "0.632692", "0.5848454", "0.5686467", "0.56734914", "0.5594058", "0.5585572", "0.55724037", "0.5552601", "0.53995436", "0.53933674", "0.5317014", "0.5310664", "0.5308959", "0.5298278", "0.5278894", "0.52740926", "0.5262637", "0.52132183", "0.52100766", "0.5156986", "0.50837016", "0.50668806", "0.50594556", "0.5045249", "0.50399905", "0.5028696", "0.5002915", "0.49976245" ]
0.69844997
1
Removes README.md from the project.
protected static function removeReadme(): void { $basePath = self::getBasepath(); if (file_exists($basePath . '/README.md')) { unlink($basePath . '/README.md'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected static function removeReadme()\n {\n $basePath = self::getBasepath();\n\n if (file_exists($basePath . '/README.md')) {\n unlink($basePath . '/README.md');\n }\n }", "protected function createReadme() :void\n {\n $path = app_path('readme.md');\n\n Storage::put($path, \"\");\n }", "protected function copyReadme()\n {\n $template = $this->getTemplate('README.md');\n $this->copy($template, 'README.md');\n }", "public function readme();", "public function createReadmeFile()\r\n {\r\n $originalFile = realpath(__DIR__ . '/../Resources/files/templates/README');\r\n $newFile = $this->destination_dir.'/README.md';\r\n\r\n $this->createCopiedFile($originalFile, $newFile);\r\n }", "public function testProjectNoReadme()\n {\n // create project to test with\n $project = new Project($this->p4);\n $project->set(\n array(\n 'id' => 'prj',\n 'members' => array('foo-member'),\n 'creator' => 'foo-member',\n 'owners' => array()\n )\n )->save();\n\n $this->dispatch('/project/readme/prj');\n $this->assertRoute('project-readme');\n $this->assertRouteMatch('markdown', 'markdown\\controller\\indexcontroller', 'project');\n $this->assertResponseStatusCode(200);\n $result = $this->getResult();\n\n $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $result);\n $this->assertSame('', $result->getVariable('readme'));\n }", "public function readme($data)\n {\n $readme = $this->di['tools']->file_get_contents(BB_PATH_MODS . '/Example/README.md');\n return $readme;\n }", "public function projectAction()\n {\n $projectId = $this->getEvent()->getRouteMatch()->getParam('project');\n $p4Admin = $this->getServiceLocator()->get('p4Admin');\n\n try {\n $project = Project::fetch($projectId, $p4Admin);\n } catch (NotFoundException $e) {\n } catch (\\InvalidArgumentException $e) {\n }\n\n if (!$project) {\n return new JsonModel(array('readme' => ''));\n }\n\n $services = $this->getServiceLocator();\n $config = $services->get('config');\n $mainlines = isset($config['projects']['mainlines']) ? (array) $config['projects']['mainlines'] : array();\n $branches = $project->getBranches('name', $mainlines);\n\n // check each path of each mainline branch to see if there's a readme.md file present\n $readme = false;\n foreach ($branches as $branch) {\n foreach ($branch['paths'] as $depotPath) {\n if (substr($depotPath, -3) == '...') {\n $filePath = substr($depotPath, 0, -3);\n }\n\n // filter is case insensitive\n $filter = Filter::create()->add(\n 'depotFile',\n $filePath . 'readme.md',\n Filter::COMPARE_EQUAL,\n Filter::CONNECTIVE_AND,\n true\n );\n $query = Query::create()->setFilter($filter);\n $query->setFilespecs($depotPath);\n\n $fileList = File::fetchAll($query);\n // there may be multiple files present, break out of the loops on the first one found\n foreach ($fileList as $file) {\n $readme = File::fetch($file->getFileSpec(), $p4Admin, true);\n break(3);\n }\n }\n }\n\n if ($readme === false) {\n return new JsonModel(array('readme' => ''));\n }\n\n $services = $this->getServiceLocator();\n $helpers = $services->get('ViewHelperManager');\n $purifiedMarkdown = $helpers->get('purifiedMarkdown');\n\n $maxSize = 1048576; // 1MB\n $contents = $readme->getDepotContents(\n array(\n $readme::UTF8_CONVERT => true,\n $readme::UTF8_SANITIZE => true,\n $readme::MAX_FILESIZE => $maxSize\n )\n );\n\n // baseUrl is used for locating relative images\n return new JsonModel(\n array(\n 'readme' => '<div class=\"view view-md markdown\">' . $purifiedMarkdown($contents) . '</div>',\n 'baseUrl' => '/projects/' . $projectId . '/view/' . $branch['id'] . '/'\n )\n );\n }", "function parseReadme()\n{\n $Parsedown = new Parsedown();\n return $Parsedown->text(file_get_contents(dirname(__FILE__) . '/../README.md'));\n}", "public function clean()\n {\n $dir = new \\Ninja\\Directory(NINJA_DOCROOT . 'public/');\n /**\n * @var $files \\Ninja\\File[]\n */\n\n $files = $dir->scanRecursive(\"*.css\");\n echo \"\\nDeleting Minified Css Files...\\n\";\n foreach($files as $sourceFile)\n {\n // if does not have a numeric pre-extension-suffix foo.#.js (e.g foo.52.js) which are files from a previous build\n if ( ! is_numeric(substr($sourceFile->getName(true), strrpos($sourceFile->getName(true), '.') + 1)) )\n continue;\n\n echo ' ' . $sourceFile->getPath() . \"\\n\";\n $sourceFile->delete();\n\n unset($sourceFile);\n }\n\n $files = $dir->scanRecursive(\"*.js\");\n echo \"\\nDeleting Minified Js Files...\\n\";\n foreach($files as $sourceFile)\n {\n // if does not have a numeric pre-extension-suffix foo.#.js (e.g foo.52.js) which are files from a previous build\n if ( ! is_numeric(substr($sourceFile->getName(true), strrpos($sourceFile->getName(true), '.') + 1)) )\n continue;\n\n echo ' ' . $sourceFile->getPath() . \"\\n\";\n $sourceFile->delete();\n unset($sourceFile);\n }\n }", "function markdown_echappe_del($texte){\n\tif (strpos($texte,\"~~\")!==false){\n\t\t$texte = echappe_html($texte,'md',true,',~~,Uims');\n\t}\n\n\treturn $texte;\n}", "public function remove_screen_reader_content()\n {\n }", "public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }", "function cvs_delete_repository($cvs_project) {\r\n global $cvs_root;\r\n \r\n //We really don't want to delete the repository,\r\n //just erase the passwd file...\r\n\r\n $cvs_passwd_file = $cvs_root.\"/\".$cvs_project.\"/CVSROOT/passwd\";\r\n unlink( $cvs_passwd_file);\r\n\r\n $cvs_deleted_file = $cvs_root.\"/\".$cvs_project.\"/DELETED\";\r\n touch( $cvs_deleted_file);\r\n}", "function deleteDocument() {\n \tglobal $synAbsolutePath;\n global ${$this->name}, ${$this->name.\"_name\"}, ${$this->name.\"_old\"}; // ${$this->name} = ${\"surname\"} = $surname\n include_once(\"../../includes/php/utility.php\");\n $ext=$this->translate($this->getValue());\n $mat=$this->translatePath($this->mat);\n $filename=$this->createFilename(false);\n $documentRoot=$synAbsolutePath.\"/\";\n $fileToBeRemoved=$documentRoot.$mat.$filename.\"*\";\n foreach (glob($fileToBeRemoved) as $filename)\n unlink($filename);\n }", "function delete_hello_world() {\n $post = get_page_by_path('hello-world',OBJECT,'post');\n if ($post){\n wp_delete_post($post->ID,true);\n }\n }", "public function remove(): void\n {\n $file = $this->getAbsolutePath();\n if (!is_file($file) || !file_exists($file)) {\n return;\n }\n\n unlink($file);\n }", "public static function removeFirstInstallFile() {}", "public function cleanOldContent($path = null)\n {\n if ($path === null) {\n $path = $this->docPath.DIRECTORY_SEPARATOR.'Contents';\n }\n\n if (!is_dir($path)) {\n return;\n }\n\n foreach (array_diff(scandir($path), ['.', '..']) as $file) {\n $file = $path.DIRECTORY_SEPARATOR.$file;\n if (is_file($file)) {\n // delete file\n unlink($file);\n } else {\n // recursively delete files in folder than folder\n $this->cleanOldContent($file);\n rmdir($file);\n }\n }\n }", "function deleteFullDescription( $sDir, $iId ){\n $sFileName = LANGUAGE.'_'.sprintf( '%04.0f', $iId ).'.txt';\n if( is_file( $sDir.$sFileName ) )\n unlink( $sDir.$sFileName );\n}", "protected function removeSymlink()\n {\n File::delete(public_path('theme'));\n }", "public function testGetReadMeFileContents_ThrowsExceptionWhenMissingFile() {\n $this->expectException( ReadMeFileDoesNotExists::class );\n $mockFileSystem = vfsStream::setup();\n $spider = new Spider( $mockFileSystem->url(), false );\n unlink( $mockFileSystem->url() . '/' . Spider::README_FILE_NAME );\n $spider->getReadMeFileContents();\n }", "public function testChapter1CantBeRemoved(): void\n {\n $this->callDelete('/v2/authors/1');\n $this->assertResponseJsonApiError('Policy exception');\n }", "public function remove() {\n $f = new File(self::CONFIG_FILE_PATH);\n $f->remove();\n }", "public function uninstall(): void\n {\n $this->output(\"TODO: Drop the journal table, remove the files and show the composer command to remove the package\");\n exit;\n }", "public function unsetRemark($index)\n {\n unset($this->remark[$index]);\n }", "function fs_remove_default_description( $bloginfo ) {\r\n\t$default_tagline = 'Just another WordPress site';\r\n\r\n\treturn ( $bloginfo === $default_tagline ) ? '' : $bloginfo;\r\n}", "public function readme($format = 'html')\n {\n // Github throws an exception if a readme doesn't exist for the repo so we catch it and return null\n try {\n return $this->github->readme(\n $this->username,\n $this->repo,\n $format\n );\n } catch (Exception $e) {\n return;\n }\n }", "function fabric_remove_default_description($bloginfo) {\n $default_tagline = 'Just another WordPress site';\n return ($bloginfo === $default_tagline) ? '' : $bloginfo;\n}", "function cleanupPlugin($name)\n\t{\n\t\t$die = function($error, $code = 1) {\n\t\t\t\\cli\\out(\"%1{$error}%n\\n\");\n\t\t\texit($code);\n\t\t};\n\n\t\t$name = Str::slug($name);\n\n\t\t\\cli\\out(\"Cleaning up {$name}...\\n\");\n\n\t\t$composer = $this->path(\"/workbench/plugins/{$name}/composer.json\");\n\t\tif (!$this->files->exists($composer)) {\n\t \t\t$die(\"Coudn't find {$composer} for {$name}\", 1);\n\t \t}\n\n\t \t$package = json_decode( $this->files->get( $composer ) );\n\t \tif (false === $package) {\n\t \t\t$die(\"Coudn't read {$composer} for {$name}\", 2);\n\t \t}\n\n\t \t// remove from composer\n\t \t$process = $this->composer(\"remove {$package->name}\");\n\t\tif (!$process->isSuccessful()) {\n\t\t\t$die(\"Failed to remove {$package->name} from workbench\", 4);\n\t\t}\n\n\t \t// remove from studio\n\t \t$workbench_path = $this->path(\"/workbench/plugins/{$name}\");\n\t \t$process = $this->studio(\"unload {$workbench_path}\");\n\t \tif (!$process->isSuccessful()) {\n\t \t\t$die(\"Failed to unload {$package->name} from your workbench\", 8);\n\t \t}\n\n\t \t// delete the project\n\t \t$this->files->deleteDirectory($workbench_path);\n\t}" ]
[ "0.79977196", "0.67315334", "0.61825985", "0.5848066", "0.5719331", "0.56311715", "0.54835165", "0.5389537", "0.53789705", "0.5251935", "0.5251701", "0.5218745", "0.51502585", "0.506788", "0.50622153", "0.50605273", "0.5029634", "0.500807", "0.5003002", "0.4989636", "0.49869958", "0.49613532", "0.49443588", "0.49434194", "0.49084935", "0.48956755", "0.48841023", "0.48806557", "0.4875111", "0.48706353" ]
0.79444027
1
Returns table locks information in the current database
function getLocks() { global $conf; if (!$conf['show_system']) $where = "AND pn.nspname NOT LIKE 'pg\\\\_%'"; else $where = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; $sql = "SELECT pn.nspname, pc.relname AS tablename, pl.transaction, pl.pid, pl.mode, pl.granted FROM pg_catalog.pg_locks pl, pg_catalog.pg_class pc, pg_catalog.pg_namespace pn WHERE pl.relation = pc.oid AND pc.relnamespace=pn.oid {$where} ORDER BY nspname,tablename"; return $this->selectSet($sql); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLocks();", "protected function getLockTablesQuery()\n {\n $newDbName = $this->newDbName;\n $oldDbName = $this->oldDbName;\n\n $tablesLocks = array_map(function ($table) use ($newDbName, $oldDbName) {\n return [\"{$newDbName}.{$table} WRITE\", \"{$oldDbName}.{$table} WRITE\"];\n }, $this->tables);\n\n $tablesLocks = array_collapse($tablesLocks);\n return 'LOCK TABLE ' . implode(',', $tablesLocks);\n }", "public function get_lock($table_name, $record_id);", "public static function getTableName()\n\t{\n\t\treturn 'b_imopenlines_lock';\n\t}", "public static function GetTableName() {\n\t\t\treturn \"person_with_lock\";\n\t\t}", "public function getLockStatus() {}", "public static function lockTable(){\n\t\t$statement = App::getDBO()->prepare('LOCK TABLES USERS WRITE');\n\t\t App::getDBO()->query();\n\t}", "public function listSlaveRecoveryHealthLock()\n {\n $sql = 'SELECT uid,health FROM slave_user WHERE health<10 FOR UPDATE';\n return $this->_rdb->fetchAll($sql);\n }", "function _lock_tree_table()\n\t{\n\t\tee()->db->query(\"LOCK TABLE \" .$this->tree_table . \" WRITE\");\n\t}", "function unlock() {\r\n\t\t$query=new query($this, \"unlock tables\");\r\n\t\t$result=$query->result;\r\n\t\treturn $result;\r\n\t}", "function lock($table, $mode=\"write\") {\r\n\t\t$query=new query($this, \"lock tables $table $mode\");\r\n\t\t$result=$query->result;\r\n\t\treturn $result;\r\n\t}", "static public function lockTable( $table )\n\t{\n\t\t$lock = \"LOCK TABLES \".Utilities::sqlBackquotes( $table ).\" WRITE\\n\";\n\t\t\n\t\treturn $lock;\n\t}", "private function getLocks()\n {\n $row = 0;\n \n foreach($this->tplVar['articles'] as $article)\n {\n // lock the user to edit\n $result = $this->model->action('article','lock',\n array('job' => 'is_locked',\n 'id_article' => (int)$article['id_article'],\n 'by_id_user' => (int)$this->viewVar['loggedUserId']) );\n \n if(($result !== TRUE) && ($result !== FALSE))\n {\n $this->tplVar['articles'][$row]['lock'] = TRUE; \n } \n else\n {\n $this->tplVar['articles'][$row]['lock'] = FALSE; \n }\n \n $row++;\n } \n }", "public function getLocks($uri) {\n\n $locks = $this->getData($uri);\n foreach($locks as $k=>$lock) {\n if (time() > $lock->timeout + $lock->created) unset($locks[$k]); \n }\n return $locks;\n\n }", "public function getMaintenanceLock()\n {\n return $this->getLockFile('lock.txt');\n }", "public function listLockUnspent();", "public function getLockedContents() {}", "public function getDatabaseInfo() {\n static $result;\n if (isset($result)) {\n return $result;\n }\n $sql = <<< EOF\n select name\n , db.snapshot_isolation_state\n , db.snapshot_isolation_state_desc\n , db.is_read_committed_snapshot_on\n , db.recovery_model\n , db.recovery_model_desc\n , db.collation_name\n from sys.databases db\n WHERE DB_NAME(db.database_id) = :database\nEOF;\n // Database is defaulted from active connection.\n $options = $this->connection->getConnectionOptions();\n $database = $options['database'];\n $result = $this->connection->query_direct($sql, [':database' => $database])\n ->fetchObject();\n return $result;\n }", "public function getLockedCommands()\n {\n static $arr = null;\n if (is_null($arr)) {\n $arr = array();\n $res = $this->db->query('SELECT command_id FROM command WHERE command_locked = 1');\n while ($row = $res->fetch()) {\n $arr[$row['command_id']] = true;\n }\n }\n return $arr;\n }", "public function getForLocking()\n\t{\n##if @BUILDER.AuditTrailSettings.strLockingTableConnectionID.len##\n\t\treturn $this->byId( \"##@BUILDER.AuditTrailSettings.strLockingTableConnectionID s##\" );\n##else##\t\t\n\t\treturn $this->getDefault();\n##endif##\n\t}", "function lock_table($table_name, $alias = null) {\r\n\t\treturn;\r\n\r\n\t\t$sql = \"LOCK TABLES $table_name\";\r\n\r\n\t\tif (isset($alias)) {\r\n\t\t\t$sql .= \" AS $alias\";\r\n\t\t}\r\n\r\n\t\t$sql .= \" WRITE\";\r\n\r\n\t\treturn $this->query($sql);\r\n\r\n\t}", "function getLock ($tablename)\n\t{\n\t\tignore_user_abort(true);\n\t\t$fp = fopen($this->datadir . $tablename.'.lock','w');\n\t\tif (!flock($fp, LOCK_EX)) {\n\t\t // log error?\n\t\t}\n\t\t$this->loadTable($tablename);\n\t\treturn $fp;\n\t}", "function lock($table, $mode=\"write\") \n \t{\n \t\t$res = @mysql_query(\"lock tables $table $mode\", $this->Link_ID);\n \t\t\n \t\tif (!$res)\n \t\t\tnew CException(sprintf(\"lock('%s', '%s') zawi�d�\", $table, $mode), __FILE__, __LINE__);\n \t\t\n \t\treturn $res;\n \t}", "public function getLockStatus() {\n\t\treturn $this->getDriver()->isAcquired();\n\t}", "function loadLockedObject()\n {\n return $this->cacheObjectContents($this->cacheObjectId.'.lock');\n }", "public function getLockHash() {}", "public function unlock_tree()\n\t{\n\t\t$sql = \"UNLOCK TABLES\";\n\t\treturn $this->db->query($sql);\n\t}", "function lock($db, $id, $table='activity') {\n if ($id<0) return -1; # ignore 'new' entries.\n $q='UPDATE '.$table.' set editlock=datetime(\\'now\\',\\'+5 minutes\\') WHERE editlock < datetime(\\'now\\') AND id='.$id.';';\n if ($db->exec($q) == 1) return -1;\n\n $q='SELECT editlock from '.$table.' WHERE id='.$id.';';\n $res=$db->query($q);\n if (!$res) return 0; # XXX error\n $r=$res->fetch(PDO::FETCH_ASSOC);\n return $r['editlock'];\n }", "function lock() {\n global $_Query_lock_depth;\n if ($_Query_lock_depth < 0) {\n Fatal::internalError('Negative lock depth');\n }\n if ($_Query_lock_depth == 0) {\n $row = $this->select1($this->mkSQL('select get_lock(%Q, %N) as locked',\n OBIB_LOCK_NAME, OBIB_LOCK_TIMEOUT));\n if (!isset($row['locked']) or $row['locked'] != 1) {\n Fatal::cantLock();\n }\n }\n $_Query_lock_depth++;\n }", "public static function unlockTables(){\n\t $statement = App::getDBO()->prepare('UNLOCK TABLES');\n\t\tApp::getDBO()->query();\n\t}" ]
[ "0.7128183", "0.6891073", "0.6674592", "0.63838595", "0.63678104", "0.62678874", "0.6111381", "0.6071616", "0.60571986", "0.60114866", "0.60066295", "0.59425944", "0.58664453", "0.5799368", "0.577263", "0.57592314", "0.57064563", "0.5694649", "0.5665413", "0.5633671", "0.5626456", "0.5602922", "0.5598184", "0.5529675", "0.55152833", "0.55127835", "0.5508056", "0.5496461", "0.5489737", "0.54855627" ]
0.794663
0
Returns the current database encoding
function getDatabaseEncoding() { $sql = "SELECT getdatabaseencoding() AS encoding"; return $this->selectField($sql, 'encoding'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEncoding() {\n\t\treturn $this->fetchRow('PRAGMA encoding');\n\t}", "public function getEncoding()\n {\n return $this->fetchRow('PRAGMA encoding');\n }", "function getEncoding() {\n\t\treturn mysql_client_encoding($this->connection);\n\t}", "public function encoding()\n {\n return $this->getEncoding();\n }", "protected static function encoding()\n {\n return static::$encoding;\n }", "public function getEncoding()\n {\n return pg_client_encoding($this->connection);\n }", "public function getEncoding(){\n\t\treturn $this->encoding;\n\t}", "public function getEncoding();", "public function getEncoding()\r\n\t{\r\n\t\treturn $this->m_charset;\r\n\t}", "public function getEncoding() {\n\t\treturn $this->encoding;\n\t}", "public function getEncoding()\n {\n return $this->encoding;\n }", "public function getEncoding()\n {\n return $this->encoding;\n }", "public function getEncoding()\n {\n return $this->encoding;\n }", "public function getEncoding()\n {\n return $this->encoding;\n }", "public function getEncoding()\n {\n return $this->encoding;\n }", "public function getEncoding()\n {\n return $this->_encoding;\n }", "public function getEncoding()\n {\n return $this->_encoding;\n }", "public function getEncoding(): string\n {\n return $this->encoding;\n }", "public function getEncoding(): string\n {\n return $this->encoding;\n }", "function getEncoding(): string\n {\n return $this->getEncodingInfo()['encoding'];\n }", "public function getEncoding(): string;", "public static function getEncoding()\n {\n return static::$encoding ?: 'utf-8';\n }", "public function get_encoding()\n {\n }", "function getEncoding ()\n\t{\n\t\treturn $this->doc->encoding;\n\t}", "protected function getEncoding(): int\n {\n return $this->encoding;\n }", "public function getEncodingFrom()\n {\n return $this->getInputEncoding();\n }", "public function getCharset()\n {\n return $this->_db->getOption('charset');\n }", "function database_encoding(){\r\n\t$default = \"WIN1252\";\r\n\tif(strlen($_SESSION[\"DATABASE_ENCODING\"]) === 0){\r\n\t\t$file_name = dirname($_SERVER[\"SCRIPT_FILENAME\"]).str_repeat(\"/..\", substr_count($_SERVER[\"SCRIPT_NAME\"], \"/\") - 2).\"/support/config.ini\";\r\n\t\tif(file_exists($file_name)){\r\n\t\t\t$ini = parse_ini_file($file_name);\r\n\t\t\tif(strlen($ini[\"dbenco\"]) > 0){\r\n\t\t\t\t$_SESSION[\"DATABASE_ENCODING\"] = $ini[\"dbenco\"];\r\n\t\t\t}else{\r\n\t\t\t\t$_SESSION[\"DATABASE_ENCODING\"] = $default;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$_SESSION[\"DATABASE_ENCODING\"] = $default;\r\n\t\t}\r\n\t}\r\n\treturn strtoupper($_SESSION[\"DATABASE_ENCODING\"]);\r\n}", "public function getEncodingID()\n {\n return $this->encodingID;\n }", "function getEncoding($conn)\n\t{\n\t\treturn pg_client_encoding($conn);\n\t}" ]
[ "0.82511604", "0.81630945", "0.79951113", "0.79760355", "0.787582", "0.772699", "0.7725211", "0.7709512", "0.7694289", "0.76809746", "0.7680298", "0.7680298", "0.7680298", "0.7680298", "0.7650099", "0.76317376", "0.76317376", "0.76009744", "0.76009744", "0.75444674", "0.7508946", "0.74515045", "0.74472374", "0.7420416", "0.7383908", "0.7353211", "0.73420376", "0.7317676", "0.7215748", "0.71494645" ]
0.88552
0
Returns the current default_with_oids setting
function getDefaultWithOid() { // 8.0 is the first release to have this setting // Prior releases don't have this setting... oids always activated return 'on'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDefaultWithOid() {\n\n\t\t$sql = \"SHOW default_with_oids\";\n\n\t\treturn $this->selectField($sql, 'default_with_oids');\n\t}", "protected function get_default() {\n\t\treturn array( 'ownerID' => 0 );\n\t}", "function get_defaultsetting() {\n return $this->defaultsetting;\n }", "public function get_default(){\n\t\treturn $this->default;\n\t}", "protected function get_default() {\n\t\treturn false;\n\t}", "public function getDefault()\n\t{\n\t\treturn $this->byId( \"##@BUILDER.strDefaultConnID s##\" );\n\t}", "public function getDefaultVariantId();", "public function getDefaultSettings();", "protected function get_default() {\n\t\treturn array(\n\t\t\t'ownerID' => 0,\n\t\t\t'accountID' => '',\n\t\t\t'adsenseLinked' => false,\n\t\t\t'adsConversionID' => '',\n\t\t\t'anonymizeIP' => true,\n\t\t\t'internalWebPropertyID' => '',\n\t\t\t'profileID' => '',\n\t\t\t'propertyID' => '',\n\t\t\t'trackingDisabled' => array( 'loggedinUsers' ),\n\t\t\t'useSnippet' => true,\n\t\t\t'canUseSnippet' => true,\n\t\t\t'dashboardView' => Analytics::DASHBOARD_VIEW,\n\t\t);\n\t}", "public function getDefault()\n {\n return $this->getOption('default');\n }", "public function getDefault();", "function get_default_type()\n\t{\n\t\treturn 'normal';\n\t}", "public function getDefaultSetting()\n {\n return $this->getPlatform()->getColumnDefaultValueDDL($this);\n }", "public static function getDefault()\r\n {\r\n return self::get('default');\r\n }", "function get_default_properties()\r\n {\r\n return $this->defaultProperties;\r\n }", "public function getDefaultIdValue(): RawValue\n {\n return new RawValue('default');\n }", "public static function getDefault()\n {\n return self::$default;\n }", "public function defaultOptions() {\n return $this->default_options;\n }", "public function defaultSettings()\n {\n return $this->repository->get( $this->repoOptionString($this->settingsKey, $this->defaultSettingsKey), array());\n }", "public function getIsDefault();", "public function getDefaultProductID() {\n return self::$defaultProductID;\n }", "public function getDefault()\n {\n return $this->get($this->default);\n }", "public static function getDefaultOptions()\n {\n return self::$defaults;\n }", "public static function getDefaultOptions()\n {\n return self::$defaults;\n }", "public function getDefault()\n {\n return $this->default;\n }", "public function getNewSuggestedDefault()\n {\n return $this->model->where('default', '=', false)->where('enabled', '=', true)->first();\n }", "function UseDefaultLocale() {\n $array = $this->_readDefaultLocaleInfo();\n if($array == false ||\n !isset($array[\"id\"])) {\n return 'en'; //Earlier versions of Openbiblio only supported English\n }\n else {\n $this->_locale = $array[\"id\"];\n $this->localekey = $array[\"code\"];\n //$this->_charset = $array[\"charset\"];\n $this->_isdefaultlocale = ($array[\"default_flg\"] == \"Y\");\n\t\t$this->_localeDescr = $array[\"description\"];\n return $array[\"id\"]; \n }\n }", "public function byDefault() {\n\t\treturn $this->byDefault;\n\t}", "public function getDefaultValue()\n {\n\treturn $this->default;\n }", "public function getIsDefault()\n {\n return $this->getProperty(\"IsDefault\");\n }" ]
[ "0.8139143", "0.65943444", "0.6342786", "0.62780774", "0.61722475", "0.6169658", "0.60390615", "0.6026518", "0.60127527", "0.5982875", "0.5978619", "0.5910437", "0.5862489", "0.5839659", "0.5837869", "0.5837418", "0.58335173", "0.58161354", "0.57959735", "0.57930255", "0.5787265", "0.57660615", "0.5762072", "0.5762072", "0.57508314", "0.5731063", "0.5726307", "0.57206595", "0.57148844", "0.57068145" ]
0.76608455
1
Constraint functions Returns a list of all constraints on a table, including constraint name, definition, related col and referenced namespace, table and col if needed
function getConstraintsWithFields($table) { $c_schema = $this->_schema; $this->clean($c_schema); $this->clean($table); // get the max number of col used in a constraint for the table $sql = "SELECT DISTINCT max(SUBSTRING(array_dims(c.conkey) FROM '^\\\\[.*:(.*)\\\\]$')) as nb FROM pg_catalog.pg_constraint AS c JOIN pg_catalog.pg_class AS r ON (c.conrelid=r.oid) JOIN pg_catalog.pg_namespace AS ns ON (r.relnamespace=ns.oid) WHERE r.relname = '{$table}' AND ns.nspname='{$c_schema}'"; $rs = $this->selectSet($sql); if ($rs->EOF) $max_col = 0; else $max_col = $rs->fields['nb']; $sql = ' SELECT c.oid AS conid, c.contype, c.conname, pg_catalog.pg_get_constraintdef(c.oid, true) AS consrc, ns1.nspname as p_schema, r1.relname as p_table, ns2.nspname as f_schema, r2.relname as f_table, f1.attname as p_field, f1.attnum AS p_attnum, f2.attname as f_field, f2.attnum AS f_attnum, pg_catalog.obj_description(c.oid, \'pg_constraint\') AS constcomment, c.conrelid, c.confrelid FROM pg_catalog.pg_constraint AS c JOIN pg_catalog.pg_class AS r1 ON (c.conrelid=r1.oid) JOIN pg_catalog.pg_attribute AS f1 ON (f1.attrelid=r1.oid AND (f1.attnum=c.conkey[1]'; for ($i = 2; $i <= $rs->fields['nb']; $i++) { $sql.= " OR f1.attnum=c.conkey[$i]"; } $sql.= ')) JOIN pg_catalog.pg_namespace AS ns1 ON r1.relnamespace=ns1.oid LEFT JOIN ( pg_catalog.pg_class AS r2 JOIN pg_catalog.pg_namespace AS ns2 ON (r2.relnamespace=ns2.oid) ) ON (c.confrelid=r2.oid) LEFT JOIN pg_catalog.pg_attribute AS f2 ON (f2.attrelid=r2.oid AND ((c.confkey[1]=f2.attnum AND c.conkey[1]=f1.attnum)'; for ($i = 2; $i <= $rs->fields['nb']; $i++) $sql.= " OR (c.confkey[$i]=f2.attnum AND c.conkey[$i]=f1.attnum)"; $sql .= sprintf(")) WHERE r1.relname = '%s' AND ns1.nspname='%s' ORDER BY 1", $table, $c_schema); return $this->selectSet($sql); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function getConstraints($tableName) {\n $constraints = DbManager::query(\"select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME,\n REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE\n where table_name = '$tableName'\");\n return $constraints;\n }", "public function getConstraints();", "protected function findConstraints($table)\n {\n $this->findPrimaryKey($table);\n\n $rc = 'INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS';\n $kcu = 'INFORMATION_SCHEMA.KEY_COLUMN_USAGE';\n if (isset($table->catalogName)) {\n $kcu = $table->catalogName . '.' . $kcu;\n $rc = $table->catalogName . '.' . $rc;\n }\n\n //From http://msdn2.microsoft.com/en-us/library/aa175805(SQL.80).aspx\n $sql = <<<EOD\n\t\tSELECT\n\t\t KCU1.TABLE_SCHEMA AS 'table_schema'\n\t\t , KCU1.TABLE_NAME AS 'table_name'\n\t\t , KCU1.COLUMN_NAME AS 'column_name'\n\t\t , KCU2.TABLE_SCHEMA AS 'referenced_table_schema'\n\t\t , KCU2.TABLE_NAME AS 'referenced_table_name'\n\t\t , KCU2.COLUMN_NAME AS 'referenced_column_name'\n\t\tFROM {$this->quoteTableName($rc)} RC\n\t\tJOIN {$this->quoteTableName($kcu)} KCU1\n\t\tON KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG\n\t\t AND KCU1.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA\n\t\t AND KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME\n\t\tJOIN {$this->quoteTableName($kcu)} KCU2\n\t\tON KCU2.CONSTRAINT_CATALOG = RC.UNIQUE_CONSTRAINT_CATALOG\n\t\t AND KCU2.CONSTRAINT_SCHEMA =\tRC.UNIQUE_CONSTRAINT_SCHEMA\n\t\t AND KCU2.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME\n\t\t AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION\nEOD;\n\n $constraints = $this->connection->select($sql);\n\n $this->buildTableRelations($table, $constraints);\n }", "public function testAllConstraints()\n {\n $xml = '<table name=\"test\"><constraints>\n <primary-key name=\"asset_type_pk\">\n <column>type_code</column>\n </primary-key>\n <foreign-key ref-table=\"asset_type\" name=\"asset_type_fk1\" on-delete=\"CASCADE\">\n <column references=\"type_code\">parent_type</column>\n </foreign-key>\n <unique name=\"unique_constraint\">\n <column>assetid</column>\n </unique></constraints></table>';\n\n $queryXml = new DOMDocument();\n $queryXml->loadXML($xml);\n $table = $queryXml->getElementsByTagName('table')->item(0);\n $expected = array(\n 'PRIMARY-KEYS' => array(\n 0 => array(\n 'name' => 'asset_type_pk',\n 'COLUMNS' => array(\n 0 => 'type_code',\n ),\n ),\n ),\n 'FOREIGN-KEYS' => array(\n 0 => array(\n 'name' => 'asset_type_fk1',\n 'table' => '',\n 'on-delete' => 'CASCADE',\n 'COLUMNS' => array (\n 0 => array(\n 'name' => 'parent_type',\n 'references' => 'type_code',\n ),\n ),\n ),\n ),\n 'UNIQUES' => array(\n 0 => array(\n 'name' => 'unique_constraint',\n 'COLUMNS' => array(\n 0 => 'assetid',\n ),\n ),\n ),\n );\n\n $retVal = DALSchemaParser::getTableConstraints($table);\n\n PHPUnit_Framework_Assert::assertEquals($expected, $retVal);\n\n }", "protected function findConstraints($table)\n {\n parent::findConstraints($table);\n\n // Modified from parent to get extended FK information.\n $tableName = $this->quoteValue($table->name);\n $tableSchema = $this->quoteValue($table->schemaName);\n\n $sql = <<<SQL\nSELECT\n ct.conname AS constraint_name,\n a.attname AS column_name,\n fc.relname AS foreign_table_name,\n fns.nspname AS foreign_table_schema,\n fa.attname AS foreign_column_name,\n ct.confupdtype AS update_type,\n ct.confdeltype AS delete_type\nfrom\n (SELECT ct.conname, ct.conrelid, ct.confrelid, ct.conkey, ct.contype, ct.confkey, generate_subscripts(ct.conkey, 1) AS s, ct.confupdtype, ct.confdeltype\n FROM pg_constraint ct\n ) AS ct\n INNER JOIN pg_class c ON c.oid=ct.conrelid\n INNER JOIN pg_namespace ns ON c.relnamespace=ns.oid\n INNER JOIN pg_attribute a ON a.attrelid=ct.conrelid AND a.attnum = ct.conkey[ct.s]\n LEFT JOIN pg_class fc ON fc.oid=ct.confrelid\n LEFT JOIN pg_namespace fns ON fc.relnamespace=fns.oid\n LEFT JOIN pg_attribute fa ON fa.attrelid=ct.confrelid AND fa.attnum = ct.confkey[ct.s]\nWHERE\n ct.contype='f'\n AND c.relname={$tableName}\n AND ns.nspname={$tableSchema}\nORDER BY \n fns.nspname, fc.relname, a.attnum\nSQL;\n\n $extendedConstraints = $this->db->createCommand($sql)->queryAll();\n\n foreach ($extendedConstraints as $key => $extendedConstraint) {\n // Find out what to do on update.\n switch ($extendedConstraint['update_type']) {\n case 'a':\n $updateAction = 'NO ACTION';\n break;\n case 'r':\n $updateAction = 'RESTRICT';\n break;\n case 'c':\n $updateAction = 'CASCADE';\n break;\n case 'n':\n $updateAction = 'SET NULL';\n break;\n default:\n $updateAction = 'DEFAULT';\n break;\n }\n\n // Find out what to do on update.\n switch ($extendedConstraint['delete_type']) {\n case 'a':\n $deleteAction = 'NO ACTION';\n break;\n case 'r':\n $deleteAction = 'RESTRICT';\n break;\n case 'c':\n $deleteAction = 'CASCADE';\n break;\n case 'n':\n $deleteAction = 'SET NULL';\n break;\n default:\n $deleteAction = 'DEFAULT';\n break;\n }\n\n $table->addExtendedForeignKey($key, [\n 'updateType' => $updateAction,\n 'deleteType' => $deleteAction,\n ]);\n }\n }", "public static function getTableConstraints(DomElement $table)\n {\n $constraints = array();\n $constraintsTag = $table->getElementsByTagName('constraints')->item(0);\n\n if ($constraintsTag === NULL) {\n return $constraints;\n }\n\n $constraints = self::getConstraintsFromParent($constraintsTag);\n\n return $constraints;\n\n }", "protected function _compile_constraints()\r\n\t{\r\n\t\t// Prepare the constraints array\r\n\t\t$constraints = array();\r\n\t\t\r\n\t\t// Compile the not null constraint\r\n\t\tif( ! $this->is_nullable)\r\n\t\t{\r\n\t\t\t$constraints[] = 'not null';\r\n\t\t}\r\n\t\t\r\n\t\t// Compile the default constraint\r\n\t\tif(isset($this->default) AND ( ! is_null($this->default) AND $this->default != ''))\r\n\t\t{\r\n\t\t\t$constraints['default'] = $this->table->database->quote($this->default);\r\n\t\t}\r\n\t\t\r\n\t\t// Return the constraints array\r\n\t\treturn $constraints;\r\n\t}", "public function getConstrains(): array;", "protected function getConstraintKeys($schemaName, $tableName)\n\t{\n\t\t$this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);\n//\t\tselect decode( a.CONSTRAINT_TYPE, 'P', 'PRIMARY KEY (', 'FOREIGN KEY (' )||b.COLUMN_NAME||')' as consrc,\n\t\t$sql =\n<<<EOD\n\t\tselect b.COLUMN_NAME as consrc,\n\t\t\t a.CONSTRAINT_TYPE as contype\n\t\tfrom ALL_CONSTRAINTS a, ALL_CONS_COLUMNS b\n \t\twhere (a.constraint_name = b.constraint_name AND a.table_name = b.table_name AND a.owner = b.owner)\n\t\tand\t a.TABLE_NAME = '{$tableName}'\n\t\tand a.OWNER = '{$schemaName}'\n\t\tand a.CONSTRAINT_TYPE in ('P','R')\nEOD;\n\t\t$this->getDbConnection()->setActive(true);\n\t\t$command = $this->getDbConnection()->createCommand($sql);\n\t\t//$command->bindValue(':table', $tableName);\n\t\t//$command->bindValue(':schema', $schemaName);\n\t\t$primary = array();\n\t\t$foreign = array();\n\t\tforeach($command->query() as $row)\n\t\t{\n\t\t\tswitch( strtolower( $row['contype'] ) )\n\t\t\t{\n\t\t\t\tcase 'p':\n\t\t\t\t\t$primary = array_merge( $primary, array(strtolower( $row['consrc'] )) );\n\t\t\t\t\t/*\n\t\t\t\t\t$arr = $this->getPrimaryKeys($row['consrc']);\n\t\t\t\t\t$primary = array_merge( $primary, array(strtolower( $arr[0] )) );\n\t\t\t\t\t*/\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'r':\n\t\t\t\t\t$foreign = array_merge( $foreign, array(strtolower( $row['consrc'] )) );\n\t\t\t\t\t/*\n\t\t\t\t\t// if(($fkey = $this->getForeignKeys($row['consrc']))!==null)\n\t\t\t\t\t$fkey = $this->getForeignKeys( $row['consrc'] );\n\t\t\t\t\t$foreign = array_merge( $foreign, array(strtolower( $fkey )) );\n\t\t\t\t\t*/\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn array($primary,$foreign);\n\t}", "public function getConstraints()\n {\n return $this->constraints;\n }", "protected function findConstraints($table)\n\t{\n\t\t$foreignKeys=array();\n\t\t$sql=\"PRAGMA foreign_key_list({$table->rawName})\";\n\t\t$keys=$this->getDbConnection()->createCommand($sql)->queryAll();\n\t\tforeach($keys as $key)\n\t\t{\n\t\t\t$column=$table->columns[$key['from']];\n\t\t\t$column->isForeignKey=true;\n\t\t\t$foreignKeys[$key['from']]=array($key['table'],$key['to']);\n\t\t}\n\t\t$table->foreignKeys=$foreignKeys;\n\t}", "public function GetConstraints () {\n\t\treturn $this->constraints;\n\t}", "public function GetConstraints ();", "protected function findConstraints($table)\n {\n // Zoggo - Converted sql to use join syntax\n $sql = 'SELECT\n c.rdb$relation_name AS ftable,\n d.rdb$field_name AS ffield,\n e.rdb$field_name AS lfield\n FROM\n rdb$ref_constraints b\n join rdb$relation_constraints a on a.rdb$constraint_name=b.rdb$constraint_name\n join rdb$relation_constraints c on b.rdb$const_name_uq=c.rdb$constraint_name\n join rdb$index_segments d on c.rdb$index_name=d.rdb$index_name\n join rdb$index_segments e on a.rdb$index_name=e.rdb$index_name\n WHERE\n a.rdb$constraint_type=\\'FOREIGN KEY\\' AND\n a.rdb$relation_name=upper(\\'' . $table->name . '\\') ';\n\n try {\n $fkeys = $this->db->createCommand($sql)->queryAll();\n } catch (Exception $e) {\n return false;\n }\n\n\n foreach ($fkeys as $fkey) {\n // Zoggo - Added strtolower here to guarantee that values are\n // returned lower case. Otherwise gii generates wrong code.\n\n $key = strtolower(rtrim($fkey['lfield']));\n $table->foreignKeys[$key] = array(strtolower(rtrim($fkey['ftable'])), strtolower(rtrim($fkey['ffield'])));\n\n if (isset($table->columns[$key])) {\n $table->columns[$key]->isForeignKey = true;\n }\n }\n }", "public function getConstraintNodes(): array\n {\n return $this->organize()->constraints;\n }", "public function getConstraintTypes() {}", "public static function validateTableConstraints(DomElement $table)\n {\n $constTag = $table->getElementsByTagName('constraints')->item(0);\n $tableName = $table->getAttribute('name');\n $msg = $tableName.'\\'s table';\n\n if ($constTag === NULL) {\n $msg .= ' does not have \"constraints\".';\n throw new DALParserException($msg);\n }\n\n // Check general constraint rules.\n self::validateConstraints($constTag, $msg);\n\n // Additional Primary Key checks.\n $pks = $constTag->getElementsByTagName('primary-key');\n if ($pks->length !== 1) {\n $msg .= ' must have a primary-key.';\n throw new DALParserException($msg);\n } else {\n foreach ($pks as $pk) {\n $cols = $pk->getElementsByTagName('column');\n // Each of the columns here must be defined in table columns.\n foreach ($cols as $col) {\n if (self::tableHasColumn($table, $col->nodeValue) === FALSE) {\n $msg .= ' does not have column \"'.$col->nodeValue;\n $msg .= '\", but it was used in its primary-key.';\n throw new DALParserException($msg);\n }\n }\n }\n }//end if\n\n // Additional Foreign Key checks.\n // Check if table has already defined this column name.\n $fks = $constTag->getElementsByTagName('foreign-key');\n $keyPosition = 1;\n foreach ($fks as $fk) {\n $cols = $fk->getElementsByTagName('column');\n if ($cols !== NULL) {\n $colLoc = 1;\n foreach ($cols as $col) {\n $colVal = $col->nodeValue;\n if (self::tableHasColumn($table, $colVal) === FALSE) {\n $msg .= ' foreign-key #'.$keyPosition;\n $msg .= ' has column (#'.$colLoc.')';\n $msg .= ' with column name that was NOT defined in';\n $msg .= ' table columns. Name: '.$colVal;\n throw new DALParserException($msg);\n }\n\n $colLoc++;\n }\n }\n\n $keyPosition++;\n }\n\n // Additional unique Key checks.\n $uniques = $constTag->getElementsByTagName('unique');\n foreach ($uniques as $unique) {\n $cols = $unique->getElementsByTagName('column');\n if ($cols !== NULL) {\n foreach ($cols as $col) {\n $colVal = $col->nodeValue;\n if (self::tableHasColumn($table, $colVal) === FALSE) {\n $msg .= ' does not have column \"'.$colVal;\n $msg .= '\", but it was used in its unique constraint.';\n throw new DALParserException($msg);\n }\n }\n }\n }\n\n }", "public function getValidationConstraints()\n {\n return $this->generator->generate($this->objects);\n }", "public function getConstraint();", "protected function findConstraints($table)\n\t{\n\t\t$schemas=$this->getDbConnection()->getPdoInstance()->cubrid_schema(PDO::CUBRID_SCH_IMPORTED_KEYS,$table->name);\n\n\t\tforeach($schemas as $schema)\n\t\t{\n\t\t\t$table->foreignKeys[$schema[\"FKCOLUMN_NAME\"]]=array($schema[\"PKTABLE_NAME\"],$schema[\"PKCOLUMN_NAME\"]);\n\t\t\tif(isset($table->columns[$schema[\"FKCOLUMN_NAME\"]]))\n\t\t\t\t$table->columns[$schema[\"FKCOLUMN_NAME\"]]->isForeignKey=true;\n\t\t}\n\t}", "public function getConstraints( $attr = NULL )\n {\n if ( $attr === NULL ) return $this->constraints;\n if ( isset($this->constraints[ $attr ]) ) return $this->constraints[ $attr ];\n\n return array(); // No tiene restricciones\n }", "function getConstraint() ;", "function getConstraint() ;", "protected function findConstraints(TableSchema $table)\r\n {\r\n foreach ($table->layouts as $layoutName) {\r\n foreach ($this->getLayout($layoutName)->getRelatedSets() as $relation) {\r\n // Check if portal of the same related table was already declared\r\n $relationName = $relation->name . '_portal';\r\n if (isset($table->relations[$relationName])) {\r\n $tableSchema = $table->relations[$relationName];\r\n } else {\r\n $tableSchema = new TableSchema();\r\n $tableSchema->name = $relation->name;\r\n $tableSchema->fullName = $relationName;\r\n $tableSchema->isPortal = true;\r\n $tableSchema->defaultLayout = $layoutName;\r\n $tableSchema->baseTable = $relation->name;\r\n\r\n //Store _recid PK as field\r\n $pk = $this->createColumnSchema();\r\n $pk->name = '_recid';\r\n $pk->allowNull = false;\r\n $pk->isPrimaryKey = true;\r\n $pk->autoIncrement = true;\r\n $pk->phpType = 'integer';\r\n\r\n $tableSchema->columns['_recid'] = $pk;\r\n }\r\n\r\n\r\n $tableSchema->layouts[] = $layoutName;\r\n\r\n foreach ($relation->getFields() as $field) {\r\n $column = $this->loadColumnSchema($field);\r\n //handle related Fields from different OT\r\n if ($column->isRelated && $column->relationName != $tableSchema->name) {\r\n if (!isset($table->relations[$column->relationName])) {\r\n $relatedSchema = new TableSchema();\r\n $relatedSchema->name = $relatedSchema->fullName = $column->relationName;\r\n $relatedSchema->defaultLayout = $table->defaultLayout;\r\n $table->relations[$column->relationName] = $relatedSchema;\r\n } else {\r\n $relatedSchema = $table->relations[$column->relationName];\r\n }\r\n\r\n $tableSchema->relations[$column->relationName] = $relatedSchema;\r\n if (!isset($relatedSchema->columns[$column->name])) {\r\n $relatedSchema->columns[$column->name] = $column;\r\n }\r\n //$table->relations[$column->relationName][1][$column->name] = $column;\r\n } elseif (!isset($tableSchema->columns[$column->name])) {\r\n $tableSchema->columns[$column->name] = $column;\r\n }\r\n }\r\n\r\n $table->relations[$relationName] = $tableSchema;\r\n }\r\n }\r\n }", "public function getConstraints(): array\n {\n $constraints = array_merge($this->getConstraint1()->getConstraints(), $this->getConstraint2()->getConstraints());\n $constraints[] = $this;\n\n return $constraints;\n }", "public function readConstraints($tableName, $resource);", "public function get_constraint_sql($constraint) {\n if ( !is_array($constraint) ) {\n throw new exception(\"constraint is not an array?\");\n }\n if ( strlen($constraint['table_name']) == 0 ) {\n var_dump(array_keys($constraint));\n throw new exception(\"table_name is blank\");\n }\n $sql = \"ALTER TABLE \"\n . pgsql8_diff::get_quoted_name($constraint['schema_name'], dbsteward::$quote_schema_names) . '.'\n . pgsql8_diff::get_quoted_name($constraint['table_name'], dbsteward::$quote_table_names) . \"\\n\"\n . static::get_constraint_sql_change_statement($constraint);\n\n $sql .= ';';\n return $sql;\n }", "public function getConstraint() {}", "public function getConstraint() {}", "public function getAffectedConstraints()\n\t{\n\t\treturn $this->constraints;\n\t}" ]
[ "0.746639", "0.693201", "0.6890931", "0.6868531", "0.6831753", "0.6791077", "0.6779372", "0.6769578", "0.6655093", "0.6639738", "0.6578574", "0.6568467", "0.65648335", "0.655904", "0.65273464", "0.6445459", "0.635602", "0.6333815", "0.63224715", "0.6318673", "0.6258683", "0.6211877", "0.6211877", "0.6109193", "0.60761917", "0.60455775", "0.6026488", "0.5985333", "0.5985333", "0.59592396" ]
0.71316516
1
Sequence functions Returns all sequences in the current database
function getSequences($all = false) { $c_schema = $this->_schema; $this->clean($c_schema); if ($all) { // Exclude pg_catalog and information_schema tables $sql = "SELECT n.nspname, c.relname AS seqname, u.usename AS seqowner FROM pg_catalog.pg_class c, pg_catalog.pg_user u, pg_catalog.pg_namespace n WHERE c.relowner=u.usesysid AND c.relnamespace=n.oid AND c.relkind = 'S' AND n.nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') ORDER BY nspname, seqname"; } else { $sql = "SELECT c.relname AS seqname, u.usename AS seqowner, pg_catalog.obj_description(c.oid, 'pg_class') AS seqcomment FROM pg_catalog.pg_class c, pg_catalog.pg_user u, pg_catalog.pg_namespace n WHERE c.relowner=u.usesysid AND c.relnamespace=n.oid AND c.relkind = 'S' AND n.nspname='{$c_schema}' ORDER BY seqname"; } return $this->selectSet( $sql ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_sequences()\n\t{\n\t\treturn $this->driver_query('sequence_list');\n\t}", "public function getSequences()\n {\n $main_actions = [\n 'sequence' => \\adminer\\lang('Create sequence'),\n ];\n\n $headers = [\n \\adminer\\lang('Name'),\n ];\n\n $sequences = [];\n if(\\adminer\\support(\"sequence\"))\n {\n // From db.inc.php\n $sequences = \\adminer\\get_vals(\"SELECT sequence_name FROM information_schema.sequences \".\n \"WHERE sequence_schema = current_schema() ORDER BY sequence_name\");\n }\n $details = [];\n foreach($sequences as $sequence)\n {\n $details[] = [\n 'name' => \\adminer\\h($sequence),\n ];\n }\n\n return \\compact('main_actions', 'headers', 'details');\n }", "public function getSequences()\n {\n return $this->sequences;\n }", "public function sequence() {\n\t\t\treturn $this->getClient()->get($this->sequenceName());\n\t\t}", "public function getSequence()\n {\n return parent::getSequence() . '_seq'; // TODO: Change the autogenerated stub\n }", "public function getSequence() {\n for ($i = 0; $i < $this->N; $i++) {\n $key = (int) $this->a[$i];\n $valor = (int) $this->w[$i];\n if (in_array($key, $this->secuencelist)) {\n array_push($this->secuencelist, $valor);\n } else {\n $this->secuencelist[$key][] = $valor;\n }\n }\n $this->fillIndex();\n return $this->secuencelist;\n }", "public function testSequences()\n {\n $xml = '<table name=\"test\">\n <sequences>\n <sequence name=\"assetid_seq\" />\n <sequence name=\"assetid_seq2\" />\n </sequences></table>';\n\n $queryXml = new DOMDocument();\n $queryXml->loadXML($xml);\n $table = $queryXml->getElementsByTagName('table')->item(0);\n $expected = array (\n 0 => 'assetid_seq',\n 1 => 'assetid_seq2',\n );\n $retVal = DALSchemaParser::getTableSequences($table);\n\n PHPUnit_Framework_Assert::assertEquals($expected, $retVal);\n\n }", "function Seq() {\n $arr = func_get_args();\n return arrayToString(Sequence($arr));\n }", "public static function getTableSequences(DomElement $table)\n {\n $squencesTag = $table->getElementsByTagName('sequences')->item(0);\n $sequences = array();\n\n if ($squencesTag !== NULL) {\n $seqs = $squencesTag->getElementsByTagName('sequence');\n foreach ($seqs as $seq) {\n $sequences[] = array(\n 'name' => $seq->getAttribute('name'),\n 'increment' => $seq->getAttribute('increment'),\n 'min' => $seq->getAttribute('min'),\n 'max' => $seq->getAttribute('max'),\n );\n }\n }\n\n return $sequences;\n\n }", "public function getTravelLocalApprovalSeqList() {\r\n\t\t$sql = $this->getSql();\r\n\t\t$select = $sql->select(); \r\n\t\t$select->from(array('e' => $this->seqTable))\r\n\t\t ->columns(array('id','ApprovalLevelName','ApprovalSequence'))\r\n\t\t; \r\n\t\t//echo $select->getSqlString(); \r\n\t\t//exit; \r\n\t\treturn $select; \r\n\t}", "public function getSequence()\n {\n return $this->primarySequence;\n }", "public function getSequence()\n {\n return $this->sequence;\n }", "abstract public function values(): Seq;", "function next_sequence() { return \"auto\"; }", "public function getSequencial() {\n return $this->iSequencial;\n }", "private function getSequence(): array\n {\n $ping = $this->results;\n\n $items_count = count($ping);\n\n // First remove items from final of the array\n for ($i = 6; $i > 0; $i--) {\n unset($ping[$items_count - $i]);\n }\n\n // Then remove first items\n unset($ping[1]);\n unset($ping[0]);\n\n $key = 0;\n\n $sequence = [];\n\n foreach ($ping as $row) {\n $sequence[$key] = $row;\n\n $key++;\n }\n\n return $sequence;\n }", "public static function getSequence()\n {\n return ++static::$sequence;\n }", "public function getSequencer($table);", "private static function sequence($ms)\n {\n return FP::reduce(\n function (Generator $acc, Generator $elem) {\n return $acc->bindGen(function ($xs) use ($elem) {\n return $elem->bindGen(function ($y) use ($xs) {\n return self::pureGen(FP::push($xs, $y));\n });\n });\n },\n $ms,\n self::pureGen([])\n );\n }", "private function getSequence() {\n srand(time());\n return rand(1, 1000);\n }", "function sequenceKey()\n {\n return array(false, false, false);\n }", "public function getSequenceName()\n\t{\n\t\t$table = $this->getTable();\n\t\tstatic $longNamesMap = array();\n\t\t$result = null;\n\t\tif ($table->getIdMethod() == IDMethod::NATIVE) {\n\t\t\t$idMethodParams = $table->getIdMethodParameters();\n\t\t\t$maxIdentifierLength = $table->getDatabase()->getPlatform()->getMaxColumnNameLength();\n\t\t\tif (empty($idMethodParams)) {\n\t\t\t\tif (strlen($table->getName() . \"_SEQ\") > $maxIdentifierLength) {\n\t\t\t\t\tif (!isset($longNamesMap[$table->getName()])) {\n\t\t\t\t\t\t$longNamesMap[$table->getName()] = strval(count($longNamesMap) + 1);\n\t\t\t\t\t}\n\t\t\t\t\t$result = substr($table->getName(), 0, $maxIdentifierLength - strlen(\"_SEQ_\" . $longNamesMap[$table->getName()])) . \"_SEQ_\" . $longNamesMap[$table->getName()];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$result = substr($table->getName(), 0, $maxIdentifierLength -4) . \"_SEQ\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$result = substr($idMethodParams[0]->getValue(), 0, $maxIdentifierLength);\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}", "public function getSequence($argument1)\n {\n }", "public function all()\n {\n $records = R::findAll( $this->table_name(), \" order by id \");\n\n $object = array_map( function($each_record) {\n return $this->map_reford_to_object( $each_record );\n },\n $records\n );\n\n return array_values( $object );\n }", "public function values() {\n return Sequence(values($this->getIterator()));\n }", "public function getSequenceNotes($idclasse, $ideleve, $idsequence, $idgroupe) {\r\n /* $query = \"SELECT ens.*, mat.*, prof.*, g.DESCRIPTION AS GROUPELIBELLE \"\r\n . \"FROM enseignements ens \"\r\n . \"INNER JOIN matieres mat ON mat.IDMATIERE = ens.MATIERE \"\r\n . \"INNER JOIN personnels prof ON prof.IDPERSONNEL = ens.PROFESSEUR \"\r\n . \"INNER JOIN groupe g ON g.IDGROUPE = ens.GROUPE \"\r\n . \"WHERE ens.CLASSE = :idclasse AND ens.GROUPE = :idgroupe\";\r\n */\r\n\r\n $query = \"SELECT n.*\";\r\n $params = [\"idclasse\" => $idclasse, \"idgroupe\" => $idgroupe];\r\n return $this->query($query, $params);\r\n }", "public function testSequences(string $name = null): array;", "public function get_next_id() {\n\n $query = $this->db->query('SELECT getNextSeq(\"company_seq as id\");');\n // print \"<pre>\";\n\n $object = $query->result()[0];\n\n // print_r($object);\n\n $array = get_object_vars($object);\n\n // print_r($array);\n // print_r($array['getNextSeq(\"company_seq as id\")']);\n\n $result_id = $array['getNextSeq(\"company_seq as id\")'];\n //echo $result_id;//[0]['id'];\n // print \"</pre>\";\n // exit(); \n\n return $result_id;\n }", "public function getSequences($actions): array\n {\n $sequences = [];\n\n $defaults = [\n 'deployment_id' => null,\n 'project_id' => null,\n 'server_id' => null,\n 'server_name' => null,\n 'sequence' => null,\n 'name' => null,\n 'action_id' => null,\n 'hook_id' => null,\n ];\n\n foreach ($actions as $action) {\n foreach ($action->beforeHooks as $beforeHook) {\n $sequences[] = array_merge($defaults, [\n 'name' => $beforeHook->name,\n 'hook_id' => $beforeHook->id,\n ]);\n }\n\n $sequences[] = array_merge($defaults, [\n 'name' => $action->name,\n 'action_id' => $action->id,\n ]);\n\n foreach ($action->afterHooks as $afterHook) {\n $sequences[] = array_merge($defaults, [\n 'name' => $afterHook->name,\n 'hook_id' => $afterHook->id,\n ]);\n }\n }\n\n return $sequences;\n }", "public function importSequences(array $sequenceArray)\n {\n $sequences = array();\n\n foreach ($sequenceArray as $name => $sequenceDef) {\n //echo '<h2>Sequence: ' . $name . '</h2>';\n //Debug::dump($sequencedef);\n $sequences[] = new Sequence(\n $sequenceDef['name'],\n $sequenceDef['allocationsize'],\n $sequenceDef['initialvalue']\n );\n }\n return $sequences;\n }" ]
[ "0.8136024", "0.7423928", "0.7077528", "0.64897966", "0.6129248", "0.60549", "0.59157425", "0.58499014", "0.5774951", "0.57231396", "0.57211506", "0.56081337", "0.55795294", "0.5522043", "0.5512508", "0.5490074", "0.54655147", "0.5461807", "0.5416555", "0.54039043", "0.53316647", "0.5324884", "0.5314412", "0.5299272", "0.52950364", "0.5292211", "0.5285305", "0.5283803", "0.5279554", "0.52577657" ]
0.7641541
1
This will return entity id based on email address.
public function getEntityIdByEmail($email) { $read = Mage::getSingleton('core/resource')->getConnection('core_read'); $readresult = $read->query( 'SELECT entity_id,role_id,role_code FROM `customer_entity` ce LEFT JOIN axaltacore_user_role aur ON ce.entity_id = aur.user_id LEFT JOIN axaltacore_role ar ON aur.role_id = ar.axaltacore_role_id where ce.email = "'.$email.'" and ar.role_code="la_key_user"' ); while ($row = $readresult->fetch()) { $entityId = $row['entity_id']; } return $entityId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmailId() {\n\t\treturn $this->getData('emailId');\n\t}", "protected function userIDEmail ($email)\n {\n \n $user = Model_users::find('all', array\n (\n 'where' => array\n (\n array('email'=>$email),\n )\n ));\n if(!empty($user))\n {\n $id=0;\n foreach ($user as $key => $value)\n {\n $id = $user[$key]->id;\n }\n return $id; \n } \n }", "function InfGetContactId($email) {\n\t\n\t$object_type = \"Contact\";\n $class_name = \"Infusionsoft_\" . $object_type;\n $object = new $class_name();\n // Order by most recent contact with that Email\n#\t$objects = Infusionsoft_DataService::query(new $class_name(), array('ContactId' => $payment['ContactId']));\n $objects = Infusionsoft_DataService::queryWithOrderBy(new $class_name(), array('Email' => $email), 'DateCreated', false);\n $contact_array = array();\n foreach ($objects as $i => $object) {\n $contact_array[$i] = $object->toArray();\n }\n foreach ($contact_array as $i => $contact) {\n\t\treturn $contact['Id'];\n\t}\n\treturn \"\";\n}", "Public Function getIdUsingEmail($Email)\n\t{\n\t\t$Result = $this->_db->fetchRow('SELECT * FROM bevomedia_user WHERE email = ?', $Email);\n\t\tif(!$Result || !sizeOf($Result))\n\t\t\treturn false;\n\t\treturn $Result->id;\n\t}", "public function getIdEmailByEmail($email){\n $row = $this->db->run(\"SELECT id, username, email FROM users WHERE email=? LIMIT 1\", [$email])->fetch();\n return $row;\n }", "public function getUidFromEmail($email);", "static function email2id($email) {\n // converts a user email to the id of the user\n // both id and email are indivitual to every user\n \n global $con;\n\n $sql = \"SELECT `id` FROM `user` WHERE `email` LIKE '\".$email.\"';\";\n $query = mysqli_query($con, $sql);\n while ($row = mysqli_fetch_assoc($query)) {\n return intval($row['id']);\n }\n return NULL;\n }", "function getId($email) {\n\t\t$selectPrepa = self::$bdd -> prepare(\"SELECT id FROM utilisateur WHERE email = '$email'\");\n\t\t$selectPrepa -> execute();\n\t\t$result = $selectPrepa -> fetch();\n\t\treturn $result[0];\n\t}", "function people_findByEmail($find_email) {\n $response = $this->execute(array('method' => 'flickr.people.findByEmail', 'find_email' => $find_email));\n\t\t$object = unserialize($response);\n\t\tif ($object['stat'] == 'ok') {\n\t\t\treturn $object['user']['nsid'];\n\t\t} else {\n\t\t\t$this->setError($object['message'], $object['code']);\n\t\t\treturn NULL;\n\t\t}\n\t}", "public static function idByEmail($email=NULL)\n {\n if($email!=NULL)\n {\n try \n {\n $count = User::where('email', $email)->count();\n if($count > 0)\n {\n $user = User::where('email', $email)->orderBy('name', 'asc')->first();\n return $user->id;\n }\n else\n {\n return null;\n }\n } \n catch (ModelNotFoundException $e) \n {\n Log::error(\"The user with email ` $email ` does not exist: \". $e->getMessage());\n //TODO: send email?\n return null;\n }\n }\n else\n {\n return null;\n }\n }", "public function getUserIdFromEmail($useremail)\n { \n try\n {\n $db_request = DB::table('user')\n ->select('id')\n ->where('Email', $useremail)\n ->first(); \n\n $id = $db_request->id;\n if($id!=NULL){\n return $id;\n }\n }\n catch(\\Exception $Exception)\n {\n return -1; \n }\n \n }", "public function get_user_id($em){\r\n $this->db->select('id');\r\n $this->db->where('email', $em);\r\n $query = $this->db->get('users');\r\n foreach ($query->result() as $row)\r\n {\r\n return $row->id;\r\n }\r\n }", "public function getIdentifier()\n {\n return $this->user->email;\n }", "public function getIdFromEmail($email)\n {\n $result = $this->find()\n ->select(['id'])\n ->where(['email' => $email])\n ->first();\n if ($result) {\n return $result->id;\n }\n\n return false;\n }", "public function get_id_from_email($email)\n {\n $this->db->select('id');\n $this->db->where('email', $email);\n $this->db->limit(1);\n if ($this->db->count_all_results('accounts') === 0)\n {\n return 0;\n }\n $this->db->select('id');\n $this->db->where('email', $email);\n return $this->db->get('accounts')->row()->id;\n }", "function getEmailId($eid)\n{\n\t$password=\"k4heNatH\";\n\t$ds=ldap_connect(\"ldap://prodldap.honeywell.com\");\n\tif ($ds) {\n\t\t$dn=\"cn=atlassian-prod,ou=ApplicationUsers,o=honeywell\";\n\t\t$r=ldap_bind($ds,$dn,$password);\n\t\t$sr=ldap_search($ds, \"o=honeywell\",\"uid=E$eid\");\n\t\t$info = ldap_get_entries($ds, $sr);\n\t\tfor ($i=0; $i<$info[\"count\"]; $i++) {\n\t\t\t$dn=$info[$i][\"dn\"];\n\t\t\t$name=$info[$i][\"cn\"][0] ;\n\t\t\t$email= $info[$i][\"mail\"][0];\n\t\t}\n\t\tldap_close($ds);\n\t}\n\telse {\n\t\techo \"<h4>Unable to connect to LDAP server</h4>\";\n\t}\n\treturn $email;\n}", "function get_user_id_from_email($email)\n\t{\n\t\t//$this->firephp->log(\"email=\".$email);\n\t\t\n\t\t$this->db->select($this->flexi_auth->db_column('user_acc', 'id'));\t\n\t\t$this->db->where($this->flexi_auth->db_column('user_acc', 'email'),$email);\t\n\t\t$qres=$this->db->get('user_accounts');\n\t\tif ($qres->num_rows() > 0) {\n\t\t\t$row=$qres->row_array();\n\t\t\t//$this->firephp->log($row['uacc_id'].\"for email=\".$email);\n\t\t\treturn $row['uacc_id'];\n\t\t} else {\n\t\t\t$this->firephp->log(\"Could not determine user id from user email\");\n\t\t\treturn NULL;\n\t\t}\n\t}", "public static function getIdByEmail($email)\n\t{\n\t\treturn (int) FrontendModel::getDB()->getVar('SELECT p.id FROM profiles AS p WHERE p.email = ?', (string) $email);\n\t}", "public function getEntityId();", "public function getEntityId();", "public function getEntityId();", "function admin_fetch_user_Idn($email)\n\t{\n\n\t\tglobal $Oau_auth;\n\t\t$email\t=\tsanitize($email);\n\n\t\t$query = \"SELECT `admin_Idn` FROM `administrator` WHERE `email` = '$email'\";\n\t\t$run_query = mysqli_query($Oau_auth, $query);\n\t\t$rows = mysqli_fetch_assoc($run_query);\n\t\t$admin_Idn = $rows['admin_Idn'];\n\t\treturn $admin_Idn;\n\n\t}", "private function id(string $email): int {\n\t\treturn (int) (new Storage\\TypedQuery(\n\t\t\t$this->connection,\n\t\t\t'SELECT id\n\t\t\tFROM seekers\n\t\t\tWHERE email IS NOT DISTINCT FROM ?',\n\t\t\t[$email]\n\t\t))->field();\n\t}", "public function getUserIdByEmail($email){\n try{\n $result = User::model()->checkIfUserExist($email,'Email');\n } catch (Exception $ex) {\n Yii::log(\"SkiptaUserService:getUserIdByEmail::\".$ex->getMessage().\"--\".$ex->getTraceAsString(), 'error', 'application');\n }\n return $result;\n }", "function fetch_user_Idn($email)\n\t{\n\n\t\tglobal $Oau_auth;\n\t\t$email\t=\tsanitize($email);\n\n\t\t$query = \"SELECT `student_Idn` FROM `student` WHERE `email` = '$email'\";\n\t\t$run_query = mysqli_query($Oau_auth, $query);\n\t\t$rows = mysqli_fetch_assoc($run_query);\n\t\t$student_Idn = $rows['student_Idn'];\n\t\treturn $student_Idn;\n\n\t}", "public function getUserID($email){\n\t\n\t\t$db = new Database();\n\t\t$conn= $db->getConn();\n\t\t$stmt = $conn->prepare(\"select id from login where Email=?\");\n\t\t$stmt->bind_param(\"s\", $email);\t\t\t\n\t\t$stmt->execute();\n\t\t$stmt->bind_result($v_id);\n\t\t\n\t\tif($stmt->execute()){\n\t\t\twhile($stmt->fetch()){\n\t\t\t\t$id=$v_id;\n\t\t\t}\n\t\t}\n\n\t\t$stmt->free_result();\n\t\t$stmt->close();\n\t\t\n\t\treturn $id;\n\t\n\t}", "function get_user_id_from_string($email_or_login)\n {\n }", "function getUserIdByEmail($email) {\n\t$email = escape($email);\n\t$result = mysql_query(\"SELECT id FROM users WHERE email = '$email'\");\n\t\n\tif($row = mysql_fetch_array($result)) {\n\t\treturn $row[0];\n\t} else {\n\t\treturn false;\n\t}\n}", "public function getUserByEmail($email) {\n //create user query by email\n $user_query_by_email = Doctrine_Query::create()\n ->select('sgu.id')\n ->from('sfGuardUser sgu')\n ->where('sgu.email_address =?', $email);\n return $user_query_by_email->fetchOne();\n }", "public function getIdentity(): string\n {\n return $this->email;\n }" ]
[ "0.73483413", "0.7223782", "0.72197527", "0.7193137", "0.716111", "0.71277434", "0.70311105", "0.6999079", "0.685598", "0.68531823", "0.6843078", "0.68231684", "0.68041915", "0.6756805", "0.67410135", "0.67270297", "0.67166895", "0.67041534", "0.66755015", "0.66755015", "0.66755015", "0.6669418", "0.66663074", "0.6658292", "0.6642257", "0.6630559", "0.6628455", "0.6593223", "0.6586229", "0.65721685" ]
0.81247777
0
/ To unassign parent from User
public function unassginedUser($customerId) { $resource = Mage::getSingleton('core/resource'); $writeConnection = $resource->getConnection('core_write'); $query = 'UPDATE customer_entity SET parent_id = 0 WHERE parent_id = '. $customerId; $writeConnection->query($query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remove_from_parent()\n {\n /* Cancel if there's nothing to do here */\n if (!$this->initially_was_account){\n return;\n }\n \n /* include global link_info */\n $ldap= $this->config->get_ldap_link();\n\n /* Remove and write to LDAP */\n plugin::remove_from_parent();\n\n /* Zero arrays */\n $this->attrs['scalixEmailAddress']= array();\n\n /* Unset fake boolean attributes from entry */\n foreach ($this->fakeBooleanAttributes as $val){\n $this->attrs[\"$val\"]= array();\n }\n\n /*unset scalixScalixObject*/\n $this->attrs['scalixScalixObject']=array();\n\n @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, \"Save\");\n $ldap->cd($this->dn);\n $ldap->modify($this->attrs);\n if (!$ldap->success()){\n msg_dialog::display(_(\"LDAP error\"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));\n }\n\n /* Optionally execute a command after we're done */\n $this->handle_post_events(\"remove\");\n }", "public function dissociate()\n {\n $this->farChild->setAttribute($this->firstKey, null);\n\n return $this->farChild->setRelation($this->relation, null);\n }", "public function unemploy(){\n unset($this->staffId);\n unset($this->store);\n $connection = new Connection();\n $link = $connection->connect();\n $link->exec(\"DELETE FROM staff WHERE user_id = '$this->id'\");\n $connection = null;\n }", "public function getParent()\n {\n return $this->user;\n }", "public function purge()\n {\n $this->owner()->where('current_organization_id', $this->id)\n ->update(['current_organization_id' => null]);\n\n $this->users()->where('current_organization_id', $this->id)\n ->update(['current_organization_id' => null]);\n\n $this->users()->detach();\n\n $this->delete();\n }", "function untrash() {\n try {\n DB::beginWork('Restoring company from a trash @ ' . __CLASS__);\n \n parent::untrash();\n\n $users = Users::findByCompany($this->object, null, STATE_TRASHED);\n if (is_foreachable($users)) {\n foreach ($users as $user) {\n if ($user->getState() == STATE_TRASHED) {\n if ($user instanceof IActivityLogs) {\n $user->activityLogs()->gag();\n } // if\n $user->state()->untrash();\n } // if\n } // foreach\n } // if\n\n AngieApplication::cache()->removeByModel('users');\n \n DB::commit('Company restored from a trash @ ' . __CLASS__);\n } catch(Exception $e) {\n DB::rollback('Failed to restore company from trash @ ' . __CLASS__);\n \n throw $e;\n } // try\n }", "function nf_revertToOriginalOwner($id) {\n global $_TABLES;\n\n if (DB_count($_TABLES['nfproductionassignments'],'id',$id)) {\n $sql = \"SELECT uid,assignBack_uid FROM {$_TABLES['nfproductionassignments']} WHERE id=$id\";\n $currentProdRec = DB_fetchArray(DB_query($sql));\n\n $sql = \"UPDATE {$_TABLES['nfproductionassignments']} SET uid={$currentProdRec['assignBack_uid']},assignBack_uid=0 \";\n $sql .= \"WHERE id=$id \";\n DB_query($sql);\n }\n\n}", "public function actionRevoke()\n\t{\n\t\t// We only allow deletion via POST request\n\t\tif( Yii::app()->request->isPostRequest===true )\n\t\t{\n\t\t\t$model = $this->loadModel();\n\t\t\t$childName = $this->getChildName();\n\n\t\t\tif( $childName!==null && $model->hasChild($childName)===true )\n\t\t\t\t$model->removeChild($childName);\n\n\t\t\t// if AJAX request, we should not redirect the browser\n\t\t\tif( isset($_POST['ajax'])===false )\n\t\t\t\t$this->redirect(array('authItem/permissions'));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthrow new CHttpException(400, Rights::t('core', 'Invalid request. Please do not repeat this request again.'));\n\t\t}\n\t}", "public function makeParent(): void\n {\n $this->parent = null;\n }", "public function remove() {\n\n // Updates DB (data & metadata)\n $this->attributes->removeAll($this->get(\"id\"));\n $this->db->delete(XCMS_Tables::TABLE_USERS, array(\n \"id\" => $this->get(\"id\")\n ));\n\n }", "function afterDelete() {\n \t\t$this->_ownerModel->deleteAll(array(\n \t\t\t\t'model' => $this->_Model->alias,\n \t\t\t\t'foreign_key' => $this->_Model->id,\n \t\t\t\t$this->settings[$this->_Model->alias]['userPrimaryKey'] => $this->_User,\n \t\t));\n\t\t}", "public function retract($user): void\n {\n $this->users()->detach($user);\n }", "public function uninstall($parent)\n {\n }", "public function purge(): void\n {\n $this->owner()->where('current_team_id', $this->id)\n ->update(['current_team_id' => null]);\n\n $this->users()->where('current_team_id', $this->id)\n ->update(['current_team_id' => null]);\n\n $this->users()->detach();\n\n $this->delete();\n }", "public function delete(Model $parent);", "public static function commandUnAssign(){\n\n self::$console->register('tasks:unassign')\n ->setDescription('Remove assigned user from a task')\n ->setDefinition(array(\n new InputArgument('taskid', InputArgument::REQUIRED, \"Task ID\"),\n new InputArgument('user', InputArgument::REQUIRED, \"User ID\")\n ))\n ->setCode(function (InputInterface $input, OutputInterface $output) {\n $taskid = (int) $input->getArgument(\"taskid\");\n $user = $input->getArgument(\"user\");\n\n if(!is_numeric($user)){\n //user didn't enter an id, search for the id by string:\n $usr = new UserCommands();\n $user = $usr->getUseridFromString($user);\n }\n\n $params = array(\n \"taskid\" => $taskid,\n \"userid\" => $user,\n \"modifyrecurrency\" => 0,\n \"isassignee\" => false,\n );\n $re = Task::AssignUserTask($params);\n print_r($re);\n\n });\n }", "public function removeUser()\n\t{\n\t\tif(isset($this->primarySearchData[$this->ref_user]))\n\t\t{\n\t\t\tunset($this->primarySearchData[$this->ref_user]);\n\t\t}\n\t}", "public function uninstall() {\n\t\t$this->load->model( 'user/user_group' );\n\t\t// access - modify pavomenu edit\n\t\t$this->model_user_user_group->removePermission( $this->user->getId(), 'access', 'extension/module/pavomenu/menu' );\n\t\t$this->model_user_user_group->removePermission( $this->user->getId(), 'modify', 'extension/module/pavomenu/menu' );\n\t\t// END REMOVE USER PERMISSION\n\t}", "public function unSetInheritance(){\n\t\t$pdo = Env::getDbConnectionForShare();\n\t\t$this->delete($pdo);\n\t\tself::updateInheritancesCache();\n\t}", "public function removeAssignments()\n {\n return Yii::$app->authManager->revokeAll($this->user->id);\n }", "public function userInverse()\n {\n return $this->belongsTo(User::class,'user_id','id');\n }", "function wp_delete_signup_on_user_delete($id, $reassign, $user)\n {\n }", "public function cancelled_by()\n {\n return $this->belongsTo(User::class);\n }", "function ihc_delete_user_level_relation($l_id=FALSE, $u_id=FALSE){\n\tif ($u_id && $l_id){\n\t\t$levels_str = get_user_meta($u_id, 'ihc_user_levels', true);\n\t\t$levels_arr = explode(',', $levels_str);\n\t\tif (!is_array($l_id)){\n\t\t\t$lid_arr[] = $l_id;\n\t\t}\n\t\t$levels_arr = array_diff($levels_arr, $lid_arr);\n\t\t$levels_str = implode(',', $levels_arr);\n\t\tupdate_user_meta($u_id, 'ihc_user_levels', $levels_str);\n\t\tglobal $wpdb;\n\t\t$table_name = $wpdb->prefix . \"ihc_user_levels\";\n\t\t$u_id = esc_sql($u_id);\n\t\t$l_id = esc_sql($l_id);\n\t\t$wpdb->query('DELETE FROM ' . $table_name . ' WHERE user_id=\"'.$u_id.'\" AND level_id=\"'.$l_id.'\";');\n\t\tihc_downgrade_levels_when_expire($u_id, $l_id);\n\n\t\tdo_action('ihc_action_after_subscription_delete', $u_id, $l_id);\n\t}\n}", "public function revokeUser(Request $request)\n {\n $group = Group::find($request->groupId);\n $group->users()->detach($request->userId);\n return redirect()->back();\n }", "public function uninstall($parent)\n\t{\n\t}", "public function removeUserFromGroup(){\n //Gets the id frim the input\n $removeId = $_GET[\"input\"];\n //This model removes the connection record from the table\n $this->individualGroupModel->removeUserFromTheGroup($removeId);\n }", "function beSelf(){\r\n\t\t$_SESSION['userid'] = $_SESSION['realUserId'];\r\n\t\t$_SESSION['roleid'] = $_SESSION['realRoleId'];\r\n\t\tunset( $_SESSION['realRoleId'] );\r\n\t\tunset( $_SESSION['realUserId'] );\r\n\t}", "public function destroy(User $user)\n {\n $user->delete();\n $user->specializations()->detach();\n\n return redirect(url('login'));\n }", "public function unimpersonateUser()\n {\n $realId = $this->session->remove('__realId');\n if ($realId !== null) {\n $this->user->identity->remove();\n $this->session->set($this->user->idParam, $realId);\n $identity = User::findOne($realId);\n $this->user->setIdentity($identity);\n $this->restoreBackedUpToken();\n }\n }" ]
[ "0.67111224", "0.5984325", "0.5945639", "0.5759665", "0.5711497", "0.5686699", "0.5667659", "0.5635568", "0.5633572", "0.5625246", "0.5597532", "0.5593291", "0.55842894", "0.5563203", "0.55456454", "0.55262077", "0.5514139", "0.55074096", "0.5491041", "0.5482948", "0.5476212", "0.5469266", "0.54517776", "0.54409045", "0.54191947", "0.5415132", "0.54118025", "0.53996444", "0.539897", "0.5398356" ]
0.6470636
1
add_filter( 'dentario_filter_importer_required_plugins','dentario_instagram_feed_importer_required_plugins', 10, 2 );
function dentario_instagram_feed_importer_required_plugins($not_installed='', $list='') { //if (in_array('instagram_feed', dentario_storage_get('required_plugins')) && !dentario_exists_instagram_feed() ) if (dentario_strpos($list, 'instagram_feed')!==false && !dentario_exists_instagram_feed() ) $not_installed .= '<br>Instagram Feed'; return $not_installed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run_blossomthemes_instagram_feed() {\r\n\r\n\t$plugin = new Blossomthemes_Instagram_Feed();\r\n\t$plugin->run();\r\n\r\n}", "function activate_blossomthemes_instagram_feed() {\r\n\trequire_once plugin_dir_path( __FILE__ ) . 'includes/class-blossomthemes-instagram-feed-activator.php';\r\n\tBlossomthemes_Instagram_Feed_Activator::activate();\r\n}", "function planmyday_instagram_widget_importer_required_plugins($not_installed='', $list='') {\n\t\tif (planmyday_strpos($list, 'instagram_widget')!==false && !planmyday_exists_instagram_widget() )\n\t\t\t$not_installed .= '<br>' . esc_html__('WP Instagram Widget', 'planmyday');\n\t\treturn $not_installed;\n\t}", "function setup() {\n\tadd_filter( 'intermediate_image_sizes_advanced', __NAMESPACE__ . '\\\\disable_upload_sizes', 10, 2 );\n\tadd_filter( 'post_thumbnail_size', __NAMESPACE__ . '\\\\force_full_size_gifs', 10, 1 );\n}", "function add_filters()\n {\n }", "function run_plugins_rss_feed() {\n\n\t$plugin = new Plugins_rss_feed();\n\t$plugin->run();\n\n\tadd_action( 'init', 'customRSS' );\n\tadd_filter( 'feed_content_type', 'authenticateRSS', 10, 2 );\n\tadd_action( 'customRSS', 'my_check_feed_auth', 1 );\n\n}", "function customRSS() {\n add_feed('active_plugins', 'createPluginRssFeed');\n}", "function spreadshop_imprint()\n{\ninclude(plugin_dir_path(__FILE__).'/imprint.php');\nadd_filter('wp_head', 'sources');\n}", "function add_filter($tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1)\n {\n }", "function wp_get_popular_importers()\n {\n }", "public static function init() {\n\t\tadd_filter( 'attachment_fields_to_edit', array( self::$class_name, 'apply_filter_attachment_fields_to_edit' ), null, 2 );\n\n\t\t// Add the filter for saving the custom url field\n\t\tadd_filter( 'attachment_fields_to_save', array( self::$class_name, 'apply_filter_attachment_fields_to_save' ), null , 2 );\n\n\t\t// Add the filter for when the post_gallery is written out\n\t\tadd_filter( 'post_gallery', array( self::$class_name, 'apply_filter_post_gallery' ), 999, 2 );\n\n\n\t}", "private function hooks() {\n\n\t\t$plugin_admin = shortbuild_bu_hooks();\n add_filter( 'advanced_import_demo_lists', array( $plugin_admin, 'add_demo_lists' ), 10, 1 );\n add_filter( 'admin_menu', array( $plugin_admin, 'import_menu' ), 10, 1 );\n add_filter( 'wp_ajax_shortbuild_bu_getting_started', array( $plugin_admin, 'install_advanced_import' ), 10, 1 );\n add_filter( 'admin_enqueue_scripts', array( $plugin_admin, 'enqueue_styles' ), 10, 1 );\n add_filter( 'admin_enqueue_scripts', array( $plugin_admin, 'enqueue_scripts' ), 10, 1 );\n\n /*Replace terms and post ids*/\n add_action( 'advanced_import_replace_term_ids', array( $plugin_admin, 'replace_term_ids' ), 20 );\n }", "function register_importer() {\n\t\tglobal $wp_importers;\n\n\t\tif( ! isset( $wp_importers['wgobd_the_events_calendar'] ) ) {\n\t\t\t$wp_importers['wgobd_the_events_calendar'] = array(\n\t\t\t\t__( 'The Events Calendar → All-in-One Event Calendar', wgobd_PLUGIN_NAME ),\n\t\t\t\t__( 'Imports events created using The Events Calendar plugin into the All-in-One Event Calendar', wgobd_PLUGIN_NAME ),\n\t\t\t\tarray( &$this, 'import_the_events_calendar' )\n\t\t\t);\n\t\t}\n\t}", "function wp_rss_multi_importer_shortcode($atts=array()){\n\t\n\n\t\n\t\n\n\t\nadd_action('wp_footer','rssmi_footer_scripts');\n\nif(!function_exists(\"wprssmi_hourly_feed\")) {\nfunction wprssmi_hourly_feed() { return 0; }\n}\nadd_filter( 'wp_feed_cache_transient_lifetime', 'wprssmi_hourly_feed' );\n\n\n\t\n\t$siteurl= get_site_url();\n $cat_options_url = $siteurl . '/wp-admin/options-general.php?page=wp_rss_multi_importer_admin&tab=category_options/';\n\t$images_url = $siteurl . '/wp-content/plugins/' . basename(dirname(__FILE__)) . '/images';\t\n\t\n\tglobal $fopenIsSet;\n\t$fopenIsSet = ini_get('allow_url_fopen');\n\t\n\t$parms = shortcode_atts(array( //Get shortcode parameters\n\t\t'category' => 0, \n\t\t'hdsize' => '16px', \n\t\t'hdweight'=>400, \n\t\t'anchorcolor' =>'',\n\t\t'testyle'=>'color: #000000; font-weight: bold;margin: 0 0 0.8125em;',\n\t\t'maximgwidth'=> 150,\n\t\t'datestyle'=>'font-style:italic;',\n\t\t'floattype'=>'',\n\t\t'showdate' => 1,\n\t\t'showgroup'=> 1,\n\t\t'thisfeed'=>'',\n\t\t'timer' => 0, \n\t\t'dumpthis' =>0,\n\t\t'cachetime'=>NULL,\n\t\t'pinterest'=>0,\n\t\t'maxperpage' =>0,\n\t\t'excerptlength'=>NULL,\n\t\t'noimage' => 0,\n\t\t'sortorder' => NULL,\n\t\t'defaultimage' => NULL,\n\t\t'showdesc' => NULL,\n\t\t'mytemplate' =>'',\n\t\t'showmore'=>NULL,\n\t\t'warnmsg'=>NULL,\n\t\t'nofollow'=>NULL,\n\t\t'sourcename'=>'',\n\t\t'authorprep'=>'by',\n\t\t'windowstyle'=>NULL,\n\t\t'morestyle' =>'[...]'\n\t\t), $atts);\n\t\t\n\t$showThisDesc=$parms['showdesc'];\t\n\t$defaultImage=$parms['defaultimage'];\n\t$sortOrder=$parms['sortorder'];\t\n\t$authorPrep=$parms['authorprep'];\n\t$anchorcolor=$parms['anchorcolor'];\n\t$datestyle=$parms['datestyle'];\n\t$hdsize = $parms['hdsize'];\n $thisCat = $parms['category'];\n\t$parmfloat=$parms['floattype'];\n\t$catArray=explode(\",\",$thisCat);\n\t$showdate=$parms['showdate'];\n\t$showgroup=$parms['showgroup'];\n\t$pshowmore=$parms['showmore'];\n\t$hdweight = $parms['hdweight'];\n\t$testyle = $parms['testyle'];\n\tglobal $morestyle;\n $morestyle = $parms['morestyle'];\n\t$warnmsg= $parms['warnmsg'];\n\tglobal $maximgwidth;\n\t$maximgwidth = $parms['maximgwidth'];\n\t$thisfeed = $parms['thisfeed']; // max posts per feed\n\t$timerstop = $parms['timer'];\n\t$dumpthis= $parms['dumpthis']; //diagnostic parameter\n\t$cachename='wprssmi_'.$thisCat;\n\t$cachetime=$parms['cachetime'];\n\t$pinterest=$parms['pinterest'];\n\t$parmmaxperpage=$parms['maxperpage'];\n\t$pnofollow=$parms['nofollow'];\n\t$noimage=$parms['noimage'];\n\t$mytemplate=$parms['mytemplate'];\n\t$windowstyle=$parms['windowstyle'];\n\t$excerptlength=$parms['excerptlength'];\n\t$parsourcename=$parms['sourcename'];\n \t$readable = '';\n \t$options = get_option('rss_import_options');\n\t$option_items = get_option('rss_import_items');\n\t$option_category_images = get_option('rss_import_categories_images');\n\n\tif ($option_items==false ) return _e(\"You need to set up the WP RSS Multi Importer Plugin before any results will show here. Just go into the <a href='/wp-admin/options-general.php?page=wp_rss_multi_importer_admin'>settings panel</a> and put in some RSS feeds\", 'wp-rss-multi-importer');\n\n\n\n$cat_array = preg_grep(\"^feed_cat_^\", array_keys($option_items));\n\n\tif (count($cat_array)==0) { // for backward compatibility\n\t\t$noExistCat=1;\n\t}else{\n\t\t$noExistCat=0;\t\n\t}\n\n\n\n \n if(!empty($option_items)){\n\t\n//GET PARAMETERS \nglobal $RSSdefaultImage;\n$RSSdefaultImage=(isset($options['RSSdefaultImage']) ? $options['RSSdefaultImage'] : 0); // 0- process normally, 1=use default for category, 2=replace when no image available\n$size = count($option_items);\n$sortDir=$options['sortbydate']; // 1 is ascending\n$stripAll=(isset($options['stripAll']) ? $options['stripAll'] : 0);\n$stripSome=(isset($options['stripSome']) ? $options['stripSome'] : null);\n$todaybefore=(isset($options['todaybefore']) ? $options['todaybefore'] : 0);\n$adjustImageSize=(isset($options['adjustImageSize']) ? $options['adjustImageSize'] : null);\n$showDesc=$options['showdesc']; // 1 is show\n$descNum=$options['descnum'];\n$maxperPage=(isset($options['maxperPage']) ? $options['maxperPage'] : 5);\n$showcategory=(isset($options['showcategory']) ? $options['showcategory'] : 0);\n$cacheMin=(isset($options['cacheMin']) ? $options['cacheMin'] : 0);\n$maxposts=$options['maxfeed'];\n$showsocial=(isset($options['showsocial']) ? $options['showsocial'] : 0);\n$targetWindow=$options['targetWindow']; // 0=LB, 1=same, 2=new\n$floatType=(isset($options['floatType']) ? $options['floatType'] : 0);\n$noFollow=(isset($options['noFollow']) ? $options['noFollow'] : 0);\n$showmore=(isset($options['showmore']) ? $options['showmore'] : 0);\n$cb=(isset($options['cb']) ? $options['cb'] : null); // 1 if colorbox should not be loaded\n$pag=$options['pag']; // 1 if pagination 2 or 3 if load more\n$perPage=(isset($options['perPage']) ? $options['perPage'] : 5);\nglobal $anyimage;\n$anyimage=(isset($options['anyimage']) ? $options['anyimage'] : 0);\n$addAuthor=(isset($options['addAuthor']) ? $options['addAuthor'] : 0);\n$warnmsg=(isset($options['warnmsg']) ? $options['warnmsg'] : 0);\n$directFetch=(isset($options['directFetch']) ? $options['directFetch'] : 0);\n$forceFeed=(isset($options['forceFeed']) ? $options['forceFeed'] : 0);\n$forceFeed= ($forceFeed==1 ? True:False);\n$timeout=(isset($options['timeout']) ? $options['timeout'] : 10);\nif (!isset($timeout)) {$timeout=10;}\nif (!isset($directFetch)) {$directFetch=0;}\n\nif(!is_null($defaultImage)){$RSSdefaultImage=$defaultImage;}\n\nif(!is_null($windowstyle)){$targetWindow=$windowstyle;}\n\nif(!is_null($showThisDesc)){$showDesc=$showThisDesc;}\n\nif(!is_null($sortOrder)){$sortDir=$sortOrder;}\n\nif (!is_null($pshowmore)) {$showmore=$pshowmore;} \n\nif (!is_null($excerptlength)) {$descNum=$excerptlength;} \n\nif (!is_null($pnofollow)) {$noFollow=$pnofollow;} \n\nif(empty($options['sourcename'])){\n\t$attribution='';\n}else{\n\t$attribution=$options['sourcename'].' ';\n}\n\nif ($parsourcename!='') $attribution=$parsourcename;\n\n\nif ($floatType=='1'){\n\t$float=\"left\";\n}else{\n\t$float=\"none\";\t\n}\n\n\n\tif ($parmfloat!='') $float=$parmfloat;\n\tif($parmmaxperpage!=0) $maxperPage=$parmmaxperpage;\n\tif ($noimage==1) $stripAll=1;\n\tif ($thisfeed!='') $maxposts=$thisfeed;\n\n\tif ($pinterest==1){\n\t\t$divfloat=\"left\";\n\t}else{\n\t\t$divfloat='';\t\n\t}\n\n\tif ($cacheMin==''){$cacheMin=0;} //set caching minutes\t\n\n\n\tif (!is_null($cachetime)) {$cacheMin=$cachetime;} //override caching minutes with shortcode parameter\t\n\n\n\n\tif (is_null($cb) && $targetWindow==0){\n\t\t\tadd_action('wp_footer','colorbox_scripts'); // load colorbox only if not indicated as conflict\n \t\t}\n\n$template=$options['template'];\nif ($mytemplate!='') $template=$mytemplate;\n\n//\tEND PARAMETERS\n\t\n\n\n\n\ntimer_start(); //TIMER START - for testing purposes\n\n\n\t$myarray=get_transient($cachename); // added for transient cache\n\t\n\tif ($cacheMin==0){\n\t\tdelete_transient($cachename); \n\t}\n\t\n if (false===$myarray) { // added for transient cache - only get feeds and put into array if the array isn't cached (for a given category set)\n\n\n\n for ($i=1;$i<=$size;$i=$i+1){\n\n\t\n\n \t\t\t$key =key($option_items);\n\t\t\t\tif ( !strpos( $key, '_' ) > 0 ) continue; //this makes sure only feeds are included here...everything else are options\n\t\t\t\t\n \t\t\t$rssName= $option_items[$key];\n\n \n \t\t\tnext($option_items);\n \t\t\t\n \t\t\t$key =key($option_items);\n \t\t\t\n \t\t\t$rssURL=$option_items[$key];\n\n\n\n \tnext($option_items);\n\t$key =key($option_items);\n\t\n $rssCatID=$option_items[$key]; ///this should be the category ID\n\n\n\nif (((!in_array(0, $catArray ) && in_array($option_items[$key], $catArray ))) || in_array(0, $catArray ) || $noExistCat==1) {\n\n\n$myfeeds[] = array(\"FeedName\"=>$rssName,\"FeedURL\"=>$rssURL,\"FeedCatID\"=>$rssCatID); //with Feed Category ID\n\n\t\n}\n \n$cat_array = preg_grep(\"^feed_cat_^\", array_keys($option_items)); // for backward compatibility\n\n\tif (count($cat_array)>0) {\n\n next($option_items); //skip feed category\n}\n\n }\n\n if ($maxposts==\"\") return _e(\"One more step...go into the the <a href='/wp-admin/options-general.php?page=wp_rss_multi_importer_admin&tab=setting_options'>Settings Panel and choose Options.</a>\", 'wp-rss-multi-importer'); // check to confirm they set options\n\nif (empty($myfeeds)){\n\t\n\treturn _e(\"You've either entered a category ID that doesn't exist or have no feeds configured for this category. Edit the shortcode on this page with a category ID that exists, or <a href=\".$cat_options_url.\">go here and and get an ID</a> that does exist in your admin panel.\", 'wp-rss-multi-importer');\n\texit;\n}\n\n\nif ($dumpthis==1){\nrssmi_list_the_plugins();\n\techo \"<strong>Feeds</strong><br>\";\n\tvar_dump($myfeeds);\n}\n\n\n\n foreach($myfeeds as $feeditem){\n\n\n\t$url=(string)($feeditem[\"FeedURL\"]);\n\n\t\n\twhile ( stristr($url, 'http') != $url )\n\t\t$url = substr($url, 1);\n\nif (empty($url)) {continue;}\n\n\n\t$url = esc_url_raw(strip_tags($url));\n\t\n\n\t\t\tif ($directFetch==1){\n\t\t\t\t$feed = wp_rss_fetchFeed($url,$timeout,$forceFeed);\n\t\t\t}else{\n\t\t\t\t$feed = fetch_feed($url);\n\t\t\t}\n\t\n\n\n\tif (is_wp_error( $feed ) ) {\n\t\n\t\tif ($dumpthis==1){\n\t\t\t\techo $feed->get_error_message();\n\t\t\t\t}\t\n\t\tif ($size<4){\n\t\t\treturn _e(\"There is a problem with the feeds you entered. Go to our <a href='http://www.wprssimporter.com/faqs/im-told-the-feed-isnt-valid-or-working/'>support page</a> to see how to solve this.\", 'wp-rss-multi-importer');\n\t\t\texit;\n\n\t\t}else{\n\t//echo $feed->get_error_message();\t\n\t\tcontinue;\n\t\t}\n\t}\n\t\n\t$maxfeed= $feed->get_item_quantity(0); \n\t\n\n\tif ($feedAuthor = $feed->get_author())\n\t{\n\t\n\t\t$feedAuthor=$feed->get_author()->get_name();\n\t}\n\t\n\tif ($feedHomePage=$feed->get_link()){\n\t\t$feedHomePage=$feed->get_link();\n\n\t}\n\n\n\n//SORT DEPENDING ON SETTINGS\n\n\tif($sortDir==1){\n\t\t\n\t\n\n\t\tfor ($i=$maxfeed-1;$i>=$maxfeed-$maxposts;$i--){\n\t\t\t$item = $feed->get_item($i);\n\t\t\t if (empty($item))\tcontinue;\n\t\t\t\t\t\n\t\t\t\t$thisTitle= html_entity_decode($item->get_title(),ENT_QUOTES,'UTF-8');\n\t\t\n\t\t\t\tif(include_post($feeditem[\"FeedCatID\"],$item->get_content(),$thisTitle)==0) continue; // FILTER \t\t\n\t\t\t\t\t\n\t\t\t\t\t\tif ($enclosure = $item->get_enclosure()){\n\t\t\t\t\t\t\tif(!IS_NULL($item->get_enclosure()->get_thumbnail())){\t\t\t\n\t\t\t\t\t\t\t\t$mediaImage=$item->get_enclosure()->get_thumbnail();\n\t\t\t\t\t\t\t}else if (!IS_NULL($item->get_enclosure()->get_link())){\n\t\t\t\t\t\t\t\t$mediaImage=$item->get_enclosure()->get_link();\t\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$mediaImage=null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($itemAuthor = $item->get_author())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$itemAuthor=(!IS_NULL($item->get_author()->get_name()) ? $item->get_author()->get_name() : $item->get_author()->get_email());\n\t\t\t\t\t\t\t$itemAuthor=html_entity_decode($itemAuthor,ENT_QUOTES,'UTF-8');\t\n\t\t\t\t\t\t}else if (!IS_NULL($feedAuthor)){\n\t\t\t\t\t\t\t$itemAuthor=$feedAuthor;\n\t\t\t\t\t\t\t$itemAuthor=html_entity_decode($itemAuthor,ENT_QUOTES,'UTF-8');\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t$myarray[] = array(\"mystrdate\"=>strtotime($item->get_date()),\"mytitle\"=>$thisTitle,\"mylink\"=>$item->get_link(),\"myGroup\"=>$feeditem[\"FeedName\"],\"mydesc\"=>$item->get_content(),\"myimage\"=>$mediaImage,\"mycatid\"=>$feeditem[\"FeedCatID\"],\"myAuthor\"=>$itemAuthor,\"itemcategory\"=>$item->get_category());\n\t\t\t\t\n\t\t\t\t\t\tunset($mediaImage);\n\t\t\t\t\t\tunset($itemAuthor);\n\t\t\t\t\t\n\t\t\t}\n\n\t\t}else{\t\n\n\t\tfor ($i=0;$i<=$maxposts-1;$i++){\n\t\t\t\t$item = $feed->get_item($i);\n\t\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\tif (empty($item))\tcontinue;\t\n\t\t\t\t\n\t\t\t\t\t$thisTitle= html_entity_decode($item->get_title(),ENT_QUOTES,'UTF-8');\t\t\n\t\n\tif(include_post($feeditem[\"FeedCatID\"],$item->get_content(),$thisTitle)==0) continue; // FILTER \n\n\t\t\t\n\t\t\tif ($enclosure = $item->get_enclosure()){\n\t\t\t\t\n\t\t\t\tif(!IS_NULL($item->get_enclosure()->get_thumbnail())){\t\n\t\t\t\t\n\t\t\t\t\t$mediaImage=$item->get_enclosure()->get_thumbnail();\n\t\t\t\t}else if (!IS_NULL($item->get_enclosure()->get_link())){\n\t\t\t\t\t$mediaImage=$item->get_enclosure()->get_link();\t\n\t\t\t\t}else{\n\t\t\t\t\t$mediaImage=null;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\n\n\t\t\t\n\t\t\t\n\t\t\tif ($itemAuthor = $item->get_author())\n\t\t\t{\n\t\t\t\t$itemAuthor=(!IS_NULL($item->get_author()->get_name()) ? $item->get_author()->get_name() : $item->get_author()->get_email());\n\t\t\t\t$itemAuthor=html_entity_decode($itemAuthor,ENT_QUOTES,'UTF-8');\t\n\t\t\t}else if (!IS_NULL($feedAuthor)){\n\t\t\t\t$itemAuthor=$feedAuthor;\n\t\t\t\t$itemAuthor=html_entity_decode($itemAuthor,ENT_QUOTES,'UTF-8');\t\t\n\t\t\t}\n\t\t\t\n\t\t\n\t\n\t\t\t$myarray[] = array(\"mystrdate\"=>strtotime($item->get_date()),\"mytitle\"=>$thisTitle,\"mylink\"=>$item->get_link(),\"myGroup\"=>$feeditem[\"FeedName\"],\"mydesc\"=>$item->get_content(),\"myimage\"=>$mediaImage,\"mycatid\"=>$feeditem[\"FeedCatID\"],\"myAuthor\"=>$itemAuthor,\"itemcategory\"=>$item->get_category());\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tunset($mediaImage);\n\t\t\t\t\t\tunset($itemAuthor);\n\t\t\t\t}\t\n\t\t}\n\n\n\t}\n\n\n\n\n\nif ($cacheMin!==0){\nset_transient($cachename, $myarray, 60*$cacheMin); // added for transient cache\n}\n\n} // added for transient cache\n\nif ($timerstop==1){\n timer_stop(1); echo ' seconds<br>'; //TIMER END for testing purposes\n}\n\n\n\n\n\n// CHECK $myarray BEFORE DOING ANYTHING ELSE //\n\nif ($dumpthis==1){\n\techo \"<br><strong>Array</strong><br>\";\n\tvar_dump($myarray);\n\treturn;\n}\nif (!isset($myarray) || empty($myarray)){\n\tif(!$warnmsg==1 && current_user_can('edit_post')){\n\t\n\treturn _e(\"There is a problem with the feeds you entered. Go to our <a href='http://www.wprssimporter.com/faqs/im-told-the-feed-isnt-valid-or-working/'>support page</a> to see how to solve this.\", 'wp-rss-multi-importer');\n\t}\n\treturn;\n}\n\nglobal $isMobileDevice;\nif (isset($isMobileDevice) && $isMobileDevice==1){ //open mobile device windows in new tab\n\t$targetWindow=2;\n\t\n\t}\n\n\n\n//$myarrary sorted by mystrdate\n\nforeach ($myarray as $key => $row) {\n $dates[$key] = $row[\"mystrdate\"]; \n}\n\n\n\n//SORT, DEPENDING ON SETTINGS\n\nif($sortDir==1){\n\tarray_multisort($dates, SORT_ASC, $myarray);\n}elseif ($sortDir==0){\n\tarray_multisort($dates, SORT_DESC, $myarray);\t\t\n}\n\n// HOW THE LINK OPENS\n\nif($targetWindow==0){\n\t$openWindow='class=\"colorbox\"';\n}elseif ($targetWindow==1){\n\t$openWindow='target=\"_self\"';\t\t\n}else{\n\t$openWindow='target=\"_blank\"';\t\n}\n\t\n$total = -1;\n$todayStamp=0;\n$idnum=0;\n\n//for pagination\n\n$currentPage = (isset($_REQUEST['pg']) ? trim($_REQUEST['pg']): 0);\n$currentURL = $_SERVER[\"HTTP_HOST\"] . $_SERVER[\"REQUEST_URI\"]; \n$currentURL = str_replace( '&pg='.$currentPage, '', $currentURL );\n$currentURL = str_replace( '?pg='.$currentPage, '', $currentURL );\n\n\nif ( strpos( $currentURL, '?' ) == 0 ){\n\t$currentURL=$currentURL.'?';\n}else{\n\t$currentURL=$currentURL.'&';\t\n}\n\n\n//pagination controls and parameters\n\n\n\n\n\nif (!isset($perPage)){$perPage=5;}\n\n$numPages = ceil(count($myarray) / $perPage);\nif(!$currentPage || $currentPage > $numPages) \n $currentPage = 0;\n$start = $currentPage * $perPage; \n$end = ($currentPage * $perPage) + $perPage;\n\n\t\n\t\tif ($pag==1 || $pag==2 || $pag==3){ //set up pagination array and put into myarray\n\tforeach($myarray AS $key => $val) \n\t\t{ \n\t if($key >= $start && $key < $end) \n\t $pagedData[] = $myarray[$key]; \n\t\t}\n\t\t\n\t\t\t$myarray=$pagedData;\n\t}\n //end set up pagination array and put into myarray\n\n\n\n\t\n// templates checked and added here\n\n\tif (!isset($template) || $template=='') {\n\treturn _e(\"One more step...go into the <a href='/wp-admin/options-general.php?page=wp_rss_multi_importer_admin&tab=setting_options'>Settings Panel and choose a Template.</a>\", 'wp-rss-multi-importer');\n\t}\n\n\trequire( WP_RSS_MULTI_TEMPLATES . $template );\n\n\n}\n\nif ($pag==2 || $pag==3){\n\t\t \nadd_action('rssmi_load_more_data', 'rssmi_pbd_alp_init',10,5);\nif (strpos($currentURL,'http')==0){\n$nextPost='http://'.$currentURL.'pg=' . ($currentPage+1);\n}else{\n$nextPost=$currentURL.'pg=' . ($currentPage+1);\t\n}\ndo_action('rssmi_load_more_data',$numPages,$currentPage,$nextPost,WP_RSS_MULTI_IMAGES,$pag); \n}\n\n\n\t//pagination controls at bottom - will be suppressed with Load More option, but only for users with javascript\n\n\tif (($pag==1 || $pag==2 || $pag==3) && $numPages>1){\n\n\t\t\t$readable .='<div class=\"rssmi_pagination\"><ul>';\n\t\t\n\t\tfor($q=0;$q<$numPages;$q++){\n\t\t\tif($currentPage>0 && $q==0){$readable .='<li class=\"prev\"><a href=\"http://'.$currentURL.'pg=' . ($currentPage-1) . '\">Prev</a></li>';}\n\t\t\tif($currentPage<>$q){\n\t\t\t\t$readable .= '<li><a href=\"http://'.$currentURL.'pg=' . ($q) . '\"> '.__($q+1, 'wp-rss-multi-importer').'</a></li>'; \n\t\t\t}else{\n\t\t\t\t$readable .='<li class=\"active\"><a href=\"#\">'.($q+1).'</a></li>';\n\t\t\t}\n\t\tif( $q==$numPages-1 && $currentPage<>$numPages-1){$readable .='<li class=\"next\"><a href=\"http://'.$currentURL.'pg=' . ($currentPage+1) . '\">Next</a></li>';}\n\t\t}\n\t\t\t$readable .='</ul></div>';\n\t\t\n\t}\t\n\t\t//end pagination controls at bottom\n\n\nreturn $readable;\n\n }", "private function init_hooks(){ \r\n add_filter('parse_query',array($this,'bamobile_mobiconnector_add_type_to_posts_rest_api'));\r\n add_action('init',array($this,'bamobile_mobiconnector_add_show_in_rest_to_post_type'), 25);\r\n add_filter('rest_request_after_callbacks',array($this,'bamobile_mobiconnector_change_response_post_details'), 10, 3 );\r\n add_filter('rest_request_after_callbacks',array($this, 'bamobile_change_error_max_page'), 10, 3 );\t\r\n }", "function add_filter($name, $callback, $priority = 10)\n{\n if ($pluginBroker = get_plugin_broker()) {\n $pluginBroker->addFilter($name, $callback, $priority);\n }\n}", "function activate_plugins_rss_feed() {\n\trequire_once plugin_dir_path( __FILE__ ) . 'includes/class-plugins_rss_feed-activator.php';\n\tPlugins_rss_feed_Activator::activate();\n}", "function dk_speakup_loadimporter(){\n\t\tif(function_exists('dk_speakup_meta_links')){\n\t\t\tload_plugin_textdomain( 'speakupimport', false, 'speakup-email-petitions-importer/languages' );\n\t\t\tinclude_once( dirname( __FILE__ ) . '/class.importer.php' );\n\t\t\tadd_action( 'admin_enqueue_scripts', array( 'dk_Speakup_Import', 'scripts'));\n\t\t\t\n\t\t\tadd_action('admin_menu', array( 'dk_Speakup_Import', 'menu'),1000);\n\t\t}\n\t}", "function acf_enable_filters($filters = array())\n{\n}", "function santo_flickr_gallery_shortcode_exist() {\r\n\t\tadd_action( 'wp_footer', 'santo_flickr_js',100 );\r\n\t\tadd_action( 'wp_enqueue_scripts', 'santo_flickr_scripting' );\r\n}", "function filter_load() {\r\n\t\tadd_action( current_filter(), array( $this, 'setup_vars' ), 20 );\r\n\t\tadd_action( 'restrict_manage_posts', array( $this, 'get_select' ) );\r\n\t\tadd_filter( \"manage_taxonomies_for_{$this->post_type}_columns\", array( $this, 'add_columns' ) );\r\n\t}", "function spreadshop_assortment()\n{\ninclude(plugin_dir_path(__FILE__).'/spreadassortment.php');\nadd_filter('wp_head', 'sources');\n}", "public static function init() {\n // hook into linkback functions to add more semantics\n add_action('pingback_post', array( 'SemanticLinkbacksPlugin', 'linkback_fix' ));\n add_action('trackback_post', array( 'SemanticLinkbacksPlugin', 'linkback_fix' ));\n add_action('webmention_post', array( 'SemanticLinkbacksPlugin', 'linkback_fix' ));\n\n add_filter('get_avatar', array( 'SemanticLinkbacksPlugin', 'get_avatar'), 11, 5);\n add_filter('comment_text', array( 'SemanticLinkbacksPlugin', 'comment_text_add_cite'), 11, 3);\n add_filter('comment_text', array( 'SemanticLinkbacksPlugin', 'comment_text_excerpt'), 12, 3);\n add_filter('get_comment_link', array( 'SemanticLinkbacksPlugin', 'get_comment_link' ), 99, 3);\n add_filter('get_comment_author_url', array( 'SemanticLinkbacksPlugin', 'get_comment_author_url' ), 99, 3);\n add_filter('get_avatar_comment_types', array( 'SemanticLinkbacksPlugin', 'get_avatar_comment_types' ));\n }", "function add_field_filter($tag = '', $function_to_add = '', $priority = 10, $accepted_args = 1)\n {\n }", "function ucf_provostnews_rss_feed_template(){\n\n require_once( plugin_dir_path( __DIR__ ) . 'rss-feed-template.php' );\n\n}", "public function addFilters() {\n\t\t// $this->subscriber->addFilter( 'mdm_syndication_post_fields', [$this, 'addCustomFields'] );\n\t}", "private function setup_filters() {\n\n\t\tadd_filter( 'pre_option_posts_per_page', array( $this, 'filter_posts_per_page' ) );\n\n\t\tadd_filter( 'plugins_url', array( $this, 'filter_plugins_url' ) );\n\n\t}", "function dacig_register_filters( $output ) {\n\tadd_filter( 'pre_get_posts', 'dacig_allow_filters' );\n\tadd_filter( 'the_posts', 'dacig_modify_the_posts' );\n\n\treturn $output;\n}", "function svl_gallery_func() {\n\n\t$labels = array(\n\t\t'name' => _x( 'Gallery Filter', 'Post Type General Name', 'devvn' ),\n\t\t'singular_name' => _x( 'Gallery Filter', 'Post Type Singular Name', 'devvn' ),\n\t\t'menu_name' => __( 'Gallery Filter', 'devvn' ),\n\t\t'name_admin_bar' => __( 'Gallery Filter', 'devvn' ),\n\t\t'archives' => __( 'Gallery', 'devvn' ),\n\t\t'attributes' => __( 'Item Attributes', 'devvn' ),\n\t\t'parent_item_colon' => __( 'Parent Item:', 'devvn' ),\n\t\t'all_items' => __( 'All Items', 'devvn' ),\n\t\t'add_new_item' => __( 'Add New Item', 'devvn' ),\n\t\t'add_new' => __( 'Add New', 'devvn' ),\n\t\t'new_item' => __( 'New Item', 'devvn' ),\n\t\t'edit_item' => __( 'Edit Item', 'devvn' ),\n\t\t'update_item' => __( 'Update Item', 'devvn' ),\n\t\t'view_item' => __( 'View Item', 'devvn' ),\n\t\t'view_items' => __( 'View Items', 'devvn' ),\n\t\t'search_items' => __( 'Search Item', 'devvn' ),\n\t\t'not_found' => __( 'Not found', 'devvn' ),\n\t\t'not_found_in_trash' => __( 'Not found in Trash', 'devvn' ),\n\t\t'featured_image' => __( 'Featured Image', 'devvn' ),\n\t\t'set_featured_image' => __( 'Set featured image', 'devvn' ),\n\t\t'remove_featured_image' => __( 'Remove featured image', 'devvn' ),\n\t\t'use_featured_image' => __( 'Use as featured image', 'devvn' ),\n\t\t'insert_into_item' => __( 'Insert into item', 'devvn' ),\n\t\t'uploaded_to_this_item' => __( 'Uploaded to this item', 'devvn' ),\n\t\t'items_list' => __( 'Items list', 'devvn' ),\n\t\t'items_list_navigation' => __( 'Items list navigation', 'devvn' ),\n\t\t'filter_items_list' => __( 'Filter items list', 'devvn' ),\n\t);\n\t$rewrite = array(\n\t\t'slug' => 'exhibitor-catalogue',\n\t\t'with_front' => true,\n\t\t'pages' => true,\n\t\t'feeds' => false,\n\t);\n\t$args = array(\n\t\t'label' => __( 'Gallery Filter', 'devvn' ),\n\t\t'description' => __( 'Post Type Description', 'devvn' ),\n\t\t'labels' => $labels,\n\t\t'supports' => array( 'title', 'thumbnail', ),\n\t\t'taxonomies' => array( 'gallery-country', ' gallery-company' ),\n\t\t'hierarchical' => false,\n\t\t'public' => true,\n\t\t'show_ui' => true,\n\t\t'show_in_menu' => true,\n\t\t'menu_position' => 5,\n\t\t'menu_icon' => 'dashicons-images-alt',\n\t\t'show_in_admin_bar' => true,\n\t\t'show_in_nav_menus' => true,\n\t\t'can_export' => true,\n\t\t'has_archive' => true,\t\t\n\t\t'exclude_from_search' => true,\n\t\t'publicly_queryable' => true,\n\t\t'rewrite' => $rewrite,\n\t\t'capability_type' => 'page',\n\t);\n\tregister_post_type( 'gallery', $args );\n\n}", "function spreadshop_designer()\n{\ninclude(plugin_dir_path(__FILE__).'/spreaddesigner.php');\nadd_filter('wp_head', 'sources');\n}" ]
[ "0.66876394", "0.66649747", "0.64598954", "0.64092255", "0.6392534", "0.6348223", "0.6315788", "0.61637276", "0.6137726", "0.61215276", "0.60820097", "0.60631496", "0.6059491", "0.6058998", "0.60547125", "0.6019657", "0.59754616", "0.5973476", "0.5962512", "0.59384435", "0.59378713", "0.5911883", "0.58931273", "0.5890557", "0.5881635", "0.587518", "0.5857207", "0.5847318", "0.584201", "0.5839466" ]
0.67997575
0
Fix iOS issue if this blog uses msfile rewrite. If not, this code does no harm.
private function un_ms_file_rewrite_path($url_to_file){ $basedir = wp_upload_dir(); $basedir = $basedir['basedir']; $date_folder = NULL; preg_match('#/[0-9]{4}/[0-1]{1}[0-9]{1}#', $url_to_file, $date_folder); $path_to_file = $basedir . $date_folder[0] . '/' . basename($url_to_file); //at this point, we have the full unix path to the file. This is bad on the internet. //strip the unnecessary unix stuff at the beginning and replace it with the domain name $path_to_file = strstr($path_to_file, 'wp-content'); //build the domain-based path $url_build = get_site_url(); return $url_build .'/'. $path_to_file; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function fixFiles()\n {\n\n \tforeach (glob(base_path($this->passport_path) . '*.php') as $filename)\n \t{\n \t $file = file_get_contents($filename);\n \t file_put_contents($filename, str_replace($this->laravel_model, $this->mongo_model, $file));\n \t //$this->info($filename . \" has been Checked/Modified\");\n \t}\n\n }", "function rex_com_mediaaccess_htaccess_update()\n{\n global $REX;\n \n $unsecure_fileext = implode('|',explode(',',$REX['ADDON']['community']['plugin_mediaaccess']['unsecure_fileext']));\n $get_varname = $REX['ADDON']['community']['plugin_mediaaccess']['request']['file'];\n \n ## build new content\n $new_content = '### MEDIAACCESS'.PHP_EOL;\n $new_content .= 'RewriteCond %{HTTPS} off'.PHP_EOL;\n $new_content .= 'RewriteCond %{REQUEST_URI} !files/.*/.*'.PHP_EOL;\n $new_content .= 'RewriteCond %{REQUEST_URI} !files/(.*).('.$unsecure_fileext.')$'.PHP_EOL;\n $new_content .= 'RewriteRule ^(.*)$ http://%{HTTP_HOST}/?'.$get_varname.'=\\$1 [R=301,L]'.PHP_EOL;\n $new_content .= 'RewriteCond %{HTTPS} on'.PHP_EOL;\n $new_content .= 'RewriteCond %{REQUEST_URI} !files/.*/.*'.PHP_EOL;\n $new_content .= 'RewriteCond %{REQUEST_URI} !files/(.*).('.$unsecure_fileext.')$'.PHP_EOL;\n $new_content .= 'RewriteRule ^(.*)$ https://%{HTTP_HOST}/?'.$get_varname.'=\\$1 [R=301,L]'.PHP_EOL;\n $new_content .= '### /MEDIAACCESS'.PHP_EOL;\n \n ## write to htaccess\n $path = $REX['HTDOCS_PATH'].'files/.htaccess';\n $old_content = rex_get_file_contents($path);\n \n if(preg_match(\"@(### MEDIAACCESS.*### /MEDIAACCESS)@s\",$old_content) == 1)\n { \n $new_content = preg_replace(\"@(### MEDIAACCESS.*### /MEDIAACCESS)@s\", $new_content, $old_content);\n return rex_put_file_contents($path, $new_content);\n }\n \n return false;\n}", "function fixDocumentNameCallback($p_event, &$p_header)\n{\n global $remove_dir;\n $files = Session::read('doc_files_to_download');\n $storedFile = $remove_dir.$p_header['stored_filename'];\n\n if (!isset($files[$storedFile])) {\n return 0;\n }\n\n $documentData = $files[$storedFile];\n $documentNameFixed = DocumentManager::undoFixDocumentName(\n $documentData['path'],\n $documentData['c_id'],\n $documentData['session_id'],\n $documentData['to_group_id']\n );\n\n // Changes file.phps to file.php\n $basename = basename($documentNameFixed);\n $basenamePHPFixed = str_replace('.phps', '.php', $basename);\n $documentNameFixed = str_replace(\n $basename,\n $basenamePHPFixed,\n $documentNameFixed\n );\n\n if ($remove_dir != '/') {\n $documentNameFixed = str_replace($remove_dir, '/', $documentNameFixed);\n if (substr($documentNameFixed, 0, 1) == '/') {\n $documentNameFixed = substr($documentNameFixed, 1, api_strlen($documentNameFixed));\n }\n } else {\n $documentNameFixed = ltrim($documentNameFixed, '/');\n }\n\n $p_header['stored_filename'] = $documentNameFixed;\n\n return 1;\n}", "function ms_deprecated_blogs_file() {}", "public function fixRewrite()\n {\n if (!defined('REWRITED')) {\n preg_match(\"#^([^\\.]*)\\.#\", $_SERVER['HTTP_HOST'], $match);\n if ($_SERVER['HTTP_HOST'] != $GLOBALS['domain_info']['host']\n && $_GET['page'] && $_GET['page'] != $match[1]\n ) {\n $_GET['rlVareables'] = $_GET['page'] . ($_GET['rlVareables'] ? '/' . $_GET['rlVareables'] : '');\n\n $_GET['page'] = $match[1];\n $_GET['wildcard'] = '';\n } elseif ($_SERVER['HTTP_HOST'] != $GLOBALS['domain_info']['host']\n && (!isset($_GET['page']) || $_GET['listing_id'])\n ) {\n $_GET['page'] = $match[1];\n $_GET['wildcard'] = '';\n }\n\n define('REWRITED', true);\n }\n }", "protected function fix_supporting_file_references() {\r\n\t\tpreg_match_all('/<link([^<>]*?) href=\"([^\"]*?)\"([^<>]*?)\\/>/is', $this->code, $link_matches);\r\n\t\t/*$counter = sizeof($link_matches[0]) - 1;\r\n\t\twhile($counter > -1) {\r\n\t\t\t\r\n\t\t\t$counter--;\r\n\t\t}*/\r\n\t\t$array_replaces = array();\r\n\t\tforeach($link_matches[0] as $index => $value) {\r\n\t\t\t$href_content = $link_matches[2][$index];\r\n\t\t\tif($href_content[0] === '/' || strpos($href_content, 'http://') !== false) { // avoid root references and URLs\r\n\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\t$relative_path = ReTidy::resolve_relative_path($href_content, $this->file);\r\n\t\t\t\tif(file_exists($relative_path)) {\r\n\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$initial_href_content = $href_content;\r\n\t\t\t\t\t// first try looking closer\r\n\t\t\t\t\t$proper_reference = false;\r\n\t\t\t\t\twhile(!$proper_reference && substr($href_content, 0, 3) === '../') {\r\n\t\t\t\t\t\t$href_content = substr($href_content, 3);\r\n\t\t\t\t\t\t$relative_path = ReTidy::resolve_relative_path($href_content, $this->file);\r\n\t\t\t\t\t\tif(file_exists($relative_path)) {\r\n\t\t\t\t\t\t\t$proper_reference = true;\r\n\t\t\t\t\t\t\t$array_replaces['href=\"' . $initial_href_content . '\"'] = 'href=\"' . $href_content . '\"';\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(!$proper_reference) { // try looking farther\r\n\t\t\t\t\t\t$counter = 0;\r\n\t\t\t\t\t\twhile(!$proper_reference && $counter < 10) {\r\n\t\t\t\t\t\t\t$href_content = '../' . $href_content;\r\n\t\t\t\t\t\t\t$relative_path = ReTidy::resolve_relative_path($href_content, $this->file);\r\n\t\t\t\t\t\t\tif(file_exists($relative_path)) {\r\n\t\t\t\t\t\t\t\t$proper_reference = true;\r\n\t\t\t\t\t\t\t\t$array_replaces['href=\"' . $initial_href_content . '\"'] = 'href=\"' . $href_content . '\"';\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t$counter++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(!$proper_reference) { // give up or finish\r\n\t\t\t\t\t\tvar_dump($this->file, $href_content, $relative_path);exit(0);\r\n\t\t\t\t\t\tprint('<span style=\"color: red;\">Could not fix broken reference in &lt;link&gt;: ' . $value . '</span>');exit(0);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$this->logMsg('Reference ' . htmlentities($value) . ' was fixed.');\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\tforeach($array_replaces as $index => $value) {\r\n\t\t\t$this->code = str_replace($index, $value, $this->code);\r\n\t\t}\r\n\t}", "function ms_deprecated_blogs_file()\n {\n }", "private function fixUri(){\n\t\t$this->uri = rtrim($this->uri,'/');\n\t}", "function wp_swap_source($old_source_file) {\n\t\t\t\n\t\t$ext = pathinfo($old_source_file, PATHINFO_EXTENSION);\n\t\t\n\t\t$name = pathinfo($old_source_file, PATHINFO_FILENAME);\n\t\t$name = explode('-', $name);\n\t\t$temp = array_pop($name);\n\t\t$name = implode('-', $name);\n\t\t\n\t\t$path = dirname($old_source_file) . '/';\n\t\t\n\n\t\t$new_source_file = $path . $name . '.' . $ext;\n\t\t\n\t\t// In case there cannot be found an unresized original file in Wordpress’ media directory\n\t\t// Fallback to original file requested\n\t\t// This happens when cropping was done manuall in Wordpress, e.g. on a thumbnail\n\t\t// Why? The filename changes and no information about how and where cropping took place is stored \n\t\tif ( !file_exists($new_source_file) ) $new_source_file = $old_source_file;\n\n\t\treturn $new_source_file;\n\t}", "protected function _updateFileIdentifier() {}", "function iis7_delete_rewrite_rule($filename)\n {\n }", "private function fixWebPath(){\n\t\t$webPathMembers = explode('/', SpanArt::$WEB_PATH);\n\t\t$this->webPathNumber = count($webPathMembers);\n\t}", "function file_replace( $match ) {\r\n global $snoopy;\r\n\r\n // Href was already converted to the proper server path\r\n preg_match( '/href\\s*=\\s*[\\'\\\"]?(.*?)[\\'\\\" >]/', $match[0], $m );\r\n $href = $m[1];\r\n\r\n $snoopy->fetch( $href );\r\n\r\n return \"<style>\\r\\n\".$snoopy->results.\"</style>\\r\\n\";\r\n}", "function _infinite_base_file_transliteration($fid, $baseurl = false) {\n $file = file_load($fid);\n if(!$file){\n return FALSE;\n }\n\n $uri_old = $file->getFileUri();\n\n $values = [\n 'uid' => $file->get('uid'),\n 'status' => $file->get('status'),\n 'filename' => $file->getFilename(),\n 'uri' => $uri_old,\n 'filesize' => $file->getSize(),\n 'filemime' => $file->getMimeType()\n ];\n $file_new = File::create($values);\n\n $basename = basename($uri_old);\n\n $pattern = '/(.+:\\/\\/)(([^\\/]*\\/)*)'.preg_quote($basename).'/';\n $uri_new = preg_replace($pattern, '$1${2}'.$file_new->getFilename(), $uri_old);\n\n if($uri_old != $uri_new) {\n\n $move = TRUE;\n if(is_string($baseurl) && strlen($baseurl)){\n $GLOBALS['base_url'] = $baseurl;\n }\n $url = file_create_url($uri_old);\n if (!file_exists($uri_old)) {\n $ch = curl_init($url);\n $move = curl_exec($ch);\n curl_close($ch);\n }\n\n if ($move) {\n file_move($file, $uri_new);\n }\n\n }\n else {\n return FALSE;\n }\n\n return FALSE;\n}", "function style_url_replace( $match ) {\r\n global $snoopy, $download_path, $downloaded_files;\r\n\r\n $relative = $match[1];\r\n $image = convertLink( $match[1] );\r\n\r\n if ( in_array( $image, array_keys( $downloaded_files ) ) ) {\r\n $filename = $downloaded_files[$image];\r\n } else {\r\n\r\n $ext = end( explode( '.', $image ) );\r\n $name = time();\r\n\r\n $snoopy->fetch( $image );\r\n\r\n $filename = $download_path.$name.'.'.$ext;\r\n $downloaded_files[$image] = $filename;\r\n\r\n // can we handle fwrite/fopen failures in a better way?\r\n $fp = @fopen( $filename, 'wb' );\r\n @fwrite( $fp, $snoopy->results, strlen( $snoopy->results ) );\r\n @fclose( $fp );\r\n }\r\n\r\n return 'url('.$filename.')';\r\n}", "private static function _dsFixFile($filename) {\n\t\t$ds = DS;\n\t\t$notDs = DS == '/' ? '\\\\' : '/';\n\t\t$filename = str_replace($notDs, $ds, $filename);\n\t\t$filename = str_replace($ds . $ds, $ds, $filename);\n\t\treturn $filename;\n\t}", "public static function fix_document_root()\n {\n if (!serverv('PATH_INFO') || serverv('DOCUMENT_ROOT')) {\n return;\n }\n $_SERVER['DOCUMENT_ROOT'] = str_replace(\n $_SERVER['PATH_INFO']\n , ''\n , str_replace(\n '\\\\'\n , '/'\n , serverv('PATH_TRANSLATED'))\n ) . '/';\n }", "function sf_relocate_smileys()\n{\n\t$success = 0;\n\t$newpath = WP_CONTENT_DIR . '/forum-smileys';\n\t$oldpath = SF_PLUGIN_DIR . '/styles/smileys';\n\n\t# check if new folder does not exist - which it shouldn't!\n\tif(!is_dir($newpath))\n\t{\n\t\tif(!is_writable(WP_CONTENT_DIR) || !($dir = mkdir($newpath, 0777)))\n\t\t{\n\t\t\t$success = 1;\n\t\t\treturn $success;\n\t\t}\n\t\tif (!is_writable($newpath))\n\t\t{\n\t\t\t$success = 2;\n\t\t\treturn $success;\n\t\t}\n\t\tif(is_dir($newpath))\n\t\t{\n\t\t\t$avlist = opendir($oldpath);\n\t\t\twhile (false !== ($file = readdir($avlist)))\n\t\t\t{\n\t\t\t\tif ($file != \".\" && $file != \"..\")\n\t\t\t\t{\n\t\t\t\t\tif(!file_exists($newpath.'/'.$file))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(@rename($oldpath.'/'.$file, $newpath.'/'.$file) == false)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$success = 3;\n\t\t\t\t\t\t\tbreak;\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\tclosedir($avlist);\n\t\t\t@rmdir($oldpath);\n\t\t}\n\t}\n\treturn $success;\n}", "private function _replace_file_types()\n\t{\n\t\tpreg_match_all( '#(src|data-src|href)\\s*=\\s*[\\'\"]([^\\'\"\\\\\\]+)[\\'\"]#i', $this->content, $matches ) ;\n\t\tif ( empty( $matches[ 2 ] ) ) {\n\t\t\treturn ;\n\t\t}\n\n\t\t$filetypes = array_keys( $this->_cfg_cdn_mapping ) ;\n\t\tforeach ( $matches[ 2 ] as $k => $url ) {\n\t\t\t$url_parsed = parse_url( $url ) ;\n\t\t\tif ( empty( $url_parsed[ 'path' ] ) ) {\n\t\t\t\tcontinue ;\n\t\t\t}\n\t\t\t$postfix = substr( $url_parsed[ 'path' ], strrpos( $url_parsed[ 'path' ], '.' ) ) ;\n\t\t\tif ( ! in_array( $postfix, $filetypes ) ) {\n\t\t\t\tcontinue ;\n\t\t\t}\n\n\t\t\tLiteSpeed_Cache_Log::debug2( 'CDN matched file_type ' . $postfix . ' : ' . $url ) ;\n\n\t\t\tif( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE, $postfix ) ) {\n\t\t\t\tcontinue ;\n\t\t\t}\n\n\t\t\t$attr = str_replace( $url, $url2, $matches[ 0 ][ $k ] ) ;\n\t\t\t$this->content = str_replace( $matches[ 0 ][ $k ], $attr, $this->content ) ;\n\t\t}\n\t}", "function fs_rewrite_flush() {\r\n\tflush_rewrite_rules();\r\n}", "function wp_start_scraping_edited_file_errors()\n {\n }", "function strip_File($FileName) {\n\t//$arrItems = array(\" \", \"`\", \"~\", \"!\",\"@\",\"#\",\"$\",\"^\",\"&\",\"*\",\"(\",\")\",\"+\",\"=\",\"{\",\"}\",\"[\",\"]\",\"|\",\"'\",\";\",\"\\\\\",\"<\",\">\",\"&\",\"\\\"\",\"'\");\n\t$arrItems = array(\"`\", \"~\", \"!\",\"@\",\"#\",\"$\",\"^\",\"&\",\"*\",\"+\",\"=\",\"{\",\"}\",\"[\",\"]\",\"|\",\"'\",\";\",\"\\\\\",\"<\",\">\",\"&\",\"\\\"\",\"'\");\n\t$FileName = str_replace($arrItems, \"_\", $FileName);\n\t$FileName = urldecode($FileName);\n\t$FileName = str_replace(\"%\", \"_\", $FileName);\n\treturn $FileName;\n}", "protected function updateBrokenLinks() {}", "private function normalizeExtension()\n {\n $explodedUri = WingedLib::explodePath(static::$uri);\n $dir = WingedLib::normalizePath();\n $beforeConcatDir = WingedLib::normalizePath();\n if ($explodedUri) {\n foreach ($explodedUri as $key => $uriPart) {\n $dir .= $uriPart;\n $dir = WingedLib::normalizePath($dir);\n if (is_directory(WingedLib::clearPath(DOCUMENT_ROOT . $dir) . '/')) {\n unset($explodedUri[$key]);\n $beforeConcatDir = $dir;\n }\n }\n static::$parent = $beforeConcatDir;\n $beforeConcatDir = WingedLib::clearPath($beforeConcatDir);\n\n static::$parentUri = WingedLib::clearPath(WingedLib::clearPath(str_replace($beforeConcatDir, '', static::$uri)));\n if (!static::$parentUri) {\n static::$parentUri = './';\n } else {\n static::$parentUri = './' . static::$parentUri . '/';\n }\n\n if (static::$uri != static::$parentUri) {\n $explodedUri = WingedLib::explodePath(static::$parentUri);\n }\n\n static::$httpsParent = static::$https . $beforeConcatDir . '/';\n static::$httpParent = static::$http . $beforeConcatDir . '/';\n static::$protocolParent = static::$protocol . $beforeConcatDir . '/';\n\n if (static::$freeGet != '') {\n static::$fullUrlProvider = static::$protocol . WingedLib::clearPath(static::$pureUri) . '?' . static::$freeGet;\n } else {\n static::$fullUrlProvider = static::$protocol . WingedLib::clearPath(static::$pureUri);\n }\n if (count7($explodedUri) == 0) {\n static::$controllerName = 'IndexController';\n static::$controllerAction = 'actionIndex';\n static::$isIndex = true;\n } else {\n $explodedUri = array_values($explodedUri);\n $page = $explodedUri[0];\n unset($explodedUri[0]);\n $uriParameters = [];\n foreach ($explodedUri as $key => $value) {\n array_push($uriParameters, $value);\n }\n static::$controllerName = Formater::camelCaseClass($page) . 'Controller';\n if (count($uriParameters) > 0) {\n static::$controllerAction = 'action' . Formater::camelCaseMethod($uriParameters[0]);\n } else {\n static::$controllerAction = 'actionIndex';\n }\n static::$isIndex = true;\n static::$uriParameters = $uriParameters;\n }\n } else {\n static::$parentUri = './';\n static::$httpsParent = static::$https;\n static::$httpParent = static::$http;\n static::$protocolParent = static::$protocol;\n if (static::$freeGet != '') {\n static::$fullUrlProvider = static::$protocol . WingedLib::clearPath(static::$pureUri) . '?' . static::$freeGet;\n } else {\n static::$fullUrlProvider = static::$protocol . WingedLib::clearPath(static::$pureUri);\n }\n static::$isIndex = true;\n static::$controllerName = 'IndexController';\n static::$controllerAction = 'actionIndex';\n static::$parent = './';\n }\n return $this;\n }", "public function fix_dir_index($s) {\n\t\t$s = preg_replace(\"/[\\/]+/\", \"/\", $s);\n\t\t/* $s = preg_replace(\"/[\\/]+$/\", \"/\", $s); */\n\t\t$s = preg_replace(\"/^\\//\", \"\", $s);\n\t\treturn $s;\n\t}", "function __sfPageContentTask_rel2abs_replace($file,$url){\n if(preg_match(\"|^/|\",$url)) return $url;\n if(preg_match(\"|^#|\",$url)) return $url;\n if(preg_match(\"|^https?://|\",$url)) return $url;\n if(preg_match(\"|^mailto:|\",$url)) return $url;\n $abs = \"/\" . dirname($file).\"/\".$url;\n $abs = str_replace(\"/./\",\"/\",$abs);\n do{\n $abs = preg_replace(\"|/[^/]+/../|\",\"/\",$abs,-1,$c);\n }while($c);\n return $abs;\n}", "public function reAnimate()\n {\n $this->addOrRemovePublishedAtTimeToFrontmatter();\n\n // get last modified unixtime from file\n $lastModified = filemtime($this->index_path);\n\n // check if file has been modified since last save\n if ($this->post->last_modified != $lastModified) {\n $data = $this->prepareContentData();\n $this->post = $this->content->update($this->post, $data);\n $this->addSlugToFrontmatter();\n $this->regenerateStatic($this->post->id, $this->path.'/index.md', $this->frontmatter, $this->discharger->getMarkdown());\n clearstatcache();\n $data['last_modified'] = filemtime($this->path.'/index.md');\n $this->post = $this->content->update($this->post, $data);\n }\n }", "public function renameMediaMetaFiles($old_base_name, $new_base_name) {\n $newPath = WikiGlobalConfig::getConf('mediametadir').\"/$new_base_name\";\n $old_base_name = str_replace(\"/\", \"_\", $old_base_name);\n $new_base_name = str_replace(\"/\", \"_\", $new_base_name);\n $ret = TRUE;\n if (($scan = @scandir($newPath))){\n foreach ($scan as $file) {\n if (is_file(\"$newPath/$file\")) {\n $search = \"/^{$old_base_name}(.*)/\";\n if (preg_match($search, $file)) {\n $newfile = preg_replace($search, \"{$new_base_name}$1\", $file);\n $ret = rename(\"$newPath/$file\", \"$newPath/$newfile\");\n if (!$ret) {\n $ret = \"$newPath/$file\";\n break;\n }\n }\n }\n }\n }\n if (is_string($ret)) {\n throw new Exception(\"renameProjectOrDirectory: Error mentre canviava el nom de l'arxiu $ret.\");\n }\n }", "function fixMarkdownImagePaths($md){\n return preg_replace('/(!\\[[^\\]]+\\]\\()([^()]+)(?=\\))/i', '$1' . LOGMD_POSTS_DIR_PATH . '$2', $md);\n }", "function relDocs($filePath){\n\n $filePath = str_replace('\\\\','/',$filePath);\n $ssl = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true : false;\n $sp = strtolower($_SERVER['SERVER_PROTOCOL']);\n $protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');\n $port = $_SERVER['SERVER_PORT'];\n $stringPort = ((!$ssl && ($port == '80' || $port=='8080')) || ($ssl && $port == '443')) ? '' : ':' . $port;\n\t\t\n\n\t\t\n\t\t\n $host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];\n\t\t\n\t\t\n $filePath = preg_replace('/(\\/+)/','/',$filePath);\n\t\t$fileUrl = str_replace($_SERVER['DOCUMENT_ROOT'] ,$protocol . '://' . $host . $stringPort, $filePath); \n\t\t\n\t\treturn $fileUrl;\n\n}" ]
[ "0.59424436", "0.5724621", "0.571139", "0.5705128", "0.56007516", "0.55843925", "0.5566918", "0.54799926", "0.5356928", "0.52918494", "0.52160275", "0.52021396", "0.51792675", "0.5136813", "0.51321155", "0.51138586", "0.51103365", "0.5095997", "0.50830734", "0.50760764", "0.50209826", "0.50003034", "0.499704", "0.49900204", "0.49770778", "0.4963658", "0.49346012", "0.49138334", "0.48989606", "0.48980096" ]
0.5746252
1
Readiness check and Create Backup steps.
protected function readinessCheckAndBackup( AssertSuccessfulReadinessCheck $assertReadiness, BackupOptions $backupOptions ) { $this->readinessCheck($assertReadiness); $this->setupWizard->getReadiness()->clickNext(); $this->backup($backupOptions); $this->setupWizard->getCreateBackup()->clickNext(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n// dd('backup.create');\n $exitCode = Artisan::call('backup:run', ['--only-db'=>true]);\n return redirect()->route('backup.index');\n }", "protected function initial()\n {\n $adapter = new Local('/', LOCK_SH, Local::SKIP_LINKS);\n $local = new Filesystem($adapter);\n foreach ($this->config->returnActions() as $key => $elem) {\n $ctype = (strtolower($elem['typebackup']) !== 'mysql' ? ucfirst(strtolower($elem['type'])) : 'Time').ucfirst(strtolower($elem['typebackup']));\n $dst = $this->distination($this->config->returnConfig($elem['dst']), $key, $elem['dst']);\n $class = '\\backup\\Actions\\\\'.$ctype;\n $this->run[] = new $class($elem, $dst, $local, $this->config->returnMysqlConfig($elem['mysqlconfig']));\n MyLog::info('Initialization backup process - '.$ctype.' with config', $elem, 'main');\n $this->initial = $this->initial === false ? true : true;\n }\n }", "public function testBackup_website_full_successful_backup() {\n\t\tset_time_limit( 0 );\n\t\tini_set( 'memory_limit', '27M' );\n\t\t$this->createFile( 'file.txt', 10 );\n\n\t\t$this->config->set_in_progress( true );\n\t\t$this->config->log( WP_Backup::BACKUP_STATUS_STARTED );\n\n\t\t$this->backup = new WP_Backup( $this->mock_dropbox_facade, $this->config, new Mock_WpDb() );\n\n\t\t$this->backup->backup_path( ABSPATH, 'Dropbox');\n\t\tunlink( 'Out/file.txt' );\n\t\t$files_processed = $this->mock_dropbox_facade->get_files_processes();\n\n\t\t$this->assertNotEmpty( $files_processed );\n\t\t$this->assertEquals( 7, count( $files_processed ) );\n\n\t\t$dir = dirname( __FILE__ );\n\t\t$expected = array(\n\t\t\t\"$dir/class-file-list-test.php\",\n\t\t\t\"$dir/class-wp-backup-test.php\",\n\t\t\t\"$dir/Mocks/class-mock-dropbox-facade.php\",\n\t\t\t\"$dir/Mocks/class-mock-wpdb.php\",\n\t\t\t\"$dir/Mocks/mock-wp-functions.php\",\n\t\t\t\"$dir/Out/expected.sql\",\n\t\t\t\"$dir/Out/file.txt\",\n\t\t);\n\t\t$this->assertEquals( $expected, $files_processed );\n\n\t\t$this->config->log( WP_Backup::BACKUP_STATUS_FINISHED );\n\n\t\tini_restore( 'memory_limit ' );\n\t}", "function _terminatur_data_make_backup($site) {\n $backup_complete = FALSE;\n $backup_started = time();\n $current_backup = terminus_latest_bucket($site['uuid'], $site['env'], 'database');\n terminus_api_site_make_backup($site['uuid'], $site['env'], 'backup', FALSE, TRUE, FALSE);\n // @todo Check for Terminus API failure.\n // Terminus API just queues the backup, so wait around till it's done.\n while (!$backup_complete) {\n drush_log(dt('Creating database backup...'), 'warning');\n sleep(5);\n // Check if backup finished.\n $latest_backup = terminus_latest_bucket($site['uuid'], $site['env'], 'database');\n if ($latest_backup != $current_backup) {\n $backup_complete = TRUE;\n $current_backup = $latest_backup;\n }\n // Error out if the backup has taken too long.\n elseif ((time() - $backup_started) > TERMINATUR_DB_BACKUP_TIMEOUT) {\n return FALSE;\n }\n }\n drush_log(dt('Database backup complete!'), 'success');\n return $current_backup;\n}", "public function start_app_backup() {\n \n // Backups the files to update and save update\n (new MidrubBaseAdminCollectionUpdateHelpers\\Apps)->start_backup();\n \n }", "function createBackup()\n {\n\n\n //Enter your database information here and the name of the backup file\n $mysqlDatabaseName ='edumarxc_bmwdatabase';\n $mysqlUserName ='edumarxc_bmw';\n $mysqlPassword ='bmw_INF370';\n $mysqlHostName ='dbxxx.hosting-data.io';\n $mysqlExportPath ='backup.sql';\n\n //Please do not change the following points\n //Export of the database and output of the status\n $command='mysqldump --opt -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' > ' .$mysqlExportPath;\n exec($command,$output=array(),$worked);\n switch($worked){\n case 0:\n return true;\n break;\n case 1:\n return false;\n break;\n case 2:\n return false;\n break;\n }\n\n\n\n }", "public function enableBackup();", "public function create()\n {\n set_time_limit(0);\n ignore_user_abort(true);\n\n $this->_lastOperationSucceed = false;\n\n $backup = $this->_backupFactory->createBackupModel()->setTime(\n $this->getTime()\n )->setType(\n $this->getType()\n )->setPath(\n $this->getBackupsDir()\n )->setName(\n $this->getName()\n );\n\n $backupDb = $this->_backupFactory->createBackupDbModel();\n $backupDb->createBackup($backup);\n\n $this->_lastOperationSucceed = true;\n\n return true;\n }", "function init__backup()\n{\n\tglobal $STARTED_BACKUP;\n\t$STARTED_BACKUP=false;\n}", "public function createAction() {\n // Since version 0.3.9 we'll check for array of file stacks if filesystem backup is required\n\n $request = reqBup::get('post');\n $response = new responseBup();\n\n $filename = $this->getModel()->generateFilename(array('zip', 'sql', 'txt'));\n\n /** @var backupLogModelBup $log */\n $log = $this->getModel('backupLog');\n $cloud = array();\n\n if ($this->getModel()->isFilesystemRequired()) {\n\n if (!isset($request['complete'])) {\n\n $files = $this->getModel()->getFilesList();\n $log->string(sprintf('%s files scanned.', count($files)));\n\n $log->string('Clear out old temporary files');\n if (file_exists($file = sys_get_temp_dir() . '/stacks.dat')) {\n if (unlink($file)) {\n $log->string(sprintf('%s successfully deleted', basename($file)));\n } else {\n $log->string(sprintf('Cannot delete file %s. If you notice a problem with archives - delete the file manually', $file));\n }\n }\n\n foreach (glob(sys_get_temp_dir() . '/*') as $tmp) {\n if (substr(basename($tmp), 0, 3) === 'BUP') {\n if (unlink($tmp)) {\n $log->string(sprintf('%s successfully deleted', $tmp));\n } else {\n $log->string(sprintf('Cannot delete file %s', $tmp));\n }\n }\n }\n\n // Defined in ./config.php\n if (!defined('BUP_FILES_PER_STACK')) {\n define('BUP_FILES_PER_STACK', 500);\n }\n\n $response->addData(array(\n 'files' => $files,\n 'per_stack' => BUP_FILES_PER_STACK,\n ));\n\n $log->string('Send request to generate temporary file stacks');\n\n return $response->ajaxExec();\n }\n\n $log->string(sprintf('Create a backup of the file system: %s', $filename['zip']));\n $this->getModel()->getFilesystem()->create($filename['zip']);\n $cloud[] = $filename['zip'];\n }\n\n if ($this->getModel()->isDatabaseRequired()) {\n $log->string(sprintf('Create a backup of the database: %s', $filename['sql']));\n $this->getModel()->getDatabase()->create($filename['sql']);\n $cloud[] = $filename['sql'];\n }\n\n $log->string('Backup complete');\n\n $destination = $this->getModel()->getConfig('dest');\n\t\t$handlers = $this->getModel()->getDestinationHandlers();\n\n\t\tif (array_key_exists($destination, $handlers)) {\n\n $cloud = array_map('basename', $cloud);\n\n $log->string(sprintf('Upload to the <%s> required', ucfirst($destination)));\n $log->string(sprintf('Files to upload: %s', rtrim(implode(', ', $cloud), ', ')));\n\t\t\t$handler = $handlers[$destination];\n\t\t\t$result = call_user_func_array($handler, array($cloud));\n\t\t\tif ($result === true || $result == 200 || $result == 201) {\n\t\t\t\t$log->string(sprintf('Successfully uploaded to the <%s>', ucfirst($destination)));\n\t\t\t} else {\n $log->string(sprintf('Cannot upload to the <%s>: %s', ucfirst($destination), (is_array($result) ? print_r($result, true) : $result)));\n }\n\t\t}\n\n $log->save($filename['txt']);\n $response->addMessage(langBup::_('Backup complete'));\n\n $log->clear();\n\n return $response->ajaxExec();\n\t}", "public function test_Incremental_Backup_Restore(){\n\t\tzbase_setup::reset_zbase_vbucketmigrator(TEST_HOST_1,TEST_HOST_2);\n\t\tflushctl_commands::set_flushctl_parameters(TEST_HOST_1, \"chk_max_items\", 100);\n\t\t$this->assertTrue(Data_generation::add_keys(2000, 100, 1, \"testvalue\"), \"adding keys failed\");\n\t\t// Ensure that keys are replicated to the slave\n\t\tsleep(30);\n\t\t$curr_items = stats_functions::get_all_stats(TEST_HOST_1, \"curr_items\");\n\t\t$this->assertEquals($curr_items ,2000 , \"All keys not replicated to slave\");\n\t\t// Take incremental backup using backup daemon\n\t\tbackup_tools_functions::clear_backup_data(TEST_HOST_2);\n\t\tbackup_tools_functions::clear_temp_backup_data(TEST_HOST_2);\n\t\tzbase_backup_setup::start_backup_daemon(TEST_HOST_2);\n\t\t$this->assertTrue(backup_tools_functions::verify_zbase_backup_upload(), \"Failed to upload the backup files to Storage Server\");\n\t\t// Kill vbucket migrator between master and slave\n\t\tvbucketmigrator_function::kill_vbucketmigrator(TEST_HOST_1);\n\t\tzbase_setup::memcached_service(TEST_HOST_2, \"stop\");\n\t\tremote_function::remote_execution(TEST_HOST_2,\"sudo rm -rf /data_*/zbase/*\");\n\t\tzbase_setup::memcached_service(TEST_HOST_2, \"start\");\n\t\t// Perform restore\n\t\tmb_restore_commands::restore_server(TEST_HOST_2);\n\t\t//Attempt get on all keys\n\t\t$this->assertTrue(Data_generation::verify_added_keys(TEST_HOST_2, 2000, \"testvalue\", 1), \"verifying keys failed\");\n\t\t// The below step causes SERVER ERROR\n\t\t//$this->assertTrue(Data_generation::verify_added_keys(TEST_HOST_2, 1, \"testvalue\", 2001), \"verifying keys failed\");\n\t}", "public function take_backup(){\n\t\t$this->load->dbutil();\n\n\t\t$prefs = array(\n 'tables' => array(), // Array of tables to backup.\n 'ignore' => array(), // List of tables to omit from the backup\n 'format' => 'zip', // gzip, zip, txt\n 'filename' => 'chikitsa-backup.sql', // File name - NEEDED ONLY WITH ZIP FILES\n 'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file\n 'add_insert' => TRUE, // Whether to add INSERT data to backup file\n 'newline' => \"\\n\" // Newline character used in backup file\n );\n\n\t\t// Backup your entire database and assign it to a variable\n\t\t$backup =& $this->dbutil->backup($prefs);\n\n\t\t// Load the file helper and write the file to your server\n\t\t$this->load->helper('file');\n\t\twrite_file('./chikitsa-backup.zip', $backup);\n\n\t\t// Load the download helper and send the file to your desktop\n\t\t$this->load->helper('download');\n\t\tforce_download('chikitsa-backup.zip', $backup);\n\n\t\t$this->backup();\n\t}", "public function start_midrub_backup() {\n \n // Backup\n (new MidrubBaseAdminCollectionUpdateHelpers\\Midrub)->start_backup();\n \n }", "public function __invoke() : void {\n $this->hostCheck->check();\n\n $localhost = $this->deployerFunctions->localhost();\n $database = $this->database->fromConfigKey();\n $dumpfile = $this->dumpfile->create($database);\n\n $this->deployerFunctions->on($localhost, fn() => $this->dump->create($this->database->fromConfigKey(), $dumpfile)());\n\n $this->upload->createWithSingleDumpfile($dumpfile)();\n\n $this->deployerFunctions->on($localhost, fn() => $this->deleteDump->create($dumpfile)());\n\n $this->import->create($database, $dumpfile)();\n $this->deleteDump->create($dumpfile)();\n }", "public function testBackup_website_full_backup_with_warnings() {\n\t\tini_set( 'memory_limit', '20M' );\n\t\t$this->createFile( 'big.txt', 10 );\n\n\t\t$this->config->set_in_progress( true );\n\t\t$this->config->log( WP_Backup::BACKUP_STATUS_STARTED );\n\n\t\t$this->backup = new WP_Backup( $this->mock_dropbox_facade, $this->config );\n\n\t\t$this->backup->backup_path( ABSPATH, 'Out');\n\t\t$files_processed = $this->mock_dropbox_facade->get_files_processes();\n\n\t\t$this->assertNotEmpty( $files_processed );\n\t\t$this->assertEquals( 6, count( $files_processed ) );\n\n\t\t$dir = dirname( __FILE__ );\n\t\t$expected = array(\n\t\t\t\"$dir/class-file-list-test.php\",\n\t\t\t\"$dir/class-wp-backup-test.php\",\n\t\t\t\"$dir/Mocks/class-mock-dropbox-facade.php\",\n\t\t\t\"$dir/Mocks/class-mock-wpdb.php\",\n\t\t\t\"$dir/Mocks/mock-wp-functions.php\",\n\t\t\t\"$dir/Out/expected.sql\",\n\t\t);\n\n\t\t$this->assertEquals( $expected, $files_processed );\n\n\t\t$this->config->log( WP_Backup::BACKUP_STATUS_FINISHED );\n\n\t\t$this->assertEquals( time(), $this->backup->get_last_backup_time() );\n\n\t\tunlink( 'Out/big.txt' );\n\n\t\t$history = $this->config->get_history();\n\n\t\tlist( $time, $status, $msg ) = array_shift( $history );\n\t\t$this->assertEquals( WP_Backup::BACKUP_STATUS_FINISHED, $status );\n\n\t\tlist( $time, $status, $msg ) = array_shift( $history );\n\t\t$this->assertEquals( WP_Backup::BACKUP_STATUS_WARNING, $status );\n\t\t$this->assertEquals( \"file 'big.txt' exceeds 40 percent of your PHP memory limit. The limit must be increased to back up this file.\", $msg );\n\n\t\tlist( $time, $status, $msg ) = array_shift( $history );\n\t\t$this->assertEquals( WP_Backup::BACKUP_STATUS_STARTED, $status );\n\n\t\tini_restore( 'memory_limit ' );\n\t}", "public function testCompanyManagementBackupsPost()\n {\n\n }", "public function createAction() {\r\n $request = reqEbbs::get('post');\r\n $response = new responseEbbs();\r\n /** @var backupLogTxtModelEbbs $logTxt */\r\n $logTxt = $this->getModel('backupLogTxt');\r\n /** @var backupTechLogModelEbbs $techLog */\r\n $techLog = $this->getModel('backupTechLog');\r\n /** @var warehouseEbbs $bupFolder */\r\n $bupFolder = frameEbbs::_()->getModule('warehouse');\r\n $uploadingList = array();\r\n $backupComplete = false;\r\n\r\n if(!empty($request['opt_values'])){\r\n do_action('bupBeforeSaveBackupSettings', $request['opt_values']);\r\n /* @var $optionsModel optionsModelEbbs*/\r\n $optionsModel = frameEbbs::_()->getModule('options')->getModel();\r\n $optionsModel->saveMainFromDestGroup($request);\r\n $optionsModel->saveGroup($request);\r\n $optionsModel->refreshOptions();\r\n\r\n // if warehouse changed - create necessary dir\r\n if (!$bupFolder->getFolder()->exists())\r\n $bupFolder->getFolder()->create();\r\n }\r\n\r\n $destination = $this->getModel()->getConfig('dest');\r\n if($destination !== 'ftp') {\r\n $isAuthorized = $this->getModel()->checkCloudServiceRemoteServerIsAuth($destination);\r\n if(!$isAuthorized){\r\n $response->addError($this->getModel()->getErrors());\r\n return $response->ajaxExec();\r\n }\r\n }\r\n\r\n // We are need to check \"warehouse\" directory (usually: wp-content/upsupsystic)\r\n if (!$this->getModel()->checkWarehouse()) {\r\n $response->addError($this->getModel()->getWarehouseError());\r\n return $response->ajaxExec();\r\n }\r\n\r\n if($this->getModel()->isFilesystemRequired() && !$this->checkExtensions($response)) {\r\n return $response->ajaxExec();\r\n }\r\n\r\n $currentBackupPath = $this->getModel()->generateFilename(array('zip', 'sql', 'txt'));\r\n $logTxt->setLogName(basename($currentBackupPath['folder']));\r\n $logTxt->writeBackupSettings($request['opt_values']);\r\n $logTxt->add(__('Clear temporary directory', EBBS_LANG_CODE));\r\n $techLog->deleteOldLogs();\r\n $techLog->setLogName(basename($currentBackupPath['folder']));\r\n\r\n if ($this->getModel()->isDatabaseRequired()) {\r\n $logTxt->add(__(sprintf('Start database backup: %s', $currentBackupPath['sql']), EBBS_LANG_CODE));\r\n $this->getModel()->getDatabase()->create($currentBackupPath['sql']);\r\n $dbErrors = $this->getModel()->getDatabase()->getErrors();\r\n\r\n if (!empty($dbErrors)) {\r\n $logTxt->add(__(sprintf('Errors during creation of database backup, errors count %d', count($dbErrors)), EBBS_LANG_CODE));\r\n $response->addError($dbErrors);\r\n return $response->ajaxExec();\r\n }\r\n\r\n $logTxt->add(__('Database backup complete.'), EBBS_LANG_CODE);\r\n $uploadingList[] = $currentBackupPath['sql'];\r\n $backupComplete = true;\r\n }\r\n\r\n if ($this->getModel()->isFilesystemRequired()) {\r\n if(!file_exists($currentBackupPath['folder'])) {\r\n $bupFolder->getController()->getModel('warehouse')->create($currentBackupPath['folder'] . DS);\r\n }\r\n\r\n $logTxt->add(__('Scanning files.', EBBS_LANG_CODE));\r\n $files = $this->getModel()->getFilesList();\r\n // $files = array_map('realpath', $files);\r\n\r\n $logTxt->add(sprintf('%s files scanned.', count($files, true) - count($files)));\r\n $logTxt->add(__('Total stacks: ' . count($files), EBBS_LANG_CODE));\r\n $techLog->set('stacks', $files);\r\n $uploadingList[] = $currentBackupPath['folder'];\r\n $backupComplete = false;\r\n }\r\n\r\n // if need create filesystem backup or send DB backup on cloud - backup not complete\r\n if(!empty($files) || $destination !== 'ftp') {\r\n $backupComplete = false;\r\n $techLog->set('destination', $destination);\r\n $techLog->set('uploadingList', $uploadingList);\r\n $techLog->set('emailNotifications', (frameEbbs::_()->getModule('options')->get('email_ch') == 1) ? true : false);\r\n\r\n $data = array(\r\n 'page' => 'backup',\r\n 'action' => 'createBackupAction',\r\n 'backupId' => $currentBackupPath['folder'],\r\n );\r\n\r\n if(!empty($files))\r\n $logTxt->add(__('Send request to generate backup file stacks', EBBS_LANG_CODE));\r\n\r\n $this->getModel('backup')->sendSelfRequest($data);\r\n }\r\n\r\n if($backupComplete && frameEbbs::_()->getModule('options')->get('email_ch') == 1) {\r\n $email = frameEbbs::_()->getModule('options')->get('email');\r\n $subject = __('DropBox Backup by Supsystic Notifications', EBBS_LANG_CODE);\r\n\r\n $logTxt->add(__('Email notification required.', EBBS_LANG_CODE));\r\n $logTxt->add(sprintf(__('Sending to', EBBS_LANG_CODE) . '%s', $email));\r\n\r\n $message = $logTxt->getContent(false);\r\n\r\n wp_mail($email, $subject, $message);\r\n }\r\n\r\n $response->addData(array(\r\n 'backupLog' => $logTxt->getContent(),\r\n 'backupId' => basename($currentBackupPath['folder']),\r\n 'backupComplete' => $backupComplete\r\n ));\r\n\r\n return $response->ajaxExec();\r\n\r\n $cloud = $log->getCurrentBackupFilesName();\r\n\r\n $handlers = $this->getModel()->getDestinationHandlers();\r\n\r\n if (array_key_exists($destination, $handlers)) {\r\n\r\n $cloud = array_map('basename', $cloud);\r\n\r\n $log->string(__(sprintf('Upload to the \"%s\" required', ucfirst($destination)), EBBS_LANG_CODE));\r\n $log->string(sprintf('Files to upload: %s', rtrim(implode(', ', $cloud), ', ')));\r\n $handler = $handlers[$destination];\r\n $result = call_user_func_array($handler, array($cloud));\r\n if ($result === true || $result == 200 || $result == 201) {\r\n $log->string(__(sprintf('Successfully uploaded to the \"%s\"', ucfirst($destination)), EBBS_LANG_CODE));\r\n\r\n $path = frameEbbs::_()->getModule('warehouse')->getPath();\r\n $path = untrailingslashit($path);\r\n\r\n foreach ($cloud as $file) {\r\n $log->string(__(sprintf('Removing %s from the local storage.', $file), EBBS_LANG_CODE));\r\n if (@unlink($path . '/' . $file)) {\r\n $log->string(__(sprintf('%s successfully removed.', $file), EBBS_LANG_CODE));\r\n } else {\r\n $log->string(__(sprintf('Failed to remove %s', $file), EBBS_LANG_CODE));\r\n }\r\n }\r\n } else {\r\n switch ($result) {\r\n case 401:\r\n $error = __('Authentication required.', EBBS_LANG_CODE);\r\n break;\r\n case 404:\r\n $error = __('File not found', EBBS_LANG_CODE);\r\n break;\r\n case 500:\r\n $error = is_object($handler[0]) ? $handler[0]->getErrors() : __('Unexpected error (500)', EBBS_LANG_CODE);\r\n break;\r\n default:\r\n $error = __('Unexpected error', EBBS_LANG_CODE);\r\n }\r\n\r\n $log->string(__(\r\n sprintf(\r\n 'Cannot upload to the \"%s\": %s',\r\n ucfirst($destination),\r\n is_array($error) ? array_pop($error) : $error\r\n )\r\n , EBBS_LANG_CODE));\r\n }\r\n }\r\n\r\n if(empty($error)) {\r\n $response->addMessage(__('Backup complete.', EBBS_LANG_CODE));\r\n } else {\r\n $response->addError(__('Error occurred: ' . ucfirst($destination) . ', ' . $error, EBBS_LANG_CODE));\r\n }\r\n\r\n // Allow to do new backups.\r\n $this->unlock();\r\n\r\n $backupPath = untrailingslashit($bupStorageRoot) . DS;\r\n $pathInfo = pathinfo($cloud[0]);\r\n $log->save($backupPath . $pathInfo['filename'] . '.txt');\r\n\r\n $response->addData(\r\n array(\r\n 'backupLog' => frameEbbs::_()->getModule('backup')->getModel('backupLog')->getBackupLog(),\r\n )\r\n );\r\n\r\n $log->clear();\r\n\r\n return $response->ajaxExec();\r\n\t}", "protected function doBaseTasks()\n {\n\n $this->showTestHeadline(\"Checking application base structure\");\n\n if (HSetting::Get('secret') == \"\" || HSetting::Get('secret') == null) {\n HSetting::Set('secret', UUID::v4());\n $this->showFix('Setting missing application secret!');\n }\n }", "public function dbBackupStructure($args){\n\n $this->dbBackup($args, true);\n\n }", "public function fullDownload(){ \n Artisan::call('backup:run');\n }", "function make_backup_2($file=NULL,$b_type=NULL,$max_size=NULL) // This is called as a shutdown function and thus cannot script-timeout\n{\n\tglobal $STARTED_BACKUP;\n\tif ($STARTED_BACKUP) return;\n\t$STARTED_BACKUP=true;\n\n\tif (is_null($file))\n\t{\n\t\tglobal $MB2_FILE,$MB2_B_TYPE,$MB2_MAX_SIZE;\n\t\t$file=$MB2_FILE;\n\t\t$b_type=$MB2_B_TYPE;\n\t\t$max_size=$MB2_MAX_SIZE;\n\t}\n\n\tif (function_exists('set_time_limit')) @set_time_limit(0);\n\t$logfile_path=get_custom_file_base().'/exports/backups/'.$file.'.txt';\n\t$logfile=@fopen($logfile_path,'wt') OR intelligent_write_error($logfile_path); // .txt file because IIS doesn't allow .log download\n\t@ini_set('log_errors','1');\n\t@ini_set('error_log',$logfile_path);\n\tfwrite($logfile,'This is a log file for an ocPortal backup. The backup is not complete unless this log terminates with a completion message.'.\"\\n\\n\");\n\n\trequire_code('tar');\n\t$myfile=tar_open(get_custom_file_base().'/exports/backups/'.filter_naughty($file),'wb');\n\n\t// Write readme.txt file\n\ttar_add_file($myfile,'readme.txt',do_lang('BACKUP_README',get_timezoned_date(time())),0664,time());\n\n\t// Write restore.php file\n\t$template=get_custom_file_base().'/data_custom/modules/admin_backup/restore.php.pre';\n\tif (!file_exists($template)) $template=get_file_base().'/data/modules/admin_backup/restore.php.pre';\n\t$_install_php_file=file_get_contents($template);\n\t$place=strpos($_install_php_file,'{!!DB!!}');\n\t$__install_php_file=ocp_tempnam('ocpbak');\n\t$install_php_file=fopen($__install_php_file,'wb');\n\tfwrite($install_php_file,substr($_install_php_file,0,$place));\n\tget_table_backup($logfile,'db_meta','db_meta_indices',$install_php_file);\n\tif (fwrite($install_php_file,substr($_install_php_file,$place+8))==0) warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));\n\tfclose($install_php_file);\n\n\ttar_add_file($myfile,'restore.php',$__install_php_file,0664,time(),true);\n\t@unlink($__install_php_file);\n\n\tif ($b_type=='full')\n\t{\n\t\tset_value('last_backup',strval(time()));\n\t\t$original_files=(get_param_integer('keep_backup_alien',0)==1)?unserialize(file_get_contents(get_file_base().'/data/files.dat')):NULL;\n\t\t$root_only_dirs=array_merge(find_all_zones(false,false,true),array(\n\t\t\t'data','data_custom',\n\t\t\t'exports','imports',\n\t\t\t'lang','lang_custom',\n\t\t\t'lang_cached',\n\t\t\t'pages',\n\t\t\t'persistant_cache','safe_mode_temp',\n\t\t\t'sources','sources_custom',\n\t\t\t'text','text_custom',\n\t\t\t'themes',\n\t\t\t'uploads',\n\n\t\t\t'site', // In case of collapsed zones blocking in\n\t\t));\n\t\ttar_add_folder($myfile,$logfile,get_file_base(),$max_size,'',$original_files,$root_only_dirs,!running_script('cron_bridge'),true);\n\t} elseif ($b_type=='incremental')\n\t{\n\t\t$threshold=intval(get_value('last_backup'));\n\n\t\tset_value('last_backup',strval(time()));\n\t\t$directory=tar_add_folder_incremental($myfile,$logfile,get_file_base(),$threshold,$max_size);\n\t\t$_directory='';\n\t\tforeach ($directory as $d)\n\t\t{\n\t\t\t$a='';\n\t\t\tforeach ($d as $k=>$v)\n\t\t\t{\n\t\t\t\tif ($a!='') $a.=\", \";\n\t\t\t\t$a.=$k.'='.$v;\n\t\t\t}\n\t\t\t$_directory.=$a.\"\\n\";\n\t\t}\n\t\ttar_add_file($myfile,'DIRECTORY',$_directory,0664,time());\n\t} else\n\t{\n\t\tset_value('last_backup',strval(time()));\n\t}\n\ttar_close($myfile);\n\tif (!file_exists(get_custom_file_base().'/exports/backups/'.filter_naughty($file))) warn_exit(do_lang_tempcode('INTERNAL_ERROR'));\n\trename(get_custom_file_base().'/exports/backups/'.filter_naughty($file),get_custom_file_base().'/exports/backups/'.filter_naughty($file).'.tar');\n\tsync_file('exports/backups/'.filter_naughty($file).'.tar');\n\tfix_permissions('exports/backups/'.filter_naughty($file).'.tar');\n\n\t$url=get_base_url().'/exports/backups/'.$file.'.tar';\n\tif (function_exists('gzopen'))\n\t{\n\t\tif (fwrite($logfile,\"\\n\".do_lang('COMPRESSING').\"\\n\")==0) warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));\n\n\t\t$myfile=gzopen(get_custom_file_base().'/exports/backups/'.$file.'.tar.gz.tmp','wb') OR intelligent_write_error(get_custom_file_base().'/exports/backups/'.$file.'.tar.gz.tmp');\n\t\t$tar_path=get_custom_file_base().'/exports/backups/'.filter_naughty($file).'.tar';\n\n\t\t$fp_in=fopen($tar_path,'rb');\n\t\twhile (!feof($fp_in))\n\t\t{\n\t\t\t$read=fread($fp_in,8192);\n\t\t gzwrite($myfile,$read,strlen($read));\n\t\t}\n\t\tfclose($fp_in);\n\t\tgzclose($myfile);\n\n\t\trename(get_custom_file_base().'/exports/backups/'.$file.'.tar.gz.tmp',get_custom_file_base().'/exports/backups/'.$file.'.tar.gz');\n\n\t\tfix_permissions(get_custom_file_base().'/exports/backups/'.$file.'.tar.gz');\n\t\tsync_file('exports/backups/'.filter_naughty($file).'.tar.gz');\n\t\t$url=get_base_url().'/exports/backups/'.$file.'.tar.gz';\n\t}\n\n\tif (fwrite($logfile,\"\\n\".do_lang('SUCCESS').\"\\n\")==0) warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));\n\tfclose($logfile);\n\tsync_file($logfile_path);\n\tfix_permissions($logfile_path);\n\tsync_file($logfile_path);\n\n\t// Remote backup\n\t$copy_server=get_option('backup_server_hostname');\n\tif ($copy_server!='')\n\t{\n\t\t$path_stub=get_custom_file_base().'/exports/backups/';\n\t\tif (file_exists($path_stub.$file.'.tar.gz')) $_file=$file.'.tar.gz';\n\t\telseif (file_exists($path_stub.$file.'.tar')) $_file=$file.'.tar';\n\t\telse $file=NULL;\n\n\t\tif (!is_null($file)) // If the backup was actually made\n\t\t{\n\t\t\t$copy_port=get_option('backup_server_port');\n\t\t\tif ($copy_port=='') $copy_port='21';\n\t\t\t$copy_user=get_option('backup_server_user');\n\t\t\tif ($copy_user=='') $copy_user='anonymous';\n\t\t\t$copy_password=get_option('backup_server_password');\n\t\t\tif (is_null($copy_password)) $copy_password=get_option('staff_address');\n\t\t\t$copy_path=get_option('backup_server_path');\n\t\t\tif ($copy_path=='') $copy_path=$_file;\n\t\t\telseif ((substr($copy_path,-1)=='/') || ($copy_path=='')) $copy_path.=$_file;\n\t\t\t$ftp_connection=@ftp_connect($copy_server,intval($copy_port));\n\t\t\tif ($ftp_connection!==false)\n\t\t\t{\n\t\t\t\tif (@ftp_login($ftp_connection,$copy_user,$copy_password))\n\t\t\t\t{\n\t\t\t\t\t@ftp_delete($ftp_connection,$path_stub.$_file);\n\t\t\t\t\t@ftp_put($ftp_connection,$copy_path,$path_stub,FTP_BINARY);\n\t\t\t\t}\n\t\t\t\t@ftp_close($ftp_connection);\n\t\t\t}\n\t\t}\n\t}\n\n\trequire_code('notifications');\n\tdispatch_notification('backup_finished',NULL,do_lang('BACKUP',NULL,NULL,NULL,get_site_default_lang()),do_lang('BACKUP_FINISHED',comcode_escape($url),get_site_default_lang()),NULL,A_FROM_SYSTEM_PRIVILEGED);\n}", "public function run()\n {\n $businesss = Business::factory()->count(env('SEED_LIMIT')/8)->health()->create();\n\n Business::factory()->count(env('SEED_LIMIT')*7/8)->create();\n }", "protected function startBackup()\n {\n if ($this->initial !== false) {\n MyLog::info(\"Starting Backup process\", [], 'main');\n foreach ($this->run as $class) {\n $class->run();\n }\n return;\n }\n throw new NoInicializationException('No Inicialization maked', 'error');\n }", "public function index() {\n try { \n \\Artisan::call('backup:run');\n }\n catch( \\Exception $e ) {\n \t//dd( $e );\n return redirect()->back();\n /*->withErrors(['error_aplicacion'=>'Error al crear el backup, contacte con el administrador.']); */ \n } \n \n return redirect()->back();\n }", "public function actionBackup()\n {\n $user = \\Yii::$app->db->username;\n $pass = \\Yii::$app->db->password;\n $db = preg_replace('/^.*\\=(\\w+)$/', '$1', \\Yii::$app->db->dsn);\n $name = date('Y-m-d_H-i').\".sql\";\n $tables = implode(\" \", array_filter(\\Yii::$app->db->schema->tableNames, function($v){\n return !preg_match('/^data_.*$/', $v);\n }));\n exec(\"mysqldump -u$user -p$pass $db $tables > \" . \\Yii::getAlias(\"@app/runtime/$name\"));\n }", "public function actionBackup()\n {\n $user = \\Yii::$app->db->username;\n $pass = \\Yii::$app->db->password;\n $db = preg_replace('/^.*\\=(\\w+)$/', '$1', \\Yii::$app->db->dsn);\n $name = date('Y-m-d_H-i').\".sql\";\n $tables = implode(\" \", array_filter(\\Yii::$app->db->schema->tableNames, function($v){\n return !preg_match('/^data_.*$/', $v);\n }));\n exec(\"mysqldump -u$user -p$pass $db $tables > \" . \\Yii::getAlias(\"@app/runtime/$name\"));\n }", "public function backupData()\n {\n $this->load->dbutil();\n\n // Backup database dan dijadikan variable\n $backup = $this->dbutil->backup();\n\n // Load file helper dan menulis ke server untuk keperluan restore\n $this->load->helper('file');\n write_file('/backup/database/mybackup.zip', $backup);\n\n // Load the download helper dan melalukan download ke komputer\n $this->load->helper('download');\n force_download('mybackup.zip', $backup);\n }", "public function createBackup() {\n $dbType = config('database.default');\n $info = config('database.connections.' . $dbType);\n $hostname = escapeshellcmd($info['host']);\n $user = escapeshellcmd($info['username']);\n $password = $info['password'];\n $database = escapeshellcmd($info['database']);\n\n $date = Carbon::now()->toDateString();\n $exportPath = 'backups/' . $database . '-' . $date . '.sql';\n $command = \"mysqldump --no-tablespaces --host=$hostname --user=$user --password='$password' $database --result-file='~/$exportPath' 2>&1\";\n\n exec($command, $output, $error);\n\n return response()->json(['msg' => $output], $error ? 500 : 200);\n }", "public function canManageBackup();", "public function create_backup_action()\n {\n if($this->isLoggedIn())\n {\n $getbackup = $this->input->post('getbackup');\n if(!empty($getbackup)){\n $tables = $this->input->post('dbtables');\n\n if(empty($tables)){\n echo json_encode(array(\"msg_type\" => \"error\", \"message\" => \"Please Select Table for Backup\"));\n }else{\n $this->getBackup($tables);\n }\n }\n }\n else {\n redirect(base_url());\n }\n }" ]
[ "0.6220813", "0.6220601", "0.6089825", "0.6017322", "0.5974011", "0.59259033", "0.58765393", "0.5808511", "0.575421", "0.5747473", "0.56747955", "0.56574196", "0.56556", "0.5649466", "0.5625648", "0.5590939", "0.55859196", "0.5580922", "0.5556306", "0.5543951", "0.55151266", "0.5497152", "0.5461999", "0.54539055", "0.54313004", "0.54313004", "0.540435", "0.53877276", "0.5373123", "0.5326181" ]
0.7063489
0
/ v2: Return an array of custdata for the memberId. Calling script to test for ofitems in array: 0=none, >=1 if some. Return errorstring if the lookup failed. / v1: Return TRUE if the Civi membership number is known in ISC4C custdata. Return FALSE if not. Return errorstring if the lookup failed. Is there something to gain by getting some data, such a numberof persons from custdata at this point? Names for household members?
function searchIS4C($member) { global $dbConn2; $is4cMembers = array(); $sel = "SELECT CardNo, personNum, FirstName, LastName FROM custdata where CardNo = ${member};"; $rslt = $dbConn2->query("$sel"); if ( $dbConn2->errno ) { $msg = sprintf("Error: DQL failed: %s\n", $dbConn2->error); $is4cMembers[] = array($msg); return($is4cMembers); } // What is $rslt if 0 rows? Does it exist? //$n = 0; while ( $row = $dbConn2->fetch_row($rslt) ) { //$n++; $is4cMembers[] = array($row[CardNo], $row[personNum], $row[FirstName], $row[LastName]); } return($is4cMembers); // searchIS4C }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cns_cache_member_details($members)\n{\n require_code('cns_members');\n\n $member_or_list = '';\n foreach ($members as $member) {\n if ($member_or_list != '') {\n $member_or_list .= ' OR ';\n }\n $member_or_list .= 'm.id=' . strval($member);\n }\n if ($member_or_list != '') {\n global $TABLE_LANG_FIELDS_CACHE;\n $member_rows = $GLOBALS['FORUM_DB']->query('SELECT m.*,f.* FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members m LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_member_custom_fields f ON f.mf_member_id=m.id WHERE ' . $member_or_list, null, null, false, true);\n global $TABLE_LANG_FIELDS_CACHE;\n $member_rows_g = $GLOBALS['FORUM_DB']->query('SELECT gm_group_id,gm_member_id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_group_members WHERE gm_validated=1 AND (' . str_replace('m.id', 'gm_member_id', $member_or_list) . ')', null, null, false, true);\n global $MEMBER_CACHE_FIELD_MAPPINGS, $SIGNATURES_CACHE;\n $found_groups = array();\n foreach ($member_rows as $row) {\n $GLOBALS['CNS_DRIVER']->MEMBER_ROWS_CACHED[$row['id']] = $row;\n\n if (!cns_is_ldap_member($row['id'])) {\n // Primary\n $pg = $GLOBALS['CNS_DRIVER']->get_member_row_field($row['id'], 'm_primary_group');\n $found_groups[$pg] = true;\n }\n\n // Signature\n if ((get_page_name() != 'search') && (!is_null($row['m_signature'])) && ($row['m_signature'] !== '') && ($row['m_signature'] !== 0)) {\n $just_row = db_map_restrict($row, array('id', 'm_signature'));\n $SIGNATURES_CACHE[$row['id']] = get_translated_tempcode('f_members', $just_row, 'm_signature', $GLOBALS['FORUM_DB']);\n }\n\n $MEMBER_CACHE_FIELD_MAPPINGS[$row['mf_member_id']] = $row;\n }\n foreach ($member_rows_g as $row) {\n if (!cns_is_ldap_member($row['gm_member_id'])) {\n $found_groups[$row['gm_group_id']] = true;\n }\n }\n\n require_code('cns_groups');\n cns_ensure_groups_cached(array_keys($found_groups));\n }\n}", "function getAllMembers() {\r\n $api = new wlmapiclass($api_adres, $api_m);\r\n $api->return_format = 'php'; // <- value can also be xml or json\r\n\r\n $data = array();\r\n// $data['user_login'] = $name;\r\n// $data['user_email'] = $email;\r\n// // $data['custom_exp_date']=$expDate;\r\n $response = $api->get('/members');\r\n $response = unserialize($response);\r\n\r\n // $response = $api->post('/levels',$data)\r\n\r\n if (secssesResponce($response)) {\r\n\r\n $mem = $response['members']['member']; //hold array of all members \r\n\r\n return($mem);\r\n }\r\n}", "function fetchThisCompanyMembers($companyId)\n{\t\n\t$data= array();\t\n\t\n\t//the defaults starts\n\tglobal $myStaticVars;\n\textract($myStaticVars); // make static vars local\n\t$member_default_avatar \t\t= $member_default_avatar;\n\t$member_default_cover\t\t= $member_default_cover;\n\t$member_default\t\t\t\t= $member_default;\n\t$company_default_cover\t\t= $company_default_cover;\n\t$company_default_avatar\t\t= $company_default_avatar;\n\t$events_default\t\t\t\t= $events_default;\n\t$event_default_poster\t\t= $event_default_poster;\n\t//the defaults ends\n\t\n\t$allCompanyMemberIds=getAllCompanyMemberIDs($companyId);\n\t\n\tif(!empty($allCompanyMemberIds))\n\t{\n\t\t$allCompanyMemberString = implode(\",\", $allCompanyMemberIds);\n\t\n\t\t$qry=\"SELECT CI.clientid,CI.firstname,CI.lastname,CI.username,CP.designation,CP.avatar \n\t\t FROM entrp_login AS CI \n\t\t LEFT JOIN client_profile AS CP ON CP.clientid=CI.clientid\n\t\t WHERE CI.clientid IN (\".$allCompanyMemberString.\") AND CI.status=1\n\t\t ORDER BY CI.clientid ASC\t \n\t\t \";\n\t\t$res=getData($qry);\n\t $count_res=mysqli_num_rows($res);\n\t $i=0; //to initiate count\n\t if($count_res>0)\n\t {\n\t \twhile($row=mysqli_fetch_array($res))\n\t {\n\t \tif(!empty($row['clientid']))\n\t \t{\n\t \t\t$data[$i]['id']\t\t\t\t=\t$row['clientid'];\n\t \t}\n\t \telse\n\t \t{\n\t \t\t$data[$i]['id']\t\t\t\t=\t\"\";\n\t \t}\n\t \t\n\t \tif(!empty($row['firstname']))\n\t \t{\n\t \t\t$data[$i]['firstName']\t\t=\t$row['firstname'];\n\t \t}\n\t \telse\n\t \t{\n\t \t\t$data[$i]['firstName']\t\t=\t\"\";\n\t \t}\n\t \t\n\t \tif(!empty($row['username']))\n\t \t{\n\t \t\t$data[$i]['username']\t\t=\t$row['username'];\n\t \t}\n\t \telse\n\t \t{\n\t \t\t$data[$i]['username']\t\t=\t\"\";\n\t \t}\n\t\t\t\t\n\t\t\t\tif(!empty($row['lastname']))\n\t \t{\n\t \t\t$data[$i]['lastName']\t\t=\t$row['lastname'];\n\t \t}\n\t \telse\n\t \t{\n\t \t\t$data[$i]['lastName']\t\t=\t\"\";\n\t \t}\n\t\t\t\t\n\t\t\t\tif(!empty($row['avatar']))\n\t \t{\n\t \t\t$data[$i]['profilePhoto']\t\t\t=\t$row['avatar'];\n\t \t}\n\t \telse\n\t \t{\n\t \t\t$data[$i]['profilePhoto']\t\t\t=\t$member_default;\n\t \t}\n\t\t\t\t\n\t\t\t\t$i++;\n\t }\t\n\t }\t\t\n\t}\n\treturn $data;\n}", "public function memberList($eid = 1) {\n $config = $this->config('simple_conreg.settings.'.$eid);\n $countryOptions = SimpleConregOptions::memberCountries($eid, $config);\n $types = SimpleConregOptions::badgeTypes($eid, $config);\n $digits = $config->get('member_no_digits');\n\n switch(isset($_GET['sort']) ? $_GET['sort'] : '') {\n case 'desc':\n $direction = 'DESC';\n break;\n default:\n $direction = 'ASC';\n break;\n }\n switch(isset($_GET['order']) ? $_GET['order'] : '') {\n case 'Name':\n $order = 'name';\n break;\n case 'Country':\n $order = 'country';\n break;\n case 'Type':\n $order = 'badge_type';\n break;\n default:\n $order = 'member_no';\n break;\n }\n\n $content = array();\n\n //$content['#markup'] = $this->t('Unpaid Members');\n\n $content['message'] = array(\n '#cache' => ['tags' => ['simple-conreg-member-list'], '#max-age' => 600],\n '#markup' => $this->t('Members\\' public details are listed below.'),\n );\n\n $rows = [];\n $headers = [\n 'member_no' => ['data' => t('Member No'), 'field' => 'm.member_no', 'sort' => 'asc'],\n 'member_name' => ['data' => t('Name'), 'field' => 'name'],\n 'badge_type' => ['data' => t('Type'), 'field' => 'm.badge_type', 'class' => [RESPONSIVE_PRIORITY_LOW]],\n 'member_country' => ['data' => t('Country'), 'field' => 'm.country', 'class' => [RESPONSIVE_PRIORITY_MEDIUM]],\n ];\n $total = 0;\n\n foreach ($entries = SimpleConregStorage::adminPublicListLoad($eid) as $entry) {\n // Sanitize each entry.\n $badge_type = trim($entry['badge_type']);\n $member_no = sprintf(\"%0\".$digits.\"d\", $entry['member_no']);\n $member = ['member_no' => $badge_type . $member_no];\n switch ($entry['display']) {\n case 'F':\n $fullname = trim(trim($entry['first_name']) . ' ' . trim($entry['last_name']));\n if ($fullname != trim($entry['badge_name']))\n $fullname .= ' (' . trim($entry['badge_name']) . ')';\n $member['name'] = $fullname;\n break;\n case 'B':\n $member['name'] = trim($entry['badge_name']);\n break;\n case 'N':\n $member['name'] = t('Name withheld');\n break;\n }\n $member['badge_type'] = trim(isset($types[$badge_type]) ? $types[$badge_type] : $badge_type);\n $member['country'] = trim(isset($countryOptions[$entry['country']]) ? $countryOptions[$entry['country']] : $entry['country']);\n\n // Set key to field to be sorted by.\n if ($order == 'member_no')\n $key = $member_no;\n else\n $key = $member[$order] . $member_no; // Append member number to ensure uniqueness.\n if (!empty($entry['display']) && $entry['display'] != 'N' && !empty($entry['country'])) {\n $rows[$key] = $member;\n }\n $total++;\n }\n\n // Sort array by key.\n if ($direction == 'DESC')\n krsort($rows);\n else\n ksort($rows);\n\n $content['table'] = array(\n '#type' => 'table',\n '#header' => $headers,\n //'#footer' => array(t(\"Total\")),\n '#rows' => $rows,\n '#empty' => t('No entries available.'),\n );\n\n $content['summary_heading'] = [\n '#markup' => $this->t('Country Breakdown'),\n '#prefix' => '<h2>',\n '#suffix' => '</h2>',\n ];\n\n $rows = array();\n $headers = array(\n t('Country'),\n t('Number of members'),\n );\n $total = 0;\n foreach ($entries = SimpleConregStorage::adminMemberCountrySummaryLoad($eid) as $entry) {\n if (!empty($entry['country'])) {\n // Sanitize each entry.\n $entry['country'] = trim($countryOptions[$entry['country']]);\n $rows[] = $entry;\n $total += $entry['num'];\n }\n }\n //Add a row for the total.\n $rows[] = array(t(\"Total\"), $total);\n $content['summary'] = array(\n '#type' => 'table',\n '#header' => $headers,\n '#rows' => $rows,\n '#empty' => t('No entries available.'),\n );\n // Don't cache this page.\n //$content['#cache']['max-age'] = 0;\n\n return $content;\n }", "public function getSoMember($id){\r\n \t$record = $this->_backend->get($id, false, true);\r\n \tif($record->getForeignId('fee_group_id')){\r\n \t\t$feeGroupId = $record->getForeignId('fee_group_id');\r\n \t\t$dueDate = $this->getDueDate();\r\n \t\t$dateFilter = $dueDate->toString('yyyy-MM-dd');//.' 00:00:00';\r\n \t\r\n \t\t\r\n \t\t$fgFilter = new Membership_Model_MembershipFeeGroupFilter(array(\r\n\t array('field' => 'no_member', 'operator' => 'isnull', 'value' => null),\r\n\t array('field' => 'valid_from_datetime', 'operator' => 'beforeOrAt', 'value' => $dateFilter),\r\n\t array('field' => 'valid_to_datetime', 'operator' => 'afterAtOrNull', 'value' => $dateFilter),\r\n\t array('field' => 'fee_group_id', 'operator'=> 'AND', 'value' => array(array('field'=>'id','operator'=>'equals','value'=>$feeGroupId)))\r\n\t ),'AND');\r\n\t $memFeeGroups = Membership_Controller_MembershipFeeGroup::getInstance()->search($fgFilter);\r\n\t $catSums = array();\r\n\t foreach($memFeeGroups as $mFeeGroup){\r\n\t \t$article = $mFeeGroup->getForeignRecord('article_id', Billing_Controller_Article::getInstance());\r\n\t \t$value = $mFeeGroup->__get('price');\r\n\t \t$label = $article->__get('name');\r\n\t \t$category = $mFeeGroup->__get('category');\r\n\t \t$summarize = $mFeeGroup->__get('summarize');\r\n\t \t$data = array('label' => $label, 'value' => $value, 'category' => $category, 'summarize' => $summarize);\r\n\t \t$result[] = $data;\r\n\t \tif(!array_key_exists($category, $catSums)){\r\n\t \t\t$catSums[$category] = 0;\r\n\t \t\t$catSums['X'.$category] = 0;\r\n\t \t\t$catSums['Y'.$category] =0;\r\n\t \t}\r\n\t \tif($summarize){\r\n\t \t\t$catSums[$category] += $value;\r\n\t \t\t$catSums['X'.$category] += $value;\r\n\t \t}\r\n\t }\r\n\t \r\n\t if($parentMemberId = $record->getForeignId('parent_member_id')){\r\n\t \tif($memFeeGroup = Membership_Controller_MembershipFeeGroup::getInstance()->getForFeeGroupAndMember($parentMemberId, $feeGroupId)){\r\n\t\t \t$article = $memFeeGroup->getForeignRecord('article_id', Billing_Controller_Article::getInstance());\r\n\t\t \t$value = $memFeeGroup->__get('price');\r\n\t\t \t$label = $article->__get('name');\r\n\t\t \t$category = $memFeeGroup->__get('category');\r\n\t \t\t$summarize = $memFeeGroup->__get('summarize');\r\n\t \t\t$data = array('label' => $label, 'value' => $value, 'category' => $category, 'summarize' => $summarize);\r\n\t \t\t$result[] = $data;\r\n\t\t \tif(!array_key_exists($category, $catSums)){\r\n\t\t \t\t$catSums[$category] = 0;\r\n\t\t \t\t\r\n\t\t \t}\r\n\t\t \tif($summarize){\r\n\t\t \t\t$catSums[$category] += $value;\r\n\t\t \t\t$catSums['Y'.$category] += $value;\r\n\t\t \t}\r\n\t \t}\r\n\t }\r\n\t $record->__set('feegroup_prices', array(\r\n\t \t'items' => $result,\r\n\t \t'sums' => $catSums\r\n\t ));\r\n \t}\r\n \treturn $record;\r\n }", "function culturefeed_pages_manage_members_list(CultureFeed_Cdb_Item_Page $page, CultureFeed_Pages_UserList $user_list, $cf_user = NULL) {\n\n // Get all the uid's in 1 time. Otherwise the theming layer will search it 1 by 1.\n culturefeed_get_uids_for_memberships($user_list->memberships);\n\n $header = array(\n t('Name'),\n t('Function'),\n t('Role'),\n t('Member since'),\n '',\n '',\n );\n\n // Count how many admins.\n $admins = array();\n foreach ($user_list->memberships as $member) {\n if ($member->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {\n $admins[] = $member;\n }\n }\n $total_admins = count($admins);\n\n $rows = array();\n // Create row for every member.\n foreach ($user_list->memberships as $member) {\n\n $row = array();\n\n $name = '';\n $depiction = !empty($member->user->depiction) ? $member->user->depiction : 'http://media.uitid.be/fis/rest/download/ce126667652776f0e9e55160f12f5478/uiv/default.png';\n $name = '<span class=\"depiction\">' . theme('image', array('path' => $depiction . '?width=30&height=30&crop=auto')) . '</span>';\n $drupal_uid = culturefeed_get_uid_for_cf_uid($member->user->id, $member->user->nick);\n $name .= l($member->user->nick, 'user/' . $drupal_uid);\n\n $row['name'] = $name;\n\n // Show the user data.\n if (empty($cf_user) || $cf_user->id != $member->user->id) {\n\n $row['function'] = $member->relation;\n switch ($member->role) {\n case CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN:\n $role = t('administrator');\n break;\n case CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER:\n default:\n $role = t('member');\n break;\n }\n $row['role'] = $role;\n $row['member_since'] = date('d/m/Y H:i', $member->creationDate);\n $row['edit'] = l(t('Edit'), 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/edit/nojs', array('attributes' => array('class' => 'use-ajax')));\n\n if ($total_admins == 1 && $member->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {\n $row['delete'] = theme('culturefeed_pages_membership_delete_not_possible', array('page' => $page));\n }\n else {\n $delete_options = array(\n 'attributes' => array(\n 'role' => 'button',\n 'data-toggle' => 'modal',\n 'data-target' => '#page_confirm',\n 'data-remote' => url('pages/' . $page->getId() . '/membership/' . $member->user->id . '/delete/ajax'),\n ),\n );\n $row['delete'] = l(t('Remove as member'), 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/delete/nojs', $delete_options);\n }\n }\n // Show the edit form.\n else {\n\n $form = drupal_get_form('culturefeed_pages_edit_membership_form', $page, $cf_user, $user_list);\n $row['function'] = array(\n 'data' => render($form),\n 'colspan' => 2,\n );\n $row['member_since'] = date('d/m/Y H:i', $member->creationDate);\n $row['cancel'] = array(\n 'data' => l(t('Cancel changes'), 'pages/' . $page->getId() . '/members/nojs', array('attributes' => array('class' => 'use-ajax'))),\n 'colspan' => 2,\n );\n\n }\n\n $rows[] = array('data' => $row, 'id' => 'member-' . $member->user->id);\n\n }\n\n return array(\n '#theme' => 'table',\n '#header' => $header,\n '#rows' => $rows,\n '#empty' => t('No content available.'),\n '#attached' => array('library' => array(array('system', 'drupal.ajax'))),\n '#prefix' => '<div id=\"manage-members\">',\n '#suffix' => '</div>',\n );\n\n}", "function InfGetReferralInfo($inf_contact_id) {\n\n $object_type = \"Referral\";\n $class_name = \"Infusionsoft_\" . $object_type;\n $object = new $class_name();\n // Order by most recent IP\n#\t$objects = Infusionsoft_DataService::query(new $class_name(), array('ContactId' => $payment['ContactId']));\n $objects = Infusionsoft_DataService::queryWithOrderBy(new $class_name(), array('ContactId' => $inf_contact_id), 'DateSet', false);\n\n $referral_array = array();\n foreach ($objects as $i => $object) {\n $referral_array[$i] = $object->toArray();\n }\n\n $aff_ip_array = array();\n $j = 0;\n foreach ($referral_array as $i => $referral) {\n if (!in_array($referral['IPAddress'], $aff_ip_array)) {\n $j++;\n $aff_ip_array[$j]['ip'] = $referral['IPAddress'];\n $aff_ip_array[$j]['inf_aff_id'] = $referral['AffiliateId'];\n }\n }\n return $aff_ip_array;\n}", "public static function getmemberData()\n {\n\n $get=DB::table('users')->where('user_type','=','vendor')->where('drop_status','=','no')->orderBy('id', 'desc')->get();\n\t$value = $get->count(); \n return $value;\n\t\n }", "function get_list_members($listid, $action = 'members')\n\t{\n\t\t$xml = $this->load_url(\"lists/$listid/$action\");\n\n\t\tif(!$xml):\n\t\t\treturn false;\n\t\tendif;\n\n\t\t// parse into nicer array\n\t\t$contacts = array();\n\t\t$_members = (isset($xml['feed']['entry'])) ? $xml['feed']['entry'] : false;\n\n\n\t\tif(isset($xml['feed']['link']['2_attr']['rel']) && $xml['feed']['link']['2_attr']['rel'] == 'first'):\n\t\t\t$this->member_meta_data->first_page = $this->get_id_from_link($xml['feed']['link']['2_attr']['href']);\n\t\t\t$this->member_meta_data->current_page = $this->get_id_from_link($xml['feed']['link']['3_attr']['href']);\n\t\t\t$this->member_meta_data->next_page = '';\n\t\telseif(isset($xml['feed']['link']['2_attr']['rel']) && $xml['feed']['link']['2_attr']['rel'] == 'next'):\n\t\t\t$this->member_meta_data->next_page = $this->get_id_from_link($xml['feed']['link']['2_attr']['href']);\n\t\t\t$this->member_meta_data->current_page = $this->get_id_from_link($xml['feed']['link']['3_attr']['href']);\n\t\t\t$this->member_meta_data->first_page = $this->get_id_from_link($xml['feed']['link']['4_attr']['href']);\n\t\tendif;\n\n\t\tif(is_array($_members)):\n\t\t\tif(isset($_members[0]['link_attr']['href'])):\n\t\t\t\tforeach($_members as $k => $v):\n\t\t\t\t\t$EmailAddress = $v['content']['ContactListMember']['EmailAddress'];\n\t\t\t\t\t$Name = $v['content']['ContactListMember']['Name'];\n\t\t\t\t\t$id = $this->get_id_from_link($v['link_attr']['href']);\n\n\t\t\t\t\t$contact = array(\n\t\t\t\t\t\t'id' => $id,\n\t\t\t\t\t\t'EmailAddress' => $EmailAddress,\n\t\t\t\t\t\t'Name' => $Name,\n\t\t\t\t\t);\n\t\t\t\t\t$contacts[] = $contact;\n\t\t\t\tendforeach;\n\t\t\telse:\n\t\t\t\t$EmailAddress = $_members['content']['ContactListMember']['EmailAddress'];\n\t\t\t\t$Name = $_members['content']['ContactListMember']['Name'];\n\t\t\t\t$id = $this->get_id_from_link($_members['link_attr']['href']);\n\n\t\t\t\t$contact = array(\n\t\t\t\t\t'id' => $id,\n\t\t\t\t\t'EmailAddress' => $EmailAddress,\n\t\t\t\t\t'Name' => $Name,\n\t\t\t\t);\n\t\t\t\t$contacts[] = $contact;\n\t\t\tendif;\n\t\tendif;\n\n\t\treturn $contacts;\n\t}", "function InfInsertMember($db, $inf_contact_id, $sponsor_id = false, $inf_product_id = false, $inf_payment_id = false, $inf_invoice_id = false) {\n\n\tif (DEBUG) EchoLn(\"ContactId: $inf_contact_id\");\n\n\t$contact = InfGetContactDetails($inf_contact_id);\n\n\t# Look up if the member already exists or not\n\t$query = \"SELECT m.member_id \n\t\t\t\tFROM members m\n\t\t\t\tWHERE inf_contact_id='{$contact['Id']}'\n\t\t\t\tLIMIT 1\";\n\tif (DEBUG) EchoLn($query);\n\t$result = mysqli_query($db, $query) or die(mysqli_error($db) . '. ' . $query);\n\tif ($row = mysqli_fetch_assoc($result)) {\n\t\t# FAILURE - Already exists\n\t\treturn array(\"member_id\" => \"\", \"username\" => \"\", \"passwd\" => \"\", \"email\" => \"\", \"name\" => \"\");\n\t}\n\n\t$member_id = false;\n\n\t# See if the customer (email) is an existing member - by checking email\n\t$query = \"SELECT member_id, inf_contact_id\n\t\t\t\tFROM members m\n\t\t\t\tLEFT JOIN member_emails me USING (member_id)\n\t\t\t\tWHERE m.email='{$contact['Email']}'\n\t\t\t\tOR me.alternate_email='{$contact['Email']}'\n\t\t\t\tORDER BY m.create_date ASC, me.create_date DESC\";\n\tif (DEBUG) EchoLn($query);\n\t$result = mysqli_query($db, $query) or die(mysqli_error($db) . '. ' . $query);\n\tif ($row = mysqli_fetch_assoc($result)) {\n\t\t$member_id = $row['member_id'];\n\t\t# If the member was found and didn't have an inf_contact_id, then give it to them.\n\t\tif (!$row['inf_contact_id']) {\n\t\t\t$query = \"UPDATE members \n\t\t\t\t\t\tSET inf_contact_id='{$payment['ContactId']}'\n\t\t\t\t\t\tWHERE member_id='$member_id\";\n\t\t\tif (DEBUG) EchoLn($query);\n\t\t\t$result = mysqli_query($db, $query) or die(mysqli_error($db) . '. ' . $query);\n\t\t\tcontinue;\n\t\t}\n\t}\n\t\n\tif ($sponsor_id) {\n\t\t$sponsor_array['sponsor_id'] = $sponsor_id;\n\t\t$sponsor_array['tracking'] = \"\";\n\t\t$sponsor_array['sponsor_unknown'] = 0;\n\t} else {\n\t\t$sponsor_array = InfGetSponsorDetails($db, $inf_contact_id, $contact);\n\t}\n\n\t# Create new username for the member\n\t# Keep creating them randomly until we find one not being used\n\tdo {\n\t\t$username = substr(str_shuffle(\"abcdefghijkmnopqrstuvwxyz\"), 0, 2).substr(str_shuffle(\"2346789\"), 0, 3);\n\t\t$query = \"SELECT member_id \n\t\t\t\t\tFROM members\n\t\t\t\t\tWHERE username='$username'\";\n\t\tif (DEBUG) EchoLn($query);\n\t\t$result = mysqli_query($db, $query) or die(mysqli_error($db) . '. ' . $query);\n\t} while (mysqli_fetch_assoc($result));\n\n\t$passwd = substr(str_shuffle(\"2346789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ\"), 0, 5);\n\t\n\t$sponsor_row = GetRowMemberDetails($db, $sponsor_array['sponsor_id']);\n\t\n\t# Assign their coaches \n\t$coach_id_setup = GetCoachId ($db, \"setup\");\n\tif (isset($sponsor_row['team_leader_id']) && $sponsor_row['team_leader_id'] <> 0) {\n\t\t// Special case for 173 (he's team leader closing strategy sales himself\n\t\t$coach_id_scale = $sponsor_row['team_leader_id'];\n\t} else {\n\t\t$coach_id_scale = GetCoachId ($db, \"scale\");\n\t}\n\t$coach_id_traffic = GetCoachId ($db, \"traffic\");\n\t$coach_id_success = GetCoachId ($db, \"success\");\n\t\n\t// If they are coming in at RISE and above then open up step 8 for them\n\t$step_sql = '';\n\tif (in_array($inf_product_id, array(INF_PRODUCT_ID_BAS_RIS_H, INF_PRODUCT_ID_BAS_RIS_C))) {\n\t\t$step_sql = \", steps_completed = 1.6\n\t\t\t\t\t, step_unlocked = 2.2\";\t\n\t\t$coach_id_startup = 0;\n\t\tEmailNewMemberCoach($db, \"S2\", $coach_id_setup, $member_row);\n\t} else {\n\t\tEmailNewMemberCoach($db, \"S1\", $coach_id_startup, $member_row);\n\t\t$coach_id_startup = GetCoachId ($db, \"startup\");\t\t\n\t}\n\n\t$date = date(\"Y-m-d H:i:s\", strtotime($contact['DateCreated']));\n// , inf_aff_id\t='$inf_aff_id'\n\t$query = \"INSERT INTO members\n\t\t\t\tSET inf_contact_id\t='{$contact['Id']}'\n\t\t\t\t, sponsor_id\t\t='{$sponsor_array['sponsor_id']}'\n\t\t\t\t, team_leader_id\t='{$sponsor_row['team_leader_id']}'\n\t\t\t\t, username\t\t\t='$username'\n\t\t\t\t, passwd\t\t\t='$passwd'\n\t\t\t\t, name\t\t\t='{$contact['FirstName']} {$contact['LastName']}'\n\t\t\t\t, email\t\t\t='{$contact['Email']}'\n\t\t\t\t, phone\t\t\t='{$contact['Phone1']}'\n\t\t\t\t, first_name\t='{$contact['FirstName']}'\n\t\t\t\t, last_name\t\t='{$contact['LastName']}'\n\t\t\t\t, address\t\t='{$contact['StreetAddress1']}'\n\t\t\t\t, city\t\t\t='{$contact['City']}'\n\t\t\t\t, state\t\t\t='{$contact['State']}'\n\t\t\t\t, zip\t\t\t='{$contact['PostalCode']}'\n\t\t\t\t, country\t\t='{$contact['Country']}'\n\t\t\t\t, t\t\t\t\t='{$sponsor_array['tracking']}'\n\t\t\t\t, ip\t\t\t='{$_SERVER['REMOTE_ADDR']}'\n\t\t\t\t$step_sql\n\t\t\t\t, sponsor_unknown\t='{$sponsor_array['sponsor_unknown']}'\n\t\t\t\t, join_date\t\t\t='$date'\n\t\t\t\t, create_date\t\t=NOW()\";\n\tif (DEBUG) EchoLn($query);\n\t$result = mysqli_query($db, $query) or die(mysqli_error($db) . '. ' . $query);\n\t$member_id = mysqli_insert_id($db);\n\n\t_InfGiveBonuses ($db, $inf_contact_id, $inf_product_id, $inf_payment_id, $inf_invoice_id, $card_id);\n\t\n\t# SUCCESS\n\t$query = \"INSERT INTO member_coaches\n\t\t\t\tSET member_id\t='$member_id'\n\t\t\t\t, coach_id_startup\t='$coach_id_startup'\n\t\t\t\t, coach_id_setup\t='$coach_id_setup'\n\t\t\t\t, coach_id_scale\t='$coach_id_scale'\n\t\t\t\t, coach_id_traffic\t='$coach_id_traffic'\n\t\t\t\t, coach_id_success\t='$coach_id_success'\n\t\t\t\t, start_date\t\t='$date'\";\n if (DEBUG) EchoLn($query);\n\t$result = mysqli_query($db, $query) or die(mysqli_error($db) . '. ' . $query);\n\n\t# Remove from GetResponse\n\tGRMoveContactCampaign($contact['Email']);\n\n\t$member_row = GetRowMember($db, $member_id);\n\t\n\t# Email Member, Welcome Coach, S1 Coach and Sponsor \n\tEmailNewMember($db, $member_id);\n\tEmailNewMemberCoach($db, \"Welcome\", $coach_id_setup, $member_row);\n\tEmailNewMemberSponsor($db, $sponsor_row, $member_row, $inf_product_id);\n\t\t\t\t\n\treturn $member_row;\n}", "public function compactList(){\n $output = array();\n $members = $this->members;\n foreach ($members as $value) {\n $member = array(\n 'id' => $value['id'],\n 'name' => $value['firstName'] . \" \" . $value['lastName'],\n 'num_boats' => count($value['boats'])\n );\n array_push($output, $member);\n }\n return $output;\n }", "function getMemberContractList() {\n $sql = \"SELECT b.* \n FROM user_contract a INNER JOIN contract b ON a.contract_id = b.id \n WHERE a.user_type = 'member' AND a.uid = ? \n ORDER BY b.id DESC\";\n return getAll($sql, [getLogin()['mid']]);\n}", "function getMembers() {\n\t\t$query = $this->createQuery();\n\t\t$query .= \"WHERE c2.status = '\" . KontakteData::$STATUS_MEMBER . \"'\";\n\t\t$query .= \" OR c2.status = '\" . KontakteData::$STATUS_ADMIN . \"' \";\n\t\t$query .= \"ORDER BY c2.name ASC\";\n\t\treturn $this->database->getSelection($query);\n\t}", "public function getRegisteredNumbersAction($header_data){\n try {\n $user = Users::findById($header_data['id']);\n if($header_data['os'] == 1) {\n $contact_numbers = json_decode($user->contact_numbers);\n } else {\n $contact_numbers = $user->contact_numbers;\n }\n $i = 0;\n $register = array();\n foreach($contact_numbers as $contacts) {\n $get_contacts = str_replace(' ', '', $contacts); \n $get_contacts = str_replace('+91', '', $contacts); \n if(substr($get_contacts, 0, 1) == \"0\") {\n $get_contacts = substr($get_contacts, 1);\n //$get_contacts = preg_replace('/0/', '', $get_contacts, 1); \n }\n $filter_contacts= preg_replace('/[^0-9\\-]/', '', $get_contacts);\n $filter_contacts = str_replace('-', '', $filter_contacts); \n if( $user->mobile_no == $filter_contacts ){\n continue;\n }\n $db = Library::getMongo();\n $record = $db->execute('return db.users.find({\"mobile_no\":{$in:[\"'.$filter_contacts.'\", \"+'.$filter_contacts.'\"]}, \"is_active\":1, \"is_deleted\":0}).toArray()');\n if(!empty($record['retval'][0])) {\n \n if( !empty($user->hidden_contacts) && in_array((string)$record['retval'][0]['_id'], $user->hidden_contacts) ){\n continue;\n }\n if(empty($record['retval'][0][\"is_mobile_searchable\"])) {\n continue;\n }\n if(isset($user->running_groups)) {\n $isFriend = false;\n foreach($user->running_groups as $user_ids) {\n if($user_ids['user_id'] == (string)$record['retval'][0]['_id']) {\n $isFriend = true; \n break;\n }\n }\n if( $isFriend ){\n continue;\n }\n }\n if( isset($user->request_sent) ) {\n $isFriendRequested = false;\n foreach($user->request_sent as $user_ids) {\n if($user_ids['user_id'] == (string)$record['retval'][0]['_id']) {\n $isFriendRequested = true; \n break;\n }\n }\n if( $isFriendRequested ){\n continue;\n }\n }\n if(isset($user->request_pending)) {\n $isRequestPending = false;\n foreach($user->request_pending as $user_ids) {\n if($user_ids['user_id'] == (string)$record['retval'][0]['_id']) {\n $isRequestPending = true; \n break;\n }\n }\n if( $isRequestPending ){\n continue;\n }\n }\n \n $register[$i]['mobile_no'] = $contacts;\n $register[$i]['user_id'] = (string)$record['retval'][0]['_id'];\n $register[$i]['username'] = $record['retval'][0]['username'];\n $register[$i]['jaxl_id'] = $record['retval'][0]['jaxl_id'];\n $register[$i]['profile_image'] = isset($record['retval'][0]['profile_image']) ? FORM_ACTION.$record['retval'][0]['profile_image'] : 'http://www.gettyimages.in/CMS/StaticContent/1391099126452_hero1.jpg';\n $register[$i]['request_sent'] = 0;\n if(isset($user->request_sent)) {\n foreach($user->request_sent as $request_sent) {\n// if($request_sent['is_active'] == 1) {\n// $j = 1;\n// }\n if($request_sent['user_id'] == (string)$record['retval'][0]['_id']) {\n $register[$i]['request_sent'] = 1;\n $register[$i]['is_active'] = $request_sent['is_active'];\n break;\n }\n }\n }\n $i++;\n }\n }\n if(empty($register)) {\n $result = array();\n Library::output(true, '1', \"No Error\", $result);\n } else {\n Library::output(true, '1', \"No Error\", $register);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : setContextIndicator : \".$e.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }", "public function getMemberInformation($facility_id) {\n $options = [\n 'json' => [\n 'CL_GetCustomerBranchInformationInput' => [\n 'CardNumber' => $facility_id,\n ],\n ],\n 'headers' => [\n 'Content-Type' => 'application/json;charset=utf-8',\n ],\n 'auth' => [\n $this->endpointSettings['username'],\n $this->endpointSettings['password'],\n ],\n ];\n try {\n $url = $this->buildApiUrl('CL_GetCustomerBranchInformation');\n $response = $this->client->request('POST', $url, $options);\n\n if ($response->getStatusCode() != '200') {\n throw new \\LogicException(t('API Method GetCustomerBranchInformation is failed.'));\n }\n $body = $response->getBody();\n\n return json_decode($body->getContents());\n }\n catch (\\Exception $e) {\n $this->logger->error('Failed to get Personify data: %msg', [\n '%msg' => $e->getMessage(),\n ]);\n }\n\n return [];\n }", "public static function getDataFromCVsTable($member_id){\n\t\t\n\t\tglobal $db; \n\t\t\n\t\t//set query\n\t\t$query_text = \"SELECT cv_id, cv_url, open_question, fullstack, frontend, backend,\n\t\tUX_UI, BI, QA, DBA, IT FROM cvs WHERE user_id = :user_id\";\n\t\t\n\t\ttry {\n\t\t\t//prepare query\t\t\n\t\t\t$query_statement = $db->prepare($query_text);\n\t\t\t//bind\n\t\t\t$query_statement->bindValue(':user_id', $member_id); \n\t\t\t//execute query\n\t\t\t$query_statement->execute();\n\t\t\t//fetch results\n\t\t\t$result = $query_statement->fetch(PDO::FETCH_ASSOC);\n\t\t}\n\t\t\n\t\tcatch (PDOException $ex) {\n\t\t\t$error_message = $ex->getMessage();\n\t\t\t$result = array('error_message' => $error_message);\n\t\t\treturn $result;\n\t\t}\n\t\t\n\t\treturn $result; \n\t}", "public static function getDataForSettingsUser($member_id){\n\t\t\n\t\t//get data from users TABLE\n\t\t$resultUsers = getDataFromDB::getDataFromUsersTable($member_id);\n\t\t\t\n\t\t//check if an error occured\n\t\tif (key($resultUsers) == 'error_message'){\n\t\t\treturn $resultUsers; \n\t\t}\n\t\t\t\n\t\t//get data from cvs TABLE\n\t\t$resultCVs = getDataFromDB::getDataFromCVsTable($member_id);\n\t\t\t\n\t\t//check if an error occured\n\t\tif (key($resultCVs) == 'error_message'){\n\t\t\treturn $resultCVs; \n\t\t}\n\t\t\t\n\t\t$result = array('contactDetails' => array('email' => $resultUsers['email'], \n\t\t'city' => $resultUsers['city'], 'phoneNumber' => $resultUsers['phone']), \n\t\t'fieldsToGrade' => array('id_1' => $resultUsers['fullstack'],\n\t\t'id_2' => $resultUsers['frontend'], 'id_3' => $resultUsers['backend'],\n\t\t'id_4' => $resultUsers['UX_UI'], 'id_5' => $resultUsers['BI'], 'id_6' => $resultUsers['QA'],\n\t\t'id_7' => $resultUsers['DBA'], 'id_8' => $resultUsers['IT']), 'resume' => \n\t\tarray('id' => $resultCVs['cv_id'], 'url' => $resultCVs['cv_url'],\n\t\t'fieldsInResume' => array('id_1' => $resultCVs['fullstack'],\n\t\t'id_2' => $resultCVs['frontend'], 'id_3' => $resultCVs['backend'], 'id_4' => $resultCVs['UX_UI'],\n\t\t'id_5' => $resultCVs['BI'], 'id_6' => $resultCVs['QA'], 'id_7' => $resultCVs['DBA'],\n\t\t'id_8' => $resultCVs['IT']), 'isSendContactDetails'=>$resultUsers['share_info'],\n\t\t'openQuestion'=>$resultCVs['open_question']));\n\t\t\t\n\t\treturn $result; \n\t}", "function rets_bsf_ismember ($roles, $agent1, $agency1, $agent2, $agency2) {\n\n $ismember1 = rets_bsf_ismember_agent ($roles, $agent1);\n $ismember2 = rets_bsf_ismember_agent ($roles, $agent2);\n\n if ($ismember1 == 'No' && $ismember2 == 'No') {\n return 'No';\n }\n\n // Set the variables for TYPE and UID so we don't error out\n if ($ismember1 == 'No') {\n $type1 = '';\n $uid1 = '';\n } else {\n $type1 = $ismember1[0];\n $uid1 = $ismember1[1];\n }\n if ($ismember2 == 'No') {\n $type2 = '';\n $uid2 = '';\n } else {\n $type2 = $ismember2[0];\n $uid2 = $ismember2[1];\n }\n \n $IsMember = array( \n 'ListAgentID' => $agent1,\n 'ListOfficeID' => $agency1,\n 'ListAgentType' => $type1,\n 'ListAgentUID' => $uid1,\n 'CoListAgentID' => $agent2,\n 'CoListOfficeID' => $agency2,\n 'CoListAgentType' => $type2,\n 'CoListAgentUID' => $uid2,\n );\n\n if ($ismember1 == 'No') {\n $IsMember['ListAgentID'] = $agent2;\n $IsMember['ListOfficeID'] = $agency2;\n $IsMember['ListAgentType'] = $type2;\n $IsMember['ListAgentUID'] = $uid2;\n $ismember2 = 'No';\n } \n if ($ismember2 == 'No') {\n $IsMember['CoListAgentID'] = '';\n $IsMember['CoListOfficeID'] = '';\n $IsMember['CoListAgentType'] = '';\n $IsMember['CoListAgentUID'] = '';\n\t$TeamMember = rets_bsf_get_teammember($roles,$IsMember['ListAgentUID']);\n\tif ($TeamMember<>'No') {\n\t $IsMember['CoListAgentID'] = $TeamMember[0];\n\t $IsMember['CoListOfficeID'] = $TeamMember[1];\n\t $IsMember['CoListAgentType'] = $TeamMember[2];\n\t $IsMember['CoListAgentUID'] = $TeamMember[3];\n\t}\n }\n return $IsMember;\n \n}", "public function get_deal_partner_members($deal_id,$deal_partner_id,$num_to_fetch,&$deal_partner_team_data_arr,&$deal_partner_team_data_count){\n \n }", "function getVisitorVerify($visitor_id){\n\t\t\t\n\t\t\t$query = \"select member_id from tbl_member where member_id = '\".$visitor_id.\"'\";\n\n\t\t\t$rs = $this->Execute($query);\n\t\t\twhile($row = $rs->FetchRow()) {\n\n\t\t\t\t$sSQL= \"select subscriber_id, mail_street_address, mail_city, mail_state, mail_zip_code \n\t\t\t\tfrom tbl_subscriber where subscriber_id='\".$visitor_id.\"'\";\n\t\t\n\t\t\t\t//echo $sSQL;\n\t\t\t\t$rs = $this->Execute($sSQL);\t\t\t\t\n\t\t\t\treturn $this->_getPageArray($rs, 'Member');\n\t\t\t}\n\t\t\treturn false;\t\t\t\n\t\t}", "function membersemailist($memberquery){\n\t$f3=$this->f3;\n\t$members =\tnew Member($this->db);\n\t$memblist=$members->load();\n\t$membemails= $this->db->exec('SELECT distinct(email) as unqemail from members where u3ayear = '.'\"2015-2016\"'. ' and status =\"Active\" and email <> \"\" ' .$memberquery.' order by unqemail;');\n\t$output = iterator_to_array(new RecursiveIteratorIterator(\n new RecursiveArrayIterator($membemails)), FALSE);\n\treturn array_values($output);\n\t\n\t\n}", "public function member( $user, $list )\n\t{\n\t\t$user = $this->sanitize_user( $user );\n\t\tif ( empty( $user->user_email ) || empty( $list ) )\n\t\t{\n\t\t\tdo_action( 'go_slog', 'go-mailchimp', __FUNCTION__ . ': Empty email or list id passed.' );\n\t\t\treturn FALSE;\n\t\t}\n\n\t\ttry\n\t\t{\n\t\t\t$email_struct = array( array( 'email' => $user->user_email ) );\n\t\t\t$member = $this->mc->lists->memberInfo( $list, $email_struct );\n\t\t}//END try\n\t\tcatch ( Exception $e )\n\t\t{\n\t\t\tdo_action( 'go_slog', 'go-mailchimp', __FUNCTION__ . ': An Exception was thrown: ' . $e->getMessage() );\n\t\t\treturn FALSE;\n\t\t}//END catch\n\n\t\tif ( empty( $member ) || empty( $member['data'] ) )\n\t\t{\n\t\t\tdo_action( 'go_slog', 'go-mailchimp', __FUNCTION__ . \": No membership info found for email address '{$user->user_email}' in list: $list\" );\n\t\t\treturn FALSE;\n\t\t}//END if\n\n\t\treturn $member['data'][0];\n\t}", "function getCustomerData()\n {\n if(isset($_SESSION['user_login']) && $_SESSION['user_login']['roll_id']==6)\n {\n /* @changes: all customer display if all_region=1\n * @author: Sagar Jogi dt: 09/08/2017\n */\n $check=DB::query(\"SELECT all_region FROM \" . CFG::$tblPrefix . \"user WHERE id=%d\",$_SESSION['user_login']['id']);\n if($check[0]['all_region']=='1') {\n return DB::query(\"SELECT id,name FROM \" . CFG::$tblPrefix . \"user where roll_id='7' and active='1' order by id desc\");\n } else {\n $customer_array=array();\n //$query=\"SELECT GROUP_CONCAT(DISTINCT(ID)) as id FROM \" . CFG::$tblPrefix . \"region WHERE find_in_set('\".$_SESSION['user_login']['id'].\"',engineer) <> 0\";\n $query=\"SELECT region as id FROM \" . CFG::$tblPrefix . \"user WHERE id=\".$_SESSION['user_login']['id'];\n \n $result=DB::query($query);\n \n if(count($result) > 0)\n {\n foreach($result as $key=>$value)\n {\n $region=explode(\",\",$value[\"id\"]);\n for($i=0;$i<count($region);$i++)\n {\n $customer_query=\"SELECT u.id, u.name\n FROM \" . CFG::$tblPrefix . \"user AS u\n WHERE active='1' and FIND_IN_SET( u.id, (\n\n SELECT GROUP_CONCAT( DISTINCT (\n ID\n ) ) AS id\n FROM \" . CFG::$tblPrefix . \"user\n WHERE find_in_set( '\".$region[$i].\"', region ) <>0 )\n ) and roll_id=7 \";\n \n $customer_result=DB::query($customer_query);\n if(count($customer_result) > 0)\n {\n foreach($customer_result as $ckey=>$cvalue)\n {\n \n array_push($customer_array,$cvalue);\n }\n } \n }\n }\n $customer_unique_array = array_map(\"unserialize\", array_unique(array_map(\"serialize\", $customer_array)));\n \n return $customer_unique_array;\n }\n }\n \n }\n else \n return DB::query(\"SELECT id,name FROM \" . CFG::$tblPrefix . \"user where roll_id='7' and active='1' order by id desc\");\n }", "static function customerList( $offset, $limit )\n {\n $db = eZDB::instance();\n\n $db_params = array();\n $db_params[\"offset\"] =(int) $offset;\n $db_params[\"limit\"] =(int) $limit;\n\n $customEmailResult = $db->arrayQuery( \"SELECT DISTINCT email FROM ezorder WHERE is_temporary='0' ORDER BY email\", $db_params );\n $customEmailArray = array();\n\n foreach( $customEmailResult as $customEmailRow )\n {\n $customEmail = $customEmailRow['email'];\n $customEmailArray[] = \"'\" . $customEmail . \"'\";\n }\n\n $emailString = implode( \", \", $customEmailArray );\n if ( !strlen( $emailString ) )\n {\n $emailString = \"''\";\n }\n\n $productItemArray = $db->arrayQuery( \"SELECT ezorder.id as order_id, user_id, email, ignore_vat, currency_code, ezproductcollection_item.*\n FROM ezorder, ezproductcollection_item, ezproductcollection\n WHERE ezproductcollection_item.productcollection_id=ezorder.productcollection_id\n AND is_temporary='0'\n AND ezproductcollection_item.productcollection_id=ezproductcollection.id\n AND email in ( $emailString )\n ORDER BY user_id, email, order_id\" );\n\n\n $siteIni = eZINI::instance();\n $anonymousUserID = $siteIni->variable( 'UserSettings', 'AnonymousUserID' );\n\n $currentUserID = 0;\n $currentOrderID = 0;\n $currentUserEmail = \"\";\n $customArray = array();\n $accountName = null;\n $account_information = null;\n $itemCount = 0;\n $hash = 0;\n $currencyCode = '';\n $ordersInfo = array();\n\n foreach( $productItemArray as $productItem )\n {\n $itemCount++;\n $currencyCode = $productItem['currency_code'];\n if ( $currencyCode == '' )\n {\n $currencyCode = eZOrder::fetchLocaleCurrencyCode();\n }\n\n $userID = $productItem['user_id'];\n $orderID = $productItem['order_id'];\n $order = eZOrder::fetch( $orderID );\n\n if ( $currentUserID != $userID && $itemCount != 1 )\n {\n $customArray[] = array( 'account_name' => $accountName,\n 'orders_info' => $ordersInfo,\n 'user_id' => $currentUserID,\n 'email' => urlencode( $currentUserEmail ),\n 'account_information' => $account_information);\n\n $ordersInfo = array();\n $accountName = $order->attribute( 'account_name' );\n $accountEmail = $order->attribute( 'account_email' );\n $account_information = $order->accountInformation();\n }\n\n $currentUserID = $userID;\n\n // If the custom is anoymous user\n if ( $currentUserID == $anonymousUserID )\n {\n $accountEmail = $order->attribute( 'email' );\n if ( $currentUserEmail == \"\" )\n {\n $accountName = $order->attribute( 'account_name' );\n $currentUserEmail = $accountEmail;\n }\n\n if ( $currentUserEmail != $accountEmail )\n {\n $customArray[] = array( 'account_name' => $accountName,\n 'orders_info' => $ordersInfo,\n 'user_id' => $currentUserID,\n 'email' => urlencode( $currentUserEmail ),\n 'account_information' => $account_information);\n\n $ordersInfo = array();\n $accountName = $order->attribute( 'account_name' );\n $accountEmail = $order->attribute( 'account_email' );\n $currentUserEmail = $accountEmail;\n $account_information = $order->accountInformation();\n }\n $currentUserEmail = $accountEmail;\n }\n else\n {\n $currentUserEmail = 0;\n }\n\n $accountName = $order->attribute( 'account_name' );\n $account_information = $order->accountInformation();\n\n if ( !isset( $ordersInfo[$currencyCode] ) )\n {\n $ordersInfo[$currencyCode] = array( 'order_count' => 0,\n 'sum_ex_vat' => 0,\n 'sum_inc_vat' => 0 );\n }\n\n if ( $currentOrderID != $orderID )\n {\n $ordersInfo[$currencyCode]['order_count']++;\n }\n $currentOrderID = $orderID;\n\n if ( $productItem['ignore_vat'] == true )\n {\n $vatValue = 0;\n }\n else\n {\n $vatValue = $productItem['vat_value'];\n }\n\n $price = $productItem['price'];\n\n if ( $productItem['is_vat_inc'] )\n {\n $priceExVAT = $price / ( 100 + $vatValue ) * 100;\n $priceIncVAT = $price;\n }\n else\n {\n $priceExVAT = $price;\n $priceIncVAT = $price * ( 100 + $vatValue ) / 100;\n }\n\n $count = $productItem['item_count'];\n $realPricePercent = ( 100 - $productItem['discount'] ) / 100;\n $ordersInfo[$currencyCode]['sum_ex_vat'] += round( $count * $priceExVAT * $realPricePercent, 2 );\n $ordersInfo[$currencyCode]['sum_inc_vat'] += round( $count * $priceIncVAT * $realPricePercent, 2 );\n }\n\n if ( count( $productItemArray ) != 0 )\n $customArray[] = array( 'account_name' => $accountName,\n 'orders_info' => $ordersInfo,\n 'user_id' => $currentUserID,\n 'email' => urlencode( $currentUserEmail ),\n 'account_information' => $account_information);\n return $customArray;\n }", "public function front_get_deals_of_member_paged($member_id,$num_to_fetch,$start_offset,&$data_arr,&$data_count){\n $db = new db();\n\t\t\n\t\t$q = \"select t.date_of_deal,t.id as deal_id,t.deal_cat_name,t.deal_subcat1_name,t.deal_subcat2_name,t.value_in_billion,pm.designation,firm.name AS firm_name,t.value_range_id,vrm.display_text as fuzzy_value FROM \".TP.\"transaction_partner_members AS pm LEFT JOIN \".TP.\"transaction AS t ON ( pm.transaction_id = t.id ) LEFT JOIN \".TP.\"company AS firm ON ( pm.partner_id = firm.company_id ) LEFT JOIN \".TP.\"transaction_value_range_master as vrm ON (t.value_range_id=vrm.value_range_id) WHERE member_id = '\".$member_id.\"' and t.is_active='y' ORDER BY t.date_of_deal DESC LIMIT \".$start_offset.\" , \".$num_to_fetch;\n\t\t\n $ok = $db->select_query($q);\n\t\tif(!$ok){\n\t\t\t\n\t\t\treturn false;\n\t\t}\n $data_count = $db->row_count();\n if(0 == $data_count){\n //no deals done by this member\n return true;\n }\n\t\t$data_arr = $db->get_result_set_as_array();\n\t\t/****************\n\t\tget the participants\n\t\t**************/\n\t\trequire_once(\"classes/class.transaction_company.php\");\n\t\t$g_trans_comp = new transaction_company();\n\t\tfor($k=0;$k<$data_count;$k++){\n\t\t\t$data_arr[$k]['participants'] = NULL;\n\t\t\t$success = $g_trans_comp->get_deal_participants($data_arr[$k]['deal_id'],$data_arr[$k]['participants']);\n\t\t\tif(!$success){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n }", "function lobby_membersapi_getMemberships($args)\r\n{\r\n\t$uid = (int)$args['uid'];\r\n\tif ($uid == 0) {\r\n\t\treturn false;\r\n\t} else {\r\n\t \t$tables = pnDBGetTables();\r\n\t \t$column = $tables['lobby_members_column'];\r\n\t \t$where = $column['uid'].\" = '\".$uid.\"'\";\r\n\t\t$result = DBUtil::selectObjectArray('lobby_members',$where);\r\n\t\t$r = array();\r\n\t\tforeach ($result as $item) {\r\n\t\t\t$r[]=$item['gid'];\r\n\t\t}\r\n\t\treturn $r;\r\n\t}\r\n}", "function virtualname_GetContactDetails($params){\n //INIT MODULE\n global $vname_admin, $vname_domains, $vname_nameservers, $vname_contacts;\n virtualname_init();\n $vname_admin->check_configuration($params);\n if(isset($params['original']['sld'])){if($params['sld'] != $params['original']['sld']){$params['sld'] = $params['original']['sld'];}}\n if(isset($params['original']['tld'])){if($params['tld'] != $params['original']['tld']){$params['tld'] = $params['original']['tld'];}}\n if(!class_exists('Punycode'))\n @include_once('lib/classes/class.punicode.php');\n $Punycode = new Punycode();\n $domain = $Punycode->decode(strtolower(trim($params['sld'].'.'.$params['tld'])));\n $domain_info = $vname_domains->view_domain_info($params);\n if(is_array($domain_info)){\n if($domain_info['status']['code']< 200 || $domain_info['status']['code'] > 299){\n $values['error'] = $domain_info['status']['description'];\n }\n else{\n $active_advance = $vname_admin->check_advance_contact();\n $additionalcontactsfields = $vname_domains->get_whmcs_additional_domains($params['domainid']);\n if($active_advance)\n $values = $vname_contacts->get_contacts_advance_details($params, $domain_info);\n else\n $values = $vname_contacts->get_contacts_simple_details($params, $domain_info);\n }\n }\n return $values;\n}", "public function get_my_tribe_member_list($post_data){\n $searchId = $post_data['searchId'];\n $loginUserId = $post_data['loginUserId']; \n \n $sql = \"SELECT * FROM tribe WHERE searchId= $searchId AND fromuserId= $loginUserId AND deleteFlag !=1 AND status = 'accept'\";\n $record = $this->db->query($sql);\n if($record->num_rows()>0){\n return $record->result_array();\n } \n }", "public static function getDataFromUsersTable($member_id){\n\t\t\n\t\tglobal $db; \n\t\t\n\t\t//set query\n\t\t$query_text = \"SELECT city, email, phone, fullstack, frontend, backend,\n\t\tUX_UI, BI, QA, DBA, IT, share_info FROM users WHERE user_id = :user_id\";\n\t\t\n\t\ttry {\n\t\t\t//prepare query\t\t\n\t\t\t$query_statement = $db->prepare($query_text);\n\t\t\t//bind\n\t\t\t$query_statement->bindValue(':user_id', $member_id); \n\t\t\t//execute query\n\t\t\t$query_statement->execute();\n\t\t\t//fetch results\n\t\t\t$result = $query_statement->fetch(PDO::FETCH_ASSOC);\n\t\t}\n\t\t\n\t\tcatch (PDOException $ex) {\n\t\t\t$error_message = $ex->getMessage();\n\t\t\t$result = array('error_message' => $error_message);\n\t\t\treturn $result;\n\t\t}\n\t\t\n\t\treturn $result; \n\t\t\n\t}", "public function readCanceledMembers(){\r\n $results = array();\r\n\r\n if ( null !== $this->getDB() ) {\r\n $dbs = $this->getDB()->prepare('select * from members, memberstatus where members.MemberID = memberstatus.MemberID and StatusCode = \"C\"');\r\n\r\n if ( $dbs->execute() && $dbs->rowCount() > 0 ) {\r\n $results = $dbs->fetchAll(PDO::FETCH_ASSOC);\r\n }\r\n } \r\n return $results;\r\n }" ]
[ "0.5722052", "0.5636185", "0.5567402", "0.54970694", "0.5495408", "0.5491785", "0.5466657", "0.5400659", "0.5390302", "0.53853226", "0.53717375", "0.5355878", "0.5354773", "0.5340167", "0.53352743", "0.5290059", "0.5283923", "0.52817833", "0.52813745", "0.5279581", "0.52743995", "0.5273522", "0.52680385", "0.526584", "0.52566725", "0.5247679", "0.52469623", "0.52394384", "0.52266014", "0.5212532" ]
0.6772406
0
/ City: + tolower if ALL CAPS + Capitalize first letter of each word + Double apostrophes
function fixCity($str = "") { if ( preg_match("/[A-Z]{3}/", $str) ) { $str = strtolower($str); } $str = ucwords($str); $str = str_replace("'", "''", $str); return($str); //fixCity }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accronym($string) {\n $out = '';\n foreach (explode(' ', $string) as $value) {\n if ($value) {\n $out .= strtoupper($value[0]);\n }\n }\n return $out;\n}", "function makeTitleCase($input_title)\n {\n $input_array_of_words = explode(\" \", strtolower($input_title));\n $output_titlecased = array();\n $designated = array(\"a\", \"as\", \"an\", \"by\", \"of\", \"on\", \"to\", \"the\", \"or\", \"in\", \"from\", \"is\");\n foreach ($input_array_of_words as $word) {\n //if any of the words in designated array appear, lowercase them\n if (in_array($word, $designated)) {\n array_push($output_titlecased, lcfirst($word));\n //otherwise, uppercase\n } else {\n array_push($output_titlecased, ucfirst($word));\n }\n\n\n }\n\n//overrides the first if statement, making every first word capitalized no matter what\n $output_titlecased[0] = ucfirst($output_titlecased[0]);\n\n return implode(\" \", $output_titlecased);\n }", "function ucfirst_sentence($str){\r\n\treturn preg_replace('/\\b(\\w)/e', 'strtoupper(\"$1\")', strtolower($str));\r\n}", "function city_name(){\n\tif(isset($_GET[\"expansion\"])){\n\t\treturn ucwords(str_replace(\"-\", \" \", $_GET[\"expansion\"]));\n\t}else{\n\t\treturn \"\";\n\t}\n}", "function titleCase($string) {\r\n // Remove no_parse content.\r\n $string_array = preg_split(\"/(<no_parse>|<\\/no_parse>)+/i\",$string);\r\n $newString = '';\r\n for ($k=0; $k<count($string_array); $k=$k+2) {\r\n $string = $string_array[$k];\r\n // If the entire string is upper case, don't perform any title case on it.\r\n if ($string != strtoupper($string)) {\r\n // TITLE CASE RULES:\r\n // 1.) Uppercase the first char in every word.\r\n $new = preg_replace(\"/(^|\\s|\\'|'|\\\"|-){1}([a-z]){1}/ie\",\"''.stripslashes('\\\\1').''.stripslashes(strtoupper('\\\\2')).''\", $string);\r\n // 2.) Lower case words exempt from title case.\r\n // Lowercase all articles, coordinate conjunctions (\"and\", \"or\", \"nor\"), and prepositions regardless of length, when they are other than the first or last word.\r\n // Lowercase the \"to\" in an infinitive.\" - this rule is of course approximated since it is context sensitive.\r\n $matches = array();\r\n // Perform recursive matching on the following words.\r\n preg_match_all(\"/(\\sof|\\sa|\\san|\\sthe|\\sbut|\\sor|\\snot|\\syet|\\sat|\\son|\\sin|\\sover|\\sabove|\\sunder|\\sbelow|\\sbehind|\\snext\\sto|\\sbeside|\\sby|\\samoung|\\sbetween|\\sby|\\still|\\ssince|\\sdurring|\\sfor|\\sthroughout|\\sto|\\sand){2}/i\",$new ,$matches);\r\n for ($i=0; $i<count($matches); $i++) {\r\n for ($j=0; $j<count($matches[$i]); $j++) {\r\n $new = preg_replace(\"/(\".$matches[$i][$j].\"\\s)/ise\",\"''.strtolower('\\\\1').''\",$new);\r\n }\r\n }\r\n // 3.) Do not allow upper case apostrophes.\r\n $new = preg_replace(\"/(\\w'S)/ie\",\"''.strtolower('\\\\1').''\",$new);\r\n $new = preg_replace(\"/(\\w'\\w)/ie\",\"''.strtolower('\\\\1').''\",$new);\r\n $new = preg_replace(\"/(\\W)(of|a|an|the|but|or|not|yet|at|on|in|over|above|under|below|behind|next to| beside|by|amoung|between|by|till|since|durring|for|throughout|to|and)(\\W)/ise\",\"'\\\\1'.strtolower('\\\\2').'\\\\3'\",$new);\r\n // 4.) Capitalize first letter in the string always.\r\n $new = preg_replace(\"/(^[a-z]){1}/ie\",\"''.strtoupper('\\\\1').''\", $new);\r\n // 5.) Replace special cases.\r\n // You will add to this as you find case specific problems.\r\n $new = preg_replace(\"/\\sin-/i\",\" In-\",$new);\r\n $new = preg_replace(\"/(\\s|\\\"|\\'){1}(ph){1}(\\s|,|\\.|\\\"|\\'|:|!|\\?|\\*|$){1}/ie\",\"'\\\\1pH\\\\3'\",$new);\r\n $new = preg_replace(\"/^ph(\\s|$)/i\",\"pH \",$new);\r\n $new = preg_replace(\"/(\\s)ph($)/i\",\" pH\",$new);\r\n $new = preg_replace(\"/(\\s|\\\"|\\'){1}(&){1}(\\s|,|\\.|\\\"|\\'|:|!|\\?|\\*){1}/ie\",\"'\\\\1and\\\\3'\",$new);\r\n $new = preg_replace(\"/(\\s|\\\"|\\'){1}(groundwater){1}(\\s|,|\\.|\\\"|\\'|:|!|\\?|\\*){1}/e\",\"'\\\\1Ground Water\\\\3'\",$new);\r\n $new = preg_replace(\"/(\\W|^){1}(cross){1}(\\s){1}(connection){1}(\\W|$){1}/ie\",\"'\\\\1\\\\2-\\\\4\\\\5'\",$new); // Always hyphenate cross-connections.\r\n $new = preg_replace(\"/(\\s|\\\"|\\'){1}(vs\\.){1}(\\s|,|\\.|\\\"|\\'|:|!|\\?|\\*){1}/ie\",\"'\\\\1Vs.\\\\3'\",$new);\r\n $new = preg_replace(\"/(\\s|\\\"|\\'){1}(on-off){1}(\\s|,|\\.|\\\"|\\'|:|!|\\?|\\*){1}/ie\",\"'\\\\1On-Off\\\\3'\",$new);\r\n $new = preg_replace(\"/(\\s|\\\"|\\'){1}(on-site){1}(\\s|,|\\.|\\\"|\\'|:|!|\\?|\\*){1}/ie\",\"'\\\\1On-Site\\\\3'\",$new);\r\n // Special cases like Class A Fires.\r\n $new = preg_replace(\"/(\\s|\\\"|\\'){1}(class\\s){1}(\\w){1}(\\s|,|\\.|\\\"|\\'|:|!|\\?|\\*|$){1}/ie\",\"'\\\\1\\\\2'.strtoupper('\\\\3').'\\\\4'\",$new);\r\n $new = stripslashes($new);\r\n $string_array[$k] = $new;\r\n }\r\n }\r\n for ($k=0; $k<count($string_array); $k++) {\r\n $newString .= $string_array[$k];\r\n }\r\n return($newString);\r\n }", "function LetterCapitalize($str) { \r\n return ucwords($str); \r\n}", "function camelCase($str, array $noStrip = [])\r\n{\r\n $str = preg_replace('/[^a-z0-9' . implode(\"\", $noStrip) . ']+/i', ' ', $str);\r\n $str = trim($str);\r\n // uppercase the first character of each word\r\n $str = ucwords($str);\r\n\r\n return $str;\r\n}", "function camelCase($str, array $noStrip = [])\n{\n $str = preg_replace('/[^a-z0-9' . implode(\"\", $noStrip) . ']+/i', ' ', $str);\n $str = trim($str);\n // uppercase the first character of each word\n $str = ucwords($str);\n $str = str_replace(\" \", \"\", $str);\n $str = lcfirst($str);\n\n return $str;\n}", "public static function makeWordsFirstCapital($text = '') {\n if (!empty($text) && is_string($text)) {\n $words = explode(' ', $text);\n // Loop through words and capital if not all upper case.\n foreach ($words as &$word) {\n // Check for all caps?\n if (strtoupper($word) != $word) {\n // It is not all caps so process it.\n $word = ucwords($word);\n }\n\n // Check to see if it should be normalized.\n $normalize = [\n 'U.s.' => 'U.S.',\n 'u.s.' => 'U.S.',\n 'U.s.a.' => 'U.S.A.',\n 'Usa' => 'USA',\n 'Lecc' => 'LECC',\n ];\n foreach ($normalize as $bad => $good) {\n // Replace it with the good version if it is bad.\n $word = ($word == $bad) ? $good : $word;\n }\n }\n // Break the reference.\n unset($word);\n\n // Join them all back together.\n $text = implode(' ', $words);\n }\n\n return $text;\n }", "public static function upWords(string $str) \n\t\t{\n\n\t\t\t$str = strtolower($str);\n\t\t\t$str = preg_replace('#\\s(como?|d[aeo]s?|desde|para|por|que|sem|sob|sobre|trás)\\s#ie', '\" \".strtolower(\"\\1\").\" \"', ucwords($str));\n\n\t\t\treturn $str;\t\n\t\t}", "function the_champ_first_letter_uppercase($word){\r\n\treturn ucfirst($word);\r\n}", "function convertNamingFromUnderlineToCamelCase($text,$firstLetterLowerCase=true) {\n\t\t\tpreg_match_all('/(^[a-zA-Z])|(_[a-zA-Z])/', $text, $matches, PREG_PATTERN_ORDER);\n\t\n\t\t\tfor ($i = 0; $i < count($matches[0]); $i++) {\n\t\t\t\t\t$original=$matches[0][$i];\n\t\t\t\t\t$originals[]=$original;\n\t\t\t\t\tif ($i==0 and $firstLetterLowerCase)\n\t\t\t\t\t\t\t$replacement=str_replace('_','',$matches[0][$i]);\n\t\t\t\t\telse\n\t\t\t\t\t\t\t$replacement=strtoupper(str_replace('_','',$matches[0][$i]));\n\t\t\t\t\t$replacements[]=$replacement;\n\t\t\t}\n\t\n\t\t\treturn str_replace($originals,$replacements,$text);\n\t}", "function nomeCase($string, $delimiters = array(\" \", \"-\", \".\", \"'\", \"O'\", \"Mc\"), $exceptions = array(\"de\", \"da\", \"dos\", \"das\", \"do\", \"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\"))\n{\n $string = mb_convert_case($string, MB_CASE_TITLE, \"UTF-8\");\n foreach ($delimiters as $dlnr => $delimiter) {\n $words = explode($delimiter, $string);\n $newwords = array();\n foreach ($words as $wordnr => $word) {\n if (in_array(mb_strtoupper($word, \"UTF-8\"), $exceptions)) {\n // check exceptions list for any words that should be in upper case\n $word = mb_strtoupper($word, \"UTF-8\");\n } elseif (in_array(mb_strtolower($word, \"UTF-8\"), $exceptions)) {\n // check exceptions list for any words that should be in upper case\n $word = mb_strtolower($word, \"UTF-8\");\n } elseif (!in_array($word, $exceptions)) {\n // convert to uppercase (non-utf8 only)\n $word = ucfirst($word);\n }\n array_push($newwords, $word);\n }\n $string = join($delimiter, $newwords);\n }//foreach\n return $string;\n}", "function fixName($str = \"\") {\n\tif ( preg_match(\"/[A-Z]{3}/\", $str) ) {\n\t\t$str = strtolower($str);\n\t\t// First letter after hyphen\n\t\t$str = preg_replace(\"/(-[A-Z])/\", \"$1\", $str);\n\t\tif ( \"$1\" != \"\" ) {\n\t\t\t$upper1 = strtoupper(\"$1\");\n\t\t\t$str = str_replace(\"$1\", \"$upper1\", $str);\n\t\t}\n\t\t//$str = preg_replace(\"/(-[A-Z])/\", strtoupper($1), $str); // T_LNUMBER error\n\t\t$str = ucwords($str);\n\t}\n\t// Is all-lowercase + hyphen space apostrophe\n\telseif ( preg_match(\"/^[- 'a-z]+$/\", $str) ) {\n\t\t// Need exceptions: \"di\", \"de la\", ... ?\n\t\t$str = ucwords($str);\n\t}\n\t// Already mixed-case\n\telse {\n\t\t1;\n\t}\n\t$str = str_replace(\"'\", \"''\", $str);\n\treturn($str);\n//fixName\n}", "function prepareSearchTerms($terms) {\n $terms = ucwords($terms); // Capitalise each word.\n return $terms;\n}", "function Capitalize($title, $delimiter = \" \")\n{\n\n /* Capitalizes the words in a title according to the MLA Handbook.\n\t $delimiter parameter is optional. It is only needed if delimiter\n\t is not a space. */\n\t \n\t$articles = 'a|an|the';\n\t$prepositions = 'aboard|above|according|across|against|along|around|as|at|because|before|below|beneath|beside|between|beyond|by|concerning|during|except|for|from|inside|into|like|near|next|of|off|on|out|outside|over|past|since|through|to|toward|underneath|until|upon|with';\n\t$conjunctions = 'and|but|nor|or|so|yet';\n\t$verbs = 'are|be|did|do|is|was|were|will';\n\t$exceptions = explode('|',$articles.'|'.$prepositions.'|'.$conjunctions.'|'.$verbs); \n\t$words = explode($delimiter,$title);\n\t$lastWord = count($words)-1; // first & last words are always capitalized\n\t$words[0] = ucfirst($words[0]);\n\t$words[$lastWord] = ucfirst($words[$lastWord]);\n\tfor($i=1; $i<$lastWord; $i++) {\n\t\tif (!in_array($words[$i],$exceptions)) {\n\t\t\t$words[$i] = ucfirst($words[$i]);\n\t\t\t}\n\t\t}\n\t$newTitle = implode(' ',$words);\n\treturn $newTitle;\n}", "function camel($string) {\r\n\t$parts = preg_split('/[\\s_\\-]+/i',strtolower($string));\r\n\t$camel = array_shift($parts) . str_replace(\" \",\"\",ucwords(implode(\" \",$parts)));\r\n\treturn $camel;\r\n}", "function sanifyText($text) {\n // todo whitespace stripping removes commas \"ostuh,otuh\" and concats the words\n // fix this issue.\n return strtolower($text);\n}", "function camelCase($input)\n{\n $words = \\__::words(preg_replace(\"/['\\x{2019}]/u\", '', $input));\n\n return array_reduce(\n $words,\n function ($result, $word) use ($words) {\n $isFirst = \\__::first($words) === $word;\n $word = \\__::toLower($word);\n return $result . (!$isFirst ? \\__::capitalize($word) : $word);\n },\n ''\n );\n}", "public function ucnames($string)\n {\n $format = function ($regex) {\n $word = strtolower($regex[1]);\n if ($word == 'de') {\n return str_replace($regex[1], $word, $regex[0]);\n }\n $word = ucfirst($word);\n if (substr($word, 1, 1) == \"'\") {\n if (substr($word, 0, 1) == 'D') {\n $word = strtolower($word);\n }\n $next = substr($word, 2, 1);\n $next = strtoupper($next);\n $word = substr_replace($word, $next, 2, 1);\n }\n $word = preg_replace_callback('/\n\t\t\t\t(?: ^ | \\\\b ) # assertion: beginning of string or a word boundary\n\t\t\t\t( O\\' | Ma?c | Fitz) # attempt to match Irish surnames\n\t\t\t\t( [^\\W\\d_] ) # match next char; we exclude digits and _ from \\w\n\t\t\t/x', function ($match) {\n return $match[1] . strtoupper($match[2]);\n}, $word);\n return str_replace($regex[1], $word, $regex[0]);\n };\n $string = preg_replace_callback('/(?:^|\\\\s)([\\\\w\\']+)\\\\s?/s', $format, $string);\n return $string;\n }", "function strtoproper($someString) {\n return ucwords(strtolower($someString));\n}", "function fmtCase($text) {\n\t\tglobal $assoc_case;\n\n\t\tif ($assoc_case == \"lower\") $newtext\t= strtolower($text);\n\t\telse if ($assoc_case == \"upper\") $newtext\t= strtoupper($text);\n\t\treturn $newtext;\n\n\t}", "function ucfirst_sentences($s) {\n return preg_replace_callback('/([.!?])\\s+(\\w)/', function ($matches) {\n return strtoupper($matches[1] . ' ' . $matches[2]);\n }, ucfirst(strtolower($s)));\n }", "function uv_first_capital($string){\n //Patron para reconocer y no modificar numeros romanos\n $pattern = '/\\b(?![LXIVCDM]+\\b)([A-Z_-ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ]+)\\b/';\n $output = preg_replace_callback($pattern, function($matches) {\n return mb_strtolower($matches[0], 'UTF-8');\n }, $string);\n $output = ucfirst($output);\n return $output;\n }", "function camel_case_with_initial_capital($s) {\n return camel_case($s, true);\n }", "function titleCase($string, $delimiters = array(\" \", \"-\", \".\", \"'\", \"O'\", \"Mc\"), $exceptions = array(\"de\", \"da\", \"dos\", \"das\", \"do\", \"um\", \"uma\", \"e\",\"é\", \"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\"))\n\t {\n\t\t\t $string = mb_convert_case($string, MB_CASE_TITLE, \"UTF-8\");\n\t\t\t foreach ($delimiters as $dlnr => $delimiter) {\n\t\t\t\t\t $words = explode($delimiter, $string);\n\t\t\t\t\t $newwords = array();\n\t\t\t\t\t foreach ($words as $wordnr => $word) {\n\t\t\t\t\t\t\t if (in_array(mb_strtoupper($word, \"UTF-8\"), $exceptions)) {\n\t\t\t\t\t\t\t\t\t // check exceptions list for any words that should be in upper case\n\t\t\t\t\t\t\t\t\t $word = mb_strtoupper($word, \"UTF-8\");\n\t\t\t\t\t\t\t } elseif (in_array(mb_strtolower($word, \"UTF-8\"), $exceptions)) {\n\t\t\t\t\t\t\t\t\t // check exceptions list for any words that should be in upper case\n\t\t\t\t\t\t\t\t\t $word = mb_strtolower($word, \"UTF-8\");\n\t\t\t\t\t\t\t } elseif (!in_array($word, $exceptions)) {\n\t\t\t\t\t\t\t\t\t // convert to uppercase (non-utf8 only)\n\t\t\t\t\t\t\t\t\t $word = ucfirst($word);\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t array_push($newwords, $word);\n\t\t\t\t\t }\n\t\t\t\t\t $string = join($delimiter, $newwords);\n\t\t\t}//foreach\n\t\t\treturn $string;\n\t }", "public static function fix_case($word) {\n # Fix case for words split by periods (J.P.)\n if (strpos($word, '.') !== false) {\n $word = self::safe_ucfirst(\".\", $word);;\n }\n # Fix case for words split by hyphens (Kimura-Fay)\n if (strpos($word, '-') !== false) {\n $word = self::safe_ucfirst(\"-\", $word);\n }\n # Special case for single letters\n if (strlen($word) == 1) {\n $word = strtoupper($word);\n }\n # Special case for 2-letter words\n if (strlen($word) == 2) {\n # Both letters vowels (uppercase both)\n if (in_array(strtolower($word{0}), self::$dict['vowels']) && in_array(strtolower($word{1}), self::$dict['vowels'])) {\n $word = strtoupper($word);\n }\n # Both letters consonants (uppercase both)\n if (!in_array(strtolower($word{0}), self::$dict['vowels']) && !in_array(strtolower($word{1}), self::$dict['vowels'])) {\n $word = strtoupper($word);\n }\n # First letter is vowel, second letter consonant (uppercase first)\n if (in_array(strtolower($word{0}), self::$dict['vowels']) && !in_array(strtolower($word{1}), self::$dict['vowels'])) {\n $word = ucfirst(strtolower($word));\n }\n # First letter consonant, second letter vowel or \"y\" (uppercase first)\n if (!in_array(strtolower($word{0}), self::$dict['vowels']) && (in_array(strtolower($word{1}), self::$dict['vowels']) || strtolower($word{1}) == 'y')) {\n $word = ucfirst(strtolower($word));\n }\n }\n # Fix case for words which aren't initials, but are all upercase or lowercase\n if ( (strlen($word) >= 3) && (ctype_upper($word) || ctype_lower($word)) ) {\n $word = ucfirst(strtolower($word));\n }\n return $word;\n }", "function capital_P_dangit($text)\n {\n }", "public function getTitleCase($value) {\n\t\t$value = str_replace('_', ' ', $value);\n\t\t$value = ucwords($value);\n\t\t$value = str_replace(' ', '', $value);\n\t\treturn $value;\n\t}", "function str_camelcase($str, $capital_first_char = false)\n{\n $str = str_replace(' ', '', ucwords(str_replace('_', ' ', $str)));\n return $capital_first_char ? $str : lcfirst($str);\n}" ]
[ "0.6969585", "0.6899945", "0.6711611", "0.65355843", "0.65331244", "0.65323824", "0.6488122", "0.6426783", "0.6404989", "0.6376354", "0.63423026", "0.63273424", "0.63271356", "0.62753755", "0.6269467", "0.62544614", "0.62507164", "0.62440306", "0.6243878", "0.6205333", "0.61948174", "0.6189622", "0.6189044", "0.61725736", "0.6168354", "0.6166148", "0.6160771", "0.6157691", "0.613284", "0.6125545" ]
0.74844426
0
Return an array of the values from the oddnumbered elements i.e. hashname keys: 1, 3, etc. I.e. reduce the duplication of a BOTH array. Getting the evens would have the same result.
function getNameValues($row) { $values = array(); $val = ""; $n = 0; foreach ($row as $val) { // Test for odd number. // http://ca.php.net/manual/en/function.array-filter.php // Also works: //if ( ($n % 2) != 0 ) {} if ($n & 1) { $values[] = $val; //echo "$n odd: $key\n"; } else { 1; //echo "$n not-odd: $key\n"; } $n++; } return($values); //getNameValues }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evenNumbers(array $array): array\n{\n $resultArray = [];\n\n if (count($array) !== 0) {\n foreach ($array as $elementArray) {\n if (($elementArray % 2) === 0) {\n $resultArray[] = $elementArray;\n }\n }\n }\n return $resultArray;\n}", "function getNameKeys($row) {\n\n\t$names = array();\n\t$key = \"\";\n\t$n = 0;\n\tforeach (array_keys($row) as $key) {\n\t\t// Test for odd number.\n\t\t// http://ca.php.net/manual/en/function.array-filter.php\n\t\t// Also works:\n\t\t//if ( ($n % 2) != 0 ) {}\n\t\tif ($n & 1) {\n\t\t\t$names[] = $key;\n\t\t\t//echo \"$n odd: $key\\n\";\n\t\t} else {\n\t\t\t1;\n\t\t\t//echo \"$n not-odd: $key\\n\";\n\t\t}\n\t\t$n++;\n\t}\n\n\treturn($names);\n\n//getNameKeys\n}", "static function keyValSplit($array){\n return [array_keys($array), array_values($array)];\n }", "public function getOddAndReverse($n){\n\t\t$result = array();\n\t\t$data = 0;\n\t\tfor($i = 0; $i < $n; $i++){\n\t\t\t//collect to result array\n\t\t\t$result[$i] = $data;\n\t\t\t\n\t\t\tif($i <= ($n-1)/2-1){\n\t\t\t\t$data = $data + 2;\n\t\t\t} else {\n\t\t\t\t$data = $data - 2;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $result;\n\t}", "public function provideCheckAdjacentValues()\n {\n return [\n [123455, 123455],\n [123456, false],\n [112234, 112234],\n [112233, 112233]\n ];\n }", "public static function data_valuesFlipCopy(): array {\n\t\treturn [\n\t\t\t[\n\t\t\t\t[\n\t\t\t\t\t'A', 'B', 'C',\n\t\t\t\t], [\n\t\t\t\t\t'A' => 'A', 'B' => 'B', 'C' => 'C',\n\t\t\t\t],\n\t\t\t], [\n\t\t\t\t[\n\t\t\t\t\t'one', 'two', 'three',\n\t\t\t\t], [\n\t\t\t\t\t'one' => 'one', 'two' => 'two', 'three' => 'three',\n\t\t\t\t],\n\t\t\t], [\n\t\t\t\t[\n\t\t\t\t\t'1', '2', '3', 'fish', '4', '5', '1', '2',\n\t\t\t\t], [\n\t\t\t\t\t'1' => '1', '2' => '2', '3' => '3', 'fish' => 'fish', '4' => '4', '5' => '5',\n\t\t\t\t],\n\t\t\t], [\n\t\t\t\t[\n\t\t\t\t\t'a' => 'A', 'b' => 'B',\n\t\t\t\t], [\n\t\t\t\t\t'A' => 'A', 'B' => 'B',\n\t\t\t\t],\n\t\t\t], [\n\t\t\t\t[\n\t\t\t\t\t'A', 'B',\n\t\t\t\t], [\n\t\t\t\t\t'A' => 'A', 'B' => 'B',\n\t\t\t\t],\n\t\t\t],\n\t\t];\n\t}", "function get_val_array($arr){\n\t$new = array();\n\tif(!empty($arr)){\n\tforeach($arr as $key=>$val){\n\t\t$new[$key] = $key;\n\t}\n\t}\n\treturn $new;\n}", "public abstract function list_pairwise(): array;", "public function getIncrementBy2($n){\n\t\t$hasil= array();\n\t\t$data=1;\n\t\tfor ($i=0; $i < $n ; $i++) {\n\t\t\t$hasil[$i]=$data;\n\t\t\t$data=$data+2;\n\t\t}\n\t\treturn $hasil;\n\t}", "function array_mash($primary, $secondary) {\n\t$primary = (array)$primary;\n\t$secondary = (array)$secondary;\n\t$out = array();\n\tforeach($primary as $name => $value) {\n\t\tif ( array_key_exists($name, $secondary) && !empty($secondary[$name]) && empty($value)) {\n\t\t\t$out[$name] = $secondary[$name];\n\t\t}\n\t\telse {\n\t\t\t$out[$name] = $value;\n\t\t}\n\t}\n\treturn $out;\n}", "public function collectAsKeyValue(): array {\n\t\t$result = [];\n\t\tforeach ($this as [$key, $value]) {\n\t\t\t$result[$key] = $value;\n\t\t}\n\t\treturn $result;\n\t}", "function getOddNumber(array $arrValues): int\n\t{\n\t\t$valueCounts = array_count_values($arrValues);\n\t\t$oddOccurredNumber = array_filter($valueCounts, function ($count) { return $count % 2 != 0; });\n\t\treturn array_keys($oddOccurredNumber)[0];\n\t}", "public static function getNiceArray($oldarray)\n {\n $newarray = [];\n foreach($oldarray as $tmparray) {\n $i=1;\n foreach($tmparray as $k => $v) {\n if($i == 1) {\n $newarray[count($newarray)+1] = $v;\n }\n $i++;\n }\n }\n return $newarray;\n }", "function appeared_once($arr)\n{\n $array_count_values = array_count_values($arr);\n\n $single_time_comming_values_array = [];\n\n foreach ($array_count_values as $key => $val) {\n\n if ($val == 1) {\n $single_time_comming_values_array[] = $key;\n }\n }\n\n return $single_time_comming_values_array;\n}", "function oddArray(array $array): int\n {\n $odd = 0;\n\n foreach($array as $number)\n {\n if($number & 1)\n {\n $odd++;\n }\n }\n\n return $odd;\n }", "static function get_duplicates(array $array): array {\n return array_unique(array_diff_assoc($array, array_unique($array)));\n }", "public function getPair() : array;", "public function values() {\n return array_values($this->_hash);\n }", "function two_pairs(array $hand) {\n if (count($hand) < 4) return false;\n\n $values = cards_values($hand);\n\n $dups = [];\n foreach(array_count_values($values) as $val => $c)\n if($c === 2) $dups[] = strval($val);\n\n if (count($dups) != 2) return false;\n\n usort($dups, \"by_value\");\n $val = strrev(implode($dups));\n\n return ['value' => $val, 'remaining' => remove_values(remove_values($hand, $val[0]), $val[1])];\n}", "function findNeighboorKeys($size, $y, $x)\n {\n $result = [];\n if ($y - 1 >= 0) {\n array_push($result, [$y - 1, $x]);\n if ($x == $y) array_push($result, [$y - 1, $x - 1]);\n }\n\n if ($y + 1 < $size) {\n array_push($result, [$y + 1, $x]);\n if ($x == $y) array_push($result, [$y + 1, $x + 1]);\n }\n if ($x - 1 >= 0) array_push($result, [$y, $x - 1]);\n if ($x + 1 < $size) array_push($result, [$y, $x + 1]);\n return $result;\n }", "public function findProdFromEven($even){\n $product_id = array();\n $product_count=array();\n $result = array();\n if (count($even)==0)\n return $result;\n else{\n for($i=0;$i<count($even);$i++){\n $product = $even[$i]->prod;\n if(!$product->is_time==1){\n $id_temp=$this->findArray($product_id,$product->id);\n if($id_temp!=-1){\n $product_count[$id_temp]++;\n }\n else{\n array_push($product_id,$product->id);\n array_push($product_count,1);\n }\n } \n }\n }\n for ($i=0;$i<count($product_id);$i++){\n $id = $product_id[$i];\n $item = (object)['id'=>$id,\n 'name'=>$this->findNameProd($id),\n 'stock'=>$this->findCountProd($id),\n 'count'=>$product_count[$i],\n 'value'=>$this->findValueProd($id)*$product_count[$i]\n ];\n array_push($result,$item);\n }\n return $result;\n }", "public function values()\n {\n return static::from(array_values($this->hash));\n }", "public function getKeys()\n {\n\t\tforeach ($this->_source as $key => $value)\n\t\t{\n\t\t\t$dummy[] = $key;\n\t\t}\n\t\treturn $dummy;\n }", "protected function getHoursArray()\n\t{\n\t\t$ha = array_pad([], 24, null);\n\t\tforeach ($this->_attr[self::HOUR] as $h) {\n\t\t\tif (is_numeric($h['hour'])) {\n\t\t\t\tfor ($i = $h['hour']; $i <= $h['end'] && $i < 24; $i += $h['period']) {\n\t\t\t\t\t$ha[$i] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $ha;\n\t}", "public function fetchKeyedArray()\n\t{\n\t\t$arr = $this->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_ASSOC);\n\t\t$arr = array_map('reset', $arr);\n\t\t$keys = array_keys($arr);\n\t\t// if there's only one item in the lower arrays, we might as well\n\t\t// remove the array element\n\t\tif (count($keys) && count($arr[$keys[0]]) == 1)\n\t\t{\n\t\t\t$arr = array_map('reset', $arr);\n\t\t}\n\n\t\treturn $arr;\n\t}", "function agm_array_multi_unique ($array) {\r\n\tif (!is_array($array)) return $array;\r\n\t$ret = array();\r\n\t$hashes = array();\r\n\r\n\tforeach ($array as $k=>$v) {\r\n\t\t$hash = md5(serialize($v));\r\n\t\tif (isset($hashes[$hash])) continue;\r\n\t\t$hashes[$hash] = $hash;\r\n\t\t$ret[] = $v;\r\n\t}\r\n\r\n\treturn $ret;\r\n}", "public function all(): array\n {\n $combined[] = $this->primary;\n\n if (!empty($this->alternates)) {\n $combined = array_merge($combined, $this->alternates);\n $combined = array_unique(array_reverse($combined));\n }\n\n return $combined;\n }", "public function toArray()\n {\n return [\n 5 => 5,\n 10 => 10,\n 15 => 15,\n 20 => 20,\n 25 => 25\n ];\n }", "function one_pair(array $hand) {\n $values = cards_values($hand);\n\n $dups = [];\n foreach(array_count_values($values) as $val => $c)\n if($c === 2) $dups[] = strval($val);\n\n if (count($dups) === 0) return false;\n\n usort($dups, \"by_value\");\n $val = $dups[count($dups) - 1];\n\n return ['value' => $val, 'remaining' => remove_values($hand, $val)];\n}", "function cards_values(array $hand):array {\n return array_map(function ($el) {return strval($el[0]);}, $hand);\n}" ]
[ "0.6245411", "0.6010292", "0.5541475", "0.5506541", "0.5460188", "0.54284096", "0.5362256", "0.53396577", "0.5330465", "0.53092116", "0.52846", "0.5278048", "0.5277437", "0.5250284", "0.5249447", "0.5221857", "0.5216014", "0.5214611", "0.5199264", "0.519908", "0.51730853", "0.51424116", "0.5141225", "0.5136302", "0.5107215", "0.5101816", "0.50875145", "0.5076239", "0.50579065", "0.49984688" ]
0.65567416
0
If the URI starts with $needle
public function startsWith($needle) { return ($needle === '') || (0 === strpos((string)$this, $needle)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function match($uri);", "public function match ($uri);", "function startWith($haystack, $needle){\n \treturn $needle === \"\" || strpos($haystack, $needle) === 0;\n\t}", "function startsWith($haystack, $needle){\n\t\t$length = strlen($needle);\n\t\treturn (substr($haystack, 0, $length) === $needle);\n\t}", "function startsWith($haystack, $needle){\n $length = strlen($needle);\n return (substr($haystack, 0, $length) === $needle);\n }", "function startsWith($haystack, $needle) {\n\t\treturn (strpos($haystack, $needle) === 0);\n\t}", "function startsWith($haystack, $needle) {\n\t\treturn (substr($haystack, 0, strlen($needle)) == $needle);\n\t}", "function startsWith($Haystack, $Needle){\n return strpos($Haystack, $Needle) === 0;\n }", "function startsWith($haystack, $needle) {\n\tif ( !is_string($haystack) || ! is_string($needle) ) return false;\n\treturn $needle === \"\" || strripos($haystack, $needle, -strlen($haystack)) !== FALSE;\n}", "function start_with($haystack, $needle)\n{\n $length = strlen($needle);\n return substr($haystack, 0, $length) === $needle;\n}", "private function startsWith($haystack, $needle)\n\t{\n \treturn $needle === \"\" || strrpos($haystack, $needle, -strlen($haystack)) !== false;\n\t}", "public static function stringStartsWith($needle, $haystack)\n {\n return preg_match('/^' . preg_quote($needle, '/') . '/', $haystack);\n }", "function startsWith($haystack, $needle) {\r\n\t\treturn $needle === \"\" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;\r\n\t}", "function startsWith($haystack, $needle) {\n return $needle === \"\" || strrpos($haystack, $needle, -strlen($haystack)) !== false;\n }", "function startsWith( $haystack, $needle ) {\n $length = strlen( $needle );\n return substr( $haystack, 0, $length ) === $needle;\n}", "function startsWith($haystack, $needle)\n{\n $length = strlen($needle);\n return (substr($haystack, 0, $length) === $needle);\n}", "function startsWith(string $haystack = null, string $needle = null): bool {\n if (empty($haystack) || empty($needle)) {\n return false;\n }\n return $haystack[0] === $needle[0]\n ? \\strncmp($haystack, $needle, strlen($needle)) === 0\n : false;\n}", "function startsWith($haystack, $needle){\n $length = strlen($needle);\n return (substr($haystack, 0, $length) === $needle);\n}", "function str_startsWith (string $str, string $needle): bool {\n\t$strLen = strlen($str);\n\t$needleLen = strlen($needle);\n\treturn (substr($str, 0, $needleLen) === $needle);\n}", "public function match( $pURI );", "function starts_with($haystack, $needle)\n\t{\n\t\treturn Illuminate\\Support\\Str::startsWith($haystack, $needle);\n\t}", "function startFrom(string $haystack, string $needle) : bool\n{\n $length = strlen($needle);\n return (substr($haystack, 0, $length) === $needle);\n}", "function startsWith($haystack, $needle) {\n\treturn $needle === \"\" || strrpos($haystack, $needle, -strlen($haystack)) !== false;\n}", "function urlcontains($string) {\n if (strpos('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'],$string) == true) {\n return true;\n }\n }", "function startsWith($haystack, $needle) {\n\treturn $needle === \"\" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;\n}", "private function startsWith($haystack, $needle) {\n return $needle === \"\" || strrpos($haystack, $needle, -strlen($haystack)) !== false;\n }", "function startsWith($haystack, $needle){\n $length = mb_strlen($needle);\n return (mb_substr($haystack, 0, $length) === $needle);\n}", "function starts_with($haystack, $needle)\n{\n\treturn substr($haystack, 0, strlen($needle))===$needle;\n}", "public function startsWith($haystack, $needle) \n {\n return $needle === \"\" || strrpos($haystack, $needle, -strlen($haystack)) !== false;\n }", "function current_url_starts_with( $start )\n{\n\t$start = current_base_url_path() . $start;\n\n\treturn\tstarts_with( trim( $_SERVER['REQUEST_URI'], ' /' ), $start ) ||\n\t\t\tstarts_with( ltrim( $_SERVER['REQUEST_URI'], ' /' ), $start );\n}" ]
[ "0.66160685", "0.65923005", "0.6553105", "0.65521544", "0.6538332", "0.6478425", "0.641376", "0.6356798", "0.6342114", "0.63109845", "0.6304224", "0.6297337", "0.62943155", "0.6286284", "0.6279851", "0.6277959", "0.6265446", "0.62494045", "0.62271297", "0.6225131", "0.6222819", "0.6222595", "0.6208174", "0.62064314", "0.6191516", "0.617868", "0.6175395", "0.6173079", "0.6161421", "0.61173993" ]
0.6635497
0
If the URI ends with $needle
public function endsWith($needle) { return ($needle === '') || (substr((string)$this, -strlen($needle)) === $needle); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function str_endsWith (string $str, string $needle): bool {\n\t$strLen = strlen($str);\n\t$needleLen = strlen($needle);\n\treturn (substr($str, $strLen - $needleLen, $needleLen) === $needle);\n}", "function endsWith($haystack, $needle){\n $length = strlen($needle);\n return $length === 0 ||\n (substr($haystack, -$length) === $needle);\n }", "function endWith($haystack, $needle) { \n\n\t\t $length = strlen($needle); \n\t\t if($length == 0)\n\t\t { \n\t\t\t return true; \n\t\t } \n\t\t return (substr($haystack, -$length) === $needle);\n\t }", "function string_ends_with( $haystack, $needle ) {\n\t\treturn substr($haystack, -strlen($needle))===$needle;\n\t}", "function endsWith($haystack, $needle) {\n // search forward starting from end minus needle length characters\n return $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);\n }", "function endsWith($haystack, $needle) {\n return $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);\n }", "function str_removeFromEnd (string $str, string $needle) : string {\n\t$strLen = strlen($str);\n\t$needleLen = strlen($needle);\n\n\tif($strLen >= $needleLen and str_endsWith($str, $needle)){\n\t\treturn substr($str, 0, $strLen - $needleLen);\n\t}\n\treturn $str;\n}", "function endsWith($needle, $haystack)\n{\n $needle = strrev($needle);\n $haystack = strrev($haystack);\n return (strpos($haystack, $needle) === 0);\n}", "function str_ends_with($needle, $haystack)\n {\n return str::endsWith($needle, $haystack);\n }", "function endsWith($haystack, $needle) {\r\n\t\treturn $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);\r\n\t}", "function str_iends_with($needle, $haystack)\n {\n return str::endsWithIgnoreCase($needle, $haystack);\n }", "function endsWith($haystack, $needle) {\n\t\t$length = strlen($needle);\n\t\tif ($length == 0) {\n\t\t\treturn true;\n\t\t}\n\t\treturn (substr($haystack, -$length) == $needle);\n\t}", "function endsWith($haystack, $needle) {\n\t\t$pos = strlen($haystack) - strlen($needle);\n\t\treturn (strpos($haystack, $needle) === $pos);\n\t}", "function ends_with($haystack, $needle)\n{\n\treturn substr($haystack, -strlen($needle))===$needle;\n}", "function endsWith($haystack, $needle) {\n\t\treturn $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);\n\t}", "function endsWith($haystack, $needle) // Colorize: green\n { // Colorize: green\n $length = strlen($needle); // Colorize: green\n // Colorize: green\n if ($length == 0) // Colorize: green\n { // Colorize: green\n return true; // Colorize: green\n } // Colorize: green\n // Colorize: green\n return substr($haystack, -$length) === $needle; // Colorize: green\n }", "function endsWith($haystack, $needle)\r\n {\r\n return $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);\r\n }", "function endsWith($haystack, $needle) {\n\t\t\t$needle_length = strlen($needle);\n\t\t\t$offset = strlen($haystack) - $needle_length;\n\t\t\t$length = $needle_length;\n\t\t\treturn @substr_compare($haystack, $needle, $offset, $length) === 0;\n\t\t}", "public function endsWith($haystack, $needle)\n {\n return $needle === '' || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);\n }", "function ends_with($haystack, $needle) {\n\treturn $needle === substr($haystack, -strlen($needle));\n}", "private function endsWith($haystack, $needle) {\r\n\t\t\treturn $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);\r\n\t\t}", "static function endsWith($haystack, $needle)\n {\n // search forward starting from end minus needle length characters\n return $needle === \"\" ||\n (($temp = strlen($haystack) - strlen($needle)) >= 0 &&\n strpos($haystack, $needle, $temp) !== false);\n }", "public static function endsWith($haystack, $needle) {\n return (strrpos($haystack, $needle) == (strlen($haystack) - strlen(\n $needle\n )));\n }", "function endsWith($haystack, $needle) {\n\treturn $needle === \"\" || strpos($haystack, $needle, strlen($haystack) - strlen($needle)) !== FALSE;\n}", "function ends_with($haystack, $needle) {\r\n $length = strlen($needle);\r\n $start = $length *-1; //negative\r\n return (substr($haystack, $start, $length) === $needle);\r\n}", "function ends_with($haystack, $needles)\n {\n return Str::endsWith($haystack, $needles);\n }", "protected static function endsWith($haystack, $needle) {\n\t\t// search forward starting from end minus needle length characters\n\t\treturn $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);\n\t}", "protected static function endsWith($haystack, $needle) {\n\t\t// search forward starting from end minus needle length characters\n\t\treturn $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);\n\t}", "public static function endsWith($haystack, $needle) {\n return $needle === \"\" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);\n }", "function ends_with($haystack, $needles)\n {\n foreach ((array)$needles as $needle) {\n if (substr($haystack, -strlen($needle)) === (string)$needle) {\n return true;\n }\n }\n return false;\n }" ]
[ "0.67159086", "0.663944", "0.6612122", "0.6581157", "0.65766317", "0.65681255", "0.65547174", "0.655125", "0.652404", "0.651618", "0.65146327", "0.6500416", "0.649843", "0.6493224", "0.6488655", "0.64760524", "0.6474933", "0.6442232", "0.6421888", "0.64060926", "0.64034575", "0.6390789", "0.63888204", "0.63490576", "0.63378155", "0.6326004", "0.6289011", "0.6289011", "0.6279919", "0.6271394" ]
0.6722348
0
Returns if the dialog retrieved a valid result. If a valid result has already been received, this method returns true, otherwise false.
public function hasValidResult() { return ( $this->result !== null ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function checkResult() {\n\t\treturn ($this->_query_result !== false);\n\t}", "protected function _isResultValid()\n {\n if (!$this->getRequest()->getParam('result') ||\n !in_array($this->getRequest()->getParam('result'), $this->_validResults)) {\n $this->_logger->error(__(\"Invalid Result\"));\n return false;\n }\n return true;\n }", "public function hasResult()\n\t{\n\t\treturn isset($this->result);\n\t}", "public function has_result()\n\t{\n\t\treturn !empty($this->result);\n\t}", "public function hasResult(): bool\n {\n return ! is_null($this->result);\n }", "public function isValid()\n {\n if ($this->_code == self::RESULT_OK) {\n return true;\n }\n\n return false;\n }", "public function isValid(){\n $bool = false;\n if($this->res) {\n $bool = true;\n }\n return $bool;\n }", "public function hasResult();", "public function hasResult();", "public function hasResult();", "public function isOk()\n {\n $result = false;\n \n if ($this->m_responseArray['result'] == 'success')\n {\n $result = true;\n }\n \n return $result;\n }", "public function isSuccess()\n {\n return $this->getResult() == self::RESULT_OK;\n }", "public function progressValidation (): bool\n {\n // for secure: Check if the step of the answer are identical with current step which is set in the result object\n // (someone could step back via browser and send answers again. In this case the answer-step and the result-step\n // would be different)\n if (!$this->result) {\n throw new Exception('No result set.', 1638189967);\n }\n\n /** @var \\RKW\\RkwCheckup\\Domain\\Model\\ResultAnswer $resultAnswer */\n foreach ($this->result->getNewResultAnswer() as $resultAnswer) {\n if ($resultAnswer->getStep() !== $this->result->getCurrentStep()) {\n // do absolutely nothing (if this condition failed once, because the whole request then is garbage)\n return false;\n }\n }\n\n return true;\n }", "public function valid()\n {\n return count($this->result_queue) !== 0;\n }", "public function isSuccessful()\n\t{\n\t\t$data = $this->getData();\n\n\t\treturn isset($data['gettransactionResult']);\n\t}", "public function isSuccessful()\n\t {\n\t\tif ($this->_result instanceof mysqli_result || $this->_result === true)\n\t\t {\n\t\t\treturn true;\n\t\t }\n\t\telse\n\t\t {\n\t\t\treturn false;\n\t\t }\n\t }", "public function hasResults() {\n\t\treturn $this->count() >= 1;\n\t}", "public function isSuccess() {\n return parent::isSuccess() ? count($this->getResult()) > 0 : FALSE;\n }", "public function hasResult(){\n return $this->_has(2);\n }", "final public function hasResults()\n {\n return boolval($this->results);\n }", "public function valid()\n\t{\n\t\treturn $this->databaseResult->valid();\n\t}", "public function isSuccessful()\r\n {\r\n // 訂單請求過銀聯后必須用origRespCode來判斷支付是否成功\r\n if (isset($this->data['origRespCode'])) {\r\n if ($this->data['origRespCode'] === '00') {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n // 訂單沒有請求過銀聯用respCode來判斷支付是否成功\r\n return isset($this->data['respCode']) && $this->data['respCode'] === '00';\r\n }", "public function hasResults()\n {\n return $this->matches && $this->matches->exists();\n }", "public function isValid()\n\t{\n\t\treturn $this->response\n\t\t\t&& $this->response->isValid();\n\t}", "public function isOk()\n {\n return $this->status == 'success' || $this->status == 'incomplete';\n }", "public function valid() {\n\t\treturn $this->can_fetch() && (false !== $this->fetch());\n\t}", "public function isReturned() {\r\n\r\n\t\tself::errorReset();\r\n\t\t$this->reload();\r\n\t\treturn InputValidator::isEmpty($this->returnDate) ? false: true;\r\n\t}", "public function success()\n {\n return ( \n ! empty($this->result) \n && $this->result->getStatus() == 'Success' \n && $this->result->getCode() == 200 );\n }", "public function checkResult(int $userResult = 0): bool {\n\t\treturn $userResult === $this->result;\n\t}", "function ok()\n {\n return (0 == count($this->_errores));\n }" ]
[ "0.7610003", "0.7455422", "0.726771", "0.7231844", "0.7221336", "0.7185457", "0.69031245", "0.68116444", "0.68116444", "0.68116444", "0.66841316", "0.66414577", "0.65968955", "0.65859735", "0.6569663", "0.6548598", "0.6537232", "0.6536151", "0.65261424", "0.64882785", "0.644277", "0.6388805", "0.635175", "0.6343253", "0.6338919", "0.6321806", "0.62932456", "0.62823707", "0.62391734", "0.6236911" ]
0.7776744
0
Append an array of child elements
public function appendChildren(array $elements) { foreach ($elements as $element) { $this->appendChild($element); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function append($node) {\n\t\tif (!is_array($node)) {\n\t\t\t$this->child[]=$node;\n\t\t} else if (is_array($node)) {\n\t\t\tfor ($childIdx=0; $childIdx<count($node); $childIdx++)\n\t\t\t\t$this->child[]=$node[$childIdx];\n\t\t}\n\t}", "function append ( $element ) {\n $this->childrenElements[] = $element;\n }", "function add_children(){\n\t\t\t\t\t//if the array has a parent add it to the parents child array\n\t\tforeach ($this->nodes as $node){\n\t\t\tif($node->parent!=-1){\n\t\t\t\tif(isset($this->nodes[$node->parent])){\n\t\t\t\t\t$parent=$this->nodes[$node->parent];\n\t\t\t\t\t$parent->add_child($node->id);\n\t\t\t\t}else{\n\t\t\t\t\tprint_error('nonode','socialwiki');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function getChildElements() {}", "public function addChildren(array $children);", "public function testAppendMultiple()\n {\n $element1 = new Element('element1');\n $element2 = new Element('element2');\n\n $dummy1 = new Element('dummy1');\n $dummy2 = new Element('dummy2');\n\n $child1 = new Element('child1');\n $child2 = new Element('child2');\n $childDeep = new Element('child_deep');\n\n $element1->insertAfter($dummy1);\n $element2->insertAfter($dummy2);\n $child2->insertAfter($childDeep);\n\n $parentDom = (new Dom($element1))->add($element2);\n $childDom = (new Dom($child1))->add($child2);\n\n $parentDom->append($childDom);\n\n $this->assertCount(2, $parentDom);\n $this->assertCount(3, $parentDom->eq(0)->children());\n $this->assertCount(3, $parentDom->eq(1)->children());\n\n $this->assertSame($dummy1, $parentDom->eq(0)->children()->get(0));\n $this->assertSame($child1, $parentDom->eq(0)->children()->get(1));\n $this->assertSame($child2, $parentDom->eq(0)->children()->get(2));\n $this->assertSame($childDeep, $parentDom->eq(0)->children()->eq(2)->children()->get(0));\n\n // the second element from the collection receives cloned copies\n $this->assertSame($dummy2, $parentDom->eq(1)->children()->get(0));\n $this->assertNotSame($child1, $parentDom->eq(1)->children()->get(1));\n $this->assertNotSame($child2, $parentDom->eq(1)->children()->get(2));\n $this->assertNotSame($childDeep, $parentDom->eq(1)->children()->eq(2)->children()->get(0));\n $this->assertSame((string) $child1, (string) $parentDom->eq(1)->children()->get(1));\n $this->assertSame((string) $child2, (string) $parentDom->eq(1)->children()->get(2));\n $this->assertSame((string) $childDeep, (string) $parentDom->eq(1)->children()->eq(2)->children()->get(0));\n }", "abstract protected function getNewChildren(): array ;", "public function append($ascArray,$parentName){\n try {\n //get the parent element if one already exists\n $existing = $this->xml->getElementsByTagName($parentName);\n //check if the parent did exists\n if ($existing->length==1 && $existing->item(0)->parentNode == $this->xml){\n //replace the existing parent with a modified version to contain the new array\n $this->xml->replaceChild($existing->item(0), $this->ArraytoXML(ascArray,$existing->item(0)));\n }\n else\n {\n //if not then create the parent element\n $parentNode = $this->xml->createElement($parentName);\n //append the array\n $this->xml->appendChild($this->arraytoXML($ascArray,$parentNode));\n } \n } catch (Exception $ex) {\n die(\"Append Failed: \".$ex);\n } \n }", "public function withAddedNestedElements(IElement ...$Elements): IContainerElement;", "function addChildren(array $children) : void;", "private function prepareObjectArray(){\n\t//scorro l' array $this->objarr settando su ciascun oggetto gli attributi children\n\tforeach($this->objarr as $key=>$object){\n\t\t//echo \"-\".$object->getAppendToIndex().\"<br />\";\n\t\t\n\t\tif(($appind=$object->getAppendToIndex()) != \"\"){\n\t\t\n\t\t$object->setIntegrated(true); //indico che l' oggetto è stato incluso come figlio di un altro.\t\n\t\t\n\t\t $objparent=$this->objarr[$appind];\n\t\t\t$objparent->appendChild($object);\t\n\t\t\t//echo $objparent->getIndex();\n\t\t}\n\t}\n}", "function add($n)\n\t{\n\t\tif (is_array($n))\n\t\t{\n\t\t\tfor($i = 0; $i < count($n); ++$i)\n\t\t\t{\n\t\t\t\t$this->children[] = $n[$i];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->children[] = $n;\n\t\t}\n\t}", "function add($n)\n\t{\n\t\tif (is_array($n))\n\t\t{\n\t\t\tfor($i = 0; $i < count($n); ++$i)\n\t\t\t{\n\t\t\t\t$this->children[] = $n[$i];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->children[] = $n;\n\t\t}\n\t}", "public function appendChildCopy($item) {}", "public function addChildDocuments(array &$docs) {}", "protected function addArrayOutput($array, $parent = null)\n {\n if ( !isset($parent) )\n $parent = $this->result;\n\n foreach ( $array AS $key=>$value )\n {\n\n $node = $this->dom->createElement($key);\n $parent->appendChild($node);\n\n if ( is_array($value) )\n {\n $this->addArrayOutput($value, $node);\n } else {\n $node->appendChild($this->dom->createTextNode($value));\n }\n }\n }", "public function addFromArray(array $array)\r\n {\r\n foreach ($array as $child) {\r\n $this->add($child);\r\n }\r\n return $this;\r\n }", "private function arrayInsert($node, $value, &$parent)\n\t{\n\t\t$index = 0;\n\t\t$nameRoot =\t$this->formNameRoot($node);\n\n\t\t// See if the parent already has an element by this name\n\t\tif (isset($parent[$nameRoot]))\n\t\t{\n\t\t\t// Is it a single value?\n\t\t\tif(!is_array($parent[$nameRoot]))\n\t\t\t{\n\t\t\t\t// Need to replace the exising item as the zeroth item of the array\n\t\t\t\t$parent[$nameRoot] = array($parent[$nameRoot]);\n\t\t\t\t\n\t\t\t\t// Do the same with any attributes\n\t\t\t\tif (isset($parent[$this->formAttributeName($nameRoot)]))\n\t\t\t\t{\n\t\t\t\t\t$attributeName = $this->formAttributeName($nameRoot);\n\t\t\t\t\t$parent[$attributeName] = array($parent[$attributeName]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Now is array so just add to the end of it.\n\t\t\t$parent[$nameRoot][] = $value;\n\t\t\t\n\t\t\t$index = count($parent[$nameRoot]) - 1; \n\t\t}\n\t\telse\n\t\t{\n\t\t\t$parent[$nameRoot] = $value;\n\t\t}\n\t\t\n\t\t// Add attributes if necessary\n\t\t$this->addAttributes($node, $index, $parent);\n\t}", "public function getChildren(): array;", "protected function append($child): void\n {\n $this->children[] = $child;\n }", "public function getChildNodes() {}", "public function getChildNodes() {}", "public function append($elements)\n\t{\n\t\tif (is_array($elements))\n\t\t{\n\t\t\t$this->elements = array_merge($this->elements, $elements);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->elements = array_merge($this->elements, array($elements));\n\t\t}\n\t}", "public function append ($content) {\r\n\t\t\r\n\t\tif ($this->length < 1) return null;\r\n\t\t\r\n\t\t$args = func_get_args();\r\n\t\tforeach ($args as $offset => $value) \r\n\t\t\tif ($value = $this->process($value)) \r\n\t\t\t\tforeach ($this as $node) \r\n\t\t\t\t\tif (get_class($value) === 'XDTNodeList') $node->appendChild($value[0]);\r\n\t\t\t\t\telse $node->appendChild($value);\r\n\t\t\t\t\r\n\t\treturn $this;\r\n\t}", "function appendChildren () {\n $this->menu[]=new Marker('start');\n foreach ( $this->items as $item ) {\n if ( $item->parent_id() == $this->current->id() ) {\n $this->menu[]=$item;\n }\n }\n $check=end($this->menu);\n if ( $check->isStart() )\n array_pop($this->menu);\n else\n $this->menu[]=new Marker('end');\n }", "private function getXMLElements( $newXML, $array )\r\n {\r\n foreach( $array as $key=>$value )\r\n {\r\n\t\t\tif(gettype($key)!=\"string\")\r\n\t\t\t{\r\n\t\t\t\t$key = \"A\".$key;\r\n\t\t\t}\r\n if( is_array( $value ) )\r\n {\r\n $child = $newXML->addChild( $key );\r\n $this->getXMLElements( $child, $value );\r\n }\r\n else\r\n {\r\n $newXML->addChild( $key, $value );\r\n }\r\n }\r\n \r\n return $newXML;\r\n }", "public function addElements($elements);", "public function push(Element ...$elem): Element\n {\n foreach ($elem as $e) {\n $this->element = $this->element.$e;\n }\n\n return $this;\n }", "public function testAddChild_Loop()\n\t{\n\t\t$someChild1 = new child('somechild1 att');\n\t\t$someChild2 = new child('somechild2 att');\n\t\t$someChild3 = new child('somechild3 att');\n\n\t\t$childList = array($someChild1, $someChild2, $someChild3);\n\n\t\tforeach ($childList as $child)\n\t\t{\n\t\t\t$this->object->AddChild($child);\n\t\t}\n\n\t\t$this->assertEquals('somechild1 att', $this->object->childList[0]->attribute);\n\t\t$this->assertEquals('somechild2 att', $this->object->childList[1]->attribute);\n\t\t$this->assertEquals('somechild3 att', $this->object->childList[2]->attribute);\n\t}", "public function testPrependMultiple()\n {\n $element1 = new Element('element1');\n $element2 = new Element('element2');\n\n $dummy1 = new Element('dummy1');\n $dummy2 = new Element('dummy2');\n\n $child1 = new Element('child1');\n $child2 = new Element('child2');\n $childDeep = new Element('child_deep');\n\n $element1->insertAfter($dummy1);\n $element2->insertAfter($dummy2);\n $child2->insertAfter($childDeep);\n\n $parentDom = (new Dom($element1))->add($element2);\n $childDom = (new Dom($child1))->add($child2);\n\n $parentDom->prepend($childDom);\n\n $this->assertCount(2, $parentDom);\n $this->assertCount(3, $parentDom->eq(0)->children());\n $this->assertCount(3, $parentDom->eq(1)->children());\n\n $this->assertSame($child1, $parentDom->eq(0)->children()->get(0));\n $this->assertSame($child2, $parentDom->eq(0)->children()->get(1));\n $this->assertSame($dummy1, $parentDom->eq(0)->children()->get(2));\n $this->assertSame($childDeep, $parentDom->eq(0)->children()->eq(1)->children()->get(0));\n\n // the second element from the collection receives cloned copies\n $this->assertSame($dummy2, $parentDom->eq(1)->children()->get(2));\n $this->assertNotSame($child1, $parentDom->eq(1)->children()->get(0));\n $this->assertNotSame($child2, $parentDom->eq(1)->children()->get(1));\n $this->assertNotSame($childDeep, $parentDom->eq(1)->children()->eq(1)->children()->get(0));\n $this->assertSame((string) $child1, (string) $parentDom->eq(1)->children()->get(0));\n $this->assertSame((string) $child2, (string) $parentDom->eq(1)->children()->get(1));\n $this->assertSame((string) $childDeep, (string) $parentDom->eq(1)->children()->eq(1)->children()->get(0));\n }" ]
[ "0.70471627", "0.6645177", "0.64714247", "0.63536996", "0.6318185", "0.62570274", "0.6226185", "0.61726373", "0.6168356", "0.613448", "0.60892767", "0.5971514", "0.5971514", "0.59264576", "0.5910577", "0.5881004", "0.58766544", "0.5809089", "0.5737582", "0.57370627", "0.57098854", "0.57098156", "0.5667324", "0.5657164", "0.56328523", "0.5552845", "0.55472195", "0.55434954", "0.5526311", "0.5522279" ]
0.67076284
1
Prepare a value for output based off a schema array.
protected function prepare_value( $value, $schema ) { switch ( $schema['type'] ) { case 'string': return strval( $value ); case 'number': return floatval( $value ); case 'boolean': return (bool) $value; default: return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function prepare_value($value, $schema)\n {\n }", "public function prepValue($value)\n\t{\n\t\t$this->_convertDateTimes($value);\n\n\t\tif (is_array($value) && ($columns = $this->getSettings()->columns))\n\t\t{\n\t\t\t// Make the values accessible from both the col IDs and the handles\n\t\t\tforeach ($value as &$row)\n\t\t\t{\n\t\t\t\tforeach ($columns as $colId => $col)\n\t\t\t\t{\n\t\t\t\t\tif ($col['handle'])\n\t\t\t\t\t{\n\t\t\t\t\t\t$row[$col['handle']] = (isset($row[$colId]) ? $row[$colId] : null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $value;\n\t\t}\n\t}", "private function value($value, array $schema = array()) {\n\t\tif (is_array($value) && count($value) > 0) {\n\t\t\tforeach ($value as $key => $val) {\n\t\t\t\t$value[$key] = $this->value($val, $schema);\n\t\t\t}\n\t\t\treturn $value;\n\t\t}\n\t\tif ($value === null) {\n\t\t\treturn 'NULL';\n\t\t}\n\n\t\tif(count($schema) > 0){\n\t\t\tswitch ($type = $schema['type']) {\n case 'boolean':\n return $this->_toNativeBoolean($value);\n case 'float':\n return floatval($value);\n case 'string':\n case 'nchar':\n case 'varchar':\n case 'nvarchar':\n return \"'\".$value.\"'\";\n\t\t\t\t\t\t\tcase 'ntext':\n\t\t\t\t\t\t\t\treturn \"\\\"\".$value.\"\\\"\";\n case 'integer':\n case 'bigint':\n case 'int':\n return intval($value);\n case 'date':\n return \"'\".date(\"Y-m-d\", strtotime($value)).\"'\";\n case 'datetime':\n return \"'\".date(\"Y-m-d H:i:s\", strtotime($value)).\"'\";\n\n }\n\t\t}\n\t}", "public function value($value, array $schema = [])\n\t{\n\t\tif (is_array($value)) {\n\t\t\tforeach ($value as $key => $val) {\n\t\t\t\t$value[$key] = $this->value($val, isset($schema[$key]) ? $schema[$key] : $schema);\n\t\t\t}\n\t\t\treturn $value;\n\t\t}\n\n\t\tif (is_object($value) && isset($value->scalar)) {\n\t\t\treturn $value->scalar;\n\t\t}\n\n\t\tif ($value === null) {\n\t\t\treturn 'NULL';\n\t\t}\n\n\t\t$type = isset($schema['type']) ? $schema['type'] : $this->_introspectType($value);\n\t\t$column = isset($this->_columns[$type]) ? $this->_columns[$type] : null;\n\n\t\treturn $this->_cast($type, $value, $column, $schema);\n\t}", "function __setSchemaField($fieldname, $descArray) {\n\t\t$result = array();\n\t\tif ($fieldname === $this->model->primaryKey) {\n\t\t\t$result[$fieldname] = $this->__fieldModelId . $this->__fieldTypeMappingTable[$descArray['type']];\n\t\t} else {\n\t\t\t$result[$fieldname] = $fieldname . $this->__fieldTypeMappingTable[$descArray['type']];\n\t\t}\n\t\treturn $result;\n\t}", "protected abstract function formatArrayValue(array $value);", "public function prepareDynamicValue($value)\n {\n return $value;\n }", "protected final function prepareValues($array)\n {\n\n foreach ($array as $index => $value)\n {\n if ((array_key_exists(\"table\", $array)))\n {\n unset($array[\"table\"]);\n }\n elseif ($value == null || $value == \"\")\n {\n unset($array[$index]);\n }\n }\n return \":\" . implode(\", :\", array_keys($array));\n\n }", "function rest_stabilize_value($value)\n {\n }", "protected function prepareValue($value)\n\t{\n\t\treturn $value;\n\t}", "private function buildArrayLiteral(array $value, array $requiredSizes): string\n {\n $requiredCount = array_shift($requiredSizes);\n if ($requiredCount !== count($value)) {\n throw TypeConversionException::unexpectedValue(\n $this,\n 'output',\n \"array with {$requiredCount} value(s)\",\n $value\n );\n }\n\n $parts = [];\n if (empty($requiredSizes)) {\n foreach ($value as $v) {\n $item = $this->itemConverter->output($v);\n $parts[] = ($item === null) ? 'NULL' : '\"' . addcslashes($item, '\"\\\\') . '\"';\n }\n\n } else {\n foreach ($value as $v) {\n if (!is_array($v)) {\n throw TypeConversionException::unexpectedValue($this, 'output', 'array', $v);\n }\n $parts[] = $this->buildArrayLiteral($v, $requiredSizes);\n }\n }\n\n return '{' . implode(',', $parts) . '}';\n }", "public function prepValueFromPost($value)\n\t{\n\t\t$this->_convertDateTimes($value, craft()->getTimeZone());\n\n\t\tif (is_array($value))\n\t\t{\n\t\t\t// Drop the string row keys\n\t\t\treturn array_values($value);\n\t\t}\n\t}", "private function _prepareRow($array){\n return array_merge($this->_blankRow, $array);\n }", "public function dbPrepValue($value)\n {\n return $value;\n }", "public function getSchemaValue()\n {\n $value = $this->RAW();\n if ($value) {\n return [ 'html' => $this->RAW() ];\n }\n return null;\n }", "function acapi_convert_values($arr) {\n foreach ($arr as $k => $v) {\n if (!isset($v)) {\n $arr->{$k} = '';\n }\n elseif (is_array($v) || is_object($v)) {\n $arr->{$k} = '...';\n }\n }\n return (array) $arr;\n}", "protected function cleanUpValue( $value ) {\n\t\t$cleanValue = [];\n\t\tif ( !is_array( $value ) ) {\n\t\t\treturn $cleanValue;\n\t\t}\n\t\tforeach ( $value as $singleValue ) {\n\t\t\t$singleValue = parent::cleanUpValue( $singleValue );\n\t\t\t// Remove options that we don't have here\n\t\t\tif ( !isset( $this->fields[ $singleValue ] ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$cleanValue[] = $singleValue;\n\t\t}\n\t\treturn $cleanValue;\n\t}", "function _wp_array_set(&$input_array, $path, $value = \\null)\n {\n }", "function format_array( $name, &$array2format ){\n $cnt = 0;\n $ret = '';\n\n if( count($array2format) === 0 ){\n //no values, create empty array to have a default in settings.conf\n return $name.'[0]=\"\"';\n }\n\n reset($array2format);\n foreach( $array2format as $val ){\n if( $val != '' ){\n $ret .= $name.\"[$cnt]='$val'\\n\";\n ++$cnt;\n }\n }\n\n $ret = trim($ret, \"\\n\");\n return $ret;\n }", "private function transform($value) {\n $CI = & get_instance();\n // caso seja um array\n if (is_array($value)) {\n // percorre os valores\n foreach ($value as $x) {\n // se for um inteiro\n if (is_integer($x)) {\n $foo[] = $x;\n } else if (is_string($x)) {\n // se for string, adiciona aspas\n $foo[] = $CI->db->escape($x);\n }\n }\n // converte o array em string separada por \",\"\n $result = '(' . implode(',', $foo) . ')';\n }\n // caso seja uma string\n else if (is_string($value)) {\n // adiciona aspas\n $result = $CI->db->escape($value);\n }\n // caso seja valor nullo\n else if (is_null($value)) {\n // armazena NULL\n $result = 'NULL';\n }\n\n // caso seja booleano\n else if (is_bool($value)) {\n // armazena TRUE ou FALSE\n $result = $value ? 'TRUE' : 'FALSE';\n } else {\n $result = $CI->db->escape($value);\n }\n // retorna o valor\n return $result;\n }", "public function hydrate($value)\n {\n $value = array_filter($value, function ($var) {\n return !is_null($var);\n });\n return $this->marshaller->marshalItem($value);\n }", "public static function normalizeValue($value)\n {\n if ($value instanceof Node) {\n return $value;\n } elseif (is_null($value)) {\n return new Expr\\ConstFetch(\n new Name('null')\n );\n } elseif (is_bool($value)) {\n return new Expr\\ConstFetch(\n new Name($value ? 'true' : 'false')\n );\n } elseif (is_int($value)) {\n return new Scalar\\LNumber($value);\n } elseif (is_float($value)) {\n return new Scalar\\DNumber($value);\n } elseif (is_string($value)) {\n return new Scalar\\String_($value);\n } elseif (is_array($value)) {\n $items = [];\n $lastKey = -1;\n foreach ($value as $itemKey => $itemValue) {\n // for consecutive, numeric keys don't generate keys\n if (null !== $lastKey && ++$lastKey === $itemKey) {\n $items[] = new Expr\\ArrayItem(\n self::normalizeValue($itemValue)\n );\n } else {\n $lastKey = null;\n $items[] = new Expr\\ArrayItem(\n self::normalizeValue($itemValue),\n self::normalizeValue($itemKey)\n );\n }\n }\n return new Expr\\Array_($items);\n } else {\n throw new \\LogicException('Invalid value');\n }\n }", "function acf_unarray($val)\n{\n}", "private function constructSchema(array $schema)\n {\n if (!$schema) {\n return '';\n }\n\n $fields = array_map(function ($field) {\n return $this->addColumn($field);\n }, $schema);\n\n return implode(\"\\n\".str_repeat(' ', 5).'*'.str_repeat(' ', 13), $this->removeEmpty($fields));\n }", "function format_value( $value, $post_id, $field )\n\t\t{\n\n\t\t\tif(is_array($value)) {\n\t\t\t\t$array = array();\n\n\t\t\t\tforeach ($value as $k => $v) {\n\t\t\t\t\t$array[$k] = json_decode( $v, true );\n\t\t\t\t}\n\n\t\t\t\treturn $array;\n\t\t\t}\n\n\t\t}", "protected function parseFlatValue($value)\n {\n if($parseParts = $this->getParseFunction($value)){\n if($parseParts[0] == \"slugify\"){\n $column = $parseParts[1];\n $model = $this->row->getColumns();\n $value = strtoupper(str_slug($model[$column], '_'));\n }\n if($parseParts[0] == \"imagify\"){\n $imageUrl = $parseParts[1];\n $size = getimagesize($imageUrl);\n $extension = image_type_to_extension($size[2]);\n $filename = time() . $extension;\n $file = Storage::put('/public/imported/'.$filename, file_get_contents($imageUrl), 'public');\n $url = 'public/imported/'.$filename;\n \n $value = $url;\n }\n }\n\n if($value == \"\"){\n $value = null;\n }\n \n return $value;\n }", "protected function prepForSave()\n\t{\n\t\t$array = array();\n\t\tforeach( static::$schema AS $field => $type )\n\t\t{\n\t\t\tif ( is_array( $type ) )\n\t\t\t{\n\t\t\t\t$type = $type[ 'type' ];\n\t\t\t}\n\t\t\t\n\t\t\t$array[ $field ] = $this->sanitize( $type, $this->data[ $field ], true );\n\t\t}\n\n\t\tif ( isset( $this->data[ 'updated_at' ] ) )\n\t\t{\n\t\t\t$array[ 'updated_at' ] = date( 'Y-m-d H:i:s' );\n\t\t}\n\t\tif ( ! $this->loaded && isset( $this->data[ 'created_at' ] ) )\n\t\t{\n\t\t\t$array[ 'created_at' ] = date( 'Y-m-d H:i:s' );\n\t\t}\n\t\t\n\t\treturn $array;\n\t}", "protected function normalizeValue($value) {\n\t\tif ($value instanceof PHPParser_Node) {\n\t\t\treturn $value;\n\t\t} elseif (is_null ( $value )) {\n\t\t\treturn new PHPParser_Node_Expr_ConstFetch ( new PHPParser_Node_Name ( 'null' ) );\n\t\t} elseif (is_bool ( $value )) {\n\t\t\treturn new PHPParser_Node_Expr_ConstFetch ( new PHPParser_Node_Name ( $value ? 'true' : 'false' ) );\n\t\t} elseif (is_int ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_LNumber ( $value );\n\t\t} elseif (is_float ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_DNumber ( $value );\n\t\t} elseif (is_string ( $value )) {\n\t\t\treturn new PHPParser_Node_Scalar_String ( $value );\n\t\t} elseif (is_array ( $value )) {\n\t\t\t$items = array ();\n\t\t\t$lastKey = - 1;\n\t\t\tforeach ( $value as $itemKey => $itemValue ) {\n\t\t\t\t// for consecutive, numeric keys don't generate keys\n\t\t\t\tif (null !== $lastKey && ++ $lastKey === $itemKey) {\n\t\t\t\t\t$items [] = new PHPParser_Node_Expr_ArrayItem ( $this->normalizeValue ( $itemValue ) );\n\t\t\t\t} else {\n\t\t\t\t\t$lastKey = null;\n\t\t\t\t\t$items [] = new PHPParser_Node_Expr_ArrayItem ( $this->normalizeValue ( $itemValue ), $this->normalizeValue ( $itemKey ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn new PHPParser_Node_Expr_Array ( $items );\n\t\t} else {\n\t\t\tthrow new LogicException ( 'Invalid value' );\n\t\t}\n\t}", "private function insertValues($finaldataset, $dataset, $array) {\n for ($i = 0; $i < count($finaldataset); $i++) {\n if (is_array($dataset[$i][2])) {\n if (isset($dataset[$i][2]['selectname'])) { // exception for select composing\n $finaldataset[$i]['input_value'] = $array[$dataset[$i][2]['selectname']];\n }\n }\n /**\n * Since we use same function both for add and edit pages, some of the values in fields might be void.\n * $array is array from $_SESSION if user is on add page and have already tried to save data\n * or array with db data if user is on add edit page.\n */\n elseif (isset($array[$dataset[$i][2]])) $finaldataset[$i]['input_value'] = $array[$dataset[$i][2]];\n else $finaldataset[$i]['input_value'] = '';\n }\n return $finaldataset;\n }", "function update_value( $value, $post_id, $field ) {\n\n\t\t\t// Bail early if no value.\n\t\t\tif ( empty( $value ) ) {\n\t\t\t\treturn $value;\n\t\t\t}\n\n\t\t\t// Convert to array.\n\t\t\t$value = acf_array( $value );\n\n\t\t\t// Format array of values.\n\t\t\t// - ensure each value is an id.\n\t\t\t// - Parse each id as string for SQL LIKE queries.\n\t\t\t$value = array_map( 'acf_idval', $value );\n\t\t\t$value = array_map( 'strval', $value );\n\n\t\t\t// Return value.\n\t\t\treturn $value;\n\n\t\t}" ]
[ "0.67483413", "0.6205842", "0.618068", "0.56534785", "0.554653", "0.54904425", "0.54771096", "0.5421695", "0.5328472", "0.5214461", "0.5201358", "0.5201351", "0.52000785", "0.51834923", "0.51401013", "0.51368433", "0.5066874", "0.5058589", "0.50428456", "0.5038394", "0.4982154", "0.49548966", "0.4940712", "0.49279806", "0.49233073", "0.49226922", "0.49219552", "0.49109453", "0.4906354", "0.48980242" ]
0.62846506
1
Get the site setting schema, conforming to JSON Schema.
public function get_item_schema() { $options = $this->get_registered_options(); $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'settings', 'type' => 'object', 'properties' => array(), ); foreach ( $options as $option_name => $option ) { $schema['properties'][ $option_name ] = $option['schema']; } return $this->add_additional_fields_schema( $schema ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static public function get_settings_schema() {\n\n $_schema = json_decode( wp_remote_retrieve_body( wp_remote_get( WPP_API_URL_STANDARDS . '/schema' ) ), true );\n\n return isset( $_schema['data'] ) ? $_schema['data'] : array();\n\n }", "public function getSettings() {\n $file = SETTINGS_PATH.'/'.$this->domain.'.json';\n $siteSettings = file_get_contents($file);\n return json_decode($siteSettings);\n }", "public static function getSiteSettings()\n {\n $siteSettingData = SiteSetting::first();\n return $siteSettingData;\n }", "public function jsonschema() {\n return $this->service->jsonschema();\n }", "public function getSchema()\n {\n return $this->get(self::SCHEMA);\n }", "public static function get_site_setting()\n {\n return Setting::pluck('value','slug')->toArray();\n }", "public function getSettings()\n {\n if (array_key_exists(\"settings\", $this->_propDict)) {\n if (is_a($this->_propDict[\"settings\"], \"\\Beta\\Microsoft\\Graph\\Model\\AppsAndServicesSettings\") || is_null($this->_propDict[\"settings\"])) {\n return $this->_propDict[\"settings\"];\n } else {\n $this->_propDict[\"settings\"] = new AppsAndServicesSettings($this->_propDict[\"settings\"]);\n return $this->_propDict[\"settings\"];\n }\n }\n return null;\n }", "public function getSchema() {\n\t\tif (empty($this->mSchema['subproject_content_data'])) {\n\n\t \t\t/* Schema for subproject_content_id */\n\t\t\t$this->mSchema['subproject_content_data']['subproject_content_id'] = array(\n\t\t\t\t'name' => 'subproject_content_id',\n\t\t\t\t'type' => 'reference',\n\t\t\t\t'label' => 'Sub Projects',\n\t\t\t\t'help' => 'Select the sub-projects this content belongs to',\n\t\t\t\t'table' => 'liberty_content',\n\t\t\t\t'column' => 'content_id',\n\t\t\t\t'required' => '1'\n\t\t\t);\n\t\t}\n\n\n\t\treturn $this->mSchema;\n\t}", "public function getSchema(): Schema;", "public function getSchema() {}", "public function getSettings() {\n return $this->settings == null ? array() : json_decode($this->settings, true);\n }", "public function getSettings()\n {\n $response = $this->get('settings');\n $data = $response->json();\n return new Settings($data);\n }", "public function getSchema()\n {\n return $this->schema;\n }", "public function getSchema()\n {\n return $this->schema;\n }", "public function getSchema()\n {\n return $this->schema;\n }", "public function getSchema()\n {\n return $this->schema;\n }", "public function getSchema()\n {\n return $this->schema;\n }", "public function getSchema()\n {\n return $this->schema;\n }", "public function getSchema()\n {\n if (empty($this->schema)) {\n return 'public';\n } else {\n return $this->schema;\n }\n }", "protected function _getSchema() {\n\t\treturn $this->__schema;\n\t}", "public function getSettings()\n {\n $data = $this->_plugin->getSettings();\n\n return Frenet_SettingsModel::populateModel($data);\n }", "public static function getSettings() {\n\n\t\tglobal $lumi_aiowps_tweaks;\n\t\tif( isset( $lumi_aiowps_tweaks['Settings'] ) ) {\n\t\t\treturn $lumi_aiowps_tweaks['Settings'];\n\t\t} else {\n\t\t\tinclude_once( __DIR__ . '/SettingsAPI.class.php' );\n\t\t\t$lumi_aiowps_tweaks['Settings'] = new SettingsAPI();\n\t\t\treturn $lumi_aiowps_tweaks['Settings'];\n\t\t}\n\n\t}", "public function getSettings()\n {\n return SettingsRecord::find()->one();\n }", "public function get_schema() {\n\t\treturn $this->schema;\n\t}", "public function getSchema()\n {\n if ($this->schema) {\n return $this->schema;\n }\n\n return $this->schema = resolve(Bakery::getModelSchema($this));\n }", "public function schema()\n\t{\n\t\treturn $this->schema;\n\t}", "public function getSchema()\r\n {\r\n // if existed (like post): begiresh va be view pass bede\r\n // if not (like blog,index): default schema template\r\n // include schema.view\r\n }", "public function getSchema();", "public function getSchema();", "public function getSchema();" ]
[ "0.7996044", "0.6677421", "0.6593927", "0.6385942", "0.6174305", "0.6144686", "0.6039883", "0.6017932", "0.59656686", "0.59631807", "0.5948019", "0.5907641", "0.58914", "0.58914", "0.58914", "0.58914", "0.58914", "0.58914", "0.5885717", "0.5882725", "0.5876973", "0.58548236", "0.58458567", "0.5845677", "0.58414793", "0.5832387", "0.5829012", "0.57989097", "0.57989097", "0.57989097" ]
0.7493372
1
Halaman List para User
public function list_user() { check_access_level_superuser(); $data = [ 'list_user' => $this->user_m->get_cabang(), 'list_cabang' => $this->data_m->get('tb_cabang') ]; $this->template->load('template2', 'user/list_user', $data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function userlist()\n\t{\n\t\t$data['page']='Userlist';\n\t\t$data['users_list']=$this->users->get_many_by('userlevel_id',2);\n\t\t$view = 'admin/userlist/admin_userlist_view';\n\t\techo Modules::run('template/admin_template', $view, $data);\t\n\t}", "public function userList() {\n /** @var User[] $users */\n $users = $this->entityManager->getRepository(\"Entity\\\\User\")->findAll(); // Retrieve all User objects registered in database\n echo $this->twig->render('admin/lists/users.html.twig', ['users' => $users]);\n }", "public function userlistAction()\n\t{\n\t\t$users = $this->userService->getUserList(array(), false);\n\n\t\t$this->view->roles = za()->getUser()->getAvailableRoles();\n\t\t$this->view->users = $users;\n\t\t$this->renderView('admin/user-list.php');\n\t}", "public function getUsersList()\n {\n }", "public function index()\n {\n $this->user_list();\n }", "function get_user_list(){\n\t\treturn array();\n\t}", "public function userlist()\n {\n $users = array('users' => UserModel::getPublicProfilesOfAllUsers(),'dynatable'=>'userlist');\n $this->View->render('user/userlist',$users);\n }", "public function userlist()\n {\n $filter = Param::get('filter');\n\n $current_page = max(Param::get('page'), SimplePagination::MIN_PAGE_NUM);\n $pagination = new SimplePagination($current_page, MAX_ITEM_DISPLAY);\n $users = User::filter($filter);\n $other_users = array_slice($users, $pagination->start_index + SimplePagination::MIN_PAGE_NUM);\n $pagination->checkLastPage($other_users);\n $page_links = createPageLinks(count($users), $current_page, $pagination->count, 'filter=' . $filter);\n $users = array_slice($users, $pagination->start_index -1, $pagination->count);\n \n $this->set(get_defined_vars());\n }", "function user_list()\n {\n if ($this->isAdmin() == TRUE) {\n $this->loadThis();\n } else {\n $this->global['pageTitle'] = '运营人员列表';\n $this->global['pageName'] = 'userlist';\n\n $data['searchType'] = '0';\n $data['searchName'] = '';\n\n $this->loadViews(\"user_manage/users\", $this->global, $data, NULL);\n }\n }", "public function index()\n {\n $this->userlist();\n }", "function listuser(){\n\t\t\tif(!empty($_GET['paginado'])){\n\t\t\t\t$pag = $_GET['paginado'];\n\t\t\t\t$list = $this -> model -> selectuser($pag);\n\t\t\t}else{\n\t\t\t\t$list = $this -> model -> selectuser();\n\t\t\t}\n\t\t\t$this -> ajax_set($list);\n\t\t}", "public function user_list()\n\t\t{\n\t\t\t$this->is_login();\n\t\t\t$this->load->model('User_Profiles', 'up');\n\t\t\t$data['users'] = $this->up->get_all_users();\n\t\t\t$this->load->view('user_list-admin',$data);\n\t\t}", "public function showListAction() {\n $users = $this->getDoctrine()\n ->getRepository(User::class)\n ->findAll();\n return $this->render(':Security\\User:users.html.twig', [\n 'users' => $users\n ]);\n }", "public function getList($user);", "public function list()\n {\n $listUsers = AppUser::findAll();\n $this->show('back/user/list', [\"users\" => $listUsers]);\n }", "public function admin_user_list() {\n $this->paginate = array(\n 'limit' => 10,\n 'order' => array('User.created' => 'desc' ),\n 'conditions' => array('User.status' => 1),\n );\n $data = $this->paginate('User');\n $this->set('user', $data);\n $this->render('/Users/user_list');\n }", "public function listUser() {\n\t\t$users = new Model_Users();\n\t\t$listeUsers = $users->listUsers();\n\t\trequire_once($_SERVER['DOCUMENT_ROOT'].\"/ecommerce/views/admin/users/liste_users.php\");\n\t}", "public function index()\n {\n // show list user\n }", "public function usersListAction()\n\t{\n\t\t$em = $this->getDoctrine()->getEntityManager();\n\n\t\t$users = $em->getRepository('McmsUserBundle:User')->findAll();\n\n\t\treturn array('users' => $users);\n\t}", "public function listarUser() {\n if(IDUSER) {\n $eval = \"SELECT id,nombre,apellidos,email FROM users\";\n $peticion = $this->db->prepare($eval);\n $peticion->execute();\n $resultado = $peticion->fetchAll(PDO::FETCH_OBJ);\n exit(json_encode($resultado));\n } else {\n http_response_code(401);\n exit(json_encode([\"error\" => \"Fallo de autorizacion\"])); \n }\n }", "public function user_lists(){\n return get_instance()->ecl('Instance')->mod('lists', 'user_lists', [get_instance()->ecl('Instance')->user(),'email']);\n }", "function list_users(){\r\n\t\t$query = $this->db->query(\"SELECT userid, concat(fname, ' ', lname, ' (', username, ')') as name FROM nf_users\");\r\n\t\t$return = array();\r\n\t\tforeach($query->result() as $row){\r\n\t\t\t$return[$row->userid] = $row->name;\r\n\t\t}\r\n\t\treturn $return;\r\n\t}", "public function _list()\n\t{\n\t\t_root::getRequest()->setAction('list');\n\t\t$tUsers = model_user::getInstance()->findAll();\n\n\t\t$oView = new _view('users::list');\n\t\t$oView->tUsers = $tUsers;\n\t\t$oView->showGroup = true;\n\t\t$oView->title = 'Tous les utilisateurs';\n\n\t\t$this->oLayout->add('work', $oView);\n\t}", "public function lst(){\n\t\t$args = $this->getArgs();\n\t\t$uid = $_SESSION[\"user\"][\"uid\"];\n\t\t$base_url = substr($_SERVER[\"REQUEST_URI\"], 0, strrpos($_SERVER[\"REQUEST_URI\"], \"/\") + 1);\n\t\t$header = array(\n\t\t\t\tsprintf(\"%s\", Translate::get(Translator::USER_LIST_HEADER_ID)),\n\t\t\t\tsprintf(\"%s\", Translate::get(Translator::USER_LIST_HEADER_EMAIL)),\n\t\t\t\tsprintf(\"%s\", Translate::get(Translator::USER_LIST_HEADER_FNAME)),\n\t\t\t\tsprintf(\"%s\", Translate::get(Translator::USER_LIST_HEADER_LNAME)),\n\t\t\t\tsprintf(\"%s\", Translate::get(Translator::USER_LIST_HEADER_PHONE))\n\t\t);\n\t\t\n\t\t$config = array(\n\t\t\t\t\"config\" => array(\n\t\t\t\t\t\t\"page\" => (isset($args[\"GET\"][\"page\"]) ? $args[\"GET\"][\"page\"] : System::PAGE_ACTUAL_DEFAULT),\n\t\t\t\t\t\t\"column\" => (isset($args[\"GET\"][\"column\"]) ? $args[\"GET\"][\"column\"] : System::SORT_DEFAULT_COLUMN),\n\t\t\t\t\t\t\"direction\" => (isset($args[\"GET\"][\"direction\"]) ? $args[\"GET\"][\"direction\"] : System::SORT_DES),\n\t\t\t\t\t\t\"actual_pagesize\" => (isset($_SESSION[\"page_size\"]) ? $_SESSION[\"page_size\"] : System::PAGE_SIZE_DEFAULT),\n\t\t\t\t\t\t\"data_count\" => $this->getModel()->getCountUserList(),\n\t\t\t\t\t\t\"disable_menu\" => true,\n\t\t\t\t\t\t\"disable_select\" => true,\n\t\t\t\t\t\t\"disable_pagging\" => false,\n\t\t\t\t\t\t\"disable_set_pagesize\" => false\n\t\t\t\t),\n\t\t\t\t\"form_url\" => array(\n\t\t\t\t\t\t\"page\" => $base_url . \"-%d-%d-%s\",\n\t\t\t\t\t\t\"header_sort\" => $base_url . \"-%d-%d-%s\",\n\t\t\t\t\t\t\"form_action\" => $base_url\n\t\t\t\t),\n\t\t\t\t\"item_menu\" => array(),\n\t\t\t\t\"select_item_action\" => array(),\n\t\t\t\t\"style\" => array(\n\t\t\t\t\t\t\"marked_row_class\" => \"marked\",\n\t\t\t\t\t\t\"count_box_class\" => \"count_box\",\n\t\t\t\t\t\t\"pagging_box_class\" => \"pagging_box\",\n\t\t\t\t\t\t\"actual_page_class\" => \"actual_page\",\n\t\t\t\t\t\t\"table_header_class\" => \"head\",\n\t\t\t\t\t\t\"table_id\" => \"user_lst\",\n\t\t\t\t\t\t\"select_form_id\" => \"\",\n\t\t\t\t\t\t\"pagesize_form_id\" => \"pagesize_box\",\n\t\t\t\t\t\t\"list_footer_id\" => \"\"\n\t\t\t\t)\n\t\t);\n\t\t$data = $this->getModel()->getUserList($config[\"config\"][\"page\"], $config[\"config\"][\"actual_pagesize\"], $config[\"config\"][\"column\"], $config[\"config\"][\"direction\"], $config[\"config\"][\"disable_pagging\"]);\n\t\t$out = Paginator::generatePage($header, $data, $config);\n\t\tinclude 'gui/template/UserTemplate.php';\n\t}", "private function getUserList()\n {\n $users = User::getUsers();\n $users = ArrayHelper::map($users, 'id', 'username');\n \n return $users;\n }", "public function get_user_list() {\n\n $sql = \" SELECT userId, concat(firstName, ' ', surname) AS `name`\n FROM time_user\"; \n return $this->db->query( $sql );\n }", "public function listAction()\n\t{\n\t\t$em = $this -> getDoctrine()->getManager();\n\t\t$listUsers = $em -> getRepository('UserBundle:User') -> showNewUsers();\n\n\t\treturn $this -> render('FrontOfficeBundle:User:list.html.twig', \n\t\t\tarray('listUsers'=> $listUsers));\n\t}", "public function listofUser()\n {\n return view('Admin.ShowallUser');\n }", "function usersList($da){\r\n\t\t\treturn $this->trouverTout();\r\n\t\t}", "public function generate_users_list()\n {\n $this->get('/usuarios')->assertStatus(200)->assertSee('Pedro');\n }" ]
[ "0.7710576", "0.76590395", "0.7579087", "0.7573508", "0.75307435", "0.75220776", "0.7499849", "0.74958277", "0.7457248", "0.74262947", "0.7386747", "0.729269", "0.7289015", "0.72821397", "0.72498786", "0.7218278", "0.71950054", "0.7181125", "0.7177128", "0.71610385", "0.7158826", "0.7134721", "0.71151483", "0.7043134", "0.7038293", "0.70266825", "0.70223045", "0.70153207", "0.7008867", "0.7006216" ]
0.7906442
0
Loads Model represented by $modName and $ctrlName
public function loadModel($modName, $ctrlName = '') { if (!class_exists($modName.'Model')) { if (!$ctrlName) $ctrlName = $this->ctrlName; $filename = $this->app->getModelClassFileName($modName, $ctrlName); if (!file_exists($filename)) zf::halt("No such model found \"$modName\"! at $filename"); require_once $filename; } $class = ucfirst($modName).'Model'; $mod = new $class($ctrlName, $modName, $this); $this->models[$modName] = $mod; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function model($modName = null, $ctrlName = '')\n\t{\n\t\tif (!$modName) $modName = $this->ctrlName;\n if (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\tif (isset($this->models[$modName])) return $this->models[$modName];\n\t\t\n\t\t$this->loadModel($modName, $ctrlName);\n\t\treturn $this->model($modName);\n\t}", "public function model($modName = '', $ctrlName = '')\n {\n return parent::model($modName, $ctrlName);\n }", "public function loadModelByPath($modName, $path, $ctrlName = '')\n\t{\n\t\trequire_once $path;\n\t\t$class = ucfirst($modName).'Model'; \n\t\t$mod = new $class($ctrlName ? $ctrlName : $this->ctrlName, $modName, $this, null, dirname($path));\n\t\t$this->models[$modName] = $mod;\n\t\treturn $mod;\n\t}", "function loadModel($name){\n\t\t$dir = APP . \"Entity\" . DS;\n\n\t\t$file = str_replace([$dir,\".php\"], [\"\",\"\"], $name);\n\n\t\tif(!isset($this->$file)){\n\t\t\trequire_once $name;\n\t\t\t$this->$file = new $file();\n\t\t\tif(isset($this->Form)){\n\t\t\t\t$this->$file->Form = $this->Form; \n\t\t\t}\n\t\t}\n\n\n\t}", "public function loadModel()\n {\n if ($this->_modelName == null) {\n $this->_modelName = $this->_controllerName . '_Model';\n $this->load->model($this->_modelName);\n }\n }", "public function loadModel($name) {\n echo \"new view was called\";\n $path = MODELS_PATH . DS . $name . '_model.php';\n\n if (file_exists($path)) {\n require MODELS_PATH . DS . $name . '_model.php';\n $modelName = $name . '_Model';\n $this->model = new $modelName();\n }\n }", "public function LoadModel($model = \"\"){\n\t\t$model = $model != \"\" ? $model : CONTROLLER_CALLED;\t\t// Si $model esta vacia significa que se esta llamando al modelo que se llama igual al controlador actual\n\t\t$nameModel = $model.\"Model\";\n\t\t$routeModelModule = MODULE_USED.\"models/\".$model.\".php\";\n\t\tif(is_file($routeModelModule)){\n\t\t\t// Vista del Modulo actual\n\t\t\t$routeModel = $routeModelModule;\n\t\t}else{\n\t\t\tif(strpos($model,\"/\") !== false){\t\t\t// Con slashes ignificaria que se esta llamando el modelo de otro modulo\n\t\t\t\t$modelInfo = explode(\"/\",$model);\n\t\t\t\t$module = $modelInfo[0];\n\t\t\t\t$model2 = $modelInfo[1];\n\t\t\t\t$nameModel = $model2.\"Model\";\n\t\t\t\t\n\t\t\t\t$routeModelApp = APP_PATH.\"modules/\".$module.\"/models/\".$model2.\".php\";\n\t\t\t\tif(is_file($routeModelApp)){\n\t\t\t\t\t$routeModel = $routeModelApp;\n\t\t\t\t}else{\n\t\t\t\t\tthrow new \\Exception(\"The model \".$model.\" is not found in the application\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tthrow new \\Exception(\"The model \".$model.\" is not found in the module application\");\n\t\t\t}\n\t\t}\n\t\tinclude($routeModel);\n\t\t$objModel = new $nameModel;\n\t\treturn $objModel;\n\t}", "function loadModel($model){\n $url='models/'.$model.'model.php';//models/alumnomodel.php\n //validando que el modelo exista\n if(file_exists($url)){\n //si axiste lo llamamos\n require $url;\n $modelName=$model.'Model';\n //instancia de la clase del modelo recibido\n $this->model=new $modelName;\n }\n }", "function loadModel ($name){\n $file = ROOT.DS.'models'.DS.$name.'.php';\n require_once($file);\n\n if(!isset($this->name)){\n $this->$name = new $name();\n }\n }", "function loadModel($model = null) {\n\t\tif ($model && $this->$model == null) {\n\t\t\tApp::import('Model',\"Seo.$model\");\n\t\t\t$this->$model = ClassRegistry::init(\"Seo.$model\");\n\t\t}\n\t}", "public static function loadModel($params)\n\t{\n\t\tif(!self::$_model_loaded){\n\t\t\tself::loadLibrary('SHIN_Model');\n\t\t\tself::loadLibrary('SHIN_SelectQuery');\n\t\t\tself::$_model_loaded = TRUE;\n\t\t}\n\t\n\t\t$__data = preg_split(\"/_/\", $params[0]);\n\t\t$app_raw_name = strtolower($__data[0]);\n\t\t\n\t\tif($app_raw_name == 'sys'){\n\t\t\t$app_folder = self::$_config['core']['shinfw_folder'];\n\t\t} else {\n\t\t\t$app_folder = self::$applistpath[$app_raw_name];\n\t\t}\n\t\t\n\t\t$path = self::$_config['core']['base_path'].$app_folder;\n\t\t\t\n\t\t$__p = \tstrtolower($path.DIRECTORY_SEPARATOR.'models'.DIRECTORY_SEPARATOR.$params[0].'.php');\n\t\t\n\t\tif(count($params) == 2)\n\t\t{\n if(!is_file($__p))\n\t\t\t{\n self::show_error(\"Model \".$__p.\" not exists. Pls check path.\");\n }\n\t\t\trequire_once($__p);\n\t\t\t\n\t\t\tself::$_models[strtolower($params[1])] = new $params[0]();\n\t\t} else {\n\t\t\trequire_once($__p);\n\t\t}\n\t\t\n\t\treturn;\n }", "public function loadModel($module)\n\t{\n\t\t$modelName = $this->findModelName();\n\n\t\t// find the model path file base on the \"module\" or \"controller\"\n\t\t$modelPath = ($module != null) ? MODPATH . $module . DS . 'models' . DS . $modelName . '.php' : APPPATH . 'classes' . DS . 'models' . DS . $modelName . '.php';\n\n\t\tif(file_exists($modelPath))\n\t\t{\n\t\t\t// load model\n\t\t\trequire_once $modelPath;\n\n\t\t\t//\n\t\t\t$this->model = new $modelName();\n\t\t}\n\t}", "protected function loadModel($modelName , $key = null)\n {\n\n if (!$key)\n $key = $modelName;\n\n $modelName = 'Model'.$modelName;\n if (!isset($this->models[$key] )) {\n if (BuizCore::classExists($modelName)) {\n $this->models[$key] = new $modelName();\n } else {\n throw new Controller_Exception('Internal Error','Failed to load Submodul: '.$modelName);\n }\n }\n\n return $this->models[$key];\n\n }", "protected function modelExists($modName, $ctrlName = '')\n\t{\n\t\tif (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\treturn file_exists($this->zf->app->app_path.$this->zf->app->conf['models_dir'].'/'.$ctrlName.'/'.$modName.'.mod.inc');\n\t}", "private function loadModel() {\n // name as requested resource.\n $name = $this->name.'Model';\n $path = str_replace(kPlaceholder, $this->version, kModelsFolder);\n $path = $path . $name . \".php\";\n // If it does not exist, go with\n // the default Model class.\n if (!file_exists($path)) {\n return new Model();\n } else {\n if (!class_exists($name)) {\n include $path;\n }\n\n return new $name();\n }\n }", "public function load_model( $model_name = false ) {\n\t\tif ( ! $model_name ) return;\n\n\t\t$model_name = strtolower( $model_name );\n\t\t$model_path = ABSPATH . '/models/' . $model_name . '.php';\n\n\t\tif ( file_exists( $model_path ) ) {\n\t\t\trequire_once $model_path;\n\n\t\t\t// Pega só o nome final do caminho\n\t\t\t$model_name = explode('/', $model_name);\n\t\t\t$model_name = end( $model_name );\n\t\t\t$model_name = preg_replace( '/[^a-zA-Z0-9]/is', '', $model_name );\n\n\t\t\t// Retorna um objeto da classe\n\t\t\tif ( class_exists( $model_name ) ) {\n\t\t\t\treturn new $model_name( $this->db, $this );\n\t\t\t}\n\n\t\t\treturn;\n\t\t} // load_model\n\n\t}", "function loadModel($modelName,$negocio){\r\n\tif($modelName=='database'){\r\n\t\t$modelPath = '../Config/'.$negocio.'_'.$modelName.'.php';\r\n\t\tif(is_file($modelPath)){\r\n\t\t\tif (!class_exists($modelName)) {\r\n\t\t\t\trequire_once($modelPath);\r\n\t\t\t}\t\t\r\n\t\t}else{\r\n\t\t\techo 'No existe la conexion'.$modelPath;\r\n\t\t\texit();\r\n\t\t}\r\n\t\t$model = new $modelName();\r\n\t\treturn $model;\t\r\n\t}else{\r\n\t\t$modelPath = '../Model/'.$modelName.'.php';\r\n\t\tif(is_file($modelPath)){\r\n\t\t\tif (!class_exists($modelName)) {\r\n\t\t\t\trequire_once($modelPath);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\techo 'No existe este modelo '.$modelPath;\r\n\t\t\texit();\r\n\t\t}\r\n\t\t$model = new $modelName();\r\n\t\tif($negocio != 'null'){\r\n\t\t\t$model->negocio = $negocio;\r\n\t\t}\t\t\r\n\t\treturn $model;\r\n\t}\r\n}", "protected function load_model($model_name)\n {\n $this->$model_name = \\App::getInstance()->getTable($model_name);\n }", "private function _loadExistingController(){\n\t\t$file = $this->_controllerPath . $this->_url[0] . '.php';\n\t\tif (file_exists($file)) {\n\t\t\trequire $file;\n\t\t\t$this->_controller = new $this->_url[0];\n\t\t $this->_controller->loadModel($this->_url[0], $this->_modelPath);\n\t\t} else {\n\t\t\t$this->_error();\n\t\t\treturn false;\n\t\t}\t\t\n\t}", "function loadmodule()\r\n\t{\r\n $this->loginHelper = $this->loadModel('loginHelper');\r\n \r\n $this->userHelper = $this->loadModel('userHelper');\r\n\t}", "public function loadModel($name, $id) {\n\t\t$model = $name::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(){\n $this->load->model('Data_Model');\n return new Data_Model($this->used_table,$this->used_db);\n }", "public function loadModel(){\n\t\t$className = get_class($this);\n\t\tforeach(func_get_args() as $model){\n\t\t\t$entity = EntityManager::getEntityInstance($model);\n\t\t\tself::$_settingLock[$className] = true;\n\t\t\t$this->$model = $entity;\n\t\t\tself::$_settingLock[$className] = false;\n\t\t}\n\t}", "private function _loadExistingController()\r\n {\r\n $file = $this->_controller_path . $this->_url[0] . '.php';\r\n if (file_exists($file)) {\r\n require_once $file;\r\n $this->_controller = new $this->_url[0];\r\n $this->_controller->loadModel($this->_url[0],$this->_model_path);\r\n } else {\r\n $this->_error();\r\n return FALSE;\r\n //throw new Exception(\"The file $file does not exist\"); \r\n }\r\n }", "public function loadModel ($name) { \n $modelName = $name . 'Model';\n if (class_exists($modelName, FALSE)) {\n return new $modelName($this->db);\n } else {\n $path = MODEL_PATH . strtolower($name) . '_model.php';\n // Check for model: Does such a model exist?\n if (file_exists($path)) {\n require MODEL_PATH . strtolower($name) . '_model.php'; \n // Return new model and pass the database connection to the model\n return new $modelName($this->db);\n } else {\n return null;\n }\n }\n }", "public function model($nome){\r\n\r\n\t\t\t#procura arquivo do model\r\n\t\t\tif(file_exists(\"model/{$nome}.php\")){\r\n\t\t\t\tinclude_once \"model/{$nome}.php\";\r\n\t\t\t} else {\r\n\t\t\t\tdie(\"Model {$nome} não encontrado na pasta modelos\");\r\n\t\t\t}\r\n\r\n\t\t\t#instancia o arquivo caso encontrado\r\n\t\t\t$this->$nome = new $nome();\r\n\t\t}", "function model($model, $name = '', $db_conn = FALSE)\n\t{\n\t // We need to override this method from the default loader because we want to be able to support the\n\t // instantiation of multiple controllers and subsequent model loading between multiple controllers for\n\t // proper amf batching support. Because CodeIgniter uses a superclass paradigm for the base controller class,\n\t // we need to check if a model class has been loaded in any instance of a controller class.\n\t // Look at the code for CI_Base and Loader for more details.\n\n\t if (is_array($model))\n\t\t{\n\t\t\tforeach($model as $babe)\n\t\t\t{\n\t\t\t\t$this->model($babe);\t\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif ($model == '')\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\n\t\t// Is the model in a sub-folder? If so, parse out the filename and path.\n\t\tif (strpos($model, '/') === FALSE)\n\t\t{\n\t\t\t$path = '';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$x = explode('/', $model);\n\t\t\t$model = end($x);\t\t\t\n\t\t\tunset($x[count($x)-1]);\n\t\t\t$path = implode('/', $x).'/';\n\t\t}\n\t\n\t\tif ($name == '')\n\t\t{\n\t\t\t$name = $model;\n\t\t}\n\t\t\n\t\tif (in_array($name, $this->_ci_models, TRUE))\n\t\t{\n\t\t $CI =& get_instance();\n//\t\t log_message('error', \"MODEL ALREADY LOADED: \" . $name . \" class = \" . get_class($CI));\n\t\t if (! isset($CI->$name)) {\n//\t\t log_message('error', \"SETTING MODEL INSTANCE TO CONTROLLER: \" . $name . \" class = \" . get_class($CI));\n\t\t $CI->$name = & $this->_ci_model_instances[$name];\n\t\t }\n\t\t return;\n\t\t}\n\t\t\n\t\t$CI =& get_instance();\n\t\tif (isset($CI->$name))\n\t\t{\n\t\t\tshow_error('The model name you are loading is the name of a resource that is already being used: '.$name);\n\t\t}\n\t\n\t\t$model = strtolower($model);\n\n $model_exists = false;\n\n foreach($this->_all_model_paths as $mod_path)\n {\n if (file_exists($mod_path . 'models/'.$path.$model.EXT))\n {\n $model_exists = true;\n break;\n }\n }\n\n if ( ! $model_exists)\n\t\t{\n\t\t\tshow_error('Unable to locate the model you have specified: '.$model);\n\t\t}\n\n\t\tif ($db_conn !== FALSE AND ! class_exists('CI_DB'))\n\t\t{\n\t\t\tif ($db_conn === TRUE)\n\t\t\t\t$db_conn = '';\n\t\t\n\t\t\t$CI->load->database($db_conn, FALSE, TRUE);\n\t\t}\n\n if (CI_VERSION === '2.1.0' || CI_VERSION === '2.1.1') {\n if ( ! class_exists('CI_Model'))\n {\n load_class('Model', 'core');\n }\n } else {\n if ( ! class_exists('Model'))\n {\n load_class('Model', FALSE);\n }\n }\n\n $found = FALSE;\n foreach($this->_all_model_paths as $mod_path)\n {\n $file = $mod_path.'models/'.$path.$model.EXT;\n if (file_exists($file))\n {\n $found = TRUE;\n include_once($file);\n break;\n }\n }\n\n if($found === FALSE)\n {\n show_error('Unable to load the requested file: models/'.$model.EXT);\n }\n\n\t\t$model = ucfirst($model);\n\t\t\t\t\n//\t log_message('info', \"LOADING MODEL: \" . $name . \" class = \" . get_class($CI));\n\t\t$CI->$name = new $model();\n $CI->$name->_assign_libraries();\n\n\t\t$all_ci = get_all_loaded_instances();\n\t\tforeach ($all_ci as $old_ci) {\n\t\t if (! isset($old_ci->$name)) {\n//\t\t log_message('error', \"BACKLOADING MODEL INSTANCE TO CONTROLLER: \" . $name . \" class = \" . get_class($old_ci));\n\t\t $old_ci->$name = & $CI->$name;\n\t\t }\n\t\t}\n\n\t\t$this->_ci_model_instances[$name] = & $CI->$name;\n\n\t\t$this->_ci_models[] = $name;\t\n\t}", "private function modelLoader( $className ) {\r\n\t\t// $className = trim( str_replace(\"_\", \"/\", $className), \"/\" );\r\n\t\t@include_once CORE_MODEL . $className .'.php';\r\n\t\t\r\n\t}", "public function loadModel() : void\n {\n $model = $this->newModel();\n\n $model->loadModel($this->modelPath);\n $model->printModel();\n\n $this->fm = FunctionMap::loadFunctionMap();\n }", "function loadController ($moduleName, $controllerName, $actionName, $view = NULL) {\r\n $uppercaseModuleName = ucwords($moduleName);\r\n $controllerName = ucwords($controllerName) . \"Controller\";\r\n $actionName = lcfirst($actionName . 'Action');\r\n $cPath = BASE_PATH . '/Modules/' . $moduleName . '/Controllers/' . $controllerName . \".php\";\r\n if (is_file($cPath) === TRUE) {\r\n /**\r\n * load custom module: i.e block module\r\n */\r\n require_once BASE_PATH . '/Modules/' . $moduleName . '/' . $uppercaseModuleName . \"Controller.php\";\r\n require_once $cPath;\r\n $arguments = array_reverse(func_get_args());\r\n $leng = count(func_get_args()) - 4;\r\n $controllerName = $uppercaseModuleName . '_' . $controllerName;\r\n $controller = new $controllerName();\r\n if ($view instanceof View) {\r\n $class_vars2 = get_object_vars($controller->view); // get new view\r\n $class_vars1 = get_object_vars($view); // get old view\r\n $controller->view = clone $view;\r\n foreach ($class_vars2 as $name => $value) {\r\n $controller->view->$name = $value; // merge new view to old view\r\n }\r\n }\r\n if ($leng > 0) {\r\n foreach ($arguments as $k => $item) {\r\n if ($k < $leng && isset($item) === TRUE) {\r\n $arg = array();\r\n foreach ($item as $ar) {\r\n $arg[] = $ar;\r\n }\r\n call_user_func_array(array($controller, $actionName), array_reverse($arg));\r\n break;\r\n }\r\n }\r\n } else {\r\n $controller->$actionName();\r\n }\r\n } else {\r\n Inc_Utility::throwError('404', $cPath . ' not availlable');\r\n }\r\n}" ]
[ "0.7934687", "0.7782699", "0.7741777", "0.6975137", "0.6923596", "0.6880434", "0.68387866", "0.68174314", "0.6717329", "0.6551923", "0.6425403", "0.63943905", "0.63550526", "0.6327506", "0.6289112", "0.6261731", "0.6251583", "0.6205615", "0.6176086", "0.6131433", "0.6118449", "0.6079966", "0.60701096", "0.6048493", "0.6032429", "0.60089093", "0.6008898", "0.5995989", "0.5989425", "0.5982134" ]
0.8280711
0
Returns loaded Model object represented by $modName and $ctrlName
public function model($modName = null, $ctrlName = '') { if (!$modName) $modName = $this->ctrlName; if (!$ctrlName) $ctrlName = $this->ctrlName; if (isset($this->models[$modName])) return $this->models[$modName]; $this->loadModel($modName, $ctrlName); return $this->model($modName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function model($modName = '', $ctrlName = '')\n {\n return parent::model($modName, $ctrlName);\n }", "public function loadModel($modName, $ctrlName = '')\n\t{\n\t\tif (!class_exists($modName.'Model')) {\n\t\t\tif (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\t\t$filename = $this->app->getModelClassFileName($modName, $ctrlName);\n\t\n\t\t\tif (!file_exists($filename)) zf::halt(\"No such model found \\\"$modName\\\"! at $filename\");\n\t\n\t\t\trequire_once $filename;\n\t\t}\n\t\t$class = ucfirst($modName).'Model'; \n\t\t$mod = new $class($ctrlName, $modName, $this);\n\t\t$this->models[$modName] = $mod;\n\t}", "public function loadModelByPath($modName, $path, $ctrlName = '')\n\t{\n\t\trequire_once $path;\n\t\t$class = ucfirst($modName).'Model'; \n\t\t$mod = new $class($ctrlName ? $ctrlName : $this->ctrlName, $modName, $this, null, dirname($path));\n\t\t$this->models[$modName] = $mod;\n\t\treturn $mod;\n\t}", "function getModelObject(){\n\t\t\n\t\tif ( !isset($this->modObj) ){\n\t\t\t//$this->modObj = new Menu_PDO_Model();\n\t\t\t$this->modObj = new DoctrineMenu();\t\n\t\t}\n\t\t\n\t\treturn $this->modObj;\n\t}", "function getModel($name);", "public function get_model() {\r\n\t\t$model = null;\r\n\t\t\r\n\t\t//Includes the shared model, if exists.\r\n\t\t$path_shared = 'models/shared.php';\r\n\t\tif (file_exists($path_shared)) include($path_shared);\r\n\t\t\r\n\t\t//Checks if the models' file for the current controller exists.\r\n\t\t$path_current_model = 'models/'.$this->controller.'.php';\r\n\t\t\r\n\t\tif (file_exists($path_current_model)) {\r\n\t\t\t//If the file exists, checks if the class for the current action exists.\r\n\t\t\tinclude($path_current_model);\r\n\t\t\t$class_name = ucwords($this->controller).ucwords($this->action).\"Model\";\r\n\t\t\t\r\n\t\t\tif (class_exists($class_name)) {\r\n\t\t\t\t//Creates the class and populates its properties.\r\n\t\t\t\t$model = new $class_name();\r\n\t\t\t\t\r\n\t\t\t\t//Iterates through all request values and check for properties with the same name.\r\n\t\t\t\tforeach ($_REQUEST as $key => $value) {\r\n\t\t\t\t\tif (property_exists($model, $key)) {\r\n\t\t\t\t\t\t$model->$key = $value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\t\t\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\treturn $model;\r\n\t}", "abstract public function getModel($name);", "function getModelObject(){\n\t\t\n\t\tif ( !isset($this->modObj) ){\n\t\t\t$this->modObj = new DoctrineModel();\n\t\t}\t\n\t\treturn $this->modObj;\n\t}", "public function LoadModel($model = \"\"){\n\t\t$model = $model != \"\" ? $model : CONTROLLER_CALLED;\t\t// Si $model esta vacia significa que se esta llamando al modelo que se llama igual al controlador actual\n\t\t$nameModel = $model.\"Model\";\n\t\t$routeModelModule = MODULE_USED.\"models/\".$model.\".php\";\n\t\tif(is_file($routeModelModule)){\n\t\t\t// Vista del Modulo actual\n\t\t\t$routeModel = $routeModelModule;\n\t\t}else{\n\t\t\tif(strpos($model,\"/\") !== false){\t\t\t// Con slashes ignificaria que se esta llamando el modelo de otro modulo\n\t\t\t\t$modelInfo = explode(\"/\",$model);\n\t\t\t\t$module = $modelInfo[0];\n\t\t\t\t$model2 = $modelInfo[1];\n\t\t\t\t$nameModel = $model2.\"Model\";\n\t\t\t\t\n\t\t\t\t$routeModelApp = APP_PATH.\"modules/\".$module.\"/models/\".$model2.\".php\";\n\t\t\t\tif(is_file($routeModelApp)){\n\t\t\t\t\t$routeModel = $routeModelApp;\n\t\t\t\t}else{\n\t\t\t\t\tthrow new \\Exception(\"The model \".$model.\" is not found in the application\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tthrow new \\Exception(\"The model \".$model.\" is not found in the module application\");\n\t\t\t}\n\t\t}\n\t\tinclude($routeModel);\n\t\t$objModel = new $nameModel;\n\t\treturn $objModel;\n\t}", "function loadModel($name){\n\t\t$dir = APP . \"Entity\" . DS;\n\n\t\t$file = str_replace([$dir,\".php\"], [\"\",\"\"], $name);\n\n\t\tif(!isset($this->$file)){\n\t\t\trequire_once $name;\n\t\t\t$this->$file = new $file();\n\t\t\tif(isset($this->Form)){\n\t\t\t\t$this->$file->Form = $this->Form; \n\t\t\t}\n\t\t}\n\n\n\t}", "private function loadModel() {\n // name as requested resource.\n $name = $this->name.'Model';\n $path = str_replace(kPlaceholder, $this->version, kModelsFolder);\n $path = $path . $name . \".php\";\n // If it does not exist, go with\n // the default Model class.\n if (!file_exists($path)) {\n return new Model();\n } else {\n if (!class_exists($name)) {\n include $path;\n }\n\n return new $name();\n }\n }", "public function loadModel()\n {\n if ($this->_modelName == null) {\n $this->_modelName = $this->_controllerName . '_Model';\n $this->load->model($this->_modelName);\n }\n }", "public function getModel() {\r\n\tforeach (glob('modules/' . $this->name . '/model/*.php') as $filename) {\r\n\t $model = basename($filename, '.php');\r\n\t $this->model[$model] = $this->getEntity($model);\r\n\t}\r\n\treturn $this->model;\r\n }", "public function getCounterpartModel(){\n\n\t\t$controllerName = get_class( $this );\n\n\t\t//check if OC controller\n\t\tif( strpos( $controllerName, 'Controller' ) === 0 ) {\n\t\t\t$modelName = Advertikon::underscore( substr( $controllerName , strlen( 'Controller' ) ) );\n\t\t\t$realName = 'Model' . substr( $controllerName , strlen( 'Controller' ) );\n\t\t\t$parts = explode( '_' , $modelName , 2 );\n\t\t\t$modelPath= implode( '/' , $parts );\n\t\t\t$this->load->model( $modelPath );\n\t\t\t$loadedModel = 'model_' . $modelName;\n\t\t\treturn new $realName( $this->registry );\n\t\t}\n\t}", "function loadModel ($name){\n $file = ROOT.DS.'models'.DS.$name.'.php';\n require_once($file);\n\n if(!isset($this->name)){\n $this->$name = new $name();\n }\n }", "public function getModel(){\n\t\tif( isset($this->model) ){\n\t\t\treturn $this->model;\n\t\t}\n\t\t$nameModel = str_replace(' View' , 'Model' ,__CLASS__ );\n\t\t$this->model = new $nameModel();\n\t}", "protected function getModel($name) {\n\t\treturn $this->getContext()->getModel($name);\n\t}", "protected function loadModel($modelName , $key = null)\n {\n\n if (!$key)\n $key = $modelName;\n\n $modelName = 'Model'.$modelName;\n if (!isset($this->models[$key] )) {\n if (BuizCore::classExists($modelName)) {\n $this->models[$key] = new $modelName();\n } else {\n throw new Controller_Exception('Internal Error','Failed to load Submodul: '.$modelName);\n }\n }\n\n return $this->models[$key];\n\n }", "protected function _getTmsModModel()\n\t{\n\t\treturn $this->getModelFromCache('TMS_Model_Modification');\n\t}", "public function loadModel ($name) { \n $modelName = $name . 'Model';\n if (class_exists($modelName, FALSE)) {\n return new $modelName($this->db);\n } else {\n $path = MODEL_PATH . strtolower($name) . '_model.php';\n // Check for model: Does such a model exist?\n if (file_exists($path)) {\n require MODEL_PATH . strtolower($name) . '_model.php'; \n // Return new model and pass the database connection to the model\n return new $modelName($this->db);\n } else {\n return null;\n }\n }\n }", "public static function loadModel($id, $modo = 'iduser')\n {\n return self::model()->findByAttributes(array($modo => $id));\n }", "protected function modelExists($modName, $ctrlName = '')\n\t{\n\t\tif (!$ctrlName) $ctrlName = $this->ctrlName;\n\t\treturn file_exists($this->zf->app->app_path.$this->zf->app->conf['models_dir'].'/'.$ctrlName.'/'.$modName.'.mod.inc');\n\t}", "protected function loadModel($name)\n {\n $modelClass = get_class($this->owner);\n if (!isset(self::$_models[$modelClass])) {\n $criteria = new CDbCriteria;\n $criteria->addCondition('locale=:locale');\n $criteria->addCondition('modelClass=:modelClass');\n $criteria->addCondition('attribute=:attribute');\n $criteria->index = 'modelId';\n $criteria->params = array(\n ':locale' => Yii::app()->language,\n ':modelClass' => $modelClass,\n ':attribute' => $name,\n );\n self::$_models[$modelClass] = I18nAttribute::model()->findAll($criteria);\n }\n $modelId = $this->resolveModelId();\n return isset(self::$_models[$modelClass][$modelId]) ? self::$_models[$modelClass][$modelId] : null;\n }", "public function Model($model){\r\n $fullpath=cf(\"BASE/MVCPATH\").\"models\".DS.ucwords($model).EXT;\r\n if($this->Load($fullpath)){\r\n return new $model();\r\n }\r\n else {\r\n return null;\r\n } \r\n }", "public function loadModel($name, $id) {\n\t\t$model = $name::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($name) {\n echo \"new view was called\";\n $path = MODELS_PATH . DS . $name . '_model.php';\n\n if (file_exists($path)) {\n require MODELS_PATH . DS . $name . '_model.php';\n $modelName = $name . '_Model';\n $this->model = new $modelName();\n }\n }", "public function getModel($model = null);", "function loadModel($modelName,$negocio){\r\n\tif($modelName=='database'){\r\n\t\t$modelPath = '../Config/'.$negocio.'_'.$modelName.'.php';\r\n\t\tif(is_file($modelPath)){\r\n\t\t\tif (!class_exists($modelName)) {\r\n\t\t\t\trequire_once($modelPath);\r\n\t\t\t}\t\t\r\n\t\t}else{\r\n\t\t\techo 'No existe la conexion'.$modelPath;\r\n\t\t\texit();\r\n\t\t}\r\n\t\t$model = new $modelName();\r\n\t\treturn $model;\t\r\n\t}else{\r\n\t\t$modelPath = '../Model/'.$modelName.'.php';\r\n\t\tif(is_file($modelPath)){\r\n\t\t\tif (!class_exists($modelName)) {\r\n\t\t\t\trequire_once($modelPath);\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\techo 'No existe este modelo '.$modelPath;\r\n\t\t\texit();\r\n\t\t}\r\n\t\t$model = new $modelName();\r\n\t\tif($negocio != 'null'){\r\n\t\t\t$model->negocio = $negocio;\r\n\t\t}\t\t\r\n\t\treturn $model;\r\n\t}\r\n}", "public function load_model( $model_name = false ) {\n\t\tif ( ! $model_name ) return;\n\n\t\t$model_name = strtolower( $model_name );\n\t\t$model_path = ABSPATH . '/models/' . $model_name . '.php';\n\n\t\tif ( file_exists( $model_path ) ) {\n\t\t\trequire_once $model_path;\n\n\t\t\t// Pega só o nome final do caminho\n\t\t\t$model_name = explode('/', $model_name);\n\t\t\t$model_name = end( $model_name );\n\t\t\t$model_name = preg_replace( '/[^a-zA-Z0-9]/is', '', $model_name );\n\n\t\t\t// Retorna um objeto da classe\n\t\t\tif ( class_exists( $model_name ) ) {\n\t\t\t\treturn new $model_name( $this->db, $this );\n\t\t\t}\n\n\t\t\treturn;\n\t\t} // load_model\n\n\t}", "function loadModel($model){\n $url='models/'.$model.'model.php';//models/alumnomodel.php\n //validando que el modelo exista\n if(file_exists($url)){\n //si axiste lo llamamos\n require $url;\n $modelName=$model.'Model';\n //instancia de la clase del modelo recibido\n $this->model=new $modelName;\n }\n }" ]
[ "0.8005318", "0.7772888", "0.75677365", "0.6486984", "0.64635754", "0.6358232", "0.63388497", "0.63196945", "0.6294006", "0.62820995", "0.62815875", "0.6276671", "0.62104774", "0.6201406", "0.6194457", "0.61726457", "0.61702365", "0.61461574", "0.6140707", "0.6138701", "0.6118916", "0.61088127", "0.6095461", "0.602491", "0.5996582", "0.59837085", "0.595594", "0.5955333", "0.5952197", "0.59256095" ]
0.83249307
0
Returns form represented by $formName
protected function form($formName) { if (isset($this->forms[$formName])) return $this->forms[$formName]; zf::halt("No such form \"{$formName}\" loaded"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getForm($name)\n {\n return $this->getFormBuilder()->createBuilder($name);\n }", "public function getForm($formName)\n {\n if (!isset($this->form[$formName])) {\n $message = sprintf(\n 'Requested form \"%s\" not part of this build. Available forms: %s',\n $formName,\n implode(', ', array_keys((array) $this->form))\n );\n throw new \\BadMethodCallException($message);\n }\n\n return $this->form[$formName];\n }", "public function _getForm($formName,$opt=null)\n {\n if($this->_form === null)\n {\n if(class_exists($formName)) {\n $this->_form = new $formName($opt);\n } else {\n throw new \\Exception(__METHOD__.\" form '$formName' class not found\");\n }\n }\n return $this->_form;\n }", "public function getFormName(){\n return $this->form_name ?? 'form';\n }", "protected function getForm( $html=false ) { return $this->form_name; }", "abstract public function getForm($formId);", "public static function getForm();", "public function getForm()\n {\n if (!isset($this->form)) {\n try {\n $this->form = SimpleForms::$plugin->forms->getFormById($this->formId);\n } catch (\\Exception $e) {\n // Do nothing\n }\n }\n\n return $this->form;\n }", "public function getForm();", "public function getFormName()\n {\n return $this->getModelSimpleName() .'Form';\n }", "public function getName() {\n return 'form';\n }", "public function getFormName();", "public function getFormName();", "public function getForm()\n {\n RETURN $this->strategy->getForm();\n }", "public function getForm()\n {\n return $this->form;\n }", "public function getForm()\n {\n return $this->form;\n }", "public function getForm() {\n return $this->form;\n }", "public function getName()\n {\n return 'form';\n }", "abstract protected function getFormName();", "public function getForm() {\r\n if ($this->_form === null) {\r\n $this->_form = new $this->_formClass;\r\n }\r\n return $this->_form;\r\n }", "abstract function getForm();", "function getForm()\n {\n return $this->getAttribute(\"form\");\n }", "abstract protected function getForm();", "public static function getForm($nameForm, $data = array())\n {\n $result = \"\";\n require_once(getenv(\"DOCUMENT_ROOT\").SP.\"lib\".SP.\"components\".SP.\"Form.php\");\n $file = getenv(\"DOCUMENT_ROOT\").SP.'view'.SP.'form'.SP.$nameForm.'.php';\n if(file_exists($file))\n {\n extract($data);\n ob_start();\n require($file);\n $result = ob_get_contents();\n ob_end_clean();\n }\n return $result;\n }", "public function getForm()\n {\n return $this->_form;\n }", "public function retrieveForm($formId)\n {\n return $this->start()->uri(\"/api/form\")\n ->urlSegment($formId)\n ->get()\n ->go();\n }", "public function getForm() {\n\t\treturn isset($this->attributes['form'])?$this->attributes['form']:null;\n\t}", "function getForm() {\n return $this->form;\n }", "public function getForm(): Form{\n $name = str_replace('[]', '', $this->widget->get_field_name(''));\n $form = new Form($name);\n $form->setDelimiter('[');\n $form->setSuffix(']');\n ($this->formHandler)($form);\n return $form;\n }", "public function form(){\n\t\treturn $this->form;\n\t}" ]
[ "0.76612115", "0.73769957", "0.7250387", "0.7189241", "0.71573496", "0.7138883", "0.7075898", "0.7067946", "0.70426977", "0.7030337", "0.70275545", "0.7017357", "0.7017357", "0.69855624", "0.69801784", "0.69801784", "0.69255316", "0.6913544", "0.6912028", "0.69070464", "0.68772936", "0.6868351", "0.6838596", "0.68376565", "0.6826051", "0.68048626", "0.6773541", "0.67422056", "0.67402893", "0.6675291" ]
0.8119895
0
Not found action method for controller
protected function actionNotFound() { zf::halt("You can't call this function \"actionNotFound\" directly. You must redefine it in your controller."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function actionnotfound()\n {\n $this->render('notfound');\n }", "public function actionNotfound()\n {\n $this->actionSlug = 'notfound';\n $this->actionParams = [];\n $this->breadcrumbs=[];\n $this->beforeAction();\n $this->breadcrumbs[] = ['title' => 404];\n header(\"HTTP/1.x 404 Not Found\");\n header(\"Status: 404 Not Found\");\n echo $this->render('404');\n exit;\n }", "public function notfoundAction()\n {\n $this->render('error/notfound');\n }", "public function notFound()\n {\n Controller::getController('PageNotFoundController')->run();\n }", "public function routenotfoundAction()\n {\n return $this->createResponse('Route Not Found', 404);\n }", "public function NotFound() {\r\n\t\t$this->PrepareController();\r\n\t\t$this->View = 'notfound';\r\n\t\t$this->Render();\r\n }", "public function action_404()\n\t{\n\t\t//return Response::forge(ViewModel::forge('welcome/404'), 404);\n\t}", "public function actionIsNotAllowed()\n {\n throw new NotFoundException(__('Page not found.'));\n }", "public function notFound(){\n \n View::renderTemplate('pageNotFound.html');\n \n }", "public function error404Action() \n {\n return '404 Page not found';\n }", "public function notFound($action) {\r\n $this->router->notFound($action);\r\n }", "public function notFoundAction()\n {\n return $this->viewBuilder()->buildViewFromTemplate($this->detailsViewTemplate);\n }", "public function action_404()\n\t{\n\t\treturn Response::forge(ViewModel::forge('welcome/404'), 404);\n\t}", "public function notFound()\n {\n }", "public function notFound()\n {\n http_response_code(404);\n error_log('404 page not found: '.$this->getRequest());\n kodexy()->loadView('system/notFound');\n $this->completeRequest();\n }", "function actionNotFound($actionName = null, $arguments = null)\n {\n $this->response()->withStatus(Status::CODE_NOT_FOUND);\n }", "public function actionIndex()\n {\n return ['status' => '404','message' => 'Not Found'];\n }", "public function action_404()\n\t{\n\t\treturn Response::forge(Presenter::forge('welcome/404'), 404);\n\t}", "public function indexAction(){\n $this->view->render('404');\n\t}", "public function action_404()\r\n\t{\r\n\t\treturn Response::forge(Presenter::forge('welcome/404'), 404);\r\n\t}", "public function error404Action()\n\t{\n\t\t$method = '_notFound' . ENVIRONMENT;\n\n\t\t// Try to call the internal method for the environment\n\t\tif (method_exists($this, $method))\n\t\t{\n\t\t\treturn $this->$method();\n\t\t}\n\n\t\t// If the method for the current environment does not exist\n\t\t// We just output the 404 production view :)\n\t\t$this->setViewFileName('Error/404-production');\n\t}", "public function action_404()\r\n {\r\n return Response::forge(Presenter::forge('welcome/404'), 404);\r\n }", "public function test_getNotFound() {\n\t\t$this->testAction('/disease/index/1', array('method'=>'get'));\n\t}", "public function notFound()\n {\n $this->set('message', 'API endpoint \"' . $this->request->getUri()->getPath() . '\" does not exist.');\n $this->set('_serialize', ['message']);\n $this->_respondWithNotFound();\n }", "function notfound() {\n\t\t$this->fw->render('404');\n\t}", "public static function notFound(){\n\n throw new \\yii\\web\\HttpException(404, 'Not Found', 405);\n }", "public function cgetAction()\n {\n throw new NotFoundHttpException();\n }", "public function indexAction() {\n\t\t$this->_notImplemented();\n\t}", "protected function notFound()\n {\n $this->response = $this->response->withStatus(404);\n $this->jsonBody($this->payload->getInput());\n }", "private static function pageNotFound()\n {\n if (self::$notFound && is_callable(self::$notFound)) {\n call_user_func(self::$notFound);\n } else {\n header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');\n throw new ExceptionHandler(\"Hata\", \"Controller bulunamadı\");\n }\n }" ]
[ "0.8356943", "0.8273121", "0.8070214", "0.8017735", "0.7941634", "0.784426", "0.7821098", "0.7747471", "0.7669802", "0.7664562", "0.7656013", "0.7636298", "0.7623391", "0.75673753", "0.75317514", "0.75268656", "0.7502693", "0.7497364", "0.74813926", "0.7467583", "0.74636656", "0.7458328", "0.7433461", "0.7392052", "0.7380008", "0.73424727", "0.7313854", "0.7211462", "0.7207951", "0.719878" ]
0.83453125
1
Many to many relationship with genre model.
public function genres() { return $this->belongsToMany('App\Genre', 'genre_artist'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function genres()\n {\n return $this->belongsToMany('App\\Genre');\n }", "public function genres()\n {\n return $this->belongsToMany(Genre::class, 'genre__movies', 'movie_id', 'id');\n }", "public function genres()\n {\n return $this->belongsToMany('App\\Models\\Genre','post_genres',\n 'post_id','genre_id');\n }", "public function genres()\n {\n return $this->belongsToMany('App/Genre', 'eventmanager_genre', 'genres_id', 'genres_id');\n }", "public function genres()\n {\n return $this->belongsToMany('App/Genre', 'bookingagency_genre', 'genres_id', 'genres_id');\n }", "public function genres() {\n return $this->belongsToMany('Rockit\\Models\\Genre', 'event_genre')->withTrashed();\n }", "public function genre(){\n return $this->belongsTo('App\\Models\\Genre');\n }", "public function movies()\n {\n return $this->belongsToMany(Movie::class, 'movie_genre')->withTimestamps();\n }", "public function genre()\n \t{\n \t\treturn\t$this->belongsTo('App\\Genre');\n \t}", "public function books()\n {\n return $this->morphedByMany('App\\Book', 'source_genre');\n }", "public function movies()\n {\n return $this->morphedByMany('App\\Movie', 'source_genre');\n }", "public function genre()\n {\n \t//parametros:\n \t//1: nombre completamente calificado del modelo con el cual me relaciono - OBLIGATORIO\n \t//2: nombre del foreing key id_genero genre_id\n \t//3: nombre del local key\n \treturn $this->belongsTo('App\\Genre');\n }", "public function movies()\n {\n return $this->belongsToMany('App\\Core\\Movies\\Movie');\n }", "public function music_genre(){\n return $this->belongsTo('App\\MusicGenre');\n }", "public function moviesDirected(){\n return $this->belongsToMany('App\\Movie', 'director_movie', 'id_director', 'id_movie'); \n }", "public function games(){\n\t\treturn $this->belongsToMany('App\\Game','favorite_games');\n\t}", "public function movies()\n {\n return $this->hasMany('App\\Movie');\n }", "public function leagues() {\n\t\treturn $this->belongsToMany('League', 'league_movies');\n\t}", "public function artists() {\n return $this->belongsToMany('Rockit\\Models\\Artist', 'descriptions', 'genre_id', 'artist_id')->withTrashed();\n }", "public function books(): \\Illuminate\\Database\\Eloquent\\Relations\\HasMany\n {\n return $this->hasMany(Book::class);\n }", "public function products(): MorphToMany;", "public function books()\n {\n\t \t return $this->belongsToMany(Book::class);\n }", "public function getGenreMusic()\n {\n return $this->hasOne(Genre::className(), ['id_genre' => 'genre_music']);\n }", "public function roles(): MorphToMany;", "public function songs(){\n return $this->belongsToMany(Song::class);\n }", "public function setGenre($genre)\n {\n $this->genres[] = $genre;\n }", "public function moviesActed(){\n return $this->belongsToMany('App\\Movie', 'actor_movie', 'id_actor', 'id_movie'); \n }", "public function muscles()\n {\n return $this->belongsToMany(Muscle::class);\n }", "function getGenres(){\n $genres = $this->all('schema:genre');\n return $genres;\n }", "public function guitars()\n {\n return $this->belongsToMany('App\\Guitar', 'user_guitar');\n }" ]
[ "0.82063353", "0.78325015", "0.77752", "0.7754915", "0.7650356", "0.7539934", "0.71598816", "0.71355844", "0.6953636", "0.6885664", "0.6842402", "0.66718584", "0.657852", "0.6541937", "0.6354747", "0.62195873", "0.62049276", "0.6166439", "0.61296797", "0.61159146", "0.6080682", "0.60625577", "0.60562104", "0.60445756", "0.60289663", "0.6013434", "0.6002715", "0.5969257", "0.5919884", "0.5903423" ]
0.79764205
1
Replaces all valid imports with the result of the $contentReplaceFunction. The function receives the cleaned path as argument (without the quotes and the function must not add quotes).
public function replaceValidImports (string $fileContent, callable $contentReplaceFunction) : string { return \preg_replace_callback( '~url\\(\\s*(?<path>.*?)\\s*\\)~i', function (array $matches) use ($contentReplaceFunction) { return $this->ensureValidImportAndReplace($matches, $contentReplaceFunction); }, $fileContent ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function ensureValidImportAndReplace (array $matches, callable $contentReplaceFunction) : string\n {\n $path = $matches[\"path\"];\n $openingQuote = \\substr($matches[\"path\"], 0, 1);\n $closingQuote = \\substr($matches[\"path\"], -1);\n $usedQuotes = \"\";\n\n // check if quoted and whether valid quoted\n if (\"'\" === $openingQuote || '\"' === $openingQuote)\n {\n if ($openingQuote !== $closingQuote)\n {\n // looks like invalid CSS, as there is a leading quote, but no closing one, so bail\n return $matches[0];\n }\n\n // strip quotes from path\n $path = \\substr($path, 1, -1);\n $usedQuotes = $openingQuote;\n }\n\n $path = $contentReplaceFunction($path);\n return \"url({$usedQuotes}{$path}{$usedQuotes})\";\n }", "private static function replaceImports($content)\n {\n $content = preg_replace(self::FORMAT['style'], '<link rel=\"stylesheet\" type=\"text/css\" href=$4/>', $content);\n $content = preg_replace(self::FORMAT['script'], '<script type=\"text/javascript\" src=$4></script>', $content);\n $content = preg_replace(self::FORMAT['icon'], '<link rel=\"icon\" href=$4>', $content);\n\n return $content;\n }", "protected function getImportsReplace()\n {\n\n // build up import lines\n $importLines = [\n config('pxlcms.generator.repositories.extend_class')\n ];\n\n // model classname\n $importLines[] = $this->context->makeFqnForModelName( studly_case($this->data->name) );;\n\n\n\n // set them in the right order\n if (config('pxlcms.generator.aesthetics.sort_imports_by_string_length')) {\n\n // sort from shortest to longest\n usort($importLines, function ($a, $b) {\n return strlen($a) - strlen($b);\n });\n\n } else {\n sort($importLines);\n }\n\n\n // build the actual replacement string\n $replace = \"\\n\";\n\n foreach ($importLines as $line) {\n $replace .= \"use \" . $line . \";\\n\";\n }\n\n $replace .= \"\\n\";\n\n return $replace;\n }", "private static function replaceFunctions($content)\n {\n foreach (self::FUNCTIONS as $original => $replacement) {\n $original = str_replace('(.*)', $original, self::FORMAT['function']);\n $content = preg_replace($original, $replacement, $content);\n }\n\n return $content;\n }", "public function contentStrReplace() {}", "private static function replaceAll(string $content)\n {\n $content = self::replaceCsrf($content);\n $content = self::replaceExtend($content);\n $content = self::replaceIncludes($content);\n $content = self::replaceImports($content);\n $content = self::replaceComments($content);\n $content = self::replaceFunctions($content);\n $content = self::replaceCycles($content);\n $content = self::replaceTags($content);\n $content = self::replaceCustom($content);\n $content = self::replaceRaws($content);\n\n return $content;\n }", "private static function replaceIncludes($content)\n {\n preg_match_all(self::FORMAT['include'], $content, $matches, PREG_OFFSET_CAPTURE);\n\n foreach ($matches[1] as $key => $val) {\n $filename = Str::sanitizePath(trim($val[0], '\"\\''));\n $content = str_replace($matches[0][$key][0], self::getContent($filename), $content);\n }\n\n return $content;\n }", "function tsapress_clean_uploads($content) {\n\t$tsapress_base_dir = tsapress_base_dir();\n $theme_name = next(explode('/themes/', $content)); \n \n \t$current_path = '/' . $tsapress_base_dir. tsapress_current_uploads_path();\n $new_path = '/' . tsapress_uploads_folder();\n $content = str_replace($current_path, $new_path, $content);\n \n return $content;\n}", "function content_processing($contents, $replacements)\n{\n $contents = str_replace($replacements['simple_delete'], '', $contents);\n $contents = preg_replace($replacements['preg_delete'], '', $contents);\n return $contents;\n}", "function tsapress_clean_assets($content) {\n\t$tsapress_base_dir = tsapress_base_dir();\n $theme_name = next(explode('/themes/', $content));\n \n $current_path = '/'.$tsapress_base_dir.'wp-content/themes/' . $theme_name;\n $new_path = '';\n $content = str_replace($current_path, $new_path, $content);\n \n return $content;\n}", "public function replace($path);", "private function performFindAndReplaceInFile(\n string $path\n ): void {\n $this->findAndReplaceHelper->findReplace(\n 'use ' . RelationsGenerator::FIND_ENTITIES_NAMESPACE . '\\\\' . RelationsGenerator::FIND_ENTITY_NAME,\n \"use {$this->entityFqn}\",\n $path\n );\n $this->findAndReplaceHelper->findReplace(\n 'use ' .\n RelationsGenerator::FIND_ENTITY_INTERFACE_NAMESPACE .\n '\\\\' .\n RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,\n \"use {$this->entityInterfaceFqn}\",\n $path\n );\n $this->findAndReplaceHelper->findReplaceRegex(\n '%use(.+?)Relations\\\\\\TemplateEntity(.+?);%',\n 'use ${1}Relations\\\\' . $this->singularNamespace . '${2};',\n $path\n );\n $this->findAndReplaceHelper->findReplaceRegex(\n '%use(.+?)Relations\\\\\\TemplateEntity(.+?);%',\n 'use ${1}Relations\\\\' . $this->pluralNamespace . '${2};',\n $path\n );\n $this->findAndReplaceHelper->findReplaceRegex(\n '%(Has|Reciprocates)(Required|)TemplateEntity%',\n '${1}${2}' . $this->singularNamespacedName,\n $path\n );\n $this->findAndReplaceHelper->findReplaceRegex(\n '%(Has|Reciprocates)(Required|)TemplateEntities%',\n '${1}${2}' . $this->pluralNamespacedName,\n $path\n );\n $this->findAndReplaceHelper->findReplace(\n RelationsGenerator::FIND_ENTITY_INTERFACE_NAME,\n $this->namespaceHelper->basename($this->entityInterfaceFqn),\n $path\n );\n $this->findAndReplaceHelper->replaceName($this->singularNamespacedName, $path);\n $this->findAndReplaceHelper->replacePluralName($this->pluralNamespacedName, $path);\n $this->findAndReplaceHelper->replaceProjectNamespace($this->projectRootNamespace, $path);\n }", "function replaceExport($content,$className,$actionName,$fileName,$blockName,$functionName)\n {\n $search = array(\n '/<ClassName>/',\n '/<ActionName>/',\n '/<FileName>/',\n '/<BlockName>/',\n '/<FunctionName>/',\n );\n\n $replace = array(\n $className,\n $actionName,\n $fileName,\n $blockName,\n $functionName,\n );\n //\n return preg_replace($search, $replace, $content);\n }", "private function removeRequiringConstructs($content)\n\t{\n\t\treturn preg_replace('/(require|include)(|_once)[^;]+;/', '', $content);\n\t}", "public function replaceFileAccessContent()\n {\n $fileName = '.access.php';\n\n if (strlen($this->path) >= strlen($fileName) && substr($this->path, -strlen($fileName)) == $fileName)\n {\n $this->fileContent = preg_replace_callback('/(PERM\\[.+\\]\\[)(\\\"G?[0-9]+\\\")(\\])/', function ($matches)\n {\n $matches[2] = trim($matches[2], \"\\\"\");\n $groupId = str_replace('G', '', $matches[2], $addG);\n $groupCode = GroupTools::findById($groupId)->code();\n\n return $matches[1] . ($addG ? \"'G'.\" : '') . \"\\Bex\\Tools\\Group\\GroupTools::find('{$groupCode}')->id()\" . $matches[3];\n }, $this->fileContent);\n }\n\n return $this->fileContent;\n }", "private static function replaceCustom(string $content)\n {\n foreach (self::$templates as $template) {\n $content = $template($content);\n }\n\n return $content;\n }", "function _makeAbsolutPathOfContent($content, $sourcePath, $parentPath)\n\t{\n\t\t$sourcePath = substr($sourcePath, strlen($_SERVER['DOCUMENT_ROOT']));\n\t\tif (substr($sourcePath, 0, 1) != \"/\") {\n\t\t\t$sourcePath = \"/\" . $sourcePath;\n\t\t}\n\t\t\n\t\t// replace hrefs\n\t\tpreg_match_all(\n\t\t\t\t'/(<[^>]+href=[\"\\']?)([^\"\\' >]+)([^\"\\'>]?[^>]*>)/i', \n\t\t\t\t$content, \n\t\t\t\t$regs, \n\t\t\t\tPREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$orig_href = $regs[2][$i];\n\t\t\t\t$new_href = weSiteImport::_makeAbsolutePath($orig_href, $sourcePath, $parentPath);\n\t\t\t\tif ($new_href != $orig_href) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $new_href . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// replace src (same as href!!)\n\t\tpreg_match_all(\n\t\t\t\t'/(<[^>]+src=[\"\\']?)([^\"\\' >]+)([^\"\\'>]?[^>]*>)/i', \n\t\t\t\t$content, \n\t\t\t\t$regs, \n\t\t\t\tPREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$orig_href = $regs[2][$i];\n\t\t\t\t$new_href = weSiteImport::_makeAbsolutePath($orig_href, $sourcePath, $parentPath);\n\t\t\t\tif ($new_href != $orig_href) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $new_href . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// url() in styles with style=\"\"\n\t\tpreg_match_all('/(<[^>]+style=\")([^\"]+)(\"[^>]*>)/i', $content, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$style = $regs[2][$i];\n\t\t\t\t$newStyle = $style;\n\t\t\t\tpreg_match_all('/(url\\(\\'?)([^\\'\\)]+)(\\'?\\))/i', $style, $regs2, PREG_PATTERN_ORDER);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\tfor ($z = 0; $z < count($regs2[2]); $z++) {\n\t\t\t\t\t\t$orig_url = $regs2[2][$z];\n\t\t\t\t\t\t$new_url = weSiteImport::_makeAbsolutePath($orig_url, $sourcePath, $parentPath);\n\t\t\t\t\t\tif ($orig_url != $new_url) {\n\t\t\t\t\t\t\t$newStyle = str_replace($orig_url, $new_url, $newStyle);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($newStyle != $style) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $newStyle . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// url() in styles with style=''\n\t\tpreg_match_all('/(<[^>]+style=\\')([^\\']+)(\\'[^>]*>)/i', $content, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$style = $regs[2][$i];\n\t\t\t\t$newStyle = $style;\n\t\t\t\tpreg_match_all('/(url\\(\"?)([^\"\\)]+)(\"?\\))/i', $style, $regs2, PREG_PATTERN_ORDER);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\tfor ($z = 0; $z < count($regs2[2]); $z++) {\n\t\t\t\t\t\t$orig_url = $regs2[2][$z];\n\t\t\t\t\t\t$new_url = weSiteImport::_makeAbsolutePath($orig_url, $sourcePath, $parentPath);\n\t\t\t\t\t\tif ($orig_url != $new_url) {\n\t\t\t\t\t\t\t$newStyle = str_replace($orig_url, $new_url, $newStyle);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($newStyle != $style) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $newStyle . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// url() in <style> tags\n\t\tpreg_match_all('/(<style[^>]*>)(.*)(<\\/style>)/isU', $content, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$style = $regs[2][$i];\n\t\t\t\t$newStyle = $style;\n\t\t\t\t// url() in styles with style=''\n\t\t\t\tpreg_match_all(\n\t\t\t\t\t\t'/(url\\([\\'\"]?)([^\\'\"\\)]+)([\\'\"]?\\))/iU', \n\t\t\t\t\t\t$style, \n\t\t\t\t\t\t$regs2, \n\t\t\t\t\t\tPREG_PATTERN_ORDER);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\tfor ($z = 0; $z < count($regs2[2]); $z++) {\n\t\t\t\t\t\t$orig_url = $regs2[2][$z];\n\t\t\t\t\t\t$new_url = weSiteImport::_makeAbsolutePath($orig_url, $sourcePath, $parentPath);\n\t\t\t\t\t\tif ($orig_url != $new_url) {\n\t\t\t\t\t\t\t$newStyle = str_replace(\n\t\t\t\t\t\t\t\t\t$regs2[0][$z], \n\t\t\t\t\t\t\t\t\t$regs2[1][$z] . $new_url . $regs2[3][$z], \n\t\t\t\t\t\t\t\t\t$newStyle);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($newStyle != $style) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $newStyle . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $content;\n\t}", "private function imports( $file ) {\n\t\t// Set the content and the directory of the stylesheet\n\t\t$content = file_get_contents( $file );\n\t\t$cwd = preg_replace( $this->rchopfile, '/', $file );\n\n\t\t// Block import fixing if not set\n\t\tif ( $this->imports === false ) {\n\t\t\treturn $content;\n\t\t}\n\n\t\t$pos = 0;\n\t\twhile ( preg_match( $this->rmarker, $content, $match, PREG_OFFSET_CAPTURE, $pos ) ) {\n\t\t\t$marker = $match[ 1 ][ 0 ];\n\t\t\tif ( $marker == '/*' ) {\n\t\t\t\tif ( ( $pos = strpos( $content, '*/', $match[ 1 ][ 1 ] ) ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( $marker == '\"' ) {\n\t\t\t\tif ( preg_match( $this->rquote, $content, $m, PREG_OFFSET_CAPTURE, $match[ 1 ][ 1 ] + 1 ) ) {\n\t\t\t\t\t$pos = $m[ 0 ][ 1 ] + 2;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( $marker == \"'\" ) {\n\t\t\t\tif ( preg_match( $this->rsinglequote, $content, $m, PREG_OFFSET_CAPTURE, $match[ 1 ][ 1 ] + 1 ) ) {\n\t\t\t\t\t$pos = $m[ 0 ][ 1 ] + 2;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( $marker == '@import' ) {\n\t\t\t\tlist ( $content, $pos ) = $this->inject( $content, $cwd, $match[ 1 ][ 1 ] );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new CSSCompression_Exception( 'Unknown Import Error' );\n\t\t\t}\n\t\t}\n\n\t\treturn $content;\n\t}", "public function fixURLs($content) {\n return str_replace($this->url, $this->baseUrl, $content);\n }", "public function the_replacers($content) {\n \n // Get replacers\n $replacers = md_the_component_variable('content_replacer');\n\n // Get placeholders\n preg_match_all(\"/{[^}]*}/\", $content, $placeholders);\n\n // Verify if placeholders exists\n if ( $placeholders[0] ) {\n\n foreach ( $placeholders[0] as $placeholder ) {\n\n $found = explode(' ', str_replace(array('{', '}'), array('', ''), $placeholder));\n\n if ( $found[0] ) {\n\n if ( isset($replacers[$found[0]]) ) {\n\n $args = array(\n 'start' => 1,\n 'content' => $content\n );\n\n if ( count($found) > 1 ) {\n\n for( $f = 1; $f < count($found); $f++ ) {\n\n parse_str(str_replace('\"', \"\", $found[$f]), $a);\n\n $key = array_keys($a);\n \n if ( isset($a[$key[0]]) ) {\n\n $args[$key[0]] = $a[$key[0]];\n\n }\n\n }\n\n }\n\n $content = $replacers[$found[0]]($args);\n\n } else if ( isset($replacers[str_replace('|', '', $found[0])]) ) {\n\n $args = array(\n 'end' => 1,\n 'content' => $content\n );\n\n $content = $replacers[str_replace('|', '', $found[0])]($args);\n\n }\n\n }\n\n }\n\n }\n\n return $content;\n\n }", "protected function recursivelyReplaceIntPlaceholdersInContent() {}", "public function replace_relative_paths( $content = false ) {\n\t\n\t\tif( empty( $content ) || empty( $this->absolute_path ) )\n\t\t\treturn $content;\n\t\t\n\t\treturn preg_replace_callback( '#url\\( ?(\\'|\")?(?P<url>.*?)(\\'|\")? ?\\)#', array( $this, 'paths_callback' ), $content );\n\t\n\t}", "function _external_to_internal($content)\n\t{\n\t\t// replace hrefs\n\t\tpreg_match_all(\n\t\t\t\t'/(<[^>]+href=[\"\\']?)([^\"\\' >]+)([^\"\\'>]?[^>]*>)/i', \n\t\t\t\t$content, \n\t\t\t\t$regs, \n\t\t\t\tPREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$orig_href = $regs[2][$i];\n\t\t\t\t$new_href = weSiteImport::_makeInternalLink($orig_href);\n\t\t\t\tif ($new_href != $orig_href) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $new_href . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// replace src (same as href!!)\n\t\tpreg_match_all(\n\t\t\t\t'/(<[^>]+src=[\"\\']?)([^\"\\' >]+)([^\"\\'>]?[^>]*>)/i', \n\t\t\t\t$content, \n\t\t\t\t$regs, \n\t\t\t\tPREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$orig_href = $regs[2][$i];\n\t\t\t\t$new_href = weSiteImport::_makeInternalLink($orig_href);\n\t\t\t\tif ($new_href != $orig_href) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $new_href . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// url() in styles with style=\"\"\n\t\tpreg_match_all('/(<[^>]+style=\")([^\"]+)(\"[^>]*>)/i', $content, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$style = $regs[2][$i];\n\t\t\t\t$newStyle = $style;\n\t\t\t\tpreg_match_all('/(url\\(\\'?)([^\\'\\)]+)(\\'?\\))/i', $style, $regs2, PREG_PATTERN_ORDER);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\tfor ($z = 0; $z < count($regs2[2]); $z++) {\n\t\t\t\t\t\t$orig_url = $regs2[2][$z];\n\t\t\t\t\t\t$new_url = weSiteImport::_makeInternalLink($orig_url);\n\t\t\t\t\t\tif ($orig_url != $new_url) {\n\t\t\t\t\t\t\t$newStyle = str_replace($orig_url, $new_url, $newStyle);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($newStyle != $style) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $newStyle . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// url() in styles with style=''\n\t\tpreg_match_all('/(<[^>]+style=\\')([^\\']+)(\\'[^>]*>)/i', $content, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$style = $regs[2][$i];\n\t\t\t\t$newStyle = $style;\n\t\t\t\tpreg_match_all('/(url\\(\"?)([^\"\\)]+)(\"?\\))/i', $style, $regs2, PREG_PATTERN_ORDER);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\tfor ($z = 0; $z < count($regs2[2]); $z++) {\n\t\t\t\t\t\t$orig_url = $regs2[2][$z];\n\t\t\t\t\t\t$new_url = weSiteImport::_makeInternalLink($orig_url);\n\t\t\t\t\t\tif ($orig_url != $new_url) {\n\t\t\t\t\t\t\t$newStyle = str_replace($orig_url, $new_url, $newStyle);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($newStyle != $style) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $newStyle . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// url() in <style> tags\n\t\tpreg_match_all('/(<style[^>]*>)(.*)(<\\/style>)/isU', $content, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[2]); $i++) {\n\t\t\t\t$style = $regs[2][$i];\n\t\t\t\t$newStyle = $style;\n\t\t\t\t// url() in styles with style=''\n\t\t\t\tpreg_match_all(\n\t\t\t\t\t\t'/(url\\([\\'\"]?)([^\\'\"\\)]+)([\\'\"]?\\))/iU', \n\t\t\t\t\t\t$style, \n\t\t\t\t\t\t$regs2, \n\t\t\t\t\t\tPREG_PATTERN_ORDER);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\tfor ($z = 0; $z < count($regs2[2]); $z++) {\n\t\t\t\t\t\t$orig_url = $regs2[2][$z];\n\t\t\t\t\t\t$new_url = weSiteImport::_makeInternalLink($orig_url);\n\t\t\t\t\t\tif ($orig_url != $new_url) {\n\t\t\t\t\t\t\t$newStyle = str_replace(\n\t\t\t\t\t\t\t\t\t$regs2[0][$z], \n\t\t\t\t\t\t\t\t\t$regs2[1][$z] . $new_url . $regs2[3][$z], \n\t\t\t\t\t\t\t\t\t$newStyle);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($newStyle != $style) {\n\t\t\t\t\t$newTag = $regs[1][$i] . $newStyle . $regs[3][$i];\n\t\t\t\t\t$content = str_replace($regs[0][$i], $newTag, $content);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $content;\n\t}", "function path_replace( $html ){\n\t\t// url => template_dir/url\n\t\t// url# => url#\n\t\t// http://url => http://url\n\n\t\t$exp = array( '/src=(?:\")http\\:\\/\\/([^\"]+?)(?:\")/i', '/src=(?:\")([^\"]+?)#(?:\")/i', '/src=\"(.*?)\"/', '/src=(?:\\@)([^\"]+?)(?:\\@)/i', '/background=(?:\")http\\:\\/\\/([^\"]+?)(?:\")/i', '/background=(?:\")([^\"]+?)#(?:\")/i', '/background=\"(.*?)\"/', '/background=(?:\\@)([^\"]+?)(?:\\@)/i', '/<link(.*?)href=(?:\")http\\:\\/\\/([^\"]+?)(?:\")/i', '/<link(.*?)href=(?:\")([^\"]+?)#(?:\")/i', '/<link(.*?)href=\"(.*?)\"/', '/<link(.*?)href=(?:\\@)([^\"]+?)(?:\\@)/i' );\n\t\t$sub = array( 'src=@http://$1@', 'src=@$1@', 'src=\"' . $this->tpl_dir . '\\\\1\"', 'src=\"$1\"', 'background=@http://$1@', 'background=@$1@', 'background=\"' . $this->tpl_dir . '\\\\1\"', 'background=\"$1\"', '<link$1href=@http://$2@', '<link$1href=@$2@' , '<link$1href=\"' . $this->tpl_dir . '$2\"', '<link$1href=\"$2\"' );\n\t\treturn preg_replace( $exp, $sub, $html );\n\t}", "public function replaceBaseTokens(&$content);", "public static function sanitize_relative_path( $path ) {\n\t\treturn preg_replace( '/#(SITE|CONTENT)#/', '', $path );\n\t}", "private static function replaceExtend(string $content)\n {\n preg_match(self::FORMAT['extends'], $content, $matches);\n\n if (!isset($matches[1])) {\n return $content;\n }\n\n $filename = Str::sanitizePath(trim($matches[1], '\"\\''));\n $parent_content = self::getContent($filename);\n\n //Replace parent block imports in child view\n preg_match_all(self::FORMAT['parent_block'], $content, $parent_blocks);\n\n foreach ($parent_blocks[1] as $block_name) {\n $block_regex = str_replace(self::BLOCK_NAME, $block_name, self::FORMAT['block']);\n $parent_block_regex = str_replace(self::BLOCK_NAME, $block_name, self::FORMAT['parent_block']);\n preg_match($block_regex, $parent_content, $block_content);\n\n $content = preg_replace($parent_block_regex, trim($block_content[2] ?? ''), $content);\n }\n\n //Replace blocks in parent with child blocks content\n preg_match_all(self::FORMAT['block'], $content, $child_blocks);\n\n foreach ($child_blocks[1] as $key => $block_name) {\n $block_regex = str_replace(self::BLOCK_NAME, $block_name, self::FORMAT['block']);\n $parent_content = preg_replace($block_regex, trim($child_blocks[2][$key]), $parent_content);\n }\n\n //Remove remaining unused tags\n $parent_content = preg_replace(self::FORMAT['block'], '', $parent_content);\n $parent_content = preg_replace(self::FORMAT['parent_block'], '', $parent_content);\n\n return $parent_content;\n }", "protected function replace($content)\n {\n // every character that has been processed will be moved to this string\n $processed = '';\n\n // update will keep shrinking, character by character, until all of it\n // has been processed\n while($content) {\n foreach($this->patterns as $i => $pattern) {\n $replacement = $this->replacements[$i];\n\n // replace pattern occurrences starting at this characters\n list($content, $replacement, $match) = $this->replacePattern($pattern, $content, $replacement);\n\n // if a pattern was replaceed out of the content, move the\n // replacement to $processed & remove it from $content\n if($match != '' || $replacement != '') {\n $processed .= $replacement;\n $content = substr($content, strlen($replacement));\n continue 2;\n }\n }\n\n // character processed: add it to $processed & strip from $content\n $processed .= $content[0];\n $content = substr($content, 1);\n }\n\n return $processed;\n }", "protected function replaceLinks($content)\n {\n return str_replace('/docs/{{version}}', '/docs', $content);\n }", "private function parseFunctions() {\r\n while( preg_match( \"/\" .$this->leftDelimiterF . \"include file=\\\"(.*)\\.(.*)\\\"\" . $this->rightDelimiterF . \"/isUe\", $this->template ) ) {\r\n $this->template = preg_replace( \"/\" . $this->leftDelimiterF . \"include file=\\\"(.*)\\.(.*)\\\"\" . $this->rightDelimiterF . \"/isUe\", \"file_get_contents(\\$this->templateDir.'\\\\1'.'.'.'\\\\2')\", $this->template );\r\n }\r\n $this->template = preg_replace( \"/\" .$this->leftDelimiterC .\"(.*)\" .$this->rightDelimiterC .\"/isUe\", \"\", $this->template );\r\n }" ]
[ "0.7026493", "0.688952", "0.59473085", "0.59461015", "0.59340507", "0.5927119", "0.5904901", "0.572699", "0.56774545", "0.55368406", "0.54570633", "0.5386634", "0.52854264", "0.52719516", "0.52693266", "0.52442926", "0.523602", "0.5209371", "0.5193935", "0.5193661", "0.5152914", "0.5148455", "0.50952655", "0.5070717", "0.504653", "0.4996411", "0.4990067", "0.49425155", "0.49391913", "0.49271297" ]
0.7020751
1
changes $current_path used for fixing relative paths
private function setCurrentPath(){ $dirs = explode('/', $this->pages[0]); // if last character is a / then just use it if(empty($dirs[count($dirs)-1]) || is_null($dirs[count($dirs)-1])){ $this->current_path = $this->pages[0]; // if end of path was a filename, remove it and add a / } else { array_pop($dirs); $this->current_path = implode('/', $dirs).'/'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function changePath()\n {\n chdir(base_path());\n }", "abstract public function getCurrentPath();", "function current_path()\n {\n\treturn str_replace(base_url(), '', current_url());\n }", "protected function setInitialRelativePath() {}", "private function relativePathFix($path){\n\t\t// check if page is a generated javadoc\n\t\t$page_str = $this->doc->saveHTML();\n\t\tif(preg_match('%.*Generated by javadoc.*%', $page_str)){\n\t\t\t// if it is, fix the frame-based links so that the path isn't appended to itself infinitely\n\t\t\t$path = preg_replace('%(.*\\/).*\\.html\\?(.*\\/.*)%', \"$1$2\", $path);\n\t\t}\n\t\t$dirs = explode('/', $path);\n\t\t// check if link goes up a directory\n\t\tif($dirs[0] == '..'){\n\t\t\t$new_path = explode('/', $this->current_path);\n\t\t\tif(count($dirs) == 2){\n\t\t\t\tarray_pop($new_path);\n\t\t\t\tarray_pop($new_path);\n\t\t\t\t$new_path = implode('/', $new_path).'/';\n\t\t\t} else {\n\t\t\t\t// remove slash from end of current path to ensure single slashes\n\t\t\t\tif(empty($new_path[count($new_path)-1]) || is_null($new_path[count($new_path)-1])){\n\t\t\t\t\tarray_pop($new_path);\n\t\t\t\t}\n\t\t\t\t// go up directories\n\t\t\t\twhile($dirs[0] == '..'){\n\t\t\t\t\tarray_shift($dirs);\n\t\t\t\t\tarray_pop($new_path);\n\t\t\t\t}\n\t\t\t\t// stick the two paths together to get new path\n\t\t\t\t$new_path = implode('/', $new_path).'/';\n\t\t\t\t$new_path .= implode('/', $dirs);\n\t\t\t}\n\t\t// if link it to same dir, remove the ./\n\t\t} elseif($dirs[0] == '.'){\n\t\t\t$new_path = $this->current_path.substr($path, 2);\n\t\t// if the link starts at root, use it without modification\n\t\t} elseif(empty($dirs[0]) || is_null($dirs[0])){\n\t\t\t$new_path = $path;\n\t\t} elseif(strlen($dirs[0]) == 2){\n\t\t\t$new_path = '/'.$path;\n\t\t// default to adding the link's value to the end of the current directory\n\t\t} else {\n\t\t\t$new_path = $this->current_path.$path;\n\t\t}\n\t\t\n\t\t// if the link doesn't point to a file or query string, but has no end slash, add one\n\t\tif(count(explode('.', $new_path)) < 2 && count(explode('?', $new_path)) < 2 && substr($new_path, -1) != '/'){\n\t\t\t$new_path .= '/';\n\t\t}\n\t\treturn $new_path;\n\t}", "public function changeCurrentDirectory(Directory $newCurrentDirectory);", "private function getPath( $current )\n {\n $paths = explode( DS, $current );\n\n $controller = $paths[0];\n $action = $paths[1];\n }", "function set_current_url() {\r\n\t\t\t$this->current_url = $this->get_current_url();\r\n\t\t}", "function adjustPath($path) {\r\n $isWin = (substr(PHP_OS, 0, 3) == 'WIN') ? 1 : 0;\r\n $siteDir = eZSys::siteDir();\r\n \r\n $path = str_replace('\\\\', '/', $siteDir . $path );\r\n $path = str_replace('//', '/', $path);\r\n if ($isWin) {\r\n $path = str_replace('/', '\\\\\\\\', $path);\r\n }\r\n return $path;\r\n}", "function calcRelativeDirPath ($current_url) {\n \n // gleiche bei den Beiden Pfade die Trennzeichen an \n $curr_dir_leveled = levelingDirSeperators($current_url);\n $root_dir_leveled = levelingDirSeperators(ROOT);\n \n $curr_dir = dirname($curr_dir_leveled);\n $root_dir_end = extractLastPart($root_dir_leveled);\n \n // Teile den Aktuellen Pfad an dem Ende des Root Pfades\n $path_parts = explode($root_dir_end, $curr_dir);\n \n // Der relative Pfad ist der letzte Teil\n $rel_path = array_pop($path_parts);\n \n return $rel_path;\n}", "private function pathify(&$path) {\n\t\t$path = realpath($path).'/';\n\t}", "function calcRelativeRootPath($current_url) {\n \n // Ermittle den Relativen Pfad zu der Aktuellen Datei\n $rel_path = calcRelativeDirPath($current_url);\n \n // Teile den Pfad in seine Ordner\n $rel_backPath_parts = explode('/', $rel_path);\n \n // entferne die Leeren Einträge\n $rel_path_dirs_cleaned = array_diff($rel_backPath_parts, array(''));\n\n // Ersetze jeden Eintrag durch \\..\n $rel_backPath_parts = array_map(\n function ($e) { return DIRECTORY_SEPARATOR . '..'; },\n $rel_path_dirs_cleaned);\n \n // implodiere das array um den Pfad, zurück zum root zu erhalten\n $rel_backPath = implode('', $rel_backPath_parts);\n\n return $rel_backPath;\n}", "function setPath() {\n\n // Wp installation path\n $wp_install_path = str_replace( 'http://' . $_SERVER['HTTP_HOST'], '', site_url());\n\n // Set the instance starting path\n $this->path = $wp_install_path . App::getOption('path');\n\n // Grab the server-passed \"REQUEST_URI\"\n $this->current_uri = $this->request->server()->get('REQUEST_URI');\n\n // Remove the starting URI from the equation\n // ex. /wp/cocoon/mypage -> /mypage\n $this->request->server()->set(\n 'REQUEST_URI', substr($this->current_uri, strlen($this->path))\n );\n\n }", "abstract function changedir($path = '', $supress_debug = FALSE);", "function cd($changePath) {\n\t\t$this->intoArray = explode('/', $this->currentPath);\n\t\tarray_pop($this->intoArray);\n\t\t$this->newPath = implode('/', $this->intoArray); \n\n\t\t// go back one folder to a parent and change to a new dir (use ../ convention)\n\t\tif (substr($changePath, 0, strlen($this->cd)) == $this->cd) { // check for ../ convention..\n \t\t$changePath = substr($changePath, strlen($this->cd)); // keep folder name after ../\n \t\t$this->newPath .= '/' . $changePath; // and join parent path with a new folder\n\t\t\techo $this->newPath; // display new path\n\t\t\t// $this->currentPath = $this->newPath; // enable if if you want current path to be changed to a new one\n \t} else { // if user entered invalid path format, i.e. without ../\n\t\t\techo 'Entered path is not valid';\n\t\t}\n\t}", "public function incCurrentPathNumber() {\r\n return ++$this->num_path_current;\r\n }", "protected function defineOriginalRootPath() {}", "public static function cleanupPathInfo(): void\n {\n global $PMA_PHP_SELF;\n\n $PMA_PHP_SELF = Core::getenv('PHP_SELF');\n if (empty($PMA_PHP_SELF)) {\n $PMA_PHP_SELF = urldecode(Core::getenv('REQUEST_URI'));\n }\n\n $_PATH_INFO = Core::getenv('PATH_INFO');\n if (! empty($_PATH_INFO) && ! empty($PMA_PHP_SELF)) {\n $question_pos = mb_strpos($PMA_PHP_SELF, '?');\n if ($question_pos != false) {\n $PMA_PHP_SELF = mb_substr($PMA_PHP_SELF, 0, $question_pos);\n }\n\n $path_info_pos = mb_strrpos($PMA_PHP_SELF, $_PATH_INFO);\n if ($path_info_pos !== false) {\n $path_info_part = mb_substr($PMA_PHP_SELF, $path_info_pos, mb_strlen($_PATH_INFO));\n if ($path_info_part == $_PATH_INFO) {\n $PMA_PHP_SELF = mb_substr($PMA_PHP_SELF, 0, $path_info_pos);\n }\n }\n }\n\n $path = [];\n foreach (explode('/', $PMA_PHP_SELF) as $part) {\n // ignore parts that have no value\n if (empty($part) || $part === '.') {\n continue;\n }\n\n if ($part !== '..') {\n // cool, we found a new part\n $path[] = $part;\n } elseif (count($path) > 0) {\n // going back up? sure\n array_pop($path);\n }\n\n // Here we intentionall ignore case where we go too up\n // as there is nothing sane to do\n }\n\n $PMA_PHP_SELF = htmlspecialchars('/' . implode('/', $path));\n }", "function set_path($path) \n {\n $this->path = \"/\" . trim($path, \"/\");\n }", "public function set_path() {\n\t\t\t\n\t\t\t// pick up the path types\n\t\t\t$path_types = include_once(CONFIGPATH . 'path-types.php' );\n\n\t\t\t// get the base path for the deploy type\n\t\t\t$base_path = $path_types[ $this->repo[ 'type' ] ];\n\n\t\t\t// check if it is a valid path\n\t\t\t$this->is_path_valid( $base_path );\n\n\t\t\t// append the repositories name to get the final deploy path\n\t\t\t$this->repo[ 'path' ] = $base_path . '/' . $this->repo[ 'name' ];\n\t\t}", "public function resolvePath($currentPath)\n {\n\n if($currentPath == \"admin/dashboard\"){\n $view = 'admin.dashboard';\n } else if($currentPath == \"admin/nieuws-overzicht\"){\n $view = 'admin.nieuws.overzicht';\n } else if($currentPath == \"admin/nieuws/toevoegen\"){\n $view = 'admin.nieuws.toevoegen';\n } else if($currentPath == \"admin/pagina-overzicht\"){\n $view = 'admin.pagina.overzicht';\n } else if($currentPath == \"admin/pagina/toevoegen\"){\n $view = 'admin.pagina.toevoegen';\n } else if($currentPath == \"admin/product-overzicht\"){\n $view = 'admin.product.overzicht';\n $this->data = WebshopController::loadProductsTable();\n } else if($currentPath == \"admin/fotoboek-overzicht\"){\n $view = 'admin.fotoboek.overzicht';\n } else if($currentPath == \"admin/fotoboek/toevoegen\"){\n $view = 'admin.fotoboek.toevoegen';\n } else if($currentPath == \"admin/product/edit/{id}\") {\n //$view = 'admin.product.edit';\n } else {\n $view = '404';\n }\n\n return $view;\n }", "function formatCurrentUrl() ;", "protected function setInitialBackPath() {}", "public function getCurrentPath()\n {\n return str_replace($this->getRootPath(), '', $this->basePath) ?: DIRECTORY_SEPARATOR;\n }", "function adjust_relative_path($path = false, $relative_path = false) {\r\n\t\tif($path === false) {\r\n\t\t\tprint('Path: ' . $path . ' or relative path: ' . $relative_path . ' for function resolve_relative_path was imporperly specifed.');\r\n\t\t}\r\n\t\t//$exploded_file_path = explode('/', $this->file);\r\n\t\t$exploded_path = explode('/', $path);\r\n\t\t$exploded_relative_path = explode('/', $relative_path);\r\n\t\t$path_counter = 0;\r\n\t\twhile($exploded_path[$path_counter] === '..') {\r\n\t\t\t$path_counter++;\r\n\t\t}\r\n\t\t$part_to_keep = '';\r\n\t\t$path_counter2 = $path_counter;\r\n\t\twhile($path_counter2 < sizeof($exploded_path)) {\r\n\t\t\t$part_to_keep .= '/' . $exploded_path[$path_counter2];\r\n\t\t\t$path_counter2++;\r\n\t\t}\r\n\t\t$relative_path_counter = sizeof($exploded_relative_path);\r\n\t\twhile($path_counter > -1) {\r\n\t\t\t$relative_path_counter--;\r\n\t\t\t$path_counter--;\r\n\t\t}\r\n\t\t$part_to_keep2 = '';\r\n\t\t$relative_path_counter2 = 0;\r\n\t\twhile($relative_path_counter > 0) {\r\n\t\t\t$part_to_keep2 .= '../';\r\n\t\t\t$relative_path_counter2++;\r\n\t\t\t$relative_path_counter--;\r\n\t\t}\r\n\t\t$resolved_path = substr($part_to_keep2, 0, strlen($part_to_keep2) - 1) . $part_to_keep;\r\n\t\t//print('$path, $relative_path, $resolved_path: ');var_dump($path, $relative_path, $resolved_path);\r\n\t\treturn $resolved_path;\r\n\t}", "protected function setInitialRootPath() {}", "public function current_path()\n\t{\n\t\t$url = parse_url($this->connection()->get('url'));\n\n\t\treturn $url['path'].(isset($url['query']) ? '?'.$url['query'] : '');\n\t}", "public function getCurrentPath()\n {\n return $this->path;\n }", "public function setPath()\n {\n $this->path = $this->getNamespace() . $this->getControllerName();\n }", "protected function _renamePath($curpath, $newpath)\n {\n $curpath = str_replace(DIRECTORY_SEPARATOR, '/', $curpath);\n $newpath = str_replace(DIRECTORY_SEPARATOR, '/', $newpath);\n\n $adapter = $this->getAdapter();\n\n // Inicia as trasações do banco de dados\n $adapter->beginTransaction();\n try {\n $files = $this->findAll(array(\n 'where' => array(\"path LIKE '{$curpath}%'\")\n ));\n\n if($files->count() > 0) {\n // renomeia com o $newpath as ocorreções encontradas\n foreach ($files as $file){\n $file->path = str_replace($curpath, $newpath, $file->path);\n FrontZend_Container::get('File')->save($file);\n }\n }\n\n $contents = FrontZend_Container::get('Content')->findAll(array(\n 'where' => array(\"text LIKE '%{$curpath}%'\")\n ));\n\n if ($contents->count() > 0) {\n foreach($contents as $content) {\n // renomeia com o $newpath as ocorreções encontradas\n $content->text = str_replace($curpath, $newpath,\n $content->text);\n FrontZend_Container::get('Content')->save($content);\n }\n }\n\n // Efetiva todas as transações do banco de dados\n $adapter->commit();\n } catch(Exception $e) {\n // Desfaz todas as alterações do banco de dados\n $adapter->rollBack();\n throw $e;\n }\n }" ]
[ "0.7021977", "0.6928795", "0.6675617", "0.6667217", "0.66215587", "0.65949434", "0.6530308", "0.63362676", "0.6181536", "0.610016", "0.60529083", "0.6050394", "0.60440636", "0.60261613", "0.59632707", "0.59627086", "0.5916782", "0.5903339", "0.5897093", "0.5879897", "0.5876571", "0.5800466", "0.57995284", "0.5782493", "0.5776515", "0.57356817", "0.5728982", "0.5728735", "0.57196826", "0.5693701" ]
0.77386767
0
sorts entries in $links, moves entries to $pages, validates entries in $pages
private function arrayShuffle(){ // check if arrays exist before trying to use them if(isset($this->links[$this->pages[0]]) && is_array($this->links[$this->pages[0]])){ // remove duplicate values $this->links[$this->pages[0]] = array_unique($this->links[$this->pages[0]]); // find all links that are not queued or visited and add to the queue $this->pages = array_merge($this->pages, array_diff($this->links[$this->pages[0]], $this->pages, $this->visited)); // sort links sort($this->links[$this->pages[0]]); } // find all links in the queue that point to files foreach ($this->pages as $path) { if(count(explode('.', $path)) > 1){ // get the file extension $file = explode('.', $path); $qry = false; // if there's a query string, explode it to access the extension foreach ($file as $key => $value){ if (count(explode('?', $value)) > 1) { $file[$key] = explode('?', $value); $qry = $key; } } if($qry){ $type = $file[$qry][0]; } else { $type = count($file); $type = $file[$type-1]; } // remove any links that are to files NOT on the accept list (deafult: html, htm, php) if(array_search($type, $this->file_types) === false){ while($key = array_search($path, $this->pages)){ array_splice($this->pages, $key, 1); } } } if(!is_null($this->ignore_dirs)){ // loop through ignored directories, compare to the path in the link foreach ($this->ignore_dirs as $dir) { if(array_search($dir, explode('/', $path)) !== false){ while($key = array_search($path, $this->pages)){ array_splice($this->pages, $key, 1); } } } } } // add current link to $visited, remove from $pages, sort $pages $this->visited[] = $this->pages[0]; array_shift($this->pages); sort($this->pages); // if the queue is not empty, crawl again if(count($this->pages) > 0){ $this->crawl(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function sort(): void\n {\n if (!$this->dirtyIndex) {\n return;\n }\n\n $newIndex = [];\n $index = 0;\n\n foreach ($this->pages as $hash => $page) {\n $order = $page->getOrder();\n\n if (null === $order) {\n $newIndex[$hash] = $index;\n ++$index;\n } else {\n $newIndex[$hash] = $order;\n }\n }\n\n asort($newIndex);\n\n $this->index = $newIndex;\n $this->dirtyIndex = false;\n }", "public function delete_page_links() {\n\t\t\t$this->linked_postid = '';\n\t\t\t$this->pages_url = '';\n\t\t\t$this->MakePersistent();\n\n\t\t}", "function sort_link_array($links){\n if (!is_array($links)) return false;\n \n $fertig=Array(); //if all positions are set, the following loop will not create an array\n //and array_splice will cry. So let's assure, we have an array...\n for ($x = 0; $x < count($links); $x++){\n if ( ($links[$x]['position'] === \"\") or (!isset($links[$x]['position'])) ){\n $fertig[] = $links[$x];\n }\n }\n \n for ($x = 0; $x < count($links); $x++){\n if (($links[$x]['position'] !== \"\") and (isset($links[$x]['position'])) ){\n array_splice($fertig, $links[$x]['position'], 0 , array($links[$x]));\n } \n }\n\n return $fertig;\n }", "private function saveLinks(int $page): void\n {\n if (isset($this->links[\"previous\"]) && !empty($this->links[\"previous\"])) {\n $this->cache[$page - 1] = (string) $this->links[\"previous\"];\n }\n if (isset($this->links[\"next\"]) && !empty($this->links[\"next\"])) {\n $this->cache[$page + 1] = (string) $this->links[\"next\"];\n }\n\n if ($this->cache) {\n ksort($this->cache);\n }\n $this->saveCache();\n }", "function browse_sort_links($links, $wrapperTags = array())\n{\n $sortParam = Omeka_Db_Table::SORT_PARAM;\n $sortDirParam = Omeka_Db_Table::SORT_DIR_PARAM;\n $req = Zend_Controller_Front::getInstance()->getRequest();\n $currentSort = trim($req->getParam($sortParam));\n $currentDir = trim($req->getParam($sortDirParam));\n\n $defaults = array(\n 'link_tag' => 'li',\n 'list_tag' => 'ul',\n 'link_attr' => array(),\n 'list_attr' => array( 'id' => 'sort-links-list' )\n );\n\n $sortlistWrappers = array_merge($defaults, $wrapperTags);\n\n $linkAttrArray = array();\n foreach ($sortlistWrappers['link_attr'] as $key => $attribute) {\n $linkAttrArray[$key] = $key . '=\"' . html_escape($attribute) . '\"';\n }\n $linkAttr = join(' ', $linkAttrArray);\n\n $listAttrArray = array();\n foreach ($sortlistWrappers['list_attr'] as $key => $attribute) {\n $listAttrArray[$key] = $key . '=\"' . html_escape($attribute) . '\"';\n }\n $listAttr = join(' ', $listAttrArray);\n\n $sortlist = '';\n if (!empty($sortlistWrappers['list_tag'])) {\n $sortlist .= \"<{$sortlistWrappers['list_tag']} $listAttr>\";\n }\n\n foreach ($links as $label => $column) {\n if ($column) {\n $urlParams = $_GET;\n $urlParams[$sortParam] = $column;\n $class = '';\n if ($currentSort && $currentSort == $column) {\n if ($currentDir && $currentDir == 'd') {\n $class = 'class=\"sorting desc\"';\n $urlParams[$sortDirParam] = 'a';\n } else {\n $class = 'class=\"sorting asc\"';\n $urlParams[$sortDirParam] = 'd';\n }\n }\n $url = html_escape(url(array(), null, $urlParams));\n if ($sortlistWrappers['link_tag'] !== '') {\n $sortlist .= \"<{$sortlistWrappers['link_tag']} $class $linkAttr><a href=\\\"$url\\\">$label</a></{$sortlistWrappers['link_tag']}>\";\n } else {\n $sortlist .= \"<a href=\\\"$url\\\" $class $linkAttr>$label</a>\";\n }\n } else {\n $sortlist .= \"<{$sortlistWrappers['link_tag']}>$label</{$sortlistWrappers['link_tag']}>\";\n }\n }\n if (!empty($sortlistWrappers['list_tag'])) {\n $sortlist .= \"</{$sortlistWrappers['list_tag']}>\";\n }\n return $sortlist;\n}", "function languagelesson_sort_by_ordering($lessonid) {\n global $DB;\n \n $pages = $DB->get_records('languagelesson_pages', array('lessonid'=>$lessonid));\n\n // Make sure they are in order by field ordering.\n $order = array();\n foreach ($pages as $key => $obj) {\n $order[$key] = $obj->ordering;\n }\n array_multisort($order, SORT_ASC, $pages);\n \n $pagecount = count($pages);\n $keys = array_keys($pages);\n \n $i = array_shift($keys);\n $last = array_pop($keys);\n \n $prev = $pages[$i];\n $prev->prevpageid = 0;\n $prev->nextpageid = $pages[$i += 1];\n $DB->update_record('languagelesson_pages', $prev);\n \n while ($i < $pagecount) {\n $thispage = $pages[$i];\n $thispage->prevpageid = $prev->id;\n if (!$pages[$i += 1]) {\n $thispage->nextpageid = 0;\n $DB->update_record('languagelesson_pages', $thispage);\n break;\n } else {\n $thispage->nextpageid = $i;\n }\n $DB->update_record($thispage);\n $prev = $thispage;\n }\n \n }", "function languagelesson_reorder_pages($lessonid) {\n global $DB;\n $startpage = $DB->get_record(\"languagelesson_pages\", array('lessonid'=> $lessonid, 'prevpageid'=>0));\n $order = 0;\n $DB->set_field(\"languagelesson_pages\", 'ordering', $order, array('id'=>$startpage->id));\n $order++;\n $nextpageid = $DB->get_field(\"languagelesson_pages\", 'id', array('id'=>$startpage->nextpageid));\n\n for (; $nextpageid != 0; $order++) {\n $DB->set_field(\"languagelesson_pages\", 'ordering', $order, array('id'=>$nextpageid));\n $nextpageid = (int)$DB->get_field(\"languagelesson_pages\", 'nextpageid', array('id'=>$nextpageid));\n }\n}", "function generate_page_links($user_search, $sort, $cur_page, $num_pages) {\n $page_links = '';\n\n // If this page is not the first page, generate the \"previous\" link\n if ($cur_page > 1) {\n $page_links .= '<a class=\"pagelinks\" href=\"' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=' . $sort . '&page=' . ($cur_page - 1) . '\"><-Previous</a> ';\n }\n else {\n $page_links .= '<- ';\n }\n\n // Loop through the pages generating the page number links\n for ($i = 1; $i <= $num_pages; $i++) {\n if ($cur_page == $i) {\n $page_links .= ' ' . $i;\n }\n else {\n $page_links .= ' <a class=\"pagelinks\" href=\"' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=' . $sort . '&page=' . $i . '\"> ' . $i . '</a>';\n }\n }\n\n // If this page is not the last page, generate the \"next\" link\n if ($cur_page < $num_pages) {\n $page_links .= ' <a class=\"pagelinks\"href=\"' . $_SERVER['PHP_SELF'] . '?usersearch=' . $user_search . '&sort=' . $sort . '&page=' . ($cur_page + 1) . '\">Next-></a>';\n }\n else {\n $page_links .= ' ->';\n }\n\n return $page_links;\n }", "public function changeContentSortingAndCopyLivePage() {}", "public function processNewsPages($pages) {\n $record = [];\n foreach ($pages as $item) {\n if ($crawler = $this->initCrawler($item['url'], $this->site['url'])) {\n $newsTag = \".content-width-default table tr table tr\";\n $crawler->filter($newsTag)->each(function($row) use($item) {\n if (count($row->filter(\".newsheader\"))) {\n $title = $row->filter(\".newsheader\")->text();\n $link = $row->filter(\".newsheader\")->attr('href');\n $body = $row->filter(\".newsbody\")->text();\n if ($fileId = $this->processLink($link)) {\n $readMore = '<p>[file-link-' . $fileId . '-Read full press release]</p>';\n }\n else {\n $readMore = '<p><a href=\"' . $link . '\">Read full press release</a></p>';\n }\n $body = str_replace(\" read more\", $readMore, $body);\n $record = [\n 'title' => $title,\n 'parent_id' => $item['id'],\n 'article_type' => $item['type'],\n 'body' => $body,\n 'type' => 'county_article',\n ];\n $this->news[] = $record;\n }\n \n });\n }\n else {\n $this->errors[$item['id']] = \"Could not scrape news article: \" . $item['id'];\n };\n }\n foreach ($this->news as $i => $page) {\n $id = $page['parent_id'] . '-' . $i;\n $this->print(\"Processing \" . $id);\n $page['id'] = $id;\n unset($page['parent_id']);\n $this->writeRecord($page, $id);\n }\n }", "function generate_page_links($user_search, $sort, $cur_page, $num_pages) {\n $page_links = '<p>';\n\n // Generate \"previous page\" link if page is not the first page\n if ($cur_page > 1) {\n // Generate back arrow as an HTML link\n $page_links .= '<a href=\"' . $_SERVER['PHP_SELF']\n . '?usersearch=' . $user_search . '&sort=' . $sort\n . '&page=' . ($cur_page - 1) . '\"><-</a> ';\n } else {\n // Generate back arrow as a non-HTML link\n $page_links .= '<- ';\n }\n\n // Generate page links for each individual page\n for ($index = 1; $index <= $num_pages; $index++) {\n // Generate clickable link if page is not current page\n if ($index == $cur_page) {\n $page_links .= ' ' . $index;\n } else {\n $page_links .= '<a href=\"' . $_SERVER['PHP_SELF']\n . '?usersearch=' . $user_search . '&sort=' . $sort\n . '&page=' . $index . '\"> ' . $index . '</a> ';\n }\n }\n\n // Generate clickable link if current page is not the last page\n if ($cur_page < $num_pages) {\n // Generate back arrow as an HTML link\n $page_links .= '<a href=\"' . $_SERVER['PHP_SELF']\n . '?usersearch=' . $user_search . '&sort=' . $sort\n . '&page=' . ($cur_page + 1) . '\"> -></a> ';\n } else {\n // Generate back arrow as a non-HTML link\n $page_links .= ' ->';\n }\n\n $page_links .= '</p>';\n\n return $page_links;\n }", "function reorder_pages($arr)\n\t{\n\t\t$db = new db;\n\t\tforeach ($arr as $key=>$value )\n\t\t{\n\t\t\t$order = $key+1;\n\t\t\t$query_str = \"UPDATE pages SET `order` = $order WHERE id=$value\";\n\t\t\t$db->set_query_str($query_str);\n\t\t\t$db->db_query();\n\t\t\t\n\t\t\t$query_str = \"UPDATE pages_published SET `order` = $order WHERE id=$value\";\n\t\t\t$db->set_query_str($query_str);\n\t\t\t$db->db_query();\n\t\t}\n\t}", "final public function removePages(): void\n {\n $this->pages = [];\n $this->index = [];\n }", "private static function sort()\n\t{\n\t\t//Setup order of importantance\n\t\t$changefreqs = array(\n\t\t\t'hourly' => 5,\n\t\t\t'daily' => 4,\n\t\t\t'weekly' => 3,\n\t\t\t'monthly' => 2,\n\t\t\t'yearly' => 1,\n\t\t\t'never' => 0\n\t\t);\n\n\t\t//Setup invidual arrays to sort by\n\t\tforeach(static::$links as $index => $link)\n\t\t{\n\t\t\t$priority[$index] = $link->priority ? $link->priority : 0;\n\t\t\t$changefreq[$index] = $link->changefreq ? $changefreqs[$link->changefreq] : 0;\n\t\t\t$loc[$index] = $link->loc;\n\t\t}\n\n\t\tarray_multisort($priority, SORT_DESC, $changefreq, SORT_DESC, $loc, SORT_ASC, static::$links);\n\t}", "public function writeRecords_pages_order() {}", "final public function moveall($newprevpage, $newnextpage, $lessonid, $pages) {\n\t\t// Make sure the pages are in sort order by key value.\n\t\tksort($pages);\n\t\t// Replace the prevpageid of the first page with that given.\n\t\t$firstpage = array_shift($pages);\n\t\t$DB->set_field('languagelesson_pages', 'prevpageid', $newprevpage, array('pageid' => $firstpage));\n\t\t \n\t\t// Replace the nextpageid of the last page with that given.\n\t\t$lastpage = array_pop($pages);\n\t\t$DB->set_field('languagelesson_pages', 'nextpageid', $newnextpage, array('pageid' => $lastpage));\n\t\t\n\t\t// Run reorder_pages function (the one that works).\n\t\tlanguagelesson_reorder_pages($lessonid);\n\t}", "public function changeContentSortingAndCopyDraftPage() {}", "private function migrateAdditionalPages() {\n\t\tif ( empty( $this->oldOptions['modules']['aiosp_sitemap_options']['aiosp_sitemap_addl_pages'] ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$pages = [];\n\t\tforeach ( $this->oldOptions['modules']['aiosp_sitemap_options']['aiosp_sitemap_addl_pages'] as $url => $values ) {\n\t\t\t$page = new \\stdClass();\n\t\t\t$page->url = esc_url( wp_strip_all_tags( $url ) );\n\t\t\t$page->priority = [ 'label' => $values['prio'], 'value' => $values['prio'] ];\n\t\t\t$page->frequency = [ 'label' => $values['freq'], 'value' => $values['freq'] ];\n\t\t\t$page->lastModified = gmdate( 'm/d/Y', strtotime( $values['mod'] ) );\n\n\t\t\t$pages[] = wp_json_encode( $page );\n\t\t}\n\n\t\taioseo()->options->sitemap->general->additionalPages->enable = true;\n\t\taioseo()->options->sitemap->general->additionalPages->pages = $pages;\n\t}", "public function saveUnsortedPages()\n {\n switch (Input::get('action')) {\n case 'remove':\n if(count(Input::get('page')) > 0) {\n Content::whereIn(\"page_id\", Input::get('page'))->delete();\n Page::whereIn(\"id\", Input::get('page'))->delete();\n }\n break;\n }\n return Redirect::route('unsortedPages');\n }", "public function onAfterDelete() {\n\n\t\tparent::onAfterDelete();\n\n\t\t// Determine whether this page has been completely removed.\n\n\t\tif(Config::inst()->get(MisdirectionRequestFilter::class, 'replace_default') && !$this->owner->isPublished() && !$this->owner->isOnDraft()) {\n\n\t\t\t// Convert any link mappings that are directly associated with this page.\n\n\t\t\t$mappings = LinkMapping::get()->filter(array(\n\t\t\t\t'RedirectType' => 'Page',\n\t\t\t\t'RedirectPageID' => $this->owner->ID\n\t\t\t));\n\t\t\tforeach($mappings as $mapping) {\n\t\t\t\t$mapping->RedirectType = 'Link';\n\t\t\t\t$mapping->RedirectLink = Director::makeRelative(($this->owner->Link() === Director::baseURL()) ? Controller::join_links(Director::baseURL(), 'home/') : $this->owner->Link());\n\t\t\t\t$mapping->write();\n\t\t\t}\n\t\t}\n\t}", "public function importPages() {\n\t\t$deletedPages = $this->db->run_query(\"DELETE FROM pages\");\n\t\t$this->debugPrint($deletedPages, \"pages deleted from new database\");\n\t\t\n\t\t$numExistingRecords = $this->importDb->run_query(\"SELECT * FROM pages\");\n\t\t$oldData = $this->importDb->farray_fieldnames();\n\t\t\n\t\t$oldPk = null;\n\t\t$firstRecord = $oldData[array_keys($oldData)[0]];\n\t\t\n\t\t$oldById = array();\n\t\t\n\t\tif(isset($firstRecord['page_id'])) {\n\t\t\t$oldPk = 'page_id';\n\t\t}\n\t\telseif(isset($firstRecord['id'])) {\n\t\t\t$oldPk = 'id';\n\t\t}\n\t\t\n\t\tif(!is_null($oldPk)) {\n\t\t\tforeach($oldData as $k=>$v) {\n\t\t\t\t$oldById[$v[$oldPk]] = $v;\n\t\t\t}\n\t\t}\n//\t\texit;\n\t\t\n\t\t// create a test page.\n\t\t$pageObj = new page($this->db);\n\t\t$testId = $pageObj->insert(array('title'=>'test'));\n\t\t\n\t\t$queryRes = $this->db->run_query(\"SELECT * FROM pages WHERE page_id=\". $testId);\n\t\t\n\t\t$numImported = 0;\n\t\t\n\t\tif($queryRes == 1) {\n\t\t\t$templateRecord = $this->db->get_single_record();\n\t\t\t\n\t\t\t// get rid of the template record.\n\t\t\t$pageObj->delete($testId);\n\t\t\t\n\t\t\t$validColumns = array_keys($templateRecord);\n\n\t\t\tforeach($oldData as $k=>$v) {\n\t\t\t\t$createPage = true;\n\t\t\t\t$insertData = $this->_cleanRecord($validColumns, $v);\n\t\t\t\t\n\t\t\t\t// attempt to preserve ID's\n\t\t\t\tif(!is_null($oldPk)) {\n\t\t\t\t\t$insertData['page_id'] = $v[$oldPk];\n\t\t\t\t\t\n\t\t\t\t\tif(intval($v['parent_id']) > 0 && !isset($oldById[$v['parent_id']])) {\n\t\t\t\t\t\t$createPage = false;\n\t\t\t\t\t\tunset($insertData['parent_id']);\n\t\t\t\t\t}\n//\t\t\t\t\tif(isset($oldById))\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tunset($insertData['parent_id']);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif($createPage === true) {\n\t\t\t\t\t// now insert the data.\n\t\t\t\t\t$importId = $pageObj->insert($insertData);\n\t\t\t\t\t$numImported++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$this->debugPrint($queryRes, \"result of query\");\n\t\t\t$this->debugPrint($testId, \"No page found, ID created was\");\n\t\t\tthrow new Exception(\"No record found\");\n\t\t}\n\t\t$this->debugPrint(\"{$numImported}/{$numExistingRecords}\", \"imported/existing page records\", 1, 0);\n\t\t\n\t\treturn $numImported;\n\t}", "function create_links()\n\t{\n\t\t$totalItems = $this->total_records;\n\t\t$perPage = $this->size;\n\t\t$currentPage = $this->page;\n\t\t$link = $this->link;\n\t\t$totalPages = floor($totalItems / $perPage);\n\t\t$totalPages += ($totalItems % $perPage != 0) ? 1 : 0;\n\n\t\tif ($totalPages < 1 || $totalPages == 1){\n\t\t\treturn null;\n\t\t}\n\n\t\t$output = null;\t\t\t\t\n\t\t$loopStart = 1; \n\t\t$loopEnd = $totalPages;\n\n\t\tif ($totalPages > 5)\n\t\t{\n\t\t\tif ($currentPage <= 3)\n\t\t\t{\n\t\t\t\t$loopStart = 1;\n\t\t\t\t$loopEnd = 5;\n\t\t\t}\n\t\t\telse if ($currentPage >= $totalPages - 2)\n\t\t\t{\n\t\t\t\t$loopStart = $totalPages - 4;\n\t\t\t\t$loopEnd = $totalPages;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$loopStart = $currentPage - 2;\n\t\t\t\t$loopEnd = $currentPage + 2;\n\t\t\t}\n\t\t}\n\n\t\tif ($loopStart != 1){\n\t\t\t$output .= sprintf('<li class=\"disabledpage\"> <a href=\"' . $link . '\">&#171;</a> </li>', '1');\n\t\t}\n\t\t\n\t\tif ($currentPage > 1){\n\t\t\t$output .= sprintf('<li class=\"nextpage\"> <a href=\"' . $link . '\">'._previous_.'</a> </li>', $currentPage - 1);\n\t\t}\n\t\t\n\t\tfor ($i = $loopStart; $i <= $loopEnd; $i++)\n\t\t{\n\t\t\tif ($i == $currentPage){\n\t\t\t\t$output .= '<li class=\"currentpage\">' . $i . '</li> ';\n\t\t\t} else {\n\t\t\t\t$output .= sprintf('<li><a href=\"' . $link . '\">', $i) . $i . '</a> </li> ';\n\t\t\t}\n\t\t}\n\n\t\tif ($currentPage < $totalPages){\n\t\t\t$output .= sprintf('<li class=\"nextpage\"> <a href=\"' . $link . '\">'._next_.'</a> </li>', $currentPage + 1);\n\t\t}\n\t\t\n\t\tif ($loopEnd != $totalPages){\n\t\t\t$output .= sprintf('<li class=\"nextpage\"> <a href=\"' . $link . '\">&#187;</a> </li>', $totalPages);\n\t\t}\n\n\t\treturn '<div class=\"pagination\"><ul>' . $output . '</ul></div>';\n\t}", "function generate_sort_links($user_search, $sort) {\n $sort_links = '';\n\n switch ($sort) {\n // Sorted by ascending job title\n case 1:\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=2\">Job Title</a></td><td>Description</td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=3\">State</a></td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=5\">Date Posted</a></td>';\n break;\n // Sorted by ascending state\n case 3:\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=1\">Job Title</a></td><td>Description</td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=4\">State</a></td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=5\">Date Posted</a></td>';\n break;\n // Sorted by ascending date posted\n case 5:\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=1\">Job Title</a></td><td>Description</td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=3\">State</a></td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=6\">Date Posted</a></td>';\n break;\n // Default sorting or some descending sorting selected\n default:\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=1\">Job Title</a></td><td>Description</td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=3\">State</a></td>';\n $sort_links .= '<td><a href=\"' . $_SERVER['PHP_SELF'] . '?usersearch='\n . $user_search . '&sort=5\">Date Posted</a></td>';\n break;\n }\n\n return $sort_links;\n }", "protected function pageParse( \n\t\tstring\t$text, \n\t\tarray\t&$links \n\t) : string {\n\t\t$text\t= \n\t\t\\strip_tags( \\nl2br( $text, false ), 'br' );\n\t\t\n\t\t$links\t= [];\n\t\t\n\t\t\\preg_match_all( self::WIKI_LINK_RX, $text, $m );\n\t\tif ( !empty( $m ) ) {\n\t\t\t$links = \n\t\t\t \\array_filter( \n\t\t\t\t$m, \n\t\t\t\tfunction( $k ) {\n\t\t\t\t\treturn \\is_string( $k );\n\t\t\t\t}, \\ARRAY_FILTER_USE_KEY \n\t\t\t);\n\t\t\t\n\t\t\t// Resort links\n\t\t\t$c = count( $m['term'] );\n\t\t\tfor ( $i = 0; $i < $c; $i++ ) {\n\t\t\t\t$links[] = \n\t\t\t\t[ $m['term'][$i] => $m['link'][$i] ];\n\t\t\t}\n\t\t}\n\t\t\n\t\t// TODO: Replace matches with HTML links\n\t\treturn $text;\n\t}", "public function links_listing() {\n\t$single_list = array();\n\t$regexa = '/^(http:|https:|mailto:|ftp:|#)/';\n\t$regexb = '/^(' . preg_quote($this->_domain, '/') . ')/';\n\tforeach ($this->_html->find('a') as $links) {\n\t $any_link = $links->href;\n\t if (!preg_match($regexa, $any_link) || preg_match($regexb, $any_link)) {\n\t\t$single_list[] = $any_link;\n\t }\n\t}\n\tvar_dump($this->_domain);\n\t//Associating each link to the page list array if it's not part of it yet\n\tforeach ($single_list as $value) {\n\t\tif (!preg_match('/^.*\\.(jpg|jpeg|png|gif|JPG|JPEG|GIF|pdf|PDF|wrd|wrdx|mp3)$/i', $value)) {\n\n\t\t\t//Checking of the link found starts with either http or / in which case we fix the url to absolute\n\t\t\t$a = strpos($value, 'http', 0);\n\t\t\t$b = strpos($value, '/', 0);\n\t\t\t$c = strpos($value, '../', 0);\n\t\t\tif ($a === 0) {\n\t\t\t\t$tvalue = $value;\n\t\t\t} elseif ($b === 0) {\n\t\t\t\t$tvalue = $this->_domain . $value;\n\t\t\t} elseif ($c === 0) {\n\t\t\t\t$tvalue = $this->_domain;\n\t\t\t} else {\n\t\t\t\t$tvalue = $this->_domain . '/' . $value;\n\t\t\t}\t\n\t\t\tif (!in_array($tvalue, $_SESSION['page_list'])) {\n\t\t\t\t if (!in_array($tvalue, $_SESSION['page_list_done']) && $tvalue != @$_SESSION['next_page']) {\n\t\t\t\t\tarray_push($_SESSION['page_list'], $tvalue);\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t}\n }", "private function convertLinks(){\n\t\tif(!isset($this->course['course_links']))\n\t\t\treturn;\n\t\t\n\t\t//Create folder in tmp for links\n mkdir('./tmp/links');\n\t\t$sectionCounter = 0;\n\n\t\t//Add section to manifest\n\t\tHelper::addIMSSection($this->manifest, $this->currentSectionCounter, $this->identifierCounter, 'Links');\n\n $section = $this->manifest->organizations->organization->item->item[$this->currentSectionCounter];\n \n\t\t//First add all general links\n\t\t\n\t\tforeach($this->course['course_links'] as $link_url)\n\t\t{\n\t\t\tif(intval($link_url['category'])==0)\n\t\t\t{\n\t\t\t\t//Create the xml\n\t\t\t\tHelper::createLinkXML($link_url);\t\t\t\t\n\t\n\t\t\t\t//Edit the manifest\n\t\t\t\tHelper::addIMSItem($section, $this->manifest, $sectionCounter, $this->identifierCounter, $this->resourceCounter, 'link', $link_url, 0);\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tforeach($this->course['course_link_categories'] as $cat)\n\t\t{\n\t\t\t//Add the label to the manifest\n\t\t\tHelper::addIMSLabel($section, $sectionCounter, $this->identifierCounter, $cat['name'], 0);\n\n\t\t\t//Add links below the label\n\t\t\tforeach($this->course['course_links'] as $link_url)\n\t\t\t{\n\t\t\t\tif(intval($link_url['category'])==$cat['id'])\n\t\t\t\t{\n\t\t\t\t\t//Create the xml\n\t Helper::createLinkXML($link_url); \n\t\t\t\t\t\n \t\t//Edit the manifest\n\t\t\t\t\tHelper::addIMSItem($section, $this->manifest, $sectionCounter, $this->identifierCounter, $this->resourceCounter, 'link', $link_url, 1);\n \t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Proceed to next section\n\t\t$this->currentSectionCounter++;\n\t\t\t\n\t\t\n\t}", "function getPagesLinks()\n\t{\n\t\tglobal $mainframe;\n\n\t\t$lang =& JFactory::getLanguage();\n\n\t\t// Build the page navigation list\n\t\t$data = $this->_buildDataObject();\n\n\t\t$list = array();\n\n\t\t$itemOverride = false;\n\t\t$listOverride = false;\n\n\t\t$chromePath = JPATH_THEMES.DS.$mainframe->getTemplate().DS.'html'.DS.'pagination.php';\n\t\tif (file_exists($chromePath))\n\t\t{\n\t\t\trequire_once ($chromePath);\n\t\t\tif (function_exists('pagination_item_active') && function_exists('pagination_item_inactive')) {\n\t\t\t\t$itemOverride = true;\n\t\t\t}\n\t\t\tif (function_exists('pagination_list_render')) {\n\t\t\t\t$listOverride = true;\n\t\t\t}\n\t\t}\n\n\t\t// Build the select list\n\t\tif ($data->all->base !== null) {\n\t\t\t$list['all']['active'] = true;\n\t\t\t$list['all']['data'] = ($itemOverride) ? pagination_item_active($data->all) : $this->_item_active($data->all);\n\t\t} else {\n\t\t\t$list['all']['active'] = false;\n\t\t\t$list['all']['data'] = ($itemOverride) ? pagination_item_inactive($data->all) : $this->_item_inactive($data->all);\n\t\t}\n\n\t\tif ($data->start->base !== null) {\n\t\t\t$list['start']['active'] = true;\n\t\t\t$list['start']['data'] = ($itemOverride) ? pagination_item_active($data->start) : $this->_item_active($data->start);\n\t\t} else {\n\t\t\t$list['start']['active'] = false;\n\t\t\t$list['start']['data'] = ($itemOverride) ? pagination_item_inactive($data->start) : $this->_item_inactive($data->start);\n\t\t}\n\t\tif ($data->previous->base !== null) {\n\t\t\t$list['previous']['active'] = true;\n\t\t\t$list['previous']['data'] = ($itemOverride) ? pagination_item_active($data->previous) : $this->_item_active($data->previous);\n\t\t} else {\n\t\t\t$list['previous']['active'] = false;\n\t\t\t$list['previous']['data'] = ($itemOverride) ? pagination_item_inactive($data->previous) : $this->_item_inactive($data->previous);\n\t\t}\n\n\t\t$list['pages'] = array(); //make sure it exists\n\t\tforeach ($data->pages as $i => $page)\n\t\t{\n\t\t\tif ($page->base !== null) {\n\t\t\t\t$list['pages'][$i]['active'] = true;\n\t\t\t\t$list['pages'][$i]['data'] = ($itemOverride) ? pagination_item_active($page) : $this->_item_active($page);\n\t\t\t} else {\n\t\t\t\t$list['pages'][$i]['active'] = false;\n\t\t\t\t$list['pages'][$i]['data'] = ($itemOverride) ? pagination_item_inactive($page) : $this->_item_inactive($page);\n\t\t\t}\n\t\t}\n\n\t\tif ($data->next->base !== null) {\n\t\t\t$list['next']['active'] = true;\n\t\t\t$list['next']['data'] = ($itemOverride) ? pagination_item_active($data->next) : $this->_item_active($data->next);\n\t\t} else {\n\t\t\t$list['next']['active'] = false;\n\t\t\t$list['next']['data'] = ($itemOverride) ? pagination_item_inactive($data->next) : $this->_item_inactive($data->next);\n\t\t}\n\t\tif ($data->end->base !== null) {\n\t\t\t$list['end']['active'] = true;\n\t\t\t$list['end']['data'] = ($itemOverride) ? pagination_item_active($data->end) : $this->_item_active($data->end);\n\t\t} else {\n\t\t\t$list['end']['active'] = false;\n\t\t\t$list['end']['data'] = ($itemOverride) ? pagination_item_inactive($data->end) : $this->_item_inactive($data->end);\n\t\t}\n\n\t\tif($this->total > $this->limit){\n\t\t\treturn ($listOverride) ? pagination_list_render($list) : $this->_list_render($list);\n\t\t}\n\t\telse{\n\t\t\treturn '';\n\t\t}\n\t}", "public function deleteInvalidSubjectPages() {\n\t\t\t\n\t\t\t$errors = FALSE;\n\t\t\t$error_msg = '';\n\n\t\t\t// Get page tiles\n\t\t\t$page_titles = $this->getPageTitles();\n\t\t\t\n\t\t\t// Build array of valid subject names\n\t\t\t$this->subjects = $this->getSubjects();\n\t\t\tforeach ($this->subjects as $subject) {\n\t\t\t\t$subject_names[] = $subject['Description'];\t\n\t\t\t}\n\n\t\t\t$invalid_page_names = array();\n\n\t\t\tforeach ($page_titles as $title) {\n\t\t\t\tif (!in_array($title, $subject_names)) {\n\t\t\t\t\t$invalid_page_names[] = $title;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If invalid subject pages found, remove them from the database\n\t\t\tif (count($invalid_page_names) > 0) {\n\n\t\t\t\tforeach ($invalid_page_names as $page_name) {\n\t\t\t\n\t\t\t\t\t// Delete page_structure\t\n\t\t\t\t\t$sql = new DB_Sql();\n\t\t\t\t\t$sql->connect();\n\n\t\t\t\t\t// Delete the page's structure\n\t\t\t\t\t$query = \"DELETE FROM webmatrix_structure WHERE structure_parent = \".$this->subjects_structure_id.\" AND structure_text = '$page_name'\";\n\t\t\t\t\t$sql->query($query, $this->debug);\n\t\t\t\t\tif (!$sql->num_rows_affected() > 0) {\n\t\t\t\t\t\t$errors = TRUE;\n\t\t\t\t\t\t$error_msg .= 'Could not delete page structure <br />';\n\t\t\t\t\t}\n\n\t\t\t\t\t// Delete the page\n\t\t\t\t\t$query = \"DELETE FROM webmatrix_user_pages WHERE template = \".$this->subject_tpl_id.\" AND title = '$page_name'\";\n\t\t\t\t\t$sql->query($query, $this->debug);\n\t\t\t\t\tif (!$sql->num_rows_affected() > 0) {\n\t\t\t\t\t\t$errors = TRUE;\n\t\t\t\t\t\t$error_msg .= 'Could not delete page <br />';\n\t\t\t\t\t}\n\n\t\t\t\t} // foreach\n\n\t\t\t\t// if in DEV mode, show error messages\n\t\t\t\tif ($errors && $this->debug == TRUE) {\n\t\t\t\t\techo $error_msg;\n\t\t\t\t\texit;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn $errors;\n\n\t\t}", "function mxpress_link_pages() {\r\n global $mx_state, $wp_query, $more, $post;\r\n $defaults = array(\r\n 'before' => '<p>' . __('Pages:'), 'after' => '</p>',\r\n 'link_before' => '', 'link_after' => '',\r\n 'next_or_number' => 'number', 'nextpagelink' => __('Next page'),\r\n 'previouspagelink' => __('Previous page'), 'pagelink' => '%',\r\n 'echo' => 1\r\n );\r\n\r\n $r = wp_parse_args($args, $defaults);\r\n $r = apply_filters('wp_link_pages_args', $r);\r\n extract($r, EXTR_SKIP);\r\n//var_dump($wp_query);\r\n $page = ($wp_query->query_vars['page']) ? $wp_query->query_vars['page'] : 1;\r\n $numpages = $mx_state['num_pages'];\r\n\r\n global $post;\r\n $post_id = $post->ID;\r\n $content_saved = get_post_meta($post_id, '_mxpress_content', true);\r\n if ($content_saved != '') {\r\n $content_ar = unserialize($content_saved);\r\n $numpages = count($content_ar);\r\n $multipage = true;\r\n }\r\n\r\n\t$output = '';\r\n\t\r\n\tif ($numpages > 1)\r\n\t{\t\t\r\n\t\tif ($multipage) {\r\n\t\t\tif ('number' == $next_or_number) {\r\n\t\t\t\t$output .= $before;\r\n\t\t\t\tfor ($i = 1; $i < ($numpages + 1); $i = $i + 1) {\r\n\t\t\t\t\t$j = str_replace('%', $i, $pagelink);\r\n\t\t\t\t\t$output .= ' ';\r\n\t\t\t\t\tif (($i != $page) || ((!$more) && ($page == 1))) {\r\n\t\t\t\t\t\t$output .= _wp_link_page($i);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$output .= $link_before . $j . $link_after;\r\n\t\t\t\t\tif (($i != $page) || ((!$more) && ($page == 1)))\r\n\t\t\t\t\t\t$output .= '</a>';\r\n\t\t\t\t}\r\n\t\t\t\t$output .= $after;\r\n\t\t\t} else {\r\n\t\t\t\tif ($more) {\r\n\t\t\t\t\t$output .= $before;\r\n\t\t\t\t\t$i = $page - 1;\r\n\t\t\t\t\tif ($i && $more) {\r\n\t\t\t\t\t\t$output .= _wp_link_page($i);\r\n\t\t\t\t\t\t$output .= $link_before . $previouspagelink . $link_after . '</a>';\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$i = $page + 1;\r\n\t\t\t\t\tif ($i <= $numpages && $more) {\r\n\t\t\t\t\t\t$output .= _wp_link_page($i);\r\n\t\t\t\t\t\t$output .= $link_before . $nextpagelink . $link_after . '</a>';\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$output .= $after;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ($echo)\r\n\t\t\techo $output;\r\n\t}\r\n\r\n return $output;\r\n}", "protected function createPageLinks()\n {\n $pageLinks = array();\n\n if ($this->totalPages > 10) {\n $startRange = $this->page - floor($this->range/2);\n $endRange = $this->page + floor($this->range/2);\n\n //Start range\n if ($startRange <= 0) {\n $startRange = 1;\n $endRange += abs($startRange) + 1;\n }\n\n // End range\n if ($endRange > $this->totalPages) {\n $startRange -= $endRange - $this->totalPages;\n $endRange = $this->totalPages;\n }\n\n // Range\n $range = range($startRange, $endRange);\n\n // Add first page\n $this->pageLinks[] = array(\n 'page' => 1,\n 'uri' => $this->createUri(1)\n );\n\n foreach ($range as $page) {\n // Skip for first and last page\n if ($page == 1 or $page == $this->totalPages) {\n continue;\n }\n\n $this->pageLinks[] = array(\n 'page' => $page,\n 'uri' => $this->createUri($page)\n );\n }\n\n // Add last page\n $this->pageLinks[] = array(\n 'page' => $this->totalPages,\n 'uri' => $this->createUri($this->totalPages)\n );\n } else {\n for ($i = 1; $i <= $this->totalPages; $i++) {\n $this->pageLinks[] = array(\n 'page' => $i,\n 'uri' => $this->createUri($i)\n );\n }\n }\n }" ]
[ "0.6010659", "0.5896721", "0.5698866", "0.56682277", "0.56658876", "0.5550747", "0.55059135", "0.54730123", "0.54663306", "0.5440575", "0.54390836", "0.5438898", "0.542991", "0.5418039", "0.5403084", "0.5396782", "0.53644204", "0.53427666", "0.5336459", "0.52864057", "0.52785784", "0.5254375", "0.5229799", "0.52093506", "0.5184209", "0.51801026", "0.5158871", "0.51422673", "0.51347476", "0.511911" ]
0.59011066
1
look through all files found in crawl for CSS files and parse them for images
private function parseCSS(){ // collect all unique values from the arrays in $links $css_links = array(); foreach ($this->links as $key => $paths) { foreach ($paths as $key => $value) { $css_links[] = $value; } } $css_links = array_unique($css_links); sort($css_links); // loop through all values look for files foreach ($css_links as $value) { if(count(explode('.', $value)) > 1){ $temp = explode('.', $value); $qry = false; // if a file is found, see if it has a querystring foreach ($temp as $key => $css) { if(count(explode('?', $css)) > 1){ $temp[$key] = explode('?', $css); $qry = $key; } } // if it has a query string, remove it if($qry){ $type = $temp[$qry][0]; // otherwise, just grab the extension } else { $type = count($temp); $type = $temp[$type-1]; } // check if the file extension is css if($type === 'css'){ // ensure path to file exists $path = 'http://'.$this->url.$value; if(@file_get_contents($path)){ // add file to $visited $this->visited[] = $value; // set current path for relativePathFiX() $dir = explode('/', $value); array_pop($dir); $this->current_path = implode('/', $dir).'/'; // open the file to start parsing $file = file_get_contents($path); $imgs = array(); // find all occurrences of the url() method used to include images preg_match_all("%.*url\('*(.*)[^\?]*\).*\)*%", $file, $matches); // loop through occurrences foreach ($matches[1] as $key => $img) { // check if a query string is attached to the image (used to prevent caching) if(count(explode('?', $img)) > 1){ // if there is, remove it and fix the path $temp = explode('?', $img); $imgs[] = $this->relativePathFix($temp[0]); } else { // if there isn't a query string, make sure to remove the closing bracket $temp = explode(')', $img); $imgs[] = $this->relativePathFix($temp[0]); } } // if images were found, add them to $links if(count($imgs) > 0){ $this->links[$value] = $imgs; } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findCssFiles();", "private function getImageIntoCss(): void\n {\n preg_match_all(self::REGEX_IMAGE_FORMAT, $this->sContents, $aHit, PREG_PATTERN_ORDER);\n\n for ($i = 0, $iCountHit = count($aHit[0]); $i < $iCountHit; $i++) {\n $sImgPath = PH7_PATH_ROOT . $this->sBaseUrl . $aHit[1][$i] . $aHit[2][$i];\n $sImgUrl = PH7_URL_ROOT . $this->sBaseUrl . $aHit[1][$i] . $aHit[2][$i];\n\n if ($this->isDataUriEligible($sImgPath)) {\n $this->sContents = str_replace(\n $aHit[0][$i],\n 'url(' . Optimization::dataUri($sImgPath, $this->oFile) . ')',\n $this->sContents\n );\n } else {\n $this->sContents = str_replace(\n $aHit[0][$i],\n 'url(' . $sImgUrl . ')',\n $this->sContents\n );\n }\n }\n }", "function allLoadCss($path){\n \n $diretorio = dir($path);\n\n while($arquivo = $diretorio -> read()){\n //verifica apenas as extenções do css \n if(strpos($arquivo, '.css')!==FALSE)\n echo (\"<link rel='stylesheet' href='\".BARRA.url_base.BARRA.$path.$arquivo.\"' type='text/css' />\\n\");\n }\n $diretorio -> close();\n\n }", "function ReadCSS($html)\n{\n//! @desc CSS parser\n//! @return string\n\n/*\n* This version ONLY supports: .class {...} / #id { .... }\n* It does NOT support: body{...} / a#hover { ... } / p.right { ... } / other mixed names\n* This function must read the CSS code (internal or external) and order its value inside $this->CSS. \n*/\n\n\t$match = 0; // no match for instance\n\t$regexp = ''; // This helps debugging: showing what is the REAL string being processed\n\t\n\t//CSS inside external files\n\t$regexp = '/<link rel=\"stylesheet\".*?href=\"(.+?)\"\\\\s*?\\/?>/si'; \n\t$match = preg_match_all($regexp,$html,$CSSext);\n $ind = 0;\n\n\twhile($match){\n //Fix path value\n $path = $CSSext[1][$ind];\n $path = str_replace(\"\\\\\",\"/\",$path); //If on Windows\n //Get link info and obtain its absolute path\n $regexp = '|^./|';\n $path = preg_replace($regexp,'',$path);\n if (strpos($path,\"../\") !== false ) //It is a Relative Link\n {\n $backtrackamount = substr_count($path,\"../\");\n $maxbacktrack = substr_count($this->basepath,\"/\") - 1;\n $filepath = str_replace(\"../\",'',$path);\n $path = $this->basepath;\n //If it is an invalid relative link, then make it go to directory root\n if ($backtrackamount > $maxbacktrack) $backtrackamount = $maxbacktrack;\n //Backtrack some directories\n for( $i = 0 ; $i < $backtrackamount + 1 ; $i++ ) $path = substr( $path, 0 , strrpos($path,\"/\") );\n $path = $path . \"/\" . $filepath; //Make it an absolute path\n }\n elseif( strpos($path,\":/\") === false) //It is a Local Link\n {\n $path = $this->basepath . $path; \n }\n //Do nothing if it is an Absolute Link\n //END of fix path value\n $CSSextblock = file_get_contents($path);\t\n\n //Get class/id name and its characteristics from $CSSblock[1]\n\t $regexp = '/[.# ]([^.]+?)\\\\s*?\\{(.+?)\\}/s'; // '/s' PCRE_DOTALL including \\n\n\t preg_match_all( $regexp, $CSSextblock, $extstyle);\n\n\t //Make CSS[Name-of-the-class] = array(key => value)\n\t $regexp = '/\\\\s*?(\\\\S+?):(.+?);/si';\n\n\t for($i=0; $i < count($extstyle[1]) ; $i++)\n\t {\n \t\tpreg_match_all( $regexp, $extstyle[2][$i], $extstyleinfo);\n \t\t$extproperties = $extstyleinfo[1];\n \t\t$extvalues = $extstyleinfo[2];\n \t\tfor($j = 0; $j < count($extproperties) ; $j++) \n \t\t{\n \t\t\t//Array-properties and Array-values must have the SAME SIZE!\n \t\t\t$extclassproperties[strtoupper($extproperties[$j])] = trim($extvalues[$j]);\n \t\t}\n \t\t$this->CSS[$extstyle[1][$i]] = $extclassproperties;\n\t \t$extproperties = array();\n \t\t$extvalues = array();\n \t\t$extclassproperties = array();\n \t}\n\t $match--;\n\t $ind++;\n\t} //end of match\n\n\t$match = 0; // reset value, if needed\n\n\t//CSS internal\n\t//Get content between tags and order it, using regexp\n\t$regexp = '/<style.*?>(.*?)<\\/style>/si'; // it can be <style> or <style type=\"txt/css\"> \n\t$match = preg_match($regexp,$html,$CSSblock);\n\n\tif ($match) {\n \t//Get class/id name and its characteristics from $CSSblock[1]\n \t$regexp = '/[.#]([^.]+?)\\\\s*?\\{(.+?)\\}/s'; // '/s' PCRE_DOTALL including \\n\n \tpreg_match_all( $regexp, $CSSblock[1], $style);\n\n\t //Make CSS[Name-of-the-class] = array(key => value)\n\t $regexp = '/\\\\s*?(\\\\S+?):(.+?);/si';\n\n\t for($i=0; $i < count($style[1]) ; $i++)\n\t {\n \t\tpreg_match_all( $regexp, $style[2][$i], $styleinfo);\n \t\t$properties = $styleinfo[1];\n \t\t$values = $styleinfo[2];\n \t\tfor($j = 0; $j < count($properties) ; $j++) \n \t\t{\n \t\t\t//Array-properties and Array-values must have the SAME SIZE!\n \t\t\t$classproperties[strtoupper($properties[$j])] = trim($values[$j]);\n \t\t}\n \t\t$this->CSS[$style[1][$i]] = $classproperties;\n \t\t$properties = array();\n \t\t$values = array();\n \t\t$classproperties = array();\n \t}\n\t} // end of match\n\n\t//Remove CSS (tags and content), if any\n\t$regexp = '/<style.*?>(.*?)<\\/style>/si'; // it can be <style> or <style type=\"txt/css\"> \n\t$html = preg_replace($regexp,'',$html);\n\n \treturn $html;\n}", "protected function ParseCSSFile()\n {\n $this->_stylelist=$this->BuildStyleList($this->FileName, $this->_inclstandard, $this->_inclid, $this->_incsubstyle);\n }", "public function css()\n {\n $dir = new \\Ninja\\Directory(NINJA_DOCROOT . 'public/');\n /**\n * @var $files \\Ninja\\File[]\n */\n $files = $dir->scanRecursive(\"*.css\");\n\n echo \"\\nMinifying Css Files...\\n\";\n foreach($files as $sourceFile)\n {\n // Skip all foo.#.js (e.g foo.52.js) which are files from a previous build\n if (is_numeric(substr($sourceFile->getName(true), strrpos($sourceFile->getName(true), '.') + 1)))\n continue;\n\n /**\n * @var $destFile \\Ninja\\File\n */\n $destFile = $sourceFile->getParent()->ensureFile($sourceFile->getName(true) . '.' . self::REVISION . '.' . $sourceFile->getExtension());\n\n $destFile->write(\\Minify_Css::process($sourceFile->read()));\n echo ' ' . $sourceFile->getPath() . \"\\n\";\n\n unset($sourceFile);\n }\n }", "function get_the_css_urls() {\n\n md_get_the_css_urls();\n \n }", "protected function getContentCssFileNames() {}", "protected function loadCss() {}", "public function getCSSFiles() {\n //je krijgt op het einde .. en . terug, deze mag je niet opnemen in je links\n $cssFiles = scandir(\"css\", 1);\n \n return $cssFiles;\n }", "function get_css_files() {\n\t$csslist = array();\n\n\t// List pfSense files, then any BETA files followed by any user-contributed files\n\t$cssfiles = glob(\"/usr/local/www/css/*.css\");\n\n\tif (is_array($cssfiles)) {\n\t\tarsort($cssfiles);\n\t\t$usrcss = $pfscss = $betacss = array();\n\n\t\tforeach ($cssfiles as $css) {\n\t\t\t// Don't display any login/logo page related CSS files\n\t\t\tif (strpos($css, \"login\") == 0 &&\n\t\t\t strpos($css, \"logo\") == 0) {\n\t\t\t\tif (strpos($css, \"BETA\") != 0) {\n\t\t\t\t\tarray_push($betacss, $css);\n\t\t\t\t} else if (strpos($css, \"pfSense\") != 0) {\n\t\t\t\t\tarray_push($pfscss, $css);\n\t\t\t\t} else {\n\t\t\t\t\tarray_push($usrcss, $css);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$css = array_merge($pfscss, $betacss, $usrcss);\n\n\t\tforeach ($css as $file) {\n\t\t\t$file = basename($file);\n\t\t\t$csslist[$file] = pathinfo($file, PATHINFO_FILENAME);\n\t\t}\n\t}\n\treturn $csslist;\n}", "public function crawl(){\n\t\t\t$this->collectUrls();\n\t\t}", "protected function compileCss() {\r\n\t\tif(count($this->source_files) == 0) {\r\n\t\t\tfile_put_contents($this->result_file, \"\", FILE_APPEND);\r\n\t\t} else {\r\n\t\t\tforeach($this->source_files as $src_file) {\r\n\t\t\t\tfile_put_contents($this->result_file, file_get_contents($src_file) . PHP_EOL, FILE_APPEND);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private function crawl(){\n\t\t// check if path is allowed by robots.txt\n\t\tif(!$this->robot || $this->robot->crawlAllowed($this->pages[0])){\n\t\t\t// set the file path, extract directory structure, open file\n\t\t\t$path = 'http://'.$this->url.$this->pages[0];\n\t\t\t$this->setCurrentPath();\n\t\t\t$this->doc->loadHTMLFile($path);\n\t\t\t\n\t\t\t// find all <a> tags in the page\n\t\t\t$a_tags = $this->doc->getElementsByTagName('a');\n\t\t\t$link_tags = $this->doc->getElementsByTagName('link');\n\t\t\t$script_tags = $this->doc->getElementsByTagName('script');\n\t\t\t$img_tags = $this->doc->getElementsByTagName('img');\n\t\t\t$form_tags = $this->doc->getElementsByTagName('form');\n\t\t\t// if <a> tags were found, loop through all of them\n\t\t\tif(isset($a_tags) && !is_null($a_tags)){\n\t\t\t\tforeach ($a_tags as $link) {\n\t\t\t\t\t// find the href attribute of each link\n\t\t\t\t\tforeach ($link->attributes as $attrib) {\n\t\t\t\t\t\tif(strtolower($attrib->name) == 'href'){\n\t\t\t\t\t\t\t// make sure its not external, javascript or to an anchor\n\t\t\t\t\t\t\tif(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){\n\t\t\t\t\t\t\t\t$this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value);\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}\n\t\t\t// if <link> tags were found, loop through all of them\n\t\t\tif(isset($link_tags) && !is_null($link_tags)){\n\t\t\t\tforeach ($link_tags as $link) {\n\t\t\t\t\t// find the href attribute of each link\n\t\t\t\t\tforeach ($link->attributes as $attrib) {\n\t\t\t\t\t\tif(strtolower($attrib->name) == 'href'){\n\t\t\t\t\t\t\t// make sure its not external, javascript or to an anchor\n\t\t\t\t\t\t\tif(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){\n\t\t\t\t\t\t\t\t$this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value);\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}\n\t\t\t// if <script> tags were found, loop through all of them\n\t\t\tif(isset($script_tags) && !is_null($script_tags)){\n\t\t\t\tforeach ($script_tags as $link) {\n\t\t\t\t\t// find the src attribute of each link\n\t\t\t\t\tforeach ($link->attributes as $attrib) {\n\t\t\t\t\t\tif(strtolower($attrib->name) == 'src'){\n\t\t\t\t\t\t\t// make sure its not external, javascript or to an anchor\n\t\t\t\t\t\t\tif(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){\n\t\t\t\t\t\t\t\t$this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value);\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}\n\t\t\t// if <img> tags were found, loop through all of them\n\t\t\tif(isset($img_tags) && !is_null($img_tags)){\n\t\t\t\tforeach ($img_tags as $link) {\n\t\t\t\t\t// find the src attribute of each link\n\t\t\t\t\tforeach ($link->attributes as $attrib) {\n\t\t\t\t\t\tif(strtolower($attrib->name) == 'src'){\n\t\t\t\t\t\t\t// make sure its not external, javascript or to an anchor\n\t\t\t\t\t\t\tif(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){\n\t\t\t\t\t\t\t\t$this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value);\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}\n\t\t\t// if <form> tags were found, loop through all of them\n\t\t\tif(isset($forms_tags) && !is_null($form_tags)){\n\t\t\t\tforeach ($form_tags as $link) {\n\t\t\t\t\t// find the src attribute of each link\n\t\t\t\t\tforeach ($link->attributes as $attrib) {\n\t\t\t\t\t\tif(strtolower($attrib->name) == 'action'){\n\t\t\t\t\t\t\t// make sure its not external, javascript or to an anchor\n\t\t\t\t\t\t\tif(count(explode(':', $attrib->value)) < 2 && count(explode('#', $attrib->value)) < 2){\n\t\t\t\t\t\t\t\t$this->links[$this->pages[0]][] = $this->relativePathFix($attrib->value);\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}\n\t\t}\n\t\t// merge and sort all arrays\n\t\t$this->arrayShuffle();\n\t}", "protected function doCompressCss() {}", "function ReadCSS($html)\r\n{\r\n//! @desc CSS parser\r\n//! @return string\r\n\r\n/*\r\n* This version ONLY supports: .class {...} / #id { .... }\r\n* It does NOT support: body{...} / a#hover { ... } / p.right { ... } / other mixed names\r\n* This function must read the CSS code (internal or external) and order its value inside $this->CSS. \r\n*/\r\n\r\n\t$match = 0; // no match for instance\r\n\t$regexp = ''; // This helps debugging: showing what is the REAL string being processed\r\n\t\r\n\t//CSS external\r\n\t$regexp = '/<link rel=\"stylesheet\".*?href=\"(.+?)\"\\\\s*?\\/?>/si';\r\n\t$match = preg_match_all($regexp,$html,$CSSext);\r\n $ind = 0;\r\n\r\n\twhile($match) {\r\n\t$file = fopen($CSSext[1][$ind],\"r\");\r\n\t$CSSextblock = fread($file,filesize($CSSext[1][$ind]));\r\n\tfclose($file);\r\n\r\n\t//Get class/id name and its characteristics from $CSSblock[1]\r\n\t$regexp = '/[.# ]([^.]+?)\\\\s*?\\{(.+?)\\}/s'; // '/s' PCRE_DOTALL including \\n\r\n\tpreg_match_all( $regexp, $CSSextblock, $extstyle);\r\n\r\n\t//Make CSS[Name-of-the-class] = array(key => value)\r\n\t$regexp = '/\\\\s*?(\\\\S+?):(.+?);/si';\r\n\r\n\tfor($i=0; $i < count($extstyle[1]) ; $i++)\r\n\t{\r\n\t\tpreg_match_all( $regexp, $extstyle[2][$i], $extstyleinfo);\r\n\t\t$extproperties = $extstyleinfo[1];\r\n\t\t$extvalues = $extstyleinfo[2];\r\n\t\tfor($j = 0; $j < count($extproperties) ; $j++) \r\n\t\t{\r\n\t\t\t//Array-properties and Array-values must have the SAME SIZE!\r\n\t\t\t$extclassproperties[strtoupper($extproperties[$j])] = trim($extvalues[$j]);\r\n\t\t}\r\n\t\t$this->CSS[$extstyle[1][$i]] = $extclassproperties;\r\n\t\t$extproperties = array();\r\n\t\t$extvalues = array();\r\n\t\t$extclassproperties = array();\r\n\t}\r\n\t$match--;\r\n\t$ind++;\r\n\t} //end of match\r\n\r\n\t$match = 0; // reset value, if needed\r\n\r\n\t//CSS internal\r\n\t//Get content between tags and order it, using regexp\r\n\t$regexp = '/<style.*?>(.*?)<\\/style>/si'; // it can be <style> or <style type=\"txt/css\">\r\n\t$match = preg_match($regexp,$html,$CSSblock);\r\n\r\n\tif ($match) {\r\n\t//Get class/id name and its characteristics from $CSSblock[1]\r\n\t$regexp = '/[.#]([^.]+?)\\\\s*?\\{(.+?)\\}/s'; // '/s' PCRE_DOTALL including \\n\r\n\tpreg_match_all( $regexp, $CSSblock[1], $style);\r\n\r\n\t//Make CSS[Name-of-the-class] = array(key => value)\r\n\t$regexp = '/\\\\s*?(\\\\S+?):(.+?);/si';\r\n\r\n\tfor($i=0; $i < count($style[1]) ; $i++)\r\n\t{\r\n\t\tpreg_match_all( $regexp, $style[2][$i], $styleinfo);\r\n\t\t$properties = $styleinfo[1];\r\n\t\t$values = $styleinfo[2];\r\n\t\tfor($j = 0; $j < count($properties) ; $j++) \r\n\t\t{\r\n\t\t\t//Array-properties and Array-values must have the SAME SIZE!\r\n\t\t\t$classproperties[strtoupper($properties[$j])] = trim($values[$j]);\r\n\t\t}\r\n\t\t$this->CSS[$style[1][$i]] = $classproperties;\r\n\t\t$properties = array();\r\n\t\t$values = array();\r\n\t\t$classproperties = array();\r\n\t}\r\n\r\n\t} // end of match\r\n\r\n //print_r($this->CSS);// Important debug-line!\r\n\r\n\t//Remove CSS (tags and content), if any\r\n\t$regexp = '/<style.*?>(.*?)<\\/style>/si'; // it can be <style> or <style type=\"txt/css\">\r\n\t$html = preg_replace($regexp,'',$html);\r\n\r\n \treturn $html;\r\n}", "protected function _getFromCSS()\n {\n // styles to apply\n $styles = array();\n\n // list of the selectors to get in the CSS files\n $getit = array();\n\n // get the list of the selectors of each tags\n $lst = array();\n $lst[] = $this->value['id_lst'];\n for ($i=count($this->table)-1; $i>=0; $i--) {\n $lst[] = $this->table[$i]['id_lst'];\n }\n\n // foreach selectors in the CSS files, verify if it match with the list of selectors\n foreach ($this->cssKeys as $key => $num) {\n if ($this->_getReccursiveStyle($key, $lst)) {\n $getit[$key] = $num;\n }\n }\n\n // if we have selectors\n if (count($getit)) {\n // get them, but in the definition order, because of priority\n asort($getit);\n foreach ($getit as $key => $val) $styles = array_merge($styles, $this->css[$key]);\n }\n\n return $styles;\n }", "protected function pvs_fetch_css($strextraction,&$strouthtml, $iscss, $cssfile=''){\n\t\tif (($this->selectedpics < $this->conf['attachments.']['webpagePreviewNumberOfImages']) || ($this->logofound == FALSE)) {\n\t\t\t$strouthtml.='<div class=\"cssfiles\">';\n\t\t\t$cssfiles = array();\n\t\t\t$k = 0;\n\t\t\t$strouthtmlcss= array();\n\t\t\t$cssfilerelpath='';\n\t\t\tif ($iscss==TRUE) {\n\t\t\t\t$cssfilebits=explode('/', $cssfile);\n\t\t\t\t$cssfilebits[count($cssfilebits)-1] = '';\n\t\t\t\t$cssfilepath=implode('/', $cssfilebits);\n\t\t\t\t$cssfilerelpatharr=explode('/', $cssfilepath);\n\t\t\t\t$cssfilerelpatharr[0]='';\n\t\t\t\t$cssfilerelpath='';\n\t\t\t\t$sizeofcssfilerelpatharr=sizeof($cssfilerelpatharr);\n\t\t\t\tfor($i = 0; $i < $sizeofcssfilerelpatharr; $i++) {\n\n\t\t\t\t\tif (($cssfilerelpatharr[$i] !='') && ($cssfilerelpatharr[$i] !=$this->urlsitestr)) {\n\t\t\t\t\t\t$cssfilerelpath.=$cssfilerelpatharr[$i].'/';\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\t$cssfilepath=$this->urlhomearrstr;\n\t\t\t}\n\n\t\t\t// handling of redirected subdirs\n\t\t\tif ($this->urlsubpath!=''){\n\t\t\t\tif (strpos($cssfilepath, $this->urlsubpath)===FALSE) {\n\t\t\t\t\t$cssfilepath=$cssfilepath . $this->urlsubpath;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// handling of redirected subdirs end\n\n\t\t\t// fetch css\n\t\t\t$css_regex = '/import[^;]*' . 'url\\([\\\"|\\'](.*)[\\\"|\\']/Ui';\n\t\t\tpreg_match_all($css_regex, $strextraction, $cssarr, PREG_PATTERN_ORDER);\n\t\t\t$css_array = $cssarr[1];\n\t\t\t$sizeofcss_array=sizeof($css_array);\n\t\t\tfor($i = 0; $i < $sizeofcss_array; $i++) {\n\t\t\t\tif ($css_array[$i]) {\n\t\t\t\t\tif (substr($css_array[$i], 0, 1)=='/') {\n\t\t\t\t\t\t$css_array[$i]=trim(substr($css_array[$i], 1, 2000));\n\t\t\t\t\t}\n\n\t\t\t\t\t$css_arraybits=explode('.', $css_array[$i]);\n\t\t\t\t\tif ($css_arraybits[count($css_arraybits)-1]=='css') {\n\t\t\t\t\t\tif (strstr($css_array[$i], 'http')) {\n\t\t\t\t\t\t\t$strouthtmlcss[$k]='<p id=\"css'. $k . '\">' . $css_array[$i] . '</p>';\n\t\t\t\t\t\t\t$cssfiles[$k]=$css_array[$i];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$css_array[$i]=str_replace($cssfilerelpath, '', $css_array[$i]);\n\t\t\t\t\t\t\t$strouthtmlcss[$k]='<p id=\"css'. $k . '\">' . $cssfilepath . $css_array[$i] . '</p>';\n\t\t\t\t\t\t\t$cssfiles[$k]=$cssfilepath . $css_array[$i];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$k++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t$sizeofcss_array=sizeof($css_array);\n\t\t\t}\n \t\t$css_regex = '/<link[^>]*' . 'href=[\\\"|\\'](.*)[\\\"|\\']/Ui';\n\t\t\tpreg_match_all($css_regex, $strextraction, $cssarr, PREG_PATTERN_ORDER);\n\t\t\t$css_array = $cssarr[1];\n\t\t\t$sizeofcss_array2=sizeof($css_array);\n\t\t\tfor($i = 0; $i < $sizeofcss_array2; $i++) {\n\t\t\t\tif ($css_array[$i]) {\n\t\t\t\t\tif (substr($css_array[$i], 0, 1)=='/') {\n\t\t\t\t\t\t$css_array[$i]=trim(substr($css_array[$i], 1, 2000));\n\t\t\t\t\t}\n\n\t\t\t\t\t$css_arraybits=explode('.', $css_array[$i]);\n\t\t\t\t\tif ($css_arraybits[count($css_arraybits)-1]=='css') {\n\t\t\t\t\t\tif (strstr($css_array[$i], 'http')) {\n\t\t\t\t\t\t\t$strouthtmlcss[$k]='<p id=\"css'. $k . '\">' . $css_array[$i] . '</p>';\n\t\t\t\t\t\t\t$cssfiles[$k]=$css_array[$i];\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$css_array[$i]=str_replace($cssfilerelpath, '', $css_array[$i]);\n\t\t\t\t\t\t\t$strouthtmlcss[$k]='<p id=\"css'. $k . '\">' . $cssfilepath . $css_array[$i] . '</p>';\n\t\t\t\t\t\t\t$cssfiles[$k]=$cssfilepath . $css_array[$i];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$k++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t$sizeofcss_array2=sizeof($css_array);\n\t\t\t}\n\n\t\t\t$sizeofcssfiles=sizeof($cssfiles);\n\t\t\tfor($i = 0; $i < $sizeofcssfiles; $i++) {\n\t\t\t\tif (array_search($cssfiles[$i], $this->css_array) ==FALSE ) {\n\t\t\t\t\tif (($this->selectedpics < $this->conf['attachments.']['webpagePreviewNumberOfImages']) || ($this->logofound == FALSE)) {\n\t\t\t\t\t\t$htmlcss = $this->file_pvs_get_contents_curl($cssfiles[$i], 'css');\n\t\t\t\t\t\tif ($htmlcss != FALSE) {\n\t\t\t\t\t\t\t$images_arraycss=$this->pvs_fetch_images ($htmlcss, TRUE, $cssfiles[$i]);\n\t\t\t\t\t\t\t$this->images_array=array_merge($this->images_array, $images_arraycss);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$i=999999;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t$sizeofcssfiles=sizeof($cssfiles);\n\t\t\t}\n\n\t\t\t$strouthtml.= '</div>';\n\t\t\treturn $cssfiles;\n\t\t}\n\n\t}", "private function load_css () {\n $buffer = '';\n if (count($this->css_files)) {\n foreach ($this->css_files as $file) {\n $file = explode('/', $file);\n // TODO: use $this->config->item('modules_locations') for modules path\n $file = 'application/modules/'.$file[0].'/views/'.$this->get_skin().'/skin/'.implode('/',array_slice($file, 1));\n $buffer .= \"\\n\".'<link rel=\"stylesheet\" href=\"'.base_url($file).'\">';\n }\n return $buffer.\"\\n\";\n } else {\n return \"\\n\";\n }\n }", "function css($filename){\n\t\t// If its an array we have to load separately.\n\t\tif(is_array($filename)){\n\t\t\tforeach($filename as $file){\n\t\t\t\t// Calls recursively this function for each file\n\t\t\t\t// on the received array.\n\t\t\t\t$this->css($file);\n\t\t\t}\n\t\t} else {\n\t\t\tif($file = $this->_has_extension($filename)){\n\t\t\t\tarray_pop($file);\n\t\t\t\t$this->css[] = implode('.', $file);\n\t\t\t} else {\n\t\t\t\t$this->css[] = $filename;\n\t\t\t}\n\t\t}\n\t}", "function get_css_files_media_array();", "static public function extract_css( $content ) {\n\t\t$content = preg_replace( '~<!--.*?-->~s', '', $content );\n\n\t\t$tags_files = array();\n\n\t\t$matches = null;\n\t\tif ( preg_match_all( '~<link\\s+([^>]+)/?>(.*</link>)?~Uis', $content,\n\t\t\t\t$matches, PREG_SET_ORDER ) ) {\n\t\t\tforeach ( $matches as $match ) {\n\t\t\t\t$attrs = array();\n\t\t\t\t$attr_matches = null;\n\t\t\t\tif ( preg_match_all( '~(\\w+)=[\"\\']([^\"\\']*)[\"\\']~', $match[1],\n\t\t\t\t\t\t$attr_matches, PREG_SET_ORDER ) ) {\n\t\t\t\t\tforeach ( $attr_matches as $attr_match ) {\n\t\t\t\t\t\t$attrs[$attr_match[1]] = trim( $attr_match[2] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( isset( $attrs['href'] ) && isset( $attrs['rel'] ) &&\n\t\t\t\t\tstristr( $attrs['rel'], 'stylesheet' ) !== false &&\n\t\t\t\t\t( !isset( $attrs['media'] ) || stristr( $attrs['media'], 'print' ) === false ) ) {\n\t\t\t\t\t$tags_files[] = array( $match[0], $attrs['href'] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif ( preg_match_all( '~@import\\s+(url\\s*)?\\(?[\"\\']?\\s*([^\"\\'\\)\\s]+)\\s*[\"\\']?\\)?[^;]*;?~is',\n\t\t\t\t$content, $matches, PREG_SET_ORDER ) ) {\n\t\t\tforeach ( $matches as $match )\n\t\t\t\t$tags_files[] = array( $match[0], $match[2] );\n\t\t}\n\n\t\treturn $tags_files;\n\t}", "private function maybe_parse_set_from_css() {\n\n\t\t\tif ( true !== $this->settings['auto_parse'] || empty( $this->settings['icon_data']['icon_css'] ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tob_start();\n\n\t\t\t$path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $this->settings['icon_data']['icon_css'] );\n\t\t\tif ( file_exists( $path ) ) {\n\t\t\t\tinclude $path;\n\t\t\t}\n\n\t\t\t$result = ob_get_clean();\n\n\t\t\tpreg_match_all( '/\\.([-_a-zA-Z0-9]+):before[, {]/', $result, $matches );\n\n\t\t\tif ( ! is_array( $matches ) || empty( $matches[1] ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( is_array( $this->settings['icon_data']['icons'] ) ) {\n\t\t\t\t$this->settings['icon_data']['icons'] = array_merge(\n\t\t\t\t\t$this->settings['icon_data']['icons'],\n\t\t\t\t\t$matches[1]\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t$this->settings['icon_data']['icons'] = $matches[1];\n\t\t\t}\n\n\t\t}", "public function addCSSFiles($css /* array */);", "private function pvs_fetch_images($strextraction, $iscss, $cssfile=''){\n\t\t// fetch images\n\t\t$this->idcounter +=1;\n\t\t$img=array();\n\t\tif ($iscss==TRUE) {\n\t\t\t$img[1]=array();\n\t\t\t$strextractionarr= explode('url(', $strextraction);\n\t\t\t$j=0;\n\t\t\t$countstrextractionarr = count($strextractionarr);\n\t\t\tif ($countstrextractionarr > 0) {\n\t\t\t\tfor($i = 1; $i < $countstrextractionarr; $i++) {\n\t\t\t\t\t$strextractionarr2= explode(')', $strextractionarr[$i]);\n\t\t\t\t\t$strextractionarrcand=$strextractionarr2[0];\n\t\t\t\t\t$strextractionarrcand=str_replace('\"', '', $strextractionarrcand);\n\t\t\t\t\t$strextractionarrcand=str_replace(\"'\", '', $strextractionarrcand);\n\t\t\t\t\tif (!strstr($strextractionarrcand, '.css'))\t{\n\t\t\t\t\t\t$img[1][$j]=$strextractionarrcand;\n\t\t\t\t\t\t$j++;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t$cssfilebits=explode('/', $cssfile);\n\t\t\t$cssfilebits[count($cssfilebits)-1] = '';\n\t\t\t$cssfilepath=implode('/', $cssfilebits);\n\t\t\t$cssfilerelpatharr=explode('/', $cssfilepath);\n\t\t\t$cssfilerelpatharr[0]='';\n\t\t\t$cssfilerelpath='';\n\t\t\t$sizeofcssfilerelpatharr=sizeof($cssfilerelpatharr);\n\t\t\tfor($i = 0; $i < $sizeofcssfilerelpatharr; $i++) {\n\t\t\t\tif (($cssfilerelpatharr[$i] !='') && ($cssfilerelpatharr[$i] !=$this->urlsitestr)) {\n\t\t\t\t\t$cssfilerelpath.=$cssfilerelpatharr[$i].'/';\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\t\t\t$image_regex = '/<img[^>]*' . 'src=[\\\"|\\'](.*)[\\\"|\\']/Ui';\n\t\t\t$cssfilepath='';\n\t\t\tpreg_match_all($image_regex, $strextraction, $img, PREG_PATTERN_ORDER);\n\t\t}\n\n\t\t// handling of redirected subdirs\n\t\tif ($this->urlsubpath!=''){\n\t\t\tif (strpos($cssfilepath, $this->urlsubpath)===FALSE) {\n\t\t\t\t$cssfilepath=$cssfilepath . $this->urlsubpath;\n\t\t\t}\n\n\t\t}\n\n\t\t// handling of redirected subdirs end\n\t\t$images_array = array();\n\t\t$j = 0;\n\t\t$countimg1=count($img[1]);\n\t\tfor($i = 0; $i < $countimg1; $i++) {\n\t\t\tif (!strstr($img[1][$i], '.css'))\t{\n\t\t\t\t$imgfilenamearr= explode('/', $img[1][$i]);\n\t\t\t\t$imgfilename=$imgfilenamearr[count($imgfilenamearr)-1];\n\t\t\t\t$imgfilenamearr= explode('.', $imgfilename);\n\t\t\t\t$imgfilename=$imgfilenamearr[0];\n\n\t\t\t\t$hit=$this->checkimagepattern($imgfilename);\n\t\t\t\tif ($hit<2) {\n\t\t\t\t\t$images_array[$j] =$img[1][$i];\n\t\t\t\t\t$j++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t$images_arrayout = array();\n\n\t\t$images_array_unique=array_unique($images_array);\n\t\t$k = 1;\n\t\tif (($this->selectedpics < $this->conf['attachments.']['webpagePreviewNumberOfImages']) || ($this->logofound == FALSE)) {\n\t\t\t$countimages_array=count($images_array);\n\t\t\tfor($i = 0; $i < $countimages_array; $i++) {\n\n\t\t\t\tif (isset($images_array_unique[$i])) {\n\t\t\t\t\tif ($images_array_unique[$i] != '') {\n\t\t\t\t\t\tif (strstr($images_array_unique[$i], 'http')) {\n\t\t\t\t\t\t\t$images_arrayout[$i]=$images_array_unique[$i];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif ($iscss==TRUE) {\n\t\t\t\t\t\t\t\t$images_array_unique[$i]=str_replace($cssfilerelpath, '', $images_array_unique[$i]);\n\t\t\t\t\t\t\t\tif (substr($images_array_unique[$i], 0, 1)=='/') {\n\t\t\t\t\t\t\t\t\t$images_arrayout[$i]=$this->urlhomearrstr . $images_array_unique[$i];\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$images_arrayout[$i]=$cssfilepath . $images_array_unique[$i];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// handling of redirected subdirs\n\t\t\t\t\t\t\t\tif ($this->urlsubpath!=''){\n\t\t\t\t\t\t\t\t\tif (strpos(($this->urlhomearrstr . $images_array_unique[$i]), $this->urlsubpath)===FALSE) {\n\t\t\t\t\t\t\t\t\t\t$cssfilepath=$this->urlhomearrstr . $this->urlsubpath . $images_array_unique[$i];\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t$cssfilepath=$this->urlhomearrstr . $images_array_unique[$i];\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t$cssfilepath=$this->urlhomearrstr . $images_array_unique[$i];\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// handling of redirected subdirs end\n\t\t\t\t\t\t\t\t$images_arrayout[$i]=$cssfilepath;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$cssfilebits=explode('.', $images_arrayout[$i]);\n\t\t\t\t\t\t$extpic = $cssfilebits[count($cssfilebits)-1];\n\t\t\t\t\t\t$arrwrk = array();\n\t\t\t\t\t\t$arrwrk=explode('//', $images_arrayout[$i]);\n\t\t\t\t\t\tif (count($arrwrk)>1) {\n\t\t\t\t\t\t\t$arrwrkout='';\n\t\t\t\t\t\t\t$countarrwrk=count($arrwrk);\n\t\t\t\t\t\t\tfor($i2 = 0; $i2 < $countarrwrk; $i2++) {\n\t\t\t\t\t\t\t\tif ($i2==0) {\n\t\t\t\t\t\t\t\t\t$arrwrkout=$arrwrk[$i2] . '//';\n\t\t\t\t\t\t\t\t} elseif ($i2==count($arrwrk)-1) {\n\t\t\t\t\t\t\t\t\t$arrwrkout .=$arrwrk[$i2];\n\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t$arrwrkout .=$arrwrk[$i2] . '/';\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$images_arrayout[$i]=$arrwrkout;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$filename=$this->saveAndResize($images_arrayout[$i], 50, 50, '/' . $this->savepath .'temp/temp .' . $extpic, $extpic);\n\n\t\t\t\t\t\tif ($filename) {\n\t\t\t\t\t\t\t$k++;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->totalpicscans +=1;\n\t\t\t\t\t\tif (($this->selectedpics > $this->conf['attachments.']['webpagePreviewNumberOfImages']) && (($this->logofound == TRUE) ||\n\t\t\t\t\t\t\t\t(($this->selectedpics > $this->conf['attachments.']['webpagePreviewNumberOfImages']) && ($this->logofound == FALSE) &&\n\t\t\t\t\t\t\t\t\t\t($this->totalpicscans > $this->conf['attachments.']['webpagePreviewScanMaxImageScan'])))) {\n\t\t\t\t\t\t\tif ($this->totalpicscans > $this->conf['attachments.']['webpagePreviewScanMaxImageScansForLogo']) {\n\t\t\t\t\t\t\t\t$i=999999;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif ($this->totalpicscans > $this->conf['attachments.']['webpagePreviewScanMaxImageScansForLogo']) {\n\t\t\t\t\t\t\t\t$i=999999;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t$this->totalcounter +=$k-1;\n\t\t}\n\n\t\treturn $images_arrayout;\n\t}", "public function get_css_files()\n\t{\n\t\treturn $this->_css_files;\n\t}", "protected function getSubCssFile(): void\n {\n preg_match_all(self::REGEX_CSS_IMPORT_FORMAT, $this->sContents, $aHit, PREG_PATTERN_ORDER);\n\n for ($i = 0, $iCountHit = count($aHit[0]); $i < $iCountHit; $i++) {\n $this->sContents = str_replace($aHit[0][$i], '', $this->sContents);\n $this->sContents .= File::EOL . $this->oFile->getUrlContents($aHit[1][$i] . $aHit[2][$i]);\n }\n }", "protected function generateCSS() {}", "function src_inc_list_css(string $assets_url, array $files) : string {\n $source = \"\";\n\n //Process the list of files\n foreach($files as $file){\n $source .= src_inc_css($assets_url.$file).\"\\n\\t\\t\";\n }\n\n return $source;\n}", "protected function parseThemes()\n {\n foreach ($this->themesDirs as $dir) {\n $absDir = $this->fileLocator->locate($dir);\n $finder = Finder::create()->files()->in($absDir)->name('*.css');\n foreach ($finder as $file) {\n $this->addTheme($file->getBasename('.css'), $file->getPathname());\n }\n }\n #save to cache if env prod\n if ($this->env == 'prod') {\n $this->cacheDriver->save(static::CACHE_THEMES_NAME, $this->getThemes());\n }\n }" ]
[ "0.7313089", "0.682833", "0.67335427", "0.6691646", "0.6673036", "0.6495293", "0.6486712", "0.6344852", "0.6308274", "0.6184599", "0.6152373", "0.6046938", "0.60176307", "0.5997407", "0.59607375", "0.5951366", "0.5904705", "0.58877546", "0.5876533", "0.58764654", "0.5857931", "0.5838931", "0.57583994", "0.57281893", "0.5723512", "0.5710182", "0.5707117", "0.56960505", "0.5693965", "0.569117" ]
0.80734646
0
Create the structure for the displayed month
function mkMonth ($month) { $head = "<div class='fullwidth'>"; $head .= "<div class='month'>"; $head .= date("F", mktime(0,0,0,$month)); $head .= "</div>"; $head .= "<div id='jresult'>"; $head .= "</div>"; $head .= "<div id='week'>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Sunday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Monday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Tuesday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Wednesday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Thursday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Friday"; $head .= "</td>"; $head .= "</table>"; $head .= "<table class='days'>"; $head .= "<td>"; $head .= "Saturday"; $head .= "</td>"; $head .= "</table>"; $head .= "</div>"; echo $head; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function monthCreator($from,$to){\n\n$month='';\nforeach (h_many_M($from,$to) as $i) {\n\n$d = DateTime::createFromFormat('!m', $i);\n$m = $d->format('F').' '.$i;\n\n $month.=' \n<th class=\"planning_head_month\" colspan=\"28\">'.$m.'</th>\n ';\n}\necho $month;\n}", "public function get_month_permastruct()\n {\n }", "public function month_list()\n\t{\n\t\t// -------------------------------------\n\t\t// Load 'em up\n\t\t// -------------------------------------\n\n\t\t$this->load_calendar_datetime();\n\t\t$this->load_calendar_parameters();\n\n\t\t// -------------------------------------\n\t\t// Prep the parameters\n\t\t// -------------------------------------\n\n\t\t$params = array(\n\t\t\tarray(\n\t\t\t\t'name'\t\t=> 'date_range_start',\n\t\t\t\t'required'\t=> FALSE,\n\t\t\t\t'type'\t\t=> 'date',\n\t\t\t\t'default'\t=> 'year-01-01'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name'\t\t=> 'date_range_end',\n\t\t\t\t'required'\t=> FALSE,\n\t\t\t\t'type'\t\t=> 'date'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'name'\t\t=> 'limit',\n\t\t\t\t'required'\t=> FALSE,\n\t\t\t\t'type'\t\t=> 'integer',\n\t\t\t\t'default'\t=> 12\n\t\t\t)\n\t\t);\n\n//ee()->TMPL->log_item('Calendar: Processing parameters');\n\n\t\t$this->add_parameters($params);\n\n\t\t$today = $this->CDT->date_array();\n\n\t\t$this->CDT->change_ymd($this->P->value('date_range_start', 'ymd'));\n\t\t$this->CDT->set_default($this->CDT->datetime_array());\n\n\t\tif ($this->P->value('date_range_end') === FALSE)\n\t\t{\n\t\t\t$this->P->set(\n\t\t\t\t'date_range_end',\n\t\t\t\t$this->CDT->add_month($this->P->value('limit'))\n\t\t\t);\n\n\t\t\t$this->CDT->reset();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->P->set('limit', 9999);\n\t\t}\n\n\t\t$dir = (\n\t\t\t$this->P->value('date_range_end', 'ymd') >\n\t\t\t\t$this->P->value('date_range_start', 'ymd')\n\t\t) ? 1 : -1;\n\n\t\t$output = '';\n\t\t$count = 0;\n\n//ee()->TMPL->log_item('Calendar: Looping');\n\n\t\tdo\n\t\t{\n\t\t\t$vars['conditional']\t= array(\n\t\t\t\t'is_current_month'\t\t=>\t(\n\t\t\t\t\t$this->CDT->year == $today['year'] AND\n\t\t\t\t\t$this->CDT->month == $today['month']\n\t\t\t\t),\n\t\t\t\t'is_not_current_month'\t=>\t(\n\t\t\t\t\t$this->CDT->year == $today['year'] AND\n\t\t\t\t\t$this->CDT->month == $today['month']\n\t\t\t\t) ? FALSE : TRUE,\n\t\t\t\t'is_current_year'\t\t=>\t(\n\t\t\t\t\t$this->CDT->year == $today['year']\n\t\t\t\t) ? TRUE : FALSE,\n\t\t\t\t'is_not_current_year'\t=>\t(\n\t\t\t\t\t$this->CDT->year == $today['year']\n\t\t\t\t) ? FALSE : TRUE\n\t\t\t);\n\n\t\t\t$vars['single']\t= array(\n\t\t\t\t'year'\t=> $this->CDT->year,\n\t\t\t\t'month'\t=> $this->CDT->month\n\t\t\t);\n\n\t\t\t$vars['date']\t= array(\n\t\t\t\t'month'\t\t\t=> $this->CDT->datetime_array(),\n\t\t\t\t'date'\t\t\t=> $this->CDT->datetime_array(),\n\t\t\t);\n\n\t\t\t$output .= $this->swap_vars($vars, ee()->TMPL->tagdata);\n\t\t\t$this->CDT->add_month($dir);\n\t\t\t$count++;\n\t\t}\n\t\twhile (\n\t\t\t$count < $this->P->value('limit') AND\n\t\t\t$this->CDT->ymd < $this->P->value('date_range_end', 'ymd')\n\t\t);\n\n\t\treturn $output;\n\t}", "public static function create($month, $year){\n\t\t$calendar = array(array());\n\t\t$cal_size = 0;\n\t\t$week = 0;\n\t\t$cell = 1;\n\t\t$month_name = \"\";\n\t\t\n\t\t//Creamos el arreglo Calendario\n\t\t$calendar = self::create_calendar($month,$year,$calendar);\n\t // Longitud del Calendario incluyendo espacios en blanco, con llamada recursiva para que sea completo;\n\t\t// Al ser recursivo nos suma tambien los renglones que son los arrays padres de las celdas, entonces restamos\n\t\t$cal_size =\tcount($calendar,COUNT_RECURSIVE) - count($calendar); \n\t\t//Imprime $month and $year\n\t\tswitch ($month) { // Obtenemos el nombre en castellano del mes\n\t\t\tcase 1 : $month_name = \"ENERO\";\n\t\t\t\tbreak;\n\t\t\tcase 2 : $month_name = \"FEBRERO\";\n\t\t\t\tbreak;\n\t\t\tcase 3 : $month_name = \"MARZO\";\n\t\t\t\tbreak;\n\t\t\tcase 4 : $month_name = \"ABRIL\";\n\t\t\t\tbreak;\n\t\t\tcase 5 : $month_name = \"MAYO\";\n\t\t\t\tbreak;\n\t\t\tcase 6 : $month_name = \"JUNIO\";\n\t\t\t\tbreak;\n\t\t\tcase 7 : $month_name = \"JULIO\";\n\t\t\t\tbreak;\n\t\t\tcase 8 : $month_name = \"AGOSTO\";\n\t\t\t\tbreak;\n\t\t\tcase 9 : $month_name = \"SEPTIEMBRE\";\n\t\t\t\tbreak;\n\t\t\tcase 10 : $month_name = \"OCTUBRE\";\n\t\t\t\tbreak;\n\t\t\tcase 11 : $month_name = \"NOVIEMBRE\";\n\t\t\t\tbreak;\n\t\t\tcase 12 : $month_name = \"DICIEMBRE\";\n\t\t\t\n\t\t}\n\t\t//Creamos las celdas de los dias de la semana\n\t\twhile ($cell <= $cal_size){\n\t\t\tself::$html .= \"<tr>\";\n\t\t\tfor ($day=0;$day<7;$day++){\n\t\t\t\tif ($calendar[$week][$day]!=0){\n\t\t\t\t\tself::$html .= \"<td>\".$calendar[$week][$day].\"</td>\";\n\t\t\t\t} else { self::$html .= \"<td></td>\"; }\n\t\t\t\t$cell++;\n\t\t\t}\n\t\t\t$week++;\n\t\t\tself::$html .= \"</tr>\";\n\t\t}\n\t\tself::$html .= \"<tr><th colspan='7'>\".$month_name.\" \".$year.\"</th></tr>\";\n\n\t\treturn self::$html;\n\t}", "private function Write_Monthly_Table() {\n\t\t$top = 445 + self::VERT_MARGIN;\n\t\t$left = self::HORZ_MARGIN;\n\t\t$label_width = 160;\n\t\t$table_left = $left + $label_width;\n\t\t$cell_width = 55;\n\t\t$row_height = 8.5;\n\t\t\n\t\t/**\n\t\t * Build label backgrounds\n\t\t */\n\t\t$this->pdf->setcolor('fill', 'gray', 0.75, 0, 0, 0);\n\t\t$this->Rect_TL($left, $top, $label_width + ($cell_width * 1), $row_height);\n\t\t$this->pdf->fill();\n\t\t\n\t\t/**\n\t\t * Add the strokes\n\t\t */\n\t\t$this->Rect_TL($table_left, $top, $cell_width, $row_height);\n\t//\t$this->Rect_TL($table_left + ($cell_width * 1), $top, $cell_width, $row_height);\n\t//\t$this->Rect_TL($table_left + ($cell_width * 2), $top, $cell_width, $row_height);\n\t\t$this->pdf->stroke();\n\t\t\n\t\t/**\n\t\t * Add the labels\n\t\t */\n\t\t$this->Text_TL(\"CURRENT PERIOD\",\n\t\t\t$left, $top, \n\t\t\t$label_width, $row_height,\n\t\t\t\"{$this->formats['BOLD_FONT']} {$this->formats['ITALICS']} {$this->formats['LEFT']}\");\n\t\t\n\t\t$this->Text_TL(\"PERIOD\",\n\t\t\t$table_left, $top, \n\t\t\t$cell_width, $row_height,\n\t\t\t\"{$this->formats['BOLD_FONT']} {$this->formats['ITALICS']} {$this->formats['CENTER']}\");\n\t\t\n\t\t/*$this->Text_TL(\"WEEK\",\n\t\t\t$table_left + ($cell_width * 1), $top, \n\t\t\t$cell_width, $row_height,\n\t\t\t\"{$this->formats['BOLD_FONT']} {$this->formats['ITALICS']} {$this->formats['CENTER']}\");\n\t\t\n\t\t$this->Text_TL(\"MONTH\",\n\t\t\t$table_left + ($cell_width * 2), $top, \n\t\t\t$cell_width, $row_height,\n\t\t\t\"{$this->formats['BOLD_FONT']} {$this->formats['ITALICS']} {$this->formats['CENTER']}\");*/\n\t\t\t\n\t\t$current_row = 1;\n\t\t$totals = array(\n\t\t\t'weekly' => 0,\n\t\t\t'biweekly' => 0,\n\t\t\t'semimonthly' => 0,\n\t\t\t'monthly' => 0,\n\t\t);\n\t\tforeach ($this->data['period'] as $label => $values) {\n\t\t\t/**\n\t\t\t * Special processing\n\t\t\t */\n\t\t\tswitch ($label) {\n\t\t\t\tcase 'nsf$':\n\t\t\t\t\tcontinue 2;\n\t\t\t\tcase 'debit returns':\n//\t\t\t\t\t$this->pdf->setcolor('fill', 'rgb', 1, 1, 176/255, 0);\n//\t\t\t\t\t$this->Rect_TL($table_left + ($cell_width * 1), $top + ($row_height * $current_row), $cell_width, $row_height);\n//\t\t\t\t\t$this->pdf->fill();\n\t\t\t\t\t\n//\t\t\t\t\t$this->Rect_TL($table_left + ($cell_width * 1), $top + ($row_height * $current_row), $cell_width, $row_height);\n//\t\t\t\t\t$this->pdf->stroke();\n\t\t\t\t\t/*$percentage = $values['month']? number_format($values['month'] / $this->data['monthly']['total debited']['month'] * 100, 1):0;\n\t\t\t\t\t$this->Text_TL($percentage.'%',\n\t\t\t\t\t\t$table_left + ($cell_width * 3), $top + ($row_height * $current_row), \n\t\t\t\t\t\t$cell_width, $row_height,\n\t\t\t\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['CENTER']}\");*/\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'net cash collected':\n\t\t\t\t\t$this->pdf->setcolor('fill', 'rgb', 1, 1, 176/255, 0);\n\t\t\t\t\t$this->Rect_TL($table_left, $top + ($row_height * $current_row), $cell_width, $row_height);\n\t\t\t\t\t//$this->Rect_TL($table_left + ($cell_width * 1), $top + ($row_height * $current_row), $cell_width, $row_height);\n\t\t\t\t\t//$this->Rect_TL($table_left + ($cell_width * 2), $top + ($row_height * $current_row), $cell_width, $row_height);\n\t\t\t\t\t$this->pdf->fill();\n\t\t\t\t\t\n\t\t\t\t\t//$this->Text_TL(number_format($this->data['period']['total debited']['span'] - $this->data['period']['debit returns']['span'], 2),\n\t\t\t\t\t$this->Text_TL(number_format($this->data['period']['total debited']['span'] - $this->data['period']['nsf$']['span'], 2),\n\t\t\t\t\t\t$table_left, $top + ($row_height * $current_row), \n\t\t\t\t\t\t$cell_width, $row_height,\n\t\t\t\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");\n\t\t\t\t\t\t\n\t\t\t\t\t/*$this->Text_TL(number_format($this->data['monthly']['total debited']['week'] - $this->data['monthly']['debit returns']['week'], 2),\n\t\t\t\t\t\t$table_left + ($cell_width * 1), $top + ($row_height * $current_row), \n\t\t\t\t\t\t$cell_width, $row_height,\n\t\t\t\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");\n\t\t\t\t\t$this->Text_TL(number_format($this->data['monthly']['total debited']['month'] - $this->data['monthly']['debit returns']['month'], 2),\n\t\t\t\t\t\t$table_left + ($cell_width * 2), $top + ($row_height * $current_row), \n\t\t\t\t\t\t$cell_width, $row_height,\n\t\t\t\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");*/\n\t\t\t\t\tbreak;\n\t\t\t\t//FORBIDDEN ROWS!\n\t\t\t\tcase 'moneygram deposit':\n\t\t\t\t//case 'credit card payments':\n\t\t\t\t\tcontinue 2;\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t}\n\t\t\t$format_decimals = 0;\n\t\t\tswitch ($label) {\n\t\t\t\tcase 'new customers':\n\t\t\t\tcase 'card reactivations':\n\t\t\t\tcase 'reactivated customers':\n\t\t\t\tcase 'refunded customers':\n\t\t\t\tcase 'resend customers':\n\t\t\t\tcase 'cancelled customers':\n\t\t\t\tcase 'paid out customers (ach)':\n\t\t\t\tcase 'paid out customers (non-ach)':\n\t\t\t\t\t$format_decimals = 0;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$format_decimals = 2;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\t$this->pdf->setcolor('fill', 'gray', 0.75, 0, 0, 0);\n\t\t\t$this->Rect_TL($left, $top + ($row_height * $current_row), $label_width, $row_height);\n\t\t\t$this->pdf->fill();\n\t\t\t\n\t\t\t$this->Rect_TL($table_left, $top + ($row_height * $current_row), $cell_width, $row_height);\n//\t\t\t$this->Rect_TL($table_left + ($cell_width * 1), $top + ($row_height * $current_row), $cell_width, $row_height);\n//\t\t\t$this->Rect_TL($table_left + ($cell_width * 2), $top + ($row_height * $current_row), $cell_width, $row_height);\n\t\t\t$this->pdf->stroke();\n\t\t\t\n\t\t\t$this->Text_TL(strtoupper($label),\n\t\t\t\t$left + $label_indent, $top + ($row_height * $current_row), \n\t\t\t\t$label_width - $label_indent, $row_height,\n\t\t\t\t\"{$this->formats['BOLD_FONT']} {$this->formats['ITALICS']} {$this->formats['RIGHT']}\");\n\t\t\t\n\t\t\tif ($label != 'net cash collected') {\n\t\t\t\t$this->Text_TL(number_format($values['span'], $format_decimals),\n\t\t\t\t\t$table_left, $top + ($row_height * $current_row), \n\t\t\t\t\t$cell_width, $row_height,\n\t\t\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");\n\t\t\t\t\n\t\t\t\t/*$this->Text_TL(number_format($values['week'], $format_decimals),\n\t\t\t\t\t$table_left + ($cell_width * 1), $top + ($row_height * $current_row), \n\t\t\t\t\t$cell_width, $row_height,\n\t\t\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");\n\t\t\t\t\n\t\t\t\t$this->Text_TL(number_format($values['month'], $format_decimals),\n\t\t\t\t\t$table_left + ($cell_width * 2), $top + ($row_height * $current_row), \n\t\t\t\t\t$cell_width, $row_height,\n\t\t\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");*/\n\t\t\t}\n\t\t\t\n\t\t\t$current_row++;\n\t\t}\n\t\t\n\t\t/**\n\t\t * Advances in Collection\n\t\t */\n\t\t$this->pdf->setcolor('fill', 'gray', 0.75, 0, 0, 0);\n\t\t$this->Rect_TL($left, $top + ($row_height * $current_row), $label_width, $row_height);\n\t\t$this->pdf->fill();\n\t\t\n\t\t$this->Rect_TL($table_left, $top + ($row_height * $current_row), $cell_width, $row_height);\n\t\t$this->pdf->stroke();\n\t\t\n\t\t$this->Text_TL(\"ADVANCES IN COLLECTION\",\n\t\t\t$left, $top + ($row_height * $current_row), \n\t\t\t$label_width, $row_height,\n\t\t\t\"{$this->formats['BOLD_FONT']} {$this->formats['ITALICS']} {$this->formats['RIGHT']}\");\n\t\t\n\t\t$this->Text_TL(number_format($this->data['advances_collections'], 2),\n\t\t\t$table_left, $top + ($row_height * $current_row), \n\t\t\t$cell_width, $row_height,\n\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");\n\t\t\n\t\t/**\n\t\t * Advances in Active\n\t\t */\n\t\t$this->pdf->setcolor('fill', 'gray', 0.75, 0, 0, 0);\n\t\t$this->Rect_TL($table_left + ($cell_width * 4), $top + ($row_height * $current_row), $cell_width * 2, $row_height);\n\t\t$this->pdf->fill();\n\t\t\n\t\t$this->Rect_TL($table_left + ($cell_width * 6), $top + ($row_height * $current_row), $cell_width, $row_height);\n\t\t$this->pdf->stroke();\n\t\t\n\t\t$this->Text_TL(\"ACTIVE ADVANCES OUT\",\n\t\t\t$table_left + ($cell_width * 4), $top + ($row_height * $current_row), \n\t\t\t$cell_width * 2, $row_height,\n\t\t\t\"{$this->formats['BOLD_FONT']} {$this->formats['ITALICS']} {$this->formats['RIGHT']}\");\n\t\t\n\t\t$this->Text_TL(number_format($this->data['advances_active'], 2),\n\t\t\t$table_left + ($cell_width * 6), $top + ($row_height * $current_row), \n\t\t\t$cell_width, $row_height,\n\t\t\t\"{$this->formats['NORMAL_FONT']} {$this->formats['RIGHT']}\");\n\t\t\n\t}", "private function setMonthNames()\n\t{\n\t\t$range = range(1,12);\n\t\t$return = array();\n\t\tforeach($range AS $key => $monthNum)\n\t\t{\n\t\t $fmt = datefmt_create ($this->locale, null, null, null, IntlDateFormatter::GREGORIAN, 'MMMM');\n\t\t\t$return[$monthNum] = datefmt_format( $fmt , mktime(12,0,0,$monthNum,1,date('Y')));\n\t\t}\n\n\t\treturn $return;\n\t}", "protected function build_month_calendar(&$tpl_var)\n {\n global $page, $lang, $conf;\n\n $query='SELECT '.pwg_db_get_dayofmonth($this->date_field).' as period,\n COUNT(DISTINCT id) as count';\n $query.= $this->inner_sql;\n $query.= $this->get_date_where();\n $query.= '\n GROUP BY period\n ORDER BY period ASC';\n\n $items=array();\n $result = pwg_query($query);\n while ($row = pwg_db_fetch_assoc($result))\n {\n $d = (int)$row['period'];\n $items[$d] = array('nb_images'=>$row['count']);\n }\n\n foreach ( $items as $day=>$data)\n {\n $page['chronology_date'][CDAY]=$day;\n $query = '\n SELECT id, file,representative_ext,path,width,height,rotation, '.pwg_db_get_dayofweek($this->date_field).'-1 as dow';\n $query.= $this->inner_sql;\n $query.= $this->get_date_where();\n $query.= '\n ORDER BY '.DB_RANDOM_FUNCTION.'()\n LIMIT 1';\n unset ( $page['chronology_date'][CDAY] );\n\n $row = pwg_db_fetch_assoc(pwg_query($query));\n $derivative = new DerivativeImage(IMG_SQUARE, new SrcImage($row));\n $items[$day]['derivative'] = $derivative;\n $items[$day]['file'] = $row['file'];\n $items[$day]['dow'] = $row['dow'];\n }\n\n if ( !empty($items) )\n {\n list($known_day) = array_keys($items);\n $known_dow = $items[$known_day]['dow'];\n $first_day_dow = ($known_dow-($known_day-1))%7;\n if ($first_day_dow<0)\n {\n $first_day_dow += 7;\n }\n //first_day_dow = week day corresponding to the first day of this month\n $wday_labels = $lang['day'];\n\n if ('monday' == $conf['week_starts_on'])\n {\n if ($first_day_dow==0)\n {\n $first_day_dow = 6;\n }\n else\n {\n $first_day_dow -= 1;\n }\n\n $wday_labels[] = array_shift($wday_labels);\n }\n\n list($cell_width, $cell_height) = ImageStdParams::get_by_type(IMG_SQUARE)->sizing->ideal_size;\n\n $tpl_weeks = array();\n $tpl_crt_week = array();\n\n //fill the empty days in the week before first day of this month\n for ($i=0; $i<$first_day_dow; $i++)\n {\n $tpl_crt_week[] = array();\n }\n\n for ( $day = 1;\n $day <= $this->get_all_days_in_month(\n $page['chronology_date'][CYEAR], $page['chronology_date'][CMONTH]\n );\n $day++)\n {\n $dow = ($first_day_dow + $day-1)%7;\n if ($dow==0 and $day!=1)\n {\n $tpl_weeks[] = $tpl_crt_week; // add finished week to week list\n $tpl_crt_week = array(); // start new week\n }\n\n if ( !isset($items[$day]) )\n {// empty day\n $tpl_crt_week[] =\n array(\n 'DAY' => $day\n );\n }\n else\n {\n $url = duplicate_index_url(\n array(\n 'chronology_date' =>\n array(\n $page['chronology_date'][CYEAR],\n $page['chronology_date'][CMONTH],\n $day\n )\n )\n );\n\n $tpl_crt_week[] =\n array(\n 'DAY' => $day,\n 'DOW' => $dow,\n 'NB_ELEMENTS' => $items[$day]['nb_images'],\n 'IMAGE' => $items[$day]['derivative']->get_url(),\n 'U_IMG_LINK' => $url,\n 'IMAGE_ALT' => $items[$day]['file'],\n );\n }\n }\n //fill the empty days in the week after the last day of this month\n while ( $dow<6 )\n {\n $tpl_crt_week[] = array();\n $dow++;\n }\n $tpl_weeks[] = $tpl_crt_week;\n\n $tpl_var['month_view'] =\n array(\n 'CELL_WIDTH' => $cell_width,\n 'CELL_HEIGHT' => $cell_height,\n 'wday_labels' => $wday_labels,\n 'weeks' => $tpl_weeks,\n );\n }\n\n return true;\n }", "function showMonth($showNoMonthDays=false){\n$this->showNoMonthDays=$showNoMonthDays;\n$out=$this->mkMonthHead(); // this should remain first: opens table tag\n$out.=$this->mkMonthTitle(); // tr tag: month title and navigation\n$out.=$this->mkDatePicker(); // tr tag: month date picker (month and year selection)\n$out.=$this->mkWeekDays(); // tr tag: the weekday names\n\tif ($this->showNoMonthDays==false) $out.=$this->mkMonthBody(); // tr tags: the days of the month\n\telse $out.=$this->mkMonthBody(1); // tr tags: the days of the month\n$out.=$this->mkMonthFoot(); // this should remain last: closes table tag\nreturn $out;\n}", "function prim_options_month() {\n $month = array(\n 'jan' => t('jan'),\n 'feb' => t('feb'),\n 'mar' => t('mar'),\n 'apr' => t('apr'),\n 'may' => t('maj'),\n 'jun' => t('jun'),\n 'jul' => t('jul'),\n 'aug' => t('aug'),\n 'sep' => t('sep'),\n 'oct' => t('okt'),\n 'nov' => t('nov'),\n 'dec' => t('dec'),\n );\n\n return $month;\n}", "public function buildMonth()\n\t{\n\t\t$this->orderedDays = $this->getDaysInOrder();\n\t\t\n\t\t$this->monthName = $this->months[ ltrim( $this->month, '0') ];\n\t\t\n\t\t// start of whichever month we are building\n\t\t$start_of_month = getdate( mktime(12, 0, 0, $this->month, 1, $this->year ) );\n\t\t\n\t\t$first_day_of_month = $start_of_month['wday'];\n\t\t\n\t\t$days = $this->startDay - $first_day_of_month;\n\t\t\n\t\tif( $days > 1 )\n\t\t{\n\t\t\t// get an offset\n\t\t\t$days -= 7;\n\t\t\t\n\t\t}\n\n\t\t$num_days = $this->daysInMonth($this->month, $this->year);\n\t\t// 42 iterations\n\t\t$start = 0;\n\t\t$cal_dates = array();\n\t\t$cal_dates_style = array();\n\t\t$cal_events = array();\n\t\twhile( $start < 42 )\n\t\t{\n\t\t\t// off set dates\n\t\t\tif( $days < 0 )\n\t\t\t{\n\t\t\t\t$cal_dates[] = '';\n\t\t\t\t$cal_dates_style[] = 'calendar-empty';\n\t\t\t\t$cal_dates_data[] = '';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif( $days < $num_days )\n\t\t\t\t{\n\t\t\t\t\t// real days\n\t\t\t\t\t$cal_dates[] = $days+1;\n\t\t\t\t\tif( in_array( $days+1, $this->daysWithEvents ) )\n\t\t\t\t\t{\n\t\t\t\t\t\t$cal_dates_style[] = 'has-events';\n\t\t\t\t\t\t$cal_dates_data[] = $this->data[ $days+1 ];\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$cal_dates_style[] = '';\n\t\t\t\t\t\t$cal_dates_data[] = '';\n\t\t\t\t\t}\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// surplus\n\t\t\t\t\t$cal_dates[] = '';\n\t\t\t\t\t$cal_dates_style[] = 'calendar-empty';\n\t\t\t\t\t$cal_dates_data[] = '';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t// increment and loop\n\t\t\t$start++;\n\t\t\t$days++;\n\t\t}\n\t\t\n\t\t// done\n\t\t$this->dates = $cal_dates;\n\t\t$this->dateStyles = $cal_dates_style;\n\t\t$this->dateData = $cal_dates_data;\n\t}", "function mkMonthTitle(){\n\tif (!$this->monthNav){\n\t\t$out=\"<tr><td class=\\\"\".$this->cssMonthTitle.\"\\\" colspan=\\\"\".$this->monthSpan.\"\\\">\";\n\t\t$out.=$this->getMonthName().$this->monthYearDivider.$this->actyear;\n\t\t$out.=\"</td></tr>\\n\";\n\t}\n\telse{\n\t\t$out=\"<tr><td class=\\\"\".$this->cssMonthNav.\"\\\" colspan=\\\"2\\\">\";\n\t\tif ($this->actmonth==1) $out.=$this->mkUrl($this->actyear-1,\"12\");\n\t\telse $out.=$this->mkUrl($this->actyear,$this->actmonth-1);\n\t\t$out.=$this->monthNavBack.\"</a></td>\";\n\t\t$out.=\"<td class=\\\"\".$this->cssMonthTitle.\"\\\" colspan=\\\"\".($this->monthSpan-4).\"\\\">\";\n\t\t$out.=$this->getMonthName().$this->monthYearDivider.$this->actyear.\"</td>\";\n\t\t$out.=\"<td class=\\\"\".$this->cssMonthNav.\"\\\" colspan=\\\"2\\\">\";\n\t\tif ($this->actmonth==12) $out.=$this->mkUrl($this->actyear+1,\"1\");\n\t\telse $out.=$this->mkUrl($this->actyear,$this->actmonth+1);\n\t\t$out.=$this->monthNavForw.\"</a></td></tr>\\n\";\n\t}\nreturn $out;\n}", "public function display($month='', $year='') {\n\t\n\t\t// Remove whitespaces\n\t\t$year = trim($year);\n\t\t$month = trim($month);\n\n\t\t// Set day, month and year of calendar\n\t\t$this->day = 1;\n\t\t$this->month = ($month == '') ?\tdate('n') : $month;\n\t\t$this->year = ($year == '') ? date('Y') : $year;\n\n\t\t// Check for valid input\t\n\t\tif (!preg_match('~[0-9]{4}~', $this->year))\n\t\t\tthrow new exception('Invalid value for year');\n\t\tif (!is_numeric($this->month) || $this->month < 0 || $this->month > 13)\n\t\t\tthrow new exception('Invalid value for month');\n\n\t\t// Set the current timestamp\n\t\t$this->timeStamp = mktime(1,1,1,$this->month, $this->day, $this->year);\n\t\t// Set the number of days in teh current month\n\t\t$this->daysInMonth = date('t',$this->timeStamp);\n\n\t\t// Start table\n\t\t$calHTML = sprintf(\"<table id=\\\"%s\\\" cellpadding=\\\"0\\\" cellspacing=\\\"%d\\\"><thead><tr>\", $this->calendarName, $this->innerBorder);\n\t\t// Display previous month navigation\n\t\tif ($this->enableNav) {\n\t\t\t$pM = explode('-', date('n-Y', strtotime('-1 month', $this->timeStamp)));\n\t\t\t$calHTML .= sprintf(\"<td class=\\\"%s-%s\\\"><a href=\\\"?%smonth=%d&amp;year=%d\\\">%s</a></td>\", $this->calendarName, $this->markup['nav'], $this->queryString, $pM[0], $pM[1],$this->prevMonthNavTxt);\n\t\t}\n\t\t\n\t\t// Month name and optional year\n\t\t$calHTML .= sprintf(\"<td colspan=\\\"%d\\\" id=\\\"%s-%s\\\">%s%s</td>\", ($this->enableNav ? 5 : 7), $this->calendarName, $this->markup['header'], $this->getMonthName(), ($this->displayYear ? ' ' .$this->year : ''));\n\n\t\t// Display next month navigation\n\t\tif ($this->enableNav) {\n\t\t\t$nM = explode('-', date('n-Y', strtotime('+1 month', $this->timeStamp)));\n\t\t\t$calHTML .= sprintf(\"<td class=\\\"%s-%s\\\"><a href=\\\"?%smonth=%d&amp;year=%d\\\">%s</a></td>\", $this->calendarName, $this->markup['nav'], $this->queryString, $nM[0], $nM[1],$this->nextMonthNavTxt);\n\t\t}\n\n\t\t$calHTML .= sprintf(\"</tr></thead><tbody><tr id=\\\"%s\\\">\", $this->markup['days_of_week']);\n\n\t\t// Display day headers\n\t\tforeach($this->dayNames as $k => $dayName)\n\t\t\t$calHTML .= sprintf(\"<td>%s</td>\", $dayName);\n\n\t\t$calHTML .= \"</tr><tr>\";\n\t\t\n\t\t/// What the heck is this\n\t\t$sDay = date('N', $this->timeStamp) + $this->startDay - 1;\n\t\t\n\t\t// Print previous months days\n\t\t\tfor ($e=1;$e<=$sDay;$e++)\n\t\t\t\t$calHTML .= sprintf(\"<td class=\\\"%s-%s\\\">%s</td>\", $this->calendarName, $this->markup['prev_month'], (($this->displayNonMonthDays) ? $this->timeTravel(\"-\" . ($sDay -$e) . \" days\", 'd', $this->timeStamp) : ''));\n\t\n\t\t// Print days\n\t\tfor ($i=1;$i<=$this->daysInMonth;$i++) {\n\t\t\t// Set current day and timestamp\n\t\t\t$this->day = $i;\n\t\t\t$this->timeStamp = mktime(1,1,1,$this->month, $this->day, $this->year);\n\t\t\t\n\t\t\t// Set day as either plain text or event link\n\t\t\tif (isset($this->events[$this->year][$this->month][$this->day]))\n\t\t\t\t$this->htmlDay = sprintf(\"<a href=\\\"%s\\\" title=\\\"%s\\\">%s</a>\", $this->events[$this->year][$this->month][$this->day]['event_link'], $this->events[$this->year][$this->month][$this->day]['event_title'], $this->day);\n\t\t\telse\n\t\t\t\t$this->htmlDay = $this->day;\t\t\t\n\t\n\t\t\t// Display calendar cell\n\t\t\t$calHTML .= sprintf(\"<td %s%s>%s</td>\", ($this->timeStamp == mktime(1,1,1,date('n'),date('j'),date('Y')) ? 'id=\"' . $this->calendarName . '-' . $this->markup['current_day'] . '\" ' : ''), ((($sDay + $this->day) % 7 == 0) ? 'class=\"' . $this->calendarName . '-' . $this->markup['last_day_of_week'] . '\"' : ''), $this->htmlDay);\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t// End row if necessary\t\t\t\n\t\t\tif (($sDay + $this->day) % 7 == 0)\n\t\t\t\t$calHTML .= \"</tr><tr>\";\n\t\t}\n\t\t\n\t\t// Print next months days\n\t\tfor ($e2=1;$e2 < (7 - (($sDay + $this->daysInMonth -1) % 7)); $e2++)\n\t\t\t$calHTML .= sprintf(\"<td class=\\\"%s-next-month-day%s\\\">%s</td>\", $this->calendarName, ((($sDay + $this->day + $e2) % 7 == 0) ? ' ' . $this->calendarName . '-' . $this->markup['last_day_of_week'] : ''), (($this->displayNonMonthDays) ? $this->timeTravel(\"+$e2 days\", 'd', $this->timeStamp) : ''));\n\t\t\n\t\t$calHTML .= \"</tr></tbody></table>\";\n\t\n\t\t// Tidy up html\n\t\tif ($this->prettyHTML) {\n\t\t\t$replaceWhat = array('<tr', '<td', '</tr>', '</table>', '<thead>', '</thead>', '<tbody>', '</tbody>');\n\t\t\t$replaceWith = array(\"\\n\\t\\t<tr\", \"\\n\\t\\t\\t<td\", \"\\n\\t\\t</tr>\", \"\\n</table>\", \"\\n\\t<thead>\", \"\\n\\t</thead>\", \"\\n\\t<tbody>\", \"\\n\\t</tbody>\");\n\t\t\t$calHTML = str_replace($replaceWhat, $replaceWith, $calHTML);\n\t\t}\n\t\t\n\t\t// Print calendar\n\t\techo $calHTML;\n\t}", "function mkMonthHead(){\nreturn \"<table class=\\\"\".$this->cssMonthTable.\"\\\">\\n\";\n}", "public function view(){\r\n $this->month();\r\n }", "public function month()\n\t{\n\t\t// -------------------------------------\n\t\t// Load 'em up\n\t\t// -------------------------------------\n\n\t\t$this->load_calendar_datetime();\n\t\t$this->load_calendar_parameters();\n\n\t\t// -------------------------------------\n\t\t// Prep the parameters\n\t\t// -------------------------------------\n\n\t\t$disable = array('categories', 'category_fields', 'custom_fields', 'member_data', 'pagination', 'trackbacks');\n\n\t\t$params = array(\n\t\t\tarray(\t'name' => 'category',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'string',\n\t\t\t\t\t'multi' => TRUE\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'site_id',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'integer',\n\t\t\t\t\t'min_value' => 1,\n\t\t\t\t\t'multi' => TRUE,\n\t\t\t\t\t'default' => $this->data->get_site_id()\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'calendar_id',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'string',\n\t\t\t\t\t'multi' => TRUE\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'calendar_name',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'string',\n\t\t\t\t\t'multi' => TRUE\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'event_id',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'string',\n\t\t\t\t\t'multi' => TRUE\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'event_name',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'string',\n\t\t\t\t\t'multi' => TRUE\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'event_limit',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'integer'\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'status',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'string',\n\t\t\t\t\t'multi' => TRUE,\n\t\t\t\t\t'default' => 'open'\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'date_range_start',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'date'\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'time_range_start',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'time',\n\t\t\t\t\t'default' => '0000'\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'time_range_end',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'time',\n\t\t\t\t\t'default' => '2400'\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'enable',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'string',\n\t\t\t\t\t'default' => '',\n\t\t\t\t\t'multi' => TRUE,\n\t\t\t\t\t'allowed_values' => $disable\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'first_day_of_week',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'integer',\n\t\t\t\t\t'default' => $this->first_day_of_week\n\t\t\t\t\t),\n\t\t\tarray(\t'name' => 'start_date_segment',\n\t\t\t\t\t'required' => FALSE,\n\t\t\t\t\t'type' => 'integer',\n\t\t\t\t\t'default' => 3\n\t\t\t\t\t)\n\t\t\t);\n\n\t\t//ee()->TMPL->log_item('Calendar: Processing parameters');\n\n\t\t$this->add_parameters($params);\n\n\t\t// -------------------------------------\n\t\t// Need to modify the starting date?\n\t\t// -------------------------------------\n\n\t\t$this->first_day_of_week = $this->P->value('first_day_of_week');\n\n\t\tif ($this->P->value('date_range_start') === FALSE)\n\t\t{\n\t\t\tif ($this->P->value('start_date_segment') AND ee()->uri->segment($this->P->value('start_date_segment')) AND strstr(ee()->uri->segment($this->P->value('start_date_segment')), '-'))\n\t\t\t{\n\t\t\t\tlist($year, $month) = explode('-', ee()->uri->segment($this->P->value('start_date_segment')));\n\t\t\t\t$this->P->params['date_range_start']['value'] = $this->CDT->change_date($year, $month, 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->P->params['date_range_start']['value'] = $this->CDT->change_date($this->CDT->year, $this->CDT->month, 1);\n\t\t\t}\n\t\t}\n\t\telseif ($this->P->value('date_range_start', 'day') != 1)\n\t\t{\n\t\t\t$this->P->params['date_range_start']['value'] = $this->CDT->change_date($this->P->value('date_range_start', 'year'), $this->P->value('date_range_start', 'month'), 1);\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// Define parameters specific to this calendar view\n\t\t// -------------------------------------\n\n\t\t$this->CDT->change_ymd($this->P->value('date_range_start', 'ymd'));\n\t\t$this->P->set('date_range_end', $this->CDT->add_day($this->CDT->days_in_month($this->P->value('date_range_start', 'month'), $this->P->value('date_range_start', 'year')) - 1));\n\t\t$this->P->set('pad_short_weeks', TRUE);\n\n\t\t// -------------------------------------\n\t\t// Define our tagdata\n\t\t// -------------------------------------\n\n\t\t$find = array(\t'EVENTS_PLACEHOLDER',\n\t\t\t\t\t\t'{/',\n\t\t\t\t\t\t'{',\n\t\t\t\t\t\t'}'\n\t\t\t\t\t\t);\n\t\t$replace = array(\tee()->TMPL->tagdata,\n\t\t\t\t\t\t\tLD.T_SLASH,\n\t\t\t\t\t\t\tLD,\n\t\t\t\t\t\t\tRD\n\t\t\t\t\t\t\t);\n\t\tee()->TMPL->tagdata = str_replace($find, $replace, $this->view('month.html', array(), TRUE, $this->sc->addon_theme_path.'templates/month.html'));\n\n\t\t// -------------------------------------\n\t\t// Tell TMPL what we're up to\n\t\t// -------------------------------------\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'events'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['events'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_hour'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_hour'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_day'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_day'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_week'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_week'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_month'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_month'] = TRUE;\n\t\t}\n\n\t\tif (strpos(ee()->TMPL->tagdata, LD.'display_each_day_of_week'.RD) !== FALSE)\n\t\t{\n\t\t\tee()->TMPL->var_pair['display_each_day_of_week'] = TRUE;\n\t\t}\n\n\t\t// -------------------------------------\n\t\t// If you build it, they will know what's going on.\n\t\t// -------------------------------------\n\n\t\t$this->parent_method = __FUNCTION__;\n\n\t\treturn $this->build_calendar();\n\t}", "public function get_month_choices()\n {\n }", "function initMonth()\n {\n //! Si aucun mois ou année n'est recupéré on prend le mois et l'année actuel\n if (!$this->currentMonthName || !$this->year) {\n $this->currentMonthIndex = (int)date(\"m\", time()) - 1;\n $this->currentMonthName = $this->months[$this->currentMonthIndex];\n $this->year = (int)date(\"Y\", time());\n }\n // recalcule le premier jour pour ce mois et le nombre de jour total du mois\n $this->firstDayInMonth = strftime('%u', strtotime(strval($this->currentMonthIndex + 1) . '/01/' . strval($this->year)));\n $this->nbDaysMonth = cal_days_in_month(CAL_GREGORIAN, $this->currentMonthIndex + 1, $this->year);\n $this->currentMonthName = $this->months[$this->currentMonthIndex];\n }", "public function getMonths()\r\n\t{\r\n \t$months = array();\r\n\t\t\r\n\t\tfor($i = 1; $i <= 12; $i++)\r\n\t\t{\r\n\t\t\t$label = ($i < 10) ? (\"0\" . $i) : $i;\r\n\t\t\t\r\n\t\t\t$months[] = array(\"num\" => $i, \"label\" => $this->htmlEscape($label));\r\n\t\t}\r\n\t\t\r\n\t\treturn $months;\r\n\t}", "public function getMonthAsTable()\n {\n // Get all days to put in calendar\n $days = $this->getDaysAsArray();\n\n // Start table\n $html = \"<table class='table'><thead><tr>\";\n\n // Add weekday names to table head\n foreach (array_keys($this->weekdayIndexes) as $key) {\n $html .= \"<th>{$key}</th>\";\n }\n $html .= \"</tr></thead><tbody>\";\n\n // Add day numbers to table body\n for ($i = 0; $i < count($days); $i++) {\n // New row at start of week\n $html .= $i % 7 === 0 ? \"<tr>\" : \"\";\n\n if (($days[$i] > $i + 7) || ($days[$i] < $i - 7)) {\n // Add class 'outside' if number is part of previous or next month\n $html .= \"<td class='outside'>\";\n } elseif ($i % 7 === 6) {\n // Add class 'red' to Sundays\n $html .= \"<td class='red'>\";\n } else {\n $html .= \"<td>\";\n }\n $html .= \"{$days[$i]}</td>\";\n // Close row at end of week\n $html .= $i % 7 === 6 ? \"</tr>\" : \"\";\n }\n $html .= \"</tbody></table>\";\n return $html;\n }", "public function showMonth ()\n {\n\n $manages = DB::table('adds')->where('user_id', '=', auth()->id())->take(3)\n ->select(DB::raw('sum(pallet) as totalpallet')\n , DB::raw('sum(eilutes) as totaleilutes')\n , DB::raw('sum(vip) as totalvip')\n , DB::raw('sum(valandos) as totalvalandos')\n , DB::raw('YEAR(created_at) year, MONTH(created_at) month'))\n ->groupBy('year', 'month')\n ->orderByRaw('min(created_at) desc')\n ->get();\n\n\n return view('layouts.manage', compact('manages'));\n }", "public static function listMonth()\r\n {\r\n $mes[1] = 'Janeiro';\r\n $mes[2] = 'Fevereiro';\r\n $mes[3] = 'Março';\r\n $mes[4] = 'Abril';\r\n $mes[5] = 'Maio';\r\n $mes[6] = 'Junho';\r\n $mes[7] = 'Julho';\r\n $mes[8] = 'Agosto';\r\n $mes[9] = 'Setembro';\r\n $mes[10] = 'Outubro';\r\n $mes[11] = 'Novembro';\r\n $mes[12] = 'Dezembro';\r\n\r\n return $mes;\r\n }", "public function monthControl(){\n\t\t$month = date('m', time());\n\t\t\t\t\n\t\t//remakes $month to the month's name\n\t\tswitch ($month) {\n\t\t\tcase 1:\t$month = \"Januari\";\t\tbreak;\n\t\t\tcase 2:\t$month = \"Februari\";\tbreak;\n\t\t\tcase 3:\t$month = \"Mars\";\t\tbreak;\n\t\t\tcase 4:\t$month = \"April\";\t\tbreak;\n\t\t\tcase 5:\t$month = \"Maj\";\t\t\tbreak;\n\t\t\tcase 6:\t$month = \"Juni\";\t\tbreak;\n\t\t\tcase 7:\t$month = \"Juli\";\t\tbreak;\n\t\t\tcase 8:\t$month = \"Augusti\";\t\tbreak;\n\t\t\tcase 9:\t$month = \"September\";\tbreak;\n\t\t\tcase 10:$month = \"Oktober\";\t\tbreak;\n\t\t\tcase 11:$month = \"November\";\tbreak;\t\n\t\t\tcase 12:$month = \"December\";\tbreak;\n\t\t}\n\t\t\n\t\treturn $month;\n\t}", "public function listMonths()\n {\n return $this->ozioma->month->list();\n }", "function monthOptionBox ($dictionary, $default)\n{\n $label = array();\n $value = array();\n \tfor ($i=1; $i<=12; $i++)\n\t{\n if ($i<10)\n\t\t{\n\t\t\t$label[] = $dictionary['month0'.$i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$label[] = $dictionary['month'.$i];\n\t\t}\n $value[] = $i;\n\t}\n\treturn OptionBox($label, $value, $default, $label);\n}", "public function getMonths();", "function mkMonthBody($showNoMonthDays=0){\n\tif ($this->actmonth==1){\n\t\t$pMonth=12;\n\t\t$pYear=$this->actyear-1;\n\t}\n\telse{\n\t\t$pMonth=$this->actmonth-1;\n\t\t$pYear=$this->actyear;\n\t}\n$out=\"<tr>\";\n$cor=0;\n\tif ($this->startOnSun) $cor=1;\n\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNum.\"\\\">\".$this->mkWeekNum(1+$cor).\"</td>\";\n$monthday=0;\n$nmonthday=1;\n\tfor ($x=0; $x<=6; $x++){\n\t\tif ($x>=$this->firstday){\n\t\t$monthday++;\n\t\t$out.=$this->mkDay($monthday);\n\t\t}\n\t\telse{\n\t\t\tif ($showNoMonthDays==0) $out.=\"<td class=\\\"\".$this->cssNoMonthDay.\"\\\"></td>\";\n\t\t\telse $out.=\"<td class=\\\"\".$this->cssNoMonthDay.\"\\\">\".($this->getMonthDays($pMonth,$pYear)-($this->firstday-1)+$x).\"</td>\";\n\t\t}\n\t}\n$out.=\"</tr>\\n\";\n$goon=$monthday+1;\n$stop=0;\n\tfor ($x=0; $x<=6; $x++){\n\t\tif ($goon>$this->maxdays) break;\n\t\tif ($stop==1) break;\n\t\t$out.=\"<tr>\";\n\t\tif ($this->weekNum) $out.=\"<td class=\\\"\".$this->cssWeekNum.\"\\\">\".$this->mkWeekNum($goon+$cor).\"</td>\";\n\t\t\tfor ($i=$goon; $i<=$goon+6; $i++){\n\t\t\t\tif ($i>$this->maxdays){\n\t\t\t\t\tif ($showNoMonthDays==0) $out.=\"<td class=\\\"\".$this->cssNoMonthDay.\"\\\"></td>\";\n\t\t\t\t\telse $out.=\"<td class=\\\"\".$this->cssNoMonthDay.\"\\\">\".$nmonthday++.\"</td>\";\n\t\t\t\t\t$stop=1;\n\t\t\t\t}\n\t\t\t\telse $out.=$this->mkDay($i);\n\t\t\t}\n\t\t$goon=$goon+7;\n\t\t$out.=\"</tr>\\n\";\n\t}\n$this->selectedday=\"-2\";\nreturn $out;\n}", "public function getCcMonths() {\n $data = Mage::app()->getLocale()->getTranslationList('month');\n foreach ($data as $key => $value) {\n $monthNum = ($key < 10) ? '0' . $key : $key;\n $data[$key] = $monthNum . ' - ' . $value;\n }\n\n $months = $this->getData('cc_months');\n if (is_null($months)) {\n $months[0] = $this->__('Month');\n $months = array_merge($months, $data);\n $this->setData('cc_months', $months);\n }\n\n\n return $months;\n }", "public function Months() {\r\n// $months = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');\r\n $months = array(1 => 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec');\r\n return $months;\r\n }", "private function make_calendar($year, $month){\n\t\t$first_of_month = gmmktime(0,0,0,$month,1,$year);\n\t\t#remember that mktime will automatically correct if invalid dates are entered\n\t\t# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998\n\t\t# this provides a built in \"rounding\" feature to generate_calendar()\n\t\n\t\t$day_names = array(); #generate all the day names according to the current locale\n\t\tfor($n=0,$t=(3+$this->firstDay)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday\n\t\t\t$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name\n\t\n\t\tlist($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));\n\t\t$weekday = ($weekday + 7 - $this->firstDay) % 7; #adjust for $firstDay\n\t\t$title = htmlentities(ucfirst($month_name)).'&nbsp;'.$year; #note that some locales don't capitalize month and day names\n\t\n\t\t#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03\n\t\t@list($p, $pl) = each($this->canonicals); @list($n, $nl) = each($this->canonicals); #previous and next links, if applicable\n\t\tif($p) $p = '<span class=\"calendar-prev\">'.($pl ? '<a href=\"'.htmlspecialchars($pl).'\">'.$p.'</a>' : $p).'</span>&nbsp;';\n\t\tif($n) $n = '&nbsp;<span class=\"calendar-next\">'.($nl ? '<a href=\"'.htmlspecialchars($nl).'\">'.$n.'</a>' : $n).'</span>';\n\t\t$calendar = '<table class=\"calendar\">'.\"\\n\".\n\t\t\t'<caption class=\"calendar-month\">'.$p.($this->monthLink ? '<a href=\"'.htmlspecialchars($this->monthLink).'\">'.$title.'</a>' : $title).$n.\"</caption>\\n<tr>\";\n\t\n\t\tif($this->dayNameLength){ #if the day names should be shown ($day_name_length > 0)\n\t\t\t#if day_name_length is >3, the full name of the day will be printed\n\t\t\tforeach($day_names as $d)\n\t\t\t\t$calendar .= '<th abbr=\"'.htmlentities($d).'\">'.htmlentities($this->dayNameLength < 4 ? substr($d,0,$this->dayNameLength) : $d).'</th>';\n\t\t\t$calendar .= \"</tr>\\n<tr>\";\n\t\t}\n\t\n\t\tif($weekday > 0) $calendar .= '<td colspan=\"'.$weekday.'\">&nbsp;</td>'; #initial 'empty' days\n\t\tfor($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){\n\t\t\tif($weekday == 7){\n\t\t\t\t$weekday = 0; #start a new week\n\t\t\t\t$calendar .= \"</tr>\\n<tr>\";\n\t\t\t}\n\t\t\tif(isset($this->days[$day]) and is_array($this->days[$day])){\n\t\t\t\t@list($link, $classes, $content) = $this->days[$day];\n\t\t\t\tif(is_null($content)) $content = $day;\n\t\t\t\t$calendar .= '<td'.($classes ? ' class=\"'.htmlspecialchars($classes).'\">' : '>').\n\t\t\t\t\t($link ? '<a href=\"'.htmlspecialchars($link).'\">'.$content.'</a>' : $content).'</td>';\n\t\t\t}\n\t\t\telse $calendar .= \"<td>$day</td>\";\n\t\t}\n\t\tif($weekday != 7) $calendar .= '<td colspan=\"'.(7-$weekday).'\">&nbsp;</td>'; #remaining \"empty\" days\n\t\n\t\treturn $calendar.\"</tr>\\n</table>\\n\";\n\t}", "function single_month_title($prefix = '', $display = \\true)\n {\n }" ]
[ "0.73935616", "0.7041853", "0.67926854", "0.66831195", "0.66279286", "0.6617421", "0.6536828", "0.6473009", "0.6435724", "0.6414517", "0.64120907", "0.6408968", "0.6383224", "0.63521445", "0.6348271", "0.63159007", "0.631117", "0.6222103", "0.62045795", "0.61959517", "0.61901295", "0.6182413", "0.61705947", "0.61674434", "0.6159054", "0.61405504", "0.6122599", "0.6100624", "0.6084469", "0.6058697" ]
0.72050965
1
Logout() Closes session and returns to login screen
public static function Logout() { Session::CloseSession(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function logOut()\n {\n self::startSession();\n session_destroy();\n }", "public function logout()\n { \n Session_activity::delete();\n \n Session_activity::delete_session();\n \n $conf = $GLOBALS['CONF'];\n $ossim_link = $conf->get_conf('ossim_link');\n $login_location = preg_replace(\"/(\\/)+/\",\"/\", $ossim_link.'/session/login.php');\n \n unset($_SESSION);\n header(\"Location: $login_location\");\n \n exit();\n }", "public function logout()\n {\n $this->session->end();\n }", "public function logout() {\r\n Session::end();\r\n Misc::redirect('login');\r\n }", "public function logout()\n {\n session_unset();\n\n $site = new SiteContainer($this->db);\n\n $site->printHeader();\n $site->printNav();\n echo \"Successfully logged out. Return to <a href=\\\"login.php\\\">login</a>\";\n $site->printFooter();\n\n }", "public function logout()\n {\n Session::destroy();\n $this->ok();\n }", "public function userLogout() {\n // Starting a session to unset and destroy it\n session_start();\n session_unset();\n session_destroy();\n\n // Sending the user back to the login page\n header(\"Location: login\");\n }", "public function logout() {\r\n\t\tSession::delete($this->_sessionName);\r\n\t}", "public function logout()\n {\n $this->deleteSession();\n }", "public function LogOut()\n {\n session_destroy();\n }", "public function logout() {\n\t\tif ($this->isLoggedIn ()) { //only the logged in user may call logout.\n\t\t\t//Remove session data\n\t\t\tunset ( $this->session );\n\t\t\t$this->updateSession ();\n\t\t\tunset ($_SESSION['uid']);\n\t\t\tsession_destroy();\n\t\t}\n\t\techo '<reply action=\"ok\" />';\n\t}", "public function logOut () : void {\n $this->destroySession();\n }", "public function logout() {\n\t\t//Bridge Logout\n\t\tif ($this->config->get('cmsbridge_active') == 1 && !$this->lite_mode){\n\t\t\t$this->bridge->logout();\n\t\t}\n\n\t\t//Loginmethod logout\n\t\t$arrAuthObjects = $this->get_login_objects();\n\t\tforeach($arrAuthObjects as $strMethods => $objMethod){\n\t\t\tif (method_exists($objMethod, 'logout')){\n\t\t\t\t$objMethod->logout();\n\t\t\t}\n\t\t}\n\n\t\t//Destroy this session\n\t\t$this->destroy();\n\t}", "public function Logout() \n {\n session_unset();\n session_destroy();\n }", "public function logout() {\r\n\t\tSession::set('login', FALSE, self::$namespace);\r\n\t}", "private static function logout() {\n\t\t$key = Request::getCookie('session');\n\t\t$session = Session::getByKey($key);\n\t\tif ($session)\n\t\t\t$session->delete();\n\t\tOutput::deleteCookie('session');\n\t\tEnvironment::getCurrent()->notifySessionChanged(null);\n\t\tself::$loggedOut->call();\n\t}", "public function logout() {\n @session_start();\n session_destroy();\n }", "public function logout()\n {\n session_unset();\n // deletes session file\n session_destroy();\n }", "public function logoutxxx()\n {\n $this->getSession()->destroy();\n }", "public function logout()\n\t{\n\t\tif (isset($_SESSION[$this->sess_auth])) {\t\n\t\t\tSessionManager::instance()->trashLoginCreadentials();\n\t\t}\n\t}", "public function Logout() {\n\t\tsession_unset();\n\t\tsession_destroy();\n\t\theader('location: ?a=login');\n\t}", "public function logout()\n\t{\n\t\t$this->session->sess_destroy();\n\t\tredirect('main');\n\t}", "public function logout()\n\t{\n\t\t$this->session->sess_destroy();\n\n\t\tredirect('login');\n\t}", "public static function logout() {\n session_start();\n session_destroy();\n header(\"Location: /\");\n exit;\n }", "public function logout() {\r\n session_unset();\r\n session_destroy();\r\n header('location: ' . DB::MAIN_URL);\r\n }", "function logout() {\n\t\t$this->session->sess_destroy();\n\t\tredirect('c_login/login_form','refresh');\n\t}", "public function logout()\n {\n\t // unsets all cookies and session data\n process_logout(); \n }", "static function logout()\n {\n session_destroy();\n }", "public function logout(){\n\t\t// Destroy the All Session Variables\n\t\tSession::destroyAll();\n\n\t\t// Redirect to login page with message\n\t\tUrl::redirect('login/?logout=1');\n\t}", "function logout()\n\t{\n\n\t\t// log the user out\n\t\t$this->session->sess_destroy();\n\n\t\t// redirect them to the login page\n\t\tredirect('auth', 'refresh');\n\t}" ]
[ "0.8442549", "0.8360225", "0.83082336", "0.8288833", "0.82682294", "0.8265262", "0.82278305", "0.82249373", "0.821423", "0.8210084", "0.82098794", "0.8203934", "0.82014424", "0.8174821", "0.81561655", "0.8118859", "0.81179655", "0.80941784", "0.8085273", "0.8083066", "0.8075119", "0.80700505", "0.806584", "0.8064809", "0.8049729", "0.8048938", "0.80460423", "0.80450946", "0.8037738", "0.8031728" ]
0.8388605
1
Delete an individual survey submission
public function delete_survey_submission($id) { if ( isset($id) ) { $this->db->delete('vwm_surveys_submissions', array('id' => $id)); } elseif ( isset($survey_id) ) { $this->db->delete('vwm_surveys_submissions', array('survey_id' => $id)); } return $this->db->affected_rows() > 0 ? TRUE : FALSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testDeleteSurvey()\n {\n $survey = Survey::factory()->create();\n $surveyId = $survey->id;\n\n $response = $this->json('DELETE', \"survey/{$surveyId}\");\n\n $response->assertStatus(204);\n $this->assertDatabaseMissing('survey', ['id' => $surveyId]);\n }", "public function destroy(Submission $submission)\n {\n //\n }", "public function destroy(Survey $survey)\n {\n //\n }", "function deleteSubmission(&$args, &$request) {\n\t\t//FIXME: Implement\n\n\t\treturn false;\n\t}", "public function deletequestionAction()\r\n {\r\n if ($this->getRequest()->isPost()) {\r\n $params = $this->getRequest()->getParams();\r\n $questionId = $params['questionId'];\r\n\r\n\r\n $question = new Application_Model_DbTable_FicheQuestion();\r\n // delete the question\r\n $question->deleteQuestion($questionId);\r\n\r\n // Return to the page informations\r\n $this->_helper->redirector('gestionquestion', 'admin', null);\r\n\r\n }\r\n\r\n }", "public function delete_question(){\n $question_id = $this->input->post('question_id');\n $challenge_id = $this->input->post('challenge_id');\n\n $question = new stdClass();\n\n if($this->questionlib->isSafeToDelete($question_id) === true){\n $question->question_id = $question_id;\n\n $this->question_model->delete($question);\n $this->challenge_question_model->delete($challenge_id, $question_id);\n $out['deleted'] = true;\n }else{\n $out['message'] = \"Question have associate data, it can't be deleted\";\n }\n $this->output->set_output(json_encode($out));\n\n }", "public function destroy(IdeaSubmission $ideaSubmission)\n {\n //\n }", "function deleteSurveyRecord()\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\t$affectedRows = $ilDB->manipulateF(\"DELETE FROM svy_svy WHERE survey_id = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\n\t\t$result = $ilDB->queryF(\"SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\t$questionblocks = array();\n\t\twhile ($row = $ilDB->fetchAssoc($result))\n\t\t{\n\t\t\tarray_push($questionblocks, $row[\"questionblock_fi\"]);\n\t\t}\n\t\tif (count($questionblocks))\n\t\t{\n\t\t\t$affectedRows = $ilDB->manipulate(\"DELETE FROM svy_qblk WHERE \" . $ilDB->in('questionblock_id', $questionblocks, false, 'integer'));\n\t\t}\n\t\t$affectedRows = $ilDB->manipulateF(\"DELETE FROM svy_qblk_qst WHERE survey_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\t$this->deleteAllUserData();\n\n\t\t$affectedRows = $ilDB->manipulateF(\"DELETE FROM svy_anonymous WHERE survey_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\t\n\t\t// delete export files\n\t\tinclude_once \"./Services/Utilities/classes/class.ilUtil.php\";\n\t\t$svy_data_dir = ilUtil::getDataDir().\"/svy_data\";\n\t\t$directory = $svy_data_dir.\"/svy_\".$this->getId();\n\t\tif (is_dir($directory))\n\t\t{\n\t\t\tinclude_once \"./Services/Utilities/classes/class.ilUtil.php\";\n\t\t\tilUtil::delDir($directory);\n\t\t}\n\n\t\tinclude_once(\"./Services/MediaObjects/classes/class.ilObjMediaObject.php\");\n\t\t$mobs = ilObjMediaObject::_getMobsOfObject(\"svy:html\", $this->getId());\n\t\t// remaining usages are not in text anymore -> delete them\n\t\t// and media objects (note: delete method of ilObjMediaObject\n\t\t// checks whether object is used in another context; if yes,\n\t\t// the object is not deleted!)\n\t\tforeach($mobs as $mob)\n\t\t{\n\t\t\tilObjMediaObject::_removeUsage($mob, \"svy:html\", $this->getId());\n\t\t\t$mob_obj =& new ilObjMediaObject($mob);\n\t\t\t$mob_obj->delete();\n\t\t}\n\t}", "function delete_question($id){\n $this->db->where('question_id', $id);\n $this->db->delete('questions');\n }", "public function deleteAnswer()\n {\n $this->is_answer = false;\n $this->topic->is_answered = false;\n $post = $this;\n\n Db::transaction(function() use ($post)\n {\n $post->topic->save();\n $post->save();\n });\n }", "public function destroy(Survey $survey)\n {\n $survey->delete();\n return Redirect::route('surveys');\n }", "public function deleted(AssignmentSubmitted $as) {\n Messages::where('id', $as->message_id)->delete();\n }", "public function Delete($surveyid)\n\t{\n\t\t$surveyid = (int)$surveyid;\n\t\t$prefix = $this->Db->TablePrefix;\n\n\t\t// First Delete all Widgets Associated with the form,\n\t\t$widgets = $this->getWidgets($surveyid);\n\t\tforeach ($widgets as $key=>$widget) {\n\t\t\t\t// for each widget delete all the fields related ..\n\t\t\t\t$query = \"DELETE FROM {$prefix}surveys_fields WHERE surveys_widget_id = {$widget['id']}\";\n\t\t\t\t$this->Db->Query($query);\n\t\t}\n\n\t\t// Delete the actual widget,\n\t\t$query = \"DELETE FROM {$prefix}surveys_widgets WHERE surveys_id = {$surveyid}\";\n\t\t$this->Db->Query($query);\n\n\t\t// Lastly delete the actual suvey\n\t\t$query = \"DELETE FROM {$prefix}surveys WHERE id = $surveyid\";\n\t\t$this->Db->Query($query);\n\n\t\t// Delete all the responses and response value as well..\n\t\t$query = \"DELETE sr, srv\n\t\t\t\t FROM {$prefix}surveys_response as sr, {$prefix}surveys_response_value as srv\n\t\t\t\t WHERE sr.id = srv.surveys_response_id and\n\t\t\t\t sr.surveys_id = {$surveyid}\";\n\n\n\t\t// Delete all the files uploaded from the survey folders..\n\t\t$survey_images_dir = TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $surveyid;\n\n\t\tif (is_dir($survey_images_dir)) {\n\t\t// Delete using our library file\n\t\t\t\t$dir = new IEM_FileSystem_Directory($survey_images_dir);\n\t\t\t\t$dir->delete();\n\t\t}\n\n\t\t$this->Db->Query($query);\n\t}", "public function delete($id)\n {\n $this->db->where('id',$id);\n return $this->db->delete('user_survey_answer');\n }", "public function deleteAction()\n {\n /* Check if user is signed in and redirect to sign in if is not */\n $this->requireSignin();\n\n /* Getting current user's data */\n $user = Auth::getUser();\n\n /* Redirect link after deleting. By default index page */\n $returnUrl = (isset($_POST['return'])) ? '/'.$_POST['return'] : '/';\n\n /* Getting Question by id */\n $answer = Answer::getById(intval($_POST['id']));\n\n /* If Answer exists and is active */\n if ($answer) {\n\n /* Checking if signed in user is answer's author */\n if ($answer->user_id == $user->id) {\n\n /* Check if question deleted */\n if (Answer::delete($answer->id)) {\n\n Flash::addMessage(\"Answer deleted!\", Flash::INFO);\n \n } else {\n\n Flash::addMessage(\"You can not delete this answer!\", Flash::INFO);\n }\n\n } else {\n\n Flash::addMessage(\"You can not delete this answer!\", Flash::INFO);\n }\n\n } else {\n\n Flash::addMessage(\"You can not delete this answer!\", Flash::INFO);\n }\n\n /* Redirect back */\n $this->redirect($returnUrl);\n }", "public function deleteanswer(Request $request)\n\t{\n\t\t$ans = \\App\\Answer::destroy($request->input('id'));\n\t}", "public function delete_survey_submissions($survey_id)\n\t{\n\t\t$this->db->delete('vwm_surveys_submissions', array('survey_id' => $survey_id));\n\n\t\treturn $this->db->affected_rows() > 0 ? TRUE : FALSE;\n\t}", "function delete($id = null) {\n if (is_null($id)) { // check for a value in the id variable\n $this->Session->setFlash('Invalid id for survey', true, null, \"error\"); // send an error message\n $this->redirect(array('action'=>'index')); // go back to the index action\n }\n $i = $this->Survey->Respondent->Response->find('count', array('conditions' => array('survey_id' => $id)));\n if ($i > 0) {\n $this->Session->setFlash('A survey that has responses cannot be deleted. Please delete all survey responses first.', true, null, \"error\"); // send an error message\n $this->redirect(array('action'=>'index')); // go back to the index action\n }\n if ($this->Survey->delete($id)) { // delete the survey and return true if successful\n $this->Session->setFlash('Survey deleted', true, null, \"confirm\"); // send a confirmation message\n $this->redirect(array('action'=>'index')); // go back to the index view\n }\n // continue when the delete function returns false\n $this->Session->setFlash('Survey was not deleted', true, null, \"error\"); // send an error message\n $this->redirect(array('action' => 'index')); // go back to the index view\n }", "public function delete() {\n\t\t$this->assignment->delete();\n\t}", "function deleteBySubmissionId($submissionId) {\n\t\t$returner = false;\n\t\t$result =& $this->retrieve(\n\t\t\t'SELECT review_id FROM review_assignments WHERE submission_id = ?',\n\t\t\tarray((int) $submissionId)\n\t\t);\n\n\t\twhile (!$result->EOF) {\n\t\t\t$row = $result->GetRowAssoc(false);\n\t\t\t$reviewId = $row['review_id'];\n\n\t\t\t$this->update('DELETE FROM review_form_responses WHERE review_id = ?', $reviewId);\n\t\t\t$this->update('DELETE FROM review_assignments WHERE review_id = ?', $reviewId);\n\n\t\t\t$result->MoveNext();\n\t\t\t$returner = true;\n\t\t}\n\t\t$result->Close();\n\t\treturn $returner;\n\t}", "function delete_question() {\r\n global $db;\r\n\r\n // get global user object\r\n global $user;\r\n\r\n // protect from unauthorized access\r\n if (!isset($user) || (!isset($_SESSION['session_survey']))) {\r\n logout();\r\n die();\r\n }\r\n\r\n $question = new Question();\r\n $question->get_from_db($_GET['question_id']);\r\n $survey = new Survey();\r\n $survey->get_from_db($question->getSurvey());\r\n\r\n if ($survey->getCreatedBy() != $user->getId()) {\r\n if ($user->getAdmin() != 1) {\r\n logout();\r\n die();\r\n }\r\n }\r\n\r\n $question->setIsActive(0);\r\n $question->update_in_db();\r\n\r\n $cookie_key = 'msg';\r\n $cookie_value = 'Вие успешно изтрихте елемент от анкетата!';\r\n setcookie($cookie_key, $cookie_value, time() + 1);\r\n header('Location: ' . ROOT_DIR . '?page=survey_edit');\r\n die();\r\n}", "public function destroy( $id ) {\n\n $submission = Submission::find( $id );\n\n if ( empty( $submission) ) {\n\n return redirect( route( 'submissions.index' ) )->withErrors( [ 'notfound' => 'Submission not found' ] );\n\n }\n\n $submission->destroy( $id );\n\n Session::flash( 'flash_message', 'Submission deleted successfully.' );\n\n return redirect( route( 'submissions.index' ) );\n\n }", "public function deleted(InterviewQuestion $interviewQuestion): void\n {\n //\n }", "public function testDeleteSurvey0()\n {\n }", "public function testDeleteSurvey0()\n {\n }", "public function destroy($id)\n {\n $questions=DB::table('questions')->where('e_id', $id);\n $questions->delete();\n\n\n $exam=DB::table('exams')->where('e_id', $id);\n $exam->delete();\n return redirect('/dashboard')->with('success','Sucessfully Deleted Exam and their questions.');\n }", "public function deleteAnswers($question_id)\n\t{\n\t}", "public function deleteAnswersByQuestion($idQuestion)\n\t{\n\t\t$this->db->delete('respostas', \" `id_pergunta` = '\".$idQuestion.\"'\"); \n\t}", "public function deletequaliteAction()\r\n {\r\n if ($this->getRequest()->isPost()) {\r\n $params = $this->getRequest()->getParams();\r\n $qualiteId = $params['qualiteId'];\r\n\r\n\r\n $qualite = new Application_Model_DbTable_FicheQualite();\r\n // delete the qualite\r\n $qualite->deleteQualite($qualiteId);\r\n\r\n // Return to the page informations\r\n $this->_helper->redirector('gestionqualite', 'admin', null);\r\n\r\n }\r\n\r\n }", "function delete_question($questionid) {\n delete_records(\"question_turprove\", \"question\", $questionid);\n return true;\n }" ]
[ "0.704928", "0.6927132", "0.6782566", "0.67519563", "0.6743712", "0.67242193", "0.6659275", "0.6654835", "0.65483344", "0.6547482", "0.6538272", "0.6526627", "0.6492822", "0.64676714", "0.64564884", "0.6453267", "0.6381312", "0.63810337", "0.6379219", "0.6363803", "0.63554263", "0.6351556", "0.6342595", "0.6329575", "0.6329575", "0.63254064", "0.6312604", "0.6304798", "0.6304132", "0.6294992" ]
0.7071134
0
Delete all survey submissions for a particular survey
public function delete_survey_submissions($survey_id) { $this->db->delete('vwm_surveys_submissions', array('survey_id' => $survey_id)); return $this->db->affected_rows() > 0 ? TRUE : FALSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function Delete($surveyid)\n\t{\n\t\t$surveyid = (int)$surveyid;\n\t\t$prefix = $this->Db->TablePrefix;\n\n\t\t// First Delete all Widgets Associated with the form,\n\t\t$widgets = $this->getWidgets($surveyid);\n\t\tforeach ($widgets as $key=>$widget) {\n\t\t\t\t// for each widget delete all the fields related ..\n\t\t\t\t$query = \"DELETE FROM {$prefix}surveys_fields WHERE surveys_widget_id = {$widget['id']}\";\n\t\t\t\t$this->Db->Query($query);\n\t\t}\n\n\t\t// Delete the actual widget,\n\t\t$query = \"DELETE FROM {$prefix}surveys_widgets WHERE surveys_id = {$surveyid}\";\n\t\t$this->Db->Query($query);\n\n\t\t// Lastly delete the actual suvey\n\t\t$query = \"DELETE FROM {$prefix}surveys WHERE id = $surveyid\";\n\t\t$this->Db->Query($query);\n\n\t\t// Delete all the responses and response value as well..\n\t\t$query = \"DELETE sr, srv\n\t\t\t\t FROM {$prefix}surveys_response as sr, {$prefix}surveys_response_value as srv\n\t\t\t\t WHERE sr.id = srv.surveys_response_id and\n\t\t\t\t sr.surveys_id = {$surveyid}\";\n\n\n\t\t// Delete all the files uploaded from the survey folders..\n\t\t$survey_images_dir = TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $surveyid;\n\n\t\tif (is_dir($survey_images_dir)) {\n\t\t// Delete using our library file\n\t\t\t\t$dir = new IEM_FileSystem_Directory($survey_images_dir);\n\t\t\t\t$dir->delete();\n\t\t}\n\n\t\t$this->Db->Query($query);\n\t}", "public function destroy(Survey $survey)\n {\n //\n }", "function deleteSurveyRecord()\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\t$affectedRows = $ilDB->manipulateF(\"DELETE FROM svy_svy WHERE survey_id = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\n\t\t$result = $ilDB->queryF(\"SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\t$questionblocks = array();\n\t\twhile ($row = $ilDB->fetchAssoc($result))\n\t\t{\n\t\t\tarray_push($questionblocks, $row[\"questionblock_fi\"]);\n\t\t}\n\t\tif (count($questionblocks))\n\t\t{\n\t\t\t$affectedRows = $ilDB->manipulate(\"DELETE FROM svy_qblk WHERE \" . $ilDB->in('questionblock_id', $questionblocks, false, 'integer'));\n\t\t}\n\t\t$affectedRows = $ilDB->manipulateF(\"DELETE FROM svy_qblk_qst WHERE survey_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\t$this->deleteAllUserData();\n\n\t\t$affectedRows = $ilDB->manipulateF(\"DELETE FROM svy_anonymous WHERE survey_fi = %s\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\t\n\t\t// delete export files\n\t\tinclude_once \"./Services/Utilities/classes/class.ilUtil.php\";\n\t\t$svy_data_dir = ilUtil::getDataDir().\"/svy_data\";\n\t\t$directory = $svy_data_dir.\"/svy_\".$this->getId();\n\t\tif (is_dir($directory))\n\t\t{\n\t\t\tinclude_once \"./Services/Utilities/classes/class.ilUtil.php\";\n\t\t\tilUtil::delDir($directory);\n\t\t}\n\n\t\tinclude_once(\"./Services/MediaObjects/classes/class.ilObjMediaObject.php\");\n\t\t$mobs = ilObjMediaObject::_getMobsOfObject(\"svy:html\", $this->getId());\n\t\t// remaining usages are not in text anymore -> delete them\n\t\t// and media objects (note: delete method of ilObjMediaObject\n\t\t// checks whether object is used in another context; if yes,\n\t\t// the object is not deleted!)\n\t\tforeach($mobs as $mob)\n\t\t{\n\t\t\tilObjMediaObject::_removeUsage($mob, \"svy:html\", $this->getId());\n\t\t\t$mob_obj =& new ilObjMediaObject($mob);\n\t\t\t$mob_obj->delete();\n\t\t}\n\t}", "public function delete_poll_submissions() {\n\t\tforminator_validate_ajax( 'forminatorPollEntries' );\n\t\tif ( ! empty( $_POST['id'] ) ) {\n\t\t\t$form_id = intval( $_POST['id'] );\n\t\t\tForminator_Form_Entry_Model::delete_by_form( $form_id );\n\n\t\t\t$file = forminator_plugin_dir() . \"admin/views/poll/entries/content-none.php\";\n\n\t\t\tob_start();\n\t\t\t/** @noinspection PhpIncludeInspection */\n\t\t\tinclude $file;\n\t\t\t$html = ob_get_clean();\n\n\t\t\t$data['html'] = $html;\n\t\t\t$data['notification'] = array(\n\t\t\t\t'type' => 'success',\n\t\t\t\t'text' => __( 'All the submissions deleted successfully.', Forminator::DOMAIN ),\n\t\t\t\t'duration' => '4000',\n\t\t\t);\n\t\t\twp_send_json_success( $data );\n\t\t} else {\n\t\t\t$data['notification'] = array(\n\t\t\t\t'type' => 'error',\n\t\t\t\t'text' => __( 'Submission delete failed.', Forminator::DOMAIN ),\n\t\t\t\t'duration' => '4000',\n\t\t\t);\n\t\t\twp_send_json_error( $data );\n\t\t}\n\t}", "public function delete_survey_submission($id)\n\t{\n\t\tif ( isset($id) )\n\t\t{\n\t\t\t$this->db->delete('vwm_surveys_submissions', array('id' => $id));\n\t\t}\n\t\telseif ( isset($survey_id) )\n\t\t{\n\t\t\t$this->db->delete('vwm_surveys_submissions', array('survey_id' => $id));\n\t\t}\n\n\t\treturn $this->db->affected_rows() > 0 ? TRUE : FALSE;\n\t}", "public function testDeleteSurvey()\n {\n $survey = Survey::factory()->create();\n $surveyId = $survey->id;\n\n $response = $this->json('DELETE', \"survey/{$surveyId}\");\n\n $response->assertStatus(204);\n $this->assertDatabaseMissing('survey', ['id' => $surveyId]);\n }", "public function destroy(Survey $survey)\n {\n $survey->delete();\n return Redirect::route('surveys');\n }", "function recycle_surveys()\n\t{\n\t\tif ($this->course->has_resources(RESOURCE_SURVEY))\n\t\t{\n\t\t\t$table_survey = Database :: get_course_table(TABLE_SURVEY);\n\t\t\t$table_survey_q = Database :: get_course_table(TABLE_SURVEY_QUESTION);\n\t\t\t$table_survey_q_o = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);\n\t\t\t$table_survey_a = Database :: get_course_Table(TABLE_SURVEY_ANSWER);\n\t\t\t$table_survey_i = Database :: get_course_table(TABLE_SURVEY_INVITATION);\n\t\t\t$ids = implode(',', (array_keys($this->course->resources[RESOURCE_SURVEY])));\n\t\t\t$sql = \"DELETE FROM \".$table_survey_i.\" \";\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t\t$sql = \"DELETE FROM \".$table_survey_a.\" WHERE survey_id IN(\".$ids.\")\";\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t\t$sql = \"DELETE FROM \".$table_survey_q_o.\" WHERE survey_id IN(\".$ids.\")\";\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t\t$sql = \"DELETE FROM \".$table_survey_q.\" WHERE survey_id IN(\".$ids.\")\";\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t\t$sql = \"DELETE FROM \".$table_survey.\" WHERE survey_id IN(\".$ids.\")\";\n\t\t\tapi_sql_query($sql,__FILE__,__LINE__);\n\t\t}\n\t}", "public function batchDestroy(PastQuestionMultipleRequest $request)\n {\n // Gets all the past questions in the array by id\n $past_questions = PastQuestion::whereIn('id', $request->input('past_questions'))->get();\n if ($past_questions) {\n\n // Deletes all found past questions\n $filtered = $past_questions->filter(function ($value, $key) {\n if ($value->uploaded_by === auth()->user()->id || $this->USER_LEVEL_3 === auth()->user()->rank) {\n if ($value->delete()) {\n return $value;\n }\n }\n });\n\n // Check's if any past questions were deleted\n if (($deleted = count($filtered)) > 0) {\n return $this->actionSuccess(\"$deleted Past question(s) deleted\");\n } else {\n return $this->requestConflict('Currently unable to delete past question(s)');\n }\n\n } else {\n return $this->notFound('Past question(s) not found');\n }\n }", "public function massDestroy(Request $request)\r\n {\r\n if (!Gate::allows('questions_option_delete')) {\r\n return abort(401);\r\n }\r\n if ($request->input('ids')) {\r\n $entries = QuestionsOption::whereIn('id', $request->input('ids'))->get();\r\n\r\n foreach ($entries as $entry) {\r\n $entry->delete();\r\n }\r\n }\r\n }", "public function massDestroy(Request $request)\n {\n if (! Gate::allows('answer_delete')) {\n return abort(401);\n }\n if ($request->input('ids')) {\n $entries = Answer::whereIn('id', $request->input('ids'))->get();\n\n foreach ($entries as $entry) {\n $entry->delete();\n }\n }\n }", "public function removeQuestions($lecture_id, $chapter_id, $survey_id) {\n $request_parameter = (array) Request::all();\n $questions_to_remove_array = explode(\"_\", $request_parameter['questions_to_remove']);\n\n //print_r($questions_to_remove_array);\n\n if ($this->hasPermission($lecture_id)) {\n DB::transaction(function() use ($questions_to_remove_array, $survey_id) {\n for ($x = 0; $x < sizeof($questions_to_remove_array); $x++) {\n QuestionModel::where(['survey_id' => $survey_id, 'id' => $questions_to_remove_array[$x]])->delete();\n }\n });\n } else {\n // TODO: Permission denied page\n print \"Permission denied\";\n }\n\n return redirect()->route('survey', ['lecture_id' => $lecture_id, 'chapter_id' => $chapter_id, 'survey_id' => $survey_id]);\n }", "public function delete_survey($session_key, $sid)\n {\n if ($this->_checkSessionKey($session_key))\n {\n if (hasSurveyPermission($sid, 'survey', 'delete'))\n {\n Survey::model()->deleteAllByAttributes(array('sid' => $sid));\n rmdirr(Yii::app()->getConfig(\"uploaddir\") . '/surveys/' . $sid);\n return array('status' => 'OK');\n }\n else\n throw new Zend_XmlRpc_Server_Exception('No permission', 2);\n }\n }", "function editCleanUp($question_id)\r\n {\r\n \t\t$this->query('DELETE FROM questions WHERE id='.$question_id);\r\n\t\t$this->query('DELETE FROM responses WHERE question_id='.$question_id);\r\n\t\t$this->query('DELETE FROM survey_questions WHERE question_id='.$question_id);\r\n }", "public function destroy(ClientSurvey $clientSurvey)\n {\n //\n }", "public function deleteAnswersByQuestion($idQuestion)\n\t{\n\t\t$this->db->delete('respostas', \" `id_pergunta` = '\".$idQuestion.\"'\"); \n\t}", "public function reset_survey_post()\n\t\t{\n\t\t\t$uuid = $this->post('uuid');\n\t\t\t$weekSend = $this->post('weekSend');\n\t\t\tif(!empty($uuid) && !empty($weekSend))\n\t\t\t{\n\t\t\t\t$this->db->where('ts_uuid' , $uuid)\n\t\t\t\t\t\t->where('ts_week' , $weekSend)\n\t\t\t\t\t\t->where('ts_test_id' , 1)\n\t\t\t\t\t\t->delete('plused_test_submited');\n\t\t\t\t$data['status'] = $this->lang->line('SUCCESS');\n\t\t\t\t$data['message'] = $this->lang->line('VALID_TOKEN_MESSAGE');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$data['status'] = $this->lang->line('FAIL');\n\t\t\t\t$data['message'] = $this->lang->line('please_pass_required');\n\t\t\t}\n\t\t\t$this->response($data , 200);\n\t\t}", "public function delete_all(Request $r)\n\t{\n\t\t$input = $r->all();\n\t\tforeach($input['datachecked'] as $tag)\n\t\t{\n\t\t\t$tag_status = \\App\\Tag::where('id',$tag)->first();\n\t\t\t$tag_status->delete();\n }\n session()->flash('success', 'Tag(s) deleted successfully.');\n\t\techo 'success';\n\t}", "public function deleteAnswers($question_id)\n\t{\n\t}", "public function massDestroy(Request $request)\n {\n if ($request->input('ids')) {\n $entries = Subjects::whereIn('id', $request->input('ids'))->get();\n\n foreach ($entries as $entry) {\n $entry->delete();\n }\n }\n }", "public function delete($id)\n {\n $this->db->where('id',$id);\n return $this->db->delete('user_survey_answer');\n }", "public function destroyall(Request $request)\n {\n if(count(collect($request->checkbox)) > 1){\n $post = Post::whereIn('id',$request->get('checkbox'));\n $post->delete();\n }else{\n $post = post::find($request->get('checkbox'))->first();\n $post->delete();\n }\n return back();\n }", "public function removeAllAction()\n {\n $isPosted = $this->request->getPost('doRemoveAll');\n if (!$isPosted) {\n $this->response->redirect($this->request->getPost('redirect'));\n }\n $comments = new \\Anax\\Comment\\CommentsInSession();\n $comments->setDI($this->di);\n $comments->deleteAll($this->request->getPost('pageKey'));\n $this->response->redirect($this->request->getPost('redirect'));\n }", "public function batchPermanentDestroy(PastQuestionMultipleRequest $request)\n {\n // Check access level\n if ($this->USER_LEVEL_3 !== auth()->user()->rank) {\n return $this->authenticationFailure('Please contact management');\n }\n\n // Gets all the past questions in the array by id\n $past_questions = PastQuestion::with('image','document')\n ->whereIn('id', $request->input('past_questions'))->get();\n if ($past_questions) {\n\n // Deletes all found past questions\n $filtered = $past_questions->filter(function ($value, $key) {\n if ($value->forceDelete()) {\n return $value;\n }\n });\n\n // Check's if any past questions were deleted\n if (($deleted = count($filtered)) > 0) {\n\n // Remove previously stored images from server or cloud\n if (config('ovsettings.image_permanent_delete')) {\n $removed_images = $filtered->filter(function ($value, $key){\n if (BatchMediaProcessors::batchUnStoreImages($value->image)){\n return true;\n }\n });\n $removed_images = count($removed_images);\n } else { $removed_images = 0; }\n\n // Remove previously stored document from server or cloud\n if (config('ovsettings.document_permanent_delete')) {\n $removed_documents = $filtered->filter(function ($value, $key){\n if (BatchMediaProcessors::batchUnStoreFiles($value->document)) {\n return true;\n }\n });\n $removed_documents = count($removed_documents);\n } else { $removed_documents = 0; }\n\n return $this->actionSuccess(\"$deleted Past question(s) deleted with $removed_images image file(s) and $removed_documents document File(s) removed\");\n } else {\n return $this->requestConflict('Currently unable to delete past question(s)');\n }\n\n } else {\n return $this->notFound('Past question(s) not found');\n }\n }", "public function reset_survey_options_post()\n\t\t{\n\t\t\t$uuid = $this->post('uuid');\n\t\t\t$weekSend = $this->post('weekSend');\n\t\t\tif(!empty($uuid) && !empty($weekSend))\n\t\t\t{\n\t\t\t\t$this->db->where('tans_uuid' , $uuid)\n\t\t\t\t\t\t->where('tans_week' , $weekSend)\n\t\t\t\t\t\t->delete('plused_test_answers');\n\t\t\t\t$data['status'] = $this->lang->line('SUCCESS');\n\t\t\t\t$data['message'] = $this->lang->line('VALID_TOKEN_MESSAGE');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$data['status'] = $this->lang->line('FAIL');\n\t\t\t\t$data['message'] = $this->lang->line('please_pass_required');\n\t\t\t}\n\t\t\t$this->response($data , 200);\n\t\t}", "public function delete(Datastore $db)\n {\n $stmt = $db->prepare('DELETE FROM tbl_survey WHERE col_uuid = :surveyUuid');\n $stmt->bindValue(':surveyUuid', $this->uuid, PDO::PARAM_STR);\n $db->execute($stmt);\n }", "public function massDestroy(Request $request)\n {\n if (! Gate::allows('exam_delete')) {\n return abort(401);\n }\n if ($request->input('ids')) {\n $entries = Exam::whereIn('id', $request->input('ids'))->get();\n\n foreach ($entries as $entry) {\n $entry->delete();\n }\n }\n }", "function questionnaire_delete_instance($id) {\n global $DB, $CFG;\n require_once($CFG->dirroot.'/mod/questionnaire/locallib.php');\n\n if (! $questionnaire = $DB->get_record('questionnaire', array('id' => $id))) {\n return false;\n }\n\n $result = true;\n\n if (! $DB->delete_records('questionnaire', array('id' => $questionnaire->id))) {\n $result = false;\n }\n\n if ($survey = $DB->get_record('questionnaire_survey', array('id' => $questionnaire->sid))) {\n // If this survey is owned by this course, delete all of the survey records and responses.\n if ($survey->owner == $questionnaire->course) {\n $result = $result && questionnaire_delete_survey($questionnaire->sid, $questionnaire->id);\n }\n }\n\n if ($events = $DB->get_records('event', array(\"modulename\" => 'questionnaire', \"instance\" => $questionnaire->id))) {\n foreach ($events as $event) {\n delete_event($event->id);\n }\n }\n\n return $result;\n}", "function delete($id = null) {\n if (is_null($id)) { // check for a value in the id variable\n $this->Session->setFlash('Invalid id for survey', true, null, \"error\"); // send an error message\n $this->redirect(array('action'=>'index')); // go back to the index action\n }\n $i = $this->Survey->Respondent->Response->find('count', array('conditions' => array('survey_id' => $id)));\n if ($i > 0) {\n $this->Session->setFlash('A survey that has responses cannot be deleted. Please delete all survey responses first.', true, null, \"error\"); // send an error message\n $this->redirect(array('action'=>'index')); // go back to the index action\n }\n if ($this->Survey->delete($id)) { // delete the survey and return true if successful\n $this->Session->setFlash('Survey deleted', true, null, \"confirm\"); // send a confirmation message\n $this->redirect(array('action'=>'index')); // go back to the index view\n }\n // continue when the delete function returns false\n $this->Session->setFlash('Survey was not deleted', true, null, \"error\"); // send an error message\n $this->redirect(array('action' => 'index')); // go back to the index view\n }", "function resetSurveyData(\\Plugin\\Project $eventProject, \\Plugin\\Record $surveyRecord, $eventID, $deleteFields) {\n $surveyRecord->updateDetails($deleteFields);\n $surveyIDs = array();\n $sql = \"SELECT survey_id\n FROM redcap_surveys\n WHERE project_id=\".$eventProject->getProjectId();\n $result = db_query($sql);\n while ($row = db_fetch_assoc($result)) {\n $surveyIDs[] = $row['survey_id'];\n }\n\n $participantIDs = array();\n $sql = \"SELECT d.participant_id\n FROM redcap_surveys_participants d\n JOIN redcap_surveys_response d2\n ON d.participant_id = d2.participant_id AND d2.record=\".$surveyRecord->getId().\"\n WHERE d.event_id=\".$eventID.\"\n AND d.survey_id IN (\".implode(\",\",$surveyIDs).\")\";\n $result = db_query($sql);\n while ($row = db_fetch_assoc($result)) {\n $participantIDs[] = $row['participant_id'];\n }\n\n foreach ($participantIDs as $participantID) {\n $sql = \"UPDATE redcap_surveys_response\n SET start_time=NULL, first_submit_time=NULL, completion_time=NULL, return_code=NULL, results_code=NULL\n WHERE record=\".$surveyRecord->getId().\" AND participant_id=\".$participantID;\n db_query($sql);\n }\n}" ]
[ "0.67710656", "0.65085137", "0.65076256", "0.6371583", "0.6282924", "0.62668693", "0.61472", "0.61339176", "0.6004049", "0.5990968", "0.59772944", "0.59734684", "0.5972448", "0.5812081", "0.5793504", "0.57799935", "0.57547843", "0.5746567", "0.57342863", "0.573265", "0.57054245", "0.56958246", "0.5679387", "0.56751007", "0.5667873", "0.5639087", "0.56370187", "0.56327224", "0.56264246", "0.56222826" ]
0.6699532
1
Get all submissions for a given survey If completed_since is set than we will check for all surveys completed since that time. This will be used to see if the user wants to compile new results based on the new completed survey submissions.
public function get_completed_survey_submissions($id, $completed_since = NULL) { $data = array(); $this->db ->order_by('completed', 'ASC') ->where('completed IS NOT NULL', NULL, TRUE) ->where('survey_id', $id); // If completed_since is set, only grab completed submissions AFTER that date if ($completed_since != NULL) { $this->db->where('completed >=', $completed_since); } $query = $this->db->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[ $row->id ] = array( 'member_id' => (int)$row->member_id, 'survey_id' => (int)$row->survey_id, 'data' => json_decode($row->data, TRUE), 'created' => (int)$row->created, 'updated' => (int)$row->updated, 'completed' => (int)$row->completed, 'current_page' => (int)$row->current_page, 'complete' => (bool)$row->completed ); } } return $data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function all_submissions($min_status = 0) {\n\t\tif (!$this->submitable()) return array();\n\t\tstatic $query;\n\t\tDB::prepare_query($query,\n\t\t\t\"SELECT * FROM `submission`\".\n\t\t\t\" WHERE `entity_path` = ? AND `status` >= ?\".\n\t\t\t\" ORDER BY `time` ASC\"\n\t\t);\n\t\t$query->execute(array($this->path(), $min_status));\n\t\treturn Submission::fetch_all($query);\n\t}", "public function get_survey_submissions($filters, $order_by = 'updated', $order_by_order = 'DESC')\n\t{\n\t\t$data = array();\n\n\t\t$order_by = in_array($order_by, array('id', 'member_id', 'survey_id', 'created', 'updated', 'completed', 'complete')) ? $order_by : 'updated';\n\t\t$order_by_order = in_array($order_by_order, array('ASC', 'DESC', 'RANDOM')) ? $order_by_order : 'DESC';\n\n\t\t$this->db->order_by($order_by, $order_by_order);\n\n\t\t// Filter survey ID\n\t\tif ( isset($filters['survey_id']) AND $filters['survey_id'])\n\t\t{\n\t\t\t$this->db->where('survey_id', $filters['survey_id']);\n\t\t}\n\n\t\t// Filter member ID\n\t\tif ( isset($filters['member_id']) AND $filters['member_id'])\n\t\t{\n\t\t\t$this->db->where('member_id', $filters['member_id']);\n\t\t}\n\n\t\t// Filter group ID\n\t\tif ( isset($filters['group_id']) AND $filters['group_id'])\n\t\t{\n\t\t\t$this->db->join('members', 'members.member_id = vwm_surveys_submissions.member_id');\n\t\t\t$this->db->where('group_id', $filters['group_id']);\n\t\t}\n\n\t\t// If a valid created from date was provided\n\t\tif ( isset($filters['created_from']) AND strtotime($filters['created_from']) )\n\t\t{\n\t\t\t// If a valid created to date was provided as well\n\t\t\tif ( isset($filters['created_to']) AND strtotime($filters['created_to']) )\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Add one day (86400 seconds) to created_to date\n\t\t\t\t *\n\t\t\t\t * If user is searching for all surveys created from 1/1/2000 to\n\t\t\t\t * 1/1/2000 it should show all surveys created on 1/1/2000.\n\t\t\t\t */\n\t\t\t\t$this->db->where( '`created` BETWEEN ' . strtotime($filters['created_from']) . ' AND ' . (strtotime($filters['created_to']) + 86400), NULL, FALSE );\n\t\t\t}\n\t\t\t// Just a created from date was provided\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where( 'created >=', strtotime($filters['created_from']) );\n\t\t\t}\n\t\t}\n\n\t\t// If a valid updated from date was provided\n\t\tif ( isset($filters['updated_from']) AND strtotime($filters['updated_from']) )\n\t\t{\n\t\t\t// If a valid updated to date was provided as well\n\t\t\tif ( isset($filters['updated_to']) AND strtotime($filters['updated_to']) )\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Add one day (86400 seconds) to updated_to date\n\t\t\t\t *\n\t\t\t\t * If user is searching for all surveys updated from 1/1/2000 to\n\t\t\t\t * 1/1/2000 it should show all surveys updated on 1/1/2000.\n\t\t\t\t */\n\t\t\t\t$this->db->where( '`updated` BETWEEN ' . strtotime($filters['updated_from']) . ' AND ' . (strtotime($filters['updated_to']) + 86400), NULL, FALSE );\n\t\t\t}\n\t\t\t// Just a updated from date was provided\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where( 'updated >=', strtotime($filters['updated_from']) );\n\t\t\t}\n\t\t}\n\n\t\t// Filter completed\n\t\tif ( isset($filters['complete']) AND $filters['complete'] !== NULL)\n\t\t{\n\t\t\t// Show completed subissions\n\t\t\tif ($filters['complete'])\n\t\t\t{\n\t\t\t\t$this->db->where('completed IS NOT NULL', NULL, TRUE);\n\t\t\t}\n\t\t\t// Show incomplete submissions\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where('completed IS NULL', NULL, TRUE);\n\t\t\t}\n\t\t}\n\t\t\n\t\t$query = $this->db->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\tforeach ($query->result() as $row)\n\t\t\t{\n\t\t\t\t$data[ (int)$row->id ] = array(\n\t\t\t\t\t'id' => (int)$row->id,\n\t\t\t\t\t'hash' => $row->hash,\n\t\t\t\t\t'member_id' => (int)$row->member_id,\n\t\t\t\t\t'survey_id' => (int)$row->survey_id,\n\t\t\t\t\t'created' => (int)$row->created,\n\t\t\t\t\t'updated' => (int)$row->updated,\n\t\t\t\t\t'completed' => (int)$row->completed,\n\t\t\t\t\t'complete' => (bool)$row->completed\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn $data;\n\t}", "function submitted_events_get_pending_submissions() {\n\tglobal $wpdb;\n\t// Get all submissions that have not had events generated for them\n\t$table_name = $wpdb->prefix . \"submitted_events\";\n\treturn $wpdb->get_results ( \"SELECT * FROM \" . $table_name . \" WHERE eventgenerated = 0\" );\n}", "function all_final_submissions($min_status = 0) {\n\t\treturn $this->all_final_submissions_from( $this->all_submissions($min_status) );\n\t}", "public function questions($survey = \"\")\n {\n\n $surveyPrefix = \"\";\n $surveyData = $this->survey_model->getSurveyPrefix($survey);\n $data[\"valid_survey\"] = true;\n $data[\"show_questions\"] = true;\n $data[\"survey_errors\"] = false;\n\n // check if the provided slug was valid\n if($surveyData != null) {\n\n // populate survery information\n $surveyPrefix = $surveyData->prefix;\n $data[\"survey_title\"] = $surveyData->title;\n $data[\"survey_subtitle\"] = $surveyData->subtitle;\n }\n else {\n $data[\"valid_survey\"] = false; // display error\n }\n\n // check if the survey was submitted\n if($_SERVER['REQUEST_METHOD'] == 'POST' && $data[\"valid_survey\"]) {\n $result = $this->survey_model->validateSubmission($surveyPrefix);\n if(array_key_exists(\"errors\", $result)) {\n $data[\"errors\"] = $result[\"errors\"];\n $data[\"survey_errors\"] = true;\n }\n else {\n $data[\"show_questions\"] = false;\n }\n }\n\n // check if the user specified a valid survey\n if(!empty($surveyPrefix)) {\n\n $data[\"questions\"] = $this->survey_model->getSurveyData($surveyPrefix);\n ($data[\"questions\"] === null) ? $data[\"valid_survey\"] = false: \"\";\n }\n\n $data[\"active_surveys\"] = \"\";\n $this->load->view('templates/survey/header', $data);\n $this->load->view('templates/survey/nav');\n $this->load->view('templates/survey/survey', $data);\n $this->load->view('templates/survey/footer');\n }", "public function getSurveys() {\n return $this->_request(\n \"surveys/\"\n );\n }", "function all_final_submissions_quick($min_status = 0) {\n\t\tif ($this->attribute_bool('keep best')) {\n\t\t\t$join_on = \"best\";\n\t\t} else {\n\t\t\t$join_on = \"last\";\n\t\t}\n\t\tstatic $query;\n\t\tDB::prepare_query($query, \"SELECT * FROM user_entity as ue JOIN submission as s ON ue.\".$join_on.\"_submissionid = s.submissionid\".\n\t\t\t\" WHERE ue.`entity_path` = ? AND `status` >= ?\".\n\t\t\t\" ORDER BY `time` ASC\"\n\t\t);\n\t\t$query->execute(array($this->path(), $min_status));\n\t\t$subs = Submission::fetch_all($query);\n\t\t$result = array();\n\t\tforeach($subs as $s) {\n\t\t\t$result[$s->userid] = $s;\n\t\t}\n\t\treturn $result;\n\t}", "protected function createSurveyEntries(): array\n {\n $result = [];\n $query = $this->SurveyResults->find();\n $count = 0;\n\n $this->out((string)__d('Qobo/Survey', 'Found [{0}] survey_result records', $query->count()));\n\n if (empty($query->count())) {\n return $result;\n }\n\n foreach ($query as $item) {\n $survey = $this->Surveys->find()\n ->where(['id' => $item->get('survey_id')]);\n\n if (!$survey->count()) {\n $this->warn((string)__d('Qobo/Survey', 'Survey [{0}] is not found. Moving on', $item->get('survey_id')));\n\n continue;\n }\n\n $entry = $this->SurveyEntries->find()\n ->where([\n 'id' => $item->get('submit_id'),\n ])\n ->first();\n\n if (empty($entry)) {\n if (empty($item->get('submit_id'))) {\n continue;\n }\n\n $entry = $this->SurveyEntries->newEntity();\n $entry->set('id', $item->get('submit_id'));\n $entry->set('submit_date', $item->get('submit_date'));\n $entry->set('survey_id', $item->get('survey_id'));\n $entry->set('status', 'in_review');\n $entry->set('score', 0);\n\n $saved = $this->SurveyEntries->save($entry);\n\n if ($saved) {\n $result[] = $saved->get('id');\n $count++;\n } else {\n $this->out((string)__d('Qobo/Survey', 'Survey Result with Submit ID [{0}] cannot be saved. Next', $item->get('submit_id')));\n }\n } else {\n // saving existing survey_entries,\n // to double check if anything is missing as well.\n $result[] = $entry->get('id');\n }\n }\n\n $this->out((string)__d('Qobo/Survey', 'Saved [{0}] survey_entries', $count));\n\n //keeping only unique entry ids, to avoid excessive iterations.\n $result = array_values(array_unique($result));\n\n return $result;\n }", "public function getSubmissionsForSelect($conferenceId = null, $empty = null)\n\t{\n\t\t$return = array();\n\n\t\tif ($empty) {\n\t\t\t$return[0] = $empty;\n\t\t}\n\n\t\t$identity = Zend_Auth::getInstance()->getIdentity();\n\n\t\t$query = 'select st.submission_id, s.title from submission_status st\n\t\tleft join submissions s ON s.submission_id = st.submission_id\n\t\twhere st.status = :status AND s.conference_id = :conference_id';\n\n\t\tif (!$identity->isAdmin()) {\n\t\t\t// if user is not admin, only show their own submissions\n\t\t\t$mySubmissions = implode(\",\", array_keys($identity->getMySubmissions()));\n\t\t\tif (!empty($mySubmissions)) {\n\t\t\t\t$query .= ' and st.submission_id IN ('.$mySubmissions.')';\n\t\t\t} else {\n\t\t\t\treturn array();\n\t\t\t}\n\t\t}\n\n\t\t$submissions = $this->getAdapter()->query(\n\t\t\t$query,\n\t\t\tarray(\n\t\t\t\t'status' => $this->_getAcceptedValue(),\n\t\t\t\t'conference_id' => $this->getConferenceId()\n\t\t\t)\n\t\t);\n\t\tforeach ($submissions as $submission) {\n\t\t\t$return[$submission['submission_id']] = $submission['title'];\n\t\t}\n\t\treturn $return;\n\t}", "function getCumulatedResults(&$question, $finished_ids)\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\tif(!$finished_ids)\n\t\t{\n\t\t\t$result = $ilDB->queryF(\"SELECT finished_id FROM svy_finished WHERE survey_fi = %s\",\n\t\t\t\tarray('integer'),\n\t\t\t\tarray($this->getSurveyId())\n\t\t\t);\n\t\t\t$nr_of_users = $result->numRows();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$nr_of_users = sizeof($finished_ids);\n\t\t}\n\t\t\n\t\t$result_array =& $question->getCumulatedResults($this->getSurveyId(), $nr_of_users, $finished_ids);\n\t\treturn $result_array;\n\t}", "function &getUserSpecificResults($finished_ids)\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\t$evaluation = array();\n\t\t$questions =& $this->getSurveyQuestions();\n\t\tforeach ($questions as $question_id => $question_data)\n\t\t{\n\t\t\tinclude_once \"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php\";\n\t\t\t$question_type = SurveyQuestion::_getQuestionType($question_id);\n\t\t\tSurveyQuestion::_includeClass($question_type);\n\t\t\t$question = new $question_type();\n\t\t\t$question->loadFromDb($question_id);\n\t\t\t$data =& $question->getUserAnswers($this->getSurveyId(), $finished_ids);\n\t\t\t$evaluation[$question_id] = $data;\n\t\t}\n\t\treturn $evaluation;\n\t}", "public function getSubmissions()\n {\n return $this->getFiles()->filter(function (File $file) {\n return $file->getOwner()->getType() === 'student';\n });\n }", "public function __invoke(): Collection|array\n {\n return Survey::all();\n }", "function get_available_by_user_surveys($user_id) {\r\n // get available by time\r\n $available_by_time_surveys = array();\r\n if (get_available_by_time_surveys()) {\r\n $available_by_time_surveys = get_available_by_time_surveys();\r\n }\r\n\r\n // get user groups\r\n $user_staff_groups = get_user_staff_groups($user_id);\r\n $user_student_groups = get_user_student_groups($user_id);\r\n $user_local_groups = get_user_local_groups($user_id);\r\n\r\n // set available_by_user_surveys\r\n $available_by_user_surveys = array();\r\n foreach ($available_by_time_surveys as $survey_id) {\r\n // check whether is already voted\r\n // get survey groups\r\n $survey_staff_groups = get_survey_staff_groups($survey_id);\r\n $survey_student_groups = get_survey_student_groups($survey_id);\r\n $survey_local_groups = get_survey_local_groups($survey_id);\r\n\r\n // get common groups\r\n $staff_groups = array_intersect($user_staff_groups, $survey_staff_groups);\r\n $student_groups = array_intersect($user_student_groups, $survey_student_groups);\r\n $local_groups = array_intersect($user_local_groups, $survey_local_groups);\r\n\r\n // get all available surveys\r\n if (!empty($staff_groups) || !empty($student_groups) || !empty($local_groups)) {\r\n array_push($available_by_user_surveys, $survey_id);\r\n }\r\n }\r\n\r\n return $available_by_user_surveys;\r\n}", "public function get_survey_submission($hash = NULL, $submission_id = NULL)\n\t{\n\t\t$data = array();\n\n\t\t// If we have a submission hash\n\t\tif ($hash)\n\t\t{\n\t\t\t$this->db->where('hash', $hash);\n\t\t}\n\t\t// If we do not have a submission hash we must have a submission ID\n\t\telse\n\t\t{\n\t\t\t$this->db->where('id', $submission_id);\n\t\t}\n\n\t\t$query = $this->db->limit(1)->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\t$row = $query->row();\n\n\t\t\t$data = array(\n\t\t\t\t'id' => (int)$row->id,\n\t\t\t\t'hash' => $row->hash,\n\t\t\t\t'member_id' => (int)$row->member_id,\n\t\t\t\t'survey_id' => (int)$row->survey_id,\n\t\t\t\t'data' => json_decode($row->data, TRUE),\n\t\t\t\t'created' => (int)$row->created,\n\t\t\t\t'updated' => (int)$row->updated,\n\t\t\t\t'completed' => (int)$row->completed,\n\t\t\t\t'current_page' => (int)$row->current_page,\n\t\t\t\t'complete' => (bool)$row->completed\n\t\t\t);\n\t\t}\n\n\t\treturn $data;\n\t}", "public function getSurveys() {\n $surveys = array();\n $jsonData = $this->getDataFromDataFolder();\n foreach($jsonData as $surveyData) {\n $surveys[] = $this->serializer->deserialize(\n json_encode($surveyData->survey), Survey::class, 'json'\n );\n }\n $surveys = array_unique($surveys, SORT_REGULAR);\n return $surveys;\n }", "function get_available_by_time_surveys() {\r\n // set connection var\r\n global $db;\r\n\r\n // get current time\r\n $time = date(\"Y-m-d H:i:s\");\r\n\r\n // query to get all vote survey_ids for session user\r\n $sql = \"SELECT id\r\n FROM surveys\r\n WHERE is_active = '1' AND status = '1' AND available_from < '$time' AND available_due > '$time';\";\r\n $surveys_data = array();\r\n $surveys = array();\r\n foreach ($db->query($sql) as $key => $value) {\r\n $surveys_data[$key] = $value;\r\n foreach ($surveys_data[$key] as $subkey => $subvalue) {\r\n if (is_int($subkey)) {\r\n $surveys[] = $subvalue;\r\n }\r\n }\r\n }\r\n\r\n return $surveys;\r\n}", "function getAll() {\r\n\t\treturn SurveyAnswerQuery::create()->find();\r\n\t}", "function GetSubmissions () {\n $array = array ();\n $result = @mysql_query (\"SELECT `submission_id` FROM `hunt_submissions` WHERE `submission_hunt` = '\".$this->hunt_id.\"' ORDER BY `submission_timestamp` ASC;\", $this->ka_db);\n while ($row = @mysql_fetch_array ($result))\n $array [] = new Submission ($row[\"submission_id\"], $this->roster_coder);\n return $array;\n }", "function learndash_get_submitted_essay_data( $quiz_id, $question_id, $essay ) {\n\t$users_quiz_data = get_user_meta( $essay->post_author, '_sfwd-quizzes', true );\n\tif ( ( !empty( $users_quiz_data ) ) && ( is_array( $users_quiz_data ) ) ) {\n\t\tif ( ( $essay ) && ( is_a( $essay, 'WP_Post' ) ) ) {\n\t\t\t$essay_quiz_time = get_post_meta( $essay->ID, 'quiz_time', true );\n\t\t} else {\n\t\t\t$essay_quiz_time = null;\n\t\t}\n\n\t\tforeach ( $users_quiz_data as $quiz_data ) {\n\t\t\t// We check for a match on the quiz time from the essay postmeta first. \n\t\t\t// If the essay_quiz_time is not empty and does NOT match then continue;\n\t\t\tif ( ( absint( $essay_quiz_time ) ) && ( isset( $quiz_data['time'] ) ) && ( absint( $essay_quiz_time ) !== absint( $quiz_data['time'] ) ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (empty($quiz_data['pro_quizid']) || $quiz_id != $quiz_data['pro_quizid'] || ! isset( $quiz_data['has_graded'] ) || false == $quiz_data['has_graded'] ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ((isset($quiz_data['graded'])) && (!empty($quiz_data['graded']))) {\n\t\t\t\tforeach ( $quiz_data['graded'] as $key => $graded_question ) {\n\t\t\t\t\tif ( ( $key == $question_id ) && ( $essay->ID == $graded_question['post_id'] ) ) {\n\t\t\t\t\t\treturn $quiz_data['graded'][ $key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "public static function get_all_awaiting_winners() {\n global $wpdb;\n $winners_table = $wpdb->prefix.\"wauc_winners\";\n return $wpdb->get_results(\"SELECT * FROM $winners_table WHERE is_selected = 1 AND is_winner = 0\");\n }", "function get_survey_questions($survey_id)\n {\n $this->db->join('survey_survey_questions', 'survey_survey_questions.question_id = ' . $this->get_table_name() . '.question_id', 'LEFT');\n\n $this->db->where('survey_survey_questions.survey_id', $survey_id);\n \n return $this->db->get($this->get_table_name());\n }", "function submissions() {\n \n global $CFG, $USER;\n\n // need to get course id in order to retrieve students\n $assignment = get_record('assignment', 'id', $this->mainobject->id);\n $courseid = $assignment->course;\n\n //permission to grade?\n $coursemodule = get_record('course_modules', 'module', $this->mainobject->modulesettings['assignment']->id, 'instance', $assignment->id) ;\n $modulecontext = get_context_instance(CONTEXT_MODULE, $coursemodule->id);\n\n if (!has_capability($this->capability, $modulecontext, $USER->id)) {\n return;\n }\n \n $this->mainobject->get_course_students($courseid);\n\n $student_sql = $this->get_role_users_sql($this->mainobject->courses[$courseid]->context);\n\n $sql = \"SELECT s.id as subid, s.userid, s.timemodified, s.data2, c.id as cmid\n FROM {$CFG->prefix}assignment_submissions s\n INNER JOIN {$CFG->prefix}course_modules c\n ON s.assignment = c.instance\n INNER JOIN {$CFG->prefix}assignment a\n ON s.assignment = a.id\n WHERE s.assignment = {$this->mainobject->id}\n AND s.timemarked < s.timemodified\n AND (s.userid IN ({$student_sql}))\n AND NOT (a.resubmit = 0 AND s.timemarked > 0)\n \n AND c.module = {$this->mainobject->modulesettings['assignment']->id}\n ORDER BY timemodified ASC\";\n\n $submissions = get_records_sql($sql);\n\n if ($submissions) {\n\n $data = array();\n\n // If we are not making the submissions for a specific group, run the group filtering\n // function to see if the config settings say display by groups and display them if they\n // are (returning false). If there are no groups, the function will return true and we\n // carry on, but if the config settings say 'don't display' then it will return false\n // and we skip this assignment\n if(!$this->mainobject->group) {\n\n //TODO - data array as input for function\n\n //$data['submissions'] = $submissions;\n //$data['type'] = $this->type;\n //$data['id'] = $this->mainobject->id;\n //$data['course'] = $assignment->course;\n\n //$group_filter = $this->mainobject->try_to_make_group_nodes($data);\n $group_filter = $this->mainobject->try_to_make_group_nodes($submissions, $this->type, $this->mainobject->id, $assignment->course);\n\n if (!$group_filter) {\n return;\n }\n }\n\n // begin json object\n $this->mainobject->output = '[{\"type\":\"submissions\"}';\n\n foreach ($submissions as $submission) {\n // add submission to JSON array of objects\n if (!isset($submission->userid)) {\n continue;\n }\n\n // ignore non-submitted uploaded files\n if (($assignment->assignmenttype == 'upload') && ($submission->data2 != 'submitted')) {\n continue;\n }\n\n // if we are displaying for just one group, skip this submission if it doesn't match\n if ($this->mainobject->group && !$this->mainobject->check_group_membership($this->mainobject->group, $submission->userid)) {\n continue;\n }\n \n $name = $this->mainobject->get_fullname($submission->userid);\n \n // sort out the time info\n $now = time();\n $seconds = ($now - $submission->timemodified);\n $summary = $this->mainobject->make_time_summary($seconds);\n \n $this->mainobject->make_submission_node($name, $submission->userid, $submission->cmid, $summary, 'assignment_final', $seconds, $submission->timemodified);\n \n }\n $this->mainobject->output .= \"]\"; // end JSON array\n \n }\n }", "public function findSubmissionsForMod($modUserId)\n {\n $query = '\n SELECT submitted_at, first_name, last_name, topic, mark, s.id\n FROM submissions s\n LEFT JOIN users u ON s.user_id = u.id\n LEFT JOIN projects p ON s.project_id = p.id\n WHERE mod_user_id = :mod_user_id\n ORDER BY submitted_at DESC\n ';\n $statement = $this->db->prepare($query);\n $statement->bindValue('mod_user_id', $modUserId, \\PDO::PARAM_INT);\n $statement->execute();\n $result = $statement->fetchAll(\\PDO::FETCH_ASSOC);\n\n return $result;\n }", "public function showSurveyResult($survey)\n\t{\n\t\t$data['answers'] = DB::table('answers')\n\t\t\t\t\t\t\t\t->leftJoin('questions', 'answers.q_id', '=', 'questions.id')\n\t\t\t\t\t\t\t\t->where('lead_id', base64_decode(Request::segment(2)))\n\t\t\t\t\t\t\t\t->where('answers.form_id', 1)\n\t\t\t\t\t\t\t\t->get();\n\n\t\t//Lets figure out the results from the answers\n\t\t$data['rediness'] = $data['answers'] = DB::table('answers')\n\t\t\t\t\t\t\t\t->leftJoin('questions', 'answers.q_id', '=', 'questions.id')\n\t\t\t\t\t\t\t\t->where('lead_id', base64_decode(Request::segment(2)))\n\t\t\t\t\t\t\t\t->where('answers.form_id', 1)\n\t\t\t\t\t\t\t\t->where('answers.q_id', 4)\n\t\t\t\t\t\t\t\t->first();\n\n\t\t//Get my goals\n\t\t$data['goals'] = $data['answers'] = DB::table('answers')\n\t\t\t\t\t\t\t\t->leftJoin('questions', 'answers.q_id', '=', 'questions.id')\n\t\t\t\t\t\t\t\t->where('lead_id', base64_decode(Request::segment(2)))\n\t\t\t\t\t\t\t\t->where('answers.form_id', 1)\n\t\t\t\t\t\t\t\t->where('answers.q_id', 5)\n\t\t\t\t\t\t\t\t->first();\n\n\t\t$data['goals'] = json_decode($data['goals']->answer);\n\n\t\t//Figure out the rediness score\n\t\t$data['rediness_percentage'] = $data['answers'] = DB::table('answers')\n\t\t\t\t\t\t\t\t->leftJoin('questions', 'answers.q_id', '=', 'questions.id')\n\t\t\t\t\t\t\t\t->where('lead_id', base64_decode(Request::segment(2)))\n\t\t\t\t\t\t\t\t->where('answers.form_id', 1)\n\t\t\t\t\t\t\t\t->where('answers.q_id', '>', 6)\n\t\t\t\t\t\t\t\t->where('answers.q_id','<' , 12)\n\t\t\t\t\t\t\t\t->get();\n\t\t//Calculate the readiness\n\t\t$myscore = 0;\n\t\t$total = count($data['rediness_percentage']);\n\t\tfor ($i=0; $i < $total; $i++) {\n\t\t\t$cr = $data['rediness_percentage'][$i];\n\n\t\t\t$myscore += $cr->answer;\n\t\t}\n\n\t\t$data['rediness_percentage'] = ($myscore/50) * 100;\n\n\t\t//Figure out the matching programs\n\t\t$data['strengths'] = $data['answers'] = DB::table('answers')\n\t\t\t\t\t\t\t\t->leftJoin('questions', 'answers.q_id', '=', 'questions.id')\n\t\t\t\t\t\t\t\t->where('lead_id', base64_decode(Request::segment(2)))\n\t\t\t\t\t\t\t\t->where('answers.form_id', 1)\n\t\t\t\t\t\t\t\t->where('answers.q_id', 11)\n\t\t\t\t\t\t\t\t->first();\n\t\t//Parse out the strenghts\n\t\t$data['strengths'] = json_decode($data['strengths']->answer);\n\t\t$program_codes = '';\n\t\t$total = count($data['strengths']);\n\t\tfor ($i=0; $i < $total; $i++) {\n\t\t\t$matching_programs = DB::table('matching_programs')\n\t\t\t\t\t\t\t\t\t\t->where('answer', $data['strengths'][$i])\n\t\t\t\t\t\t\t\t\t\t->first();\n\t\t\tif($program_codes == '') {\n\t\t\t\t$program_codes = $matching_programs->program_codes;\n\t\t\t}else {\n\t\t\t\t$program_codes .= ','.$matching_programs->program_codes;\n\t\t\t}\n\t\t}\n\n\t\t$program_codes = explode(',', $program_codes);\n\t\t$program_codes = array_unique($program_codes);\n\t\tforeach ($program_codes as $key => $value) {\n\t\t\t$program_codes[$key] = trim($program_codes[$key]);\n\t\t}\n\n\n\t\t$data['programs'] = DB::table('programs')\n\t\t\t\t\t\t\t->whereIn('program_code', $program_codes)\n\t\t\t\t\t\t\t->get();\n\n\t\t//Get the user information\n\t\t$data['lead'] = DB::table('leads')\n\t\t\t\t\t\t\t->where('id', base64_decode(Request::segment(2)))\n\t\t\t\t\t\t\t->first();\n\n\t\t//Get the articles that we are going to display\n $data['articles'] = Tools::getBlogPosts();\n\n\n\t\t//Create the view\n\t\t$this->layout->content = View::make('survey-result.content', $data);\n\n\t\t$this->layout->header = View::make('includes.header');\n\t}", "public static function withSubmitted()\n {\n return (new static )->newQueryWithoutScope(new ContentPublishingScope())->withSubmitted();\n }", "public function submissions()\n {\n $segregatedSubmissions = Submissions::getStudentSubmissions();\n //dd($segregatedSubmissions);\n $upcoming_submissions = $segregatedSubmissions[0];\n $ongoing_submissions = $segregatedSubmissions[1];\n $finished_submissions = $segregatedSubmissions[2];\n\n //dd($upcoming_submissions);\n //dd($ongoing_submissions);\n //dd($finished_submissions);\n $unReadNotifCount = StudentCalls::getUnReadNotifCount();\n return view('student/submissions', compact('upcoming_submissions', 'ongoing_submissions', 'finished_submissions','unReadNotifCount'));\n }", "public function getScoreSubmissions($team) {\n\t\t\n\t\t\n\t\tif($this->scoreSubmissions == null && $this->db != null && ($this->getTeamOneId() == $team->getId() || $this->getTeamTwoId() == $team->getId()) ) {\n\t\t\t$this->scoreSubmissions = [];\n\t\t\n\t\t\t$sql = \"SELECT scoreSubmissions.* FROM \" . Includes_DBTableNames::scoreSubmissionsTable . \" scoreSubmissions \"\n\t\t\t\t\t. \"INNER JOIN \" . Includes_DBTableNames::datesTable . \" dates \"\n\t\t\t\t\t\t. \"ON scoreSubmissions.score_submission_date_id = dates.date_id AND dates.date_id = \" . $this->getDateId() . \" \"\n\t\t\t\t\t. \"WHERE scoreSubmissions.score_submission_team_id = \" . $team->getId() . \" AND scoreSubmissions.score_submission_ignored = 0 \"\n\t\t\t\t\t. \"ORDER BY dates.date_week_number ASC, scoreSubmissions.score_submission_is_phantom ASC, scoreSubmissions.score_submission_id ASC\";\n\t\t\t\n\t\t\t//echo $sql;\n\t\t\t\n\t\t\t$stmt = $this->db->query($sql);\n\n\t\t\twhile(($row = $stmt->fetch()) != false) {\n\t\t\t\t$this->scoreSubmissions[] = Models_ScoreSubmission::withRow($this->db, $this->logger, $row);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//print_r($this->scoreSubmissions);\n\t\t\n\t\treturn $this->scoreSubmissions;\n\t}", "function &getExistingQuestions() \n\t{\n\t\tglobal $ilDB;\n\t\t$existing_questions = array();\n\t\t$result = $ilDB->queryF(\"SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE \" .\n\t\t\t\"svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id\",\n\t\t\tarray('integer'),\n\t\t\tarray($this->getSurveyId())\n\t\t);\n\t\twhile ($data = $ilDB->fetchAssoc($result)) \n\t\t{\n\t\t\tif($data[\"original_id\"])\n\t\t\t{\n\t\t\t\tarray_push($existing_questions, $data[\"original_id\"]);\n\t\t\t}\n\t\t}\n\t\treturn $existing_questions;\n\t}", "private function get_user_submissions($submission_hahses)\n\t{\n\t\tself::$user_submissions = array();\n\n\t\t$member_id = $this->session->userdata('member_id');\n\n\t\t// Make sure we have a member ID or some submission hashes to check\n\t\tif ( $member_id OR $submission_hahses )\n\t\t{\n\t\t\t// If we have a member ID\n\t\t\tif ($member_id)\n\t\t\t{\n\t\t\t\t$this->db\n\t\t\t\t\t->where('member_id', $member_id)\n\t\t\t\t\t->or_where_in('hash', $submission_hahses ? $submission_hahses : ''); // CI does not like an empty array\n\t\t\t}\n\t\t\t// If we only have submission hashes\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where_in('hash', $submission_hahses);\n\t\t\t}\n\n\t\t\t$query = $this->db\n\t\t\t\t->order_by('completed, updated, created', 'DESC')\n\t\t\t\t->get('vwm_surveys_submissions');\n\n\t\t\tif ($query->num_rows() > 0)\n\t\t\t{\n\t\t\t\t// Loop through each submission\n\t\t\t\tforeach ($query->result() as $row)\n\t\t\t\t{\n\t\t\t\t\t// First key is either \"completed\" or \"progress\", second is survey ID, and value is the submission hash\n\t\t\t\t\tself::$user_submissions[ $row->completed ? 'complete' : 'progress' ][ $row->survey_id ] = $row->hash;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.5996727", "0.5936609", "0.54508674", "0.5380265", "0.5299355", "0.52664226", "0.51739275", "0.51614606", "0.5112784", "0.50744545", "0.50663435", "0.5055705", "0.50379115", "0.50034606", "0.49738628", "0.4944428", "0.49141344", "0.48513246", "0.48392534", "0.48335564", "0.47980154", "0.4797188", "0.47884125", "0.4781893", "0.4756993", "0.475167", "0.47358626", "0.47295982", "0.47207606", "0.4717574" ]
0.6841735
0
Get all survey submissions (but allow for a search filter)
public function get_survey_submissions($filters, $order_by = 'updated', $order_by_order = 'DESC') { $data = array(); $order_by = in_array($order_by, array('id', 'member_id', 'survey_id', 'created', 'updated', 'completed', 'complete')) ? $order_by : 'updated'; $order_by_order = in_array($order_by_order, array('ASC', 'DESC', 'RANDOM')) ? $order_by_order : 'DESC'; $this->db->order_by($order_by, $order_by_order); // Filter survey ID if ( isset($filters['survey_id']) AND $filters['survey_id']) { $this->db->where('survey_id', $filters['survey_id']); } // Filter member ID if ( isset($filters['member_id']) AND $filters['member_id']) { $this->db->where('member_id', $filters['member_id']); } // Filter group ID if ( isset($filters['group_id']) AND $filters['group_id']) { $this->db->join('members', 'members.member_id = vwm_surveys_submissions.member_id'); $this->db->where('group_id', $filters['group_id']); } // If a valid created from date was provided if ( isset($filters['created_from']) AND strtotime($filters['created_from']) ) { // If a valid created to date was provided as well if ( isset($filters['created_to']) AND strtotime($filters['created_to']) ) { /** * Add one day (86400 seconds) to created_to date * * If user is searching for all surveys created from 1/1/2000 to * 1/1/2000 it should show all surveys created on 1/1/2000. */ $this->db->where( '`created` BETWEEN ' . strtotime($filters['created_from']) . ' AND ' . (strtotime($filters['created_to']) + 86400), NULL, FALSE ); } // Just a created from date was provided else { $this->db->where( 'created >=', strtotime($filters['created_from']) ); } } // If a valid updated from date was provided if ( isset($filters['updated_from']) AND strtotime($filters['updated_from']) ) { // If a valid updated to date was provided as well if ( isset($filters['updated_to']) AND strtotime($filters['updated_to']) ) { /** * Add one day (86400 seconds) to updated_to date * * If user is searching for all surveys updated from 1/1/2000 to * 1/1/2000 it should show all surveys updated on 1/1/2000. */ $this->db->where( '`updated` BETWEEN ' . strtotime($filters['updated_from']) . ' AND ' . (strtotime($filters['updated_to']) + 86400), NULL, FALSE ); } // Just a updated from date was provided else { $this->db->where( 'updated >=', strtotime($filters['updated_from']) ); } } // Filter completed if ( isset($filters['complete']) AND $filters['complete'] !== NULL) { // Show completed subissions if ($filters['complete']) { $this->db->where('completed IS NOT NULL', NULL, TRUE); } // Show incomplete submissions else { $this->db->where('completed IS NULL', NULL, TRUE); } } $query = $this->db->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[ (int)$row->id ] = array( 'id' => (int)$row->id, 'hash' => $row->hash, 'member_id' => (int)$row->member_id, 'survey_id' => (int)$row->survey_id, 'created' => (int)$row->created, 'updated' => (int)$row->updated, 'completed' => (int)$row->completed, 'complete' => (bool)$row->completed ); } } return $data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getSurveys() {\n return $this->_request(\n \"surveys/\"\n );\n }", "function getAll() {\r\n\t\treturn SurveyAnswerQuery::create()->find();\r\n\t}", "public function __invoke(): Collection|array\n {\n return Survey::all();\n }", "function all_submissions($min_status = 0) {\n\t\tif (!$this->submitable()) return array();\n\t\tstatic $query;\n\t\tDB::prepare_query($query,\n\t\t\t\"SELECT * FROM `submission`\".\n\t\t\t\" WHERE `entity_path` = ? AND `status` >= ?\".\n\t\t\t\" ORDER BY `time` ASC\"\n\t\t);\n\t\t$query->execute(array($this->path(), $min_status));\n\t\treturn Submission::fetch_all($query);\n\t}", "function _getFilteredSubmissions($journalId) {\r\n \r\n\t\t$sectionId = Request::getUserVar('decisionCommittee');\r\n\t\t$decisionType = Request::getUserVar('decisionType');\r\n\t\t$decisionStatus = Request::getUserVar('decisionStatus');\r\n\t\t$decisionAfter = Request::getUserVar('decisionAfter');\r\n\t\t$decisionBefore = Request::getUserVar('decisionBefore');\r\n \r\n\t\t$studentResearch = Request::getUserVar('studentInitiatedResearch');\r\n\t\t$startAfter = Request::getUserVar('startAfter');\r\n\t\t$startBefore = Request::getUserVar('startBefore');\r\n\t\t$endAfter = Request::getUserVar('endAfter');\r\n\t\t$endBefore = Request::getUserVar('endBefore');\r\n\t\t$kiiField = Request::getUserVar('KII');\r\n\t\t$multiCountry = Request::getUserVar('multicountry');\r\n\t\t$countries = Request::getUserVar('countries');\r\n\t\t$geoAreas = Request::getUserVar('geoAreas');\r\n\t\t$researchDomains = Request::getUserVar('researchDomains');\r\n $researchFields = Request::getUserVar('researchFields');\r\n\t\t$withHumanSubjects = Request::getUserVar('withHumanSubjects');\r\n\t\t$proposalTypes = Request::getUserVar('proposalTypes');\r\n\t\t$dataCollection = Request::getUserVar('dataCollection');\r\n\r\n $budgetOption = Request::getUserVar('budgetOption');\r\n\t\t$budget = Request::getUserVar('budget');\r\n\t\t$sources = Request::getUserVar('sources');\r\n \r\n\t\t$identityRevealed = Request::getUserVar('identityRevealed');\r\n\t\t$unableToConsent = Request::getUserVar('unableToConsent');\r\n\t\t$under18 = Request::getUserVar('under18');\r\n\t\t$dependentRelationship = Request::getUserVar('dependentRelationship');\r\n\t\t$ethnicMinority = Request::getUserVar('ethnicMinority');\r\n\t\t$impairment = Request::getUserVar('impairment');\r\n\t\t$pregnant = Request::getUserVar('pregnant');\r\n\t\t$newTreatment = Request::getUserVar('newTreatment');\r\n\t\t$bioSamples = Request::getUserVar('bioSamples');\r\n\t\t$exportHumanTissue = Request::getUserVar('exportHumanTissue');\r\n\t\t$exportReason = Request::getUserVar('exportReason');\r\n $radiation = Request::getUserVar('radiation');\r\n\t\t$distress = Request::getUserVar('distress');\r\n\t\t$inducements = Request::getUserVar('inducements');\r\n\t\t$sensitiveInfo = Request::getUserVar('sensitiveInfo');\r\n\t\t$reproTechnology = Request::getUserVar('reproTechnology');\r\n\t\t$genetic = Request::getUserVar('genetic');\r\n\t\t$stemCell = Request::getUserVar('stemCell');\r\n\t\t$biosafety = Request::getUserVar('biosafety');\r\n \r\n\r\n $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');\r\n\r\n $submissions =& $editorSubmissionDao->getEditorSubmissionsReport(\r\n $journalId, $sectionId, $decisionType, $decisionStatus, $decisionAfter, $decisionBefore,\r\n $studentResearch, $startAfter, $startBefore, $endAfter, $endBefore, $kiiField, $multiCountry, \r\n $countries, $geoAreas, $researchDomains, $researchFields, $withHumanSubjects, $proposalTypes, $dataCollection,\r\n $budgetOption, $budget, $sources,\r\n $identityRevealed, $unableToConsent, $under18, $dependentRelationship, $ethnicMinority, $impairment, \r\n $pregnant, $newTreatment, $bioSamples, $exportHumanTissue, $exportReason, $radiation, $distress, $inducements, \r\n $sensitiveInfo, $reproTechnology, $genetic, $stemCell, $biosafety);\r\n \r\n $criterias = $this->_getCriterias(\r\n $sectionId, $decisionType, $decisionStatus, $decisionAfter, $decisionBefore,\r\n $studentResearch, $startAfter, $startBefore, $endAfter, $endBefore, $kiiField, $multiCountry, \r\n $countries, $geoAreas, $researchDomains, $researchFields, $withHumanSubjects, $proposalTypes, $dataCollection,\r\n $budgetOption, $budget, $sources,\r\n $identityRevealed, $unableToConsent, $under18, $dependentRelationship, $ethnicMinority, $impairment, \r\n $pregnant, $newTreatment, $bioSamples, $exportHumanTissue, $exportReason, $radiation, $distress, $inducements, \r\n $sensitiveInfo, $reproTechnology, $genetic, $stemCell, $biosafety \r\n );\r\n \r\n\t\treturn array( 0 => $submissions->toArray(), 1 => $criterias); \r\n }", "function get_simple_form_submissions() {\n global $wpdb;\n $table_name = $wpdb->prefix . 'content_submissions';\n\n $sql = \"SELECT * FROM $table_name\";\n $results = $wpdb->get_results( $sql );\n\n return $results;\n}", "public function getSubmissions()\n {\n return $this->getFiles()->filter(function (File $file) {\n return $file->getOwner()->getType() === 'student';\n });\n }", "protected function createSurveyEntries(): array\n {\n $result = [];\n $query = $this->SurveyResults->find();\n $count = 0;\n\n $this->out((string)__d('Qobo/Survey', 'Found [{0}] survey_result records', $query->count()));\n\n if (empty($query->count())) {\n return $result;\n }\n\n foreach ($query as $item) {\n $survey = $this->Surveys->find()\n ->where(['id' => $item->get('survey_id')]);\n\n if (!$survey->count()) {\n $this->warn((string)__d('Qobo/Survey', 'Survey [{0}] is not found. Moving on', $item->get('survey_id')));\n\n continue;\n }\n\n $entry = $this->SurveyEntries->find()\n ->where([\n 'id' => $item->get('submit_id'),\n ])\n ->first();\n\n if (empty($entry)) {\n if (empty($item->get('submit_id'))) {\n continue;\n }\n\n $entry = $this->SurveyEntries->newEntity();\n $entry->set('id', $item->get('submit_id'));\n $entry->set('submit_date', $item->get('submit_date'));\n $entry->set('survey_id', $item->get('survey_id'));\n $entry->set('status', 'in_review');\n $entry->set('score', 0);\n\n $saved = $this->SurveyEntries->save($entry);\n\n if ($saved) {\n $result[] = $saved->get('id');\n $count++;\n } else {\n $this->out((string)__d('Qobo/Survey', 'Survey Result with Submit ID [{0}] cannot be saved. Next', $item->get('submit_id')));\n }\n } else {\n // saving existing survey_entries,\n // to double check if anything is missing as well.\n $result[] = $entry->get('id');\n }\n }\n\n $this->out((string)__d('Qobo/Survey', 'Saved [{0}] survey_entries', $count));\n\n //keeping only unique entry ids, to avoid excessive iterations.\n $result = array_values(array_unique($result));\n\n return $result;\n }", "public function getSubmissionsForSelect($conferenceId = null, $empty = null)\n\t{\n\t\t$return = array();\n\n\t\tif ($empty) {\n\t\t\t$return[0] = $empty;\n\t\t}\n\n\t\t$identity = Zend_Auth::getInstance()->getIdentity();\n\n\t\t$query = 'select st.submission_id, s.title from submission_status st\n\t\tleft join submissions s ON s.submission_id = st.submission_id\n\t\twhere st.status = :status AND s.conference_id = :conference_id';\n\n\t\tif (!$identity->isAdmin()) {\n\t\t\t// if user is not admin, only show their own submissions\n\t\t\t$mySubmissions = implode(\",\", array_keys($identity->getMySubmissions()));\n\t\t\tif (!empty($mySubmissions)) {\n\t\t\t\t$query .= ' and st.submission_id IN ('.$mySubmissions.')';\n\t\t\t} else {\n\t\t\t\treturn array();\n\t\t\t}\n\t\t}\n\n\t\t$submissions = $this->getAdapter()->query(\n\t\t\t$query,\n\t\t\tarray(\n\t\t\t\t'status' => $this->_getAcceptedValue(),\n\t\t\t\t'conference_id' => $this->getConferenceId()\n\t\t\t)\n\t\t);\n\t\tforeach ($submissions as $submission) {\n\t\t\t$return[$submission['submission_id']] = $submission['title'];\n\t\t}\n\t\treturn $return;\n\t}", "private function get_all_circleci_submissions($submissionid) {\n global $DB;\n return $DB->get_records('assignsubmission_circleci', array('submission'=>$submissionid));\n }", "public static function withSubmitted()\n {\n return (new static )->newQueryWithoutScope(new ContentPublishingScope())->withSubmitted();\n }", "public function getSubmissions($filters = array())\n {\n // filter date\n if (isset($filters['date'])) {\n\n switch ($filters['date']) {\n case 'LAST_DAY':\n $filters['submittedDateBegin'] = date('Y-m-d',strtotime(\"-1 days\"));\n $filters['submittedDateEnd'] = date('Y-m-d');\n break;\n case 'LAST_WEEK':\n $filters['submittedDateBegin'] = date('Y-m-d',strtotime(\"-1 week\"));\n $filters['submittedDateEnd'] = date('Y-m-d');\n break;\n case 'LAST_14DAYS':\n $filters['submittedDateBegin'] = date('Y-m-d',strtotime(\"-2 week\"));\n $filters['submittedDateEnd'] = date('Y-m-d');\n break;\n case 'LAST_MONTH':\n $filters['submittedDateBegin'] = date('Y-m-d',strtotime(\"-1 month\"));\n $filters['submittedDateEnd'] = date('Y-m-d');\n break;\n case 'LAST_6_MONTHS':\n $filters['submittedDateBegin'] = date('Y-m-d',strtotime(\"-6 month\"));\n $filters['submittedDateEnd'] = date('Y-m-d');\n break;\n case 'LAST_YEAR':\n $filters['submittedDateBegin'] = date('Y-m-d',strtotime(\"-12 month\"));\n $filters['submittedDateEnd'] = date('Y-m-d');\n break;\n case 'LAST_18_MONTHS':\n $filters['submittedDateBegin'] = date('Y-m-d',strtotime(\"-18 month\"));\n $filters['submittedDateEnd'] = date('Y-m-d');\n break;\n }\n }\n\n $getSubmissionsService = $this->limsApiFactory->newGetSubmissionsService();\n $result = $getSubmissionsService->execute($filters);\n\n // paginate\n $this->limsPaginator = new LimsPagination($result, self::PER_PAGE, isset($filters['page']) ? $filters['page'] : 1);\n $this->limsPaginator->paginate();\n\n return $this->limsPaginator->currentItems;\n }", "function GetSubmissions () {\n $array = array ();\n $result = @mysql_query (\"SELECT `submission_id` FROM `hunt_submissions` WHERE `submission_hunt` = '\".$this->hunt_id.\"' ORDER BY `submission_timestamp` ASC;\", $this->ka_db);\n while ($row = @mysql_fetch_array ($result))\n $array [] = new Submission ($row[\"submission_id\"], $this->roster_coder);\n return $array;\n }", "public function submissions();", "function dev_get_submission_pages() {\n\n\t$submission = dev_get_option( 'ticket_submit' );\n\n\tif ( ! is_array( $submission ) ) {\n\t\t$submission = array_filter( (array) $submission );\n\t}\n\n\treturn $submission;\n\n}", "function getSubmissionFilter() {\n\t\treturn null;\n\t}", "public function index(): AnonymousResourceCollection\n {\n return SurveyResource::collection(Survey::all());\n }", "function submissions() {\n \n global $CFG, $USER;\n\n // need to get course id in order to retrieve students\n $assignment = get_record('assignment', 'id', $this->mainobject->id);\n $courseid = $assignment->course;\n\n //permission to grade?\n $coursemodule = get_record('course_modules', 'module', $this->mainobject->modulesettings['assignment']->id, 'instance', $assignment->id) ;\n $modulecontext = get_context_instance(CONTEXT_MODULE, $coursemodule->id);\n\n if (!has_capability($this->capability, $modulecontext, $USER->id)) {\n return;\n }\n \n $this->mainobject->get_course_students($courseid);\n\n $student_sql = $this->get_role_users_sql($this->mainobject->courses[$courseid]->context);\n\n $sql = \"SELECT s.id as subid, s.userid, s.timemodified, s.data2, c.id as cmid\n FROM {$CFG->prefix}assignment_submissions s\n INNER JOIN {$CFG->prefix}course_modules c\n ON s.assignment = c.instance\n INNER JOIN {$CFG->prefix}assignment a\n ON s.assignment = a.id\n WHERE s.assignment = {$this->mainobject->id}\n AND s.timemarked < s.timemodified\n AND (s.userid IN ({$student_sql}))\n AND NOT (a.resubmit = 0 AND s.timemarked > 0)\n \n AND c.module = {$this->mainobject->modulesettings['assignment']->id}\n ORDER BY timemodified ASC\";\n\n $submissions = get_records_sql($sql);\n\n if ($submissions) {\n\n $data = array();\n\n // If we are not making the submissions for a specific group, run the group filtering\n // function to see if the config settings say display by groups and display them if they\n // are (returning false). If there are no groups, the function will return true and we\n // carry on, but if the config settings say 'don't display' then it will return false\n // and we skip this assignment\n if(!$this->mainobject->group) {\n\n //TODO - data array as input for function\n\n //$data['submissions'] = $submissions;\n //$data['type'] = $this->type;\n //$data['id'] = $this->mainobject->id;\n //$data['course'] = $assignment->course;\n\n //$group_filter = $this->mainobject->try_to_make_group_nodes($data);\n $group_filter = $this->mainobject->try_to_make_group_nodes($submissions, $this->type, $this->mainobject->id, $assignment->course);\n\n if (!$group_filter) {\n return;\n }\n }\n\n // begin json object\n $this->mainobject->output = '[{\"type\":\"submissions\"}';\n\n foreach ($submissions as $submission) {\n // add submission to JSON array of objects\n if (!isset($submission->userid)) {\n continue;\n }\n\n // ignore non-submitted uploaded files\n if (($assignment->assignmenttype == 'upload') && ($submission->data2 != 'submitted')) {\n continue;\n }\n\n // if we are displaying for just one group, skip this submission if it doesn't match\n if ($this->mainobject->group && !$this->mainobject->check_group_membership($this->mainobject->group, $submission->userid)) {\n continue;\n }\n \n $name = $this->mainobject->get_fullname($submission->userid);\n \n // sort out the time info\n $now = time();\n $seconds = ($now - $submission->timemodified);\n $summary = $this->mainobject->make_time_summary($seconds);\n \n $this->mainobject->make_submission_node($name, $submission->userid, $submission->cmid, $summary, 'assignment_final', $seconds, $submission->timemodified);\n \n }\n $this->mainobject->output .= \"]\"; // end JSON array\n \n }\n }", "public function getSurveys() {\n $surveys = array();\n $jsonData = $this->getDataFromDataFolder();\n foreach($jsonData as $surveyData) {\n $surveys[] = $this->serializer->deserialize(\n json_encode($surveyData->survey), Survey::class, 'json'\n );\n }\n $surveys = array_unique($surveys, SORT_REGULAR);\n return $surveys;\n }", "public function xsubmissions() {\n\t\t\n\t\t/* Load Model */\n\t\t$submissions = $this->getModel ( 'submission' );\n\t\t\n\t\t$submissions->setTableName ( $this->_getFormId () );\n\t\t\n\t\t/* Get all rows */\n\t\t$submissions->getAll ();\n\t\t\n\t\t/* set the view file (optional) */\n\t\t$this->setView ( 'submissions' );\n\t\t\n\t\t/* set last view into session */\n\t\t$this->session->returnto ( $this->getView () );\n\t}", "public function actionIndex() {\n $searchModel = new SurveySearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n $surveyz = new Surveys();\n $surv = $surveyz->find()->orderBy(['survey_id' => SORT_ASC])->all();\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider, 'surv' => $surv,\n ]);\n }", "public function getBookmarkedSubmissions()\n {\n return Auth::user()->bookmarkedSubmissions()->simplePaginate(10);\n }", "public function index(Request $request)\n {\n $quests = Quest::where('status', 0)->where('user_id', '!=', Auth::id());\n if ($request->has('q')) {\n $quests = $quests->where('name', 'LIKE', '%' . $request->input('q') . '%')->get();\n } else {\n $quests = $quests->get();\n }\n\n return $quests;\n\n }", "public function index($survey_id)\n\t{\n\t\t$questions = Survey::find($survey_id)->questions;\n\n\t\treturn Fractal::collection($questions, new QuestionTransformer);\n\t}", "function submitted_events_get_pending_submissions() {\n\tglobal $wpdb;\n\t// Get all submissions that have not had events generated for them\n\t$table_name = $wpdb->prefix . \"submitted_events\";\n\treturn $wpdb->get_results ( \"SELECT * FROM \" . $table_name . \" WHERE eventgenerated = 0\" );\n}", "public function index()\n\t{\n\t\t//User based filtering\n\t\t$user = $this->apiKey->guestUser;\n\t\t$survey_ids_taken = TrackSurvey::where('users_id', $user->id)->groupBy('surveys_id')->lists('surveys_id');\n\n\t\t//Question count\n\t\t// return $survey_ids_taken;\n\t\t\n\t\ttry {\n\t\t\t//inserting custom key-val\n\t\t\t$surveys = Survey::all();\n\t\t\tforeach($surveys as $survey){\n\t\t\t\t$survey->is_taken = in_array($survey->id, $survey_ids_taken) ? '1':'0';\n\t\t\t\t$survey->mcq_count = Question::where('surveys_id', $survey->id)->where('type', 'mcq')->count();\n\t\t\t\t$survey->wr_count = Question::where('surveys_id', $survey->id)->where('type', 'written')->count();\n\t\t\t\t$survey->taken_by = TrackSurvey::where('surveys_id', $survey->id)->groupBy('users_id')->lists('users_id');\t\t\t\n\t\t\t}\n\n\t\t\t// return $surveys;\n\t\t\treturn Fractal::collection($surveys, new SurveyTransformer);\n\t\t\n\t\t} catch (Exception $e) {\n \n \treturn $this->response->errorGone();\n\t\t\t\n\t\t}\n\t}", "public function results()\n {\n if(!(php_sapi_name() == 'cli-server'))\n return 403;\n\n if($this->request->server['REMOTE_ADDR'] != '127.0.0.1' && $this->request->server['REMOTE_ADDR'] != '::1')\n return 403;\n\n $matcher = new SurveyMatcher();\n $matcher->match((isset($this->request->get['limit']) ? $this->request->get['limit'] : null));\n }", "public function submissions()\n {\n return $this->hasMany('App\\Modules\\Models\\Submission');\n }", "public function getSurveys() {\n\n \n $this->db->select('sur_id, sur_title');\n $this->db->from('msv_surveys');\n \n $query = $this->db->get();\n \n $res = $query->result();\n \n return $res;\n }", "public function getSubmits()\n {\n return $this->submits;\n }" ]
[ "0.64325094", "0.64244294", "0.61194974", "0.60658884", "0.60614973", "0.59773904", "0.5884745", "0.58226883", "0.581804", "0.5790863", "0.5789288", "0.5775172", "0.57700557", "0.5765209", "0.5763232", "0.5725316", "0.57097596", "0.56432366", "0.5620622", "0.56064343", "0.55968606", "0.55528903", "0.55387634", "0.55200285", "0.5517244", "0.5458244", "0.5442555", "0.544234", "0.5416997", "0.53964084" ]
0.64346766
0
Get all surveys completed or in progress by the current user If a member ID is set, use that. If submission hashes are found, use those. Save results to user_submissions property.
private function get_user_submissions($submission_hahses) { self::$user_submissions = array(); $member_id = $this->session->userdata('member_id'); // Make sure we have a member ID or some submission hashes to check if ( $member_id OR $submission_hahses ) { // If we have a member ID if ($member_id) { $this->db ->where('member_id', $member_id) ->or_where_in('hash', $submission_hahses ? $submission_hahses : ''); // CI does not like an empty array } // If we only have submission hashes else { $this->db->where_in('hash', $submission_hahses); } $query = $this->db ->order_by('completed, updated, created', 'DESC') ->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { // Loop through each submission foreach ($query->result() as $row) { // First key is either "completed" or "progress", second is survey ID, and value is the submission hash self::$user_submissions[ $row->completed ? 'complete' : 'progress' ][ $row->survey_id ] = $row->hash; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function user_submissions_progress($submission_hahses)\n\t{\n\t\t// If user submissions have not yet been gathered\n\t\tif (self::$user_submissions == NULL) { $this->get_user_submissions($submission_hahses); }\n\n\t\t// If we have some surveys in progress return an array of their hashes\n\t\treturn isset(self::$user_submissions['progress']) ? self::$user_submissions['progress'] : array();\n\t}", "public function get_completed_survey_submissions($id, $completed_since = NULL)\n\t{\n\t\t$data = array();\n\n\t\t$this->db\n\t\t\t->order_by('completed', 'ASC')\n\t\t\t->where('completed IS NOT NULL', NULL, TRUE)\n\t\t\t->where('survey_id', $id);\n\n\t\t// If completed_since is set, only grab completed submissions AFTER that date\n\t\tif ($completed_since != NULL)\n\t\t{\n\t\t\t$this->db->where('completed >=', $completed_since);\n\t\t}\n\n\t\t$query = $this->db->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\tforeach ($query->result() as $row)\n\t\t\t{\n\t\t\t\t$data[ $row->id ] = array(\n\t\t\t\t\t'member_id' => (int)$row->member_id,\n\t\t\t\t\t'survey_id' => (int)$row->survey_id,\n\t\t\t\t\t'data' => json_decode($row->data, TRUE),\n\t\t\t\t\t'created' => (int)$row->created,\n\t\t\t\t\t'updated' => (int)$row->updated,\n\t\t\t\t\t'completed' => (int)$row->completed,\n\t\t\t\t\t'current_page' => (int)$row->current_page,\n\t\t\t\t\t'complete' => (bool)$row->completed\n\t\t\t\t);\n\t\t\t}\n\n\t\t}\n\t\t\n\t\treturn $data;\n\t}", "function submissions() {\n \n global $CFG, $USER;\n\n // need to get course id in order to retrieve students\n $assignment = get_record('assignment', 'id', $this->mainobject->id);\n $courseid = $assignment->course;\n\n //permission to grade?\n $coursemodule = get_record('course_modules', 'module', $this->mainobject->modulesettings['assignment']->id, 'instance', $assignment->id) ;\n $modulecontext = get_context_instance(CONTEXT_MODULE, $coursemodule->id);\n\n if (!has_capability($this->capability, $modulecontext, $USER->id)) {\n return;\n }\n \n $this->mainobject->get_course_students($courseid);\n\n $student_sql = $this->get_role_users_sql($this->mainobject->courses[$courseid]->context);\n\n $sql = \"SELECT s.id as subid, s.userid, s.timemodified, s.data2, c.id as cmid\n FROM {$CFG->prefix}assignment_submissions s\n INNER JOIN {$CFG->prefix}course_modules c\n ON s.assignment = c.instance\n INNER JOIN {$CFG->prefix}assignment a\n ON s.assignment = a.id\n WHERE s.assignment = {$this->mainobject->id}\n AND s.timemarked < s.timemodified\n AND (s.userid IN ({$student_sql}))\n AND NOT (a.resubmit = 0 AND s.timemarked > 0)\n \n AND c.module = {$this->mainobject->modulesettings['assignment']->id}\n ORDER BY timemodified ASC\";\n\n $submissions = get_records_sql($sql);\n\n if ($submissions) {\n\n $data = array();\n\n // If we are not making the submissions for a specific group, run the group filtering\n // function to see if the config settings say display by groups and display them if they\n // are (returning false). If there are no groups, the function will return true and we\n // carry on, but if the config settings say 'don't display' then it will return false\n // and we skip this assignment\n if(!$this->mainobject->group) {\n\n //TODO - data array as input for function\n\n //$data['submissions'] = $submissions;\n //$data['type'] = $this->type;\n //$data['id'] = $this->mainobject->id;\n //$data['course'] = $assignment->course;\n\n //$group_filter = $this->mainobject->try_to_make_group_nodes($data);\n $group_filter = $this->mainobject->try_to_make_group_nodes($submissions, $this->type, $this->mainobject->id, $assignment->course);\n\n if (!$group_filter) {\n return;\n }\n }\n\n // begin json object\n $this->mainobject->output = '[{\"type\":\"submissions\"}';\n\n foreach ($submissions as $submission) {\n // add submission to JSON array of objects\n if (!isset($submission->userid)) {\n continue;\n }\n\n // ignore non-submitted uploaded files\n if (($assignment->assignmenttype == 'upload') && ($submission->data2 != 'submitted')) {\n continue;\n }\n\n // if we are displaying for just one group, skip this submission if it doesn't match\n if ($this->mainobject->group && !$this->mainobject->check_group_membership($this->mainobject->group, $submission->userid)) {\n continue;\n }\n \n $name = $this->mainobject->get_fullname($submission->userid);\n \n // sort out the time info\n $now = time();\n $seconds = ($now - $submission->timemodified);\n $summary = $this->mainobject->make_time_summary($seconds);\n \n $this->mainobject->make_submission_node($name, $submission->userid, $submission->cmid, $summary, 'assignment_final', $seconds, $submission->timemodified);\n \n }\n $this->mainobject->output .= \"]\"; // end JSON array\n \n }\n }", "public function getStudentSubmission(User $user)\n {\n foreach ($this->getSubmissions() as $submission) {\n if ($submission->getOwner() === $user) {\n return $submission;\n }\n }\n }", "function &getUserSpecificResults($finished_ids)\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\t$evaluation = array();\n\t\t$questions =& $this->getSurveyQuestions();\n\t\tforeach ($questions as $question_id => $question_data)\n\t\t{\n\t\t\tinclude_once \"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php\";\n\t\t\t$question_type = SurveyQuestion::_getQuestionType($question_id);\n\t\t\tSurveyQuestion::_includeClass($question_type);\n\t\t\t$question = new $question_type();\n\t\t\t$question->loadFromDb($question_id);\n\t\t\t$data =& $question->getUserAnswers($this->getSurveyId(), $finished_ids);\n\t\t\t$evaluation[$question_id] = $data;\n\t\t}\n\t\treturn $evaluation;\n\t}", "public function getSubmissions()\n {\n return $this->getFiles()->filter(function (File $file) {\n return $file->getOwner()->getType() === 'student';\n });\n }", "public function get_survey_submissions($filters, $order_by = 'updated', $order_by_order = 'DESC')\n\t{\n\t\t$data = array();\n\n\t\t$order_by = in_array($order_by, array('id', 'member_id', 'survey_id', 'created', 'updated', 'completed', 'complete')) ? $order_by : 'updated';\n\t\t$order_by_order = in_array($order_by_order, array('ASC', 'DESC', 'RANDOM')) ? $order_by_order : 'DESC';\n\n\t\t$this->db->order_by($order_by, $order_by_order);\n\n\t\t// Filter survey ID\n\t\tif ( isset($filters['survey_id']) AND $filters['survey_id'])\n\t\t{\n\t\t\t$this->db->where('survey_id', $filters['survey_id']);\n\t\t}\n\n\t\t// Filter member ID\n\t\tif ( isset($filters['member_id']) AND $filters['member_id'])\n\t\t{\n\t\t\t$this->db->where('member_id', $filters['member_id']);\n\t\t}\n\n\t\t// Filter group ID\n\t\tif ( isset($filters['group_id']) AND $filters['group_id'])\n\t\t{\n\t\t\t$this->db->join('members', 'members.member_id = vwm_surveys_submissions.member_id');\n\t\t\t$this->db->where('group_id', $filters['group_id']);\n\t\t}\n\n\t\t// If a valid created from date was provided\n\t\tif ( isset($filters['created_from']) AND strtotime($filters['created_from']) )\n\t\t{\n\t\t\t// If a valid created to date was provided as well\n\t\t\tif ( isset($filters['created_to']) AND strtotime($filters['created_to']) )\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Add one day (86400 seconds) to created_to date\n\t\t\t\t *\n\t\t\t\t * If user is searching for all surveys created from 1/1/2000 to\n\t\t\t\t * 1/1/2000 it should show all surveys created on 1/1/2000.\n\t\t\t\t */\n\t\t\t\t$this->db->where( '`created` BETWEEN ' . strtotime($filters['created_from']) . ' AND ' . (strtotime($filters['created_to']) + 86400), NULL, FALSE );\n\t\t\t}\n\t\t\t// Just a created from date was provided\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where( 'created >=', strtotime($filters['created_from']) );\n\t\t\t}\n\t\t}\n\n\t\t// If a valid updated from date was provided\n\t\tif ( isset($filters['updated_from']) AND strtotime($filters['updated_from']) )\n\t\t{\n\t\t\t// If a valid updated to date was provided as well\n\t\t\tif ( isset($filters['updated_to']) AND strtotime($filters['updated_to']) )\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Add one day (86400 seconds) to updated_to date\n\t\t\t\t *\n\t\t\t\t * If user is searching for all surveys updated from 1/1/2000 to\n\t\t\t\t * 1/1/2000 it should show all surveys updated on 1/1/2000.\n\t\t\t\t */\n\t\t\t\t$this->db->where( '`updated` BETWEEN ' . strtotime($filters['updated_from']) . ' AND ' . (strtotime($filters['updated_to']) + 86400), NULL, FALSE );\n\t\t\t}\n\t\t\t// Just a updated from date was provided\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where( 'updated >=', strtotime($filters['updated_from']) );\n\t\t\t}\n\t\t}\n\n\t\t// Filter completed\n\t\tif ( isset($filters['complete']) AND $filters['complete'] !== NULL)\n\t\t{\n\t\t\t// Show completed subissions\n\t\t\tif ($filters['complete'])\n\t\t\t{\n\t\t\t\t$this->db->where('completed IS NOT NULL', NULL, TRUE);\n\t\t\t}\n\t\t\t// Show incomplete submissions\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where('completed IS NULL', NULL, TRUE);\n\t\t\t}\n\t\t}\n\t\t\n\t\t$query = $this->db->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\tforeach ($query->result() as $row)\n\t\t\t{\n\t\t\t\t$data[ (int)$row->id ] = array(\n\t\t\t\t\t'id' => (int)$row->id,\n\t\t\t\t\t'hash' => $row->hash,\n\t\t\t\t\t'member_id' => (int)$row->member_id,\n\t\t\t\t\t'survey_id' => (int)$row->survey_id,\n\t\t\t\t\t'created' => (int)$row->created,\n\t\t\t\t\t'updated' => (int)$row->updated,\n\t\t\t\t\t'completed' => (int)$row->completed,\n\t\t\t\t\t'complete' => (bool)$row->completed\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn $data;\n\t}", "public function findSubmissionsForMod($modUserId)\n {\n $query = '\n SELECT submitted_at, first_name, last_name, topic, mark, s.id\n FROM submissions s\n LEFT JOIN users u ON s.user_id = u.id\n LEFT JOIN projects p ON s.project_id = p.id\n WHERE mod_user_id = :mod_user_id\n ORDER BY submitted_at DESC\n ';\n $statement = $this->db->prepare($query);\n $statement->bindValue('mod_user_id', $modUserId, \\PDO::PARAM_INT);\n $statement->execute();\n $result = $statement->fetchAll(\\PDO::FETCH_ASSOC);\n\n return $result;\n }", "public function user_submissions_complete($submission_hahses)\n\t{\n\t\t// If user submissions have not yet been gathered\n\t\tif (self::$user_submissions == NULL) { $this->get_user_submissions($submission_hahses); }\n\n\t\t// If we have some completed surveys return an array of their hashes\n\t\treturn isset(self::$user_submissions['complete']) ? self::$user_submissions['complete'] : array();\n\t}", "private function users_for_stats() {\n\n\t\t\tif ( ! is_null( $this->users_for_stats ) ) {\n\t\t\t\treturn $this->users_for_stats;\n\t\t\t}\n\n\t\t\tif ( is_null( $this->request ) ) {\n\t\t\t\treturn $this->users_for_stats;\n\t\t\t}\n\n\t\t\t$quiz_id = $this->request->get_param( 'quiz' );\n\t\t\tif ( empty( $quiz_id ) ) {\n\t\t\t\t$this->users_for_stats = array( 0 );\n\t\t\t\treturn $this->users_for_stats;\n\t\t\t}\n\n\t\t\tif ( learndash_is_admin_user() ) {\n\t\t\t\t$this->users_for_stats = array();\n\t\t\t} elseif ( learndash_is_group_leader_user() ) {\n\t\t\t\tif ( learndash_get_group_leader_manage_courses() ) {\n\t\t\t\t\t/**\n\t\t\t\t\t * If the Group Leader can manage_courses they have will access\n\t\t\t\t\t * to all quizzes. So they are treated like the admin user.\n\t\t\t\t\t */\n\t\t\t\t\t$this->users_for_stats = array();\n\t\t\t\t} else {\n\t\t\t\t\t/**\n\t\t\t\t\t * Else we need to figure out of the quiz requested is part of a\n\t\t\t\t\t * Course within Group managed by the Group Leader.\n\t\t\t\t\t */\n\t\t\t\t\t$quiz_users = array();\n\t\t\t\t\t$leader_courses = learndash_get_groups_administrators_courses( get_current_user_id() );\n\t\t\t\t\tif ( ! empty( $leader_courses ) ) {\n\t\t\t\t\t\t$quiz_courses = array();\n\t\t\t\t\t\tif ( 'yes' === LearnDash_Settings_Section::get_section_setting( 'LearnDash_Settings_Courses_Builder', 'shared_steps' ) ) {\n\t\t\t\t\t\t\t$quiz_courses = learndash_get_courses_for_step( $quiz_id, true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$quiz_course = learndash_get_setting( $quiz_id, 'course' );\n\t\t\t\t\t\t\tif ( ! empty( $quiz_course ) ) {\n\t\t\t\t\t\t\t\t$quiz_courses = array( $quiz_course );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( ! empty( $quiz_courses ) ) {\n\t\t\t\t\t\t\t$common_courses = array_intersect( $quiz_courses, $leader_courses );\n\t\t\t\t\t\t\tif ( ! empty( $common_courses ) ) {\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * The following will get a list of all users within the Groups\n\t\t\t\t\t\t\t\t * managed by the Group Leader. This list of users will be passed\n\t\t\t\t\t\t\t\t * to the query logic to limit the selected rows.\n\t\t\t\t\t\t\t\t *\n\t\t\t\t\t\t\t\t * This is not 100% accurate because we don't limit the rows based\n\t\t\t\t\t\t\t\t * on the associated courses. Consider if Shared Course steps is\n\t\t\t\t\t\t\t\t * enabled and the quiz is part of two courses and those courses\n\t\t\t\t\t\t\t\t * are associated with multiple groups. And the user is in both\n\t\t\t\t\t\t\t\t * groups. So potentially we will pull in statistics records for\n\t\t\t\t\t\t\t\t * the other course quizzes.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t$quiz_users = learndash_get_groups_administrators_users( get_current_user_id() );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! empty( $quiz_users ) ) {\n\t\t\t\t\t\t$this->users_for_stats = $quiz_users;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->users_for_stats = array( 0 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// If here then non-admin and non-group leader user.\n\t\t\t\t$quiz_id = $this->request->get_param( 'quiz' );\n\t\t\t\tif ( ! empty( $quiz_id ) ) {\n\t\t\t\t\tif ( get_post_meta( $quiz_id, '_viewProfileStatistics', true ) ) {\n\t\t\t\t\t\t$this->users_for_stats = (array) get_current_user_id();\n\t\t\t\t\t\treturn $this->users_for_stats;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$this->users_for_stats = array( 0 );\n\t\t\t}\n\n\t\t\treturn $this->users_for_stats;\n\t\t}", "function get_available_by_user_surveys($user_id) {\r\n // get available by time\r\n $available_by_time_surveys = array();\r\n if (get_available_by_time_surveys()) {\r\n $available_by_time_surveys = get_available_by_time_surveys();\r\n }\r\n\r\n // get user groups\r\n $user_staff_groups = get_user_staff_groups($user_id);\r\n $user_student_groups = get_user_student_groups($user_id);\r\n $user_local_groups = get_user_local_groups($user_id);\r\n\r\n // set available_by_user_surveys\r\n $available_by_user_surveys = array();\r\n foreach ($available_by_time_surveys as $survey_id) {\r\n // check whether is already voted\r\n // get survey groups\r\n $survey_staff_groups = get_survey_staff_groups($survey_id);\r\n $survey_student_groups = get_survey_student_groups($survey_id);\r\n $survey_local_groups = get_survey_local_groups($survey_id);\r\n\r\n // get common groups\r\n $staff_groups = array_intersect($user_staff_groups, $survey_staff_groups);\r\n $student_groups = array_intersect($user_student_groups, $survey_student_groups);\r\n $local_groups = array_intersect($user_local_groups, $survey_local_groups);\r\n\r\n // get all available surveys\r\n if (!empty($staff_groups) || !empty($student_groups) || !empty($local_groups)) {\r\n array_push($available_by_user_surveys, $survey_id);\r\n }\r\n }\r\n\r\n return $available_by_user_surveys;\r\n}", "public function submission()\n {\n return Submission::where('assignment_id', $this->attributes['id'])->where('user_id', Auth::user()->id)->first();\n }", "public function getSubmittedbyuser()\n\t{\n\t\treturn $this->submittedbyuser;\n\t}", "public function userStanding(User $user, Collection $submissions = null)\n {\n return $this->gradeStanding($this->userPercentage($user, $submissions));\n }", "public function get_survey_submission($hash = NULL, $submission_id = NULL)\n\t{\n\t\t$data = array();\n\n\t\t// If we have a submission hash\n\t\tif ($hash)\n\t\t{\n\t\t\t$this->db->where('hash', $hash);\n\t\t}\n\t\t// If we do not have a submission hash we must have a submission ID\n\t\telse\n\t\t{\n\t\t\t$this->db->where('id', $submission_id);\n\t\t}\n\n\t\t$query = $this->db->limit(1)->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\t$row = $query->row();\n\n\t\t\t$data = array(\n\t\t\t\t'id' => (int)$row->id,\n\t\t\t\t'hash' => $row->hash,\n\t\t\t\t'member_id' => (int)$row->member_id,\n\t\t\t\t'survey_id' => (int)$row->survey_id,\n\t\t\t\t'data' => json_decode($row->data, TRUE),\n\t\t\t\t'created' => (int)$row->created,\n\t\t\t\t'updated' => (int)$row->updated,\n\t\t\t\t'completed' => (int)$row->completed,\n\t\t\t\t'current_page' => (int)$row->current_page,\n\t\t\t\t'complete' => (bool)$row->completed\n\t\t\t);\n\t\t}\n\n\t\treturn $data;\n\t}", "private function getCurrentSubmission(\n Gradeable $gradeable,\n string $who_id,\n string $details_page\n ): GradedGradeable {\n $submitter_id = $this->core->getQueries()->getSubmitterIdFromAnonId($who_id, $gradeable->getId());\n if ($submitter_id === null) {\n $submitter_id = $who_id;\n }\n $current_submission = $this->tryGetGradedGradeable($gradeable, $submitter_id, false);\n\n // Submission does not exist\n if ($current_submission === false) {\n $this->core->redirect($details_page);\n }\n\n return $current_submission;\n }", "public function getSubmissionsForSelect($conferenceId = null, $empty = null)\n\t{\n\t\t$return = array();\n\n\t\tif ($empty) {\n\t\t\t$return[0] = $empty;\n\t\t}\n\n\t\t$identity = Zend_Auth::getInstance()->getIdentity();\n\n\t\t$query = 'select st.submission_id, s.title from submission_status st\n\t\tleft join submissions s ON s.submission_id = st.submission_id\n\t\twhere st.status = :status AND s.conference_id = :conference_id';\n\n\t\tif (!$identity->isAdmin()) {\n\t\t\t// if user is not admin, only show their own submissions\n\t\t\t$mySubmissions = implode(\",\", array_keys($identity->getMySubmissions()));\n\t\t\tif (!empty($mySubmissions)) {\n\t\t\t\t$query .= ' and st.submission_id IN ('.$mySubmissions.')';\n\t\t\t} else {\n\t\t\t\treturn array();\n\t\t\t}\n\t\t}\n\n\t\t$submissions = $this->getAdapter()->query(\n\t\t\t$query,\n\t\t\tarray(\n\t\t\t\t'status' => $this->_getAcceptedValue(),\n\t\t\t\t'conference_id' => $this->getConferenceId()\n\t\t\t)\n\t\t);\n\t\tforeach ($submissions as $submission) {\n\t\t\t$return[$submission['submission_id']] = $submission['title'];\n\t\t}\n\t\treturn $return;\n\t}", "private function get_user_quiz_details() {\n\t\t\tif ( isset( $this->user_quiz_data[ $this->current()->getUserId() ] ) ) {\n\n\t\t\t\treturn $this->user_quiz_data[ $this->current()->getUserId() ];\n\t\t\t}\n\n\t\t\t$user_quizzes = (array) get_user_meta( $this->current()->getUserId(), '_sfwd-quizzes', true );\n\t\t\t$user_quizzes_stats = array();\n\t\t\t/**\n\t\t\t * We want to rebuild/reindex the quizzes listing to be by\n\t\t\t * the statatistics ref ID.\n\t\t\t */\n\t\t\tif ( ! empty( $user_quizzes ) ) {\n\t\t\t\tforeach ( $user_quizzes as $user_quiz ) {\n\t\t\t\t\tif ( ( ! isset( $user_quiz['statistic_ref_id'] ) ) || ( empty( $user_quiz['statistic_ref_id'] ) ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t$statistic_ref_id = absint( $user_quiz['statistic_ref_id'] );\n\t\t\t\t\t$user_quizzes_stats[ $statistic_ref_id ] = $user_quiz;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->user_quiz_data[ $this->current()->getUserId() ] = $user_quizzes_stats;\n\n\t\t\treturn $this->user_quiz_data[ $this->current()->getUserId() ];\n\t\t}", "private function get_submitters_data()\n {\n $publication = DataManager::retrieve_by_id(\n ContentObjectPublication::class_name(), \n $this->get_publication_id());\n \n // Users\n $this->users = DataManager::get_publication_target_users_by_publication_id(\n $this->get_publication_id());\n // Course groups\n $this->course_groups = DataManager::retrieve_publication_target_course_groups(\n $this->get_publication_id(), \n $publication->get_course_id())->as_array();\n // Platform groups\n $this->platform_groups = DataManager::retrieve_publication_target_platform_groups(\n $this->get_publication_id(), \n $publication->get_course_id())->as_array();\n }", "function submitSurveyReport($user_id,$userData)\n\t\t{\n\t\t\t//getting the active survey set no\n\t\t\t$active_set = $this->manageContent->getValue_where(\"survey_info\",\"*\",\"status\",1);\n\t\t\t$survey_set_no = $active_set[0]['set_no'];\n\t\t\t//getting the questions which are answered\n\t\t\tforeach($userData as $key=>$value)\n\t\t\t{\n\t\t\t\tif(substr($key,0,1) == 'q')\n\t\t\t\t{\n\t\t\t\t\t$question_no = substr($key,1);\n\t\t\t\t\t//getting values of user id of that answer\n\t\t\t\t\t$ans_user = $this->manageContent->getValueMultipleCondtn(\"survey_info\",\"*\",array(\"set_no\",\"question_no\",\"answer_no\"),array($survey_set_no,$question_no,$value));\n\t\t\t\t\t$user_field = $ans_user[0]['user_id'];\n\t\t\t\t\tif(empty($user_field))\n\t\t\t\t\t{\n\t\t\t\t\t\t$new_user_field = $user_id;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$new_user_field = $ans_user[0]['user_id'].','.$user_id;\n\t\t\t\t\t}\n\t\t\t\t\t//updating the value\n\t\t\t\t\t$update = $this->manageContent->updateValueWhere(\"survey_info\",\"user_id\",$new_user_field,\"id\",$ans_user[0]['id']);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $update;\n\t\t}", "function submission($task_id, $user_status){\n\t$answer = DB::table('tasks')->where('id',$task_id)->select('answer_type')->first();\n\t$answer_type = $answer->answer_type;\n\t$response = $response_orig;\n\t\n\t// if(sizeof($response_orig)<3 && $answer_type== \"int\"){\n\t// \t$response = \"Not enough data\";\n\t// }\n\n\tif($answer_type == \"mcq\"){\n\t\t$response = DB::table('answers')->select('answers.data as data', DB::raw(\"count('answers.data') as total\"))->join('users', 'users.id', '=', 'answers.user_id')->where('users.is_mturk', true)->whereNotIn('answers.data', ['null', 'timeout'])->where('users.status', $user_status)->where('answers.task_id',$task_id)->groupBy('data')->get();\n\t\t// if(sizeof($response_orig) < 3){\n\t\t// \t$response=\"Not enough data\";\n\t\t// }\n\t\t// else {\n\t\t\t$hist = [];\n\t\t\tforeach( $response as $item )\n\t\t\t\t$hist[$item->data] = $item->total;\n\t\t\tarsort($hist);\n\t\t\t$response = array_slice($hist,0,3,true);\t\n\t\t// }\n\t\t\n\t}\n\n\telse if($answer_type == \"int\"){\n \t\t$data = array_map('intval', DB::table('answers')->select('answers.data as data')->join('users', 'users.id', '=', 'answers.user_id')->where('users.is_mturk', true)->whereNotIn('answers.data', ['null', 'timeout'])->where('users.status', $user_status)->where('answers.task_id', $task_id)->lists('data'));\n\t\t$med = array_median($data);\n\t\t$response = array('data' => $med);\n\t}\n\t\t\n\t\t// if ($total % 2 != 0)\n\t\t// \t$total += 1;\n\t\t// $median = (int)(ceil($total / 2));\n\t\t// $upper_index = (int)(ceil($total / 4) - 1);\n\t\t// $lower_index = (int)(ceil($total * 3 / 4) - 1);\n\n\t\t// $median = DB::table('answers')->join('users', 'users.id', '=', 'answers.user_id')->where('users.is_mturk', true)->where('users.status', $user_status)->whereNotIn('answers.data', ['null', 'timeout'])->where('answers.task_id', $task_id)->orderBy(DB::raw(\"cast(answers.data as unsigned)\"), 'asc')->skip($median)->limit(1)->first();\n\t\t// $median_up = DB::table('answers')->join('users', 'users.id', '=', 'answers.user_id')->where('users.is_mturk', true)->where('users.status', $user_status)->whereNotIn('answers.data', ['null', 'timeout'])->where('answers.task_id', $task_id)->orderBy(DB::raw(\"cast(answers.data as unsigned)\"), 'asc')->skip($upper_index)->limit(1)->first();\n\t\t// $median_down = DB::table('answers')->join('users', 'users.id', '=', 'answers.user_id')->where('users.is_mturk', true)->where('users.status', $user_status)->whereNotIn('answers.data', ['null', 'timeout'])->where('answers.task_id', $task_id)->orderBy(DB::raw(\"cast(answers.data as unsigned)\"), 'asc')->skip($lower_index)->limit(1)->first();\n\n\t\t// $iqr = ($median_down->data - $median_up->data);\n\t\t// $median = $median->data;\n\n\t\t//$response = array('count'=>$total, 'median'=>$median, 'first_quartile'=>$median_up, 'third_quartile' =>$median_down );\n\treturn $response;\n}", "function get_survey_requests_by_user($user_id=NULL,$survey_id=NULL)\n\t{\n\t\t\t$this->db->select('lic_requests.id,expiry,status');\n\t\t\t$this->db->where('userid',$user_id);\n\t\t\t$this->db->where('lic_requests.surveyid',$survey_id);\n\t\t\t$this->db->where('lic_requests.status !=','DENIED');\n\t\t\t$this->db->join('lic_file_downloads', 'lic_requests.id = lic_file_downloads.requestid','left');\n\t\t\t$query=$this->db->get(\"lic_requests\");\n\t\t\t//echo mktime(0,0,0,9,9,2010);\n\t\t\tif (!$query)\n\t\t\t{\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t\t\n\t\t\treturn $query->result_array();\n\t}", "private function get_codehandin_submission($assignmentid, $userid) {\r\n global $DB;\r\n return $DB->get_record('codehandin_submission', array('assignmentid' => $assignmentid, 'userid' => $userid));\r\n }", "public function getSubmissionById($id)\n\t{\n\t\treturn $this->find((int) $id)->current();\n\t}", "public function getAllMyJobPostings()\n {\n $conn = new DBConnect();\n $dbObj = $conn->getDBConnect();\n $this->DAO = new JobDAO($dbObj);\n $this->DAO2 = new SecurityDAO($dbObj);\n $username = Session::get('currentUser');\n $userID = $this->DAO2->getUserIDByUsername($username);\n return $this->DAO->getMyPostedJobs($userID);\n }", "public function evaluationTotal(User $user, Collection $submissions = null)\n {\n $evaluationTotal = 0;\n if(!$submissions){\n $submissions = $this->submissions;\n }\n foreach ( $submissions as $submission )\n {\n $userGrade = $submission->grades()->where('user_id', $user->id);\n if ($userGrade->exists())\n {\n if (!$submission->bonus)\n {\n $evaluationTotal += $submission->total;\n }\n\n }\n }\n\n return $evaluationTotal;\n }", "public function userFinalPercentage(User $user, Collection $submissions = null, $limit=false)\n {\n return round(($this->userMark($user, $submissions, $limit)) * $this->grade, 1);\n }", "function getCumulatedResults(&$question, $finished_ids)\n\t{\n\t\tglobal $ilDB;\n\t\t\n\t\tif(!$finished_ids)\n\t\t{\n\t\t\t$result = $ilDB->queryF(\"SELECT finished_id FROM svy_finished WHERE survey_fi = %s\",\n\t\t\t\tarray('integer'),\n\t\t\t\tarray($this->getSurveyId())\n\t\t\t);\n\t\t\t$nr_of_users = $result->numRows();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$nr_of_users = sizeof($finished_ids);\n\t\t}\n\t\t\n\t\t$result_array =& $question->getCumulatedResults($this->getSurveyId(), $nr_of_users, $finished_ids);\n\t\treturn $result_array;\n\t}", "function getCumulatedResultsDetails($survey_id, $counter, $finished_ids)\n\t{\n\t\tif (count($this->cumulated) == 0)\n\t\t{\n\t\t\tif(!$finished_ids)\n\t\t\t{\n\t\t\t\tinclude_once \"./Modules/Survey/classes/class.ilObjSurvey.php\";\t\t\t\n\t\t\t\t$nr_of_users = ilObjSurvey::_getNrOfParticipants($survey_id);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$nr_of_users = sizeof($finished_ids);\n\t\t\t}\n\t\t\t$this->cumulated =& $this->object->getCumulatedResults($survey_id, $nr_of_users, $finished_ids);\n\t\t}\n\t\t\n\t\t$output = \"\";\n\t\tinclude_once \"./Services/UICore/classes/class.ilTemplate.php\";\n\t\t$template = new ilTemplate(\"tpl.il_svy_svy_cumulated_results_detail.html\", TRUE, TRUE, \"Modules/Survey\");\n\n\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"question\"));\n\t\t$questiontext = $this->object->getQuestiontext();\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $this->object->prepareTextareaOutput($questiontext, TRUE));\n\t\t$template->parseCurrentBlock();\n\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"question_type\"));\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $this->lng->txt($this->getQuestionType()));\n\t\t$template->parseCurrentBlock();\n\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"users_answered\"));\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $this->cumulated[\"USERS_ANSWERED\"]);\n\t\t$template->parseCurrentBlock();\n\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"users_skipped\"));\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $this->cumulated[\"USERS_SKIPPED\"]);\n\t\t$template->parseCurrentBlock();\n\t\t/*\n\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"mode\"));\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $this->cumulated[\"MODE\"]);\n\t\t$template->parseCurrentBlock();\n\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"mode_nr_of_selections\"));\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $this->cumulated[\"MODE_NR_OF_SELECTIONS\"]);\n\t\t$template->parseCurrentBlock();\n\t\t*/\n\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"categories\"));\n\t\t$categories = \"\";\n\t\tif (is_array($this->cumulated[\"variables\"]))\n\t\t{\n\t\t\tforeach ($this->cumulated[\"variables\"] as $key => $value)\n\t\t\t{\n\t\t\t\t$categories .= \"<li>\" . $value[\"title\"] . \": n=\" . $value[\"selected\"] . \n\t\t\t\t\t\" (\" . sprintf(\"%.2f\", 100*$value[\"percentage\"]) . \"%)</li>\";\n\t\t\t}\n\t\t}\n\t\t$categories = \"<ol>$categories</ol>\";\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $categories);\n\t\t$template->parseCurrentBlock();\n\t\t\n\t\t// add text answers to detailed results\n\t\tif (is_array($this->cumulated[\"textanswers\"]))\n\t\t{\n\t\t\t$template->setCurrentBlock(\"detail_row\");\n\t\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"freetext_answers\"));\t\n\t\t\t$html = \"\";\t\t\n\t\t\tforeach ($this->cumulated[\"textanswers\"] as $key => $answers)\n\t\t\t{\n\t\t\t\t$html .= $this->cumulated[\"variables\"][$key][\"title\"] .\"\\n\";\n\t\t\t\t$html .= \"<ul>\\n\";\n\t\t\t\tforeach ($answers as $answer)\n\t\t\t\t{\n\t\t\t\t\t$html .= \"<li>\" . preg_replace(\"/\\n/\", \"<br>\\n\", $answer) . \"</li>\\n\";\n\t\t\t\t}\n\t\t\t\t$html .= \"</ul>\\n\";\n\t\t\t}\n\t\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $html);\n\t\t\t$template->parseCurrentBlock();\n\t\t}\t\t\t\n\t\t\n\t\t// chart \n\t\t$template->setCurrentBlock(\"detail_row\");\t\t\t\t\n\t\t$template->setVariable(\"TEXT_OPTION\", $this->lng->txt(\"chart\"));\n\t\t$template->setVariable(\"TEXT_OPTION_VALUE\", $this->renderChart(\"svy_ch_\".$this->object->getId(), $this->cumulated[\"variables\"]));\n\t\t$template->parseCurrentBlock();\n\t\t\t\t\n\t\t$template->setVariable(\"QUESTION_TITLE\", \"$counter. \".$this->object->getTitle());\n\t\treturn $template->get();\n\t}", "public function getSubmissionData()\r\n {\r\n return $this->data;\r\n }" ]
[ "0.58979917", "0.5864403", "0.56491774", "0.5584163", "0.5540704", "0.5500674", "0.54719305", "0.5454758", "0.5414054", "0.53811324", "0.5347915", "0.5323728", "0.52780086", "0.52272236", "0.5170256", "0.51539874", "0.5069158", "0.50341356", "0.49852288", "0.49704343", "0.49376476", "0.4922154", "0.49219683", "0.48684505", "0.48546648", "0.48175475", "0.481444", "0.4798427", "0.4779008", "0.47745308" ]
0.6154837
0
Check an array of submission hashes to see if it marks a completed survey
public function is_complete_by_hashes($survey_id, $submission_hashes) { $query = $this->db ->where('survey_id', $survey_id) ->where('completed IS NOT NULL', NULL, TRUE) ->where_in('hash', $submission_hashes) ->limit(1) ->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { return TRUE; } else { return FALSE; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function is_progress_by_hashes($survey_id, $submission_hashes)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NULL', NULL, TRUE)\n\t\t\t->where_in('hash', $submission_hashes)\n\t\t\t->order_by('updated', 'DESC')\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\t$row = $query->row();\n\t\t\treturn $row->hash;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public function is_complete($survey_id)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NOT NULL', NULL, TRUE)\n\t\t\t->where('member_id', $this->session->userdata('member_id'))\n\t\t\t->order_by('updated', 'DESC')\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public function user_submissions_complete($submission_hahses)\n\t{\n\t\t// If user submissions have not yet been gathered\n\t\tif (self::$user_submissions == NULL) { $this->get_user_submissions($submission_hahses); }\n\n\t\t// If we have some completed surveys return an array of their hashes\n\t\treturn isset(self::$user_submissions['complete']) ? self::$user_submissions['complete'] : array();\n\t}", "function isComplete() {\n\t\t$questions = $this->getQuestions();\n\t\t\n\t\tforeach((array) $questions as $question) {\n\t\t\tif(!$question->hasAnswer($this->_answers)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "function isComplete()\n\t{\n\t\tif (($this->getTitle()) and (count($this->questions)))\n\t\t{\n\t\t\treturn 1;\n\t\t} \n\t\t\telse \n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}", "function HasSubmitted ($id) {\n if (@mysql_result(@mysql_query (\"SELECT `submission_id` AS `sub_id` FROM `hunt_submissions` WHERE `submission_person` = $id AND `submission_hunt` = \".$this->hunt_id.\" LIMIT 1\", $this->ka_db), 0, 'sub_id') != '') {\n return true;\n } else {\n return false;\n }\n }", "public function is_progress($survey_id)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NULL', NULL, TRUE)\n\t\t\t->where('member_id', $this->session->userdata('member_id'))\n\t\t\t->order_by('updated', 'DESC')\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\t$row = $query->row();\n\t\t\treturn $row->hash;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "function _isComplete($obj_id)\n\t{\n\t\t$survey = new ilObjSurvey($obj_id, false);\n\t\t$survey->loadFromDb();\n\t\tif (($survey->getTitle()) and (count($survey->questions)))\n\t\t{\n\t\t\treturn 1;\n\t\t} \n\t\t\telse \n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}", "function questionnaire_user_complete($course, $user, $mod, $questionnaire) {\n global $CFG;\n require_once($CFG->dirroot . '/mod/questionnaire/locallib.php');\n\n if ($responses = questionnaire_get_user_responses($questionnaire->sid, $user->id, $complete = false)) {\n foreach ($responses as $response) {\n if ($response->complete == 'y') {\n echo get_string('submitted', 'questionnaire').' '.userdate($response->submitted).'<br />';\n } else {\n echo get_string('attemptstillinprogress', 'questionnaire').' '.userdate($response->submitted).'<br />';\n }\n }\n } else {\n print_string('noresponses', 'questionnaire');\n }\n\n return true;\n}", "function areSet($submit, $arr) {\n if(empty($submit)) return false;\n $json = json_encode($submit);\n foreach ($arr as $variable) {\n if (strpos($json, $variable)==-1) return false;\n }\n return true;\n}", "function check_form_submitted()\n {\n $query = $this->recruitment_model->get_faculty_info($this->user_id);\n if($query->num_rows()==1)\n {\n if($query->row()->final_submission==1)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n }\n return 0;\n }", "function tsk_mark_complete() {\n\t$lesson_args = array(\n\t\t'post_type' => 'lesson',\n\t\t'posts_per_page' => '-1'\n\t);\n\n\t$lesson_arr = get_posts($lesson_args);\n\t\n\t// Is there a better way to do this?\n\tforeach ($lesson_arr as $lesson) { \n\t\tif ( isset( $_POST['_lesson_'.$lesson->ID.'_complete'] ) ) {\n\t\t\t$new_state = $_POST['_lesson_'.$lesson->ID.'_complete'];\n\t\t\t$user_id = get_current_user_id();\n\n\t\t\tupdate_user_meta( $user_id, '_lesson_'.$lesson->ID.'_complete', $new_state ); \n\n\t\t\tif ( is_wp_error( $user_id ) ) {\n\t\t\t\t// There was an error, probably that user doesn't exist.\n\t\t\t} else {\n\t\t\t\t// Success!\n\t\t\t}\n\t\t}\n\t}\n\n}", "public function hasAnswers();", "public static function check_question(array $question);", "function proposal_is_submitted($proposal_id) {\n foreach ($_SESSION['submitted_proposals'] as $sp) {\n if ($sp->id == $proposal_id) {return TRUE;}\n }\n}", "function isComplete()\n\t{\n\t\tif (\n\t\t\tstrlen($this->title) \n\t\t\t&& $this->author \n\t\t\t&& $this->question && \n\t\t\tcount($this->answers) >= $this->correctanswers \n\t\t\t&& $this->getMaximumPoints() > 0\n\t\t)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function _erpal_projects_helper_timetracking_finalise_action_validate($timetrackings) {\n $errors = false;\n\n foreach ($timetrackings as $timetracking) {\n //error if timetracking has no subject\n $timetracking_link = l($timetracking->defaultLabel(), 'timetracking/'.$timetracking->timetracking_id.'/edit', array('query' => array('destination' => $_GET['q'])));\n if (!$timetracking->subject_id) {\n $errors[$timetracking->timetracking_id]['entity'] = $timetracking;\n $errors[$timetracking->timetracking_id]['errors'][] = t('To finalise a timetracking, ensure that a subject task is set for !timetracking_link', array('!timetracking_link' => $timetracking_link));\n } elseif (!$timetracking->time_end) {\n //if we dont have a duration the timetracking is still running and cannot be finalised!\n $errors[$timetracking->timetracking_id]['entity'] = $timetracking;\n $errors[$timetracking->timetracking_id]['errors'][] = t('To finalise the timetracking !timetracking_link, ensure that it is not still tracking the time!', array('!timetracking_link' => $timetracking_link));\n }\n }\n\n return $errors;\n}", "public function answerCheck()\n {\n $first_number = $this->post_data['firstNumber']; \n // Assign the second number in the question to $second_number in the class method.\n $second_number = $this->post_data['secondNumber'];\n // Assign the number of correct answers to $number_correct in the class method.\n $number_correct = $this->post_data['numberCorrect'];\n // Assign the question number for this level to $question_number in the class method.\n $question_number = $this->post_data['questionNumber'];\n // Assign the level number for this level to $level_number in the class method.\n $level_number = $this->post_data['levelNumber'];\n // Reset Question number to 1 if more than five questions have been completed or increase it by one\n if($question_number == 5) {\n $question_number = 1;\n $level_number++;\n } else {\n $question_number++;\n }\n\n // Check the correct answer to the question.\n $sum = $first_number * $second_number;\n // If the answer in the post data is equivalent to the correct answer, increment $number_correct by one \n // then return true and $number_correct. If it isn't correct return false and $number_correct.\n if ($sum == $this->post_data['sumAnswer']) {\n $number_correct++;\n return array(true, $number_correct, $question_number, $level_number);\n } else {\n return array(false, $number_correct, $question_number, $level_number);\n }\n }", "public function canBeSubmitted()\n {\n if (!$this->isNotYetSubmitted()) {\n return false;\n }\n\n $confirmationSections = $this->getSectionCompletion(self::CONFIRMATION_SECTIONS);\n\n if (!$confirmationSections['allCompleted']) {\n return false;\n }\n\n $applicationSections = $this->getSectionCompletion(self::SECTIONS);\n\n if (!$applicationSections['allCompleted']) {\n return false;\n }\n\n return $this->licence->canMakeEcmtApplication($this);\n }", "public function isSubmitted();", "function is_any_parcours_completed() {\n\t\n\t$id_user = get_current_user_id();\n\tglobal $wpdb;\n\t$results = $wpdb->get_results(\"SELECT * FROM parcours_user WHERE id_user = $id_user AND completed = 1\", ARRAY_A);\n\tif(!empty($results)) return true;\t\n\treturn false;\n}", "function hasCompletedSurvey($iSurveyId, $sToken) {\n\t\t// Check if this token has already completed this survey\n\t\t$sQuery \t\t= \"SELECT completed FROM lime_tokens_$iSurveyId WHERE token = '$sToken'\";\n\t\t$oResult\t\t= $this->oDbConnection->query($sQuery);\n\t\twhile($aRow = mysqli_fetch_array($oResult)) {\n\t\t\t$isCompleted = $aRow['completed'];\n\t\t}\n\t\treturn (isset($isCompleted) && ($isCompleted != 'N'));\n\t}", "function languagelesson_is_lesson_complete($lessonid, $userid) {\n\tglobal $CFG, $DB, $LL_QUESTION_TYPE;\n\n // Pull the list of all question types as a string of format [type],[type],[type],.\n\t$qtypeslist = implode(',', array_keys($LL_QUESTION_TYPE));\n\n\t\n// Find the number of question pages \n\t\n // This alias must be the same in both queries, so establish it here.\n\t$tmp_name = \"page\";\n // A sub-query used to ignore pages that have no answers stored for them\n // (instruction pages).\n\t$do_answers_exist = \"select *\n\t\t\t\t\t\t from {$CFG->prefix}languagelesson_answers ans\n\t\t\t\t\t\t where ans.pageid = $tmp_name.id\";\n // Query to pull only pages of stored languagelesson question types, belonging\n // to the current lesson, and having answer records stored.\n\t$get_only_question_pages = \"select *\n\t\t\t\t\t\t\t\tfrom {$CFG->prefix}languagelesson_pages $tmp_name\n\t\t\t\t\t\t\t\twhere qtype in ($qtypeslist)\n\t\t\t\t\t\t\t\t\t and $tmp_name.lessonid=$lessonid\n\t\t\t\t\t\t\t\t\t and exists ($do_answers_exist)\";\n\t$qpages = $DB->get_records_sql($get_only_question_pages);\n\t$numqpages = count($qpages);\n\t\n\t\n// Find the number of questions attempted.\n\t\n\t// See how many questions have been attempted.\n\t$numattempts = languagelesson_count_most_recent_attempts($lessonid, $userid);\n\n\t// If the number of question pages matches the number of attempted questions, it's complete.\n\tif ($numqpages == $numattempts) { return true; }\n\telse { return false; }\n}", "public function markSubmitted(): void\n {\n $user = Auth::user()->callsign;\n $uploadDate = date('n/j/y G:i:s');\n $batchInfo = $this->batchInfo ?? '';\n\n foreach ($this->bmids as $bmid) {\n $bmid->status = Bmid::SUBMITTED;\n\n /*\n * Make a note of what provisions were set\n */\n\n $showers = [];\n if ($bmid->showers) {\n $showers[] = 'set';\n }\n\n if ($bmid->earned_showers) {\n $showers[] = 'earned';\n }\n if ($bmid->allocated_showers) {\n $showers[] = 'allocated';\n }\n if (empty($showers)) {\n $showers[] = 'none';\n }\n\n $meals = [];\n if (!empty($bmid->meals)) {\n $meals[] = $bmid->meals . ' set';\n }\n if (!empty($bmid->earned_meals)) {\n $meals[] = $bmid->earned_meals . ' earned';\n }\n if (!empty($bmid->allocated_meals)) {\n $meals[] = $bmid->allocated_meals . ' allocated';\n }\n\n if (empty($meals)) {\n $meals[] = 'none';\n }\n\n /*\n * Figure out which provisions are to be marked as submitted.\n *\n * Note: Meals and showers are not allowed to be banked in the case were the\n * person earned them yet their position (Council, OOD, Supervisor, etc.) comes\n * with a provisions package.\n */\n\n $items = [];\n if ($bmid->effectiveShowers()) {\n $items[] = Provision::WET_SPOT;\n }\n\n if (!empty($bmid->meals) || !empty($bmid->allocated_meals)) {\n // Person is working.. consume all the meals.\n $items = [...$items, ...Provision::MEAL_TYPES];\n } else if (!empty($bmid->earned_meals)) {\n // Currently only two meal provision types, All Eat, and Event Week\n $items[] = ($bmid->earned_meals == Bmid::MEALS_ALL) ? Provision::ALL_EAT_PASS : Provision::EVENT_EAT_PASS;\n }\n\n\n if (!empty($items)) {\n $items = array_unique($items);\n Provision::markSubmittedForBMID($bmid->person_id, $items);\n }\n\n $meals = '[meals ' . implode(', ', $meals) . ']';\n $showers = '[showers ' . implode(', ', $showers) . ']';\n $bmid->notes = \"$uploadDate $user: Exported $meals $showers\\n$bmid->notes\";\n $bmid->auditReason = 'exported to print';\n $bmid->batch = $batchInfo;\n $bmid->saveWithoutValidation();\n }\n }", "public function canCheckAnswers()\n {\n $sections = $this->getSectionCompletion(self::SECTIONS);\n\n return $sections['allCompleted'] && $this->canBeUpdated();\n }", "public function hasComplete(){\n return $this->_has(2);\n }", "public function isSubmited(): bool\n {\n return (bool) $this->values();\n }", "public function getHasSubmitted() {\n\t\t@$cookie = $_COOKIE['promotion_' . $this->getId()];\n\t\treturn (bool) $cookie;\n\t}", "function challengeCompleted($challenge_id)\n\t{\n\t $current = $this->DB->database_select('users', array('challenges_completed'), array('uid' => session_get('uid')), 1);\n\t $current = $current['challenges_completed'];\n\t if(!empty($current)) //Has any challenges been completed?\n\t {\n\t\t $challenges = explode(',', $current);\n\t\t for($i = 0; $i < count($challenges); $i++)\n\t\t {\n\t\t\t if($challenges[$i] == $challenge_id)\n\t\t\t {\n\t\t\t\t return true; //Challenge was already completed\n\t\t\t }\n\t\t }\n\t }\n\t return false;\n\t}", "function incompleteSubmissionExists($monographId, $userId, $pressId) {\n\t\t$result =& $this->retrieve(\n\t\t\t'SELECT\tsubmission_progress\n\t\t\tFROM\tmonographs\n\t\t\tWHERE\tmonograph_id = ? AND\n\t\t\t\tuser_id = ? AND\n\t\t\t\tpress_id = ? AND\n\t\t\t\tdate_submitted IS NULL',\n\t\t\tarray($monographId, $userId, $pressId)\n\t\t);\n\t\t$returner = isset($result->fields[0]) ? $result->fields[0] : false;\n\n\t\t$result->Close();\n\t\tunset($result);\n\n\t\treturn $returner;\n\t}" ]
[ "0.6178807", "0.59711295", "0.5959456", "0.5868236", "0.5860308", "0.5852881", "0.57966447", "0.574047", "0.56483114", "0.55511385", "0.55195135", "0.5517042", "0.5457055", "0.54339623", "0.5426887", "0.54228735", "0.54208577", "0.5354125", "0.5342349", "0.533848", "0.53353405", "0.53350353", "0.5314593", "0.530779", "0.52938277", "0.52745646", "0.5260125", "0.5253789", "0.5240312", "0.52338785" ]
0.6854474
0
Check an array of submission hashes to see if the current user has any progress in this survey
public function is_progress_by_hashes($survey_id, $submission_hashes) { $query = $this->db ->where('survey_id', $survey_id) ->where('completed IS NULL', NULL, TRUE) ->where_in('hash', $submission_hashes) ->order_by('updated', 'DESC') ->limit(1) ->get('vwm_surveys_submissions'); if ($query->num_rows() > 0) { $row = $query->row(); return $row->hash; } else { return FALSE; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function is_progress($survey_id)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NULL', NULL, TRUE)\n\t\t\t->where('member_id', $this->session->userdata('member_id'))\n\t\t\t->order_by('updated', 'DESC')\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\t$row = $query->row();\n\t\t\treturn $row->hash;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public function user_submissions_progress($submission_hahses)\n\t{\n\t\t// If user submissions have not yet been gathered\n\t\tif (self::$user_submissions == NULL) { $this->get_user_submissions($submission_hahses); }\n\n\t\t// If we have some surveys in progress return an array of their hashes\n\t\treturn isset(self::$user_submissions['progress']) ? self::$user_submissions['progress'] : array();\n\t}", "public function is_complete_by_hashes($survey_id, $submission_hashes)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NOT NULL', NULL, TRUE)\n\t\t\t->where_in('hash', $submission_hashes)\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "function incompleteSubmissionExists($monographId, $userId, $pressId) {\n\t\t$result =& $this->retrieve(\n\t\t\t'SELECT\tsubmission_progress\n\t\t\tFROM\tmonographs\n\t\t\tWHERE\tmonograph_id = ? AND\n\t\t\t\tuser_id = ? AND\n\t\t\t\tpress_id = ? AND\n\t\t\t\tdate_submitted IS NULL',\n\t\t\tarray($monographId, $userId, $pressId)\n\t\t);\n\t\t$returner = isset($result->fields[0]) ? $result->fields[0] : false;\n\n\t\t$result->Close();\n\t\tunset($result);\n\n\t\treturn $returner;\n\t}", "public function user_submissions_complete($submission_hahses)\n\t{\n\t\t// If user submissions have not yet been gathered\n\t\tif (self::$user_submissions == NULL) { $this->get_user_submissions($submission_hahses); }\n\n\t\t// If we have some completed surveys return an array of their hashes\n\t\treturn isset(self::$user_submissions['complete']) ? self::$user_submissions['complete'] : array();\n\t}", "function is_any_parcours_completed() {\n\t\n\t$id_user = get_current_user_id();\n\tglobal $wpdb;\n\t$results = $wpdb->get_results(\"SELECT * FROM parcours_user WHERE id_user = $id_user AND completed = 1\", ARRAY_A);\n\tif(!empty($results)) return true;\t\n\treturn false;\n}", "function isSubmittedBy();", "function isRead() {\n\t\t$submissionDao = Application::getSubmissionDAO();\n\t\t$userGroupDao = DAORegistry::getDAO('UserGroupDAO');\n\t\t$userStageAssignmentDao = DAORegistry::getDAO('UserStageAssignmentDAO');\n\t\t$viewsDao = DAORegistry::getDAO('ViewsDAO');\n\n\t\t$submission = $submissionDao->getById($this->getSubmissionId());\n\n\t\t// Get the user groups for this stage\n\t\t$userGroups = $userGroupDao->getUserGroupsByStage(\n\t\t\t$submission->getContextId(),\n\t\t\t$this->getStageId()\n\t\t);\n\t\twhile ($userGroup = $userGroups->next()) {\n\t\t\t$roleId = $userGroup->getRoleId();\n\t\t\tif ($roleId != ROLE_ID_MANAGER && $roleId != ROLE_ID_SUB_EDITOR) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Get the users assigned to this stage and user group\n\t\t\t$stageUsers = $userStageAssignmentDao->getUsersBySubmissionAndStageId(\n\t\t\t\t$this->getSubmissionId(),\n\t\t\t\t$this->getStageId(),\n\t\t\t\t$userGroup->getId()\n\t\t\t);\n\n\t\t\t// Check if any of these users have viewed it\n\t\t\twhile ($user = $stageUsers->next()) {\n\t\t\t\tif ($viewsDao->getLastViewDate(\n\t\t\t\t\tASSOC_TYPE_REVIEW_RESPONSE,\n\t\t\t\t\t$this->getId(),\n\t\t\t\t\t$user->getId()\n\t\t\t\t)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "function HasSubmitted ($id) {\n if (@mysql_result(@mysql_query (\"SELECT `submission_id` AS `sub_id` FROM `hunt_submissions` WHERE `submission_person` = $id AND `submission_hunt` = \".$this->hunt_id.\" LIMIT 1\", $this->ka_db), 0, 'sub_id') != '') {\n return true;\n } else {\n return false;\n }\n }", "private function get_user_submissions($submission_hahses)\n\t{\n\t\tself::$user_submissions = array();\n\n\t\t$member_id = $this->session->userdata('member_id');\n\n\t\t// Make sure we have a member ID or some submission hashes to check\n\t\tif ( $member_id OR $submission_hahses )\n\t\t{\n\t\t\t// If we have a member ID\n\t\t\tif ($member_id)\n\t\t\t{\n\t\t\t\t$this->db\n\t\t\t\t\t->where('member_id', $member_id)\n\t\t\t\t\t->or_where_in('hash', $submission_hahses ? $submission_hahses : ''); // CI does not like an empty array\n\t\t\t}\n\t\t\t// If we only have submission hashes\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->where_in('hash', $submission_hahses);\n\t\t\t}\n\n\t\t\t$query = $this->db\n\t\t\t\t->order_by('completed, updated, created', 'DESC')\n\t\t\t\t->get('vwm_surveys_submissions');\n\n\t\t\tif ($query->num_rows() > 0)\n\t\t\t{\n\t\t\t\t// Loop through each submission\n\t\t\t\tforeach ($query->result() as $row)\n\t\t\t\t{\n\t\t\t\t\t// First key is either \"completed\" or \"progress\", second is survey ID, and value is the submission hash\n\t\t\t\t\tself::$user_submissions[ $row->completed ? 'complete' : 'progress' ][ $row->survey_id ] = $row->hash;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function isSubmitted();", "function check_form_submitted()\n {\n $query = $this->recruitment_model->get_faculty_info($this->user_id);\n if($query->num_rows()==1)\n {\n if($query->row()->final_submission==1)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n }\n return 0;\n }", "public function evalGradeExists(User $user, Collection $submissions = null)\n {\n if(!$submissions){\n $submissions = $this->submissions;\n }\n $list = $submissions->pluck('id');\n $userGrade = $user->grades()->whereIn('submission_id', $list)->get();\n return !$userGrade->isEmpty();\n\n }", "function tsk_mark_complete() {\n\t$lesson_args = array(\n\t\t'post_type' => 'lesson',\n\t\t'posts_per_page' => '-1'\n\t);\n\n\t$lesson_arr = get_posts($lesson_args);\n\t\n\t// Is there a better way to do this?\n\tforeach ($lesson_arr as $lesson) { \n\t\tif ( isset( $_POST['_lesson_'.$lesson->ID.'_complete'] ) ) {\n\t\t\t$new_state = $_POST['_lesson_'.$lesson->ID.'_complete'];\n\t\t\t$user_id = get_current_user_id();\n\n\t\t\tupdate_user_meta( $user_id, '_lesson_'.$lesson->ID.'_complete', $new_state ); \n\n\t\t\tif ( is_wp_error( $user_id ) ) {\n\t\t\t\t// There was an error, probably that user doesn't exist.\n\t\t\t} else {\n\t\t\t\t// Success!\n\t\t\t}\n\t\t}\n\t}\n\n}", "function is_current_parcours_completed($id_user , $id_episode , $id_parcours) {\n\n\t$completed = false;\n\n\tglobal $wpdb;\n\n\t$episodes = get_field('episodes' , $id_parcours); \n\t$episodes_number = count($episodes); \n\n\t$rowcount = $wpdb->get_var(\"SELECT COUNT(*) FROM tracking WHERE id_user = $id_user AND id_parcours = $id_parcours\");\n\n\tif($rowcount == $episodes_number) $completed = true;\n\n\treturn $completed;\n\n}", "function questionnaire_user_complete($course, $user, $mod, $questionnaire) {\n global $CFG;\n require_once($CFG->dirroot . '/mod/questionnaire/locallib.php');\n\n if ($responses = questionnaire_get_user_responses($questionnaire->sid, $user->id, $complete = false)) {\n foreach ($responses as $response) {\n if ($response->complete == 'y') {\n echo get_string('submitted', 'questionnaire').' '.userdate($response->submitted).'<br />';\n } else {\n echo get_string('attemptstillinprogress', 'questionnaire').' '.userdate($response->submitted).'<br />';\n }\n }\n } else {\n print_string('noresponses', 'questionnaire');\n }\n\n return true;\n}", "function proposal_is_submitted($proposal_id) {\n foreach ($_SESSION['submitted_proposals'] as $sp) {\n if ($sp->id == $proposal_id) {return TRUE;}\n }\n}", "function check_user_has_data_access($survey_id,$user_id)\n\t{\n\t\t$requests=$this->get_user_study_n_collection_requests($survey_id,$user_id);\n\t\t\t\n\t\t\tforeach($requests as $request)\n\t\t\t{\n\t\t\t\tif ($request['status']=='APPROVED')\n\t\t\t\t{\n\t\t\t\t\treturn TRUE;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\treturn FALSE;\n\t}", "private function has_submission_field($user_id)\n {\n $this->db->where('umeta_key', 'submissions');\n $this->db->where('user_id', $user_id);\n\n $result = $this->db->get('user_meta');\n\n return ($result->num_rows() == 1) ? $result->row('umeta_value') : FALSE;\n }", "public function getHasSubmitted() {\n\t\t@$cookie = $_COOKIE['promotion_' . $this->getId()];\n\t\treturn (bool) $cookie;\n\t}", "function isSubmitted()\r\n\t\t{\r\n\t\t\tif( isset($_POST[$this->form_id.'-issubmitted'] ) )\r\n\t\t\t\treturn TRUE;\r\n\t\t\telse\r\n\t\t\t\treturn FALSE;\r\n\r\n\t\t}", "public function updateSubmissionStatus() {\n\n $updateStatus = Usersubmissionstatus::where('user_id', Auth::user()->id)\n ->where('quarter_id', Quarter::getRunningQuarter()->id)\n ->update(['status_id' => config('constant.status.L1_APPROVAL_PENDING')]);\n // Let's notify user and L1 about user submission status.\n return $this->sendMail(config('constant.email_status.INFORM_APPRAISEE'));\n }", "public function isCurrentUserPrepared()\n {\n if ($this->isCompletedByCurrentUser()) {\n return true;\n }\n\n foreach ($this->getPrerequisites() as $p) {\n if (!$p->isCompletedByCurrentUser()) {\n return false;\n }\n }\n\n return true;\n }", "public function is_complete($survey_id)\n\t{\n\t\t$query = $this->db\n\t\t\t->where('survey_id', $survey_id)\n\t\t\t->where('completed IS NOT NULL', NULL, TRUE)\n\t\t\t->where('member_id', $this->session->userdata('member_id'))\n\t\t\t->order_by('updated', 'DESC')\n\t\t\t->limit(1)\n\t\t\t->get('vwm_surveys_submissions');\n\n\t\tif ($query->num_rows() > 0)\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "function submissions() {\n \n global $CFG, $USER;\n\n // need to get course id in order to retrieve students\n $assignment = get_record('assignment', 'id', $this->mainobject->id);\n $courseid = $assignment->course;\n\n //permission to grade?\n $coursemodule = get_record('course_modules', 'module', $this->mainobject->modulesettings['assignment']->id, 'instance', $assignment->id) ;\n $modulecontext = get_context_instance(CONTEXT_MODULE, $coursemodule->id);\n\n if (!has_capability($this->capability, $modulecontext, $USER->id)) {\n return;\n }\n \n $this->mainobject->get_course_students($courseid);\n\n $student_sql = $this->get_role_users_sql($this->mainobject->courses[$courseid]->context);\n\n $sql = \"SELECT s.id as subid, s.userid, s.timemodified, s.data2, c.id as cmid\n FROM {$CFG->prefix}assignment_submissions s\n INNER JOIN {$CFG->prefix}course_modules c\n ON s.assignment = c.instance\n INNER JOIN {$CFG->prefix}assignment a\n ON s.assignment = a.id\n WHERE s.assignment = {$this->mainobject->id}\n AND s.timemarked < s.timemodified\n AND (s.userid IN ({$student_sql}))\n AND NOT (a.resubmit = 0 AND s.timemarked > 0)\n \n AND c.module = {$this->mainobject->modulesettings['assignment']->id}\n ORDER BY timemodified ASC\";\n\n $submissions = get_records_sql($sql);\n\n if ($submissions) {\n\n $data = array();\n\n // If we are not making the submissions for a specific group, run the group filtering\n // function to see if the config settings say display by groups and display them if they\n // are (returning false). If there are no groups, the function will return true and we\n // carry on, but if the config settings say 'don't display' then it will return false\n // and we skip this assignment\n if(!$this->mainobject->group) {\n\n //TODO - data array as input for function\n\n //$data['submissions'] = $submissions;\n //$data['type'] = $this->type;\n //$data['id'] = $this->mainobject->id;\n //$data['course'] = $assignment->course;\n\n //$group_filter = $this->mainobject->try_to_make_group_nodes($data);\n $group_filter = $this->mainobject->try_to_make_group_nodes($submissions, $this->type, $this->mainobject->id, $assignment->course);\n\n if (!$group_filter) {\n return;\n }\n }\n\n // begin json object\n $this->mainobject->output = '[{\"type\":\"submissions\"}';\n\n foreach ($submissions as $submission) {\n // add submission to JSON array of objects\n if (!isset($submission->userid)) {\n continue;\n }\n\n // ignore non-submitted uploaded files\n if (($assignment->assignmenttype == 'upload') && ($submission->data2 != 'submitted')) {\n continue;\n }\n\n // if we are displaying for just one group, skip this submission if it doesn't match\n if ($this->mainobject->group && !$this->mainobject->check_group_membership($this->mainobject->group, $submission->userid)) {\n continue;\n }\n \n $name = $this->mainobject->get_fullname($submission->userid);\n \n // sort out the time info\n $now = time();\n $seconds = ($now - $submission->timemodified);\n $summary = $this->mainobject->make_time_summary($seconds);\n \n $this->mainobject->make_submission_node($name, $submission->userid, $submission->cmid, $summary, 'assignment_final', $seconds, $submission->timemodified);\n \n }\n $this->mainobject->output .= \"]\"; // end JSON array\n \n }\n }", "public function isCurrentUserPreparedForPrerequisites()\n {\n if ($this->isCompletedByCurrentUser()) {\n return true;\n }\n\n if ($this->isCurrentUserPrepared()) {\n return true;\n }\n\n foreach ($this->getPrerequisites() as $p) {\n if (!$p->isCurrentUserPrepared()) {\n return false;\n }\n }\n\n return true;\n }", "public function checkCurrentSlot() {\n $result = array();\n foreach($this->workflowSlotUser as $user) {\n $processUser = WorkflowProcessUserTable::instance()->getProcessUserByWorkflowSlotUserId($user->getId())->toArray();\n $this->decission[] = $this->checkProcessState($processUser);\n }\n }", "public function hasPartsToIssue(): bool\n {\n return count($this->issuedItems) > 0;\n }", "public function markSubmitted(): void\n {\n $user = Auth::user()->callsign;\n $uploadDate = date('n/j/y G:i:s');\n $batchInfo = $this->batchInfo ?? '';\n\n foreach ($this->bmids as $bmid) {\n $bmid->status = Bmid::SUBMITTED;\n\n /*\n * Make a note of what provisions were set\n */\n\n $showers = [];\n if ($bmid->showers) {\n $showers[] = 'set';\n }\n\n if ($bmid->earned_showers) {\n $showers[] = 'earned';\n }\n if ($bmid->allocated_showers) {\n $showers[] = 'allocated';\n }\n if (empty($showers)) {\n $showers[] = 'none';\n }\n\n $meals = [];\n if (!empty($bmid->meals)) {\n $meals[] = $bmid->meals . ' set';\n }\n if (!empty($bmid->earned_meals)) {\n $meals[] = $bmid->earned_meals . ' earned';\n }\n if (!empty($bmid->allocated_meals)) {\n $meals[] = $bmid->allocated_meals . ' allocated';\n }\n\n if (empty($meals)) {\n $meals[] = 'none';\n }\n\n /*\n * Figure out which provisions are to be marked as submitted.\n *\n * Note: Meals and showers are not allowed to be banked in the case were the\n * person earned them yet their position (Council, OOD, Supervisor, etc.) comes\n * with a provisions package.\n */\n\n $items = [];\n if ($bmid->effectiveShowers()) {\n $items[] = Provision::WET_SPOT;\n }\n\n if (!empty($bmid->meals) || !empty($bmid->allocated_meals)) {\n // Person is working.. consume all the meals.\n $items = [...$items, ...Provision::MEAL_TYPES];\n } else if (!empty($bmid->earned_meals)) {\n // Currently only two meal provision types, All Eat, and Event Week\n $items[] = ($bmid->earned_meals == Bmid::MEALS_ALL) ? Provision::ALL_EAT_PASS : Provision::EVENT_EAT_PASS;\n }\n\n\n if (!empty($items)) {\n $items = array_unique($items);\n Provision::markSubmittedForBMID($bmid->person_id, $items);\n }\n\n $meals = '[meals ' . implode(', ', $meals) . ']';\n $showers = '[showers ' . implode(', ', $showers) . ']';\n $bmid->notes = \"$uploadDate $user: Exported $meals $showers\\n$bmid->notes\";\n $bmid->auditReason = 'exported to print';\n $bmid->batch = $batchInfo;\n $bmid->saveWithoutValidation();\n }\n }", "public function IsSubmitted() {\n\n if ($this->HttpValues === null) {\n // HTTP submision's data are not imported? import them now from Request service.\n $this->SetHttpValues();\n }\n return isset($this->HttpValues['_FormName'])\n && $this->HttpValues['_FormName'] === $this->Name;\n }" ]
[ "0.6453063", "0.63572836", "0.62184566", "0.614686", "0.5964588", "0.5960737", "0.58579767", "0.57735705", "0.5769345", "0.5744846", "0.57434314", "0.57242435", "0.56118435", "0.5611202", "0.5591954", "0.5563764", "0.55606085", "0.54936224", "0.54547346", "0.5449678", "0.5419217", "0.5407261", "0.53684336", "0.5356259", "0.5347819", "0.532864", "0.5328052", "0.5318049", "0.53054416", "0.529099" ]
0.66446465
0
Imports a checkbox header i.e. a field's declaration.
protected function process_header_checkbox(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output_checkbox_row( string $label, string $key, bool $checked = false ): void {\n\twp_enqueue_style( 'wpinc-meta-field' );\n\t?>\n\t<div class=\"wpinc-meta-field-single checkbox\">\n\t\t<label>\n\t\t\t<span class=\"checkbox\"><input <?php name_id( $key ); ?> type=\"checkbox\" <?php echo esc_attr( $checked ? 'checked' : '' ); ?>></span>\n\t\t\t<span><?php echo esc_html( $label ); ?></span>\n\t\t</label>\n\t</div>\n\t<?php\n}", "function pgm_list_column_headers($columns){\n $columns = array(\n 'cb'=>'<input type=\"checkbox\" />', //checkbox-HTML empty checkbox\n 'title'=>__('Lists'), //update header name to 'List Name'\n 'shortcode'=>__('Shortcode'),\n );\n\n return $columns;\n}", "function surgeon_add_checkbox_heading_fields($post, $addon, $loop) {\n echo '<th class=\"checkbox_column\"><span class=\"column-title\">Image</span></th>';\n}", "function pgm_subscriber_column_headers($columns){\n $columns = array(\n 'cb'=>'<input type=\"checkbox\" />', //checkbox-HTML empty checkbox\n 'title'=>__('Subscriber Name'), //update header name to 'Subscriber Name'\n 'email'=>__('Email Address'), //create new header for email\n );\n\n return $columns;\n}", "public static function convert_single_checkbox_field() {\n\n\t\t// Create a new Checkbox field.\n\t\tself::$field = new GF_Field_Checkbox();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add choices property.\n\t\tself::$field->choices = array(\n\t\t\tarray(\n\t\t\t\t'text' => self::$nf_field['label'],\n\t\t\t\t'value' => '',\n\t\t\t\t'isSelected' => 'unchecked' === self::$nf_field['default_value'] ? '0' : '1',\n\t\t\t),\n\t\t);\n\n\t}", "function checkbox()\n {\n ?>\n <input type=\"hidden\" <?php $this->name_tag(); ?> value=\"0\" />\n <input type=\"checkbox\" <?php $this->name_tag(); ?> value=\"1\" class=\"inferno-setting\" <?php $this->id_tag('inferno-concrete-setting-'); if($this->setting_value) echo ' checked'; ?> />\n <label <?php $this->for_tag('inferno-concrete-setting-'); ?> data-true=\"<?php _e('On'); ?>\" data-false=\"<?php _e('Off'); ?>\"><?php if($this->setting_value) _e('On'); else _e('Off'); ?></label>\n <?php \n }", "function add_header_columns($columns) \n {\n $columns = array(\n \"cb\" => \"<input type=\\\"checkbox\\\" />\",\n \"shortcode\" => __('Shortcode'),\n \"title\" => __('Title'),\n \"quote\" => __('Quote', $this->localization_domain),\n \"author\" => __('Author'),\n \"date\" => __('Publish Date'),\n );\n return $columns;\n }", "function products_column_headers( $columns ) {\r\n\r\n // Creating the custom column header data\r\n $columns = array(\r\n 'cb' => '<input type=\"checkbox\" />',\r\n 'title' => __('Product Name'),\r\n 'Background Color' => __('Background Color')\r\n );\r\n\r\n // Returning the new columns\r\n return $columns;\r\n\r\n}", "function gen_webguileftcolumnhyper_field(&$section, $value) {\n\n\t$section->addInput(new Form_Checkbox(\n\t\t'webguileftcolumnhyper',\n\t\t'Left Column Labels',\n\t\t'Active',\n\t\t$value\n\t))->setHelp('If selected, clicking a label in the left column will select/toggle the first item of the group.');\n}", "public static function convert_checkbox_field() {\n\n\t\t// Create a new Checkbox field.\n\t\tself::$field = new GF_Field_Checkbox();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add choices property.\n\t\tself::$field->choices = array();\n\n\t\t// Loop through field options.\n\t\tforeach ( self::$nf_field['list']['options'] as $i => $option ) {\n\n\t\t\t// Get checkbox ID.\n\t\t\t$id = $i + 1;\n\n\t\t\t// Skip multiple of 10 on checkbox ID.\n\t\t\tif ( 0 === $id % 10 ) {\n\t\t\t\t$id++;\n\t\t\t}\n\n\t\t\t// Add option choices.\n\t\t\tself::$field->choices[] = array(\n\t\t\t\t'text' => $option['label'],\n\t\t\t\t'value' => $option['value'],\n\t\t\t\t'isSelected' => $option['selected'],\n\t\t\t);\n\n\t\t\t// Add option input.\n\t\t\tself::$field->inputs[] = array(\n\t\t\t\t'id' => self::$field->id . '.' . $id,\n\t\t\t\t'label' => $option['label'],\n\t\t\t);\n\n\t\t}\n\n\t}", "function output_checkbox_row( string $label, string $key, bool $checked = false ): void {\n\t\t\\wpinc\\meta\\output_checkbox_row( $label, $key, $checked );\n\t}", "function setTypeAsCheckbox($labeltext = false)\n\t{\n\t\t$this->type = \"checkbox\";\n\t\t$this->checkbox_label = $labeltext;\n\t\t\n\t\t// Formfield doesn't work if a checkbox\n\t\t$this->isformfield = false;\n\t}", "function checkbox_init(){\n add_meta_box(\"closing\", \"Closed ?\", \"closing\", \"closings\", \"normal\", \"high\");\n add_meta_box(\"delayed\", \"Delayed / Message ?\", \"delayed\", \"closings\", \"normal\", \"high\");\n add_meta_box(\"message_delayed\", \"Message:\", \"message_delayed\", \"closings\", \"normal\", \"high\");\n}", "function add_checkbox_hidden_field( $fields, $section ) {\n $fields['general'][] = [\n 'default' => 'save_email_enable_or_disable',\n 'type' => 'hidden',\n 'id' => 'save_email_enable_or_disable',\n\n ];\n return $fields;\n}", "function acf_get_checkbox_input($attrs = array())\n{\n}", "private function display_checkbox_field($name, $value) {\n?>\n<input type=\"checkbox\" name=\"<?php echo htmlspecialchars($this->group); ?>[<?php echo htmlspecialchars($name); ?>]\" id=\"http_authentication_<?php echo htmlspecialchars($name); ?>\"<?php if ($value) echo ' checked=\"checked\"' ?> value=\"1\" /><br />\n<?php\n }", "function render_field_checkbox($field)\n {\n }", "public function AddCheckboxToCheckoutPage()\n\t{\n\t\t$checked = get_option($this->GrOptionDbPrefix . 'checkout_checked');\n\t\t?>\n\t\t<p class=\"form-row form-row-wide\">\n\t\t\t<input class=\"input-checkbox GR_checkoutbox\" value=\"1\" id=\"gr_checkout_checkbox\" type=\"checkbox\"\n\t\t\t name=\"gr_checkout_checkbox\" <?php if ($checked)\n\t\t\t { ?>checked=\"checked\"<?php } ?> />\n\t\t\t<label for=\"gr_checkout_checkbox\" class=\"checkbox\">\n\t\t\t\t<?php echo get_option($this->GrOptionDbPrefix . 'checkout_label'); ?>\n\t\t\t</label>\n\t\t</p>\n\t\t<?php\n\t}", "function makeCheckbox( $value, $column )\n{\n\treturn $value ? _( 'Yes' ) : _( 'No' );\n}", "public function getHeaderFields()\n {\n $headerFields = array();\n\n foreach ($this->getFieldsData() as $fieldId => $row) {\n\n // Show single checkbox label as field label\n if ($row['label'] == $row['name']\n && $row['type'] == 'checkbox'\n && $row['options'] != ''\n ) {\n $options = deserialize($row['options'], true);\n\n if (count($options) == 1) {\n $headerFields[$fieldId] = $options[0]['label'];\n continue;\n }\n }\n\n $headerFields[$fieldId] = $row['label'];\n }\n\n return $headerFields;\n }", "public static function renderCheckbox();", "public function AddCheckboxToComment()\n\t{\n\t\t$checked = get_option($this->GrOptionDbPrefix . 'comment_checked');\n\t\t?>\n\t\t<p>\n\t\t\t<input class=\"GR_checkbox\" value=\"1\" id=\"gr_comment_checkbox\" type=\"checkbox\" name=\"gr_comment_checkbox\"\n\t\t\t\t <?php if ($checked)\n\t\t\t\t { ?>checked=\"checked\"<?php } ?>/>\n\t\t\t<?php echo get_option($this->GrOptionDbPrefix . 'comment_label'); ?>\n\t\t</p><br/>\n\t\t<?php\n\t}", "function acf_checkbox_input($attrs = array())\n{\n}", "public function setHasHeader(bool $hasHeader): CsvImport\n {\n $this->hasHeader = $hasHeader;\n return $this;\n }", "function checkbox($args) {\r\n\t\t$args = $this->apply_default_args($args) ;\r\n\t\techo \"<input name='$this->options_name[\" . $args['id'] . \"]' type='checkbox' value='1' \";\r\n\t\tchecked('1', $this->options[$args['id']]); \r\n\t\techo \" /> <span class='description'>\" . $args['description'] . \"</span>\" ;\r\n\t\t\r\n\t}", "function checkbox( \n\t $name, $title, $value = null, \n\t $required = false, \n\t $attributes = null,\n\t $options = array(),\n\t $datatype = Form::DATA_STRING\n\t){\n return $this->input(\n\t $name, \n\t Form::TYPE_CHECKBOX,\n\t $title, \n\t $value, \n\t $required, \n\t $attributes,\n\t $options,\n\t $datatype\n );\n\t}", "public function AddCheckboxToBpRegistrationPage()\n\t{\n\t\t$bp_checked = get_option($this->GrOptionDbPrefix . 'bp_registration_checked');\n\t\t?>\n\t\t<div class=\"gr_bp_register_checkbox\">\n\t\t\t<label>\n\t\t\t\t<input class=\"input-checkbox GR_bpbox\" value=\"1\" id=\"gr_bp_checkbox\" type=\"checkbox\"\n\t\t\t\t name=\"gr_bp_checkbox\" <?php if ($bp_checked)\n\t\t\t\t{ ?> checked=\"checked\"<?php } ?> />\n\t\t\t\t<span\n\t\t\t\t\tclass=\"gr_bp_register_label\"><?php echo get_option($this->GrOptionDbPrefix . 'bp_registration_label'); ?></span>\n\t\t\t</label>\n\t\t</div>\n\t\t<?php\n\t}", "public function loadColumnHeaders() {\n\t\t$jinput = JFactory::getApplication()->input;\n\t\t$jinput->set('columnheaders', $this->data->_data[1]);\n\t\t$this->linepointer++;\n\t\treturn true;\n\t}", "function initialize () {\n $this->set_openingtag ( \"<INPUT TYPE=\\\"checkbox\\\" value=\\\"\" );\n\t$this->set_closingtag ( \"\\\"[attributes]>\" );\n\t$this->set_type (\"checkbox\");\n }", "function option_checkbox($label, $name, $value='', $comment='') {\r\n\t\tif ($value)\r\n\t\t\t$checked = \"checked='checked'\";\r\n\t\telse\r\n\t\t\t$checked = \"\";\r\n\t\techo \"<tr valign='top'><th scope='row'>\" . $label . \"</th>\";\r\n\t\techo \"<td><input type='hidden' id='$name' name='$name' value='0' /><input type='checkbox' name='$name' value='1' $checked />\";\r\n\t\techo \" $comment</td></tr>\";\r\n\t}" ]
[ "0.63695353", "0.5883379", "0.58809394", "0.58807844", "0.57226795", "0.57156914", "0.57071275", "0.5695699", "0.56633687", "0.5649122", "0.5549496", "0.5474228", "0.5473855", "0.5447326", "0.54225916", "0.5406645", "0.5400897", "0.53399295", "0.5336694", "0.53366834", "0.5328856", "0.5297", "0.528531", "0.5255044", "0.5250966", "0.52465814", "0.5207455", "0.5182041", "0.51812214", "0.51687825" ]
0.6030131
1
Imports a date header i.e. a field's declaration.
protected function process_header_date(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function parseDate(object $header): void {\n\n if (property_exists($header, 'date')) {\n $date = $header->date;\n\n if (preg_match('/\\+0580/', $date)) {\n $date = str_replace('+0580', '+0530', $date);\n }\n\n $date = trim(rtrim($date));\n try {\n if (str_contains($date, '&nbsp;')) {\n $date = str_replace('&nbsp;', ' ', $date);\n }\n if (str_contains($date, ' UT ')) {\n $date = str_replace(' UT ', ' UTC ', $date);\n }\n $parsed_date = Carbon::parse($date);\n } catch (\\Exception $e) {\n switch (true) {\n case preg_match('/([0-9]{4}\\.[0-9]{1,2}\\.[0-9]{1,2}\\-[0-9]{1,2}\\.[0-9]{1,2}.[0-9]{1,2})+$/i', $date) > 0:\n $date = Carbon::createFromFormat(\"Y.m.d-H.i.s\", $date);\n break;\n case preg_match('/([0-9]{2} [A-Z]{3} [0-9]{4} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} [+-][0-9]{1,4} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} [+-][0-9]{1,4})+$/i', $date) > 0:\n $parts = explode(' ', $date);\n array_splice($parts, -2);\n $date = implode(' ', $parts);\n break;\n case preg_match('/([A-Z]{2,4}\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4})+$/i', $date) > 0:\n $array = explode(',', $date);\n array_shift($array);\n $date = Carbon::createFromFormat(\"d M Y H:i:s O\", trim(implode(',', $array)));\n break;\n case preg_match('/([0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ UT)+$/i', $date) > 0:\n case preg_match('/([A-Z]{2,3}\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ UT)+$/i', $date) > 0:\n $date .= 'C';\n break;\n case preg_match('/([A-Z]{2,3}\\,\\ [0-9]{1,2}[\\,]\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4})+$/i', $date) > 0:\n $date = str_replace(',', '', $date);\n break;\n // match case for: Di., 15 Feb. 2022 06:52:44 +0100 (MEZ)/Di., 15 Feb. 2022 06:52:44 +0100 (MEZ)\n case preg_match('/([A-Z]{2,3}\\.\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\.\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4}\\ \\([A-Z]{3,4}\\))\\/([A-Z]{2,3}\\.\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\.\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4}\\ \\([A-Z]{3,4}\\))+$/i', $date) > 0:\n $dates = explode('/', $date);\n $date = array_shift($dates);\n $array = explode(',', $date);\n array_shift($array);\n $date = trim(implode(',', $array));\n $array = explode(' ', $date);\n array_pop($array);\n $date = trim(implode(' ', $array));\n $date = Carbon::createFromFormat(\"d M. Y H:i:s O\", $date);\n break;\n // match case for: fr., 25 nov. 2022 06:27:14 +0100/fr., 25 nov. 2022 06:27:14 +0100\n case preg_match('/([A-Z]{2,3}\\.\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\.\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4})\\/([A-Z]{2,3}\\.\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\.\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4})+$/i', $date) > 0:\n $dates = explode('/', $date);\n $date = array_shift($dates);\n $array = explode(',', $date);\n array_shift($array);\n $date = trim(implode(',', $array));\n $date = Carbon::createFromFormat(\"d M. Y H:i:s O\", $date);\n break;\n case preg_match('/([A-Z]{2,3}\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ \\+[0-9]{2,4}\\ \\(\\+[0-9]{1,2}\\))+$/i', $date) > 0:\n case preg_match('/([A-Z]{2,3}[\\,|\\ \\,]\\ [0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}.*)+$/i', $date) > 0:\n case preg_match('/([A-Z]{2,3}\\,\\ [0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4}\\ \\(.*)\\)+$/i', $date) > 0:\n case preg_match('/([A-Z]{2,3}\\, \\ [0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{4}\\ [0-9]{1,2}\\:[0-9]{1,2}\\:[0-9]{1,2}\\ [\\-|\\+][0-9]{4}\\ \\(.*)\\)+$/i', $date) > 0:\n case preg_match('/([0-9]{1,2}\\ [A-Z]{2,3}\\ [0-9]{2,4}\\ [0-9]{2}\\:[0-9]{2}\\:[0-9]{2}\\ [A-Z]{2}\\ \\-[0-9]{2}\\:[0-9]{2}\\ \\([A-Z]{2,3}\\ \\-[0-9]{2}:[0-9]{2}\\))+$/i', $date) > 0:\n $array = explode('(', $date);\n $array = array_reverse($array);\n $date = trim(array_pop($array));\n break;\n }\n try {\n $parsed_date = Carbon::parse($date);\n } catch (\\Exception $_e) {\n if (!isset($this->config[\"fallback_date\"])) {\n throw new InvalidMessageDateException(\"Invalid message date. ID:\" . $this->get(\"message_id\") . \" Date:\" . $header->date . \"/\" . $date, 1100, $e);\n } else {\n $parsed_date = Carbon::parse($this->config[\"fallback_date\"]);\n }\n }\n }\n\n $this->set(\"date\", $parsed_date);\n }\n }", "public function getHeaderDate()\r\n\t{\r\n\t\treturn $this->headers[SONIC_HEADER__DATE];\r\n\t}", "private function importDateContents($contents) : void\n {\n //==============================================================================\n // Import Date\n if (!empty($contents[\"date\"])) {\n if ($contents[\"date\"] instanceof DateTime) {\n $this->setRefreshAt($contents[\"date\"]);\n } elseif (is_scalar($contents[\"date\"])) {\n $this->setRefreshAt(new DateTime((string) $contents[\"date\"]));\n }\n }\n }", "public function buildHeaderFields() {}", "public function getDateImport()\n {\n return $this->date_import;\n }", "private function readHeaderRow() {\n\n // Grab the line as items\n $csvLine = $this->stream->readCSVLine($this->separator, $this->enclosure);\n\n // Create fields from these\n $columns = [];\n foreach ($csvLine as $column) {\n // Expand out the title and the name\n $name = StringUtils::convertToCamelCase(trim($column));\n $columns[] = new Field($name);\n }\n\n $this->csvColumns = $columns;\n }", "protected function readHeader()\n {\n \t$this->data_mesgs['file_id']['type']=\"TCX\";\n \t$this->data_mesgs['file_id']['manufacturer']=(string)$this->file_contents->Activities->Activity->Creator->Name;\n \t$this->data_mesgs['file_id']['number']=(string)$this->file_contents->Author->Build->Version->VersionMajor.\".\".\n \t\t(string)$this->file_contents->Author->Build->Version->VersionMinor;\n \t$datebrut=(string)$this->file_contents->Activities->Activity->Lap['StartTime'];\n \t$this->data_mesgs['file_id']['time_created']=strtotime( $datebrut);\n \t$this->data_mesgs['session']['sport']=(string)$this->file_contents->Activities->Activity['Sport'];\n \t \n }", "static function dateFromDayHeader($start_date, $day_header) {\n $objDate = new DateAndTime(DB_DATEFORMAT, $start_date);\n $currentDayHeader = (string) $objDate->getDate(); // It returns an int on first call.\n if (strlen($currentDayHeader) == 1) // Which is an implementation detail of DateAndTime class.\n $currentDayHeader = '0'.$currentDayHeader; // Add a 0 for single digit day.\n $i = 1;\n while ($currentDayHeader != $day_header && $i < 7) {\n // Iterate through remaining days to find a match.\n $objDate->incDay();\n $currentDayHeader = $objDate->getDate(); // After incDay it returns a string with leading 0, when necessary.\n $i++;\n }\n return $objDate->toString(DB_DATEFORMAT);\n }", "static function parseHTTPDate($dateHeader) {\n\n //RFC 2616 section 3.3.1 Full Date\n //Only the format is checked, valid ranges are checked by strtotime below\n $month = '(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)';\n $weekday = '(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)';\n $wkday = '(Mon|Tue|Wed|Thu|Fri|Sat|Sun)';\n $time = '[0-2]\\d(\\:[0-5]\\d){2}';\n $date3 = $month . ' ([1-3]\\d| \\d)';\n $date2 = '[0-3]\\d\\-' . $month . '\\-\\d\\d';\n //4-digit year cannot begin with 0 - unix timestamp begins in 1970\n $date1 = '[0-3]\\d ' . $month . ' [1-9]\\d{3}';\n\n //ANSI C's asctime() format\n //4-digit year cannot begin with 0 - unix timestamp begins in 1970\n $asctime_date = $wkday . ' ' . $date3 . ' ' . $time . ' [1-9]\\d{3}';\n //RFC 850, obsoleted by RFC 1036\n $rfc850_date = $weekday . ', ' . $date2 . ' ' . $time . ' GMT';\n //RFC 822, updated by RFC 1123\n $rfc1123_date = $wkday . ', ' . $date1 . ' ' . $time . ' GMT';\n //allowed date formats by RFC 2616\n $HTTP_date = \"($rfc1123_date|$rfc850_date|$asctime_date)\";\n\n //allow for space around the string and strip it\n $dateHeader = trim($dateHeader, ' ');\n if (!preg_match('/^' . $HTTP_date . '$/', $dateHeader))\n return false;\n\n //append implicit GMT timezone to ANSI C time format\n if (strpos($dateHeader, ' GMT') === false)\n $dateHeader .= ' GMT';\n\n\n $realDate = strtotime($dateHeader);\n //strtotime can return -1 or false in case of error\n if ($realDate !== false && $realDate >= 0)\n return new \\DateTime('@' . $realDate, new \\DateTimeZone('UTC'));\n\n }", "public static function convert_date_field() {\n\n\t\t// Create a new Phone field.\n\t\tself::$field = new GF_Field_Date();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add Phone specific properties.\n\t\tself::$field->dateFormat = 'dd/mm/yyyy';\n\n\t}", "public function fromHeader($header, $dataType)\n\t{\n\t\treturn $this->fromString($header, $dataType);\n\t}", "protected function makeHeader()\n {\n }", "public function loadHeader(): void\n {\n $this->openFile('r');\n\n $header = $this->getLine(false);\n --$this->line; // because we don't want to count header line\n\n $this->initializeHeader($header);\n }", "protected function _parseHeader() {}", "static private function getDate($day) {\n\t\treturn $day->getElementsByTagName('h3')->item(0)->nodeValue;\n\t}", "public function importHeader($admin){\n\t return parent::importHeader($admin);\n\t}", "function prepare_field_for_import($field)\n {\n }", "function type_column_header( $columns ) {\r\n\t\tunset( $columns['date'] );\r\n\t\treturn $columns;\r\n\t}", "private function build_header() {\n\t\t// if we've already got the cart ID, use it\n\t\t$header = self::fetch('cart_header', [':cart_id' => $this->id()]);\n\n\t\t$header['date_created'] = ck_datetime::datify(@$header['date_created']);\n\t\tif (!empty($header['date_updated'])) $header['date_updated'] = ck_datetime::datify($header['date_updated']);\n\n\t\t$this->skeleton->load('header', $header);\n\t}", "public function getFromWebserviceImport($value)\n {\n $timestamp = strtotime($value);\n if (empty($value)) {\n return null;\n } else if ($timestamp !== FALSE) {\n return new Pimcore_Date($timestamp);\n } else {\n throw new Exception(\"cannot get values from web service import - invalid data\");\n }\n }", "public function getDataWithTypeDate() {}", "public function defineHeader()\n {\n $this->header = new Header();\n }", "private function parseFileHeader()\n\t{\n\n\t\tif ($this->data)\n\t\t{\n\t\t\t$line = StringHelper::substr($this->data, 0, StringHelper::strpos($this->data, \"\\n\") + 1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$fp = fopen($this->file, 'r');\n\t\t\t$line = fgets($fp, 4096);\n\t\t\t$line = trim($line); // remove white spaces, at the end always \\n (or \\r\\n)\n\t\t\tfclose($fp);\n\t\t}\n\n\t\t$headers = explode($this->columnSeparator, $line);\n\t\t$this->colsNum = count($headers);\n\t\tfor ($i = 0; $i < $this->colsNum; $i++)\n\t\t{\n\t\t\t// -------- remove the utf-8 BOM ----\n\t\t\t$headers[$i] = str_replace(\"\\xEF\\xBB\\xBF\", '', $headers[$i]);\n\t\t\t$this->colsOrder[str_replace('\"', '', trim($headers[$i]))] = $i;\n\t\t\t// some people let white space at the end of text, so better to trim\n\t\t\t// CSV has often begining and ending \" - replace it\n\t\t}\n\t}", "function pixelgrade_entry_header( $post_id = null ) {\n\t\t// Fallback to the current post if no post ID was given.\n\t\tif ( empty( $post_id ) ) {\n\t\t\t$post_id = get_the_ID();\n\t\t}\n\n\t\t// Bail if we still don't have a post ID.\n\t\tif ( empty( $post_id ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthe_date( '', '<div class=\"entry-date\">', '</div>', true );\n\n\t}", "public function getImportDateTime()\n {\n return $this->importDateTime;\n }", "public function getHeaderData() {}", "function newsroom_elated_get_header() {\n $id = newsroom_elated_get_page_id();\n\n //will be read from options\n $header_type = 'header-type3';\n $header_behavior = newsroom_elated_options()->getOptionValue('header_behaviour');\n\n if(HeaderFactory::getInstance()->validHeaderObject()) {\n $parameters = array(\n 'hide_logo' => newsroom_elated_options()->getOptionValue('hide_logo') == 'yes' ? true : false,\n 'header_in_grid' => newsroom_elated_options()->getOptionValue('header_in_grid') == 'yes' ? true : false,\n 'logo_position' => newsroom_elated_get_meta_field_intersect('logo_position',$id),\n 'show_sticky' => in_array($header_behavior, array(\n 'sticky-header-on-scroll-up',\n 'sticky-header-on-scroll-down-up'\n )) ? true : false,\n );\n\n $parameters = apply_filters('newsroom_elated_header_type_parameters', $parameters, $header_type);\n\n HeaderFactory::getInstance()->getHeaderObject()->loadTemplate($parameters);\n }\n }", "public function SetImportDateTime($time) {\n $this->ImportDateTime = $time;\n }", "public static function rfcDate()\n {\n }", "public function import($type) {\n $this -> clear();\n if ($this -> lines == \"\") {\n $this -> log[\"failure\"][\"missingheader\"] = _NOHEADERROWISDEFINEDORHEADERROWNOTCOMPATIBLEWITHIMPORTTYPE;\n } else {\n // Pairs of values <Csv column header> => <eFront DB field>\n $this -> types = EfrontImport::getTypes($type);\n // Pairs of values <eFront DB field> => <import file column>\n $this -> mappings = $this -> parseHeaderLine(&$headerLine);\n if ($this -> mappings) {\n if ($this -> checkImportEssentialField($type)) {\n if ($type == 'users_to_groups' || $type == 'users') {\n $data = array();\n for ($line = $headerLine+1; $line < $this -> lines; ++$line) {\n $data[] = $this -> parseDataLine($line);\n }\n $this -> importDataMultiple($type, $data);\n } else {\n for ($line = $headerLine+1; $line < $this -> lines; ++$line) {\n $data = $this -> parseDataLine($line);\n $this -> importData($line+1, $type, $data);\n }\n }\n }\n } else {\n $this -> log[\"failure\"][\"missingheader\"] = _NOHEADERROWISDEFINEDORHEADERROWNOTCOMPATIBLEWITHIMPORTTYPE;\n }\n }\n return $this -> log;\n }" ]
[ "0.62307817", "0.591231", "0.5634141", "0.5621257", "0.55200434", "0.547975", "0.54533225", "0.5449354", "0.5261206", "0.5159231", "0.5139352", "0.50846297", "0.50423723", "0.5041895", "0.50371337", "0.5035094", "0.4972689", "0.49478891", "0.49268717", "0.49260876", "0.49195048", "0.4898456", "0.4882097", "0.48735273", "0.48692095", "0.48664793", "0.4858699", "0.48464656", "0.48237735", "0.48226285" ]
0.6072167
1
Imports a number header i.e. a field's declaration.
protected function process_header_number(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function min_headings_num() {\n\t\t$this->section_data['general_min_headings_num'] = array(\n\t\t\t'name' \t\t\t\t\t=> 'general_min_headings_num',\n\t\t\t'label' \t\t\t\t=> __( 'Display TOC when', 'fixedtoc' ),\n\t\t\t'default' \t\t\t=> '',\n\t\t\t'type' \t\t\t\t\t=> 'number',\n\t\t\t'input_attrs'\t\t=> array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'class' => 'small-text'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t'sanitize'\t\t\t=> 'absint',\n\t\t\t'suffix'\t\t\t\t=> __( 'or more headings are present.', 'fixedtoc' )\n\t\t);\n\t}", "function uwwtd_field_num($field) {\n// $field[0]['#markup'] = 'Not provided';\n return uwwtd_format_number($field[0]['#markup'], 1);\n}", "function getFieldHeader($fN) {\n\t\tswitch($fN) {\n\t\t\tdefault:\n\t\t\t\treturn $this->pi_getLL ( 'listFieldHeader_' . $fN, '[' . $fN . ']' );\n\t\t\tbreak;\n\t\t}\n\t}", "public function getNumber() {}", "private function AddHeaderDigit($i)\n {\n $this->length = $this->length * 16 + $i;\n }", "function _field_number($fval) \n {\n return $this->_field_text($fval);\n }", "public function getNumber();", "public function fnReadNumber($bStartsWithDot) \n {\n $iStart = $this->iPos;\n if (!$bStartsWithDot && $this->fnReadInt(10) === null) \n $this->fnRaise($iStart, \"Invalid number\");\n $bOctal = ($this->iPos - $iStart) >= 2\n && Utilities::fnGetCharAt($this->sInput, $iStart) == 48;\n if ($bOctal && $this->bStrict) \n $this->fnRaise($iStart, \"Invalid number\");\n if ($bOctal \n && preg_match(\n \"/[89]/\", \n mb_substr(\n $this->sInput, \n $iStart, \n $this->iPos - $iStart\n )\n )\n ) \n $bOctal = false;\n $iNext = Utilities::fnGetCharAt($this->sInput, $this->iPos);\n if ($iNext == 46 && !$bOctal) { // '.'\n ++$this->iPos;\n $this->fnReadInt(10);\n $iNext = Utilities::fnGetCharAt($this->sInput, $this->iPos);\n }\n if (($iNext == 69 || $iNext == 101) && !$bOctal) { // 'eE'\n $iNext = Utilities::fnGetCharAt($this->sInput, ++$this->iPos);\n if ($iNext == 43 || $iNext == 45) \n ++$this->iPos; // '+-'\n if ($this->fnReadInt(10) === null) \n $this->fnRaise($iStart, \"Invalid number\");\n }\n if (Identifier::fnIsIdentifierStart($this->fnFullCharCodeAtPos())) \n $this->fnRaise($this->iPos, \"Identifier directly after number\");\n\n $sStr = mb_substr($this->sInput, $iStart, $this->iPos - $iStart);\n $iVal = $bOctal ? intval($sStr, 8) : floatval($sStr);\n return $this->fnFinishToken(TokenTypes::$aTypes['num'], $iVal);\n }", "public function __construct() {\n\t\t\t$this->field_type = 'number';\n\n\t\t\tparent::__construct();\n\t\t}", "function to($dscNum);", "public static function convert_number_field() {\n\n\t\t// Create a new Number field.\n\t\tself::$field = new GF_Field_Number();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add Number specific properties.\n\t\tself::$field->rangeMin = rgar( self::$nf_field, 'number_min' );\n\t\tself::$field->rangeMax = rgar( self::$nf_field, 'number_max' );\n\n\t\t// Add currency property if needed.\n\t\tif ( rgar( self::$nf_field, 'mask' ) && 'currency' === self::$nf_field['mask'] ) {\n\t\t\tself::$field->numberFormat = 'currency';\n\t\t}\n\n\t}", "public function import();", "function import_module($import_key,$type,$imported,$install_mode){\r\n\t\t$this->import_key = $import_key;\r\n\t\t$this->type = $type;\r\n\t\t$this->imported = $imported;\r\n\t\t$this->install_mode = $install_mode;\r\n\t\t$this->mount_point = \"\";\r\n\t\t$this->mount_item = 0;\r\n\t}", "public function addNumber($str_name)\n {\n return $this->addField($str_name, self::FIELD_NUMBER);\n }", "public function loadHeader(): void\n {\n $this->openFile('r');\n\n $header = $this->getLine(false);\n --$this->line; // because we don't want to count header line\n\n $this->initializeHeader($header);\n }", "public function import($type) {\n $this -> clear();\n if ($this -> lines == \"\") {\n $this -> log[\"failure\"][\"missingheader\"] = _NOHEADERROWISDEFINEDORHEADERROWNOTCOMPATIBLEWITHIMPORTTYPE;\n } else {\n // Pairs of values <Csv column header> => <eFront DB field>\n $this -> types = EfrontImport::getTypes($type);\n // Pairs of values <eFront DB field> => <import file column>\n $this -> mappings = $this -> parseHeaderLine(&$headerLine);\n if ($this -> mappings) {\n if ($this -> checkImportEssentialField($type)) {\n if ($type == 'users_to_groups' || $type == 'users') {\n $data = array();\n for ($line = $headerLine+1; $line < $this -> lines; ++$line) {\n $data[] = $this -> parseDataLine($line);\n }\n $this -> importDataMultiple($type, $data);\n } else {\n for ($line = $headerLine+1; $line < $this -> lines; ++$line) {\n $data = $this -> parseDataLine($line);\n $this -> importData($line+1, $type, $data);\n }\n }\n }\n } else {\n $this -> log[\"failure\"][\"missingheader\"] = _NOHEADERROWISDEFINEDORHEADERROWNOTCOMPATIBLEWITHIMPORTTYPE;\n }\n }\n return $this -> log;\n }", "protected static function getLineNumbersStart($openingTag) {\n\t\t$start = 1;\n\t\tif (!empty($openingTag['attributes'][0])) {\n\t\t\t$start = intval($openingTag['attributes'][0]);\n\t\t\tif ($start < 1) $start = 1;\n\t\t}\n\t\t\n\t\treturn $start;\n\t}", "private function writeHeader(): void\n {\n $record = 0x0014; // Record identifier\n\n /* removing for now\n // need to fix character count (multibyte!)\n if (strlen($this->phpSheet->getHeaderFooter()->getOddHeader()) <= 255) {\n $str = $this->phpSheet->getHeaderFooter()->getOddHeader(); // header string\n } else {\n $str = '';\n }\n */\n\n $recordData = StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader());\n $length = strlen($recordData);\n\n $header = pack('vv', $record, $length);\n\n $this->append($header . $recordData);\n }", "protected function process_data_number(import_settings $settings, $field, $data_record, $value) {\r\n $result = $this->process_data_default($settings, $field, $data_record, $value);\r\n return $result;\r\n }", "public function getInt32PackedFieldAt($offset)\n {\n return $this->get(self::INT32_PACKED_FIELD, $offset);\n }", "function prepare_field_for_import($field)\n {\n }", "public function import_read_header()\n\t{\n // phpcs:enable\n\t\treturn 0;\n\t}", "function display_header_phone_number()\n {\n include 'assets/partials/header-phone-number.php';\n }", "private function writeNumber($row, $col, $num, $xfIndex)\n {\n $record = 0x0203; // Record identifier\n $length = 0x000E; // Number of bytes to follow\n\n $header = pack('vv', $record, $length);\n $data = pack('vvv', $row, $col, $xfIndex);\n $xl_double = pack('d', $num);\n if (self::getByteOrder()) { // if it's Big Endian\n $xl_double = strrev($xl_double);\n }\n\n $this->append($header . $data . $xl_double);\n\n return 0;\n }", "public function parseNumber($value)\n\t{\n\t\treturn $value;\n\t}", "function fiftyone_degrees_get_numeric_node_index($node, $index, $headers) {\n $_fiftyone_degrees_data_file = fiftyone_degrees_get_data_file(\n $node['node_numeric_children_offset']\n + ($index * (2 + 4)));\n\n return array(\n 'value' => fiftyone_degrees_read_short($_fiftyone_degrees_data_file),\n 'related_node_index' => fiftyone_degrees_read_int($_fiftyone_degrees_data_file),\n );\n}", "public function importLine(Import $import, ImportLine $line);", "function th($number) {\n\treturn number_format(intval($number));\n}", "public function incrementImportCount();", "public function wt_parse_int_field($value) {\n // Remove the ' prepended to fields that start with - if needed.\n//\t\t$value = $this->unescape_data( $value );\n\n return intval($value);\n }" ]
[ "0.51880145", "0.5137977", "0.5004235", "0.49478108", "0.49266407", "0.48821086", "0.4875254", "0.4813329", "0.48021185", "0.4799113", "0.47685233", "0.46652612", "0.46492574", "0.46343297", "0.46296328", "0.46275207", "0.46213627", "0.45985338", "0.45579165", "0.455238", "0.45510942", "0.45478252", "0.4538662", "0.45105", "0.45104966", "0.45053288", "0.45051426", "0.44666204", "0.44517002", "0.4437387" ]
0.6226848
0
Imports a radiobutton header i.e. a field's declaration.
protected function process_header_radiobutton(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static public function createCheckboxRadio($input, $name) {\n include $_SERVER[\"DOCUMENT_ROOT\"] . \"/mvdv/core/view/templates/general/form/formelements/radiocheckbox.php\";\n }", "public static function renderRadio();", "public function defineHeaderButton(){\r\n $this->addnewctrl='';\r\n $this->searchctrl='';\r\n }", "protected function registerDocheaderButtons() {}", "protected function registerDocheaderButtons() {}", "protected function registerDocheaderButtons() {}", "protected function registerDocheaderButtons() {}", "protected function registerDocheaderButtons() {}", "public function add($labelText, $value='X', $boolChecked=false) {\n\t\t\n\t\t$radio_id = $this->_name.'_'.$this->_count;\n\t\t$this->_count++;\n\n\t\t$label = new JamElement('label',$labelText);\t\n\t\t$label->setHtmlOption('for',$radio_id);\n\n\t\t$input = new JamElement('input');\n\t\t$input->setId($radio_id);\n\t\t$input->setHtmlOption('name',$this->_name);\n\t\t$input->setHtmlOption('type','radio');\n\t\t$input->setHtmlOption('value',$value);\n\t\tif($boolChecked == true)\n\t\t\t$input->setHtmlOption('checked','checked');\n\n\t\t$hpanel = parent::add(new JamHorzPanel());\n\t\t$hpanel->setBorderNone();\n\t\t$hpanel->add($label);\n\t\t$hpanel->add($input);\n\n\t\treturn $hpanel;\n\t}", "protected function add_header_button( $add_param = '' ) {\n\n\t\t\tif ( 'off' === $this->allow_insert ) {\n\t\t\t\tif ( null !== $this->wpda_import ) {\n\t\t\t\t\t$this->wpda_import->add_button();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( WPDA::is_wpda_table( $this->table_name ) ||\n\t\t\t\t ( 'on' === WPDA::get_option( WPDA::OPTION_BE_ALLOW_INSERT ) &&\n\t\t\t\t count( $this->wpda_list_columns->get_table_primary_key() ) ) > 0\n\t\t\t\t) {\n\n\t\t\t\t\t?>\n\n\t\t\t\t\t<form\n\t\t\t\t\t\t\tmethod=\"post\"\n\t\t\t\t\t\t\taction=\"?page=<?php echo esc_attr( $this->page ); ?><?php echo '' === $this->schema_name ? '' : '&schema_name=' . esc_attr( $this->schema_name ); ?>&table_name=<?php echo esc_attr( $this->table_name ); ?><?php echo esc_attr( $add_param ); ?>\"\n\t\t\t\t\t\t\tstyle=\"display: inline-block; vertical-align: baseline;\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"new\">\n\t\t\t\t\t\t\t<input type=\"submit\" value=\"<?php echo __( 'Add New', 'wp-data-access' ); ?>\"\n\t\t\t\t\t\t\t\t class=\"page-title-action\">\n\n\t\t\t\t\t\t\t<?php\n\n\t\t\t\t\t\t\t// Add import button to title.\n\t\t\t\t\t\t\tif ( null !== $this->wpda_import ) {\n\t\t\t\t\t\t\t\t$this->wpda_import->add_button();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t?>\n\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\n\t\t\t\t\t<?php\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Add import button to title.\n\t\t\t\t\tif ( null !== $this->wpda_import ) {\n\t\t\t\t\t\t$this->wpda_import->add_button();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}", "public function __construct() {\n\t\tparent::__construct();\n\n\t\t$this->category = _x( 'Multi Fields', 'xprofile field type category', 'buddypress' );\n\t\t$this->name = _x( 'Radio Buttons', 'xprofile field type', 'buddypress' );\n\n\t\t$this->supports_options = true;\n\n\t\t$this->set_format( '/^.+$/', 'replace' );\n\t\tdo_action( 'bp_xprofile_field_type_radiobutton', $this );\n\t}", "protected static function radio()\n {\n }", "function iver_select_set_header_object() {\n \t$header_type = iver_select_get_meta_field_intersect('header_type', iver_select_get_page_id());\n\t $header_types_option = iver_select_get_header_type_options();\n\t \n $object = Lib\\HeaderFactory::getInstance()->build($header_type, $header_types_option);\n\n if(Lib\\HeaderFactory::getInstance()->validHeaderObject()) {\n $header_connector = new Lib\\IverSelectHeaderConnector($object);\n $header_connector->connect($object->getConnectConfig());\n }\n }", "function acf_get_radio_input($attrs = array())\n{\n}", "protected function getDocHeaderButtons() {}", "public static function convert_radio_field() {\n\n\t\t// Create a new Radio field.\n\t\tself::$field = new GF_Field_Radio();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add choices property.\n\t\tself::$field->choices = array();\n\n\t\t// Loop through field options.\n\t\tforeach ( self::$nf_field['list']['options'] as $option ) {\n\n\t\t\t// Add option choice.\n\t\t\tself::$field->choices[] = array(\n\t\t\t\t'text' => $option['label'],\n\t\t\t\t'value' => $option['value'],\n\t\t\t);\n\n\t\t\t// If option is selected, set as default value.\n\t\t\tif ( '1' === $option['selected'] ) {\n\t\t\t\tself::$field->defaultValue = ! empty( $option['value'] ) ? $option['value'] : $option['text'];\n\t\t\t}\n\n\t\t}\n\n\t}", "public function __Header(){\n $this->Ln(5);\n $this->SetDrawColor(160,160,160);\n $this->SetFillColor(230,230,230);\n $this->SetTextColor(100);\n $this->SetFont('Arial','B',7);\n $this->SetX(($this->w - $this->_tWidth)/2);\n foreach($this->_fields as $field)\n $this->Cell($field[\"size\"],5,$field[\"header\"],1,0,\"C\",true);\n $this->Ln();\n }", "public function radio ( \\r8\\Form\\Radio $field )\n {\n $this->addField( \"radio\", $field );\n }", "function acf_radio_input($attrs = array())\n{\n}", "private function createImportButton() {\n\t\t$moduleUrl = t3lib_BEfunc::getModuleUrl(self::MODULE_NAME, array('id' => $this->id));\n\t\t$this->template->setMarker('module_url', htmlspecialchars($moduleUrl));\n\t\t$this->template->setMarker(\n\t\t\t'label_start_import',\n\t\t\t$GLOBALS['LANG']->getLL('start_import_button')\n\t\t);\n\t\t$this->template->setMarker('tab_number', self::IMPORT_TAB);\n\t\t$this->template->setMarker(\n\t\t\t'label_import_in_progress',\n\t\t\t$GLOBALS['LANG']->getLL('label_import_in_progress')\n\t\t);\n\n\t\treturn $this->template->getSubpart('IMPORT_BUTTON');\n\t}", "function minorite_radio($variables) {\n $element = $variables['element'];\n $element['#attributes']['type'] = 'radio';\n element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));\n\n if (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {\n $element['#attributes']['checked'] = 'checked';\n }\n _form_set_class($element, array('form-custom-radio'));\n\n drupal_add_js(\"\n jQuery('.form-custom-radio').iCheck({\n checkboxClass: 'icheckbox_square-blue',\n radioClass: 'iradio_square-blue',\n increaseArea: '20%' // optional\n });\", array('type' => 'inline', 'scope' => 'footer', 'group' => JS_THEME));\n\n return '<label for=\"' . $element['#id'] . '\"><input' . drupal_attributes($element['#attributes']) . '><span>' . $element['#title'] . '</span></label>';\n}", "function radio_button($object, $field, $tag_value, $options = array()) {\n $form = new FormHelper($object, $field);\n return $form->to_radio_button_tag($tag_value, $options);\n}", "function quadro_social_icons_header() {\n\tquadro_social_icons('social_header_display', 'header-social-icons', 'header_icons_scheme', 'header_icons_color_type');\n}", "function wizardHeader() {\n $strOutput = '<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\">';\n return $strOutput;\n }", "protected function getDefaultHeader() {\n\t\treturn CWidgetConfig::getKnownWidgetTypes()[$this->type];\n\t}", "public function setHeader($rowHeader){\n array_unshift($this->data,$rowHeader);\n return $this;\n }", "function &addHeader($type = 'all') {\r\n\t \tif (empty($this->rtf->oddEvenDifferent) && $type == 'all') {\r\n\t\t $header = new Header($this->rtf, $type);\r\n\t\t} else if (!empty($this->rtf->oddEvenDifferent) \r\n\t\t\t\t\t\t&& ($type == 'left' || $type == 'right')) {\t\t \r\n\t\t \t$header = new Header($this->rtf, $type);\t\r\n\t\t} else if ($type == 'first') {\r\n\t\t \t$header = new Header($this->rtf, $type);\t\r\n\t\t \t$this->titlepg = 1;\r\n\t\t} else {\t\t\t\r\n\t\t \treturn;\r\n\t\t}\t\t \r\n\r\n\t\t$this->headers[$type] = &$header;\r\n\t\treturn $header;\t\t\r\n\t}", "function header() {\n //\n //Get the fields in this sql \n $cols= $this->fields->get_array();\n //\n //Loop through the fields and display the <tds>\n foreach ($cols as $col) {\n //\n $name= is_null($col->alias) ? $col->to_str():$col->alias;\n echo \"<th>$name</th>\"; \n }\n }", "function addHeadElement($include) {\n\t $this->_headSection .= $include . \"\\n\";\n\t}", "private function addHeaderDetails(){ \n $headerCount = $this->createElement('select', 'headerCount')\n ->addMultiOptions(array('1' => '1 - Header', '2' => '2 - Header', '3' => '3 - Header'))\n ->setValue('3');\n \n $highPressure = $this->createElement('text', 'highPressure')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true)\n ->addValidator('between', true, array('min' => $this->mS->minPressure(), 'max' => $this->mS->critPressure(), 'inclusive' => true));\n $mediumPressure = $this->createElement('text', 'mediumPressure')\n ->setAttrib('style', 'width: 60px;');\n $lowPressure = $this->createElement('text', 'lowPressure')\n ->setAttrib('style', 'width: 60px;');\n $hpSteamUsage = $this->createElement('text', 'hpSteamUsage')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true);\n $mpSteamUsage = $this->createElement('text', 'mpSteamUsage')\n ->setAttrib('style', 'width: 60px;');\n $lpSteamUsage = $this->createElement('text', 'lpSteamUsage')\n ->setAttrib('style', 'width: 60px;');\n\n $this->addElements(array(\n $headerCount,\n $highPressure,\n $mediumPressure,\n $lowPressure,\n $hpSteamUsage,\n $mpSteamUsage,\n $lpSteamUsage,\n )); \n \n $condReturnTemp = $this->createElement('text', 'condReturnTemp')\n ->setValue(round($this->mS->localize(338.705556, 'temperature')))\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true);\n \n $condReturnFlash = $this->createElement('select', 'condReturnFlash')\n ->addMultiOptions(array('No' => 'No', 'Yes' => 'Yes'))\n ->setValue('No');\n $hpCondReturnRate = $this->createElement('text', 'hpCondReturnRate')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true)\n ->addValidator('between', true, array('min' => 0, 'max' => 100, 'inclusive' => true));\n $mpCondReturnRate = $this->createElement('text', 'mpCondReturnRate')\n ->setAttrib('style', 'width: 60px;');\n $lpCondReturnRate = $this->createElement('text', 'lpCondReturnRate')\n ->setAttrib('style', 'width: 60px;');\n $hpCondFlash = $this->createElement('select', 'hpCondFlash')\n ->addMultiOptions(array('No' => 'No', 'Yes' => 'Yes'))\n ->setValue('No');\n $mpCondFlash = $this->createElement('select', 'mpCondFlash')\n ->addMultiOptions(array('No' => 'No', 'Yes' => 'Yes'))\n ->setValue('No');\n\n $this->addElements(array(\n $condReturnTemp,\n $condReturnFlash,\n $hpCondReturnRate,\n $mpCondReturnRate,\n $lpCondReturnRate,\n $hpCondFlash,\n $mpCondFlash,\n ));\n \n $hpHeatLossPercent = $this->createElement('text', 'hpHeatLossPercent')\n ->setValue(.1)\n ->setAttrib('style', 'width: 60px;');\n $mpHeatLossPercent= $this->createElement('text', 'mpHeatLossPercent')\n ->setValue(.1)\n ->setAttrib('style', 'width: 60px;');\n $lpHeatLossPercent = $this->createElement('text', 'lpHeatLossPercent')\n ->setValue(.1)\n ->setAttrib('style', 'width: 60px;');\n\n $this->addElements(array(\n $hpHeatLossPercent,\n $mpHeatLossPercent,\n $lpHeatLossPercent,\n ));\n }" ]
[ "0.5305672", "0.51929915", "0.5192559", "0.517536", "0.517536", "0.517536", "0.517536", "0.517536", "0.51236653", "0.5028674", "0.49931952", "0.4927494", "0.4910817", "0.49040562", "0.48878166", "0.488666", "0.48583576", "0.48304302", "0.48169217", "0.4809677", "0.4804556", "0.47822472", "0.4774667", "0.47666228", "0.47259566", "0.47228193", "0.47110397", "0.47096616", "0.47092998", "0.46909007" ]
0.5901773
0
Imports a text header i.e. a field's declaration.
protected function process_header_text(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $autolink = true); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function statementHeader(string $text): void\n {\n }", "function setHeaderText($value) {\n $this->header_text = $value;\n}", "private function _header($text){\n echo '[*] ' . $text . PHP_EOL;\n }", "function import_text( $text ) {\r\n // quick sanity check\r\n if (empty($text)) {\r\n return '';\r\n }\r\n $data = $text[0]['#'];\r\n return addslashes(trim( $data ));\r\n }", "function display_header_text()\n {\n }", "private function readHeaderRow() {\n\n // Grab the line as items\n $csvLine = $this->stream->readCSVLine($this->separator, $this->enclosure);\n\n // Create fields from these\n $columns = [];\n foreach ($csvLine as $column) {\n // Expand out the title and the name\n $name = StringUtils::convertToCamelCase(trim($column));\n $columns[] = new Field($name);\n }\n\n $this->csvColumns = $columns;\n }", "private function parseFileHeader()\n\t{\n\n\t\tif ($this->data)\n\t\t{\n\t\t\t$line = StringHelper::substr($this->data, 0, StringHelper::strpos($this->data, \"\\n\") + 1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$fp = fopen($this->file, 'r');\n\t\t\t$line = fgets($fp, 4096);\n\t\t\t$line = trim($line); // remove white spaces, at the end always \\n (or \\r\\n)\n\t\t\tfclose($fp);\n\t\t}\n\n\t\t$headers = explode($this->columnSeparator, $line);\n\t\t$this->colsNum = count($headers);\n\t\tfor ($i = 0; $i < $this->colsNum; $i++)\n\t\t{\n\t\t\t// -------- remove the utf-8 BOM ----\n\t\t\t$headers[$i] = str_replace(\"\\xEF\\xBB\\xBF\", '', $headers[$i]);\n\t\t\t$this->colsOrder[str_replace('\"', '', trim($headers[$i]))] = $i;\n\t\t\t// some people let white space at the end of text, so better to trim\n\t\t\t// CSV has often begining and ending \" - replace it\n\t\t}\n\t}", "private function setHeader($header)\n {\n $this->header = trim((string) $header);\n $this->headerComment = '';\n\n if ('' !== $this->header) {\n $this->headerComment = $this->encloseTextInComment($this->header);\n }\n }", "public function buildHeaderFields() {}", "public function header($text)\n {\n return '\n\n\t<!-- MAIN Header in page top -->\n\t<h1 class=\"t3js-title-inlineedit\">' . htmlspecialchars($text) . '</h1>\n';\n }", "public function importHeader($admin){\n\t return parent::importHeader($admin);\n\t}", "public function loadHeader(): void\n {\n $this->openFile('r');\n\n $header = $this->getLine(false);\n --$this->line; // because we don't want to count header line\n\n $this->initializeHeader($header);\n }", "function printHeader($text) {\n \treturn \"<h2>\".$text.\"</h2>\";\n }", "public function docHeaderContent() {}", "public function set_comment_before_headers($text)\n {\n }", "protected function readHeader()\n {\n \t$this->data_mesgs['file_id']['type']=\"TCX\";\n \t$this->data_mesgs['file_id']['manufacturer']=(string)$this->file_contents->Activities->Activity->Creator->Name;\n \t$this->data_mesgs['file_id']['number']=(string)$this->file_contents->Author->Build->Version->VersionMajor.\".\".\n \t\t(string)$this->file_contents->Author->Build->Version->VersionMinor;\n \t$datebrut=(string)$this->file_contents->Activities->Activity->Lap['StartTime'];\n \t$this->data_mesgs['file_id']['time_created']=strtotime( $datebrut);\n \t$this->data_mesgs['session']['sport']=(string)$this->file_contents->Activities->Activity['Sport'];\n \t \n }", "private function processHeader(): void\n {\n $this->header = $header = $this->translation;\n if (count($description = $header->getComments()->toArray())) {\n $this->translations->setDescription(implode(\"\\n\", $description));\n }\n if (count($flags = $header->getFlags()->toArray())) {\n $this->translations->getFlags()->add(...$flags);\n }\n $headers = $this->translations->getHeaders();\n if (($header->getTranslation() ?? '') !== '') {\n foreach (self::readHeaders($header->getTranslation()) as $name => $value) {\n $headers->set($name, $value);\n }\n }\n $this->pluralCount = $headers->getPluralForm()[0] ?? null;\n foreach (['Language', 'Plural-Forms', 'Content-Type'] as $header) {\n if (($headers->get($header) ?? '') === '') {\n $this->addWarning(\"$header header not declared or empty{$this->getErrorPosition()}\");\n }\n }\n }", "public function getHeader(string $header): string;", "function privReadFileHeader(&$p_header)\n {\n }", "function ParseHeader($header='')\n{\n\t$resArr = array();\n\t$headerArr = explode(\"\\n\",$header);\n\tforeach ($headerArr as $key => $value) {\n\t\t$tmpArr=explode(\": \",$value);\n\t\tif (count($tmpArr)<1) continue;\n\t\t$resArr = array_merge($resArr, array($tmpArr[0] => count($tmpArr) < 2 ? \"\" : $tmpArr[1]));\n\t}\n\treturn $resArr;\n}", "public function defineHeader()\n {\n $this->header = new Header();\n }", "public function getHeader();", "public function getHeader();", "public function getHeader();", "abstract public function header();", "public function printHeader() {\n\t\t$template = self::$templates[$this->templateName];\n\t\trequire_once $template['path'] . $template['file-header'];\n\t}", "public function import();", "public static function fromString($headerLine)\n {\n $header = new static();\n $headerName = $header->getFieldName();\n [$name, $value] = GenericHeader::splitHeaderLine($headerLine);\n // Ensure the proper header name\n if (strcasecmp($name, $headerName) !== 0) {\n throw new Exception\\InvalidArgumentException(sprintf(\n 'Invalid header line for %s string: \"%s\"',\n $headerName,\n $name\n ));\n }\n // As per https://w3c.github.io/webappsec-feature-policy/#algo-parse-policy-directive\n $tokens = explode(';', $value);\n foreach ($tokens as $token) {\n $token = trim($token);\n if ($token) {\n [$directiveName, $directiveValue] = array_pad(explode(' ', $token, 2), 2, null);\n if (! isset($header->directives[$directiveName])) {\n $header->setDirective(\n $directiveName,\n $directiveValue === null ? [] : [$directiveValue]\n );\n }\n }\n }\n\n return $header;\n }", "public function getHeaderData() {}", "protected function _parseHeader() {}" ]
[ "0.6034784", "0.58935195", "0.56245434", "0.55620503", "0.5527571", "0.5523644", "0.5466935", "0.5460304", "0.5458527", "0.54272413", "0.54262334", "0.5407933", "0.54028666", "0.53963476", "0.53871566", "0.5360135", "0.53181714", "0.53011644", "0.52995664", "0.5290824", "0.52863383", "0.5262209", "0.5262209", "0.5262209", "0.52615505", "0.5254824", "0.52422506", "0.52361715", "0.5231258", "0.52203715" ]
0.6070688
0
Imports a textarea header i.e. a field's declaration.
protected function process_header_textarea(import_settings $settings, $data, $name, $description, $options) { $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options); $result->param2 = 60; $result->param3 = 35; $result->param4 = 1; global $DB; $DB->update_record('data_fields', $result); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static public function createTextArea($input, $name) {\n include $_SERVER[\"DOCUMENT_ROOT\"] . \"/mvdv/core/view/templates/general/form/formelements/textarea.php\";\n }", "function bfa_add_html_inserts_header() {\r\n\tglobal $bfa_ata;\r\n\tif( $bfa_ata['html_inserts_header'] != '' ) bfa_incl('html_inserts_header'); \r\n}", "function setHeaderText($value) {\n $this->header_text = $value;\n}", "public function __Header(){\n $this->Ln(5);\n $this->SetDrawColor(160,160,160);\n $this->SetFillColor(230,230,230);\n $this->SetTextColor(100);\n $this->SetFont('Arial','B',7);\n $this->SetX(($this->w - $this->_tWidth)/2);\n foreach($this->_fields as $field)\n $this->Cell($field[\"size\"],5,$field[\"header\"],1,0,\"C\",true);\n $this->Ln();\n }", "private function setHeader($header)\n {\n $this->header = trim((string) $header);\n $this->headerComment = '';\n\n if ('' !== $this->header) {\n $this->headerComment = $this->encloseTextInComment($this->header);\n }\n }", "public function getInputHeaders()\n {\n }", "public function defineHeader()\n {\n $this->header = new Header();\n }", "protected function output_header() {\n include dirname( __FILE__ ) . '/views/html-csv-import-header.php';\n }", "function _importAuto($content, &$we_doc, $templateFilename, $templateParentID)\n\t{\n\t\t\n\t\t$textareaCode = '<we:textarea name=\"content\" wysiwyg=\"true\" width=\"800\" height=\"600\" xml=\"true\" inlineedit=\"true\"/>';\n\t\t$titleCode = \"<we:title />\";\n\t\t$descriptionCode = \"<we:description />\";\n\t\t$keywordsCode = \"<we:keywords />\";\n\t\t\n\t\t$title = \"\";\n\t\t$description = \"\";\n\t\t$keywords = \"\";\n\t\t$charset = \"\";\n\t\t\n\t\t// check if we have a body start and end tag\n\t\tif (preg_match('/<body[^>]*>(.*)<\\/body>/is', $content, $regs)) {\n\t\t\t$bodyhtml = $regs[1];\n\t\t\t$templateCode = preg_replace('/(.*<body[^>]*>).*(<\\/body>.*)/is', \"$1$textareaCode$2\", $content);\n\t\t} else {\n\t\t\t$bodyhtml = $content;\n\t\t\t$templateCode = $textareaCode;\n\t\t}\n\t\t\n\t\t// try to get title, description, keywords and charset\n\t\tif (preg_match('/<title[^>]*>(.*)<\\/title>/is', $content, $regs)) {\n\t\t\t$title = $regs[1];\n\t\t\t$templateCode = preg_replace('/<title[^>]*>.*<\\/title>/is', \"$titleCode\", $templateCode);\n\t\t}\n\t\tif (preg_match('/<meta ([^>]*)name=\"description\"([^>]*)>/is', $content, $regs)) {\n\t\t\tif (preg_match('/content=\"([^\"]+)\"/is', $regs[1], $attr)) {\n\t\t\t\t$description = $attr[1];\n\t\t\t} else \n\t\t\t\tif (preg_match('/content=\"([^\"]+)\"/is', $regs[2], $attr)) {\n\t\t\t\t\t$description = $attr[1];\n\t\t\t\t}\n\t\t\t$templateCode = preg_replace('/<meta [^>]*name=\"description\"[^>]*>/is', \"$descriptionCode\", $templateCode);\n\t\t}\n\t\tif (preg_match('/<meta ([^>]*)name=\"keywords\"([^>]*)>/is', $content, $regs)) {\n\t\t\tif (preg_match('/content=\"([^\"]+)\"/is', $regs[1], $attr)) {\n\t\t\t\t$keywords = $attr[1];\n\t\t\t} else \n\t\t\t\tif (preg_match('/content=\"([^\"]+)\"/is', $regs[2], $attr)) {\n\t\t\t\t\t$keywords = $attr[1];\n\t\t\t\t}\n\t\t\t$templateCode = preg_replace('/<meta [^>]*name=\"keywords\"[^>]*>/is', \"$keywordsCode\", $templateCode);\n\t\t}\n\t\tif (preg_match('/<meta ([^>]*)http-equiv=\"content-type\"([^>]*)>/is', $content, $regs)) {\n\t\t\tif (preg_match('/content=\"([^\"]+)\"/is', $regs[1], $attr)) {\n\t\t\t\tif (preg_match('/charset=([^ \"\\']+)/is', $attr[1], $cs)) {\n\t\t\t\t\t$charset = $cs[1];\n\t\t\t\t}\n\t\t\t} else \n\t\t\t\tif (preg_match('/content=\"([^\"]+)\"/is', $regs[2], $attr)) {\n\t\t\t\t\tif (preg_match('/charset=([^ \"\\']+)/is', $attr[1], $cs)) {\n\t\t\t\t\t\t$charset = $cs[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t$templateCode = preg_replace(\n\t\t\t\t\t'/<meta [^>]*http-equiv=\"content-type\"[^>]*>/is', \n\t\t\t\t\t'<we:charset defined=\"' . $charset . '\">' . $charset . '</we:charset>', \n\t\t\t\t\t$templateCode);\n\t\t}\n\t\t\n\t\t// replace external css (link rel=stylesheet)\n\t\tpreg_match_all('/<link ([^>]+)>/i', $templateCode, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[1]); $i++) {\n\t\t\t\tpreg_match_all('/([^= ]+)=[\\'\"]?([^\\'\" ]+)[\\'\"]?/is', $regs[1][$i], $regs2, PREG_PATTERN_ORDER);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\tfor ($z = 0; $z < count($regs2[1]); $z++) {\n\t\t\t\t\t\t$attribs[$regs2[1][$z]] = $regs2[2][$z];\n\t\t\t\t\t}\n\t\t\t\t\tif (isset($attribs[\"rel\"]) && $attribs[\"rel\"] == \"stylesheet\") {\n\t\t\t\t\t\tif (isset($attribs[\"href\"]) && $attribs[\"href\"]) {\n\t\t\t\t\t\t\t$id = path_to_id($attribs[\"href\"]);\n\t\t\t\t\t\t\t$tag = '<we:css id=\"' . $id . '\" xml=\"true\" ' . ((isset($attribs[\"media\"]) && $attribs[\"media\"]) ? ' pass_media=\"' . $attribs[\"media\"] . '\"' : '') . '/>';\n\t\t\t\t\t\t\t$templateCode = str_replace($regs[0][$i], $tag, $templateCode);\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\t// replace external js scripts\n\t\tpreg_match_all('/<script ([^>]+)>.*<\\/script>/isU', $templateCode, $regs, PREG_PATTERN_ORDER);\n\t\tif ($regs != null) {\n\t\t\tfor ($i = 0; $i < count($regs[1]); $i++) {\n\t\t\t\tpreg_match('/src=[\"\\']?([^\"\\']+)[\"\\']?/is', $regs[1][$i], $regs2);\n\t\t\t\tif ($regs2 != null) {\n\t\t\t\t\t$id = path_to_id($regs2[1]);\n\t\t\t\t\t$tag = '<we:js id=\"' . $id . '\" xml=\"true\" />';\n\t\t\t\t\t$templateCode = str_replace($regs[0][$i], $tag, $templateCode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check if there is allready a template with the same content\n\t\t\n\n\t\t$newTemplateID = f(\n\t\t\t\t\"SELECT \" . LINK_TABLE . \".DID AS DID FROM \" . LINK_TABLE . \",\" . CONTENT_TABLE . \" WHERE \" . LINK_TABLE . \".CID=\" . CONTENT_TABLE . \".ID AND \" . CONTENT_TABLE . \".Dat='\" . mysql_real_escape_string(\n\t\t\t\t\t\t$templateCode) . \"' AND \" . LINK_TABLE . \".DocumentTable='\" . substr(\n\t\t\t\t\t\tTEMPLATES_TABLE, \n\t\t\t\t\t\tstrlen(TBL_PREFIX)) . \"'\", \n\t\t\t\t\"DID\", \n\t\t\t\t$GLOBALS['DB_WE']);\n\t\t\n\t\tif (!$newTemplateID) {\n\t\t\t// create Template\n\t\t\t\n\n\t\t\t$newTemplateFilename = $templateFilename;\n\t\t\t$GLOBALS['DB_WE']->query(\n\t\t\t\t\t\"SELECT Filename FROM \" . TEMPLATES_TABLE . \" WHERE ParentID=\" . abs($templateParentID) . \" AND Filename like '\" . mysql_real_escape_string(\n\t\t\t\t\t\t\t$templateFilename) . \"%'\");\n\t\t\t$result = array();\n\t\t\tif ($GLOBALS['DB_WE']->num_rows()) {\n\t\t\t\twhile ($GLOBALS['DB_WE']->next_record()) {\n\t\t\t\t\tarray_push($result, $GLOBALS['DB_WE']->f(\"Filename\"));\n\t\t\t\t}\n\t\t\t}\n\t\t\t$z = 1;\n\t\t\twhile (in_array($newTemplateFilename, $result)) {\n\t\t\t\t$newTemplateFilename = $templateFilename . $z;\n\t\t\t\t$z++;\n\t\t\t}\n\t\t\tinclude_once ($_SERVER[\"DOCUMENT_ROOT\"] . \"/webEdition/we/include/we_classes/we_template.inc.php\");\n\t\t\t$templateObject = new we_template();\n\t\t\t$templateObject->we_new();\n\t\t\t$templateObject->CreationDate = time();\n\t\t\t$templateObject->ID = 0;\n\t\t\t$templateObject->OldPath = \"\";\n\t\t\t$templateObject->Extension = \".tmpl\";\n\t\t\t$templateObject->Filename = $newTemplateFilename;\n\t\t\t$templateObject->Text = $templateObject->Filename . $templateObject->Extension;\n\t\t\t$templateObject->setParentID($templateParentID);\n\t\t\t$templateObject->Path = $templateObject->ParentPath . ($templateParentID ? \"/\" : \"\") . $templateObject->Text;\n\t\t\t$templateObject->OldPath = $templateObject->Path;\n\t\t\t$templateObject->setElement(\"data\", $templateCode, \"txt\");\n\t\t\t$templateObject->we_save();\n\t\t\t$templateObject->we_publish();\n\t\t\t$templateObject->setElement(\"Charset\", $charset);\n\t\t\t$newTemplateID = $templateObject->ID;\n\t\t}\n\t\t\n\t\t$we_doc->setTemplateID($newTemplateID);\n\t\t$we_doc->setElement(\"content\", $bodyhtml);\n\t\t$we_doc->setElement(\"Title\", $title);\n\t\t$we_doc->setElement(\"Keywords\", $keywords);\n\t\t$we_doc->setElement(\"Description\", $description);\n\t\t$we_doc->setElement(\"Charset\", $charset);\n\t}", "public function docHeaderContent() {}", "function insertFormulize()\n{\n\techo \"Hello\";\n//\tinclude '/Users/dpage/Sites/formulize/htdocs/mainfile.php';\n//\t$formulize_screen_id = 2;\n//\tinclude XOOPS_ROOT_PATH . '/modules/formulize/index.php';\n}", "function greater_jackson_habitat_extra_metabox_content() {\n\t\n\tgreater_jackson_habitat_do_field_textarea( array(\n\t\t'name' => 'gjh_extra',\n\t\t'group' => 'gjh_extra',\n\t\t'wysiwyg' => true,\n\t) );\n\t\n\tgreater_jackson_habitat_init_field_group( 'gjh_extra' );\n\t\n}", "function Header() {\n $this->AddFont('Gotham-M','B','gotham-medium.php'); \n //seteamos el titulo que aparecera en el navegador \n $this->SetTitle(utf8_decode('Toma de Protesta Candidato PVEM'));\n\n //linea que simplemente me marca la mitad de la hoja como referencia\n \t$this->Line(139.5,$this->getY(),140,250);\n\n \t//bajamos la cabecera 13 espacios\n $this->Ln(10);\n //seteamos la fuente, el color de texto, y el color de fondo de el titulo\n $this->SetFont('Gotham-M','B',11);\n $this->SetTextColor(255,255,255);\n $this->SetFillColor(73, 168, 63);\n //escribimos titulo\n $this->Cell(0,5,utf8_decode('Toma de Protesta Candidato PVEM'),0,0,'C',1); //el completo es 279 bueno 280 /2 = 140 si seran 10 de cada borde, entonces 120\n\n $this->Ln();\n }", "public function __construct() {\n\t\tparent::__construct();\n\n\t\t$this->category = _x( 'Single Fields', 'xprofile field type category', 'buddypress' );\n\t\t$this->name = _x( 'Multi-line Text Area', 'xprofile field type', 'buddypress' );\n\n\t\t$this->set_format( '/^.*$/m', 'replace' );\n\t\tdo_action( 'bp_xprofile_field_type_textarea', $this );\n\t}", "function add_admin_header() {\n }", "function getHeaderTitleJS($varElement, $varName, $type, $endSequence='', $add=FALSE, $count=10)\t{\n\t\t\n\t\treturn parent::getHeaderTitleJS($varName, $type, $endSequence, $add, $count) . \"\n\t\t\t\tif (typeof(lorem_ipsum) == 'function' && \" . $varElement . \".tagName.toLowerCase() == 'textarea' ) lorem_ipsum(\" . $varElement . \", lipsum_temp_strings[lipsum_temp_pointer]);\n\t\t\t\";\n\t}", "function addHeadElement($include) {\n\t $this->_headSection .= $include . \"\\n\";\n\t}", "function create_custom_field() {\n $args = array(\n 'id' => 'custom_field_brand',\n 'label' => __( 'Detalhes da Marca'),\n 'class' => 'brand-custom-field',\n 'desc_tip' => true,\n 'description' => __( 'Enter the brand details.'),\n );\n woocommerce_wp_textarea_input( $args );\n}", "function add_from_tab_content () {\n require_once dirname(__FILE__).'/templates/form-tab-content.php';\n }", "public function header($text)\n {\n return '\n\n\t<!-- MAIN Header in page top -->\n\t<h1 class=\"t3js-title-inlineedit\">' . htmlspecialchars($text) . '</h1>\n';\n }", "public function importHeader($admin){\n\t return parent::importHeader($admin);\n\t}", "function header (){\n\t\t$this->setfont('Arial','B', 16);\n\t\t$this->settextcolor(0, 0, 0);\n\t\t$this->cell(0, 10, 'WANANCHI', 0, 0, 'C');\n\t\t$this->Ln(10);\n\t\t$this->setfont('Arial','',12);\n\t\t$this->settextcolor(0, 0, 0);\n\t\t$this->cell(0, 10, 'INFORMATION',0, 0, 'C');\n\t\t$this->Ln(30);\n\t}", "function wpsites_modify_comment_form_text_area($arg) {\n $arg['comment_field'] = '<p class=\"comment-form-comment\"><label for=\"comment\">' . _x( 'Takk for din tilbakemelding!', 'noun' ) . '</label><textarea id=\"comment\" name=\"comment\" cols=\"55\" rows=\"7\" aria-required=\"true\"></textarea></p>';\n return $arg;\n}", "function output_textarea_row( string $label, string $key, $val, int $rows = 2 ): void {\n\twp_enqueue_style( 'wpinc-meta-field' );\n\t$val = $val ?? '';\n\t?>\n\t<div class=\"wpinc-meta-field-single textarea\">\n\t\t<label>\n\t\t\t<span><?php echo esc_html( $label ); ?></span>\n\t\t\t<textarea <?php name_id( $key ); ?> cols=\"64\" rows=\"<?php echo esc_attr( $rows ); ?>\"><?php echo esc_attr( $val ); ?></textarea>\n\t\t</label>\n\t</div>\n\t<?php\n}", "protected function dumpHeader() {\n\t\treturn trim('\n# TYPO3 Extension Manager dump 1.1\n#\n#--------------------------------------------------------\n');\n\t}", "public function buildHeaderFields() {}", "function Header()\n\t\t{\n\t\t\t$this->SetFont('Helvetica','B',18);\n\t\t\t$this->SetTextColor(184,10,10);\n\t\t\t$this->Cell(30);\n\t\t\t$this->Cell(120,10,utf8_decode(\"Mensajes Contestados\"),0,0,'C');\n\t\t\t$this->Ln(20);\n\t\t}", "private function textareaCustomField(): string\n {\n return Template::build($this->getTemplatePath('textarea.html'), [\n 'id' => uniqid(\"{$this->id}-\", true),\n 'name' => $this->id,\n 'label' => $this->label,\n 'value' => $this->getValue($this->index),\n 'index' => isset($this->index) ? $this->index : false\n ]);\n }", "function ctools_export_form($form, &$form_state, $code, $title = '') {\r\n $lines = substr_count($code, \"\\n\");\r\n $form['code'] = array(\r\n '#type' => 'textarea',\r\n '#title' => $title,\r\n '#default_value' => $code,\r\n '#rows' => $lines,\r\n );\r\n\r\n return $form;\r\n}", "public function set_comment_before_headers($text)\n {\n }" ]
[ "0.5486219", "0.54106927", "0.5353058", "0.5314122", "0.5278608", "0.525247", "0.51403344", "0.5138327", "0.5132187", "0.51316994", "0.5102319", "0.51012313", "0.50904256", "0.50699586", "0.5052026", "0.5043884", "0.5042542", "0.50385123", "0.5025942", "0.5023656", "0.50211185", "0.5016126", "0.50081235", "0.5006829", "0.49513927", "0.49355346", "0.49292946", "0.49227333", "0.49189118", "0.49142745" ]
0.5842437
0
PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY PROCESS BODY Process and import the body i.e. content of the table. Parses the table and calls the specialized import method based on the field's type.
protected function process_body(import_settings $settings, $data, $fields) { $doc = $settings->get_dom(); $list = $doc->getElementsByTagName('tbody'); $body = $list->item(0); $rows = $body->getElementsByTagName('tr'); foreach ($rows as $row) { $data_record = $this->get_data_record($data); //do not create datarecord if there are no rows to import $index = 0; $cells = $row->getElementsByTagName('td'); foreach ($cells as $cell) { $field = $fields[$index]; $type = $field->type; $f = array($this, 'process_data_' . $type); if (is_callable($f)) { call_user_func($f, $settings, $field, $data_record, $cell); } else { $this->process_data_default($settings, $field, $data_record, $cell); } $index++; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function prepareImportContent();", "public function doImport() \n\t{ \n\t // first save the import object in the database\n $this->status = self::STATUS_IN_PROGRESS_IMPORT;\n $this->item_count = $this->getItemCount();\n\t $this->save(); \n\t \t \n\t // add an import object\n\t $db = get_db();\n\t $csvFile = $this->getCsvFile();\n\t $columnMaps = $this->getColumnMaps();\n\t \t \n if ($csvFile->isValid()) { \t \n\n // define item metadata\t \n $itemMetadata = array(\n 'public' => $this->is_public, \n 'featured' => $this->is_featured, \n 'item_type_id' => $this->item_type_id,\n 'collection_id' => $this->collection_id\n );\n \n // create a map from the column index number to an array of element infos, where each element info contains \n // the element set name, element name, and whether the element text is html or not \n $colNumToElementInfosMap = array();\n\n $colNumMapsToTag = array();\n \n foreach($columnMaps as $columnMap) {\n $columnIndex = $columnMap->getColumnIndex();\n \n // check to see if the column maps to a tag\n $mapsToTag = $colNumMapsToTag[$columnIndex];\n if (empty($mapsToTag)) {\n $colNumMapsToTag[$columnIndex] = false; \n }\n if ($columnMap->mapsToTag()) {\n $colNumMapsToTag[$columnIndex] = true; \n }\n \n // check to see if the column maps to a file\n $mapsToFile = $colNumMapsToFile[$columnIndex];\n if (empty($mapsToFile)) {\n $colNumMapsToFile[$columnIndex] = false; \n }\n if ($columnMap->mapsToFile()) {\n $colNumMapsToFile[$columnIndex] = true; \n }\n \n // build element infos from the column map\n $elementIds = $columnMap->getElementIds();\n foreach($elementIds as $elementId) {\n $et = $db->getTable('Element');\n $element = $et->find($elementId);\n $es = $db->getTable('ElementSet');\n $elementSet = $es->find($element['element_set_id']);\n $elementInfo = array('element_name' => $element->name, \n 'element_set_name' => $elementSet->name, \n 'element_text_is_html' => $columnMap->getDataIsHtml());\n \n // make sure that an array of element infos exists for the column index\n if (!is_array($colNumToElementInfosMap[$columnIndex])) {\n $colNumToElementInfosMap[$columnIndex] = array();\n }\n \n // add the element info if it does not already exist for the column index \n if (!in_array($elementInfo, $colNumToElementInfosMap[$columnIndex])) {\n $colNumToElementInfosMap[$columnIndex][] = $elementInfo; \n }\n } \n }\n \n // add item from each row\n $rows = $csvFile->getRows();\n $i = 0;\n foreach($rows as $row) {\n $i++;\n \n // ignore the first row because it is the header\n if ($i == 1) {\n continue;\n }\n \n //insert the item \n try {\n $item = $this->addItemFromRow($row, $itemMetadata, $colNumToElementInfosMap, $colNumMapsToTag, $colNumMapsToFile);\n } catch (Exception $e) {\n $this->status = self::STATUS_IMPORT_ERROR_INVALID_ITEM;\n \t $this->error_details = $e->getMessage();\n }\n release_object($item);\n \n // stop import on error\n if ($this->hasErrorStatus()) {\n \t $this->save();\n \t return false;\n \t }\n }\n \n $this->status = self::STATUS_COMPLETED_IMPORT;\n $this->save();\n return true;\n \n }\n \n $this->status = self::STATUS_IMPORT_ERROR_INVALID_CSV_FILE;\n $this->save();\n return false;\n\t}", "public function import()\n {\n // Reorder importers\n usort($this->entityImporterMappings, function ($a, $b) {\n return $a[ORDER] <=> $b[ORDER];\n });\n\n // Import each entity type in turn\n foreach ($this->entityImporterMappings as $entityImporterMapping) {\n $files = $this->directoryReader->getFileNameMappings($entityImporterMapping[self::DIRECTORY]);\n foreach ($files as $filename => $slug) {\n $fileContents = file_get_contents($filename);\n $entityData = json_decode($fileContents, true);\n $entityImporterMapping[self::IMPORTER]->importEntity($slug, $entityData);\n }\n }\n }", "public function import($type) {\n $this -> clear();\n if ($this -> lines == \"\") {\n $this -> log[\"failure\"][\"missingheader\"] = _NOHEADERROWISDEFINEDORHEADERROWNOTCOMPATIBLEWITHIMPORTTYPE;\n } else {\n // Pairs of values <Csv column header> => <eFront DB field>\n $this -> types = EfrontImport::getTypes($type);\n // Pairs of values <eFront DB field> => <import file column>\n $this -> mappings = $this -> parseHeaderLine(&$headerLine);\n if ($this -> mappings) {\n if ($this -> checkImportEssentialField($type)) {\n if ($type == 'users_to_groups' || $type == 'users') {\n $data = array();\n for ($line = $headerLine+1; $line < $this -> lines; ++$line) {\n $data[] = $this -> parseDataLine($line);\n }\n $this -> importDataMultiple($type, $data);\n } else {\n for ($line = $headerLine+1; $line < $this -> lines; ++$line) {\n $data = $this -> parseDataLine($line);\n $this -> importData($line+1, $type, $data);\n }\n }\n }\n } else {\n $this -> log[\"failure\"][\"missingheader\"] = _NOHEADERROWISDEFINEDORHEADERROWNOTCOMPATIBLEWITHIMPORTTYPE;\n }\n }\n return $this -> log;\n }", "public function wp_parser_starting_import() {\n\t\t$importer = new Importer;\n\n\t\tif ( ! $this->p2p_tables_exist() ) {\n\t\t\t\\P2P_Storage::init();\n\t\t\t\\P2P_Storage::install();\n\t\t}\n\n\t\t$this->post_types = array(\n\t\t\t'hook' => $importer->post_type_hook,\n\t\t\t'method' => $importer->post_type_method,\n\t\t\t'function' => $importer->post_type_function,\n\t\t);\n\t}", "protected function importDatabaseData() {}", "function _updateSiteImportTable()\n\t{\n\t\t\n\t\t$_templateFields = weSiteImport::_getFieldsFromTemplate($_REQUEST[\"tid\"]);\n\t\t$hasDateFields = false;\n\t\t\n\t\t$values = array();\n\t\t\n\t\tforeach ($_templateFields as $name => $type) {\n\t\t\tif ($type == \"date\") {\n\t\t\t\t$hasDateFields = true;\n\t\t\t}\n\t\t\tswitch ($name) {\n\t\t\t\tcase \"Title\" :\n\t\t\t\t\tarray_push($values, array(\n\t\t\t\t\t\t\"name\" => $name, \"pre\" => \"<title>\", \"post\" => \"</title>\"\n\t\t\t\t\t));\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase \"Keywords\" :\n\t\t\t\t\tarray_push($values, array(\n\t\t\t\t\t\t\"name\" => $name, \"pre\" => '<meta name=\"keywords\" content=\"', \"post\" => '\">'\n\t\t\t\t\t));\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase \"Description\" :\n\t\t\t\t\tarray_push(\n\t\t\t\t\t\t\t$values, \n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\"name\" => $name, \n\t\t\t\t\t\t\t\t\t\"pre\" => '<meta name=\"description\" content=\"', \n\t\t\t\t\t\t\t\t\t\"post\" => '\">'\n\t\t\t\t\t\t\t));\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase \"Charset\" :\n\t\t\t\t\tarray_push(\n\t\t\t\t\t\t\t$values, \n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\"name\" => $name, \n\t\t\t\t\t\t\t\t\t\"pre\" => '<meta http-equiv=\"content-type\" content=\"text/html;charset=', \n\t\t\t\t\t\t\t\t\t\"post\" => '\">'\n\t\t\t\t\t\t\t));\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tdefault :\n\t\t\t\t\tarray_push($values, array(\n\t\t\t\t\t\t\"name\" => $name, \"pre\" => \"\", \"post\" => \"\"\n\t\t\t\t\t));\n\t\t\t}\n\t\t}\n\t\t\n\t\t$js = 'var tableDivObj = parent.document.getElementById(\"tablediv\");\n\t\ttableDivObj.innerHTML = \"' . str_replace(\n\t\t\t\t\"\\r\", \n\t\t\t\t\"\\\\r\", \n\t\t\t\tstr_replace(\"\\n\", \"\\\\n\", addslashes($this->_getSiteImportTableHTML($_templateFields, $values)))) . '\"\n\t\tparent.document.getElementById(\"dateFormatDiv\").style.display=\"' . ($hasDateFields ? \"block\" : \"none\") . '\";\n';\n\t\t\n\t\t$js = we_htmlElement::jsElement($js) . \"\\n\";\n\t\treturn $this->_getHtmlPage(\"\", $js);\n\t}", "public function importAction()\n {\n $controller = $this->getRequest()->getControllerName();\n $importLoader = $this->loader->getImportLoader();\n $model = $this->getModel();\n\n $params = array();\n $params['defaultImportTranslator'] = $importLoader->getDefaultTranslator($controller);\n $params['formatBoxClass'] = 'browser table';\n $params['importer'] = $importLoader->getImporter($controller, $model);\n $params['model'] = $model;\n $params['tempDirectory'] = $importLoader->getTempDirectory();\n $params['importTranslators'] = $importLoader->getTranslators($controller);\n\n $this->addSnippets($this->importSnippets, $params);\n }", "public function prepareImport();", "public function importer($type) {\n $mappings = array(\n new Name('first_name'),\n new Name('last_name'),\n );\n if ($type == 'campaignion_action_taken') {\n $mappings = array_merge($mappings, array(\n new Field('field_gender', 'gender'),\n new Field('field_salutation', 'salutation'),\n new Field('field_title', 'title'),\n new Date('field_date_of_birth', 'date_of_birth'),\n new Address('field_address', array(\n 'thoroughfare' => 'street_address',\n 'premise' => 'street_address_2',\n 'postal_code' => ['zip_code', 'postcode'],\n 'locality' => 'city',\n 'administrative_area' => 'state',\n 'country' => 'country',\n )),\n new Phone('field_phone_number', 'phone_number'),\n new Phone('field_phone_number', 'mobile_number'),\n new EmailBulk('redhen_contact_email', 'email', 'email_newsletter'),\n new BooleanOptIn('field_opt_in_phone', 'phone_opt_in'),\n new BooleanOptIn('field_opt_in_post', 'post_opt_in'),\n new Field('field_preferred_language', 'language'),\n ));\n }\n return new ImporterBase($mappings);\n }", "protected function process_fields($table, $data, $format)\n {\n }", "abstract protected function loadFields();", "function prepare_field_for_import($field)\n {\n }", "public function postImport() {\n parent::postImport();\n if (!civicrm_initialize()) {\n return;\n }\n // Need to clear the cache once the fields are created.\n civicrm_api3('system', 'flush', array('version' => 3));\n }", "private function loadFields() {\n\t\tif (count($this->fields) > 0) return;\n\t\t$db = getDB();\n\t\t$stat = $db->prepare(\"SELECT * FROM collection_has_field WHERE collection_id=:cid ORDER BY sort_order DESC\");\n\t\t$stat->execute(array('cid'=>$this->collection_id));\n\t\twhile($d = $stat->fetch()) {\n\t\t\tif ($d['type'] == \"STRING\") {\n\t\t\t\t$this->fields[] = new ItemFieldString( $d, $this->collection_id, $this);\n\t\t\t} else if ($d['type'] == \"TEXT\") {\n\t\t\t\t$this->fields[] = new ItemFieldText( $d, $this->collection_id, $this);\n\t\t\t} else if ($d['type'] == \"HTML\") {\n\t\t\t\t$this->fields[] = new ItemFieldHTML( $d, $this->collection_id, $this);\n\t\t\t} else if ($d['type'] == \"EMAIL\") {\n\t\t\t\t$this->fields[] = new ItemFieldEmail( $d, $this->collection_id, $this);\n\t\t\t} else if ($d['type'] == \"PHONE\") {\n\t\t\t\t$this->fields[] = new ItemFieldPhone( $d, $this->collection_id, $this);\n\t\t\t} else {\n\t\t\t\tthrow new Exception(\"We don't know about type: \".$d['type']);\n\t\t\t}\n\t\t}\n\t}", "protected abstract function importCreate($entity);", "public function run()\n {\n \tDB::beginTransaction();\n\n Excel::import(new PageImport, storage_path('imports/pages.xls'));\n Excel::import(new PageItemImport, storage_path('imports/page_items.xls'));\n\n DB::commit();\n }", "function theme_helper_import_field_table($form) {\n $header = $form['#node_import-columns'];\n $rows = array();\n $groups = array();\n\n foreach (element_children($form) as $child) {\n if (!isset($form[$child]['#type']) || $form[$child]['#type'] != 'value') {\n $title = check_plain($form[$child]['#title']);\n $description = $form[$child]['#description'];\n $group = isset($form[$child]['#node_import-group']) ? $form[$child]['#node_import-group'] : '';\n unset($form[$child]['#title']);\n unset($form[$child]['#description']);\n\n if (!isset($groups[$group])) {\n $groups[$group] = array();\n }\n\n $groups[$group][] = array(\n check_plain($title) . '<div class=\"description\">'. $description .'</div>',\n drupal_render($form[$child]),\n );\n }\n }\n\n if (isset($groups['']) && !empty($groups[''])) {\n $rows = array_merge($rows, $groups['']);\n }\n\n foreach ($groups as $group => $items) {\n if ($group !== '' && !empty($items)) {\n $rows[] = array(\n array('data' => $group, 'colspan' => 2, 'class' => 'region'),\n );\n $rows = array_merge($rows, $items);\n }\n }\n\n if (empty($rows)) {\n $rows[] = array(array('data' => $form['#node_import-empty'], 'colspan' => 2));\n }\n\n return theme('table', $header, $rows) . drupal_render($form);\n}", "public function import(HTTPRequest $request)\n {\n $hasheader = (bool)$request->postVar('HasHeader');\n $cleardata = $this->component->getCanClearData() ?\n (bool)$request->postVar('ClearData') :\n false;\n if ($request->postVar('action_import')) {\n $file = File::get()\n ->byID($request->param('FileID'));\n if (!$file) {\n return \"file not found\";\n }\n\n $temp_file = $this->tempFileFromStream($file->getStream());\n\n $colmap = Convert::raw2sql($request->postVar('mappings'));\n if ($colmap) {\n //save mapping to cache\n $this->cacheMapping($colmap);\n //do import\n $results = $this->importFile(\n $temp_file,\n $colmap,\n $hasheader,\n $cleardata\n );\n $this->gridField->getForm()\n ->sessionMessage($results->getMessage(), 'good');\n }\n }\n $controller = $this->getToplevelController();\n $controller->redirectBack();\n }", "function acf_prepare_field_for_import($field)\n{\n}", "public static function import_process() {}", "function _import()\n\t{\n\t\t$title=get_page_title('IMPORT');\n\n\t\t$xml=post_param('xml');\n\n\t\t$ops=import_from_xml($xml);\n\n\t\t$ops_nice=array();\n\t\tforeach ($ops as $op)\n\t\t{\n\t\t\t$ops_nice[]=array('OP'=>$op[0],'PARAM_A'=>$op[1],'PARAM_B'=>array_key_exists(2,$op)?$op[2]:'');\n\t\t}\n\n\t\t// Clear some cacheing\n\t\trequire_code('view_modes');\n\t\trequire_code('zones2');\n\t\trequire_code('zones3');\n\t\terase_comcode_page_cache();\n\t\trequire_code('view_modes');\n\t\terase_tempcode_cache();\n\t\tpersistant_cache_empty();\n\n\t\tbreadcrumb_set_self(do_lang_tempcode('_RESULTS'));\n\t\tbreadcrumb_set_parents(array(array('_SELF:_SELF:misc',do_lang_tempcode('XML_DATA_MANAGEMENT'))));\n\n\t\treturn do_template('XML_STORAGE_IMPORT_RESULTS_SCREEN',array('TITLE'=>$title,'OPS'=>$ops_nice));\n\t}", "public function process_export_import() {\r\n if(Tools::isSubmit('exportSubmit')){ // export data\r\n $this->_export();\r\n } else if(!empty($_FILES['importFile']['tmp_name'])){ // import data\r\n $file = $_FILES['importFile'];\r\n $type = Tools::strtolower(Tools::substr(strrchr($file['name'], '.'), 1));\r\n if ( $type == 'json' ){\r\n return $this->_import($file['tmp_name']);\r\n } else {\r\n return GearHelper::displayAlert('Please use a valid JSON file for import', 'danger');\r\n }\r\n }\r\n }", "public function import()\n\t{\n\t\t$optionStart = $this->importOptions->getOptionValue(\"start\", \"0\");\n\t\t$optionLength = $this->importOptions->getOptionValue(\"length\", \"0\");\n\t\t$optionCols = $this->importOptions->getOptionValue(\"cols\", \"0\");\n\t\t$optionDelimiter = $this->importOptions->getOptionValue(\"delimiter\", \";\");\n\t\t$optionEnclosure = $this->importOptions->getOptionValue(\"enclosure\", \"\");\n\t\t$optionType = $this->importOptions->getOptionValue(\"objectType\", \"\");\n\t\tif($optionType == \"\")\n\t\t{\n\t\t\tthrow new FileImportOptionsRequiredException(gettext(\"Missing option objectType for file import\"));\n\t\t}\n\n\t\t//create object controller\n\t\t$objectController = ObjectController::create();\n\t\t$config = CmdbConfig::create();\n\n\t\t//get mapping of csv columns to object fiels\n\t\t$objectFieldConfig = $config->getObjectTypeConfig()->getFields($optionType);\n\t\t$objectFieldMapping = Array();\n\t\t$foreignKeyMapping = Array();\n $assetIdMapping = -1;\n $activeMapping = -1;\n\t\tfor($i = 0; $i < $optionCols; $i++)\n\t\t{\n\t\t\t$fieldname = $this->importOptions->getOptionValue(\"column$i\", \"\");\n\t\t\t//assetId mapping\n\t\t\tif($fieldname == \"yourCMDB_assetid\")\n\t\t\t{\n\t\t\t\t$assetIdMapping = $i;\n }\n\t\t\t//active state mapping\n\t\t\tif($fieldname == \"yourCMDB_active\")\n {\n\t\t\t\t$activeMapping = $i;\n\t\t\t}\n\t\t\t//foreign key mapping\n\t\t\telseif(preg_match('#^yourCMDB_fk_(.*)/(.*)#', $fieldname, $matches) == 1)\n\t\t\t{\n\t\t\t\t$foreignKeyField = $matches[1];\n\t\t\t\t$foreignKeyRefField = $matches[2];\n\t\t\t\t$foreignKeyMapping[$foreignKeyField][$foreignKeyRefField] = $i;\n\t\t\t}\n\t\t\t//fielf mapping\n\t\t\telseif($fieldname != \"\")\n\t\t\t{\n\t\t\t\t$objectFieldMapping[$fieldname] = $i;\n\t\t\t}\n\t\t}\n\n\t\t//open file\t\t\n\t\t$csvFile = fopen($this->importFilename, \"r\");\n\t\tif($csvFile == FALSE)\n\t\t{\n\t\t\tthrow new FileImportException(gettext(\"Could not open file for import.\"));\n\t\t}\n\n\t\t//create or update objects for each line in csv file\n\t\t$i = 0;\n\t\twhile(($line = $this->readCsv($csvFile, 0, $optionDelimiter, $optionEnclosure)) !== FALSE)\n\t\t{\n\t\t\t//\n\t\t\tif($i >= ($optionLength + $optionStart) && $optionLength != 0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t//check start of import\n\t\t\tif($i >= $optionStart)\n\t\t\t{\n\t\t\t\t//generate object fields\n\t\t\t\t$objectFields = Array();\n\t\t\t\tforeach(array_keys($objectFieldMapping) as $objectField)\n\t\t\t\t{\n\t\t\t\t\tif(isset($line[$objectFieldMapping[$objectField]]))\n\t\t\t\t\t{\n\t\t\t\t\t\t$objectFields[$objectField] = $line[$objectFieldMapping[$objectField]];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//resolve foreign keys\n\t\t\t\tforeach(array_keys($foreignKeyMapping) as $foreignKey)\n\t\t\t\t{\n\t\t\t\t\tforeach(array_keys($foreignKeyMapping[$foreignKey]) as $foreignKeyRefField)\n\t\t\t\t\t{\n\t\t\t\t\t\t//set foreign key object type\n\t\t\t\t\t\t$foreignKeyType = Array(preg_replace(\"/^objectref-/\", \"\", $objectFieldConfig[$foreignKey]));\n\t\t\t\t\t\t$foreignKeyLinePosition = $foreignKeyMapping[$foreignKey][$foreignKeyRefField];\n\t\t\t\t\t\tif(isset($line[$foreignKeyLinePosition]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$foreignKeyRefFieldValue = $line[$foreignKeyLinePosition];\n\t\n\t\t\t\t\t\t\t//get object defined by foreign key\n\t\t\t\t\t\t\t$foreignKeyObjects = $objectController->getObjectsByField(\t$foreignKeyRefField, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$foreignKeyRefFieldValue, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$foreignKeyType, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull, 0, 0, $this->authUser);\n\t\t\t\t\t\t\t//if object was found, set ID as fieldvalue\n\t\t\t\t\t\t\tif(isset($foreignKeyObjects[0]))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$objectFields[$foreignKey] = $foreignKeyObjects[0]->getId();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n }\n\n //set active state\n $active = \"A\";\n if($activeMapping != -1 && isset($line[$activeMapping]))\n {\n if($line[$activeMapping] == \"A\" || $line[$activeMapping] == \"N\")\n {\n $active = $line[$activeMapping];\n }\n }\n\n\n\t\t\t\t//only create objects, if 1 or more fields are set\n\t\t\t\tif(count($objectFields) > 0)\n\t\t\t\t{\n\t\t\t\t\t//check if assetID is set in CSV file for updating objects\n\t\t\t\t\tif($assetIdMapping != -1 && isset($line[$assetIdMapping]))\n\t\t\t\t\t{\n $assetId = $line[$assetIdMapping];\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$objectController->updateObject($assetId, $active, $objectFields, $this->authUser);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(Exception $e)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//if object was not found, add new one\n\t\t\t\t\t\t\t$objectController->addObject($optionType, $active, $objectFields, $this->authUser);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t//if not, create a new object\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t//generate object and save to datastore\n\t\t\t\t\t\t$objectController->addObject($optionType, $active, $objectFields, $this->authUser);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//increment counter\n\t\t\t$i++;\n\t\t}\n\n\t\t//check, if CSV file could be deleted\n\t\t$deleteFile = false;\n\t\tif(feof($csvFile))\n\t\t{\n\t\t\t$deleteFile = true;\n\t\t}\n\n\t\t//close file\n\t\tfclose($csvFile);\n\n\t\t//delete file from server\n\t\tif($deleteFile)\n\t\t{\n\t\t\tunlink($this->importFilename);\n\t\t}\n\n\t\t//return imported objects\n\t\treturn $i;\n\t}", "private function parseFields(): void\n {\n foreach ($this->reflect->getProperties() as $item) {\n $name = $item->getName();\n if (in_array($name, self::SKIP_FIELDS, true)) {\n continue;\n }\n\n $docblock = $item->getDocComment();\n $defType = $this->getFieldType($name, $docblock);\n $varType = $this->getVarType($name, $docblock);\n $isRequired = $this->isRequired($name, $docblock);\n $storage = &$this->fieldsBuffer[$defType];\n\n switch ($defType) {\n case self::FIELD_SIMPLE_TYPE:\n $storage[] = $this->processSimpleField($name, $varType, $isRequired);\n break;\n case self::FIELD_DATE_TYPE:\n $storage[] = $this->processDateField($name, $varType, $isRequired);\n break;\n case self::FIELD_MO_TYPE:\n $storage[] = $this->processManyToOneField($name, $varType, $isRequired);\n break;\n case self::FIELD_OM_TYPE:\n $storage[] = $this->processOneToManyField($name);\n break;\n }\n }\n\n unset($storage);\n }", "public function process() {\n\n\t\t\t/**\n\t\t\t * Decode all data from JSON\n\t\t\t *\n\t\t\t * @var array $data\n\t\t\t */\n\t\t\t$data = json_decode($this->getData(), true);\n\n\t\t\t/**\n\t\t\t * Get keys from first row of data set\n\t\t\t *\n\t\t\t * @var array $columNames\n\t\t\t */\n\t\t\t$columnNames = array_keys($data[0]);\n\n\t\t\t/**\n\t\t\t * Generate tablename from given columns\n\t\t\t *\n\t\t\t * @var string $tableName\n\t\t\t */\n\t\t\t$tableName = \"tmp_plista_api_\" . md5(implode($columnNames));\n\n\t\t\t/**\n\t\t\t * Building the query for creating the temporary Table\n\t\t\t * Note: This function does not fires a DROP TABLE. If the\n\t\t\t * table already exists the data gets filled in again. So the\n\t\t\t * client is responsible for droping the table after usage\n\t\t\t *\n\t\t\t * @var string $sql\n\t\t\t */\n\t\t\t$sql = \"CREATE TABLE IF NOT EXISTS `\" . $tableName . \"`\n\t\t\t(\" . implode( $columnNames, \" VARCHAR(255), \" ) . \" VARCHAR(255))\n\t\t\tENGINE=MEMORY\n\t\t\tDEFAULT CHARSET=utf8;\";\n\n\t\t\t/**\n\t\t\t * Build the query for inserting data into the temporary table\n\t\t\t *\n\t\t\t * @var string $sql\n\t\t\t */\n\t\t\tforeach ($data as $row) {\n\t\t\t\t$sql .= \"\\nINSERT INTO $tableName (\" . implode($columnNames, \", \") . \") VALUES ('\" . implode($row, \"', '\") . \"');\";\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * set the data\n\t\t\t */\n\t\t\t$this->setData(\n\t\t\t\tarray(\n\t\t\t\t\t\"table_name\"\t=> $tableName,\n\t\t\t\t\t\"query\"\t\t=> $sql\n\t\t\t\t)\n\t\t\t);\n\t\t}", "function erp_process_import_export() {\n if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), 'erp-import-export-nonce' ) ) {\n return;\n }\n\n $is_crm_activated = erp_is_module_active( 'crm' );\n $is_hrm_activated = erp_is_module_active( 'hrm' );\n\n $departments = $is_hrm_activated ? erp_hr_get_departments_dropdown_raw() : [];\n $designations = $is_hrm_activated ? erp_hr_get_designation_dropdown_raw() : [];\n\n $field_builder_contact_options = get_option( 'erp-contact-fields' );\n $field_builder_contacts_fields = [];\n\n if ( ! empty( $field_builder_contact_options ) ) {\n foreach ( $field_builder_contact_options as $field ) {\n $field_builder_contacts_fields[] = $field['name'];\n }\n }\n\n $field_builder_company_options = get_option( 'erp-company-fields' );\n $field_builder_companies_fields = [];\n\n if ( ! empty( $field_builder_company_options ) ) {\n foreach ( $field_builder_company_options as $field ) {\n $field_builder_companies_fields[] = $field['name'];\n }\n }\n\n $field_builder_employee_options = get_option( 'erp-employee-fields' );\n $field_builder_employees_fields = array();\n\n if ( ! empty( $field_builder_employee_options ) ) {\n foreach ( $field_builder_employee_options as $field ) {\n $field_builder_employees_fields[] = $field['name'];\n }\n }\n\n if ( isset( $_POST['erp_import_csv'] ) ) {\n define( 'ERP_IS_IMPORTING', true );\n\n $fields = ! empty( $_POST['fields'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['fields'] ) ) : [];\n $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : '';\n\n if ( empty( $type ) ) {\n return;\n }\n\n $csv_file = isset( $_FILES['csv_file'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_FILES['csv_file'] ) ) : [];\n\n $data = [ 'type' => $type, 'fields' => $fields, 'file' => $csv_file ];\n\n do_action( 'erp_tool_import_csv_action', $data );\n\n if ( ! in_array( $type, [ 'contact', 'company', 'employee' ] ) ) {\n return;\n }\n\n $employee_fields = [\n 'work' => [\n 'designation',\n 'department',\n 'location',\n 'hiring_source',\n 'hiring_date',\n 'date_of_birth',\n 'reporting_to',\n 'pay_rate',\n 'pay_type',\n 'type',\n 'status',\n ],\n 'personal' => [\n 'photo_id',\n 'user_id',\n 'first_name',\n 'middle_name',\n 'last_name',\n 'other_email',\n 'phone',\n 'work_phone',\n 'mobile',\n 'address',\n 'gender',\n 'marital_status',\n 'nationality',\n 'driving_license',\n 'hobbies',\n 'user_url',\n 'description',\n 'street_1',\n 'street_2',\n 'city',\n 'country',\n 'state',\n 'postal_code',\n ]\n ];\n\n require_once WPERP_INCLUDES . '/lib/parsecsv.lib.php';\n\n $csv = new ParseCsv();\n $csv->encoding( null, 'UTF-8' );\n $csv->parse( $csv_file['tmp_name'] );\n\n if ( empty( $csv->data ) ) {\n wp_redirect( admin_url( \"admin.php?page=erp-tools&tab=import\" ) );\n exit;\n }\n\n $csv_data = [];\n\n $csv_data[] = array_keys( $csv->data[0] );\n\n foreach ( $csv->data as $data_item ) {\n $csv_data[] = array_values( $data_item );\n }\n\n if ( ! empty( $csv_data ) ) {\n $count = 0;\n\n foreach ( $csv_data as $line ) {\n if ( empty( $line ) ) {\n continue;\n }\n\n $line_data = [];\n\n if ( is_array( $fields ) && ! empty( $fields ) ) {\n foreach ($fields as $key => $value) {\n\n if (!empty($line[$value]) && is_numeric($value)) {\n if ($type == 'employee') {\n if (in_array($key, $employee_fields['work'])) {\n if ($key == 'designation') {\n $line_data['work'][$key] = array_search($line[$value], $designations);\n } else if ($key == 'department') {\n $line_data['work'][$key] = array_search($line[$value], $departments);\n } else {\n $line_data['work'][$key] = $line[$value];\n }\n\n } else if (in_array($key, $employee_fields['personal'])) {\n $line_data['personal'][$key] = $line[$value];\n } else {\n $line_data[$key] = $line[$value];\n }\n } else {\n $line_data[$key] = isset($line[$value]) ? $line[$value] : '';\n $line_data['type'] = $type;\n }\n }\n }\n }\n\n if ( $type == 'employee' && $is_hrm_activated ) {\n if ( ! isset( $line_data['work']['status'] ) ) {\n $line_data['work']['status'] = 'active';\n }\n\n\n $item_insert_id = erp_hr_employee_create( $line_data );\n\n if ( is_wp_error( $item_insert_id ) ) {\n continue;\n }\n }\n\n if ( ( $type == 'contact' || $type == 'company' ) && $is_crm_activated ) {\n $contact_owner = isset( $_POST['contact_owner'] ) ? absint( $_POST['contact_owner'] ) : erp_crm_get_default_contact_owner();\n $line_data['contact_owner'] = $contact_owner;\n $people = erp_insert_people( $line_data, true );\n\n if ( is_wp_error( $people ) ) {\n continue;\n } else {\n $contact = new \\WeDevs\\ERP\\CRM\\Contact( absint( $people->id ), 'contact' );\n $life_stage = isset( $_POST['life_stage'] ) ? sanitize_key( $_POST['life_stage'] ) : '';\n\n if ( ! $people->exists ) {\n $contact->update_life_stage( $life_stage );\n\n } else {\n if ( ! $contact->get_life_stage() ) {\n $contact->update_life_stage( $life_stage );\n }\n }\n\n if ( ! empty( $_POST['contact_group'] ) ) {\n $contact_group = absint( $_POST['contact_group'] );\n\n $existing_data = \\WeDevs\\ERP\\CRM\\Models\\ContactSubscriber::where( [\n 'group_id' => $contact_group,\n 'user_id' => $people->id\n ] )->first();\n\n if ( empty( $existing_data ) ) {\n $hash = sha1( microtime() . 'erp-subscription-form' . $contact_group . $people->id );\n\n erp_crm_create_new_contact_subscriber( [\n 'group_id' => $contact_group,\n 'user_id' => $people->id,\n 'status' => 'subscribe',\n 'subscribe_at' => current_time( 'mysql' ),\n 'unsubscribe_at' => null,\n 'hash' => $hash\n ] );\n }\n }\n\n\n if ( ! empty( $field_builder_contacts_fields ) ) {\n foreach ( $field_builder_contacts_fields as $field ) {\n if ( isset( $line_data[ $field ] ) ) {\n erp_people_update_meta( $people->id, $field, $line_data[ $field ] );\n }\n }\n }\n }\n }\n\n ++ $count;\n }\n\n }\n\n wp_redirect( admin_url( \"admin.php?page=erp-tools&tab=import&imported=$count\" ) );\n exit;\n }\n\n if ( isset( $_POST['erp_export_csv'] ) ) {\n if ( ! empty( $_POST['type'] ) && ! empty( $_POST['fields'] ) ) {\n $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : '';\n $fields = array_map( 'sanitize_text_field', wp_unslash( $_POST['fields'] ) );\n\n if ( $type == 'employee' && $is_hrm_activated ) {\n $args = [\n 'number' => - 1,\n 'status' => 'all'\n ];\n\n $items = erp_hr_get_employees( $args );\n }\n\n if ( ( $type == 'contact' || $type == 'company' ) && $is_crm_activated ) {\n $args = [\n 'type' => $type,\n 'count' => true,\n ];\n $total_items = erp_get_peoples( $args );\n\n $args = [\n 'type' => $type,\n 'offset' => 0,\n 'number' => - 1,\n ];\n $items = erp_get_peoples( $args );\n }\n\n //@todo do_action()\n $csv_items = [];\n\n $x = 0;\n foreach ( $items as $item ) {\n\n if ( empty( $fields ) ) {\n continue;\n }\n\n foreach ( $fields as $field ) {\n if ( $type == 'employee' ) {\n\n if ( in_array( $field, $field_builder_employees_fields ) ) {\n $csv_items[ $x ][ $field ] = get_user_meta( $item->id, $field, true );\n } else {\n switch ( $field ) {\n case 'department':\n $csv_items[ $x ][ $field ] = $item->get_department_title();\n break;\n\n case 'designation':\n $csv_items[ $x ][ $field ] = $item->get_job_title();\n break;\n\n default:\n $csv_items[ $x ][ $field ] = $item->{$field};\n break;\n }\n }\n\n } else {\n if ( $type == 'contact' ) {\n if ( in_array( $field, $field_builder_contacts_fields ) ) {\n $csv_items[ $x ][ $field ] = erp_people_get_meta( $item->id, $field, true );\n } else {\n $csv_items[ $x ][ $field ] = $item->{$field};\n }\n }\n if ( $type == 'company' ) {\n if ( in_array( $field, $field_builder_companies_fields ) ) {\n $csv_items[ $x ][ $field ] = erp_people_get_meta( $item->id, $field, true );\n } else {\n $csv_items[ $x ][ $field ] = $item->{$field};\n }\n }\n }\n }\n\n $x ++;\n }\n\n $file_name = 'export_' . date( 'd_m_Y' ) . '.csv';\n\n erp_make_csv_file( $csv_items, $file_name );\n\n } else {\n wp_redirect( admin_url( \"admin.php?page=erp-tools&tab=export\" ) );\n exit();\n }\n }\n}", "public function import()\n {\n \n }", "public function getImportContent() {\n $this->loadTemplatePart('content-import');\n }", "protected abstract function generateParagraphTypeBaseFields(Row $row);" ]
[ "0.6050659", "0.601217", "0.59888643", "0.59820735", "0.5856395", "0.5741842", "0.57190835", "0.55667895", "0.55624694", "0.55112386", "0.55014026", "0.54888356", "0.54544675", "0.5453983", "0.54128957", "0.5410939", "0.5394443", "0.53521615", "0.533543", "0.5309772", "0.5283276", "0.52589464", "0.52425677", "0.5237593", "0.52152383", "0.52101606", "0.5202669", "0.5162076", "0.5147895", "0.5139805" ]
0.63890934
0
On first call creates as data_record record used to link data object with its content. On subsequent calls returns the previously created record.
protected function get_data_record($data) { if ($this->_data_record) { return $this->_data_record; } global $USER, $DB; $this->_data_record = new object(); $this->_data_record->id = null; $this->_data_record->userid = $USER->id; $this->_data_record->groupid = 0; $this->_data_record->dataid = $data->id; $this->_data_record->timecreated = $time = time(); $this->_data_record->timemodified = $time; $this->_data_record->approved = true; $this->_data_record->id = $DB->insert_record('data_records', $this->_data_record); return $this->_data_record->id ? $this->_data_record : false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addRecord()\n {\n $rec = new Record($this, true);\n $rec->markForInsert();\n $this->records[] = $rec;\n return $rec;\n }", "public function create($data)\n {\n try {\n $record = $this->model->create($data);\n } catch (\\Exception $e) {\n throw $e;\n }\n\n return $record;\n }", "public function createRecord();", "public function createRecord(array $data = array());", "public static function Create() {\r\n\t\t$cls = get_called_class();\r\n\t\t$model = new $cls();\r\n\t\t$record = new Dbi_Record($model, array());\r\n\t\treturn $record;\r\n\t}", "protected function _addData($recordData)\n {\n \t$result = array();\n \t\n \t\n \treturn $result;\n }", "public function createRecord(array $data);", "public function createData()\n {\n // TODO: Implement createData() method.\n }", "public function CopyRecord()\n {\n $rec = $this->GetActiveRecord();\n if (!$rec) return;\n foreach ($rec as $k=>$v)\n $rec[$k] = addslashes($v);\n global $g_BizSystem;\n // get new record array\n $recArr = $this->GetDataObj()->NewRecord();\n\n $rec[\"Id\"] = $recArr[\"Id\"]; // replace with new Id field. TODO: consider different ID generation type\n $this->m_RecordRow->SetRecordArr($rec);\n $ok = $this->GetDataObj()->InsertRecord($rec);\n if (!$ok)\n return $this->ProcessDataObjError($ok);\n return $this->ReRender();\n }", "public function getRecord() {}", "public function getRecord() {}", "public function getRecord() {}", "public function newRecord($data,$module=\"Leads\") {\r\n \r\n \r\n //if(count($data)&lt;=0)return \"\";\r\n $records = [];\r\n try{\r\n \r\n $record = ZCRMRecord::getInstance( $module, null );\r\n foreach($data as $d=>$v)\r\n $record->setFieldValue($d, $v);\r\n \r\n\r\n $records[] = $record;\r\n \r\n $zcrmModuleIns = ZCRMModule::getInstance($module);\r\n $bulkAPIResponse=$zcrmModuleIns->createRecords($records); // $recordsArray - array of ZCRMRecord instances filled with required data for creation.\r\n $entityResponses = $bulkAPIResponse->getEntityResponses();\r\n \r\n foreach($entityResponses as $entityResponse){\r\n if(\"success\"==$entityResponse->getStatus()){\r\n $createdRecordInstance=$entityResponse->getData();\r\n return $createdRecordInstance->getEntityId();\r\n \r\n }\r\n else{\r\n $file_names = __DIR__.\"/zoho_ERROR_ADDNEW_log.txt\";\r\n \t\t\t\t file_put_contents($file_names, (json_encode($entityResponses)).PHP_EOL , FILE_APPEND | LOCK_EX);\t\r\n \t\t\t\t return \"-1\";\r\n }\r\n }\r\n \r\n \r\n }catch(Exception $e){\r\n $file_names = __DIR__.\"/zoho_ERROR_ADDNEW_log.txt\";\r\n\t\t\t\t file_put_contents($file_names, $e.PHP_EOL , FILE_APPEND | LOCK_EX);\t\r\n return \"\";\r\n }\r\n \r\n \r\n }", "function appendDataForGetRecord( &$data ) {\n\n\t}", "public function createNewRecord() {\n try {\n // Define classes that we need to use.\n $phoneUtil = PhoneNumberUtil::getInstance();\n $phoneNumberCarrier = PhoneNumberToCarrierMapper::getInstance();\n // Define PhoneNumber instance.\n $phoneNumber = $phoneUtil->parse($this->number);\n // Check if phone number is valid.\n if ($phoneUtil->isValidNumber($phoneNumber)) {\n // Get phone number parameters.\n $countryCode = $phoneUtil->getRegionCodeForNumber($phoneNumber);\n $carrier = $phoneNumberCarrier->getNameForNumber($phoneNumber, $countryCode);\n $countryDialingCode = $phoneNumber->getCountryCode();\n $subscriberNumber = $phoneNumber->getNationalNumber();\n\n // We will return this data to the view.\n $data = [\n 'mno' => $carrier,\n 'country_dialing_code' => $countryDialingCode,\n 'subscriber_number' => $subscriberNumber,\n 'country_code' => $countryCode,\n ];\n\n // Save new record into database.\n $record = Records::create([\n 'phone_number' => $this->number,\n 'data' => json_encode($data),\n ]);\n\n return $record;\n }\n } catch (NumberParseException $e) {\n throw new NumberParseException($e, $e->getMessage());\n }\n }", "public function getRecord();", "public function createData($data){\n return $resultSet = $this->model->create($data);\n }", "public function getRecord()\n {\n return $this->get(self::_RECORD);\n }", "function &returnRecord()\n\t{\n\t\treturn $this->record;\n\t}", "public function create()\n {\n return new PersonData($this);\n }", "protected function buildNewRecordData()\n\t{\n\t\t// define temporary arrays. These are required for ASP conversion\n\t\t$evalues = array();\n\t\t$efilename_values = array();\n\t\t$blobfields = array();\n\t\t$keys = $this->keys;\n\t\t\n\t\t$newFields = array_intersect( $this->getpageFields(), $this->selectedFields );\n\t\tforeach($newFields as $f)\n\t\t{\n\t\t\t$control = $this->getControl( $f, $this->id );\n\t\t\t$control->readWebValue($evalues, $blobfields, NULL, NULL, $efilename_values);\n\t\t}\n\n\t\t$this->newRecordData = $evalues;\n\t\t$this->newRecordBlobFields = $blobfields;\n\t}", "public static function new_detail_record()\n\t{\n\t\treturn new league_record_detail();\n\t}", "public function create($data)\n {\n if (($id = $this->database->insert($this->getTableName(), $data)) !== false) {\n return $this->find($id);\n }\n }", "public function setDiaryRecordId($data)\n {\n $this->_DiaryRecordId=$data;\n return $this;\n }", "protected function createEntryRecord() {\n\n\t\t$lot = CqlixHistory::getInstance()->getEntryLotRecord();\n\t\t$modelName = $this->model->getTable()->getModelName();\n\n\t\treturn HistoryEntry::create(array(\n\t\t\t'history_id' => $this->historyRecord->getId(),\n\t\t\t'Lot' => $lot,\n\t\t\t'model' => $modelName,\n\t\t\t'model_id' => $this->model->getPrimaryKeyValue(),\n\t\t\t'operation' => $this->operation,\n\t\t));\n\t}", "protected function createEntity()\n {\n return (new LogRecord());\n }", "function v1_record_obj($key, $code, $data) {\n\t\n\tglobal $checked_data;\n\tglobal $xml_id_cnt;\n\t\n\tif (!isset($checked_data[$key])) {\n\t\t$checked_data[$key]=array();\n\t}\n\t\n\tif (!isset($checked_data[$key][$code])) {\n\t\t$checked_data[$key][$code]=array();\n\t}\n\t\n\t// XML ID\n\t$data['xml_id']=$xml_id_cnt;\n\t$xml_id_cnt++;\n\t\n\tarray_push($checked_data[$key][$code], $data);\n\t\n}", "public function NewRecord()\n {\n global $g_BizSystem;\n $this->SetDisplayMode(MODE_N);\n $recArr = $this->GetNewRecord();\n if (!$recArr)\n return $this->ProcessDataObjError();\n $this->UpdateActiveRecord($recArr);\n // TODO: popup message of new record successful created\n return $this->ReRender();\n }", "function add_a_record()\n {\n /**\n * @var str IP Address for the A record\n * @var int TTL for the A record\n * @var str Hostname for the A record\n * @var str Regex to Validate IPv4 Addresses\n */\n $ip = Null;\n $ttl = Null;\n $host = Null;\n $hnregex = \"/(([a-zA-Z0-9](-*[a-zA-Z0-9]+)*).)+\" . $this->domainnames[$this->domain_id]['name'] . \"/\";\n $shnregex = \"/^(([a-zA-Z0-9](-*[a-zA-Z0-9]+)*).)/\";\n while (!is_string($ip)) {\n $ip = filter_var(readline(\"IP Address: \"), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);\n }\n while (!is_int($ttl)) {\n $ttl = filter_var(readline(\"TTL [300]: \"), FILTER_VALIDATE_INT);\n $ttl = (!is_bool($ttl)) ? $ttl : 300;\n }\n while (!is_string($host)) {\n $hosttmp = readline(\"Hostname for new A record: \");\n if (filter_var($hosttmp, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $hnregex)))) {\n $host = $hosttmp;\n } elseif (filter_var($hosttmp, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $shnregex)))) {\n $host = filter_var($hosttmp . \".\" . $this->domainnames[$this->domain_id]['name'], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $hnregex)));\n }\n }\n\n foreach ($this->domains as $d) {\n if ($d->name == $this->domainnames[$this->domain_id]['name']){\n $domain = $d;\n }\n }\n\n $record = array(\n 'name' => $host,\n 'type' => 'A',\n 'ttl' => $ttl,\n 'data' => $ip);\n\n printf(\"\\nYou would like to add the following record:\\n\");\n printf(\"Type: %s\\n\", $record['type']);\n printf(\"Name: %s\\n\", $record['name']);\n printf(\"IP: %s\\n\", $record['data']);\n printf(\"TTL: %s\\n\", $record['ttl']);\n\n $proceed = readline(\"Type \\\"Y\\\" or \\\"y\\\" to proceed: \");\n\n if (strtolower($proceed) === 'y') {\n $hostentry = $domain->record($record);\n try {\n $response = $hostentry->create();\n printf(\"Created!\\n\");\n } catch (Exception $e) {\n printf(\"%s\\n\", $e);\n }\n } else {\n printf(\"ABORTED!\\n\");\n }\n }", "function CallerRecordLoad( &$data ) {\n\t\t$table = BIT_DB_PREFIX.\"task_caller\";\n\t\t\n\t\t$pDataHash['data_store']['caller_id'] = $data[0];\n\t\tif ( $data[1] == '[null]' )\n\t\t\t$pDataHash['data_store']['cltype'] = 0;\n\t\telse\n\t\t\t$pDataHash['data_store']['cltype'] = $data[1];\n\t\t$pDataHash['data_store']['title'] = $data[2];\n\t\t$pDataHash['data_store']['surname'] = $data[3];\n\t\t$pDataHash['data_store']['forename'] = $data[4];\n\t\t$pDataHash['data_store']['company'] = $data[5];\n\t\tif ( $data[6] == '[null]' )\n\t\t\t$pDataHash['data_store']['ni'] = '';\n\t\telse\n\t\t\t$pDataHash['data_store']['ni'] = $data[6];\n\t\tif ( $data[7] == '[null]' )\n\t\t\t$pDataHash['data_store']['hbis'] = '';\n\t\telse\n\t\t\t$pDataHash['data_store']['hbis'] = $data[7];\n\t\t$pDataHash['data_store']['address'] = $data[8];\n\t\t$pDataHash['data_store']['postcode'] = $data[9];\n\t\tif ( $data[10] != '[null]' ) $pDataHash['data_store']['lastvisit'] = $data[10];\n\t\tif ( $data[11] == '[null]' )\n\t\t\t$pDataHash['data_store']['specialneeds'] = '';\n\t\telse\n\t\t\t$pDataHash['data_store']['specialneeds'] = $data[11];\n\t\tif ( $data[12] == '[null]' )\n\t\t\t$pDataHash['data_store']['staff_id'] = 0;\n\t\telse\n\t\t\t$pDataHash['data_store']['staff_id'] = $data[12];\n\t\tif ( $data[13] == '[null]' )\n\t\t\t$pDataHash['data_store']['note'] = '';\n\t\telse\n\t\t\t$pDataHash['data_store']['note'] = $data[13];\n\t\tif ( $data[14] != '[null]' ) $pDataHash['data_store']['memo'] = $data[14];\n\t\tif ( $data[15] != '[null]' ) $pDataHash['data_store']['cllink'] = $data[15];\n\t\tif ( $data[16] == '[null]' )\n\t\t\t$pDataHash['data_store']['usn'] = 0;\n\t\telse\n\t\t\t$pDataHash['data_store']['usn'] = $data[16];\n\t\t$result = $this->mDb->associateInsert( $table, $pDataHash['data_store'] );\n\t}" ]
[ "0.6830509", "0.66752625", "0.65268564", "0.63946795", "0.6298123", "0.6273325", "0.61721206", "0.6119108", "0.6106025", "0.6050434", "0.6050434", "0.6048353", "0.6044807", "0.59401137", "0.59214187", "0.58682567", "0.5797092", "0.5792165", "0.57628447", "0.57008016", "0.5700288", "0.568659", "0.5638006", "0.5632575", "0.56048524", "0.5595621", "0.5595532", "0.5590561", "0.5549571", "0.5547602" ]
0.7404586
0
Method for importing a checkbox data cell.
protected function process_data_checkbox(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output_checkbox_row( string $label, string $key, bool $checked = false ): void {\n\twp_enqueue_style( 'wpinc-meta-field' );\n\t?>\n\t<div class=\"wpinc-meta-field-single checkbox\">\n\t\t<label>\n\t\t\t<span class=\"checkbox\"><input <?php name_id( $key ); ?> type=\"checkbox\" <?php echo esc_attr( $checked ? 'checked' : '' ); ?>></span>\n\t\t\t<span><?php echo esc_html( $label ); ?></span>\n\t\t</label>\n\t</div>\n\t<?php\n}", "function output_checkbox_row( string $label, string $key, bool $checked = false ): void {\n\t\t\\wpinc\\meta\\output_checkbox_row( $label, $key, $checked );\n\t}", "protected function process_header_checkbox(import_settings $settings, $data, $name, $description, $options) {\r\n $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options);\r\n return $result;\r\n }", "public static function convert_checkbox_field() {\n\n\t\t// Create a new Checkbox field.\n\t\tself::$field = new GF_Field_Checkbox();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add choices property.\n\t\tself::$field->choices = array();\n\n\t\t// Loop through field options.\n\t\tforeach ( self::$nf_field['list']['options'] as $i => $option ) {\n\n\t\t\t// Get checkbox ID.\n\t\t\t$id = $i + 1;\n\n\t\t\t// Skip multiple of 10 on checkbox ID.\n\t\t\tif ( 0 === $id % 10 ) {\n\t\t\t\t$id++;\n\t\t\t}\n\n\t\t\t// Add option choices.\n\t\t\tself::$field->choices[] = array(\n\t\t\t\t'text' => $option['label'],\n\t\t\t\t'value' => $option['value'],\n\t\t\t\t'isSelected' => $option['selected'],\n\t\t\t);\n\n\t\t\t// Add option input.\n\t\t\tself::$field->inputs[] = array(\n\t\t\t\t'id' => self::$field->id . '.' . $id,\n\t\t\t\t'label' => $option['label'],\n\t\t\t);\n\n\t\t}\n\n\t}", "public static function renderCheckbox();", "public function getDataCellContent($row)\n\t{\n\t\t$data=$this->grid->dataProvider->data[$row];\n\t\tif($this->value!==null)\n\t\t\t$value=$this->evaluateExpression($this->value,array('data'=>$data,'row'=>$row));\n\t\telseif($this->name!==null)\n\t\t\t$value=CHtml::value($data,$this->name);\n\t\telse\n\t\t\t$value=$this->grid->dataProvider->keys[$row];\n\n\t\t$checked = false;\n\t\tif($this->checked!==null)\n\t\t\t$checked=$this->evaluateExpression($this->checked,array('data'=>$data,'row'=>$row));\n\n\t\t$options=$this->checkBoxHtmlOptions;\n\t\tif($this->disabled!==null)\n\t\t\t$options['disabled']=$this->evaluateExpression($this->disabled,array('data'=>$data,'row'=>$row));\n\n\t\t$name=$options['name'];\n\t\tunset($options['name']);\n\t\t$options['value']=$value;\n\t\t$options['id']=$this->id.'_'.$row;\n\t\treturn CHtml::checkBox($name,$checked,$options);\n\t}", "abstract public function checkboxOnClick();", "public static function convert_single_checkbox_field() {\n\n\t\t// Create a new Checkbox field.\n\t\tself::$field = new GF_Field_Checkbox();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add choices property.\n\t\tself::$field->choices = array(\n\t\t\tarray(\n\t\t\t\t'text' => self::$nf_field['label'],\n\t\t\t\t'value' => '',\n\t\t\t\t'isSelected' => 'unchecked' === self::$nf_field['default_value'] ? '0' : '1',\n\t\t\t),\n\t\t);\n\n\t}", "public function getColumnCheckboxHtml() : string\n {\n return '<label class=\"kt-checkbox kt-checkbox--single kt-checkbox--all kt-checkbox--solid\">\n <input type=\"checkbox\" class=\"selected_data\" name=\"selected_data[]\" value=\"{{ $id }}\">\n <span></span>\n </label>';\n }", "function checkbox()\n {\n ?>\n <input type=\"hidden\" <?php $this->name_tag(); ?> value=\"0\" />\n <input type=\"checkbox\" <?php $this->name_tag(); ?> value=\"1\" class=\"inferno-setting\" <?php $this->id_tag('inferno-concrete-setting-'); if($this->setting_value) echo ' checked'; ?> />\n <label <?php $this->for_tag('inferno-concrete-setting-'); ?> data-true=\"<?php _e('On'); ?>\" data-false=\"<?php _e('Off'); ?>\"><?php if($this->setting_value) _e('On'); else _e('Off'); ?></label>\n <?php \n }", "public function convertCheckboxesToBool()\n\t{\n\t\t$this->convertCheckboxesToBool = true;\n\t}", "public function testCellsImportDataIntArray()\n {\n $book1 = \"Book1.xlsx\";\n $mydoc = \"myDocument.xlsx\";\n $ImportOption = \"ImportOption\";\n\n $data = new ImportIntArrayOption();\n $data->setDestinationWorksheet('Sheet1');\n $data->setFirstColumn(1);\n $data->setFirstRow(3);\n $data->setImportDataType('IntArray');\n $data->setIsVertical('true');\n $data->setData(array(1, 2, 3, 4)) ;\n $files = array (\n $mydoc => CellsApiTestBase::getfullfilename($mydoc),\n $book1 => CellsApiTestBase::getfullfilename($book1)\n );\n $result = $this->instance->postImport( $files, $data );\n // print( $result);\n $this->assertNotNull($result);\n }", "public function init()\n\t{\n\t\tif(isset($this->checkBoxHtmlOptions['name']))\n\t\t\t$name=$this->checkBoxHtmlOptions['name'];\n\t\telse\n\t\t{\n\t\t\t$name=$this->id;\n\t\t\tif(substr($name,-2)!=='[]')\n\t\t\t\t$name.='[]';\n\t\t\t$this->checkBoxHtmlOptions['name']=$name;\n\t\t}\n\t\t$name=strtr($name,array('['=>\"\\\\[\",']'=>\"\\\\]\"));\n\n\t\tif($this->selectableRows===null)\n\t\t{\n\t\t\tif(isset($this->checkBoxHtmlOptions['class']))\n\t\t\t\t$this->checkBoxHtmlOptions['class'].=' select-on-check';\n\t\t\telse\n\t\t\t\t$this->checkBoxHtmlOptions['class']='select-on-check';\n\t\t\treturn;\n\t\t}\n\n\t\t$cball=$cbcode='';\n\t\tif($this->selectableRows==0)\n\t\t{\n\t\t\t//.. read only\n\t\t\t$cbcode=\"return false;\";\n\t\t}\n\t\telseif($this->selectableRows==1)\n\t\t{\n\t\t\t//.. only one can be checked, uncheck all other\n\t\t\t$cbcode=\"jQuery(\\\"input:not(#\\\"+this.id+\\\")[name='$name']\\\").prop('checked',false);\";\n\t\t}\n\t\telseif(strpos($this->headerTemplate,'{item}')!==false)\n\t\t{\n\t\t\t//.. process check/uncheck all\n\t\t\t$cball=<<<CBALL\njQuery(document).on('click','#{$this->id}_all',function() {\n\tvar checked=this.checked;\n\tjQuery(\"input[name='$name']:enabled\").each(function() {this.checked=checked;});\n});\n\nCBALL;\n\t\t\t$cbcode=\"jQuery('#{$this->id}_all').prop('checked', jQuery(\\\"input[name='$name']\\\").length==jQuery(\\\"input[name='$name']:checked\\\").length);\";\n\t\t}\n\n\t\tif($cbcode!=='')\n\t\t{\n\t\t\t$js=$cball;\n\t\t\t$js.=<<<EOD\njQuery(document).on('click', \"input[name='$name']\", function() {\n\t$cbcode\n});\nEOD;\n\t\t\tYii::app()->getClientScript()->registerScript(__CLASS__.'#'.$this->id,$js);\n\t\t}\n\t}", "function import2ds() {\r\n $ok = 0;\r\n foreach ($this->properties as $colvar=>$col) {\r\n if (isset($_REQUEST['field'][$colvar]) and !isset($this->ds->$colvar)) { # i hazardously ignore action state (updatable, insertable...)\r\n # note: below hasbeen moved to import_suggest_field_to_ds()\r\n if ($this->action == 'new' and $col->parentkey) {# special case for detail-new, parent-linked field val only supplied by post as field[fieldname][0]=val. let's copied this to all indices\r\n $value = $_REQUEST['field'][$colvar][0];\r\n $this->ds->$colvar = array();\r\n for ($i=0; $i<$_REQUEST['num_row']; $i++) {\r\n $this->ds->{$colvar}[$i] = $value;\r\n }\r\n }\r\n else {\r\n $this->ds->$colvar = $_REQUEST['field'][$colvar];\r\n }\r\n $ok = 1;\r\n }\r\n elseif ($col->inputtype == 'checkbox' and !isset($_REQUEST['field'][$colvar][$i]) and !isset($this->ds->$colvar)) {\r\n # special case for checkbox. unchecked checkboxes do not generate empty key/val. so depending whether this is group checkboxes or single checkbox, we initialize it to correct value.\r\n # if we dont explicitly say its value is (ie, value=0), and the previous value in db is 1, then checkbox would never be saved as unchecked, since populate will passess current value in db.\r\n if ($col->enumerate != '') {\r\n $value = array(); # assign it to empty array. TODO: should test this.\r\n }\r\n else {\r\n $value = 0; # BOOLEAN 0/1\r\n }\r\n $this->ds->$colvar = array();\r\n for ($i=0; $i<$_REQUEST['num_row']; $i++) {\r\n $this->ds->{$colvar}[$i] = $value;\r\n }\r\n $ok = 1;\r\n }\r\n else {\r\n #~ echo 'not ok';\r\n }\r\n }\r\n\r\n $this->db_count = $ok;\r\n }", "function acf_get_checkbox_input($attrs = array())\n{\n}", "function column_cb( $item ) {\r\n\t\treturn sprintf( '<input type=\"checkbox\" id=\"cb-select-%2$s\" name=\"cb_%1$s[]\" value=\"%2$s\" />',\r\n\t\t/*%1$s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label (\"attachment\")\r\n\t\t/*%2$s*/ $item->ID //The value of the checkbox should be the object's id\r\n\t\t);\r\n\t}", "public function importxls()\n\t{\n\t\tif( $this->import_start() )\n\t\t{\n\t\t\t$xls\t\t= $this->file['tmp_name'];\n\t\t\t$objPHPExcel\t= PHPExcel_IOFactory::load($xls);\n\t\t\t$sht\t\t= $objPHPExcel->getActiveSheet();\n\n\t\t\t$highestColumm\t= $sht->getHighestDataColumn();\n\t\t\t$highestRow\t= $sht->getHighestDataRow();\n\t\t\t$range\t\t= \"A1:\".$highestColumm.$highestRow;\n\n\t\t\t$rows\t\t= $sht->rangeToArray($range);\n\t\t\t$model\t\t= $this->getModel('HelloImport');\t\t//for db read/write\n\t\t\t$this->ok\t= $model->importItems($rows);\n\t\t}\n\t\t$this->import_finish();\n\t\treturn;\n\t}", "public function importData(){\n $status = false;\n\n // rtrim(); for arrays (removes empty values) from the end\n $rtrim = function($array = [], $lengthMin = false){\n $length = key(array_reverse(array_diff($array, ['']), 1))+1;\n $length = $length < $lengthMin ? $lengthMin : $length;\n return array_slice($array, 0, $length);\n };\n\n if(static::$enableDataImport){\n $filePath = $this->getF3()->get('EXPORT') . 'csv/' . $this->getTable() . '.csv';\n\n if(is_file($filePath)){\n $handle = @fopen($filePath, 'r');\n $keys = array_map('lcfirst', fgetcsv($handle, 0, ';'));\n $keys = $rtrim($keys);\n\n if(count($keys) > 0){\n $tableData = [];\n while (!feof($handle)) {\n $tableData[] = array_combine($keys, $rtrim(fgetcsv($handle, 0, ';'), count($keys)));\n }\n // import row data\n $status = $this->importStaticData($tableData);\n $this->getF3()->status(202);\n }else{\n $this->getF3()->error(500, 'File could not be read');\n }\n }else{\n $this->getF3()->error(404, 'File not found: ' . $filePath);\n }\n }\n\n return $status;\n }", "function checkbox ($params) {\n\t\tif (!$params['id']) $params['id'] = $params['name'];\n if (!$params['y_value']) $params['y_value'] = 1;\n if (!$params['n_value']) $params['n_value'] = 0;\n?>\n\t\t<input type=\"hidden\" name=\"<?=$params['name']?>\" value=\"<?=$params['n_value']?>\" />\n\t\t<input\n\t\t\ttype=\"checkbox\" \n\t\t\tname=\"<?=$params['name']?>\" \n\t\t\tvalue=\"<?=$params['y_value']?>\"\n\t\t\tid=\"<?=$params['id']?>\" \n\t\t\tonclick=\"<?=$params['onclick']?>\"\n\t\t\t<? if ($params['checked']) echo 'checked=\"checked\"'; ?> \n\t\t\t<? if ($params['disabled']) echo 'disabled=\"disabled\"'; ?> \n\t\t\tstyle=\"display:inline;\"\n\t\t/>\n\t\t<label for=\"<?=$params['id']?>\" class=\"checkbox-label\"><?=$params['label']?></label>\n\t\t\n<?\n\t}", "public function import()\n\t{\n\t\tinclude APPPATH . 'third_party/PHPExcel/PHPExcel.php';\n\n\t\t$excelreader = new PHPExcel_Reader_Excel2007();\n\t\t$loadexcel = $excelreader->load('excel/' . $this->filename . '.xlsx'); // Load file yang telah diupload ke folder excel\n\t\t$sheet = $loadexcel->getActiveSheet()->toArray(null, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);\n\n\t\t// Buat sebuah variabel array untuk menampung array data yg akan kita insert ke database\n\t\t$data = array();\n\n\t\t$numrow = 3;\n\t\t$kosong = 0;\n\t\tforeach ($sheet as $row) {\n\t\t\t// Cek $numrow apakah lebih dari 1\n\t\t\t// Artinya karena baris pertama adalah nama-nama kolom\n\t\t\t// Jadi dilewat saja, tidak usah diimport\n\t\t\tif ($numrow > 3) {\n\t\t\t\t// Kita push (add) array data ke variabel data\n\t\t\t\tarray_push($data, array(\n\t\t\t\t\t'cabang' => $row['B'],\n\t\t\t\t\t'temuan' => $row['C'],\n\t\t\t\t\t'nilai_amanah' => $row['D'],\n\t\t\t\t\t'level' => $row['E'],\n\t\t\t\t\t'tingkat' => $row['F'],\n\t\t\t\t\t'avail' => $row['G'],\n\t\t\t\t\t'util' => $row['H'],\n\t\t\t\t\t'nilai_kompeten' => $row['I'],\n\t\t\t\t\t'kaloborasi' => $row['J'],\n\t\t\t\t\t'nilai_harmonis' => $row['K'],\n\t\t\t\t\t'revenue' => $row['L'],\n\t\t\t\t\t'efisiensi' => $row['M'],\n\t\t\t\t\t'nilai_loyal' => $row['N'],\n\t\t\t\t\t'koreksi' => $row['O'],\n\t\t\t\t\t'modul' => $row['P'],\n\t\t\t\t\t'nilai_adaptif' => $row['Q'],\n\t\t\t\t\t'realisasi_kpi' => $row['R'],\n\t\t\t\t\t'realisasi_pkm' => $row['S'],\n\t\t\t\t\t'nilai_kolab' => $row['T'],\n\t\t\t\t\t'nilai_total' => $row['U'],\n\t\t\t\t));\n\t\t\t}\n\n\t\t\t$numrow++; // Tambah 1 setiap kali looping\n\t\t}\n\n\t\t// Panggil fungsi insert_multiple yg telah kita buat sebelumnya di model\n\t\t$this->RaporModel->insert_multiple($data);\n\n\t\tredirect(\"/rapor\"); // Redirect ke halaman awal (ke controller rapor fungsi index)\n\t}", "function checkbox($args) {\r\n\t\t$args = $this->apply_default_args($args) ;\r\n\t\techo \"<input name='$this->options_name[\" . $args['id'] . \"]' type='checkbox' value='1' \";\r\n\t\tchecked('1', $this->options[$args['id']]); \r\n\t\techo \" /> <span class='description'>\" . $args['description'] . \"</span>\" ;\r\n\t\t\r\n\t}", "function setTypeAsCheckbox($labeltext = false)\n\t{\n\t\t$this->type = \"checkbox\";\n\t\t$this->checkbox_label = $labeltext;\n\t\t\n\t\t// Formfield doesn't work if a checkbox\n\t\t$this->isformfield = false;\n\t}", "function checkbox( \n\t $name, $title, $value = null, \n\t $required = false, \n\t $attributes = null,\n\t $options = array(),\n\t $datatype = Form::DATA_STRING\n\t){\n return $this->input(\n\t $name, \n\t Form::TYPE_CHECKBOX,\n\t $title, \n\t $value, \n\t $required, \n\t $attributes,\n\t $options,\n\t $datatype\n );\n\t}", "function column_cb($item){\n return sprintf(\n '<input type=\"checkbox\" name=\"%1$s[]\" value=\"%2$s\" />',\n /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label (\"listing\")\n /*$2%s*/ $item['id'] \t\t\t//The value of the checkbox should be the record's id\n );\n }", "public function AddCheckboxToComment()\n\t{\n\t\t$checked = get_option($this->GrOptionDbPrefix . 'comment_checked');\n\t\t?>\n\t\t<p>\n\t\t\t<input class=\"GR_checkbox\" value=\"1\" id=\"gr_comment_checkbox\" type=\"checkbox\" name=\"gr_comment_checkbox\"\n\t\t\t\t <?php if ($checked)\n\t\t\t\t { ?>checked=\"checked\"<?php } ?>/>\n\t\t\t<?php echo get_option($this->GrOptionDbPrefix . 'comment_label'); ?>\n\t\t</p><br/>\n\t\t<?php\n\t}", "function deleteData()\n{\n global $myDataGrid;\n global $f;\n global $tbl;\n $arrKeys = [];\n foreach ($myDataGrid->checkboxes as $strValue) {\n $arrKeys['id'][] = $strValue;\n }\n if ($tbl->deleteMultiple($arrKeys)) {\n $myDataGrid->message = $tbl->strMessage;\n $f->setValues('step', getDataListRecruitmentProcessTypeStep(null, true));\n } else {\n $myDataGrid->errorMessage = \"Failed to delete data \" . $tbl->strEntityName;\n }\n}", "function checkboxes(){\n if($this->ChkReal->Checked){\n $this->avance_real = 'Si';\n }else{\n $this->avance_real = 'No';\n }\n if($this->ChkProg->Checked){\n $this->avance_prog = 'Si';\n }else{\n $this->avance_prog = 'No';\n }\n if($this->ChkComent->Checked){\n $this->comentario = 'Si';\n }else{\n $this->comentario = 'No';\n }\n if($this->ChkPermiso->Checked){\n $this->permiso = 'Si';\n }else{\n $this->permiso = 'No';\n }\n if($this->ChkTipoA->Checked){\n $this->tipo_admon = 'Si';\n }else{\n $this->tipo_admon = 'No';\n }\n }", "function column_cb($item){\n return sprintf(\n '<input type=\"checkbox\" name=\"%1$s[]\" value=\"%2$s\" />',\n /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label (\"movie\")\n /*$2%s*/ $item['ID'] //The value of the checkbox should be the record's id\n );\n }", "function setTypeAsCheckboxList($itemList) {\n\t\t$this->type = \"checkboxlist\";\n\t\t$this->seleu_itemlist = $itemList;\n\t}", "function loadImportingData()\r\n\t{\r\n\t\treturn true;\r\n\t}" ]
[ "0.55346096", "0.5344551", "0.5191674", "0.51886994", "0.518288", "0.5171274", "0.51545525", "0.50641865", "0.5053339", "0.50150746", "0.5008626", "0.48653644", "0.48485696", "0.4838679", "0.4827591", "0.48134705", "0.48091918", "0.48020542", "0.48018435", "0.47888786", "0.4782507", "0.4781474", "0.477534", "0.4767205", "0.47431844", "0.46987894", "0.46894133", "0.46795645", "0.46786076", "0.46665367" ]
0.55580056
0
Method for importing a number data cell.
protected function process_data_number(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testCellsImportDataIntArray()\n {\n $book1 = \"Book1.xlsx\";\n $mydoc = \"myDocument.xlsx\";\n $ImportOption = \"ImportOption\";\n\n $data = new ImportIntArrayOption();\n $data->setDestinationWorksheet('Sheet1');\n $data->setFirstColumn(1);\n $data->setFirstRow(3);\n $data->setImportDataType('IntArray');\n $data->setIsVertical('true');\n $data->setData(array(1, 2, 3, 4)) ;\n $files = array (\n $mydoc => CellsApiTestBase::getfullfilename($mydoc),\n $book1 => CellsApiTestBase::getfullfilename($book1)\n );\n $result = $this->instance->postImport( $files, $data );\n // print( $result);\n $this->assertNotNull($result);\n }", "public function getNumber() {}", "public function getNumber();", "public function onSetCellData( $cellNumber, $data )\n\t{\n\t\t$this->objPHPExcel->getActiveSheet()->setcellValue( $cellNumber, $data );\n\t}", "function _putBaseNumber(&$pdf, $font, $data, $x, $y, $widthCell, $heightCell, $align, $size, $margin = 1.6) {\n $data = number_format($data);\n\n $step = 0;\n for ($i = strlen($data) - 1; $i >= 0; $i--) {\n $element = mb_substr($data, $i, 1, 'utf-8');\n if ($element == '-') {\n $element = '△';\n $size = $size - 2;\n $y = $y + 0.5;\n }\n $pdf->SetFont($font, null, $size, true);\n $pdf->SetXY($x - $step, $y);\n $pdf->MultiCell($widthCell, 5, $element, 0, $align);\n $step += $margin;\n }\n }", "public function getNumber()\n {\n return $this->getData(self::NUMBER);\n }", "function import(array $data);", "public function testNumberToExcellColumnFormat()\n {\n $numberFormatter = new NumberFormatService();\n $z = $numberFormatter->toExcelColumnFormat(26);\n $aa = $numberFormatter->toExcelColumnFormat(27);\n $abb = $numberFormatter->toExcelColumnFormat(730);\n\n $this->assertEquals('Z', $z);\n $this->assertEquals('AA', $aa);\n $this->assertEquals('ABB', $abb);\n }", "public function numberFormatDataProvider() {}", "function gmp_import($data)\n {\n return gmp_init(bin2hex($data), 16);\n }", "public function importFrom(array $data);", "private function _readNumber($subData)\n\t{\n\t\t$rknumhigh = $this->_GetInt4d($subData, 4);\n\t\t$rknumlow = $this->_GetInt4d($subData, 0);\n\t\t$sign = ($rknumhigh & 0x80000000) >> 31;\n\t\t$exp = ($rknumhigh & 0x7ff00000) >> 20;\n\t\t$mantissa = (0x100000 | ($rknumhigh & 0x000fffff));\n\t\t$mantissalow1 = ($rknumlow & 0x80000000) >> 31;\n\t\t$mantissalow2 = ($rknumlow & 0x7fffffff);\n\t\t$value = $mantissa / pow( 2 , (20- ($exp - 1023)));\n\n\t\tif ($mantissalow1 != 0) {\n\t\t\t$value += 1 / pow (2 , (21 - ($exp - 1023)));\n\t\t}\n\n\t\t$value += $mantissalow2 / pow (2 , (52 - ($exp - 1023)));\n\t\tif ($sign) {\n\t\t\t$value = -1 * $value;\n\t\t}\n\n\t\treturn\t$value;\n\t}", "public function triggerNum($num, $data){}", "public function setNumber($var)\n {\n GPBUtil::checkInt32($var);\n $this->number = $var;\n }", "public function fnReadNumber($bStartsWithDot) \n {\n $iStart = $this->iPos;\n if (!$bStartsWithDot && $this->fnReadInt(10) === null) \n $this->fnRaise($iStart, \"Invalid number\");\n $bOctal = ($this->iPos - $iStart) >= 2\n && Utilities::fnGetCharAt($this->sInput, $iStart) == 48;\n if ($bOctal && $this->bStrict) \n $this->fnRaise($iStart, \"Invalid number\");\n if ($bOctal \n && preg_match(\n \"/[89]/\", \n mb_substr(\n $this->sInput, \n $iStart, \n $this->iPos - $iStart\n )\n )\n ) \n $bOctal = false;\n $iNext = Utilities::fnGetCharAt($this->sInput, $this->iPos);\n if ($iNext == 46 && !$bOctal) { // '.'\n ++$this->iPos;\n $this->fnReadInt(10);\n $iNext = Utilities::fnGetCharAt($this->sInput, $this->iPos);\n }\n if (($iNext == 69 || $iNext == 101) && !$bOctal) { // 'eE'\n $iNext = Utilities::fnGetCharAt($this->sInput, ++$this->iPos);\n if ($iNext == 43 || $iNext == 45) \n ++$this->iPos; // '+-'\n if ($this->fnReadInt(10) === null) \n $this->fnRaise($iStart, \"Invalid number\");\n }\n if (Identifier::fnIsIdentifierStart($this->fnFullCharCodeAtPos())) \n $this->fnRaise($this->iPos, \"Identifier directly after number\");\n\n $sStr = mb_substr($this->sInput, $iStart, $this->iPos - $iStart);\n $iVal = $bOctal ? intval($sStr, 8) : floatval($sStr);\n return $this->fnFinishToken(TokenTypes::$aTypes['num'], $iVal);\n }", "private function readDigits()\n {\n }", "public function import()\n\t{\n\t\tinclude APPPATH . 'third_party/PHPExcel/PHPExcel.php';\n\n\t\t$excelreader = new PHPExcel_Reader_Excel2007();\n\t\t$loadexcel = $excelreader->load('excel/' . $this->filename . '.xlsx'); // Load file yang telah diupload ke folder excel\n\t\t$sheet = $loadexcel->getActiveSheet()->toArray(null, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);\n\n\t\t// Buat sebuah variabel array untuk menampung array data yg akan kita insert ke database\n\t\t$data = array();\n\n\t\t$numrow = 3;\n\t\t$kosong = 0;\n\t\tforeach ($sheet as $row) {\n\t\t\t// Cek $numrow apakah lebih dari 1\n\t\t\t// Artinya karena baris pertama adalah nama-nama kolom\n\t\t\t// Jadi dilewat saja, tidak usah diimport\n\t\t\tif ($numrow > 3) {\n\t\t\t\t// Kita push (add) array data ke variabel data\n\t\t\t\tarray_push($data, array(\n\t\t\t\t\t'cabang' => $row['B'],\n\t\t\t\t\t'temuan' => $row['C'],\n\t\t\t\t\t'nilai_amanah' => $row['D'],\n\t\t\t\t\t'level' => $row['E'],\n\t\t\t\t\t'tingkat' => $row['F'],\n\t\t\t\t\t'avail' => $row['G'],\n\t\t\t\t\t'util' => $row['H'],\n\t\t\t\t\t'nilai_kompeten' => $row['I'],\n\t\t\t\t\t'kaloborasi' => $row['J'],\n\t\t\t\t\t'nilai_harmonis' => $row['K'],\n\t\t\t\t\t'revenue' => $row['L'],\n\t\t\t\t\t'efisiensi' => $row['M'],\n\t\t\t\t\t'nilai_loyal' => $row['N'],\n\t\t\t\t\t'koreksi' => $row['O'],\n\t\t\t\t\t'modul' => $row['P'],\n\t\t\t\t\t'nilai_adaptif' => $row['Q'],\n\t\t\t\t\t'realisasi_kpi' => $row['R'],\n\t\t\t\t\t'realisasi_pkm' => $row['S'],\n\t\t\t\t\t'nilai_kolab' => $row['T'],\n\t\t\t\t\t'nilai_total' => $row['U'],\n\t\t\t\t));\n\t\t\t}\n\n\t\t\t$numrow++; // Tambah 1 setiap kali looping\n\t\t}\n\n\t\t// Panggil fungsi insert_multiple yg telah kita buat sebelumnya di model\n\t\t$this->RaporModel->insert_multiple($data);\n\n\t\tredirect(\"/rapor\"); // Redirect ke halaman awal (ke controller rapor fungsi index)\n\t}", "public function importxls()\n\t{\n\t\tif( $this->import_start() )\n\t\t{\n\t\t\t$xls\t\t= $this->file['tmp_name'];\n\t\t\t$objPHPExcel\t= PHPExcel_IOFactory::load($xls);\n\t\t\t$sht\t\t= $objPHPExcel->getActiveSheet();\n\n\t\t\t$highestColumm\t= $sht->getHighestDataColumn();\n\t\t\t$highestRow\t= $sht->getHighestDataRow();\n\t\t\t$range\t\t= \"A1:\".$highestColumm.$highestRow;\n\n\t\t\t$rows\t\t= $sht->rangeToArray($range);\n\t\t\t$model\t\t= $this->getModel('HelloImport');\t\t//for db read/write\n\t\t\t$this->ok\t= $model->importItems($rows);\n\t\t}\n\t\t$this->import_finish();\n\t\treturn;\n\t}", "public function import(array $data): void;", "function _putIntNumber(&$pdf, $x, $y, $data, $distance, $align, $margin1) {\n\t\t$data = strval($data);\n $step = 0;\n for ($i = strlen($data) - 1; $i >= 0; $i--) {\n $element = mb_substr($data, $i, 1, 'utf-8');\n if ($element == '-') {\n $element = '△';\n $pdf->SetXY($x - $step + $margin1, $y);\n } else {\n $pdf->SetXY($x - $step, $y);\n }\n $pdf->MultiCell(10, 5, $element, 0, $align);\n $step += $distance;\n }\n }", "private function writeNumber($row, $col, $num, $xfIndex)\n {\n $record = 0x0203; // Record identifier\n $length = 0x000E; // Number of bytes to follow\n\n $header = pack('vv', $record, $length);\n $data = pack('vvv', $row, $col, $xfIndex);\n $xl_double = pack('d', $num);\n if (self::getByteOrder()) { // if it's Big Endian\n $xl_double = strrev($xl_double);\n }\n\n $this->append($header . $data . $xl_double);\n\n return 0;\n }", "public function setNumber($number);", "public function testUnsupportedDataAlphaToNumber()\n {\n // Input text parameters\n $input_alphabet = \"A2\";\n $expected_result = -20;\n\n // Execute test target\n $Response = Utility::alpha2num($input_alphabet);\n\n // Check result\n $this->assertEquals($expected_result, $Response);\n }", "public function getNumericData($number){\n\t\tif(is_numeric($number)){\n\t \t$validNumber= floatval($number);\n\t }\n\t\telse {\n\t\t\t$validNumber= FALSE;\n\t\t}\n\t\treturn $validNumber;\n }", "protected function process_header_number(import_settings $settings, $data, $name, $description, $options) {\r\n $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options);\r\n return $result;\r\n }", "public function setNumber($val)\n {\n $this->_propDict[\"number\"] = $val;\n return $this;\n }", "public function setNumericCode($numericCode);", "public function getNumber()\n {\n return $this->number;\n }", "public static function convert_number_field() {\n\n\t\t// Create a new Number field.\n\t\tself::$field = new GF_Field_Number();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add Number specific properties.\n\t\tself::$field->rangeMin = rgar( self::$nf_field, 'number_min' );\n\t\tself::$field->rangeMax = rgar( self::$nf_field, 'number_max' );\n\n\t\t// Add currency property if needed.\n\t\tif ( rgar( self::$nf_field, 'mask' ) && 'currency' === self::$nf_field['mask'] ) {\n\t\t\tself::$field->numberFormat = 'currency';\n\t\t}\n\n\t}", "public function get_number()\n\t{\n\t\treturn $this->number;\n\t}" ]
[ "0.5837573", "0.53284067", "0.52543306", "0.5202485", "0.5182147", "0.51563007", "0.5153926", "0.5122473", "0.5105191", "0.5067507", "0.5045524", "0.50338566", "0.5031159", "0.5026738", "0.50197023", "0.50055516", "0.4991452", "0.49911588", "0.49648672", "0.4929456", "0.49221638", "0.48724565", "0.48137578", "0.47739545", "0.4753525", "0.47328532", "0.47281843", "0.47176793", "0.47093266", "0.4701018" ]
0.5444547
1
Method for importing a radiobutton data cell.
protected function process_data_radiobutton(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function process_header_radiobutton(import_settings $settings, $data, $name, $description, $options) {\r\n $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options);\r\n return $result;\r\n }", "public function import()\n\t{\n\t\tinclude APPPATH . 'third_party/PHPExcel/PHPExcel.php';\n\n\t\t$excelreader = new PHPExcel_Reader_Excel2007();\n\t\t$loadexcel = $excelreader->load('excel/' . $this->filename . '.xlsx'); // Load file yang telah diupload ke folder excel\n\t\t$sheet = $loadexcel->getActiveSheet()->toArray(null, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);\n\n\t\t// Buat sebuah variabel array untuk menampung array data yg akan kita insert ke database\n\t\t$data = array();\n\n\t\t$numrow = 3;\n\t\t$kosong = 0;\n\t\tforeach ($sheet as $row) {\n\t\t\t// Cek $numrow apakah lebih dari 1\n\t\t\t// Artinya karena baris pertama adalah nama-nama kolom\n\t\t\t// Jadi dilewat saja, tidak usah diimport\n\t\t\tif ($numrow > 3) {\n\t\t\t\t// Kita push (add) array data ke variabel data\n\t\t\t\tarray_push($data, array(\n\t\t\t\t\t'cabang' => $row['B'],\n\t\t\t\t\t'temuan' => $row['C'],\n\t\t\t\t\t'nilai_amanah' => $row['D'],\n\t\t\t\t\t'level' => $row['E'],\n\t\t\t\t\t'tingkat' => $row['F'],\n\t\t\t\t\t'avail' => $row['G'],\n\t\t\t\t\t'util' => $row['H'],\n\t\t\t\t\t'nilai_kompeten' => $row['I'],\n\t\t\t\t\t'kaloborasi' => $row['J'],\n\t\t\t\t\t'nilai_harmonis' => $row['K'],\n\t\t\t\t\t'revenue' => $row['L'],\n\t\t\t\t\t'efisiensi' => $row['M'],\n\t\t\t\t\t'nilai_loyal' => $row['N'],\n\t\t\t\t\t'koreksi' => $row['O'],\n\t\t\t\t\t'modul' => $row['P'],\n\t\t\t\t\t'nilai_adaptif' => $row['Q'],\n\t\t\t\t\t'realisasi_kpi' => $row['R'],\n\t\t\t\t\t'realisasi_pkm' => $row['S'],\n\t\t\t\t\t'nilai_kolab' => $row['T'],\n\t\t\t\t\t'nilai_total' => $row['U'],\n\t\t\t\t));\n\t\t\t}\n\n\t\t\t$numrow++; // Tambah 1 setiap kali looping\n\t\t}\n\n\t\t// Panggil fungsi insert_multiple yg telah kita buat sebelumnya di model\n\t\t$this->RaporModel->insert_multiple($data);\n\n\t\tredirect(\"/rapor\"); // Redirect ke halaman awal (ke controller rapor fungsi index)\n\t}", "public function import_file(){\n\t\t$this->load->model(\"payment/M_pa_payment\",\"payment\");\n\t\t\n\t\t$this->data[\"rs_year_exam\"] = $this->payment->get_year_exam();\n\t\t\n\t\t$this->output(\"Payment/v_import_excel\",$this->data);\n\t}", "public function import(){\n include APPPATH.'third_party/PHPExcel.php';\n \n $excelreader = new PHPExcel_Reader_Excel2007();\n $loadexcel = $excelreader->load('uploads/'.$this->filename.'.xlsx'); /* Load file yang telah diupload ke folder excel */\n $sheet = $loadexcel->getActiveSheet()->toArray(null, true, true ,true);\n \n /* Buat sebuah variabel array untuk menampung array data yg akan kita insert ke database */\n $data = array();\n \n $numrow = 1;\n foreach($sheet as $row){\n\n /* ----------------------------------------------\n * Cek $numrow apakah lebih dari 1\n * Artinya karena baris pertama adalah nama-nama kolom\n * Jadi dilewat saja, tidak usah diimport\n * ----------------------------------------------\n */\n\n if($numrow > 1){\n \n /* Kita push (add) array data ke variabel data */\n array_push($data, array(\n 'id_siswa' => '',\n 'nis'=>$row['A'],\n 'nisn'=>$row['B'],\n 'nama_siswa'=>$row['C'],\n 'j_kelamin'=>$row['D'],\n 'temp_lahir'=>$row['E'],\n 'tgl_lahir'=>$row['F'],\n 'kd_agama'=>$row['G'],\n 'status_keluarga'=>$row['H'],\n 'anak_ke'=>$row['I'],\n 'alamat'=>$row['J'],\n 'telp'=>$row['K'],\n 'asal_sekolah'=>$row['L'],\n 'kelas_diterima'=>$row['M'],\n 'tgl_diterima'=>$row['N'],\n 'nama_ayah'=>$row['O'],\n 'nama_ibu'=>$row['P'],\n 'alamat_orangtua'=>$row['Q'],\n 'tlp_ortu'=>$row['R'],\n 'pekerjaan_ayah'=>$row['S'],\n 'pekerjaan_ibu'=>$row['T'],\n 'nama_wali'=>$row['U'],\n 'alamat_wali'=>$row['V'],\n 'telp_wali'=>$row['W'],\n 'pekerjaan_wali'=>$row['X'],\n 'id_kelas' =>$row['Y']\n ));\n }\n \n $numrow++; // Tambah 1 setiap kali looping\n }\n\n $this->Mdl_siswa->insert_multiple($data);\n \n redirect(\"siswa\");\n }", "protected static function radio()\n {\n }", "public function actionImport()\n {\n $model = new UploadExcelForm();\n\n if (Yii::$app->request->isPost) {\n $post_data = Yii::$app->request->post();\n\n if (!empty($post_data['file_path'])) {\n $model->file_path = $post_data['file_path']; //! unsafe data need filter\n \n // save uploaded file\n $data_arr = $model->processExcel();\n $parse_result = $this->processData($data_arr, true);\n } else {\n $model->excel_file = UploadedFile::getInstance($model, 'excel_file');\n\n if (!$model->upload()) {\n \\Yii::$app->response->format = \\yii\\web\\Response::FORMAT_JSON;\n return [\n 'success' => false,\n 'errors' => $model->getErrors()\n ];\n }\n\n // process uploaded file\n $data_arr = $model->processExcel();\n $parse_result = $this->processData($data_arr, false);\n }\n\n \\Yii::$app->response->format = \\yii\\web\\Response::FORMAT_JSON;\n return [\n 'success' => true,\n 'data' => [\n 'file_path' => $model->file_path,\n 'parse_result' => $parse_result,\n ]\n ];\n }\n\n // import data from excel file\n return $this->render('import', [\n 'model' => $model\n ]);\n }", "public function import()\n {\n return !empty($this->configs['rows_edit']) && $this->configs['rows_edit'] == 1 ? self::rows() : 'files.rows.table_import';\n }", "function import_data()\n {\n $config = array(\n 'upload_path' => FCPATH . 'uploads/subjectoptions',\n 'allowed_types' => 'xls|csv'\n );\n $this->load->library('upload', $config);\n if ($this->upload->do_upload('file')) {\n $data = $this->upload->data();\n @chmod($data['full_path'], 0777);\n\n $this->load->library('Spreadsheet_Excel_Reader');\n $this->spreadsheet_excel_reader->setOutputEncoding('CP1251');\n\n $this->spreadsheet_excel_reader->read($data['full_path']);\n $sheets = $this->spreadsheet_excel_reader->sheets[0];\n error_reporting(0);\n\n $data_excel = array();\n for ($i = 2; $i <= $sheets['numRows']; $i++) {\n if ($sheets['cells'][$i][1] == '') break;\n\n $data_excel[$i - 1]['student'] = $sheets['cells'][$i][1];\n $data_excel[$i - 1]['student_id'] = $sheets['cells'][$i][2];\n $data_excel[$i - 1]['theclass'] = $sheets['cells'][$i][3];\n $data_excel[$i - 1]['stream'] = $sheets['cells'][$i][4];\n $data_excel[$i - 1]['subject'] = $sheets['cells'][$i][5];\n $data_excel[$i - 1]['theyear'] = $sheets['cells'][$i][6];\n // $data_excel[$i - 1]['subjectcode'] = $sheets['cells'][$i][6];\n // $data_excel[$i - 1]['mark1'] = $sheets['cells'][$i][7];\n // $data_excel[$i - 1]['comment'] = $sheets['cells'][$i][8];\n // $data_excel[$i - 1]['term'] = $sheets['cells'][$i][10];\n }\n\n /* $params = $this->security->xss_clean($params);\n $student_id = $this->Student_model->add_student($params);\n if($student_id){\n $this->session->set_flashdata('msg', 'Student is Registered Successfully!');\n redirect('student/index');*/\n\n $this->db->insert_batch('subject_options', $data_excel);\n $this->session->set_flashdata('msg', 'Student Subject Options Registered Successfully!');\n // @unlink($data['full_path']);\n //redirect('excel_import');\n redirect('subjectoptions/index');\n }\n }", "public function import(){\n include APPPATH.'third_party/PHPExcel.php';\n \n $excelreader = new PHPExcel_Reader_Excel2007();\n $loadexcel = $excelreader->load('uploads/'.$this->filename.'.xlsx'); /* Load file yang telah diupload ke folder excel */\n $sheet = $loadexcel->getActiveSheet()->toArray(null, true, true ,true);\n \n /* Buat sebuah variabel array untuk menampung array data yg akan kita insert ke database */\n $data = array();\n \n $numrow = 1;\n foreach($sheet as $row){\n\n /* ----------------------------------------------\n * Cek $numrow apakah lebih dari 1\n * Artinya karena baris pertama adalah nama-nama kolom\n * Jadi dilewat saja, tidak usah diimport\n * ----------------------------------------------\n */\n\n if($numrow > 1){\n \n /* Kita push (add) array data ke variabel data */\n array_push($data, array(\n 'id_guru' => '',\n 'nuptk' =>$row['A'],\n 'nama_guru' =>$row['B'],\n 'jenis_kelamin' =>$row['C'],\n 'username' =>$row['D'],\n 'password' =>password_hash($row['E'],PASSWORD_DEFAULT)\n ));\n }\n \n $numrow++; // Tambah 1 setiap kali looping\n }\n\n $this->Mdl_guru->insert_multiple($data);\n \n redirect(\"Guru\");\n }", "public function load_import_quiz() {\n\t\tif ( ! Forminator::is_import_export_feature_enabled() ) {\n\t\t\twp_send_json_success( '' );\n\t\t}\n\t\t// Validate nonce\n\t\tforminator_validate_ajax( \"forminator_popup_import_quiz\" );\n\n\t\t$html = forminator_template( 'quiz/popup/import' );\n\n\t\twp_send_json_success( $html );\n\t}", "public function insert_entry() //データ挿入コード\n {\n\n // $this->number = $this->input->post('radio'); \n $this->number = $this->input->post('radio01');\n // $this->number = $this->input->post('two');\n // $this->number = $this->input->post('three');\n // $this->number = $this->input->post('number');\n $this->name = $this->input->post('name');\n $this->pass = $this->input->post('pass');\n $this->db->insert('radio_test', $this);\n\t}", "public static function renderRadio();", "public function radiobuttonClicked($sender,$param)/*\n Module: radiobuttonClicked\n Parameters:\n * $sender -- Page that sent request\n * $param -- Tcontrol that sent request\n Author Name(s): Nate Priddy\n Date Created: 12/7/2010\n Purpose: Not in use!\n * Meant to be used when radio buttons rather than select button is\n * used to make adjusstments to lists\n */{\n $item = $param->Item;\n // obtains the primary key corresponding to the datagrid item\n $RL_ID = $this->RecipeUserListGrid->DataKeys[$item->ItemIndex];\n $this->SetSelectedID($RL_ID);\n $this->UserListRebind($this->User->getUserId());\n $this->ListRebind($RL_ID);\n }", "public function importInterface(){\n return view('/drugAdministration/drugs/importExcelDrugs');\n }", "public function importSub($model, $relate = FALSE);", "public function importxls()\n\t{\n\t\tif( $this->import_start() )\n\t\t{\n\t\t\t$xls\t\t= $this->file['tmp_name'];\n\t\t\t$objPHPExcel\t= PHPExcel_IOFactory::load($xls);\n\t\t\t$sht\t\t= $objPHPExcel->getActiveSheet();\n\n\t\t\t$highestColumm\t= $sht->getHighestDataColumn();\n\t\t\t$highestRow\t= $sht->getHighestDataRow();\n\t\t\t$range\t\t= \"A1:\".$highestColumm.$highestRow;\n\n\t\t\t$rows\t\t= $sht->rangeToArray($range);\n\t\t\t$model\t\t= $this->getModel('HelloImport');\t\t//for db read/write\n\t\t\t$this->ok\t= $model->importItems($rows);\n\t\t}\n\t\t$this->import_finish();\n\t\treturn;\n\t}", "function bit_admin_import_csv( $playid ) {\n}", "private function reedImportFile()\n {\n $reader = IOFactory::createReader('Xlsx');\n\n $reader->setReadDataOnly(true);\n\n $spreadsheet = $reader->load($this->getFullPathToUploadFile());\n\n $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true);\n\n $this->resultReedImportFile = $sheetData;\n }", "public function importExcel($path);", "public function importFrom(array $data);", "function setTypeAsRadioButtons($itemList) {\n\t\t$this->type = \"radio\";\n\t\t$this->seleu_itemlist = $itemList;\n\t}", "public function acfedu_import_raw_data() {\n\t\t\t\tif ( isset( $_POST[\"import_raw_nonce\"] ) ) {\n\t\t\t\t\tif ( ! wp_verify_nonce( $_POST[\"import_raw_nonce\"], 'import-raw-nonce' ) ) {\n\t\t\t\t\t\t$this->acfedu_errors()->add( 'error_no_nonce_match', esc_html__( 'Something went wrong, please try again.', 'acf-faculty-selector' ) );\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( isset( $_POST['verify'] ) ) {\n\t\t\t\t\t\t\t$verify_data = acfedu_verify_csv_data( $_POST['raw_csv_import'] );\n\t\t\t\t\t\t\tif ( false != $verify_data ) {\n\t\t\t\t\t\t\t\t$this->acfedu_errors()->add( 'success_csv_valid', esc_html__( 'Congratulations, your CSV data seems valid.', 'acf-faculty-selector' ) );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} elseif ( isset( $_POST['import'] ) ) {\n\n\t\t\t\t\t\t\t$verified_data = acfedu_verify_csv_data( $_POST['raw_csv_import'] );\n\t\t\t\t\t\t\tif ( false != $verified_data ) {\n\t\t\t\t\t\t\t\t// import data\n\t\t\t\t\t\t\t\tglobal $wpdb;\n\t\t\t\t\t\t\t\t$line_number = 0;\n\t\t\t\t\t\t\t\tforeach ( $verified_data as $line ) {\n\t\t\t\t\t\t\t\t\t$line_number ++;\n\n\t\t\t\t\t\t\t\t\t$faculty = $line[0];\n\t\t\t\t\t\t\t\t\t$univ_abbr = $line[1];\n\t\t\t\t\t\t\t\t\t$univ = $line[2];\n\t\t\t\t\t\t\t\t\t$country_abbr = $line[3];\n\t\t\t\t\t\t\t\t\t$country = $line[4];\n\t\t\t\t\t\t\t\t\t$price = $line[5];\n\n\t\t\t\t\t\t\t\t\t$faculty_row = array(\n\t\t\t\t\t\t\t\t\t\t'faculty_name' => $faculty,\n\t\t\t\t\t\t\t\t\t\t'univ_code' => $univ_abbr,\n\t\t\t\t\t\t\t\t\t\t'univ_name' => $univ,\n\t\t\t\t\t\t\t\t\t\t'country_code' => $country_abbr,\n\t\t\t\t\t\t\t\t\t\t'country' => $country,\n\t\t\t\t\t\t\t\t\t\t'price' => $price,\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tglobal $wpdb;\n\t\t\t\t\t\t\t\t\t$wpdb->insert( $wpdb->prefix . 'faculty', $faculty_row );\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$this->acfedu_errors()->add( 'success_faculty_imported', sprintf( _n( 'Congratulations, you imported %d faculty.', 'Congratulations, you imported %d faculty.', $line_number, 'acf-faculty-selector' ), $line_number ) );\n\n\t\t\t\t\t\t\t\tdo_action( 'acfedu_after_success_import_raw' );\n\n\t\t\t\t\t\t\t\treturn;\n\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}", "public function import()\n {\n $file_mimes = array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');\n /**\n *text/comma-separated-values 逗號分隔CSV\n */\n if (isset($_FILES['file']['name']) && in_array($_FILES['file']['type'], $file_mimes)) //檔案是否存在\n {\n \n $arr_file = explode('.', $_FILES['file']['name']); //分割字串\n $extension = end($arr_file); //副檔名\n \n if ('csv' == $extension) \n {\n $reader = new \\PhpOffice\\PhpSpreadsheet\\Reader\\Csv();//Csv package new\n } elseif ('xlsx' == $extension) {\n $reader = new \\PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx();//Xlsx package new \n }\n \n $spreadsheet = $reader->load($_FILES['file']['tmp_name']);\n // start customize\n $sheetData = $spreadsheet->getActiveSheet()->ToArray(); //取得sheet值並存成陣列\n //return $sheetData; return只會給予物件 所以中文會輸出unicode\n //return view('',$sheetData=>$sheetData);\n // /end customize\n $count = count($sheetData);\n if (is_array($sheetData)) \n {\n foreach ($sheetData as $row => $value) {\n Line::create([\n 'user_id' => $value[0],\n 'created_at' => now(),\n 'apporved' => now(),\n 'person_name' => $value[1],\n 'school' => $value[2],\n 'phone' => $value[3],\n ]);\n }\n } \n return redirect()->route('home')->with('message', \"新增成功!總共新增$count\" . \"筆\");//redirect home and \n }\n }", "function import(array $data);", "public static function convert_radio_field() {\n\n\t\t// Create a new Radio field.\n\t\tself::$field = new GF_Field_Radio();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add choices property.\n\t\tself::$field->choices = array();\n\n\t\t// Loop through field options.\n\t\tforeach ( self::$nf_field['list']['options'] as $option ) {\n\n\t\t\t// Add option choice.\n\t\t\tself::$field->choices[] = array(\n\t\t\t\t'text' => $option['label'],\n\t\t\t\t'value' => $option['value'],\n\t\t\t);\n\n\t\t\t// If option is selected, set as default value.\n\t\t\tif ( '1' === $option['selected'] ) {\n\t\t\t\tself::$field->defaultValue = ! empty( $option['value'] ) ? $option['value'] : $option['text'];\n\t\t\t}\n\n\t\t}\n\n\t}", "public function import( $quiz_id ) {\n\n\t\tif ( empty( $this->_import_path ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->_quiz_id = (int) $quiz_id;\n\t\t$start_question = current( $this->_stack );//this should be the start question\n\n\t\t$id = $this->_save_question( $start_question );\n\n\t\treturn is_int( $id );\n\t}", "public function getQuestionFromImportData($data) {\n return parent::getQuestionFromImportData($data);\n }", "protected function loadRow() {}", "private function import_pegawai($sheet)\n\t{\n\t\tforeach ($sheet as $idx => $data) {\n\t\t\t//skip index 1 karena title excel\n\t\t\tif ($idx == 1) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ($data['B'] == null) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$nip = $data['B'];\n\t\t\t$nama = $data['C'];\n\t\t\t$tempat_lahir = $data['D'];\n\t\t\t$tanggal_lahir = $data['E'];\n\t\t\t$jenis_kelamin = $data['F'];\n\t\t\t$gol = $data['G'];\n\t\t\t$tmt_gol = $data['H'];\n\t\t\t$eselon = $data['I'];\n\t\t\t$jabatan = $data['J'];\n\t\t\t$tmt_jabatan = $data['K'];\n\t\t\t$agama = $data['L'];\n\t\t\t$sub = $data['M'];\n\t\t\t$bagian = $data['N'];\n\t\t\t$unit = $data['O'];\n\n\t\t\t// insert data\n\t\t\t$this->pegawaiModel->insert([\n\t\t\t\t'nip' => $nip,\n\t\t\t\t'name' => $nama,\n\t\t\t\t'tempat_lahir' => strtoupper($tempat_lahir),\n\t\t\t\t'tanggal_lahir' => date_format(date_create($tanggal_lahir), \"Y-m-d\"),\n\t\t\t\t'jenis_kelamin' => $jenis_kelamin,\n\t\t\t\t'gol' => $gol,\n\t\t\t\t'tmt_gol' => date_format(date_create($tmt_gol), \"Y-m-d\"),\n\t\t\t\t'eselon' => $eselon,\n\t\t\t\t'jabatan' => $jabatan,\n\t\t\t\t'tmt_jab' => date_format(date_create($tmt_jabatan), \"Y-m-d\"),\n\t\t\t\t'agama' => $agama,\n\t\t\t\t'sub_bagian' => $sub,\n\t\t\t\t'bagian' => $bagian,\n\t\t\t\t'unit' => $unit,\n\t\t\t]);\n\t\t}\n\n\t\treturn true;\n\t}", "public static function load(){\n // creation d'un tableau d'objet webRadio à retourner\n $tabWebRadio= array();\n $webRadio= array();\n $filename=\"../webRadio.txt\";\n // ouverture du fichier\n if (file_exists($filename)) { \n $datain = file_get_contents($filename);\n $lines = explode(\"\\n\", $datain);\n \n $count = count($lines);\n \n for ($i = 0; $i < $count; $i++){\n $webRadio = unserialize($lines[$i]);\n if ($webRadio){\n /* @var $webRadio WebRadio */\n \n // construction de l'objet json\n $arr= array(\n \"id\" => $i, // ligne dans le fichier\n \"nom\" => $webRadio->getNom(),\n \"url\" => $webRadio->getUrl(),\n );\n array_push($tabWebRadio, $arr);\n \n }\n \n }\n \n // retour du tableau\n return $tabWebRadio;\n }else{\n //creation du fichier\n $fp = fopen($filename,\"w\"); \n fwrite($fp,\"\"); \n fclose($fp);\n return $tabWebRadio;\n }\n }" ]
[ "0.51157725", "0.47869363", "0.4668854", "0.46299484", "0.45710236", "0.45428073", "0.45386532", "0.45222545", "0.45018837", "0.4486966", "0.44613567", "0.44118488", "0.4400204", "0.43842605", "0.43669873", "0.43482393", "0.43444", "0.43307984", "0.43288007", "0.43213406", "0.43211138", "0.43095648", "0.42987326", "0.42971995", "0.42920613", "0.42887068", "0.4259", "0.42361015", "0.42325976", "0.42254734" ]
0.5347019
0
Method for importing a textarea data cell.
protected function process_data_textarea(import_settings $settings, $field, $data_record, $value) { $result = $this->process_data_default($settings, $field, $data_record, $value, true); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function convert_textarea_field() {\n\n\t\t// Create a new Textarea field.\n\t\tself::$field = new GF_Field_Textarea();\n\n\t\t// Add standard properties.\n\t\tself::add_standard_properties();\n\n\t\t// Add Textarea specific properties.\n\t\tself::$field->useRichTextEditor = rgar( self::$nf_field, 'textarea_rte' );\n\n\t}", "public function display_cell($data) {\n\n\t\t// get the field markup and Editor config from the normal display function\n\t\tlist($textarea, $ckconfig) = $this->display_field($data,$this->cell_name);\n\t\t\n\t\t// include the matrix functions if not already done so\n\t\tif(!isset($this->EE->session->cache['eeck']['mconfigs']) ) {\n\t\t\t$this->include_matrix_js();\n\t\t\t$this->EE->session->cache['eeck']['mconfigs'] = array();\n\t\t}\n\n\t\t// stash the editor init config code for this matrix column id\n\t\tif (!isset($this->EE->session->cache['eeck']['mconfigs'][$this->col_id])) {\n\n\t\t\t$this->EE->cp->add_to_foot(\n\t\t\t\t$this->EE->javascript->inline( 'eeckconf.col_id_'.$this->col_id.'={'.$ckconfig.'};')\n\t\t\t);\n\n\t\t\t$this->EE->session->cache['eeck']['mconfigs'][$this->col_id] = true;\n\t\t}\n\t\treturn $textarea;\n\t}", "function output_textarea_row( string $label, string $key, $val, int $rows = 2 ): void {\n\twp_enqueue_style( 'wpinc-meta-field' );\n\t$val = $val ?? '';\n\t?>\n\t<div class=\"wpinc-meta-field-single textarea\">\n\t\t<label>\n\t\t\t<span><?php echo esc_html( $label ); ?></span>\n\t\t\t<textarea <?php name_id( $key ); ?> cols=\"64\" rows=\"<?php echo esc_attr( $rows ); ?>\"><?php echo esc_attr( $val ); ?></textarea>\n\t\t</label>\n\t</div>\n\t<?php\n}", "public static function renderTextarea();", "public function textarea()\n {\n return $this->content(false, false, false, true);\n }", "function tep_cfg_textarea($text) {\n return tep_draw_textarea_field('configuration_value', false, 35, 5, $text);\n}", "private function textareaCustomField(): string\n {\n return Template::build($this->getTemplatePath('textarea.html'), [\n 'id' => uniqid(\"{$this->id}-\", true),\n 'name' => $this->id,\n 'label' => $this->label,\n 'value' => $this->getValue($this->index),\n 'index' => isset($this->index) ? $this->index : false\n ]);\n }", "static function textarea ($in = '', $data = []) {\n\t\treturn static::textarea_common($in, $data, __FUNCTION__);\n\t}", "function output_textarea_row( string $label, string $key, $val, int $rows = 2 ): void {\n\t\t\\wpinc\\meta\\output_textarea_row( $label, $key, $val, $rows );\n\t}", "function text_parse_csv_column_input($t)\r\n{\r\n\t$t = str_replace(\"'\", '&#39;', $t);\r\n\t$t = str_replace(' \"', ' &#34;', $t);\r\n\t$t = str_replace('& ', '&amp; ', $t);\r\n\t$t = preg_replace('/[^\\\\\\\\]\\\\\\n/', \"\\n\", $t);\r\n\t$t = preg_replace('/[^\\\\\\\\]\\\\\\t/', \"\\t\", $t);\r\n\t$t = str_replace('\\\\\\n', '\\n', $t);\r\n\t$t = str_replace('\\\\\\r', '\\r', $t);\r\n\t$t = str_replace('\\\\\\t', '\\t', $t);\r\n\treturn $t;\r\n}", "function tlspi_make_text_area() { ?>\n\t<div class=\"wrap\"> \n\t\t<h1>The La Source Newspaper Post Importer</h1> \n \n\t\t<form method=\"post\" action=\"\"> \n\t\t\t<label>copy and paste document here... <br />\n\t\t\t<textarea rows=\"60\" cols=\"100\" name=\"preview\" id=\"code\" ></textarea> </label>\n\t\t\t\n\t\t\t<br> \n\t\t\t<input type =\"submit\" value=\"Preview\" name=\"submit\" class=\"button-primary\"> \n\t\t\t<br>\n\t\t</form> <br> \n\t\t<script>\n\t\t\tvar editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n\t\t\t\tmode: { name: \"xml\", alignCDATA: true},\n\t\t\t\tlineNumbers: true\n\t\t\t});\n\t\t</script>\n\t</div>\n<?php\n}", "protected function importData()\n\t{\n\t\tinclude_once \"Services/ADN/AD/classes/class.adnCharacter.php\";\n\t\t$characters = adnCharacter::getAllCharacters($this->wmo_id);\n\n\t\t$this->setData($characters);\n\t\t$this->setMaxCount(sizeof($characters));\n\t}", "public function getEditableText() {}", "function tep_cfg_textarea($text, $key = '') {\n $name = tep_not_null($key) ? 'configuration[' . $key . ']' : 'configuration_value';\n\n return HTML::textareaField($name, 35, 5, $text);\n }", "public function textArea ( \\r8\\Form\\TextArea $field )\n {\n $this->addField( \"textarea\", $field );\n }", "function olc_cfg_textarea($text) {\n\treturn olc_draw_textarea_field('configuration_value', false, 50, 5, $text);\n}", "function setTypeAsTextArea($rows = 4, $cols = 70) {\n\t\t$this->type = \"textarea\";\n\t\t$this->textarea_cols = $cols;\n\t\t$this->textarea_rows = $rows;\n\t}", "protected function process_header_textarea(import_settings $settings, $data, $name, $description, $options) {\r\n $result = $this->process_header_default($settings, $data, end(explode('_', __FUNCTION__)), $name, $description, $options);\r\n $result->param2 = 60;\r\n $result->param3 = 35;\r\n $result->param4 = 1;\r\n\r\n global $DB;\r\n $DB->update_record('data_fields', $result);\r\n return $result;\r\n }", "public function getTYPE_TEXT_AREA()\n {\n return self::TYPE_TEXT_AREA;\n }", "function make_form_row(){\n\t\t$index = $this->col_index;\n\t\t# remove the * at the start of the first line\n\t\t$this->col_data = preg_replace(\"/^\\*/\",\"\",$this->col_data);\n\t\t# split the lines and remove the * from each. The value in each line goes into the array $values\n\t\t$values = preg_split(\"/\\n\\*?/\", $this->col_data);\n\t\t# pad the values array to make sure there are 3 entries\n\t\t$values = array_pad($values, 3, \"\");\n\t\t\n\t\t/*\n\t\tmake three input boxes. TableEdit takes row input from an input array named field a \n\t\tvalue for a particular field[$index] can be an array\n\t\t\tfield[$index][] is the field name\n\t\t\t40 is the length of the box\n\t\t\t$value is the value for the ith line\n\t\t \n\t\t */\n\t\t $form = ''; #initialize\n\t\t foreach($values as $i => $value){\n\t\t\t$form .= \"$i:\".XML::input(\"field[$index][]\",40,$value, array('maxlength'=>255)).\"<br>\\n\";\n\t\t}\n\t\treturn $form;\n\t\n\t}", "function fbWriteTextarea($areaname, $html, $width, $height, $useRte, $emoticons)\r\n {\r\n // well $html is the $message to edit, generally it means in PLAINTEXT @FireBoard!\r\n global $editmode;\r\n // ERROR: mixed global $editmode\r\n global $fbConfig;\r\n\r\n // (JJ) JOOMLA STYLE CHECK\r\n if ($fbConfig->joomlastyle < 1) {\r\n $boardclass = \"fb_\";\r\n }\r\n ?>\r\n\r\n <tr class = \"<?php echo $boardclass; ?>sectiontableentry1\">\r\n <td class = \"fb_leftcolumn\" valign = \"top\">\r\n <strong><a href = \"<?php echo sefRelToAbs(JB_LIVEURLREL.'&amp;func=faq').'#boardcode';?>\"><?php echo _COM_BOARDCODE; ?></a></strong>:\r\n </td>\r\n\r\n <td>\r\n <table border = \"0\" cellspacing = \"0\" cellpadding = \"0\" class = \"fb-postbuttonset\">\r\n <tr>\r\n <td class = \"fb-postbuttons\">\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"b\" name = \"addbbcode0\" value = \" B \" style = \"font-weight:bold; \" onclick = \"bbstyle(0)\" onmouseover = \"helpline('b')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"i\" name = \"addbbcode2\" value = \" i \" style = \"font-style:italic; \" onclick = \"bbstyle(2)\" onmouseover = \"helpline('i')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"u\" name = \"addbbcode4\" value = \" u \" style = \"text-decoration: underline;\" onclick = \"bbstyle(4)\" onmouseover = \"helpline('u')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"q\" name = \"addbbcode6\" value = \"Quote\" onclick = \"bbstyle(6)\" onmouseover = \"helpline('q')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"c\" name = \"addbbcode8\" value = \"Code\" onclick = \"bbstyle(8)\" onmouseover = \"helpline('c')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"k\" name = \"addbbcode10\" value = \"ul\" onclick = \"bbstyle(10)\" onmouseover = \"helpline('k')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"o\" name = \"addbbcode12\" value = \"ol\" onclick = \"bbstyle(12)\" onmouseover = \"helpline('o')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"l\" name = \"addbbcode18\" value = \"li\" onclick = \"bbstyle(18)\" onmouseover = \"helpline('l')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"p\" name = \"addbbcode14\" value = \"Img\" onclick = \"bbstyle(14)\" onmouseover = \"helpline('p')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"w\" name = \"addbbcode16\" value = \"URL\" style = \"text-decoration: underline; \" onclick = \"bbstyle(16)\" onmouseover = \"helpline('w')\"/>\r\n\r\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"h\" name = \"addbbcode24\" value = \"Hide\" onclick = \"bbstyle(20)\" onmouseover = \"helpline('h')\"/>\r\n\r\n &nbsp;<?php echo _SMILE_COLOUR; ?>:\r\n\r\n <select name = \"addbbcode20\"\r\n onchange = \"bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');\" onmouseover = \"helpline('s')\" class = \"<?php echo $boardclass;?>slcbox\">\r\n <option style = \"color:black; background-color: #FAFAFA\" value = \"\"><?php echo _COLOUR_DEFAULT; ?></option>\r\n\r\n <option style = \"color:#FF0000; background-color: #FAFAFA\" value = \"#FF0000\"><?php echo _COLOUR_RED; ?></option>\r\n\r\n <option style = \"color:#800080; background-color: #FAFAFA\" value = \"#800080\"><?php echo _COLOUR_PURPLE; ?></option>\r\n\r\n <option style = \"color:#0000FF; background-color: #FAFAFA\" value = \"#0000FF\"><?php echo _COLOUR_BLUE; ?></option>\r\n\r\n <option style = \"color:#008000; background-color: #FAFAFA\" value = \"#008000\"><?php echo _COLOUR_GREEN; ?></option>\r\n\r\n <option style = \"color:#FFFF00; background-color: #FAFAFA\" value = \"#FFFF00\"><?php echo _COLOUR_YELLOW; ?></option>\r\n\r\n <option style = \"color:#FF6600; background-color: #FAFAFA\" value = \"#FF6600\"><?php echo _COLOUR_ORANGE; ?></option>\r\n\r\n <option style = \"color:#000080; background-color: #FAFAFA\" value = \"#000080\"><?php echo _COLOUR_DARKBLUE; ?></option>\r\n\r\n <option style = \"color:#825900; background-color: #FAFAFA\" value = \"#825900\"><?php echo _COLOUR_BROWN; ?></option>\r\n\r\n <option style = \"color:#9A9C02; background-color: #FAFAFA\" value = \"#9A9C02\"><?php echo _COLOUR_GOLD; ?></option>\r\n\r\n <option style = \"color:#A7A7A7; background-color: #FAFAFA\" value = \"#A7A7A7\"><?php echo _COLOUR_SILVER; ?></option>\r\n </select>\r\n\r\n &nbsp;<?php echo _SMILE_SIZE; ?>:\r\n\r\n <select name = \"addbbcode22\" onchange = \"bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')\" onmouseover = \"helpline('f')\" class = \"<?php echo $boardclass;?>button\">\r\n <option value = \"1\"><?php echo _SIZE_VSMALL; ?></option>\r\n\r\n <option value = \"2\"><?php echo _SIZE_SMALL; ?></option>\r\n\r\n <option value = \"3\" selected = \"selected\"><?php echo _SIZE_NORMAL; ?></option>\r\n\r\n <option value = \"4\"><?php echo _SIZE_BIG; ?></option>\r\n\r\n <option value = \"5\"><?php echo _SIZE_VBIG; ?></option>\r\n </select>\n\n\t\t\t\t\t<?php if ($fbConfig->showspoilertag) {?>\n <script type=\"text/javascript\">\n\t\t\t\t\t\tfunction fb_spoiler_help() {document.postform.helpbox.value = 'Spoiler: [spoiler] ... [/spoiler]';}\n\t\t\t\t\t</script>\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"s\" name = \"addbbcode40\" value = \"Spoiler\" onclick = \"bbfontstyle('[spoiler]', '[/spoiler]')\" onmouseover = \"fb_spoiler_help()\"/>\n\t\t\t\t\t<?php } ?>\n\n\t\t\t\t\t<?php if ($fbConfig->showebaytag) {?>\n <script type=\"text/javascript\">\n\t\t\t\t\t\tfunction fb_ebay_help() {document.postform.helpbox.value = 'eBay: [ebay]ItemId[/ebay]';}\n\t\t\t\t\t</script>\n <input type = \"button\" class = \"<?php echo $boardclass;?>button\" accesskey = \"e\" name = \"addbbcode30\" value = \"eBay\" onclick = \"bbfontstyle('[ebay]', '[/ebay]')\" onmouseover = \"fb_ebay_help()\"/>\n\t\t\t\t\t<?php } ?>\n\n\t\t\t\t\t<?php if ($fbConfig->showvideotag) {?>\n &nbsp;<span style=\"white-space:nowrap;\">\r\n\t\t\t\t\t<script type=\"text/javascript\">\r\n\t\t\t\t\t\tfunction fb_vid_help1() {document.postform.helpbox.value = 'Video: [video type=provider size=100 width=480 height=360]xyz[/video]';}\r\n\t\t\t\t\t\tfunction fb_vid_help2() {document.postform.helpbox.value = 'Video: [video size=100 width=480 height=360]http://myvideodomain.com/myvideo[/video]';}\r\n\t\t\t\t\t</script>\r\n\t\t\t\t\t<a href = \"javascript: bbfontstyle('[video]', '[/video]')\" onmouseover = \"fb_vid_help2()\">Video:</a>\r\n\t\t\t\t\t<select name = \"fb_vid_code1\" onchange = \"bbfontstyle('[video type=' + this.form.fb_vid_code1.options[this.form.fb_vid_code1.selectedIndex].value, '[/video]');\" onmouseover = \"fb_vid_help1()\" class = \"<?php echo $boardclass;?>button\">\r\n\t\t\t\t\t\t<?php\r\n\t\t\t\t\t\t$vid_provider = array('','AnimeEpisodes','Biku','Bofunk','Break','Clip.vn','Clipfish','Clipshack','Collegehumor','Current',\r\n\t\t\t\t\t\t\t'DailyMotion','DivX,divx]http://','DownloadFestival','Flash,flash]http://','FlashVars,flashvars param=]http://','Fliptrack',\r\n\t\t\t\t\t\t\t'Fliqz','Gametrailers','Gamevideos','Glumbert','GMX','Google','GooglyFoogly','iFilm','Jumpcut','Kewego','LiveLeak','LiveVideo',\r\n\t\t\t\t\t\t\t'MediaPlayer,mediaplayer]http://','MegaVideo','Metacafe','Mofile','Multiply','MySpace','MyVideo','QuickTime,quicktime]http://','Quxiu',\r\n\t\t\t\t\t\t\t'RealPlayer,realplayer]http://','Revver','RuTube','Sapo','Sevenload','Sharkle','Spikedhumor','Stickam','Streetfire','StupidVideos','Toufee','Tudou',\r\n\t\t\t\t\t\t\t'Unf-Unf','Uume','Veoh','VideoclipsDump','Videojug','VideoTube','Vidiac','VidiLife','Vimeo','WangYou','WEB.DE','Wideo.fr','YouKu','YouTube');\r\n\t\t\t\t\t\tforeach($vid_provider as $vid_type) {\r\n\t\t\t\t\t\t\tlist($vid_name, $vid_type) = explode(',', $vid_type);\r\n\t\t\t\t\t\t\techo '<option value = \"'.(($vid_type)?$vid_type:strtolower($vid_name).']').'\">'.$vid_name.'</option>';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t?>\r\n\t\t\t\t\t</select></span>\r\n\t\t\t\t\t<?php } ?>\n\r\n &nbsp;&nbsp;<a href = \"javascript: bbstyle(-1)\"onmouseover = \"helpline('a')\"><small><?php echo _BBCODE_CLOSA; ?></small></a>\r\n </td>\r\n </tr>\r\n\r\n <tr>\r\n <td class = \"<?php echo $boardclass;?>posthint\">\r\n <input type = \"text\" name = \"helpbox\" size = \"45\" class = \"<?php echo $boardclass;?>inputbox\" maxlength = \"100\" value = \"<?php echo _BBCODE_HINT;?>\"/>\r\n </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n\r\n <tr class = \"<?php echo $boardclass; ?>sectiontableentry2\">\r\n <td valign = \"top\" class = \"fb_leftcolumn\">\r\n <strong><?php echo _MESSAGE; ?></strong>:\r\n\r\n <?php\r\n if ($emoticons != 1)\r\n {\r\n ?>\r\n\r\n <br/>\r\n\r\n <br/>\r\n\r\n <div align = \"right\">\r\n <table border = \"0\" cellspacing = \"3\" cellpadding = \"0\">\r\n <tr>\r\n <td colspan = \"4\" style = \"text-align: center;\">\r\n <strong><?php echo _GEN_EMOTICONS; ?></strong>\r\n </td>\r\n </tr>\r\n\r\n <tr>\r\n <?php\r\n generate_smilies(); //the new function Smiley mod\r\n ?>\r\n </tr>\r\n </table>\r\n </div>\r\n\r\n <?php\r\n }\r\n ?>\r\n </td>\r\n\r\n <td valign = \"top\">\r\n <textarea class = \"<?php echo $boardclass;?>txtarea\" name = \"<?php echo $areaname;?>\" id = \"<?php echo $areaname;?>\"><?php echo htmlspecialchars($html, ENT_QUOTES); ?></textarea>\r\n<?php\r\nif ($editmode) {\r\n // Moderator edit area\r\n ?>\r\n <fieldset>\r\n <legend><?php echo _FB_EDITING_REASON?></legend>\r\n <input name=\"modified_reason\" size=\"40\" maxlength=\"200\" type=\"text\"><br />\r\n\r\n </fieldset>\r\n<?php\r\n}\r\n?>\r\n </td>\r\n </tr>\r\n\r\n<?php\r\n }", "public function it_shows_textarea_input()\n {\n // configure\n $inputs = [\n [\n 'type' => 'textarea',\n 'name' => 'message'\n ]\n ];\n\n $this->configureInputs($inputs);\n\n // assert\n $this->get('/settings')\n ->assertStatus(200)\n ->assertSee('textarea')\n ->assertSee('message');\n }", "public static function getTextArea($namespace, &$columns, $fieldName) {\n\t\t$configuration = self::getCommonConfiguration($columns, $fieldName, $namespace);\n\t\t$tca = $columns[$fieldName]['config'];\n\n\t\t// Set default xtype\n\t\t$configuration['xtype'] = 'textarea';\n\t\tif (isset($tca['height'])) {\n\t\t\t$configuration['height'] = (int) $tca['height'];\n\t\t}\n\t\t$configuration['enableKeyEvents'] = TRUE;\n\n\t\treturn $configuration;\n\t}", "function setting_textarea( $option ) {\n\n\t\t$value = $this->pretty_print(get_option( $option ));\n?>\n\t<textarea name=\"<?php echo $option; ?>\"><?php echo $value;\n?></textarea>\n<?php\n\t}", "public function loadData($path) {\n\t\t\n\t\t$this->properties->lines = 1;\n\t\t\n\t\t$sql = 'INSERT INTO '.$this->properties->table.' ('.implode(\", \", $this->properties->columns).') VALUES (:'.implode(\", :\", $this->properties->columns).')'; \n\t\t$statement = $this->properties->con->prepare($sql); \t\t\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\t$finfo = finfo_open(FILEINFO_MIME);\n\t\t\t\n\t\t\tif(substr(finfo_file($finfo,$path),0,4) != \"text\") {\n\t\t\t\tthrow new ImporterException(\"Not a CSV document!\");\n\t\t\t}\n\t\t\t\n\t\t\t$fp = fopen($path,\"rt\");\n\t\t\t\n\t\t\tif(!$fp) {\n\t\t\t\tthrow new ImporterException(\"Couldn't read file!\");\n\t\t\t}\n\t\t\t\n\t\t\t$first_row = 1;\n\t\t\t\n\t\t\twhile(($row = fgetcsv($fp,0,$this->properties->delimeter,$this->properties->enclosure)) !== false) {\n\t\t\t\tif(count($row) == 1 && !$row[0]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tforeach($row as &$value) {\n\t\t\t\t\t$value = trim($value);\n\t\t\t\t}\n\t\t\t\t$this->data[] = $row;\n\t\t\t\tif($first_row && $this->properties->has_header) {\n\t\t\t\t\t$first_row = 0;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tparent::insertData($statement);\n\t\t\t\t$this->properties->lines++;\n\t\t\t\t$this->properties->has_header = false;\n\t\t\t\t$this->properties->append = true;\n\t\t\t\t$this->data = array();\n\t\t\t}\n\t\t\t\n\t\t\tfclose($fp);\n\t\t\t\n\t\t}\n\t\tcatch (Exception $e) {\n\t\t\t/*if($this->properties->lines > 1) {\n\t\t\t\tparent::deleteData();\n\t\t\t}*/\n\t\t\tthrow new ImporterException(\"<b>File</b>: \".$path.\"<br /><br /><b>Error</b>: \".$e->getMessage().\"<br/>\");\n\t\t}\n\n\t}", "public function import_blog_text(&$Db_object, &$databasetype, &$tableprefix)\n\t{\n\t\t// Check the dupe\n\t\tif (dupe_checking AND !($this->_dupe_checking === false OR $this->_dupe_checking['pmtext'] === false))\n\t\t{\n\t\t\t$there = $Db_object->query_first(\"\n\t\t\t\tSELECT blogtextid\n\t\t\t\tFROM \" . $tableprefix . \"blog_text\n\t\t\t\tWHERE importblogtextid = \" . intval(trim($this->get_value('mandatory', 'importblogtextid'))) . \"\n\t\t\t\");\n\n\t\t\tif (is_numeric($there[0]))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t$Db_object->query(\"\n\t\t\tINSERT INTO \" . $tableprefix . \"blog_text\n\t\t\t\t(blogid, userid, dateline, pagetext, title, state, allowsmilie, username, ipaddress, reportthreadid, bloguserid, importblogtextid)\n\t\t\tVALUES\n\t\t\t\t(\" . intval($this->get_value('mandatory', 'blogid')) . \",\n\t\t\t\t\" . intval($this->get_value('mandatory', 'userid')) . \",\n\t\t\t\t\" . intval($this->get_value('mandatory', 'dateline')) . \",\n\t\t\t\t'\" . addslashes($this->get_value('mandatory', 'pagetext')) . \"',\n\t\t\t\t'\" . addslashes($this->get_value('mandatory', 'title')) . \"',\n\t\t\t\t'\" . $this->enum_check($this->get_value('mandatory', 'state'), array('moderation','visible','deleted'), 'visible') . \"',\n\t\t\t\t\" . intval($this->get_value('nonmandatory', 'allowsmilie')) . \",\n\t\t\t\t'\" . addslashes($this->get_value('nonmandatory', 'username')) . \"',\n\t\t\t\t\" . intval(sprintf('%u', ip2long($this->get_value('nonmandatory', 'ipaddress')))) . \",\n\t\t\t\t\" . intval($this->get_value('nonmandatory', 'reportthreadid')) . \",\n\t\t\t\t\" . intval($this->get_value('mandatory', 'bloguserid')) . \",\n\t\t\t\t\" . intval($this->get_value('mandatory', 'importblogtextid')) . \")\n\t\t\");\n\n\t\tif ($Db_object->affected_rows())\n\t\t{\n\t\t\treturn $Db_object->insert_id();\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "private function import()\n {\n if ($this->option('file') == null) {\n $this->warn('Please specify an import file');\n\n return;\n }\n\n $translatedLocaleValues = [];\n $file = fopen($this->option('file'), 'r');\n\n // Header row\n $line = fgetcsv($file, 0, $this->csvSeperator);\n if ($line[0] == 'translation_string') {\n $translationLocale = $line[2];\n } else {\n $this->warn('The given file seems to have an incorrect format');\n\n return;\n }\n\n // Data rows\n while (($line = fgetcsv($file, 0, $this->csvSeperator)) !== false) {\n if (empty($line[2])) {\n continue;\n }\n\n $translatedLocaleValues[$translationLocale][$line[0]] = $line[2];\n }\n\n $this->manager->write($translatedLocaleValues);\n }", "public function it_can_create_a_textarea(): void\n {\n static::assertHtmlStringEqualsHtmlString(\n '<textarea></textarea>',\n $this->html->textarea()\n );\n }", "function textAreaEntry($display,$name,$entries,$errors,$cols=45,$rows=5)\n{\n\t$returnVal = \"\n\t<tr>\n\t\t<td colspan='2'>$display:</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan='2'>\n\t\t\t<textarea name='$name' cols='$cols' rows='$rows'>\";\n\t\t\t$returnVal .= $entries[$name];\n\t\t\t$returnVal .= \"</textarea>\n\t\t</td>\n\t</tr>\";\n\n\tif (array_key_exists($name,$errors))\n\t{\n\t\t$returnVal .= addErrorRow($name,$errors);\n\t}\n\treturn $returnVal;\n}", "public function import()\n {\n return !empty($this->configs['rows_edit']) && $this->configs['rows_edit'] == 1 ? self::rows() : 'files.rows.table_import';\n }" ]
[ "0.5420207", "0.524603", "0.5194765", "0.5126707", "0.51193887", "0.51129174", "0.5090459", "0.5061626", "0.5016948", "0.50030977", "0.49657747", "0.49424002", "0.48762652", "0.4853857", "0.48512346", "0.48473266", "0.48277137", "0.48229995", "0.4812099", "0.48112962", "0.48059466", "0.48039365", "0.47925842", "0.4749986", "0.47496885", "0.47379342", "0.47356984", "0.4733378", "0.47319528", "0.47220707" ]
0.56925595
0
Returns the context used to store files. On first call construct the result based on $mod. On subsequent calls return the cached value.
protected function get_context($mod=null) { if ($this->_context) { return $this->_context; } global $DB; $module = $DB->get_record('modules', array('name' => 'data'), '*', MUST_EXIST); $cm = $DB->get_record('course_modules', array('course' => $mod->course, 'instance' => $mod->id, 'module' => $module->id), '*', MUST_EXIST); $this->_context = get_context_instance(CONTEXT_MODULE, $cm->id); return $this->_context; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _context()\n {\n return $this->_file()->context;\n }", "function frmget_context() {\n\tglobal $CFG, $DB;\n //include this file for content /libdir/filelib.php\n return $systemcontext = context_system::instance();\t\n}", "public static function context() {\n\t\treturn self::get_context();\n\t}", "public static function context()\n {\n return self::$_context;\n }", "private function getFileCache()\n {\n $shopIdCalculatorMock = $this->getMock(ShopIdCalculator::class, array('getShopId'), array(), '', false);\n $shopIdCalculatorMock->method('getShopId')->willReturn(1);\n\n return oxNew(SubShopSpecificFileCache::class, $shopIdCalculatorMock);\n }", "public function temp()\n\t\t{\n\t\t\tif ($this->is_cached()) {\n\t\t\t\tself::put($this->get_path_temp(), $this->get_content());\n\t\t\t} else {\n\t\t\t\tif ($this->exists()) {\n\t\t\t\t\t$this->copy($this->get_path_temp());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->update_attrs(array(\n\t\t\t\t\"name\" => basename($this->get_path_temp()),\n\t\t\t\t\"path\" => dirname($this->get_path_temp()),\n\t\t\t\t\"temp\" => true,\n\t\t\t));\n\n\t\t\treturn $this;\n\t\t}", "protected function getContext() {\n\t\treturn $this->context;\n\t}", "public static function getContext()\n {\n if (isset(self::$context) == false) {\n self::$context = new Context();\n }\n\n return self::$context;\n }", "public function getCacheFile()\n\t{\n\t\treturn $this->tempDir . '/' . $this->filename;\n\t}", "public function getContext();", "public function getContext();", "public function getContext();", "public function getContext();", "public function getContext();", "protected function getContext() {}", "abstract public function get_context();", "protected function getContext()\n\t{\n\t\treturn $this->context;\n\t}", "private function getFileContext () {\n\n $temp = $this->cleanse( filter_var( $_SERVER['HTTP_REFERER'] , FILTER_SANITIZE_URL ) );\n\n $this->referer = substr( $temp , -1 * ( strlen( $temp ) - strrpos( $temp , \"/\" ) - 1 ) );\n $this->log->write( '[Form] [context] Refererring Form: ' . $this->referer );\n\n $this->template = substr( $this->referer , 0 , strpos( $this->referer , \".\" ) ) . \".txt\";\n $this->template = $_SERVER['DOCUMENT_ROOT'] . '/forms-text/' . $this->template;\n $this->log->write( '[Form] [context] Template: ' . $this->template );\n\n $this->thankyou = substr( $this->referer , 0 , strpos( $this->referer , \".\" ) ) . \"-thanks.html\";\n $this->thankyou = '/forms-thanks/' . $this->thankyou;\n $this->log->write( '[Form] [context] Thank You: ' . $this->thankyou );\n\n }", "private function getCacheFile() {\n return new File($this->rootPath, self::CACHE_FILE);\n }", "public function getContext()\n {\n return self::$context;\n }", "protected function getContext()\n {\n return $this->_context;\n }", "protected function getContext()\n {\n return $this->_context;\n }", "public function getContext() {\n\t\treturn $this->getPrivateSetting('context');\n\t}", "public function cacheSetup()\n\t{\n\t\t// Generate the name\n\t\t$time = $this->modified;\n\t\t$extension = $this->type;\n\t\t$fileName = pathinfo($this->name, PATHINFO_FILENAME) . \".\" . md5($this->name . '.' . $time);\n\t\t$name = $fileName . \".\" . $extension;\n\n\t\t// Generate the cache file path\n\t\t$this->cacheFilePath = realpath(public_path() . '/' . $this->app['assets::config']['cache_path']) . '/' . $name;\n\n\t\t// Generate the cache file URL\n\t\t$this->cacheFileUrl = $this->app['assets::config']['cache_url'] . $name;\n\n\t\treturn $this->cacheFile = $name;\n\t}", "private function get_context() {\n return context_course::instance($this->course->id);\n }", "public function getContext() {\r\n\t\treturn $this->context;\r\n\t}", "function get_context_instance($contextlevel=NULL, $instance=0) {\n\n global $context_cache, $context_cache_id, $CONTEXT;\n static $allowed_contexts = array(CONTEXT_SYSTEM, CONTEXT_PERSONAL, CONTEXT_USER, CONTEXT_COURSECAT, CONTEXT_COURSE, CONTEXT_GROUP, CONTEXT_MODULE, CONTEXT_BLOCK);\n\n // Yu: Separating site and site course context - removed CONTEXT_COURSE override when SITEID\n \n // fix for MDL-9016\n if ($contextlevel == 'clearcache') {\n // Clear ALL cache\n $context_cache = array();\n $context_cache_id = array();\n $CONTEXT = ''; \n return false;\n }\n\n/// If no level is supplied then return the current global context if there is one\n if (empty($contextlevel)) {\n if (empty($CONTEXT)) {\n //fatal error, code must be fixed\n error(\"Error: get_context_instance() called without a context\");\n } else {\n return $CONTEXT;\n }\n }\n\n/// Backwards compatibility with obsoleted (CONTEXT_SYSTEM, SITEID)\n if ($contextlevel == CONTEXT_SYSTEM) {\n $instance = 0;\n }\n\n/// check allowed context levels\n if (!in_array($contextlevel, $allowed_contexts)) {\n // fatal error, code must be fixed - probably typo or switched parameters\n error('Error: get_context_instance() called with incorrect context level \"'.s($contextlevel).'\"');\n }\n\n/// Check the cache\n if (isset($context_cache[$contextlevel][$instance])) { // Already cached\n return $context_cache[$contextlevel][$instance];\n }\n\n/// Get it from the database, or create it\n if (!$context = get_record('context', 'contextlevel', $contextlevel, 'instanceid', $instance)) {\n create_context($contextlevel, $instance);\n $context = get_record('context', 'contextlevel', $contextlevel, 'instanceid', $instance);\n }\n\n/// Only add to cache if context isn't empty.\n if (!empty($context)) {\n $context_cache[$contextlevel][$instance] = $context; // Cache it for later\n $context_cache_id[$context->id] = $context; // Cache it for later\n }\n\n return $context;\n}", "public function context()\n {\n return $this->context;\n }", "public function context()\n {\n return $this->context;\n }", "public function files() {\n if(isset($this->cache['files'])) return $this->cache['files'];\n return $this->cache['files'] = new Files($this);\n }" ]
[ "0.64674646", "0.6071938", "0.5815943", "0.56743664", "0.5604517", "0.54792696", "0.5473542", "0.5459495", "0.5439038", "0.54256904", "0.54256904", "0.54256904", "0.54256904", "0.54256904", "0.5416612", "0.53899765", "0.5358736", "0.5349171", "0.5308736", "0.5301935", "0.5298288", "0.5298288", "0.5277234", "0.5252037", "0.5249687", "0.51868916", "0.51827395", "0.5180562", "0.5180562", "0.517884" ]
0.6363582
1
Fetch first child of $el with class name equals to $name and returns all li in an array.
protected function read_list($el, $name) { $result = array(); $list = $el->getElementsByTagName('div'); foreach ($list as $div) { if (strtolower($div->getAttribute('class')) == $name) { $lis = $el->getElementsByTagName('li'); foreach ($lis as $li) { $result[] = trim(html_entity_decode($this->get_innerhtml($li))); } } } return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function read($el, $name, $default = '') {\r\n $list = $el->getElementsByTagName('div');\r\n foreach ($list as $div) {\r\n if (strtolower($div->getAttribute('class')) == $name) {\r\n $result = $this->get_innerhtml($div);\r\n $result = str_ireplace('<p>', '', $result);\r\n $result = str_ireplace('</p>', '', $result);\r\n return $result;\r\n }\r\n }\r\n return $default;\r\n }", "public function getFirstChildByName($name) {\n foreach($this->__childs as $child) {\n if ($child->getName() == $name) {\n return $child;\n }\n }\n return null; \n }", "protected function _getChildrenByName($name)\n {\n assert(is_string($name), 'Wrong type for argument 1. String expected');\n\n $nodes = array();\n\n foreach ($this->children() as $node)\n {\n if ($node->getName() === $name) {\n $nodes[] = $node;\n }\n }\n unset($node);\n\n return $nodes;\n }", "public function offsetGet(mixed $name): self\n {\n return $this->children[$name];\n }", "public function getElements( $name ) {\n\t\treturn $this->getGpml()->$name;\n\t}", "public function get($name)\n {\n return $this->children[$name];\n }", "private function toplevel($name) {\n return $this->child_by_name(null, $name);\n }", "protected function getChildrenByName(DOMNode $node, $name)\n {\n $nodes = array();\n foreach ($node->childNodes as $node) {\n if ($node->nodeName == $name) {\n array_push($nodes, $node);\n }\n }\n return $nodes;\n }", "protected function _makeElt($name, $attributes = 0)\n {\n $elt = array(\n 'a' => $attributes,\n 'c' => 0,\n 'p' => self::BASE_ELT,\n 'v' => strval($name)\n );\n\n /* Check for polled status. */\n $this->_initPollList();\n $this->_setPolled($elt, isset($this->_cache['poll'][$name]));\n\n /* Check for open status. */\n switch ($GLOBALS['prefs']->getValue('nav_expanded')) {\n case self::OPEN_NONE:\n $open = false;\n break;\n\n case self::OPEN_ALL:\n $open = true;\n break;\n\n case self::OPEN_USER:\n $this->_initExpandedList();\n $open = !empty($this->_cache['expanded'][$name]);\n break;\n }\n $this->_setOpen($elt, $open);\n\n if (is_null($this->_delimiter)) {\n $elt['c'] = 0;\n return $elt;\n }\n\n $ns_info = $this->_getNamespace($name);\n $delimiter = is_null($ns_info)\n ? $this->_delimiter\n : $ns_info['delimiter'];\n $tmp = explode($delimiter, $name);\n $elt['c'] = count($tmp) - 1;\n\n if (!$this->_nohook) {\n try {\n $this->_setInvisible($elt, !Horde::callHook('display_folder', array($elt['v']), 'imp'));\n } catch (Horde_Exception_HookNotSet $e) {\n $this->_nohook = true;\n }\n }\n\n if ($elt['c'] != 0) {\n $elt['p'] = implode(is_null($ns_info) ? $this->_delimiter : $ns_info['delimiter'], array_slice($tmp, 0, $elt['c']));\n }\n\n if (is_null($ns_info)) {\n return $elt;\n }\n\n switch ($ns_info['type']) {\n case Horde_Imap_Client::NS_PERSONAL:\n /* Strip personal namespace. */\n if (!empty($ns_info['name']) && ($elt['c'] != 0)) {\n --$elt['c'];\n if (strpos($elt['p'], $ns_info['delimiter']) === false) {\n $elt['p'] = self::BASE_ELT;\n } elseif (strpos($elt['v'], $ns_info['name'] . 'INBOX' . $ns_info['delimiter']) === 0) {\n $elt['p'] = 'INBOX';\n }\n }\n break;\n\n case Horde_Imap_Client::NS_OTHER:\n case Horde_Imap_Client::NS_SHARED:\n if (substr($ns_info['name'], 0, -1 * strlen($ns_info['delimiter'])) == $elt['v']) {\n $elt['a'] = self::ELT_NOSELECT | self::ELT_NAMESPACE;\n }\n\n if ($GLOBALS['prefs']->getValue('tree_view')) {\n /* Don't add namespace element to tree. */\n if ($this->isNamespace($elt)) {\n return false;\n }\n\n if ($elt['c'] == 1) {\n $elt['p'] = ($ns_info['type'] == Horde_Imap_Client::NS_OTHER)\n ? self::OTHER_KEY\n : self::SHARED_KEY;\n }\n }\n break;\n }\n\n return $elt;\n }", "public function getElementByTagName($name)\n {\n return $this->find($name, 0);\n }", "public function getChildsByName($name) {\n $ret = array();\n foreach($this->__childs as $child) {\n if ($child->getName() == $name) {\n $ret[] = $child;\n }\n }\n return $name;\n }", "public function __get($name){\n if($this->locator->hasLocation($name)){\n return $this->findElement($name);\n }\n }", "public function findEmployeeByName($name) {\n // use XPath to find the employee we're looking for\n $query = '//employees/employee/name[text() = \"' . $name . '\"]/..';\n\n // create a new XPath object and associate it with the document we want to query against\n $xpath = new DOMXPath($this->domDocument);\n $result = $xpath->query($query);\n $arrEmps = array();\n if($result->length){\n // iterate of the results\n $classCounter = 0;\n foreach($result as $emp) {\n // add the details of the employee to an array\n $arrEmps[$classCounter][\"name\"] = $emp->getElementsByTagName(\"name\")->item(0)->nodeValue;\n $arrEmps[$classCounter][\"gender\"] = $emp->getElementsByTagName(\"gender\")->item(0)->nodeValue;\n $arrEmps[$classCounter][\"phone\"] = $emp->getElementsByTagName(\"phone\")->item(0)->nodeValue;\n $arrEmps[$classCounter][\"email\"] = $emp->getElementsByTagName(\"email\")->item(0)->nodeValue;\n $classCounter++;\n }\n }\n return $arrEmps;\n }", "public function getChildrenByName($name) {\n $this->select->from($this);\n $this->select->where(\"C.child_full_name LIKE ?\", '%' . $name . '%');\n\n return $this->fetchAll($this->select);\n }", "public function __get($name)\n\t{\n\t\treturn $this->element($name);\n\t}", "public function get($name) {\n\t\tif( isset($this->childs[$name]) ) {\n\t\t\treturn $this->childs[$name];\n\t\t}\n\t\treturn null;\n\t}", "function get_list_items_by_name( $name )\n {\n $q = \"SELECT * FROM \n list_items\n LEFT JOIN lists ON list_items.list_id = lists.id \n WHERE LOWER(TRIM(name)) = \" . $this->db->escape(strtolower(trim($name))) . \n ' ORDER BY sort_order';\n $res = $this->db->query( $q );\n \n $data = array();\n foreach( $res->result() as $row ) {\n $item = $this->get_item_by_type($row->type, $row->data_id);\n \n\n /* \n \t\t$q = \"\n SELECT a.id, title, body, excerpt, ac.category, publish_on, author, \n owner, ast.status, a.group as group_id, gt.name as group_name, \n u.firstname, u.lastname, u.nickname\n \tFROM articles as a, article_categories as ac, article_statuses as ast, group_tree as gt, users as u\n WHERE a.category = ac.id AND a.status = ast.id AND a.group = gt.id AND u.username = a.owner\n AND a.id = $row->data_id\";\n\n $res = $this->db->query( $q );\n if( $res->num_rows() ) {\n $ritem = $res->row();\n\t\t\t $ritem->media = $this->media_model->get_media_for_path(\"/articles/$ritem->id\", 'general', 1);\n $data[] = $ritem;\n }*/\n if ($item) $data[] = $item;\n }\n return $data;\n }", "public function __get($name)\n\t{\n\t\tif ($this->_lastChild !== null &&\n\t\t\t\t$this->_lastChild->_node->nodeName === $this->_prefix . $name)\n\t\t{\n\t\t\treturn $this->_lastChild;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$element = $this->_element($name);\n\t\t\t$this->_lastChild = new self($this->_doc, $element,\n\t\t\t\t\t$this->_nsUri, $this->_prefix, $this->_qualifyAttributes);\n\t\t\treturn $this->_lastChild;\n\t\t}\n\t}", "public function getChildElements() {}", "public function getUl() {}", "function getSiblings($name)\n\t\t{\n\t\t\t$name = trim(strtolower($name));\n\t\t\t$par = $this->getParents(trim($name));\n\t\t\tif (empty($par)) \n\t\t\t{\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\t\n\t\t\t$all_children = $this->getChildren($par['mother']);\n\t\t\tforeach ($all_children as $key => $value) \n\t\t\t{\n\t\t\t\tif($value[\"name\"] == $name)\n\t\t\t\t{\n\t\t\t\t\tunset($all_children[$key]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $all_children;\n\t\t}", "public function getElementsByClassName($className, $tag = \"*\", $node = null) {\n $classNames = explode('|', str_replace(' ', '', $className));\n $nodes = array();\n $domNodeList = ($node == null) ? $this->getElementsByTagName($tag) : $node->getElementsByTagName($tag);\n\n for ($i = 0; $i < $domNodeList->length; $i++) {\n /** @var DOMElement $element */\n $element = $domNodeList->item($i);\n if ($element->hasAttributes() && $element->hasAttribute('class')) {\n for ($j = 0; $j < count($classNames); $j++) {\n if ($this->hasClass($element, $classNames[$j])) {\n $nodes[] = $domNodeList->item($i);\n break;\n }\n }\n }\n }\n\n return $nodes;\n }", "function getElementsByTagname ($a_elementname, $a_node = \"\")\n\t{\n\t\tif (empty($a_node)) {\n\t\t\t$a_node = $this->doc;\n\t\t}\n\t\t\n\t\tif (count($node = $a_node->get_elements_by_tagname($a_elementname)) > 0) {\n\t\t\treturn $node;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "public function getChildren($name = null)\n {\n if (!$name) {\n return $this->childContainer;\n } else {\n return $this->childContainer->getItem($name);\n }\n }", "protected function getChildrenRecursive($name, &$result)\n\t{\n\t\tItemHelper::getChildrenRecursive($name, $result, $this->children);\n\t}", "private function getChildList(){\n\t\tif ($this->_childList == null) {\n\t\t\t$this->_childList = $this->getStructureNode()->getChildren();\n\t\t\t$this->_childList = $this->_childList->sort(array(\n\t\t\t\tnew SortRule($this->_childList->exprMember('title'))));\n\t\t}\n\t\treturn $this->_childList;\n\t}", "function fetchElement($name, $value, &$node, $control_name)\n {\n $ctrl = $control_name .'['. $name .']';\n \n // Construct the various argument calls that are supported.\n $attribs = ' ';\n if ($v = $node->attributes( 'size' )) {\n $attribs .= 'size=\"'.$v.'\"';\n }\n if ($v = $node->attributes( 'class' )) {\n $attribs .= 'class=\"'.$v.'\"';\n } else {\n $attribs .= 'class=\"inputbox\"';\n }\n if ($m = $node->attributes( 'multiple' ))\n {\n $attribs .= ' multiple=\"multiple\"';\n $ctrl .= '[]';\n }\n \n // Query items for list.\n $db = & JFactory::getDBO();\n $db->setQuery($node->attributes('sql'));\n $key = ($node->attributes('key_field') ? $node->attributes('key_field') : 'value');\n $val = ($node->attributes('value_field') ? $node->attributes('value_field') : $name);\n \n $options = array ();\n foreach ($node->children() as $option)\n {\n $options[]= array($key=> $option->attributes('value'),$val => $option->data());\n }\n \n $rows = $db->loadAssocList();\n if($rows)\n {\n\t foreach ($rows as $row){\n \t $options[]=array($key=>$row[$key],$val=>$row[$val]);\n \t }\n \t }\n if($options){\n return JHTML::_('select.genericlist',$options, $ctrl, $attribs, $key, $val, $value, $control_name.$name);\n }\n }", "public function getChildNodes() {}", "public function getChildNodes() {}", "public function getChildNodes();" ]
[ "0.61263555", "0.56702036", "0.5652199", "0.5628246", "0.55545205", "0.54151684", "0.5303527", "0.52979654", "0.52324617", "0.5228412", "0.5225914", "0.51862645", "0.5164076", "0.5162426", "0.5157026", "0.5079374", "0.5076307", "0.50721323", "0.5065997", "0.501336", "0.4996645", "0.49917242", "0.49674225", "0.49631527", "0.4917202", "0.49028042", "0.48805302", "0.48803687", "0.4877994", "0.48649064" ]
0.7723638
0
Fetch first child of $el with class name equals to $name and returns its inner html. Returns $default if no child is found.
protected function read($el, $name, $default = '') { $list = $el->getElementsByTagName('div'); foreach ($list as $div) { if (strtolower($div->getAttribute('class')) == $name) { $result = $this->get_innerhtml($div); $result = str_ireplace('<p>', '', $result); $result = str_ireplace('</p>', '', $result); return $result; } } return $default; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getFirstChildByName($name) {\n foreach($this->__childs as $child) {\n if ($child->getName() == $name) {\n return $child;\n }\n }\n return null; \n }", "public function get($name) {\n\t\tif( isset($this->childs[$name]) ) {\n\t\t\treturn $this->childs[$name];\n\t\t}\n\t\treturn null;\n\t}", "public function __get($name)\n\t{\n\t\tif ($this->_lastChild !== null &&\n\t\t\t\t$this->_lastChild->_node->nodeName === $this->_prefix . $name)\n\t\t{\n\t\t\treturn $this->_lastChild;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$element = $this->_element($name);\n\t\t\t$this->_lastChild = new self($this->_doc, $element,\n\t\t\t\t\t$this->_nsUri, $this->_prefix, $this->_qualifyAttributes);\n\t\t\treturn $this->_lastChild;\n\t\t}\n\t}", "public function renderElement($name) {\n $element = $this->get($name);\n $type = strtolower(current(array_reverse(explode(\"\\\\\", get_class($element)))));\n\n $method = \"_render\" . ucfirst($type);\n if (method_exists($this, $method))\n $html = $this->$method($element);\n else\n $html = $this->_renderDefault($element);\n return $html;\n }", "public function fetchElement($name, $value, &$node, $control_name)\n\t{\n\t\t$db = App::get('db');\n\n\t\t$query = $db->getQuery()\n\t\t\t->select('*')\n\t\t\t->from('#__template_styles')\n\t\t\t->whereEquals('client_id', '0')\n\t\t\t->whereEquals('home', '0');\n\n\t\t$db->setQuery($query->toString());\n\t\t$data = $db->loadObjectList();\n\n\t\t$default = Builder\\Select::option(0, App::get('language')->txt('JOPTION_USE_DEFAULT'), 'id', 'description');\n\t\tarray_unshift($data, $default);\n\n\t\t$selected = $this->_getSelected();\n\t\t$html = Builder\\Select::genericlist($data, $control_name . '[' . $name . ']', 'class=\"inputbox\" size=\"6\"', 'id', 'description', $selected);\n\n\t\treturn $html;\n\t}", "public function getElementByClassName($className, $tag = \"*\", $node = null, $deep = true) {\n $nodes = $this->getElementsByClassName($className, $tag, $node, $deep);\n return count($nodes) > 0 ? $nodes[0] : null;\n }", "public function offsetGet(mixed $name): self\n {\n return $this->children[$name];\n }", "public static function &getElement($name): \\DOMElement\n {\n if ($name == 'root') {\n return self::getInstance()->realRoot;\n }\n $me = self::getInstance();\n if (!isset($me->elements[$name])) {\n $me->elements[$name] = $me->realRoot->appendChild($me->xml->createElement($name));\n }\n return $me->elements[$name];\n }", "function firstChild() {\n\t\t$children = $this->children();\n\t\tif (sizeof($children>0)) {\n\t\t\treturn $children[0];\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "public function findElement($selector = 'all') {\r\n\t\t$attrs = $this->parseSelector($selector);\r\n\t\tforeach($this->children as $child) {\r\n\t\t\tif ($child->matchAttrs($attrs)) {\r\n\t\t\t\treturn $child;\r\n\t\t\t} else {\r\n\t\t\t\tif ($elem = $child->findElement($selector)) {\r\n\t\t\t\t\treturn $elem;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "function getTag($name, $default = 0) {\n if(empty($this -> $name)) {\n return $default ;\n } else {\n return $this -> $name ;\n }\n }", "public function __get($name){\n if($this->locator->hasLocation($name)){\n return $this->findElement($name);\n }\n }", "public function __get($name)\n\t{\n\t\treturn $this->element($name);\n\t}", "private function getChildNode($node, $name) {\n\t\tforeach ($node->childNodes as $child) {\n\t\t\tif ($child->nodeName === $name) {\n\t\t\t\treturn $child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "abstract function getAsElem($dom);", "public function firstChild()\n {\n $node = $this->node->firstChild;\n\n if ($node === null) {\n return null;\n }\n\n return new Element($node);\n }", "public function getChildHtml($name='', $useCache=true, $sorted=true)\n {\n return parent::getChildHtml($name, $useCache, $sorted);\n }", "public function element(): ?string\n {\n return $this->element ?: $this->first();\n }", "public function getFirstChild();", "public function renderChild($name)\n {\n if ($child = $this->getChild($name)) {\n return $child->render();\n } else {\n return \"\";\n }\n }", "public function getChild($c){\n if($this->childNodes[$c] != NULL){\n return $this->childNodes[$c];\n }\n else{\n return NULL;\n }\n }", "public function get($name)\n {\n return $this->children[$name];\n }", "private function toplevel($name) {\n return $this->child_by_name(null, $name);\n }", "public function fetchElement($name, $value, &$node, $control_name)\n {\n if($value)\n {\n return '<div align=\"center\" style=\"background-color: #E5FF99; font-size: 1.2em; border-radius: 10px; margin-top: 0.4em;\">'.jgettext($value).'</div>';\n }\n else\n {\n return '<hr />';\n }\n }", "function getElemOrAttrVal(&$element, $name){\n\t\t$value;\n\t\t$parts = explode(\".\", $name);\n\t\t\t\n\t\tswitch(count($parts)){\n\t\t\tcase 1:\n\t\t\t\t$value = $element->xpath(\".//\". $parts[0] .\"[1]\");\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif($parts[1] == \"\"){\n\t\t\t\t\tfprintf(STDERR, \"ERROR! Wrong query\\n\");\n\t\t\t\t\texit(EWQUERY);\n\t\t\t\t}\n\t\t\t\tif($parts[0] == \"\")\n\t\t\t\t\t$parts[0] = \"*\";\n\t\t\t\t\n\n\t\t\t\tif($parts[0] == $element->getName() || $parts[0] == \"*\"){\n\t\t\t\t\tif($element->attributes()->$parts[1] != false){\n\t\t\t\t\t\t$value = $element;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$value = $element->xpath(\".//\". $parts[0] .\"[@\" . $parts[1] . \"][1]\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfprintf(STDERR, \"ERROR! Wrong query\\n\");\n\t\t\t\texit(EWQUERY);\n\t\t}\n\n\t\tif(count($value) != 0)\n\t\t\t$value = $value[0];\n\t\telse return false;\n\n\t\tif(count($parts) == 1){\n\t\t\tif($value->count() != 0){\n\t\t\t\tfprintf(STDERR, \"ERROR! Input is in an an illegal format!\\n\");\n\t\t\t\texit(EINPUTF);\n\t\t\t}\n\t\t\telse return $value[0];\n\t\t}\n\t\telse return $value->attributes()->$parts[1];\n\t}", "function &FindNodeByName($Name)\n {\n foreach($this->ChildNodes as $node)\n if ( $node->Name == $Name )\n return $node;\n\n // To make PHP5 happy, we will not return NULL, but a variable which\n // has a value of NULL.\n $NULL = NULL;\n return $NULL;\n }", "public function findOne(string $selector)\n {\n return new SimpleXmlDomBlank();\n }", "abstract protected function get_root_element();", "function getFirstElementNode( &$elem, $tagname = '') {\n\t\t$nextElem = $elem->getFirstChild();\n\n\t\twhile( $nextElem ) {\n\t\t\tif( ($nextElem->getNodeType() == XML_ELEMENT_NODE) ) { // only node elements\n\t\t\t\tif( $tagname != '' ) {\n\t\t\t\t\tif(strtolower($nextElem->getNodeName()) == $tagname)\n\t\t\t\t\t\treturn $nextElem;\n\t\t\t\t} else {\n return $nextElem;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$nextElem = $nextElem->getNextSibling();\n\t\t}\n\t return NULL;\n\t}", "function get_child_by_outer_html($outer_html,$exactly=false,$include_subchildren=false)\n\t{\t\t\n\t\t$params = array( \"inner_number\" => $this->inner_number , \"outer_html\" => $outer_html , \"exactly\" => $exactly , \"include_subchildren\" => $include_subchildren);\n\t\t$child_inner_number=-1;\n\t\tif ($this->inner_number!=-1)\n\t\t\t$child_inner_number=$this->call_get(__FUNCTION__,$params);\n\t\treturn new XHEInterface($child_inner_number,$this->server,$this->password);\n\t}" ]
[ "0.6228843", "0.57680947", "0.566378", "0.56176656", "0.55473787", "0.54208755", "0.54067624", "0.5387862", "0.532956", "0.5317605", "0.5308805", "0.52735484", "0.52621186", "0.5230969", "0.5207049", "0.5177255", "0.5170779", "0.5135536", "0.5127617", "0.51206994", "0.50768524", "0.506744", "0.50417465", "0.5037264", "0.5033888", "0.5019743", "0.50143415", "0.5003655", "0.4982512", "0.49772537" ]
0.76925004
0
/ Update user vendor
public function updateVendor() { try { if (!($this->vendor instanceof Base_Model_ObtorLib_App_Core_Catalog_Entity_Vendor)) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception(" Vendor Entity not initialized"); } else { $objVendor = new Base_Model_ObtorLib_App_Core_Catalog_Dao_Vendor(); $objVendor->vendor = $this->vendor; return $objVendor->updateVendor(); } } catch (Exception $ex) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception($ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update($vendor);", "public function update_vendor($id, $data)\n\t{\n\t\t// Unset, if neccessary\n\t\tif ($data['api_id'] == '0')\n\t\t\t$data['api_id'] = NULL;\n\t\t\n\t\tif (empty($data['orderemail']))\n\t\t\t$data['orderemail'] = NULL;\n\t\t\t\n\t\tif (empty($data['ordername']))\n\t\t\t$data['ordername'] = NULL;\n\t\t\n\t\t// Limit to this vendor_id\n\t\t$this->db->where('id', $id);\n\t\t\n\t\t// Perform an update\n\t\t$this->db->update('vendors', $data);\n\t}", "public function setVendor(string $vendor)\n {\n }", "public function handleVendor(){ \n $login = $this->hlp->logn();\n $vStr = \"vendorfee\";\n $vFee = intval($this->configuration->valueGetter($vStr));\n \n if (!$this->listings->isVendor($login)) {\n if ($this->wallet->getBalance($login) >= $vFee){ \n $this->wallet->moveAndStore($vStr, $login, \"profit\", $vFee);\n $this->listings->becomeVendor($login);\n $this->flashMessage(\"Váš účet má nyní vendor status\");\n $this->redirect(\"Listings:in\");\n } else {\n $this->flashMessage(\"You don't have sufficient funds!\");\n $this->redirect(\"Listings:in\");\n } \n } else {\n $this->redirect(\"Listings:in\");\n }\n }", "public function updateVendor($body)\n {\n list($response, $statusCode, $httpHeader) = $this->updateVendorWithHttpInfo ($body);\n return $response; \n }", "function edit_allowed_vendor($user_data_id) {\n\n $data = array(\n 'allowed_url' => $this->input->post('url_link'),\n 'allowed_image_url' => $this->input->post('image_url_link'),\n 'allowed_tagline' => $this->input->post('tagline'),\n 'allowed_body' => $this->input->post('allowed_body'),\n 'allowed_modified' => date('Y-m-d H:i:s'),\n );\n\n if ($data['allowed_image_url'] === '')\n {\n $data['allowed_image_url'] = '/webroot/vendor_logos/default_logo.png';\n }\n if ( ! empty($_FILES['userfile']['name']))\n {\n $image_data = $this->upload->data();\n $image_loc = $image_data['file_name'];\n $data['allowed_image_url'] = '/webroot/vendor_logos/'.$image_loc;\n }\n $this->db->where('id', $id);\n return $this->db->update('allowed_vendors', $data);\n }", "public function update_partner_profile($user_data) {\n\n $partner_id = $user_data['vendor_id'];\n if (isset($user_data['name']) && $user_data['name'] != '') {\n $updated_user_data = array(\n 'first_name' => $user_data['name'],\n );\n $this->db->where('id', $partner_id);\n $this->db->update('vendors', $updated_user_data);\n return $updated_user_data;\n }\n\n\n if (isset($user_data['lastname']) && $user_data['lastname'] != '') {\n\n $updated_user_data = array(\n 'last_name' => $user_data['lastname'],\n );\n $this->db->where('id', $partner_id);\n $this->db->update('vendors', $updated_user_data);\n return $updated_user_data;\n }\n }", "public function update_vendor_email_on_user_update( $user_id = 0, $old_user_data ) {\n\t\t$vendor = new FES_Vendor( $user_id, true );\n\t\tif ( ! $vendor ) {\n\t\t\treturn false;\n\t\t}\n\t\t$user = get_userdata( $user_id );\n\t\tif ( ! empty( $user ) && $user->user_email !== $vendor->email ) {\n\t\t\tif ( ! $this->get_vendor_by( 'email', $user->user_email ) ) {\n\t\t\t\t$success = $this->update( $vendor->id, array( 'email' => $user->user_email ) );\n\t\t\t\tif ( $success ) {\n\t\t\t\t\t/**\n\t\t\t\t\t * Update Vendor Email on User Update\n\t\t\t\t\t *\n\t\t\t\t\t * An action that runs when a vendor email is updated \n\t\t\t\t\t * because a user email was changed.\n\t\t\t\t\t *\n\t\t\t\t\t * @since 2.0.0\n\t\t\t\t\t *\n\t\t\t\t\t * @param WP_User $user User object of edited user.\n\t\t\t\t\t * @param FES_Vendor $vendor Vendor object of edited user.\n\t\t\t\t\t */\t\n\t\t\t\t\tdo_action( 'fes_update_vendor_email_on_user_update', $user, $vendor );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function testUpdateUser()\n {\n }", "public function testUpdateVendorComplianceSurveyCustomFields()\n {\n }", "public function edit(Vendor $vendor)\n {\n //\n }", "public function update(Request $request)\n {\n if (!Vendor::where('customer_uid', $request->user()->uid)->first()) {\n return errorResponse(\"You don't have vendor yet.\", 404);\n }\n $vendor = Vendor::where('customer_uid', $request->user()->uid)->first();\n $validator = Validator::make($request->all(), [\n 'name' => 'required|max:250',\n 'description' => 'required|min:50',\n 'logo' => 'image',\n 'id_card' => 'image',\n 'national_identity_number' => 'required|unique:vendors,national_identity_number,' . $vendor->id . ',id,deleted_at,NULL',\n 'id_card_with_customer' => 'image',\n 'phone' => 'required|max:20|unique:vendors,phone,' . $vendor->id . ',id,deleted_at,NULL',\n 'village_id' => 'required|exists:villages,id',\n 'street' => 'required',\n 'latitude' => 'required|numeric',\n 'longitude' => 'required|numeric'\n ]);\n if ($validator->fails()) {\n return errorResponse($validator->errors(), 400);\n }\n $requestData = $request->all();\n $village = Village::findOrFail($requestData['village_id']);\n $requestData['district_id'] = $village->district->id;\n $requestData['city_id'] = $village->district->city->id;\n $requestData['province_id'] = $village->district->city->province->id;\n DB::beginTransaction();\n try {\n $requestData['customer_uid'] = $request->user()->uid;\n $requestData['phone'] = $this->phoneNumberUtil->parse($requestData['phone'], 'ID');\n if (!$this->phoneNumberUtil->isValidNumber($requestData['phone'])) {\n return errorResponse('No telepon tidak valid', 400);\n }\n $requestData['phone'] = '+' . $requestData['phone']->getCountryCode() .\n $requestData['phone']->getNationalNumber();\n Log::info('Before update : ' . $vendor);\n $vendor->update($requestData);\n $vendor->address()->delete();\n $address = new VendorAddress($requestData);\n $vendor->address()->save($address);\n Log::info('After update Vendor : ' . $vendor);\n DB::commit();\n return (new VendorResource($vendor));\n } catch (Exception $e) {\n DB::rollBack();\n return errorResponse($e->getMessage(), 500);\n }\n }", "public function update($itemVendorX){\r\n\t\t$sql = 'UPDATE item_vendor_x SET price = ?, part_number = ?, item_name = ? WHERE item_id = ? AND vendor_id = ? ';\r\n\t\t$sqlQuery = new SqlQuery($sql);\r\n\t\t\n\t\t$sqlQuery->set($itemVendorX->price);\n\t\t$sqlQuery->set($itemVendorX->partNumber);\n\t\t$sqlQuery->set($itemVendorX->itemName);\n\r\n\t\t\n\t\t$sqlQuery->setNumber($itemVendorX->itemId);\n\n\t\t$sqlQuery->setNumber($itemVendorX->vendorId);\n\r\n\t\treturn $this->executeUpdate($sqlQuery);\r\n\t}", "public function updateVendor(Request $request, MasterVendor $vendor)\n {\n\n $validator = Validator::make(\n $request->all(),\n [\n 'nama' => 'required|max:255',\n 'kode' => 'required|size:5',\n 'harga_katering_dasar' => 'required',\n 'add_on' => 'required',\n 'harga_add_on' => 'required',\n ],\n [\n 'nama.required' => 'Harap Masukan Nama Vendor (Maks 255)',\n 'kode.size' => 'Kode Vendor Harus 5 Buah',\n 'harga_katering_dasar.required' => 'Harap Masukan Harga Dasar Katering',\n 'add_on.required' => 'Harap Masukan Menu Tambahan',\n 'harga_add_on.required' => 'Harap Masukan Harga Menu Tambahan',\n ]\n );\n\n if ($validator->fails()) {\n return response()->json([\n 'success' => false,\n 'message' => $validator->errors()\n ], 401);\n } else {\n\n $vendor = MasterVendor::whereId($request->input('id'))->update([\n 'nama' => $request->input('nama'),\n 'kode' => $request->input('kode'),\n 'harga_katering_dasar' => $request->input('harga_katering_dasar'),\n 'add_on' => $request->input('add_on'),\n 'harga_add_on' => $request->input('harga_add_on'),\n ]);\n\n if ($vendor) {\n return response()->json([\n 'success' => true,\n 'message' => 'Menu Berhasil Diupdate!',\n ], 200);\n } else {\n return response()->json([\n 'success' => false,\n 'message' => 'Menu Gagal Diupdate!',\n ], 401);\n }\n }\n\n }", "public function change($vendor_id){\n\t\tif(!$this->session->userdata(\"user_id\")){\n\t\t\treturn redirect(\"auth\");\n\t\t}else{\n\t\t\t$vendor = $this->vendors_model->get_details($vendor_id);\n\t\t\t$user = $this->membership_model->get_authenticated_user_by_id($this->session->userdata(\"user_id\"));\n\t\t\t$countries = $this->countries_model->get_countries();\n\t\t\t$this->load->view('vendors/edit', [\n\t\t\t\t'user' => $user, \n\t\t\t\t'vendor' => $vendor, \n\t\t\t\t'countries' => $countries\n\t\t\t]);\n\t\t}\n\t}", "function doVendor() {\n\t$data = array();\n\t$data['apikey'] = APIKEY;\n\t\n\t$result = sendjson($data, HD_SERVER.\"/devices/vendors.json\");\n\t//$result = sendxml($data, HD_SERVER.\"/devices/vendors.xml\");\n}", "public function testUpdateVendorComplianceSurvey()\n {\n }", "public function update(Request $request, Vendor $vendor)\n {\n //Validate the form\n $this->validate(request(), [\n 'name' => 'required|string|max:255'\n ]);\n flash('Successfully updated vendor!')->success();\n $vendor->update(request()->all());\n return redirect()->route('vendors_index');\n }", "public function update(User $user, SystemUnit $systemUnit)\n {\n //\n }", "public function update(Request $request, Vendor $vendor)\n {\n $data = $this->validate($request, [\n 'name' => 'required',\n 'abbr' => 'nullable'\n ]);\n\n $data['author_id'] = auth()->id();\n\n $vendor = $this->vendorService->update($vendor, $data);\n\n session()->flash('message:success', 'Vendor updated');\n return redirect(route('admin.vendor.edit', $vendor->id));\n }", "public function testUpdateNetworkMerakiAuthUser()\n {\n }", "public function update(Request $request, Vendor $vendor)\n {\n $vendor->update($request->validate([\n 'name' => 'required|max:60',\n 'notes' => 'nullable|max:255',\n 'website' => 'nullable|url|max:255',\n 'is_active' => 'required|boolean',\n ]));\n\n flash(__('vendor.updated'), 'success');\n\n return redirect()->route('vendors.index', request(['page', 'q']));\n }", "public function update(Request $request, Vendor $Vendor) {\n $this->saveUpdateVendorDetails($request);\n return redirect()->route('vendors.index')->with('success', 'Vendor updated successfully');\n }", "public function updatePoinsUserAction()\n {\n \t$this->pointServices->updatePointUser($this->getUser());\n \t\n \treturn new Response(\"OK\");\n }", "public function vendorChangeStatus(Request $request)\n {\n $validator=Validator::make($request->all(), [\n 'user_id' => 'required',\n 'vendor_id' => 'required',\n 'tag'=>'required',\n 'gig_id'=>'required',\n 'status'=>'required'\n ]);\n if ($validator->fails())\n {\n return response(array(\n 'success'=>0,\n 'data'=>$validator->errors()\n ));\n }\n else\n {\n $response=VendorServiceGig::where(['id'=>$request->gig_id,'vendor_id'=>$request->vendor_id])->update([\n 'status'=>$request->status\n ]);\n if($response)\n {\n return response(array(\n 'success'=>1,\n 'msg'=>'Successfully Updated'\n ));\n }\n else {\n return response(array(\n 'success'=>0,\n 'msg'=>'Something Went Wrong'\n ));\n }\n }\n }", "public function update_account() {\n global $dbconfig;\n\n $user_id = $this->params['user_id'];\n $status = isset($this->params['status']) ? $this->params['status'] : BLOCKED;\n $account_dbobj = $this->params['account_dbobj'];\n $user_status = BLOCKED;\n $store_status = PENDING;\n\n if($status === ACTIVATED) {\n $user_status = CREATED;\n $store_status = PENDING;\n }\n\n // update users table\n $user_obj = new User($account_dbobj, $user_id);\n $user_obj->setStatus($status);\n $user_obj->save();\n\n $user = BaseModel::findCachedOne($dbconfig->account->name . \".user?id=$user_id\");\n if(!empty($user['store_id'])){\n $store_id = $user['store_id'];\n // store need to manually launch\n $store_obj = new Store($account_dbobj, $store_id);\n if($store_obj->getId()) {\n $store_obj->setStatus($store_status);\n $store_obj->save();\n if($store_status != ACTIVATED){\n GlobalProductsMapper::deleteProductsInStore($account_dbobj, $store_id);\n }\n }\n }\n }", "protected function _setVendor()\n {\n // use as the vendor name. e.g., './scripts/solar' => 'solar'\n $path = explode(DIRECTORY_SEPARATOR, $this->_argv[0]);\n $this->_vendor = end($path);\n \n // change vendor name to a class name prefix:\n // 'foo' => 'Foo'\n // 'foo-bar' => 'FooBar'\n // 'foo_bar' => 'FooBar'\n $this->_vendor = str_replace(array('-', '_'), ' ', $this->_vendor);\n $this->_vendor = ucwords($this->_vendor);\n $this->_vendor = str_replace(' ', '', $this->_vendor);\n }", "public function testDestiny2GetVendor()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "function update_user_option($user_id, $option_name, $newvalue, $is_global = \\false)\n {\n }", "public function update(SaveVendorRequest $request, Vendor $vendor)\n {\n $vendor->vendor_id = $request->input('vendor_id');\n $vendor->vendor_code = $request->input('vendor_code');\n $vendor->supplier_name = $request->input('supplier_name');\n $vendor->contact_person = $request->input('contact_person');\n $vendor->address = $request->input('address');\n $vendor->city = $request->input('city');\n $vendor->state_or_province = $request->input('state_or_province');\n $vendor->country = $request->input('country');\n $vendor->postal_code = $request->input('postal_code');\n $vendor->phone_number = $request->input('phone_number');\n $vendor->fax_number = $request->input('fax_number');\n $vendor->email = $request->input('email');\n $vendor->save();\n\n return redirect()->route('vendors.index')->with('success', 'Vendor updated successfully.');\n }" ]
[ "0.77089745", "0.678249", "0.6584451", "0.6425409", "0.6245101", "0.62318724", "0.62134546", "0.6159758", "0.6158834", "0.6122324", "0.6108975", "0.60946953", "0.602808", "0.59663606", "0.59483075", "0.59092873", "0.59023994", "0.58952296", "0.5860157", "0.5858423", "0.58498704", "0.5802578", "0.57960314", "0.5784667", "0.5781054", "0.5780597", "0.5769366", "0.5750897", "0.57450724", "0.57340425" ]
0.713382
1
/ Search user vendors....
public function search() { try { if (!($this->vendor instanceof Base_Model_ObtorLib_App_Core_Catalog_Entity_Vendor)) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception(" Vendor Entity not initialized"); } else { $objVendor = new Base_Model_ObtorLib_App_Core_Catalog_Dao_Vendor(); $objVendor->vendor = $this->vendor; return $objVendor->search(); } } catch (Exception $ex) { throw new Base_Model_ObtorLib_App_Core_Catalog_Exception($ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getActiveVendors() {\n $this->resetResponse();\n if ($this->ci->session->userdata('user_id') != null) {\n $archived = $this->ci->input->post('archived', true);\n\n $result = $this->model->getActiveVendors('*', array(\"person_type\" => Globals::PERSON_TYPE_VENDOR, \"person_archived\" => $archived))->result();\n\n if ($result) {\n $this->_status = true;\n $this->_message = '';\n $this->_rdata = $result;\n\n } else {\n $this->_status = false;\n $this->_message = $this->ci->lang->line('no_records_found');\n }\n \n } else {\n $this->_status = false;\n $this->_message = $this->ci->lang->line('invalid_user');\n \n }\n\n return $this->getResponse();\n }", "public function get_vendors( $args = array() ) {\n\n\t\tglobal $wpdb;\n\n\t\t$defaults = array(\n\t\t\t'number' => 20,\n\t\t\t'offset' => 0,\n\t\t\t'user_id' => 0,\n\t\t\t'orderby' => 'id',\n\t\t\t'order' => 'DESC'\n\t\t);\n\n\t\t$args = wp_parse_args( $args, $defaults );\n\n\t\tif ( $args['number'] < 1 ) {\n\t\t\t$args['number'] = 999999999999;\n\t\t}\n\n\t\t$where = '';\n\n\t\t// specific vendors\n\t\tif ( ! empty( $args['id'] ) ) {\n\n\t\t\tif ( is_array( $args['id'] ) ) {\n\t\t\t\t$ids = implode( ',', $args['id'] );\n\t\t\t} else {\n\t\t\t\t$ids = intval( $args['id'] );\n\t\t\t}\n\n\t\t\t$where .= \" WHERE `id` IN( {$ids} ) \";\n\n\t\t}\n\n\t\t// vendors for specific user accounts\n\t\tif ( ! empty( $args['user_id'] ) ) {\n\n\t\t\tif ( is_array( $args['user_id'] ) ) {\n\t\t\t\t$user_ids = implode( ',', $args['user_id'] );\n\t\t\t} else {\n\t\t\t\t$user_ids = intval( $args['user_id'] );\n\t\t\t}\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `user_id` IN( {$user_ids} ) \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `user_id` IN( {$user_ids} ) \";\n\t\t\t}\n\n\n\t\t}\n\n\t\t//specific vendors by email\n\t\tif ( ! empty( $args['email'] ) ) {\n\n\t\t\tif ( is_array( $args['email'] ) ) {\n\t\t\t\t$emails = \"'\" . implode( \"', '\", $args['email'] ) . \"'\";\n\t\t\t} else {\n\t\t\t\t$emails = \"'\" . $args['email'] . \"'\";\n\t\t\t}\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `email` IN( {$emails} ) \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `email` IN( {$emails} ) \";\n\t\t\t}\n\n\t\t}\n\n\t\t// specific vendors by username\n\t\tif ( ! empty( $args['username'] ) ) {\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `username` LIKE '\" . $args['username'] . \"' \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `username` LIKE '%%\" . $args['username'] . \"%%' \";\n\t\t\t}\n\t\t}\n\n\t\t// specific vendors by name\n\t\tif ( ! empty( $args['name'] ) ) {\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `name` LIKE '\" . $args['name'] . \"' \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `name` LIKE '%%\" . $args['name'] . \"%%' \";\n\t\t\t}\n\t\t}\n\n\t\t// specific vendors by status\n\t\tif ( ! empty( $args['status'] ) ) {\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `status` LIKE '\" . $args['status'] . \"' \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `status` LIKE '%%\" . $args['status'] . \"%%' \";\n\t\t\t}\n\t\t}\n\n\t\t// Vendors created for a specific date or in a date range\n\t\tif ( ! empty( $args['date'] ) ) {\n\n\t\t\tif ( is_array( $args['date'] ) ) {\n\n\t\t\t\tif ( ! empty( $args['date']['start'] ) ) {\n\n\t\t\t\t\t$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );\n\n\t\t\t\t\tif ( ! empty( $where ) ) {\n\n\t\t\t\t\t\t$where .= \" AND `date_created` >= '{$start}'\";\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$where .= \" WHERE `date_created` >= '{$start}'\";\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $args['date']['end'] ) ) {\n\n\t\t\t\t\t$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );\n\n\t\t\t\t\tif ( ! empty( $where ) ) {\n\n\t\t\t\t\t\t$where .= \" AND `date_created` <= '{$end}'\";\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$where .= \" WHERE `date_created` <= '{$end}'\";\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t$year = date( 'Y', strtotime( $args['date'] ) );\n\t\t\t\t$month = date( 'm', strtotime( $args['date'] ) );\n\t\t\t\t$day = date( 'd', strtotime( $args['date'] ) );\n\n\t\t\t\tif ( empty( $where ) ) {\n\t\t\t\t\t$where .= \" WHERE\";\n\t\t\t\t} else {\n\t\t\t\t\t$where .= \" AND\";\n\t\t\t\t}\n\n\t\t\t\t$where .= \" $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )\";\n\t\t\t}\n\n\t\t}\n\n\t\t$args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'id' : $args['orderby'];\n\n\t\tif ( 'sales_value' == $args['orderby'] ) {\n\t\t\t$args['orderby'] = 'sales_value+0';\n\t\t}\n\n\t\t$cache_key = md5( 'edd_vendors_' . serialize( $args ) );\n\n\t\t$vendors = wp_cache_get( $cache_key, 'vendors' );\n\n\t\tif ( $vendors === false ) {\n\t\t\t$vendors = $wpdb->get_results( $wpdb->prepare( \"SELECT * FROM $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;\", absint( $args['offset'] ), absint( $args['number'] ) ) );\n\t\t\twp_cache_set( $cache_key, $vendors, 'vendors', 3600 );\n\t\t}\n\n\t\treturn $vendors;\n\n\t}", "public function getActivatedVendors();", "public abstract function find_users($search);", "public function testDestiny2GetVendors()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "function getVendors(){\n $datarow = NULL;\n try\n {\n $db = new Database();\n $db->connect();\n \n $sql = \"SELECT userid,firstname,lastname,category,categorycode,phonenumber,email,agebracket,country,countrycode,gender,town,userstatus,xikilaaccount,bancoaccount,wantbancoaccount,creationdate FROM registration \".\n \"where userstatus=:userstatus\";\n $params = array(\":userstatus\" => 1);\n $results = $db->runSelect($sql,$params);\n \n if ($results != null){\n $datarow = $results;\n }\t\t\n }\n catch(PDOException $ex) {\n echo $ex->getMessage();\n }\n return $datarow;\n }", "public function searchUsers()\n {\n # Set tables to search to a variable.\n $tables = $this->getTables();\n # Set fields to search to a variable.\n $fields = $this->getFields();\n # Set search terms to a variable.\n $search_terms = $this->getSearchTerms();\n # Perform search.\n $this->performSearch($search_terms, $tables, $fields);\n }", "public function ShowVendors()\n\t{\n\t\t$GLOBALS['BreadCrumbs'] = array(\n\t\t\tarray(\n\t\t\t\t'name' => GetLang('Vendors')\n\t\t\t)\n\t\t);\n\t\t$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(GetConfig('StoreName').' - '.GetLang('Vendors'));\n\t\t$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('vendors');\n\t\t$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();\n\t}", "public function getvendorsAction()\n {\n \t\n \t$vendorsmodel= new Default_Model_Vendors();\n \t$vendorsdataArr=$vendorsmodel->getVendorsList();\n \n \t$opt='<option value=\\'\\'>Select Vendor</option>';\n \n \tif(sizeof($vendorsdataArr)>0){\n \t\t\n \t\tforeach($vendorsdataArr as $vendors)\n \t\t{\n \t\t\t$opt.=\"<option value='\".$vendors['id'].\"'>\".$vendors['name'].\"</option>\";\n \t\t}\n \t}\n \t\n \t\n \t \t\n \t$this->_helper->json(array('options'=>utf8_encode($opt)));\n \t\n \t\n }", "function particularvendorlist($id)\n\t{\n\t\t$getParvendor=\"SELECT * from vendor where vendor_id = $id\";\n\t\t$vendor_data=$this->get_results( $getParvendor );\n\t\treturn $vendor_data;\n\t}", "public function search($params, $vendors = '')\n {\n $query = Vendor::find();\n\n // add conditions that should always apply here\n\n $dataProvider = new ActiveDataProvider([\n 'query' => ($vendors) ? $query->where(['in', 'vendor_id', $vendors]) : $query,\n 'sort' => ['defaultOrder' => ['sort_order' => SORT_DESC]],\n ]);\n\n $this->load($params);\n\n if (!$this->validate()) {\n // uncomment the following line if you do not want to return any records when validation fails\n // $query->where('0=1');\n return $dataProvider;\n }\n\n // grid filtering conditions\n $query->andFilterWhere([\n 'vendor_id' => $this->vendor_id,\n 'vendor_account_start_date' => $this->vendor_account_start_date,\n 'vendor_account_end_date' => $this->vendor_account_end_date,\n ]);\n\n $query->andFilterWhere(['like', 'vendor_logo', $this->vendor_logo])\n ->andFilterWhere(['like', 'vendor_name_en', $this->vendor_name_en])\n ->andFilterWhere(['like', 'vendor_name_ar', $this->vendor_name_ar])\n ->andFilterWhere(['like', 'vendor_description_en', $this->vendor_description_en])\n ->andFilterWhere(['like', 'vendor_description_ar', $this->vendor_description_ar])\n ->andFilterWhere(['like', 'vendor_phone1', $this->vendor_phone1])\n ->andFilterWhere(['like', 'vendor_phone2', $this->vendor_phone2])\n ->andFilterWhere(['like', 'vendor_youtube_video', $this->vendor_youtube_video])\n ->andFilterWhere(['like', 'vendor_social_instagram', $this->vendor_social_instagram])\n ->andFilterWhere(['like', 'vendor_social_twitter', $this->vendor_social_twitter])\n ->andFilterWhere(['like', 'vendor_location', $this->vendor_location])\n ->andFilterWhere(['like', 'vendor_address_text_en', $this->vendor_address_text_en])\n ->andFilterWhere(['like', 'vendor_address_text_ar', $this->vendor_address_text_ar]);\n\n return $dataProvider;\n }", "public function index()\n {\n $editableVendor = null;\n $vendorQuery = Vendor::query();\n $vendorQuery->where('name', 'like', '%'.request('q').'%');\n $vendors = $vendorQuery->paginate(25);\n\n if (in_array(request('action'), ['edit', 'delete']) && request('id') != null) {\n $editableVendor = Vendor::find(request('id'));\n }\n\n return view('vendors.index', compact('vendors', 'editableVendor'));\n }", "public function incSearch() {\n\t\t$result = array();\n\t\tif ( current_user_can( 'manage_options' ) ) {\n\t\t\tif ( $this->input->get( 'term' ) ) {\n\t\t\t\t/** @var \\wpdb $wpdb */\n\t\t\t\tglobal $wpdb;\n\t\t\t\t$query = '%' . $this->input->get( 'term' ) . '%';\n\t\t\t\t$sql = <<<SQL\n\t\t\t\t\tSELECT SQL_CALC_FOUND_ROWS\n\t\t\t\t\t\tID, user_login, display_name\n\t\t\t\t\tFROM {$wpdb->users}\n\t\t\t\t\tWHERE user_login LIKE %s\n\t\t\t\t\t OR user_email LIKE %s\n\t\t\t\t\t OR display_name LIKE %s\n ORDER BY display_name ASC\n\t\t\t\t\tLIMIT 10\nSQL;\n\t\t\t\t$result = array_map( function ( $user ) {\n\t\t\t\t\t$user->avatar = get_avatar( $user->ID, '48', '', $user->display_name );\n\n\t\t\t\t\treturn $user;\n\t\t\t\t}, $wpdb->get_results( $wpdb->prepare( $sql, $query, $query, $query ) ) );\n\t\t\t}\n\t\t}\n\t\twp_send_json( $result );\n\t}", "function lendingform_search_user($search = NULL) {\r\n \r\n $users = array();\r\n if (empty($search)) {\r\n $users = entity_load('user');\r\n } else {\r\n // Search users\r\n $users = entity_get_controller(PROJECT_ENTITY)->search_users($search);\r\n }\r\n \r\n $users_name_and_id = array();\r\n foreach ($users as $user) {\r\n $users_name_and_id[] = array(\r\n 'uid' => $user->uid,\r\n 'name' => lendingform_siemens_format_username($user),\r\n );\r\n }\r\n\r\n echo json_encode($users_name_and_id);\r\n \r\n exit();\r\n}", "public function count( $args = array() ) {\n\n\t\tglobal $wpdb;\n\n\t\t$defaults = array(\n\t\t\t'number' => 20,\n\t\t\t'offset' => 0,\n\t\t\t'user_id' => 0,\n\t\t\t'orderby' => 'id',\n\t\t\t'order' => 'DESC'\n\t\t);\n\n\t\t$args = wp_parse_args( $args, $defaults );\n\n\t\tif ( $args['number'] < 1 ) {\n\t\t\t$args['number'] = 999999999999;\n\t\t}\n\n\t\t$where = '';\n\n\t\t// specific vendors\n\t\tif ( ! empty( $args['id'] ) ) {\n\n\t\t\tif ( is_array( $args['id'] ) ) {\n\t\t\t\t$ids = implode( ',', $args['id'] );\n\t\t\t} else {\n\t\t\t\t$ids = intval( $args['id'] );\n\t\t\t}\n\n\t\t\t$where .= \" WHERE `id` IN( {$ids} ) \";\n\n\t\t}\n\n\t\t// vendors for specific user accounts\n\t\tif ( ! empty( $args['user_id'] ) ) {\n\n\t\t\tif ( is_array( $args['user_id'] ) ) {\n\t\t\t\t$user_ids = implode( ',', $args['user_id'] );\n\t\t\t} else {\n\t\t\t\t$user_ids = intval( $args['user_id'] );\n\t\t\t}\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `user_id` IN( {$user_ids} ) \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `user_id` IN( {$user_ids} ) \";\n\t\t\t}\n\n\n\t\t}\n\n\t\t//specific vendors by email\n\t\tif ( ! empty( $args['email'] ) ) {\n\n\t\t\tif ( is_array( $args['email'] ) ) {\n\t\t\t\t$emails = \"'\" . implode( \"', '\", $args['email'] ) . \"'\";\n\t\t\t} else {\n\t\t\t\t$emails = \"'\" . $args['email'] . \"'\";\n\t\t\t}\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `email` IN( {$emails} ) \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `email` IN( {$emails} ) \";\n\t\t\t}\n\n\t\t}\n\n\t\t// specific vendors by username\n\t\tif ( ! empty( $args['username'] ) ) {\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `username` LIKE '\" . $args['username'] . \"' \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `username` LIKE '%%\" . $args['username'] . \"%%' \";\n\t\t\t}\n\t\t}\n\n\t\t// specific vendors by name\n\t\tif ( ! empty( $args['name'] ) ) {\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `name` LIKE '\" . $args['name'] . \"' \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `name` LIKE '%%\" . $args['name'] . \"%%' \";\n\t\t\t}\n\t\t}\n\n\t\t// specific vendors by status\n\t\tif ( ! empty( $args['status'] ) ) {\n\n\t\t\tif ( ! empty( $where ) ) {\n\t\t\t\t$where .= \" AND `status` LIKE '\" . $args['status'] . \"' \";\n\t\t\t} else {\n\t\t\t\t$where .= \" WHERE `status` LIKE '%%\" . $args['status'] . \"%%' \";\n\t\t\t}\n\t\t}\n\n\t\t// Vendors created for a specific date or in a date range\n\t\tif ( ! empty( $args['date'] ) ) {\n\n\t\t\tif ( is_array( $args['date'] ) ) {\n\n\t\t\t\tif ( ! empty( $args['date']['start'] ) ) {\n\n\t\t\t\t\t$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );\n\n\t\t\t\t\tif ( ! empty( $where ) ) {\n\n\t\t\t\t\t\t$where .= \" AND `date_created` >= '{$start}'\";\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$where .= \" WHERE `date_created` >= '{$start}'\";\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! empty( $args['date']['end'] ) ) {\n\n\t\t\t\t\t$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );\n\n\t\t\t\t\tif ( ! empty( $where ) ) {\n\n\t\t\t\t\t\t$where .= \" AND `date_created` <= '{$end}'\";\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$where .= \" WHERE `date_created` <= '{$end}'\";\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t$year = date( 'Y', strtotime( $args['date'] ) );\n\t\t\t\t$month = date( 'm', strtotime( $args['date'] ) );\n\t\t\t\t$day = date( 'd', strtotime( $args['date'] ) );\n\n\t\t\t\tif ( empty( $where ) ) {\n\t\t\t\t\t$where .= \" WHERE\";\n\t\t\t\t} else {\n\t\t\t\t\t$where .= \" AND\";\n\t\t\t\t}\n\n\t\t\t\t$where .= \" $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )\";\n\t\t\t}\n\n\t\t}\n\n\t\t$args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'id' : $args['orderby'];\n\n\t\tif ( 'sales_value' == $args['orderby'] ) {\n\t\t\t$args['orderby'] = 'sales_value+0';\n\t\t}\n\n\t\t$cache_key = md5( 'fes_vendors_count' . serialize( $args ) );\n\n\t\t$count = wp_cache_get( $cache_key, 'vendors' );\n\n\t\tif ( $count === false ) {\n\t\t\t$count = $wpdb->get_var( \"SELECT COUNT($this->primary_key) FROM \" . $this->table_name . \"{$where};\" );\n\t\t\twp_cache_set( $cache_key, $count, 'vendors', 3600 );\n\t\t}\n\n\t\treturn absint( $count );\n\n\t}", "public function getVendorList() {\n $vendors = $this->couponServices_model->fetchVendors();\n\n $vendor_options = array();\n $vendor_options[\"\"] = \"-- Select vendor --\";\n foreach ($vendors as $company) {\n $vendor_options[$company['vendorId']] = $company['vendorName'];\n }\n return $vendor_options;\n }", "function wcfmgs_group_manager_allow_vendors_list( $allow_vendors = array(0), $is_marketplace = '', $is_term = true ) {\r\n \tglobal $WCFM, $WCFMgs;\r\n \t\r\n \tif( !$allow_vendors || !is_array( $allow_vendors ) ) $allow_vendors = array(0);\r\n \t\r\n \tif( $is_marketplace == '' ) {\r\n \t\t$is_marketplace = wcfm_is_marketplace();\r\n \t}\r\n \t\r\n\t\t$wcfm_vendor_groups = get_user_meta( $this->manager_id, '_wcfm_vendor_group', true );\r\n\t\tif( !empty( $wcfm_vendor_groups ) ) {\r\n\t\t\tforeach( $wcfm_vendor_groups as $wcfm_vendor_group ) {\r\n\t\t\t\t$group_vendors = get_post_meta( $wcfm_vendor_group, '_group_vendors', true );\r\n\t\t\t\tif( $group_vendors && is_array( $group_vendors ) && !empty( $group_vendors ) ) {\r\n\t\t\t\t\tforeach( $group_vendors as $group_vendor ) {\r\n\t\t\t\t\t\tif( $is_marketplace == 'wcpvendors' ) {\r\n\t\t\t\t\t\t\tif( $is_term ) {\r\n\t\t\t\t\t\t\t\t$term_id = get_user_meta( $group_vendor, '_wcpv_active_vendor', true );\r\n\t\t\t\t\t\t\t\tif( $term_id ) $allow_vendors[] = $term_id;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t$allow_vendors[] = $group_vendor;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t$allow_vendors[] = $group_vendor;\r\n\t\t\t\t\t\t}\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\t\r\n\t\treturn $allow_vendors;\r\n }", "public function actionIndex() {\n $searchModel = new VendorSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "function display_used_vouchers() {\n\n\t\tglobal $current_user, $woo_vou_vendor_role;\n\n\t\t$prefix = WOO_VOU_META_PREFIX;\n\n\t\t$args = $data = array();\n\n\t\t// Taking parameter\n\t\t$orderby \t= isset( $_GET['orderby'] )\t? urldecode( $_GET['orderby'] )\t\t: 'ID';\n\t\t$order\t\t= isset( $_GET['order'] )\t? $_GET['order'] \t: 'DESC';\n\t\t$search \t= isset( $_GET['s'] ) \t\t? sanitize_text_field( trim($_GET['s']) )\t: null;\n\n\t\t$args = array(\n\t\t\t\t\t\t'posts_per_page'\t=> $this->per_page,\n\t\t\t\t\t\t'page'\t\t\t\t=> isset( $_GET['paged'] ) ? $_GET['paged'] : null,\n\t\t\t\t\t\t'orderby'\t\t\t=> $orderby,\n\t\t\t\t\t\t'order'\t\t\t\t=> $order,\n\t\t\t\t\t\t'offset' \t\t\t=> ( $this->get_pagenum() - 1 ) * $this->per_page,\n\t\t\t\t\t\t'woo_vou_list'\t\t=> true\n\t\t\t\t\t);\n\n\t\t$search_meta = \tarray(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'key' \t\t=> $prefix . 'used_codes',\n\t\t\t\t\t\t\t\t'value' \t=> '',\n\t\t\t\t\t\t\t\t'compare' \t=> '!='\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\t\n\t\t//Get user role\n\t\t$user_roles\t= isset( $current_user->roles ) ? $current_user->roles : array();\n\t\t$user_role\t= array_shift( $user_roles );\n\n\t\t//voucher admin roles\n\t\t$admin_roles\t= woo_vou_assigned_admin_roles();\n\n\t\tif( !in_array( $user_role, $admin_roles ) ) {// voucher admin can redeem all codes\n\t\t\t$args['author'] = $current_user->ID;\n\t\t}\n\n\t\tif( isset( $_GET['woo_vou_post_id'] ) && !empty( $_GET['woo_vou_post_id'] ) ) {\n\t\t\t$args['post_parent'] = $_GET['woo_vou_post_id'];\n\t\t}\n\t\t\n\t\tif( isset( $_GET['woo_vou_user_id'] ) && !empty( $_GET['woo_vou_user_id'] ) ) {\n\t\t\t\n\t\t\t$search_meta =\tarray(\n\t\t\t\t\t\t\t\t'relation' => 'AND',\n\t\t\t\t\t\t\t\t($search_meta),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'redeem_by',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $_GET['woo_vou_user_id'],\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> '=',\n\t\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);\n\t\t}\n\t\t\n\t\tif( isset( $_GET['woo_vou_start_date'] ) && !empty( $_GET['woo_vou_start_date'] ) ) {\n\t\t\t\n\t\t\t$search_meta =\tarray(\n\t\t\t\t\t\t\t\t'relation' => 'AND',\n\t\t\t\t\t\t\t\t($search_meta),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'used_code_date',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> date( \"Y-m-d H:i:s\", strtotime( $_GET['woo_vou_start_date'] ) ),\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> '>=',\n\t\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);\n\t\t}\n\t\t\n\t\tif( isset( $_GET['woo_vou_end_date'] ) && !empty( $_GET['woo_vou_end_date'] ) ) {\n\t\t\t\n\t\t\t$search_meta =\tarray(\n\t\t\t\t\t\t\t\t'relation' => 'AND',\n\t\t\t\t\t\t\t\t($search_meta),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'used_code_date',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> date( \"Y-m-d H:i:s\", strtotime( $_GET['woo_vou_end_date'] ) ),\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> '<=',\n\t\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);\n\t\t}\n\n\t\tif( !empty( $search ) ) {\n\n\t\t\t$search_meta =\tarray(\n\t\t\t\t\t\t\t\t'relation' => 'AND',\n\t\t\t\t\t\t\t\t($search_meta),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'relation'\t=> 'OR',\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'used_codes',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $_GET['s'],\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> 'LIKE',\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'first_name',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $_GET['s'],\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> 'LIKE',\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'last_name',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $_GET['s'],\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> 'LIKE',\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'order_id',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $_GET['s'],\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> 'LIKE',\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'order_date',\n\t\t\t\t\t\t\t\t\t\t\t'value'\t\t=> $_GET['s'],\n\t\t\t\t\t\t\t\t\t\t\t'compare'\t=> 'LIKE',\n\t\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);\n\t\t}\n\t\t\n\t\t$args['meta_query']\t= $search_meta;\n\n\t\t//get used voucher codes data from database\n\t\t$woo_data \t= $this->model->woo_vou_get_voucher_details( $args );\n\t\t$data\t\t= isset( $woo_data['data'] ) ? $woo_data['data'] : '';\n\n\t\tif( !empty( $data ) ) {\n\n\t\t\tforeach ( $data as $key => $value ) {\n\n\t\t\t\t$user_id \t = get_post_meta( $value['ID'], $prefix.'redeem_by', true );\n\t\t\t\t$user_detail = get_userdata( $user_id );\n\t\t\t\t$user_profile = add_query_arg( array('user_id' => $user_id), admin_url('user-edit.php') );\n\t\t\t\t$display_name = isset( $user_detail->display_name ) ? $user_detail->display_name : '';\n\n\t\t\t\tif( !empty( $display_name ) ) {\n\t\t\t\t\t$display_name = '<a href=\"'.$user_profile.'\">'.$display_name.'</a>';\n\t\t\t\t} else {\n\t\t\t\t\t$display_name = __( 'N/A', 'woovoucher' );\n\t\t\t\t}\n\n\t\t\t\t$data[$key]['ID'] \t\t\t= $value['ID'];\n\t\t\t\t$data[$key]['post_parent'] \t= $value['post_parent'];\n\t\t\t\t$data[$key]['code'] \t\t= get_post_meta( $value['ID'], $prefix.'used_codes', true );\n\t\t\t\t$data[$key]['redeem_by'] \t= $display_name;\n\t\t\t\t$data[$key]['first_name'] \t= get_post_meta( $value['ID'], $prefix.'first_name', true );\n\t\t\t\t$data[$key]['last_name'] \t= get_post_meta( $value['ID'], $prefix.'last_name', true );\n\t\t\t\t$data[$key]['order_id'] \t= get_post_meta( $value['ID'], $prefix.'order_id', true );\n\t\t\t\t$data[$key]['order_date'] \t= get_post_meta( $value['ID'], $prefix.'order_date', true );\n\t\t\t\t$data[$key]['product_title']= get_the_title( $value['post_parent'] );\n\n\t\t\t\t$order_id = $data[$key]['order_id'];\n\n\t\t\t\t$data[$key]['buyers_info'] = $this->model->woo_vou_get_buyer_information( $order_id );\n\t\t\t}\n\t\t}\n\n\t\t$result_arr['data']\t\t= !empty($data) ? $data : array();\n\t\t$result_arr['total'] \t= isset( $woo_data['total'] ) ? $woo_data['total'] \t: 0; // Total no of data\n\n\t\treturn $result_arr;\n\t}", "function findusers() {\n $this->auth(SUPPORT_ADM_LEVEL);\n $search_word = $this->input->post('search');\n if($search_word == '-1'){ //initial listing\n $data['records'] = $this->m_user->getAll(40);\n } else { //regular search\n $data['records'] = $this->m_user->getByWildcard($search_word);\n }\n $data['search_word'] = $search_word;\n $this->load->view('/admin/support/v_users_search_result', $data);\n }", "public function queryAll(){\r\n\t\t$sql = 'SELECT * FROM item_vendor_x';\r\n\t\t$sqlQuery = new SqlQuery($sql);\r\n\t\treturn $this->getList($sqlQuery);\r\n\t}", "public function search();", "public function search();", "public function users() {\n $matches = array();\n if ($name = $this->input->get('q')) {\n $users = ORM::factory('user')->where('site_id', $this->site->id)->like('searchname', text::searchable($name))->where('status', 1)->find_all();\n foreach ($users as $user) {\n if ($user->id != $this->user->id) { // Can't send a message to yourself.\n $matches[] = (object) array('id' => $user->id, 'name' => $user->name());\n }\n }\n }\n print json_encode($matches);\n die();\n }", "function _vendorCompanyList(){\n $this->resetResponse();\n if ($this->ci->session->userdata('user_id') != null) {\n $archived = $this->ci->input->post('archived', true);\n\n $result = $this->model->getVendorCompany('*', array(\"person_type\" => Globals::PERSON_TYPE_VENDOR))->result();\n if ($result) {\n $this->_status = true;\n $this->_message = '';\n $this->_rdata = $result;\n\n } else {\n $this->_status = false;\n $this->_message = $this->ci->lang->line('no_records_found');\n }\n \n } else {\n $this->_status = false;\n $this->_message = $this->ci->lang->line('invalid_user');\n \n }\n\n return $this->getResponse();\n }", "public function admin_get_users(){\n $limit = $this->input->get('length');\n $offset = $this->input->get('start');\n $search = $this->input->get('search')['value'];\n echo $this->usm->get_users($limit, $offset, $search);\n }", "public function testDestiny2GetVendor()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "function GetAllDataVendor($param = []) \t\t\t\n { \t\t\t\n if (isset($param['search_value']) && $param['search_value'] != '') { \t\t\t\n $this->db->group_start(); \t\t\t\n $i = 0; \t\t\t\n foreach ($param['search_field'] as $row => $val) { \t\t\t\n if ($val['searchable'] == 'true') { \t\t\t\n if ($i == 0) { \t\t\t\n $this->db->like('LCASE(`'.$val['data'].'`)', strtolower($param['search_value'])); \t\t\t\n } else { \t\t\t\n $this->db->or_like('LCASE(`'.$val['data'].'`)', strtolower($param['search_value'])); \t\t\t\n } \t\t\t\n $i++; \t\t\t\n } \t\t\t\n } \t\t\t\n $this->db->group_end(); \t\t\t\n } \t\t\t\n if (isset($param['row_from']) && isset($param['length'])) { \t\t\t\n $this->db->limit($param['length'], $param['row_from']); \t\t\t\n } \t\t\t\n if (isset($param['order_field'])) { \t\t\t\n if (isset($param['order_sort'])) { \t\t\t\n $this->db->order_by($param['order_field'], $param['order_sort']); \t\t\t\n } else { \t\t\t\n $this->db->order_by($param['order_field'], 'desc'); \t\t\t\n } \t\t\t\n } else { \t\t\t\n $this->db->order_by('id', 'desc'); \t\t\t\n } \t\t\t\n $data = $this->db \t\t\t\n ->select('a.*') \t\t\t\n ->where('a.is_delete',0) \t\t\t\n ->get('master_vendor a') \t\t\t\n ->result_array(); \t\t\t\n #echo $this->db->last_query(); \t\t\t\n return $data; \t\t\t\n }", "protected function getListQuery()\n\t{\n\t\t$input = Factory::getApplication()->input;\n\t\t$this->vendor_id = $input->get('vendor_id', '', 'INT');\n\t\t$vendor_id = $this->vendor_id ? $this->vendor_id : $this->getState('vendor_id');\n\t\t$client = $input->get('client', '', 'STRING');\n\n\t\t// Create a new query object.\n\t\t$db = $this->getDbo();\n\t\t$query = $db->getQuery(true);\n\n\t\t// Select the required fields from the table.\n\t\t$query->select(\n\t\t\t$db->quoteName(array('a.vendor_id', 'a.vendor_title', 'b.client', 'b.percent_commission', 'b.flat_commission', 'b.id', 'b.currency'))\n\t\t);\n\n\t\t$query->from($db->quoteName('#__tjvendors_fee', 'b'));\n\n\t\t$query->join('LEFT', ($db->quoteName('#__tjvendors_vendors', 'a') . 'ON ' . $db->quoteName('b.vendor_id') . ' = ' . $db->quoteName('a.vendor_id')));\n\n\t\t$query->where($db->quoteName('a.vendor_id') . ' = ' . $vendor_id);\n\n\t\tif (!empty($client))\n\t\t{\n\t\t\t$query->where($db->quoteName('b.client') . ' = ' . $db->quote($client));\n\t\t}\n\n\t\t// Filter by search in title\n\t\t$search = $this->getState('filter.search');\n\n\t\tif (!empty($search))\n\t\t{\n\t\t\tif (stripos($search, 'id:') === 0)\n\t\t\t{\n\t\t\t\t$query->where($db->quoteName('b.id') . ' = ' . (int) substr($search, 3));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$search = $db->Quote('%' . $db->escape($search, true) . '%');\n\t\t\t\t$query->where('(b.currency LIKE ' . $search .\n\t\t\t\t\t\t\t'OR b.percent_commission LIKE' . $search .\n\t\t\t\t\t\t\t'OR b.flat_commission LIKE' . $search . ')');\n\t\t\t}\n\n\t\t\t$this->search = $search;\n\t\t}\n\n\t\t// Add the list ordering clause.\n\t\t$orderCol = $this->state->get('list.ordering');\n\t\t$orderDirn = $this->state->get('list.direction');\n\n\t\tif (!in_array(strtoupper($orderDirn), array('ASC', 'DESC')))\n\t\t{\n\t\t\t$orderDirn = 'DESC';\n\t\t}\n\n\t\tif ($orderCol && $orderDirn)\n\t\t{\n\t\t\t$query->order($db->escape($orderCol . ' ' . $orderDirn));\n\t\t}\n\n\t\treturn $query;\n\t}", "protected function _getVendorCollection()\n {\n if (is_null($this->_vendorCollection)) {\n $queryText = $this->getQueryText();\n $vendorShoptable = $this->_resourceConnection->getTableName('ced_csmarketplace_vendor_shop');\n $this->_vendorCollection = $this->_collectionFactory->create();\n $this->_vendorCollection->addAttributeToSelect('*');\n //$this->_vendorCollection->getSelect()->join(['vendor_shop' => $vendorShoptable], 'e.entity_id=vendor_shop.vendor_id AND vendor_shop.shop_disable=' . Vshop::ENABLED, ['shop_disable']);\n\n $this->_vendorCollection->addAttributeToFilter('meta_keywords', ['like' => '%' . $queryText . '%']);\n if ($this->_csmarketplaceHelper->isSharingEnabled()) {\n $this->_vendorCollection->addAttributeToFilter('website_id', $this->_storeManager->getStore()->getWebsiteId());\n }\n\n if ($this->_csmarketplaceHelper->getStoreConfig(HyperlocalHelper::MODULE_ENABLE)) {\n //------------------- Custom Filter----------------[START]\n\n $savedLocationFromSession = $this->_hyperlocalHelper->getShippingLocationFromSession();\n $filterType = $this->_csmarketplaceHelper->getStoreConfig(HyperlocalHelper::FILTER_TYPE);\n $radiusConfig = $this->_csmarketplaceHelper->getStoreConfig(HyperlocalHelper::FILTER_RADIUS);\n $distanceType = $this->_csmarketplaceHelper->getStoreConfig(HyperlocalHelper::DISTANCE_TYPE);\n $apiKey = $this->_csmarketplaceHelper->getStoreConfig(HyperlocalHelper::API_KEY);\n $filterProductsBy = $this->_csmarketplaceHelper->getStoreConfig(HyperlocalHelper::FILTER_PRODUCTS_BY);\n\n if ($filterProductsBy == 'vendor_location' || $filterType == 'distance') {\n $vendorIds = [0];\n if ($savedLocationFromSession) {\n\n /** Filter Products By Vendor Location */\n if ($filterType == 'city_state_country') {\n\n //------------------- Filter By City,country & state----------------[START]\n $locationCollection = $this->_hyperlocalHelper->getFilteredlocationByCityStateCountry($savedLocationFromSession);\n if ($locationCollection) {\n $vendorIds = $locationCollection->getColumnValues('vendor_id');\n }\n\n //------------------- Filter By City,country & state----------------[END]\n } elseif ($filterType == 'zipcode' && isset($savedLocationFromSession['filterZipcode'])) {\n\n //------------------- Filter By Zipcode----------------[START]\n $resource = $this->_resourceConnection;\n $tableName = $resource->getTableName('ced_cshyperlocal_shipping_area');\n $this->zipcodeCollection->getSelect()->joinLeft($tableName, 'main_table.location_id = ' . $tableName . '.id', ['status', 'is_origin_address']);\n $this->zipcodeCollection->addFieldToFilter('main_table.zipcode', $savedLocationFromSession['filterZipcode'])\n ->addFieldToFilter('status', Shiparea::STATUS_ENABLED);\n $this->zipcodeCollection->getSelect()->where(\"`is_origin_address` IS NULL OR `is_origin_address` = '0'\");\n $vendorIds = $this->zipcodeCollection->getColumnValues('vendor_id');\n //------------------- Filter By Zipcode----------------[END]\n } elseif ($filterType == 'distance') {\n $tolat = $savedLocationFromSession['latitude'];\n $tolong = $savedLocationFromSession['longitude'];\n $vIds = [];\n if ($tolat != '' && $tolong != '') {\n $vendorCollection = $this->_collectionFactory->create();\n $vendorCollection->addAttributeToSelect('*');\n if ($vendorCollection->count()) {\n foreach ($vendorCollection as $vendor) {\n $distance = $this->_hyperlocalHelper->calculateDistancebyHaversine($vendor->getLatitude(), $vendor->getLongitude(), $tolat, $tolong);\n if ($distance <= $radiusConfig) {\n $vendorIds[] = $vendor->getId();\n }\n }\n }\n }\n }\n $this->_vendorCollection->addAttributeToFilter('entity_id', ['in' => $vendorIds]);\n }\n }\n //------------------- Custom Filter ----------------[END]\n }\n\n $this->prepareSortableFields();\n }\n return $this->_vendorCollection;\n }" ]
[ "0.6522265", "0.64070505", "0.63639617", "0.62607735", "0.62493575", "0.62388426", "0.6212094", "0.6181377", "0.6116254", "0.6110841", "0.6058671", "0.6051379", "0.6045634", "0.603381", "0.6016279", "0.60091215", "0.5976708", "0.5961105", "0.5955323", "0.592257", "0.589258", "0.5892466", "0.5892466", "0.58640844", "0.5850152", "0.58498055", "0.5849276", "0.58303165", "0.5822557", "0.5821266" ]
0.6957608
0
Display a listing of the Uploads.
public function index() { $module = Module::get('Uploads'); if(Module::hasAccess($module->id)) { return View('la.uploads.index', [ 'show_actions' => $this->show_action, 'listing_cols' => $this->listing_cols, 'module' => $module ]); } else { return redirect(config('laraadmin.adminRoute')."/"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function index() {\n $this->data['title'] = \"Uploads\";\n $viewContent = $this->load->view('uploads/index', $this->data, true);\n renderWithLayout(array('content' => $viewContent), 'admin');\n }", "public function index()\n {\n $uploads=Auth::guard('team')->user()->uploads;\n $upload_names=UploadName::all();\n \n return view('team.uploads.index',compact('upload_names','uploads'));\n }", "public function listCommand() {\n\t\t$iterator = new DirectoryIterator(UploadManager::UPLOAD_FOLDER);\n\n\t\t$counter = 0;\n\t\tforeach ($iterator as $file) {\n\t\t\tif ($file->isFile()) {\n\t\t\t\t$counter++;\n\t\t\t\t$this->outputLine($file->getFilename());\n\t\t\t}\n\t\t}\n\n\t\t$this->outputLine();\n\t\t$this->outputLine(sprintf('%s temporary file(s).', $counter));\n\t}", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $entities = $em->getRepository('MHProductsBundle:Upload')->findAll();\n\n return $this->render('MHProductsBundle:Upload:index.html.twig', array(\n 'entities' => $entities,\n ));\n }", "public function index()\n {\n $files = Upload::all();\n return view('upload', compact('files'));\n }", "public function show(Upload $upload)\n {\n //\n }", "public function show(Upload $upload)\n {\n //\n }", "public function actionIndex()\n {\n try {\n $model = new Upload();\n $info = $model->upImage();\n\n\n $info && is_array($info) ?\n exit(Json::htmlEncode($info)) :\n exit(Json::htmlEncode([\n 'code' => 1,\n 'msg' => 'error'\n ]));\n\n\n } catch (\\Exception $e) {\n exit(Json::htmlEncode([\n 'code' => 1,\n 'msg' => $e->getMessage()\n ]));\n }\n }", "public function index(Request $request)\n {\n $upload = Upload::with(['tbluploadtypes'])->get()->sortByDesc('id');\n\t\t\n\t\treturn view('admin.upload.index', compact('upload'));\n\t}", "public function index()\n {\n $images = File::all();\n return view('view-uploads')->with('images', $images);\n }", "public function index()\n {\n //\n $photos = Upload::all();\n return view('uploaded-images', compact('photos'));\n }", "public function index()\n {\n return view('lecturer::result.upload.index');\n }", "public function index()\n {\n $uploader = \\App\\Uploader::orderBy('created_at', 'desc')->paginate(5);\n return view('uploader.index')->with('uploaders',$uploader);\n }", "public function index()\n {\n return view('files.upload')->render();\n }", "public function indexAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $files = $em->getRepository('TikaBundle:UpFile')->findAllOrdered();\n\n return array(\n 'files' => $files,\n );\n }", "public function index()\n {\n $data = $this->searchFiles();\n $datasources = Datasource::get(['id', 'datasource_name']);\n\n return view('uploaded_file.index', ['data' => $data, 'datasources' => $datasources]);\n\n // return view('upload.index');\n }", "public function indexAction() {\n\t\t$page = intval($this->getInput('page'));\n\t\t$perpage = $this->perpage;\n\t\t\n\t\tlist(,$files) = Lock_Service_FileType::getAllFileType();\n\t\t$data = array();\n\t\tforeach ($files as $key=>$value) {\n\t\t\t$data[$key]['id'] = $value['id'];\n\t\t\t$data[$key]['title'] = $value['name'];\n\t\t}\n\t\tlist($total, $filetype) = Lock_Service_FileType::getList($page, $perpage);\n\t\t$this->assign('filetype', $filetype);\n\t\t$this->assign('pager', Common::getPages($total, $page, $perpage, $this->actions['listUrl'].'/?'));\n\t\t$this->assign('data', json_encode($data));\n\t}", "public function display()\n\t{\n\t\t$this->list_table->prepare_items( $this->orderby );\n\n\t\t$this->form_start_get( 'process-all-items', null, 'process-all-items' );\n\t\t\t?><button>Process All Items</button><?php\n\t\t$this->form_end();\n\t\t\n\t\t$this->form_start_get( 'clear', null, 'clear' );\n\t\t\t?><button>Clear Items</button><?php\n\t\t$this->form_end();\n\n\t\t$this->form_start( 'upload-table' );\n\t\t\t$this->list_table->display();\n\t\t$this->form_end();\n\t}", "public function list_of_fileuploads() {\n $request = $_GET;\n $result = $this->fileupload_model->load_list_of_fileuploads($request, array());\n $result = getUtfData($result);\n echo json_encode($result);\n exit;\n }", "public function index()\n {\n return view('upload.index');\n }", "public function index()\n\t{\n return View::make('uploads.index');\n\t}", "public function index(){\n\t\tview('upload/index');\n\t}", "public function assetThumbnailListAction() {\n\t\t$parentFolder = $this->document->getElement ( \"parentFolder\" );\n\t\tif ($parentFolder) {\n\t\t\t$parentFolder = $parentFolder->getElement ();\n\t\t}\n\t\t\n\t\tif (! $parentFolder) {\n\t\t\t// default is the home folder\n\t\t\t$parentFolder = Asset::getById ( 1 );\n\t\t}\n\t\t\n\t\t// get all children of the parent\n\t\t$list = new \\Asset\\Listing ();\n\t\t$list->setCondition ( \"path like ?\", $parentFolder->getFullpath () . \"%\" );\n\t\t\n\t\t$this->view->list = $list;\n\t}", "public function indexAction() {\n $viewer = Engine_Api::_()->user()->getViewer();\n if (!$viewer || !$viewer->getIdentity()) {\n return $this->setNoRender();\n }\n\n // Must be able to create albums\n if (!Engine_Api::_()->authorization()->isAllowed('album', $viewer, 'create')) {\n return $this->setNoRender();\n }\n\n $this->view->upload_button = $this->_getParam('upload_button', 0);\n $this->view->upload_button_title = $this->_getParam('upload_button_title', 'Add New Photos');\n }", "public function index()\n {\n $categories = Category::all();\n return view('pages.upload', compact('categories'));\n }", "public function index()\n {\n\n $this->types->trackFilter();\n\n return view('site::file.index', [\n 'repository' => $this->files,\n 'items' => $this->files->paginate(config('site.per_page.file', 10), ['files.*'])\n ]);\n }", "public function index(){\n //Load configuration\n $this->loadModel('Upload.Uploads');\n //Retrieves the last 35 logs\n $uploads = $this->Uploads->find('all', ['order' => ['created desc'], 'limit' => 35]);\n\n return $this->set(compact('uploads'));\n }", "public function index()\n {\n //\n return view('upload.index');\n }", "public function show(ImageUploads $imageUploads)\n {\n //\n }", "public function showList()\n\t{\n\t\t$images = array();\n\t\tif (Auth::user()->name == \"admin\") {\n\t\t\t$images = DB::table('images')->get();\n\t\t} else {\n\t\t\t$images = DB::table('images')\n\t\t\t\t->where('created_by', '=', Auth::user()->name)\n\t\t\t\t->get();\n\t\t}\n\n\t\treturn view('admincp.listImage', ['images' => $images]);\n\t}" ]
[ "0.69382066", "0.6876522", "0.6749682", "0.6725907", "0.6721007", "0.6666607", "0.6666607", "0.6640795", "0.66351545", "0.66273767", "0.6605901", "0.65982366", "0.6577865", "0.65707296", "0.6520642", "0.65011615", "0.64765644", "0.63927686", "0.6379982", "0.63731706", "0.6365104", "0.63601077", "0.6326552", "0.62755495", "0.6275275", "0.62667596", "0.6256606", "0.62197876", "0.62158597", "0.62113774" ]
0.71702826
1
Update Uploads Public Visibility
public function update_public() { if(Module::hasAccess("Uploads", "edit")) { $file_id = Input::get('file_id'); $public = Input::get('public'); if(isset($public)) { $public = true; } else { $public = false; } $upload = Upload::find($file_id); if(isset($upload->id)) { if($upload->user_id == Auth::user()->id || Entrust::hasRole('SUPER_ADMIN')) { // Update Caption $upload->public = $public; $upload->save(); return response()->json([ 'status' => "success" ]); } else { return response()->json([ 'status' => "failure", 'message' => "Unauthorized Access 1" ]); } } else { return response()->json([ 'status' => "failure", 'message' => "Upload not found" ]); } } else { return response()->json([ 'status' => "failure", 'message' => "Unauthorized Access" ]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update_public()\n {\n\t\tif(Module::hasAccess(\"Uploads\", \"edit\")) {\n\t\t\t$file_id = Input::get('file_id');\n\t\t\t$public = Input::get('public');\n\t\t\t\n\t\t\t\n\t\t\t$upload = Upload::find($file_id);\n\t\t\tif(isset($upload->id)) {\n\t\t\t\tif($upload->user_id == Auth::user()->id || Entrust::hasRole('SUPER_ADMIN')) {\n\t\t\t\t\tif($upload->public == 0) \n\t\t\t\t\t$public = 1;\n\t\t\t\t\telse $public = 0;\n\t\t\t\t\t// Update Caption\n\t\t\t\t\t$upload->public = $public;\n\t\t\t\t\t$upload->save();\n\t\n\t\t\t\t\treturn response()->json([\n\t\t\t\t\t\t'status' => \"success\"\n\t\t\t\t\t]);\n\t\n\t\t\t\t} else {\n\t\t\t\t\treturn response()->json([\n\t\t\t\t\t\t'status' => \"failure\",\n\t\t\t\t\t\t'message' => \"Unauthorized Access 1\"\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn response()->json([\n\t\t\t\t\t'status' => \"failure\",\n\t\t\t\t\t'message' => \"Upload not found\"\n\t\t\t\t]);\n\t\t\t}\n\t\t} else {\n\t\t\treturn response()->json([\n\t\t\t\t'status' => \"failure\",\n\t\t\t\t'message' => \"Unauthorized Access\"\n\t\t\t]);\n\t\t}\n }", "public function updatePublic() {\n $this->Industry->updateSystemIndices();\n $this->Markets->updatePublic();\n $this->Usage->sendUsageStats();\n }", "protected function updateVisibility()\n {\n if($this->visibility === null) {\n return;\n }\n\n if ($this->instance->content->visibility != $this->visibility) {\n $this->instance->content->visibility = $this->visibility;\n\n $contentIds = [];\n foreach($this->instance->mediaList as $media) {\n $contentIds[] = $media->content->id;\n }\n\n Content::updateAll(['visibility' => $this->visibility], ['in', 'id', $contentIds]);\n }\n }", "function set_public_status(){\n\t\t\t\tif (get_option( 'blog_public' ) == 1 ){\n\t\t\t\t\tupdate_option('blog_public', 0);\n\t\t\t\t}\n\t\t\t}", "function set_public_status(){\n\t\t\t\tif (get_option( 'blog_public' ) == 0 ){\n\t\t\t\t\tupdate_option('blog_public', 1);\n\t\t\t\t}\n\t\t\t}", "function damopen_assets_library_post_update_change_public_files_to_private() {\n $connection = Database::getConnection();\n // Select the uri from the database.\n $query = $connection\n ->select('file_managed', 'fm')\n ->fields('fm', ['fid', 'uri']);\n $result = $query->execute();\n\n $fileStorage = Drupal::entityTypeManager()->getStorage('file');\n $fileSystem = Drupal::service('file_system');\n $priv_path = $fileSystem->realpath('private://');\n\n foreach ($result as $row) {\n $uri = str_replace('public://', '', $row->uri);\n $file_name = substr(strrchr($uri, '/'), 1);\n $folder = str_replace($file_name, '', $uri);\n // Check if the directory already exists.\n // Directory does not exist, so lets create it.\n if (\n !is_dir($priv_path . '/' . $folder)\n && !mkdir($concurrentDirectory = $priv_path . '/' . $folder, 0775, TRUE)\n && !is_dir($concurrentDirectory)\n ) {\n throw new RuntimeException(sprintf('Directory \"%s\" was not created', $concurrentDirectory));\n }\n\n // Move the file to the private folder.\n $new_uri = $fileSystem->move('public://' . $uri, 'private://' . $uri, FileSystemInterface::EXISTS_REPLACE);\n\n if ($new_uri !== NULL) {\n // Replace the uri with the new private schema's uri.\n /** @var \\Drupal\\file\\FileInterface $file */\n $file = $fileStorage->load($row->fid);\n $file->setFileUri($new_uri);\n $file->save();\n }\n }\n}", "public function updatePublications() {\n DAOFactory::getPersonDAO()->updatePublications($this);\n }", "public function setpublic() {\n $this->layout = \"\";\n $sessionstaff = $this->Session->read('staff');\n\n\n $Locations = $this->Promotion->find('first', array('conditions' => array('Promotion.id' => $_POST['promotion_id'])));\n\n\n if ($Locations['Promotion']['public'] == 1) {\n $like = 0;\n } else {\n $like = 1;\n }\n\n $this->Promotion->query('UPDATE promotions set public=\"' . $like . '\" where id=' . $Locations['Promotion']['id']);\n\n exit;\n }", "public function changeToPublic(){\n $num=0;\n $id=$this->session->get('id_rev');\n $tmp_review=new Review();\n $review=$tmp_review->find($id);\n\n $tmp_review->save([\n 'id_rev'=>$review->id_rev,\n 'title'=>$review->title,\n 'text'=>$review->text,\n 'privacy'=>$num,\n 'token_count'=>$review->token_count,\n 'id_vis'=>$review->id_vis,\n 'date_posted'=>$review->date_posted\n ]);\n\n\n }", "public function isPublic() {\n return $this->privacyState == 'public';\n }", "public function updatePublishedAt() {\n\t\tif (!$this->private && !$this->published_at) {\n\t\t\t$this->published_at = $this->updated_at;\n\t\t}\n\t}", "public function setPubliclyViewable($value)\n {\n $this->setItemValue('publicly_viewable', (bool)$value);\n }", "function subway_is_public_form() {\n\n\techo '<label for=\"subway_is_public\"><input ' . checked( 1, get_option( 'subway_is_public' ), false ) . ' value=\"1\" name=\"subway_is_public\" id=\"subway_is_public\" type=\"checkbox\" class=\"code\" /> Check to make all of your posts and pages visible to public.</label>';\n\techo '<p class=\"description\">' . esc_html__( 'Pages like user profile, members, and groups are still only available to the rightful owner of the profile.', 'subway' ) . '</p>';\n\n\treturn;\n}", "function wp_update_blog_public_option_on_site_update($site_id, $is_public)\n {\n }", "function publishExhibit(){\n\t\t$this->setVisible('1');\n\t\t$res = requete_sql(\"UPDATE exhibit SET visible = '\".$this->visible.\"' WHERE id = '\".$this->id.\"' \");\n\t\tif ($res) {\n\t\t\treturn TRUE;\n\t\t}\n\t\telse{\n\t\t\treturn FALSE;\n\t\t}\n\t}", "public function isPublic()\n {\n\n if ($this->visibility == self::VISIBILITY_PUBLIC) {\n return true;\n }\n\n return false;\n }", "public function setVisibility($isPublic = 0, $isFriend = 0, $isFamily = 0)\r\n {\r\n $this->_visibility = array(\r\n 'is_public' => $isPublic,\r\n 'is_friend' => $isFriend,\r\n 'is_family' => $isFamily,\r\n );\r\n }", "public function setPublic($public)\n {\n $this->_public = $public;\n }", "public function isPublic()\n {\n return $this->_public;\n }", "public function isPublic() {\n\t\treturn $this->public;\n\t}", "public function isPublic() {}", "public function setPublic( $public = true ){\n\t\t$this->public = $public;\n\t}", "public function isPublic()\n {\n return $this->public;\n }", "public function setPublic()\n {\n $this->private = false;\n }", "public function setVisibility() {}", "function getVisibility() {\n if($this->visibility === false) {\n $this->visibility = $this->canSeePrivate() ? VISIBILITY_PRIVATE : VISIBILITY_NORMAL;\n } // if\n return $this->visibility;\n }", "public function setPublic($public) {\n $params = array(\"userid={$this->id}\",\n \"publickey={$this->publickey}\");\n switch ($public) {\n case true:\n $params[] = \"ispublic=1\";\n break;\n case false:\n $params[] = \"ispublic=0\";\n break;\n default:\n throw new validationErrorWbsException(\"Public should be set to true or false\");\n break;\n }\n $this->callWbs('user', 'update', $params);\n return true;\n }", "public function update(Request $request, Publicidad $publicidad)\n {\n $publicidad = Publicidad::find($request['id']);\n\n if($request['publi'] == 1){\n $file = $request->file('fichero1');\n $name = $file->store('noticias-img');\n $publicidad->publi1 = '/storage/' . $name;\n $publicidad->save();\n return redirect('/agregar');\n }\n\n if($request['publi'] == 2){\n $file = $request->file('fichero2');\n $name = $file->store('noticias-img');\n $publicidad->publi2 = '/storage/' . $name;\n $publicidad->save();\n return redirect('/agregar');\n }\n\n if($request['publi'] == 3){\n $file = $request->file('fichero3');\n $name = $file->store('noticias-img');\n $publicidad->publi3 = '/storage/' . $name;\n $publicidad->save();\n return redirect('/agregar');\n }\n\n if($request['publi'] == 4){\n $file = $request->file('fichero4');\n $name = $file->store('noticias-img');\n $publicidad->publi4 = '/storage/' . $name;\n $publicidad->save();\n return redirect('/agregar');\n }\n\n if($request['publi'] == 5){\n $file = $request->file('fichero5');\n $name = $file->store('noticias-img');\n $publicidad->publi5 = '/storage/' . $name;\n $publicidad->save();\n return redirect('/agregar');\n }\n }", "public function get_visibility()\n {\n }", "public function set_public($value) {\r\n $this->public = $value;\r\n data::add(\"public\", $this->public == \"\" ? 1 : $this->public, $this->table_fields);\r\n }" ]
[ "0.7433434", "0.697364", "0.6724741", "0.6699069", "0.6688663", "0.6155418", "0.6049058", "0.6047401", "0.60376936", "0.5982526", "0.57420754", "0.5724763", "0.57083505", "0.56794137", "0.56685036", "0.56627905", "0.56376064", "0.5635653", "0.56148225", "0.56059617", "0.5595509", "0.55890936", "0.5582023", "0.556295", "0.55586284", "0.5543791", "0.5514967", "0.5512556", "0.5506944", "0.54965883" ]
0.7411745
1
Test that the sanitized css matches a known good version
public function test_css_was_sanitized() { $unsanitized_css = file_get_contents( __DIR__ . '/unsanitized.css' ); $known_good_sanitized_css = file_get_contents( __DIR__ . '/sanitized.css' ); $maybe_sanitized_css = sanitize_unsafe_css( $unsanitized_css ); $this->assertEquals( $maybe_sanitized_css, $known_good_sanitized_css ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function safecss_filter_attr($css, $deprecated = '')\n {\n }", "function cleanStyleInformation($string) {\r\n\t\t$string = str_replace('&nbsp;', ' ', $string);\r\n\t\t$string = str_replace('&quot;', \"'\", $string);\r\n\t\t$string = ReTidy::decode_for_DOM_character_entities($string);\r\n\t\t/* // 2011-11-28\r\n\t\tpreg_match_all('/&[\\w#x0-9]+;/is', $string, $character_entity_matches);\r\n\t\tforeach($character_entity_matches[0] as $character_entity_match) {\r\n\t\t\t//$decoded = html_entity_decode($character_entity_match);\r\n\t\t\tif(strpos($decoded, \";\") === false) {\r\n\t\t\t\t$string = str_replace($character_entity_match, $decoded, $string);\r\n\t\t\t} else { // then we still have a problem\r\n\t\t\t\tprint(\"did not properly decode HTML character entity in style attribute4892589435: <br>\\r\\n\");var_dump($decoded);print(\"<br>\\r\\n\");var_dump($string);print(\"<br>\\r\\n\");exit(0);\r\n\t\t\t}\r\n\t\t}*/\r\n\t\t$string = preg_replace('/\\/\\*.*\\*\\//s', '', $string);\r\n\t\t// the above could already be taken care of\r\n\t\t$string = preg_replace('/\\s*;\\s*/s', '; ', $string);\r\n\t\t$string = preg_replace('/\\s*:\\s*/s', ': ', $string);\r\n\t\t// pseudo-elements...\r\n\t\t$string = preg_replace('/\\s*:\\s*(\\w*)\\s*\\{([^\\{\\}]*)\\}/s', ' :$1 {$2};', $string);\r\n\t\t// we would probably like to force a format on things like media rules here also\r\n\t\t$string = preg_replace('/\\r\\n/', ' ', $string);\r\n\t\t$string = preg_replace('/\\s+/', ' ', $string);\r\n\t\t$string = trim($string);\r\n\t\t$string = ReTidy::delete_empty_styles($string);\r\n\t\t$string = ReTidy::ensureStyleInformationBeginsProperly($string);\r\n\t\t$string = ReTidy::ensureStyleInformationEndsProperly($string);\r\n\t\treturn $string;\r\n\t}", "public function testPreprocessCssFail() {\n $eval1 = <<<EOT\n\\$config = \\\\Drupal::configFactory()->getEditable('system.performance');\n\\$config->set('css.preprocess', FALSE);\n\\$config->save();\nEOT;\n $this->drush('php-eval', array($eval1), $this->options);\n $this->drush('audit-cache', array(), $this->options + array(\n 'detail' => NULL,\n 'json' => NULL,\n ));\n $output = json_decode($this->getOutput());\n $this->assertEquals(\\SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL, $output->checks->SiteAuditCheckCachePreprocessCss->score);\n }", "private function proxify_css($str){\r\n\t\t\r\n\t\t// The HTML5 standard does not require quotes around attribute values.\r\n\t\t\r\n\t\t// if {1} is not there then youtube breaks for some reason\r\n\t\t$str = preg_replace_callback('@[^a-z]{1}url\\s*\\((?:\\'|\"|)(.*?)(?:\\'|\"|)\\)@im', array($this, 'css_url'), $str);\r\n\t\t\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/CSS/@import\r\n\t\t// TODO: what about @import directives that are outside <style>?\r\n\t\t$str = preg_replace_callback('/@import (\\'|\")(.*?)\\1/i', array($this, 'css_import'), $str);\r\n\t\t\r\n\t\treturn $str;\r\n\t}", "function makeSafeForCss($className) {\n $cleanName = preg_replace('/\\W+/','',strtolower($className));\n return $cleanName;\n }", "function minify_css($input) {\n if(trim($input) === \"\") return $input;\n return preg_replace(\n array(\n // Remove comment(s)\n '#(\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\')|\\/\\*(?!\\!)(?>.*?\\*\\/)|^\\s*|\\s*$#s',\n // Remove unused white-space(s)\n '#(\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\'|\\/\\*(?>.*?\\*\\/))|\\s*+;\\s*+(})\\s*+|\\s*+([*$~^|]?+=|[{};,>~+]|\\s*+-(?![0-9\\.])|!important\\b)\\s*+|([[(:])\\s++|\\s++([])])|\\s++(:)\\s*+(?!(?>[^{}\"\\']++|\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\')*+{)|^\\s++|\\s++\\z|(\\s)\\s+#si',\n // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`\n '#(?<=[\\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',\n // Replace `:0 0 0 0` with `:0`\n '#:(0\\s+0|0\\s+0\\s+0\\s+0)(?=[;\\}]|\\!important)#i',\n // Replace `background-position:0` with `background-position:0 0`\n '#(background-position):0(?=[;\\}])#si',\n // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space\n '#(?<=[\\s:,\\-])0+\\.(\\d+)#s',\n // Minify string value\n '#(\\/\\*(?>.*?\\*\\/))|(?<!content\\:)([\\'\"])([a-z_][a-z0-9\\-_]*?)\\2(?=[\\s\\{\\}\\];,])#si',\n '#(\\/\\*(?>.*?\\*\\/))|(\\burl\\()([\\'\"])([^\\s]+?)\\3(\\))#si',\n // Minify HEX color code\n '#(?<=[\\s:,\\-]\\#)([a-f0-6]+)\\1([a-f0-6]+)\\2([a-f0-6]+)\\3#i',\n // Replace `(border|outline):none` with `(border|outline):0`\n '#(?<=[\\{;])(border|outline):none(?=[;\\}\\!])#',\n // Remove empty selector(s)\n '#(\\/\\*(?>.*?\\*\\/))|(^|[\\{\\}])(?:[^\\s\\{\\}]+)\\{\\}#s'\n ),\n array(\n '$1',\n '$1$2$3$4$5$6$7',\n '$1',\n ':0',\n '$1:0 0',\n '.$1',\n '$1$3',\n '$1$2$4$5',\n '$1$2$3',\n '$1:0',\n '$1$2'\n ),\n $input);\n}", "function minify_css($input)\n {\n if (trim($input) === \"\")\n {\n return $input;\n }\n\n return preg_replace(\n array(\n // Remove comment(s)\n '#(\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\')|\\/\\*(?!\\!)(?>.*?\\*\\/)|^\\s*|\\s*$#s',\n // Remove unused white-space(s)\n '#(\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\'|\\/\\*(?>.*?\\*\\/))|\\s*+;\\s*+(})\\s*+|\\s*+([*$~^|]?+=|[{};,>~+]|\\s*+-(?![0-9\\.])|!important\\b)\\s*+|([[(:])\\s++|\\s++([])])|\\s++(:)\\s*+(?!(?>[^{}\"\\']++|\"(?:[^\"\\\\\\]++|\\\\\\.)*+\"|\\'(?:[^\\'\\\\\\\\]++|\\\\\\.)*+\\')*+{)|^\\s++|\\s++\\z|(\\s)\\s+#si',\n // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`\n '#(?<=[\\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',\n // Replace `:0 0 0 0` with `:0`\n '#:(0\\s+0|0\\s+0\\s+0\\s+0)(?=[;\\}]|\\!important)#i',\n // Replace `background-position:0` with `background-position:0 0`\n '#(background-position):0(?=[;\\}])#si',\n // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space\n '#(?<=[\\s:,\\-])0+\\.(\\d+)#s',\n // Minify string value\n '#(\\/\\*(?>.*?\\*\\/))|(?<!content\\:)([\\'\"])([a-z_][a-z0-9\\-_]*?)\\2(?=[\\s\\{\\}\\];,])#si',\n '#(\\/\\*(?>.*?\\*\\/))|(\\burl\\()([\\'\"])([^\\s]+?)\\3(\\))#si',\n // Minify HEX color code\n '#(?<=[\\s:,\\-]\\#)([a-f0-6]+)\\1([a-f0-6]+)\\2([a-f0-6]+)\\3#i',\n // Replace `(border|outline):none` with `(border|outline):0`\n '#(?<=[\\{;])(border|outline):none(?=[;\\}\\!])#',\n // Remove empty selector(s)\n '#(\\/\\*(?>.*?\\*\\/))|(^|[\\{\\}])(?:[^\\s\\{\\}]+)\\{\\}#s'\n ),\n array(\n '$1',\n '$1$2$3$4$5$6$7',\n '$1',\n ':0',\n '$1:0 0',\n '.$1',\n '$1$3',\n '$1$2$4$5',\n '$1$2$3',\n '$1:0',\n '$1$2'\n ),\n $input);\n }", "public function testPreprocessCssPass() {\n $eval1 = <<<EOT\n\\$config = \\\\Drupal::configFactory()->getEditable('system.performance');\n\\$config->set('css.preprocess', TRUE);\n\\$config->save();\nEOT;\n $this->drush('php-eval', array($eval1), $this->options);\n $this->drush('audit-cache', array(), $this->options + array(\n 'detail' => NULL,\n 'json' => NULL,\n ));\n $output = json_decode($this->getOutput());\n $this->assertEquals(\\SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS, $output->checks->SiteAuditCheckCachePreprocessCss->score);\n }", "public function testsanitizeStrict()\n {\n $input = 'test87';\n\t$output = sanitizeStrict($input);\n\t\n $this->assertEquals( $output , 'test87' , 'fail sanitizeStrict '.$input);\n// asserting that the regex block other characters on the two next tests\n\t$input = 'test&';\n\t$output = sanitizeStrict($input);\n\t\n $this->assertEquals( $output , 'test' , 'fail sanitizeStrict '.$input);\n\n\t\n $input = 'test#';\n\t$output = sanitizeStrict($input);\n\t\n $this->assertEquals( $output , 'test' , 'fail sanitizeStrict '.$input);\t\n\t\n\treturn false;\n }", "public static function sanitizeCSS($css)\n {\n $css = preg_replace('/(?<![a-z0-9\\-\\_\\#\\.])body(?![a-z0-9\\-\\_])/i', '.body', $css);\n\n //\n // Inspired by http://stackoverflow.com/a/5209050/1721527, dleavitt <https://stackoverflow.com/users/362110/dleavitt>\n //\n\n // Create a new configuration object\n $config = HTMLPurifier_Config::createDefault();\n $config->set('Filter.ExtractStyleBlocks', true);\n $config->set('CSS.AllowImportant', true);\n $config->set('CSS.AllowTricky', true);\n $config->set('CSS.Trusted', true);\n\n // Create a new purifier instance\n $purifier = new HTMLPurifier($config);\n\n // Wrap our CSS in style tags and pass to purifier.\n // we're not actually interested in the html response though\n $purifier->purify('<style>'.$css.'</style>');\n\n // The \"style\" blocks are stored seperately\n $css = $purifier->context->get('StyleBlocks');\n\n // Get the first style block\n return count($css) ? $css[0] : '';\n }", "function bdpp_validate_css_settings( $input ) {\n\n\t$input['custom_css'] = isset($input['custom_css']) ? sanitize_textarea_field( $input['custom_css'] ) : '';\n\n\treturn $input;\n}", "function fabric_clean_style_tag($input) {\n preg_match_all(\"!<link rel='stylesheet'\\s?(id='[^']+')?\\s+href='(.*)' type='text/css' media='(.*)' />!\", $input, $matches);\n // Only display media if it is meaningful\n $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media=\"' . $matches[3][0] . '\"' : '';\n return '<link rel=\"stylesheet\" href=\"' . $matches[2][0] . '\"' . $media . '>' . \"\\n\";\n}", "public function it_can_be_sanitized()\n {\n $this->markTestSkipped('Sanitization is not implemented yet.');\n }", "public function testAllowedValues()\n {\n $string = $this->basicSanitizer->sanitize('<a href=\"#\" title=\"four\">hey</a>');\n $this->assertEquals('<a href=\"#\">hey</a>', $string);\n }", "function clean_style_tag( $input ) {\n\t$link = \"!<link rel='stylesheet'\\s?(id='[^']+')?\\s+href='(.*)' type='text/css' media='(.*)' />!\";\n\tpreg_match_all( $link, $input, $matches );\n\tif ( empty( $matches[2] ) ) {\n\t\treturn $input;\n\t}\n\n\t// Only display media if it is meaningful\n\t$media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media=\"' . $matches[3][0] . '\"' : '';\n\n\treturn '<link rel=\"stylesheet\" href=\"' . $matches[2][0] . '\"' . $media . '>' . \"\\n\";\n}", "function clean_style_tag($input) {\n preg_match_all(\"!<link rel='stylesheet'\\s?(id='[^']+')?\\s+href='(.*)' type='text/css' media='(.*)' />!\", $input, $matches);\n if (empty($matches[2])) {\n return $input;\n }\n // Only display media if it is meaningful\n $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media=\"' . $matches[3][0] . '\"' : '';\n return '<link rel=\"stylesheet\" href=\"' . $matches[2][0] . '\"' . $media . '>' . \"\\n\";\n}", "function fs_clean_style_tag( $input ) {\r\n\tpreg_match_all( \"!<link rel='stylesheet'\\s?(id='[^']+')?\\s+href='(.*)' type='text/css' media='(.*)' />!\", $input, $matches );\r\n\t// Only display media if it's print\r\n\t$media = $matches[3][0] === 'print' ? ' media=\"print\"' : '';\r\n\treturn '<link rel=\"stylesheet\" href=\"' . $matches[2][0] . '\"' . $media . '>' . \"\\n\";\r\n}", "function clean_style_tag($input) {\n preg_match_all(\"!<link rel='stylesheet'\\s?(id='[^']+')?\\s+href='(.*)' type='text/css' media='(.*)' />!\", $input, $matches);\n if (empty($matches[2])) {\n return $input;\n }\n // Only display media if it is meaningful\n $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media=\"' . $matches[3][0] . '\"' : '';\n return '<link rel=\"stylesheet\" href=\"' . $matches[2][0] . '\"' . $media . '>' . \"\\n\";\n}", "function hatch_custom_css_sanitize( $setting, $object ) {\n\n\tif ( 'hatch_custom_css' == $object->id )\n\t\t$setting = wp_filter_nohtml_kses( $setting );\n\n\treturn $setting;\n}", "public function xssClean($str)\r\n\t{\r\n\t\t$str = preg_replace('/\\0+/', '', $str);\r\n\t\t$str = preg_replace('/(\\\\\\\\0)+/', '', $str);\r\n\r\n\t\t/*\r\n\t\t * Validate standard character entities\r\n\t\t *\r\n\t\t * Add a semicolon if missing. We do this to enable\r\n\t\t * the conversion of entities to ASCII later.\r\n\t\t *\r\n\t\t */\r\n\t\t$str = preg_replace('#(&\\#?[0-9a-z]+)[\\x00-\\x20]*;?#i', \"\\\\1;\", $str);\r\n\t\t\r\n\t\t/*\r\n\t\t * Validate UTF16 two byte encoding (x00) \r\n\t\t *\r\n\t\t * Just as above, adds a semicolon if missing.\r\n\t\t *\r\n\t\t */\r\n\t\t$str = preg_replace('#(&\\#x?)([0-9A-F]+);?#i',\"\\\\1\\\\2;\",$str);\r\n\r\n\t\t/*\r\n\t\t * URL Decode\r\n\t\t *\r\n\t\t * Just in case stuff like this is submitted:\r\n\t\t *\r\n\t\t * <a href=\"http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D\">Google</a>\r\n\t\t *\r\n\t\t * Note: Use rawurldecode() so it does not remove plus signs\r\n\t\t *\r\n\t\t */\t\r\n\t\t$str = rawurldecode($str);\r\n\r\n\t\t/*\r\n\t\t * Convert character entities to ASCII \r\n\t\t *\r\n\t\t * This permits our tests below to work reliably.\r\n\t\t * We only convert entities that are within tags since\r\n\t\t * these are the ones that will pose security problems.\r\n\t\t *\r\n\t\t */\r\n\t\tif (preg_match_all(\"/[a-z]+=([\\'\\\"]).*?\\\\1/si\", $str, $matches))\r\n\t\t{ \r\n\t\t\tfor ($i = 0; $i < count($matches[0]); $i++)\r\n\t\t\t{\r\n\t\t\t\tif (stristr($matches[0][$i], '>'))\r\n\t\t\t\t{\r\n\t\t\t\t\t$str = str_replace(\t$matches['0'][$i], \r\n\t\t\t\t\t\t\t\t\t\tstr_replace('>', '&lt;', $matches[0][$i]), \r\n\t\t\t\t\t\t\t\t\t\t$str);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t \r\n if (preg_match_all(\"/<([\\w]+)[^>]*>/si\", $str, $matches))\r\n { \r\n\t\t\tfor ($i = 0; $i < count($matches[0]); $i++)\r\n\t\t\t{\r\n\t\t\t\t$str = str_replace($matches[0][$i], \r\n\t\t\t\t\t\t\t\t\t$this->_html_entity_decode($matches[0][$i]), \r\n\t\t\t\t\t\t\t\t\t$str);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Convert all tabs to spaces\r\n\t\t *\r\n\t\t * This prevents strings like this: ja\tvascript\r\n\t\t * NOTE: we deal with spaces between characters later.\r\n\t\t * NOTE: preg_replace was found to be amazingly slow here on large blocks of data,\r\n\t\t * so we use str_replace.\r\n\t\t *\r\n\t\t */\r\n\t\t \r\n\t\t$str = str_replace(\"\\t\", \" \", $str);\r\n\r\n\t\t/*\r\n\t\t * Not Allowed Under Any Conditions\r\n\t\t */\t\r\n\t\t$bad = array(\r\n\t\t\t\t\t\t'document.cookie'\t=> '[removed]',\r\n\t\t\t\t\t\t'document.write'\t=> '[removed]',\r\n\t\t\t\t\t\t'.parentNode'\t\t=> '[removed]',\r\n\t\t\t\t\t\t'.innerHTML'\t\t=> '[removed]',\r\n\t\t\t\t\t\t'window.location'\t=> '[removed]',\r\n\t\t\t\t\t\t'-moz-binding'\t\t=> '[removed]',\r\n\t\t\t\t\t\t'<!--'\t\t\t\t=> '&lt;!--',\r\n\t\t\t\t\t\t'-->'\t\t\t\t=> '--&gt;',\r\n\t\t\t\t\t\t'<!CDATA['\t\t\t=> '&lt;![CDATA['\r\n\t\t\t\t\t);\r\n\r\n\t\tforeach ($bad as $key => $val)\r\n\t\t{\r\n\t\t\t$str = str_replace($key, $val, $str); \r\n\t\t}\r\n\r\n\t\t$bad = array(\r\n\t\t\t\t\t\t\"javascript\\s*:\"\t=> '[removed]',\r\n\t\t\t\t\t\t\"expression\\s*\\(\"\t=> '[removed]', // CSS and IE\r\n\t\t\t\t\t\t\"Redirect\\s+302\"\t=> '[removed]'\r\n\t\t\t\t\t);\r\n\t\t\t\t\t\r\n\t\tforeach ($bad as $key => $val)\r\n\t\t{\r\n\t\t\t$str = preg_replace(\"#\".$key.\"#i\", $val, $str); \r\n\t\t}\r\n\t\r\n\t\t/*\r\n\t\t * Makes PHP tags safe\r\n\t\t *\r\n\t\t * Note: XML tags are inadvertently replaced too:\r\n\t\t *\r\n\t\t *\t<?xml\r\n\t\t *\r\n\t\t * But it doesn't seem to pose a problem.\r\n\t\t *\r\n\t\t */\t\t\r\n\t\t$str = str_replace(array('<?php', '<?PHP', '<?', '?'.'>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);\r\n\t\r\n\t\t/*\r\n\t\t * Compact any exploded words\r\n\t\t *\r\n\t\t * This corrects words like: j a v a s c r i p t\r\n\t\t * These words are compacted back to their correct state.\r\n\t\t *\r\n\t\t */\t\t\r\n\t\t$words = array('javascript', 'expression', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window');\r\n\t\tforeach ($words as $word)\r\n\t\t{\r\n\t\t\t$temp = '';\r\n\t\t\tfor ($i = 0; $i < strlen($word); $i++)\r\n\t\t\t{\r\n\t\t\t\t$temp .= substr($word, $i, 1).\"\\s*\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// We only want to do this when it is followed by a non-word character\r\n\t\t\t// That way valid stuff like \"dealer to\" does not become \"dealerto\"\r\n\t\t\t$str = preg_replace('#('.substr($temp, 0, -3).')(\\W)#ise', \"preg_replace('/\\s+/s', '', '\\\\1').'\\\\2'\", $str);\r\n\t\t}\r\n\t\r\n\t\t/*\r\n\t\t * Remove disallowed Javascript in links or img tags\r\n\t\t */\r\n\t\tdo\r\n\t\t{\r\n\t\t\t$original = $str;\r\n\t\t\t\r\n\t\t\tif ((version_compare(PHP_VERSION, '5.0', '>=') === TRUE && stripos($str, '</a>') !== FALSE) OR \r\n\t\t\t\t preg_match(\"/<\\/a>/i\", $str))\r\n\t\t\t{\r\n\t\t\t\t$str = preg_replace_callback(\"#<a.*?</a>#si\", array($this, '_js_link_removal'), $str);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif ((version_compare(PHP_VERSION, '5.0', '>=') === TRUE && stripos($str, '<img') !== FALSE) OR \r\n\t\t\t\t preg_match(\"/img/i\", $str))\r\n\t\t\t{\r\n\t\t\t\t$str = preg_replace_callback(\"#<img.*?\".\">#si\", array($this, '_js_img_removal'), $str);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif ((version_compare(PHP_VERSION, '5.0', '>=') === TRUE && (stripos($str, 'script') !== FALSE OR stripos($str, 'xss') !== FALSE)) OR\r\n\t\t\t\t preg_match(\"/(script|xss)/i\", $str))\r\n\t\t\t{\r\n\t\t\t\t$str = preg_replace(\"#</*(script|xss).*?\\>#si\", \"\", $str);\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile($original != $str);\r\n\t\t\r\n\t\tunset($original);\r\n\r\n\t\t/*\r\n\t\t * Remove JavaScript Event Handlers\r\n\t\t *\r\n\t\t * Note: This code is a little blunt. It removes\r\n\t\t * the event handler and anything up to the closing >,\r\n\t\t * but it's unlikely to be a problem.\r\n\t\t *\r\n\t\t */\t\t\r\n\t\t$event_handlers = array('onblur','onchange','onclick','onfocus','onload','onmouseover','onmouseup','onmousedown','onselect','onsubmit','onunload','onkeypress','onkeydown','onkeyup','onresize', 'xmlns');\r\n\t\t$str = preg_replace(\"#<([^>]+)(\".implode('|', $event_handlers).\")([^>]*)>#iU\", \"&lt;\\\\1\\\\2\\\\3&gt;\", $str);\r\n\t\r\n\t\t/*\r\n\t\t * Sanitize naughty HTML elements\r\n\t\t *\r\n\t\t * If a tag containing any of the words in the list\r\n\t\t * below is found, the tag gets converted to entities.\r\n\t\t *\r\n\t\t * So this: <blink>\r\n\t\t * Becomes: &lt;blink&gt;\r\n\t\t *\r\n\t\t */\t\t\r\n\t\t$str = preg_replace('#<(/*\\s*)(alert|applet|basefont|base|behavior|bgsound|blink|body|embed|expression|form|frameset|frame|head|html|ilayer|iframe|input|layer|link|meta|object|plaintext|style|script|textarea|title|xml|xss)([^>]*)>#is', \"&lt;\\\\1\\\\2\\\\3&gt;\", $str);\r\n\t\t\r\n\t\t/*\r\n\t\t * Sanitize naughty scripting elements\r\n\t\t *\r\n\t\t * Similar to above, only instead of looking for\r\n\t\t * tags it looks for PHP and JavaScript commands\r\n\t\t * that are disallowed. Rather than removing the\r\n\t\t * code, it simply converts the parenthesis to entities\r\n\t\t * rendering the code un-executable.\r\n\t\t *\r\n\t\t * For example:\teval('some code')\r\n\t\t * Becomes:\t\teval&#40;'some code'&#41;\r\n\t\t *\r\n\t\t */\r\n\t\t$str = preg_replace('#(alert|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\\s*)\\((.*?)\\)#si', \"\\\\1\\\\2&#40;\\\\3&#41;\", $str);\r\n\t\t\t\t\t\t\r\n\t\t/*\r\n\t\t * Final clean up\r\n\t\t *\r\n\t\t * This adds a bit of extra precaution in case\r\n\t\t * something got through the above filters\r\n\t\t *\r\n\t\t */\t\r\n\t\t$bad = array(\r\n\t\t\t\t\t\t'document.cookie'\t=> '[removed]',\r\n\t\t\t\t\t\t'document.write'\t=> '[removed]',\r\n\t\t\t\t\t\t'.parentNode'\t\t=> '[removed]',\r\n\t\t\t\t\t\t'.innerHTML'\t\t=> '[removed]',\r\n\t\t\t\t\t\t'window.location'\t=> '[removed]',\r\n\t\t\t\t\t\t'-moz-binding'\t\t=> '[removed]',\r\n\t\t\t\t\t\t'<!--'\t\t\t\t=> '&lt;!--',\r\n\t\t\t\t\t\t'-->'\t\t\t\t=> '--&gt;',\r\n\t\t\t\t\t\t'<!CDATA['\t\t\t=> '&lt;![CDATA['\r\n\t\t\t\t\t);\r\n\r\n\t\tforeach ($bad as $key => $val)\r\n\t\t{\r\n\t\t\t$str = str_replace($key, $val, $str); \r\n\t\t}\r\n\r\n\t\t$bad = array(\r\n\t\t\t\t\t\t\"javascript\\s*:\"\t=> '[removed]',\r\n\t\t\t\t\t\t\"expression\\s*\\(\"\t=> '[removed]', // CSS and IE\r\n\t\t\t\t\t\t\"Redirect\\s+302\"\t=> '[removed]'\r\n\t\t\t\t\t);\r\n\t\t\t\t\t\r\n\t\tforeach ($bad as $key => $val)\r\n\t\t{\r\n\t\t\t$str = preg_replace(\"#\".$key.\"#i\", $val, $str); \r\n\t\t}\r\n\r\n\t\treturn $str;\r\n\t}", "function sw_clean_style_tag($input) {\r\n\tpreg_match_all(\"!<link rel='stylesheet'\\s?(id='[^']+')?\\s+href='(.*)' type='text/css' media='(.*)' />!\", $input, $matches);\r\n\t$media = $matches[3][0] === 'print' ? ' media=\"print\"' : '';\r\n\treturn '<link rel=\"stylesheet\" href=\"' . esc_url( $matches[2][0] ) . '\"' . $media . '>' . \"\\n\";\r\n}", "public function testCustomAttribute() : void\n {\n $string = $this->basicSanitizer->sanitize('<img src=\"1.png\" data-src=\"1.png\">');\n $this->assertEquals('<img src=\"1.png\" data-src=\"1.png\">', $string);\n }", "function inputCleaner($value){\n\t $toBeTested\t\t= strip_tags($value);\n\t // Instead of using HTMLStripSpecialChars, I am using some Regex\n\t\t// to have a greater degree of control over the input.\n\t\t//\tThis regex checks the entire string for anything that\n\t\t//\tcould ruin our consistency.\n\t $regExp = (\"/[\\!\\\"\\£\\$\\%\\^\\&\\*\\(\\)\\;\\'\\,\\\"\\?]/ \");\n\t if(preg_match_all($regExp, $toBeTested,$matches)){\n\t \treturn false;\n\t\t}\n\t\telse{\n\t\t\treturn $toBeTested;\n\t\t}\n\t}", "function nectar_quick_minify( $css ) {\n\n\t$css = preg_replace( '/\\s+/', ' ', $css );\n\t\n\t$css = preg_replace( '/\\/\\*[^\\!](.*?)\\*\\//', '', $css );\n\t\n\t$css = preg_replace( '/(,|:|;|\\{|}) /', '$1', $css );\n\t\n\t$css = preg_replace( '/ (,|;|\\{|})/', '$1', $css );\n\t\n\t$css = preg_replace( '/(:| )0\\.([0-9]+)(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}.${2}${3}', $css );\n\t\n\t$css = preg_replace( '/(:| )(\\.?)0(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}0', $css );\n\t\n\treturn trim( $css );\n\n}", "public function test_it_finds_settings_css() {\n $starttoken = css_processor::TOKEN_ENABLEOVERRIDES_START;\n $endtoken = css_processor::TOKEN_ENABLEOVERRIDES_END;\n $css = <<<EOF\nbody {\n background: lime;\n}\n{$starttoken}\nSETTINGS HERE 1\n{$endtoken}\n.foo .bar {\n display: inline-block;\n color: #123123;\n}\n\n{$starttoken}\nSETTINGS HERE 2\n{$endtoken}\nEOF;\n $expected = array();\n $expected[] = <<<EOF\n{$starttoken}\nSETTINGS HERE 1\n{$endtoken}\nEOF;\n $expected[] = <<<EOF\n{$starttoken}\nSETTINGS HERE 2\n{$endtoken}\nEOF;\n $actual = (new css_processor())->get_settings_css($css);\n\n $this->assertEquals($expected, $actual);\n\n // No settings.\n $expected = array();\n $actual = (new css_processor())->get_settings_css('body { background: lime; }');\n\n $this->assertEquals($expected, $actual);\n }", "private function _replace_inline_css()\n\t{\n\t\t// preg_match_all( '/url\\s*\\(\\s*(?![\"\\']?data:)(?![\\'|\\\"]?[\\#|\\%|])([^)]+)\\s*\\)([^;},\\s]*)/i', $this->content, $matches ) ;\n\n\t\t/**\n\t\t * Excludes `\\` from URL matching\n\t\t * @see #959152 - Wordpress LSCache CDN Mapping causing malformed URLS\n\t\t * @see #685485\n\t\t * @since 3.0\n\t\t */\n\t\tpreg_match_all( '#url\\((?![\\'\"]?data)[\\'\"]?([^\\)\\'\"\\\\\\]+)[\\'\"]?\\)#i', $this->content, $matches ) ;\n\t\tforeach ( $matches[ 1 ] as $k => $url ) {\n\t\t\t$url = str_replace( array( ' ', '\\t', '\\n', '\\r', '\\0', '\\x0B', '\"', \"'\", '&quot;', '&#039;' ), '', $url ) ;\n\n\t\t\tif ( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {\n\t\t\t\tcontinue ;\n\t\t\t}\n\t\t\t$attr = str_replace( $matches[ 1 ][ $k ], $url2, $matches[ 0 ][ $k ] ) ;\n\t\t\t$this->content = str_replace( $matches[ 0 ][ $k ], $attr, $this->content ) ;\n\t\t}\n\t}", "function crypton_blog_cryptocurrency_prepare_css($css='', $remove_spaces=true) {\n\t\treturn apply_filters( 'cryptocurrency_filter_prepare_css', $css, $remove_spaces );\n\t}", "function test_stylesheet() {\n\t\t\tif ($this->is_readable_and_not_empty($this->get_stylesheet())) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// so try to generate stylesheet...\n\t\t\t$this->write_stylesheet(false);\n\n\t\t\t// retest\n\t\t\tif ($this->is_readable_and_not_empty($this->get_stylesheet())) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}", "private static final function cleanCSSEnvironmentIfCSSFile () {\r\n if (strpos ($_SERVER['SCRIPT_FILENAME'], '.css') && isset ($_SESSION['CSS'][$_SERVER['SCRIPT_FILENAME']])) {\r\n unset ($_SESSION['CSS'][$_SERVER['SCRIPT_FILENAME']]);\r\n // Do return ...\r\n return new B (TRUE);\r\n } else {\r\n // Do return ...\r\n return new B (FALSE);\r\n }\r\n }", "function cssuni($name)\n{\n\t$cssbegin = '<link rel=\"stylesheet\" href=\"';\n\t$cssend = '\">';\n//\tif (current_user_can('administrator')) $csspath = '/css/';\n\t$csspath = '/css/'; //$csspath='/css/';\n\t$filename = get_stylesheet_directory() . $csspath . $name;\n\tif (file_exists($filename)) return $cssbegin . get_template_directory_uri() . $csspath . $name . '?v=' . filemtime($filename) . $cssend;\n\treturn $cssbegin . get_template_directory_uri() . $csspath . $name . $cssend;\n}" ]
[ "0.62958", "0.61226946", "0.6118173", "0.6066739", "0.6029883", "0.5999646", "0.5948778", "0.59352994", "0.5889052", "0.57163066", "0.55703104", "0.5520725", "0.55170554", "0.54799986", "0.54263294", "0.53980327", "0.53788733", "0.5351177", "0.53320503", "0.5310577", "0.5297644", "0.5292352", "0.5280083", "0.526269", "0.52620506", "0.5238508", "0.5188613", "0.5180272", "0.5172164", "0.5166588" ]
0.8243286
0
this creates the divs for the summary fields
function createSummaryDivs($numRows, $groupType) { for ($i = 1; $i <= $numRows; $i++) { $divs .= "<div id=\"$i$groupType\"></div>\n"; } return $divs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function buildPaneSummary();", "function show() {\n global $post;\n \t\t/**\n\t\t * Use nonce for verification.\n\t\t */\n echo '<input type=\"hidden\" name=\"weddingvendor_meta_box_nonce\" value=\"', wp_create_nonce(basename(__FILE__)), '\" />';\n echo '<table class=\"form-table\">';\n\t\t\n foreach ($this->_meta_box['fields'] as $field) { \n\t\t\t/**\n\t\t\t * get current post meta data.\n\t\t\t */\n $meta = get_post_meta($post->ID, $field['id'], true);\n\t\t\tif( isset( $field['desc'] ) ) {\n\t\t\t\t$meta_description = $field['desc'];\n\t\t\t}\n\t\t\t\n echo '<tr><th style=\"width:20%\"><label for=\"',esc_attr($field['id']), '\">', esc_html($field['name']), '</label></th><td>';\n\t\t\t\n switch ($field['type']) {\n\t\t\t /**\n\t\t\t\t * Meta-box Text Field.\n\t\t\t\t */\t\n case 'text':\n \t echo '<input type=\"text\" name=\"',esc_html($field['id']), '\" id=\"', esc_attr($field['id']), '\" value=\"', $meta ? $meta : $field['std'], '\" size=\"30\" style=\"width:97%\" />',\n '<br /><small>', $meta_description.'</small>';\n break;\t\n\t\n\n\t\t\t /**\n\t\t\t\t * Meta-box date Field.\n\t\t\t\t */\t\n case 'date':\n \t echo '<input type=\"text\" name=\"',esc_html($field['id']), '\" id=\"', esc_attr($field['id']), '\" value=\"', $meta ? $meta : $field['std'], '\" size=\"30\" style=\"width:97%\" class=\"check_date date\" />',\n '<br /><small>', $meta_description.'</small>';\n break;\t\t\t\t\t \t\t\t\t\n\t\t\t /**\n\t\t\t\t * Meta-box Color Field.\n\t\t\t\t */\t\n\t\t\t\tcase 'color':\n\t\t\t\t echo '<input class=\"color-field\" type=\"text\" name=\"',esc_html($field['id']), '\" id=\"', esc_attr($field['id']), '\" value=\"', $meta ? $meta : $field['std'], '\" />',\n '<br /><small>', $meta_description.'</small>';\n\t\t\t\tbreak;\n\t\t\t /**\n\t\t\t\t * Meta-box Textarea Field.\n\t\t\t\t */\t\n case 'textarea':\n echo '<textarea name=\"',esc_html($field['id']), '\" id=\"', esc_attr($field['id']), '\" cols=\"60\" rows=\"4\" style=\"width:97%\">', $meta ? $meta : $field['std'], '</textarea>',\n '<br /><small>', $meta_description.'</small>';\n break;\n\t\t\t /**\n\t\t\t\t * Meta-box Select Field.\n\t\t\t\t */\t\n\t\t\t\tcase 'select':\t\t\t\t\t\n\t\t\t\t\t echo '<select name=\"'.esc_attr($field['id']).'\" id=\"'.esc_attr($field['id']).'\">';\n\t\t\t\t\t\t foreach ($field['options'] as $option) {\n\t\t\t\t\t\t \t echo '<option', $meta == $option['value'] ? ' selected=\"selected\"' : '', ' value=\"'.$option['value'].'\">'.$option['label'].'</option>';\n\t\t\t\t\t \t } \n\t\t\t\t\t echo '</select><br /><span class=\"description\">'.$meta_description.'</span>';\n break;\n\t\t\t /**\n\t\t\t\t * Meta-box Radio Field.\n\t\t\t\t */\t\n\t\t\t\tcase 'radio':\n\t\t\t\t\t foreach ( $field['options'] as $option ) {\n\t\t\t\t\t\t echo '<input type=\"radio\" name=\"'.esc_attr($field['id']).'\" id=\"'.$option['value'].'\" \n\t\t\t\t\t\t\t value=\"'.$option['value'].'\" ',$meta == $option['value'] ? ' checked=\"checked\"' : '',' />\n\t\t\t\t\t\t\t <label for=\"'.$option['value'].'\">'.$option['name'].'</label><br />';\n\t\t\t\t\t }\n\t\t\t\t\t echo '<span class=\"description\">'.$meta_description.'</span>';\n\t\t\t\tbreak;\n\t\t\t /**\n\t\t\t\t * Meta-box Checkbox Field.\n\t\t\t\t */\t\n\t case 'checkbox':\n \t echo '<input type=\"checkbox\" name=\"',esc_html($field['id']), '\" id=\"', esc_attr($field['id']), '\"', $meta ? ' checked=\"checked\"' : '', ' />';\n\t\t\t\t\t echo '<span class=\"description\">'.$meta_description.'</span>';\n break;\n\t\t\t /**\n\t\t\t\t * Meta-box Checkbox-group Field.\n\t\t\t\t */\t\n\t\t\t case 'checkbox_group':\n\t\t\t\t\t foreach ($field['options'] as $option) {\n\t\t\t\t\t echo '<input type=\"checkbox\" value=\"',$option['value'],'\" name=\"',esc_html($field['id']),'[]\" \n\t\t\t\t\t\t id=\"',$option['value'],'\"',$meta && in_array($option['value'], $meta) ? ' checked=\"checked\"' : '',' />\n\t\t\t\t\t\t <label for=\"'.$option['value'].'\">'.$option['name'].'</label><br />';\n\t\t\t\t\t }\n\t\t\t\t\t echo '<span class=\"description\">'.$meta_description.'</span>';\n\t\t\t\t\tbreak;\n\t\t\t /**\n\t\t\t\t * Meta-box Image Field.\n\t\t\t\t */\t\n\t\t\t\tcase 'image':\n\t\t\t\t\t echo '<span class=\"upload\">';\n\t\t\t\t\t if( $meta ) {\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t echo '<input type=\"hidden\" name=\"',esc_html($field['id']), '\" id=\"', esc_attr($field['id']), '\" \n\t\t\t\t\t\t\t\t class=\"regular-text form-control text-upload\" value=\"',$meta,'\" />';\t\t\t\t\t\t\t\n\t\t\t\t\t\t echo '<img style=\"width:150px; display:block;\" src= \"'.$meta.'\" class=\"preview-upload\" />';\n\t\t\t\t\t\t echo '<input type=\"button\" class=\"button button-upload\" id=\"logo_upload\" value=\"'.esc_html__('Upload an image','weddingvendor').'\"/></br>';\t\t\n\t\t\t\t\t\t echo '<input type=\"button\" class=\"button-remove\" id=\"remove\" value=\"'.esc_html__('Remove','weddingvendor').'\" /> ';\n\t\t\t\t\t }else {\n\t\t\t\t\t\t echo '<input type=\"hidden\" name=\"',esc_html($field['id']), '\" id=\"', esc_attr($field['id']), '\" \n\t\t\t\t\t\t\t\t\tclass=\"regular-text form-control text-upload\" value=\"',$meta,'\" />';\t\t\t\t\t\t\t\n\t\t\t\t\t\t echo '<img style=\"\" src= \"'.$meta.'\" class=\"preview-upload\" />';\n\t\t\t\t\t\t echo '<input type=\"button\" class=\"button button-upload\" id=\"logo_upload\" value=\"'.esc_html__('Upload an image','weddingvendor').'\"/></br>';\t\t\n\t\t\t\t\t\t echo '<input type=\"button\" style=\"display:none;\" id=\"remove\" class=\"button-remove\" value=\"\" /> ';\n\t\t\t\t\t } echo '</span><span class=\"description\">'.$meta_description.'</span>';\t\t\n\t\t\t\tbreak;\n\t\t\t\t\t\n }\n echo '<td></tr>';\n }\n echo '</table>';\n }", "public function dashboard_summary_metabox() {\r\n\t\t$core = WP_Smush::get_instance()->core();\r\n\r\n\t\t$resize_count = $core->get_savings( 'resize', false, false, true );\r\n\r\n\t\t// Split human size to get format and size.\r\n\t\t$human = explode( ' ', $core->stats['human'] );\r\n\r\n\t\t$resize_savings = 0;\r\n\t\t// Get current resize savings.\r\n\t\tif ( ! empty( $core->stats['resize_savings'] ) && $core->stats['resize_savings'] > 0 ) {\r\n\t\t\t$resize_savings = size_format( $core->stats['resize_savings'], 1 );\r\n\t\t}\r\n\r\n\t\t$this->view(\r\n\t\t\t'summary/meta-box',\r\n\t\t\tarray(\r\n\t\t\t\t'human_format' => empty( $human[1] ) ? 'B' : $human[1],\r\n\t\t\t\t'human_size' => empty( $human[0] ) ? '0' : $human[0],\r\n\t\t\t\t'remaining' => $this->get_total_images_to_smush(),\r\n\t\t\t\t'resize_count' => ! $resize_count ? 0 : $resize_count,\r\n\t\t\t\t'resize_enabled' => (bool) $this->settings->get( 'resize' ),\r\n\t\t\t\t'resize_savings' => $resize_savings,\r\n\t\t\t\t'stats_percent' => $core->stats['percent'] > 0 ? number_format_i18n( $core->stats['percent'], 1 ) : 0,\r\n\t\t\t\t'total_optimized' => $core->stats['total_images'],\r\n\t\t\t)\r\n\t\t);\r\n\t}", "function display() {\n\t\tif (!empty($this->config['blog_id'])) {\n\t\t\t$default_data = get_blog_option($this->config['blog_id'], $this->config['name']);\n\t\t}\n\t\telse {\n\t\t\t$default_data = get_option($this->config['name']);\n\t\t}\n\t\t$data = apply_filters('cfinput_get_settings_value',$default_data,$this->config);\n\t\tif ($data != '') {\n\t\t\t$data = maybe_unserialize($data);\n\t\t}\n\t\t// kick off the repeater block with a wrapper div to contain everything\n\t\t$html .= '<div class=\"block_wrapper\">'. \n\t\t\t\t '<h4>'.\n\t\t\t\t (isset($this->config['block_label']) && !empty($this->config['block_label']) ? $this->config['block_label'] : '&nbsp;').\n\t\t\t\t '</h4>';\n\t\t\n\t\t// this div just contains the actual items in the group and it's where new elements are inserted\n\t\t$html .= '<div id=\"'.$this->config['name'].'\" class=\"insert_container\">';\n\t\t\t\t\t\n\t\tif (is_array($this->config['items'])) {\n\t\t\t// if we have data then we need to display it first\n\t\t\tif (!empty($data)) {\n\t\t\t\tforeach ($data as $index => $each) {\n\t\t\t\t\t\n\t\t\t\t\t$html .= $this->make_block_item(array('index' => $index++, 'items' => $each));\n\t\t\t\t}\n\t\t\t}\n\t\t\t// else we can just display an empty set \n\t\t\telse {\n\t\t\t\t$html .= $this->make_block_item(array('index' => 0));\n\t\t\t}\n\t\t}\n\t\t$html .= '</div>'; // this is the end of the .insert_container div\n\t\t\n\t\t// JS for inserting and removing new elements for repeaters\n\t\t$html .= '\n\t\t\t<script type=\"text/javascript\" charset=\"utf-8\">\n\t\t\t\tfunction addAnother'.$this->config['name'].'() {\n\t\t\t\t\tif (jQuery(\\'#'.$this->config['name'].'\\').children().length > 0) {\n\t\t\t\t\t\tlast_element_index = jQuery(\\'#'.$this->config['name'].' fieldset:last\\').attr(\\'id\\').match(/'.$this->config['name'].'_([0-9])/);\n\t\t\t\t\t\tnext_element_index = Number(last_element_index[1])+1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnext_element_index = 1;\n\t\t\t\t\t}\n\t\t\t\t\tinsert_element = \\''.str_replace(PHP_EOL,'',trim($this->make_block_item())).'\\';\n\t\t\t\t\tinsert_element = insert_element.replace(/'.$this->repeater_index_placeholder.'/g, next_element_index);\n\t\t\t\t\tjQuery(insert_element).appendTo(\\'#'.$this->config['name'].'\\');\n\t\t\t\t}\n\t\t\t\tfunction delete'.$this->config['name'].'(del_el) {\n\t\t\t\t\tif(confirm(\\'Are you sure you want to delete this?\\')) {\n\t\t\t\t\t\tjQuery(del_el).parent().remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t</script>';\n\n\t\t/* If we have add_another button text set, use that instead of the block_label */\n\t\tif (isset($this->config['add_another_button_text']) && !empty($this->config['add_another_button_text'])) {\n\t\t\t$add_another_text = $this->config['add_another_button_text'];\t\n\t\t}\n\t\telse {\n\t\t\t$add_another_text = 'Add Another '.$this->config['block_label'];\t\n\t\t} \n\t\t\n\t\t$html .= '<p class=\"cf_meta_actions\"><a href=\"#\" onclick=\"addAnother'.$this->config['name'].'(); return false;\" '.\n\t\t\t 'class=\"add_another button-secondary\">'.$add_another_text.'</a></p>'.\n\t\t\t\t '</div><!-- close '.$this->config['name'].' wrapper -->';\n\t\t\n\t\treturn $html;\n\t}", "function inspiry_additional_details() { ?>\n <div class=\"inspiry-details-wrapper\">\n <label><?php esc_html_e( 'Additional Details', 'framework' ); ?></label>\n <div class=\"inspiry-detail-header\">\n <p class=\"title\"><?php esc_html_e( 'Title', 'framework' ); ?></p>\n <p class=\"value\"><?php esc_html_e( 'Value', 'framework' ); ?></p>\n </div>\n <div id=\"inspiry-additional-details-container\">\n\t\t\t\t<?php\n\t\t\t\tif ( realhomes_dashboard_edit_property() || inspiry_is_edit_property() ) {\n\t\t\t\t\tglobal $target_property;\n\n\t\t\t\t\tif ( function_exists( 'ere_additional_details_migration' ) ) {\n\t\t\t\t\t\tere_additional_details_migration( $target_property->ID ); // Migrate property additional details from old metabox key to new key.\n\t\t\t\t\t}\n\n\t\t\t\t\t$additional_details = get_post_meta( $target_property->ID, 'REAL_HOMES_additional_details_list', true );\n\t\t\t\t\tif ( ! empty( $additional_details ) ) {\n\t\t\t\t\t\t$additional_details = array_filter( $additional_details ); // remove empty values.\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! empty( $additional_details ) ) {\n\t\t\t\t\t\tforeach ( $additional_details as $additional_detail ) {\n\t\t\t\t\t\t\tinspiry_render_additional_details( $additional_detail[0], $additional_detail[1] );\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinspiry_render_additional_details();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$default_details = apply_filters( 'inspiry_default_property_additional_details', array() );\n\t\t\t\t\tif ( ! empty( $default_details ) ) {\n\t\t\t\t\t\tforeach ( $default_details as $title => $value ) {\n\t\t\t\t\t\t\tinspiry_render_additional_details( $title, $value );\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinspiry_render_additional_details();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t?>\n </div>\n <button class=\"add-detail btn btn-primary\"><i class=\"fas fa-plus\"></i><?php esc_attr_e( 'Add More', 'framework' ); ?></button>\n </div>\n\t\t<?php\n\t}", "public function getSummaryBox(){\n \n $TPL = new \\ELBP\\Template();\n \n $TPL->set(\"obj\", $this);\n \n $quals = $this->getStudentsQualifications();\n $courses = $this->getStudentsCoursesWithoutQualifications();\n \n if ($quals)\n {\n foreach($quals as $qual)\n {\n $qual->aspirationalGrade = $this->getAspirationalTargetGrade($qual->get_id());\n $qual->targetGrade = $this->getTargetGrade($qual->get_id());\n if (is_array($qual->aspirationalGrade)) $qual->aspirationalGrade = reset($qual->aspirationalGrade);\n if (is_array($qual->targetGrade)) $qual->targetGrade = reset($qual->targetGrade);\n }\n }\n \n if ($courses)\n {\n foreach($courses as $course)\n {\n $course->aspirationalGrade = $this->getAspirationalTargetGradeCourse($course->id);\n $course->targetGrade = $this->getTargetGradeCourse($course->id);\n if (is_array($course->aspirationalGrade)) $course->aspirationalGrade = reset($course->aspirationalGrade);\n if (is_array($course->targetGrade)) $course->targetGrade = reset($course->targetGrade);\n }\n }\n \n usort($quals, function($a, $b){\n return strcasecmp($a->get_display_name(), $b->get_display_name());\n });\n \n usort($courses, function($a, $b){\n return strcasecmp($a->fullname, $b->fullname);\n });\n \n $TPL->set(\"quals\", $quals);\n $TPL->set(\"courses\", $courses);\n \n try {\n return $TPL->load($this->CFG->dirroot . $this->path . 'tpl/elbp_target_grades/summary.html');\n }\n catch (\\ELBP\\ELBPException $e){\n return $e->getException();\n }\n \n }", "function field_details() \n { ?>\n <div class=\"field-details\">\n <?php if($this->setting['type'] != 'radio' && $this->setting['type'] != 'checkbox') : ?><label <?php $this->for_tag(\"inferno-concrete-setting-\"); ?>><?php endif; ?>\n <?php echo $this->setting['desc']; ?>\n <?php if($this->setting['type'] != 'radio' && $this->setting['type'] != 'checkbox') : ?></label><?php endif; ?>\n\n <?php if(isset($this->setting['more']) && $this->setting['more'] != '') : ?>\n <span class=\"more\"><?php echo $this->setting['more']; ?></span>\n <?php endif; ?>\n\n <?php if($this->setting['type'] == 'font') : ?>\n <div class=\"googlefont-desc\">\n <label <?php $this->for_tag(\"inferno-concrete-setting-\", \"-googlefont\"); ?>>\n <?php _e('Enter the Name of the Google Webfont You want to use, for example \"Droid Serif\" (without quotes). Leave blank to use a Font from the selector above.', 'inferno'); ?>\n </label>\n <span class=\"more\">\n <?php _e('You can view all Google fonts <a href=\"http://www.google.com/webfonts\">here</a>. Consider, that You have to respect case-sensitivity. If the font has been successfully recognized, the demo text will change to the entered font.', 'inferno'); ?>\n </span>\n </div>\n <?php endif; ?>\n </div>\n <?php\n }", "public function display_summary() {\n // FIXME\n }", "function createPlayerSummary() {\n $records = $this->Players->all();\n\n //Prime the table class to display player info. Wasn't sure what equity was though...\n $this->load->library('table');\n $parms = array(\n 'table_open' => '<table class=\"table-right-game\">',\n 'cell_start' => '<td class=\"player\">',\n 'cell_alt_start' => '<td class=\"player\">'\n );\n\n $this->table->set_template($parms);\n $this->table->set_heading('Player', 'Peanuts', 'Equity');\n\n foreach ($records as $row) {\n $this->table->add_row($row->Player, $row->Peanuts);\n }\n\n //Generate the table\n $this->data['wtable'] = $this->table->generate();\n }", "private function showDetailsHorizontal()\n\t{\n\t\t$style = $this->col_aggr_sum ? 'table-details-left' : 'table-details-right';\n\t\t\n\t\tforeach ($this->data_show as $key => $row)\n\t\t{\n\t\t\techo '<div id=\"row_' . $key . '\" class=\"slider ' . $style . '\">\n\t\t\t\t<table class=\"table table-striped\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>';\n\n\t\t\t\t\t\t\tforeach ($row['details'][0] as $col => $val)\n\t\t\t\t\t\t\t\techo '<th>' . $col . '</th>';\n\t\t\t\n\t\t\t\t\t\techo '</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>';\n\t\t\t\t\t\t\n\t\t\t\t\t\tforeach ($row['details'] as $item)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\techo '<tr>';\n\n\t\t\t\t\t\t\tforeach ($item as $col => $val)\n\t\t\t\t\t\t\t\techo '<td class=\"' . $col . '\">' . $val . '</td>';\n\n\t\t\t\t\t\t\techo '</tr>';\n\t\t\t\t\t\t}\n\n\t\t\t\t\techo '<tbody>\n\t\t\t\t</table>\n\t\t\t</div>';\n\t\t}\n\t}", "function field_tags($sum){\n\t\t$max = 12;\n\t\t$per_row = ceil($max / $sum);\n\t\t$fields = '<div class=\"col-xs-12 col-md-'.$per_row.'\">';\n\t\t// $fields = '<div class=\"row\">';\n\t\treturn $fields;\n\t}", "public function buildLightbox(){\n\n\t\t$fields = $this->getFields();\n\n\t\techo '<div class=\"main-content\">';\n\t\t\n\t\t\tforeach( $fields as $field ){\n\n\t\t\t\t$field->render();\n\n\t\t\t\tif( method_exists( $field, 'renderTemplate' ) )\n\t\t\t\t\techo $field->renderTemplate();\n\n\t\t\t}\n\n\t\techo '</div>';\n\t\techo '<div class=\"side-content\">';\n\t\t\t\n\t\t\t$this->saveButton();\n\n\t\techo '</div>';\n\t}", "function inspiry_render_additional_details( $title = '', $value = '' ) {\n\t\t?>\n <div class=\"inspiry-detail\">\n <div class=\"inspiry-detail-sort-handle\"><i class=\"fas fa-grip-horizontal\"></i></div>\n <div class=\"inspiry-detail-title\">\n <input type=\"text\" name=\"detail-titles[]\" value=\"<?php echo esc_attr( $title ); ?>\" placeholder=\"<?php esc_attr_e( 'Title', 'framework' ); ?>\"/>\n </div>\n <div class=\"inspiry-detail-value\">\n <input type=\"text\" name=\"detail-values[]\" value=\"<?php echo esc_attr( $value ); ?>\" placeholder=\"<?php esc_attr_e( 'Value', 'framework' ); ?>\"/>\n </div>\n <div class=\"inspiry-detail-remove-detail\">\n <button class=\"remove-detail btn btn-primary\"><i class=\"fas fa-trash-alt\"></i></button>\n </div>\n </div>\n\t\t<?php\n\t}", "function init()\n {\n\n $elements = array(\n 'page_id' => array('hidden')\n , 'name' => array('text', array('label' => 'Name', 'options' => array('StringLength' => array(false, array(1, 50)),), 'filters' => array('StringTrim'), 'required' => true))\n , 'title' => array('text', array('label' => 'Title', 'options' => array('StringLength' => array(false, array(4, 255)),),'filters' => array('StringTrim'), 'required' => true))\n , 'meta' => array('text', array('label' => 'meta', 'options' => array('StringLength' => array(false, array(4, 255))), 'filters' => array('StringTrim'),))\n , 'description' => array('textarea',array('label' => 'description', 'attribs' => array('rows' => 2), 'filters' => array('StringTrim'), 'required' => true))\n , 'body' => array('textarea',array('label' => 'body', 'attribs' => array('rows' => 7), 'filters' => array('StringTrim'), 'required' => true))\n );\n $this->addElements($elements);\n\n // --- Groups ----------------------------------------------\n $this->addDisplayGroup(array('name','title', 'meta'), 'display-head', array('legend'=>'display-head'));\n $this->addDisplayGroup(array('description', 'body'), 'display-body', array('legend'=>'display-body'));\n parent::init();\n }", "protected function _getForm() \r\n\t{ \r\n\t\t$form = \"\";\r\n\t\t$allElementSets = $this->_getAllElementSets();\r\n\t\t$ignoreElements = array();\r\n\t\tforeach ($allElementSets as $elementSet) { //traverse each element set to create a form group for each\r\n\t\t\tif($elementSet['name'] != \"Item Type Metadata\") { // start with non item type metadata\r\n\t\t\t\t\r\n\t\t\t\t$form .= '<div id=\"' . text_to_id($elementSet['name']) . '-metadata\">';\r\n\t\t\t\t$form .= '<fieldset class=\"set\">';\r\n\t\t\t\t$form .= '<h2>' . __($elementSet['name']) . '</h2>';\r\n\t\t\t\t$form .= '<p class=\"element-set-description\" id=\"';\r\n\t\t\t\t$form .= html_escape(text_to_id($elementSet['name']) . '-description') . '\">';\r\n\t\t\t\t$form .= url_to_link(__($elementSet['description'])) . '</p>';\r\n\t\t\t\t\r\n\t\t\t\t$elements = $this->_getAllElementsInSet($elementSet['id']);\r\n\t\t\t\tforeach ($elements as $element) { //traverse each element in the set to create a form input for each in the form group\r\n\t\t\t\t\t$allElementValues = $this->_allElementValues($element['id'], $elements);\r\n\t\t\t\t\tif ((!in_array($element['id'], $ignoreElements)) && (count($allElementValues) > 1)) { // if the element has a value and has multiple inputs\r\n\t\t\t\t\t\t$form .= $this->_field($allElementValues, true);\r\n\t\t\t\t\t\tarray_push($ignoreElements, $element['id']);\r\n\t\t\t\t\t} else if (!in_array($element['id'], $ignoreElements)) { \r\n\t\t\t\t\t\t$form .= $this->_field($allElementValues, false);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$form .= \"</fieldset>\";\r\n\t\t\t\t$form .= \"</div>\";\r\n\t\t\t} else { // if item type metadata\r\n\t\t\t\t$item_types = get_records('ItemType', array('sort_field' => 'name'), 1000);\r\n\t\t\t\t$defaultItemType = $this->_helper->db->getTable('DefaultMetadataValue')->getDefaultItemType();\r\n\t\t\t\t$defaultItemTypeId = 0;\r\n\t\t\t\tif (!empty($defaultItemType)) {\r\n\t\t\t\t\t$defaultItemTypeId = intval($defaultItemType[0][\"text\"]);\r\n\t\t\t\t}\r\n\t\t\t\t$form .= '<div id=\"item-type-metadata-metadata\">';\r\n\t\t\t\t$form .= '<h2>' . __($elementSet['name']) . '</h2>';\r\n\t\t\t\t$form .= '<div class=\"field\" id=\"type-select\">';\r\n\t\t\t\t$form .= '<div class=\"two columns alpha\">';\r\n\t\t\t\t$form .= '<label for=\"item-type\">Item Type</label> </div>';\r\n\t\t\t\t$form .= '<div class=\"inputs five columns omega\">';\r\n\t\t\t\t$form .= '<select name=\"item_type_id\" id=\"item-type\">';\r\n\t\t\t\t$form .= '<option value=\"\">Select Below </option>';\r\n\t\t\t\tforeach ($item_types as $item_type) {\r\n\t\t\t\t\tif($item_type[\"id\"] == $defaultItemTypeId) {\r\n\t\t\t\t\t\t$form .= '<option value=\"' . $item_type['id'] . '\" selected=\"selected\">' . $item_type['name'] . '</option>';\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$form .= '<option value=\"' . $item_type['id'] . '\">' . $item_type['name'] . '</option>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t$form .= '</select> </div>';\r\n\t\t\t\t$form .= '<input type=\"submit\" name=\"change_type\" id=\"change_type\" value=\"Pick this type\" style=\"display: none;\">';\r\n\t\t\t\t$form .= '</div>';\r\n\t\t\t\t$form .= '<div id=\"type-metadata-form\">';\r\n\t\t\t\t$form .= '<div class=\"five columns offset-by-two omega\">';\r\n\t\t\t\t$form .= '<p class=\"element-set-description\">';\r\n\t\t\t\t$form .= '</p>';\r\n\t\t\t\t$form .= '</div>';\r\n\t\t\t\t$form .= '</div>';\r\n\t\t\t\t$form .= '</div>';\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n return $form;\r\n }", "function meta_box_field_groups(){\n \n foreach($this->field_groups as $field_group){ ?>\n\n <div class=\"acf-field\">\n\n <div class=\"acf-label\">\n <label><a href=\"<?php echo admin_url(\"post.php?post={$field_group['ID']}&action=edit\"); ?>\"><?php echo $field_group['title']; ?></a></label>\n <p class=\"description\"><?php echo $field_group['key']; ?></p>\n </div>\n\n <div class=\"acf-input\">\n \n <?php if(acf_maybe_get($field_group, 'fields')){ ?>\n\n <table class=\"acf-table\">\n <thead>\n <th class=\"acf-th\" width=\"25%\"><strong>Label</strong></th>\n <th class=\"acf-th\" width=\"25%\"><strong>Name</strong></th>\n <th class=\"acf-th\" width=\"25%\"><strong>Key</strong></th>\n <th class=\"acf-th\" width=\"25%\"><strong>Type</strong></th>\n </thead>\n\n <tbody>\n <?php\n \n $array = array();\n foreach($field_group['fields'] as $field){\n \n $this->get_fields_labels_recursive($array, $field);\n \n }\n \n foreach($array as $field_key => $field_label){\n \n $field = acf_get_field($field_key);\n $type = acf_get_field_type($field['type']);\n $type_label = '-';\n if(isset($type->label))\n $type_label = $type->label;\n ?>\n\n <tr class=\"acf-row\">\n <td width=\"25%\"><?php echo $field_label; ?></td>\n <td width=\"25%\"><code style=\"font-size:12px;\"><?php echo $field['name']; ?></code></td>\n <td width=\"25%\"><code style=\"font-size:12px;\"><?php echo $field_key; ?></code></td>\n <td width=\"25%\"><?php echo $type_label; ?></td>\n </tr>\n \n <?php } ?>\n </tbody>\n </table>\n \n <?php } ?>\n </div>\n\n </div>\n \n <?php } ?>\n\n <script type=\"text/javascript\">\n if(typeof acf !== 'undefined'){\n\n acf.newPostbox(<?php echo wp_json_encode(array(\n 'id' => 'acfe-form-details',\n 'key' => '',\n 'style' => 'default',\n 'label' => 'left',\n 'edit' => false\n )); ?>);\n\n }\n </script>\n <?php\n \n }", "function cmb2_render_coupon_summary( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {\r\n wpcoupon_setup_coupon( $object_id );\r\n ?>\r\n <div class=\"st-type-summary\">\r\n <span><i class=\"wifi icon\"></i> <?php printf( _n( '%s view', '%s views', wpcoupon_coupon()->get_total_used(), 'wp-coupon' ), wpcoupon_coupon()->get_total_used() ); ?></span>\r\n <span><i class=\"smile icon\"></i> <?php echo wpcoupon_coupon()->_wpc_vote_up; ?></span>\r\n <span><i class=\"frown icon\"></i> <?php echo wpcoupon_coupon()->_wpc_vote_down; ?></span>\r\n </div>\r\n <?php\r\n wp_reset_postdata();\r\n}", "public function buildFormLayout()\n {\n $this->addColumn(6, function(FormLayoutColumn $column) {\n $column->withSingleField('title');\n })->addColumn(6, function(FormLayoutColumn $column) {\n $column->withSingleField('cover');\n $column->withSingleField('description');\n $column->withSingleField('price');\n $column->withSingleField('tags');\n });\n }", "function show() {\n\t\tglobal $post;\n\n\t\t// Use nonce for verification\n\t\techo '<input type=\"hidden\" name=\"mytheme_meta_box_nonce\" value=\"', wp_create_nonce(basename(__FILE__)), '\" />';\n\t\n\t\techo '<table class=\"form-table\">';\n\n\t\tforeach ($this->_meta_box['fields'] as $field) {\n\t\t\t// get current post meta data\n\t\t\t$meta = get_post_meta($post->ID, $field['id'], true);\n\t\t\n\t\t\techo '<tr>',\n\t\t\t\t\t'<th style=\"width:20%\"><label for=\"', $field['id'], '\">', $field['name'], '</label></th>',\n\t\t\t\t\t'<td>';\n\t\t\tswitch ($field['type']) {\n\t\t\t\tcase 'text':\n\t\t\t\t\techo '<input type=\"text\" name=\"', $field['id'], '\" id=\"', $field['id'], '\" value=\"', $meta ? $meta : $field['std'], '\" size=\"30\" style=\"width:97%\" />',\n\t\t\t\t\t\t'<br />', $field['desc'];\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'textarea':\n\t\t\t\t\techo '<textarea name=\"', $field['id'], '\" id=\"', $field['id'], '\" cols=\"60\" rows=\"4\" style=\"width:97%\">', $meta ? $meta : $field['std'], '</textarea>',\n\t\t\t\t\t\t'<br />', $field['desc'];\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'select':\n\t\t\t\t\techo '<select name=\"', $field['id'], '\" id=\"', $field['id'], '\">';\n\t\t\t\t\tforeach ($field['options'] as $option) {\n\t\t\t\t\t\techo '<option', $meta == $option ? ' selected=\"selected\"' : '', '>', $option, '</option>';\n\t\t\t\t\t}\n\t\t\t\t\techo '</select>';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'radio':\n\t\t\t\t\tforeach ($field['options'] as $option) {\n\t\t\t\t\t\techo '<input type=\"radio\" name=\"', $field['id'], '\" value=\"', $option['value'], '\"', $meta == $option['value'] ? ' checked=\"checked\"' : '', ' />', $option['name'];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\techo '<input type=\"checkbox\" name=\"', $field['id'], '\" id=\"', $field['id'], '\"', $meta ? ' checked=\"checked\"' : '', ' />';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'file':\n\t\t\t\t\techo $meta ? \"$meta<br />\" : '', '<input type=\"file\" name=\"', $field['id'], '\" id=\"', $field['id'], '\" />',\n\t\t\t\t\t\t'<br />', $field['desc'];\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'image':\n\t\t\t\t\techo $meta ? \"<img src=\\\"$meta\\\" width=\\\"150\\\" height=\\\"150\\\" /><br />$meta<br />\" : '', '<input type=\"file\" name=\"', $field['id'], '\" id=\"', $field['id'], '\" />',\n\t\t\t\t\t\t'<br />', $field['desc'];\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\techo \t'<td>',\n\t\t\t\t'</tr>';\n\t\t}\n\t\n\t\techo '</table>';\n\t}", "private function addGeneralDetails(){\n $sitePowerImport = $this->createElement('text', 'sitePowerImport')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true);\n $sitePowerCost = $this->createElement('text', 'sitePowerCost')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true)\n ->addValidator('greaterThan', true, array('min' => 0));\n $operatingHours = $this->createElement('text', 'operatingHours')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true)\n ->addValidator('between', true, array('min' => 1, 'max' => 8760, 'inclusive' => true));\n $makeupWaterCost = $this->createElement('text', 'makeupWaterCost')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true)\n ->addValidator('greaterThan', true, array('min' => 0));\n \n $minTemp = $this->mS->standardize(39.9999999999999,'temperature','F'); \n $maxTemp = $this->mS->standardize(160.000000000001,'temperature','F'); \n $makeupWaterTemp = $this->createElement('text', 'makeupWaterTemp')\n ->setValue( $this->mS->localize(283.15, 'temperature') )\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true)\n ->addValidator('between', true, array('min' => $this->mS->localize($minTemp,'temperature'), 'max' => $this->mS->localize($maxTemp,'temperature'), 'inclusive' => true));\n\n $fuelUnitCost = $this->createElement('text', 'fuelUnitCost')\n ->setAttrib('style', 'width: 60px;')\n ->setRequired(true)\n ->addValidator($this->isFloat,true)\n ->addValidator('greaterThan', true, array('min' => 0));\n\n $this->addElements(array(\n $sitePowerImport,\n $sitePowerCost,\n $operatingHours,\n $makeupWaterCost,\n $makeupWaterTemp,\n $fuelUnitCost,\n ));\n }", "function cbGenHtml($number, $title, $englishTitle, $author, $summary,\n $summaryCount, $url, $authorName, $date) {\n echo\n '<p align=\"center\">'\n . \"<p align='center'>\"\n . cbGenSpan(\"number\", $number)\n . ' - '\n . cbGenSpan(\"german-title\", $title)\n . \"<br>\"\n . cbGenSpan(\"english-title\", $englishTitle)\n . \"<br>\"\n . cbGenSpan(\"author\", $author)\n . \"<hr width='20%'/>\"\n . \"</p>\"\n . \"<htr>\"\n . \"<table><tr><td>\"\n ;\n\n if ($summaryCount > 0) {\n echo cbGenSpan(\"text\", $summary);\n echo '</td>'\n . '<td valign=\"top\">'\n\t. cbGenCover($url, \"right\")\n . '</td></tr></table>'\n ;\n\n } else {\n global $MAIN_URL, $EDIT_SUMMARY_URL;\n echo\n '</table>'\n . '<p align=\"center\">'\n\t. cbGenCover($url, \"center\")\n . '<br>'\n . 'No summary was found for this issue.<br>\n You can <a href=\"'\n . $EDIT_SUMMARY_URL\n . '?number='\n . $number\n . '\">submit one</a> or return to the '\n\t. '<a href=\"' . $MAIN_URL . '\">main page</a></p>';\n }\n\n echo '<p align=\"right\">'\n . (is_null($authorName) ? \"\" : cbGenSpanSmall(\"author\", $authorName))\n . (is_null($date) ? \"\" : \" \" . cbGenSpanSmall(\"date\", $date))\n . '</p>'\n ;\n}", "public function render () {\n\n $defaults = array(\n 'show' => array(\n 'title' => true,\n 'description' => true,\n 'url' => true,\n ),\n 'content_title' => __ ( 'Filter', 'uplift' )\n );\n\n $this->field = wp_parse_args ( $this->field, $defaults );\n\n echo '<div class=\"redux-supersearch-accordion\" data-new-content-title=\"' . esc_attr ( sprintf ( __ ( 'New %s', 'uplift' ), $this->field[ 'content_title' ] ) ) . '\">';\n\n $x = 0;\n\n $multi = ( isset ( $this->field[ 'multi' ] ) && $this->field[ 'multi' ] ) ? ' multiple=\"multiple\"' : \"\";\n\n if ( isset ( $this->value ) && is_array ( $this->value ) && !empty ( $this->value ) ) {\n\n $slides = $this->value;\n\n foreach ( $slides as $slide ) {\n\n if ( empty ( $slide ) ) {\n continue;\n }\n\t\t\t\n\t\t\t\t\t$defaults = array(\n 'beforetext' => '',\n 'ss-filter' => '',\n 'label' => '',\n 'aftertext' => '',\n );\n $slide = wp_parse_args ( $slide, $defaults );\n\n echo '<div class=\"redux-supersearch-accordion-group\"><fieldset class=\"redux-field\" data-id=\"' . $this->field[ 'id' ] . '\"><h3><span class=\"redux-supersearch-header\">' . $slide[ 'beforetext' ] . '</span></h3><div>';\n\n echo '<div class=\"redux_slides_add_remove\">';\n\n \techo '<ul id=\"' . $this->field[ 'id' ] . '-ul\" class=\"redux-slides-list\">';\n\n //BEFORE TEXT\n\t\t\t\t\t$placeholder = ( isset ( $this->field[ 'placeholder' ][ 'beforetext' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'beforetext' ] ) : __ ( 'Before Text', 'uplift' );\n echo '<li><input type=\"text\" id=\"' . $this->field[ 'id' ] . '-before_text_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][beforetext]' . $this->field['name_suffix'] . '\" value=\"' . esc_attr ( $slide[ 'beforetext' ] ) . '\" placeholder=\"' . $placeholder . '\" class=\"full-text slide-title\" /></li>';\n\n \t\t$filter_array = sf_get_woo_product_filters_array();\n\t\t\t\t\t\n \t\t//FILTER \n\t\t\t $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'ss-filter' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'ss-filter' ] ) : __ ( 'Filter', 'uplift' );\n \t\t\t\n echo '<li><select id=\"' . $this->field[ 'id' ] . '-filter_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][ss-filter]' . $this->field['name_suffix'] .'\" value=\"' . esc_attr ( $slide[ 'ss-filter' ] ) . '\" class=\"ss-select full-text\" placeholder=\"' . $placeholder . '\" />';\n\t\t\t\t\t\n\t\t\t\t\techo '<option value=\"\">'.__ ( 'Choose an option', 'uplift' ).'</option>';\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tforeach ($filter_array as $filter => $filter_text) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ($filter == $slide[ 'ss-filter' ]) {\n\t\t\t\t\t\t\techo '<option value=\"'.$filter.'\" selected>'.$filter_text.'</option>';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\techo '<option value=\"'.$filter.'\" >'.$filter_text.'</option>';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\techo '</select></li>';\n\t\t\t\t\t\n\t\t\t\t\t//LABEL\n\t\t\t $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'label' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'label' ] ) : __ ( 'Label', 'uplift' );\n \t\t\t\n echo '<li><input type=\"text\" id=\"' . $this->field[ 'id' ] . '-label_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][label]' . $this->field['name_suffix'] .'\" value=\"' . esc_attr ( $slide[ 'label' ] ) . '\" class=\"full-text\" placeholder=\"' . $placeholder . '\" /></li>';\n\t\t\t\t\t\n\t\t\t\t\t//AFTER TEXT\n\t\t\t $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'aftertext' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'aftertext' ] ) : __ ( 'After Text', 'uplift' );\n \t\t\t\n echo '<li><input type=\"text\" id=\"' . $this->field[ 'id' ] . '-after_text_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][aftertext]' . $this->field['name_suffix'] .'\" value=\"' . esc_attr ( $slide[ 'aftertext' ] ) . '\" class=\"full-text\" placeholder=\"' . $placeholder . '\" /></li>';\n\t\t\t\t\t\n echo '<li><input type=\"hidden\" class=\"slide-sort\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][sort]' . $this->field['name_suffix'] .'\" id=\"' . $this->field[ 'id' ] . '-sort_' . $x . '\" value=\"' . $slide[ 'sort' ] . '\" />';\n\n\n echo '<li><a href=\"javascript:void(0);\" class=\"button deletion redux-supersearch-remove\">' . sprintf ( __ ( 'Delete %s', 'uplift' ), $this->field[ 'content_title' ] ) . '</a></li>';\n echo '</ul></div></fieldset></div>';\n $x ++;\n }\n }\n\n if ( $x == 0 ) {\n echo '<div class=\"redux-supersearch-accordion-group\"><fieldset class=\"redux-field\" data-id=\"' . $this->field[ 'id' ] . '\"><h3><span class=\"redux-supersearch-header\">New ' . $this->field[ 'content_title' ] . '</span></h3><div>';\n\n $hide = ' hide';\n\n echo '<div class=\"screenshot' . $hide . '\">';\n echo '<a class=\"of-uploaded-image\" href=\"\">';\n echo '<img class=\"redux-supersearch-image\" id=\"image_image_id_' . $x . '\" src=\"\" alt=\"\" target=\"_blank\" rel=\"external\" />';\n echo '</a>';\n echo '</div>';\n\n echo '<ul id=\"' . $this->field[ 'id' ] . '-ul\" class=\"redux-supersearch-list\">';\n \n $placeholder = ( isset ( $this->field[ 'placeholder' ][ 'beforetext' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'beforetext' ] ) : __ ( 'Before Text', 'uplift' );\n echo '<li><input type=\"text\" id=\"' . $this->field[ 'id' ] . '-before_text_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][beforetext]' . $this->field['name_suffix'] .'\" value=\"\" placeholder=\"' . $placeholder . '\" class=\"full-text slide-title\" /></li>';\n\n /* Filter Field\t*/\n\t\t\t\t$placeholder = ( isset ( $this->field[ 'placeholder' ][ 'ss-filter' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'ss-filter' ] ) : __ ( 'Filter', 'uplift' );\n\t\t\t\techo '<li><select id=\"' . $this->field[ 'id' ] . '-filter_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][ss-filter]' . $this->field['name_suffix'] .'\" value=\"\" class=\"ss-select full-text\" placeholder=\"' . $placeholder . '\" />';\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t$filter_array = sf_get_woo_product_filters_array();\n\t\t\t\t\t\n\t\t\t\techo '<option value=\"\">'.__ ( 'Choose an option', 'uplift' ).'</option>';\n\t\t\t\t\n\t\t\t\tforeach ($filter_array as $filter => $filter_text) {\n\t\t\t\t\tif ($filter == $slide[ 'ss-filter' ]) {\n\t\t\t\t\t\techo '<option value=\"'.$filter.'\" selected>'.$filter_text.'</option>';\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\techo '<option value=\"'.$filter.'\" >'.$filter_text.'</option>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\techo '</select></li>';\n\t\t\t\t\n\t\t\t/* Label Field */\n\t\t\t\t$placeholder = ( isset ( $this->field[ 'placeholder' ][ 'label' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'label' ] ) : __ ( 'Label', 'uplift' );\n\t\t\t\techo '<li><input type=\"text\" id=\"' . $this->field[ 'id' ] . '-label_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][label]' . $this->field['name_suffix'] .'\" value=\"\" class=\"full-text\" placeholder=\"' . $placeholder . '\" /></li>';\n\n\t\t\t\t\n\t\t\t\t/* After Text Field */\n\t\t\t\t$placeholder = ( isset ( $this->field[ 'placeholder' ][ 'after' ] ) ) ? esc_attr ( $this->field[ 'placeholder' ][ 'after' ] ) : __ ( 'After Text', 'uplift' );\n\t\t\t\techo '<li><input type=\"text\" id=\"' . $this->field[ 'id' ] . '-after_text_' . $x . '\" name=\"' . $this->field[ 'name' ] . '[' . $x . '][aftertext]' . $this->field['name_suffix'] .'\" value=\"\" class=\"full-text\" placeholder=\"' . $placeholder . '\" /></li>';\t\t\t\t\n echo '</ul></div></fieldset></div>';\n }\n echo '</div><a href=\"javascript:void(0);\" class=\"button redux-supersearch-add button-primary\" rel-id=\"' . $this->field[ 'id' ] . '-ul\" rel-name=\"' . $this->field[ 'name' ] . '[title][]' . $this->field['name_suffix'] .'\">' . sprintf ( __ ( 'Add %s', 'uplift' ), $this->field[ 'content_title' ] ) . '</a><br/>';\n }", "function PricerrTheme_summary_scr()\n{\n $id_icon = 'icon-options-general8';\n $ttl_of_stuff = 'PricerrTheme - ' . __('Site Summary', 'PricerrTheme');\n\n //------------------------------------------------------\n\n echo '<div class=\"wrap\">';\n echo '<div class=\"icon32\" id=\"' . $id_icon . '\"><br/></div>';\n echo '<h2 class=\"my_title_class_sitemile\">' . $ttl_of_stuff . '</h2>';\n\n ?>\n\n <div id=\"usual2\" class=\"usual\">\n <ul>\n <li><a href=\"#tabs1\" class=\"selected\"><?php _e('Main Summary', 'PricerrTheme'); ?></a></li>\n <!-- <li><a href=\"#tabs2\"><?php _e('Other Information', 'PricerrTheme'); ?></a></li> -->\n\n </ul>\n <div id=\"tabs1\">\n <table width=\"100%\" class=\"sitemile-table\">\n <tr>\n <td width=\"200\">Total number of jobs</td>\n <td><?php echo PricerrTheme_get_total_nr_of_listings(); ?></td>\n </tr>\n\n <tr>\n <td>Open jobs</td>\n <td><?php echo PricerrTheme_get_total_nr_of_open_listings(); ?></td>\n </tr>\n\n <tr>\n <td>Closed</td>\n <td><?php echo PricerrTheme_get_total_nr_of_closed_listings(); ?></td>\n </tr>\n\n <!-- \n <tr>\n <td>Disputed & Not Finished</td>\n <td>12</td>\n </tr>\n -->\n <tr>\n <td>Total Users</td>\n <td><?php\n $result = count_users();\n echo 'There are ', $result['total_users'], ' total users';\n foreach ($result['avail_roles'] as $role => $count)\n echo ', ', $count, ' are ', $role, 's';\n echo '.';\n ?></td>\n </tr>\n </table>\n </div>\n\n <div id=\"tabs2\">\n\n </div>\n\n <?php echo '</div>';\n}", "function form($instance) {\n $instance = wp_parse_args( (array) $instance, array( 'title' => 'WP-Popular Posts Tool', 'itemsQuantity' => 5, 'catId' => 0 ) );\n $title = strip_tags($instance['title']);\n $itemsQuantity = absint($instance['itemsQuantity']);\n $catId = absint($instance['catId']);\n $displayMode = absint($instance['displayMode']);\n $disableCommentCount = absint($instance['disableCommentCount']);\n $barsLocation = absint($instance['barsLocation']);\n ?>\n \n <p><label for=\"<?php echo $this->get_field_id('title'); ?>\">\n <?php echo esc_html__('Title'); ?>: \n <input class=\"widefat\" id=\"<?php echo $this->get_field_id('title'); ?>\" name=\"<?php echo $this->get_field_name('title'); ?>\" \n type=\"text\" value=\"<?php echo attribute_escape($title); ?>\" />\n </label></p>\n \n <p><label for=\"<?php echo $this->get_field_id('itemsQuantity'); ?>\">\n <?php echo esc_html__('Number of items to show'); ?>: \n <input class=\"widefat\" id=\"<?php echo $this->get_field_id('itemsQuantity'); ?>\" name=\"<?php echo $this->get_field_name('itemsQuantity'); ?>\" \n type=\"text\" value=\"<?php echo attribute_escape($itemsQuantity); ?>\" />\n </label></p> \n \n <p><label for=\"<?php echo $this->get_field_id('catId'); ?>\">\n <?php echo esc_html__('Id of the cateogory or tag (leave it blank for automatic detection)'); ?>: \n <input class=\"widefat\" id=\"<?php echo $this->get_field_id('catId'); ?>\" name=\"<?php echo $this->get_field_name('catId'); ?>\" \n type=\"text\" value=\"<?php echo attribute_escape($catId); ?>\" />\n </label></p>\n \n <p><label for=\"<?php echo $this->get_field_id('displayMode'); ?>\">\n <?php echo esc_html__('Display mode'); ?>: \n <select class=\"widefat\" id=\"<?php echo $this->get_field_id('displayMode'); ?>\" name=\"<?php echo $this->get_field_name('displayMode'); ?>\" \n type=\"text\">\n <option value=\"0\" <?php if($displayMode == 0) echo 'selected'; ?>>Text Only</option>\n <option value=\"1\" <?php if($displayMode == 1) echo 'selected'; ?>>Graphic</option>\n </select>\n </label></p>\n \n <p><label for=\"<?php echo $this->get_field_id('barsLocation'); ?>\">\n <?php echo esc_html__('Bars Location (if mode = Graphic)'); ?>: \n <select class=\"widefat\" id=\"<?php echo $this->get_field_id('barsLocation'); ?>\" name=\"<?php echo $this->get_field_name('barsLocation'); ?>\" \n type=\"text\">\n <option value=\"0\" <?php if($barsLocation == 0) echo 'selected'; ?>>Left</option>\n <option value=\"1\" <?php if($barsLocation == 1) echo 'selected'; ?>>Right</option>\n </select>\n </label></p> \n \n <p><label for=\"<?php echo $this->get_field_id('disableCommentCount'); ?>\">\n <?php echo esc_html__('Disable comment count'); ?>: \n <select class=\"widefat\" id=\"<?php echo $this->get_field_id('disableCommentCount'); ?>\" name=\"<?php echo $this->get_field_name('disableCommentCount'); ?>\" \n type=\"text\">\n <option value=\"0\" <?php if($disableCommentCount == 0) echo 'selected'; ?>>No</option>\n <option value=\"1\" <?php if($disableCommentCount == 1) echo 'selected'; ?>>Yes</option>\n </select>\n </label></p> \n \n <?php\n }", "function cbDisplaySummary($number) {\n global $EDIT_SUMMARY_URL;\n\n cbTrace(\"DISPLAYING \" . $number);\n $heftRow = cbFindHeftRow($number) or cbTrace(mysql_error());\n $numRows = mysql_numrows($heftRow);\n\n $title = mysql_result($heftRow, 0, \"title\");\n $author = mysql_result($heftRow, 0, \"author\");\n $summaryRow = cbFindSummaryRow($number);\n $summaryCount = mysql_numrows($summaryRow);\n\n $url = sprintf(\"http://perry-kotlin.app.heroku/api/covers/%d\", $number);\n\n $date = null;\n if ($summaryCount > 0) {\n $summary = mysql_result($summaryRow, 0, \"summary\");\n $englishTitle = mysql_result($summaryRow, 0, \"english_title\");\n $date = mysql_result($summaryRow, 0, \"date\");\n $authorName = mysql_result($summaryRow, 0, \"author_name\");\n if ($date == null) $date = '';\n }\n\n cbGenHtml($number, $title, $englishTitle, $author, $summary,\n $summaryCount, $url, $authorName, $date);\n}", "public function meta_box_form_items() {\n\t\t$vfb_post = '';\n\t\t// Run Create Post add-on\n\t\tif ( class_exists( 'VFB_Pro_Create_Post' ) )\n\t\t\t$vfb_post = new VFB_Pro_Create_Post();\n\t?>\n\t\t<div class=\"taxonomydiv\">\n\t\t\t<p><strong><?php _e( 'Click or Drag' , 'visual-form-builder-pro'); ?></strong> <?php _e( 'to Add a Field' , 'visual-form-builder-pro'); ?> <img id=\"add-to-form\" alt=\"\" src=\"<?php echo admin_url( '/images/wpspin_light.gif' ); ?>\" class=\"waiting spinner\" /></p>\n\t\t\t<ul class=\"posttype-tabs add-menu-item-tabs\" id=\"vfb-field-tabs\">\n\t\t\t\t<li class=\"tabs\"><a href=\"#standard-fields\" class=\"nav-tab-link vfb-field-types\"><?php _e( 'Standard' , 'visual-form-builder-pro'); ?></a></li>\n\t\t\t\t<li><a href=\"#advanced-fields\" class=\"nav-tab-link vfb-field-types\"><?php _e( 'Advanced' , 'visual-form-builder-pro'); ?></a></li>\n\t\t\t\t<?php\n\t\t\t\t\tif ( class_exists( 'VFB_Pro_Create_Post' ) && method_exists( $vfb_post, 'form_item_tab' ) )\n\t\t\t\t\t\t$vfb_post->form_item_tab();\n\t\t\t\t?>\n\t\t\t</ul>\n\t\t\t<div id=\"standard-fields\" class=\"tabs-panel tabs-panel-active\">\n\t\t\t\t<ul class=\"vfb-fields-col-1\">\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-fieldset\">Fieldset</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-text\"><b></b>Text</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-checkbox\"><b></b>Checkbox</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-select\"><b></b>Select</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-datepicker\"><b></b>Date</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-url\"><b></b>URL</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-digits\"><b></b>Number</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-phone\"><b></b>Phone</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-file\"><b></b>File Upload</a></li>\n\t\t\t\t</ul>\n\t\t\t\t<ul class=\"vfb-fields-col-2\">\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-section\">Section</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-textarea\"><b></b>Textarea</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-radio\"><b></b>Radio</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-address\"><b></b>Address</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-email\"><b></b>Email</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-currency\"><b></b>Currency</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-time\"><b></b>Time</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-html\"><b></b>HTML</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-instructions\"><b></b>Instructions</a></li>\n\t\t\t\t</ul>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div> <!-- #standard-fields -->\n\t\t\t<div id=\"advanced-fields\"class=\"tabs-panel tabs-panel-inactive\">\n\t\t\t\t<ul class=\"vfb-fields-col-1\">\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-username\"><b></b>Username</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-hidden\"><b></b>Hidden</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-autocomplete\"><b></b>Autocomplete</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-min\"><b></b>Min</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-range\"><b></b>Range</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-name\"><b></b>Name</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-likert\"><b></b>Likert</a></li>\n\t\t\t\t</ul>\n\t\t\t\t<ul class=\"vfb-fields-col-2\">\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-password\"><b></b>Password</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-color\"><b></b>Color Picker</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-ip\"><b></b>IP Address</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-max\"><b></b>Max</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-pagebreak\"><b></b>Page Break</a></li>\n\t\t\t\t\t<li><a href=\"#\" class=\"vfb-draggable-form-items\" id=\"form-element-rating\"><b></b>Rating</a></li>\n\t\t\t\t</ul>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div> <!-- #advanced-fields -->\n\t\t\t<?php\n\t\t\t\tif ( class_exists( 'VFB_Pro_Create_Post' ) && method_exists( $vfb_post, 'form_items' ) )\n\t\t\t\t\t$vfb_post->form_items();\n\t\t\t?>\n\t\t</div> <!-- .taxonomydiv -->\n\t\t<div class=\"clear\"></div>\n\t<?php\n\t}", "public function generateHtmlDivData()\n\t{\n\t\t// TODO : to be implemented\n\t}", "function get_summary_output($district_counts, $crm_dist, $name)\n{\n $label = \"$name - District $crm_dist\\n\"\n .\"Summary of contacts that are outside Senate District $crm_dist\\n\";\n\n $columns = [\n 'Senate District' => 12,\n 'Individuals' => 15,\n 'Households' => 14,\n 'Organizations' => 14,\n 'Total' => 16\n ];\n\n $output = '';\n $heading = $label . create_table_header($columns);\n\n ksort($district_counts);\n\n foreach ($district_counts as $dist => $counts) {\n $output .=\n fixed_width($dist, 12, false, 'Unknown')\n . fixed_width(get($counts, 'individual', '0'), 15, true)\n . fixed_width(get($counts, 'household', '0'), 14, true)\n . fixed_width(get($counts, 'organization', '0'), 14, true)\n . fixed_width(get($counts, 'contacts', '0'), 16, true) . \"\\n\";\n }\n\n return $heading . $output;\n}", "function form_content()\r\n {\r\n $table = html_table($this->_width,0,4) ;\r\n $table->set_style(\"border: 1px solid\") ;\r\n\r\n $table->add_row($this->element_label(\"Organization\"),\r\n $this->element_form(\"Organization\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet Name\"),\r\n $this->element_form(\"Meet Name\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet Address 1\"),\r\n $this->element_form(\"Meet Address 1\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet Address 2\"),\r\n $this->element_form(\"Meet Address 2\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet State\"),\r\n $this->element_form(\"Meet State\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet Postal Code\"),\r\n $this->element_form(\"Meet Postal Code\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet Country\"),\r\n $this->element_form(\"Meet Country\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet Code\"),\r\n $this->element_form(\"Meet Code\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet Start\"),\r\n $this->element_form(\"Meet Start\")) ;\r\n\r\n $table->add_row($this->element_label(\"Meet End\"),\r\n $this->element_form(\"Meet End\")) ;\r\n\r\n $table->add_row($this->element_label(\"Pool Altitude\"),\r\n $this->element_form(\"Pool Altitude\")) ;\r\n\r\n $table->add_row($this->element_label(\"Course Code\"),\r\n $this->element_form(\"Course Code\")) ;\r\n\r\n $this->add_form_block(null, $table) ;\r\n }", "public function workload_summary(){\n\t\tif($this->session->userdata('status') !== 'admin_logged_in'){\n\t\tredirect('pages/Login');\n\t\t}\n\t\t$this->M_auditTrail->auditTrailRead('Usecase Summary', $this->session->userdata['type']);\n\n\t\t$data = [\n\t\t\t'countUsecase' => $this->M_workloadGraph->getCountUsecase(),\n\t\t\t'countMember' => $this->M_workloadGraph->getCountMember(),\n\t\t\t'graphNodes' => $this->M_workloadGraph->get_nodes(),\n\t\t\t'graphLinks' => $this->M_workloadGraph->get_links(),\n\t\t\t'judul' => 'Workload Summary - INSIGHT',\n\t\t\t'konten' => 'adm_views/home/monitoringWorkload',\n\t\t\t'admModal' => [],\n\t\t\t'footerGraph' => ['workloadSummary/workloadGraph']\n\t\t];\n\n\t\t$this->load->view('adm_layout/master', $data);\n\t}" ]
[ "0.59962493", "0.59763706", "0.58714974", "0.5822382", "0.5802656", "0.57680917", "0.573524", "0.5723683", "0.56696504", "0.56693673", "0.5666097", "0.5644782", "0.5620018", "0.5618954", "0.55702794", "0.5554211", "0.5536003", "0.55055", "0.5488495", "0.5485995", "0.548042", "0.5475191", "0.5463356", "0.5456213", "0.5439482", "0.54367685", "0.54152924", "0.5409545", "0.5408882", "0.5404515" ]
0.6125534
0
Returns whether this plugin is running on a test system or the production system.
public function is_test_environment() { if(empty($this->production_site_url)) return true; else return get_site_url() === $this->production_site_url ? false : true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isTest() : bool\n\t{\n\t\treturn $this->productionTest;\n\t}", "public function isProd() {\n\t\tif ($this->checkEnv(array('prod', 'product', 'production'))) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public static function isDev() {\n // Acquia.\n if (defined('AH_SITE_ENVIRONMENT')) {\n return !in_array(PANTHEON_ENVIRONMENT, array('test', 'prod'));\n }\n\n // Pantheon.\n if (defined('PANTHEON_ENVIRONMENT')) {\n return !in_array(PANTHEON_ENVIRONMENT, array('test', 'live'));\n }\n\n return FALSE;\n }", "protected function isProduction()\n {\n return $this->getEnvironment()->isProd();\n }", "public static function isProdEnvironment()\r\n {\r\n return in_array($_SERVER['HTTP_HOST'], static::getProdDomains());\r\n }", "function is_production() {\n\treturn ENV == PRODUCTION;\n}", "public static function isProductionMode()\n {\n return (self::getEnvMode() == PaylineSDK::ENV_PROD);\n }", "public function isProduction() {\n return !empty($this->configuration['production']);\n }", "public function IsProduction () {\n\t\tif ($this->name === NULL) $this->GetName();\n\t\treturn $this->values[\\MvcCore\\IEnvironment::PRODUCTION];\n\t}", "public function isProduction(): bool\n {\n return $this->env === 'production';\n }", "public function isProduction()\n {\n return $this->transbankConfig->isProduction();\n }", "public function isProduction()\r\n {\r\n return (bool) $this->productionMode;\r\n }", "function is_prod() {\n return env() === 'production';\n}", "public function isTestMode()\n {\n if (strpos($this->adyenMode, Environment::TEST) !== false) {\n return true;\n } else {\n return false;\n }\n }", "public function isProductionMode(): bool;", "public static function isProductive()\n\t{\n\t\treturn (self::getEnvironmentVariable(self::ENV_PRODUCTIVE, true));\n\t}", "public static function isProductionEnv() {\n return getenv('ENVIRONMENT') !== false && strtolower(getenv('ENVIRONMENT')) === \"production\";\n }", "public function isProduction();", "public static function isInTestingEnvironment()\n {\n return !in_array(env('APP_ENV'),['prod','production']);\n }", "public function isProduction() {}", "public static function inProduction(): bool\n {\n $env = env('APP_ENV');\n\n return $env === 'production' || $env === 'prod';\n }", "public function isInProductionMode()\n {\n return $this->_appState->getMode() === \\Magento\\Framework\\App\\State::MODE_PRODUCTION;\n }", "public static function detectProductionMode()\n\t{\n\t\t$addrs = array();\n\t\tif (PHP_SAPI === 'cli') {\n\t\t\t$addrs[] = getHostByName(php_uname('n'));\n\t\t} else {\n\t\t\tif (!isset($_SERVER['SERVER_ADDR']) && !isset($_SERVER['LOCAL_ADDR'])) {\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t\tif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { // proxy server detected\n\t\t\t\t$addrs = preg_split('#,\\s*#', $_SERVER['HTTP_X_FORWARDED_FOR']);\n\t\t\t}\n\t\t\tif (isset($_SERVER['REMOTE_ADDR'])) {\n\t\t\t\t$addrs[] = $_SERVER['REMOTE_ADDR'];\n\t\t\t}\n\t\t\t$addrs[] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];\n\t\t}\n\n\t\tforeach ($addrs as $addr) {\n\t\t\t$oct = explode('.', $addr);\n\t\t\t// 10.0.0.0/8 Private network\n\t\t\t// 127.0.0.0/8 Loopback\n\t\t\t// 169.254.0.0/16 & ::1 Link-Local\n\t\t\t// 172.16.0.0/12 Private network\n\t\t\t// 192.168.0.0/16 Private network\n\t\t\tif ($addr !== '::1' && (count($oct) !== 4 || ($oct[0] !== '10' && $oct[0] !== '127' && ($oct[0] !== '172' || $oct[1] < 16 || $oct[1] > 31)\n\t\t\t\t&& ($oct[0] !== '169' || $oct[1] !== '254') && ($oct[0] !== '192' || $oct[1] !== '168')))\n\t\t\t) {\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\t\treturn FALSE;\n\t}", "public function isTestmode()\n {\n return $this->getConfigDataFlag('test', $this->getStoreId());\n }", "public function isTestMode() {\n\t\treturn (bool) $this->app->store->get()->params->get('anet.test_mode');\n\t}", "public static function isDev()\n {\n return isset($_SERVER['ENV']) && $_SERVER['ENV'] == 'dev';\n }", "function isDev(){ return $_ENV['CURRENT_ENVIRONMENT'] == ENVIRONMENT_DEV; }", "function isDevOrBeta(){ return $_ENV['CURRENT_ENVIRONMENT'] == ENVIRONMENT_DEV || $_ENV['CURRENT_ENVIRONMENT'] == ENVIRONMENT_BETA; }", "public function getIsSystemOn(): bool\n {\n /** @var WebApplication|ConsoleApplication $this */\n return $this->getIsLive();\n }", "public final function isDebugEnabled()\n {\n return getenv('TEST') === 'true';\n }" ]
[ "0.77510166", "0.76399803", "0.7498758", "0.7489189", "0.73803633", "0.7375103", "0.7369261", "0.73560923", "0.73511416", "0.728489", "0.7228609", "0.71942675", "0.7176972", "0.7143329", "0.71116257", "0.7090879", "0.70895076", "0.7072677", "0.7005752", "0.70015776", "0.69697887", "0.6965847", "0.69557995", "0.6929314", "0.6871107", "0.6795872", "0.67524594", "0.6692539", "0.6667458", "0.66615087" ]
0.76479644
1
Modify the css if we are in a test environment to make the website look ugly to avoid confusion. To be added to the 'wp_head' and 'admin_head' action.
public function modify_css_if_in_test_environment() { if($this->is_test_environment()) echo '<style>div#wpadminbar {background-color: #49cf44;}</style>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attach_custom_css_filter() {\n\tif ( ! is_admin() && ! is_feed() && ! is_robots() && ! is_trackback() ) {\n\t\tglobal $publishthis;\n\n\t\tif( is_singular() ) echo $publishthis->utils->display_css();\n\t}\n}", "private function set_styles()\n {\n\n if (count($this->assets_css['global']) > 0)\n {\n $this->template->append_metadata('<!-- BEGIN GLOBAL MANDATORY STYLES -->');\n foreach($this->assets_css['global'] as $asset)\n {\n $this->template->append_metadata('<link rel=\"stylesheet\" type=\"text/css\" href=\"' . $this->config->item('base_url') . '../../themes/public/css/' . $asset . '\" media=\"screen\" />');\n }\n }\n if (isset($this->assets_css['page_style']) && count($this->assets_css['page_style']) > 0)\n {\n $this->template->append_metadata('<!-- BEGIN PAGE STYLES -->');\n foreach($this->assets_css['page_style'] as $asset)\n {\n $this->template->append_metadata('<link rel=\"stylesheet\" type=\"text/css\" href=\"' . $this->config->item('base_url') . '../../themes/public/css/' . $asset . '\" media=\"screen\" />');\n }\n }\n\n // Webkit based browsers\n //$this->template->append_metadata('<link rel=\"stylesheet\" type=\"text/css\" href=\"' . $this->config->item('base_url') . 'assets/css/cross_browser/webkit.css\" media=\"screen\" />');\n\n // Internet Explorer styles\n $this->template->append_metadata('<!--[if IE 6]><link rel=\"stylesheet\" type=\"text/css\" href=\"' . $this->config->item('base_url') . 'assets/css/cross_browser/ie6.css\" media=\"screen\" /><![endif]-->');\n $this->template->append_metadata('<!--[if IE 7]><link rel=\"stylesheet\" type=\"text/css\" href=\"' . $this->config->item('base_url') . 'assets/css/cross_browser/ie7.css\" media=\"screen\" /><![endif]-->');\n $this->template->append_metadata('<!--[if IE 8]><link rel=\"stylesheet\" type=\"text/css\" href=\"' . $this->config->item('base_url') . 'assets/css/cross_browser/ie8.css\" media=\"screen\" /><![endif]-->');\n $this->template->append_metadata('<!--[if IE 9]><link rel=\"stylesheet\" type=\"text/css\" href=\"' . $this->config->item('base_url') . 'assets/css/cross_browser/ie9.css\" media=\"screen\" /><![endif]-->');\n }", "function harvest_style_override(){\n\t$primary = harvest_option( 'accent', '#006f7c' );\n\t$secondary = harvest_option( 'secondary_accent', '#b4b2b1' );\n\t$logo_css = harvest_option( 'logo_name_css', '');\n\t$style = \".logo_name { $logo_css }\";\n\twp_add_inline_style( 'harvest-stylesheet', $style );\t\n\t\n\t$style = \".accent-background, \n\t\t.r-tabs .r-tabs-state-active {\n\t\t\tbackground: $primary;\n\t\t}\n\t\t.secondary-accent-background,\n\t\t.recent-sermon h2, \n\t\t.weekly-calendar h2 {\n\t\t\tbackground: $secondary;\n\t\t}\n\t\t.r-tabs a,\n\t\t.r-tabs .r-tabs-anchor {\n\t\t\tcolor: $primary;\n\t\t}\n\t\t.r-tabs .r-tabs-tab {\n\t\t\tborder-bottom-color: $secondary;\n\t\t\tborder-top-color: $secondary;\n\t\t}\n\t\t.r-tabs .r-tabs-accordion-title{\n\t\t\tborder-bottom-color: $secondary;\n\t\t}\n\t\t.content a:not(.button),\n\t\t.content a:hover {\n\t\t\tcolor: $primary;\n\t\t}\n\t\t.content a.button:hover {\n\t\t\tcolor: $primary;\n\t\t\tborder-color: $primary;\n\t\t}\";\n\t\twp_add_inline_style( 'harvest-stylesheet', $style );\t\n}", "function additional_styles() {\n\t\tJetpack_Admin_Page::load_wrapper_styles();\n\t}", "public function admin_css() {\n\t\t\treturn '';\n\t\t}", "function enfold_customization_admin_css() {\n\techo \"<style>\n\t\t\t\ta[href='#avia_sc_contact'] { display: none; }\n\t\t\t\ta[href='#avia_sc_tab'] { display: none; }\n\t\t\t\ta[href='#avia_sc_toggle'] { display: none; }\n\t\t\t\ta[href='#avia_sc_comments_list'] { display: none; }\n\t\t\t</style>\";\n}", "public function testInlineCssDevelopment() {\n\t\t$config = $this->Helper->config();\n\t\t$config->paths('css', null, array(\n\t\t\t$this->_testFiles . 'css' . DS\n\t\t));\n\n\t\t$config->addTarget('nav.css', array(\n\t\t\t'files' => array('nav.css')\n\t\t));\n\n\t\tConfigure::write('debug', 1);\n\t\t$results = $this->Helper->inlineCss('nav.css');\n\n\t\t$expected = <<<EOF\n<style type=\"text/css\">@import url(\"reset/reset.css\");\n#nav {\n\twidth:100%;\n}</style>\nEOF;\n\t\t$this->assertEquals($expected, $results);\n\t}", "function do_test_test_css()\n{\n ?>\n<style type=\"text/css\">\n html, body {\n width:100%; \n height:100%; \n } \n\n</style>\n <?php\n}", "public function customizer_styles() {\n\t\tif ( 'version_2' != get_theme_mod( 'demo_setup' ) ) {\n\t\t\t?>\n\t\t\t<style>\n\t\t\t\t#customize-control-demo_setup_extra {\n\t\t\t\t\tdisplay: none !important;\n\t\t\t\t}\n\t\t\t</style><?php\n\t\t}\n\n\t}", "function html5blank_styles() {\n if ( HTML5_DEBUG ) {\n // normalize-css\n // wp_register_style( 'normalize', get_template_directory_uri() . '/bower_components/normalize.css/normalize.css', array(), '3.0.1' );\n\n // Slick\n wp_register_style( 'slick', get_theme_root_uri() . '/REPLACEMEPLEASE/node_modules/slick-carousel/slick/slick.css', array(), '1.8.1' );\n wp_register_style( 'slick-theme', get_theme_root_uri() . '/REPLACEMEPLEASE/node_modules/slick-carousel/slick/slick-theme.css', array(), '1.8.1' );\n\n // Custom CSS\n wp_register_style( 'html5blank', get_template_directory_uri() . '/style.css', array(), THE_VERSION_NUMBER );\n\n // Register CSS\n wp_enqueue_style( 'slick' );\n wp_enqueue_style( 'slick-theme' );\n wp_enqueue_style( 'html5blank' );\n } else {\n\n // Custom CSS\n wp_register_style( 'html5blankcssmin', get_template_directory_uri() . '/style.css', array(), THE_VERSION_NUMBER );\n\n // Register CSS\n wp_enqueue_style( 'html5blankcssmin' );\n }\n}", "function html5blank_styles()\n{\n wp_register_style('normalize', get_template_directory_uri() . '/normalize.css', array(), '1.0', 'all');\n wp_enqueue_style('normalize');\n\t\n\t//wp_enqueue_style( 'fancybox', get_stylesheet_directory_uri() . '/js/lib/jquery.fancybox.min.css' );\n\t\n\t//wp_enqueue_style( 'slick', get_template_directory_uri() . '/js/lib/slick.css' );\n\t\n\twp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.10.0/css/all.css' );\n\n wp_register_style('html5blank', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');\n wp_enqueue_style('html5blank');\n}", "function setup() {\n\tadd_filter( 'fl_builder_render_css', __NAMESPACE__ . '\\\\styles', 10, 3 );\n}", "public static function setSiteStyling()\n {\n $styling = SiteManagement::getMetaValue('settings');\n if (!empty($styling[0]['enable_theme_color']) && $styling[0]['enable_theme_color'] == 'true') {\n if (!empty($styling[0]['primary_color'])) {\n ob_start(); ?>\n <style>\n /* Theme Text Color */\n a,\n p a,\n p a:hover,\n a:hover,\n a:focus,\n a:active,\n .wt-navigation>ul>li:hover>a,\n .wt-navigation>ul>li.current-menu-item>a,\n .wt-navarticletab li:hover a,\n .wt-navarticletab li a.active,\n .wt-categoriescontent li a:hover,\n .wt-joinsteps li.wt-active a,\n .wt-effectivecontent li:hover a,\n .wt-articlesingle-content .wt-description .wt-blockquotevone q,\n .wt-filtertag li:hover a,\n .wt-userlisting-breadcrumb li .wt-clicksave,\n .wt-clicksave,\n .wt-qrcodefeat h3 span,\n .wt-comfollowers ul li:hover a span,\n .wt-postarticlemeta .wt-following span,\n .tg-qrcodefeat h3 span,\n .active-category {\n color: <?php echo $styling[0]['primary_color'] ?>;\n }\n\n /* Theme Background Color */\n .wt-btn:hover,\n .wt-dropdowarrow,\n .navbar-toggle,\n .wt-btn,\n .wt-navigationarea .wt-navigation>ul>li>a:after,\n .wt-searchbtn,\n .wt-sectiontitle:after,\n .wt-navarticletab li a:after,\n .wt-pagination ul li a:hover,\n .wt-pagination ul li.wt-active a,\n .wt-widgettag a:hover,\n .wt-articlesingle-content .wt-description blockquote span i,\n .wt-searchgbtn,\n .wt-filtertagclear a,\n .ui-slider-horizontal .ui-slider-range,\n .wt-btnsearch,\n .wt-newnoti a em,\n .wt-notificationicon>a:after,\n .wt-rightarea .wt-nav .navbar-toggler,\n .wt-usersidebaricon span,\n .wt-usersidebaricon span i,\n .wt-filtertag .wt-filtertagclear a,\n .loader:before,\n .wt-offersmessages .wt-ad:after,\n .wt-btnsendmsg,\n .wt-tabstitle li a:before,\n .wt-tabscontenttitle:before,\n .wt-tablecategories thead tr th:first-child:before,\n .wt-tablecategories tbody tr td:first-child:before,\n .wt-slidernav .wt-prev:hover,\n .wt-slidernav .wt-next:hover,\n .vb>.vb-dragger>.vb-dragger-styler,\n .wt-pagination ul li span,\n .la-banner-settings .wt-location h5:after,\n .la-section-settings .wt-location h6:after,\n .wt-forgotpassword-holder .card .card-body form .form-group button[type=submit] {\n background: <?php echo $styling[0]['primary_color'] ?>;\n }\n\n /* Theme Border Color */\n input:focus,\n .select select:focus,\n .form-control:focus,\n .wt-navigation>ul>li>.sub-menu,\n .wt-pagination ul li a:hover,\n .wt-widgettag a:hover,\n .wt-joinsteps li.wt-active a,\n .wt-filtertag li:hover a,\n .wt-filtertag .wt-filtertagclear a,\n .wt-themerangeslider .ui-slider-handle,\n .wt-clicksavebtn,\n .wt-pagination ul li.wt-active a,\n .wt-usernav>ul,\n .wt-pagination ul li span {\n border-color: <?php echo $styling[0]['primary_color'] ?>;\n }\n\n /* RGBA Background Color */\n .loader{\n background: <?php echo $styling[0]['primary_color'] ?>;\n background: -moz-linear-gradient(left, <?php echo $styling[0]['primary_color'] ?> 10%, rgba(255, 88, 81, 0) 42%);\n background: -webkit-linear-gradient(left, <?php echo $styling[0]['primary_color'] ?> 10%, rgba(255, 88, 81, 0) 42%);\n background: -o-linear-gradient(left, <?php echo $styling[0]['primary_color'] ?> 10%, rgba(255, 88, 81, 0) 42%);\n background: -ms-linear-gradient(left, <?php echo $styling[0]['primary_color'] ?> 10%, rgba(255, 88, 81, 0) 42%);\n background: linear-gradient(to right, <?php echo $styling[0]['primary_color'] ?> 10%, rgba(255, 88, 81, 0) 42%);\n }\n </style>\n <?php return ob_get_clean();\n }\n }\n }", "function admin_print_styles() {\r\n global $wpi_settings, $current_screen;\r\n\r\n wp_enqueue_style('wpi-custom-jquery-ui');\r\n wp_enqueue_style('wpi-admin-css');\r\n\r\n //** Prints styles specific for this page */\r\n wp_enqueue_style('wpi-this-page-css');\r\n wp_enqueue_style('wpi-ie7');\r\n }", "public function config_page_styles() {\n\t\twp_enqueue_style( 'yseo-gc-admin-css', HS_DOCS_API_DIR_URL . 'css/dist/admin.css', null, HS_DOCS_API_PLUGIN_VERSION );\n\t}", "function v2_mumm_css_alter(&$css) {\n $path = drupal_get_path('theme', 'v2_mumm');\n if ($_GET['q'] === 'outdated-browser') {\n unset($css[$path . '/css/style.css']);\n }\n else {\n unset($css[$path . '/css/unsupported-browsers.css']);\n }\n}", "function gtpress_overrideCSS(){\r\n\t$GTTabs_options=get_option(\"GTTabs\");\r\n\t?>\r\n\t<style type=\"text/css\">\r\n\t<?php require_once(\"GTPress_css.php\"); ?>\r\n\t</style>\r\n\t<?php\r\n\r\n}", "function add_head() {\r\n\t\tglobal $locale;\r\n\t\t$wpca_settings = get_option('wpcareers');\r\n\t\techo \"<link rel=\\\"stylesheet\\\" href=\\\"\" . $this->plugin_url . \"/themes/default/css/default.css\\\" type=\\\"text/css\\\" media=\\\"screen\\\">\";\r\n\t\tif($wpca_settings['edit_style']==null || $wpca_settings['edit_style']=='plain') {\r\n\t\t\t// nothing\r\n\t\t} elseif($wpca_settings['edit_style']=='tinymce') {\r\n\t\t\t// activate these includes if the user chooses tinyMCE on the settings page\r\n\t\t\t$mce_path = get_option('siteurl');\r\n\t\t\t$mce_path .= '/wp-includes/js/tinymce/tiny_mce.js';\r\n\t\t\techo '<script type=\"text/javascript\" src=\"' . $mce_path . '\"></script>';\r\n\t\t}\r\n\t}", "function scripts_styles() {\n\n\t\t// No need to process if in admin.\n\t\tif ( is_admin() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$theme_url = get_template_directory_uri();\n\t\t$main_css_url = $theme_url . '/style.css';\n\t\t$main_css_path = get_template_directory() . '/style.css';\n\t\t$main_css_ver = file_exists( $main_css_path ) ? filemtime( $main_css_path ) : '';\n\n\t\twp_enqueue_style( 'superiocity-style', $main_css_url, null, $main_css_ver );\n\t\twp_deregister_script( 'wp-embed' );\n\t}", "function setupSkinUserCss( OutputPage $out ){\n\t\tparent::setupSkinUserCss( $out );\n\t\t\n\t\t// XXX: Cannot use addModuleStyles because the icons don't work\n\t\t$out->addStyle( 'smoothwiki/css/bootstrap.min.css' );\n\t\t$out->addStyle( 'smoothwiki/css/bootstrap-responsive.min.css' );\n\t\t$out->addStyle( 'smoothwiki/css/smoothwiki.css' );\n\t}", "function alt_admin_styles()\n {\n global $wp_styles;\n\n wp_enqueue_style('alt-admin-footer', get_template_directory_uri() . '/lib/alt-admin/css/admin-footer.css');\n\n $color_scheme = get_user_option('admin_color');\n\n if ( 'alt-design' === $color_scheme || in_array(get_current_screen()->base, array('profile', 'profile-network')) ) {\n $wp_styles->registered['colors']->deps[] = 'colors-fresh';\n }\n }", "public function meta_box_css() {\n\n ?>\n <style type=\"text/css\">.misc-pub-section:not(.misc-pub-post-status) { display: none; }</style>\n <?php\n\n // Fire action for CSS on Envira post type screens.\n do_action( 'envira_gallery_admin_css' );\n\n }", "function habitat_wp_dequeue_cau_css() {\n wp_dequeue_style('civicrm_admin_utilities_admin_tweaks');\n}", "function capstone_frontend_styles() {\n\t\tif ( !is_admin() ) {\n\n\t\t\t// Libraries Styles\n\t\t\twp_enqueue_style('fontawesome', CAPSTONE_CSS_URI . '/lib/font-aswesome.css');\n\t\t\twp_enqueue_style('icheck', CAPSTONE_JS_URI . '/lib/icheck/square/blue.css');\n\t\t\twp_enqueue_style('material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons');\n\t\t\twp_enqueue_style('flickity', CAPSTONE_CSS_URI . '/lib/flickity.min.css');\n\t\t\twp_enqueue_style('mapbox', 'https://api.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css');\n\t\t\twp_enqueue_style('mapbox-geocoder', 'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v2.3.0/mapbox-gl-geocoder.css');\n\t\t\t\n\t\t\t// Theme Styles\n\t\t\twp_enqueue_style('capstone-main', CAPSTONE_CSS_URI . '/main.min.css', array('wp-mediaelement'));\n\t\t\t\n\t\t\t// Google Fonts\n\t\t\twp_enqueue_style('capstone-fonts', capstone_fonts_url(), array(), '1.0.0');\n\t\t\t\n\t\t\t// Add Inline Styles (dynamic)\n\t\t\tob_start();\n\t\t\trequire( get_template_directory() .'/styles/dynamic.php' );\n\t\t\t$dynamic_css = ob_get_clean();\n\t wp_add_inline_style('capstone-main', $dynamic_css);\n\t\t}\n\t}", "function ft_hook_add_css() {}", "function ct_include_style () {\n\tif ( !is_admin() ) {\n\t\twp_enqueue_style( 'christatimmer', get_stylesheet_uri() );\n\t}\n}", "private function addCSS()\n {\n Filters::add('head', array($this, 'renderRevisionsCSS'));\n }", "function head_css()\n{\n return get_view()->headLink() . get_view()->headStyle();\n}", "protected function regStyles() {\n $this->modx->regClientCSS($this->config['cssUrl'] . 'web/bbcode/bbcode.css');\n $this->modx->regClientCSS($this->config['cssUrl'] . 'web/styles.css');\n }", "function kcsite_add_semi_admin_stylesheet() {\n\t echo '<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"'.get_bloginfo('stylesheet_directory').'/css/admin/admin-custom-semi-admin.css?4\" />';\n\t}" ]
[ "0.64123803", "0.6364427", "0.634668", "0.6344194", "0.6244267", "0.62112933", "0.6184165", "0.617153", "0.6154084", "0.61347914", "0.6115918", "0.61113024", "0.6109064", "0.6083221", "0.6071445", "0.60558105", "0.6034255", "0.60268146", "0.6019083", "0.6017077", "0.5979238", "0.5970835", "0.595425", "0.5940803", "0.59394914", "0.59315497", "0.59286255", "0.59079945", "0.5900163", "0.58738935" ]
0.826032
0
Returns a filename that is unique in the given directory. This fuction is based on wp_unique_filename() from but it treats .tar.gz as a single extension.
public function unique_filename_callback( $dir, $filename, $ext ) { $ext = mb_strtolower($ext); if($ext === '.gz' && mb_substr($filename, -7) === '.tar.gz' ) $ext = '.tar.gz'; $number = ''; while ( file_exists( $dir . "/$filename" ) ) { $new_number = (int) $number + 1; if ( '' === "$number$ext" ) { $filename = "$filename-" . $new_number; } else { $filename = str_replace( array( "-$number$ext", "$number$ext" ), "-" . $new_number . $ext, $filename ); } $number = $new_number; } return $filename; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generate_unique_file_name($dir, $filename)\n{\n if (!$filename)\n return;\n \n $extension = pathinfo($filename, PATHINFO_EXTENSION);\n\n $new_filename = '';\n for (;;)\n {\n $new_filename = get_random_string(8, 8) . '.' . $extension;\n if (!file_exists($dir . '/' . $new_filename))\n break;\n }\n\n return $new_filename;\n}", "function wp_unique_filename($dir, $filename, $unique_filename_callback = null) {\n\t\t$filename = sanitize_file_name($filename);\n\n\t\t// Separate the filename into a name and extension.\n\t\t$info = pathinfo($filename);\n\t\t$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';\n\t\t$name = basename($filename, $ext);\n\n\t\t// Edge case: if file is named '.ext', treat as an empty name.\n\t\tif ($name === $ext) {\n\t\t\t$name = '';\n\t\t}\n\n\t\t/*\n\t\t\t * Increment the file number until we have a unique file to save in $dir.\n\t\t\t * Use callback if supplied.\n\t\t*/\n\t\tif ($unique_filename_callback && is_callable($unique_filename_callback)) {\n\t\t\t$filename = call_user_func($unique_filename_callback, $dir, $name, $ext);\n\t\t} else {\n\t\t\t$number = '';\n\n\t\t\t// Change '.ext' to lower case.\n\t\t\tif ($ext && strtolower($ext) != $ext) {\n\t\t\t\t$ext2 = strtolower($ext);\n\t\t\t\t$filename2 = preg_replace('|' . preg_quote($ext) . '$|', $ext2, $filename);\n\n\t\t\t\t// Check for both lower and upper case extension or image sub-sizes may be overwritten.\n\t\t\t\twhile (file_exists($dir . \"/$filename\") || file_exists($dir . \"/$filename2\")) {\n\t\t\t\t\t$new_number = $number + 1;\n\t\t\t\t\t$filename = str_replace(\"$number$ext\", \"$new_number$ext\", $filename);\n\t\t\t\t\t$filename2 = str_replace(\"$number$ext2\", \"$new_number$ext2\", $filename2);\n\t\t\t\t\t$number = $new_number;\n\t\t\t\t}\n\t\t\t\treturn $filename2;\n\t\t\t}\n\n\t\t\twhile (file_exists($dir . \"/$filename\")) {\n\t\t\t\tif ('' == \"$number$ext\") {\n\t\t\t\t\t$filename = $filename . ++$number . $ext;\n\t\t\t\t} else {\n\t\t\t\t\t$filename = str_replace(\"$number$ext\", ++$number . $ext, $filename);\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\treturn $filename;\n\t}", "function wp_unique_filename($dir, $filename, $unique_filename_callback = \\null)\n {\n }", "public static function uniqueFilename($directory)\n\t{\n\t\t$ds = DIRECTORY_SEPARATOR;\n\t\t$i = 0;\n\t\tdo{\n\t\t\t$filename = uniqid($i++);\n\t\t} while (file_exists($directory . $ds . $filename));\n\t\t\n\t\treturn $filename;\n\t}", "private function generateUniqueFileName()\n {\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName()\n {\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName()\n {\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName()\n {\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName()\n {\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName()\n {\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName()\n {\n // md5() reduces the similarity of the file names generated by\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName()\n {\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "private function generateUniqueFileName() {\r\n \r\n return md5(uniqid());\r\n }", "private function createUniqueZipFilename()\n {\n $directory = storage_path() . '/elvis/';\n\n if (!file_exists($directory)) {\n mkdir($directory);\n }\n\n return $directory . Str::random(40) . '.zip';\n }", "private function generateUniqueFileName()\n {\n return md5(base64_encode(pack('N6', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid())));\n }", "private function generateUniqueFileName() :string\n {\n // md5() reduces the similarity of the file names generated by\n // uniqid(), which is based on timestamps\n return md5(uniqid());\n }", "function unique_name($folder, $name, $extension)\n{\n $result = \"$folder/$name.$extension\";\n\n $i = 2;\n while (file_exists($result))\n {\n $result = \"$folder/$name-$i.$extension\";\n $i++;\n }\n\n return $result;\n}", "protected function randomFileName($directory, $prefix = '', $extension = '.txt')\n {\n do {\n $file = uniqid($prefix).$extension;\n }\n while (file_exists($directory.'/'.$file));\n return $file;\n }", "function generateNewFileName(string $directory, string $extension) : string {\n\n\t//First, check if folder exists\n\tif(!file_exists($directory))\n\t\treturn false;\n\t\n\t//Generate a random filename\n\tdo {\n\t\t//Generate a new filename\n\t\t$fileName = random_str(25).\".\".$extension;\t\n\t}\n\twhile(file_exists($directory.$fileName));\n\n\t//Return the generated filename\n\treturn $fileName;\n}", "public function makeFilename()\n {\n return getcwd().'/package'.md5(time().uniqid()).'.zip';\n }", "public static function MakeFilenameUnique($dir, $filename)\n\t{\n\t $dir = self::NormalizeDirPath($dir);\n\t\t$i = 0;\n\t while ($i < 1000)\n\t {\n\t if ($i == 0)\n\t {\n\t $newFilename = $filename;\n\t }\n\t else\n\t {\n\t \t$reg = array();\n\t if (preg_match('/(.*)\\.([^\\.]*)$/', $filename, $reg))\n\t {\n\t $newFilename = $reg[1].\"[$i].\".$reg[2];\n\t }\n\t else\n\t {\n\t $newFilename = $filename.\"[$i]\";\n\t }\n\t }\n\n\t if (!file_exists($dir.$newFilename)) break;\n\t $i++;\n\t }\n\t return $newFilename;\n\t}", "protected function makeFilename()\n {\n return getcwd().'/october_installer_'.md5(time().uniqid()).'.zip';\n }", "protected function makeFilename()\n {\n return getcwd().'/bolt_'.md5(time().uniqid()).'.zip';\n }", "function getUnique($fileName,$path)\n{\n $baseName = preg_replace('/^(.*)\\.[^.]+$/', '\\\\1', $fileName);\n $extension = preg_replace('/^.*(\\.[^.]+$)/', '\\\\1', $fileName);\n $i = 1;\n \n while (file_exists($path.$fileName)) {\n $fileName = $baseName . '_' . $i . $extension;\n $i++;\n }\n \n return $fileName;\n}", "protected function getUniqueTargetPath($uploadDirectory, $filename)\n\t{\n\t\t// Allow only one process at the time to get a unique file name, otherwise\n\t\t// if multiple people would upload a file with the same name at the same time\n\t\t// only the latest would be saved.\n\n\t\tif (function_exists('sem_acquire')){\n\t\t\t$lock = sem_get(ftok(__FILE__, 'u'));\n\t\t\tsem_acquire($lock);\n\t\t}\n\n\t\t$pathinfo = pathinfo($filename);\n\t\t$base = $pathinfo['filename'];\n// Clean the fileName for security reasons\n$base = preg_replace('/[^\\w\\._]+/', '_', $base);\n\t\t$ext = isset($pathinfo['extension']) ? $pathinfo['extension'] : '';\n\t\t$ext = $ext == '' ? $ext : '.' . $ext;\n\n\t\t$unique = $base;\n\t\t$suffix = 0;\n\n\t\t// Get unique file name for the file, by appending suffix.\n\t\twhile (file_exists($uploadDirectory . DIRECTORY_SEPARATOR . $unique . $ext)){\n//\t\t\t$suffix += rand(1, 999);\t// random\n\t\t\t$suffix++;\t// consecutive\n\t\t\t$unique = $base.'-'.$suffix;\n\t\t}\n\n\t\t$result = $uploadDirectory . DIRECTORY_SEPARATOR . $unique . $ext;\n\n\t\t// Create an empty target file\n\t\tif (!touch($result)){\n\t\t\t// Failed\n\t\t\t$result = false;\n\t\t}\n\n\t\tif (function_exists('sem_acquire')){\n\t\t\tsem_release($lock);\n\t\t}\n\n\t\treturn $result;\n\t}", "public function getUniqFilename()\n\t{\n\t\tif (empty($this->_uniqFilename)) {\n\t\t\t$this->_uniqFilename = sprintf('%s_%s', uniqid(), $this->_uploadedFile->getClientFilename());\n\t\t}\n\n\t\treturn $this->_uniqFilename;\n\t}", "private function genereteFilename(){\n return strtolower(md5(uniqid($this->document->baseName)) . '.' . $this->document->extension);\n }", "public static function getRandomFileName()\r\n\t{\r\n\t\treturn uniqid(rand(), true);\r\n\t}", "public function unique_filename_callback($dir, $name, $ext) {// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Filter use\n\t\treturn $name.$ext;\n\t}", "private function returnUniqueFileName($name) {\n\t\t\t\twhile(file_exists($this->dir.'/'.$name) == true) {\n\t\t\t\t\t$name = rand(1000).$name;\n\t\t\t\t}\n\t\t\t\treturn $name;\n\t\t\t}" ]
[ "0.77655303", "0.767303", "0.7602459", "0.75815725", "0.74350446", "0.74350446", "0.74350446", "0.74350446", "0.74350446", "0.74350446", "0.73986477", "0.7397706", "0.7242553", "0.72255135", "0.71434987", "0.70677674", "0.7001081", "0.6945939", "0.6924418", "0.6850468", "0.6801426", "0.67566496", "0.6752559", "0.67253417", "0.66985434", "0.6686271", "0.6621189", "0.6573536", "0.6565372", "0.656363" ]
0.7734731
1
Download a file to the WordPress media library. $mime_type and $extension are optional, if set to something empty() they are guessed form the download file, where the extension is guessed based on the mime type. If the mime type is provided and the downloaded file does not actually have that mime type, an error is returned.
public function download_to_media_library( $url, $filename, $extension, $mime_type, $parent_post_id ) { $extension = ltrim($extension, '.'); // Gives us access to the download_url() and wp_handle_sideload() functions require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/image.php' ); $timeout_seconds = 20; // Download file to temp dir $temp_file = download_url( $url, $timeout_seconds ); if ( !is_wp_error( $temp_file ) ) { $finfo = finfo_open(FILEINFO_MIME_TYPE); $actual_mime_type = finfo_file($finfo, $temp_file); finfo_close($finfo); if( empty($mime_type) ) { $mime_type = $actual_mime_type; } elseif($mime_type !== $actual_mime_type) return array( 'error' => "Instead of the mime type " . $mime_type . " we were expecting, the remote server provided a file of mime type " . $actual_mime_type ); if (empty($extension)) { if( preg_match('#text/.*tex#u', $mime_type) ) $extension = 'tex'; else if( preg_match('#application/.*(tar|gz|gzip)#u', $mime_type) ) $extension = 'tar.gz'; else if( preg_match('#application/.*pdf#u', $mime_type) ) $extension = 'pdf'; else $extension = 'unknown'; } $filename = $filename . '.' . $extension; // Array based on $_FILE as seen in PHP file uploads $file = array( 'name' => $filename, 'type' => $mime_type, 'tmp_name' => $temp_file, 'error' => 0, 'size' => filesize($temp_file), ); $overrides = array( // Tells WordPress to not look for the POST form // fields that would normally be present as // we downloaded the file from a remote server, so there // will be no form fields // Default is true 'test_form' => false, // Setting this to false lets WordPress allow empty files, not recommended // Default is true 'test_size' => true, // for .tar.gz files normally only .gz is treated as the extension, so that // when file.tar.gz already exists the file is uploaded as file.tar-1.gz but // we want the propper file-1.tar.gz 'unique_filename_callback' => array($this, 'unique_filename_callback'), ); // Move the temporary file into the uploads directory $results = wp_handle_sideload( $file, $overrides ); if ( !empty( $results['error'] ) ) { return array( 'error' => "Failed to put file " . $file['name'] . " of mime type " . $file['type'] . " into uploads directory because Wordpress said: " . $results['error'] ); } else { $filepath = $results['file']; // Full path to the file // Prepare an array of post data for the attachment. $attachment = array( 'guid' => $filepath, 'post_mime_type' => $mime_type, 'post_title' => $filename, 'post_content' => '', 'post_status' => 'inherit' ); // Insert the attachment. $attach_id = wp_insert_attachment( $attachment, $filepath, $parent_post_id ); // Generate the metadata for the attachment, and update the database record. $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data ); $results['mime_type'] = $mime_type; $results['attach_id'] = $attach_id; return $results; } } else return array( 'error' => "Failed to download file of mime type " . $mime_type . ": " . $temp_file->get_error_message()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function download($type)\n {\n $model = Student::whereUser_id(auth()->user()->id)->first();\n if (!is_null($model)) {\n if ($model->user_id == auth()->user()->id) {\n $document = $model->getFirstMedia($type);\n if (!is_null($document))\n return response()->download($document->getPath(), $document->file_name);\n }\n }\n toast('Document not found', 'warning')->autoClose(5000)->timerProgressBar();\n return redirect()->back();\n }", "private function sendDownload($content, $name = null, $type = 1)\n {\n // Backward compatibilty for ob_list_handlers\n if (!function_exists('ob_list_handlers')) {\n function ob_list_handlers()\n {\n $res = array();\n if (ini_get('output_buffering')) {\n $res[] = 'default output handler';\n }\n return $res;\n }\n }\n \n \n require_once 'Download.php';\n $dl = &new HTTP_Download();\n \n switch ($type) {\n case 1:\n if (is_file($content)) {\n $dl->setFile($content);\n } else {\n die('Download File/Path Not Found: ' . $content);\n return false;\n }\n break;\n \n case 2:\n $dl->setData($content);\n break;\n \n case 3:\n $dl->setResource($content);\n break;\n \n default:\n return false;\n break;\n }\n\n $dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $name);\n \n // Set content type \n if (preg_match('#Opera(/| )([0-9].[0-9]{1,2})#', getenv('HTTP_USER_AGENT')) or \n preg_match('#MSIE ([0-9].[0-9]{1,2})#', getenv('HTTP_USER_AGENT'))) {\n \n $content_type = 'application/octetstream';\n } else {\n $content_type = 'application/octet-stream';\n }\n $dl->setContentType($content_type);\n $res = $dl->send();\n \n if (PEAR::isError($res)) {\n die('Send Download Failed: ' . $res->message);\n } else {\n exit;\n }\n }", "public function download($entity_type, $entity_id) {\n try {\n $media_links = $this->getFiles($entity_id);\n\n if (count($media_links) === 0) {\n $this->messenger()->addError($this->t('No files found for this entity to be downloaded'));\n\n return new RedirectResponse(\"$entity_type/$entity_id\");\n }\n\n $filename = \"$entity_type-$entity_id.zip\";\n\n ob_clean();\n\n $zip = new ZipStream($filename);\n foreach ($media_links as $media_link) {\n if (!$media_link->url) {\n continue;\n }\n\n $zip->addFileFromPath($media_link->file_name, $media_link->url);\n }\n\n $zip->finish();\n\n ob_end_flush();\n exit();\n\n } catch (StorageException $e) {\n $this->messenger()->addError($this->t('There were issues generating the package of media downloads.'));\n\n return new RedirectResponse(\"$entity_type/$entity_id\");\n }\n }", "public function downloadFile();", "public function getFile($ext, $type)\n {\n\t $dao = $this->getDAO();\n\n $resume = $dao->findByExt($ext);\n\n if ( !$resume ) { return $this->error($ext); }\n\n $response = new StreamedResponse();\n $d = $response->headers\n ->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE,\n $this->buildFileName(). $ext);\n $response->headers->set('Content-Disposition', $d);\n $response->headers->set('Content-Type', $type);\n \n //$response->setContent($resume->getFile());\n \n //there has to be more elegant way to do this // brute force\n switch($ext)\n {\n case 'docx';\n $response->setCallback(function()\n {\n echo $this->getDAO()->findByExt('docx')\n ->getFile();\n flush();\n });\n break;\n\n case 'html':\n $response->setCallback(function()\n {\n echo $this->getDAO()->findByExt('html')\n ->getFile();\n flush();\n });\n break;\n\n case 'txt':\n $response->setCallback(function()\n {\n echo $this->getDAO()->findByExt('txt')\n ->getFile();\n flush();\n });\n break;\n\n case 'pdf':\n $response->setCallback(function()\n {\n echo $this->getDAO()->findByExt('pdf')\n ->getFile();\n flush();\n });\n break;\n\n default:\n return $this->error($ext);\n }\n \n $response->send();\n }", "public function send_file($filename, $download = NULL, array $options = NULL)\n\t{\n\t\tif ( ! empty($options['mime_type']))\n\t\t{\n\t\t\t// The mime-type has been manually set\n\t\t\t$mime = $options['mime_type'];\n\t\t}\n\n\t\tif ($filename === TRUE)\n\t\t{\n\t\t\tif (empty($download))\n\t\t\t{\n\t\t\t\tthrow new Kohana_Exception('Download name must be provided for streaming files');\n\t\t\t}\n\n\t\t\t// Temporary files will automatically be deleted\n\t\t\t$options['delete'] = FALSE;\n\n\t\t\tif ( ! isset($mime))\n\t\t\t{\n\t\t\t\t// Guess the mime using the file extension\n\t\t\t\t$mime = File::mime_by_ext(strtolower(pathinfo($download, PATHINFO_EXTENSION)));\n\t\t\t}\n\n\t\t\t// Force the data to be rendered if\n\t\t\t$file_data = (string) $this->response;\n\n\t\t\t// Get the content size\n\t\t\t$size = strlen($file_data);\n\n\t\t\t// Create a temporary file to hold the current response\n\t\t\t$file = tmpfile();\n\n\t\t\t// Write the current response into the file\n\t\t\tfwrite($file, $file_data);\n\n\t\t\t// File data is no longer needed\n\t\t\tunset($file_data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Get the complete file path\n\t\t\t$filename = realpath($filename);\n\n\t\t\tif (empty($download))\n\t\t\t{\n\t\t\t\t// Use the file name as the download file name\n\t\t\t\t$download = pathinfo($filename, PATHINFO_BASENAME);\n\t\t\t}\n\n\t\t\t// Get the file size\n\t\t\t$size = filesize($filename);\n\n\t\t\tif ( ! isset($mime))\n\t\t\t{\n\t\t\t\t// Get the mime type\n\t\t\t\t$mime = File::mime($filename);\n\t\t\t}\n\n\t\t\t// Open the file for reading\n\t\t\t$file = fopen($filename, 'rb');\n\t\t}\n\n\t\tif ( ! is_resource($file))\n\t\t{\n\t\t\tthrow new Kohana_Exception('Could not read file to send: :file', array(\n\t\t\t\t':file' => $download,\n\t\t\t));\n\t\t}\n\n\t\t// Inline or download?\n\t\t$disposition = empty($options['inline']) ? 'attachment' : 'inline';\n\n\t\t// Calculate byte range to download.\n\t\tlist($start, $end) = $this->_calculate_byte_range($size);\n\n\t\tif ( ! empty($options['resumable']))\n\t\t{\n\t\t\tif ($start > 0 OR $end < ($size - 1))\n\t\t\t{\n\t\t\t\t// Partial Content\n\t\t\t\t$this->status = 206;\n\t\t\t}\n\n\t\t\t// Range of bytes being sent\n\t\t\t$this->headers['Content-Range'] = 'bytes '.$start.'-'.$end.'/'.$size;\n\t\t\t$this->headers['Accept-Ranges'] = 'bytes';\n\t\t}\n\n\t\t// Set the headers for a download\n\t\t$this->headers['Content-Disposition'] = $disposition.'; filename=\"'.$download.'\"';\n\t\t$this->headers['Content-Type'] = $mime;\n\t\t$this->headers['Content-Length'] = ($end - $start) + 1;\n\n\t\tif (Request::user_agent('browser') === 'Internet Explorer')\n\t\t{\n\t\t\t// Naturally, IE does not act like a real browser...\n\t\t\tif (Request::$protocol === 'https')\n\t\t\t{\n\t\t\t\t// http://support.microsoft.com/kb/316431\n\t\t\t\t$this->headers['Pragma'] = $this->headers['Cache-Control'] = 'public';\n\t\t\t}\n\n\t\t\tif (version_compare(Request::user_agent('version'), '8.0', '>='))\n\t\t\t{\n\t\t\t\t// http://ajaxian.com/archives/ie-8-security\n\t\t\t\t$this->headers['X-Content-Type-Options'] = 'nosniff';\n\t\t\t}\n\t\t}\n\n\t\t// Send all headers now\n\t\t$this->send_headers();\n\n\t\twhile (ob_get_level())\n\t\t{\n\t\t\t// Flush all output buffers\n\t\t\tob_end_flush();\n\t\t}\n\n\t\t// Manually stop execution\n\t\tignore_user_abort(TRUE);\n\n\t\tif ( ! Kohana::$safe_mode)\n\t\t{\n\t\t\t// Keep the script running forever\n\t\t\tset_time_limit(0);\n\t\t}\n\n\t\t// Send data in 16kb blocks\n\t\t$block = 1024 * 16;\n\n\t\tfseek($file, $start);\n\n\t\twhile ( ! feof($file) AND ($pos = ftell($file)) <= $end)\n\t\t{\n\t\t\tif (connection_aborted())\n\t\t\t\tbreak;\n\n\t\t\tif ($pos + $block > $end)\n\t\t\t{\n\t\t\t\t// Don't read past the buffer.\n\t\t\t\t$block = $end - $pos + 1;\n\t\t\t}\n\n\t\t\t// Output a block of the file\n\t\t\techo fread($file, $block);\n\n\t\t\t// Send the data now\n\t\t\tflush();\n\t\t}\n\n\t\t// Close the file\n\t\tfclose($file);\n\n\t\tif ( ! empty($options['delete']))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t// Attempt to remove the file\n\t\t\t\tunlink($filename);\n\t\t\t}\n\t\t\tcatch (Exception $e)\n\t\t\t{\n\t\t\t\t// Create a text version of the exception\n\t\t\t\t$error = Kohana::exception_text($e);\n\n\t\t\t\tif (is_object(Kohana::$log))\n\t\t\t\t{\n\t\t\t\t\t// Add this exception to the log\n\t\t\t\t\tKohana::$log->add(Kohana::ERROR, $error);\n\n\t\t\t\t\t// Make sure the logs are written\n\t\t\t\t\tKohana::$log->write();\n\t\t\t\t}\n\n\t\t\t\t// Do NOT display the exception, it will corrupt the output!\n\t\t\t}\n\t\t}\n\n\t\t// Stop execution\n\t\texit;\n\t}", "public function download(): void\n\t{\n\t\t/** @var ExtensionModel $model */\n\t\t$model = $this->getModel();\n\t\t$id = $this->input->getInt('id');\n\t\t$fileDetails = $model->getFilename($id);\n\n\t\tif (!file_exists($fileDetails->file))\n\t\t{\n\t\t\tthrow new InvalidArgumentException(Text::sprintf('COM_JED_EXTENSIONS_DOWNLOAD_NOT_FOUND',\n\t\t\t\t$fileDetails->file));\n\t\t}\n\n\t\theader('Content-type: application/zip');\n\t\theader('Content-Disposition: attachment; filename=' . $fileDetails->originalFile);\n\t\theader('Content-length: ' . filesize($fileDetails->file));\n\t\theader('Pragma: no-cache');\n\t\theader('Expires: 0');\n\t\treadfile($fileDetails->file);\n\n\t\tFactory::getApplication()->close();\n\t}", "public static function downloadContent(&$contents, $filename = null, $inline = false, $mime_type = null)\n\t{\n\n\t\t$is_file = is_file($contents);\n\n\t\tif(is_null($mime_type)) // Test if MIME type forced.\n\t\t{\n\t\t\t$mime_type = self::detectMimeType($contents);\n\t\t} // Test if MIME type forced.\n\n\t\tif(is_null($filename)) // Test if custom filename is to be used.\n\t\t{\n\n\t\t\tif($is_file) // Test if content is a file.\n\t\t\t{\n\t\t\t\t$filename = basename($contents);\n\t\t\t}\n\t\t\telse // Test if content is a file.\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t} // Test if content is a file.\n\n\t\t} // Test if custom filename is to be used.\n\n\t\t// We clean up the output buffer.\n\t\terror_reporting(E_ALL ^ E_NOTICE);\n\t\tob_end_clean();\n\n\t\tif($mime_type == 'application/pdf') // Test if content is PDF.\n\t\t{\n\t\t\theader('Cache-Control: public');\n\t\t\theader('Pragma: ');\n\t\t\theader('Expires: 0');\n\t\t}\n\t\telse // Test if content is PDF.\n\t\t{\n\t\t\theader('Pragma: no-cache');\n\t\t\theader('Cache-Control: no-store, no-cache, must-revalidate');\n\t\t} // Test if content is PDF.\n\n\t\t// Content is always modified.\n\t\theader(sprintf(\"Last-Modified: %s GMT\", gmdate(\"D, d M Y H:i:s\")));\n\t\theader(sprintf('Content-Type: %s', $mime_type));\n\t\theader(sprintf('Content-Disposition: %s; filename=\"%s\"', $inline ? 'inline' : 'attachment', $filename));\n\n\t\tif(self::isBinaryContent($mime_type)) // Test if content should be presented as binary.\n\t\t{\n\t\t\theader('Content-Transfer-Encoding: binary');\n\t\t} // Test if content should be presented as binary.\n\n\t\tif($is_file) // Test if content is a file.\n\t\t{\n\t\t\theader(sprintf('Content-Length: %d', filesize($contents)));\n\n\t\t\t// Unlock session in order to prevent php session warnings\n\t\t\tsession_write_close();\n\n\t\t\tif(self::detectServerSoftware() == self::LIGHTTPD && defined('XSENDFILE_ENABLED'))\n\t\t\t{\n\t\t\t\tif(XSENDFILE_ENABLED) // Test if X-Sendfile can be used.\n\t\t\t\t{\n\t\t\t\t\theader(sprintf('X-Sendfile: %s', $contents));\n\n\t\t\t\t\t// Send http headers to user client\n\t\t\t\t\texit(0);\n\t\t\t\t} // Test if X-Sendfile can be used.\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Send http headers to user client\n\t\t\t\treadfile($contents);\n\t\t\t\texit(0);\n\t\t\t}\n\t\t}\n\t\telse // Test if content is a file.\n\t\t{\n\t\t\theader(sprintf('Content-Length: %d', strlen($contents)));\n\n\t\t\t// Unlock session in order to prevent php session warnings\n\t\t\tsession_write_close();\n\n\t\t\t// Send http headers to user client\n\t\t\techo $contents;\n\t\t\texit(0);\n\t\t} // Test if content is a file.\n\n\t\treturn false;\n\t}", "function returnMimeThumb($file_ext, $url = false)\n{\n\tglobal $settings;\n\n\t// These are not meant to be exhaustive, just some of the most common attached on a forum\n\t$generics = array(\n\t\t'arc' => array('tgz', 'zip', 'rar', '7z', 'gz'),\n\t\t'doc' => array('doc', 'docx', 'wpd', 'odt'),\n\t\t'sound' => array('wav', 'mp3', 'pcm', 'aiff', 'wma', 'm4a', 'flac'),\n\t\t'video' => array('mp4', 'mgp', 'mpeg', 'mp4', 'wmv', 'mkv', 'flv', 'aiv', 'mov', 'swf'),\n\t\t'txt' => array('rtf', 'txt', 'log'),\n\t\t'presentation' => array('ppt', 'pps', 'odp'),\n\t\t'spreadsheet' => array('xls', 'xlr', 'ods'),\n\t\t'web' => array('html', 'htm')\n\t);\n\tforeach ($generics as $generic_extension => $generic_types)\n\t{\n\t\tif (in_array($file_ext, $generic_types))\n\t\t{\n\t\t\t$file_ext = $generic_extension;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tstatic $distinct = array('arc', 'doc', 'sound', 'video', 'txt', 'presentation', 'spreadsheet', 'web',\n\t\t\t\t\t\t\t 'c', 'cpp', 'css', 'csv', 'java', 'js', 'pdf', 'php', 'sql', 'xml');\n\n\tif (empty($settings))\n\t{\n\t\tThemeLoader::loadEssentialThemeData();\n\t}\n\n\t// Return the mine thumbnail if it exists or just the default\n\tif (!in_array($file_ext, $distinct) || !file_exists($settings['theme_dir'] . '/images/mime_images/' . $file_ext . '.png'))\n\t{\n\t\t$file_ext = 'default';\n\t}\n\n\t$location = $url ? $settings['theme_url'] : $settings['theme_dir'];\n\n\treturn $location . '/images/mime_images/' . $file_ext . '.png';\n}", "public function downloadFile($id, $type)\n {\n $model = Student::whereUser_id($id)->first();\n if (!is_null($model)) {\n $document = $model->getFirstMedia($type);\n if (!is_null($document))\n return response()->download($document->getPath(), $document->file_name);\n }\n toast('Document not found', 'warning')->autoClose(5000)->timerProgressBar();\n return redirect()->back();\n }", "public function downloadFile($file, $name, $mime_type='') {\n if(!is_readable($file)) throw new Exception('File not found or inaccessible! ['.$file.']');\n\n $size = filesize($file);\n $name = rawurldecode($name);\n\n /* Figure out the MIME type (if not specified) */\n $known_mime_types=array(\n \"pdf\" => \"application/pdf\",\n \"txt\" => \"text/plain\",\n \"html\" => \"text/html\",\n \"htm\" => \"text/html\",\n \"exe\" => \"application/octet-stream\",\n \"zip\" => \"application/zip\",\n \"doc\" => \"application/msword\",\n \"xls\" => \"application/vnd.ms-excel\",\n \"ppt\" => \"application/vnd.ms-powerpoint\",\n \"gif\" => \"image/gif\",\n \"png\" => \"image/png\",\n \"jpeg\"=> \"image/jpg\",\n \"jpg\" => \"image/jpg\",\n \"php\" => \"text/plain\"\n );\n\n if($mime_type==''){\n $file_extension = strtolower(substr(strrchr($name,\".\"),1));\n if (array_key_exists($file_extension, $known_mime_types)) {\n $mime_type=$known_mime_types[$file_extension];\n }\n else {\n $mime_type=\"application/force-download\";\n };\n };\n\n @ob_end_clean(); //turn off output buffering to decrease cpu usage\n\n // required for IE, otherwise Content-Disposition may be ignored\n if(ini_get('zlib.output_compression'))\n ini_set('zlib.output_compression', 'Off');\n\n header('Content-Type: ' . $mime_type);\n header('Content-Disposition: attachment; filename=\"'.$name.'\"');\n header(\"Content-Transfer-Encoding: binary\");\n header('Accept-Ranges: bytes');\n\n /* The three lines below basically make the\n download non-cacheable */\n header(\"Cache-control: private\");\n header('Pragma: private');\n header(\"Expires: Mon, 26 Jul 1997 05:00:00 GMT\");\n\n // multipart-download and download resuming support\n if(isset($_SERVER['HTTP_RANGE'])) {\n list($a, $range) = explode(\"=\",$_SERVER['HTTP_RANGE'],2);\n list($range) = explode(\",\",$range,2);\n list($range, $range_end) = explode(\"-\", $range);\n $range=intval($range);\n if (!$range_end) {\n $range_end=$size-1;\n }\n else {\n $range_end=intval($range_end);\n }\n\n $new_length = $range_end-$range+1;\n header(\"HTTP/1.1 206 Partial Content\");\n header(\"Content-Length: $new_length\");\n header(\"Content-Range: bytes $range-$range_end/$size\");\n }\n else {\n $new_length=$size;\n header(\"Content-Length: \".$size);\n }\n\n /* output the file itself */\n $chunksize = 1*(1024*1024); //you may want to change this\n $bytes_send = 0;\n if ($file = fopen($file, 'r')) {\n if(isset($_SERVER['HTTP_RANGE'])) fseek($file, $range);\n\n while(!feof($file) && (!connection_aborted()) && ($bytes_send<$new_length)) {\n $buffer = fread($file, $chunksize);\n print($buffer); //echo($buffer); // is also possible\n flush();\n $bytes_send += strlen($buffer);\n }\n fclose($file);\n }\n else die('Error - can not open file.');\n\n die();\n }", "function download_file($path, $type = 'application/octet-stream', $name = '', $force_download = false) {\n if(!is_readable($path)) {\n return false;\n } // if\n \n $filename = trim($name) == '' ? basename($path) : trim($name);\n return download_contents(file_get_contents($path), $type, $filename, filesize($path), $force_download);\n }", "private function fileDownload()\n {\n /**\n * Defined variables\n */\n $configHelper = $this->dataHelper;\n $request = $this->getRequest();\n $ds = DIRECTORY_SEPARATOR;\n $baseDir = DirectoryList::VAR_DIR;\n $fileFactory = $this->fileFactory;\n $contentType = 'application/octet-stream';\n $paramNameRequest = $request->getParam('m');\n $packagePathDir = $configHelper->getConfigAbsoluteDir();\n\n $lastItem = $this->packageFilter();\n $versionPackageData = $lastItem;\n $file = $versionPackageData->getData('file');\n\n $packageName = str_replace('_', '/', $paramNameRequest);\n $correctPathFile = $packagePathDir . $ds . $packageName . $ds . $file;\n\n $fileName = $file;\n $content = file_get_contents($correctPathFile, true);\n $fileDownload = $fileFactory->create($fileName, $content, $baseDir, $contentType);\n\n return $fileDownload;\n }", "private function sendFile($filename, $content, $type) {\n\t\tif ($type === 'unknown') {\n\t\t\treturn;\n\t\t}\n\n\t\t$content_type = '';\n\t\tif ($type === 'opml') {\n\t\t\t$content_type = 'application/xml';\n\t\t} elseif ($type === 'json_feed' || $type === 'json_starred') {\n\t\t\t$content_type = 'application/json';\n\t\t}\n\n\t\theader('Content-Type: ' . $content_type . '; charset=utf-8');\n\t\theader('Content-disposition: attachment; filename=' . $filename);\n\t\tprint($content);\n\t}", "function downloadFile($file, $name, $mime_type='')\n{\n /*\n This function takes a path to a file to output ($file), the filename that the browser will see ($name) and the MIME type of the file ($mime_type, optional).\n */\n \n //Check the file premission\n if(!is_readable($file)) die('File not found or inaccessible!');\n \n $size = filesize($file);\n $name = rawurldecode($name);\n \n /* Figure out the MIME type | Check in array */\n $known_mime_types=array(\n \t\"pdf\" => \"application/pdf\",\n \t\"txt\" => \"text/plain\",\n \t\"html\" => \"text/html\",\n \t\"htm\" => \"text/html\",\n\t\"exe\" => \"application/octet-stream\",\n\t\"zip\" => \"application/zip\",\n\t\"doc\" => \"application/msword\",\n\t\"xls\" => \"application/vnd.ms-excel\",\n\t\"ppt\" => \"application/vnd.ms-powerpoint\",\n\t\"gif\" => \"image/gif\",\n\t\"png\" => \"image/png\",\n\t\"jpeg\"=> \"image/jpg\",\n\t\"jpg\" => \"image/jpg\",\n\t\"php\" => \"text/plain\"\n );\n \n if($mime_type==''){\n\t $file_extension = strtolower(substr(strrchr($file,\".\"),1));\n\t if(array_key_exists($file_extension, $known_mime_types)){\n\t\t$mime_type=$known_mime_types[$file_extension];\n\t } else {\n\t\t$mime_type=\"application/force-download\";\n\t }\n }\n \n //turn off output buffering to decrease cpu usage\n @ob_end_clean(); \n \n // required for IE, otherwise Content-Disposition may be ignored\n if(ini_get('zlib.output_compression'))\n ini_set('zlib.output_compression', 'Off');\n \n header('Content-Type: ' . $mime_type);\n header('Content-Disposition: attachment; filename=\"'.$name.'\"');\n header(\"Content-Transfer-Encoding: binary\");\n header('Accept-Ranges: bytes');\n \n /* The three lines below basically make the \n download non-cacheable */\n header(\"Cache-control: private\");\n header('Pragma: private');\n header(\"Expires: Mon, 26 Jul 1997 05:00:00 GMT\");\n \n // multipart-download and download resuming support\n if(isset($_SERVER['HTTP_RANGE']))\n {\n\tlist($a, $range) = explode(\"=\",$_SERVER['HTTP_RANGE'],2);\n\tlist($range) = explode(\",\",$range,2);\n\tlist($range, $range_end) = explode(\"-\", $range);\n\t$range=intval($range);\n\tif(!$range_end) {\n\t\t$range_end=$size-1;\n\t} else {\n\t\t$range_end=intval($range_end);\n\t}\n\t/*\n\t------------------------------------------------------------------------------------------------------\n\t//This application is developed by www.webinfopedia.com\n\t//visit www.webinfopedia.com for PHP,Mysql,html5 and Designing tutorials for FREE!!!\n\t------------------------------------------------------------------------------------------------------\n \t*/\n\t$new_length = $range_end-$range+1;\n\theader(\"HTTP/1.1 206 Partial Content\");\n\theader(\"Content-Length: $new_length\");\n\theader(\"Content-Range: bytes $range-$range_end/$size\");\n } else {\n\t$new_length=$size;\n\theader(\"Content-Length: \".$size);\n }\n \n /* Will output the file itself */\n $chunksize = 1*(1024*1024); //you may want to change this\n $bytes_send = 0;\n if ($file = fopen($file, 'r'))\n {\n\tif(isset($_SERVER['HTTP_RANGE']))\n\tfseek($file, $range);\n \n\twhile(!feof($file) && \n\t\t(!connection_aborted()) && \n\t\t($bytes_send<$new_length)\n\t )\n\t{\n\t\t$buffer = fread($file, $chunksize);\n\t\tprint($buffer); //echo($buffer); // can also possible\n\t\tflush();\n\t\t$bytes_send += strlen($buffer);\n\t}\n fclose($file);\n } else\n //If no permissiion\n die('Error - can not open file.');\n //die\ndie();\n}", "protected static function get_mime_type($extension = \\null)\n {\n }", "function output_file($Source_File, $Download_Name, $mime_type='')\n{\nif(!is_readable($Source_File)) die('File not found or inaccessible!');\n \n$size = filesize($Source_File);\n$Download_Name = rawurldecode($Download_Name);\n \n/* Figure out the MIME type (if not specified) */\n$known_mime_types=array(\n \"pdf\" => \"application/pdf\",\n \"csv\" => \"application/csv\",\n \"txt\" => \"text/plain\",\n \"html\" => \"text/html\",\n \"htm\" => \"text/html\",\n \"exe\" => \"application/octet-stream\",\n \"zip\" => \"application/zip\",\n \"doc\" => \"application/msword\",\n \"xls\" => \"application/vnd.ms-excel\",\n \"ppt\" => \"application/vnd.ms-powerpoint\",\n \"gif\" => \"image/gif\",\n \"png\" => \"image/png\",\n \"jpeg\"=> \"image/jpg\",\n \"jpg\" => \"image/jpg\",\n \"php\" => \"text/plain\"\n);\n \nif($mime_type==''){\n $file_extension = strtolower(substr(strrchr($Source_File,\".\"),1));\n if(array_key_exists($file_extension, $known_mime_types)){\n $mime_type=$known_mime_types[$file_extension];\n } else {\n $mime_type=\"application/force-download\";\n };\n};\n \n@ob_end_clean(); //off output buffering to decrease Server usage\n \n// if IE, otherwise Content-Disposition ignored\nif(ini_get('zlib.output_compression'))\n ini_set('zlib.output_compression', 'Off');\n \nheader('Content-Type: ' . $mime_type);\nheader('Content-Disposition: attachment; filename=\"'.$Download_Name.'\"');\nheader(\"Content-Transfer-Encoding: binary\");\nheader('Accept-Ranges: bytes');\n \nheader(\"Cache-control: private\");\nheader('Pragma: private');\nheader(\"Expires: Thu, 26 Jul 2012 05:00:00 GMT\");\n \n// multipart-download and download resuming support\nif(isset($_SERVER['HTTP_RANGE']))\n{\n list($a, $range) = explode(\"=\",$_SERVER['HTTP_RANGE'],2);\n list($range) = explode(\",\",$range,2);\n list($range, $range_end) = explode(\"-\", $range);\n $range=intval($range);\n if(!$range_end) {\n $range_end=$size-1;\n } else {\n $range_end=intval($range_end);\n }\n \n $new_length = $range_end-$range+1;\n header(\"HTTP/1.1 206 Partial Content\");\n header(\"Content-Length: $new_length\");\n header(\"Content-Range: bytes $range-$range_end/$size\");\n} else {\n $new_length=$size;\n header(\"Content-Length: \".$size);\n}\n \n/* output the file itself */\n$chunksize = 1*(1024*1024); //you may want to change this\n$bytes_send = 0;\nif ($Source_File = fopen($Source_File, 'r'))\n{\n if(isset($_SERVER['HTTP_RANGE']))\n fseek($Source_File, $range);\n \n while(!feof($Source_File) &&\n (!connection_aborted()) &&\n ($bytes_send<$new_length)\n )\n {\n $buffer = fread($Source_File, $chunksize);\n print($buffer); //echo($buffer); // is also possible\n flush();\n $bytes_send += strlen($buffer);\n }\nfclose($Source_File);\n} else die('Error - can not open file.');\n \ndie();\n}", "public function download_file($path){\t\n\t\t// Must be fresh start\n\t\tif( headers_sent() )\n\t\tdie('Headers Sent');\n\t\t// Required for some browsers\n\t\tif(ini_get('zlib.output_compression'))\n\t\tini_set('zlib.output_compression', 'Off');\n\t\t// File Exists?\n\t\tif(file_exists($path)){\n\t\t\t// Parse Info / Get Extension\n\t\t\t$fsize = filesize($path);\n\t\t\t$path_parts = pathinfo($path);\n\t\t\t$ext = strtolower($path_parts[\"extension\"]);\n\t\t\t// Determine Content Type\n\t\t\tswitch($ext){\t\t\t \n\t\t\t case \"zip\": $ctype=\"application/zip\"; break;\n\t\t\t case \"doc\": $ctype=\"application/msword\"; break;\n\t\t\t case \"xls\": $ctype=\"application/vnd.ms-excel\"; break;\t\t \n\t\t\t case \"gif\": $ctype=\"image/gif\"; break;\n\t\t\t case \"png\": $ctype=\"image/png\"; break;\n\t\t\t case \"jpeg\":\n\t\t\t case \"jpg\": $ctype=\"image/jpg\"; break;\n\t\t\t default: $ctype=\"application/force-download\";\n\t\t\t}\n\t\t\theader(\"Pragma: public\"); // required\n\t\t\theader(\"Expires: 0\");\n\t\t\theader(\"Cache-Control: must-revalidate, post-check=0, pre-check=0\");\n\t\t\theader(\"Cache-Control: private\",false); // required for certain browsers\n\t\t\theader(\"Content-Type: $ctype\");\n\t\t\t$file_name = basename($path);\n\t\t\theader(\"Content-Disposition: attachment; filename=\\\"\".$file_name.\"\\\";\" );\n\t\t\theader(\"Content-Transfer-Encoding: binary\");\n\t\t\theader(\"Content-Length: \".$fsize);\n\t\t\tob_clean();\n\t\t\tflush();\n\t\t\treadfile( $path );\n\t\t}else{\n\t\t\tdie('File Not Found');\n\t\t}\n\t}", "public function download_file($path){\t\n\t\t// Must be fresh start\n\t\tif( headers_sent() )\n\t\tdie('Headers Sent');\n\t\t// Required for some browsers\n\t\tif(ini_get('zlib.output_compression'))\n\t\tini_set('zlib.output_compression', 'Off');\n\t\t// File Exists?\n\t\tif(file_exists($path)){\n\t\t\t// Parse Info / Get Extension\n\t\t\t$fsize = filesize($path);\n\t\t\t$path_parts = pathinfo($path);\n\t\t\t$ext = strtolower($path_parts[\"extension\"]);\n\t\t\t// Determine Content Type\n\t\t\tswitch($ext){\t\t\t \n\t\t\t case \"zip\": $ctype=\"application/zip\"; break;\n\t\t\t case \"doc\": $ctype=\"application/msword\"; break;\n\t\t\t case \"xls\": $ctype=\"application/vnd.ms-excel\"; break;\t\t \n\t\t\t case \"gif\": $ctype=\"image/gif\"; break;\n\t\t\t case \"png\": $ctype=\"image/png\"; break;\n\t\t\t case \"jpeg\":\n\t\t\t case \"jpg\": $ctype=\"image/jpg\"; break;\n\t\t\t default: $ctype=\"application/force-download\";\n\t\t\t}\n\t\t\theader(\"Pragma: public\"); // required\n\t\t\theader(\"Expires: 0\");\n\t\t\theader(\"Cache-Control: must-revalidate, post-check=0, pre-check=0\");\n\t\t\theader(\"Cache-Control: private\",false); // required for certain browsers\n\t\t\theader(\"Content-Type: $ctype\");\n\t\t\t$file_name = basename($path);\n\t\t\theader(\"Content-Disposition: attachment; filename=\\\"\".$file_name.\"\\\";\" );\n\t\t\theader(\"Content-Transfer-Encoding: binary\");\n\t\t\theader(\"Content-Length: \".$fsize);\n\t\t\tob_clean();\n\t\t\tflush();\n\t\t\treadfile( $path );\n\t\t}else{\n\t\t\tdie('File Not Found');\n\t\t}\n\t}", "public function download()\n {\n $encrypt = $this->services['encrypt'];\n $file_name = $encrypt->decode($this->getPost('id'));\n $type = $this->getPost('type');\n $storage = $this->services['backup']->setStoragePath($this->settings['working_directory']);\n if($type == 'files')\n {\n $file = $storage->getStorage()->getFileBackupNamePath($file_name);\n }\n else\n {\n $file = $storage->getStorage()->getDbBackupNamePath($file_name);\n }\n \n \n $backup_info = $this->services['backups']->setLocations($this->settings['storage_details'])->getBackupData($file);\n $download_file_path = false;\n if( !empty($backup_info['storage_locations']) && is_array($backup_info['storage_locations']) )\n {\n foreach($backup_info['storage_locations'] AS $storage_location)\n {\n if( $storage_location['obj']->canDownload() )\n {\n $download_file_path = $storage_location['obj']->getFilePath($backup_info['file_name'], $backup_info['backup_type']); //next, get file path\n break;\n }\n }\n }\n \n if($download_file_path && file_exists($download_file_path))\n {\n $this->services['files']->fileDownload($download_file_path);\n exit;\n }\n }", "function output_file($file, $name, $mime_type = '') {\r\n if (!is_readable($file))\r\n die('File not found or inaccessible!');\r\n\r\n $size = filesize($file);\r\n $name = rawurldecode($name);\r\n\r\n /* Figure out the MIME type (if not specified) */\r\n $known_mime_types = array(\r\n \"pdf\" => \"application/pdf\",\r\n \"txt\" => \"text/plain\",\r\n \"html\" => \"text/html\",\r\n \"htm\" => \"text/html\",\r\n \"exe\" => \"application/octet-stream\",\r\n \"zip\" => \"application/zip\",\r\n \"doc\" => \"application/msword\",\r\n \"xls\" => \"application/vnd.ms-excel\",\r\n \"ppt\" => \"application/vnd.ms-powerpoint\",\r\n \"gif\" => \"image/gif\",\r\n \"png\" => \"image/png\",\r\n \"jpeg\" => \"image/jpg\",\r\n \"jpg\" => \"image/jpg\",\r\n \"php\" => \"text/plain\"\r\n );\r\n\r\n if ($mime_type == '') {\r\n $file_extension = strtolower(substr(strrchr($file, \".\"), 1));\r\n if (array_key_exists($file_extension, $known_mime_types)) {\r\n $mime_type = $known_mime_types[$file_extension];\r\n } else {\r\n $mime_type = \"application/force-download\";\r\n };\r\n };\r\n\r\n @ob_end_clean(); //turn off output buffering to decrease cpu usage\r\n // required for IE, otherwise Content-Disposition may be ignored\r\n if (ini_get('zlib.output_compression'))\r\n ini_set('zlib.output_compression', 'Off');\r\n\r\n header('Content-Type: ' . $mime_type);\r\n header('Content-Disposition: attachment; filename=\"' . $name . '\"');\r\n header(\"Content-Transfer-Encoding: binary\");\r\n header('Accept-Ranges: bytes');\r\n\r\n /* The three lines below basically make the \r\n download non-cacheable */\r\n header(\"Cache-control: private\");\r\n header('Pragma: private');\r\n\r\n // multipart-download and download resuming support\r\n if (isset($_SERVER['HTTP_RANGE'])) {\r\n list($a, $range) = explode(\"=\", $_SERVER['HTTP_RANGE'], 2);\r\n list($range) = explode(\",\", $range, 2);\r\n list($range, $range_end) = explode(\"-\", $range);\r\n $range = intval($range);\r\n if (!$range_end) {\r\n $range_end = $size - 1;\r\n } else {\r\n $range_end = intval($range_end);\r\n }\r\n\r\n $new_length = $range_end - $range + 1;\r\n header(\"HTTP/1.1 206 Partial Content\");\r\n header(\"Content-Length: $new_length\");\r\n header(\"Content-Range: bytes $range-$range_end/$size\");\r\n } else {\r\n $new_length = $size;\r\n header(\"Content-Length: \" . $size);\r\n }\r\n\r\n /* output the file itself */\r\n $chunksize = 1 * (1024 * 1024); //you may want to change this\r\n $bytes_send = 0;\r\n if ($file = fopen($file, 'r')) {\r\n if (isset($_SERVER['HTTP_RANGE']))\r\n fseek($file, $range);\r\n\r\n while (!feof($file) &&\r\n (!connection_aborted()) &&\r\n ($bytes_send < $new_length)\r\n ) {\r\n $buffer = fread($file, $chunksize);\r\n print($buffer); //echo($buffer); // is also possible\r\n flush();\r\n $bytes_send += strlen($buffer);\r\n }\r\n fclose($file);\r\n unlink($file);\r\n } else\r\n die('Error - can not open file.');\r\n\r\n die();\r\n }", "public function download_file($path = '', $filename = '')\n {\n if ($path != '' && $filename != '')\n {\n $file = $path . '/' . $filename;\n $finfo = finfo_open(FILEINFO_MIME_TYPE);\n $file_mime_type = finfo_file($finfo, $file);\n $len = filesize($file); // Calculate File Size \n ob_clean();\n ob_start();\n if (headers_sent())\n {\n echo 'HTTP header already sent';\n }\n else if (!is_readable($file))\n {\n header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');\n echo 'File not readable';\n }\n else\n {\n header(\"Pragma: public\");\n header(\"Expires: 0\");\n header(\"Cache-Control: must-revalidate, post-check=0, pre-check=0\");\n header(\"Cache-Control: public\");\n header(\"Content-Description: File Transfer\");\n header(\"Content-Type:pplication/octet-stream\"); // Send type of file\n $header = \"Content-Disposition: attachment; filename=$filename;\"; // Send File Name\n header($header);\n header(\"Content-Transfer-Encoding: binary\");\n header(\"Content-Length: \" . $len); // Send File Size \n readfile($file);\n }\n }\n }", "public function downloadAction()\n\t{\n\t\t$settings = $this->getProgressParameters();\n\n\t\tif (!empty($settings['downloadParams']['filePath']) && !empty($settings['downloadParams']['fileName']))\n\t\t{\n\t\t\t$file = new Main\\IO\\File($settings['downloadParams']['filePath']);\n\t\t\tif ($file->isExists())\n\t\t\t{\n\t\t\t\t$response = new Main\\Engine\\Response\\File(\n\t\t\t\t\t$file->getPath(),\n\t\t\t\t\t$settings['downloadParams']['fileName'],\n\t\t\t\t\t$settings['downloadParams']['fileType']\n\t\t\t\t);\n\n\t\t\t\treturn $response;\n\t\t\t}\n\t\t}\n\n\t\t$this->addError(new Error('File not found'));\n\t}", "function downloadPhoto()\n{\n if (!empty($_FILES['file-photo']['name']) || !empty($_POST['post-photo-link'])) {\n if (!empty($_FILES['file-photo']['name'])) {\n $file_name = $_FILES['file-photo']['name'];\n $file_path = __DIR__ . '/uploads/';\n move_uploaded_file($_FILES['file-photo']['tmp_name'], $file_path . $file_name);\n return $file_name;\n } else {\n $url = $_POST['post-photo-link'];\n $file_name = basename($url);\n $file = file_get_contents($url);\n $ext = pathinfo($url, PATHINFO_EXTENSION);\n file_put_contents(__DIR__ . '/uploads/' . $file_name . '.' . $ext, $file);\n return $file_name;\n }\n }\n}", "public function file($file_path = null, $content_type = null, $cache_type = null, $cache_control = null)\n {\n // If null is passed then return the current file value\n // otherwise if a blank string then clear the current file\n // and return this Response object.\n if ($file_path === null) {\n return $this->response_file;\n } elseif ($file_path === '') {\n $this->response_file = null;\n return $this;\n }\n\n // Validate that the file exists\n if (!is_file($file_path)) {\n throw new \\Exception(sprintf('[%s->%s()] was called for a file that does not exist: %s', __CLASS__, __FUNCTION__, $file_path));\n }\n\n // Determine the Mime-type to send if not specified as a parameter\n if ($content_type === null) {\n $content_type = $this->fileTypeToMimeType($file_path);\n }\n\n // Set the 'Content-Type' Responder Header or if a 'Download' file is\n // specified then set Responder Headers so that the browswer will prompt\n // to download the file.\n if ($content_type === 'download' || $content_type === 'application/octet-stream') {\n // Get the file name and replace any double-quotes.\n // Note - [basename()] is not used because it doesn't always\n // work in some environments (often Linux or Unix) for Unicode\n // Characters unless calling [setlocale()]. Since the Locale\n // is not known this method is more reliable.\n // $file_name = str_replace('\"', '', basename($file_path));\n $data = explode(DIRECTORY_SEPARATOR, realpath($file_path));\n $file_name = $data[count($data)-1];\n\n // Headers [ 'Content-Description', 'Content-Type', 'Content-Disposition' ]\n // are related to the download while headers [ 'Cache-Control', 'Pragma', 'Expires' ]\n // are related to caching. These caching headers are similar to what is sent\n // from noCache() but vary slightly for 'Cache-Control'.\n $this\n ->header('Content-Description', 'File Transfer')\n ->header('Content-Type', 'application/octet-stream')\n ->header('Content-Disposition', 'attachment; filename=\"' . $file_name . '\"')\n ->header('Cache-Control', 'must-revalidate')\n ->header('Pragma', 'no-cache')\n ->header('Expires', '-1');\n } else {\n $this->contentType($content_type);\n }\n\n // If a cache type is specified then calculate either a\n // hash or last modified date from the file.\n if ($cache_type !== null) {\n switch (strtolower($cache_type)) {\n case 'etag:md5':\n $this->etag(md5_file($file_path));\n break;\n case 'etag:sha1':\n $this->etag(sha1_file($file_path));\n break;\n case 'last-modified':\n $this->lastModified(filemtime($file_path));\n break;\n default:\n throw new \\Exception('Invalid parameter for option $cache_type: ' . $cache_type);\n }\n }\n\n // Set a 'Cache-Control' header if one is defined from this function\n if ($cache_control !== null) {\n $this->cacheControl($cache_control);\n }\n\n // Set a private property to the file path and return the Response Object\n $this->response_file = $file_path;\n return $this;\n }", "function instant_download($product_id, $ftype=null) {\n \n if (!$filetype = GetReq('filetype'))\n $filetype = $ftype ? $ftype : $this->ftype;\n \n \t //extra security set form must be filled as session param\n\t //to prevent cmd instant download without it.\n\t if ((GetSessionParam('FORMSUBMITED')) || GetSessionParam(\"CODESUBMITED\")) {\t \n \n $file = $this->wherethefileis . $product_id . $this->file_epithema . $filetype;\t \n\t //$file = \"c:\\\\php\\\\webos2\\\\projects\\\\re-coding-official\\\\demo\\\\delphi2java_shareware.zip\";\n\t //echo \"DOWNLOAD:\",$file;\n\t //die();\n $downloadfile = new DOWNLOADFILE($file);\n\t \n /*$this->tell_by_mail(\"demo file downloaded\",\n\t 'support@re-coding.com',\n\t\t 'billy@re-coding.com',\n\t\t\t\t\t\t $file);\t\n\t\t\t\t\t\t \n $this->tell_by_sms(\"$product_id demo file downloaded.\");*/\t\n\t\t \n\t //inform bt mail and sms\n\t $this->send_downloaded_mail($product_id);\t\t\t\t\t \n\t \n if (!$downloadfile->df_download()) {\n\t //echo \"Sorry, we are experiencing technical difficulties downloading this file. Please report this error to Technical Support.\";\t \t \n\t\t$m = paramload('RCDOWNLOAD','error');\t\n\t\t$ff = $this->prpath.$m;\n\t\tif (is_file($ff)) {\n\t\t $ret = file_get_contents($ff);\n\t\t}\n\t\telse\n\t\t $ret = $m; //plain text\t\t \n\t }\n\t //else\n\t // $ret = \"OK\";\t\n\t }\n\t else\n\t $ret = \"Prohibited area!\"; \n\t\t \t \n\t return ($ret);\n\t \n\t \n\t //use download2.lib\n\t //$dFile = new Download_file($this->prpath . paramload('RCDOWNLOAD','dirsource') , $product_id . $this->ftype);\n }", "function provide_file($filename) {\n $ext = pathinfo($filename, PATHINFO_EXTENSION);\n $MODE = 'txt';\n $attachment = \"attachment; \";\n if ($ext != '') {\n $MODE = $ext;\n }\n switch ($MODE) {\n case \"bz2\": $ctype=\"application/x-bzip2\"; break;\n case \"css\": $ctype=\"text/css\"; break;\n case \"gz\": $ctype=\"application/x-gzip\"; break;\n case \"gzip\": $ctype=\"application/x-gzip\"; break;\n case \"java\": $ctype=\"text/x-java-source\"; $attachment=\"\"; break;\n case \"tgz\": $ctype=\"application/x-compressed\"; break;\n case \"pdf\": $ctype=\"application/pdf\"; $attachment=\"\"; break;\n case \"zip\": $ctype=\"application/zip\"; break;\n case \"doc\": $ctype=\"application/msword\"; break;\n case \"docx\": $ctype=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\"; break;\n case \"xls\": $ctype=\"application/vnd.ms-excel\"; break;\n case \"xlsx\": $ctype=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"; break;\n case \"ppt\": $ctype=\"application/vnd.ms-powerpoint\"; break;\n case \"pptx\": $ctype=\"application/vnd.openxmlformats-officedocument.presentationml.presentation\"; break;\n case \"svg\": $ctype=\"image/svg+xml\"; $attachment=\"\"; break;\n case \"gif\": $ctype=\"image/gif\"; $attachment=\"\"; break;\n case \"png\": $ctype=\"image/png\"; $attachment=\"\"; break;\n case \"jpe\": case \"jpeg\":\n case \"jpg\": $ctype=\"image/jpg\"; $attachment=\"\"; break;\n case \"sql\":\n case \"txt\": $ctype=\"text/plain\"; $attachment=\"\"; break;\n case \"htm\": $ctype=\"text/html\"; $attachment=\"\"; break;\n case \"html\": $ctype=\"text/html\"; $attachment=\"\"; break;\n case \"htmls\": $ctype=\"text/html\"; $attachment=\"\"; break;\n default: $ctype=\"application/octet-stream\";\n }\n\n header(\"Content-Type: $ctype\");\n header('Content-Disposition: '.$attachment.'filename=\"'.basename($filename).'\"');\n header('Content-Transfer-Encoding: binary');\n header('Expires: 0');\n header('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n\n echo file_get_contents($filename);\n\n }", "function get_mime($file) {\n\t// Since in php 5.3 this is a mess...\n\t/*if(function_exists('finfo_open')) {\n\t\treturn finfo_file(finfo_open(FILEINFO_MIME_TYPE), $file); \n\t} else {\n\t\tif(function_exists('mime_content_type')) {\n\t\t\treturn mime_content_type($file);\n\t\t} else {\n\t\t\treturn \"application/force-download\";\n\t\t}\n\t}*/\n\t$mimetypes = array(\n\t\t\"php\"\t=> \"application/x-php\",\n\t\t\"js\"\t=> \"application/x-javascript\",\n\t\t\n\t\t\"css\"\t=> \"text/css\",\n\t\t\"html\"\t=> \"text/html\",\n\t\t\"htm\"\t=> \"text/html\",\n\t\t\"txt\"\t=> \"text/plain\",\n\t\t\"xml\"\t=> \"text/xml\",\n\t\t\n\t\t\"bmp\"\t=> \"image/bmp\",\n\t\t\"gif\"\t=> \"image/gif\",\n\t\t\"jpg\"\t=> \"image/jpeg\",\n\t\t\"png\"\t=> \"image/png\",\n\t\t\"tiff\"\t=> \"image/tiff\",\n\t\t\"tif\"\t=> \"image/tif\",\n\t);\n\t$file_mime = $mimetypes[pathinfo($file, PATHINFO_EXTENSION)];\n\tif(check_value($file_mime)) {\n\t\treturn $file_mime;\n\t} else {\n\t\treturn \"application/force-download\";\n\t}\n}", "function dahz_attachment() {\n\n\t$file = wp_get_attachment_url();\n\t$mime = get_post_mime_type();\n\t$attachment = '';\n\n\t$mime_type = false !== strpos( $mime, '/' ) ? explode( '/', $mime ) : array( $mime, '' );\n\n\t/* Loop through each mime type. If a function exists for it, call it. Allow users to filter the display. */\n\tforeach ( $mime_type as $type ) {\n\t\tif ( function_exists( \"dahz_{$type}_attachment\" ) )\n\t\t\t$attachment = call_user_func( \"dahz_{$type}_attachment\", $mime, $file );\n\n\t\t$attachment = apply_filters( \"dahz_{$type}_attachment\", $attachment );\n\t}\n\n\techo apply_filters( 'dahz_attachment', $attachment );\n}", "public function stream( $mime_type = null ) {\n\t\tlist( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type );\n\n\t\tswitch ( $mime_type ) {\n\t\t\tcase 'image/png':\n\t\t\t\theader( 'Content-Type: image/png' );\n\t\t\t\treturn imagepng( $this->image );\n\t\t\tcase 'image/gif':\n\t\t\t\theader( 'Content-Type: image/gif' );\n\t\t\t\treturn imagegif( $this->image );\n\t\t\tdefault:\n\t\t\t\theader( 'Content-Type: image/jpeg' );\n\t\t\t\treturn imagejpeg( $this->image, null, $this->get_quality() );\n\t\t}\n\t}" ]
[ "0.5585438", "0.5543451", "0.5510361", "0.5502444", "0.54925233", "0.5442962", "0.5389697", "0.53632355", "0.5334549", "0.5286034", "0.5261409", "0.5223991", "0.5199559", "0.51602364", "0.514058", "0.51262844", "0.5090899", "0.50513715", "0.50513715", "0.5029837", "0.50279915", "0.50137264", "0.501037", "0.49977586", "0.49809703", "0.49782625", "0.49614578", "0.49470013", "0.4946638", "0.49308285" ]
0.68361455
0
Get the path of a feature image of a post Returns the path of the feature image, insired by
public function get_feature_image_path( $post_id ) { $thumb_id = get_post_thumbnail_id($post_id); if(empty($thumb_id)) return ''; $image= wp_get_attachment_image_src($thumb_id, 'full'); if(empty($image)) return ''; $upload_dir = wp_upload_dir(); $base_dir = $upload_dir['basedir']; $base_url = $upload_dir['baseurl']; $imagepath= str_replace($base_url, $base_dir, $image[0]); if (file_exists( $imagepath)) return $imagepath; else return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_feature_image_url($post_id)\n{\n\tif(has_post_thumbnail($post_id))\n\t{\n\t\t$image5 = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'full' );\n\t\treturn $image5[0];\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "function get_feature_image_url($post_id)\n{\n\tif(has_post_thumbnail($post_id))\n\t{\n\t\t$image5 = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'full' );\n\t\treturn $image5[0];\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "public function getImagePath(Post $post): ?string\n {\n if ($post->getThumbnail() === null) {\n return null;\n }\n return '/uploads/post/' . $post->getThumbnail();\n }", "public function get_image_attached($post){\n\t\n\tpreg_match_all('/src=([\"\\'])(.*?)\\1/', $post, $matches);\n\t$img = $matches[2];\n\t\n\treturn $img;\n\t\n\treturn false;\n }", "public function get_name() {\n\t\treturn 'happyden-feature-image';\n\t}", "public function path()\n {\n return $this->image->path;\n }", "function rest_get_featured_image( $post, $field_name, $request ) {\n $attachment_id = $post['featured_media'];\n $attachment_info = wp_get_attachment_image_src( $attachment_id, 'rest_post_thumbnail' );\n return $attachment_info[0];\n}", "public function getImage( $post_id ) {}", "function get_page_feature_image_url($postID, $size)\n{\n //get wp object of featured image\n $feature_image_id = get_post_thumbnail_id($postID);\n //get array of the featured image based on size\n $feature_image_meta = wp_get_attachment_image_src($feature_image_id, $size);\n //the 1st argument of the array is the url of the image 2nd is the width the 3ed is the height\n $link = $feature_image_meta[0];\n //return the first argument\n return $link;\n}", "public function getImgPath()\n {\n return $this->imgPath;\n }", "public function getImagePath()\n {\n return $this->imagepath;\n }", "function getImagePath () {\n return luxbum::getImage($this->dir, $this->file);\n }", "public function getImagePath(){\r\n\t\t\treturn $this->imagePath;\r\n\t\t}", "function ST4_columns_content($column_name, $post_ID) {\n if ($column_name == 'featured_image') {\n $post_featured_image = ST4_get_featured_image($post_ID);\n if ($post_featured_image) {\n echo '<img src=\"' . $post_featured_image . '\" />';\n }\n }\n}", "private function image_url( $post_id ) {\n\n\t\tstatic $uploads;\n\n\t\tif ( empty( $uploads ) ) {\n\t\t\t$uploads = wp_upload_dir();\n\t\t}\n\n\t\tif ( false !== $uploads['error'] ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$file = get_post_meta( $post_id, '_wp_attached_file', true );\n\n\t\tif ( empty( $file ) ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Check that the upload base exists in the file location.\n\t\tif ( 0 === strpos( $file, $uploads['basedir'] ) ) {\n\t\t\t$src = str_replace( $uploads['basedir'], $uploads['baseurl'], $file );\n\t\t}\n\t\telseif ( false !== strpos( $file, 'wp-content/uploads' ) ) {\n\t\t\t$src = $uploads['baseurl'] . substr( $file, ( strpos( $file, 'wp-content/uploads' ) + 18 ) );\n\t\t}\n\t\telse {\n\t\t\t// It's a newly uploaded file, therefore $file is relative to the baseurl.\n\t\t\t$src = $uploads['baseurl'] . '/' . $file;\n\t\t}\n\n\t\treturn apply_filters( 'wp_get_attachment_url', $src, $post_id );\n\t}", "public function featured_img() {\n\n $featured_img = wp_get_attachment_image_src(\n get_post_thumbnail_id( get_the_ID() ), 'large'\n );\n\n return $featured_img[0];\n }", "public function imagePath(){\n return $this->upload_directory.DS.$this->filename;\n }", "public function getPathByPostUrl() {\n\t\t\n\t\t$url = Request::post('url');\n\n\t\tif ($url && ($Page = $this->Automad->getPage($url))) {\n\t\t\treturn FileSystem::fullPagePath($Page->path);\n\t\t} else {\n\t\t\treturn AM_BASE_DIR . AM_DIR_SHARED . '/';\n\t\t}\n\t\t\n\t}", "function ay_emp_get_pi ( $post_ID ) {\n\t\t$post_thumbnail_id = get_post_thumbnail_id( $post_ID );\n\t\tif ( $post_thumbnail_id ) {\n\t\t\t$post_thumbnail_img = wp_get_attachment_image_src($post_thumbnail_id );\n\t\t\treturn $post_thumbnail_img[0];\n\t\t}\n\t}", "public function getImage() {\n return Mage::helper('landingpage/image')->getImageUrl($this->getData('image'));\n }", "function fs_get_featured_image_src( $size ) {\r\n\tglobal $post;\r\n\t$featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $size);\r\n\treturn $featured_image[0];\r\n}", "function get_featured_img_url($id) {\n\t$thumb_id = get_post_thumbnail_id($id);\n\t$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'grid-thumbnail-medium', true);\n\t$thumb_url = $thumb_url_array[0];\n\treturn $thumb_url;\n}", "function catch_that_image() {\n global $post;\n\n $first_img = get_template_directory_uri() . '/img/svg/one.svg';\n\n $output = preg_match_all('/<img.+src=[\\'\"]([^\\'\"]+)[\\'\"].*>/i', $post->post_content, $matches);\n\n\tif(isset($matches[1][0])) {\n\t\t$first_img = $matches[1][0];\n\t}\n\n return $first_img;\n}", "function _sf_get_spot_listing_image($post_id, $post_title = null) {\n\t\t\n\t\t//// GETS OUR FEATURED IMAGE\n\t\t$image = btoa_get_featured_image($post_id);\n\t\t\n\t\t//// GENERATES OUR MARKUP\n\t\t$markup = '';\n\t\t\n\t\t//// LINK TAG\n\t\t$markup .= '<a href=\"'.get_permalink($post_id).'\" title=\"'.$post_title.'\" class=\"spot-image\">';\n\t\t\n\t\t///// IF IT'S FEATURED\n\t\tif(get_post_meta($post_id, 'featured', true) == 'on') { $markup .= '<span class=\"featured\">'.__('Featured', 'btoa').'</span>'; }\n\t\t\n\t\t///// IMAGE\n\t\t$markup .= '<img src=\"'.ddTimthumb($image, 500, 350).'\" alt=\"'.$post_title.'\" title=\"'.$post_title.'\" />';\n\t\t\n\t\t//// CLOSES LINK TAG\n\t\t$markup .= '</a>';\n\t\t\n\t\treturn $markup;\n\t\t\n\t}", "function tp_get_img_dir() {\n\t$file = new ElggFile();\n\t$file->setFilename('image/');\n\treturn $file->getFilenameOnFilestore();\n}", "function save_admin_fields( $post_id, $post ){\r\n\r\n\t\t// Handle featured image being added/removed from admin\r\n\t\t$fi_id = get_post_thumbnail_id( $post_id );\r\n\t\tif ( $fi_id ) {\r\n\t\t\t$fi_url = wp_get_attachment_url( $fi_id );\r\n\t\t\tupdate_post_meta( $post_id, '_featured_image', $fi_url );\r\n\t\t} else {\r\n\t\t\tdelete_post_thumbnail( $post_id );\r\n\t\t\tdelete_post_meta( $post_id, '_featured_image' );\r\n\t\t}\r\n\r\n\t\treturn $post_id;\r\n\r\n\t}", "function get_post_thumbnail_id($post = \\null)\n {\n }", "abstract public function get_thumbnail_source_path();", "function wp_get_original_image_path($attachment_id, $unfiltered = \\false)\n {\n }", "public function getPath() {\n $path = 'private://dumper/%d/%s/%s';\n $path = sprintf($path,\n $this->og_controller->og_node->nid,\n $this->og_controller->date->format('Y/m/d'),\n $this->entity_type);\n return $path;\n }" ]
[ "0.6573878", "0.6573878", "0.6296172", "0.6168056", "0.6103291", "0.60804135", "0.6034792", "0.6013491", "0.58720905", "0.5870317", "0.58182037", "0.5749974", "0.5736883", "0.5706038", "0.5667666", "0.56430054", "0.5625451", "0.5622882", "0.56065935", "0.56058884", "0.5603174", "0.55935794", "0.557224", "0.55687124", "0.5525266", "0.55186373", "0.55136627", "0.549116", "0.5463427", "0.545287" ]
0.75880456
0
/ This script can be run at the command line via cron to search for all available jobs in US craigslist cities, input them into a database and email you the results. DB export is inside the folder for import.
function grab_feed($url){ //open our db connection $database="clscrape"; $con = mysql_connect('***.***.***.***','****','****'); //our associateive array of magical parsed xml jobs $arrFeeds = array(); //list of sites we want to search for jobs $sites = array("web/index.rss","eng/index.rss","sof/index.rss","search/crg?query=%20&format=rss","search/cpg?query=%20&format=rss"); foreach ($sites as $site){ //lets create a new document $doc = new DOMDocument(); //load our rss url $doc->load($url.$site); //crete an empty array to feed our items into //loop through the RSS XML document grabbing the title, description and link tags as those are the only ones we care about foreach ($doc->getElementsByTagName('item') as $node) { $itemRSS = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue ); //push each item onto the feed array array_push($arrFeeds, $itemRSS); } } foreach($arrFeeds as $link) { $search_terms = array( 'PHP','sysadmin','php'); foreach ($search_terms as $keyword) { $pos = strpos($link['desc'],$keyword); if($pos) { mysql_select_db('clscrape',$con) or die( 'Unable to select database' . mysql_error()); $hash = md5($link['title'].$link['desc'].$link['link']); $title = mysql_real_escape_string($link['title']); $desc = mysql_real_escape_string($link['desc']); $url = mysql_real_escape_string($link['link']); $query="INSERT INTO clscrape.data (data.hash,data.title,data.desc,data.link) VALUES('$hash','$title','$desc','$url')"; mysql_query($query,$con); } } } //close our db connection mysql_close($con); //return our associative array return $arrFeeds; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function asu_isearch_cron() {\n\n // Cache data from configuration\n _asu_isearch_cache_dept_feed();\n\n // Cache dept tree and employee types data\n _asu_isearch_cache_dept_tree_data();\n\n // Begin profile migrations\n _asu_isearch_begin_migrate(FALSE);\n\n // Cleanup the profiles which are no longer associated with\n // unit depts in iSearch. Only run once per day.\n $last_clean = variable_get('last_profile_cleanup', NULL);\n\n if ($last_clean != date('ymd', time())) {\n _asu_isearch_cleanup();\n variable_set('last_profile_cleanup', date('ymd', time()));\n }\n}", "function mainExec() {\n $numPerPage = 10;\n $numIterations = 1;\n $dataDir = \"./data\";\n $dataDir = \"./data/samples\";\n $conn = new \\PDO(\"sqlite:\" . \"/opt/sqlite_dbs/gcrawler.db\");\n\n $initialise = new InitialiseDB($conn);\n $initialise->createTables();\n\n $terms = [\n \"nz books\",\n \"nz gems\"\n ];\n\n $searchStorer = new SearchStorer($dataDir);\n\n\n foreach ($terms as $currentTerms) {\n $dateSfx = SearchStorer::getDateSuffix();\n // Don't turn on unless crawling live\t\n//\t\t $searchStorer->getPagesContentForTerms($currentTerms, $numIterations, $numPerPage, $dateSfx);\n\n $storedResultsParser = new StoredResultsParser($dataDir, $conn);\n $allStoredLinks = $storedResultsParser->parseContentFiles($currentTerms);\n\n $dated = (new \\DateTime())->format(\"Y-m-d H:i:s\");\n $searchBatchId = $storedResultsParser->insertSearchBatch($currentTerms, $dated);\n // echo \"searchBatchId: \" . $searchBatchId . PHP_EOL;\n\n $storedResultsParser->insertSearchResultsForBatch($searchBatchId, $allStoredLinks);\n }\n}", "function gather_ua_faculty_jobs( $args = array() ) {\n\n\t// Set up the arguments\n\t$defaults = array(\n\t\t'keywords' => NULL,\n\t);\n\textract( wp_parse_args( $args, $defaults ), EXTR_OVERWRITE );\n\n // Clean up the keywords\n if ( ! empty( $keywords ) ) {\n\n // Make sure $keywords is an array\n if ( ! is_array( $keywords ) )\n $keywords = explode( ',', $keywords );\n\n // Clean up the array\n $keywords = array_map( 'trim', $keywords );\n\n }\n\n // Get jobs from the UA faculty jobs feed - caches for 12 hours\n\t$the_jobs_feed = fetch_ua_faculty_jobs_feed();\n\n\t// Make sure there isn't an error\n\tif ( is_wp_error( $the_jobs_feed ) )\n\t\treturn false;\n\n\t// Figure out how many feed items there are\n\t$feed_count = $the_jobs_feed->get_item_quantity();\n\n\t// Sort/gather the feed items\n\tif ( $orig_feed_items = $the_jobs_feed->get_items( 0, $feed_count ) ) :\n\n\t\t// Create array of feed items to return\n\t\t$feed_items = array();\n\n\t\t// Loop through the items\n\t\tforeach ( $orig_feed_items as $job ) :\n\n // Set the job ID\n $job_id = $job->get_id();\n\n // Set the job title\n $job_title = $job->get_title();\n\n // Set the job content\n $job_content = $job->get_content();\n\n // Set the job authors\n $job_authors = $job->get_authors();\n\n // Search title and content for keywords\n if ( ! empty( $keywords ) && is_array( $keywords ) ) :\n\n // Create the search regex\n $search_regex = '/(' . implode( '|', $keywords ) . ')/i';\n\n // Keyword exist?\n $keyword_exist = false;\n\n // Keywords in the title?\n if ( preg_match( $search_regex, $job_title ) ) {\n\n $keyword_exist = true;\n\n // Keywords in the content?\n } else if ( preg_match( $search_regex, $job_content ) ) {\n\n $keyword_exist = true;\n\n } else {\n\n // Keywords in the authors?\n foreach( $job_authors as $author ) {\n\n // Search the name\n if ( isset( $author->name ) && preg_match( $search_regex, $author->name ) ) {\n\n $keyword_exist = true;\n break;\n\n }\n\n }\n\n }\n\n // If keyword doesn't exist, don't include\n if ( ! $keyword_exist ) {\n\n continue;\n\n }\n\n endif;\n\n\t\t\t// Get published date (is in UTC)\n\t\t\t$published_date = ( $published_date_str = $job->get_gmdate( 'Y-m-d H:i:s O' ) ) ? new DateTime( $published_date_str ) : false;\n\n\t\t\t// Get updated date (is in UTC)\n\t\t\t$updated_date = ( $updated_date_str = $job->get_updated_gmdate( 'Y-m-d H:i:s O' ) ) ? new DateTime( $updated_date_str ) : false;\n\n\t\t\t// Get site's timezone\n\t\t\tif ( $timezone = get_option( 'timezone_string' ) ) {\n\n\t\t\t\t// Convert to timezone\n\t\t\t\t$published_date->setTimezone( new DateTimeZone($timezone ) );\n\t\t\t\t$updated_date->setTimezone( new DateTimeZone($timezone ) );\n\n\t\t\t}\n\n\t\t\t// Add job object\n\t\t\t$feed_items[] = (object) array (\n 'ID' => $job_id,\n\t\t\t\t'permalink' => esc_url( $job->get_permalink() ),\n\t\t\t\t'published' => $published_date,\n\t\t\t\t'updated' => $updated_date,\n\t\t\t\t'title' => esc_html( $job_title ),\n\t\t\t\t'authors' => $job_authors,\n\t\t\t\t'content' => esc_html( $job_content )\n\t\t\t);\n\n\t\tendforeach;\n\n\t\treturn $feed_items;\n\n\tendif;\n\n\treturn false;\n\n}", "function createCrontab()\n\t{\n\t\t$crontabFilePath = '/tmp/crontab.txt';\n\t\t$file = fopen($crontabFilePath, \"w\") or die(\"Unable to open file!\");\n\t\tglobal $mongo,$python_script_path;\n\t\t$db = $mongo->logsearch;\n\t\t$collection = $db->service_config;\n\t\t$cursor = $collection->find();\n\t\tforeach ($cursor as $doc) {\n\t\t\tif( $doc['state'] == 'Running' && $doc['path'] != '' && $doc['crontab'] != ''){\n\t\t\t\t$txt = '# Index, service:\"'.$doc['service'].'\" system:\"'.$doc['system']\n\t\t\t\t\t\t.'\" node:\"'.$doc['node'].'\" process:\"'.$doc['process'].'\" path:\"'.$doc['path'].'\"'.PHP_EOL;\n\t\t\t\tfwrite($file, $txt); \n\t\t\t\t$txt = $doc['crontab'].' sudo -u logsearch python '\n\t\t\t\t\t\t\t.$python_script_path.'indexScript.py index '.$doc['_id'].PHP_EOL;\n\t\t\t\tfwrite($file, $txt); \n\t\t\t}\n\t\t}\n\t\t//purge data here\n\t\t$keepDataMonth = 3;\n\t\t$txt = '# Purge data at 04:00 everyday, keep data '.$keepDataMonth.' months'.PHP_EOL;\n\t\tfwrite($file, $txt);\n\t\t$txt = '0 4 * * *'.' sudo -u logsearch python '.$python_script_path.'purgeData.py '.$keepDataMonth.' '.PHP_EOL;\n\t\tfwrite($file, $txt); \n\t\tfclose($file);\n\t\t$cmd = \"sudo -u logsearch crontab \".$crontabFilePath;\n\t\texec($cmd);\n\t}", "function cron()\n\t{\n\t\tglobal $wpdb,\n\t\t\t\t\t $wgobd_importer_helper,\n\t\t\t\t\t $wgobd_events_helper,\n\t\t\t\t\t $wgobd_settings_controller;\n\n\t\t// ====================\n\t\t// = Select all feeds =\n\t\t// ====================\n\t\t$table_name = $wpdb->prefix . 'wgobd_event_feeds';\n\t\t$sql = \"SELECT * FROM {$table_name}\";\n\t\t$feeds = $wpdb->get_results( $sql );\n\n\t\t// ===============================\n\t\t// = go over each iCalendar feed =\n\t\t// ===============================\n\t\tforeach( $feeds as $feed ) {\n\t\t // flush the feed\n\t\t $wgobd_settings_controller->flush_ics_feed( false, $feed->feed_url );\n\t\t // import the feed\n\t\t\t$wgobd_importer_helper->parse_ics_feed( $feed );\n\t\t}\n\t}", "public function scrape($dom) {\n\n\t\t$job = new Job();\n\t\t$citylist = $GLOBALS['citylist'];\n\n\t\tif ($dom->find('comment')) {\n\t\t\tif ($dom->find('h2.nafn')) {\n\t\t\t\tif ($dom->find('div.box-left')){\n\n\t\t\t\t\t//Get foreign id\n\t\t\t\t\tforeach($dom->find('comment') as $Link) {\n\t\t\t\t\t\t$startString=\"nr/\";\n\t\t\t\t\t\t$endString=\"/\";\n\t\t\t\t\t\tpreg_match_all (\"|$startString(.*)$endString|U\", $Link, $output, PREG_PATTERN_ORDER);\n\t\t\t\t\t\t$job->setForeignId('vinnumalastofnun_is_' . trim(implode($output[1])));\n\t\t\t\t\t}\n\n\t \t\t\t//Get job title\n\t\t\t\t\tforeach($dom->find('h2.nafn') as $Jobtitle) {\n\t\t\t\t\t\t$job->setJobTitle($Jobtitle->plaintext);\n\t\t\t\t\t}\n\n\t\t\t\t\t//Get job description\n\t\t\t\t\tforeach($dom->find('div.box-left') as $DESCRIPTION) {\n\t\t\t\t\t\t$str = htmlentities($DESCRIPTION->innertext,ENT_NOQUOTES,'UTF-8',false);\n\t\t\t\t\t\t$str = str_replace(array('&lt;','&gt;'),array('<','>'), $str);\n\t\t\t\t\t\t$str = str_replace(array('&amp;lt;','&amp;gt'),array('&lt;','&gt;'), $str);\t\n\t\t\t\t\t\t$job->setDescription($str);\n\t\t\t\t\t}\n\n\t\t\t\t\t$date = date('Y-m-d');// current date\n\t\t\t\t\t$date = strtotime('+1 week', strtotime($date));\n\t\t\t\t\t$newdate = date ( 'Y-m-j' , $date);\n\n\t\t\t\t\t$outputDate = $newdate.\"T\".date(\"h:i\").\":00Z\";\n\t\t\t\t\t$job->setExpireDate($outputDate);\n\n\t\t\t\t\t$job->addJobLocation(\"Iceland\", false, false, 273716);\n\n\t\t\t\t\tforeach($dom->find('link[rel=canonical]') as $Link) {\n\t\t\t\t\t\t$job->setJobRouting(false, $Link->href, false);\n\t\t\t\t\t}\n\n\t\t\t\t\tforeach($dom->find('comment') as $Link) {\n\t\t\t\t\t\t$startString=\"from \";\n\t\t\t\t\t\t$endString=\" by HTTrack\";\n\t\t\t\t\t\tpreg_match_all (\"|$startString(.*)$endString|U\", $Link, $output, PREG_PATTERN_ORDER);\n\t\t\t\t\t\t$job->setJobRouting(false, \"http://\".trim(implode($output[1])), 2);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn $job;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n}", "function searchJobs() {\n $keyword = htmlspecialchars(trim($_POST['keyword']), ENT_QUOTES);\n $category = $_POST['category'];\n $location = $_POST['location'];\n \n // keyword parse\n if (!empty($keyword)) {\n $keyword = explode(' ', $keyword);\n \n if (count($keyword) > 1) {\n $default = 1;\n \n foreach ($keyword as $value) {\n if (!empty($value)) {\n if ($default == 1)\n $key_regexp = '[[:<:]]' . $value . '[[:>:]]';\n else\n $key_regexp .= '|[[:<:]]' . $value . '[[:>:]]';\n\n $default++;\n }\n }\n } elseif (count($keyword) == 1)\n $key_regexp = '[[:<:]]' . $keyword[0] . '[[:>:]]';\n \n $keyword = implode(' ', $keyword);\n } else\n $key_regexp = null;\n\n // category parse\n if (count($category) > 1) {\n $default = 1;\n \n foreach ($category as $value) {\n if (!empty($value)) {\n if ($default == 1)\n $cat_regexp = '[[:<:]]' . $value . '[[:>:]]';\n else\n $cat_regexp .= '|[[:<:]]' . $value . '[[:>:]]';\n\n $default++;\n }\n }\n } elseif (count($category) == 1)\n $cat_regexp = '[[:<:]]' . $category[0] . '[[:>:]]';\n else\n $cat_regexp = null;\n\n $category = implode(' ', $category);\n \n // location parse\n if (count($location) > 1) {\n $default = 1;\n \n foreach ($location as $value) {\n if (!empty($value)) {\n if ($default == 1)\n $loc_regexp = '[[:<:]]' . $value . '[[:>:]]';\n else\n $loc_regexp .= '|[[:<:]]' . $value . '[[:>:]]';\n\n $default++;\n }\n }\n } elseif (count($location) == 1)\n $loc_regexp = '[[:<:]]' . $location[0] . '[[:>:]]';\n else\n $loc_regexp = null;\n\n $location = implode(' ', $location);\n \n connectDatabase();\n \n if (!empty($key_regexp)) {\n if (ereg(\"all\", $cat_regexp) && ereg(\"all\", $loc_regexp)) {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1 AND\n (title REGEXP '$key_regexp' OR\n description REGEXP '$key_regexp')\n ORDER BY pk DESC\");\n\n } elseif (ereg(\"all\", $cat_regexp) && !ereg(\"all\", $loc_regexp)) {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1 AND\n (title REGEXP '$key_regexp' OR\n description REGEXP '$key_regexp') AND\n fk_location REGEXP '$loc_regexp'\n ORDER BY pk DESC\");\n\n } elseif (!ereg(\"all\", $cat_regexp) && ereg(\"all\", $loc_regexp)) {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1 AND\n (title REGEXP '$key_regexp' OR\n description REGEXP '$key_regexp') AND\n fk_category REGEXP '$cat_regexp'\n ORDER BY pk DESC\");\n\n } else {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1 AND\n (title REGEXP '$key_regexp' OR\n description REGEXP '$key_regexp') AND\n fk_category REGEXP '$cat_regexp' AND\n fk_location REGEXP '$loc_regexp'\n ORDER BY pk DESC\");\n\n }\n } else {\n if (ereg(\"all\", $cat_regexp) && ereg(\"all\", $loc_regexp)) {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1\n ORDER BY pk DESC\");\n \n } elseif (ereg(\"all\", $cat_regexp) && !ereg(\"all\", $loc_regexp)) {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1 AND\n fk_location REGEXP '$loc_regexp'\n ORDER BY pk DESC\");\n\n } elseif (!ereg(\"all\", $cat_regexp) && ereg(\"all\", $loc_regexp)) {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1 AND\n fk_category REGEXP '$cat_regexp'\n ORDER BY pk DESC\");\n\n } else {\n\n $result = queryDatabase(\"SELECT pk\n FROM job\n WHERE active = 1 AND\n fk_category REGEXP '$cat_regexp' AND\n fk_location REGEXP '$loc_regexp'\n ORDER BY pk DESC\");\n\n }\n }\n\n $ip = ($_SERVER['X_FORWARDED_FOR']) ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];\n $date = date('Y-m-d');\n $total = mysql_num_rows($result);\n \n if (mysql_num_rows($result) > 0) {\n $default = 1;\n \n while ($row = mysql_fetch_object($result)) {\n if ($default == 1)\n $fk_job = $row->pk;\n else {\n $fk_job .= \" $row->pk\";\n }\n\n $default++;\n }\n } else\n $fk_job = 'EMPTY';\n\n queryDatabase(\"INSERT INTO search (ip, keyword, total, searched, fk_category, fk_job, fk_location)\n VALUES ('$ip', '$keyword', $total, '$date', '$category', '$fk_job', '$location')\");\n\n header('Location: ' . HOME . 'browse.php?pk=' . mysql_insert_id());\n}", "static function jobs() {\n\t\tif(self::doCron()):\n\t\t\n\t\twhile(!Db::lock());\n\n\t\tReminder::cron();\n\t\t\n\t\t$ctrl = new Cronjob();\n\t\t$ctrl->checkBookings();\n\t\t$ctrl->cancelPending();\n\t\t$ctrl->unattended();\n\t\t\n\t\twhile(!Db::unlock());\n\t\t\n\t\tPreferences::set('lastCron', date(\"H:i:s\"));\n\t\t_debug(\"CRON JOBS DONE!\");\n\t\tendif;\n\t}", "function Main()\n{\n\tglobal $server;\n\t$company = ECash::getFactory()->getModel('Company');\n\t$company->loadBy(array('name_short' => strtolower(ECash::getConfig()->COMPANY_NAME_SHORT))); \n\n\t$server->company_id = $company->company_id;\n\t$company_id = $company->company_id;\n\t$db = ECash::getMasterDb();\n\t$start_date = getLastProcessTime($db, 'populate_email_queue', 'completed');\n\n\t// If this is null, the process has never run so we'll need to make up a \n\t// new start date.\n\tif (NULL === $start_date)\n\t{\n\t\t// We're going to subtract 6 hours below, so by setting this to 18 hours ago,\n\t\t// we'll ultimately start at 24 hours ago.\n\t\t$start_date = date('YmdHis', strtotime('-18 hourss', time()));\n\t}\n\telse if (EXECUTION_MODE !== 'LIVE') // local and rc time will be off, so...\n\t{\n\t\t$start_date = substr($start_date, 0, 8) . '000000';\n\t}\n\n\t$start_date = date('YmdHis', strtotime('-6 hours', strtotime($start_date)));\n\n\t$pid = Set_Process_Status($db, $company_id, 'populate_email_queue', 'started');\n\tECash::getLog()->Write(\"populate email queue [start:{$start_date}]\");\n\t$email_documents = eCash_Document_DeliveryAPI_Condor::Prpc()->Get_Incoming_Documents($start_date, NULL, NULL, TRUE, 'EMAIL');\n\n\tif(! is_array($email_documents))\n\t{\n\t\tSet_Process_Status($db, $company_id, 'populate_email_queue', 'failed', NULL, $pid);\n\t\treturn;\n\t}\t\t\n\n\tif(! empty($email_documents))\n\t{\n\t\tECash::getLog()->Write(\"Importing New Email Documents:\");\n\t\tECash::getLog()->Write(print_r($email_documents, true));\n\n\t\t$request = new stdClass();\n\t \t$eq = new Incoming_Email_Queue($server, $request);\n\n\t\tforeach ($email_documents as $email)\n\t\t{\n\t\t\t$eq->Add_To_Email_Queue($company_id, $email->archive_id, FALSE, $email->recipient, $email->sender);\n\t\t}\n\t}\n\n\tSet_Process_Status($db, $company_id, 'populate_email_queue', 'completed', NULL, $pid);\n\n}", "function viewSearchedJobs() {\n connectDatabase();\n\t\n $pk = mysql_real_escape_string($_GET['pk']);\n if (isset($_GET['start']))\n $start = $_GET['start'];\n else\n $start = 0;\n \n \n $result = queryDatabase(\"SELECT total, fk_job\n FROM search\n WHERE pk = $pk\");\n\n $row = mysql_fetch_object($result);\n \n $total = $row->total;\n \n if ($total > 0) {\n $results = (($start + 15) > $total) ? $total: ($start + 15);\n \n echo \"<div class=\\\"good\\\">Results \" . ($start + 1) . \"-$results of $total job(s) found</div><br />\";\n } else\n echo \"<div class=\\\"bad\\\">Your search did not match any jobs in our database</div><br />\";\n\n // fk_job parse\n if ($row->fk_job <> 'EMPTY') {\n $row->fk_job = explode(' ', $row->fk_job);\n \n $row->fk_job = array_slice($row->fk_job, $start, 15);\n \n if (count($row->fk_job) > 1) {\n $default = 1;\n \n foreach ($row->fk_job as $value) {\n if (!empty($value)) {\n if ($default == 1)\n $job_regexp = '[[:<:]]' . $value . '[[:>:]]';\n else\n $job_regexp .= '|[[:<:]]' . $value . '[[:>:]]';\n\n $default++;\n }\n }\n } elseif (count($row->fk_job) == 1)\n $job_regexp = '[[:<:]]' . $row->fk_job[0] . '[[:>:]]';\n\n $result = queryDatabase(\"SELECT pk, title, inserted, fk_location\n FROM job\n WHERE pk REGEXP '$job_regexp'\n ORDER BY pk DESC\");\n \n echo '<table cellspacing=\"0\" cellpadding=\"0\">';\n\n $default = 1;\n \n while ($row = mysql_fetch_object($result)) {\n $location = explodeFK($row->fk_location, 'location', 1);\n $row->inserted = substr($row->inserted, 5, 2) . \"/\" . substr($row->inserted, 8, 2) . \"/\" . substr($row->inserted, 0, 4);\n\n $backgroundColor = ($default%2) ? '#FFFACD': '#FFFFFF';\n \n $row->title = wordwrap($row->title, 30, \"\\n\", true);\n \n echo <<< END\n<tr>\n<td style=\"background-color:$backgroundColor; height:77px; text-align:left; vertical-align:top; width:280px;\">\n<strong>Title:</strong><br />\n<a href=\"javascript:popUp('detail.php?pk=$row->pk&apply=1')\">$row->title</a>\n</td>\n<td style=\"background-color:$backgroundColor; text-align:left; vertical-align:top; width:100px;\">\n<strong>Inserted:</strong><br />\n$row->inserted\n</td>\n<td style=\"background-color:$backgroundColor; text-align:left; vertical-align:top; width:245px;\">\n<strong>Location:</strong><br />\n$location\n</td>\n</tr>\nEND;\n\n $default++;\n }\n\n echo '</table>';\n \n if (($start - 15) >= 0) {\n $previous = $start - 15;\n echo \"<a href=\\\"./browse.php?pk=$pk&start=$previous\\\" alt=\\\"\\\">Previous 15 Jobs</a>&nbsp;&nbsp;&nbsp;\";\n }\n\n if (($start + 15) < $total) {\n $start += 15;\n $next = (($start + 15) <= $total) ? 15: ($total - $start);\n echo \"<a href=\\\"./browse.php?pk=$pk&start=$start\\\" alt=\\\"\\\">Next $next Job(s)</a>\";\n }\n \n }\n}", "function refreshDatabasePrintJobs($nfcid, $jobList) {\n\t// delete existing records about the print queue\n\t$deleteStmt = SQL::prepare('DELETE FROM printjobs WHERE nfcid=?');\n\t$deleteStmt->execute(array($_GET['nfcid']));\n\n\t$insertStmt = SQL::prepare('INSERT INTO printjobs SET nfcid=?, jobid=?, fileUrl=?');\n\tforeach ($jobList as $job) {\n\t\t// insert the print jobs into the database\n\t\t$insertStmt->execute(array($nfcid, $job['id'], $job['fileUrl']));\n\t}\n}", "public function action_index()\n\t{\n\t\t// Called every minute\n\t\tif ($this->modules['geocoded_addresses'])\n\t\t{\n\t\t\t$requests = Jelly::select('address_geocode_request')->where('status', '=', 'queued')->limit(10)->execute();\n\t\t\tforeach ($requests as $request)\n\t\t\t{\n\t\t\t\t$request->process();\n\t\t\t}\n\t\t}\n\t\texit();\n\t}", "function cron_jobs($offset, $limit, $phrase)\n\t{\n\t\tlog_message('debug', '_setting/cron_jobs');\n\t\tlog_message('debug', '_setting/cron_jobs:: [1] offset='.$offset.' limit='.$limit.' phrase='.$phrase);\n\n\t\t$values['phrase_condition'] = !empty($phrase)? \" AND S.activity_code LIKE '%\".htmlentities(str_replace(' ', '_', strtolower($phrase)), ENT_QUOTES).\"%'\": '';\n\t\t$values['limit_text'] = \" LIMIT \".$offset.\",\".$limit.\" \";\n\n\t\t$result = server_curl(CRON_SERVER_URL, array('__action'=>'get_list', 'query'=>'get_cron_job_list', 'variables'=>$values ));\n\t\tlog_message('debug', '_setting/cron_jobs:: [2] result='.json_encode($result));\n\n\t\treturn $result;\n\t}", "public function cron_action()\n\t{\n\n\t\t// process any recently updated inventory\n\t\t$this->inventory_batch();\n\t\t\n\t\t// process any recently shipped orders\n\t\t$this->shipping_batch();\n\n\t\t// process any recently processing orders\n\t\t$this->processing_batch();\n\n\t\t// process any product updates\n\t\t$this->product_batch(); \n\n\t\t// clean up any old records from the queues\n\t\t$this->cleanup();\n\t\texit('done');\n\n\t}", "public function execute() {\n $sql = \"SELECT gcj_id_job\n FROM gems__comm_jobs\n WHERE gcj_active = 1\n ORDER BY gcj_id_order, \n CASE WHEN gcj_id_survey IS NULL THEN 1 ELSE 0 END,\n CASE WHEN gcj_round_description IS NULL THEN 1 ELSE 0 END,\n CASE WHEN gcj_id_track IS NULL THEN 1 ELSE 0 END,\n CASE WHEN gcj_id_organization IS NULL THEN 1 ELSE 0 END\";\n\n $jobs = $this->db->fetchAll($sql);\n\n if ($jobs) {\n $batch = $this->getBatch();\n foreach ($jobs as $job) {\n $batch->addTask('Mail\\\\ExecuteMailJobTask', $job['gcj_id_job']);\n }\n } else {\n $this->getBatch()->addMessage($this->_('Nothing to do, please create a mail job first.'));\n }\n }", "public function run()\n {\n \\App\\ContactList::truncate();\n $phone_book = \\App\\ImportPhoneNumber::first();\n\n if ($phone_book) {\n $limit = 50000;\n\n for ($i = 0; $i < $limit; $i++) {\n $number = '88017'. $i . time();\n $number = substr($number, 0, 13);\n\n \\App\\ContactList::create([\n 'pid' => $phone_book->id,\n 'phone_number' => $number\n ]);\n }\n }\n\n }", "public function jobs(){\n\n \\Disco\\manage\\Manager::jobs();\n\n }", "public function run()\n {\n $file_pointer = base_path('resources/dataset/company.csv');\n $dataset = fopen($file_pointer, 'r');\n $iter = 0;\n while (($row = fgetcsv($dataset, 10000, ',')) != false){\n if($iter === 0) {\n $iter = +1;\n continue;\n }\n if(!$row[0] && !is_int($row[0])) {\n continue;\n }\n if(!$row[1] && !is_int($row[1])) {\n continue;\n }\n DB::table('companies')->insert(\n array(\n 'employee_id' => $row[1],\n 'name' => $row[2],\n 'employee_number' => $row[3],\n )\n );\n }\n }", "function search_job()\r\n{\r\n\tglobal $database, $url, $results_per_page, $p, $search_text, $t, $search_objects, $results, $total_results;\r\n \r\n /*\r\n\t// GET JOB FIELDS\r\n\t$jobfields = $database->database_query(\"SELECT jobfield_id, jobfield_type, jobfield_options FROM se_jobfields WHERE jobfield_type<>'5'\");\r\n\t$jobvalue_query = \"se_jobs.job_title LIKE '%$search_text%' OR se_jobs.job_body LIKE '%$search_text%'\";\r\n \r\n\t// LOOP OVER JOB FIELDS\r\n\twhile($jobfield_info = $database->database_fetch_assoc($jobfields)) {\r\n \r\n\t // TEXT FIELD OR TEXTAREA\r\n\t if($jobfield_info[jobfield_type] == 1 | $jobfield_info[jobfield_type] == 2) {\r\n\t if($jobvalue_query != \"\") { $jobvalue_query .= \" OR \"; }\r\n\t $jobvalue_query .= \"se_jobvalues.jobvalue_\".$jobfield_info[jobfield_id].\" LIKE '%$search_text%'\";\r\n\r\n\t // RADIO OR SELECT BOX\r\n\t } elseif($jobfield_info[jobfield_type] == 3 | $jobfield_info[jobfield_type] == 4) {\r\n\t // LOOP OVER FIELD OPTIONS\r\n\t $options = explode(\"<~!~>\", $jobfield_info[jobfield_options]);\r\n\t for($i=0,$max=count($options);$i<$max;$i++) {\r\n\t if(str_replace(\" \", \"\", $options[$i]) != \"\") {\r\n\t $option = explode(\"<!>\", $options[$i]);\r\n\t $option_id = $option[0];\r\n\t $option_label = $option[1];\r\n\t if(strpos($option_label, $search_text)) {\r\n\t if($jobvalue_query != \"\") { $jobvalue_query .= \" OR \"; }\r\n\t $jobvalue_query .= \"se_jobvalues.jobvalue_\".$jobfield_info[jobfield_id].\"='$option_id'\";\r\n\t }\r\n\t }\r\n\t }\r\n\t }\r\n\t}\r\n */\r\n \r\n /*\r\n $field = new se_field(\"job\");\r\n $text_columns = $field->field_index(TRUE);\r\n \r\n if( !is_array($text_columns) )\r\n $text_columns = array();\r\n */\r\n \r\n\t// CONSTRUCT QUERY\r\n $sql = \"\r\n SELECT\r\n se_jobs.job_id,\r\n se_jobs.job_title,\r\n se_jobs.job_body,\r\n se_jobs.job_photo,\r\n se_users.user_id,\r\n se_users.user_username,\r\n se_users.user_photo,\r\n se_users.user_fname,\r\n se_users.user_lname\r\n FROM\r\n se_jobs\r\n LEFT JOIN\r\n se_users\r\n ON se_jobs.job_user_id=se_users.user_id\r\n LEFT JOIN\r\n se_levels\r\n ON se_users.user_level_id=se_levels.level_id\r\n LEFT JOIN\r\n se_jobvalues\r\n ON se_jobs.job_id=se_jobvalues.jobvalue_job_id\r\n WHERE\r\n (se_jobs.job_search=1 || se_levels.level_job_search=0)\r\n \";\r\n \r\n /*\r\n $sql .= \" && (MATCH (`job_title`, `job_body`) AGAINST ('{$search_text}' IN BOOLEAN MODE)\";\r\n \r\n if( !empty($text_columns) )\r\n $sql .= \" || MATCH (`\".join(\"`, `\", $text_columns).\"`) AGAINST ('{$search_text}' IN BOOLEAN MODE)\";\r\n \r\n $sql .= \")\";\r\n */\r\n \r\n $text_columns[] = 'job_title';\r\n $text_columns[] = 'job_body';\r\n $sql .= \" && MATCH (`\".join(\"`, `\", $text_columns).\"`) AGAINST ('{$search_text}' IN BOOLEAN MODE)\";\r\n \r\n \r\n\t// GET TOTAL ENTRIES\r\n $sql2 = $sql . \" LIMIT 201\";\r\n $resource = $database->database_query($sql2) or die($database->database_error().\" <b>SQL was: </b>{$sql2}\");\r\n\t$total_entries = $database->database_num_rows($resource);\r\n\r\n\t// IF NOT TOTAL ONLY\r\n\tif( $t==\"job\" )\r\n {\r\n\t // MAKE JOB PAGES\r\n\t $start = ($p - 1) * $results_per_page;\r\n\t $limit = $results_per_page+1;\r\n \r\n\t // SEARCH JOBS\r\n $sql3 = $sql . \" ORDER BY job_id DESC LIMIT {$start}, {$limit}\";\r\n $resource = $database->database_query($sql3) or die($database->database_error().\" <b>SQL was: </b>{$sql3}\");\r\n \r\n\t while( $job_info=$database->database_fetch_assoc($resource) )\r\n {\r\n\t // CREATE AN OBJECT FOR AUTHOR\r\n\t $profile = new se_user();\r\n\t $profile->user_info['user_id'] = $job_info['user_id'];\r\n\t $profile->user_info['user_username'] = $job_info['user_username'];\r\n\t $profile->user_info['user_photo'] = $job_info['user_photo'];\r\n\t $profile->user_info['user_fname'] = $job_info['user_fname'];\r\n\t $profile->user_info['user_lname'] = $job_info['user_lname'];\r\n\t $profile->user_displayname();\r\n \r\n\t // IF EMPTY TITLE\r\n\t if( !trim($job_info['job_title']) )\r\n $job_info['job_title'] = SE_Language::get(589);\r\n \r\n $job_info['job_body'] = cleanHTML($job_info['job_body'], '');\r\n \r\n\t // IF BODY IS LONG\r\n\t if( strlen($job_info['job_body'])>150 )\r\n $job_info['job_body'] = substr($job_info['job_body'], 0, 147).\"...\";\r\n \r\n\t // SET THUMBNAIL, IF AVAILABLE\r\n $thumb_path = NULL;\r\n if( !empty($job_info['job_photo']) )\r\n {\r\n $job_dir = se_job::job_dir($job_info['job_id']);\r\n $job_photo = $job_info['job_photo'];\r\n $job_thumb = substr($job_photo, 0, strrpos($job_photo, \".\")).\"_thumb\".substr($job_photo, strrpos($job_photo, \".\"));\r\n \r\n if( file_exists($job_dir.$job_thumb) )\r\n $thumb_path = $job_dir.$job_thumb;\r\n elseif( file_exists($job_dir.$job_photo) )\r\n $thumb_path = $job_dir.$job_photo;\r\n }\r\n \r\n if( !$thumb_path )\r\n $thumb_path = \"./images/icons/file_big.gif\";\r\n \r\n \r\n $result_url = $url->url_create('job', $job_info['user_username'], $job_info['job_id']);\r\n $result_name = 6400137;\r\n $result_desc = 6400138;\r\n \r\n \r\n\t $results[] = array(\r\n 'result_url' => $result_url,\r\n\t\t\t\t'result_icon' => $thumb_path,\r\n\t\t\t\t'result_name' => $result_name,\r\n\t\t\t\t'result_name_1' => $job_info['job_title'],\r\n\t\t\t\t'result_desc' => $result_desc,\r\n\t\t\t\t'result_desc_1' => $url->url_create('profile', $job_info['user_username']),\r\n\t\t\t\t'result_desc_2' => $profile->user_displayname,\r\n\t\t\t\t'result_desc_3' => $job_info['job_body']\r\n );\r\n \r\n unset($profile);\r\n\t }\r\n \r\n\t // SET TOTAL RESULTS\r\n\t $total_results = $total_entries;\r\n\t}\r\n\r\n\t// SET ARRAY VALUES\r\n\tSE_Language::_preload_multi(6400137, 6400138, 6400139);\r\n\tif( $total_entries>200 )\r\n $total_entries = \"200+\";\r\n \r\n\t$search_objects[] = array(\r\n 'search_type' => 'job',\r\n 'search_lang' => 6400139,\r\n 'search_total' => $total_entries\r\n );\r\n}", "public function run()\n {\n $json = json_decode(file_get_contents('https://core.tadbirrlc.com//StocksHandler.ashx?{%22Type%22:%22ALL21%22,%22Lan%22:%22Fa%22}&jsoncallback='), true);\n\n foreach ($json as $item) {\n DB::table('companies')\n ->insert([\n 'symbol' => $item['sf'],\n 'name' => $item['cn'],\n 'id_code' => $item['ic'],\n 'company_12_digit_name' => $item['nc'],\n 'category_id' => $item['sc']\n ]);\n }\n }", "public function index() {\n $params2 = array(\n 'conditions' => array(\n 'title' => 'Senior Developer',\n 'location' => '10018',\n 'query' => \"Wordpress\",\n 'miles' => 5,\n ),\n 'order' => array(\n 'last_seen_date' => 'DESC',\n ),\n 'limit' => 3,\n 'page' => 1,\n //'fields' => array('job_key', 'title')\n );\n $jobs2 = $this->Simplyhired->find('count', $params2);\n debug($jobs2);\n\n $jobs2 = $this->Simplyhired->find('first', $params2);\n debug($jobs2);\n\n $jobs2 = $this->Simplyhired->find('all', $params2);\n debug($jobs2);\n exit;\n }", "function findOnCraigslist($state = \"Oregon\",$jsonManufacturers = null,$ignoreWords=array(),$cityDepth=null,$depthOverride=true){\n $cityCounter = 0;\n $itemFoundCounter = 0;\n $foundItems = array();\n //Use the Scraper Web API and pull the results in JSON format\n $jsonData = file_get_contents(\"https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=jsondict&name=craigslist_cities_1&query=select%20*%20from%20%60swdata%60%20WHERE%20state%20%3D%20'\".$state.\"'\");\n $jsonCraigCities = json_decode($jsonData);\n //$jsonItemManufacturerData = file_get_contents($manufacturerScraperURL.\"%20WHERE%20manufacturer%20%3D%20'\".$itemManufacturer.\"'\");\n //$jsonItemsFromManufacturer = json_decode($jsonItemManufacturerData);\n //echo \"There are \".count($jsonItemsFromManufacturer).\" \".$itemManufacturer.\" items in the system.\\n\";\n $foundURLS = array(); \n if(!empty($jsonData)){\n foreach($jsonCraigCities as $city){\n $itemCounter = 0;\n echo \"-> Parsing link: \".$city->link.\"\\n\";\n //Search each city for each item for a certain item manufacturer in the vintage item database.\n if($cityCounter < $cityDepth || $depthOverride == true || $cityDepth == 0){\n foreach($jsonManufacturers as $item){\n //Example musical instrument search string http://portland.craigslist.org/search/msg?query=korg+microkorg&srchType=A&minAsk=5&maxAsk=&hasPic=1 \n if(!empty($item)){\n $itemName = urlencode(trim($item->name));\n if(!empty($itemName)){ \n $tManName = preg_replace(\"/\\s/\",\"_\",$item->manufacturer);//Build a temp name for the array key\n $itemManufacturer = urlencode($item->manufacturer);\n $search_string = '\"'.strtolower($itemManufacturer).\"+\".$itemName.'\"';\n //$search_string = urlencode($search_string);\n $search_string2 = urlencode($itemName);\n //\"%7C\" = | (This establishes Craiglist's OR search.)\n if(!empty($search_string) && !empty($search_string2)){\n $search_url = $city->link.\"/search/msg?query=\".$search_string.\"+%7C+\".$search_string2.\"&srchType=T&minAsk=5&maxAsk=&hasPic=1\";//Title only and has image\n echo \"--> Scraping: \".$search_url.\"\\n\";\n $html = scraperWiki::scrape($search_url); \n $dom = new simple_html_dom();\n $dom->load($html); //Load the HTML \n foreach($dom->find(\"p.row\") as $item){\n $itemLink = $item->find('a',0); //Find the second link (not the image link)\n if(!empty($itemLink->href)){\n $itemName = $itemLink->innertext;\n $itemName = preg_replace('/\\s-/','',$itemName);\n $itemName = trim($itemName);\n //Check the name against the ignore words\n $addItem = 1;\n foreach($ignoreWords as $word){\n //Make sure that the itemName doesn't include a word to ignore\n if(strpos(strtolower($itemName),strtolower($word))===false){\n //Do something\n }else{\n $addItem = 0;\n }\n }\n //Check to make sure that the item link matches the search city link. \n $searchCity = preg_match(\"@http://([a-z]*+)\\.@\",$city->link,$cityMatches);\n $searchCity = trim($cityMatches[1]);\n $itemCity = preg_match(\"@http://([a-z]*+)\\.@\",$itemLink->href,$itemCityMatches);\n $itemCity = trim($itemCityMatches[1]);\n //echo \"Search city: \".$searchCity.\"\\n\";\n //echo \"Item city: \".$itemCity.\"\\n\";\n if($itemCity != $searchCity){\n $addItem = 0;\n }\n if($addItem == 1 && in_array($itemLink->href,$foundURLS) == 0){\n echo $itemName.\"\\n\";\n $itemInfo = $item->plaintext;\n $itemInfo = explode('$',$itemInfo);\n $itemPrice = \"$\".trim($itemInfo[1]);\n $itemInfo = $itemInfo[0];\n $itemInfo = explode('-',$itemInfo);\n $itemInfo = preg_replace('/&nbsp;/','',$itemInfo);\n $foundItems[$itemFoundCounter]['manufacturer'] = $itemManufacturer;\n $foundItems[$itemFoundCounter]['name'] = $itemName;\n $foundItems[$itemFoundCounter]['post_item_name'] = $itemName;\n //Find the date and price\n if(!empty($itemInfo)){\n if(isset($itemInfo[0])){\n $itemDate = trim($itemInfo[0]);\n $itemDate = preg_replace('/\\s\\s+/',' ',$itemDate); //Strip excess whitespace\n //Change date string\n $itemDateArray = explode(\" \",$itemDate);\n $monthNumVal = getMonthNum($itemDateArray[0]); //ex Nov\n $curYear = date(\"Y\");\n $itemDate = $curYear.\"-\".$monthNumVal.\"-\".$itemDateArray[1];\n echo \"Date posted: \".$itemDate.\"\\n\";\n $foundItems[$itemFoundCounter]['post_item_date'] = $itemDate;\n }else{\n $foundItems[$itemFoundCounter]['post_item_date'] = \"\";\n }\n if(isset($itemPrice)){\n $itemPrice = trim($itemPrice);\n $itemPrice = preg_replace('/\\(.*\\)/','',$itemPrice);\n $itemPrice = preg_replace('/[a-z]+|[A-Z]+/','',$itemPrice);\n $itemPrice = trim($itemPrice);\n echo \"Price: \".$itemPrice.\"\\n\";\n //Only add the price if a dollar sign exists\n if($itemPrice[0] == \"$\"){\n $foundItems[$itemFoundCounter]['post_item_price'] = $itemPrice;\n }else{\n $foundItems[$itemFoundCounter]['post_item_price'] = \"$\".$itemPrice;\n }\n }else{\n $foundItems[$itemFoundCounter]['post_item_price'] = \"\";\n }\n }else{\n $foundItems[$itemFoundCounter]['post_item_date'] = \"\";\n $foundItems[$itemFoundCounter]['post_item_price'] = \"\";\n }\n $foundURLS[] = $itemLink->href; //Add the url to keep track and make sure that only unique URLs are added.\n $foundItems[$itemFoundCounter]['post_item_link'] = $city->link;\n $foundItems[$itemFoundCounter]['post_item_state'] = $city->state;\n $foundItems[$itemFoundCounter]['query'] = $search_string.\"+%7C+\".$search_string2;\n $foundItems[$itemFoundCounter]['link'] = $itemLink->href;\n //Find the page details on the page\n $craigSynthItemPage = scraperWiki::scrape($itemLink->href); \n $craigSynthItemPageDOM = new simple_html_dom();\n $craigSynthItemPageDOM->load($craigSynthItemPage); //Load the HTML\n if(!empty($craigSynthItemPageDOM)){\n $craigSynthItemDesc = $craigSynthItemPageDOM->find(\"div#userbody\",0);\n //print_r($craigSynthItemDesc);\n if(!empty($craigSynthItemDesc)) $craigSynthItemDesc = $craigSynthItemDesc->plaintext;\n $craigSynthItemBlurb = $craigSynthItemPageDOM->find(\"div#userbody] ul.blurbs\",0);\n if(!empty($craigSynthItemBlurb)) $craigSynthItemBlurb = $craigSynthItemBlurb->plaintext;\n $craigSynthItemDesc = str_replace($craigSynthItemBlurb,\"\",$craigSynthItemDesc);\n $postImages = array();\n foreach($craigSynthItemPageDOM->find(\"table[summary='craigslist hosted images'] tbody tr\") as $imageGroup){\n if(!empty($imageGroup)){\n $image = $imageGroup->find(\"img\",0);\n if(!empty($image)){\n $postImages[] = $image->src;\n }\n }\n }\n //print_r($postImages);\n $postImageStr = implode(\",\",$postImages);\n //echo $postImageStr;\n $craigSynthItemDesc = preg_replace(\"/(\\r|\\n|\\r\\n){2,}/\",\"\",$craigSynthItemDesc);\n $craigSynthItemDesc = preg_replace('/[^(\\x20-\\x7F)]*/','', $craigSynthItemDesc); //Remove non-ASCII characters\n echo $craigSynthItemDesc;\n if(!empty($postImageStr)){\n $foundItems[$itemFoundCounter]['post_item_images'] = $postImageStr;\n }else{\n $foundItems[$itemFoundCounter]['post_item_images'] = \"\";\n }\n if(!empty($craigSynthItemDesc)){\n $foundItems[$itemFoundCounter]['post_item_description'] = $craigSynthItemDesc;\n }else{\n $foundItems[$itemFoundCounter]['post_item_description'] = \"\";\n }\n }\n $itemFoundCounter++;\n }else{\n //Do something if the item wasn't added\n }\n }else{\n //Do something if the link is empty\n }\n }\n }\n }else{\n break;\n }\n $itemCounter++; \n }\n }\n }else{\n break;\n }\n $cityCounter++;\n }\n }else{\n echo \"There were no results found for \".$state.\".\";\n }\n \n return $foundItems;\n}", "function findOnCraigslist($state = \"Oregon\",$jsonManufacturers = null,$ignoreWords=array(),$cityDepth=null,$depthOverride=true){\n $cityCounter = 0;\n $itemFoundCounter = 0;\n $foundItems = array();\n //Use the Scraper Web API and pull the results in JSON format\n $jsonData = file_get_contents(\"https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=jsondict&name=craigslist_cities_1&query=select%20*%20from%20%60swdata%60%20WHERE%20state%20%3D%20'\".$state.\"'\");\n $jsonCraigCities = json_decode($jsonData);\n //$jsonItemManufacturerData = file_get_contents($manufacturerScraperURL.\"%20WHERE%20manufacturer%20%3D%20'\".$itemManufacturer.\"'\");\n //$jsonItemsFromManufacturer = json_decode($jsonItemManufacturerData);\n //echo \"There are \".count($jsonItemsFromManufacturer).\" \".$itemManufacturer.\" items in the system.\\n\";\n $foundURLS = array(); \n if(!empty($jsonData)){\n foreach($jsonCraigCities as $city){\n $itemCounter = 0;\n echo \"-> Parsing link: \".$city->link.\"\\n\";\n //Search each city for each item for a certain item manufacturer in the vintage item database.\n if($cityCounter < $cityDepth || $depthOverride == true || $cityDepth == 0){\n foreach($jsonManufacturers as $item){\n //Example musical instrument search string http://portland.craigslist.org/search/msg?query=korg+microkorg&srchType=A&minAsk=5&maxAsk=&hasPic=1 \n if(!empty($item)){\n $itemName = urlencode(trim($item->name));\n if(!empty($itemName)){ \n $tManName = preg_replace(\"/\\s/\",\"_\",$item->manufacturer);//Build a temp name for the array key\n $itemManufacturer = urlencode($item->manufacturer);\n $search_string = '\"'.strtolower($itemManufacturer).\"+\".$itemName.'\"';\n //$search_string = urlencode($search_string);\n $search_string2 = urlencode($itemName);\n //\"%7C\" = | (This establishes Craiglist's OR search.)\n if(!empty($search_string) && !empty($search_string2)){\n $search_url = $city->link.\"/search/msg?query=\".$search_string.\"+%7C+\".$search_string2.\"&srchType=T&minAsk=5&maxAsk=&hasPic=1\";//Title only and has image\n echo \"--> Scraping: \".$search_url.\"\\n\";\n $html = scraperWiki::scrape($search_url); \n $dom = new simple_html_dom();\n $dom->load($html); //Load the HTML \n foreach($dom->find(\"p.row\") as $item){\n $itemLink = $item->find('a',0); //Find the second link (not the image link)\n if(!empty($itemLink->href)){\n $itemName = $itemLink->innertext;\n $itemName = preg_replace('/\\s-/','',$itemName);\n $itemName = trim($itemName);\n //Check the name against the ignore words\n $addItem = 1;\n foreach($ignoreWords as $word){\n //Make sure that the itemName doesn't include a word to ignore\n if(strpos(strtolower($itemName),strtolower($word))===false){\n //Do something\n }else{\n $addItem = 0;\n }\n }\n //Check to make sure that the item link matches the search city link. \n $searchCity = preg_match(\"@http://([a-z]*+)\\.@\",$city->link,$cityMatches);\n $searchCity = trim($cityMatches[1]);\n $itemCity = preg_match(\"@http://([a-z]*+)\\.@\",$itemLink->href,$itemCityMatches);\n $itemCity = trim($itemCityMatches[1]);\n //echo \"Search city: \".$searchCity.\"\\n\";\n //echo \"Item city: \".$itemCity.\"\\n\";\n if($itemCity != $searchCity){\n $addItem = 0;\n }\n if($addItem == 1 && in_array($itemLink->href,$foundURLS) == 0){\n echo $itemName.\"\\n\";\n $itemInfo = $item->plaintext;\n $itemInfo = explode('$',$itemInfo);\n $itemPrice = \"$\".trim($itemInfo[1]);\n $itemInfo = $itemInfo[0];\n $itemInfo = explode('-',$itemInfo);\n $itemInfo = preg_replace('/&nbsp;/','',$itemInfo);\n $foundItems[$itemFoundCounter]['manufacturer'] = $itemManufacturer;\n $foundItems[$itemFoundCounter]['name'] = $itemName;\n $foundItems[$itemFoundCounter]['post_item_name'] = $itemName;\n //Find the date and price\n if(!empty($itemInfo)){\n if(isset($itemInfo[0])){\n $itemDate = trim($itemInfo[0]);\n $itemDate = preg_replace('/\\s\\s+/',' ',$itemDate); //Strip excess whitespace\n //Change date string\n $itemDateArray = explode(\" \",$itemDate);\n $monthNumVal = getMonthNum($itemDateArray[0]); //ex Nov\n $curYear = date(\"Y\");\n $itemDate = $curYear.\"-\".$monthNumVal.\"-\".$itemDateArray[1];\n echo \"Date posted: \".$itemDate.\"\\n\";\n $foundItems[$itemFoundCounter]['post_item_date'] = $itemDate;\n }else{\n $foundItems[$itemFoundCounter]['post_item_date'] = \"\";\n }\n if(isset($itemPrice)){\n $itemPrice = trim($itemPrice);\n $itemPrice = preg_replace('/\\(.*\\)/','',$itemPrice);\n $itemPrice = preg_replace('/[a-z]+|[A-Z]+/','',$itemPrice);\n $itemPrice = trim($itemPrice);\n echo \"Price: \".$itemPrice.\"\\n\";\n //Only add the price if a dollar sign exists\n if($itemPrice[0] == \"$\"){\n $foundItems[$itemFoundCounter]['post_item_price'] = $itemPrice;\n }else{\n $foundItems[$itemFoundCounter]['post_item_price'] = \"$\".$itemPrice;\n }\n }else{\n $foundItems[$itemFoundCounter]['post_item_price'] = \"\";\n }\n }else{\n $foundItems[$itemFoundCounter]['post_item_date'] = \"\";\n $foundItems[$itemFoundCounter]['post_item_price'] = \"\";\n }\n $foundURLS[] = $itemLink->href; //Add the url to keep track and make sure that only unique URLs are added.\n $foundItems[$itemFoundCounter]['post_item_link'] = $city->link;\n $foundItems[$itemFoundCounter]['post_item_state'] = $city->state;\n $foundItems[$itemFoundCounter]['query'] = $search_string.\"+%7C+\".$search_string2;\n $foundItems[$itemFoundCounter]['link'] = $itemLink->href;\n //Find the page details on the page\n $craigSynthItemPage = scraperWiki::scrape($itemLink->href); \n $craigSynthItemPageDOM = new simple_html_dom();\n $craigSynthItemPageDOM->load($craigSynthItemPage); //Load the HTML\n if(!empty($craigSynthItemPageDOM)){\n $craigSynthItemDesc = $craigSynthItemPageDOM->find(\"div#userbody\",0);\n //print_r($craigSynthItemDesc);\n if(!empty($craigSynthItemDesc)) $craigSynthItemDesc = $craigSynthItemDesc->plaintext;\n $craigSynthItemBlurb = $craigSynthItemPageDOM->find(\"div#userbody] ul.blurbs\",0);\n if(!empty($craigSynthItemBlurb)) $craigSynthItemBlurb = $craigSynthItemBlurb->plaintext;\n $craigSynthItemDesc = str_replace($craigSynthItemBlurb,\"\",$craigSynthItemDesc);\n $postImages = array();\n foreach($craigSynthItemPageDOM->find(\"table[summary='craigslist hosted images'] tbody tr\") as $imageGroup){\n if(!empty($imageGroup)){\n $image = $imageGroup->find(\"img\",0);\n if(!empty($image)){\n $postImages[] = $image->src;\n }\n }\n }\n //print_r($postImages);\n $postImageStr = implode(\",\",$postImages);\n //echo $postImageStr;\n $craigSynthItemDesc = preg_replace(\"/(\\r|\\n|\\r\\n){2,}/\",\"\",$craigSynthItemDesc);\n $craigSynthItemDesc = preg_replace('/[^(\\x20-\\x7F)]*/','', $craigSynthItemDesc); //Remove non-ASCII characters\n echo $craigSynthItemDesc;\n if(!empty($postImageStr)){\n $foundItems[$itemFoundCounter]['post_item_images'] = $postImageStr;\n }else{\n $foundItems[$itemFoundCounter]['post_item_images'] = \"\";\n }\n if(!empty($craigSynthItemDesc)){\n $foundItems[$itemFoundCounter]['post_item_description'] = $craigSynthItemDesc;\n }else{\n $foundItems[$itemFoundCounter]['post_item_description'] = \"\";\n }\n }\n $itemFoundCounter++;\n }else{\n //Do something if the item wasn't added\n }\n }else{\n //Do something if the link is empty\n }\n }\n }\n }else{\n break;\n }\n $itemCounter++; \n }\n }\n }else{\n break;\n }\n $cityCounter++;\n }\n }else{\n echo \"There were no results found for \".$state.\".\";\n }\n \n return $foundItems;\n}", "public function run()\n {\n $name_jobs = [\n ['name_job' => 'ADMINISTRADOR DE REDES Y SERVIDORES'],\n ['name_job' => 'ANALISTA DE MESA DE AYUDA'],\n ['name_job' => 'ANALISTA DE RECURSOS HUMANOS'],\n ['name_job' => 'ANALISTA DE SOPORTE DE PRIMER NIVEL'],\n ['name_job' => 'COORDINADOR DE SERVICIOS INFORMATICOS'],\n ['name_job' => 'ESPECIALISTA DE SOPORTE DE TERCER NIVEL'],\n ['name_job' => 'GERENTE DE PRE VENTA'],\n ['name_job' => 'GESTOR DE CENTRO DE SERVICIOS'],\n ['name_job' => 'INGENIERO POST VENTA'],\n ['name_job' => 'JEFE DE CENTRO DE SERVICIO'],\n ['name_job' => 'JEFE DE PROYECTO'],\n ['name_job' => 'PRACTICANTE TI'],\n ['name_job' => 'PROGRAMADOR'],\n ['name_job' => 'SOPORTE TECNICO DE SEGUNDO NIVEL'],\n ['name_job' => 'SUPERVISOR DE SOPORTE TECNICO DE PRIMER NIVEL'],\n ['name_job' => 'SUPERVISOR DE SOPORTE TECNICO DE SEGUNDO NIVEL'],\n ['name_job' => 'TECNICO SENIOR']\n ];\n\n DB::table('users_jobs')->insert($name_jobs);\n }", "public function getAllJobPostings()\n {\n $conn = new DBConnect();\n $dbObj = $conn->getDBConnect();\n $this->DAO = new JobDAO($dbObj);\n return $this->DAO->getAllJobs();\n }", "function local_campusconnect_cron() {\n $ecslist = ecssettings::list_ecs();\n foreach ($ecslist as $ecsid => $name) {\n $ecssettings = new ecssettings($ecsid);\n\n if ($ecssettings->time_for_cron()) {\n mtrace(\"Checking for updates on ECS server '\".$ecssettings->get_name().\"'\");\n $connect = new connect($ecssettings);\n $queue = new receivequeue();\n\n try {\n $queue->update_from_ecs($connect);\n $queue->process_queue($ecssettings);\n } catch (connect_exception $e) {\n local_campusconnect_ecs_error_notification($ecssettings, $e->getMessage());\n }\n\n mtrace(\"Sending updates to ECS server '\".$ecssettings->get_name().\"'\");\n try {\n export::update_ecs($connect);\n course_url::update_ecs($connect);\n enrolment::update_ecs($connect);\n } catch (connect_exception $e) {\n local_campusconnect_ecs_error_notification($ecssettings, $e->getMessage());\n }\n\n $cms = participantsettings::get_cms_participant();\n if ($cms && $cms->get_ecs_id() == $ecssettings->get_id()) {\n // If we are updating from the ECS with the CMS attached, then check the directory mappings (and sort order).\n directorytree::check_all_mappings();\n }\n\n mtrace(\"Emailing any necessary notifications for '\".$ecssettings->get_name().\"'\");\n notification::send_notifications($ecssettings);\n\n $ecssettings->update_last_cron();\n }\n }\n}", "public function run()\n {\n DB::table('jobs')->insert([\n [\n 'job_id' => 1,\n 'job_name' => 'ASN/Honorer',\n ],\n [\n 'job_id' => 2,\n 'job_name' => 'Swasta/Karyawan',\n ],\n [\n 'job_id' => 3,\n 'job_name' => 'Wirausaha/Wiraswasta',\n ],\n ]);\n }", "function action_runjobs() {\n global $CFG;\n\n //need the code that defines the scheduled export behaviour\n require_once($CFG->dirroot . '/blocks/php_report/runschedule.php');\n\n $scheduleids = array();\n if ($data = data_submitted()) {\n foreach ($data as $key => $value) {\n if (strpos($key, 'schedule_') === 0) {\n $scheduleid = (int)substr($key, strlen('schedule_'));\n if ($this->can_do_schedule_action($scheduleid)) {\n $scheduleids[] = $scheduleid;\n }\n }\n }\n }\n\n //re-display the list of scheduled jobs for this report\n $this->action_listinstancejobs();\n\n if (count($scheduleids) > 0) {\n //include the necessary javascript libraries for the ASYNC request stuff\n require_js(array('yui_yahoo', 'yui_event'));\n\n //one or more schedules selected, so open the popup to run them\n echo '<script type=\"text/javascript\">\n YAHOO.util.Event.onDOMReady(function() {\n openpopup(\\'/blocks/php_report/lib/run_schedule_popup.php?scheduleids=' . urlencode(json_encode($scheduleids)) . '\\', \\'runjobsnow\\', \\'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\\', 0);\n });\n </script>';\n }\n }", "public function run()\n {\n \t\t$companies = [\n [\n 'company_name' => 'Your Company',\n 'type' => '',\n 'telephone' => '(000) 000-000',\n 'email' => 'info@your-company.com',\n 'website' => 'www.your-company.com',\n 'image_url' => 'logo-placeholder.png',\n 'is_enable' => 0,\n 'created_by' => 1,\n ],\n\n ];\n \n foreach ($companies as $item)\n DB::table('companies')->insert($item);\n }", "public function execute()\n {\n $date = (new \\DateTime('-1 week'))->format(DateTime::DATETIME_PHP_FORMAT);\n $jobs = $this->collectionFactory->create()\n ->addFieldToFilter('scheduled_at', [\n 'or' => [\n ['date' => true, 'to' => $date],\n ['null' => true],\n ]\n ])\n ->addFieldToFilter('created_at', [\n ['date' => true, 'to' => $date]\n ])\n ->setOrder('created_at', 'ASC')\n ->setPageSize(250);\n\n $itemsToRemove = $jobs->count() - 50;\n\n foreach ($jobs as $job) {\n if ($itemsToRemove-- < 0) {\n break;\n }\n\n $job->delete();\n }\n }" ]
[ "0.5537103", "0.54606855", "0.5449546", "0.54228944", "0.5410553", "0.5278324", "0.5236165", "0.52066", "0.5195223", "0.5177203", "0.5169428", "0.5155695", "0.50330484", "0.5013517", "0.50096905", "0.49978343", "0.49911544", "0.4990376", "0.49754736", "0.4973946", "0.4946123", "0.49458846", "0.49458846", "0.49443197", "0.49438933", "0.49342427", "0.49027938", "0.48860556", "0.48818126", "0.4875198" ]
0.5626864
0
/ Gather all information related to a given year for a person training status & location (if any) radio eligibility meals & shower privileges
public static function findForPersonYear($personId, $year) { $info = new PersonEventInfo(); $info->person_id = $personId; $info->year = $year; $requireTraining = PersonPosition::findTrainingPositions($personId); $info->trainings = []; if ($requireTraining->isEmpty()) { $requireTraining = [Position::find(Position::TRAINING)]; } foreach ($requireTraining as $position) { $info->trainings[] = Training::retrieveEducation($personId, $position, $year); } usort($info->trainings, function ($a, $b) { return strcmp($a->position_title, $b->position_title); }); $radio = RadioEligible::findForPersonYear($personId, $year); $info->radio_info_available = setting('RadioInfoAvailable'); $info->radio_max = $radio ? $radio->max_radios : 0; $info->radio_eligible = $info->radio_max > 0 ? true : false; $bmid = Bmid::findForPersonYear($personId, $year); if ($bmid) { $info->meals = $bmid->meals; $info->showers = $bmid->showers; } else { $info->meals = ''; $info->showers = false; } if (current_year() == $year && !setting('MealInfoAvailable')) { $info->meals = 'no-info'; } $ot = PersonOnlineTraining::findForPersonYear($personId, $year); if ($ot) { $info->online_training_passed = true; $info->online_training_date = (string)$ot->completed_at; } else { $info->online_training_passed = false; } $info->vehicles = Vehicle::findForPersonYear($personId, $year); $event = PersonEvent::findForPersonYear($personId, $year); if ($event) { $info->may_request_stickers = $event->may_request_stickers; $info->org_vehicle_insurance = $event->org_vehicle_insurance; $info->signed_motorpool_agreement = $event->signed_motorpool_agreement; } else { $info->may_request_stickers = false; $info->org_vehicle_insurance = false; $info->signed_motorpool_agreement = false; } return $info; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function horoscopeInformation(){\n $horoscope_years = [\n 'Rat' => [\n \"years\" => [2008, 1996, 1984, 1972, 1960, 1948, 1936, 1924],\n \"info\" =>\n 'The Rat is known as a friend for life. You find it difficult to give yourself completely, \n but once you are used to it, you do not let go. You are perfectionistic and sometimes you\n can become a little aggressive if something does not work.\n Properties: charming, sweet, confident, straightforward, possessive.'\n\n ],\n 'Os' => [\n \"years\" => [2009, 1997, 1985, 1973, 1961, 1949, 1937, 1925],\n 'info' =>\n 'De Os is a go-getter. You can quickly condemn someone and often see things black or white.\n If you have a bad mood, others can better stay away from you.\n Characteristics: patient, attentive, inquisitive, overconfident, critical.'\n ,\n ]\n ,\n 'Tiger' => [\n 'years' => [2010, 1998, 1986, 1974, 1962, 1950, 1938, 1926],\n 'info' =>\n 'The Tiger is often a leader. You are adventurous and do not mind going somewhere alone.\n You are sometimes impulsive and direct and can occasionally be possessive.\n Characteristics: very sweet, adventurous, hasty, reckless and passionate.'\n ,\n ],\n 'Rabbit' => [\n 'years' => [2011, 1999, 1987, 1975, 1963, 1951, 1939, 1927],\n 'info' =>\n 'The Rabbit is sometimes difficult to understand. You are sensitive \n and loved by friends and family. You have a good memory and \n are inclined to run away from problems.Properties: very sensitive,\n intelligent, a little affected, modest and tactful.'\n ,\n ],\n 'Dragon' => [\n 'years' => [2012, 2000, 1988, 1976, 1964, 1952, 1940, 1928],\n 'info' =>\n 'The Dragon is right at his turn. You often do first before you think.\n You are protective and confident, but always want confirmation\n that your partner loves you.\n Features: enthusiastic, demanding, energetic and emotional.'\n ,\n ],\n 'Snake' => [\n 'years' => [2013, 2001, 1989, 1977, 1965, 1953, 1941, 1929],\n 'info' =>\n 'The snake is mysterious. You find it difficult to show your feelings, but \n you want love and attention. In addition, you continue until your goal is reached.\n Features: helpful, orderly, fickle, funny and a bad loser.'\n ,\n ],\n 'Horse' => [\n 'years' => [2014, 2002, 1990, 1978, 1966, 1954, 1942, 1930],\n 'info' =>\n 'The Horse is solution-oriented. You are loyal but not good at keeping secrets. \n You would like to know everything, but if it sometimes gets too difficult,\n you will get rid of it.\n Characteristics: hard worker, demanding, talented, moody, lively.'\n ,\n ],\n 'Goat' => [\n 'years' => [2015, 2003, 1991, 1979, 1967, 1955, 1943, 1931],\n 'info' =>\n 'The Sheep is a natural person. You are creative, perfectionist and can sometimes\n be very insecure. You can not handle pressure well and want to be protected.\n Features: creative, romantic, helpful, pessimistic, honest.'\n ,\n ],\n 'Monkey' => [\n 'years' => [2016, 2004, 1992, 1980, 1968, 1956, 1944, 1932],\n 'info' =>\n 'The Monkey is interested in the interest. You are often happy and always talk.\n You like challenges and do not think in problems, but in solutions.\n Characteristics: sympathetic, loyal, creative, insecure, irritable.'\n ,\n ],\n 'Haan' => [\n 'years' => [2017, 2005, 1993, 1981, 1969, 1957, 1945, 1933],\n 'info' =>\n 'Rooster is direct and says what it says. You love clothes and your hairstyle \n and spend a lot of time and money on this. You want to come for the day.\n Characteristics: frank, courageous, fussy, vain, charming.'\n ,\n ],\n 'Dog' => [\n 'years' => [2018, 2006, 1994, 1982, 1970, 1958, 1946, 1934],\n 'info' =>\n 'The Dog wants to have the last word. You find it difficult to agree with someone \n and you like to complain. You like being in your own home and family is important to you.\n You attract a lot of how others feel.\n Characteristics: loyal, patient, enthusiastic, inflexible, anxious.'\n ,\n ],\n 'Pig' => [\n 'years' => [2019, 2007, 1995, 1983, 1971, 1959, 1947, 1935],\n 'info' =>\n 'The Pig is reliable. You like luxury and can therefore be a bit spoiled.\n You are happy and have a big heart. Sometimes you believe things too quickly.\n Characteristics: very sensible, well-meaning, hospitable, passionate and defensive.'\n ,\n ]\n ];\n\n return $horoscope_years;\n }", "public function showClassesAcademicYearWise()\n {\n if ($this->checkEmpty()) return json_encode(array(\"error\" => \"empty\"));\n $this->acd_year = $this->verifyInput($_POST['acd_id']);\n $this->faculty_id = isset($_POST['faculty_id']) ? $this->verifyInput($_POST['faculty_id']) : $_SESSION['faculty_id'];\n $this->dept = isset($_POST['dept_id']) ? $this->verifyInput($_POST['dept_id']) : $_SESSION['dept'];\n $result = $this->getClassByDeptAndAcademicYear([ $this->dept, $this->acd_year]);\n if (!$result) return json_encode(array(\"error\" => \"notfound\"));\n if (isset($result['e'])) return json_encode(array(\"error\" => \"Server Error!\"));\n return json_encode(array(\"error\" => \"none\", \"data\" => $result));\n }", "public static function retrieveRadioEligilibity($currentYear)\n {\n $lastYear = $currentYear-1;\n $prevYear = $currentYear-2;\n\n $people = DB::select(\"SELECT person.id, person.callsign,\n (SELECT SUM(TIMESTAMPDIFF(second, on_duty, off_duty))/3600.0 FROM timesheet WHERE person.id=timesheet.person_id AND year(on_duty)=$lastYear AND position_id NOT IN (1,13)) as hours_last_year,\n (SELECT SUM(TIMESTAMPDIFF(second, on_duty, off_duty))/3600.0 FROM timesheet WHERE person.id=timesheet.person_id AND year(on_duty)=$prevYear AND position_id NOT IN (1,13)) as hours_prev_year,\n EXISTS (SELECT 1 FROM person_position WHERE person_position.person_id=person.id AND person_position.position_id IN (10,12) LIMIT 1) AS shift_lead,\n EXISTS (SELECT 1 FROM person_slot JOIN slot ON person_slot.slot_id=slot.id AND YEAR(slot.begins)=$currentYear AND slot.begins >= '$currentYear-08-15 00:00:00' AND position_id NOT IN (1,13) WHERE person_slot.person_id=person.id LIMIT 1) as signed_up\n FROM person WHERE person.status IN ('active', 'inactive', 'inactive extension', 'retired')\n ORDER by callsign\");\n\n // Person must have worked in one of the previous two years, or is a shift lead\n $people = array_values(array_filter($people, function ($p) {\n return $p->hours_prev_year || $p->hours_last_year || $p->shift_lead;\n }));\n\n foreach ($people as $person) {\n // Normalized the hours - no timesheets found in a given years will result in null\n if (!$person->hours_last_year) {\n $person->hours_last_year = 0.0;\n }\n $person->hours_last_year = round($person->hours_last_year, 2);\n\n if (!$person->hours_prev_year) {\n $person->hours_prev_year = 0.0;\n }\n $person->hours_prev_year = round($person->hours_prev_year, 2);\n\n // Qualified radio hours is last year, OR the previous year if last year\n // was less than 10 hours and the previous year was greater than last year.\n $person->radio_hours = $person->hours_last_year;\n if ($person->hours_last_year < 10.0 && ($person->hours_prev_year > $person->hours_last_year)) {\n $person->radio_hours = $person->hours_prev_year;\n }\n }\n\n return $people;\n }", "public function getResAppByStatusAndYear($status,$resSubspecArg,$year=null,$interviewer=null) {\n\n $userServiceUtil = $this->container->get('user_service_utility');\n $resappUtil = $this->container->get('resapp_util');\n\n //echo \"year=$year<br>\";\n //process.py script: replaced namespace by ::class: ['AppResAppBundle:ResidencyApplication'] by [ResidencyApplication::class]\n $repository = $this->em->getRepository(ResidencyApplication::class);\n $dql = $repository->createQueryBuilder(\"resapp\");\n $dql->select('resapp');\n $dql->leftJoin(\"resapp.appStatus\", \"appStatus\");\n\n if( $status ) {\n if (strpos((string)$status, \"-\") !== false) {\n $statusArr = explode(\"-\", $status);\n $statusStr = $statusArr[0];\n $statusNot = $statusArr[1];\n if ($statusNot && $statusNot == 'not') {\n //'interviewee-not' is dummy status which is all statuses but not\n $dql->where(\"appStatus.name != '\" . $statusStr . \"'\");\n }\n } else {\n $dql->where(\"appStatus.name = '\" . $status . \"'\");\n }\n }\n\n if( $resSubspecArg ) {\n $dql->leftJoin(\"resapp.residencyTrack\",\"residencyTrack\");\n if( is_array($resSubspecArg) ) {\n $restypeArr = array();\n foreach( $resSubspecArg as $residencyTypeID => $residencyTypeName ) {\n $restypeArr[] = \"residencyTrack.id = \".$residencyTypeID;\n }\n $dql->andWhere( implode(\" OR \", $restypeArr) );\n } else {\n $dql->andWhere(\"residencyTrack.id=\".$resSubspecArg);\n }\n }\n\n //application Season Start Year ($applicationSeasonStartDate)\n if( $year ) {\n //echo \"year=$year<br>\";\n if( strpos((string)$year, \",\" ) !== false) {\n //multiple years\n $yearArr = explode(\",\",$year);\n $criterions = array();\n foreach($yearArr as $singleYear) {\n //$bottomDate = $singleYear.\"-01-01\";\n //$topDate = $singleYear.\"-12-31\";\n //$startEndDates = $userServiceUtil->getAcademicYearStartEndDates($singleYear);\n //$startEndDates = $resappUtil->getAcademicYearStartEndDates($singleYear);\n //$bottomDate = $startEndDates['startDate'];\n //$topDate = $startEndDates['endDate'];\n ////startDate - Residency Start Year\n //$criterions[] = \"(\".\"resapp.startDate BETWEEN '\" . $bottomDate . \"'\" . \" AND \" . \"'\" . $topDate . \"'\".\")\";\n\n $startEndDates = $resappUtil->getResAppAcademicYearStartEndDates($singleYear);\n $bottomDate = $startEndDates['Season Start Date'];\n $topDate = $startEndDates['Season End Date'];\n //echo \"bottomDate=$bottomDate, topDate=$topDate <br>\";\n ////applicationSeasonStartDate - Application Season Start Year\n $criterions[] = \"(\".\"resapp.applicationSeasonStartDate BETWEEN '\" . $bottomDate . \"'\" . \" AND \" . \"'\" . $topDate . \"'\".\")\";\n }\n $criterionStr = implode(\" OR \",$criterions);\n $dql->andWhere($criterionStr);\n } else {\n //single year\n //$bottomDate = $year.\"-01-01\";\n //$topDate = $year.\"-12-31\";\n //$startEndDates = $resappUtil->getAcademicYearStartEndDates($year);\n //$bottomDate = $startEndDates['startDate'];\n //$topDate = $startEndDates['endDate'];\n //echo \"get AcademicYearStartEndDates: single year: bottomDate=$bottomDate, topDate=$topDate <br>\";\n ////startDate - Residency Start Year\n //$dql->andWhere(\"resapp.startDate BETWEEN '\" . $bottomDate . \"'\" . \" AND \" . \"'\" . $topDate . \"'\");\n\n $startEndDates = $resappUtil->getResAppAcademicYearStartEndDates($year);\n $bottomDate = $startEndDates['Season Start Date'];\n $topDate = $startEndDates['Season End Date'];\n //echo \"get ResAppAcademicYearStartEndDates: single year: bottomDate=$bottomDate, topDate=$topDate <br>\";\n ////applicationSeasonStartDate - Application Season Start Year\n $dql->andWhere(\"resapp.applicationSeasonStartDate BETWEEN '\" . $bottomDate . \"'\" . \" AND \" . \"'\" . $topDate . \"'\");\n }\n }\n\n if( $interviewer ) {\n $dql->leftJoin(\"resapp.interviews\", \"interviews\");\n $dql->leftJoin(\"interviews.interviewer\", \"interviewer\");\n $dql->andWhere(\"interviewer.id=\".$interviewer->getId());\n }\n\n $dql->orderBy(\"resapp.id\",\"ASC\");\n \n //echo \"dql=\".$dql.\"<br>\";\n\n $query = $dql->getQuery();\n $applicants = $query->getResult();\n \n// echo \"applicants=\".count($applicants).\"<br>\";\n// if( $status == 'active' ) {\n// foreach ($applicants as $resapp) {\n// echo \"ID \" . $resapp->getId() .\n// \"; startDate=\" . $resapp->getStartDate()->format('Y-m-d') .\n// \"; status=\" . $resapp->getAppStatus()->getName() .\n// \"; type=\" . $resapp->getResidencyTrack()->getName() .\n// \"<br>\";\n// }\n// }\n\n return $applicants;\n }", "public function GetHEIFollowUpNational($year, $estatus, $col=\"enrollment_status\", $division='county', $monthly=true)\n\t{\n\t\t$date_range = BaseModel::date_range($year);\n\n\t\t$data = SampleSynchView::selectRaw($division . \", COUNT(DISTINCT patient_id) as totals, month(datetested) as month\")\n\t\t->where('result', 2)\n\t\t->whereBetween('datetested', $date_range)\n\t\t->whereBetween('age', [0.0001, 24])\n\t\t->whereIn('pcrtype', [1, 2, 3])\n\t\t->where($col, $estatus)\n\t\t->where('flag', 1)\n\t\t->where('repeatt', 0)\n\t\t->when(true, function($query) use ($col){\n\t\t\tif($col == \"enrollment_status\"){\n\t\t\t\treturn $query->where('hei_validation', 1);\n\t\t\t}\t\t\t\n\t\t})\n\t\t->when($division, function($query) use ($monthly, $division){\n\t\t\tif($monthly){\n\t\t\t\treturn $query->groupBy('month', $division);\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn $query->groupBy($division);\n\t\t\t}\t\t\t\n\t\t})\n\t\t->get(); \n\n\t\treturn $data;\n\t}", "public function getTrainingList2($dept, $month, $year, $status)\n {\n $this->db->select(\"th_ref_id,\n th_training_title,\n to_char(th_date_from, 'dd/mm/yyyy') th_date_from2,\n to_char(th_date_to, 'dd/mm/yyyy') th_date_to2,\n th_training_fee\n \");\n $this->db->from(\"ims_hris.training_head\");\n\n if(!empty($dept)) {\n $this->db->where(\"th_dept_code\", $dept);\n }\n\n if(!empty($month)) {\n $this->db->where(\"COALESCE(TO_CHAR(th_date_from,'MM'),'') = '$month'\");\n }\n\n if(!empty($year)) {\n $this->db->where(\"COALESCE(TO_CHAR(th_date_from,'YYYY'),'') = '$year'\");\n }\n\n // if(!empty($year) && !empty($month)) {\n // $this->db->where(\"COALESCE(TO_CHAR(TH_DATE_FROM,'MM/YYYY'),'') = '$month/$year'\");\n // }\n\n if(!empty($status)) {\n $this->db->where(\"COALESCE(th_status, 'ENTRY') = '$status'\");\n }\n \n $this->db->where(\"th_internal_external = 'EXTERNAL_AGENCY'\");\n $this->db->order_by(\"th_date_from, th_date_to, th_training_title, th_ref_id\");\n $q = $this->db->get();\n \n return $q->result_case('UPPER');\n }", "public static function sanityChecker($year)\n {\n $withBase = [ 'position:id,title', 'person:id,callsign' ];\n\n $rows = self::whereYear('on_duty', $year)\n ->whereNull('off_duty')\n ->with($withBase)\n ->get()\n ->sortBy('person.callsign')\n ->values();\n\n $onDutyEntries = $rows->map(function ($row) {\n return [\n 'person' => [\n 'id' => $row->person_id,\n 'callsign' => $row->person ? $row->person->callsign : 'Person #'.$row->person_id,\n ],\n 'callsign' => $row->person ? $row->person->callsign : 'Person #'.$row->person_id,\n 'on_duty' => (string) $row->on_duty,\n 'duration' => $row->duration,\n 'credits' => $row->credits,\n 'position' => [\n 'id' => $row->position_id,\n 'title' => $row->position ? $row->position->title : 'Position #'.$row->position_id,\n ]\n ];\n })->values();\n\n $rows = self::whereYear('on_duty', $year)\n ->whereRaw('on_duty > off_duty')\n ->whereNotNull('off_duty')\n ->with($withBase)\n ->get()\n ->sortBy('person.callsign')\n ->values();\n\n /*\n * Do any entries have the end time before the start time?\n * (should never happen..famous last words)\n */\n\n $endBeforeStartEntries = $rows->map(function ($row) {\n return [\n 'person' => [\n 'id' => $row->person_id,\n 'callsign' => $row->person ? $row->person->callsign : 'Person #'.$row->person_id,\n ],\n 'on_duty' => (string) $row->on_duty,\n 'off_duty' => (string) $row->off_duty,\n 'duration' => $row->duration,\n 'position' => [\n 'id' => $row->position_id,\n 'title' => $row->position ? $row->position->title : 'Position #'.$row->position_id,\n ]\n ];\n });\n\n /*\n * Look for overlapping entries\n */\n\n $people = self::whereYear('on_duty', $year)\n ->whereNotNull('off_duty')\n ->with($withBase)\n ->orderBy('person_id')\n ->orderBy('on_duty')\n ->get()\n ->groupBy('person_id');\n\n $overlappingPeople = [];\n foreach ($people as $personId => $entries) {\n $overlapping = [];\n\n $prevEntry = null;\n foreach ($entries as $entry) {\n if ($prevEntry) {\n if ($entry->on_duty->timestamp < ($prevEntry->on_duty->timestamp + $prevEntry->duration)) {\n $overlapping[] = [\n [\n 'timesheet_id' => $prevEntry->id,\n 'position' => [\n 'id' => $prevEntry->position_id,\n 'title' => $prevEntry->position ? $prevEntry->position->title : 'Position #'.$prevEntry->position_id,\n ],\n 'on_duty' => (string) $prevEntry->on_duty,\n 'off_duty' => (string) $prevEntry->off_duty,\n 'duration' => $prevEntry->duration,\n ],\n [\n 'timesheet_id' => $entry->id,\n 'position' => [\n 'id' => $entry->position_id,\n 'title' => $entry->position ? $entry->position->title : 'Position #'.$entry->position_id,\n ],\n 'on_duty' => (string) $entry->on_duty,\n 'off_duty' => (string) $entry->off_duty,\n 'duration' => $entry->duration,\n ]\n ];\n }\n }\n $prevEntry = $entry;\n }\n\n if (!empty($overlapping)) {\n $first = $entries[0];\n $overlappingPeople[] = [\n 'person' => [\n 'id' => $first->person_id,\n 'callsign' => $first->person ? $first->person->callsign : 'Person #'.$first->person_id\n ],\n 'entries' => $overlapping\n ];\n }\n }\n\n usort($overlappingPeople, function ($a, $b) {\n return strcasecmp($a['person']['callsign'], $b['person']['callsign']);\n });\n\n $minHour = 24;\n foreach (Position::PROBLEM_HOURS as $positionId => $hours) {\n if ($hours < $minHour) {\n $minHour = $hours;\n }\n }\n\n $now = now();\n $rows = self:: select('timesheet.*', DB::raw(\"TIMESTAMPDIFF(SECOND, on_duty, IFNULL(off_duty,'$now')) as duration\"))\n ->whereYear('on_duty', $year)\n ->whereRaw(\"TIMESTAMPDIFF(HOUR, on_duty, IFNULL(off_duty,'$now')) >= $minHour\")\n ->with($withBase)\n ->orderBy('duration', 'desc')\n ->get();\n\n /*\n * Look for entries that may be too long. (i.e. a person forgot to signout in a timely manner.)\n */\n\n $tooLongEntries = $rows->filter(function ($row) {\n if (!isset(Position::PROBLEM_HOURS[$row->position_id])) {\n return true;\n }\n\n return Position::PROBLEM_HOURS[$row->position_id] < ($row->duration / 3600.0);\n })->values()->map(function ($row) {\n return [\n 'person' => [\n 'id' => $row->person_id,\n 'callsign' => $row->person ? $row->person->callsign : 'Person #'.$row->person_id,\n ],\n 'on_duty' => (string) $row->on_duty,\n 'off_duty' => (string) $row->off_duty,\n 'duration' => $row->duration,\n 'position' => [\n 'id' => $row->position_id,\n 'title' => $row->position ? $row->position->title : 'Position #'.$row->position_id,\n ]\n ];\n });\n\n return [\n 'on_duty' => $onDutyEntries,\n 'end_before_start' => $endBeforeStartEntries,\n 'overlapping' => $overlappingPeople,\n 'too_long' => $tooLongEntries\n ];\n }", "public function getstudent($txtStartDate,$txtEndDate,$txtSubject,$txtYear)\n\t{\n\t\tif($txtYear==\"1st\"){\n\t\t\t$this->db->where('payment_admission', 1);\n\t\t\t// $this->db->where('gen_type', $txtSubject);\n\t\t\t$this->db->where('gen_type', $txtSubject);\n\t\t\t$this->db->where('admission_payment_date >=', $txtStartDate);\n\t\t\t$this->db->where('admission_payment_date <=', $txtEndDate);\n\t\t\t$this->db->where('trsnfer_flag', 0);\n\t\t\t$this->db->where('cancel', 0);\n\t\t\t$this->db->order_by('college_roll', 'asc');\n\t\t\t$query=$this->db->get('admission_erp');\n\t\t\treturn $query->result();\n\t\t}\n\t\telse{\n\t\t\t$this->db->where('sub_honours', $txtSubject);\n\t\t\t$this->db->where('pay_status_part2', 1);\n\t\t\t$this->db->where('payment_date_2 >=', $txtStartDate);\n\t\t\t$this->db->where('payment_date_2 <=', $txtEndDate);\n\t\t\t$this->db->where('trsnfer_flag', 0);\n\t\t\t$this->db->where('cancel_flag', 0);\n\t\t\t$query=$this->db->get('student_dtl');\n\t\t\treturn $query->result();\n\t\t}\n\t}", "public static function retrieveAllForYearByCallsign($year)\n {\n $rows = self::whereYear('on_duty', $year)\n ->with([ 'person:id,callsign,status', 'position:id,title,type,count_hours' ])\n ->orderBy('on_duty')\n ->get();\n\n if (!$rows->isEmpty()) {\n PositionCredit::warmYearCache($year, array_unique($rows->pluck('position_id')->toArray()));\n }\n\n $personGroups = $rows->groupBy('person_id');\n\n return $personGroups->map(function ($group) {\n $person = $group[0]->person;\n\n return [\n 'id' => $group[0]->person_id,\n 'callsign' => $person ? $person->callsign : \"Person #\".$group[0]->person_id,\n 'status' => $person ? $person->status : 'deleted',\n\n 'total_credits' => $group->pluck('credits')->sum(),\n 'total_duration' => $group->pluck('duration')->sum(),\n 'total_appreciation_duration' => $group->filter(function ($t) {\n return $t->position ? $t->position->count_hours : false;\n })->pluck('duration')->sum(),\n\n 'timesheet' => $group->map(function ($t) {\n return [\n 'on_duty' => (string) $t->on_duty,\n 'off_duty' => (string) $t->off_duty,\n 'duration' => $t->duration,\n 'credits' => $t->credits,\n 'position' => [\n 'id' => $t->position_id,\n 'title' => $t->position ? $t->position->title : \"Position #\".$t->position_id,\n 'count_hours' => $t->position ? $t->position->count_hours : 0,\n ]\n ];\n })->values()\n ];\n })->sortBy('callsign', SORT_NATURAL|SORT_FLAG_CASE)->values();\n }", "public function get_student_by_form_name($form_number,$year)\n\t{\n\t\tif($year==\"1st\"){\n\t\t\t$this->db->where('form_no', $form_number);\n\t\t\t$query=$this->db->get('admission_erp');\n\t\t\treturn $query->result_array();\n\t\t}\n\t\telse{\n\t\t\t$this->db->where('addmission_no', $form_number);\n\t\t\t$query=$this->db->get('student_dtl');\n\t\t\treturn $query->result_array();\n\t\t}\t\n\t}", "function preview() {\n\n\t\t\n\t\t// determine this year\n\t\t$now = new DateTime();\n\t\t$thisYear = (int) ($now->format(\"Y\"));\n\n\t\t// get selected year\n\t\t$selectedYear = $this->request->query('selectedYear');\n\t\tif (is_null($selectedYear)) $selectedYear = $thisYear;\n\t\t$nextYear = $selectedYear + 1;\n\n\t\t// get first payment year\n\t\t$firstYear = $this->Department->Project->getFirstProjectYear();\n\n\t\t// get departments\n\t\t$departmentsList = $this->Department->findOrderedList();\n\n\n\t\t// BUILD UP SUMMARY DATA for this year and next\n\n\t\t// THIS YEAR\n\t\t//\n\t\t// get annual contract budgets\n\t\t$contractbudgetsThisYear = $this->Department->Project->Contract->Contractbudget->getContractBudgets($selectedYear);\n\n\t\t// get department budgets for this year\n\t\t$departmentBudgetsThisYear = $this->Department->Departmentbudget->getDepartmentBudgetsList($selectedYear);\n\n\t\t// get department unrestricted allocations for this year\n\t\t$departmentUnrestrictedAllocationThisYear = $this->Department->Departmentbudget->getDepartmentUnrestrictedAllocationsList($selectedYear);\n\n\t\t// NEXT YEAR\n\t\t//\n\t\t// get annual contract budgets\n\t\t$contractbudgetsNextYear = $this->Department->Project->Contract->Contractbudget->getContractBudgets($nextYear);\n\n\t\t// get department budgets for this year\n\t\t$departmentBudgetsNextYear = $this->Department->Departmentbudget->getDepartmentBudgetsList($nextYear);\n\n\t\t// get department unrestricted allocations for next year\n\t\t$departmentUnrestrictedAllocationNextYear = $this->Department->Departmentbudget->getDepartmentUnrestrictedAllocationsList($selectedYear);\n\n\n\t\t// BUILD UP DEPARTMENT-LEVEL DATA\n\t\t$departmentsDetailAnnual = [];\n\t\tforeach ($departmentsList as $department_id => $name) {\n\n\t\t\t$departmentDetailAnnual = array(\n\t\t\t\t'department' => $this->Department->findSimpleById($department_id),\n\t\t\t\t'projects' => $this->Department->Project->getProjectsByDepartmentAndYear($department_id, array($selectedYear, $nextYear)),\n\t\t\t\t'departmentBudgetThisYear' => $departmentBudgetsThisYear[$department_id],\n\t\t\t\t'departmentBudgetNextYear' => $departmentBudgetsNextYear[$department_id],\n\t\t\t\t'departmentUnrestrictedAllocationThisYear' => $departmentUnrestrictedAllocationThisYear[$department_id],\n\t\t\t\t'departmentUnrestrictedAllocationNextYear' => $departmentUnrestrictedAllocationNextYear[$department_id],\n\t\t\t);\n\n\t\t\t$departmentsDetailAnnual[$department_id] = $departmentDetailAnnual;\n\n\t\t}\n\n\n\t\t$this->set(compact(\n\n\t\t\t'departmentsList',\n\t\t\t'firstYear',\n\t\t\t'thisYear',\n\t\t\t'selectedYear',\n\t\t\t'nextYear',\n\t\t\t\n\t\t\t// Summary data\n\t\t\t'departmentBudgetsThisYear',\n\t\t\t'departmentBudgetsNextYear',\n\t\t\t'departmentUnrestrictedAllocationThisYear',\n\t\t\t'departmentUnrestrictedAllocationNextYear',\n\t\t\t'contractbudgetsThisYear',\n\t\t\t'contractbudgetsNextYear',\n\n\t\t\t// department-level\n\t\t\t'departmentsDetailAnnual'\n\t\t\t\n\t\t ));\n\n\t}", "public function Search_Document($type,$course_id,$teacher_id)\n {\n if($teacher_id != null)\n {\n $check_access = $this->Check_Access($teacher_id,$course_id);\n }\n else\n {\n $check_access = null;\n }\n if($type =='special')\n {\n $check_access = true;\n $sql = \"SELECT DISTINCT si.`instructor_id`,`firstname`,`lastname`,s.`semester_num`,s.`year` FROM `special_instructor` si,`course_hire_special_instructor` ci, `semester` s\n WHERE ci.`course_id` = '\".$course_id.\"' AND ci.`instructor_id` = si.`instructor_id` AND ci.`semester_id` = s.`semester_id` ORDER BY `ci`.`updated_date` DESC\" ;\n }\n else if ($type == 'evaluate')\n {\n $sql = \"SELECT `semester_num`,`year` FROM `course_evaluate` e,`semester` s\n WHERE e.`course_id` = '\".$course_id.\"' AND e.`semester_id` = s.`semester_id` ORDER BY e.`updated_date` DESC\" ;\n }\n $data = array();\n \n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n if($type == 'special')\n {\n $data['DATA'][$i]['id'] = $result[$i]['instructor_id'];\n $data['DATA'][$i]['name'] = $result[$i]['firstname'].' '.$result[$i]['lastname'];\n }\n $data['DATA'][$i]['semester'] = $result[$i]['semester_num'];\n $data['DATA'][$i]['year'] = $result[$i]['year'];\n }\n }\n else\n {\n $data['DATA'] = false;\n }\n $data['ACCESS'] = $check_access;\n $data['INFO'] = $this->Get_Course_Info($course_id);\n $dept = $this->Search_Course_Dept($course_id,$this->SEMESTER['id']);\n if($dept)\n {\n $data['INFO']['department'] = $dept['id'];\n\n }\n $sql = \"SELECT sum(se.`student`) as num_student FROM `course_evaluate` ce, `student_evaluate` se \";\n $sql .= \"WHERE ce.`course_evaluate_id` = se.`course_evaluate_id` AND ce.`course_id` = '\".$course_id.\"' AND ce.`semester_id` = '\".$this->SEMESTER['id'].\"'\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n\n if(is_null($result[0]['num_student']))\n {\n $data['INFO']['num_student'] = '0';\n }\n else\n {\n $data['INFO']['num_student'] = $result[0]['num_student'];\n }\n }\n //id,name,semester,year\n return $data;\n }", "public function getTrainingList4($dept, $month, $year)\n {\n $this->db->select(\"th_ref_id,\n th_training_title,\n to_char(th_date_from, 'dd/mm/yyyy') th_date_from2,\n to_char(th_date_to, 'dd/mm/yyyy') th_date_to2,\n th_training_fee\n \");\n $this->db->from(\"ims_hris.training_head\");\n\n if(!empty($dept)) {\n $this->db->where(\"th_dept_code\", $dept);\n }\n\n if(!empty($month)) {\n $this->db->where(\"COALESCE(TO_CHAR(th_date_from,'MM'),'') = '$month'\");\n }\n\n if (!empty($year)) {\n $this->db->where(\"COALESCE(TO_CHAR(th_date_from,'YYYY'),'') = '$year'\");\n }\n \n $this->db->where(\"COALESCE(th_status, 'ENTRY') = 'APPROVE'\");\n $this->db->where(\"th_internal_external = 'EXTERNAL_AGENCY'\");\n $this->db->order_by(\"th_date_from, th_date_to, th_training_title, th_ref_id\");\n $q = $this->db->get();\n \n return $q->result_case('UPPER');\n }", "function recommends_req_wizard_schools_info($form, &$form_state) {\n // access the form hierarchically.\n $form['#tree'] = TRUE;\n\n $form['schreq'] = array(\n '#type' => 'fieldset',\n '#title' => variable_get('recommends_req_student_professor'),\n );\n $form['schreq']['description'] = array(\n '#type' => 'item',\n '#title' => t('Enter each school which is to receive the recommendation.'),\n );\n\n if (empty($form_state['num_schools'])) {\n $form_state['num_schools'] = 1;\n }\n\n // Build the number of name fieldsets indicated by $form_state['num_schools']\n for ($i = 1; $i <= $form_state['num_schools']; $i++) {\n $form['schname'][$i] = array(\n '#type' => 'fieldset',\n '#title' => t('School #@num', array('@num' => $i)),\n '#collapsible' => TRUE,\n '#collapsed' => FALSE,\n );\n\n $form['schname'][$i]['schoolname'] = array(\n '#type' => 'textfield',\n '#title' => t('School/Business'),\n '#size' => 25,\n '#maxlength' => 50,\n '#required' => TRUE,\n '#default_value' => !empty($form_state['values']['schoolname']) ? $form_state['values']['schoolname'] : '',\n\n );\n $form['schname'][$i]['schoolprogram'] = array(\n '#type' => 'textfield',\n '#title' => t('School Program/Position'),\n '#size' => 25,\n '#maxlength' => 50,\n '#description' => '<br/><b>Note: </b>If you have any special forms required by the school, email hard copy to <br/>via the \"Email Professor\" link or mail a soft copy to the professor. ',\n '#default_value' => !empty($form_state['values']['schoolname']) ? $form_state['values']['schoolname'] : '',\n\n );\n \n // School contact information.\n $form['schname'][$i]['school_contact_info'] = array(\n '#type' => 'checkboxes',\n '#options' => drupal_map_assoc(array(t('Contact Email'), t('Contact Postal Address'))),\n '#title' => t('School contact information, if known'),\n // This #states rule says that this checkboxes array will be visible only\n // when $form['student_type'] is set to t('High School').\n // It uses the jQuery selector :input[name=student_type] to choose the\n // element which triggers the behavior, and then defines the \"High School\"\n // value as the one that triggers visibility.\n\n \n );\n\n $form['schname'][$i]['school_contact_email'] = array(\n '#type' => 'textfield',\n '#title' => t('School email:'),\n '#size' => 25,\n\n // This #states rule limits visibility to when the $form['tests_taken']\n // 'school_contact_email' checkbox is checked.\"\n '#states' => array(\n 'visible' => array( // action to take.\n ':input[name=\"schname[' . $i . '][school_contact_info][Contact Email]\"]' => array('checked' => TRUE),\n ),\n ),\n );\n $form['schname'][$i]['school_contact_postal'] = array(\n '#type' => 'textarea',\n '#title' => t('Contact Postal address:'),\n '#size' => 4,\n\n // Set this element visible if the postal checkbox above is checked.\n '#states' => array(\n 'visible' => array( // action to take.\n ':input[name=\"schname[' . $i . '][school_contact_info][Contact Postal Address]\"]' => array('checked' => TRUE),\n ),\n ),\n );\n \n $form['schname'][$i]['r_date_due'] = array(\n '#type' => 'date',\n '#title' => t('Last Date due'),\n '#required' => TRUE,\n '#size' => 10,\n \n );\n \n }\n\n // Adds \"Add another school\" button\n $form['add_school'] = array(\n '#type' => 'submit',\n '#value' => t('Add another school'),\n '#submit' => array('recommends_req_schtut_9_add_school'),\n );\n\n // If we have more than one school, this button allows removal of the\n // last name.\n if ($form_state['num_schools'] > 1) {\n $form['remove_school'] = array(\n '#type' => 'submit',\n '#value' => t('Remove latest school'),\n '#submit' => array('recommends_req_schtut_9_remove_school'),\n // Since we are removing a name, don't validate until later.\n '#limit_validation_errors' => array(),\n );\n }\n\n return $form;\n}", "public function yearProvider()\n {\n return array(\n // year = 1\n array('11111111111111111', array(2001, 2031)),\n // year = K\n array('1M8GDM9AXKP042788', array(1989, 2019)),\n // year = 3\n array('5GZCZ43D13S812715', array(2003, 2033)),\n // invalid year\n array('5GZCZ43D1US812715', array())\n );\n }", "public function getLecturerByMajor($major){\n $client = new Client();\n \n $majorID = $major == 'D3'? '57401' : '55301';\n $page = 1; $nameCollection = []; $userIDCollection = []; $gIDCollection = []; $imageCollection = [];\n $link = 'https://sinta.ristekbrin.go.id/departments/detail?page=1&afil=413&id='.$majorID.'&view=authors&sort=year2';\n $crawler = $client->request('GET', $link );\n \n // Get total amount written in sinta web\n $infoAmount = $crawler->filter('.uk-table > caption')->text();\n $pieces = explode(' ', $infoAmount);\n $sintaAmountLecturerTI = array_pop($pieces);\n \n do {\n $link = 'https://sinta.ristekbrin.go.id/departments/detail?page='.$page.'&afil=413&id='.$majorID.'&view=authors&sort=year2';\n $crawler = $client->request('GET', $link );\n \n // Scrape name\n $crawler->filter('.uk-description-list-line > dt > a')->each(function($node) use (&$nameCollection){\n array_push($nameCollection,$node->text());\n });\n \n // Scrape profile picture\n $crawler->filter('.author-photo-small')->each(function($node) use (&$imageCollection){\n array_push($imageCollection,$node->attr('src'));\n });\n \n // Scrape Sinta user ID\n $crawler->filter('.uk-description-list-line > dt > a')->each(function($node) use (&$userIDCollection){\n // Get only the user id from the link\n preg_match('/id=(.*)&view/', $node->attr('href'), $matches);\n $extractedUserID = $matches[1];\n \n array_push($userIDCollection,$extractedUserID);\n });\n \n // Scrape gscholar ID\n $crawler->filter('.author-photo-small')->each(function($node) use (&$gIDCollection){\n // Get only the user id from the link\n preg_match('/user=(.*)&citpid/', $node->attr('src'), $matches);\n $extractedID = $matches[1];\n \n array_push($gIDCollection,$extractedID);\n });\n \n $page++;\n } while (count($nameCollection) < $sintaAmountLecturerTI);\n \n for ($i=0; $i < count($nameCollection); $i++) { \n $collection[$i]['name'] = $nameCollection[$i];\n $collection[$i]['image'] = $imageCollection[$i];\n $collection[$i]['userID'] = $userIDCollection[$i];\n $collection[$i]['gscholarID'] = $gIDCollection[$i];\n }\n \n return $collection;\n }", "private function inclusionByYearByTypeEssai()\n {\n $em = $this->getDoctrine()->getManager();\n\n $inclusionByYearByTypeEssai = $em->getRepository(Inclusion::class)\n ->createQueryBuilder('i')\n ->select(' count(i) as nb, YEAR(i.datInc) AS year, e.typeEssai as type')\n ->join('i.essai', 'e')\n ->where('i.datInc IS NOT NULL')\n ->groupBy('year, type')\n ->orderBy('year')\n ->getQuery()\n ->getResult();\n\n $data = [];\n $years = [];\n $essais = [];\n foreach ($inclusionByYearByTypeEssai as $resp) {\n if (empty($data[$resp['year']][$resp['type']]))\n $data[$resp['year']][$resp['type']] = 0;\n $data[$resp['year']][$resp['type']] += $resp['nb'];\n $years[] = $resp['year'];\n $essais[] = $resp['type'];\n }\n $years = array_unique($years);\n $essais = array_unique($essais);\n sort($years);\n sort($essais);\n foreach ($data as $year => $v) {\n $total = 0;\n foreach ($v as $nb) {\n $total += $nb;\n }\n foreach ($v as $name => $nb) {\n $data[$year][$name] = $data[$year][$name] / $total * 100;\n }\n }\n\n $data_by_type = [];\n foreach ($years as $year) {\n foreach ($essais as $v) {\n if (empty($data[$year][$v]))\n $data_by_type[$v][] = 0;\n else\n $data_by_type[$v][] = $data[$year][$v];\n }\n }\n\n return [\"years\" => $years, \"data\" => $data_by_type];\n }", "public function ARTClinicNewlyMalesAllAges() {\r\n $query = \"SELECT TOP 1 [code_year_quarter].[year] AS [year],\r\n [code_year_quarter].[quarter] AS [quarter],\r\n CONCAT ([code_year_quarter].[year], ' Q',[code_year_quarter].[quarter]) AS [year_quarter],\r\n [code_hdepartment].[hfacility_id] AS [facility_id],\r\n [code_hfacility].[hfacility_name] AS [facility_name],\r\n (SELECT CONCAT ('Newly - ', [concept].[concept_name]) FROM [dbo].[concept] WHERE [concept].[ID] = [obs].[data_element]) AS [concept_name],\r\n (CAST([obs].[data_value] AS INT)) AS [newly_registered] \r\n FROM [dbo].[obs_dimensions] \r\n LEFT JOIN [dbo].[obs] ON [obs].[obs_dimensions_ID] = [obs_dimensions].[ID] \r\n LEFT JOIN [dbo].[art_clinic_obs] ON [art_clinic_obs].[ID] = [obs_dimensions].[art_clinic_obs_id] \r\n LEFT JOIN [dbo].[code_hdepartment] ON [code_hdepartment].[ID] = [art_clinic_obs].[hdepartment_id]\r\n LEFT JOIN [dbo].[code_year_quarter] ON [code_year_quarter].[ID] = [art_clinic_obs].[year_quarter_id]\r\n LEFT JOIN [dbo].[code_hfacility] ON [code_hfacility].[ID] = [code_hdepartment].[hfacility_id]\r\n\t\t WHERE \r\n [sub_group] = 398\r\n AND [period_report] = 393\r\n AND [obs].[data_element] = 14\r\n AND [art_clinic_obs].[year_quarter_id] = :year_quarter_id\r\n AND [code_hdepartment].[hfacility_id] = :health_facility_id\r\n AND [code_hdepartment].[hservice] = 294\";\r\n //Prepare query statement\r\n $stmt = $this->conn->prepare($query);\r\n //Bind values\r\n $stmt->bindParam(':year_quarter_id', $this->year_quarter);\r\n $stmt->bindParam(':health_facility_id', $this->health_facility_id);\r\n //Execute statement\r\n $stmt->execute();\r\n return $stmt;\r\n }", "public function former_student($year,$subject,$ddlSession)\n\t{\n\t\tif($year==\"1st\"){\n\t\t\t$this->db->where('gen_type', $subject);\n\t\t\t$this->db->where('trsnfer_flag', 1);\n\t\t\t$this->db->where('session_id', $ddlSession);\n\t\t\t$this->db->order_by('college_roll', 'asc');\n\t\t\t$query=$this->db->get('admission_erp');\n\t\t\treturn $query->result();\n\t\t}\n\t\telse{\n\t\t\t$this->db->where('sub_honours', $subject);\n\t\t\t$this->db->where('trsnfer_flag', 1);\n\t\t\t$this->db->where('session_id', $ddlSession);\n\t\t\t$query=$this->db->get('student_dtl');\n\t\t\treturn $query->result();\n\t\t}\n\t\t\n\t}", "public function getTrainingList5($dept, $month, $year)\n {\n $this->db->select(\"th_ref_id,\n th_training_title,\n to_char(th_date_from, 'dd/mm/yyyy') th_date_from2,\n to_char(th_date_to, 'dd/mm/yyyy') th_date_to2,\n th_training_fee\n \");\n $this->db->from(\"ims_hris.training_head\");\n\n if(!empty($dept)) {\n $this->db->where(\"th_dept_code\", $dept);\n }\n\n if(!empty($month)) {\n $this->db->where(\"COALESCE(TO_CHAR(th_date_from,'MM'),'') = '$month'\");\n }\n\n if (!empty($year)) {\n $this->db->where(\"COALESCE(TO_CHAR(th_date_from,'YYYY'),'') = '$year'\");\n }\n \n $this->db->where(\"COALESCE(th_status, 'ENTRY') = 'APPROVE'\");\n $this->db->where(\"th_internal_external = 'EXTERNAL_AGENCY'\");\n $this->db->where(\"th_training_fee >= '5000.01'\");\n $this->db->order_by(\"th_date_from, th_date_to, th_training_title\");\n $q = $this->db->get();\n \n return $q->result_case('UPPER');\n }", "public static function retrieveCorrectionRequestsForYear($year)\n {\n // Find all the unverified timesheets\n $rows = self::with([ 'person:id,callsign', 'position:id,title'])\n ->whereYear('on_duty', $year)\n ->where('verified', false)\n ->where('notes', '!=', '')\n ->where('review_status', 'pending')\n ->whereNotNull('off_duty')\n ->orderBy('on_duty')\n ->get();\n\n // Warm up the position credit cache so the database is not being slammed.\n PositionCredit::warmYearCache($year, array_unique($rows->pluck('position_id')->toArray()));\n\n return $rows->sortBy(function ($p) {\n return $p->person->callsign;\n }, SORT_NATURAL|SORT_FLAG_CASE)->values();\n }", "public function processData()\n {\n \n $dateTimeStart = new DateTime($this->start);\n \n $dateEnd = $this->end;\n \n if (!$dateEnd) {\n $dateEnd = date('Y-m-d');\n }\n \n $dateTimeEnd = new DateTime($dateEnd);\n $this->yearEnd = $dateTimeEnd->format('Y');\n \n $beginYear = $dateTimeStart->format('Y');\n $this->yearStart = $beginYear;\n \n\n \n $numYears = $this->yearEnd - $this->yearStart;\n \n\n Log::debug( \"Start: {$this->yearStart} End: {$this->yearEnd} Num: {$numYears}\" );\n \n \n if (!$numYears) {\n $numYears = 1;\n }\n \n $this->allYears = [];\n \n for ($num = 0; $num <= $numYears; ++$num) {\n $this->allYears[] = $beginYear;\n ++$beginYear;\n }\n \n if (!$this->active) {\n $this->active = $this->yearEnd;\n }\n \n $active = $this->active;\n \n $this->yearBefore = $active-1;\n $this->yearAfter = $active+1;\n \n // ok ganz simple\n if (count($this->allYears) > 5) {\n\n \n if ($active + 2 >= $this->yearEnd) {\n $active = $this->yearEnd - 2;\n }\n \n if ( ($active - 2) <= $this->yearStart) {\n $active = $this->yearStart + 2;\n }\n \n $this->showYears[] = $active-2;\n $this->showYears[] = $active-1;\n $this->showYears[] = $active;\n $this->showYears[] = $active+1;\n $this->showYears[] = $active+2;\n \n } else {\n \n $this->showYears = $this->allYears;\n }\n \n $this->allYears = array_reverse($this->allYears);\n\n }", "function lib4ridora_construct_year_filter($form_state) {\n // Get the values out of the form.\n $year_type = $form_state['values']['year']['select'];\n $to = empty($form_state['values']['year']['to']) ? \"*\" : $form_state['values']['year']['to'];\n $from = empty($form_state['values']['year']['from']) ? \"*\" : $form_state['values']['year']['from'];\n // If nothing was entered in the date fields, exit early.\n if ($to == \"*\" && $from == \"*\") {\n return \"\";\n }\n\n // Convert to proper format for solr.\n if ($to != '*') {\n $to_date = new DateTime();\n $to = date_format($to_date->createFromFormat('Y/m/d/G:i:s', \"$to/12/31/23:59:59\"), 'Y-m-d\\TH:i:s\\Z');\n }\n if ($from != '*') {\n $from_date = new DateTime();\n $from = date_format($from_date->createFromFormat('Y/m/d/G:i:s', \"$from/01/01/0:00:00\"), 'Y-m-d\\TH:i:s\\Z');\n }\n\n // Return fq string.\n module_load_include(\"inc\", \"islandora_solr\", \"includes/utilities\");\n switch ($year_type) {\n case \"publication year\":\n $publication_year_field = islandora_solr_lesser_escape(variable_get('lib4ridora_solr_field_publication_year', 'mods_originInfo_encoding_w3cdtf_keyDate_yes_dateIssued_dt'));\n return \"$publication_year_field:[$from TO $to]\";\n\n case \"reporting year\":\n $reporting_year_field = islandora_solr_lesser_escape(variable_get('lib4ridora_solr_field_reporting_year', 'mods_originInfo_encoding_w3cdtf_type_reporting year_dateOther_dt'));\n return \"$reporting_year_field:[$from TO $to]\";\n\n default:\n return \"\";\n }\n}", "public function searchActiveCelebritiesWorldYear($year = 2015)\n {\n $intervalStart = $year .'-01-01 00:00:00';\n\t\t$intervalEnd = $year .'-12-31 00:00:00';\n\t\t\n\t\t$query = ArtistPlan::find()\n\t\t\t->innerJoin('artist', 'artistplan.artist_id = artist.id')\n\t\t\t->andWhere(['artistplan.show_status' => 1])\n\t\t\t->andWhere(['artist.show_status' => 1])\n\t\t\t->andWhere(['artist.celebrity_status' => 1])\n\t\t\t->andWhere(['between', 'start_date', self::$startOfTime, $intervalEnd])\n\t\t\t->andWhere(['between', 'end_date', $intervalStart, self::$endOfTime])\n\t\t\t->orderBy([\"artist.show_order\" => SORT_ASC]);\n\t\t\n $dataProvider = new ActiveDataProvider([\n 'query' => $query,\n\t\t\t'pagination' => [\n\t\t\t\t'pageSize' => 40\n\t\t\t]\n ]);\n\n return $dataProvider;\n }", "function getStudentByMajorValidate(){\n\t\t\n\t\tif(@$this->major == \"\" | @$this->institution == \"\"){\n\t\t\t$respArray = $this->makeResponse(\"ERROR\", \"Both the major and institution are required!\", \"\");\n\t\t\techo $this->jsoncallback.\"(\".json_encode($respArray).\")\";\n\t\t\texit;\n\t\t}else{\n\t\t\t\n\t\t\t$this->basics->getStudentByMajor( $this->sanitize($this->major), $this->sanitize($this->institution) );\n\t\t\t\n\t\t}\n\t\t\n\t}", "public function Get_Document($type,$course_id,$instructor_id,$teacher_id,$semester,$year)\n {\n $semester_id = $this->DEADLINE->Search_Semester_id($semester,$year);\n //check responsible\n if($teacher_id != null)\n {\n $check_access = $this->Check_Access($teacher_id,$course_id);\n }\n else\n {\n $check_access = null;\n }\n if($type == 'evaluate')\n {\n $sql = \"SELECT ce.`course_evaluate_id`,ce.`exam_evaluate_id`,ce.`num_section`,ce.`credit_total`,ce.`course_id`,ce.`noorspe`,ce.`type`,ce.`type_other`,ce.`teacher_co`,ce.`absent`,ce.`syllabus`,ce.`submit_user_id`,ce.`submit_date`,cg.*,me.*,ee.* \";\n $sql .=\" FROM `course_evaluate` ce, `criterion_grade` cg, `measure_evaluate` me, `exam_evaluate` ee \";\n $sql .=\" WHERE ce.`criterion_grade_id` = cg.`criterion_grade_id` AND ce.`measure_evaluate_id` = me.`measure_evaluate_id` AND ce.`exam_evaluate_id` = ee.`exam_evaluate_id` AND ce.`course_id` = '\".$course_id.\"' AND `semester_id` = '\".$semester_id.\"'\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n $data = $result[0];\n if($data['syllabus'] == null)\n {\n $data['syllabus'] = false;\n }\n }\n else\n {\n $data = false;\n }\n $data['student'] = array();\n if(isset($data['course_evaluate_id']))\n {\n $sql = \"SELECT `section`,`student` FROM `student_evaluate` WHERE `course_evaluate_id` = \".$data['course_evaluate_id'];\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $data['student'][$result[$i]['section'] -1] = $result[$i]['student'];\n }\n }\n }\n\n $data['exam_mid1_committee_lec'] = array();\n $sql = \"SELECT `teacher_id`,`name_type` FROM `exam_commitee` WHERE `exam_evaluate_id` = '\".$data['exam_evaluate_id'].\"' AND `type` = 'MID1' AND `type_commitee` = 'LEC' ORDER BY `updated_date` ASC\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $teacher_name = $this->PERSON->Get_Teacher_Name($result[$i]['teacher_id'],$result[$i]['name_type']);\n if($teacher_name != false)\n {\n $temp = explode(\" \",$teacher_name);\n $teacher_name = '';\n for($j=1;$j<count($temp);$j++)\n {\n $teacher_name .= $temp[$j].\" \";\n }\n $teacher_name = trim($teacher_name,\" \");\n }\n array_push($data['exam_mid1_committee_lec'],$teacher_name);\n }\n }\n\n $data['exam_mid1_committee_lab'] = array();\n $sql = \"SELECT `teacher_id`,`name_type` FROM `exam_commitee` WHERE `exam_evaluate_id` = '\".$data['exam_evaluate_id'].\"' AND `type` = 'MID1' AND `type_commitee` = 'LAB' ORDER BY `updated_date` ASC\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $teacher_name = $this->PERSON->Get_Teacher_Name($result[$i]['teacher_id'],$result[$i]['name_type']);\n if($teacher_name != false)\n {\n $temp = explode(\" \",$teacher_name);\n $teacher_name = '';\n for($j=1;$j<count($temp);$j++)\n {\n $teacher_name .= $temp[$j].\" \";\n }\n $teacher_name = trim($teacher_name,\" \");\n }\n array_push($data['exam_mid1_committee_lab'],$teacher_name);\n }\n }\n\n $data['exam_mid2_committee_lec'] = array();\n $sql = \"SELECT `teacher_id`,`name_type` FROM `exam_commitee` WHERE `exam_evaluate_id` = '\".$data['exam_evaluate_id'].\"' AND `type` = 'MID2' AND `type_commitee` = 'LEC' ORDER BY `updated_date` ASC\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $teacher_name = $this->PERSON->Get_Teacher_Name($result[$i]['teacher_id'],$result[$i]['name_type']);\n if($teacher_name != false)\n {\n $temp = explode(\" \",$teacher_name);\n $teacher_name = '';\n for($j=1;$j<count($temp);$j++)\n {\n $teacher_name .= $temp[$j].\" \";\n }\n $teacher_name = trim($teacher_name,\" \");\n }\n array_push($data['exam_mid2_committee_lec'],$teacher_name);\n }\n }\n\n $data['exam_mid2_committee_lab'] = array();\n $sql = \"SELECT `teacher_id`,`name_type` FROM `exam_commitee` WHERE `exam_evaluate_id` = '\".$data['exam_evaluate_id'].\"' AND `type` = 'MID2' AND `type_commitee` = 'LAB' ORDER BY `updated_date` ASC\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $teacher_name = $this->PERSON->Get_Teacher_Name($result[$i]['teacher_id'],$result[$i]['name_type']);\n if($teacher_name != false)\n {\n $temp = explode(\" \",$teacher_name);\n $teacher_name = '';\n for($j=1;$j<count($temp);$j++)\n {\n $teacher_name .= $temp[$j].\" \";\n }\n $teacher_name = trim($teacher_name,\" \");\n }\n array_push($data['exam_mid2_committee_lab'],$teacher_name);\n }\n }\n\n $data['exam_final_committee_lec'] = array();\n $sql = \"SELECT `teacher_id`,`name_type` FROM `exam_commitee` WHERE `exam_evaluate_id` = '\".$data['exam_evaluate_id'].\"' AND `type` = 'FINAL' AND `type_commitee` = 'LEC' ORDER BY `updated_date` ASC\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $teacher_name = $this->PERSON->Get_Teacher_Name($result[$i]['teacher_id'],$result[$i]['name_type']);\n if($teacher_name != false)\n {\n $temp = explode(\" \",$teacher_name);\n $teacher_name = '';\n for($j=1;$j<count($temp);$j++)\n {\n $teacher_name .= $temp[$j].\" \";\n }\n $teacher_name = trim($teacher_name,\" \");\n }\n array_push($data['exam_final_committee_lec'],$teacher_name);\n }\n }\n\n $data['exam_final_committee_lab'] = array();\n $sql = \"SELECT `teacher_id`,`name_type` FROM `exam_commitee` WHERE `exam_evaluate_id` = '\".$data['exam_evaluate_id'].\"' AND `type` = 'FINAL' AND `type_commitee` = 'LAB' ORDER BY `updated_date` ASC\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $teacher_name = $this->PERSON->Get_Teacher_Name($result[$i]['teacher_id'],$result[$i]['name_type']);\n if($teacher_name != false)\n {\n $temp = explode(\" \",$teacher_name);\n $teacher_name = '';\n for($j=1;$j<count($temp);$j++)\n {\n $teacher_name .= $temp[$j].\" \";\n }\n $teacher_name = trim($teacher_name,\" \");\n }\n array_push($data['exam_final_committee_lab'],$teacher_name);\n }\n }\n $data['teacher'] = array();\n $sql = \"SELECT `teacher_id`,`name_type` FROM `teacher_exam_evaluate` WHERE `course_eveluate_id` = \".$data['course_evaluate_id'].\" ORDER BY `updated_date` ASC\";\n $result = $this->DB->Query($sql);\n if($result)\n {\n for($i=0;$i<count($result);$i++)\n {\n $teacher_name = $this->PERSON->Get_Teacher_Name($result[$i]['teacher_id'],$result[$i]['name_type']);\n if($teacher_name != false)\n {\n $temp = explode(\" \",$teacher_name);\n $teacher_name = '';\n for($j=1;$j<count($temp);$j++)\n {\n $teacher_name .= $temp[$j].\" \";\n }\n $teacher_name = trim($teacher_name,\" \");\n }\n array_push($data['teacher'],$teacher_name);\n }\n }\n }\n else if($type == 'special')\n {\n $check_access = true;\n $lecture_detail = array();\n $sql = \"SELECT st.`topic_name`,st.`teaching_date`,st.`teaching_time_start`,st.`teaching_time_end`,st.`teaching_room` FROM `special_lecture_teach` st, `course_hire_special_instructor` ci \";\n $sql .= \"WHERE ci.`instructor_id` = \".$instructor_id.\" AND ci.`course_id` = '\".$course_id.\"' AND st.`hire_id` = ci.`hire_id` AND ci.`semester_id` = \".$semester_id;\n $result = $this->DB->Query($sql);\n if($result)\n {\n $numtable = count($result);\n for ($i=0; $i < count($result); $i++)\n {\n $lecture_detail[$i] = $result[$i];\n }\n }\n else\n {\n $numtable = 0;\n $data['lecture_detail'] = null;\n }\n $sql = \"SELECT si.`instructor_id`,si.`prefix`,si.`firstname`,si.`lastname`,si.`position`,si.`qualification`,si.`work_place`,si.`phone`,si.`phone_sub`,si.`phone_mobile`,si.`cv`,si.`email`,si.`invited`,ei.`level_teacher`,ei.`level_descript`,ei.`payment_method`,ei.`expense_lec_checked`,ei.`expense_lec_number`,ei.`expense_lec_hour`,ei.`expense_lec_cost`,ei.`expense_lab_checked`,ei.`expense_lab_number`,ei.`expense_lab_hour`,ei.`expense_lab_cost`,ei.`expense_plane_check`,ei.`expense_plane_depart`,ei.`expense_plane_arrive`,ei.`expense_plane_cost`,ei.`expense_taxi_check`,ei.`expense_taxi_depart`,ei.`expense_taxi_arrive`,ei.`expense_taxi_cost`,ei.`expense_car_check`,ei.`expense_car_distance`,ei.`expense_car_unit`,ei.`expense_car_cost`,ei.`expense_hotel_choice`,ei.`expense_hotel_per_night`,ei.`expense_hotel_number`,ei.`expense_hotel_cost`,ei.`cost_total`, ci.*\";\n $sql .= \" FROM `special_instructor` si,`expense_special_instructor` ei, `course_hire_special_instructor` ci \";\n $sql .= \"WHERE ci.`instructor_id` = \".$instructor_id.\" AND ci.`course_id` = '\".$course_id.\"' AND ci.`instructor_id` = si.`instructor_id` AND ci.`expense_id` = ei.`expense_id` AND ci.`semester_id` = \".$semester_id;\n $result = $this->DB->Query($sql);\n if($result)\n {\n $data = $result[0];\n if($data['cv'] == null)\n {\n $data['cv'] = false;\n }\n $data['num_table'] = $numtable;\n $data['lecture_detail'] = $lecture_detail;\n }\n else\n {\n $data = false;\n }\n }\n else\n {\n die(\"รูปแบบข้อมูลผิดพลาด กรุณาติดต่อผู้ดูแลระบบ\");\n }\n $data['ACCESS'] = $check_access;\n return $data;\n }", "public function talentOpportunities($state=null,$institution_type=null,$gender=null,$sport_type=null,$country = null)\n {\n $talent_management_level = Session::get(SiteSessions::USER_MANAGEMENT_LEVEL);\n $managers = null;\n\n switch($talent_management_level)\n {\n case SiteConstants::USER_TALENT_MANAGEMENT_LEVEL_STUDENT:\n\n //Management level and Gender requested by the user.\n $managerManagementLevel = null;\n\n //If Institution type is \"High School\"\n if($institution_type == 1)\n {\n $managerManagementLevel=SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_HIGH_SCHOOL;\n }\n //If Institution type is \"University\"\n else if($institution_type == 2)\n {\n $managerManagementLevel=SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_UNIVERSITY;\n }\n\n $managers = ManagersDatabase::managerType(SiteConstants::USER_MANAGER_COACH)\n ->managementLevel($managerManagementLevel)\n ->state($state)\n ->sportGender($gender)\n ->sport($sport_type)\n ->paginate(25);\n\n\n break;\n\n\n case SiteConstants::USER_TALENT_MANAGEMENT_LEVEL_ASPIRING_PRO:\n\n $managers = ManagersDatabase::country($country)\n ->sport($sport_type)\n ->sportGender($gender)\n ->whereIn('management_level',[SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_AMATEUR,SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_PRO,SiteConstants::USER_MANAGER_MANAGEMENT_LEVEL_SEMI_PRO])\n ->paginate(25);\n break;\n }\n\n\n $managers_already_contacted = DB::table(\"managers_contacted\")->where('user_id','=',Session::get(SiteSessions::USER_ID))->lists('manager_id');\n\n\n $userProfile=UserProfile::find(Session::get(SiteSessions::USER_ID));\n $userProfile->getMutatedData = false;\n $sport_gender = array_map('ucfirst',array_merge(['0'=>'-- Select Option --'],SportsRepository::getSportsGender()));\n $state = array_map('ucfirst',array_merge(['0' => \"-- Select State --\"],BasicSiteRepository::getAmericanState()));\n $institution_type = array_map('ucfirst',UserProfileRepository::getInstituteType());\n $country = array_map('ucfirst',BasicSiteRepository::getListOfCountries());\n\n\n return view('database.talent_database_search_result',compact('managers','managers_already_contacted','userProfile','sport_gender','state','institution_type','country'));\n }", "public function reportTeacherDatewiseAttendent()\n {\n $year = DB::table('student')->distinct()->get(array('year'));\n return view('report.reportTeacherDatewiseAttendent')->wit;\n }", "public function modelYear();", "public function listApprovelAction($year = \"notset\")\n {\n $em = $this->getDoctrine()->getManager();\n \n $repository = $this->getDoctrine()\n ->getRepository('AppBundle:RoomReservation');\n\n $query = $repository->createQueryBuilder('rr')\n ->where('rr.approved = -1')\n ->orderBy('rr.date', 'ASC')\n ->getQuery();\n\n $roomReservations = $query->getResult();\n \n return $this->render('roomreservation/approvellist.html.twig', array(\n 'roomReservations' => $roomReservations\n ));\n }" ]
[ "0.6223644", "0.53187007", "0.53092265", "0.52474815", "0.52237827", "0.5216263", "0.5115766", "0.50811625", "0.5071113", "0.4988595", "0.49541777", "0.49491763", "0.49457964", "0.49439424", "0.49324158", "0.4928264", "0.4917653", "0.48897353", "0.48842284", "0.48779628", "0.48752287", "0.48680854", "0.48607317", "0.4856309", "0.48556393", "0.4852165", "0.4844146", "0.48428875", "0.48371613", "0.4831452" ]
0.5841433
1
Loads the name of an user given its email
public function findNameByEmail($email){ $stmt = $this->db->prepare("SELECT * FROM users WHERE email=?"); $stmt->execute(array($email)); $user = $stmt->fetch(PDO::FETCH_ASSOC); if($user != null) { return new User( $user["email"], $user["completeName"]); } else { return NULL; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function loadUserByEmail($email)\n { \n $user = $this->_em->getRepository('Entity\\User\\User')->findOneBy(array('email' => $email));\n\n if($user != null)\n return $user;\n\n throw new UsernameNotFoundException(\"Compte introuvable\");\n }", "function getUserNameFromEmail( $email ) {\n $d = loadDB();\n\n foreach ( $d[\"users\"] as $key => $value ) {\n if ($value[\"email\"] == $email) {\n return $value[\"name\"];\n }\n }\n return \"unknown\";\n }", "public function getUser($email);", "function get_user_by_email($email)\n {\n }", "function get_username_by_email($h, $email){\n \n $sql = \"SELECT user_username FROM \" . TABLE_USERS . \" WHERE user_email=%s LIMIT 1\";\n $query = $h->db->prepare($sql, $email);\n \n\treturn $username= $h->db->get_var($query);\n }", "public function get_user_name($email_id) {\r\n $this->db->select('*');\r\n $where = \"(user_email='$email_id')\";\r\n $this->db->where($where);\r\n $query = $this->db->get('users');\r\n $data = $query->result();\r\n\r\n return $data;\r\n }", "public function getUserOrProperName()\n {\n $person = $this->getPerson();\n if (strtolower($person->getEmail()) != strtolower($this->username)) {\n return $this->username;\n } else {\n $init = substr($person->getFirstname(), 0, 1);\n return \"{$init}. {$person->getLastname()}\";\n }\n }", "public function loadFromEmail(){\r\n\t\t$em = $this -> getEmail();\r\n\t\tif(!empty($em))\r\n\t\t $this -> loadFromQuery(\"select * from UserTab where User_email='\".$em.\"'\");\r\n\t }", "public function loadUserByUsername($email) {\n /* @var $user \\App\\Entity\\User */\n $user = $this->repository->findOneByEmail($email);\n\n if( ! $user ) {\n throw new UsernameNotFoundException(sprintf('Account with email %s was not found!', $email));\n }\n \n if( $user->getIsAdmin() ) {\n $user->addRole('ROLE_DEVELOPER');\n }\n else {\n $user->addRole('ROLE_USER');\n }\n\n return $user;\n }", "public function getUserByEmail($email);", "public function get_user($email){\n\t\t$email_md5_hash = md5($email); \n\t\t$endpoint = '/lists/'. LIST_ID . '/members/'. $email_md5_hash;\n\t\t$result = $this->mc->get($endpoint);\n\t\tif($result['status'] == '404'){\n\t\t\tprint 'user does not exist';\n\t\t}else{\n\t\t\tprint '<pre>'; print_r($result); print '</pre>';\n\t\t}\n\t\t\n\t}", "public function retrieveUser ($email) {\n return $this->usersDB->retrieve($email);\n }", "public function fetchUserByEmail($email);", "public function getUserByEmail()\n {\n $db = init_db();\n $req = $db->prepare(\"SELECT * FROM user WHERE email = ?\");\n $req->execute(array($this->getEmail()));\n $db = null;\n\n return $req->fetch();\n }", "function getuser($email)\n\t\t{\n\t\t\t$email = \"'\".$email.\"'\";\n\t\t\t$sql = $this->conn_id->query(\"select * from users where email = \".$email );\n\t\t\t$r = $sql->fetchALL(PDO::FETCH_ASSOC);\n\t\t\treturn $r;\n\t\t}", "public function retrieve($email){\n $conn_manager = new ConnectionManager();\n $pdo = $conn_manager->getConnection();\n \n $sql = \"select * from user where email=:email\";\n $stmt = $pdo->prepare($sql);\n // $stmt->bindParam(\":name\",$name,PDO::PARAM_STR);\n $stmt->bindParam(\":email\",$email,PDO::PARAM_STR);\n $stmt->execute();\n \n $user = null;\n $stmt->setFetchMode(PDO::FETCH_ASSOC);\n if($row = $stmt->fetch()){\n $user = new User($row[\"email\"],$row['first_name'],$row['last_name'],$row[\"hashed_password\"]);\n }\n \n $stmt = null;\n $pdo = null;\n return $user;\n }", "function get_user_name() {\n return $this->call('get_user_name', array(), TRUE);\n }", "function getUserByEmail($userEmail){\n\n\t\tglobal $conn;\n\n\t\t$query = \"SELECT firstname, lastname, email, phone FROM User WHERE email='\" . $userEmail . \"'\";\n\n\t\t$result = $conn->query($query);\n\n\t\tif($result->num_rows != 1){\n\t\t\treturn \"NO_USER_BY_EMAIL\";\n\t\t}else{\n\t\t\treturn $result->fetch_assoc();\n\t\t}\n\t}", "public function loadUser($email) {\r\n\r\n\t\t//TODO: Look at bookmark class for sample try/catch block around DB code\r\n\t\t$sqlObj = new DataBase();\r\n\t\t$query = \"SELECT id AS uc_id, first, last, email, username, sex FROM v_returnShortUserProfile WHERE email='{$email}';\";\r\n\r\n\t\t$sqlObj->DoQuery($query);\r\n\t\t$result = $sqlObj->GetData();\r\n\r\n\t\t//Let's make sure we're only returning one result\r\n\t\tif (count($result) == 1) {\r\n\t\t\t$result = $result[0]; //break the multi-dimensional array since this should only be 1 record\r\n\t\t} elseif (count($result) > 1) {\r\n\t\t\t$result = NULL;\r\n\t\t\tthrow new MyException('ERROR: We have duplicate records for User Credential email: {$email}.');\r\n\t\t} else {\r\n\t\t\t$result = NULL;\r\n\t\t}\r\n\r\n\t\t$sqlObj->destroy();\r\n\r\n\t\treturn $result;\r\n\t}", "function getUsername($mail) {\n\t global $db;\n\t $username;\n\t try {\n\t\t $stmt = $db->prepare('SELECT username FROM User WHERE mail = ?');\n\t\t $stmt->execute(array($mail)); \n\t\t \n\t\t $res = $stmt->fetch();\n\t} catch (PDOException $e) {\n\t\techo $e->getMessage();\n\t}\n\t\n\t\n\treturn $res['username'];\n }", "public function getUserName()\n {\n return substr($this->email, 0, strpos($this->email, '@'));\n }", "public function getUser(string $email) {\n\t\t$queryString = \"SELECT * \n\t\t\t\t\t\tFROM users \n\t\t\t\t\t\tWHERE email='{$email}';\";\n\t\t$userArray = $this->queryForUser($queryString);\n\t\treturn $this->makeUserFromArray($userArray);\n\t}", "public function getUsername()\n {\n return $this->email;\n }", "public function getUsernameByForgotKey(){\n $key = $this->key;\n\n //get email\n $user_forgot = new \\Filebase\\Database([\n 'dir' => $this->getDataSourceForgot()\n ]);\n\n $item = $user_forgot->get($key);\n $email = $item->email;\n\n //get username\n $user = new \\Filebase\\Database([\n 'dir' => $this->getDataSource(),\n 'cache' => $this->cache,\n 'cache_expires' => $this->cache_expires\n ]);\n\n $list = $user->query()->where('email','=',$email)->limit(1)->results();\n if(!empty($list)){\n if(!empty($list[0]['username'])){\n return $list[0]['username'];\n }\n }\n return '';\n }", "public function getUserByEmail($email) {\n //create user query by email\n $user_query_by_email = Doctrine_Query::create()\n ->select('sgu.id')\n ->from('sfGuardUser sgu')\n ->where('sgu.email_address =?', $email);\n return $user_query_by_email->fetchOne();\n }", "public function findUserByMail(string $email)\n {\n $users = $this->doctrine->getUserRepository()->findBy(['email' => $email]);\n\n if ($user = reset($users)) {\n return $user;\n }\n\n return null;\n }", "public function getUsername(): string\n {\n return $this->email;\n }", "public function getUsername(): string\n {\n return $this->email;\n }", "public function getUsername()\n {\n return $this->email;\n }", "public function getUniqueUsernameFromEmail($email);" ]
[ "0.7470118", "0.7409108", "0.7289771", "0.70845586", "0.6977614", "0.69411457", "0.6923764", "0.689882", "0.6886406", "0.68858427", "0.68018734", "0.67706674", "0.6748977", "0.6733427", "0.6714101", "0.6670983", "0.66457134", "0.66178656", "0.65951985", "0.65804493", "0.655011", "0.6548146", "0.6507691", "0.65075743", "0.649263", "0.6478785", "0.6477061", "0.6477061", "0.6471525", "0.6463727" ]
0.7462196
1
Saves a User into the database
public function save($user) { $stmt = $this->db->prepare("INSERT INTO users values (?,?,?)"); $stmt->execute(array($user->getEmail(), $user->getCompleteName(), $user->getPasswd())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function save_user()\n\t{\n $user= new Users();\n $user->setNom($_POST['nom']);\n $user->setPrenom($_POST['prenom']);\n $user->setDate_naissance($_POST['date_naiss']);\n $user->setEmail($_POST['mail']);\n $user->setPassword($_POST['pwd']); \n\n $user->Create_user();\n\t}", "public function saving(User $user)\n {\n //\n }", "public function save(User $user){\n return $user->save();\n }", "public static function save(User $user)// statiska funkcija, lai nevajadzetu taisit klases objektu\n {\n }", "public function saveUser($user) {\n if(empty($user->user_id)){\n $this->dao->insertUser($user);\n } else {\n $this->dao->updateUser($user, $user->user_id); \n }\n }", "public function saveUser()\n {\n $connection = \\Yii::$app->db;\n $command = $connection->createCommand()\n ->update('users', [\n 'name' => $this->name,\n 'email' => $this->email,\n ], 'id='.$this->id);\n $command->execute();\n }", "public function saved(User $user)\n {\n //\n }", "public function store()\n {\n // Save post data in $user var\n $user = $_POST;\n \n // Create a password, set created_by ID and set the date of creation\n $user['password'] = password_hash('Gorilla1!', PASSWORD_DEFAULT);\n $user['created_by'] = Helper::getUserIdFromSession();\n $user['created'] = date('Y-m-d H:i:s');\n\n // Save the record to the database\n UserModel::load()->store($user);\n }", "public function save(User $user): void\n {\n $em = DoctrineManager::entityManager();\n $em->persist($user);\n $em->flush();\n }", "public function save(User $user) {\n $userData = array(\n 'user_email' => $user->getEmail(),\n 'user_salt' => $user->getSalt(),\n 'user_password' => $user->getPassword(),\n 'user_role' => $user->getRole(),\n 'user_lastname' => $user->getLastname(),\n 'user_firstname' => $user->getFirstname(),\n 'user_address' => $user->getAddress(),\n 'user_town' => $user->getTown(),\n 'user_zipcode' => $user->getZipcode()\n );\n\n if ($user->getId()) {\n $this->getDb()->update('user', $userData, array('user_id' => $user->getId()));\n } else {\n // The user has never been saved : insert it\n $this->getDb()->insert('user', $userData);\n // Get the id of the newly created user and set it on the entity.\n // $id = $this->getDb()->lastInsertId();\n $user->setEmail($user->getEmail());\n }\n }", "public function saveUser()\n {\n $this->_initUser();\n\n $this->generateSecurePassword();\n\n return $this->save(\n [\n 'username' => $this->username,\n 'password' => $this->password,\n 'salt' => $this->_salt,\n 'email' => $this->email,\n 'name' => $this->name,\n 'lastname' => $this->lastname,\n 'sw_active' => 1\n ], true\n );\n }", "public function save($user){\n $this->validate();\n if(sizeof($this->errors)==0){\n\n $password_hash=password_hash($user->getPassword(),PASSWORD_DEFAULT);\n $sql=\"INSERT INTO user(name,email,password) VALUES(?,?,?)\";\n $stmt=static::getDB()->prepare($sql);\n $stmt->execute(array($user->getUsername(),$user->getEmail(),$password_hash));\n \n }else{\n print_r($this->errors) ;\n }\n\n // return false;\n }", "public function save() {\n $db = Db::instance();\n // omit id and any timestamps\n $db_properties = array(\n 'username' => $this->username,\n 'password_hash' => $this->password_hash,\n 'email' => $this->email,\n 'first_name' => $this->first_name,\n 'last_name' => $this->last_name,\n 'user_type' => $this->user_type,\n 'bio' => $this->bio,\n 'creation_date' => $this->creation_date,\n 'gender' => $this->gender,\n 'color' => $this->color\n );\n $db->store($this, __CLASS__, self::DB_TABLE, $db_properties);\n }", "public function saveUser() {\n\n try {\n\n $this->save();\n\n }catch (Exception $e) {\n\n throw new Exception($e->getMessage());\n\n }\n }", "function saveUser($user)\n {\n //1. Define the query\n $sql = \"INSERT INTO users (username, nickname, userlocation, archive, usertype, password, email) \n VALUES (:username, :nickname, :userlocation, :archive, :usertype, :password, :email)\";\n\n //2. Prepare the statement\n $statement = $this->_dbh->prepare($sql);\n\n //3. Bind the parameters\n $statement->bindParam(':username', $user->getUserName(), PDO::PARAM_STR);\n $statement->bindParam(':nickname', $user->getNickname(), PDO::PARAM_STR);\n $statement->bindParam(':userlocation', $user->getLocation(), PDO::PARAM_STR);\n $statement->bindParam(':password', $user->getPassword(), PDO::PARAM_STR);\n $statement->bindParam(':email', $user->getEmail(), PDO::PARAM_STR);\n\n // set account type and archive if admin\n if ($user instanceof Admin) {\n $userType = \"admin\";\n $archive = 1;\n } else {\n $userType = \"standard\";\n $archive = 0;\n }\n\n $statement->bindParam(':archive', $archive, PDO::PARAM_STR);\n $statement->bindParam(':usertype', $userType, PDO::PARAM_STR);\n\n $lastId = $this->_dbh->lastInsertId();\n\n //4. Execute the query\n $result = $statement->execute();\n\n //5. Process the results\n return $result;\n }", "public function save(){\n\t\tif($this->validateForms(Input::all()) === true){\n\t\t\t$user = new User();\n\t\t\t$user->username = Input::get('username');\n\t\t\t$user->password = Hash::make(Input::get('password'));\t\n\t\t\t$user->email = Input::get('email');\n\t\t\t$user->role_id = Input::get('rol');\n\t\t\t$user->enable = 1;\n\n\t\t\t$useradmin = new UsuarioAdmin();\n\t\t\t$useradmin->nombres = Input::get('nombres');\n\t\t\t$useradmin->apellidos = Input::get('apellidos');\n\t\t\t$useradmin->cargo = Input::get('cargo');\n\n\t\t\t$user->save();\n\t\t\t$user->usuarioadmin()->save($useradmin);\n\n\t\t\tSession::flash('message', 'Usuario Agregado');\n\t\t\treturn Redirect::back();\n\n\t\t}else{\n\t\t\treturn Redirect::back()->withErrors($this->validateForms(Input::all()))->withInput();\n\t\t}\n\t}", "public function save(User $model);", "function saveuser(){\n \t\t\tif (isset($_POST['UserID'])){\n \t\t\t\t$UserID = base64_decode($_POST['UserID']);\n \t\t\t\t$this->Users->UpdateUser($UserID);\n \t\t\t}else{\n \t\t\t\t$UserID = $this->Users->AddNewUser();\n \t\t\t\t$this->Users->AddUserToCompany($UserID);\n \t\t\t}\n \t\t\t$this->Flash->error(__('UserSaved', true));\n \t\t\t$this->Redirect('/users/edituser/'.base64_encode($UserID));\n \t\t}", "public function saveNewUser() {\n\t\t$db = $this->getDatabaseConnection();\n\n\t\t// Prepare the SQL\n\t\t$sql =\"INSERT INTO users (email, password, first_name, last_name, username)\n\t\t\t\tVALUES (:email, :password, :first_name, :last_name, :username)\";\n\n\t\t$statement = $db->prepare($sql);\n\n\t\t// Bind the form data to the SQL query\n\t\t$statement->bindValue(':email', $_POST['email']);\n\t\t$statement->bindValue(':password', $_POST['password']);\n\t\t$statement->bindValue(':first_name', $_POST['first_name']);\n\t\t$statement->bindValue(':last_name', $_POST['last_name']);\n\t\t$statement->bindValue(':username', $_POST['username']);\n\n\t\t// Run the query\n\t\t$result = $statement->execute();\n\n\t\t//Confirm tht it worked\n\t\tif( $result == true) {\n\t\t\t// Yay!\n\n\t\t\t$_SESSION['user_id'] = $db->lastInsertID();\n\t\t\t$_SESSION['privilege'] = 'user';\n\t\t\t$_SESSION['first_name'] = $_POST['first_name'];\n\t\t\t$_SESSION['last_name'] = $_POST['last_name'];\n\t\t\t$_SESSION['username'] = $_POST['username'];\n\t\t\t$_SESSION['email'] = $_POST['email'];\n\n\t\t\theader('Location: index.php?page=account');\n\t\t} else {\n\t\t\t// Uh oh...\n\t\t}\n\n\t\t//If it did, log the user in and redirect to their \n\t\t// new account page\n\t}", "public function save()\n {\n if ($this->id)\n {\n $query = sprintf('UPDATE USERS SET USERNAME = \"%s\", ' .\n 'PASSWORD = \"%s\", EMAIL_ADDR = \"%s\", FIRST_NAME = \"%s\", LAST_NAME = \"%s\", IS_ACTIVE = %d ' .\n 'WHERE USER_ID = %d',\n mysql_real_escape_string($this->username, $GLOBALS['DB']),\n mysql_real_escape_string($this->password, $GLOBALS['DB']),\n mysql_real_escape_string($this->emailAddr, $GLOBALS['DB']),\n mysql_real_escape_string($this->firstName, $GLOBALS['DB']),\n mysql_real_escape_string($this->lastName, $GLOBALS['DB']),\n $this->isActive,\n $this->id);\n mysql_query($query, $GLOBALS['DB']);\n }\n else\n {\n $query = sprintf('INSERT INTO USERS (USERNAME, PASSWORD, ' .\n 'EMAIL_ADDR, FIRST_NAME, LAST_NAME, IS_ACTIVE) VALUES (\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", %d)',\n mysql_real_escape_string($this->username, $GLOBALS['DB']),\n mysql_real_escape_string($this->password, $GLOBALS['DB']),\n mysql_real_escape_string($this->emailAddr, $GLOBALS['DB']),\n mysql_real_escape_string($this->firstName, $GLOBALS['DB']),\n mysql_real_escape_string($this->lastName, $GLOBALS['DB']),\n $this->isActive);\n mysql_query($query, $GLOBALS['DB']);\n\n $this->id = mysql_insert_id($GLOBALS['DB']);\n }\n }", "public function store()\n\t{\n $user = new User();\n $user->name = Input::get('name');\n $user->email = Input::get('email');\n $user->mobile = Input::get('mobile');\n $user->save();\n echo json_encode(array('msg' => 'success', 'id' => $user->id));\n\t}", "public function save()\n {\n if ($this->uid)\n {\n $query = sprintf('UPDATE %sUSER SET USERNAME = \"%s\", ' .\n 'PASSWORD = \"%s\", EMAIL_ADDR = \"%s\", IS_ACTIVE = %d ' .\n 'WHERE USER_ID = %d',\n DB_TBL_PREFIX,\n mysql_real_escape_string($this->username, $GLOBALS['DB']),\n mysql_real_escape_string($this->password, $GLOBALS['DB']),\n mysql_real_escape_string($this->emailAddr, $GLOBALS['DB']),\n $this->isActive,\n $this->userId);\n mysql_query($query, $GLOBALS['DB']);\n }\n else\n {\n $query = sprintf('INSERT INTO %sUSER (USERNAME, PASSWORD, ' .\n 'EMAIL_ADDR, IS_ACTIVE) VALUES (\"%s\", \"%s\", \"%s\", %d)',\n DB_TBL_PREFIX,\n mysql_real_escape_string($this->username, $GLOBALS['DB']),\n mysql_real_escape_string($this->password, $GLOBALS['DB']),\n mysql_real_escape_string($this->emailAddr, $GLOBALS['DB']),\n $this->isActive);\n mysql_query($query, $GLOBALS['DB']);\n\n $this->uid = mysql_insert_id($GLOBALS['DB']);\n }\n }", "public function save()\n {\n $this->validate();\n $this->user->save();\n\n $this->toast('Your information has been updated!', 'success');\n }", "function saveUser(UserEntity $user, string $hashedPwd);", "public function store()\n\t{\n\t\t$user = $this->user->store( Input::all() );\n\t}", "function save() {\n $conn = \\DB\\getConnection();\n\n $query = sprintf(\"INSERT INTO Payments (uid, typeid, token, amount)\n VALUES (%u, %u, '%s', %f)\",\n $this->uid, $this->typeid, $conn->escape_string($this->token), $this->amount);\n\n \n\n $result = $conn->query($query);\n\n // If this is a newly created user, then update the id with the\n // newly created one\n if (!isset($this->id)) {\n $this->id = $result->insert_id;\n }\n }", "public function saveUser($user)\n {\n $sql = \"UPDATE `\".DB::TBL_USERS.\"` \".\n \"SET `fio`=?,`login`=?,`loginHash`=?,`phone`=?,\".\n \"`email`=?, `emailHash`=?,`pass`=?,`photo`=? \".\n \"WHERE `id`=?\";\n $st = $this->MySQL->getConn()->prepare($sql);\n $st->execute([\n $user->fio, $user->login, $user->loginHash,\n $user->phone, $user->email, $user->emailHash,\n $user->pass, $user->photo, $user->id,\n ]);\n }", "public function save ( $isNewUser = false ) {\n $db = new DB();\n \n // If the user is already registered, just update their info\n if ( !$isNewUser ) {\n $data = array (\n 'password' => \"'$this->hashedPassword'\",\n 'email' => \"'$this->email'\"\n );\n $db->update($_SESSION[userTable], $data, \"id = '\".$this->id.\"'\");\n }\n // else register the user\n else {\n $data = array (\n 'username' => \"'$this->username'\",\n 'password' => \"'$this->hashedPassword'\",\n 'email' => \"'$this->email'\",\n 'joindate' => \"'\".date(\"Y-m-d H:i:s\").\"'\"\n );\n $this->id = $db->insert($_SESSION['userTable'], $data);\n $this->joindate = time();\n }\n }", "public function saved(User $user)\n {\n // $his->name = \"mr.\".$user->name;\n // $his->save();\n }", "public function save(CreateUserRequest $request)\n {\n $this->authorize('create', User::class);\n\n $pass = $this->get_password($request);\n $user = User::create([\n 'name' => $request->input('name'),\n 'phone_number' => $request->input('phone_number'),\n 'email' => $request->input('email'),\n 'password' => bcrypt($pass),\n 'role_id' => $request->input('role_id', 3)\n ]);\n\n $user->notify(new AdminUserCreated($user, $pass));\n\n return redirect()->route('active_user', $user->id);\n }" ]
[ "0.79587907", "0.77736866", "0.7708109", "0.7707836", "0.7703543", "0.76558113", "0.76016927", "0.7571912", "0.75581414", "0.7402825", "0.7399722", "0.739042", "0.73269767", "0.7292358", "0.7276313", "0.7225437", "0.721875", "0.7218055", "0.7195012", "0.71814644", "0.71694463", "0.71504515", "0.71381915", "0.7132326", "0.7126802", "0.71163815", "0.7112709", "0.71014917", "0.7082874", "0.7075887" ]
0.7893134
1
Asks the database what games are currently running.
public static function current_games( $db = 0 ) { if( !$db ) { $db = REGISTRY::get( "db" ); } $sth = $db->prepare( " SELECT id FROM games WHERE start_date < CURRENT_TIMESTAMP() AND end_date > CURRENT_TIMESTAMP() " ); $sth->execute(); if( $sth->rowCount() > 0 ) { return $sth->fetchAll( PDO::FETCH_COLUMN, 0 ); } else { return 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listAvailableGames() {\n\t$sql = \"select id, name, admin_id from games where has_started = 0\";\n\n\treturn parcoursRs(SQLSelect($sql));\n}", "public function processGames()\n\t{\n\t\tif ($this->site->lookupgames !== '0') {\n\t\t\t$console = new Console($this->echooutput);\n\t\t\t$console->processConsoleReleases();\n\t\t}\n\t}", "public function listGame()\n {\n return $this->db->get('game', 8, 9)->result();\n }", "public function getCurrentGame() {\n\t\t// $stmt = $this->dbh->prepare($sql);\n\t\t// $this->dbo->execute($stmt,array());\t\n\n\t\t// if ($stmt->rowCount() >= 1)\n\t\t// {\t\n\t\t// \t$result = $stmt->fetchAll(PDO::FETCH_ASSOC);\n\t\t// \treturn $result[0];\n\t\t// } else {\n\t\t// \treturn false;\n\t\t// }\t\n\t }", "public function runGame()\n {\n $currentGame = $this->find('all')->where([\n 'complete' => false\n ])->contain(['Users'])->first();\n\n //get all the plays counts\n $gamesUsersTable = TableRegistry::get('GamesUsers');\n $currentGameCheckedCount = $gamesUsersTable->find();\n $currentGameCheckedCount = $currentGameCheckedCount->select([\n 'count' => $currentGameCheckedCount->func()->count('*')\n ])->where([\n 'game_id' => $currentGame->id,\n 'checked_box' => true\n ])->first()->count;\n\n $currentGameUncheckedCount = $gamesUsersTable->find();\n $currentGameUncheckedCount = $currentGameUncheckedCount->select([\n 'count' => $currentGameUncheckedCount->func()->count('*')\n ])->where([\n 'game_id' => $currentGame->id,\n 'checked_box' => false\n ])->first()->count;\n\n $totalPlays = $currentGameCheckedCount + $currentGameUncheckedCount;\n\n //If not enough players, extend the end time and bail;\n if ($totalPlays < 2) {\n $currentGame->end_time = Time::now()->addHour(1);\n $this->save($currentGame);\n return false;\n }\n\n //update current game fields\n $currentGame->total_checked = $currentGameCheckedCount;\n $currentGame->total_plays = $totalPlays;\n $currentGame->ratio = round((float)$currentGameCheckedCount / (float)$totalPlays, 2);\n\n //save game as 'complete'\n $currentGame->complete = true;\n $this->save($currentGame);\n\n //get all the users that played this round\n $usersTable = TableRegistry::get('Users');\n $usersWhoCheckedThisGameIdArray = $gamesUsersTable->find('list', [\n 'valueField' => 'user_id'\n ])->where([\n 'game_id' => $currentGame->id,\n 'checked_box' => true\n ])->toArray();\n $currentGameCheckedUsers = $usersTable->find('all')->where([\n 'id IN' => (!empty($usersWhoCheckedThisGameIdArray) ? $usersWhoCheckedThisGameIdArray : [0])\n ]);\n\n $usersWhoDidntCheckThisGameIdArray = $gamesUsersTable->find('list', [\n 'valueField' => 'user_id'\n ])->where([\n 'game_id' => $currentGame->id,\n 'checked_box' => false\n ])->toArray();\n $currentGameUncheckedUsers = $usersTable->find('all')->where([\n 'id IN' => (!empty($usersWhoDidntCheckThisGameIdArray) ? $usersWhoDidntCheckThisGameIdArray : [0])\n ]);\n\n\n //update users scores\n foreach ($currentGameCheckedUsers as $user) {\n if ($currentGame->ratio > 0.5) {\n if ($user->score != 0) {\n $user->score = (int)$user->score - 10;\n }\n } else {\n $user->score = (int)$user->score + 10;\n }\n $usersTable->save($user);\n }\n\n //create next incomplete game & save\n $this->createNewGame();\n\n //send notification emails to everybody that gained/lost points\n $email = new Email('default');\n\n $email->setTemplate('end_game', 'default')\n ->setEmailFormat('html')\n ->setFrom(\"admin@brandonfoltz.com\", \"Cruelty Game\")\n ->setSubject('Cruelty Game Results')\n ->setViewVars([\n 'ratio' => $currentGame->ratio,\n 'checked' => true,\n 'gameDomain' => Configure::read('GameDomain')\n ]);\n\n foreach ($currentGameCheckedUsers as $user) {\n if ($user->receive_emails && $user->enabled) {\n $email->addBcc($user->email);\n }\n }\n\n //don't bother emailing if there's nobody to email.\n if (empty($email->getTo()) && empty($email->getCc()) && empty($email->getBcc())) {\n return true;\n }\n try {\n $email->send();\n } catch (\\Cake\\Network\\Exception\\SocketException $e) {\n Log::write(\"error\", \"Couldn't send game result email!\");\n }\n\n //send email to everybody who played but didn't check\n $email = new Email('default');\n\n $email->setTemplate('end_game', 'default')\n ->setEmailFormat('html')\n ->setFrom(\"admin@brandonfoltz.com\", \"Cruelty Game\")\n ->setSubject('Cruelty Game Results')\n ->setViewVars([\n 'ratio' => $currentGame->ratio,\n 'checked' => false,\n 'gameDomain' => Configure::read('GameDomain')\n ]);\n\n foreach ($currentGameUncheckedUsers as $user) {\n if ($user->receive_emails && $user->enabled) {\n $email->addBcc($user->email);\n }\n }\n\n //don't bother emailing if there's nobody to email.\n if (empty($email->getTo()) && empty($email->getCc()) && empty($email->getBcc())) {\n return true;\n }\n try {\n $email->send();\n } catch (\\Cake\\Network\\Exception\\SocketException $e) {\n Log::write(\"error\", \"Couldn't send game result email!\");\n }\n }", "function getWaitingGames()\n\t{\n\t\t$uid = $_SESSION[\"uid\"];\n\t\t\n\t\t$query = \"SELECT DISTINCT g.gid, g.year, g.season, g.players\n\t\t\t\t\tFROM games g, in_game i\n\t\t\t\t\tWHERE g.running=false and g.gid=i.gid and not i.uid='$uid';\";\n\t\t\n\t\t$result = mysql_query($query) or die(\"db access error\" . mysql_error());\n\t\t\n\t\t$games = array();\n\t\t\n\t\tfor($i = 0; $i < mysql_num_rows($result); $i++)\n\t\t{\n\t\t\tarray_push($games, mysql_fetch_assoc($result));\n\t\t}\n\t\t\n\t\treturn $games;\n\t}", "function getAllGames() {\n $conn = dbcon();\n\n $query = $conn->prepare(\"SELECT * FROM games\");\n $query->execute();\n\n return $query->fetchAll();\n }", "public function runningApp(){\n\t\t\t$nilaiAkhir = self::pembulatan(self::$schoolPG, 5, 100, self::$inputanUser);\n\n\t\t\t// tampilkan hasil nilai akhir siswa\n\t\t\tprint(\"Final Score: <br/>\");\n\t\t\tforeach(self::$inputanUser as $key => $nilai){\n\t\t\t\tif(isset($nilaiAkhir[$key])){\n\t\t\t\t\tprintf(\"%d. Siswa ke-%d: %d --> %d<br/>\", ($key + 1), ($key + 1), $nilai, $nilaiAkhir[$key]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t}", "public function run()\n {\n //game 1\n\n //economy:\n //dilapidated 3\n //impoverished 3\n //mediocre 7\n //upscale 7\n //rich 3\n //opulent 1\n\n //1.\n DB::table('hoods')->insert([\n 'hood_name' => 'Streeterville',\n 'hood_type' => 'impoverished',\n 'game' => '1'\n ]);\n //2.\n DB::table('hoods')->insert([\n 'hood_name' => 'Little Village',\n 'hood_type' => 'upscale',\n 'game' => '1'\n ]);\n //3.\n DB::table('hoods')->insert([\n 'hood_name' => 'Cicero',\n 'hood_type' => 'mediocre',\n 'game' => '1'\n ]);\n //4.\n DB::table('hoods')->insert([\n 'hood_name' => 'Berwyn',\n 'hood_type' => 'dilapidated',\n 'game' => '1'\n ]);\n //5.\n DB::table('hoods')->insert([\n 'hood_name' => 'Loop',\n 'hood_type' => 'opulent',\n 'game' => '1'\n ]);\n //6.\n DB::table('hoods')->insert([\n 'hood_name' => 'Chinatown',\n 'hood_type' => 'impoverished',\n 'game' => '1'\n ]);\n //7.\n DB::table('hoods')->insert([\n 'hood_name' => 'Humboldt Park',\n 'hood_type' => 'upscale',\n 'game' => '1'\n ]);\n //8.\n DB::table('hoods')->insert([\n 'hood_name' => 'Lincoln Park',\n 'hood_type' => 'upscale',\n 'game' => '1'\n ]);\n //9.\n DB::table('hoods')->insert([\n 'hood_name' => 'Garfield Park',\n 'hood_type' => 'rich',\n 'game' => '1'\n ]);\n //10.\n DB::table('hoods')->insert([\n 'hood_name' => 'Bronzeville',\n 'hood_type' => 'dilapidated',\n 'game' => '1'\n ]);\n //11.\n DB::table('hoods')->insert([\n 'hood_name' => 'Brookfield',\n 'hood_type' => 'mediocre',\n 'game' => '1'\n ]);\n //12.\n DB::table('hoods')->insert([\n 'hood_name' => 'Broadview',\n 'hood_type' => 'mediocre',\n 'game' => '1'\n ]);\n //13.\n DB::table('hoods')->insert([\n 'hood_name' => 'Stickney',\n 'hood_type' => 'dilapidated',\n 'game' => '1'\n ]);\n //14.\n DB::table('hoods')->insert([\n 'hood_name' => 'Englewood',\n 'hood_type' => 'mediocre',\n 'game' => '1'\n ]);\n //15.\n DB::table('hoods')->insert([\n 'hood_name' => 'Elmwood',\n 'hood_type' => 'upscale',\n 'game' => '1'\n ]);\n //16\n DB::table('hoods')->insert([\n 'hood_name' => 'Belmont',\n 'hood_type' => 'upscale',\n 'game' => '1'\n ]);\n //17.\n DB::table('hoods')->insert([\n 'hood_name' => 'Dunning',\n 'hood_type' => 'mediocre',\n 'game' => '1'\n ]);\n //18.\n DB::table('hoods')->insert([\n 'hood_name' => 'Berkeley',\n 'hood_type' => 'mediocre',\n 'game' => '1'\n ]);\n //19.\n DB::table('hoods')->insert([\n 'hood_name' => 'Lake View',\n 'hood_type' => 'rich',\n 'game' => '1'\n ]);\n //20.\n DB::table('hoods')->insert([\n 'hood_name' => 'Bucktown',\n 'hood_type' => 'mediocre',\n 'game' => '1'\n ]);\n //21.\n DB::table('hoods')->insert([\n 'hood_name' => 'Elmhurst',\n 'hood_type' => 'rich',\n 'game' => '1'\n ]);\n //22.\n DB::table('hoods')->insert([\n 'hood_name' => 'Cragin',\n 'hood_type' => 'impoverished',\n 'game' => '1'\n ]);\n //23.\n DB::table('hoods')->insert([\n 'hood_name' => 'Avondale',\n 'hood_type' => 'upscale',\n 'game' => '1'\n ]);\n //24.\n DB::table('hoods')->insert([\n 'hood_name' => 'Maywood',\n 'hood_type' => 'upscale',\n 'game' => '1'\n ]);\n }", "protected function initDB() {\r\n\r\n $qry = $this->getMain()->getDatabase()->get(\"*\", [\"table\" => \"Games\", \"name\" => $this->getName()]);\r\n\r\n if($qry instanceof \\SQLite3Result) {\r\n\r\n if($qry->num_rows == 0) { // Game not initiated in the db.\r\n\r\n $id = $this->getMain()->getDatabase()->get(\"*\", [\"table\" => \"Games\"]);\r\n\r\n $v3 = $this->getLevel()->getSafeSpawn();\r\n\r\n $v3Ser = $v3->x . \",\" . $v3->y . \",\" . $v3->z; // V32String\r\n\r\n $this->getMain()->getDatabase()->insert(\"Games\", [$this->getName(), $v3Ser, $v3Ser, $this->getMain()->getMaxPlayers(), $this->getMain()->getWaitTime(), $this->getMain()->getSeekTime(), $this->getMain()->getSeekersPercentage(), $id->num_rows+1]); // Inserting the db with new queries\r\n\r\n }\r\n\r\n } else {\r\n\r\n throw new \\Exception(\"Could not contact database.\");\r\n\r\n }\r\n\r\n }", "private function selectCurrentDatabase()\n {\n $input = $this->cli->input('Please enter DB name >>');\n $dbName = $input->prompt();\n $this->currentDB = $this->mongoClient->selectDatabase($dbName)->getDatabaseName();\n $this->cli->info('Selected ' . $dbName . ' database');\n }", "public function getGames(){\n\t\t$sql = new SqlManager();\n\t\t$sql->setQuery(\"SELECT game_id FROM game WHERE game_status != 'finished'\");\n\t\t$sql->execute();\n\t\t\n\t\t$games = array();\n\t\twhile($row = $sql->fetch()){\n\t\t\t$games[] = new Game($row['game_id']);\n\t\t}\n\t\t\n\t\treturn $games;\n\t}", "public static function poll( ) {\n\t\t\t\t\n\t\tforeach(Config::get('nagios:status') as $chrURL){\n\t\t\t\n\t\t\t$objStatus = new NagiosStatus($chrURL);\n\n\t\t}\n\t\t\n\t\tdisplay(\"Total of \" . DB::count() . \" database queries executed\");\n\t\t\t\n\t\treturn true;\n\t\t\t\n\t}", "function CheckDisponiblityGame($IdJoinGame)\n{\n $dbh = ConnectDB();\n $req = $dbh->query(\"SELECT MaxPlayersGame, (SELECT COUNT(fkGamePlace) FROM fishermenland.place WHERE fkGamePlace = '$IdJoinGame') as UsedPlaces FROM fishermenland.game WHERE idGame = '$IdJoinGame'\");\n $reqArray = $req->fetch();\n\n return $reqArray;\n}", "public function get_games()\n {\n return $this->games;\n }", "public function index() {\n\n\t\t$arr = [\n\t\t\t'fields' => ['id', 'description', 'user_id', 'complete'],\n\t\t\t'recursive' => 0\n\t\t];\n\t\t$this->set('games', $this->Killer->find('all', $arr));\n\n\t}", "public function showdbs()\n {\n $this->_validate(array());\n $this->_QUERYCOUNT++;\n\n return $this->_query->showdatabases();\n }", "private function fetchGames() {\n $this->games = array();\n $this->playtimes = array();\n\n $url = $this->getBaseUrl() . '/games?xml=1';\n $gamesData = new SimpleXMLElement(file_get_contents($url));\n\n foreach($gamesData->games->game as $gameData) {\n $game = SteamGame::create($gameData);\n $this->games[$game->getAppId()] = $game;\n $recent = (float) $gameData->hoursLast2Weeks;\n $total = (float) $gameData->hoursOnRecord;\n $playtimes = array((int) ($recent * 60), (int) ($total * 60));\n $this->playtimes[$game->getAppId()] = $playtimes;\n }\n }", "public function runExists() {\r\n $db = static::getDB();\r\n $stmt = $db->query(\r\n \"SELECT * FROM runboard \"\r\n . \"WHERE fromStore='$this->fromStore' \"\r\n . \"AND toStore='$this->toStore' \"\r\n . \"AND category='$this->category' \"\r\n . \"AND item='$this->item' \"\r\n );\r\n $results = $stmt->fetchAll(PDO::FETCH_ASSOC);\r\n \r\n return $results;\r\n }", "public function run()\n {\n DB::table('games')->insert([\n [\n 'name'=>'League of Legends',\n 'isSinglePlayer'=>false,\n 'maxPlayers'=>5,\n 'MaxTeams'=>14\n ],\n [\n 'name'=>'Counter Strike Global Offensive',\n 'isSinglePlayer'=>false,\n 'maxPlayers'=>5,\n 'MaxTeams'=>14\n ],\n [\n 'name'=>'Hearthstone',\n 'isSinglePlayer'=>true,\n 'maxPlayers'=>1,\n 'MaxTeams'=>30\n ]\n ]);\n }", "public function runGame( )\n {\n\n $MODELS = include(ROOT.'/conf/rooms.php');\n $gameConfig = $MODELS[1];\n\n }", "public function run()\n {\n\t DB::table('games')->insert([\n\t\t ['name'=>'Memory','popularity'=>'18','time_min'=>'15','time_max'=>'30','approved'=>'1',],\n ['name'=>'Vier op een rij','popularity'=>'14','time_min'=>'5','time_max'=>'20','approved'=>'1',],\n ['name'=>'Monopoly','popularity'=>'12','time_min'=>'60','time_max'=>'120','approved'=>'1',],\n ['name'=>'Dammen','popularity'=>'4','time_min'=>'15','time_max'=>'30','approved'=>'1',],\n\t\t ['name'=>'Schaken','popularity'=>'2','time_min'=>'15','time_max'=>'30','approved'=>'1',],\n\t ]);\n }", "function retrieveGameInfo($name) {\n \t# Open and validate the Database connection.\n \t$conn = connect();\n\n if ($conn != null) {\n \t$sql = \"SELECT * FROM Games WHERE Name = '$name'\";\n\t\t\t$result = $conn->query($sql);\n\n\t\t\tif ($result->num_rows == 0) {\n\t\t\t\t# There are no games that match the searchTerm in the database.\n\t\t\t\t$conn->close();\n\t\t\t\treturn errors(460);\n\t\t\t}\n\n\t\t\t# Get game information\n\t\t\twhile ($row = $result -> fetch_assoc()) {\n $ans = array(\"status\" => \"COMPLETE\", \"state\" => $row[\"State\"], \"imageSource\" => $row[\"ImageSource\"],\n \"PlayStation\" => $row[\"PlayStation\"], \"PlayStation2\" => $row[\"PlayStation2\"],\n \"PlayStation3\" => $row[\"PlayStation3\"], \"PlayStation4\" => $row[\"PlayStation4\"],\n \"PSP\" => $row[\"PSP\"], \"GameboyAdvance\" => $row[\"GameboyAdvance\"],\n \"NintendoDS\" => $row[\"NintendoDS\"], \"Nintendo3DS\" => $row[\"Nintendo3DS\"],\n \"NintendoSwitch\" => $row[\"NintendoSwitch\"], \"XboxOne\" => $row[\"XboxOne\"],\n \"Blizzard\" => $row[\"Blizzard\"], \"GOG\" => $row[\"GOG\"], \"Epic\" => $row[\"Epic\"],\n \"Origin\" => $row[\"Origin\"], \"Steam\" => $row[\"Steam\"], \"Twitch\" => $row[\"Twitch\"],\n \"UPlay\" => $row[\"UPlay\"], \"Microsoft\" => $row[\"Microsoft\"]);\n\t\t\t}\n\n\t\t\t$conn->close();\n\t\t\treturn $ans;\n }\n else {\n \t# Connection to Database was not successful.\n \t$conn->close();\n \treturn errors(400);\n }\n\t}", "public function getGames()\n {\n return $this->games;\n }", "public function run()\n {\n //\n DB::table('goals')->insert([\n 'game_id' => '1',\n 'team' => 'Mighty Pucks',\n 'time' => '4:30'\n ]);\n\n DB::table('goals')->insert([\n 'game_id' => '1',\n 'team' => 'Ruthless',\n 'time' => '20:00'\n ]);\n\n DB::table('goals')->insert([\n 'game_id' => '1',\n 'team' => 'Ruthless',\n 'time' => '20:55'\n ]);\n\n DB::table('goals')->insert([\n 'game_id' => '1',\n 'team' => 'Ruthless',\n 'time' => '23:41'\n ]);\n\n DB::table('goals')->insert([\n 'game_id' => '1',\n 'team' => 'Mighty Pucks',\n 'time' => '34:18'\n ]);\n\n DB::table('goals')->insert([\n 'game_id' => '1',\n 'team' => 'Mighty Pucks',\n 'time' => '40:38'\n ]);\n\n DB::table('goals')->insert([\n 'game_id' => '1',\n 'team' => 'Ruthless',\n 'time' => '47:47'\n ]);\n }", "public function findAllGames()\n {\n return $this->entityManager->getRepository('Model\\Entity\\Game')->findAll();\n }", "public function run()\n {\n //Game::factory(100)->create();\n\n\n\n DB::table('games')->insert([\n 'master' => '1',\n 'boardgame_id' => '1',\n 'date' => '2020-06-01',\n 'time' => '17:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '1',\n 'boardgame_id' => '2',\n 'date' => '2020-06-02',\n 'time' => '16:35',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '1',\n 'boardgame_id' => '3',\n 'date' => '2020-06-05',\n 'time' => '12:15',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '2',\n 'boardgame_id' => '1',\n 'date' => '2020-06-08',\n 'time' => '17:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n DB::table('games')->insert([\n 'master' => '4',\n 'boardgame_id' => '5',\n 'date' => '2020-06-10',\n 'time' => '16:00',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '6',\n 'boardgame_id' => '3',\n 'date' => '2020-06-21',\n 'time' => '17:35',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n DB::table('games')->insert([\n 'master' => '3',\n 'boardgame_id' => '3',\n 'date' => '2020-06-01',\n 'time' => '17:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '5',\n 'boardgame_id' => '5',\n 'date' => '2020-06-05',\n 'time' => '17:05',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '7',\n 'boardgame_id' => '7',\n 'date' => '2020-06-07',\n 'time' => '17:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '6',\n 'boardgame_id' => '6',\n 'date' => '2020-06-12',\n 'time' => '18:50',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n DB::table('games')->insert([\n 'master' => '1',\n 'boardgame_id' => '10',\n 'date' => '2020-07-01',\n 'time' => '11:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '10',\n 'boardgame_id' => '2',\n 'date' => '2020-08-01',\n 'time' => '14:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n DB::table('games')->insert([\n 'master' => '9',\n 'boardgame_id' => '8',\n 'date' => '2020-06-08',\n 'time' => '20:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '7',\n 'boardgame_id' => '6',\n 'date' => '2020-02-05',\n 'time' => '08:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n DB::table('games')->insert([\n 'master' => '4',\n 'boardgame_id' => '5',\n 'date' => '2020-06-09',\n 'time' => '09:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '3',\n 'boardgame_id' => '1',\n 'date' => '2020-06-04',\n 'time' => '16:10',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n DB::table('games')->insert([\n 'master' => '8',\n 'boardgame_id' => '9',\n 'date' => '2020-06-09',\n 'time' => '10:39',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '4',\n 'boardgame_id' => '4',\n 'date' => '2019-06-01',\n 'time' => '12:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n DB::table('games')->insert([\n 'master' => '5',\n 'boardgame_id' => '5',\n 'date' => '2020-06-27',\n 'time' => '20:30',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n DB::table('games')->insert([\n 'master' => '2',\n 'boardgame_id' => '8',\n 'date' => '2020-12-01',\n 'time' => '17:35',\n \"created_at\" => date('Y-m-d H:i:s'),\n \"updated_at\" => date('Y-m-d H:i:s'),\n ]);\n\n\n\n\n $this->command->info('Games añadidas correctamente');\n }", "public function showAllDatabase(){\n $stmt = $this->pdo->query('SHOW DATABASES');\n\n //Fetch the columns from the returned PDOStatement\n $databases = $stmt->fetchAll(PDO::FETCH_COLUMN);\n //var_dump($databases);\n //Loop through the database list and print it out.\n foreach($databases as $database){\n //$database will contain the database name\n //in a string format\n echo $database, '<br>';\n }\n return 1;\n }", "public function run()\n {\n // [\"CREATED\" => 0, \"ABORTED\" => 1, \"PLAYING\" => 2, \"WONTEAM1\" => 3, \"WONTEAM2\" => 4];\n\n $g = new Game();\n\n\n $g->player1 = 1;\n $g->player2 = 2;\n $g->player3 = 3;\n $g->player4 = 4;\n\n $g->scorelimit = 1000;\n $gameState = rand(0, 4);\n $g->gamestate = $gameState;\n\n switch ($gameState) {\n case 0:\n $g->scoreteam1 = 0;\n $g->scoreteam2 = 0;\n break;\n case 3:\n $g->scoreteam1 = 1000;\n $g->scoreteam2 = rand(100, 999);\n break;\n case 4:\n $g->scoreteam1 = rand(100, 999);\n $g->scoreteam2 = 1000;\n break;\n \n default: #case ABORTED et PLAYING\n $g->scoreteam1 = rand(100, 999);\n $g->scoreteam2 = rand(100, 999);\n break;\n }\n $g->save();\n }", "function getActiveGamesList () {\n\tglobal $bdd;\n\t$req = $bdd->prepare('\n\t\tSELECT *\n\t\tFROM parties\n\t\tORDER BY id_partie;\n\t');\n\t$req->execute();\n\t$list = array();\n\twhile ($row = $req->fetch()) {\n\t\t$list[] = array(\n\t\t\t'id_partie' => $row['id_partie'],\n\t\t\t'nom' => $row['nom'],\n\t\t\t'createur' => getLoginForPlayer($row['createur']),\n\t\t\t'date_debut' => $row['date_debut'],\n\t\t\t'date_fin' => $row['date_fin'],\n\t\t\t'partie_privee' => ($row['password'] === sha1('') || $row['password'] === NULL) ? 'NO' : 'YES',\n\t\t\t'players' => getListeJoueursPartie($row['id_partie'])\n\t\t);\n\t}\n\treturn $list;\n}" ]
[ "0.63181704", "0.5849128", "0.56395024", "0.55175513", "0.550297", "0.5479659", "0.5446325", "0.53626204", "0.5309082", "0.5246008", "0.5228512", "0.5202838", "0.5187248", "0.51846135", "0.51785505", "0.5178185", "0.5170967", "0.5170245", "0.51696986", "0.51438165", "0.5139482", "0.51392126", "0.51344436", "0.5096586", "0.5069135", "0.50019366", "0.49918664", "0.4979509", "0.4963881", "0.4962833" ]
0.5993147
1
Send reminder messages to the list of appointments that have been passed to us
function sendReminders($appointmentList) { // get appointment details and email address JLoader::register('SalonBookModelAppointments', JPATH_COMPONENT_SITE.DS.'models'.DS.'appointments.php'); $appointmentModel = new SalonBookModelAppointments(); foreach ($appointmentList as $appointment) { $mailingInfo = $appointmentModel->detailsForMail($appointment['id']); // clear any old recipients $this->email = NULL; $this->setSuccessMessage($mailingInfo); // $this->mailer->addBCC("cronwatch@pelau.com"); $this->sendMail(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function appointments()\n\t{\n\t\tif (!is_cli())\n\t\t{\n\t\t\techo \"This script can only be accessed via the command line\" . PHP_EOL;\n\t\t\treturn;\n\t\t}\n\n\t\t$participations = $this->participationModel->get_confirmed_participations();\n\t\tforeach ($participations as $participation)\n\t\t{\n\t\t\t$appointment = strtotime($participation->appointment); \n\t\t\tif ($appointment > strtotime('tomorrow') && $appointment <= strtotime('tomorrow + 1 day')) \n\t\t\t{\t\t\t\t\t\n\t\t\t\treset_language(L::DUTCH);\n\t\t\t\t\n\t\t\t\t$participant = $this->participationModel->get_participant_by_participation($participation->id);\n\t\t\t\t$experiment = $this->participationModel->get_experiment_by_participation($participation->id);\n\t\t\t\t$message = email_replace('mail/reminder', $participant, $participation, $experiment);\n\t\t\n\t\t\t\t$this->email->clear();\n\t\t\t\t$this->email->from(FROM_EMAIL, FROM_EMAIL_NAME);\n\t\t\t\t$this->email->to(in_development() ? TO_EMAIL_DEV_MODE : $participant->email);\n\t\t\t\t$this->email->subject('Babylab Utrecht: Herinnering deelname');\n\t\t\t\t$this->email->message($message);\n\t\t\t\t$this->email->send();\n\t\t\t\t// DEBUG: $this->email->print_debugger();\n\t\t\t}\n\t\t}\n\t}", "public function sendEmailReminders()\n\t{\n\t\t$now = mktime(date('H'), 0, 0, 1, 1, 1970);\n\t\t$objCalendars = $this->Database->execute(\"SELECT * FROM tl_calendar WHERE subscription_reminders=1 AND ((subscription_time >= $now) AND (subscription_time <= $now + 3600))\");\n\n\t\t// Return if there are no calendars with subscriptions\n\t\tif (!$objCalendars->numRows)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$intReminders = 0;\n\t\t$objToday = new \\Date();\n\n\t\t// Send the e-mails\n\t\twhile ($objCalendars->next())\n\t\t{\n\t\t\t$arrDays = array_map('intval', trimsplit(',', $objCalendars->subscription_days));\n\n\t\t\tif (empty($arrDays))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$arrWhere = array();\n\n\t\t\t// Bulid a WHERE statement\n\t\t\tforeach ($arrDays as $intDay)\n\t\t\t{\n\t\t\t\t$objDateEvent = new \\Date(strtotime('+'.$intDay.' days'));\n\t\t\t\t$arrWhere[] = \"((e.startTime BETWEEN \" . $objDateEvent->dayBegin . \" AND \" . $objDateEvent->dayEnd . \") AND ((es.lastEmail = 0) OR (es.lastEmail NOT BETWEEN \" . $objToday->dayBegin . \" AND \" . $objToday->dayEnd . \")))\";\n\t\t\t}\n\n\t\t\t$objSubscriptions = $this->Database->prepare(\"SELECT e.*, es.member FROM tl_calendar_events_subscriptions es JOIN tl_calendar_events e ON e.id=es.pid WHERE e.pid=?\" . (!empty($arrWhere) ? \" AND (\".implode(\" OR \", $arrWhere).\")\" : \"\"))\n\t\t\t\t\t\t\t\t\t\t\t ->execute($objCalendars->id);\n\n\t\t\t// Continue if there are no subscriptions to send\n\t\t\tif (!$objSubscriptions->numRows)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$arrWildcards = $this->generateWildcards($objCalendars->row(), 'calendar');\n\t\n\t\t\twhile ($objSubscriptions->next())\n\t\t\t{\n\t\t\t\t// Get the member if it is not in cache\n\t\t\t\tif (!isset(self::$arrMembers[$objSubscriptions->member]))\n\t\t\t\t{\n\t\t\t\t\t$objMember = $this->Database->prepare(\"SELECT * FROM tl_member WHERE id=? AND email!=''\")\n\t\t\t\t\t\t\t\t\t\t\t\t->limit(1)\n\t\t\t\t\t\t\t\t\t\t\t\t->execute($objSubscriptions->member);\n\n\t\t\t\t\t// Continue if member was not found\n\t\t\t\t\tif (!$objMember->numRows)\n\t\t\t\t\t{\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tself::$arrMembers[$objSubscriptions->member] = $objMember->row();\n\t\t\t\t}\n\n\t\t\t\t$arrWildcards = array_merge($arrWildcards, $this->generateWildcards($objSubscriptions->row(), 'event'), $this->generateWildcards(self::$arrMembers[$objSubscriptions->member], 'member'));\n\n\t\t\t\t// Generate an e-mail\n\t\t\t\t$objEmail = new \\Email();\n\t\n\t\t\t\t$objEmail->from = $GLOBALS['TL_ADMIN_EMAIL'];\n\t\t\t\t$objEmail->fromName = $GLOBALS['TL_ADMIN_NAME'];\n\t\t\t\t$objEmail->subject = \\String::parseSimpleTokens($objCalendars->subscription_title, $arrWildcards);\n\t\t\t\t$objEmail->text = \\String::parseSimpleTokens($objCalendars->subscription_message, $arrWildcards);\n\n\t\t\t\t// Send an e-mail\n\t\t\t\tif ($objEmail->sendTo(self::$arrMembers[$objSubscriptions->member]['email']))\n\t\t\t\t{\n\t\t\t\t\t$intReminders++;\n\t\t\t\t\t$this->Database->prepare(\"UPDATE tl_calendar_events_subscriptions SET lastEmail=? WHERE pid=? AND member=?\")->execute(time(), $objSubscriptions->id, $objSubscriptions->member);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tself::log('A total number of ' . $intReminders . ' event reminders have been sent', 'EventsSubscriptions sendEmailReminders()', TL_INFO);\n\t}", "public function sendAssignmentNotification()\n {\n \t$ctime = date('Y-m-d'); //get current day\n \n \t//get facebook id from the user setting for facebook reminder\n \t$this->PleAssignmentReminder->virtualFields = array('tid' => 'PleUserMapTwitter.twitterId');\n \n \t//get last sent id\n \t$last_sent_id = $this->PleLastReminderSent->find('first',array('conditions' => array('PleLastReminderSent.date' => $ctime, 'PleLastReminderSent.type' => 'twitter')));\n \n \tif( count($last_sent_id) > 0 ) {\n \t\t$options['conditions'][] = array('PleAssignmentReminder.id >' => $last_sent_id['PleLastReminderSent']['last_sent_rid']);\n \t}\n \n \t//get appController class object\n \t$obj = new AppController();\n \t$assignments = $obj->getAssignmentConstraints();\n \n \t//get today assignments\n \n \t$options['conditions'][] = $assignments;\n \t$options['fields'] = array('id', 'user_id', 'assignment_uuid', 'assignment_title', 'due_date', 'course_id');\n \t$options['order'] = array('PleAssignmentReminder.id ASC');\n \n \t//execute query\n \t$assignmnet_details = $this->PleAssignmentReminder->find('all', $options);\n \t\n \n \t//send twitter reminder\n \tforeach( $assignmnet_details as $assignmnet_detail ) {\n\t $user_id = $assignmnet_detail['PleAssignmentReminder']['user_id'];\n \t\t//$to_twitter = $assignmnet_detail['PleAssignmentReminder']['tid'];\n \t\t$body = $assignmnet_detail['PleAssignmentReminder']['assignment_title'];\n\t\t$course_id = $assignmnet_detail['PleAssignmentReminder']['course_id'];\n \t\t\n\t\t//get twitter users array if user is instructor\n \t\t$twitter_users_array = $this->getChildren( $user_id, $course_id );\n\t\t\n \t\t//set display date for assignments\n \t\t$originalDate = $assignmnet_detail['PleAssignmentReminder']['due_date'];\n\t\tif($originalDate != \"\"){\n \t\t$newDate = date(\"F d, Y\", strtotime($originalDate));\n \t\t$due_date = \" due on $newDate\";\n\t\t}else{\n\t\t \t$due_date = \" is due on NA\";\n\t\t }\n \t\t\n \t\t//compose mail date\n \t\t$mail_data = \"Assignment Reminder! $course_id. Your assignment, $body, $due_date.\";\n \t\t$subject = $course_id.\" - \".$body;\n \n\t\t//send the reminder to multiple users\n \t\tforeach ($twitter_users_array as $to_twitter_data ) {\n\t\t$to_twitter = $to_twitter_data['twitter_id'];\n \t\t$to_id = $to_twitter_data['id'];\n \t\t$send_twitter = $this->sendNotification( $to_twitter, $mail_data );\n \n \t\t//check for if facebook reminder sent\n \t\tif ( $send_twitter == 1) {\n \n \t\t\t//remove the previous entry of current date\n \t\t\t$this->PleLastReminderSent->deleteAll(array('PleLastReminderSent.date'=>$ctime, 'PleLastReminderSent.type'=>'twitter'));\n \t\t\t$this->PleLastReminderSent->create();\n \n \t\t\t//update the table for sent facebook reminder\n \t\t\t$data['PleLastReminderSent']['last_sent_rid'] = $assignmnet_detail['PleAssignmentReminder']['id'];\n \t\t\t$data['PleLastReminderSent']['type'] = 'twitter';\n \t\t\t$data['PleLastReminderSent']['date'] = $ctime;\n \t\t\t$this->PleLastReminderSent->save($data);\n \n \t\t\t//create the CSV user data array\n \t\t\t$csv_data = array('id'=>$to_id, 'tid'=>$to_twitter, 'mail_data'=> $mail_data);\n \n \t\t\t//write the csv\n \t\t\t$this->writeTwitterCsv($csv_data);\n \n \t\t\t//unset the csv data array\n \t\t\tunset($csv_data);\n \t\t} else if ( $send_twitter == 2) { //twitter app not following case(can be used for future for notification on dashboard)\n \t\t\t\n \t\t} else {\n \t\t\t//handling for twitter reminder failure\n\t \t\t$tw_data = array();\n\t \t\t$tw_data['AssignmentTwitterFailure']['twitter_id'] = $to_twitter;\n\t \t\t$tw_data['AssignmentTwitterFailure']['mail_data'] = $mail_data;\n\t \t\t$this->AssignmentTwitterFailure->create();\n\t \t\t$this->AssignmentTwitterFailure->save($tw_data);\n \t\t}\n\t\t}\n \t}\n }", "public function testGetMessageListAppointments()\r\n\t{\r\n\t\t// Create an event to make sure we have at least one\r\n\t\t$obj = CAntObject::factory($this->dbh, \"calendar_event\", null, $this->user);\r\n\t\t$obj->setValue(\"name\", \"My Test Event\");\r\n\t\t$obj->setValue(\"ts_start\", date(\"m/d/Y\") . \" 12:00 PM\");\r\n\t\t$obj->setValue(\"ts_end\", date(\"m/d/Y\") . \" 01:00 PM\");\r\n\t\t$eid = $obj->save();\r\n\r\n\t\t// Get events\r\n\t\t$events = $this->backend->GetMessageList(\"calendar_root\", time()); // second param cuts off to today\r\n\t\t$found = false;\r\n\t\tforeach ($events as $evt)\r\n\t\t{\r\n\t\t\tif ($evt[\"id\"] == $eid)\r\n\t\t\t\t$found = true;\r\n\t\t}\r\n\t\t$this->assertTrue($found);\r\n\r\n\t\t// Cleanup\r\n\t\t$obj->removeHard();\r\n\t}", "public static function sendEmailReminder()\n {\n /*'text'->Notification.notification_message\n subject-> notification_subject \n\n sender can be from .env or email of currently logged user ....\n to... list from vic, vol, emp\n */\n /*Mail::raw(Input::get('notification_message'), function($message) {\n $message->from('cmpuchane@gmail.com', 'NECare System email');\n\n $message->to('cmpuchanemolefha@unomaha.edu', 'Chanda')->subject(Input::get('notification_subject'));\n });\n */\n\n $activities= Input::get('activity_id');\n //if volunteer = 'Y'\n if (Input::get('to_all_volunteers')=='Y') {\n\n\n $activitydetails = Activitydetail::where('activity_id', $activities)->value('volunteer_id'); \n $volunteers = Volunteer::where('id', $activitydetails)->get(); \n foreach ($volunteers as $volunteer) {\n Mail::raw(Input::get('notification_message'), function($message) use ($volunteer) {\n $message->from('team6necare@gmail.com', 'NECare System email');\n\n $message->to($volunteer->email, $volunteer->last_name.\", \".$volunteer->first_name)->subject(Input::get('notification_subject'));\n });\n } \n }\n\n //if victim = 'Y'\n if (Input::get('to_all_victims')=='Y') {\n\n $activitydetails = Activitydetail::where('activity_id', $activities)->value('victim_id'); \n $victims = Victim::where('id', $activitydetails)->get(); \n foreach ($victims as $victim) {\n Mail::raw(Input::get('notification_message'), function($message) use ($victim) {\n $message->from('team6necare@gmail.com', 'NECare System email');\n\n $message->to($victim->email, $victim->last_name.\", \".$victim->first_name)->subject(Input::get('notification_subject'));\n });\n }\n }\n\n //if employee = 'Y'\n if (Input::get('to_all_employees')=='Y') {\n\n\n $activitydetails = Activitydetail::where('activity_id', $activities)->value('employee_id'); \n $employees = Employee::where('id', $activitydetails)->get(); \n foreach ($employees as $employee) {\n Mail::raw(Input::get('notification_message'), function($message) use ($employee) {\n $message->from('team6necare@gmail.com', 'NECare System email');\n\n $message->to($employee->email, $employee->last_name.\", \".$employee->first_name)->subject(Input::get('notification_subject'));\n });\n } \n }\n }", "protected function executeReminder()\n\t{\n\t\t$url\t= $this->getClass( 'Url' );\n\t\t$mail\t= $this->getClass( 'Mail' );\n\t\t$date\t= date( 'Y-m-d', ( time() + ( self::NUM_DAYS_BEFORE_MATCH_REMINDER * 24 * 60 * 60 ) ) );\n\n\t\t$match\t= $this->getData( 'MatchModel', 'getMatchByDate', array( 'date' => $date ) );\n\t\tif ( !isset( $match[0] ) )\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t$match\t\t\t\t\t= array_shift( $match );\n\t\t$match['day_formated']\t= date( 'd/m/Y', strtotime( $match['day'] ) );\n\t\t$join_url\t\t\t\t= $url->buildUrl( 'Match', 'Call', array( $match['id_match'] ) );\n\n\t\t$mail->setContentType( 'text/html', 'utf8' );\n\t\t$mail->setFrom( FROM_EMAIL );\n\t\t$mail->setSubject( \"Call {$match['day_formated']}. Are you going to play?\" );\n\t\t$mail->setBody( \"We are going to play versus '{$match['rival']}' in \" . self::NUM_DAYS_BEFORE_MATCH_REMINDER . \" days and you aren't provided availability.\\n\\nIn order to close match as soon as possible, please provide here your availability <a href='$join_url'>$join_url</a>\\n\\nThank you\" );\n\n\t\t$players\t= $this->getData( 'MatchModel', 'getPlayersNotJoinedToMatch', array( 'id_match' => $match['id_match'], 'match_type' => $match['type'] ) );\n\t\tforeach( $players as $player )\n\t\t{\n\t\t\t$mail->setReceiver( $player['email'] );\n\t\t\t$mail->send();\n\t\t\t$mail->resetReceiver();\n\t\t}\n\t}", "public static function soon()\n\t{\n\t\t$reservations = \\Model_Lessontime::find(\"all\", [\n\t\t\t\"where\" => [\n\t\t\t\t[\"deleted_at\", 0],\n\t\t\t\t[\"status\", 1],\n\t\t\t\t[\"freetime_at\", \"<=\", time() + 600],\n\t\t\t\t[\"freetime_at\", \">=\", time()],\n\t\t\t]\n\t\t]);\n\n\t\tforeach($reservations as $reservation){\n\n\t\t\t// for teacher\n\t\t\t$url = \"http://game-bootcamp.com/teachers/top\";\n\n\t\t\t$body = \\View::forge(\"email/teachers/reminder_soon\",[\"url\" => $url]);\n\t\t\t$sendmail = \\Email::forge(\"JIS\");\n\t\t\t$sendmail->from(\\Config::get(\"statics.info_email\"),\\Config::get(\"statics.info_name\"));\n\t\t\t$sendmail->to($reservation->teacher->email);\n\t\t\t$sendmail->subject(\"Your lesson will start.\");\n\t\t\t$sendmail->html_body(htmlspecialchars_decode($body));\n\n\t\t\t$sendmail->send();\n\n\t\t\t// for student\n\t\t\t$url = \"http://game-bootcamp.com/students/top\";\n\n\t\t\t$body = \\View::forge(\"email/students/reminder_soon\",[\"url\" => $url]);\n\t\t\t$sendmail = \\Email::forge(\"JIS\");\n\t\t\t$sendmail->from(\\Config::get(\"statics.info_email\"),\\Config::get(\"statics.info_name\"));\n\t\t\t$sendmail->to($reservation->student->email);\n\t\t\t$sendmail->subject(\"Your lesson will start.\");\n\t\t\t$sendmail->html_body(htmlspecialchars_decode($body));\n\n\t\t\t$sendmail->send();\n\t\t}\n\t}", "public function sendReminder(){\n $sid = getenv('ACCOUNT_SID');\n $token = getenv('TWILIO_TOKEN');\n $sandbox_number=getenv('WHATSAPP_SANDBOX_NUMBER');\n $subscriber_number = \"your phone number\";\n $message = $this->todaysScripture(true);\n\n $twilio = new Client($sid, $token);\n $message = $twilio->messages\n ->create(\"whatsapp:\".$subscriber_number,\n array(\n \"from\" => \"whatsapp:\".$sandbox_number,\n \"body\" => $message\n )\n );\n }", "public function onManagerAppointments() {\nglobal $_LW, $title;\nif (!$_LW->userSetting('core_globals')) { // disallow access for non-global perm\n\tdie(header('Location: /livewhale/'));\n};\n$GLOBALS['dropdown_checked']=$this->dropdown('checked_appointments'); // create checked items dropdown menu\n$title='Appointment Slots'; // set title\n$GLOBALS['manager_appointments']=$_LW->showManager('<ul id=\"manager_appointments\" class=\"manager simple list-group\"/>', '<li id=\"item{id}\" class=\"list-group-item\">\n\t<input class=\"with_this\" type=\"checkbox\" name=\"items[]\" value=\"{id}\"/>\n\t<h5>{title}</h5>\n\t<input type=\"hidden\" name=\"appointments[]\" value=\"{id}\"/>\n</li>', 'managerQuery', 'formatManager');\n}", "public function actionNotifyToJoin(){\n $message = new YiiMailMessage;\n $message->view = 'system';\n $message->subject = \"We are happy to see you soon on Cofinder\"; // 11.6. title change\n $message->from = Yii::app()->params['noreplyEmail'];\n \n // send newsletter to all in waiting list\n $invites = Invite::model()->findAll(\"NOT ISNULL(`key`)\");\n $c = 0;\n foreach ($invites as $user){\n \n $create_at = strtotime($user->time_invited);\n if ($create_at < strtotime('-8 week') || $create_at >= strtotime('-1 day')) continue; \n if (!\n (($create_at >= strtotime('-1 week')) || \n (($create_at >= strtotime('-4 week')) && ($create_at < strtotime('-3 week'))) || \n (($create_at >= strtotime('-8 week')) && ($create_at < strtotime('-7 week'))) )\n ) continue; \n \n //set mail tracking\n $mailTracking = mailTrackingCode($user->id);\n $ml = new MailLog();\n $ml->tracking_code = mailTrackingCodeDecode($mailTracking);\n $ml->type = 'invitation-reminder';\n $ml->user_to_id = $user->id;\n $ml->save();\n \n //$activation_url = '<a href=\"'.absoluteURL().\"/user/registration?id=\".$user->key.'\">Register here</a>';\n $activation_url = mailButton(\"Register here\", absoluteURL().\"/user/registration?id=\".$user->key,'success',$mailTracking,'register-button');\n $content = \"This is just a friendly reminder to activate your account on Cofinder.\n <br /><br />\n Cofinder is a web platform through which you can share your ideas with the like minded entrepreneurs, search for people to join your project or join an interesting project yourself.\n <br /><br />If we got your attention you can \".$activation_url.\"!\";\n \n $message->setBody(array(\"content\"=>$content,\"email\"=>$user->email,\"tc\"=>$mailTracking), 'text/html');\n $message->setTo($user->email);\n Yii::app()->mail->send($message);\n $c++;\n }\n Slack::message(\"CRON >> Invite to join reminders: \".$c);\n return 0;\n }", "public function indexAction() {\n\t\t$count1 = 0;\n\t\t$invoices = Mage::getModel( 'invoicereminder/invoicereminder' )->getCollection()->getItems();\n\t\tforeach ( $invoices as $invoice ) {\n\t\t\t$count1 = $count1 + $invoice->getInvoicereminders();\n\t\t}\n\n\t\t// Send the reminders\n\t\tMage::getModel( 'invoicereminder/sender' )->prepareMail();\n\n\t\t// Calculate the total of send items after sending\n\t\t$count2 = 0;\n\t\t$invoices = Mage::getModel( 'invoicereminder/invoicereminder' )->getCollection()->getItems();\n\t\tforeach ( $invoices as $invoice ) {\n\t\t\t$count2 = $count2 + $invoice->getInvoicereminders();\n\t\t}\n\n\t\t// Output the total number of sent reminders\n\t\tMage::getSingleton( 'adminhtml/session' )->addSuccess( Mage::helper( 'invoicereminder' )->__( '%d reminder(s) sent', ( $count2 - $count1 ) ) );\n\t\t$this->getResponse()->setRedirect( $this->getUrl( '*/view/' ) );\n\n\t}", "public static function sendActivationReminders(){\n self::$UserService->sendEmailActivationReminders();\n }", "static public function sendReminders($vars)\n {\n global $whups_driver;\n\n if ($vars->get('id')) {\n $info = array('id' => $vars->get('id'));\n } elseif ($vars->get('queue')) {\n $info['queue'] = $vars->get('queue');\n if ($vars->get('category')) {\n $info['category'] = $vars->get('category');\n } else {\n // Make sure that resolved tickets aren't returned.\n $info['category'] = array('unconfirmed', 'new', 'assigned');\n }\n } else {\n throw new Whups_Exception(_(\"You must select at least one queue to send reminders for.\"));\n }\n\n $tickets = $whups_driver->getTicketsByProperties($info);\n self::sortTickets($tickets);\n if (!count($tickets)) {\n throw new Whups_Exception(_(\"No tickets matched your search criteria.\"));\n }\n\n $unassigned = $vars->get('unassigned');\n $remind = array();\n foreach ($tickets as $info) {\n $info['link'] = self::urlFor('ticket', $info['id'], true, -1);\n $owners = current($whups_driver->getOwners($info['id']));\n if (!empty($owners)) {\n foreach ($owners as $owner) {\n $remind[$owner][] = $info;\n }\n } elseif (!empty($unassigned)) {\n $remind['**' . $unassigned][] = $info;\n }\n }\n\n /* Build message template. */\n $view = new Horde_View(array('templatePath' => WHUPS_BASE . '/config'));\n $view->date = strftime($GLOBALS['prefs']->getValue('date_format'));\n\n /* Get queue specific notification message text, if available. */\n $message_file = WHUPS_BASE . '/config/reminder_email.plain';\n if (file_exists($message_file . '.local.php')) {\n $message_file .= '.local.php';\n } else {\n $message_file .= '.php';\n }\n $message_file = basename($message_file);\n\n foreach ($remind as $user => $utickets) {\n if (empty($user) || !count($utickets)) {\n continue;\n }\n $view->tickets = $utickets;\n $subject = _(\"Reminder: Your open tickets\");\n $whups_driver->mail(array('recipients' => array($user => 'owner'),\n 'subject' => $subject,\n 'view' => $view,\n 'template' => $message_file,\n 'from' => $user));\n }\n }", "public function getFollowUpAppointments($notification)\n {\n $couponsTable = CouponsTable::getTableName();\n $customerBookingsExtrasTable = CustomerBookingsToExtrasTable::getTableName();\n $paymentsTable = PaymentsTable::getTableName();\n\n try {\n $notificationType = $notification->getType()->getValue();\n\n $currentDateTime = \"STR_TO_DATE('\" . DateTimeService::getNowDateTimeInUtc() . \"', '%Y-%m-%d %H:%i:%s')\";\n\n $statement = $this->connection->query(\n \"SELECT\n a.id AS appointment_id,\n a.bookingStart AS appointment_bookingStart,\n a.bookingEnd AS appointment_bookingEnd,\n a.notifyParticipants AS appointment_notifyParticipants,\n a.serviceId AS appointment_serviceId,\n a.providerId AS appointment_providerId,\n a.locationId AS appointment_locationId,\n a.internalNotes AS appointment_internalNotes,\n a.status AS appointment_status,\n \n cb.id AS booking_id,\n cb.customerId AS booking_customerId,\n cb.status AS booking_status,\n cb.price AS booking_price,\n cb.info AS booking_info,\n cb.utcOffset AS booking_utcOffset,\n cb.aggregatedPrice AS booking_aggregatedPrice,\n cb.persons AS booking_persons,\n \n p.id AS payment_id,\n p.amount AS payment_amount,\n p.dateTime AS payment_dateTime,\n p.status AS payment_status,\n p.gateway AS payment_gateway,\n p.gatewayTitle AS payment_gatewayTitle,\n p.data AS payment_data,\n \n cbe.id AS bookingExtra_id,\n cbe.extraId AS bookingExtra_extraId,\n cbe.customerBookingId AS bookingExtra_customerBookingId,\n cbe.quantity AS bookingExtra_quantity,\n cbe.price AS bookingExtra_price,\n cbe.aggregatedPrice AS bookingExtra_aggregatedPrice,\n \n c.id AS coupon_id,\n c.code AS coupon_code,\n c.discount AS coupon_discount,\n c.deduction AS coupon_deduction,\n c.limit AS coupon_limit,\n c.customerLimit AS coupon_customerLimit,\n c.status AS coupon_status\n FROM {$this->appointmentsTable} a\n INNER JOIN {$this->bookingsTable} cb ON cb.appointmentId = a.id\n LEFT JOIN {$paymentsTable} p ON p.customerBookingId = cb.id\n LEFT JOIN {$customerBookingsExtrasTable} cbe ON cbe.customerBookingId = cb.id\n LEFT JOIN {$couponsTable} c ON c.id = cb.couponId\n WHERE a.bookingEnd BETWEEN DATE_SUB({$currentDateTime}, INTERVAL 172800 SECOND) AND {$currentDateTime}\n AND DATE_ADD(a.bookingEnd, INTERVAL {$notification->getTimeAfter()->getValue()} SECOND)\n < {$currentDateTime}\n AND a.notifyParticipants = 1 \n AND cb.status = 'approved' \n AND a.id NOT IN (\n SELECT nl.appointmentId \n FROM {$this->table} nl \n INNER JOIN {$this->notificationsTable} n ON nl.notificationId = n.id \n WHERE n.name = 'customer_appointment_follow_up' \n AND n.type = '{$notificationType}'\n )\"\n );\n\n $rows = $statement->fetchAll();\n } catch (\\Exception $e) {\n throw new QueryExecutionException('Unable to find appointments in ' . __CLASS__, $e->getCode(), $e);\n }\n\n return AppointmentFactory::createCollection($rows);\n }", "public function handle()\n {\n $agencies = Agency::all();\n\n foreach ($agencies as $agency){\n $tasks_with_custom_reminder = tasks_with_custom_reminder($agency->id);\n $tasks_reminder = tasks_reminder($agency->id);\n\n $content = '<p>Hi {STAFF_NAME},</p>\n <p>Reminder The Task <strong>#{TASK_ID}</strong> &nbsp;has a deadline to you at <strong>{TIME}</strong> in <strong>{DEADLINE}</strong>.</p>\n <p>Please check the task and Update it.</p>\n <p><br><a href=\"{TASK_URL}\"><strong>View Task</strong></a><br><br>Regards<br>The {SITE_NAME} Team</p>';\n $subject = 'TASK DEADLINE';\n\n $merged = array_merge($tasks_with_custom_reminder, $tasks_reminder);\n\n foreach ($merged as $date_remind => $custom_reminder){\n\n\n if (date('Y-m-d') == $date_remind){\n\n foreach ($custom_reminder as $time_remind => $tasks){\n\n if (date('H:i').':00' == $time_remind){\n// if ($time_remind == $time_remind){\n foreach ($tasks as $task){\n\n $staffs = $task->staff;\n $company_name = $task->agency && $task->agency->company_name_en ? $task->agency->company_name_en : 'Broker';\n foreach ($staffs as $staff){\n\n $link = 'activity/tasks/'.$task->agency_id.'/show/'.$task->id;\n $message = str_replace(\"{STAFF_NAME}\",$staff->name_en,$content);\n $message = str_replace(\"{TASK_ID}\",$task->id,$message);\n $message = str_replace(\"{DEADLINE}\",$task->deadline,$message);\n $message = str_replace(\"{{TIME}}\",$task->time,$message);\n $message = str_replace(\"{TASK_URL}\",url($link),$message);\n $message = str_replace(\"{SITE_NAME}\",$company_name,$message);\n\n SendEmail::dispatch($staff->email, $message, $subject);\n\n event(new CronJobMailEvent($task ,$staff->id,'Send Email To Reminder Staff The Deadline',\n 'task_reminder'));\n// Mail::to($staff->email)->send(new EmailGeneral($message, $subject ));\n\n }\n Notification::send($staffs, new CronJobMailNotification($task,\n 'Send Email To Reminder Staff The Deadline','task_reminder'));\n\n }\n }\n }\n }\n }\n }\n return 0;\n }", "function send_reminders_to_supervisors($courseid){\n\n global $DB, $CFG;\n $numsheets = count_unsigned_timesheets($courseid);\n $numalerts = count_outstanding_alerts($courseid);\n\n if($numsheets == 0 && $numalerts == 0) return 0;\n\n $coursecon = get_context_instance(CONTEXT_COURSE, $courseid); \n $teachers = get_enrolled_users($coursecon, 'mod/assignment:grade');\n\n $course = $DB->get_record('course', array('id'=>$courseid));\n\n $subj = '['.$course->shortname.'] Notice: '.\n ($numsheets + $numalerts).' item(s) need your attention';\n\n $from = generate_email_supportuser();\n\n $msg = 'Hello!<br /><br />This is a reminder that you have '.\n ($numsheets+$numalerts).' item(s) that require your attention. <br /><br />'.\n '<ul>';\n \n if($numsheets > 0){\n $msg .=\n '<li>'.$numsheets.' timesheet(s). To inspect these timesheets, '.\n 'visit <a href=\"'. $CFG->wwwroot.'/blocks/timetracker/supervisorsig.php?id='.\n $courseid.'\">this link</a>.</li>';\n }\n\n if($numalerts > 0){\n $msg .=\n '<li>'.$numalerts.' alert(s). To inspect these alerts, '.\n 'visit <a href=\"'. $CFG->wwwroot.'/blocks/timetracker/managealerts.php?id='.\n $courseid.'\">this link</a>. As a reminder, <span style=\"font-weight: bold\">'.\n 'workers cannot sign their timesheets if there are outstanding alerts.</span></li>';\n } \n $msg .=\n '</ul><br /><br />'.\n 'We, and your workers, '.\n 'appreciate your prompt attention to this matter.<br />'.\n '<br />Thanks,<br /><br />'.\n '<br />The TimeTracker Development Team';\n \n $count = 0;\n foreach($teachers as $teacher){\n $ok = email_to_user($teacher, $from, $subj, \n format_text_email($msg, FORMAT_HTML), $msg, '', '', false);\n if(!$ok){\n error_log('Error sending timesheet reminder email to: '.\n $teacher->firstname.' '.$teacher->lastname);\n } else {\n $count++;\n }\n }\n return $count;\n}", "public function agenda_reminder($id,$team_id= null){\n\t\t$from = date('H:i:s',strtotime ( '-70 min' , strtotime (date('H:i:s')) ));\n\t \t$to = date('H:i:s');\n\n\t $agendas = AgendaMast::whereBetween('required_at',array($from,$to))\n\t ->where('days_active','like','%'.date('N').'%')\n\t ->get(); \n\n\t foreach($agendas as $agenda){\n\t \t$users = User::whereIn('id', json_decode($agenda->permissions)->can_respond)->get();\n\t\t $team = null;\n\t\t Notification::send($users, new SendAgendaMessage($agenda,$team));\n\t }\n\t }", "protected function getPendingAppointments($args) {\n\n if ($args['ent_date_time'] == '')\n return $this->_getStatusMessage(1, 1);\n\n $this->curr_date_time = urldecode($args['ent_date_time']);\n\n $returned = $this->_validate_token($args['ent_sess_token'], $args['ent_dev_id'], '1');\n\n if (is_array($returned))\n return $returned;\n\n// $curr_date = date('Y-m-d H:i:s', time());\n// $curr_date_bfr_30min = date('Y-m-d H:i:s', time() - 1800);\n// $curr_date_bfr_1hr = date('Y-m-d H:i:s', time() - 3600);\n\n\n $selectAppntsQry = \"select p.profile_pic,p.first_name,p.phone,p.email,a.appt_lat,a.appt_long,a.appointment_dt,a.extra_notes,a.address_line1,a.address_line2,a.status,a.booking_type from appointment a, slave p \";\n $selectAppntsQry .= \" where p.slave_id = a.slave_id and a.status = 1 and a.mas_id = '\" . $this->User['entityId'] . \"' order by a.appointment_dt DESC\"; // and a.appointment_dt >= '\" . $curr_date_bfr_1hr . \"'\n\n $selectAppntsRes = mysql_query($selectAppntsQry, $this->db->conn);\n\n if (mysql_num_rows($selectAppntsRes) <= 0)\n return $this->_getStatusMessage(30, $selectAppntsQry);\n\n $pending_appt = array();\n\n while ($appnt = mysql_fetch_assoc($selectAppntsRes)) {\n\n if ($appnt['profile_pic'] == '')\n $appnt['profile_pic'] = $this->default_profile_pic;\n\n $pending_appt[] = array('apntDt' => $appnt['appointment_dt'], 'pPic' => $appnt['profile_pic'], 'email' => $appnt['email'],\n 'fname' => $appnt['first_name'], 'phone' => $appnt['phone'], 'apntTime' => date('H:i', strtotime($appnt['appointment_dt'])),\n 'apntDate' => date('Y-m-d', strtotime($appnt['appointment_dt'])), 'apptLat' => (double) $appnt['appt_lat'], 'apptLong' => (double) $appnt['appt_long'],\n 'addrLine1' => urldecode($appnt['address_line1']), 'addrLine2' => urldecode($appnt['address_line2']), 'notes' => $appnt['extra_notes'], 'bookType' => $appnt['booking_type']);\n }\n\n\n $errMsgArr = $this->_getStatusMessage(31, 2);\n\n return array('errNum' => $errMsgArr['errNum'], 'errFlag' => $errMsgArr['errFlag'], 'errMsg' => $errMsgArr['errMsg'], 'appointments' => $pending_appt); //,'test'=>$selectAppntsQry,'test1'=>$appointments);\n }", "private function upcoming_bills_reminder()\n\t{\n\t\t$recipients = array();\n\t\t$recipient = array();\n\t\t$this->load->model('Membership_model');\n\t\t$this->load->model('Accounts_model');\n\t\t$this->load->model('Settings_model');\n\t\t\n\t\t$result = $this->Membership_model->get_members();\n\t\tforeach ($result as $member)\n\t\t{\n\t\t\t$days = $this->Settings_model->email_reminder_days_get($member->id);\n\t\t\tif ($days > 0) // only do this if they want email reminders \n\t\t\t{\n\t\t\t\t$recipient['email_address'] = $member->email_address;\n\t\t\t\t$billcount = 0;\n\t\t\t\t$accounts_due = $this->Accounts_model->get_accounts_due($member->id);\n\t\t\t\t$recipient['message'] = \"G'day\";\n\t\t\t\tif ($member->first_name != '') $recipient['message'] .= \"&nbsp;\".$member->first_name;\n\t\t\t\t$recipient['message'] .= \",<br><br>Derek from remember-my-bills here. As promised, here's a list of bills due in the next \".$days.\" days<hr>\";\n\t\t\t\tforeach ($accounts_due as $account) {\n\t\t\t\t\t$billcount += 1;\n\t\t\t\t\t$recipient['message'] .= \n\t\t\t\t\t\t$account->account.\" bill for \".\n\t\t\t\t\t\t$account->amount.\" is due by \".\n\t\t\t\t\t\tdate($this->Settings_model->date_format_get_php($member->id), strtotime($account->next_due)).\"<br>\";\n\t\t\t\t}\n\t\t\t\t$recipient['message'] .= \"<Br><br>Go to <a href='http://rememberthebills.com'>http://rememberthebills.com</a> to pay them.\";\n\t\t\t\t$recipient['message'] .= \"<Br><br>Enjoy your day!<br><br>The remember-the-bills team.\";\n\t\t\t\t\n\t\t\t\t$recipient['subject'] = \"You have \".$billcount.\" bill\".($billcount > 1 ? \"s\" : \"\").\" due within the next \".$days.\" day\".($days > 1 ? \"s\" : \"\");\n\t\t\t\t//$data['ignoreMenu'] = 'true';\n\t\t\t\t//$data['main_content'] = 'email_view';\n\t\t\t\t//$recipient['message'] = $this->load->view('includes/template.php', $data, true);\n\t\t\t\t\n\t\t\t\tarray_push($recipients, $recipient);\n\t\t\t}\n\t\t}\n\t\treturn $recipients;\n\t}", "private function notify_on_add($meet, $location)\n { \n $subject = 'Shackmeet Announcement - ' . $meet->title;\n $body = $this->build_create_message($meet, $location);\n \n $notification_users = $this->load_users_to_notify();\n \n foreach ($notification_users as $user)\n {\n // Prevent shackmessages from being sent to yourself. Unless you're me. I get all the shackmessages.\n if ($user['username'] == $this->current_user->username && $user['username'] != 'omnova') \n continue;\n \n if ($user['notify_option'] == 2 || ($user['notify_option'] == 1 && $this->eligible_for_notification($user['latitude'], $user['longitude'], $location->latitude, $location->longitude, $user['notify_max_distance'])))\n { \n // Insert SM message into the queue\n if ($user['notify_shackmessage'] == 1)\n {\n $message = Model::factory('message_queue');\n $message->message_type_id = 1;\n $message->message_recipients = $user['username'];\n $message->message_subject = $subject;\n $message->message_body = $body;\n $message->meet_id = $meet->meet_id;\n $message->notification_reason_id = 1;\n $message->insert(); \n }\n \n // Insert email message into the queue\n if ($user['notify_email'] == 1)\n {\n $message = Model::factory('message_queue');\n $message->message_type_id = 2;\n $message->message_recipients = $user['email_address'];\n $message->message_subject = $subject;\n $message->message_body = $body;\n $message->meet_id = $meet->meet_id;\n $message->notification_reason_id = 1;\n $message->insert();\n }\n }\n }\n }", "public function send_meeting()\n {\n // save meeting\n if($this->user['is_matched'] > 0) {\n $update['data']['from'] = $this->session->userdata('user_id');\n $update['data']['to'] = $this->user['is_matched'];\n $update['data']['meeting_subject'] = $this->input->post('meeting_subject');\n $update['data']['meeting_desc'] = $this->input->post('meeting_desc');\n $update['data']['month'] = $this->input->post('month');\n $update['data']['day'] = $this->input->post('day');\n $update['data']['year'] = $this->input->post('year');\n $update['data']['start_ampm'] = $this->input->post('start_ampm');\n $update['data']['end_ampm'] = $this->input->post('end_ampm');\n $update['data']['stamp'] = date(\"Y-m-d H:i:s\");\n $update['data']['start_time'] = $this->input->post('start_time');\n $update['data']['end_time'] = $this->input->post('end_time');\n\n $update['table'] = 'meetings';\n $update['data']['ical'] = encrypt_url($this->Application_model->insert($update));\n\n // send emails to each party\n\n $match = $this->Application_model->get(array('table'=>'users','id'=>$this->user['is_matched']));\n $update['data']['who'][] = $match['first_name'] . \" \" . $match['last_name'];\n $update['data']['who'][] = $this->user['first_name'] . \" \" . $this->user['last_name'];\n\n //convert date and time to nice format\n $nice_date = date('D M d, Y',strtotime($this->input->post('day').\"-\".$this->input->post('month').\"-\".$this->input->post('year')));\n $update['data']['nice_date'] = $nice_date;\n\n // to requesting user\n $data = array();\n $data['user'] = $this->user['first_name'] . \" \" . $this->user['last_name'];\n $data['message'] = $update['data'];\n $message = $this->load->view('/dash/email/meeting', $data, true);\n $this->email->clear();\n $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));\n $this->email->to($this->user['email']);\n\n $full_subject = \"Invitation: \" . $nice_date . \" \" . $this->input->post('start_time') . \"\" . $this->input->post('start_ampm') . \" - \" . $this->input->post('end_time') . \"\" . $this->input->post('end_ampm') . \" (\" . $this->user['first_name'] . \" \" . $this->user['last_name'] . \")\";\n\n $this->email->subject($full_subject);\n $this->email->message($message);\n\n $result = $this->email->send(); // @todo handle false send result\n\n\n // to invitee\n $data = array();\n $data['user'] = $match['first_name'] . \" \" . $match['last_name'];\n $data['message'] = $update['data'];\n $message = $this->load->view('/dash/email/meeting', $data, true);\n $this->email->clear();\n $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));\n $this->email->to($match['email']);\n\n $full_subject = \"Invitation: \" . $nice_date . \" \" . $this->input->post('start_time') . \"\" . $this->input->post('start_ampm') . \" - \" . $this->input->post('end_time') . \"\" . $this->input->post('end_ampm') . \" (\" . $match['first_name'] . \" \" . $match['last_name'] . \")\";\n\n $this->email->subject($full_subject);\n $this->email->message($message);\n\n $result = $this->email->send(); // @todo handle false send result\n\n\n $this->session->set_flashdata(\n 'message',\n '<div class=\"alert alert-success\">Meeting Request Sent.</div>'\n );\n\n redirect('/dashboard/match','refresh');\n }else{\n\n redirect('/dashboard','refresh');\n\n }\n\n }", "public function appointments()\n {\n return view('patient.pending-appointments');\n }", "public function send_reminder()\n\t{\n\t\t$apikey = $this->input->post('apikey');\n\t\t$ip_add = $_SERVER['REMOTE_ADDR'];\n\n\t\tif($apikey=='smsatlosbanos'){\n\t \t\t$contact_number = '0'.substr($this->input->post('contact_number'), -10);\n\t \t\t$name = $this->input->post('name');\n\t \t\t$vac_date = $this->input->post('vac_date');\n\t \t\t$vac_site = $this->input->post('vac_site');\n\t \t\t$time_schedule = $this->input->post('time_schedule');\n\t \t\t$device_id = $this->input->post('device_id');\n\t \t\t$dose = $this->input->post('dose');\n\n\t \t\tif($vac_site==1){\n\t \t\t\t$site_text = 'Batong Malake Covered Court';\n\t \t\t}elseif($vac_site==2){\n\t \t\t\t$site_text = 'UPLB Copeland';\n\t \t\t}elseif($vac_site==3){\n\t \t\t\t$site_text = 'LB Evacuation Center';\n\t \t\t}\n\n\t\t\t$message = 'LB RESBAKUNA REMINDER';\n\t\t\t$message .= \"\\n\".$name;\n\t\t\t$message .= \"\\n\".date('F d, Y', strtotime($vac_date)).' At '. $time_schedule;\n\t \t\t$message .= \"\\n\".$site_text;\n\t \t\t$message .= \"\\nWear facemask and faceshield properly. Bring Ballpen.\";\n\t \t\t$message .= \"\\nSalamat po.\";\n\t\t\t$this->send_text($message,$contact_number,$device_id);\n\t\t}\n\t}", "function send_first_reminder()\n\t{\n\t\tlog_message('debug', '_message_cron/send_first_reminder');\n\t\t# get non-responsive invites that are more than FIRST_INVITE_PERIOD days old\n\t\t$list = $this->_query_reader->get_list('get_non_responsive_invitations', array('days_old'=>FIRST_INVITE_PERIOD, 'limit_text'=>' LIMIT '.MAXIMUM_INVITE_BATCH_LIMIT, 'old_message_code'=>'invitation_to_join_clout'));\n\t\tlog_message('debug', '_message_cron/send_first_reminder:: [1] list='.json_encode($list));\n\t\t# resend old invite as a reminder\n\t\t$results = array();\n\t\tforeach($list AS $i=>$row){\n\t\t\t$results[$i] = $this->_query_reader->run('resend_old_invite', array('invite_id'=>$row['invite_id'], 'new_code'=>'first_reminder_to_join_clout', 'new_status'=>'pending'));\n\t\t}\n\t\tlog_message('debug', '_message_cron/send_first_reminder:: [2] results='.json_encode($results));\n\t\t$reason = empty($results)? 'no-users': '';\n\t\treturn array('result'=>(get_decision($results)? 'SUCCESS': 'FAIL'), 'count'=>count($results), 'reason'=>$reason);\n\t}", "public function actionSuggestions(){\n return 0;\n $message = new YiiMailMessage;\n $message->view = 'system';\n $message->from = Yii::app()->params['noreplyEmail'];\n \n // send newsletter to all in waiting list\n $invites = Invite::model()->findAll(\"NOT ISNULL(`key`)\");\n foreach ($invites as $user){\n \n $create_at = strtotime($stat->time_invited);\n if ($create_at < strtotime('-8 week') || $create_at >= strtotime('-1 day')) continue; \n if (!\n (($create_at >= strtotime('-1 week')) || \n (($create_at >= strtotime('-4 week')) && ($create_at < strtotime('-3 week'))) || \n (($create_at >= strtotime('-8 week')) && ($create_at < strtotime('-7 week'))) )\n ) continue;\n \n //set mail tracking\n $mailTracking = mailTrackingCode($user->id);\n $ml = new MailLog();\n $ml->tracking_code = mailTrackingCodeDecode($mailTracking);\n $ml->type = 'suggestion-created';\n $ml->user_to_id = $user->id;\n $ml->save();\n\n $message->subject = \"We are happy to see you interested in Cofinder\"; // 11.6. title change\n \n $content = \"This is just a friendly reminder to activate your account on Cofinder.\n <br /><br />\n Cofinder is a web platform through which you can share your ideas with the like minded entrepreneurs, search for people to join your project or join an interesting project yourself.\n <br /><br />If we got your attention you can !\";\n \n $message->setBody(array(\"content\"=>$content,\"email\"=>$user->email,\"tc\"=>$mailTracking), 'text/html');\n $message->setTo($user->email);\n Yii::app()->mail->send($message);\n }\n return 0;\n\t}", "public function trainingVideoReminderMail() \n {\n $data = $this->BusinessOwner->find('all',array(\n 'conditions'=>array('BusinessOwner.group_role' => array('leader', 'co-leader'),'BusinessOwner.is_unlocked'=> 0),\n 'fields' => array('BusinessOwner.email','BusinessOwner.fname','BusinessOwner.lname','BusinessOwner.group_role')\n ));\n if(!empty($data)) {\n foreach($data as $row) { \n $emailLib = new Email();\n $subject = \"FoxHopr: Watch Training Video\";\n $template = \"training_video_reminder\";\n $format = \"both\";\n $to=$row['BusinessOwner']['email'];\n $emailLib->sendEmail($to,$subject,array('username'=>$row['BusinessOwner']['fname'].' '.$row['BusinessOwner']['lname']),$template,$format);\n }\n }\n }", "public function broadcastOn()\n {\n return ['ticket'];\n }", "public function booking_notifications() {\n $data = $this->class->get_all_active_classes();// model for data. \n log_message(\"debug\", \"Found active classes: \".count($data)); \n foreach ($data as $class) { \n log_message(\"debug\", \"Processing class ID: \" . $class->class_id);\n $current_date = date('Y-m-d');\n $freq1_date = NULL;\n $freq2_date = NULL;\n $freq3_date = NULL;\n $managers = NULL;\n if($class->min_reqd_noti_freq1 != 0) {\n $freq1_date = date ( 'Y-m-d', strtotime ( \"-$class->min_reqd_noti_freq1 day\" . $class->class_start_date) );\n } \n if($class->min_reqd_noti_freq2 != 0) {\n $freq2_date = date ( 'Y-m-d', strtotime ( \"-$class->min_reqd_noti_freq2 day\" . $class->class_start_date) );\n }\n if($class->min_reqd_noti_freq3 != 0) {\n $freq3_date = date ( 'Y-m-d', strtotime ( \"-$class->min_reqd_noti_freq3 day\" . $class->class_start_date) );\n }\n if(strtotime($freq1_date) == strtotime($current_date)) {\n $managers = $this->class->get_manager_details($class->crse_manager);\n } else if(strtotime($freq2_date) == strtotime($current_date)) {\n $managers = $this->class->get_manager_details($class->crse_manager);\n } else if(strtotime($freq3_date) == strtotime($current_date)) {\n $managers = $this->class->get_manager_details($class->crse_manager);\n }\n if (!empty($managers)) { \n foreach ($managers as $user) {\n $total_enrol_count = 0;\n $subject = NULL;\n $noti_msg_txt = NULL;\n log_message('debug', ' Sending notification to ' . $user->registered_email_id);\n if (!empty($user->registered_email_id)) {\n $total_enrol_count = $this->class->class_enrol_count($class->course_id, $class->class_id); \n $subject = \"Class booking notifications for '\".$class->class_name.\"'\";\n $noti_msg_txt = \"Dear \".$user->first_name.\" \".$user->last_name.\", <br/><br/>\"\n . \"Total seats booked in the class '\".$class->class_name.\"' as on '\".date('d-m-Y').\"' is: <b>'\".$total_enrol_count.\"'</b>\"; \n $send_result = $this->sendBookingEmail($user->registered_email_id, $noti_msg_txt, $subject);\n if (!$send_result) {\n log_message('error', ' ERROR sending notification to ' . $user->registered_email_id);\n $last_error = $this->email->print_debugger();\n log_message('error', $last_error); \n }\n } else {\n $error = ' User [ID:' . $user->user_id . '] email is empty.';\n log_message('error', $error); \n }\n }\n }\n } \n echo \"OK\";\n }", "public function getAppointmentsList() {\nglobal $_LW;\ninclude $_LW->INCLUDES_DIR_PATH.'/core/modules/core/includes/class.livewhale_manager.php'; // include manager class\n$_LW->module='appointments';\n$GLOBALS['manager_appointments']=$_LW->showManager('<ul id=\"manager_appointments\" class=\"manager simple list-group\"/>', '<li id=\"item{id}\" class=\"{class} list-group-item\">\n\t{checkbox}\n\t<h5>{title}</h5>\n\t{appointments}\n</li>', 'managerQuery', 'formatManager');\nreturn $_LW->xphp->parseString('<xphp var=\"manager_appointments\"/>');\n}", "function resendApplicationEmail(){\n\t\t//echo \"resend... AppReID: \" . $_POST['appReId'];\n\t\t$db\t\t= JFactory::getDbo();\n\t\t$query\t= $db->getQuery(true);\n\n\t\t$query->select($db->nameQuote('s_name'));\n\t\t$query->select($db->nameQuote('s_prename'));\n\t\t$query->select($db->nameQuote('s_address'));\n\t\t$query->select($db->nameQuote('s_plz'));\n\t\t$query->select($db->nameQuote('s_city'));\n\t\t$query->select($db->nameQuote('s_phone'));\n\t\t$query->select($db->nameQuote('s_email'));\n\t\t$query->select($db->nameQuote('idt_drivin_event_apply')); \n\t\t$query->select($db->nameQuote('s_title'));\t\t\n\t\t$query->from($db->nameQuote('#__jevent_events_apply'));\n\t\t$query->where($db->nameQuote('idt_drivin_event_apply') . '=' . $_POST['appReId']);\n\t\tif(!$bCanceled)\n\t\t\t$query->where($db->nameQuote('dt_Cancel') . ' is null');\n\t\telse\n\t\t\t$query->where($db->nameQuote('dt_Cancel') . ' is not null');\n\n\t\t$db->setQuery($query);\n\t\tif ($link = $db->loadRowList()) {\n\t\t\t//echo \" Count: \" . count($link);\n\t\t\t//echo \" Item: \" . $link[0][0];\n\t\t\t$mailer = new jEventMailer();\n\t\t\t//$mailer->test();\n\t\t\tif(!$mailer->sendApplicationEmail2(1, $link, $this->getEventById(), false)){\n\t\t\t\t$this->setError($mailer->error);\n\t\t\t\techo \"Eroooor \" . $mailer->error;\n\t\t\t}\n\t\t}else{\n\t\t\techo \"No Records found\";\n\t\t}\n\t\treturn true;\n\t}" ]
[ "0.8026194", "0.7020604", "0.67048925", "0.66590756", "0.6545574", "0.64621097", "0.6336447", "0.6316557", "0.6287346", "0.6232709", "0.620149", "0.6109475", "0.60863554", "0.60080373", "0.5963936", "0.59571224", "0.5953585", "0.5945126", "0.5907907", "0.59026027", "0.58853006", "0.5856908", "0.5852093", "0.5791652", "0.5748522", "0.57464886", "0.5729569", "0.5676186", "0.5674008", "0.5656599" ]
0.7875032
1
Updates the specified agent version. Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version resource.
public function UpdateVersion(\Google\Cloud\Dialogflow\V2\UpdateVersionRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.dialogflow.v2.Versions/UpdateVersion', $argument, ['\Google\Cloud\Dialogflow\V2\Version', 'decode'], $metadata, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setUpdateVersion($val)\n {\n $this->_propDict[\"updateVersion\"] = $val;\n return $this;\n }", "public function setAgentVersion($agentVersion)\n {\n $this->_data['ai.internal.agentVersion'] = $agentVersion;\n }", "public function updateVersion($version)\n {\n $config_file = new File(MAIN_PATH . '/config/build.ini');\n $lines = $config_file->readLines();\n foreach ($lines as &$line) {\n // We update the line with the \"current_version\" parameter\n if (strpos($line, 'current_version') === 0) {\n $line = 'current_version = ' . $version;\n break;\n }\n }\n // We rewrite the file with the updated parameter\n $config_file->writeLines($lines, true, false);\n }", "public function update(Request $request, Version $version)\n {\n //\n }", "public function updateVersion(string $extension, ?string $version): void\n {\n $this->set(\"{$extension}/version\", $version);\n $this->updateHistory($extension, $version);\n }", "public function setVersion($version)\n {\n $this->version = $version;\n }", "public function setVersion(Version $version): void\n {\n $this->version = $version;\n }", "public function setVersion($version)\n {\n $this->version = $version;\n }", "public function setVersion($version)\n {\n $this->version = $version;\n }", "public function setVersion($version)\n {\n $this->version = $version;\n }", "public function setVersion($value){\n $this->version = $value;\n }", "public function setApiVersion($version)\n {\n if (ctype_digit(strval($version))) {\n $this->apiVersion = (int)$version;\n }\n }", "public function setVersion($version) {}", "public function setVersion($version) {}", "public function setVersion($version) {\n\t\t$this->version = $version;\n\t}", "public function setVersion($version)\n\t{\n\t\t$this->version = (int) $version;\n\t}", "public function update_version_number(){\n $plugin_settings = nf_get_settings();\n\n if ( !isset ( $plugin_settings['version'] ) OR ( NF_PLUGIN_VERSION != $plugin_settings['version'] ) ) {\n $plugin_settings['version'] = NF_PLUGIN_VERSION;\n update_option( 'ninja_forms_settings', $plugin_settings );\n }\n }", "public function setApiVersion($version)\n {\n $this->_apiVersion = (int)$version;\n }", "public function update(Request $request, OSVersion $osVersion)\n {\n $data = $request->validate([\n 'name' => ['required']\n ]);\n\n $osVersion->update($data);\n\n return redirect('/admin/os-versions');\n }", "final public function setApiVersion($version)\n {\n $this->_apiVersion = $version;\n }", "public function setVersion(string $version): void\n {\n $this->version = $version;\n }", "public function setVersion($var)\n {\n GPBUtil::checkInt32($var);\n $this->version = $var;\n\n return $this;\n }", "public function setVersion($var)\n {\n GPBUtil::checkInt32($var);\n $this->version = $var;\n\n return $this;\n }", "public function SetVersion($version)\n {\n $this->messageBuilder->SetVersion($version);\n }", "public function setVersion($version);", "public function setVersion($version);", "public function setVersion($version);", "public function setVersion($version);", "public function setVersion($version);", "public function setVersion(string $version);" ]
[ "0.58730173", "0.58695847", "0.58048266", "0.5606574", "0.55426466", "0.54943204", "0.54700434", "0.54400736", "0.54400736", "0.54400736", "0.54358196", "0.5432168", "0.5421149", "0.5421149", "0.54122525", "0.5388079", "0.53782827", "0.53386074", "0.5330476", "0.5304612", "0.5282869", "0.52772796", "0.52772796", "0.52651674", "0.5261862", "0.5261862", "0.5261862", "0.5261862", "0.5261862", "0.52597344" ]
0.7078659
0
Invalidates the cache key on edit_comment and wp_insert_comment. If a list of post IDs is provided, the invalidation will only happen if the edited/created comments belongs to one of the given posts.
public function expires_on_comment_save( $post_ids = array() ) { $invalidation = new \Cache\Invalidation\Hook( $this ); $callback = null; if ( ! empty( $post_ids ) ) { $callback = new SerializableClosure( function ( $id ) use ( $post_ids ) { $comment = get_comment( $id ); return in_array( $comment->comment_post_ID, $post_ids ); } ); } $invalidation->on_hook_with_callable( 'edit_comment', $callback ); $invalidation->on_hook_with_callable( 'wp_insert_comment', $callback ); return $this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clean_comment_cache($ids)\n {\n }", "function _prime_comment_caches($comment_ids, $update_meta_cache = \\true)\n {\n }", "function update_postmeta_cache($post_ids)\n {\n }", "function _prime_post_caches($ids, $update_term_cache = \\true, $update_meta_cache = \\true)\n {\n }", "public function updating(Post $post)\n {\n //---------we kill cache route post.show whene updating post-------------\n\n Cache::forget(\"show-post-{$post->id}\");\n cache::forget(\"comment-show-{$post->id}\");\n }", "function update_post_cache(&$posts)\n {\n }", "function update_comment_cache($comments, $update_meta_cache = \\true)\n {\n }", "function update_post_author_caches($posts)\n {\n }", "public static function action_clean_post_cache( $post_id ) {\n\t\t$type = get_post_type( $post_id );\n\t\t// Ignore revisions, which aren't ever displayed on the site.\n\t\tif ( $type && 'revision' === $type ) {\n\t\t\treturn;\n\t\t}\n\t\tpantheon_wp_clear_edge_keys( array( 'post-' . $post_id, 'rest-post-' . $post_id ) );\n\t}", "function clean_post_cache($post)\n {\n }", "function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = \\true, $update_meta_cache = \\true)\n {\n }", "public function delete_oembed_caches($post_id)\n {\n }", "function tiny_cache_actions() {\n\n // Post ID is received.\n add_action( 'save_post', 'tiny_cache_delete_the_content', 0 );\n add_action( 'edit_post', 'tiny_cache_delete_the_content', 0 );\n add_action( 'delete_post', 'tiny_cache_delete_the_content', 0 );\n add_action( 'wp_trash_post', 'tiny_cache_delete_the_content', 0 );\n add_action( 'clean_post_cache', 'tiny_cache_delete_the_content', 0 );\n // Post as third argument.\n add_action( 'transition_post_status', 'tiny_cache_post_transition', 10, 3 );\n}", "public function clear_cache($entry_ids)\n\t{\n\t\tif ( ! is_array($entry_ids))\n\t\t{\n\t\t\t$entry_ids = array($entry_ids);\n\t\t}\n\t\t\n\t\tforeach ($entry_ids as $entry_id)\n\t\t{\n\t\t\tunset($this->entries[$entry_id]);\n\t\t}\n\t}", "public function optimize() {\n\t\t$clean = \"DELETE FROM `\" . $this->wpdb->commentmeta . \"` WHERE comment_id NOT IN (SELECT comment_id FROM `\" . $this->wpdb->comments . \"`)\";\n\n\t\t// if posted ids in params, then remove only selected items. used by preview widget.\n\t\tif (isset($this->data['ids'])) {\n\t\t\t$clean .= ' AND meta_id in ('.join(',', $this->data['ids']).')';\n\t\t}\n\n\t\t$clean .= \";\";\n\n\t\t$commentstrash_meta = $this->query($clean);\n\t\t$this->processed_trash_count += $commentstrash_meta;\n\n\t\t$clean = \"DELETE FROM `\" . $this->wpdb->commentmeta . \"` WHERE meta_key LIKE '%akismet%'\";\n\n\t\t// if posted ids in params, then remove only selected items. used by preview widget.\n\t\tif (isset($this->data['ids'])) {\n\t\t\t$clean .= ' AND meta_id in ('.join(',', $this->data['ids']).')';\n\t\t}\n\n\t\t$clean .= \";\";\n\n\t\t$commentstrash_meta2 = $this->query($clean);\n\t\t$this->processed_akismet_count += $commentstrash_meta2;\n\t}", "public function expire_posts() {\n\n\t\t$expire_urls = array_unique($this->expire_urls);\n\n\t\tforeach($expire_urls as $url) {\n\n\t\t\t$this->expire($url);\n\t\t}\n \n\t\tif (!empty($expire_urls)) {\n \n\t\t\t// Clear the homepage too to take in to account updated posts\n\t\t\t$this->expire(home_url());\n\n\t\t\t// If content has changed we should really update /sitemap.xml to keep the search engines happy\n\t\t\t$this->expire(site_url() . '/sitemap.xml');\n\n\t\t} \n\n\t}", "private function update_atozsites_comment(WP_Post $post)\n {\n $comment_count = wp_count_comments($post->ID);\n\n if (!is_object($comment_count) || $comment_count->approved < 3) {\n return;\n }\n\n $atozsites_comment = array_reduce(get_comments(array('post_id' => $post->ID)), array($this, 'compare_comments'));\n \n /**\n\t\t * Filter: atozsites_allow_post_author\n\t\t *\n\t\t * Whether to allow post author comments to be atozsites.\n\t\t *\n\t\t * @since 1.1.6\n\t\t *\n\t\t * @param bool false if not, true if yes\n\t\t */\n $allow_post_author = apply_filters( 'atozsites_allow_post_author', false );\n if ( $post->post_author === $atozsites_comment->user_id && ! $allow_post_author ) {\n\t return;\n }\n\n if ($atozsites_comment instanceof WP_Comment) {\n update_post_meta($post->ID, $this->atozsites_comment_id_meta_key, $atozsites_comment->comment_ID);\n }\n }", "function tiny_cache_delete_the_content( $post_id ) {\n\n wp_cache_delete( $post_id, 'the_content' );\n}", "public function except(...$post_ids): Collection;", "function update_post_parent_caches($posts)\n {\n }", "public function handle_deletion_cache( $post_id ) {\n\t\tif ( get_post_status( $post_id ) !== 'publish' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tself::$cache_trigger_url = get_permalink( $post_id );\n\t\tself::$status_before = 'publish';\n\t\tself::$status_after = 'delete';\n\t\tself::$suppress_notification = true;\n\t\tself::$which_cloudflare_method = __METHOD__;\n\n\t\tself::purge_cloudflare_cache();\n\t}", "static function del($postID, $callback = false)\n\t{\n\t\t$crons = get_option('delibera-cron', array());\n\t\tif(!is_array($crons)) $crons = array();\n\t\n\t\tif( is_array($callback) )\n\t\t{\n\t\t\t$callback = $callback[0].'_'.$callback[1];\n\t\t}\n\t\n\t\t$crons_new = array();\n\t\tforeach($crons as $cron_data => $cron_value)\n\t\t{\n\t\t\t$new_cron = array();\n\t\t\tforeach ($cron_value as $call)\n\t\t\t{\n\t\t\t\t$cron_callback = $call['call_back'];\n\t\t\t\tif( is_array($call['call_back']) )\n\t\t\t\t{\n\t\t\t\t\t$cron_callback = $call['call_back'][0].'_'.$call['call_back'][1];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(array_key_exists('post_id', $call['args'])) $call['args']['post_ID'] = $call['args']['post_id'];\n\t\t\t\t\n\t\t\t\tif($call['args']['post_ID'] != $postID || ($callback !== false && $callback != $cron_callback ))\n\t\t\t\t{\n\t\t\t\t\t$new_cron[] = $call;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(count($new_cron) > 0)\n\t\t\t{\n\t\t\t\t$crons_new[$cron_data] = $new_cron;\n\t\t\t}\n\t\t}\n\t\n\t\tksort($crons_new);\n\t\tupdate_option('delibera-cron', $crons_new);\n\t}", "public function updated(Comment $comment)\n {\n Cache::forget('latest-posts');\n Cache::forget('paginated-posts');\n Cache::forget('comments_verified');\n Cache::forget('comments_not_verified');\n Cache::forget('comment_'.$comment->id);\n Cache::forget('top-posts');\n }", "function challenge_check($comment_id)\n{\n global $wpdb, $user_ID, $comment_count_cache;\n \n if ($user_ID) {\n return;\n }\n \n $hash = $_POST['challenge_hash'];\n $challenge = md5($_POST['challenge']);\n $post_id = $_POST['comment_post_ID'];\n \n if ($hash != $challenge) {\n $wpdb->query(\"DELETE FROM {$wpdb->comments} WHERE comment_ID = {$comment_id}\");\n $count = $wpdb->get_var(\"select count(*) from $wpdb->comments where comment_post_id = {$post_id} and comment_approved = '1'\"); \n $wpdb->query(\"update $wpdb->posts set comment_count = {$count} where ID = {$post_id}\");\n wp_die(__('Desculpe, mas a conta não está correta.'));\n }\n}", "function clear_global_post_cache($post_id)\n {\n }", "public static function action_clean_comment_cache( $comment_id ) {\n\t\tpantheon_wp_clear_edge_keys( array( 'rest-comment-' . $comment_id ) );\n\t}", "function get_the_image_delete_cache_by_post( $post_id ) {\n\twp_cache_delete( $post_id, 'get_the_image' );\n}", "function _close_comments_for_old_posts($posts, $query)\n {\n }", "function _prime_site_caches($ids, $update_meta_cache = \\true)\n {\n }", "function _prime_site_caches( $ids ) {\n\tglobal $wpdb;\n\n\t$non_cached_ids = _get_non_cached_ids( $ids, 'sites' );\n\tif ( ! empty( $non_cached_ids ) ) {\n\t\t$fresh_sites = $wpdb->get_results( sprintf( \"SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)\", join( \",\", array_map( 'intval', $non_cached_ids ) ) ) );\n\n\t\tupdate_site_cache( $fresh_sites );\n\t}\n}" ]
[ "0.66274947", "0.63293374", "0.6029599", "0.5792569", "0.5717498", "0.55613804", "0.55031", "0.54733425", "0.54707885", "0.52404207", "0.52330625", "0.5191158", "0.50896", "0.50280756", "0.49876598", "0.49760443", "0.49303183", "0.4894563", "0.48845637", "0.48414186", "0.48329446", "0.48046082", "0.47987002", "0.4793482", "0.479153", "0.47577137", "0.47536102", "0.47520846", "0.47256532", "0.47087023" ]
0.69485825
0
Builds LibriProducts from ONIX file.
public static function makeFromFile(string $file): array { // get catalog update identifier list($catalogUpdateIdentifier,$suffix) = explode('.',basename($file)); // get date of catalog update (don't use simplexml, the file might be very large) $dateOfCatalogUpdate = new Carbon(self::getDateOfCatalogUpdate($file)); // get number of items in file to make a progress bar $numberOfItems = substr_count(file_get_contents($file),'<product>'); $progress = ConsoleOutput::progress($numberOfItems); // holds all products $products = []; $productHandler = function($product) use ($progress,&$products,$dateOfCatalogUpdate, $catalogUpdateIdentifier) { ConsoleOutput::advance($progress); try { // create Object from ONIX message $libriProduct = self::create($product); if(!is_null($libriProduct)) { $libriProduct->DateOfData = $dateOfCatalogUpdate; $libriProduct->LibriUpdate = $catalogUpdateIdentifier; $products[] = $libriProduct; } } catch (MissingDataException $e) { ConsoleOutput::error($e->getMessage()); Log::warning($e->getMessage()); } }; try { $parser = new Parser(); // create instance of PINOpar Parser $parser->setProductHandler($productHandler); // define a product handler which will be called for each <product> tag $parser->useFile($file); $parser->parse(); ConsoleOutput::finish($progress); } catch(PONIpar\XMLException $e) { // error in ONIXMessage, e.g. missing <ProductIdentifier> // todo: find a way to continue parsing the onixmessage ConsoleOutput::error($e->getMessage()); Log::warning($e->getMessage()); } catch(Exception $e) { ConsoleOutput::error($e->getMessage()); Log::error($e->getMessage()); // todo: find a way to continue parsing after caught exception } // clear $products from null values $products = array_filter($products, function($item) { return !is_null($item); }); return $products; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function create(PONIpar\\Product $onix){\n $libriProduct = new LibriProduct;\n $controller = new LibriProductFactory();\n $controller->product = $onix;\n\n $recordReference = $controller->getRecordReference();\n\n /* ---------------- required data -------------- */\n $libriProduct->RecordReference = $recordReference;\n $libriProduct->ProductForm = $controller->getProductForm();\n $libriProduct->DistinctiveTitle = $controller->getDistinctiveTitle();\n\n $tmpReference = $controller->getProductReference();\n if(!$tmpReference) return null; // if no valid reference was found, this product is invalid\n\n $libriProduct->ProductReference = (String) $tmpReference[0];\n $libriProduct->ProductReferenceType = (String) $tmpReference[1];\n\n // test required fields\n $requiredFields = [\n 'RecordReference',\n 'ProductReference',\n 'DistinctiveTitle',\n 'ProductForm'\n ];\n\n foreach ($requiredFields as $field) {\n if ($libriProduct->$field === false) throw new MissingDataException(\"Content of `$field` not found or empty.\", $recordReference);\n }\n\n /* ---------------- optional data -------------- */\n $libriProduct->OrderTime = (Integer) $controller->getOrderTime();\n $libriProduct->QuantityOnHand = (Integer) $controller->getQuantityOnHand();\n $libriProduct->AvailabilityStatus = (Integer) $controller->getAvailabilityStatus();\n $libriProduct->NumberOfPages = (Integer) $controller->getNumberOfPages();\n $libriProduct->VLBSchemeOld = (Integer) $controller->getVLBSchemeOld();\n $libriProduct->ProductWeight = (Integer) $controller->getProductWeight();\n $libriProduct->ProductWidth = (Integer) $controller->getProductWidth();\n $libriProduct->ProductThickness = (Integer) $controller->getProductThickness();\n $libriProduct->AudienceCodeValue = (Integer) $controller->getAudienceCodeValue();\n\n $libriProduct->Author = (String) $controller->getAuthor();\n $libriProduct->CoverLink = (String) $controller->getCoverLink();\n $libriProduct->ProductLanguage = (String) $controller->getProductLanguage();\n $libriProduct->PublisherName = (String) $controller->getPublisherName();\n $libriProduct->PublicationDate = (String) $controller->getPublicationDate();\n $libriProduct->Blurb = (String) $controller->getBlurb();\n\n $controller->CurrentPrice = $controller->getPriceDeCurrent();\n $libriProduct->PriceAmount = (float) $controller->getPriceAmount();\n $libriProduct->PriceTypeCode = (Integer) $controller->getPriceTypeCode();\n $libriProduct->DiscountPercent = (Integer) $controller->getDiscountPercent();\n $libriProduct->TaxRateCode1 = (String) $controller->getTaxRateCode1();\n $libriProduct->NotificationType = $controller->getNotificationType();\n $libriProduct->Lib_MSNo = $controller->getLibriNotificationKey();\n $libriProduct->AvailabilityCode = $controller->getAvailabilityCode();\n $libriProduct->PublishingStatus = $controller->getPublishingStatus();\n\n return $libriProduct;\n }", "public function make_gear_products_import() {\n\t\tWP_CLI::line( 'GO!' );\n\t\t$rei = file_get_contents( get_stylesheet_directory_uri() . '/inc/wp-cli/rei.xml' );\n\t\t$xml = simplexml_load_string( $rei );\n\t\tforeach ($xml->Product as $products ) {\n\t\t\t$post = array(\n\t\t\t\t'post_title' => $products->Product_Name,\n\t\t\t\t'post_type' \t=> 'gear',\n\t\t\t\t'post_status' => 'publish',\n\t\t\t\t'post_author' => 0,\n\t\t\t\t'post_content'\t=> $products->Long_Description,\n\t\t\t\t'post_excerpt'\t=> $products->Short_Description,\n\t\t\t);\n\n\t\t\t$id = wp_insert_post( $post );\n\n\t\t\tif ( $id ) {\n\t\t\t\tWP_CLI::success( get_the_title( $id ) );\n\t\t\t} elseif ( is_wp_error( $id ) ) {\n\t\t\t\tWP_CLI::warning( $products->Product_Name );\n\t\t\t}\n\n\t\t\t$terms = wp_set_object_terms( $id, array( $products->Category, $products->SubCategory ), 'category', true );\n\n\t\t\t$tags = explode( ',', $products->Keywords );\n\n\t\t\tprint_r( $tags );\n\n\t\t\t$the_tags = wp_set_object_terms( $id, $tags, 'post_tag', true );\n\n\t\t\t$the_tags = wp_set_object_terms( $id, $products->BrandName, 'post_tag', true );\n\n\t\t\t$keys = array( 'SKU',\n\t\t\t\t'Manufacturer_Id',\n\t\t\t\t'Brand_Name',\n\t\t\t\t'Thumb_URL',\n\t\t\t\t'Medium_Image_URL',\n\t\t\t\t'Image_URL',\n\t\t\t\t'Buy_Link',\n\t\t\t\t'Retail_Price',\n\t\t\t\t'Sale_Price',\n\t\t\t\t'Brand_Page_Link',\n\t\t\t\t'Brand_Logo_Image',\n\t\t\t\t'Product_Page_View_Tracking',\n\t\t\t\t'Product_Content_Widget',\n\t\t\t\t'Google_Categorization'\n\t\t\t\t);\n\t\t\tWP_CLI::line('| Post ID ' . $id );\n\t\t\t// WP_CLI::line('| Post SKU' . ( $sku ) ? get_post_meta( $id, 'SKU', true ) : 'Nope...' );\n\t\t\tforeach ( $keys as $key ) {\n\t\t\t\tWP_CLI::line( '| ' . $key );\n\t\t\t\t$meta = ( !empty( $products->$key ) ) ? add_post_meta( $id, $key, (string) $products->$key ) : null;\n\t\t\t\tif ( $meta ) {\n\t\t\t\t\tWP_CLI::line( '| Added: ' . $products->$key );\n\t\t\t\t} else {\n\t\t\t\t\tWP_CLI::warning( 'Didn\\'t add ' . $key );\n\t\t\t\t}\n\t\t\t}\n\t\t\tWP_CLI::line( '' );\n\t\t\tWP_CLI::line( '' );\n\t\t\tWP_CLI::line( '' );\n\t\t}\n\t}", "function webmap_compo_lib_xml_build()\r\n{\r\n\t$this->webmap_compo_lib_xml_base();\r\n}", "function dbInstall($data) {\r\n/*\r\nproducts - Products\r\nproduct_categories - Categories\r\nshopping_list_items - Shopping List\r\n*/\r\n $data = <<<EOD\r\n\r\n products: ID int(10) unsigned NOT NULL auto_increment\r\n products: TITLE varchar(255) NOT NULL DEFAULT ''\r\n products: CATEGORY_ID int(10) NOT NULL DEFAULT '0'\r\n products: IMAGE varchar(70) NOT NULL DEFAULT ''\r\n products: WILL_EXPIRE int(3) NOT NULL DEFAULT '0'\r\n products: EXPIRE_DATE date\r\n products: EXPIRE_DEFAULT int(10) NOT NULL DEFAULT '0'\r\n products: UPDATED datetime\r\n products: QTY int(10) NOT NULL DEFAULT '0'\r\n products: MIN_QTY int(10) NOT NULL DEFAULT '0'\r\n products: DETAILS text\r\n products: DEFAULT_PRICE float DEFAULT '0' NOT NULL\r\n\r\n product_categories: ID int(10) unsigned NOT NULL auto_increment\r\n product_categories: TITLE varchar(255) NOT NULL DEFAULT ''\r\n product_categories: PRIORITY int(10) NOT NULL DEFAULT '0'\r\n product_categories: PARENT_ID int(10) NOT NULL DEFAULT '0'\r\n product_categories: SUB_LIST text\r\n product_categories: PARENT_LIST text\r\n\r\n shopping_list_items: ID int(10) unsigned NOT NULL auto_increment\r\n shopping_list_items: TITLE varchar(255) NOT NULL DEFAULT ''\r\n shopping_list_items: PRODUCT_ID int(10) NOT NULL DEFAULT '0'\r\n shopping_list_items: PRICE float DEFAULT '0' NOT NULL\r\n shopping_list_items: CODE varchar(255) NOT NULL DEFAULT ''\r\n shopping_list_items: IN_CART int(3) NOT NULL DEFAULT '0'\r\n\r\n product_log: ID int(10) unsigned NOT NULL auto_increment\r\n product_log: TITLE varchar(255) NOT NULL DEFAULT ''\r\n product_log: PRODUCT_ID int(10) NOT NULL DEFAULT '0'\r\n product_log: CODE_ID int(10) NOT NULL DEFAULT '0'\r\n product_log: QTY int(10) NOT NULL DEFAULT '0'\r\n product_log: ACTION char(10) NOT NULL DEFAULT ''\r\n product_log: UPDATED datetime\r\n\r\n product_codes: ID int(10) unsigned NOT NULL auto_increment\r\n product_codes: TITLE varchar(255) NOT NULL DEFAULT ''\r\n product_codes: CODE varchar(255) NOT NULL DEFAULT ''\r\n product_codes: PRODUCT_ID int(10) NOT NULL DEFAULT '0'\r\n\r\n\r\nEOD;\r\n parent::dbInstall($data);\r\n }", "function getProducts(){\r\n\r\n\t$products = false;\r\n\t$pList = simplexml_load_file('data/productList.xml');\r\n\tif( isset( $pList->product ) ){\r\n\t\t$products = array();\r\n\t\tforeach ($pList->product as $p) {\r\n\t\t\t$cur = array();\r\n\t\t\t\r\n\t\t\t$cur['id'] \t\t\t= (string)$p->id;\r\n\t\t\t$cur['name'] \t\t= (string)$p->name;\r\n\t\t\t$cur['category'] \t= (string)$p->category;\r\n\t\t\t$cur['price'] \t\t= (string)$p->price;\r\n\t\t\t$cur['quantity'] \t= (string)$p->quantity;\r\n\t\t\t$cur['offer'] \t\t= (string)$p->offer;\r\n\t\t\t$cur['picture'] \t= (string)$p->picture;\r\n\t\t\t$cur['date'] \t\t= (string)$p->date;\r\n\t\t\t$cur['userId'] \t\t= (string)$p->userId;\r\n\t\t\t$cur['status'] \t\t= (string)$p->status;\r\n\r\n\t\t\t$products[] = $cur;\r\n\t\t\tunset($cur);\r\n\t\t}\t\r\n\t}\r\n\t\r\n\treturn $products;\r\n}", "protected static function buildBaseTcaFromSingleFiles() {}", "public function buildCoreFields(): void\n {\n //====================================================================//\n // Product SKU\n $this->fieldsFactory()->create(SPL_T_VARCHAR)\n ->identifier(\"identifier\")\n ->name(\"Product SKU\")\n ->microData(\"http://schema.org/Product\", \"model\")\n ->isListed()\n ->isReadOnly()\n ;\n //====================================================================//\n // Active => Product Is Enables & Visible\n $this->fieldsFactory()->create(SPL_T_BOOL)\n ->identifier(\"enabled\")\n ->name(\"Enabled\")\n ->microData(\"http://schema.org/Product\", \"offered\")\n ->isListed()\n ;\n //====================================================================//\n // Product Family\n $this->fieldsFactory()->create(SPL_T_VARCHAR)\n ->identifier(\"family_code\")\n ->name(\"Family Code\")\n ->group(\"Metadata\")\n ->addChoices($this->variants->getFamilyChoices())\n ->microData(\"http://schema.org/Product\", \"famillyCode\")\n ->isReadOnly()\n ;\n //====================================================================//\n // Product Family Name\n $this->fieldsFactory()->create(SPL_T_VARCHAR)\n ->identifier(\"family_label\")\n ->name(\"Family Name\")\n ->group(\"Metadata\")\n ->microData(\"http://schema.org/Product\", \"famillyName\")\n ->isReadOnly()\n ;\n //====================================================================//\n // Product Family Variant\n $this->fieldsFactory()->create(SPL_T_VARCHAR)\n ->identifier(\"family_variant_code\")\n ->name(\"Family Variant Code\")\n ->group(\"Metadata\")\n ->addChoices($this->variants->getFamilyChoices())\n ->microData(\"http://schema.org/Product\", \"famillyVariantCode\")\n ->isNotTested()\n ;\n //====================================================================//\n // PhpUnit/Travis Mode => Force Variation Types\n if (Splash::isTravisMode()) {\n $this->fieldsFactory()->addChoice(\"clothing_color\", \"Color\");\n }\n }", "public abstract function build();", "public abstract function build();", "abstract function build();", "abstract public function build();", "abstract public function build();", "function ciniki_products_processPDFCatalog(&$ciniki, $tnid, $catalog_id) {\n\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUUID');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUpdate');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'images', 'hooks', 'insertFromImagick');\n\n //\n // Load the pdf catalog\n //\n $strsql = \"SELECT id, uuid, status, permalink \"\n . \"FROM ciniki_product_pdfcatalogs \"\n . \"WHERE id = '\" . ciniki_core_dbQuote($ciniki, $catalog_id) . \"' \"\n . \"AND tnid = '\" . ciniki_core_dbQuote($ciniki, $tnid) . \"' \"\n . \"AND status = 10 \"\n . \"\";\n $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.products', 'catalog');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( !isset($rc['catalog']) ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.products.33', 'msg'=>'Catalog does not exist'));\n }\n $catalog = $rc['catalog'];\n \n //\n // Update the pdf catalog status to lock\n //\n $strsql = \"UPDATE ciniki_product_pdfcatalogs SET status = 20 \"\n . \"WHERE id = '\" . ciniki_core_dbQuote($ciniki, $catalog_id) . \"' \"\n . \"AND tnid = '\" . ciniki_core_dbQuote($ciniki, $tnid) . \"' \"\n . \"AND status = 10 \"\n . \"\";\n $rc = ciniki_core_dbUpdate($ciniki, $strsql, 'ciniki.products');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( $rc['num_affected_rows'] < 1 ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.products.34', 'msg'=>'Unable to lock catalog for processing.'));\n }\n\n //\n // Get the tenant storage directory\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'tenants', 'hooks', 'storageDir');\n $rc = ciniki_tenants_hooks_storageDir($ciniki, $tnid, array());\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $tenant_storage_dir = $rc['storage_dir'];\n //\n // Check the file exists\n $storage_filename = $tenant_storage_dir . '/ciniki.products/pdfcatalogs/' . $catalog['uuid'][0] . '/' . $catalog['uuid'];\n if( !file_exists($storage_filename) ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.products.35', 'msg'=>'Unable to open pdf.'));\n }\n\n //\n // Copy to tmp directory so it's local for processing. Remove files take too long to open over and over for each page.\n //\n if( isset($ciniki['config']['ciniki.core']['tmp_dir']) ) {\n $tmp_filename = $ciniki['config']['ciniki.core']['tmp_dir'] . '/' . $catalog['uuid'];\n } else {\n $tmp_filename = '/tmp/' . $catalog['uuid'];\n }\n\n if( !copy($storage_filename, $tmp_filename) ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.products.36', 'msg'=>'Unable to copy pdf.'));\n }\n\n ini_set('memory_limit', '4096M');\n\n $imagick = new Imagick();\n $imagick->setResolution(300, 300);\n\n $imagick->pingImage($tmp_filename);\n $num_pages = $imagick->getNumberImages();\n $imagick->clear();\n $imagick->destroy();\n\n $imagick = new Imagick();\n $imagick->setResolution(300, 300);\n\n $page_number = 0;\n for($page_number = 0; $page_number < $num_pages; $page_number++) {\n $imagick->readImage($tmp_filename . '[' . $page_number . ']');\n $imagick = $imagick->flattenImages();\n $imagick->setImageFormat('jpeg');\n \n //\n // Add the image\n //\n $rc = ciniki_images_hooks_insertFromImagick($ciniki, $tnid, array(\n 'image'=>$imagick,\n 'original_filename'=>$catalog['permalink'] . '-' . ($page_number+1) . '.jpg',\n 'name'=>'',\n 'force_duplicate'=>'no',\n 'perms'=>1,\n ));\n if( $rc['stat'] != 'ok' && $rc['stat'] != 'exists' ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.products.37', 'msg'=>\"Unable to save image for page $page_number.\", 'err'=>$rc['err']));\n }\n $image_id = $rc['id'];\n\n //\n // Add the pdfcatalog image\n //\n $rc = ciniki_core_objectAdd($ciniki, $tnid, 'ciniki.products.pdfcatalogimage', array(\n 'catalog_id'=>$catalog_id,\n 'page_number'=>($page_number+1),\n 'image_id'=>$image_id,\n ));\n if( $rc['stat'] != 'ok' ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.products.38', 'msg'=>\"Unable to save image for page $page_number.\"));\n }\n }\n\n unlink($tmp_filename);\n\n //\n // Update the pdf catalog status to lock\n //\n $rc = ciniki_core_objectUpdate($ciniki, $tnid, 'ciniki.products.pdfcatalog', $catalog_id, array(\n 'status'=>30,\n 'num_pages'=>$num_pages,\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n return array('stat'=>'ok');\n}", "protected function buildProducts($vtexBaseProduct)\n {\n $baseProduct = [\n 'brand' => $vtexBaseProduct->brand,\n 'description' => $vtexBaseProduct->description,\n 'url' => preg_replace('/https?:\\/\\/.*\\.vtexcommercestable\\.com\\.br/si', $this->vtexConnector->getStoreUrl(), $vtexBaseProduct->link),\n 'base_name' => $vtexBaseProduct->productName,\n 'release_date' => $vtexBaseProduct->releaseDate\n ];\n\n $categories = $this->vtexConnector->getCategories();\n if ($this->hasCategory($categories, $vtexBaseProduct)) {\n $baseProduct['category'] = $categories[$vtexBaseProduct->categoryId];\n }\n\n if ($customAttributes = $this->getCustomAttributes($vtexBaseProduct)) {\n $baseProduct['custom_attributes'] = $customAttributes;\n }\n\n foreach ($vtexBaseProduct->items as $vtexProduct) {\n if (!$this->hasSku($vtexProduct)) {\n continue;\n }\n $sku = $vtexProduct->referenceId[0]->Value;\n\n yield $baseProduct + [\n 'image_url' => $this->getImageUrl($vtexProduct),\n 'thumbnail_url' => $this->getImageUrl($vtexProduct),\n 'sku' => $sku,\n 'name' => $vtexProduct->name,\n 'price' => $this->getItemListPrice($vtexProduct),\n 'offer_price' => $this->getItemPrice($vtexProduct),\n 'stock' => $this->getItemStock($vtexProduct),\n 'available' => true,\n ];\n }\n }", "function m_packageBuild()\n\t{\n\t\t$this->ObTpl=new template();\n\t\t$this->ObTpl->set_file(\"TPL_PACKAGE_FILE\",$this->packageTemplate);\n\n\t\t#SETTING ALL TEMPLATE BLOCKS\n\t\t$this->ObTpl->set_block(\"TPL_PACKAGE_FILE\",\"TPL_DEPARTMENT_BLK\", \"dept_blk\");\n\t\t$this->ObTpl->set_block(\"TPL_PACKAGE_FILE\",\"TPL_ITEMS_BLK\", \"items_blk\");\n\t\t$this->ObTpl->set_block(\"TPL_PACKAGE_FILE\",\"TPL_MAIN_BLK\", \"main_blk\");\n\t\t$this->ObTpl->set_block(\"TPL_MAIN_BLK\",\"TPL_ATTACHED_BLK\", \"attached_blk\");\n\t\t#INTIALIZING VARIABLES\n\t\tif(!isset($this->request['owner']))\n\t\t{\n\t\t\t$this->request['owner']=\"0\";\n\t\t}\n\t\tif(!isset($this->request['type']))\n\t\t{\n\t\t\t$this->request['type']=\"product\";\n\t\t}\n\t\tif(!isset($this->request['otype']))\n\t\t{\n\t\t\t$this->request['otype']=\"department\";\n\t\t}\n\t\tif(!isset($this->request['kitid']))\n\t\t{\n\t\t\t$this->request['kitid']=\"\";\n\t\t}\n\n\t\t#SETTING TEMPLATE VARIABLE\n\t\t$this->ObTpl->set_var(\"GRAPHICSMAINPATH\",GRAPHICS_PATH);\t\n\t\t$this->ObTpl->set_var(\"TPL_SHOPURL\",SITE_URL.\"ecom/\");\n\t\t$this->ObTpl->set_var(\"TPL_VAR_OWNER\",$this->request['owner']);\n\t\t$this->ObTpl->set_var(\"TPL_VAR_TYPE\",$this->request['type']);\n\t\t$this->ObTpl->set_var(\"TPL_VAR_OTYPE\",$this->request['otype']);\n\t\t$this->ObTpl->set_var(\"TPL_VAR_KITID\",$this->request['kitid']);\n\t\t\n\t\t//defining language variables\n\t\t$this->ObTpl->set_var(\"LANG_VAR_BUILDPACKAGE\",LANG_BUILDPACKAGE);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_CURRENTPACKAGE\",LANG_CURRENTPACKAGE);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_CODE\",LANG_CODE);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_PRODUCT\",LANG_PRODUCTSTXT);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_QTY\",LANG_QTYTXT);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_SORT\",LANG_SORT);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_REMOVE\",LANG_REMOVE);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_HOME\",LANG_HOME);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_ALLORPHAN\",LANG_ALLORPHAN);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_RETURNPACK\",LANG_RETURNTOPACK);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_VIEWITEMS\",LANG_VIEWITEMS);\n\t\t$this->ObTpl->set_var(\"LANG_VAR_UPDATEPACKAGE\",LANG_UPDATEPACKAGE);\n\t\t#START DISPLAY DEPARETMENT BLOCK\n\t\t$this->obDb->query = \"SELECT vTitle,iDeptId_PK FROM \".DEPARTMENTS.\", \".FUSIONS.\" WHERE iDeptId_PK=iSubId_FK AND vType='department'\";\n\t\t$deptResult = $this->obDb->fetchQuery();\n\t\t $recordCount=$this->obDb->record_count;\n\t\t#PARSING DEPARTMENT BLOCK\n\t\t$this->ObTpl->set_var(\"SELECTED1\",\"selected\");\n\t\t\n\t\t\n\t\tif($recordCount>0)\n\t\t{\n\t\t\tfor($i=0;$i<$recordCount;$i++)\n\t\t\t{\n\t\t\t\t$_SESSION['dspTitle']=\"\";\t\t\n\t\t\t\t $this->ObTpl->set_var(\"TPL_VAR_TITLE\",$this->m_getTitle($deptResult[$i]->iDeptId_PK,'department'));\n\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_ID\",$deptResult[$i]->iDeptId_PK);\n\t\t\t\tif(isset($this->request['postOwner']) && $this->request['postOwner'] == $deptResult[$i]->iDeptId_PK)\n\t\t\t\t{\n\t\t\t\t\t$this->ObTpl->set_var(\"SELECTED1\",\"\");\n\t\t\t\t\t$this->ObTpl->set_var(\"SELECTED2\",\"selected\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->ObTpl->set_var(\"SELECTED2\",\"\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$this->ObTpl->parse(\"dept_blk\",\"TPL_DEPARTMENT_BLK\",true);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"dept_blk\",\"\");\n\t\t}\n\t\t#END DISPLAY DEPARETMENT BLOCK\n\n\t\t#START DISPLAY PRODUCT BLOCK\n\t\t#IF TYPE IS CONTENT\n\t\tif(isset($this->request['postOwner']))#PRODUCT\n\t\t{#FOR ORPHAN PRODUCT\n\t\t\tif($this->request['postOwner']==\"orphan\")\n\t\t\t{\n\t\t\t\t $this->obDb->query= \"SELECT vTitle,fusionid,iProdId_PK FROM \".PRODUCTS.\" LEFT JOIN \".FUSIONS.\" ON iProdId_PK = iSubId_FK \" ;\n\t\t\t\t$queryResult = $this->obDb->fetchQuery();\n\t\t\t\t$recordCount=$this->obDb->record_count;\n\t\t\t\t\n\t\t\t\tif($recordCount>0)\n\t\t\t\t{\n\t\t\t\t\t#PARSING TPL_ITEMS_BLK\n\t\t\t\t\tfor($j=0;$j<$recordCount;$j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(empty($queryResult[$j]->fusionid))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_TITLE\",$this->libFunc->m_displayContent($queryResult[$j]->vTitle));\n\t\t\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_ID\",$queryResult[$j]->iProdId_PK);\n\t\t\t\t\t\t\t$this->ObTpl->parse(\"items_blk\",\"TPL_ITEMS_BLK\",true);\n\t\t\t\t\t\t}\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\t$this->ObTpl->set_var(\"items_blk\",\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{#IF OTHER THAN ORPHAN\n\t\t\t\t$query = \"SELECT vTitle,iProdId_PK FROM \".PRODUCTS.\", \".FUSIONS.\" WHERE iProdId_PK=iSubId_FK AND iOwner_FK='\".$this->request['postOwner'].\"' AND vOwnerType='department' AND vType='\".$this->request['type'].\"'\";\n\t\t\t\t$this->obDb->query=$query;\n\t\t\t\t$queryResult = $this->obDb->fetchQuery();\n\t\t\t\t$recordCount=$this->obDb->record_count;\n\t\t\t\tif($recordCount>0)\n\t\t\t\t{\n\t\t\t\t\t#PARSING TPL_ITEMS_BLK\n\t\t\t\t\tfor($j=0;$j<$recordCount;$j++)\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_TITLE\",$this->libFunc->m_displayContent($queryResult[$j]->vTitle));\n\t\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_ID\",$queryResult[$j]->iProdId_PK);\n\t\t\t\t\t\t$this->ObTpl->parse(\"items_blk\",\"TPL_ITEMS_BLK\",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\t$this->ObTpl->set_var(\"items_blk\",\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_POSTOWNER\",$this->request['postOwner']);\n\t\t}\n\t\telse#POST OWNER NOT SET\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"items_blk\",\"\");\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_POSTOWNER\",\"\");\n\t\t}\n\n\t\t$this->obDb->query=\"SELECT vTitle FROM \".PRODUCTS.\" WHERE iProdId_PK='\".$this->request['kitid'].\"'\";\n\t\t$rs = $this->obDb->fetchQuery();\n\t\tif(!empty($rs[0]->vTitle))\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_HEADTITLE\",$this->libFunc->m_displayContent($rs[0]->vTitle));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"TPL_VAR_HEADTITLE\",\"\");\n\t\t}\n\t\t\t\n\t\t#TO DISPLAY CURRENTLY ATTACHED ITEMS\n\t\t$query1 = \"SELECT vSku,vTitle,iProdId_PK,iKitId_PK,iSort,iQty FROM \".PRODUCTS.\", \".PRODUCTKITS.\" WHERE iProdId_PK=iProdId_FK AND iKitId='\".$this->request['kitid'].\"' order by iSort\";\n\t\t$this->obDb->query=$query1;\n\t\t$queryResult = $this->obDb->fetchQuery();\n\t\t$recordCount=$this->obDb->record_count;\n\t\tif($recordCount>0)\n\t\t{\n\t\t\t#PARSING TPL_ITEMS_BLK\n\t\t\tfor($j=0;$j<$recordCount;$j++)\n\t\t\t{\n\t\t\t\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_QTY\",$queryResult[$j]->iQty);\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_SORT\",$queryResult[$j]->iSort);\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_SKU\",$this->libFunc->m_displayContent($queryResult[$j]->vSku));\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_TITLE\",$this->libFunc->m_displayContent($queryResult[$j]->vTitle));\n\t\t\t\t\t$str=str_replace(\"'\",\"\\'\",$this->libFunc->m_displayContent($queryResult[$j]->vTitle));\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_TITLE1\",$str);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_PID\",$queryResult[$j]->iProdId_PK);\n\t\t\t\t\t$this->ObTpl->set_var(\"TPL_VAR_KID\",$queryResult[$j]->iKitId_PK);\n\t\t\t\t\t$this->ObTpl->parse(\"attached_blk\",\"TPL_ATTACHED_BLK\",true);\n\t\t\t\n\t\t\t}\n\n\t\t\t$this->ObTpl->parse(\"main_blk\",\"TPL_MAIN_BLK\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\t$this->ObTpl->set_var(\"attached_blk\",\"\");\n\t\t\t\t$this->ObTpl->parse(\"main_blk\",\"TPL_MAIN_BLK\");\n\t\t}\n\t\t#END DISPLAY CURRENTLY ATTACHED ITEMS\n\t\t$this->ObTpl->set_var(\"TPL_VAR_KITID\",$this->request['kitid']);\n\t\tif(empty($this->request['kitid']))\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"main_blk\",\"\");\n\t\t\t$this->ObTpl->set_var(\"TPL_BTNLBL\",LBL_BUILDPACK);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->ObTpl->set_var(\"TPL_BTNLBL\",LBL_ADDTOPACK);\n\t\t}\n\t\treturn($this->ObTpl->parse(\"return\",\"TPL_PACKAGE_FILE\"));\n\t}", "public function get_all_product_information () {\n $this->json_source_file = file_get_contents(\"products.json\");\n $this->json_source_array = json_decode($this->json_source_file,true);\n\n }", "public function product_action()\n\t{\n\t\t// shut up php\n\t\terror_reporting(0);\n\t\tee()->load->helper('xml');\n\n\t\t$output = new Oxymel;\n\n\t\t// create our structure\n\t\t$output->xml->products->contains;\n\n\t\tee()->sync_db = ee()->load->database('sync_db', true);\n\n\t\t$query = ee()->sync_db\n\t\t\t->where('processed', 0)\n\t\t\t->get('products', 500);\n\n\t\t$ids_processed = array();\n\n\t\tforeach($query->result() as $row)\n\t\t{\n\n\t\t\tif($row->tax_exempt == 0)\n\t\t\t{\n\t\t\t\t$tax_exempt = \"Taxable\";\n\t\t\t}\t\n\t\t\telse\n\t\t\t{\n\t\t\t\t$tax_exempt = \"\";\n\t\t\t}\n\n\t\t\tif(!empty($row->product_category_3))\n\t\t\t{\n\t\t\t\t$product_category = $row->product_category_3;\n\t\t\t}\t\n\t\t\telseif(!empty($row->product_category_2))\n\t\t\t{\n\t\t\t\t$product_category = $row->product_category_2;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$product_category = $row->product_category_1;\n\t\t\t}\n\n\t\t\t// append a product\n\t\t\t$output\n\t\t\t\t->product->contains\n\t\t\t\t \t->title->contains->cdata($row->sku .' - ' . $row->name)->end\n\t\t\t\t \t->sku($row->sku)\n\t\t\t\t \t->name->contains->cdata($row->name)->end\n\t\t\t\t \t->price($row->price)\n\t\t\t\t \t->weight($row->weight)\n\t\t\t\t \t->length($row->length)\n\t\t\t\t \t->width($row->width)\n\t\t\t\t \t->height($row->height)\n\t\t\t\t \t->handling($row->handling)\n\t\t\t\t \t->free_shipping($row->free_shipping)\n\t\t\t\t \t->tax_exempt($tax_exempt)\n\t\t\t\t \t->category->contains->cdata($product_category)->end\n\t\t\t\t \t->product_number($row->product_number)\n\t\t\t\t \t->manufacturer->contains->cdata($row->product_manufacturer)->end\n\t\t\t\t \t->container($row->product_container)\n\t\t\t\t \t->condition($row->product_condition)\n\t\t\t\t \t->listed($row->product_listed)\n\t\t\t\t \t->location($row->product_location)\n\t\t\t\t \t->tested($row->product_tested)\n\t\t\t\t \t->cosmetic_condition->contains->cdata($row->product_cosmetic_condition)->end\n\t\t\t\t \t->keywords->contains->cdata($row->product_keywords)->end\n\t\t\t\t \t->natural_search->contains->cdata($row->product_natural_search)->end\n\t\t\t\t \t->description->contains->cdata($row->product_description)->end\n\t\t\t\t \t->image($row->product_image_filename)\n\t\t\t\t \t->stock_level($row->product_stock_level)\n\t\t\t\t \t->sell_online($row->product_sell_online)\n\t\t\t\t \t->timestamp($row->timestamp)\n\t\t\t\t->end;\t\n\n\t\t\t$ids_processed[] = $row->id;\n\n\t\t}\t\n\n\t\t// close our structure\n\t\t$output->end;\t\n\t\t\t \t\n\t\t// update processed flag on records\t\n\t\tif(count($ids_processed) > 0)\n\t\t{\n\t\t\tee()->sync_db->where_in('id', $ids_processed)->set('processed', 1)->update('products');\n\t\t}\n\n\t\theader('Content-Type: text/xml');\n\t\texit($output->to_string());\n\n\t}", "protected function _buildMerge($product)\n {\n $import = $this->_root->appendChild($this->_doc->createElement('import'));\n\n $import->setAttribute('type', 'product');\n $import->setAttribute('operation', 'merge');\n $import->setAttribute('externalReference', $product->getExternalReference());\n\n $content = \"\";\n\n foreach ($product->toArray(true) as $key => $value) {\n $content .= $key.\"=\".$value.\"\\n\";\n }\n\n $import->appendChild($import->ownerDocument->createCDATASection(substr($content, 0, -1)));\n }", "function cc_import_xml_file($file){\n\t\n\t// apro file ed elaboro xml\t\n\t$xml = @simplexml_load_file($file);\t\n\n\tif($xml){\t\t\n\t\t// ok struttura xml valida, recupero tag root Offerte\n\t\t$offerte = $xml->Offerte;\n\n\t\tif($offerte){\t\n\t\t\t// tutto ok procedo con elavorazione\n\t\t\t\n\t\t\t$nofferte = count($offerte); // numeri di record all'interno del file\n\t\t\tcc_update_configs(\"source\", $nofferte); // aggiorno file di config con il numerod i record nel file xml\n\t\t\t\n\t\t\t/***\n\t\t\t * Elabora oggetto xml\n\t\t\t * Restituisce array con chiave Rif e valore \"updated\", \"inserted\" o false\n\t\t\t*/\n\t\t\treturn cc_elabora_file_xml($offerte); // restriuisci array a cc_controllo_nuovi_immobili()\t\t \n\t\t\t\n\t\t}else{\n\t\t\t\n\t\t\t// E' un file xml ma con struttura errata (manca tag apertura Offerte) - invio email di notifica \n\t\t\tcc_import_error(\"Nessuna offerta trovata nel file XML \".$file);\n\t\t\treturn false; // ritorno a cc_controllo_nuovi_immobili()\n\t\t\t\n\t\t}\n\t\t\n\t}else{\n\t\t\t\t\n\t\t// Non è un file xml valido - invio email di notifica \n\t\tcc_import_error($file.\" non è un file XML valido!\");\n\t\treturn false; // ritorno a cc_controllo_nuovi_immobili()\n\t\t\n\t} // end if xml\t\t\n\t\n}", "public function importABCProducts()\n {\n try {\n $input = Request::onlyLegacy('file', 'supplier_id');\n $validator = Validator::make($input, FinancialProduct::getImportFileRules());\n\n if ($validator->fails()) {\n return ApiResponse::validation($validator);\n }\n\n $import = App::make(ImportProducts::class);\n $import->import($input['file'], $input['supplier_id']);\n\n return ApiResponse::success([\n 'message' => trans('response.success.imported', ['attribute' => 'File']),\n ]);\n } catch (InvalidImportTemplate $e) {\n return ApiResponse::errorGeneral($e->getMessage());\n } catch (\\Exception $e) {\n return ApiResponse::errorInternal(trans('response.error.something_wrong'), $e);\n }\n }", "function makeProduct($productcode) {\n\t$product = new Product();\n \t$product->category = substr($productcode, 0, 1);\n \t$i = strpos($productcode, '-', 1) + 1;\n \t$product->style = substr($productcode, 1, $i - 2);\n \t$j = strpos($productcode, '-', $i) + 1;\n \t$product->type = substr($productcode, $i, $j - 1 - $i);\n \t$product->material = substr($productcode, $j);\n\treturn $product;\n}", "public function init($config = array())\n\t{\t\t\t\t\n\t\tif (isset($config['languageId'])) {\n\t\t\t$this->languageId = $config['languageId'];\n\t\t}\n\t\tif (isset($config['categoryKey'])) {\n\t\t\t$this->categoryKey = $config['categoryKey'];\n\t\t}\n\t\tif (isset($config['cronTask'])) {\n\t\t\t$this->setCron($config['cronTask']);\n\t\t}\n\t\tif (isset($config['csvOptions'])) {\n\t\t\t$this->setCsvOptions($config['csvOptions']);\n\t\t}\n\t\tif (isset($config['importFields'])) {\n\t\t\t$this->importFields = $config['importFields'];\n\t\t}\n\t\tif (isset($config['productStatus'])) {\n\t\t\t$this->productStatus = $config['productStatus'];\n\t\t}\n\t\tif (isset($config['categoryStatus'])) {\n\t\t\t$this->categoryStatus = $config['categoryStatus'];\n\t\t}\n\t\tif (isset($config['categoryCreate'])) {\n\t\t\t$this->categoryCreate = $config['categoryCreate'];\n\t\t}\n\t\tif (isset($config['categoryDelimiter'])) {\n\t\t\t$this->categoryDelimiter = $config['categoryDelimiter'];\n\t\t}\n\t\tif (isset($config['csvSkipFirstLine'])) {\n\t\t\t$this->csvSkipFirstLine = $config['csvSkipFirstLine'];\n\t\t}\n\t\tif (isset($config['addToSubCategories'])) {\n\t\t\t$this->addToSubCategories = $config['addToSubCategories'];\n\t\t}\n\t\tif (isset($config['imageFileTpl'])) {\n\t\t\t$this->prepareImages($config['imageFileTpl']);\n\t\t}\n\t\t$this->_baseProduct = $this->getBaseProduct();\n\t\t$this->_baseCategory = $this->getBaseCategory();\n\t\t\n\t\tif ($this->handle && $this->csvSkipFirstLine) {\n\t\t\t$this->getItem();\n\t\t\t$this->csvSkipFirstLine = 0;\n\t\t}\n\t}", "function jft_assistant_sdk( $products ) {\n\t$products[] = __FILE__;\n\n\treturn $products;\n}", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();" ]
[ "0.6253491", "0.5181114", "0.5112983", "0.5110384", "0.50576365", "0.503746", "0.49284264", "0.48707747", "0.48707747", "0.4832499", "0.4815969", "0.4815969", "0.4783766", "0.47737586", "0.4726791", "0.4719312", "0.467551", "0.46643233", "0.46590096", "0.4658956", "0.46509764", "0.4647398", "0.4642674", "0.46100882", "0.46100882", "0.46100882", "0.46100882", "0.46100882", "0.46100882", "0.46100882" ]
0.6799675
0
Copy existing Annotation Urls from old to new product, since they are usually not included in the catalog update.
private static function copyAnnotationUrls($existing_product, $new_product) { foreach(["AntCbildUrl","AntAbildUrl","AntRueckUrl"] as $ant) { if(isset($existing_product->$ant) && !property_exists($new_product,$ant)) { $new_product->$ant = $existing_product->$ant; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function mapMagentoAttributes(ProductInterface $newProduct)\n {\n try {\n $originalProduct = $this->baseMagentoProductRepository->get($newProduct->getSku());\n $newProduct->setMediaGalleryEntries($originalProduct->getMediaGalleryEntries());\n } catch (NoSuchEntityException $e) {\n $this->logger->debug('We tried to copy attribute data from the existing product in Magento,\n but the product could not be found.',\n ['Product SKU' => $newProduct->getSku()]\n );\n }\n }", "private function renameOldAttributes()\n {\n if ($this->mageVersion < '2.2.5') {\n $attributes = $this->attrNames;\n foreach ($attributes as $key => $attr) {\n $isExist = $this->eavConfig->getAttribute('catalog_product', 'wwe_'.$attr.'')->getAttributeId();\n if ($isExist != null) {\n $updateSql = \"UPDATE \".$this->tableNames['eav_attribute'].\" \"\n . \"SET attribute_code = 'en_\".$attr.\"', is_required = 0 \"\n . \"WHERE attribute_code = 'wwe_\".$attr.\"'\";\n $this->connection->query($updateSql);\n }\n }\n }\n }", "protected function _getProductEnterpriseUrlRewrites(Mage_Catalog_Model_Product $product)\n {\n $requestPath = $this->_connection->getIfNullSql('url_rewrite.request_path', 'default_ur.request_path');\n $targetPath = $this->_connection->getIfNullSql('url_rewrite.target_path', 'default_ur.target_path');\n\n $select = $this->_connection->select()\n ->from(array('e' => $this->_resource->getTableName('catalog/product')),\n array('product_id' => 'entity_id')\n )\n ->where('e.entity_id = ?', $product->getId())\n ->joinLeft(array('url_rewrite_product' => $this->_resource->getTableName('enterprise_catalog/product')),\n 'url_rewrite_product.product_id = e.entity_id',\n array(''))\n ->joinLeft(array('url_rewrite' => $this->_resource->getTableName('enterprise_urlrewrite/url_rewrite')),\n 'url_rewrite_product.url_rewrite_id = url_rewrite.url_rewrite_id AND url_rewrite.is_system = 1',\n array(''))\n ->joinLeft(array('default_urp' => $this->_resource->getTableName('enterprise_catalog/product')),\n 'default_urp.product_id = e.entity_id AND default_urp.store_id = 0',\n array(''))\n ->joinLeft(array('default_ur' => $this->_resource->getTableName('enterprise_urlrewrite/url_rewrite')),\n 'default_ur.url_rewrite_id = default_urp.url_rewrite_id',\n array('request_path' => $requestPath, 'target_path' => $targetPath, 'store_id')\n );\n\n $rewrites = array();\n foreach ($this->_connection->fetchAll($select) as $row) {\n $rewrites[] = $this->_fixRequestPathSuffix($row);\n }\n\n return $rewrites;\n }", "function emr_normalize_file_urls( $old, $new ) {\n\t$result = array();\n\n\tif ( empty( $new['guid'] ) ) {\n\t\treturn $result;\n\t}\n\n\t$guid = $new['guid'];\n\n\tforeach ( $old as $key => $value ) {\n\t\t$result[ $key ] = empty( $new[ $key ] ) ? $guid : $new[ $key ];\n\t}\n\n\treturn $result;\n}", "function upgrade_old_slugs()\n {\n }", "private function updateAttachmentUrls(string $sourceUrl, string $destinationUrl)\n {\n $tables = [\n $this->wpdb->comments => [\n 'comment_content',\n ],\n $this->wpdb->posts => [\n 'guid',\n 'post_content',\n 'post_content_filtered',\n 'post_excerpt',\n ],\n $this->wpdb->term_taxonomy => [\n 'description',\n ],\n ];\n\n foreach ($tables as $table => $columns) {\n $this->tableStringReplacer->replace($table, $columns, $sourceUrl, $destinationUrl);\n }\n }", "protected function saveMappingsSourceUris(): void\n {\n $columns = [\n 'source',\n 'items',\n 'uri',\n 'label',\n 'type',\n 'info',\n ];\n foreach ($this->mappingsSourceUris as $name => $mapper) {\n // Prepare the list of specific headers one time in order to save\n // the fetched data and the ones from the original file.\n $extraColumns = [];\n foreach ($mapper as $rows) {\n foreach ($rows as $row) {\n $extraColumns = array_unique(array_merge($extraColumns, array_keys($row)));\n }\n }\n $extraColumns = array_flip(array_diff($extraColumns, $columns));\n unset($extraColumns['_chk']);\n $extraColumns = array_keys($extraColumns);\n $this->saveMappingSourceUrisToOds($name, $mapper, $extraColumns);\n $this->saveMappingSourceUrisToHtml($name, $mapper, $extraColumns);\n }\n }", "function update( $new_instance, $old_instance ) {\n\t\n\t\t$instance['brand_logo_url'] = strip_tags( $new_instance['brand_logo_url'] );\n\n\t\treturn $instance;\n\t}", "protected function _saveLinks()\n {\n $resource = $this->_linkFactory->create();\n $mainTable = $resource->getMainTable();\n $positionAttrId = [];\n $nextLinkId = $this->_resourceHelper->getNextAutoincrement($mainTable);\n\n // pre-load 'position' attributes ID for each link type once\n foreach ($this->_linkNameToId as $linkName => $linkId) {\n $select = $this->_connection->select()->from(\n $resource->getTable('catalog_product_link_attribute'),\n ['id' => 'product_link_attribute_id']\n )->where(\n 'link_type_id = :link_id AND product_link_attribute_code = :position'\n );\n $bind = [':link_id' => $linkId, ':position' => 'position'];\n $positionAttrId[$linkId] = $this->_connection->fetchOne($select, $bind);\n }\n while ($bunch = $this->_dataSourceModel->getNextBunch()) {\n $productIds = [];\n $linkRows = [];\n $positionRows = [];\n\n foreach ($bunch as $rowNum => $rowData) {\n if (!$this->isRowAllowedToImport($rowData, $rowNum)) {\n continue;\n }\n\n $sku = $rowData[self::COL_SKU];\n\n $productId = $this->skuProcessor->getNewSku($sku)[$this->getProductEntityLinkField()];\n $productLinkKeys = [];\n $select = $this->_connection->select()->from(\n $resource->getTable('catalog_product_link'),\n ['id' => 'link_id', 'linked_id' => 'linked_product_id', 'link_type_id' => 'link_type_id']\n )->where(\n 'product_id = :product_id'\n );\n $bind = [':product_id' => $productId];\n foreach ($this->_connection->fetchAll($select, $bind) as $linkData) {\n $linkKey = \"{$productId}-{$linkData['linked_id']}-{$linkData['link_type_id']}\";\n $productLinkKeys[$linkKey] = $linkData['id'];\n }\n foreach ($this->_linkNameToId as $linkName => $linkId) {\n $productIds[] = $productId;\n if (isset($rowData[$linkName . 'sku'])) {\n $linkSkus = explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'sku']);\n $linkPositions = !empty($rowData[$linkName . 'position'])\n ? explode($this->getMultipleValueSeparator(), $rowData[$linkName . 'position'])\n : [];\n foreach ($linkSkus as $linkedKey => $linkedSku) {\n $linkedSku = trim($linkedSku);\n if (($this->skuProcessor->getNewSku($linkedSku) !== null || $this->isSkuExist($linkedSku))\n && strcasecmp($linkedSku, $sku) !== 0\n ) {\n $newSku = $this->skuProcessor->getNewSku($linkedSku);\n if (!empty($newSku)) {\n $linkedId = $newSku['entity_id'];\n } else {\n $linkedId = $this->getExistingSku($linkedSku)['entity_id'];\n }\n\n if ($linkedId == null) {\n // Import file links to a SKU which is skipped for some reason,\n // which leads to a \"NULL\"\n // link causing fatal errors.\n $this->_logger->critical(\n new \\Exception(\n sprintf(\n 'WARNING: Orphaned link skipped: From SKU %s (ID %d) to SKU %s, ' .\n 'Link type id: %d',\n $sku,\n $productId,\n $linkedSku,\n $linkId\n )\n )\n );\n continue;\n }\n\n $linkKey = \"{$productId}-{$linkedId}-{$linkId}\";\n if (empty($productLinkKeys[$linkKey])) {\n $productLinkKeys[$linkKey] = $nextLinkId;\n }\n if (!isset($linkRows[$linkKey])) {\n $linkRows[$linkKey] = [\n 'link_id' => $productLinkKeys[$linkKey],\n 'product_id' => $productId,\n 'linked_product_id' => $linkedId,\n 'link_type_id' => $linkId,\n ];\n }\n if (!empty($linkPositions[$linkedKey])) {\n $positionRows[] = [\n 'link_id' => $productLinkKeys[$linkKey],\n 'product_link_attribute_id' => $positionAttrId[$linkId],\n 'value' => $linkPositions[$linkedKey],\n ];\n }\n $nextLinkId++;\n }\n }\n }\n }\n }\n if (Import::BEHAVIOR_APPEND != $this->getBehavior() && $productIds) {\n $this->_connection->delete(\n $mainTable,\n $this->_connection->quoteInto('product_id IN (?)', array_unique($productIds))\n );\n }\n if ($linkRows) {\n $this->_connection->insertOnDuplicate($mainTable, $linkRows, ['link_id']);\n }\n if ($positionRows) {\n // process linked product positions\n $this->_connection->insertOnDuplicate(\n $resource->getAttributeTypeTable('int'),\n $positionRows,\n ['value']\n );\n }\n }\n return $this;\n }", "public function rewritePermalinks($old_options, $new_options)\n {\n if (isset($old_options['features']['Sitemaps']) && !isset($new_options['features']['Sitemaps'])) {\n // Disabled\n add_filter('rewrite_rules_array', function ($rules)\n {\n unset($rules['sitemap\\.xml$']);\n unset($rules['sitemap-([^/]+?)-?([0-9]+)?\\.xml$']);\n\n return $rules;\n });\n flush_rewrite_rules();\n }\n if (!isset($old_options['features']['Sitemaps']) && isset($new_options['features']['Sitemaps'])) {\n // Enabled\n add_rewrite_rule('sitemap\\.xml$', 'index.php?buzz_sitemap=1', 'top');\n add_rewrite_rule('sitemap-([^/]+?)-?([0-9]+)?\\.xml$', 'index.php?buzz_sitemap=$matches[1]&buzz_sitemap_page=$matches[2]', 'top');\n flush_rewrite_rules();\n }\n }", "private function generateChangedProductUrls(\n MergeDataProvider $mergeDataProvider,\n Category $category,\n int $storeId,\n bool $saveRewriteHistory\n ) {\n $this->isSkippedProduct[$category->getEntityId()] = $category->getAffectedProductIds();\n\n $categoryStoreIds = [$storeId];\n // If category is changed in the Global scope when need to regenerate product URL rewrites for all other scopes.\n if ($this->productScopeRewriteGenerator->isGlobalScope($storeId)) {\n $categoryStoreIds = $this->getCategoryStoreIds($category);\n }\n\n foreach ($categoryStoreIds as $categoryStoreId) {\n /* @var Collection $collection */\n $collection = $this->productCollectionFactory->create()\n ->setStoreId($categoryStoreId)\n ->addIdFilter($category->getAffectedProductIds())\n ->addAttributeToSelect('visibility')\n ->addAttributeToSelect('name')\n ->addAttributeToSelect('url_key')\n ->addAttributeToSelect('url_path');\n\n $collection->setPageSize(1000);\n $pageCount = $collection->getLastPageNumber();\n $currentPage = 1;\n while ($currentPage <= $pageCount) {\n $collection->setCurPage($currentPage);\n foreach ($collection as $product) {\n $product->setData('save_rewrites_history', $saveRewriteHistory);\n $product->setStoreId($categoryStoreId);\n $mergeDataProvider->merge(\n $this->productUrlRewriteGenerator->generate($product, $category->getEntityId())\n );\n }\n $collection->clear();\n $currentPage++;\n }\n }\n }", "abstract public function get_url_update();", "public function testInsertProductAttribute()\n\t{\n\t\t$repository = new ProductRepository();\n\t\t$product = $repository->getProduct(1);\n\n\t\t// Update a global attribute, just to check that update works\n\t\t// Global = applies to all categories\n\t\t$product->attributes[self::ATTRIBUTE_URL] = \"some-slug\";\n\t\t$repository->updateProduct($product);\n\n\t\t$new_product = $repository->getProduct(1);\n\n\t\t$this->assertEquals(1, count($new_product->attributes));\n\t\t$this->assertEquals(\"some-slug\", $new_product->attributes[self::ATTRIBUTE_URL]);\n\t}", "protected function applyUrl()\n\t{\n\t\t// CSS\n\t\t$nodes = $this->dom->getElementsByTagName('link');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('href');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('href', $url);\n\t\t\t}\n\t\t}\n\t\t// JS\n\t\t$nodes = $this->dom->getElementsByTagName('script');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('src');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('src', $url);\n\t\t\t}\n\t\t}\n\t\t// Image\n\t\t$nodes = $this->dom->getElementsByTagName('img');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('src');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->layout_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('src', $url);\n\t\t\t}\n\t\t}\n\t\t// Anchor\n\t\t$nodes = $this->dom->getElementsByTagName('a');\n\t\tforeach ($nodes as $node) {\n\t\t\t$url = $node->getAttribute('href');\n\t\t\tif (strlen($url) > 0 && $url[0] == ':') {\n\t\t\t\t$url = $this->base_url . '/' . trim($url, ':');\n\t\t\t\t$node->setAttribute('href', $url);\n\t\t\t}\n\t\t}\n\t}", "function call_logs_migration_tables_to_replace_old_links($tables)\n{\n $tables[] = [\n 'table' => db_prefix() . 'call_logs',\n 'field' => 'description',\n ];\n\n return $tables;\n}", "function setDestinationUrl ($newDestinationUrl) {\n // this by deleting and then re-creating the ad\n // update the google servers\n $soapClients = &APIlityClients::getClients();\n $someSoapClient = $soapClients->getAdClient();\n // then recreate it with the new destination url set\n $soapParameters = \"<addAds>\n <ads>\n <adGroupId>\".$this->getBelongsToAdGroupId().\"</adGroupId>\n <headline>\".utf8_decode($this->getHeadline()).\"</headline>\n <description1>\".utf8_decode($this->getDescription1()).\"</description1>\n <description2>\".utf8_decode($this->getDescription2()).\"</description2>\n <displayUrl>\".$this->getDisplayUrl().\"</displayUrl>\n <destinationUrl>\".$newDestinationUrl.\"</destinationUrl>\n <status>\".$this->getStatus().\"</status>\n <adType>TextAd</adType>\n </ads>\n </addAds>\";\n // add the ad to the google servers\n $someAd = $someSoapClient->call(\"addAds\", $soapParameters);\n $soapClients->updateSoapRelatedData(extractSoapHeaderInfo($someSoapClient->getHeaders()));\n if ($someSoapClient->fault) {\n pushFault($someSoapClient, $_SERVER['PHP_SELF'].\":setDestinationUrl()\", $soapParameters);\n return false;\n }\n // first delete the current ad\n $soapParameters = \"<updateAds>\n <ads>\n <adGroupId>\".$this->getBelongsToAdGroupId().\"</adGroupId>\n <id>\".$this->getId().\"</id>\n <status>Disabled</status>\n <adType>TextAd</adType>\n </ads>\n </updateAds>\";\n // delete the ad on the google servers\n $someSoapClient->call(\"updateAds\", $soapParameters);\n $soapClients->updateSoapRelatedData(extractSoapHeaderInfo($someSoapClient->getHeaders()));\n if ($someSoapClient->fault) {\n pushFault($someSoapClient, $_SERVER['PHP_SELF'].\":setDestinationUrl()\", $soapParameters);\n return false;\n }\n // update local object\n $this->destinationUrl = $someAd['addAdsReturn']['destinationUrl'];\n // changing the destination url of a ad will change its id so update local object\n $this->id = $someAd['addAdsReturn']['id'];\n return true;\n }", "public function fixRepositoryUrls() {\n\t\t$update_count = 0;\n\n\t\t$packages = $this->Package->find('all', array(\n\t\t\t'contain' => array('Maintainer' => array('id', 'username')),\n\t\t\t'fields' => array('id', 'maintainer_id', 'name'),\n\t\t\t'order' => array('Package.id ASC')\n\t\t));\n\n\t\tforeach ($packages as $package) {\n\t\t\t$this->out(sprintf(\n\t\t\t\t__('Updating package id %s named %s'),\n\t\t\t\t$package['Package']['id'],\n\t\t\t\t$package['Package']['name']\n\t\t\t));\n\n\t\t\tif ($this->Package->fixRepositoryUrl($package)) $update_count++;\n\t\t}\n\n\t\t$this->out(sprintf(__('* Successfully updated %s out of %s package urls'), $update_count, count($packages)));\n\t\t$this->_stop();\n\t}", "public function automaticOldUrl($data)\n\t{\n\t\tif (substr($data['old_url'], 0, strlen('http')) != 'http')\n\t\t{\n\t\t\t$data['old_url'] = '/' . ltrim($data['old_url'], '/');\n\t\t}\n\t\treturn rtrim($data['old_url'], '/');\n\t}", "protected function cleanupCrawledUrl(Product $product)\n\t{\n\t\t$result = $this\n\t\t\t->format($product->getUrl())\n\t\t\t->result();\n\n\t\t$product->setUrl($result);\n\t}", "public function update_include_links(array $mapping)\n {\n if (count($this->get_includes()) == 0)\n {\n return;\n }\n\n $fields = static::get_html_editors();\n\n foreach ($mapping as $old_id => $new_object)\n {\n $pattern = '/core\\.php\\?go=document_downloader&amp;display=1&amp;object=' . $old_id .\n '(&amp;security_code=[^\\&]+)?&amp;application=repository/';\n\n $security_code = $new_object->calculate_security_code();\n\n $replacement_string = 'core.php?go=document_downloader&amp;display=1&amp;object=' . $new_object->get_id() .\n '&amp;security_code=' . $security_code . '&amp;application=repository';\n\n foreach ($fields as $field)\n {\n $value = $this->get_default_property($field);\n $value = preg_replace($pattern, $replacement_string, $value);\n $this->set_default_property($field, $value);\n }\n\n $this->process_additional_include_links($pattern, $replacement_string);\n }\n\n $this->update();\n }", "public function set_url_replacements($element_attribute = \\null)\n {\n }", "public function set_url_replacements($element_attribute = \\null)\n {\n }", "private function replace($old_xpath, $new_xml, $insert_ns = FALSE) {\n $hits = $this->xpath->query($old_xpath, null, false);\n if ($hits && count($hits) > 0) {\n if ($insert_ns) {\n $new_xml = XMLPatcher::insert_namespaces($new_xml, $this->namespaces);\n }\n foreach ($hits as $hit) {\n $parent = $hit->parentNode;\n //error_log('new_xml is ' . $new_xml);\n $replace = dom_import_simplexml(simplexml_load_string($new_xml));\n if ($replace !== FALSE) {\n $replace = $this->dom->importNode($replace, TRUE);\n $parent->replaceChild($replace, $hit);\n $this->changed = TRUE;\n }\n }\n }\n }", "public function saveProductRelations($product)\n {\n parent::saveProductRelations($product);\n\n $data = $product->getCustomOneLinkData();\n if (!is_null($data)) {\n $this->_getResource()->saveProductLinks($product, $data, self::LINK_TYPE_CUSTOMONE);\n }\n\n $data = $product->getCustomTwoLinkData();\n if (!is_null($data)) {\n $this->_getResource()->saveProductLinks($product, $data, self::LINK_TYPE_CUSTOMTWO);\n }\n }", "protected function importLayoutImages_processCopiedImages(){\n\t\t\n\t\t\n\t\tforeach($this->arrImportImages as $key=>$arrImage){\n\t\t\t\n\t\t\t//get image ID\n\t\t\t$imageID = $this->insertAttachmentByImage($arrImage);\n\t\t\tif(empty($imageID))\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t//update image id\n\t\t\t$arrImage[\"imageid\"] = $imageID;\n\t\t\t$this->arrImportImages[$key] = $arrImage;\n\t\t}\n\t\t\n\t}", "function resetCopyInfos()\n {\n $this->dn = 'new';\n foreach ($this->plugins as &$plugin) {\n $plugin->resetCopyInfos();\n }\n unset($plugin);\n }", "function _postBuildSources() {\n foreach($this->sphinxConfig->default['sources'] as $modelName => &$source) {\n //insert database configuration\n if(isset($source['database'])) {\n $database = $source['database'];\n } else {\n $database = 'default';\n }\n $dbConfig = $this->cakeDbConfigToSphinx($this->DbConfig->{$source['database']});\n $source = Set::merge($dbConfig, $source);\n unset($source['database']);\n\n //move index\n if(isset($source['index'])) {\n $this->sphinxConfig->default['indexes'][$modelName] = $source['index'];\n unset($source['index']);\n }\n\n if(is_array($source['sql_query'])) {\n $source['sql_query']['log'] = true;\n $queryAndAttrs = $this->_getSQLQuery($modelName, $source['sql_query']);\n $source['sql_query'] = $queryAndAttrs['sql_query'];\n }\n\n if(is_array($source['attributes'])) {\n $this->getAttributes($modelName, $source['attributes']);\n }\n }\n }", "function __reimportPhotos(){\n\t\t$this->Asset->disablePermissionable();\n\t\t$this->Asset->recursive=0;\n\t\t$json = $this->Asset->find('all', array('fields'=>'json_src'));\n\t\t$json =Set::extract($json, '/Asset/json_src');\n\t\tforeach ($json as $row) {\n\t\t\t$imgSrc = json_decode($row);\n\t\t\t$src = \"Summer2009/\".basename($imgSrc->orig);\n\t\t\t$dest = $imgSrc->preview;\n\t\t\t$src_baseurl = Configure::read('path.local.preview');\n\t\t\t$dest_baseurl = Configure::read('stageroot.basepath');\n\t\t\t$shell_cmd[] =\"cp {$src_baseurl}/{$src} {$dest_baseurl}/{$dest}\";\n\t\t\t//\t\t\tmkdir(dirname(Configure::read('stageroot.basepath').\"/{$dest}\"), 0777, $recursive=true);\n\t\t\t//\t\t\tcopy( Configure::read('path.local.preview').\"/{$src}\", Configure::read('stageroot.basepath').\"/{$dest}\");\n\t\t}\n\t\tdebug($shell_cmd);\n\t}", "public function rewriteEndpoints()\n {\n $this->addEndpoints();\n flush_rewrite_rules();\n }", "public function apply_config() {\n\t\tforeach ( $this->config as $dependency ) {\n\t\t\tif ( false == ( $download_link = $this->installer->get_download_link( $dependency ) ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$this->config[ $dependency['slug'] ]['download_link'] = $download_link;\n\t\t}\n\t}" ]
[ "0.5510585", "0.5038295", "0.497977", "0.49260625", "0.49137515", "0.48702252", "0.48362923", "0.48355854", "0.48096398", "0.4760752", "0.47297874", "0.4719762", "0.4659986", "0.46197754", "0.45372865", "0.45190895", "0.45028773", "0.44517055", "0.44405726", "0.4438688", "0.4435172", "0.4432782", "0.44293526", "0.4422784", "0.4418211", "0.43977672", "0.43957976", "0.4344308", "0.43435484", "0.43430293" ]
0.76536757
0
todo: implement memory friendly version of this Builds LibriProduct from ONIX object.
static function create(PONIpar\Product $onix){ $libriProduct = new LibriProduct; $controller = new LibriProductFactory(); $controller->product = $onix; $recordReference = $controller->getRecordReference(); /* ---------------- required data -------------- */ $libriProduct->RecordReference = $recordReference; $libriProduct->ProductForm = $controller->getProductForm(); $libriProduct->DistinctiveTitle = $controller->getDistinctiveTitle(); $tmpReference = $controller->getProductReference(); if(!$tmpReference) return null; // if no valid reference was found, this product is invalid $libriProduct->ProductReference = (String) $tmpReference[0]; $libriProduct->ProductReferenceType = (String) $tmpReference[1]; // test required fields $requiredFields = [ 'RecordReference', 'ProductReference', 'DistinctiveTitle', 'ProductForm' ]; foreach ($requiredFields as $field) { if ($libriProduct->$field === false) throw new MissingDataException("Content of `$field` not found or empty.", $recordReference); } /* ---------------- optional data -------------- */ $libriProduct->OrderTime = (Integer) $controller->getOrderTime(); $libriProduct->QuantityOnHand = (Integer) $controller->getQuantityOnHand(); $libriProduct->AvailabilityStatus = (Integer) $controller->getAvailabilityStatus(); $libriProduct->NumberOfPages = (Integer) $controller->getNumberOfPages(); $libriProduct->VLBSchemeOld = (Integer) $controller->getVLBSchemeOld(); $libriProduct->ProductWeight = (Integer) $controller->getProductWeight(); $libriProduct->ProductWidth = (Integer) $controller->getProductWidth(); $libriProduct->ProductThickness = (Integer) $controller->getProductThickness(); $libriProduct->AudienceCodeValue = (Integer) $controller->getAudienceCodeValue(); $libriProduct->Author = (String) $controller->getAuthor(); $libriProduct->CoverLink = (String) $controller->getCoverLink(); $libriProduct->ProductLanguage = (String) $controller->getProductLanguage(); $libriProduct->PublisherName = (String) $controller->getPublisherName(); $libriProduct->PublicationDate = (String) $controller->getPublicationDate(); $libriProduct->Blurb = (String) $controller->getBlurb(); $controller->CurrentPrice = $controller->getPriceDeCurrent(); $libriProduct->PriceAmount = (float) $controller->getPriceAmount(); $libriProduct->PriceTypeCode = (Integer) $controller->getPriceTypeCode(); $libriProduct->DiscountPercent = (Integer) $controller->getDiscountPercent(); $libriProduct->TaxRateCode1 = (String) $controller->getTaxRateCode1(); $libriProduct->NotificationType = $controller->getNotificationType(); $libriProduct->Lib_MSNo = $controller->getLibriNotificationKey(); $libriProduct->AvailabilityCode = $controller->getAvailabilityCode(); $libriProduct->PublishingStatus = $controller->getPublishingStatus(); return $libriProduct; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function build();", "abstract public function build();", "abstract function build();", "public abstract function build();", "public abstract function build();", "abstract public function factoryMethod(): Product;", "function webmap_compo_lib_xml_build()\r\n{\r\n\t$this->webmap_compo_lib_xml_base();\r\n}", "function makeProduct($productcode) {\n\t$product = new Product();\n \t$product->category = substr($productcode, 0, 1);\n \t$i = strpos($productcode, '-', 1) + 1;\n \t$product->style = substr($productcode, 1, $i - 2);\n \t$j = strpos($productcode, '-', $i) + 1;\n \t$product->type = substr($productcode, $i, $j - 1 - $i);\n \t$product->material = substr($productcode, $j);\n\treturn $product;\n}", "public static function build($type) {\n $product = $type;\n if (class_exists($product)) {\n return new $product();\n }\n else {\n throw new Exception(\"Invalid product type given.\");\n }\n }", "function ciniki_products_typeObjectDefUpdate($ciniki, $object_def, $args) {\n\n if( $object_def == NULL ) {\n $object_def = array(\n 'name'=>array('name_s'=>'', 'name_p'=>''),\n );\n }\n if( !isset($object['parent']) ) {\n $object['parent'] = array('products'=>array());\n }\n if( !isset($object['parent']['products']) ) {\n $object['parent']['products'] = array();\n }\n\n $product_fields = array(\n 'name',\n 'code',\n 'sequence',\n 'category',\n 'source',\n 'flags',\n 'status',\n 'barcode',\n 'supplier_tnid',\n 'supplier_product_id',\n 'price',\n 'unit_discount_amount',\n 'unit_discount_percentage',\n 'taxtype_id',\n 'cost',\n 'msrp',\n 'sell_unit',\n 'supplier_id',\n 'supplier_item_number',\n 'supplier_minimum_order',\n 'supplier_order_multiple',\n 'manufacture_min_time',\n 'manufacture_max_time',\n 'inventory_flags',\n 'inventory_current_num',\n 'inventory_reorder_num',\n 'inventory_reorder_quantity',\n 'shipping_flags',\n 'shipping_weight',\n 'shipping_weight_units',\n 'shipping_length',\n 'shipping_width',\n 'shipping_height',\n 'shipping_size_units',\n 'primary_image_id',\n 'short_description',\n 'long_description',\n 'description',\n 'start_date',\n 'end_date',\n 'webflags',\n 'detail01',\n 'detail02',\n 'detail03',\n 'detail04',\n 'detail05',\n 'detail06',\n 'detail07',\n 'detail08',\n 'detail09',\n );\n foreach($product_fields as $field) {\n if( isset($args['parent_product_' . $field]) ) {\n if( $args['parent_product_' . $field] == 'on' ) {\n $object_def['parent']['products'][$field] = array();\n } elseif( $args['parent_product_' . $field] == 'off' \n && isset($object_def['parent']['products'][$field]) ) {\n unset($object_def['parent']['products'][$field]);\n }\n }\n if( (!isset($args['parent_product_' . $field . '-name']) || $args['parent_product_' . $field . '-name'])\n && isset($args['parent_product_' . $field . '-name']) ) {\n if( isset($object_def['parent']['products']) ) {\n $object_def['parent']['products'][$field]['name'] = $args['parent_product_' . $field . '-name'];\n }\n }\n if( isset($args['child_product_' . $field]) ) {\n if( $args['child_product_' . $field] == 'on' ) {\n if( !isset($object_def['child']) ) {\n $object_def['child'] = array('products'=>array());\n }\n $object_def['child']['products'][$field] = array();\n } elseif( $args['child_product_' . $field] == 'off' \n && isset($object_def['child']['products'][$field]) ) {\n unset($object_def['child']['products'][$field]);\n }\n }\n if( (!isset($args['child_product_' . $field . '-name']) || $args['child_product_' . $field . '-name'])\n && isset($args['child_product_' . $field . '-name']) ) {\n if( isset($object_def['child']['products']) ) {\n $object_def['child']['products'][$field]['name'] = $args['child_product_' . $field . '-name'];\n }\n }\n }\n\n $price_fields = array(\n 'name',\n 'pricepoint_id',\n 'available_to',\n 'min_quantity',\n 'unit_amount',\n 'unit_discount_amount',\n 'unit_discount_percentage',\n 'taxtype_id',\n 'start_date',\n 'end_date',\n 'webflags',\n );\n\n foreach($price_fields as $field) {\n if( isset($args['parent_price_' . $field]) ) {\n if( $args['parent_price_' . $field] == 'on' ) {\n if( !isset($object_def['parent']['prices']) ) { $object_def['parent']['prices'] = array(); }\n $object_def['parent']['prices'][$field] = array();\n } elseif( $args['parent_price_' . $field] == 'hidden' ) {\n if( !isset($object_def['parent']['prices']) ) { $object_def['parent']['prices'] = array(); }\n $object_def['parent']['prices'][$field] = array('ui-hide'=>'yes');\n } elseif( $args['parent_price_' . $field] == 'off' \n && isset($object_def['parent']['prices'][$field]) ) {\n unset($object_def['parent']['prices'][$field]);\n }\n if( $args['parent_price_' . $field] != 'off' ) {\n if( isset($args['parent_price_' . $field . '-default']) \n && $args['parent_price_' . $field . '-default'] != '' ) {\n $object_def['parent']['prices'][$field]['default'] = $args['parent_price_' . $field . '-default'];\n }\n }\n }\n if( isset($args['child_price_' . $field]) ) {\n if( $args['child_price_' . $field] == 'on' ) {\n if( !isset($object_def['child']) ) { $object_def['child'] = array('products'=>array()); }\n if( !isset($object_def['child']['prices']) ) { $object_def['child']['prices'] = array(); }\n $object_def['child']['prices'][$field] = array();\n } elseif( $args['child_price_' . $field] == 'off' \n && isset($object_def['child']['prices'][$field]) ) {\n unset($object_def['child']['prices'][$field]);\n }\n }\n }\n\n //\n // Remove old ones\n //\n if( isset($object_def['parent']['subcategories']) ) { unset($object_def['parent']['subcategories']); }\n\n// $args['object_def'] = serialize($object_def);\n\n //\n // Check for subcategories\n //\n for($i=11;$i<30;$i++) {\n $field = 'parent_subcategories-' . $i;\n if( isset($args[$field]) ) {\n if( $args[$field] == 'on' ) {\n $object_def['parent']['subcategories-' . $i] = array();\n if( isset($args[$field . '-sname']) ) {\n $object_def['parent']['subcategories-' . $i]['sname'] = $args[$field . '-sname'];\n }\n if( isset($args[$field . '-pname']) ) {\n $object_def['parent']['subcategories-' . $i]['pname'] = $args[$field . '-pname'];\n }\n } elseif( $args[$field] == 'off' && isset($object_def['parent']['subcategories-' . $i]) ) {\n unset($object_def['parent']['subcategories-' . $i]);\n }\n }\n }\n\n $extras = array('categories', \n// 'subcategories-11', 'subcategories-12', 'subcategories-13', 'subcategories-14', 'subcategories-15', \n 'tags', 'images', 'audio', 'files', 'similar', 'recipes');\n foreach($extras as $extra) {\n $field = 'parent_' . $extra;\n if( isset($args[$field]) ) {\n if( $args[$field] == 'on' ) {\n $object_def['parent'][$extra] = array();\n } elseif( $args[$field] == 'off' && isset($object_def['parent'][$extra]) ) {\n unset($object_def['parent'][$extra]);\n }\n }\n $field = 'child_' . $extra;\n if( isset($args[$field]) ) {\n if( $args[$field] == 'on' ) {\n $object_def['child'][$extra] = array();\n } elseif( $args[$field] == 'off' && isset($object_def['child'][$extra]) ) {\n unset($object_def['child'][$extra]);\n }\n }\n }\n\n return array('stat'=>'ok', 'object_def'=>$object_def);\n}", "abstract function build($result);", "public function getTargetType($type) {\n $retObj = array();\n switch ($type) {\n case 'Brand':\n $retObj[] = new ProductBrand($this->targetData);\n $retObj[] = new ProductBrand();\n \n return $retObj;\n break;\n case 'Condition':\n $retObj[] = new ProductCanonicalCondition($this->targetData);\n $retObj[] = new ProductCanonicalCondition();\n \n return $retObj;\n break;\n case 'Category':\n $retObj[] = new ProductBiddingCategory('BIDDING_CATEGORY_L1', $this->targetData);\n $retObj[] = new ProductBiddingCategory('BIDDING_CATEGORY_L1');\n \n return $retObj;\n break;\n case 'Channel':\n $retObj[] = new ProductChannel($this->targetData);\n $retObj[] = new ProductChannel();\n \n return $retObj;\n break;\n case 'Item ID':\n $retObj[] = new ProductOfferId($this->targetData);\n $retObj[] = new ProductOfferId();\n \n return $retObj;\n break;\n case 'Product type':\n $retObj[] = new ProductType('PRODUCT_TYPE_L1', $this->targetData);\n $retObj[] = new ProductType('PRODUCT_TYPE_L1');\n \n return $retObj;\n break;\n case 'Channel exclusivity':\n $retObj[] = new ProductChannelExclusivity($this->targetData);\n $retObj[] = new ProductChannelExclusivity();\n \n return $retObj;\n break;\n case 'CUSTOM_ATTRIBUTE_0':\n $retObj[] = new ProductCustomAttribute($type, $this->targetData);\n $retObj[] = new ProductCustomAttribute($type);\n $retObj[] = new ProductCustomAttribute();\n \n return $retObj;\n break;\n case 'CUSTOM_ATTRIBUTE_1':\n $retObj[] = new ProductCustomAttribute($type, $this->targetData);\n $retObj[] = new ProductCustomAttribute($type);\n $retObj[] = new ProductCustomAttribute();\n \n return $retObj;\n break;\n case 'CUSTOM_ATTRIBUTE_2':\n $retObj[] = new ProductCustomAttribute($type, $this->targetData);\n $retObj[] = new ProductCustomAttribute($type);\n $retObj[] = new ProductCustomAttribute();\n \n return $retObj;\n break;\n case 'CUSTOM_ATTRIBUTE_3':\n $retObj[] = new ProductCustomAttribute($type, $this->targetData);\n $retObj[] = new ProductCustomAttribute($type);\n $retObj[] = new ProductCustomAttribute();\n \n return $retObj;\n break;\n case 'CUSTOM_ATTRIBUTE_4':\n $retObj[] = new ProductCustomAttribute($type, $this->targetData);\n $retObj[] = new ProductCustomAttribute($type);\n $retObj[] = new ProductCustomAttribute();\n \n return $retObj;\n break;\n \n default:\n break;\n }\n }", "public function Build() {\n $this->XaoThrow(\n \"_EntBase::Build(): This entity does not implement it's \" .\n \"creation in the RDBMS.\"\n , debug_backtrace()\n );\n }", "function product( )\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n $ret = new eZProduct( $this->ProductID );\n \n return $ret;\n }", "public function buildObject()\n {\n $object = $this->instanciator->build($this->class, $this->properties);\n $parameters = $this->instanciator->getParameters($this->class);\n\n //avoid injecting the properties already used in the constructor\n $properties = $this\n ->properties\n ->filter(function($value, $property) use ($parameters) {\n return !$parameters->contains($property);\n });\n $refl = new ReflectionObject(\n $object,\n $properties,\n $this->injectionStrategies\n );\n\n return $refl->buildObject();\n }", "public function getBaseProduct($languageId = null) \n\t{\t\n\t\t$baseProduct = $this->getTableFields('product');\n\t\tunset($baseProduct['product_id']);\t\t\n\n\t\t$baseProductDescription = $this->getTableFields('product_description');\n\t\tunset($baseProductDescription['product_id']);\n\t\t\n\t\tif ($languageId == null) {\n\t\t\t$languageId = $this->config->get('config_language_id');\n\t\t}\n\t\t$baseProduct['product_description'] = array();\n\t\t$baseProduct['product_description'][$languageId] = $baseProductDescription;\n\t\t\n\t\treturn $baseProduct;\t\n\t}", "function getProductInfos($oid){\n if (!isset($this->products[$oid])){\n $r = array('pool'=>NULL, 'ticket'=>NULL, 'person'=>NULL, 'taarticleno'=>NULL);\n $selectedfields = array('tapool', 'taperson', 'taticket', 'prdconf');\n if ($this->xwtscatalog->fieldExists('taarticleno')){\n $selectedfields[] = 'taarticleno';\n }\n $dp = $this->xwtscatalog->display(array('oid'=>$oid,\n 'selectedfields'=>$selectedfields,\n 'options'=>array('tapool'=>array('target_fields'=>array('prjno', 'poolno')),\n 'taperson'=>array('target_fields'=>array('ptno')),\n 'prdconf'=>array('target_fields'=>array('calendar')),\n 'taticket'=>array('target_fields'=>array('tapool', 'ttno'))\n )\n )\n );\n $r['project'] = $dp['otapool']->link['oprjno']->raw;\n $r['pool'] = $dp['otapool']->link['opoolno']->raw;\n $r['ticket'] = $dp['otaticket']->link['ottno']->raw;\n $r['person'] = $dp['otaperson']->link['optno']->raw;\n $r['calendartype'] = $dp['oprdconf']->link['ocalendar']->link['otype']->raw;\n if (isset($dp['otaarticleno']))\n $r['taarticleno'] = $dp['otaarticleno']->raw;\n $this->products[$oid] = $r;\n }\n return $this->products[$oid];\n }", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function build();", "public function createAddonProduct()\n {\n ++$this->productCount;\n\n // Create basic product.\n $product = $this->productFactory->createEntity();\n $this->entityManager->persist($product);\n $product->setNumber('AddonProductNumber-' . $this->productCount);\n $product->setManufacturer('EnglishManufacturer-' . $this->productCount);\n $product->setType($this->addonProductType);\n $product->setStatus($this->productStatus);\n $product->setCreated(new DateTime());\n $product->setChanged(new DateTime());\n $product->setSupplier($this->contactTestData->accountSupplier);\n $product->setOrderUnit($this->orderUnit);\n $product->setContentUnit($this->contentUnit);\n $product->setOrderContentRatio(2.0);\n $product->setTaxClass($this->taxClass);\n\n // Add prices\n $this->addPrice($product, 5.99);\n $this->addPrice($product, 3.85, 4.0);\n\n // Product translation\n $this->addProductTranslation($product);\n\n return $product;\n }", "public function build()\n {\n if(($document = $this->getDocument()) === null) {\n $document = $this->loader->getInstance(NodeLoader::DOCUMENT_NODE);\n $this->setDocument($document);\n }\n\n if(($header = $document->getHeader()) === null) {\n $header = $this->loader->getInstance(NodeLoader::HEADER_NODE);\n $document->setHeader($header);\n }\n\n if(($supplier = $header->getSupplier()) === null) {\n $supplier = $this->loader->getInstance(NodeLoader::SUPPLIER_NODE);\n $header->setSupplier($supplier);\n }\n\n if(($catalog = $header->getCatalog()) === null) {\n $catalog = $this->loader->getInstance(NodeLoader::CATALOG_NODE);\n $header->setCatalog($catalog);\n }\n\n if(($datetime = $catalog->getDateTime()) === null) {\n $datetime = $this->loader->getInstance(NodeLoader::DATE_TIME_NODE);\n $catalog->setDateTime($datetime);\n }\n\n if(($newCatalog = $document->getNewCatalog()) === null) {\n $newCatalog = $this->loader->getInstance(NodeLoader::NEW_CATALOG_NODE);\n $document->setNewCatalog($newCatalog);\n }\n\n return $document;\n }", "public function build() {}", "public function build() {}", "public function build() {}", "public function build()\n {\n return new EntityDataObject(\n $this->name,\n $this->type,\n $this->data,\n $this->linkedEntities,\n null,\n $this->vars\n );\n }" ]
[ "0.567433", "0.567433", "0.5630675", "0.5624379", "0.5624379", "0.55156046", "0.5475541", "0.5378524", "0.53736424", "0.53120536", "0.5254839", "0.5251328", "0.5201675", "0.51764864", "0.51479137", "0.5127448", "0.51158357", "0.5112923", "0.5112923", "0.5112923", "0.5112923", "0.5112923", "0.5112923", "0.5112923", "0.51122165", "0.5099884", "0.5064306", "0.5064306", "0.50641406", "0.50594604" ]
0.6952602
0
Converts ISBN10 to ISBN13 string. Taken from
private function isbn10to13($isbn10){ $isbnclean = preg_replace("/([^d])/", "",substr($isbn10,0,-1)); if (strlen($isbnclean) != 9) { return $isbn10; } $isbn="978".$isbnclean; $check=0; for ($i=0;$i<12;$i++) { $check+=(($i%2)*2+1)*$isbn[$i]; } $check=(10-($check%10))%10; return "978".substr($isbn10,0,-1).$check; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function convert10to13($isbn10)\n {\n $isbn13 = '978' . substr($isbn10, 0, 9);\n $sum = 0;\n for ($i = 0; $i < 12; $i ++) {\n if ($i % 2 == 0) {\n $sum += $isbn13{$i};\n } else {\n $sum += 3 * $isbn13{$i};\n }\n }\n $checksum = 10 - ($sum % 10);\n if ($checksum == 10) {\n $checksum = '0';\n }\n $isbn13 = $isbn13 . $checksum;\n\n $this->_isbn13 = $isbn13;\n return $this->_isbn13;\n }", "public function isbn13(): string\n {\n $code = '97' . mt_rand(8, 9) . Helper::numerify(str_repeat('#', 9));\n\n return sprintf('%s%s', $code, Ean::checksum($code));\n }", "public function isbn10(): string\n {\n $code = Helper::numerify(str_repeat('#', 9));\n\n return sprintf('%s%s', $code, Isbn::checksum($code));\n }", "public function getIsbn13()\n {\n return $this->isbn13;\n }", "function isbn13checker($input, $convert = FALSE){\n\t$output = FALSE;\n\tif (strlen($input) < 12){\n\t\t$output = array('error'=>'ISBN too short.');\n\t}\n\tif (strlen($input) > 13){\n\t\t$output = array('error'=>'ISBN too long.');\n\t}\n\tif (!$output){\n\t\t$runningTotal = 0;\n\t\t$r = 1;\n\t\t$multiplier = 1;\n\t\tfor ($i = 0; $i < 13 ; $i++){\n\t\t\t$nums[$r] = substr($input, $i, 1);\n\t\t\t$r++;\n\t\t}\n\t\t$inputChecksum = array_pop($nums);\n\t\tforeach($nums as $key => $value){\n\t\t\t$runningTotal += $value * $multiplier;\n\t\t\t$multiplier = $multiplier == 3 ? 1 : 3;\n\t\t}\n\t\t$div = $runningTotal / 10;\n\t\t$remainder = $runningTotal % 10;\n\n\t\t$checksum = $remainder == 0 ? 0 : 10 - substr($div, -1);\n\n\t\t$output = array('checksum'=>$checksum);\n\t\t$output['isbn13'] = substr($input, 0, 12) . $checksum;\n\t\tif ($convert){\n\t\t\t$output['isbn10'] = isbn13to10($output['isbn13']);\n\t\t}\n\t\tif (is_numeric($inputChecksum) && $inputChecksum != $checksum){\n\t\t\t$output['error'] = 'Input checksum digit incorrect: ISBN not valid';\n\t\t\t$output['input_checksum'] = $inputChecksum;\n\t\t}\n\t}\n\treturn $output;\n}", "public function getIsbn10()\n {\n return $this->isbn10;\n }", "public function getIsbn13()\n\t\t{\n\t\t\tif(is_null($this->data))\n\t\t\t\treturn null;\n\t\t\t\n\t\t\tif(!array_key_exists('identifiers', $this->data) || !array_key_exists('isbn_13', $this->data['identifiers']))\n\t\t\t\treturn null;\n\t\t\t\n\t\t\treturn $this->data['identifiers']['isbn_13'][0];\n\t\t}", "function isbn10checker($input, $convert = FALSE){\n\t$output = FALSE;\n\tif (strlen($input) < 9){\n\t\t$output = array('error'=>'ISBN too short.');\n\t}\n\tif (strlen($input) > 10){\n\t\t$output = array('error'=>'ISBN too long.');\n\t}\n\tif (!$output){\n\t\t$runningTotal = 0;\n\t\t$r = 1;\n\t\t$multiplier = 10;\n\t\tfor ($i = 0; $i < 10 ; $i++){\n\t\t\t$nums[$r] = substr($input, $i, 1);\n\t\t\t$r++;\n\t\t}\n\t\t$inputChecksum = array_pop($nums);\n\t\tforeach($nums as $key => $value){\n\t\t\t$runningTotal += $value * $multiplier;\n\t\t\t//echo $value . 'x' . $multiplier . ' + ';\n\t\t\t$multiplier --;\n\t\t\tif ($multiplier === 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t//echo ' = ' . $runningTotal;\n\t\t$remainder = $runningTotal % 11;\n\t\t$checksum = $remainder == 1 ? 'X' : 11 - $remainder;\n\t\t$checksum = $checksum == 11 ? 0 : $checksum;\n\t\t$output = array('checksum'=>$checksum);\n\t\t$output['isbn10'] = substr($input, 0, 9) . $checksum;\n\t\tif ($convert){\n\t\t\t$output['isbn13'] = isbn10to13($output['isbn10']);\n\t\t}\n\t\tif ((is_numeric($inputChecksum) || $inputChecksum == 'X') && $inputChecksum != $checksum){\n\t\t\t$output['error'] = 'Input checksum digit incorrect: ISBN not valid';\n\t\t\t$output['input_checksum'] = $inputChecksum;\n\t\t}\n\t}\n\treturn $output;\n}", "function isbn13Selector($isbn_id)\r\n\t{\r\n\t\tforeach($isbn_id as $iid) \r\n\t\t{\r\n\t\t\tif($iid->type=='ISBN_13')\r\n\t\t\t{\r\n\t\t\t\treturn $iid->identifier;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function getIsbn10()\n\t\t{\n\t\t\tif(is_null($this->data))\n\t\t\t\treturn null;\n\t\t\t\n\t\t\tif(!array_key_exists('identifiers', $this->data) || !array_key_exists('isbn_10', $this->data['identifiers']))\n\t\t\t\treturn null;\n\t\t\t\n\t\t\treturn $this->data['identifiers']['isbn_10'][0];\n\t\t}", "public function getIsbn13(): string|null;", "public function getIdentifiersISBN() {\n $fields = array('identifiersISBN' => array(\n 'identifier',\n ));\n $result = TingOpenformatMethods::parseFields($this->_getDetails(), $fields);\n return $result;\n }", "public function getIsbnNumber()\n {\n return $this->isbnNumber;\n }", "public function getByISBN(string $isbn): string\n {\n $subscription = $this->subscription;\n $this->subscription = null;\n $response = $this->apiClient->get(self::PATH . '/' . $isbn);\n $this->subscription = $subscription;\n \n return (string) $response->getBody();\n }", "public function getIsbn()\n {\n return $this->isbn;\n }", "public function getIsbn()\n {\n return $this->isbn;\n }", "public function getIsbn()\n {\n return $this->isbn;\n }", "static final public function modifyISBN($ISBN) {\n\t\t$url= @file_get_contents('http://toolserver.org/gradzeichen/IsbnTextFormat?Bot-Modus&Text='.$ISBN);\n\t\t$temp = explode(' ',$url);\n\t\tif ($temp[0])\n\t\t{\n\t\t\treturn $temp[0];\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $ISBN;\n\t\t}\n\t}", "public function loadISBN(){\n $sqlQuery = 'SELECT I.val FROM identifiers I , books B WHERE I.type=\"ISBN\" AND B.id = I.book AND B.id='.$this->id;\n $pdo = new SPDO($this->databasePath);\n foreach ($pdo->query($sqlQuery) as $row)\n return $row['val'];\n return \"\";\n }", "public function getDefaultIsbn13(): string|null;", "public function getISBN(): ?string\n {\n return isset($this->ISBN) ? $this->ISBN : null;\n }", "protected function _validateIsbn($isbnArray){\n \t\n \t$j = 0;\n \t$mess1 = ' is valid!';\n \t$mess2 = ' is not valid or not ISBN!';\n \tforeach ($isbnArray as $isbn){\n \t\t//13 digits isbsn\n \t\tif (strlen($isbn) == 13){\n \t\t\t$sum = 0;\n \t\t\t$res = 0;\n \t\t\tfor ($i = 0; $i < 12; $i++){\n \t\t\t\tif ($i%2 == 0){\n \t\t\t\t\t$sum += $isbn[$i]*1;\n \t\t\t\t} else {\n \t\t\t\t\t$sum += $isbn[$i]*3;\n \t\t\t\t}\n \t\t\t$res = (10 - $sum%10)%10;\n \t\t\t}\n \t\t\tif ($res == $isbn[12]){\n \t\t\t\t$this->_isbnInfo[$j]=$isbn.$mess1;\n \t\t\t\t$j++;\n \t\t\t} else {\n \t\t\t\t$this->_isbnInfo[$j]=$isbn.$mess2;\n \t\t\t\t$j++;\n \t\t\t\t}\n \t\t}\n \t\t// 10 digits isbns\n \t\tif (strlen($isbn) == 10){\n \t\t $sum = 0;\n \t\t $res = 0;\n \t\t\tfor ($k = 0; $k < 9; $k++){\n \t\t\t\t$sum += $isbn[$k]*($k+1);\n \t\t\t}\n \t\t$res = $sum%11;\n \t\tif ((($res < 10)&&($res == $isbn[9])) ||\n \t\t\t(($res == 10) &&($isbn[9]=='X')))\n \t\t\t{\n \t\t\t\t$this->_isbnInfo[$j]=$isbn.$mess1;\n \t\t\t\t$j++;\n \t\t\t}\n \t\t\telse {\n \t\t\t\t$this->_isbnInfo[$j]=$isbn.$mess2;\n \t\t\t\t$j++;\n \t\t\t}\n \t\t}\n \t}\n }", "public function getInvoiceNumber(): string\n {\n return sprintf('R-%1$02d%2$03d', $this->getInvoiceYear(), $this->id);\n }", "public function setIsbn10($isbn10)\n {\n $this->isbn10 = $isbn10;\n\n return $this;\n }", "public function asString(): string\n {\n if (is_null($this->iban)) {\n $part1 = ord('C') - ord('A') + 10;\n $part2 = ord('Z') - ord('A') + 10;\n\n $accountPrefix = 0;\n $accountNumber = $this->accountNumber;\n if (strpos($accountNumber, '-') !== false) {\n $accountParts = explode('-', $accountNumber);\n $accountPrefix = $accountParts[0];\n $accountNumber = $accountParts[1];\n }\n\n $numeric = sprintf('%04d%06d%010d%d%d00', $this->bankCode, $accountPrefix, $accountNumber, $part1, $part2);\n\n $mod = '';\n foreach (str_split($numeric) as $n) {\n $mod = ($mod . $n) % 97;\n }\n $mod = intval($mod);\n\n $this->iban = sprintf('%.2s%02d%04d%06d%010d', 'CZ', 98 - $mod, $this->bankCode, $accountPrefix, $accountNumber);\n }\n\n return $this->iban;\n }", "public function setIsbn13($isbn13)\n {\n $this->isbn13 = $isbn13;\n\n return $this;\n }", "public function getTitle(){\n\t\treturn $this->ol[\"ISBN:\".$this->isbn][\"title\"];\t\n\t}", "public function getIsbn_issn()\n {\n return $this->isbn_issn;\n }", "private function sanitiseISBN($isbn) {\n\t\tpreg_match('/[^\\s]+/', trim($isbn), $match);\n\t\treturn (isset($match[0])) ? $match[0] : null;\n\t}", "function setISBN($book_isbn){\t\n\t\t$result = file_get_contents('http://openlibrary.org/api/books?bibkeys=ISBN:'.$book_isbn.'&format=json&jscmd=data');\n\t\t$this->ol = json_decode($result, TRUE);\t\t\t\n\t\t$this->isbn = $book_isbn;\n\t\t\n\t}" ]
[ "0.7752301", "0.69664115", "0.683384", "0.65942186", "0.63080627", "0.6307712", "0.61868817", "0.61771363", "0.61431986", "0.5945208", "0.5832819", "0.5708205", "0.5654722", "0.5618333", "0.5520768", "0.5519655", "0.5519655", "0.55044407", "0.531368", "0.5266902", "0.5264451", "0.524977", "0.5235721", "0.51902837", "0.5160583", "0.5110362", "0.5052034", "0.50471807", "0.4980943", "0.4968428" ]
0.8058322
0
Retrieve Blurb Text from ONIX data
public function getBlurb() { // check if there is text available in the onix message // and return as Blurb if it exists $records = $this->product->get('OtherText'); foreach ($records as $record) { if($record->getType() == 18) { return $record->getValue(); } } return false; /* Original SQL statement from spMacSelectProductsFairnopoly.sql: > update macSelectProducts > set Blurb = > cast(( > select top 1 OtherText from refProductOtherText > where macSelectProducts.ProductReference = refProductOtherText.ProductReference > and refProductOtherText.TextTypeCode = '18') > as varchar(4000)) */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_featureblurb() {\n\t\tglobal $product;\n\t\tif ( is_front_page() ) {\n\t\t\t$content = get_post_meta( $product->id, 'featureblurb', true );\n\t\t\tif ( $content ) {\n\t\t\t\techo( '<div class=\"featureblurb\">' . html_entity_decode( $content ) . '</div>' );\n\t\t\t}\n\t\t}\n\t}", "public function getBodyText();", "function getTextContent() {\n\t\treturn $this->lobSub->lobText;\n\t}", "function getSuburb()\n\t{\n\t\t// Load the Suburb data\n\t\tif ($this->_loadSuburb())\n\n\t\treturn $this->_suburb;\n\t}", "public function getBillText() {\n \n $contentsUrl = $this->getBillTextUrl();\n \n // If no URL that means there is no bill text to download yet (boo)\n if ($contentsUrl == false)\n return false;\n\n // Base URL for all pages same as the first URL, but with different file name,\n // so we want to strip that.\n $baseUrl = $contentsUrl;\n $baseUrl = preg_replace(\"/[^\\/]*$/\", '', $baseUrl);\n \n $ch = curl_init();\n $timeout = 10;\n curl_setopt($ch, CURLOPT_URL, $contentsUrl);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);\n $response = curl_exec($ch);\n curl_close($ch);\n\n // Get all the HTML pages for the bill from the page control\n $matches = array();\n preg_match(\"/\\<p class=\\\"LegNavTextBottom\\\"\\>.*\\<\\/p\\>/\", $response, $matches);\n \n if (!isset($matches[0]))\n return false;\n\n $billPages = array(); \n $regexp = \"<a\\s[^>]*href=(\\\"??)([^\\\" >]*?)\\\\1[^>]*>(.*)<\\/a>\";\n if (preg_match_all(\"/$regexp/siU\", $matches[0], $matches, PREG_SET_ORDER)) {\n foreach($matches as $match) {\n array_push($billPages, $baseUrl.$match[2]);\n }\n }\n \n // Get the stripped HTML for each seperate page and stitch them all together\n $billText = '';\n foreach ($billPages as $url) {\n $billText .= $this->getBillPageHtml($url);\n }\n\n return $billText;\n }", "function detect_bing($data)\n\t {\n\t \t //\n\t \t //print_r($data);\n\t \t $api = 'F0DE0CCB37335B16E7EB0BD3FA2A3C9FD3543DE5';\n\t \t \n\t \t if(empty($data['text']))\n\t\t { \n\t\t return ''; \n\t\t } \n\t\t \t\t \n\t\t $url = \"http://api.microsofttranslator.com/v2/Http.svc/Detect?appId=\".$api.\"&text=\".urlencode($data['text']); \n\t\t \n\t\t //echo $url;\n\t\t \n\t\t if (function_exists('curl_init')) \n\t\t { \n\t\t $curl = curl_init(); \n\t\t curl_setopt($curl, CURLOPT_URL, $url); \n\t\t curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); \n\t\t $res = curl_exec($curl); \n\t\t } \n\t\t else \n\t\t { \n\t\t $res = @file_get_contents($url); \n\t\t }\n\t\t \t\t \n\t\t preg_match(\"~<string([^><]*?)>([\\s\\S]*?)<\\/string>~i\", $res, $ostr); \n\t\t //print_r($ostr);\n\t\t if (empty($ostr[2])) \n\t\t { \n\t\t return ''; \n\t\t } \n\t\t else \n\t\t { \n\t\t $code_str = htmlspecialchars_decode($ostr[2]); \n\t\t $arr = explode(\"-\",$code_str);\n\t\t return (count($arr)>1) ? $arr[0] : $code_str;\n\t\t } \n\t }", "public function getTextContent();", "public function getBrief() {\n\t\t$baseUrl = \"http://\" . $_SERVER['SERVER_NAME'] . Director::BaseURL();\n\t\t$themeDir = $baseUrl . 'themes/' . SSViewer::current_theme();\n\t\t$html = '<div class=\"brief\">\n\t\t\t\t\t<div class=\"cell\" >'.$this->statusButton().'</div>\n\t\t\t\t\t<div class=\"cell weather\"><img src=\"'.$themeDir.'/images/weather_report/'.$this->getWeatherBrief().'.png\" alt=\"weather-icon\" /></div>\n\t\t\t\t\t<div class=\"cell temp\">'.$this->getWeatherTempurature().'&deg;</div>\n\t\t\t\t\t<div class=\"cell snowfall\">\n\t\t\t\t\t\tLast Snowfall<br />\n\t\t\t\t\t\t<span class=\"amount\">'.$this->getLatestFall().'cm</span><br />\n\t\t\t\t\t\t\ton '.$this->getLatestFallDate().'\n\t\t\t\t\t</div>\n\t\t\t\t</div>';\n\t\treturn $html;\n\t}", "public function getSearchQBis()\n {\n return $this->getFormattedText('description');\n }", "public function get_text()\n {\n }", "public function getText() {\n return $this->data->text;\n }", "public function getblogContent(): string {\n\t\treturn ($this->blogContent);\n\t}", "public function getDescription() {\r\n\t\t$tmp_body = strip_tags($this -> body);\r\n\t\t$description = Engine_Api::_() -> ynblog() -> subPhrase($tmp_body, 150);\r\n\t\treturn $description;\r\n\t}", "protected function getBio()\n\t{\n\t\treturn apply_filters('the_author_description', $this->rawDescription, $this->id);\n\t}", "protected function getBody() {\n $db = DBManager::get();\n $stmt = $db->prepare('SELECT body FROM plugin_rich_text WHERE range_id = ?');\n $stmt->execute(array(Utils\\getSeminarId()));\n return Purifier\\purify($stmt->fetchColumn());\n }", "public function getInfotext()\n {\n return $this->_infotext;\n }", "public function getTextEntity();", "public function biography();", "public function getText();", "public function getText();", "public function getText();", "public function bold($text) {\n return $this->begin() . $this->formats['bold'] . $text . $this->end();\n }", "function getFamilyIntroText($familyId) {\n $dbh = Doctrine_Manager::connection()->getDbh();\n $sth = $dbh->query('SELECT text_content FROM families_fr WHERE id = '.$familyId);\n $row = $sth->fetch(PDO::FETCH_ASSOC);\n return $row['text_content'];\n }", "public function bbcodeAction() : object\n {\n $title = \"BBcode\";\n $text = file_get_contents(__DIR__ . \"/textfiles/bbcode.txt\");\n // $filter = new MyTextFilter();\n\n // Deal with the action and return a response.\n $this->app->page->add(\"textfilter/bbcode\", [\n \"text\" => $text,\n \"html\" => $this->filter->parse($text, [\"bbcode\"])\n ], \"main\");\n return $this->app->page->render([ \"title\" => $title ]);\n }", "public function actionBisnis() {\n $strata = new WStrata('search');\n $strata->unsetAttributes(); // clear any default values\n if (isset($_GET['WStrata']))\n $strata->attributes = $_GET['WStrata'];\n \n $this->render('bisnis', array(\n 'strata' => $strata,\n ));\n }", "function getDescriptionB() {\r\r\n\t\treturn $this->descriptionB;\r\r\n\t}", "public function getText() {\n\t\treturn html_entity_decode($this->text);\n\t}", "public function getBio()\n {\n return $this->bio;\n }", "public function getBio()\n {\n return $this->bio;\n }", "public function getText(){\n return $this->TEXT;\n }" ]
[ "0.6004652", "0.59671986", "0.5666079", "0.5549008", "0.5529162", "0.54114276", "0.54049116", "0.53617334", "0.53467906", "0.5331171", "0.5294811", "0.5259774", "0.5241196", "0.520316", "0.5161109", "0.5139849", "0.5134706", "0.51287276", "0.5109651", "0.5109651", "0.5109651", "0.5104748", "0.50912225", "0.50548816", "0.50510013", "0.50430834", "0.5037806", "0.5036474", "0.5036474", "0.50339264" ]
0.7552279
0
Threads have many views.
public function views() { return $this->hasMany('App\Models\ViewedThread'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function threads()\n\t{\n\n\t\t// get sort type\n\n\n\t\t$query = Thread::where('parent_id', null)->with('user')->with('topic')->limit(20);\n\n\t\t$sort = get_string('sort', 'newest');\n\n\t\t$topic = get_int('topic', false);\n\n\t\tif($topic)\n\t\t\t$query->where('topic_id', $topic);\n\n\t\tThread::setOrder($query, $sort);\n\n\t\t$threads = $query->get();\n\n\t\t$topics = Topic::all();\n\n\t\treturn view('threads.index', compact('threads', 'sort', 'topics'));\n\t\n\t}", "public function updateViews()\r\n {\r\n if ($this->isViewTimelimit()) {\r\n return -1;\r\n }\r\n\r\n $this->views_seen++;\r\n $this->last_viewed_at = JFactory::getDate()->toSql();\r\n\r\n if ($this->views_bought > 0 && $this->views_seen == $this->views_bought) {\r\n $this->active = 0;\r\n }\r\n\r\n return $this->store();\r\n }", "public function view(User $user, Thread $thread)\n {\n //da implementare\n }", "public function index()\n {\n if (!is_logged_in()) {\n redirect(url('user/index'));\n }\n\n $thread_count = Thread::getNumRows();\n $pagination = pagination($thread_count);\n $threads = Thread::getAll($pagination['max']);\n $this->set(get_defined_vars());\n }", "public function viewedBy()\n {\n return $this->belongsToMany(\n 'App\\Models\\User',\n 'viewed_threads',\n 'thread_id',\n 'user_id'\n )\n ->using('App\\Models\\ViewedThread')\n ->withPivot('timestamp');\n }", "public function index()\n {\n $threads = DB::table('thread')->get();\n\n return view ('threads.index') -> with ('threads', $threads );\n }", "public function index()\n {\n $threads = Thread::all();\n $threads->load('posts', 'author');\n\n return view('threads.index', compact('threads'));\n }", "public function index() {\n $threads_1 = DB::table('threads')\n ->join('users','users.id', '=', 'threads.user_id')\n ->select('threads.*', 'users.name')\n ->where('threads.category', '=', '1')\n ->orderBy('updated_at', 'desc')\n ->get();\n $threads_2 = DB::table('threads')\n ->join('users','users.id', '=', 'threads.user_id')\n ->select('threads.*', 'users.name')\n ->where('category', '=', '2')\n ->orderBy('updated_at', 'desc')\n ->get();\n $threads_3 = DB::table('threads')\n ->join('users','users.id', '=', 'threads.user_id')\n ->select('threads.*', 'users.name')\n ->where('category', '=', '3')\n ->orderBy('updated_at', 'desc')\n ->get();\n $threads_4 = DB::table('threads')\n ->join('users','users.id', '=', 'threads.user_id')\n ->select('threads.*', 'users.name')\n ->where('category', '=', '4')\n ->orderBy('updated_at', 'desc')\n ->get();\n \treturn view('thread', ['threads_1' => $threads_1, 'threads_2' => $threads_2, \n 'threads_3' => $threads_3, 'threads_4' => $threads_4]);\n }", "public function index()\n {\n $threads = Thread::with('user', 'votes')->withCount('replies')->latest()->paginate(10);\n // return $threads;\n return view('pertanyaan.index', compact('threads'));\n }", "public function index()\n {\n $threads = Thread::with('user')->paginate(5);\n return view(\"threads.index\",compact('threads'));\n }", "public function index()\n {\n $groups = Chat::getAllGroupConversations();\n $threads = Chat::getAllConversations();\n \n \n \n $newCollection = $threads->map(function($value,$key) {\n return $value->user->id ;\n});\n\n \n $users = User::where('id', '!=', auth()->id())->get();\n\n return view('home')->with([\n 'threads' => $threads,\n 'groups' => $groups,\n 'users'=>$users\n ]);\n }", "public function index()\n {\n $user = Auth::user();\n\n $threads = DB::table('threads')->where('user_id', '=', $user->id)->get();\n\n $count_posts = DB::table('posts')->where('user_id', '=', $user->id)->count();\n\n $count_threads = DB::table('threads')->where('user_id', '=', $user->id)->count();\n\n return view('users/index', ['user' => $user, 'count_posts' => $count_posts, 'count_threads' => $count_threads, 'threads' => $threads]);\n\n }", "public function index()\n {\n // All threads that user is participating in\n $threads = Thread::forUser(Auth::id())->latest('updated_at')->get();\n foreach ($threads as $key => $thread) {\n $users = User::whereIn('id', $thread->participantsUserIds())->get();\n $senderAvatar = str_replace('storage/owner/', 'img/cache/small-avatar/', Storage::url($users[1]->avatar_name));\n $cafe = Cafe::where('owner_id', Owner::where('user_id', $users[0]->id)->first()->id)->first();\n $threads[$key]->cafeLogo = str_replace('storage/logo/', 'img/cache/small-logo/', Storage::url($cafe->logo_path));\n $threads[$key]->users = $users;\n $threads[$key]->senderAvatar = $senderAvatar;\n }\n return view('messenger.index', compact('threads'));\n }", "public function run()\n {\n $assigned_projects = DB::table('project_assignments')->select('project_id','user_id')->get();\n //lets say that each users view around 200-500 times on project they owned\n $total = $assigned_projects->count();\n $idx = 0;\n foreach($assigned_projects as $assign_project)\n {\n if($idx%200==0)\n $this->command->info('Project View seeds: '.$idx.' items out of '.$total);\n $idx++;\n $date_creation =DB::table('projects')->select('created_at')->where('id','=',$assign_project->project_id)->get()[0]->created_at;\n // $this->command->info(json_encode($assign_project));\n $last_dateView = strtotime($date_creation)+rand(7776000,15552000);\n\n ProjectView::create(array(\n 'project_id'=>$assign_project->project_id,\n 'user_id'=>$assign_project->user_id,\n 'view_count'=>rand(200,500),\n 'last_visited'=>date(\"Y-m-d H:i:s\",$last_dateView)\n ));\n }\n\n //lets say that each users view around 30-100 times on 20-50 projects they are not owned\n $user_num = User::count();\n $project_num = Project::count();\n $project_limit = require('Config.php');\n for($id=1;$id<=$user_num;++$id)\n {\n if($id%20==0)\n $this->command->info('Random Project View seeds: '.$id.' items out of '.$user_num);\n $projects_viewed_num = rand($project_limit['projects']['min_random_view'],$project_limit['projects']['max_random_view']);\n for($j=0;$j<$projects_viewed_num;++$j)\n {\n $rand_project = rand(1,$project_num);\n $date_creation =DB::table('projects')->select('created_at')->where('id','=',$rand_project)->get()[0]->created_at;\n if(DB::table('project_views')->select('project_id')->where('project_id','=',$rand_project)->get()->count()>0)\n continue;\n //$this->command->info(json_encode($assign_project));\n $last_dateView = strtotime($date_creation)+rand(7776000,15552000);\n $this->command->info($last_dateView);\n ProjectView::create(array(\n 'project_id'=>$rand_project,\n 'user_id'=>$id,\n 'view_count'=>rand(30,100),\n 'last_visited'=>date(\"Y-m-d H:i:s\",$last_dateView)\n ));\n }\n }\n }", "public function index()\n {\n $threads= Thread::with('tags' ,'video' ,'video.videoDetails')->get();\n return view('home', compact('threads'));\n\n }", "function erpal_projects_helper_views_post_execute(&$view) {\n _erpal_projects_helper_view_timetracking_entites_post_execute($view);\n}", "protected function get_views()\n {\n }", "protected function get_views()\n {\n }", "protected function get_views()\n {\n }", "protected function get_views()\n {\n }", "public function generate($totalElements)\n\t{\n\t\t$this->initialize();\n\n\t\t$db = XenForo_Application::getDb();\n\t\t$sql = \"\n\t\t\tSELECT * FROM xf_thread thread\n\t\t\tWHERE\n\t\t\t\tthread_id > ? AND\n\t\t\t\tdiscussion_state = 'visible' AND\n\t\t\t\tdiscussion_type <> 'redirect'\n\t\t\tORDER\n\t\t\t\tBY thread.thread_id\n\t\t\t\";\n\t\t$st = new Zend_Db_Statement_Mysqli($db, $sql);\n\t\t$st->execute( array( $this->lastId ) );\n\n\t\t$totalPages = 0;\n\t\twhile ($data = $st->fetch())\n\t\t{\n\t\t\t$this->lastId = $data['thread_id'];\n\t\t\tif (!$this->canView($data))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$totalPages = $this->getTotalpages($data['thread_id']);\n\t\t\tif ($totalPages < 2)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\twhile ($this->lastPage <= $totalPages)\n\t\t\t{\n\t\t\t\t$params = array( 'page' => $this->lastPage, );\n\t\t\t\t$url = XenForo_Link::buildPublicLink('canonical:threads', $data, $params);\n\t\t\t\t$this->addUrl($url, $data['post_date']);\n\n\t\t\t\t$this->lastPage++;\n\n\t\t\t\t$totalElements--;\n\t\t\t\tif ($totalElements <= 0)\n\t\t\t\t{\n\t\t\t\t\tbreak 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->lastPage = 2;\n\t\t}\n\n\t\t$this->isFinished = !$st->fetch() && $this->lastPage > $totalPages;\n\t\t$st->closeCursor();\n\t}", "public function views()\n {\n }", "public function views()\n {\n }", "public function views()\n {\n }", "public function index()\n {\n\n $threads = Thread::forUser(Auth::id())->with([\n 'users' => function ($query) {\n $query->select('avatar', 'name', 'agent_name');\n },\n 'messages' => function ($query) {\n $query->latest()->first();\n },\n ])\n ->groupBy('threads.id')\n ->latest('updated_at')\n ->paginate();\n\n $threads->getCollection()->transform(function ($value) {\n $value->isUnread = $value->isUnread(Auth::id());\n\n return $value;\n });\n\n\n return response()->json($threads);\n }", "public function userViews()\n {\n $system = \\Config::get('tenant_system');\n //$system = \\Auth::user()->system;\n //all of the possible views\n// $system_id = session('system');\n// $system = System::find($system_id);\n $views = $system->views();\n\n //Views for the role - limited results\n $query = \\DB::table('role_view');\n $query->where('role_id', '=', $this->id);\n $results = $query->get();\n\n //we need to manually add the name back in for the view\n foreach ($results as $result)\n {\n foreach ($views as $view)\n {\n if ($result->view_id == $view->id)\n {\n $result->name = $view->name;\n $result->icon = $view->icon;\n $result->route = $view->route;\n $result->place = $view->place;\n\n }\n }\n }\n foreach ($results as $result)\n {\n if ($result->access != 'none')\n {\n $return[] = $result;\n }\n }\n\n return $return;\n\n\n }", "function run()\r\n {\r\n $ids = Request :: get(RepositoryManager :: PARAM_USER_VIEW);\r\n\r\n $failures = 0;\r\n\r\n if (! empty($ids))\r\n {\r\n if (! is_array($ids))\r\n {\r\n $ids = array($ids);\r\n }\r\n\r\n foreach ($ids as $user_view_id)\r\n {\r\n $uv = new UserView();\r\n $uv->set_id($user_view_id);\r\n\r\n if (! $uv->delete())\r\n {\r\n $failures ++;\r\n }\r\n }\r\n\r\n if ($failures)\r\n {\r\n if (count($ids) == 1)\r\n {\r\n $message = Translation :: get('ObjectNotDeleted', array('OBJECT' => Translation :: get('UserView')), Utilities :: COMMON_LIBRARIES);\r\n }\r\n else\r\n {\r\n $message = Translation :: get('ObjectsNotDeleted', array(\r\n 'OBJECT' => Translation :: get('UserViews')), Utilities :: COMMON_LIBRARIES);\r\n }\r\n }\r\n else\r\n {\r\n if (count($ids) == 1)\r\n {\r\n $message = Translation :: get('ObjectDeleted', array('OBJECT' => Translation :: get('UserView')), Utilities :: COMMON_LIBRARIES);\r\n }\r\n else\r\n {\r\n $message = Translation :: get('ObjectsDeleted', array('OBJECT' => Translation :: get('UserViews')), Utilities :: COMMON_LIBRARIES);\r\n }\r\n }\r\n\r\n $this->redirect($message, $failures ? true : false, array(\r\n Application :: PARAM_ACTION => RepositoryManager :: ACTION_BROWSE_USER_VIEWS));\r\n }\r\n else\r\n {\r\n $this->display_error_page(htmlentities(Translation :: get('NoObjectSelected', array(\r\n 'OBJECT' => Translation :: get('UserView')), Utilities :: COMMON_LIBRARIES)));\r\n }\r\n }", "function get_views()\n\t{\n\t\treturn $this->views;\n\t\t//return get_views($this->id);\n\t}", "public function compose(View $view)\n {\n $user = \\Auth::user();\n if ($user)\n {\n // Auto update logged user to active status\n Active::addUser($user);\n\n $view->with('user', $user);\n $view->with('gravatar_url', $user->gravatar);\n\n $activeGuests = ActiveGuest::count();\n $view->with('active_guests', $activeGuests);\n\n $activeUsers = ActiveUser::count();\n $view->with('active_users', $activeUsers);\n\n $messagesCount = AdminMessageStatus::where('messageStatus', 0)->where('adminUsername', $user->username)->count();\n $view->with('messagesCount', $messagesCount);\n\n $ticketsCount = AdminTicketStatus::where('ticket_status', 0)->count();\n $view->with('ticketsCount', $ticketsCount);\n\n $messages = AdminMessage::join('tbl_admin_message_status', 'tbl_admin_message.messageID', '=', 'tbl_admin_message_status.messageID')\n ->where('tbl_admin_message_status.adminUsername', $user->username)->where('messageStatus', 0)\n ->orderBy('statusUpdated', 'desc')->limit(5)->get();\n $view->with('messages', $messages);\n }\n }", "public function viewed($channel)\n {\n $service = new ThreadsService();\n $threads = $channel->threads()->get();\n $user = auth()->user();\n\n foreach ($threads as $thread) {\n $service->viewed($thread, $user);\n }\n\n return $channel;\n }" ]
[ "0.6227774", "0.6065797", "0.58746225", "0.5841943", "0.58096045", "0.57834", "0.57736015", "0.5746879", "0.5743991", "0.57399094", "0.564211", "0.56412166", "0.55708474", "0.5564394", "0.55544937", "0.5502142", "0.549396", "0.549396", "0.549396", "0.549396", "0.54552364", "0.54536915", "0.54520184", "0.54520184", "0.5406648", "0.5402039", "0.5387732", "0.53797543", "0.5379175", "0.5374076" ]
0.62835604
0
Threads belong to many viewers (Users) through ViewedThread.
public function viewedBy() { return $this->belongsToMany( 'App\Models\User', 'viewed_threads', 'thread_id', 'user_id' ) ->using('App\Models\ViewedThread') ->withPivot('timestamp'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function views()\n {\n return $this->hasMany('App\\Models\\ViewedThread');\n }", "public function favoriteThreads($userid, $threads);", "public function threads()\n {\n return $this->hasMany(thread::class);\n }", "public function threads()\n {\n return $this->hasMany('App\\Thread');\n }", "public function threads()\n {\n return $this->hasMany('App\\Thread');\n }", "public function authenticated_user_may_participate_in_forum_threads()\n {\n \t// Given we have an authenticated user.\n \t$user = factory('App\\User')->create();\n \t$this->be($user);\n \t// Given we have a thread.\n \t$thread = factory('App\\Thread')->create();\n \t// Given we have a reply.\n \t$reply = factory('App\\Reply')->make();\n \t// The user submits a reply.\n \t// $this->post('threads/'.$thread->id.'/replies', $reply->toArray()); also works\n \t$this->post($thread->path().'/replies', $reply->toArray());\n \t$this->get($thread->path())->assertSee($reply->body);\n }", "public function threads(){\n return $this->belongsToMany('App\\Thread');\n }", "public function threads()\n {\n return $this->hasMany(Thread::class);\n }", "public function an_authenticated_user_can_participate_in_forum_threads()\n {\n //given we have an authernticated user\n $this->be($user = factory('App\\User')->create());\n // and an existing threads\n $thread = factory('App\\Thread')->create();\n // when a user adds a reply to thread\n $reply = factory('App\\Reply')->make();\n $this->post('/threads/'.$thread->id.'/replies', $reply->toArray());\n // then their reply should be visible in the page.\n $this->get($thread->path())\n -> assertSee($reply->body);\n }", "public function an_authenticated_user_may_participate_in_a_thread(){\n //Given we have an authenticated user\n //$user = factory('App\\User')->create();\n $this->be($user = factory('App\\User')->create());\n //And an existing thread\n $thread = factory('App\\Thread')->create();\n\n //When the user adds a reply to the thread\n $reply = factory('App\\Reply')->make();\n\n $this->post($thread->path().'/replies', $reply->toArray());\n\n //then their reply should be visible on the page\n $this->get($thread->path())->\n assertSee($reply->body);\n }", "public function threads()\n {\n return $this->morphedByMany('App\\Thread', 'taggable');\n }", "public function threads(){\n \treturn $this->HasMany('App\\Models\\MessageThread', 'room_id');\n }", "public function subscribeThreads($userid, $threads);", "public function getThreads()\n {\n $user = request()->user();\n\n $messages = $user->threadsWithMessagesWithUsers($user->id)->get();\n\n /**\n * Returns unread messages given the userId.\n */\n //$messages = Message::unreadForUser($user->id)->get();\n\n return ThreadsResource::collection($messages);\n //return response()->json($messages);\n }", "public function threads()\n\t{\n\n\t\t// get sort type\n\n\n\t\t$query = Thread::where('parent_id', null)->with('user')->with('topic')->limit(20);\n\n\t\t$sort = get_string('sort', 'newest');\n\n\t\t$topic = get_int('topic', false);\n\n\t\tif($topic)\n\t\t\t$query->where('topic_id', $topic);\n\n\t\tThread::setOrder($query, $sort);\n\n\t\t$threads = $query->get();\n\n\t\t$topics = Topic::all();\n\n\t\treturn view('threads.index', compact('threads', 'sort', 'topics'));\n\t\n\t}", "public function sender()\n {\n \t// TODO: dodaj u User modelu funkciju koja ce da ti vrati sve thread-ove gde si ili sender ili receiver\n\n\n \t// tu treba da se radi query nad Thread modelom ...\n \t// izvadi sve thread-ove gde je sender_id ili receiver_id ulogovani korisnik\n return $threads = \\Auth::user()->treads();\n \t// priveri samo na laravel dokumentaciji kako se ovo pise\n \t\n \treturn $this->belongsTo(User::class, 'sender_id');\n }", "public function viewed($channel)\n {\n $service = new ThreadsService();\n $threads = $channel->threads()->get();\n $user = auth()->user();\n\n foreach ($threads as $thread) {\n $service->viewed($thread, $user);\n }\n\n return $channel;\n }", "public function test_an_authenticated_user_may_participate_in_forum_threads()\n {\n $this->be($user = factory('App\\User')->create();\n\n $thread = factory('App\\Thread')->create();\n\n $reply = factory('App\\Reply')->make();\n\n $this->post('/threads/'.$thread->id.'/replies',$reply->toArray());\n\n $this->get('/threads'.$thread->id);\n\n }", "public function view(User $user, Thread $thread)\n {\n //da implementare\n }", "public function test_an_authenticated_user_may_participate_in_forum_threads()\n {\n $this->be($user = factory('App\\User')->create());\n \n //Add an existing thread\n $thread = factory('App\\Thread')->create();\n \n //when the user add replies to thread\n $reply = factory('App\\Reply')->create();\n $this->post('/thread/' . $thread->id . '/replies', $reply->toArray());\n }", "public function viewed($thread, $user)\n {\n ViewedThread::updateOrCreate(\n ['user_id' => $user->id, 'thread_id' => $thread->id],\n ['timestamp' => Carbon::now()]\n );\n }", "function loadThreads($user_id)\n\t\t{\n\t\t\t$query=sqlite_query($this->connection, \"SELECT member1_id, member2_id, date_created FROM thread WHERE '$user_id' in (member1_id, member2_id) AND valid='yes' ORDER BY thread_id DESC\");\n\t\t\twhile ($row = sqlite_fetch_array($query))\n\t\t\t{\n\t\t\t\t$row[0]=$this->loadUser($row[0]);\n\t\t\t\t$row[1]=$this->loadUser($row[1]);\n\t\t\t}\n\t\t\treturn $row;\n\t\t}", "public function test_a_channel_consists_of_threads()\n {\n $channel=create('App\\Channel');\n $thread=create('App\\Thread',['channel_id' => $channel->id]);\n\n //dd($channel->threads,$thread);\n $this->assertTrue($channel->threads->contains($thread));\n // $reply= factory('App\\Reply')->create();\n\n // $this->assertInstanceOf('App\\User',$reply->owner);\n }", "public function index()\n {\n // All threads that user is participating in\n $threads = Thread::forUser(Auth::id())->latest('updated_at')->get();\n foreach ($threads as $key => $thread) {\n $users = User::whereIn('id', $thread->participantsUserIds())->get();\n $senderAvatar = str_replace('storage/owner/', 'img/cache/small-avatar/', Storage::url($users[1]->avatar_name));\n $cafe = Cafe::where('owner_id', Owner::where('user_id', $users[0]->id)->first()->id)->first();\n $threads[$key]->cafeLogo = str_replace('storage/logo/', 'img/cache/small-logo/', Storage::url($cafe->logo_path));\n $threads[$key]->users = $users;\n $threads[$key]->senderAvatar = $senderAvatar;\n }\n return view('messenger.index', compact('threads'));\n }", "public function run()\n {\n Session::find(1)->teachers()->attach(1);\n Session::find(2)->teachers()->attach(1);\n Session::find(1)->teachers()->attach(2);\n Session::find(2)->teachers()->attach(2);\n }", "public function checkThread(Request $request)\n {\n\n $threadid = $request->get('threadid');\n $original = $request->get('studentsids');\n $ids = $original . ',' . Auth()->id();\n $objThreadP = new ThreadParticipant();\n $objThread = new Thread();\n $authid = Auth::user()->id;\n $reverseIds = Auth()->id() . ',' . $original;\n if (empty($threadid)) {\n $haveit = $objThreadP->checkThreadParticipant($ids);\n if ($haveit == 0) {\n $haveit = $objThreadP->checkThreadParticipant($reverseIds);\n if ($haveit > 0) {\n $ids = $reverseIds;\n }\n }\n if ($haveit > 0) {\n $threadidobj = $objThreadP->getThreadId($ids);\n $threadid = $threadidobj['thread_id'];\n } else {\n $threadid = $objThread->createThread($authid);\n //Insert Participant in this thread\n $objThreadP->assignParticipantInThread($ids, $threadid);\n $userids = explode(',', $ids);\n foreach ($userids as $userid) {\n \\Event::fire(new App\\Events\\Thread($threadid, $userid));\n }\n }\n }\n $objmessage = new Message();\n $message = $objmessage->getThreadMessages($threadid);\n $students = $objmessage->getChatUsers($ids);\n $ouput = view(\"teacher.chat-messages\", compact('message', 'threadid', 'students', 'original'))->render();\n return response()->json([\n 'threadid' => $threadid,\n 'message' => $ouput\n ]);\n }", "public function test_can_see_threads_or_replies_created_by_one_user_on_his_profile_with_latest_first()\n {\n // And there's 3 threads created by him\n // When i access his profile\n // Then i can see those 3 threads in order from latest to oldest\n $user = create(User::class);\n $this->signIn($user);\n\n $item1 = $this->createWithActivity(Thread::class, [\n 'user_id' => $user->id,\n 'created_at' => Carbon::parse('3 days ago')\n ]);\n\n $item2 = $this->createWithActivity(Thread::class, [\n 'user_id' => $user->id,\n 'created_at' => Carbon::now()->subDay()\n ]);\n\n $item3 = $this->createWithActivity(Reply::class, [\n 'user_id' => $user->id,\n 'created_at' => Carbon::now()->subDays(2),\n 'thread_id' => $item1->id\n ]);\n\n $response = $this->get(\"/profiles/{$user->name}\");\n\n $response->assertStatus(200);\n $response->assertSeeTextInOrder([\n $item2->title,\n $item3->body,\n $item1->title,\n ]);\n }", "public static function getCountThreadsByUserId($id)\n\t{\n\t\treturn (int) FrontendModel::getDB()->getVar(\n\t\t\t'SELECT count(pts.id)\n\t\t\t FROM profiles_thread_status AS pts\n\t\t\t WHERE pts.receiver_id = ?', (int) $id\n\t\t);\n\t}", "private function filterThreads(\\XF\\Finder\\Thread $finder, $user_id, $page, $perPage)\n {\n $filters = $this->getThreadLogFilterInput($user_id);\n\n $finder->where('Forum.shinka_thread_log', true);\n $this->applyFilters($finder, $filters);\n $finder->limitByPage($page, $perPage, $perPage * 2);\n $threads = $finder->fetch()\n ->filter(function(Thread $thread)\n {\n return $thread->canView();\n })\n ->slice(0, $perPage, true);\n\n return $threads;\n }", "public function workers()\n {\n return $this->belongsToMany(\"App\\User\")\n ->where(\"owner_id\", Auth::id());\n }" ]
[ "0.64863783", "0.6115233", "0.58442837", "0.5840202", "0.5840202", "0.5837736", "0.58362126", "0.573146", "0.57066077", "0.57065344", "0.56756526", "0.56379545", "0.5579365", "0.55518365", "0.54680085", "0.5441456", "0.5403752", "0.53617686", "0.53530246", "0.5348783", "0.52709043", "0.52515846", "0.5249233", "0.5218291", "0.52128756", "0.5204931", "0.50757384", "0.5059323", "0.50484616", "0.50197566" ]
0.7057228
0